fix: complete marketplace client remediation

This commit is contained in:
2026-08-28 23:14:41 +08:00
parent 2c3baf6dff
commit 11d0af0166
18 changed files with 1007 additions and 90 deletions

View File

@@ -17,6 +17,7 @@ import type {
import type {
EffectivePluginResolver,
EffectivePluginSnapshot,
EffectivePluginSkillSource,
} from './effective-resolver';
const MAX_REQUEST_ID = 128;
@@ -391,21 +392,30 @@ export class CodingCapabilityRegistryImpl implements CodingCapabilityRegistryPor
const effectiveSkills = new Set(snapshot.effectiveSkillIds);
const pluginIds = new Set<string>(snapshot.runtimePolicies.map(({ pluginId }) => pluginId));
const skillRoots = new Set<string>();
const sourcesBySkillId = new Map<string, EffectivePluginSkillSource>();
for (const source of sources) {
if (effectiveSkills.has(source.id)) {
pluginIds.add(source.pluginId);
skillRoots.add(source.packageRoot);
if (effectiveSkills.has(source.id) && !sourcesBySkillId.has(source.id)) {
sourcesBySkillId.set(source.id, source);
}
}
const skillEntries = snapshot.skillEntries.map(({ id, entryPath, packageRoot }) => {
const source = sourcesBySkillId.get(id);
const pairedRoot = packageRoot ?? source?.packageRoot;
if (source && pairedRoot) {
pluginIds.add(source.pluginId);
skillRoots.add(pairedRoot);
}
return {
id,
entryPath,
...(pairedRoot ? { packageRoot: pairedRoot } : {}),
};
});
return {
catalogRevision: this.options.effectiveResolver.getPolicyState().revision,
pluginIds: [...pluginIds],
effectiveSkillIds: [...snapshot.effectiveSkillIds],
skillEntries: snapshot.skillEntries.map(({ id, entryPath, packageRoot }) => ({
id,
entryPath,
...(packageRoot ? { packageRoot } : {}),
})),
skillEntries,
tools: snapshot.toolDefinitions.map((tool) => structuredClone(tool)),
effectiveSnapshot: snapshot,
skillRoots: [...skillRoots],