Add runnable echo-agent example
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).
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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()}` }]
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user