feat(skill): layer the host skill registry per scope like the tools registry
The skills capability moves back to the host plane as one singleton, layered with the ScopedLayers infrastructure the tools registry established: a registration files into its calling context's layer (repository plugins and host rows land global, a preset's skill-local lands in that preset's layer), and a read merges the global layer with the viewing scope's chain, the nearest layer winning duplicate names outright while rank keeps deciding duplicates within one layer. The web-app bundle re-enables the base skill registry row (skill-local and tool-skill stay preset-owned), the standard preset drops its isolate skills realm for bare rows over the host registry, tool-skill passes the calling agent as the view scope, and the gateway's skills domain reads the host registry in the presenter scope — a cold session now resolves its recorded preset's standing key instead of failing.
This commit is contained in:
@@ -2567,9 +2567,9 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
|
||||
},
|
||||
|
||||
skills: {
|
||||
// Skill lookup never touches the Agent registry: the session address
|
||||
// resolves to a canonical cwd from the host-resident session header, so
|
||||
// listing skills cannot create or resume an agent as a side effect.
|
||||
// Skill lookup never creates or resumes an agent: the session address
|
||||
// resolves to a canonical cwd from the host-resident session header, and
|
||||
// the view scope is the live agent or the preset's standing key.
|
||||
async list(request) {
|
||||
const { sessionId } = request.payload
|
||||
const session = ctx.sessions.get(sessionId)
|
||||
@@ -2586,12 +2586,10 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
|
||||
return err(request, { code: 'internal', message: `session "${sessionId}" has no project cwd`, details: {} })
|
||||
}
|
||||
const cwd = session.header.cwd
|
||||
// The registry is per session when a preset mounts one — a preset
|
||||
// ships its own skill directory, so the catalog IS the session's — and
|
||||
// that instance sits behind an `isolate` realm no host context
|
||||
// resolves. Address it through the live agent; `agents.get` keeps the
|
||||
// no-side-effect stance above (a cold session creates nothing and
|
||||
// falls through to whatever the host composes).
|
||||
// The host registry is layered per scope and serves every session. A
|
||||
// composition may still realm-mount its own registry instead; that
|
||||
// instance is invisible to host contexts, so address it through the
|
||||
// live agent (`agents.get` keeps the no-side-effect stance above).
|
||||
const live = ctx.agents.get(sessionId)
|
||||
const presets = ctx.get('agentPresets')
|
||||
const scoped = live === undefined ? undefined : presets?.serviceFor(live, 'skills')
|
||||
@@ -2603,8 +2601,12 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
|
||||
if (skillRegistry === undefined) {
|
||||
return err(request, { code: 'internal', message: 'skill registry is absent: neither this session\'s agent preset nor the host composition mounts @deepseek-ai/dsh-skill', details: {} })
|
||||
}
|
||||
// The scope presenters resolve in — the live agent, else the recorded
|
||||
// preset's standing key, else the global layer — so a cold session's
|
||||
// '/' popup lists the catalog its composition actually serves.
|
||||
const scope = await presenterScopeFor(sessionId, session.header)
|
||||
try {
|
||||
const skills = (await skillRegistry.list({ cwd })).filter(isUserInvocable)
|
||||
const skills = (await skillRegistry.list({ cwd, scope })).filter(isUserInvocable)
|
||||
return ok(request, {
|
||||
skills: skills.map(skill => ({
|
||||
name: skill.name,
|
||||
|
||||
Reference in New Issue
Block a user