Files
deepseek-harness/examples/echo-agent/src/echo-tool.ts
Tianyi Cui 53d1ef4a74 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).
2026-06-11 10:55:05 +08:00

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()}` }]
},
})
}