preset-tool.js 852 B

1234567891011121314151617181920
  1. // A preset row standing in for the agent-plane tool rows a real preset mounts.
  2. // Import-free on purpose — the Loader resolves entry modules through Node's ESM
  3. // resolver, which cannot see this workspace's TypeScript sources.
  4. export const name = 'preset-tool'
  5. export const inject = ['tools', 'systemPrompt']
  6. export function apply(ctx, config) {
  7. ctx.effect(() => ctx.tools.register({
  8. name: config.tool,
  9. description: `fixture tool ${config.tool}`,
  10. parameters: { type: 'object', properties: {}, additionalProperties: false },
  11. output: { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: String(value) }] },
  12. execute: () => Promise.resolve(config.tool),
  13. }))
  14. ctx.effect(() => ctx.systemPrompt.section({
  15. name: `preset:${config.tool}`,
  16. order: 10,
  17. text: `section for ${config.tool}`,
  18. }))
  19. }