Remove the Echo agent

This commit is contained in:
Tianyi Cui
2026-07-20 20:16:41 +08:00
parent 2191d45ece
commit 44ad2ef073
64 changed files with 230 additions and 483 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write
index.md: 5fa46806bc195ad2566fc0a29b45eb1dd7a68179
index.zh.md: a6d238c12841c8c25b00376ee032e5db50fc6b4e
index.md: d7d657ff7b8cb9001dd5e9c3af658a7a3c45b5b7
index.zh.md: 7a134f7aaed470b87ee8ca8978dd39593de2651b

View File

@@ -122,24 +122,24 @@ Function form is sufficient in most cases. Use class form when the plugin provid
## Complete example
`examples/echo-agent/src/echo-tool.ts` is a plugin that registers a tool:
A minimal tool plugin registers its definition on `ctx.tools`:
```ts
import type { Context } from 'cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'
export const name = 'echo-tool'
export const name = 'greet-tool'
export const inject = ['tools']
export function apply(ctx: Context) {
ctx.tools.register(defineTool({
name: 'echo',
description: 'Echo the given text back, uppercased.',
name: 'greet',
description: 'Greet the named person.',
parameters: {
text: { type: 'string', required: true },
name: { type: 'string', required: true },
},
async execute(args) {
return [{ type: 'text', text: `ECHO: ${args.text.toUpperCase()}` }]
return [{ type: 'text', text: `Hello, ${args.name}!` }]
},
}))
}

View File

@@ -122,24 +122,24 @@ export default class MyService extends Service {
## 完整示例
参考仓库中的 `examples/echo-agent/src/echo-tool.ts`,这是一个注册 tool 的插件
最小化的工具插件会在 `ctx.tools` 上注册其定义
```ts
import type { Context } from 'cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'
export const name = 'echo-tool'
export const name = 'greet-tool'
export const inject = ['tools']
export function apply(ctx: Context) {
ctx.tools.register(defineTool({
name: 'echo',
description: 'Echo the given text back, uppercased.',
name: 'greet',
description: 'Greet the named person.',
parameters: {
text: { type: 'string', required: true },
name: { type: 'string', required: true },
},
async execute(args) {
return [{ type: 'text', text: `ECHO: ${args.text.toUpperCase()}` }]
return [{ type: 'text', text: `Hello, ${args.name}!` }]
},
}))
}

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write
llm-adapter.md: 83296e54220c668410fe69d689199171251a7787
llm-adapter.zh.md: 89b7185690dbdfe33cbafe7b0ee4c3e83cfe0df8
llm-adapter.md: 3e83289b8072ef231f83c0fa3cfe3260547b42fa
llm-adapter.zh.md: 92fcf9b22f4bb356ada4c46f9a03ef0cc2d159da

View File

@@ -145,9 +145,8 @@ The repository contains complete implementations:
- `packages/llm/llm-deepseek/` — DeepSeek API adapter using the OpenAI-compatible format
- `packages/llm/llm-pi-ai/` — Pi AI adapter using a different API format
- `examples/echo-agent/src/mock-llm.ts` — minimal local teaching adapter
Start with the mock adapter to study a complete chunk sequence without network behavior.
Compare the two shipped adapters to see the same harness contract implemented over different provider SDKs.
## Error handling

View File

@@ -145,9 +145,8 @@ ctx.llm.registerAdapter(['model-name-1', 'model-name-2'], adapter)
- `packages/llm/llm-deepseek/` — DeepSeek API 适配器OpenAI 兼容格式)
- `packages/llm/llm-pi-ai/` — Pi AI 适配器(不同的 API 格式)
- `examples/echo-agent/src/mock-llm.ts` — 最简 mock 适配器(教学用)
mock 适配器是学习 StreamChunk 协议的最佳起点——它用纯本地逻辑演示了完整的 chunk 序列
对比这两个已交付的适配器,可以看到同一套 harness 契约如何在不同提供方 SDK 之上实现
## 错误处理

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write
config.md: 0616f163f995b152d7a28841506027558de2c32c
config.zh.md: fa91445ae88456a61a4736ce8b71aed482227ce8
config.md: 8958729d04224215ca420c3103d253a8a5783405
config.zh.md: 530f2b335453d5064acdac28a60d7df51cd915f0

View File

@@ -8,7 +8,6 @@ Harness uses `cordis.yml` to describe which plugins an agent loads and the confi
The repository examples are runnable configurations and the most reliable starting points for a new project:
- [echo-agent](../../../examples/echo-agent/cordis.yml) uses a local mock model and needs no API key.
- [tui-agent](../../../examples/tui-agent/cordis.yml) combines the DeepSeek model, Bash, filesystem, compaction, subagents, workflows, and the interactive TUI.
- [headless-agent](../../../examples/headless-agent/cordis.yml) exposes the coding composition as a one-shot task.
- [acp-agent](../../../examples/acp-agent/cordis.yml) connects to editor clients over ACP.

View File

