mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
A preset is a directory holding one `agent.cordis.yml`. Mounting it under an agent's scope context during `setup(agentCtx)` gives that one session its own tools and prompt sections while every other live session keeps its own. No registry gains a tier. `dsh-tools` and `dsh-system-prompt` already file registrations into the calling context's scope layer, and entry contexts chain to the context a subtree was plugged into, so a composition mounted under `agent.ctx` is that agent's alone and unwinds with it. The mount audits itself because a directly-plugged subtree is absent from `ctx.loader.entries()` and no boot audit covers it. It rejects an unscoped target, a row that never became usable, and a row that published a service into the root service realm — that last one is process-global rather than per-session, and its collision with the next session surfaces as an unhandled rejection `setup` never observes, leaving a half-composed agent that looks healthy. The package invariant re-checks that rule on every service notification, since a row publishing from a timer would escape a one-shot audit. Raises the `packages/README.md` word ceiling from 920 to 980: the group table must enumerate every group, and the new `preset/` row is necessary content. Design: .agents/notes/implemented/architecture/2026-08-03-per-session-agent-presets.md
21 lines
855 B
JavaScript
21 lines
855 B
JavaScript
// A preset row: registers one tool and one prompt section, both named from
|
|
// config. Import-free on purpose — the Loader resolves entry modules through
|
|
// Node's ESM resolver, which cannot see this workspace's TypeScript sources.
|
|
export const name = 'contribute'
|
|
export const inject = ['tools', 'systemPrompt']
|
|
|
|
export function apply(ctx, config) {
|
|
ctx.effect(() => ctx.tools.register({
|
|
name: config.tool,
|
|
description: `fixture tool ${config.tool}`,
|
|
parameters: { type: 'object', properties: {}, additionalProperties: false },
|
|
output: { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: String(value) }] },
|
|
execute: () => Promise.resolve(config.tool),
|
|
}))
|
|
ctx.effect(() => ctx.systemPrompt.section({
|
|
name: `preset:${config.tool}`,
|
|
order: 10,
|
|
text: `section for ${config.tool}`,
|
|
}))
|
|
}
|