@menghuan1918/dsh-apollo 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  <h1 align="center">dsh-apollo</h1>
2
2
 
3
3
  <p align="center">
4
- DeepSeek Harness 的<strong>插件集合入口</strong>:流程技能 · 工程预设 · Codex / Claude 后台任务 · 独立长期目标
4
+ DeepSeek Harness 的<strong>插件集合入口</strong>:流程技能 · 工程预设 · 独立长期目标 · 子代理增强 · 压缩策略
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
8
  <a href="https://www.npmjs.com/package/@menghuan1918/dsh-apollo"><img src="https://img.shields.io/npm/v/%40menghuan1918%2Fdsh-apollo.svg" alt="npm 版本"></a>
9
9
  <a href="LICENSE"><img alt="License" src="https://img.shields.io/github/license/Menghuan1918/dsh-apollo?color=blue"></a>
10
- <a href="package.json"><img alt="Node ^22.19.0 || &gt;=24.0.0" src="https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-339933?logo=node.js&amp;logoColor=white"></a>
10
+ <a href="package.json"><img alt="Node ^22.19.0 || &gt;=24.0.0" src="https://img.shields.io/badge/node-%5E22.19.0%20%7C%7C%20%3E%3D24-339933?logo=node.js&amp;logoColor=white"></a>
11
11
  <a href="package.json"><img alt="DSH &gt;=0.2.1-rc.2 &lt;0.3.0" src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.2%20%3C0.3.0-4B32C3"></a>
12
12
  </p>
13
13
 
@@ -15,26 +15,33 @@
15
15
  <a href="#这是什么">是什么</a> ·
16
16
  <a href="#能力地图">能力地图</a> ·
17
17
  <a href="#安装">安装</a> ·
18
- <a href="#cli-后台任务">CLI 后台任务</a> ·
19
- <a href="#长期目标">长期目标</a> ·
20
- <a href="#设置与权限">设置与权限</a> ·
18
+ <a href="#从-04x-升级">升级</a> ·
19
+ <a href="#设置与行归属">设置</a> ·
20
+ <a href="#独立使用与组合安装">组合</a> ·
21
21
  <a href="#faq">FAQ</a> ·
22
22
  <a href="docs/DEVELOPMENT.md">开发文档</a>
23
23
  </p>
24
24
 
25
25
  ## 这是什么
26
26
 
27
- Apollo 是 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)的**插件集合入口**:安装一次,同时得到流程技能、两套工程预设、可续接的 Codex / Claude 后台任务,以及独立的长期目标插件。
27
+ Apollo 是 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)的**插件集合入口**:安装一次,同时得到流程技能、两套工程预设,并把三个各自独立发布、可单独使用的插件装配进同一个 profile:
28
28
 
