Merge branch 'main' of https://git.nianxx.cn/wangxuming/makelore
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-09-07 20:28:05 +08:00
71 changed files with 1478 additions and 2170 deletions

View File

@@ -5,7 +5,6 @@ import type {
} from '../../shared/coding-plugins';
import { isProjectWideCodingPluginId } from '../../shared/coding-plugins';
import {
CORE_CODING_SKILL_IDS,
type CodingSkillId,
} from '../../shared/coding-skills';
import {
@@ -218,13 +217,13 @@ function validateBinding(value: AccountBinding | null): AccountBinding | null {
}
/**
* A raw Skill ID is the public assignment key. Marketplace packages cannot
* shadow a core Skill or an already accepted package owner; the project
* A raw Skill ID is the public assignment key. Marketplace packages cannot
* shadow a code-owned plugin Skill or an already accepted package owner; the project
* assignment is retained, but the later package contributes no resources.
*/
function marketplaceSkillConflicts(records: readonly DefinitionRecord[]): ReadonlySet<string> {
const blocked = new Set<string>();
const owned = new Set<string>(CORE_CODING_SKILL_IDS);
const owned = new Set<string>();
for (const { definition } of records) {
if (definition.provenance.source === 'marketplace') continue;
for (const { id } of definition.skills) owned.add(id);
@@ -282,19 +281,14 @@ export class EffectivePluginResolver {
const blockedMarketplacePlugins = marketplaceSkillConflicts(definitions);
const assigned = normalizeIds(input.assignedSkillIds);
const coreIds = new Set<string>(CORE_CODING_SKILL_IDS);
const effectiveSkillIds: CodingSkillId[] = assigned.filter((id) => coreIds.has(id));
const skillEntries: SkillEntry[] = effectiveSkillIds.map((id) => ({
id,
entryPath: `${id}/SKILL.md`,
}));
const effectiveSkillIds: CodingSkillId[] = [];
const skillEntries: SkillEntry[] = [];
const pluginReleaseIds: string[] = [];
const toolDefinitions: CodingPluginToolDefinition[] = [];
const runtimePolicies: RuntimePolicy[] = [];
const unavailableReasons: PluginUnavailableReason[] = [];
// Child workers intentionally receive only core resources. Still validate
// assignment IDs above so malformed project configuration remains visible.
// Child workers intentionally receive no plugin-delivered Skill resources.
if (input.role === 'child') {
return freezeSnapshot({
accountSessionId: accountSessionId(this.options, validateBinding(this.options.getAccountBinding?.() ?? null)),

View File

@@ -3,7 +3,6 @@ import {
type CodingPluginToolDefinition,
type PluginBillingMode,
} from '../../shared/coding-plugins';
import { CORE_CODING_SKILL_IDS } from '../../shared/coding-skills';
import type {
CapabilityBillingReceiptV1,
CapabilityResultV1,
@@ -427,22 +426,20 @@ export class CodingCapabilityRegistryImpl implements CodingCapabilityRegistryPor
skillRoots: [...skillRoots],
};
}
const assigned = [...new Set(input.assignedSkillIds)];
const coreIds = new Set<string>(CORE_CODING_SKILL_IDS);
const pluginSkillOwners = new Map<string, CodingPluginDefinition>();
for (const definition of this.definitions) {
for (const skill of definition.skills) pluginSkillOwners.set(skill.id, definition);
}
for (const id of assigned) {
if (!coreIds.has(id) && !pluginSkillOwners.has(id)) throw new Error(`Unknown bundled coding skill: ${id}`);
}
const effectiveCoreSkills = assigned.filter((id) => coreIds.has(id));
// Preserve legacy assignment IDs in project.json, but only providers in the
// current plugin registry may contribute resources to a new worker.
const assigned = [...new Set(input.assignedSkillIds)]
.filter((id) => pluginSkillOwners.has(id));
if (input.role === 'child') {
return {
catalogRevision: this.options.policyClient.getState().revision,
pluginIds: [],
effectiveSkillIds: effectiveCoreSkills,
skillEntries: effectiveCoreSkills.map((id) => ({ id, entryPath: `${id}/SKILL.md` })),
effectiveSkillIds: [],
skillEntries: [],
tools: [],
};
}
@@ -455,8 +452,8 @@ export class CodingCapabilityRegistryImpl implements CodingCapabilityRegistryPor
return {
catalogRevision: this.options.policyClient.getState().revision,
pluginIds: [],
effectiveSkillIds: effectiveCoreSkills,
skillEntries: effectiveCoreSkills.map((id) => ({ id, entryPath: `${id}/SKILL.md` })),
effectiveSkillIds: [],
skillEntries: [],
tools: [],
};
}
@@ -464,8 +461,8 @@ export class CodingCapabilityRegistryImpl implements CodingCapabilityRegistryPor
const enabled = await this.enabledPluginIds(input.projectPath);
const state = this.options.policyClient.getState();
const pluginIds: string[] = [];
const effectiveSkillIds = [...effectiveCoreSkills];
const skillEntries = effectiveCoreSkills.map((id) => ({ id, entryPath: `${id}/SKILL.md` }));
const effectiveSkillIds: string[] = [];
const skillEntries: Array<{ id: string; entryPath: string; packageRoot?: string }> = [];
const tools: CodingPluginToolDefinition[] = [];
for (const definition of this.definitions) {
if (!definition.requiresBackend || !enabled.includes(definition.id)

View File

@@ -1,7 +1,6 @@
import { readFile, readdir } from 'node:fs/promises';
import path from 'node:path';
import {
BUNDLED_CODING_SKILL_IDS,
type CodingSkillId,
} from '../../shared/coding-skills';
import type {
@@ -56,8 +55,9 @@ function selectedSkillIds(
const selected = new Set<string>();
for (const raw of value) {
const id = raw.trim();
if (!allowed.has(id)) throw new Error(`Unknown bundled coding skill: ${id}`);
selected.add(id);
// Old project assignments are retained in project.json, but a removed or
// not-yet-installed provider must not break the current capability list.
if (allowed.has(id)) selected.add(id);
}
return selected;
}
@@ -85,29 +85,21 @@ async function listSkillEntries(
}
export async function listProductCodingSkills(
bundledSkillsDir: string,
_bundledSkillsDir: string,
selectedIds: readonly string[] = [],
pluginSkillSources: readonly ProductCodingPluginSkillSource[] = [],
): Promise<ProductCodingSkill[]> {
const pluginIds = pluginSkillSources.map(({ id }) => id);
const allIds = [...BUNDLED_CODING_SKILL_IDS, ...pluginIds];
const allIds = [...pluginIds];
if (new Set(allIds).size !== allIds.length) {
throw new Error('Duplicate coding skill identifier');
}
const selected = selectedSkillIds(selectedIds, allIds);
const sources: ProductCodingPluginSkillSource[] = [
...BUNDLED_CODING_SKILL_IDS.map((id) => ({
id,
directory: path.join(bundledSkillsDir, id),
})),
...pluginSkillSources,
];
const sources: ProductCodingPluginSkillSource[] = [...pluginSkillSources];
const visibleSources = sources.filter(({ id, available }) => available !== false || selected.has(id));
return await Promise.all(visibleSources.map(async ({ id, directory, entryPath, available = true }) => {
const sourceLocation = path.resolve(directory);
const location = (BUNDLED_CODING_SKILL_IDS as readonly string[]).includes(id)
? path.posix.join('resources', 'coding-skills', id)
: sourceLocation;
const location = sourceLocation;
const content = await readFile(path.join(sourceLocation, entryPath ?? 'SKILL.md'), 'utf8');
return {
id: productSkillId(id),

View File

@@ -21,7 +21,6 @@ import {
} from '../../coding-plugins/registry';
import type { EffectivePluginSnapshot } from '../../coding-plugins/effective-resolver';
import type { KnownToolDetails, RuntimeContextDetailsV1 } from '../contracts';
import { BUNDLED_CODING_SKILL_IDS } from '../../../shared/coding-skills';
import { PiAgentBrowserTool } from './extensions/agent-browser';
import type {
AgentBrowserPresentationRequester,
@@ -134,8 +133,7 @@ export class PiProductTools {
available: available.has(source.pluginId ?? source.id) || available.has(source.id),
}));
const selectedSkillIds = this.options.getPluginSkillSources
? skillIds.filter((id) => BUNDLED_CODING_SKILL_IDS.includes(id)
|| uniqueSources.some((source) => source.id === id))
? skillIds.filter((id) => uniqueSources.some((source) => source.id === id))
: skillIds;
return listProductCodingSkills(this.options.bundledSkillsDir, selectedSkillIds, sources);
}

View File

@@ -226,7 +226,6 @@ async function resolveSkillEntryPath(
const roots = entry.packageRoot
? [path.resolve(entry.packageRoot)]
: [
path.resolve(bundledSkillsDir),
...resolveBundledCodingPluginRootPaths(path.join(
path.dirname(path.resolve(bundledSkillsDir)),
'coding-plugins',
@@ -243,7 +242,7 @@ async function resolveSkillEntryPath(
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
}
}
throw new Error(`Bundled coding Skill entry is not a file: ${entry.entryPath}`);
throw new Error(`Plugin Skill entry is not a file: ${entry.entryPath}`);
}
export async function resolveExplicitCodingSkillPaths(

View File

@@ -165,13 +165,12 @@ interface PiRpcSessionStateProjection {
sessionFile?: string;
}
function fallbackWorkerResources(skillIds: readonly string[]): ResolvedWorkerResources {
const effectiveSkillIds = [...new Set(skillIds.map((id) => id.trim()).filter(Boolean))];
function fallbackWorkerResources(_skillIds: readonly string[]): ResolvedWorkerResources {
return {
catalogRevision: 0,
pluginIds: [],
effectiveSkillIds,
skillEntries: effectiveSkillIds.map((id) => ({ id, entryPath: `${id}/SKILL.md` })),
effectiveSkillIds: [],
skillEntries: [],
tools: [],
};
}

View File

@@ -66,13 +66,12 @@ export interface PiManagedSubagentChildOpenerOptions {
capabilityRegistry?: CodingCapabilityRegistry;
}
function fallbackWorkerResources(skillIds: readonly string[]): ResolvedWorkerResources {
const effectiveSkillIds = [...new Set(skillIds.map((id) => id.trim()).filter(Boolean))];
function fallbackWorkerResources(_skillIds: readonly string[]): ResolvedWorkerResources {
return {
catalogRevision: 0,
pluginIds: [],
effectiveSkillIds,
skillEntries: effectiveSkillIds.map((id) => ({ id, entryPath: `${id}/SKILL.md` })),
effectiveSkillIds: [],
skillEntries: [],
tools: [],
};
}