feat(plugins): merge Skill management into plugins

This commit is contained in:
inman
2026-09-07 18:36:33 +08:00
parent bb8a19eecf
commit ab9f889233
49 changed files with 461 additions and 1218 deletions

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: [],
};
}