feat(plugins): merge Skill management into plugins
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user