Files
deepseek-harness/docs/user/guide/config.zh.md
Yichen Jiang a45aa28ca6 Merge branch 'master' into claude/unified-environment-credentials-c8841a
Master removed the TUI package, the `meta` and `upgrade` subcommands, and
`--config-replace`, and made raw `dsh` require a `--config` overlay. Resolved
onto that shape:

- Dropped this branch's TUI edits with the surface itself, including
  `tui.cordis.yml`, `runTui`, and the TUI keyless PTY smoke.
- Dropped the `--config-replace` plumbing rather than reintroducing a flag
  master deliberately removed. The gap this branch fixed remains: `dsh -p`
  still could not name its composition, so it keeps `--config`.
- Kept this branch's deletion of the personal `$DSH_HOME/config.yaml` layer,
  which master still carried, and provided the environment snapshot in the new
  raw `runConfig` surface alongside web and headless.
- Ported the headless shutdown PTY test off the personal overlay onto a named
  `--config` file, which is what proves that flag now exists on `-p`.
2026-08-04 17:51:44 +08:00

3.4 KiB
Raw Blame History

配置文件

English | 中文

Harness 使用 cordis.yml 描述 Agent 加载哪些插件以及每个插件的参数。配置文件负责组合能力;每个包真正支持的字段和默认值由源码生成的配置目录负责记录,避免两份手写表格逐渐不一致。

从真实配置开始

仓库中的示例就是可以运行的配置,也是新项目最可靠的起点:

  • 共享的 dsh base 提供通用的模型、工具、持久化、策略与遥测配置项;原始 dsh --config <path> 要求传入一份 patch 列表,用于选择部署特定的 agent 和前端入口。
  • Web overlay 添加浏览器宿主、Workspace 管理、浏览器交互与客户端插件。
  • headless-agent 以单次任务形式暴露 coding 组装。
  • acp-agent 向程序化 ACPAgent Client Protocol客户端提供全新会话。

最小配置由一组插件条目组成:

- id: llm-deepseek
  name: '@deepseek-ai/dsh-llm-deepseek'
  config:
    apiKey: !!js process.env.DEEPSEEK_API_KEY
    models:
      - deepseek-v4-flash

- id: bash
  name: '@deepseek-ai/dsh-bash-local'

- id: agent-loop
  name: '@deepseek-ai/dsh-agent-loop'
  config:
    agents:
      - id: main
        provider: deepseek-official
        model: deepseek-v4-flash

插件条目

name 指定 npm 包或相对于 cordis.yml 的本地模块,id 为插件实例提供稳定标识,config 传入插件自己的配置。需要临时跳过某个条目时可设置 disabled: true

- id: local-tool
  name: './src/my-tool.ts'
  disabled: false
  config:
    toolName: my_tool

插件按文件中的顺序加载。依赖其他服务的插件应该排在提供这些服务的应用或能力插件之后;引用不存在的模型、工具或插件会尽早报错,而不是被静默忽略。

CLI 覆盖层

dsh --config <path> 要求给出一个补丁列表,并将其直接应用在 base.cordis.yml 之上;指定的文件不是完整的替换树。dsh webdsh -p 组合 base.cordis.ymlweb.cordis.yml,随后是任何 --config <path> 覆盖,最后是启动器自身的命令行标志补丁。磁盘上不会自动发现任何覆盖:点名一个文件是组合自己配置树的唯一途径,dsh -p 接受 --config 正是为此。

补丁会替换目标行的整个 config 值,而不是深度合并各个键。例如,只用 config: { thinking: disabled } 修补 llm-deepseek,也会移除该行原有的 apiKeybaseURL;因此必须重新写出该行需要保留的全部键。

JavaScript 值和环境变量

Cordis loader 使用 !!js 标签读取运行时表达式。API key 等凭据应放在仓库根目录、已被 Git 忽略的 .env 中,不能提交到配置文件。

config:
  apiKey: !!js process.env.DEEPSEEK_API_KEY
  cwd: !!js process.cwd()

标签是 !!js,不是 !js

精确配置参考

每个插件当前支持的字段、类型和默认值见自动生成的插件配置目录。理解插件如何组合可继续阅读架构说明能力接口;要创建自己的配置,优先复制并修改示例目录说明中最接近的例子。