Files
deepseek-harness/examples/jsonrpc-agent/README.zh.md

41 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# jsonrpc-agent
[English](README.md) | 中文
面向 Python SDK 内置 JSON-RPC 运行时的无人值守编码 agent智能体组合。它有意不加载终端 UI、控制台日志记录器、批准界面或用户交互工具因为 stdout 属于 SDK 协议,轮次由 SDK 驱动。
面向模型的工具为:
- `bash`,仅前台
- `read``write``edit`
- `subagent`,使用一个在进程内以前台方式运行的 spawn 提供方
- `todo_write`
周边运行时还加载 JSONL 会话持久化和自动上下文压缩context compaction`maxTokensAsSuccess` 将受 token 上限限制的模型轮次保留为已接受的评估结果,同时保留其 `max-tokens` 原因。
## 运行时环境
| 变量 | 用途 |
|---|---|
| `DEEPSEEK_API_KEY` | 传给 OpenAI 兼容宿主端点的凭据 |
| `DEEPSEEK_BASE_URL` | `dsh-llm-deepseek` 使用的宿主端点 |
| `DSH_CWD` | bash 和文件系统工具使用的 agent workspace |
| `DSH_MAX_TOKENS_AS_SUCCESS` | `true`(默认)接受受 token 上限限制的结果;`false` 将其报告为错误 |
| `DSH_SESSION_ROOT` | JSONL 轨迹目录 |
| `DSH_SYSTEM_PROMPT` | 由部署提供的编码人格 |
通过 Python SDK 的 `cordis` 选项或 `DSH_CORDIS_CONFIG` 传入配置路径。内置可执行文件已携带此文件中指定的每个插件;目标机器无需 Node.js。
## 持久工具变体
[`persistent-tools.cordis.yml`](persistent-tools.cordis.yml) 是一个最小可运行变体,面向模型的能力严格只有:
- agent 独占、状态持久的 `bash`
- 提供 `view``create``str_replace``insert``str_replace_editor`
它组合真实本地 PTY、文件系统 intent 策略与 session 沙箱策略。无密钥 SDK 快照会通过正式 JSON-RPC runtime 驱动这两个工具,验证 shell 的 cwd 与环境变量能跨调用保留,并锁定通知流、轮次结果与已持久化的 JSONL
```bash
pnpm exec vitest run --config vitest.snapshot.config.ts -t persistent-tools
```