@@ -8,7 +8,6 @@ Harness 使用 `cordis.yml` 描述 Agent 加载哪些插件以及每个插件的
仓库中的示例就是可以运行的配置,也是新项目最可靠的起点:
- [echo-agent](../../../examples/echo-agent/cordis.yml) 使用本地 mock 模型,不需要 API key。
- [tui-agent](../../../examples/tui-agent/cordis.yml) 组合 DeepSeek 模型、Bash、文件系统、压缩、子代理、工作流和交互式 TUI。
- [headless-agent](../../../examples/headless-agent/cordis.yml) 以单次任务形式暴露 coding 组装。
- [acp-agent](../../../examples/acp-agent/cordis.yml) 通过 ACP 接入编辑器客户端。

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write
quickstart.md: 62e899adfa33e566083b8224b9bdf77c1038557a
quickstart.zh.md: 382c9685ebe0c919c2fd039484898b44e9264aa7
quickstart.md: 25ce51ee3d010d2eb800071b9697fc62857dace1
quickstart.zh.md: e2e023670a999566e273d8893c42103dc273e7b1

View File

@@ -8,6 +8,7 @@ This guide gets an agent running in five minutes.
- [Node.js](https://nodejs.org/) ^22.19 or >= 24
- [pnpm](https://pnpm.io/) 11 through Corepack
- A [DeepSeek Platform](https://platform.deepseek.com/) API key
```sh
node -v
@@ -15,25 +16,32 @@ corepack enable
pnpm -v
```
## Step 1: run the keyless Headless demo
## Step 1: install and configure the API key
```sh
git clone https://github.com/deepseek-harness/deepseek-harness.git
cd deepseek-harness
pnpm install
pnpm run demo:echo "echo hello world"
```
The local mock model calls the `echo` tool, which returns the text in uppercase, and the final response is printed without opening an interactive UI. Use `--output-format stream-json` when you need the canonical event stream.
## Step 2: use a real model in the TUI
Get an API key from [DeepSeek Platform](https://platform.deepseek.com/) and create the gitignored repository-root `.env`:
Create the gitignored repository-root `.env`:
```sh
DEEPSEEK_API_KEY=sk-your-key-here
```
## Step 2: run one Headless task
Run a non-interactive task and print its final answer:
```sh
pnpm run demo:headless "summarize the architecture of this workspace"
```
Headless runs one complete model/tool turn, persists the session, prints the result, and exits. Use `--output-format stream-json` when you need the canonical event stream.
## Step 3: use the TUI
Start the interactive coding agent:
```sh
@@ -44,7 +52,7 @@ The full-screen agent can read and write files, run commands, delegate subtasks,
## What happened
echo-agent uses the Headless `@deepseek-ai/dsh-cli-demo` app; tui-agent uses the interactive `@deepseek-ai/dsh-tui-demo` app. Both load the same providerless agent spine, while their `cordis.yml` files select the model and capability plugins appropriate to each surface.
headless-agent uses the `@deepseek-ai/dsh-cli-demo` app; tui-agent uses the interactive `@deepseek-ai/dsh-tui-demo` app. Both load the same providerless agent spine, while their `cordis.yml` files select the DeepSeek model and capability plugins appropriate to each surface.
## Next steps

View File

@@ -8,6 +8,7 @@
- [Node.js](https://nodejs.org/) ^22.19 或 >= 24
- 通过 Corepack 使用 [pnpm](https://pnpm.io/) 11
- [DeepSeek Platform](https://platform.deepseek.com/) API key
```sh
node -v
@@ -15,25 +16,32 @@ corepack enable
pnpm -v
```
## 第一步:运行 keyless Headless 演示
## 第一步:安装并配置 API key
```sh
git clone https://github.com/deepseek-harness/deepseek-harness.git
cd deepseek-harness
pnpm install
pnpm run demo:echo "echo hello world"
```
本地 mock 模型会调用 `echo` 工具,由工具返回大写文本,最终回复在不打开交互式 UI 的情况下直接输出。需要规范事件流时可使用 `--output-format stream-json`
## 第二步:在 TUI 中使用真实模型
前往 [DeepSeek Platform](https://platform.deepseek.com/) 获取 API key并创建已被 Git 忽略的仓库根目录 `.env`
在仓库根目录创建已被 Git 忽略的 `.env`
```sh
DEEPSEEK_API_KEY=sk-your-key-here
```
## 第二步:运行一个 Headless 任务
运行一个非交互式任务并打印最终回答:
```sh
pnpm run demo:headless "summarize the architecture of this workspace"
```
Headless 运行一个完整的模型/工具轮次,持久化会话,打印结果后退出。需要规范事件流时可使用 `--output-format stream-json`
## 第三步:使用 TUI
启动交互式 coding agent
```sh
@@ -44,7 +52,7 @@ pnpm run demo:tui
## 回头看
echo-agent 使用 Headless `@deepseek-ai/dsh-cli-demo` apptui-agent 使用交互式 `@deepseek-ai/dsh-tui-demo` app。二者加载同一个 providerless agent spine并通过各自的 `cordis.yml` 为对应 surface 选择模型和能力插件。
headless-agent 使用 `@deepseek-ai/dsh-cli-demo` apptui-agent 使用交互式 `@deepseek-ai/dsh-tui-demo` app。二者加载同一个 providerless agent spine并通过各自的 `cordis.yml` 为对应 surface 选择 DeepSeek 模型和能力插件。
## 下一步