29
- > **当前边界**:`dsh-better-goal` 是独立插件包,拥有独立仓库和独立设置行;流程技能、工程预设和 CLI 后台任务目前随 Apollo 一起交付。
29
+ - **[`dsh-better-goal`](https://github.com/Menghuan1918/dsh-better-goal)**:长期目标、暂停与提问超时;
30
+ - **[`@menghuan1918/dsh-better-subagent`](https://github.com/Menghuan1918/dsh-better-subagent)**:Codex / Claude 可续接 CLI 子代理、`wait_subagent`、运行中子代理守卫、模型分档与子代理提示词;
31
+ - **[`dsh-better-compact`](https://github.com/Menghuan1918/dsh-better-compact)**:native / goal / file-handoff 三种压缩模式与只读诊断。
32
+
33
+ > **0.5.0 的所有权变化**:Apollo 不再实现 CLI 协议/路由、`wait_subagent`、能力探针、子代理设置页、模型分档/委派提示词或运行中子代理守卫。这些代码只在独立插件里保留一份;Apollo 只做**装配、通用工程纪律、后台任务退出守卫、旧配置迁移**。Apollo 也不再注册 `/apollo/api/*` —— 该前缀由 better-subagent 作为只读兼容别名拥有。
30
34
 
31
35
  ```mermaid
32
36
  flowchart TB
33
37
  A["dsh-apollo<br/>插件集合入口"]
34
38
  A --> S["流程技能<br/>拆 Spec · 并行 · 审查"]
35
39
  A --> E["工程模式<br/>eng / eng-ptc"]
36
- A --> C["CLI 后台任务<br/>Codex / Claude"]
37
- A -. 自动包含 .-> G["dsh-better-goal<br/>独立长期目标插件"]
40
+ A --> J["后台任务退出守卫<br/>Apollo 唯一运行时开关"]
41
+ A -. 精确依赖 + 相同稳定行 .-> G["dsh-better-goal"]
42
+ A -. 精确依赖 + 相同稳定行 .-> SA["better-subagent<br/>CLI 子代理 · wait · 分档"]
43
+ A -. 精确依赖 + 相同稳定行 .-> C["better-compact<br/>压缩模式与引擎"]
44
+ E -. 预设内 engine 行 .-> C
38
45
  ```
39
46
 
40
47
  ## 能力地图
@@ -42,9 +49,10 @@ flowchart TB
42
49
  | 模块 | 入口 | 提供什么 |
43
50
  |---|---|---|
44
51
  | 流程技能 | 会话内用 `/技能名` 或按描述自动选用 | 把大任务拆成可验证的 Spec,按波次实现、审查、验证后合入 |
45
- | 工程预设 | 预设选择器:`eng` / `eng-ptc` | 工程纪律、委派约定、子代理模型分档、可选退出守卫,以及同一个长期目标 |
46
- | CLI 后台任务 | **Plugins → @menghuan1918/dsh-apollo**;在会话里直接派发 | 让本机 Codex / Claude 在后台执行子任务,结果回到父会话 |
47
- | 长期目标(独立 `dsh-better-goal`) | **Plugins → @menghuan1918/dsh-apollo → `dsh-better-goal` 行** + `/goal` | 每个会话一个持久目标;执行步骤单独跟踪 |
52
+ | 工程预设 | 预设选择器:`eng` / `eng-ptc` | 通用工程纪律、后台任务守卫、完整工作流;压缩用 better-compact 引擎 |
53
+ | 子代理增强 | **Plugins → better-subagent 行** | CLI 后台子代理、等待续接、运行中子代理守卫、模型分档 |
54
+ | 压缩 | **Plugins → dsh-better-compact 行** | native / goal / handoff、预算、摘要路由、只读诊断 |
55
+ | 长期目标 | **Plugins → dsh-better-goal 行** + `/goal` | 每个会话一个持久目标,可暂停、可恢复 |
48
56
 
49
57
  ### 流程技能
50
58
 
@@ -59,196 +67,192 @@ flowchart TB
59
67
  | `/code-review` | 并行检查仓库标准与原始需求,并排报告 |
60
68
  | `/handoff` | 把当前上下文整理为交接文档;仅由用户手动触发 |
61
69
 
62
- `/dev`、`/tdd` 和 `/diagnosing-bugs` 通常作为 `/exec` 或 `/main-agent-driven-development` 的参考被引用,也可以手动调用。技能需要在所选预设中挂载 DSH 的技能工具,两套工程预设已挂载。
70
+ 技能需要在所选预设中挂载 DSH 的技能工具,两套工程预设已挂载。
63
71
 
64
72
  ### 工程预设
65
73
 
66
74
  | 预设(ID) | 适合 | 关键差异 |
67
75
  |---|---|---|
68
- | 工程模式 — `eng` | 编码 / 基础设施任务 | 原生工具调用;保留 workflow 工具,用法以内置说明为准 |
69
- | 工程(PTC)模式 — `eng-ptc` | 多步、循环、需要过滤汇总的任务 | 工具经 `run_code` 的 TypeScript SDK 调用,一个程序组合多步;与官方 PTC 模式一致不提供 workflow,扇出改为在一个 `run_code` 里派发多个子代理 |
76
+ | 工程模式 — `eng` | 编码 / 基础设施任务 | 原生工具调用;保留 workflow 工具 |
77
+ | 工程(PTC)模式 — `eng-ptc` | 多步、循环、需要过滤汇总的任务 | 工具经 `run_code` 的 TypeScript SDK 调用;与官方 PTC 模式一致不提供 workflow |
70
78
 
71
- 两套预设共用同一段工程模式提示词(KISS、证据先行、修复根因、防过度设计与过度防御、权限与依赖边界、命令与进程纪律、委派与编排),并按设置渲染子代理模型分档。提示词是弱约束:用户的明确指示优先。最终组装出的完整提示词见 [prompts/eng.md](prompts/eng.md) 与 [prompts/eng-ptc.md](prompts/eng-ptc.md)。
79
+ 两套预设共用 Apollo 的通用工程纪律(KISS、证据先行、修复根因、防过度设计与过度防御、权限与依赖边界、命令与进程纪律)。**委派规则与模型分档不在 Apollo**:由 better-subagent 在 `agent/created` 时按预设与活配置注册自己的 prompt section。完整组装结果见 [prompts/eng.md](prompts/eng.md) 与 [prompts/eng-ptc.md](prompts/eng-ptc.md)。
72
80
 
73
- 两套预设都不提供自动化任务工具:工程模式会话内不能创建或修改自动化任务,侧栏「自动化任务」页和其他预设不受影响。退出守卫默认关闭,只检查本会话仍运行的后台工作,不管理 pm2、systemd、nohup 等外部进程。
81
+ 两套预设的压缩组里,原生 `compaction-basic` 被替换为 `dsh-better-compact/engine`(与独立 bundle 完全相同的稳定行),保留 `command-compact` 与 `tool-result-pruner`。工程模式不提供自动化任务工具;退出守卫默认关闭,只检查本会话仍运行的后台 job,不管理 pm2、systemd、nohup 等外部进程。
74
82
 
75
83
  ## 安装
76
84
 
77
- 需要 Node.js `^22.19.0 || >=24.0.0`,以及 DSH `>=0.2.1-rc.2 <0.3.0`。已验证基线是 DSH `0.2.1-rc.2`;声明范围不等于逐版验证保证。
78
-
79
- ```mermaid
80
- flowchart TB
81
- A["安装 Apollo"] --> B["重启 DSH"]
82
- B --> C["选择工程模式"]
83
- C --> D["可选:设置 CLI"]
84
- D --> E["开始任务"]
85
- ```
85
+ 需要 Node.js `^22.19.0 || >=24.0.0`,以及 DSH `>=0.2.1-rc.2 <0.3.0`。已验证基线是 DSH `0.2.1-rc.2`。
86
86
 
87
87
  ```sh
88
- # npm 安装(推荐)
89
- dsh plugin --profile <profile> add @menghuan1918/dsh-apollo@0.4.0
88
+ # npm 安装(发布后)
89
+ dsh plugin --profile <profile> add @menghuan1918/dsh-apollo@0.5.0
90
90
 
91
91
  # 或从 GitHub main 源码安装(备选)
92
92
  dsh plugin --profile <profile> add github:Menghuan1918/dsh-apollo
93
93
  ```
94
94
 
95
- npm 包页面:[`@menghuan1918/dsh-apollo`](https://www.npmjs.com/package/@menghuan1918/dsh-apollo)。安装、升级或换包都会改变运行的代码,必须重启对应 profile 的 DSH 进程;只刷新网页不够。重启后选择「工程模式」;需要 CLI 时,打开 **Plugins → @menghuan1918/dsh-apollo → `apollo-skills` 行** 按需启用。
95
+ > **发布状态(诚实说明)**:Apollo `0.5.0` 把 `dsh-better-subagent@0.1.0` 与 `dsh-better-compact@0.1.0` 声明为**精确 npm 依赖**,但截至本实现完成,这两个版本尚未发布到 npm。Apollo 0.5.0 必须在两个子包发布并按顺序验证后再发布;本仓库的验证使用本地 tarball `npm install --no-save`,提交的 manifest 中**没有** `file:` / `link:` / Git 说明符。
96
+
97
+ 安装、升级或换包都会改变运行的代码,必须重启对应 profile 的 DSH 进程;只刷新网页不够。目标行、子代理行与压缩行由 Apollo 的 bundle patch 插入,不需要再单独 `add` 三个子包。
96
98
 
97
- > npm 和 GitHub 安装都会自动带入精确依赖 `dsh-better-goal@0.1.0`,**不需要再单独安装**。安装 Apollo 不会安装、登录或启用 Codex / Claude。
99
+ > **不要重复添加**:已经显式选中 better-subagent / better-compact bundle 的 profile,再加 Apollo 会形成“双显式来源”。Loader 仍只激活一行,但 DSH 0.2.1-rc.2 会把同一 id 的配置写入拒绝为只读(见[独立使用与组合安装](#独立使用与组合安装))。只保留一个显式入口。
98
100
 
99
- 如果之前通过 GitHub 或 `link:` 安装了旧名 `dsh-apollo`,迁移到 scoped npm 包时请按下面两条命令手动处理,不要依赖自动迁移。会话记录会保留,但换包后仍须重启对应 profile(刷新网页不够):
101
+ 如果之前通过 GitHub 或 `link:` 安装了旧名 `dsh-apollo`,迁移到 scoped npm 包时请手动处理,不要依赖自动迁移。会话记录会保留,但换包后仍须重启 profile:
100
102
 
101
103
  ```sh
102
104
  dsh plugin --profile <profile> remove dsh-apollo
103
- dsh plugin --profile <profile> add @menghuan1918/dsh-apollo@0.4.0
105
+ dsh plugin --profile <profile> add @menghuan1918/dsh-apollo@0.5.0
104
106
  ```
105
107
 
106
108
  > `dsh-apollo` 只是旧入口名;unscoped 的 `dsh-apollo` 已被其他项目占用,不要从 npm 安装它。
107
109
 
108
- > **0.4.0 破坏性变更**:删除了 `eng-noask`(工程模式(无提问))预设,之前用它开的会话不能再按原预设恢复,请改用 `eng` 或 `eng-ptc` 新建会话。
110
+ ## 从 0.4.x 升级
109
111
 
110
- ## CLI 后台任务
111
-
112
- 你不需要记住工具名或调用格式:在会话里正常派发任务即可。需要时,Agent 会把子任务交给本机 Codex / Claude 后台执行,结果回到父会话;之后可以继续同一任务。
112
+ 0.5.0 把子代理与压缩能力移出 Apollo。旧 profile 不需要手工重填配置:Apollo 启动后在 settings/loader 可用时运行一次**幂等迁移**([src/migrate.js](src/migrate.js))。
113
113
 
114
114
  ```mermaid
115
- flowchart TB
116
- U["用户派发任务"] --> P["父会话"]
117
- P --> C["本机 Codex / Claude 执行"]
118
- S["Plugins → @menghuan1918/dsh-apollo<br/>模型 · effort · 权限"] -. 配置 .-> C
119
- C --> R["结果回到父会话"]
120
- R --> N["继续同一任务"]
115
+ flowchart LR
116
+ A["旧 Apollo 行<br/>tiers / subagents / trustedHosts / exitGuard"] --> B["启动后迁移"]
117
+ C["旧 eng / eng-ptc 预设里的<br/>原生 compaction-basic 显式配置"] --> B
118
+ B --> D["dsh-better-subagent<br/>缺失字段补齐"]
119
+ B --> E["dsh-better-compact<br/>缺失字段补齐"]
120
+ B --> F["Apollo exitGuard<br/>只留 job/通用守卫"]
121
121
  ```
122
122
 
123
- ### 启用步骤
123
+ 规则:
124
124
 
125
- 1. 在运行 DSH 的机器上安装并登录 Codex CLI 或 Claude Code,确认账户有可用额度。
126
- 2. 打开 **Plugins → @menghuan1918/dsh-apollo → `apollo-skills` 行**,启用对应后端,填写可执行文件,点「自动发现模型」或手填至少一个模型与匹配的 effort;Codex 可选 profile。
127
- 3. 选择接入范围(默认只对工程预设生效;需要全局时再打开)和 CLI 权限,保存。
128
- 4. 如果当前会话是在启用前开的,新建会话再派发。
125
+ - **目标行已有的显式用户值优先**;迁移只补缺失字段,不覆盖你在新设置页里改过的值。显式 `false` / `0` / `""` / `[]` 都是值。
126
+ - 旧 `exitGuard` 的初值同时复制到 better-subagent 的 `childExitGuard`;Apollo 自己的 `exitGuard` 继续作为后台 job/通用守卫开关,之后两者可独立配置。
127
+ - 旧原生 `compaction-basic` 的显式配置(`auto`、阈值、headroom、保留方式、摘要路由、输出上限、重试、`modelPolicies`)补进 better-compact;目标缺失的模式采用默认 `goal`。
128
+ - `trustedHosts` 是非 volatile 部署字段,经宿主 configEditor 写到目标行,不绕过字段限制。
129
+ - 迁移**不删除**旧配置、不复制 CLI 身份 KV、不复制 goal 状态;写入后重读验证,失败/目标行尚不可写时明确报告“待迁移/需重载”,不会假装成功。
130
+ - 旧 `apollo-skills` 行里的 `tiers` / `subagents` / `trustedHosts` 降级为 **deprecated、运行时无效**,只为装载旧 profile 与迁移保留;网页上不再把它们作为活跃子代理设置展示。
129
131
 
130
- ### 自动发现模型
132
+ 升级后:
131
133
 
132
- 设置页的「自动发现模型」按后端读取一次模型清单,**只追加列表里还没有的 id**,不覆盖已有条目;默认模型为空时自动选第一个。
134
+ 1. 重启 profile(只刷新网页不算重载)。
135
+ 2. 迁移写入的压缩设置需要**再重载一次**才会被运行中的引擎采用(引擎使用载入时冻结快照;设置页/inspect 会显示 `requiresReload`)。
136
+ 3. 如果旧 profile 曾用网页编辑器保存过 `preset-eng` / `preset-eng-ptc` 的整份覆盖,那份覆盖会按 DSH 规则优先于新 bundle 的预设;其中如果还引用原生 `compaction-basic`,需要重新保存/清理该预设覆盖,才能用上新的 engine。
137
+ 4. 如果旧预设行已经被手动删除,迁移会报告 `source-missing` 而不是假装保留:请按 [dsh-better-compact 的配置表](https://github.com/Menghuan1918/dsh-better-compact#configuration) 手工把旧值填进新的 compact 行,或恢复升级前的 `cordis.patch.yml` 备份。多个预设显式配置无法确定时迁移报告 `ambiguous`,不会猜。
133
138
 
134
- | 后端 | 来源 | 说明 |
135
- |---|---|---|
136
- | Codex | `codex debug models`(失败退回 `--bundled`) | 清单跟随 `config.toml` 的 model_provider;id 取 `slug`,effort 取 `supported_reasoning_levels`,默认 effort 取 `default_reasoning_level`,只收 `visibility: "list"` 的模型。 |
137
- | Claude | `GET {ANTHROPIC_BASE_URL}/v1/models` | Claude CLI 没有模型清单命令;Apollo 读取与 CLI 相同的端点与凭据(进程 env,其次 `~/.claude/settings.json` 的 `env`)。凭据只在宿主进程内用于请求头,不会返回给页面。effort 固定为 `low` / `medium` / `high` / `xhigh` / `max`,默认 `high`。 |
138
-
139
- > Codex 的 `profile` 不参与发现(`codex debug models` 不接受 `-p`);profile 若改了 model_provider,请手填该 profile 的模型。Claude 的 OAuth 订阅凭据存在系统钥匙串时不参与发现——请手填模型,或把 `ANTHROPIC_AUTH_TOKEN` / `ANTHROPIC_API_KEY` 放进进程 env 或 `~/.claude/settings.json` 的 `env`。
140
-
141
- > **安全默认**
142
- >
143
- > - CLI 权限**不继承父会话**;默认 Codex 为 `read-only`,Claude 为 `plan`。
144
- > - CLI 默认关闭;Apollo 不安装、不登录 CLI,请先在本机完成安装与登录。
145
- > - 权限每轮读取最新设置;模型、effort、可执行文件和初始目录在创建时固定。
146
- > - Codex 固定非交互审批,Claude 的权限提问自动拒绝;CLI 仍受宿主文件沙箱限制。
147
-
148
- ### 行为边界
139
+ ## 设置与行归属
149
140
 
150
- - **后台执行**:任务在后台运行,完成时结果回到父会话,可以继续同一任务。
151
- - **工作目录固定**:`cwd` 可为绝对路径或相对父会话当前目录的路径;省略则继承当前目录,创建后不跟随父会话切换。
152
- - **白名单与文本**:模型和 effort 必须在允许列表内;只支持文本,失败不会自动重试。
141
+ | 行 | 所属包 | 主要设置 | 生效 |
142
+ |---|---|---|---|
143
+ | `apollo-skills` | Apollo | `exitGuard`(**只**拦运行中后台 job) | volatile,保存即生效 |
144
+ | `dsh-better-subagent` | better-subagent | `childExitGuard`、`tiers.*`、两个 CLI 后端、`subagents.eng/global` | volatile,保存即生效 |
145
+ | `dsh-better-compact` | better-compact | 模式、auto、阈值/headroom/保留、摘要模型、重试、模型策略 | volatile 保存;**引擎快照需重载 profile** |
146
+ | `dsh-better-goal` | goal | 轮数策略、提问超时 | volatile,保存即生效 |
153
147
 
154
- ## 长期目标
148
+ - Apollo 的最小行页只保留后台任务退出守卫与迁移说明。
149
+ - 子代理页、压缩页分别由两个独立包自己的浏览器半边注册;它们也注册 Apollo 集成槽别名(`@menghuan1918/dsh-apollo#<row>`、`dsh-apollo#<row>`),独立与集成共用同一份实现,不产生三份配置。
150
+ - 运行中子代理的拦截与 Apollo 的后台 job 守卫是**两个独立开关**;任意一个关闭都不影响原生工具。
151
+ - 原生 `subagent` / `subagent_fork` / `send_message` / `interrupt_agent` 注册表不变;better-subagent 只是在它上面加路由、等待工具与提示词,不拆第二套 registry。
155
152
 
156
- 目标域由独立插件 **[`dsh-better-goal`](https://www.npmjs.com/package/dsh-better-goal)**(npm `0.1.0`)提供,Apollo 负责把它装进同一个 profile。每个会话一个持久目标;执行步骤单独记录,不与目标混在一起。模型侧只看到一个 `goal` 工具,人侧用 `/goal` 管理同一个目标。
153
+ ### 什么时候需要重启
157
154
 
158
- > **相较原生 goal,重点不只是继续跑,而是该停时能停。** 缺少必需密钥、权限或外部条件时,Agent 可以立即记录失败原因并停止续跑,不用先凑目标轮数;提问默认等 120 秒,超时后仍可回答,也可以先推进不依赖答案的工作。原生的受阻门槛、恢复限制、默认阻塞提问与本插件的[完整对照](https://github.com/Menghuan1918/dsh-better-goal/blob/main/README.md#与-dsh-原生-goal-对比)见独立插件文档。
155
+ | 改动 | 生效方式 |
156
+ |---|---|
157
+ | Apollo `exitGuard`、子代理行、goal 行设置 | 保存后即时生效 |
158
+ | better-compact 设置 | 保存后写入 profile;重启 profile 后引擎采用新快照 |
159
+ | 安装 / 升级 / 移除 bundle、修改预设或顶层 patch | 重启对应 profile 的 DSH 进程 |
160
+ | 已有 CLI 子代理的模型 / effort / profile / 可执行文件 / 初始目录 | 创建时固定;改设置只影响新任务 |
161
+ | 已有 CLI 子代理的权限 | 每轮读取最新设置 |
159
162
 
160
- - **默认轮数策略是 `agent`**:由 Agent 按任务决定是否设置上限;切到 `fixed` 才使用配置值,`unlimited` 不施加策略性轮数上限。
161
- - **固定值默认 `256`**,只在 `fixed` 模式生效。
162
- - **提问超时默认 `120` 秒**,`-1` 表示永不超时;只影响之后新建的等待,超时不会被当作同意。
163
- - **重开、恢复或 fork 会话**后,目标与计数恢复,但自动续跑停止;**Agent 可以自行恢复续跑**,人类也可以用 `/goal resume` 或 UI 继续——没有“必须人类先发言”或“只有 UI 才能恢复”的限制。用户中断会停止续跑。
164
- - 完成前应逐项核对当前文件、命令和测试结果;失败可带具体原因停止。
163
+ ## 独立使用与组合安装
165
164
 
166
- 目标设置位于 **Plugins → @menghuan1918/dsh-apollo → `dsh-better-goal` 行**(独立安装时为 **Plugins → dsh-better-goal**):
165
+ 两个新插件都不依赖 Apollo,也可以单独使用:
167
166
 
168
- | 设置 | 默认 | 行为 |
169
- |---|---|---|
170
- | `roundLimitMode` | `agent` | `agent` / `unlimited` / `fixed` |
171
- | `roundLimit` | `256` | 仅 `fixed` 模式使用的正整数上限 |
172
- | `questionTimeoutSeconds` | `120` | 新提问等待秒数;`-1` 永不超时 |
167
+ ```sh
168
+ # 只装子代理增强
169
+ dsh plugin --profile <profile> add @menghuan1918/dsh-better-subagent@0.1.0
173
170
 
174
- 目标工具与命令的完整说明以 [独立插件 README](https://github.com/Menghuan1918/dsh-better-goal/blob/main/README.md) 为准。
171
+ # 只装压缩
172
+ dsh plugin --profile <profile> add dsh-better-compact@0.1.0
173
+ ```
175
174
 
176
- ## 设置与权限
175
+ 独立安装时的行、页面和提示词与 Apollo 集成完全相同;行 id/name 也是同一组稳定值。区别只在**由谁插入这些行**:Apollo 的 bundle patch 自己携带同样的行,因为 DSH 不会自动应用传递依赖的 bundle patch。
177
176
 
178
- 打开 **Plugins → @menghuan1918/dsh-apollo → `apollo-skills` 行** 修改模型分档、CLI 和退出守卫设置;目标设置在同页的 `dsh-better-goal` 行。保存后即时生效。
177
+ | 组合 | 结果 |
178
+ |---|---|
179
+ | 只有 Apollo | Apollo 插入 goal / subagent / compact companion+engine / 自己的行;工程预设内带 compact engine |
180
+ | 只有独立 bundle | 各自插入同样的行;没有 Apollo 的工程预设、技能或 job 守卫 |
181
+ | Apollo + 独立 bundle 同时显式选中 | Loader 仍按行 id 只激活**一行**实例,但 DSH 0.2.1-rc.2 会拒绝为同一 id 写入配置:行可读、开关/配置**只读**(见下) |
179
182
 
180
- | 设置 | 默认 | 说明 |
181
- |---|---|---|
182
- | `exitGuard` | `false` | 退出守卫;开启后在回合结束时拦下仍在运行的后台工作,用户中断始终放行 |
183
- | `tiers.fast` / `tiers.quality` | 空(沿用父会话路由) | 子代理快速档(探索、侦察、批量排查)与质量档(复杂实现、调试、审查、设计)的 provider / model / effort;从「子代理 → 模型选择」白名单下拉选择,写进工程模式提示词 |
184
- | `subagents.eng` | `true` | 在 `eng` / `eng-ptc` 中接入 CLI 后台任务 |
185
- | `subagents.global` | `false` | 在所有具备所需工具和服务的预设中接入 |
186
- | `codex.enabled` / `claude.enabled` | `false` | 启用对应 CLI 后端 |
187
- | `executable` | `codex` / `claude` | PATH 命令名、绝对路径或 `~/` 路径 |
188
- | `defaultModel` / `models` | 空 / `[]` | 启用前至少配置一个模型、默认模型和匹配的 effort;可用「自动发现模型」从本机 CLI 或 Anthropic 端点补齐 |
183
+ ### 双显式 bundle 的只读限制(已在临时 profile 验证)
189
184
 
190
- 模型分档要生效,需先在 **Plugins → 子代理 → 模型选择** 开启模型选择并把路由加入白名单;设置页只能选白名单内的路由,未开启时会提示。模型选择策略在会话创建时记录,改白名单只影响新会话;分档本身改完下一次请求即生效。
185
+ 在 DSH `0.2.1-rc.2` 上,同一行 id 由两个显式 bundle 插入时:
191
186
 
192
- 权限档见下表;模型 ID、effort 和 profile 以 CLI 与账户实际支持为准,自动发现读到的清单也受同一限制。表单会阻止不完整组合,手写配置虽可装载,但调用时会失败。
187
+ - 运行实例仍然只有一个:`wait_subagent`、提示词 section、压缩引擎和工具都不会重复;
188
+ - 行配置**可以读**(设置页能看到值),但保存会被宿主拒绝(实测信息为 `Configuration for "<id>" is overridden by a home patch or command-line overlay`);
189
+ - 插件管理器里的“组合行不可寻址/只读”标记属于 Web 管理界面,当前 headless 冒烟没有点验该 UI 标签,只验证了实际写入限制。
193
190
 
194
- ### CLI 权限对照
191
+ 恢复方法:**只保留一个显式入口**。例如移除独立 bundle 或移除 Apollo,然后重启 profile:
195
192
 
196
- | 后端 | 默认 | 可选档位 |
197
- |---|---|---|
198
- | Codex | `read-only` | `read-only` / `workspace-write` / `danger-full-access`(对应 `codex --sandbox`) |
199
- | Claude | `plan` | `plan` / `manual` / `dontAsk` / `acceptEdits` / `auto` / `bypassPermissions`(对应 `claude --permission-mode`) |
193
+ ```sh
194
+ dsh plugin --profile <profile> remove dsh-better-subagent
195
+ dsh plugin --profile <profile> remove dsh-better-compact
196
+ # 或反过来移除 Apollo,仅保留独立包
197
+ ```
200
198
 
201
- 档位名称直接传给对应 CLI;具体允许哪些工具、是否自动批准,仍由 CLI 版本和账户决定。**CLI 权限不继承父会话**,请把默认值当作安全基线,只在明确需要时放宽。
199
+ 不要为了“多一层保险”同时安装两套入口。
202
200
 
203
- ### 什么时候需要重启
201
+ ### 禁用、卸载与回退
204
202
 
205
- | 改动 | 生效方式 |
206
- |---|---|
207
- | Plugins 中的运行时设置(Apollo 行与 goal 行) | 保存后即时生效,无需重启 |
208
- | 安装 / 升级插件、修改技能或预设文件、顶层 patch | 重启对应 profile 的 DSH 进程 |
209
- | 已有 CLI 后台任务的模型 / effort / profile / 可执行文件 / 初始目录 | 创建时固定;改设置只影响新任务 |
210
- | 已有 CLI 后台任务的权限 | 每轮读取最新设置 |
203
+ - 移除独立 bundle **不会**移除 Apollo 仍然装配的同一稳定行;反之亦然。文档必须按“有效 row 的来源”而不是 bundle 名判断。
204
+ - 彻底移除压缩增强:从 Apollo 组合中移除 Apollo,或把预设/组合改回原生压缩。**只禁用独立 compact bundle 不会恢复 Apollo 预设内的 engine 行**,因为该 engine 由 Apollo 自己的预设 patch 声明;需要移除 Apollo,或恢复一份使用原生 `compaction-basic` 的预设覆盖。
205
+ - 彻底移除子代理增强:移除 Apollo(或至少禁用其 `dsh-better-subagent` 行)。原生 create/fork/message/interrupt 仍可用;CLI-only 旧会话需要重新安装 better-subagent 才能续接,其它原生会话不受影响。
206
+ - 卸载不删除原生压缩事件、goal 日志或 CLI 身份 KV;handoff 临时文件不是必需依赖,删除后已压缩会话仍可从原生 checkpoint 恢复。
207
+ - 回退到 0.4.x 前先备份 profile 的 `cordis.patch.yml`;旧字段仍能装载,但 0.5.0 写入的新行配置不会被 0.4.x 读取。
211
208
 
212
- ## FAQ
209
+ ## 提示词归属
213
210
 
214
- <details><summary>需要单独安装 dsh-better-goal 吗?</summary>
211
+ 运行时只有一份来源:
215
212
 
216
- 不需要。通过 npm 或 GitHub 安装 Apollo 时,Apollo 会把 `dsh-better-goal@0.1.0` 作为固定依赖装配进来,goal 行和 `/goal` 一起可用。只有在准备脱离 Apollo 单独使用目标插件时,才按[独立包页面](https://www.npmjs.com/package/dsh-better-goal)或独立仓库说明安装;不要在同一个 profile 里重复添加两个 goal bundle。
213
+ - **Apollo**(`eng-mode-instructions`):通用工程纪律 + `exitGuard` 开启时的 job-only 退出守卫说明;不含委派、分档、CLI 目录或 child guard。
214
+ - **better-subagent**(per-Agent sections):`better-subagent:delegation`(委派 + fast/quality 分档,`eng-ptc` 自行追加 PTC fan-out)、`better-subagent:child-guard`(`childExitGuard` 开启时)、`better-subagent:cli-subagents`(有启用后端时)。
215
+ - **better-compact**:不注册系统提示词段。
217
216
 
218
- </details>
217
+ [prompts/eng.md](prompts/eng.md) / [prompts/eng-ptc.md](prompts/eng-ptc.md) 由真实 headless 宿主装配生成(`npm run prompts`),临时 profile 会复制三个独立包的真实发布文件,所以快照里的新插件段落来自它们自己的运行时实现,而不是 Apollo 的第二份副本。
219
218
 
220
- <details><summary>为什么 Plugins 的 @menghuan1918/dsh-apollo 下有两个配置行?</summary>
219
+ ## Specs 与发布包
221
220
 
222
- 两行分工不同:`apollo-skills` 管流程技能、CLI 后台任务、退出守卫和模型设置;`dsh-better-goal` 管目标的轮数策略与提问超时。它们来自同一次安装,不是重复安装。
221
+ 本仓库的私有设计 Specs(`docs/specs/`)**不进入 Git 提交,也不进入 npm 包**:
223
222
 
224
- </details>
223
+ - 它们由本仓库的 Git 私有排除规则忽略;
224
+ - `package.json` 的 `files` 只列入 `docs/DEVELOPMENT.md`,并额外用 [.npmignore](.npmignore) 排除 `docs/specs/`;
225
+ - `tests/packaging.test.mjs` 直接运行 `npm pack --dry-run --json`,断言发布清单没有 Specs、测试、脚本、快照或 tarball。
225
226
 
226
- <details><summary>CLI 后台任务为什么不可用?</summary>
227
+ 发布顺序:**先发布并验证两个独立包(`@menghuan1918/dsh-better-subagent@0.1.0`、`dsh-better-compact@0.1.0`),再发布 Apollo 0.5.0**。Apollo 的精确依赖指向尚不存在的版本时,`npm install` 会失败;不要用开发 `file:`/`link:` 依赖发布。两个子仓各自有 trusted publishing workflow;Apollo 的 [release workflow](.github/workflows/release.yml) 只发布本包。
227
228
 
228
- 按顺序检查:CLI 是否已安装并登录;对应后端是否已在 `apollo-skills` 中启用;是否配置了默认模型和匹配的 effort;当前预设是否在接入范围内;是否是需要新建的旧会话。
229
+ ## 验证状态(诚实记录)
229
230
 
230
- </details>
231
+ 在本实现提交时验证过(命令与结果见 [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)):
231
232
 
232
- <details><summary>eng 和 eng-ptc 怎么选?</summary>
233
+ - `npm test`:配置/装配/漂移/迁移纯函数/settings/客户端/prompt/发布清单全部通过,含真实 temp-profile 迁移测试;
234
+ - `npm run prompts`:用发布布局复制 Apollo + 三个独立包,由真实 headless 宿主重新生成两份快照;
235
+ - `npm pack --dry-run --json`:发布清单无 Specs/tests/scripts/prompts/tarball;
236
+ - `node scripts/runtime-smoke.mjs apollo|standalone|both`:临时 profile + 脚本化 LLM 适配器(无凭据),覆盖单实例行、旧配置迁移、eng 回合、native subagent create/wait、手动 `/compact`、inspect、真实后台 job 退出守卫、保存→`requiresReload`→重启→`activeConfig`、独立组合与双显式 bundle 的只读限制。
233
237
 
234
- 默认用 `eng`。任务里有大量「读多个文件 → 过滤 → 汇总」或循环式操作时用 `eng-ptc`:模型写一个 `run_code` 程序一次完成,中间结果不进上下文。`eng-ptc` 没有 workflow 工具;`/exec` 用 `subagent` + `wait_subagent` 编排,两种模式都能用。两者的纪律、分档、CLI 后台任务和退出守卫一致。
238
+ **未验证 / 明确限制**:
235
239
 
236
- </details>
240
+ - 两个子包的 `0.1.0` 尚未发布;本轮只用本地 tarball 验证,未验证 npm registry 安装路径。
241
+ - 未修改或重启用户当前运行的 profile,未验证当前 GUI(`http://127.0.0.1:3384`)的设置页/卡片;S3 视觉设置页的 GUI 验收归 S3/最终宿主验收。
242
+ - 未运行真实 Codex/Claude CLI 的真实模型回合(那属于两个子包自己的验证;Apollo 侧本轮只用脚本化适配器)。
243
+ - 真实模型摘要保真、缓存命中率与跨版本预设漂移仍需按实际环境复验。
237
244
 
238
- <details><summary>如何卸载?</summary>
245
+ ## 开发
239
246
 
240
247
  ```sh
241
- dsh plugin --profile <profile> remove @menghuan1918/dsh-apollo
248
+ npm install
249
+ npm test
250
+ npm run prompts # 需要 DSH_PACKAGE_ROOT
251
+ npm run smoke -- apollo # 或 standalone / both / all,需要 DSH_PACKAGE_ROOT
242
252
  ```
243
253
 
244
- 旧的 unscoped 入口用 `remove dsh-apollo` 卸载。卸载 Apollo 后,Apollo 插入的 goal 行也会消失。若之前还单独安装过 `dsh-better-goal`,需要按独立仓库的说明一并处理。
245
-
246
- </details>
247
-
248
- ## 开发文档
249
-
250
- 实现、配置、测试、冒烟和历史兼容细节见 [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)。
254
+ 实现、迁移契约、测试细节与冒烟场景见 [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)。
251
255
 
252
256
  ## 许可与致谢
253
257
 
254
- 本包采用 **GPL-3.0-or-later**,见 [LICENSE](LICENSE)。工程预设改编自 DeepSeek Harness 的 MIT 标准预设与 PTC 预设([预设声明](presets/eng/NOTICE)、[MIT 许可](third-party/LICENSE-MIT-dsh-standard-preset));`tdd` / `diagnosing-bugs` 改编自 [mattpocock/skills](https://github.com/mattpocock/skills)([第三方声明](third-party/NOTICE-mattpocock-skills));能力探针的请求信任边界改编自 dsh-better-sidebar,源自 BSD-3-Clause 的 DSH client connection 实现。
258
+ 本包采用 **GPL-3.0-or-later**,见 [LICENSE](LICENSE)。工程预设改编自 DeepSeek Harness 的 MIT 标准预设与 PTC 预设([预设声明](presets/eng/NOTICE)、[MIT 许可](third-party/LICENSE-MIT-dsh-standard-preset));`tdd` / `diagnosing-bugs` 改编自 [mattpocock/skills](https://github.com/mattpocock/skills)([第三方声明](third-party/NOTICE-mattpocock-skills))。子代理与压缩实现分别在各自仓库保留版权与许可声明。
package/cordis.patch.yml CHANGED
@@ -1,22 +1,33 @@
1
- # dsh-apollo bundle patch: inserts the two host-plane rows this package needs
2
- # into the profile roster. Applied as a profile bundle layer (the first entry
3
- # of the `dsh.bundle.patch` array in package.json — the eng/eng-ptc preset
4
- # patches in presets/ load after it); activate with
5
- # `dsh plugin --profile <name> add link:<path-to>/dsh-apollo`.
1
+ # dsh-apollo bundle patch: inserts the host-plane rows this package needs into
2
+ # the profile roster. Applied as a profile bundle layer (the first entry of the
3
+ # `dsh.bundle.patch` array in package.json — the eng/eng-ptc preset patches in
4
+ # presets/ load after it); activate with
5
+ # `dsh plugin --profile <name> add @menghuan1918/dsh-apollo`.
6
+ #
7
+ # Apollo 0.5.0 is an integration bundle. The subagent and compaction features
8
+ # are owned by two independent plugins, and Apollo repeats their *same stable
9
+ # rows* here because DSH does not auto-apply a transitive dependency's bundle
10
+ # patch (`dsh plugin add` only selects directly installed bundles):
11
+ #
12
+ # - `@menghuan1918/dsh-better-subagent` owns the Codex/Claude CLI subagents,
13
+ # `wait_subagent`, the running-child exit guard, the subagent settings page
14
+ # and every subagent-specific prompt section;
15
+ # - `dsh-better-compact` (host companion) + `dsh-better-compact/engine`
16
+ # (engine row) own compaction; the native host-plane `compaction-basic` is
17
+ # disabled here exactly like the standalone bundle, and the eng/eng-ptc
18
+ # presets carry the engine row inside their own compaction realm;
19
+ # - `dsh-better-goal` keeps owning the goal domain.
20
+ #
21
+ # Selecting both the standalone bundle and Apollo still loads one instance: the
22
+ # Loader keys entries by row id. The same rule makes the double-explicit-bundle
23
+ # combination unaddressable in DSH 0.2.1-rc.2 (the config editor excludes
24
+ # duplicate ids), so prefer one explicit entry; see docs/DEVELOPMENT.md.
6
25
  #
7
26
  # ── goal domain: independent dsh-better-goal row ────────────────────────────
8
27
  # The native goal service, round driver, /goal command, model-facing tool and
9
- # GoalBar UI are disabled below and replaced by the independent dsh-better-goal
10
- # plugin. Its own bundle patch declares exactly these native disables plus the
11
- # same top-level row (id and name `dsh-better-goal`), so selecting both bundles
12
- # still loads one row: the Loader keys entries by row id.
13
- #
14
- # Apollo carries the lines itself because DSH does not auto-apply a transitive
15
- # dependency's bundle patch — `dsh plugin add` only selects the directly
16
- # installed bundle. Consequently, disabling or removing the standalone
17
- # dsh-better-goal bundle does NOT disable this row; goal remains available
18
- # through Apollo. Conversely, a profile that already selected the standalone
19
- # bundle must not hand-write a third row.
28
+ # GoalBar UI are disabled below and replaced by dsh-better-goal's own stable
29
+ # row. Disabling or removing the standalone dsh-better-goal bundle does NOT
30
+ # disable this row; goal remains available through Apollo.
20
31
  - id: goal
21
32
  disabled: true
22
33
  - id: goal-round-driver
@@ -32,6 +43,32 @@
32
43
  - id: dsh-better-goal
33
44
  name: dsh-better-goal
34
45
 
46
+ # ── compaction: independent dsh-better-compact rows ─────────────────────────
47
+ # Same stable rows/ids as the standalone bundle. `compaction-basic` is the
48
+ # native host-plane default; Web compositions already disable it and mount
49
+ # compaction inside each preset, while headless compositions keep this
50
+ # disabled row so exactly one compaction service exists. The host-plane engine
51
+ # detects a preset-owned engine and stays out of the way.
52
+ - id: compaction-basic
53
+ disabled: true
54
+
55
+ - insert:
56
+ - id: dsh-better-compact
57
+ name: dsh-better-compact
58
+
59
+ - id: dsh-better-compact-engine
60
+ name: dsh-better-compact/engine
61
+
62
+ # ── subagent enhancement: independent dsh-better-subagent row ───────────────
63
+ # One host-plane row owns the CLI adapters/routing bridge, the `wait_subagent`
64
+ # tool, the running-child exit guard, `/better-subagent/api/*` (+ the
65
+ # `/apollo/api/*` read aliases) and the subagent prompt sections. It does not
66
+ # replace the native subagent registry: create/fork/message/interrupt still
67
+ # come from the host tools.
68
+ - insert:
69
+ - id: dsh-better-subagent
70
+ name: '@menghuan1918/dsh-better-subagent'
71
+
35
72
  # ── Apollo host row ─────────────────────────────────────────────────────────
36
73
  # The apollo-skills row is one row on purpose. The row's module specifier must
37
74
  # be this package's npm name (`@menghuan1918/dsh-apollo`), not a short alias,
@@ -42,37 +79,33 @@
42
79
  # would resolve host code only if an alias existed, then silently lose the
43
80
  # client half (the manifest name no longer matches). The page-side closure id
44
81
  # is the manifest package name too. It rejects a second active row resolving to
45
- # the same package name ("resolves from multiple active Loader sources"). So
46
- # this one node half does every job:
82
+ # the same package name ("resolves from multiple active Loader sources").
47
83
  #
48
- # 1. registers the packaged skills/ tree on the skill registry's global layer
49
- # (every preset mounting tool-skill then exposes the catalog);
50
- # 2. mounts the formal row Config (src/config.js, a @deepseek-ai/schemastery
51
- # schema) together with the configForm that edits it from Plugins →
52
- # Apollo; volatile fields apply without reloading this row;
53
- # 3. registers the read-only capability endpoint /apollo/api/capabilities
54
- # (src/panel.js), which that form reads to show where each CLI resolved;
55
- # 4. installs the CLI subagent bridge (src/subagents.js) over the existing
56
- # subagent tools — it adds no tool of its own;
57
- # 5. when the row config sets `declareOwnsHost: true`, taps the index HTML so
58
- # the official client treats a proxied page as loopback.
84
+ # Apollo 0.5.0 keeps only the responsibilities that were not migrated:
85
+ # 1. the packaged skills/ tree on the skill registry's global layer;
86
+ # 2. the formal row Config (src/config.js) with its minimal browser page —
87
+ # the background-job `exitGuard` switch and the `declareOwnsHost`
88
+ # deployment flag, plus deprecated load-only fields kept so old profiles
89
+ # load during migration;
90
+ # 3. the one-time legacy `exitGuard` import and the one-time old-config
91
+ # migration into dsh-better-subagent / dsh-better-compact (src/migrate.js);
92
+ # 4. the `declareOwnsHost` index tap.
93
+ # It no longer registers `/apollo/api/*` (dsh-better-subagent owns those read
94
+ # aliases) and no longer implements CLI protocols, subagent routing, the wait
95
+ # tool, tier/delegation prompt generation or the child exit guard.
59
96
  #
60
- # Row config — two classes of fields (details in README, section 配置):
61
- # - volatile, editable from the Web form: `exitGuard`, `tiers.{fast,quality}`,
62
- # `subagents.{eng,global}`, `subagents.{codex,claude}.*`
63
- # (enabled / executable / profile / permissionMode / defaultModel / models[]).
64
- # Changes do NOT reload this row.
65
- # - deployment flags, hand-written here, never edited from the Web form (the
66
- # settings layer rejects writes outside the volatile paths):
67
- # `trustedHosts: string[]` — reverse-proxy authorities additionally allowed
68
- # to call /apollo/api/* (loopback is always trusted);
69
- # `declareOwnsHost: boolean` — the boot global above; off by default,
70
- # enable only behind a trusted proxy.
97
+ # Row config — two classes of fields (details in README, section 设置与权限):
98
+ # - volatile, editable from the Web form: `exitGuard` (background jobs only)
99
+ # and the deprecated `tiers.*` / `subagents.*` / `exitGuard`-era fields that
100
+ # the migration reads; every deprecated field is inert at runtime;
101
+ # - deployment flags, hand-written here, never edited from the Web form:
102
+ # `trustedHosts` (deprecated, load-only; the new plugin owns its own
103
+ # `trustedHosts`), `declareOwnsHost` (the boot global above; off by
104
+ # default, enable only behind a trusted proxy).
71
105
  #
72
106
  # Presets are separate bundle-patch rows (presets/eng.patch.yml,
73
107
  # presets/eng-ptc.patch.yml): a preset is an `insert` of a
74
- # `@deepseek-ai/dsh-agent-preset` row read straight from that file — the old
75
- # sync-into-<dshHome>/.agent-presets delivery no longer exists.
108
+ # `@deepseek-ai/dsh-agent-preset` row read straight from that file.
76
109
  - insert:
77
110
  - id: apollo-skills
78
111
  name: '@menghuan1918/dsh-apollo'