fix: close marketplace client review findings

This commit is contained in:
2026-08-28 21:01:51 +08:00
parent 8dfa542860
commit 1614f7efc1
25 changed files with 1224 additions and 143 deletions

View File

@@ -95,7 +95,7 @@ export interface ResolvedWorkerResources {
catalogRevision: number;
pluginIds: readonly string[];
effectiveSkillIds: readonly string[];
skillEntries: readonly { id: string; entryPath: string }[];
skillEntries: readonly { id: string; entryPath: string; packageRoot?: string }[];
tools: readonly CodingPluginToolDefinition[];
/** The exact Main-owned snapshot used to produce these legacy fields. */
effectiveSnapshot?: EffectivePluginSnapshot;
@@ -401,7 +401,11 @@ export class CodingCapabilityRegistryImpl implements CodingCapabilityRegistryPor
catalogRevision: this.options.effectiveResolver.getPolicyState().revision,
pluginIds: [...pluginIds],
effectiveSkillIds: [...snapshot.effectiveSkillIds],
skillEntries: snapshot.skillEntries.map(({ id, entryPath }) => ({ id, entryPath })),
skillEntries: snapshot.skillEntries.map(({ id, entryPath, packageRoot }) => ({
id,
entryPath,
...(packageRoot ? { packageRoot } : {}),
})),
tools: snapshot.toolDefinitions.map((tool) => structuredClone(tool)),
effectiveSnapshot: snapshot,
skillRoots: [...skillRoots],
@@ -457,7 +461,13 @@ export class CodingCapabilityRegistryImpl implements CodingCapabilityRegistryPor
if (selectedSkills.length === 0) continue;
for (const skill of selectedSkills) {
effectiveSkillIds.push(skill.id);
skillEntries.push({ id: skill.id, entryPath: skill.entryPath });
skillEntries.push({
id: skill.id,
entryPath: skill.entryPath,
...(definition.provenance.source === 'marketplace'
? { packageRoot: definition.provenance.packageRoot }
: {}),
});
}
for (const tool of definition.tools) {
const granted = selectedSkills.some(({ grants }) => grants.includes(tool.capabilityId));