The regression for `PresetTree.write` lived two layers up, so this layer's own assertion could not fail: it checked the file after an ordinary teardown, and the Loader's unload listener returns early when the whole tree is being disposed, so the override never ran. Moves the self-disposing-row test down to the layer that adds the override, in a temp root so a committed fixture cannot be damaged by the run that proves the bug.
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}`,
|
|
}))
|
|
}
|