53d1ef4a74
cordis.yml-wired demo proving the full stack end to end: mock-echo LlmAdapter (streams text; calls the echo tool on "echo <text>"), echo tool, stdio chat UI plugin (consumes only the agent/* taxonomy), and a JSONL persistence plugin demonstrating the write-behind + session/flush checkpoint pattern. Runs unbuilt via tsx with loader, include, and HMR live-reload all active (yarn demo).
20 lines
496 B
TypeScript
20 lines
496 B
TypeScript
import type { Context } from 'cordis'
|
|
|
|
export const name = 'echo-tool'
|
|
export const inject = ['tools']
|
|
|
|
export function apply(ctx: Context) {
|
|
ctx.tools.register({
|
|
name: 'echo',
|
|
description: 'Echo the given text back, uppercased.',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: { text: { type: 'string' } },
|
|
required: ['text'],
|
|
},
|
|
async execute(args: any) {
|
|
return [{ type: 'text', text: `ECHO: ${String(args?.text ?? '').toUpperCase()}` }]
|
|
},
|
|
})
|
|
}
|