feat: add canonical typed tool outputs

This commit is contained in:
Tianyi Cui
2026-07-21 03:08:35 +08:00
parent 8500974fd4
commit 66c36e7325
173 changed files with 3298 additions and 954 deletions

View File

@@ -203,7 +203,8 @@ describe('dsh-acp-demo composition', () => {
name,
description: name,
parameters: {},
execute: async () => [],
output: { schema: { type: 'null' }, render: () => [] },
execute: async () => null,
})
}
const assembly = await ctx.get('systemPrompt')!.assemble()

View File

@@ -494,7 +494,8 @@ describe('dsh-agent-spine-demo bundle', () => {
name,
description: name,
parameters: {},
execute: async () => [],
output: { schema: { type: 'null' }, render: () => [] },
execute: async () => null,
})
}
const assembly = await ctx.get('systemPrompt')!.assemble()

View File

@@ -95,7 +95,13 @@ describe('dsh-cli-demo app composition', () => {
})
ctx.skills.register({ name: 'cli-skill', description: 'CLI skill', source: 'runtime', content: 'body' })
for (const name of ['alpha', 'zulu']) {
ctx.tools.register({ name, description: name, parameters: {}, execute: async () => [] })
ctx.tools.register({
name,
description: name,
parameters: {},
output: { schema: { type: 'null' }, render: () => [] },
execute: async () => null,
})
}
expect(JSON.stringify(await composePrefix(ctx))).toContain('- `cli-skill`: CLI...')
expect((await ctx.systemPrompt.assemble()).tools.map(tool => tool.name)).toEqual([

View File

@@ -115,7 +115,11 @@ async function harness(script: readonly ScriptEntry[]): Promise<Harness> {
name: 'echo',
description: 'Echo text.',
parameters: { text: { type: 'string', required: true } },
execute: async args => [{ type: 'text', text: `ECHO: ${(args as { text: string }).text}` }],
output: {
schema: { type: 'string' },
render: (_args, value) => [{ type: 'text', text: value as string }],
},
execute: async args => `ECHO: ${(args as { text: string }).text}`,
})
const [agent] = ctx.agents.roots()
if (agent === undefined) throw new Error('test main agent missing')