dsh-tower 2.1.0 → 2.4.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.
Files changed (203) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/COMPATIBILITY.md +6 -1
  3. package/CONTRIBUTING.md +78 -5
  4. package/PRINCIPLES.md +163 -0
  5. package/README.en.md +35 -19
  6. package/README.md +28 -18
  7. package/SECURITY.md +6 -0
  8. package/{lib → adapters}/archive.js +1 -1
  9. package/{lib → adapters}/caseSensitivity.js +1 -1
  10. package/adapters/default.js +51 -10
  11. package/{lib → adapters}/git.js +1 -1
  12. package/{lib → adapters}/leases.js +1 -1
  13. package/{lib → adapters}/legacy.js +1 -1
  14. package/adapters/persistence.js +543 -0
  15. package/adapters/store-fs.js +28 -1
  16. package/adapters/store.js +204 -0
  17. package/{lib → adapters}/tests.js +9 -5
  18. package/adapters/vcs-git.js +15 -1
  19. package/{lib → adapters}/workspaceLock.js +1 -1
  20. package/{lib → adapters}/worktreeOwnership.js +1 -1
  21. package/app/archive.js +4 -6
  22. package/app/batch.js +9 -10
  23. package/app/board.js +2 -4
  24. package/app/checkCompletion.js +9 -10
  25. package/app/enrichedMissions.js +2 -4
  26. package/app/findings.js +6 -7
  27. package/app/gate.js +1 -2
  28. package/app/init.js +24 -29
  29. package/app/merge.js +58 -51
  30. package/app/messages.js +7 -8
  31. package/app/mission.js +5 -5
  32. package/app/plan.js +8 -5
  33. package/app/provision.js +12 -14
  34. package/app/read.js +6 -3
  35. package/app/rebase.js +14 -16
  36. package/app/recording.js +7 -8
  37. package/app/review.js +15 -8
  38. package/app/roster.js +14 -15
  39. package/{lib → app}/spawn-prechecks.js +4 -3
  40. package/app/spawn.js +12 -13
  41. package/app/teardown.js +8 -9
  42. package/app/tower.js +89 -35
  43. package/cordis.patch.yml +56 -28
  44. package/docs/README.md +7 -2
  45. package/docs/adr/0001-ports-adapters-as-data.md +49 -0
  46. package/docs/adr/0002-single-state-json.md +50 -0
  47. package/docs/adr/0003-allow-agent-control-default-true.md +48 -0
  48. package/docs/adr/0004-surface-budget.md +70 -0
  49. package/docs/adr/0005-component-surface.md +130 -0
  50. package/docs/adr/README.md +52 -0
  51. package/docs/agents/workflow.md +51 -0
  52. package/docs/architecture/overview.md +192 -43
  53. package/docs/guide/hot-reload.md +5 -5
  54. package/docs/guide/install-upgrade-migration.md +13 -0
  55. package/docs/guide/release.md +1 -1
  56. package/docs/operations/incident.md +82 -0
  57. package/docs/operations/runbook.md +12 -3
  58. package/docs/operations/security.md +1 -1
  59. package/docs/reference/blockers.md +2 -2
  60. package/docs/reference/component-surface.md +135 -0
  61. package/docs/reference/config.generated.md +2 -9
  62. package/docs/reference/config.md +11 -9
  63. package/docs/reference/doctor.md +53 -2
  64. package/docs/reference/errors.generated.md +41 -37
  65. package/docs/reference/errors.md +53 -41
  66. package/docs/reference/events.md +38 -6
  67. package/docs/reference/surface-budget.md +157 -0
  68. package/docs/reference/tools.generated.md +8 -5
  69. package/docs/reference/tools.md +10 -7
  70. package/docs/zh/README.md +1 -1
  71. package/docs/zh/guide/hot-reload.md +4 -4
  72. package/docs/zh/guide/install-upgrade-migration.md +10 -0
  73. package/docs/zh/operations/security.md +1 -1
  74. package/docs/zh/reference/blockers.md +2 -2
  75. package/docs/zh/reference/config.md +9 -9
  76. package/docs/zh/reference/doctor.md +29 -1
  77. package/docs/zh/reference/tools.md +10 -8
  78. package/domain/batch.js +2 -2
  79. package/domain/components.js +641 -0
  80. package/domain/config/schema.js +62 -28
  81. package/domain/contracts/outputs.js +16 -2
  82. package/domain/contracts/tool-inputs/ops.js +1 -0
  83. package/domain/errors.js +308 -43
  84. package/domain/events.js +207 -0
  85. package/domain/integration/gate.js +17 -2
  86. package/domain/integration/merge.js +35 -0
  87. package/domain/lockBudget.js +30 -0
  88. package/domain/mission.js +12 -1
  89. package/domain/missions/completion.js +14 -0
  90. package/domain/missions/lifecycle.js +9 -3
  91. package/domain/missions/plan.js +14 -0
  92. package/domain/missions/review.js +90 -7
  93. package/domain/read/views.js +3 -0
  94. package/domain/state/archive.js +1 -1
  95. package/domain/state.js +1 -1
  96. package/domain/surface.js +347 -0
  97. package/host/capability-batch.js +15 -0
  98. package/host/capability-hmr.js +30 -0
  99. package/host/capability-import.js +11 -0
  100. package/host/capability-leases.js +11 -0
  101. package/host/capability-registry.js +149 -0
  102. package/host/capability-tests.js +16 -0
  103. package/{lib → host}/doctor.js +157 -18
  104. package/{lib → host}/hmr.js +2 -4
  105. package/{lib → host}/modeStore.js +1 -1
  106. package/host/presets.js +77 -0
  107. package/{lib → host}/tool-registry.js +235 -44
  108. package/host/tower.js +32 -0
  109. package/index.js +40 -25
  110. package/locale/en.json +31 -11
  111. package/locale/zh.json +30 -10
  112. package/package.json +24 -4
  113. package/ports/archive.js +18 -0
  114. package/ports/caseSensitivity.js +15 -0
  115. package/ports/clock.js +10 -2
  116. package/ports/config.js +19 -0
  117. package/ports/contract.js +38 -0
  118. package/ports/events.js +24 -0
  119. package/ports/ids.js +10 -2
  120. package/ports/index.js +54 -2
  121. package/ports/ownership.js +17 -0
  122. package/ports/state.js +16 -0
  123. package/ports/store.js +52 -3
  124. package/ports/vcs.js +25 -4
  125. package/scripts/architecture-waivers.json +19 -0
  126. package/scripts/architecture.mjs +634 -23
  127. package/scripts/check-components.mjs +235 -0
  128. package/scripts/check-docs.mjs +8 -35
  129. package/scripts/check-pack.mjs +68 -39
  130. package/scripts/check-philosophy.mjs +266 -0
  131. package/scripts/component-surface.json +395 -0
  132. package/scripts/domain-metrics.mjs +13 -4
  133. package/scripts/generate-component-surface.mjs +59 -0
  134. package/scripts/generate-config-reference.mjs +14 -1
  135. package/scripts/generate-error-reference.mjs +68 -14
  136. package/scripts/generate-events-reference.mjs +83 -0
  137. package/scripts/generate-tools-reference.mjs +18 -25
  138. package/scripts/generate-types.mjs +127 -0
  139. package/scripts/issue-audit.mjs +2 -2
  140. package/scripts/lib/surface.mjs +87 -0
  141. package/scripts/lib/tool-surface.mjs +85 -0
  142. package/scripts/mount-smoke/fixtures.mjs +3 -3
  143. package/scripts/mount-smoke/surface.mjs +96 -27
  144. package/scripts/mount-smoke.mjs +3 -1
  145. package/scripts/pack-manifest.txt +75 -22
  146. package/scripts/regression-audit.mjs +164 -0
  147. package/scripts/release-check.mjs +1 -1
  148. package/scripts/surface-baseline.json +52 -0
  149. package/scripts/surface-baseline.mjs +118 -0
  150. package/scripts/types-coverage.mjs +184 -0
  151. package/scripts/types-strict-manifest.txt +10 -0
  152. package/scripts/types-strict.mjs +141 -0
  153. package/skills.js +8 -1
  154. package/tools/adopt.js +2 -3
  155. package/tools/batch.js +2 -3
  156. package/tools/complete.js +2 -3
  157. package/tools/diff.js +3 -3
  158. package/tools/doctor.js +7 -10
  159. package/tools/finding.js +2 -3
  160. package/tools/findings.js +3 -3
  161. package/tools/import-legacy.js +3 -5
  162. package/tools/inbox.js +3 -3
  163. package/tools/index.js +9 -8
  164. package/tools/init.js +3 -6
  165. package/tools/interrupt.js +2 -3
  166. package/tools/legacy-map.js +3 -5
  167. package/tools/merge.js +3 -3
  168. package/tools/mission.js +2 -3
  169. package/tools/plan.js +6 -5
  170. package/tools/preflight.js +2 -3
  171. package/tools/rebase.js +3 -3
  172. package/tools/recover.js +38 -13
  173. package/tools/reload.js +36 -40
  174. package/tools/resource.js +3 -5
  175. package/tools/review.js +3 -4
  176. package/tools/roster.js +2 -3
  177. package/tools/send.js +2 -2
  178. package/tools/spawn.js +8 -5
  179. package/tools/status.js +11 -4
  180. package/tools/teardown.js +2 -3
  181. package/tools/test.js +2 -2
  182. package/types/index.d.ts +29 -13
  183. package/ui-bundle/README.md +37 -3
  184. package/ui-bundle/client.cards.js +356 -0
  185. package/ui-bundle/client.denied.js +142 -0
  186. package/ui-bundle/client.dock.js +333 -0
  187. package/ui-bundle/client.helpers.js +271 -0
  188. package/ui-bundle/client.js +79 -1747
  189. package/ui-bundle/client.locales.js +247 -0
  190. package/ui-bundle/client.mode.js +206 -0
  191. package/ui-bundle/client.overlay.js +64 -0
  192. package/ui-bundle/client.styles.js +151 -0
  193. package/ui-bundle/client.toolview.js +82 -0
  194. package/ui-bundle/package.json +1 -0
  195. package/lib/persistence.js +0 -356
  196. package/lib/presets.js +0 -35
  197. package/lib/store.js +0 -133
  198. /package/{lib → adapters}/stateFile.js +0 -0
  199. /package/{lib → app}/briefing.js +0 -0
  200. /package/{lib → app}/spawn-support.js +0 -0
  201. /package/{lib → host}/compatibility.js +0 -0
  202. /package/{lib → host}/config.js +0 -0
  203. /package/{lib → host}/modeState.js +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,143 @@
4
4
 
5
5
  ## 未发布(Unreleased)
6
6
 
7
+ ## 2.4.0(2026-10-24)
8
+
9
+ ### 新增
10
+
11
+ - **#121 可选能力回到组件**:一个 `tower-bundle` 组拆成强制 `tower` 宿主 + 可独立开关的顶层行
12
+ (`tower-skills`/`tower-batch`/`tower-import`/`tower-leases`/`tower-tests`/`tower-hmr` 默认关/
13
+ `preset-tower-reviewer` 依 `review.requireReview` 条件存在);新增 `./batch`/`./import`/`./leases`/
14
+ `./tests`/`./hmr` 导出,每个入口只注册自己的能力;8 个可见组件的 title/summary/disables 双语覆盖;
15
+ 任一可选行关闭后 Tower 仍可用(模式、规划、状态、其余工具),缺失能力在 status/doctor 中以
16
+ “disabled by component <id>” 呈现。
17
+ - **#120 组件面政策载体**:`PRINCIPLES.md` 第 11 条(“optional capabilities are switches; the core is not”)、
18
+ ADR 0005、64 键的组件轴分类(core / optional-component / optional-config / forbidden-to-disable,由
19
+ `scripts/component-surface.json` 单一来源生成)、`check-components`(locale 覆盖、forbidden-to-disable
20
+ denylist、组件计数 baseline)与 `components` 基线;组件面 4→1→8 的变化以带日期的 decision 记录。
21
+ - **#115 类型面完整性**:`types:coverage` 从 `package.json files` 与 `tsc --listFiles` 派生检查程序
22
+ (146/146 运行时 .js 全覆盖,旧配置下可复现 19 个漏检);tsconfig 改为 glob;`types:generate` 从运行时常量
23
+ 生成发布词汇(ErrorCode/状态/角色等)并纳入 `--check`,修掉 8 个幽灵码与 4 个缺失码;
24
+ `tsconfig.strict.json`(noImplicitAny)以显式文件清单起步,manifest 禁止清单收缩。
25
+ - **#118 surface 计数覆盖完整工具面**:`tower_doctor`/生成参考/`docs:check`/`surface:check` 统一为
26
+ 29 个工具面(默认装配 28,tower-hmr 关闭时少 `tower_reload`),直接注册的 `tower_mode`/`tower_control`
27
+ 也进入刹车;baseline 以 correction 记录 27→29。
28
+
29
+ ### 变更
30
+
31
+ - **#122 安全网永不可关**:`tower_doctor`/`tower_recover` 在任何配置下都注册;删除
32
+ `tools.exposeDoctor`/`exposeRecovery`/`exposeOperational` 与整个 `tools` 组、`dev.hotReload`;
33
+ 旧配置作为未知键被拒绝并停止挂载(升级指南 en/zh 已记录迁移)。
34
+ - 配置面从 64 键/15 节收缩为 56 键/14 节;生成的 config/tools/component-surface 参考同步更新。
35
+
36
+ ### 修复
37
+
38
+ - **F11/F9**:`operationalRegistry` 解析容忍 trailing comma 与 `OPERATIONAL_TOOLS.set` 路由;
39
+ 根 README 的工具计数标题修正为 29(20 core + 9 optional)并注明默认装配 28。
40
+ - 真实 `smoke:mount` 在 pinned host `0.2.1-rc.2` 上通过(默认 28/28),required `mount` CI 上下文保持绿。
41
+ ## 2.3.0(2026-10-23)
42
+
43
+ ### 新增
44
+
45
+ - **#87 live harness 可复现**:`tests/live/package.json` 固定 `playwright`(含独立 lockfile),
46
+ 根脚本 `npm run test:live` 解析本地/`NODE_PATH` 并在缺失时打印两条确切安装命令后退出 2(无堆栈);
47
+ 七个 live 脚本统一走该解析器;`--check` 模式无需浏览器即可在 clean clone 上通过;
48
+ `tests/README.md` 以可复现路径为默认、全局安装作为 fallback。
49
+ - **#47 live 套件安全门禁 + nightly**:live 入口强制 `DSH_LIVE=1` 且 `DSH_HOME` 必须是 `os.tmpdir()` 的严格子目录,
50
+ 拒绝真实 home 及其 `profiles/*`(错误信息指向 `npm run test:live`);CI 的浏览器 live job 移出 push/PR,
51
+ 改为 nightly `schedule`/`workflow_dispatch` 且主机版本固定在 `0.2.1-rc.2`;输出首行打印解析后的
52
+ `DSH_HOME` 与 host 版本。
53
+ - **#83 工程哲学**:根目录 `PRINCIPLES.md`(10 条原则,每条带明确的 refusal 与可解析的 enforcement pointer)、
54
+ `docs/adr/` 四份带日期的 ADR(ports-as-data、单一 state.json、allowAgentControl 默认、surface budget,
55
+ 均含 rejected alternatives)、`docs/` 非目标审计、PR 模板的 principle 问题;
56
+ `scripts/check-philosophy.mjs` + `npm run docs:check:philosophy` 在 pointer 失效时失败。
57
+ - **#84 概念预算**:`tower_doctor` 打印 `config keys: 64 · sections: 15 · tools: 27 (baseline 2026-10-23)`;
58
+ 生成的 config/tools 参考头部携带同一计数与日期;`scripts/surface-baseline.json` + `npm run surface:check`
59
+ 在 surface 增长而无 ADR/等量删除时失败(fixture 覆盖);64 个 config key 的 core/tuning/niche 分类
60
+ (含 3 条 niche removal note)与 27 个工具的 core/optional 分类。
61
+ - **#85 事故实践**:`docs/operations/incident.md` 六字段模板(Symptom/Introduced in/Blast radius/Root cause/
62
+ Regression test/Released in),从 CONTRIBUTING 与 SECURITY 链接;`regression` label 语义固定为
63
+ “worked in a released version, then stopped”;`scripts/regression-audit.mjs` 离线审计已关闭 regression issue
64
+ 的 `Regression test:` 路径;#68 已按模板回填并通过审计。
65
+
66
+ ### 修复
67
+
68
+ - 发布前 CI flake:lock 心跳测试改为轮询等待一次 tick,避免高负载 Node 24 下固定 60ms 窗口偶发失败。
69
+ ## 2.2.0(2026-10-23)
70
+
71
+ ### 新增
72
+
73
+ - **#74 恢复动作到达模型**:`ERROR_CODES` 统一为 35 条目录(description/trigger/retryable/nextAction);
74
+ `renderErrorMessage()` 在消息尾部追加恰好一个 `— next: …` 片段,retryable 条目附加 `(retryable)`;
75
+ 无 nextAction 的条目保持字节不变;`TowerToolError`/`classifyError()` 均从目录解析字段;
76
+ `errors.generated.md` 与 errors.md 的 Code/Retryable/Next action 表由同一目录生成。
77
+ - **#75 领域事件**:域转换返回 `{ state, events }`;app 持久化后发出稳定事件
78
+ `tower.mission.planned|completed|reviewed|merged|abandoned`(携带 missionId/revision/at,merged 另有 commit),
79
+ `tower/<tool>` 作为弃用别名保留一个 minor;`ports/events.js` 新增 `EventPort`(no-op 默认,Cordis `ctx.emit` 绑定);
80
+ `docs/reference/events.md` 由事件表生成并纳入 `--check`。
81
+ - **#71 ui-bundle 纳入 fitness gate**:`client-no-node`/`client-size`/`client-ambient` 三条阻塞规则;
82
+ `client.js` 从 1,980 行拆为 entry + 9 个按渲染面切分的 chunk(每个 ≤400 行,总行数 +9.95%);
83
+ `domain:metrics` 打印 ui-bundle 行;`pack:check` 额外要求 ui-bundle/package.json 与 cordis.patch.yml。
84
+
85
+ ### 变更
86
+
87
+ - **#69 app 依赖 ports 而非 adapters**:9 个运行时 Port 契约 + `assertPorts`;组合根一次性构造 adapter 并注入;
88
+ `app-ports-only`/`composition-root`/`port-shape` 三条 fitness 规则;内存 adapter 全生命周期测试。
89
+ - **#70 退役 lib/**:23 个文件 `git mv` 到 adapters/host/app;新增 `no-lib-from-core`、`host-scope` 阻塞规则;
90
+ ambient 豁免降为 2 条 I/O 边界;`lib/` 不再存在。
91
+ - **#80 fitness 豁免有据**:硬编码 allow-list 改为 `scripts/architecture-waivers.json` 中带 reason/owner/ref 的豁免;
92
+ 新增阻塞 `waiver-contract`,无理由豁免/未知规则/ambient 无 match/domain 豁免一律失败;statement-aware ambient 扫描。
93
+
94
+ ### 修复
95
+
96
+ - **发布前 hygiene(F2–F5)**:根级 `*.log` 忽略规则;控制流 `)` 后正则的 scanner 加固;
97
+ `tsconfig` 移除已删除 lib 路径;COMPATIBILITY/ui-bundle 文档中的旧 lib 路径更新。
98
+ ## 2.1.2(2026-10-23)
99
+
100
+ ### 修复
101
+
102
+ - **#107 survey 依赖满足门禁**:`dependencySatisfied()` 让 `merged`/`abandoned` 继续满足任意类型依赖,
103
+ 并额外接受 `kind === 'survey' && status === 'completed'`(survey 的终态成功,没有可合并分支);
104
+ `dependencyBlockers()` 对活跃 state 与归档索引一视同仁,因此归档的已完成 survey 也满足依赖。
105
+ build→build 仍要求 `merged`,不为 survey 发明新状态。
106
+ - **#108 多路 review 同 tip 记录**:`reviewAdmission()` 允许 `active` mission 的后续 route 在同一
107
+ reviewed tip 上追加 verdict,并入同一 round(`appended:true`),不再次翻转状态;tip 已移动时以
108
+ 明确说明拒绝。`app/review.js` 与输出 schema 同步。
109
+
110
+ ### 变更
111
+
112
+ - **Tower 交付流程**:2.1.2 的 #107/#108 由 Tower mission M2 实施(worker → reviewer clean R2 →
113
+ preflight → merge);review 后按文档化路径扩了 mission scope 以覆盖根文档,`tower_review` 契约
114
+ 描述更新为「completed 起新 round / active 可追加同 tip route」。
115
+ ## 2.1.1(2026-10-23)
116
+
117
+ ### 修复
118
+
119
+ - **#92 PID 复用导致 state 锁永久不可恢复**:持有 state/git 锁期间,记录中的 `at` 现在按固定间隔
120
+ 心跳重写(默认 1000 ms,`unref` 定时器,释放时清除且任何写失败都不会抛给调用方)。回收条件
121
+ 从"PID 已死"改为"`ESRCH` 立即回收,或心跳静默超过 3 × 间隔(默认 3 s)且改名后字节校验通过",
122
+ 因此即使 PID 被无关进程复用也能安全回收,且仍在默认 5 s 的 state 锁等待预算内。修复前
123
+ `tower_recover clear-stale-lock` 会拒绝 PID 仍存活的锁;新增 `force: true`(仍需
124
+ `confirm:"CLEAR_STALE_LOCK"`)可清理"PID 存活但心跳静默"的锁,输出
125
+ `{pid, startedAt, ageMs, heartbeatAgeMs}` 并始终改名为 `.recovered-<ts>` 备份、绝不 unlink。
126
+ 自动回收一个"PID 存活但心跳过期"的记录时保留 `state.lock.reclaimed-<ts>-<id>` 审计备份;
127
+ `ESRCH` 快速路径行为不变。`tower_doctor` 新增 `stateLock` 报告(`ageMs`、`heartbeatAgeMs`、
128
+ `staleAfterMs`、`stale`),锁记录新增 `since`(记录写入时间;旧记录回退到 `at`)。
129
+ 改名 → 校验字节 → 再处置的顺序保持不变,回收中途被替换的记录会被还原而不会丢失。
130
+
131
+ - **#93 git mutex 等待按合并超时预算**:持有 git 锁的一方记录 `{kind:'git', phase}`,并让
132
+ `tower_init`/`tower_teardown`/`tower_rebase`/`tower_spawn` 按 `merge.timeoutMs`
133
+ (默认 900000)+ 60 s 边距等待,慢 pre-merge hook 不再让并发操作在 60 s 失败。超时错误携带
134
+ `{holderPid, holderPhase, heldMs, waitedMs}`(消息形如 `held by pid 1234 (merge) for 92 s;
135
+ waited 60 s`),`tower_status`/`tower_doctor` 新增 `gitLock {held,pid,phase,heldMs}` 与
136
+ `git-lock` 检查;state 锁的 5 s 预算与 merge 超时默认值保持不变。
137
+
138
+ ### 变更
139
+
140
+ - **#106 执行规范**:新增 `docs/agents/workflow.md`,把 Matt Pocock 技能流程(triage → spec →
141
+ tickets → TDD → 两轴 code-review → retro)与 Tower 交付协议(worktree mission、scope 围栏、
142
+ review/merge 门禁)合并为仓库唯一执行规范,`AGENTS.md` 指向它;明确 tag-only 与 published
143
+ 两种发布模式以及人工门禁(npm publish/2FA、保护分支变更)。
7
144
  ## 2.1.0(2026-10-23)
8
145
 
9
146
  ### 新增
package/COMPATIBILITY.md CHANGED
@@ -5,6 +5,11 @@ is shipped in the npm package; doctor reads it locally and never contacts a regi
5
5
 
6
6
  | dsh version | tag / commit | verified on | what was run |
7
7
  |---|---|---|---|
8
+ | 0.2.1-rc.2 | v2.4.0 | 2026-10-24 | mount smoke (28/28 default tools, 3 skills, 2 presets, 1 bundle row), `npm test` (612), `types:coverage` 146/146, strict ratchet 10, docs + six generated checks, components + philosophy + surface gates |
9
+ | 0.2.1-rc.2 | v2.3.0 | 2026-10-23 | mount smoke (29 tower tools, `/tower`, 3 skills, 2 presets, single bundle row), `npm test` (573), `npm run docs:check`, four generated docs checks, philosophy + surface gates, live `--check` |
10
+ | 0.2.1-rc.2 | v2.2.0 | 2026-10-23 | mount smoke (29 tower tools, `/tower`, 3 skills, 2 presets, single bundle row), `npm test` (536), `npm run docs:check`, four generated docs checks |
11
+ | 0.2.1-rc.2 | v2.1.2 | 2026-10-23 | mount smoke (29 tower tools, `/tower`, 3 skills, 2 presets, single bundle row), `npm test` (495), `npm run docs:check`, generated docs checks |
12
+ | 0.2.1-rc.2 | v2.1.1 | 2026-10-23 | mount smoke (29 tower tools, `/tower`, 3 skills, 2 presets, single bundle row), `npm test` (490), `npm run docs:check`, generated docs checks |
8
13
  | 0.2.1-rc.2 | v2.1.0 | 2026-10-23 | mount smoke (29 tower tools, `/tower`, 3 skills, 2 presets, single bundle row), `npm test` (479), `npm run docs:check`, generated docs checks |
9
14
  | 0.2.1-rc.2 | v2.1.0-beta.1 | 2026-10-22 | mount smoke (29 tower tools, `/tower`, 3 skills, 2 presets, single bundle row), `npm test` (413), `npm run docs:check`, generated docs checks |
10
15
  | 0.2.1-rc.2 | 6ee19de | 2026-10-21 | `npm test` (229), `npm run docs:check`, offline `ui-bundle` tests |
@@ -25,7 +30,7 @@ Tower work. This is provenance, not a feature-detection mechanism.
25
30
 
26
31
  Add a row in the release PR, before tagging, after running the offline suite and docs check on the
27
32
  host build being shipped. Name the release tag in cell 1 and the host build in cell 0; the other
28
- columns are read positionally by `lib/compatibility.js`, so do not insert or reorder them. Do not
33
+ columns are read positionally by `host/compatibility.js`, so do not insert or reorder them. Do not
29
34
  claim a live run that was not performed. The 2.1.0-beta.1 row is a pre-release: it becomes
30
35
  installable on the `next` dist-tag only after the checklist's publish step, and `latest` stays on
31
36
  2.0.4 until a stable release. The full six-step procedure is the
package/CONTRIBUTING.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  Thanks for your interest in `dsh-tower`. This is a DeepSeek Harness plugin; the repository root is the bundle itself (`package.json` + `cordis.patch.yml`).
4
4
 
5
+ ## Engineering philosophy and decisions
6
+
7
+ Two short documents say what this project refuses to do:
8
+
9
+ - [PRINCIPLES.md](PRINCIPLES.md) — the numbered refusals. Each one names what it
10
+ refuses and the file plus test or gate that enforces it. A principle whose
11
+ pointer does not resolve fails `npm run docs:check:philosophy`.
12
+ - [docs/adr/](docs/adr/README.md) — dated decision records for choices already
13
+ made (ports as data, one `state.json`, `allowAgentControl`, the surface
14
+ budget, the component surface).
15
+
16
+ Every pull request answers **"which principle does this change touch, or which new
17
+ one does it require?"** in the PR template. "None" is not an answer: if no
18
+ existing refusal covers the change, say why a new principle is needed. The
19
+ concept budget and its classification table are in
20
+ [docs/reference/surface-budget.md](docs/reference/surface-budget.md): a config key
21
+ or tool may grow only with an ADR or a provably matching deletion, checked by
22
+ `npm run surface:check`.
23
+
24
+ The component axis — who may be switched off — is principle 11 and
25
+ [ADR 0005](docs/adr/0005-component-surface.md). It is generated from
26
+ [scripts/component-surface.json](scripts/component-surface.json) into
27
+ [docs/reference/component-surface.md](docs/reference/component-surface.md) and
28
+ enforced by `npm run docs:check:components`: every visible component needs
29
+ `title`/`summary`/`disables` in both locales, the host/health/recovery/review/
30
+ merge-gate capabilities may not be gated by any row or boolean key (the
31
+ `gateableTools` allowlist is empty since #122), and the component count — 8
32
+ visible rows in 2.4.0 — is the fourth baselined surface.
33
+
5
34
  ## Landing changes
6
35
 
7
36
  `main` is protected. Every change lands through a pull request; direct pushes to `main` are rejected,
@@ -18,7 +47,9 @@ The context names come from the workflow job id and matrix values. Renaming a jo
18
47
  changes the required context; update the protection setting in the same PR, or the check never reports
19
48
  and every PR stays unmergeable. The setting and its verification command are in
20
49
  [SECURITY.md](SECURITY.md#repository-protection-on-main). The `mount-fixtures` job runs the seeded
21
- smoke failures for evidence but is deliberately **not** a required context.
50
+ smoke failures for evidence but is deliberately **not** a required context. The `live` job is nightly
51
+ (and manual-dispatch) only, runs on a pinned host matrix, and is evidence as well: it is never part of
52
+ a push or a PR gate.
22
53
 
23
54
  The offline `test` matrix also has a `test (22, windows)` leg on `windows-latest` (Node 22). It runs the
24
55
  offline suite and the offline gates, not the release/coverage steps, so the platform branches are
@@ -39,8 +70,8 @@ four-line body, in this order:
39
70
 
40
71
  - `domain/**`
41
72
  - `app/**`
42
- - `lib/store.js`, `lib/persistence.js`, `lib/*lock*.js`
43
- - `scripts/architecture.mjs`
73
+ - `adapters/store.js`, `adapters/persistence.js`, `adapters/*lock*.js`
74
+ - `scripts/architecture.mjs`, `scripts/architecture-waivers.json`
44
75
  - `cordis.patch.yml`
45
76
 
46
77
  ```markdown
@@ -72,22 +103,41 @@ npm test # no dependencies to install; Node's built-in test runner only
72
103
 
73
104
  Requirements: Node.js 22+, Git. No package installation is needed for the offline suite.
74
105
 
106
+ The opt-in live suite is the exception: install it once with
107
+ `npm ci --prefix tests/live && npx --prefix tests/live playwright install chromium`, then run it with `npm run test:live`
108
+ against a disposable `DSH_HOME` under the OS temp directory and a booted isolated profile. The guard
109
+ refuses the operator's real `DSH_HOME` and any profile under `DSH_HOME/profiles`. `npm run test:live --
110
+ --check` validates the environment and Playwright resolution without a browser. See
111
+ [tests/README.md](tests/README.md#2-real-web-runtime-isolated-profile). The live suite is not part of
112
+ the push gates; CI schedules it nightly.
113
+
75
114
  ## What to change
76
115
 
77
116
  - `index.js` — Host entry: `/tower` command, mode guard, dynamic prompt section, `tower_control`.
78
- - `lib/` — the Tower domain (`tower.js`), tool definitions (`tools.js`), persistence (`store.js`, `modeStore.js`), Git helpers (`git.js`).
117
+ - `host/` — the composition root and session/process glue (`tool-registry.js`, `config.js`, `hmr.js`, `modeStore.js`, `doctor.js`); `adapters/` — the only I/O implementations (store, git, archive, leases, locks); `app/` — use cases; `domain/` — the pure core.
79
118
  - `worker.js` — the `tower-worker` preset policy (tool surface + protocol text).
80
119
  - `tests/` — add a regression test for every behavior change. The offline suite is `tests/*.test.mjs`; live-runtime scripts are documented in `tests/README.md`.
120
+ - `scripts/architecture.mjs` — the fitness rules; `scripts/architecture-waivers.json` — the only exemptions, each with a `reason` and an `owner`/`ref`. An entry without a reason fails the blocking `waiver-contract` rule, The three layering rules that keep the core pure — `domain-pure`, `host-scope`, and `no-lib-from-core` — cannot be waived at all. The `let` scan behind `host-scope` is statement-aware: every binding of every top-level declaration is recorded, and only `host/**` may hold ambient state.
121
+ - `types/` — the published declaration surface (`package.json` `types` is `types/index.d.ts`). The vocabulary block in that file is generated from the runtime constants by `npm run types:generate` and gated by `npm run docs:check:generated:types`; never edit it by hand. `tsconfig.strict.json` turns `noImplicitAny` on for an explicit file list that may grow but never silently shrink: add a file, then record it with `npm run types:strict:write` (a removal also needs `--allow-shrink`). `npm run types:coverage` fails when a shipped runtime `.js` file is outside the `tsc` program.
81
122
 
82
123
  ## Pull request checklist
83
124
 
84
- 1. `npm test` passes locally (479 tests today, including protocol end-to-end against a real temporary Git repository and mock spawn coverage) and `npm run docs:check` passes.
125
+ 1. `npm test` passes locally (612 tests today, including protocol end-to-end against a real temporary Git repository and mock spawn coverage) and `npm run docs:check` passes.
85
126
  2. New behavior has a test. Bug fixes should add a test that fails before the fix.
86
127
  3. No secrets, tokens, personal paths, session logs, or generated artifacts are added. `.gitignore` covers local acceptance output; do not force-add it.
87
128
  4. Keep the public API and state-file formats compatible; if a change is breaking, call it out in `CHANGELOG.md` and bump the version.
88
129
  5. Update `README.md` / `README.en.md` when the user-visible behavior changes.
89
130
  6. If you touched `cordis.patch.yml`, `index.js`, `skills.js`, or `tools/`, run `npm run smoke:mount` (see below).
90
131
  7. A commit carries `Refs #n` or `Fixes #n`; a P0/P1 closure carries `verified-by:` and `commit:`, and `npm run audit:issues` reports no new failures.
132
+ 8. A regression closure carries the six-field record from
133
+ [docs/operations/incident.md](docs/operations/incident.md) and `npm run audit:regressions`
134
+ reports no failure; a `Regression test:` path must exist.
135
+ 9. If you added a config key or tool, `scripts/surface-baseline.json` and
136
+ [docs/reference/surface-budget.md](docs/reference/surface-budget.md) are updated in the
137
+ same PR, and `npm run surface:check` passes. A visible component change also updates
138
+ `scripts/surface-baseline.json` (`components`), `scripts/component-surface.json` and
139
+ `docs/reference/component-surface.md` (`npm run docs:generate:components`), and must pass
140
+ `npm run docs:check:components`.
91
141
 
92
142
  ## Mount smoke
93
143
 
@@ -182,6 +232,29 @@ Exit codes: `0` — every checked closure names an existing test file (a missing
182
232
  export is missing or malformed. `--strict` promotes the missing-`commit:` warning to an error.
183
233
  `tracker/` is a local snapshot and is gitignored; regenerate it instead of committing it.
184
234
 
235
+ ## Regressions and incidents
236
+
237
+ The `regression` label means **"worked in a released version, then stopped"**. It is
238
+ narrower than `bug` and mutually exclusive with it for a shipped break: a user
239
+ could rely on the old behavior, so the record must say which release broke it and
240
+ which test prevents it from happening again.
241
+
242
+ A closed `regression` issue carries the six-field record from
243
+ [docs/operations/incident.md](docs/operations/incident.md) (symptom, introduced in,
244
+ blast radius, root cause and fix, regression test, released in). The one checkable
245
+ line is `Regression test:`, which must name a test file that exists. The same
246
+ `tracker/issues.json` export from above is audited offline:
247
+
248
+ ```powershell
249
+ npm run audit:regressions
250
+ npm run audit:regressions -- --tracker path/to/export.json --json
251
+ ```
252
+
253
+ Exit codes: `0` — every closed regression names an existing test; `1` — a line is
254
+ missing or the path is nonexistent/non-test; `2` — the export is missing or
255
+ malformed. The fixture in `tests/regression-audit.test.mjs` seeds a missing path
256
+ and a valid one, so the rule cannot quietly become prose.
257
+
185
258
  ## Commit style
186
259
 
187
260
  Conventional-commit prefixes are preferred: `feat:`, `fix:`, `docs:`, `test:`, `refactor:`, `chore:`. Keep the subject line in the imperative mood. Add the issue trailer (`Refs #n` / `Fixes #n`) described above.
package/PRINCIPLES.md ADDED
@@ -0,0 +1,163 @@
1
+ # Engineering principles
2
+
3
+ These are the refusals this project makes. A principle with no refusal and no
4
+ enforcement pointer is a slogan, so every entry below names what it refuses and
5
+ the file plus test or gate that makes the refusal real. `npm run
6
+ docs:check:philosophy` fails when a pointer no longer resolves.
7
+
8
+ The product philosophy — when to use Tower, and when not to — is a separate
9
+ document: [docs/guide/scenarios-and-philosophy.md](docs/guide/scenarios-and-philosophy.md).
10
+ Decisions already made are recorded in [docs/adr/README.md](docs/adr/README.md).
11
+
12
+ ## 1. Evidence before done
13
+
14
+ We do not accept "done" as an assertion. A change is done when a named test,
15
+ command, or receipt can be re-run by someone else, and the closure names that
16
+ pointer instead of describing the work.
17
+
18
+ Refused because of this: one-line closures, "implemented on main, trust me",
19
+ and completion reports that list prose without an exit code.
20
+
21
+ Enforced by: `scripts/issue-audit.mjs` and `scripts/regression-audit.mjs`, with
22
+ the fixtures in `tests/issue-audit.test.mjs` and `tests/regression-audit.test.mjs`;
23
+ gate: `npm run audit:issues`.
24
+
25
+ ## 2. Gates before prose
26
+
27
+ We do not add a rule to a document that a machine could enforce. If a sentence
28
+ says "always" or "never", the same change must either point at an existing check
29
+ or admit that the sentence is `unowned`.
30
+
31
+ Refused because of this: warnings-only lint rules, "please remember to bump the
32
+ version", and instructions that only a careful reader can follow.
33
+
34
+ Enforced by: `scripts/architecture.mjs` and `scripts/check-docs.mjs`; tests in
35
+ `tests/architecture.test.mjs`; gate: `npm run architecture:check`.
36
+
37
+ ## 3. Ports are data, not a DI container
38
+
39
+ We do not add a service locator, decorators, or a reflection-driven container.
40
+ The adapter seam is a table of frozen runtime contracts that a test asserts, so a
41
+ reader can see every effectful call without booting the app.
42
+
43
+ Refused because of this: `reflect-metadata`, string-keyed service lookup, and
44
+ "the container will wire it" as an explanation for a dependency.
45
+
46
+ Enforced by: `ports/index.js` and `scripts/architecture.mjs`; contract tests in
47
+ `tests/memory-adapters.contract.test.mjs`; ADR:
48
+ `docs/adr/0001-ports-adapters-as-data.md`.
49
+
50
+ ## 4. One state file, one writer
51
+
52
+ We do not split mission state across per-mission files for diffability. One
53
+ `state.json` with one lock and one atomic write is the persistence contract;
54
+ archived missions move to year files only after they are terminal.
55
+
56
+ Refused because of this: per-mission JSON files, append-only forks of the state
57
+ tree, and any write that does not go through the lock.
58
+
59
+ Enforced by: `adapters/store.js` and `adapters/persistence.js`; tests in
60
+ `tests/persistence-contract.test.mjs`; ADR: `docs/adr/0002-single-state-json.md`.
61
+
62
+ ## 5. The human owns the mode
63
+
64
+ The model may toggle Tower mode, but it may not acquire ownership of it, resume a
65
+ user-paused goal, or merge without the gate. The default that lets the model
66
+ enter is paired with lock, ack, and resume-authorization checks rather than with
67
+ trust.
68
+
69
+ Refused because of this: an autonomous "always on" mode, auto-resuming a paused
70
+ goal, and a model-initiated merge that skips preflight.
71
+
72
+ Enforced by: `index.js` and `host/modeState.js`; tests in `tests/plugin.test.mjs`;
73
+ ADR: `docs/adr/0003-allow-agent-control-default-true.md`.
74
+
75
+ ## 6. The surface is a budget
76
+
77
+ We do not treat "highly configurable" as a feature. Every config key and tool is
78
+ a promise, so the counts are committed in `scripts/surface-baseline.json` and a
79
+ count may grow only with an ADR or a provably matching deletion.
80
+
81
+ Refused because of this: a new config key added because it was easy, and a tool
82
+ added without deciding which tool it replaces.
83
+
84
+ Enforced by: `scripts/surface-baseline.mjs` and
85
+ `docs/reference/surface-budget.md`; tests in `tests/surface.test.mjs`; gate:
86
+ `npm run surface:check`.
87
+
88
+ ## 7. Read-only means no writes
89
+
90
+ A tool that says read-only may not create a temp file, migrate state, or probe the
91
+ filesystem. Diagnostics either report the absence or return a warning; they never
92
+ make the repository healthier as a side effect.
93
+
94
+ Refused because of this: doctor probes, lazy migrations during inspection, and
95
+ "read-only" tools that repair things on first call.
96
+
97
+ Enforced by: `host/doctor.js` and `adapters/store.js`; tests in
98
+ `tests/lock-heartbeat.test.mjs` and `tests/state-migration.test.mjs`; gate:
99
+ `npm test`.
100
+
101
+ ## 8. Offline tests are the contract
102
+
103
+ `npm test` does not need a network, a browser, credentials, or a live host. A
104
+ proof that can only run on one machine is evidence for that machine, not a gate.
105
+
106
+ Refused because of this: a test that calls GitHub, a required model run in the
107
+ offline suite, and a live-only check that blocks a merge.
108
+
109
+ Enforced by: `tests/live-harness.test.mjs` and `scripts/mount-smoke/fixtures.mjs`;
110
+ gate: `npm run smoke:fixtures`.
111
+
112
+ ## 9. Generated references are generated
113
+
114
+ We do not hand-maintain a list that the source already knows. Docs under
115
+ `docs/reference/*.generated.md` are written by a generator, their count line
116
+ comes from `scripts/surface-baseline.json`, and a mismatch is a failed check
117
+ rather than a review comment.
118
+
119
+ Refused because of this: hand-editing a generated table, and two references that
120
+ disagree about the same count.
121
+
122
+ Enforced by: `scripts/generate-config-reference.mjs` and
123
+ `scripts/generate-tools-reference.mjs`; tests in `tests/surface.test.mjs`; gate:
124
+ `npm run docs:check:generated:config`.
125
+
126
+ ## 10. A regression keeps its test
127
+
128
+ We do not close a shipped regression with a sentence. A `regression` is anything
129
+ that worked in a released version and then stopped, and its closure carries the
130
+ six-field incident record plus a test path that exists.
131
+
132
+ Refused because of this: "fixed in the next release", a regression closed
133
+ without a test path, and a postmortem that names the cause but not the proof.
134
+
135
+ Enforced by: `docs/operations/incident.md`, `scripts/regression-audit.mjs`, and
136
+ `tests/regression-audit.test.mjs`; gate: `npm run audit:regressions`.
137
+
138
+ ## 11. Optional capabilities are switches; the core is not
139
+
140
+ A component may exist only for a capability whose off state leaves the rest of the
141
+ product intact. Every capability that qualifies gets a component, so the user can
142
+ control it. Every capability that does not — the host, the health contract, the
143
+ recovery escape, the review contract, the merge gates — is configuration or code,
144
+ never a switch: not as a row, and not as a boolean that removes it.
145
+
146
+ Refused because of this: a single all-or-nothing switch offered as "simpler"; a
147
+ disableable `tower_doctor`/`tower_recover`; a core feature exposed as a toggle; a
148
+ component whose off state is worse than uninstalling the plugin.
149
+
150
+ Enforced by: `scripts/check-components.mjs` (locale coverage, the
151
+ forbidden-to-disable denylist and the generated component reference),
152
+ `scripts/surface-baseline.mjs` (the component count is a baselined surface),
153
+ `docs/adr/0005-component-surface.md`, and `tests/components.test.mjs`; gate:
154
+ `npm run docs:check:components`.
155
+
156
+ ## Non-goals
157
+
158
+ This file is not a governance process: there is no RFC queue, no architecture
159
+ review board, and no required approval. The list stays useful only while its
160
+ pointers resolve, which is exactly what `scripts/check-philosophy.mjs` checks.
161
+
162
+ Enforced by: `scripts/check-philosophy.mjs`; tests in
163
+ `tests/philosophy.test.mjs`; gate: `npm run docs:check:philosophy`.
package/README.en.md CHANGED
@@ -16,7 +16,7 @@ The repository root **is** the DSH bundle: `package.json` declares `dsh.bundle.p
16
16
 
17
17
  - **Configurable Tower mode.** `/tower` toggles a session-level stance that narrows the tool surface and injects the Tower protocol. `/tower on|off <instruction>` also forwards your instruction to the model in the same step. By default the model may also enter/leave with `tower_control` and a concrete reason; set `mode.allowAgentControl:false` for human-only control.
18
18
  - **Missions with real isolation.** Every mission gets its own branch and Git worktree; workers never touch your checkout.
19
- - **Review-gated merges.** When `review.requireReview:true`, a reviewer bound to the current branch tip must submit a `clean` / `merge` verdict before merge; the merge gate re-checks scope, staleness, task completion, review history, and worktree ownership before a `--no-ff` merge. Independent review is optional by default (the gate is off); use `reviewPolicy:"none"` + reason plus `gates.allowReviewExemption:true` for a single mission when the global gate is on.
19
+ - **Review-gated merges.** When `review.requireReview:true`, a reviewer bound to the current branch tip must submit a `clean` / `merge` verdict before merge; the merge gate re-checks scope, staleness, task completion, review history, and worktree ownership before a `--no-ff` merge. Independent review is optional by default (the gate is off); use `reviewPolicy:"none"` + reason plus `gates.allowReviewExemption:true` for a single mission when the global gate is on. Multi-route review is recorded per round: while a non-clean round keeps the mission `active`, a later reviewer may still submit its verdict for the same reviewed tip and it appends to that round. A completed `survey` dependency satisfies the dependency gate (a build dependency still must be merged).
20
20
  - **Durable coordination.** Roster, inbox, findings, reviews, and mission state are persisted under `.git/dsh-tower/`, so a restart does not lose the plan.
21
21
  - **Bounded state growth.** Terminal missions whose worktree is gone move to `.git/dsh-tower/archive/` once `archive.afterDays`/`archive.maxMissions` says so, keeping their tasks, reviews, findings and completion report; mutations then rewrite only active work. `tower_status includeArchived` lists compact archived summaries, and `tower_doctor` reports archive size, count and policy.
22
22
  - **Safe by default.** While Tower mode is active, `create_goal`, `update_goal(resume)`, `todo_write`, the Team task board, and `spawn_teammate` are refused; a paused goal is never resumed automatically.
@@ -128,20 +128,33 @@ Image and file attachments are forwarded together with the instruction as one co
128
128
 
129
129
  ## Component model
130
130
 
131
- This bundle is **all-or-nothing**: `cordis.patch.yml` inserts one `tower-bundle`
132
- `cordis:group` row, and the Host plugin, skills, and worker/reviewer presets are internal sections
133
- of it. The plugin page should treat that group as one component; disabling it disables all sections
134
- together, so no orphan preset or skill points at missing `tower_*` tools. Do not enable/disable the
135
- child rows independently.
136
-
137
- Mode entry and `tower_plan` validate both presets before work starts. A missing preset is refused
138
- with `preset-missing` and names `preset-tower-worker` / `preset-tower-reviewer`, instead of planning
139
- or spawning first and dead-ending at review/merge.
131
+ The bundle ships a **mandatory host anchor plus individually switchable optional
132
+ rows** (#121): `cordis.patch.yml` inserts a top-level `tower` group that mounts
133
+ the Host plugin and the mandatory `preset-tower-worker`, then the optional
134
+ components `tower-skills`, `tower-batch`, `tower-import`, `tower-leases`,
135
+ `tower-tests`, `tower-hmr` (shipped off) and `preset-tower-reviewer`. Turn a row
136
+ off from the Plugins page and exactly that capability goes away; the mode, the
137
+ planning tools, `tower_status`, and the remaining tools keep working.
138
+
139
+ Mode entry and `tower_plan` validate the required presets before work starts. The
140
+ worker preset is mandatory; the reviewer preset is required only when
141
+ `review.requireReview` is true, so the reviewer row may be off while review is
142
+ optional and is locked with an explanatory `preset-missing` error when the gate
143
+ is on. `tower-tests` off with `gates.requireTests:true` is refused the same way.
144
+ `tower_doctor` and `tower_recover` are not components and have no config key: they
145
+ are registered for every configuration (#122).
146
+
147
+ [Principle 11](PRINCIPLES.md) and
148
+ [ADR 0005](docs/adr/0005-component-surface.md) say a component may exist only for
149
+ a capability whose off state leaves the rest intact; the host, health, recovery,
150
+ review and merge-gate capabilities are never switches. The per-key answer is the
151
+ generated [component surface](docs/reference/component-surface.md), enforced by
152
+ `npm run docs:check:components`.
140
153
 
141
154
  ## Configuration
142
155
 
143
156
  ```yaml
144
- - id: tower
157
+ - id: tower-host
145
158
  name: 'dsh-tower'
146
159
  config:
147
160
  section: 'Optional legacy alias replacing the Tower-mode prompt text'
@@ -166,13 +179,13 @@ or spawning first and dead-ending at review/merge.
166
179
  - `mode.allowAgentControl` defaults to `true` in code; the bundled `cordis.patch.yml` also sets it explicitly to `true` so the model may enter/leave when the user intent or task state warrants it, always stating a reason. Set it to `false` for human-only control. The bundled patch also enables `mode.workspaceLock` (single-active tower), `send.interruptDefault`, `init.autoGitInit`, and sets `spawn.staleMs` to 15s.
167
180
  - `/tower base <branch>` records a session-level init base preference; `/tower on` clears an active plan mode (`mode.planModePolicy:"refuse"` instead refuses entry), keeping plan and Tower mutually exclusive.
168
181
  - Repository-level config: put the same JSON shape in `<git-common-dir>/dsh-tower/config.json` (usually `.git/dsh-tower/config.json`) to override `review`/`merge`/`worktrees`/`spawn`. Precedence is code defaults < profile config < repository config < tool arguments. `mode.*` is session-scoped and only the profile layer controls it.
169
- - Every key and default is in [docs/reference/config.md](docs/reference/config.md); unknown top-level keys are rejected so typos cannot silently disable security-relevant settings, while unknown keys inside a group are ignored. Tool error codes are in [docs/reference/errors.md](docs/reference/errors.md).
182
+ - Every key and default is in [docs/reference/config.md](docs/reference/config.md); unknown keys are rejected (top-level and inside a group) so typos cannot silently disable security-relevant settings. Tool error codes are in [docs/reference/errors.md](docs/reference/errors.md).
170
183
 
171
- ## Tools (27 core)
184
+ ## Tools (29: 22 core + 7 optional)
172
185
 
173
186
  `tower_init` · `tower_plan` · `tower_mission` · `tower_status` · `tower_spawn` · `tower_roster` · `tower_adopt` · `tower_diff` · `tower_send` · `tower_inbox` · `tower_complete` · `tower_interrupt` · `tower_finding` · `tower_findings` · `tower_review` · `tower_preflight` · `tower_merge` · `tower_rebase` · `tower_teardown` · `tower_mode` · `tower_doctor` · `tower_recover` · `tower_test` · `tower_batch` · `tower_resource` · `tower_import_legacy` · `tower_legacy_map`
174
187
 
175
- `tower_control` is registered by default (`allowAgentControl:true`); set it to `false` to disable it. `tower_reload` is registered while `dev.hotReload` is on (default true) and returns `reload-unavailable` without an HMR service (so up to 29 tools). Mission-scoped tools also accept `id` as an alias for `missionId`; snake/camel spellings such as `task_done`/`taskDone` are both accepted.
188
+ The list above is the 22 core tools plus 5 of the component-owned optional tools. `tower_control` is the sixth optional tool, registered by default (`allowAgentControl:true`); set it to `false` to disable it. `tower_reload` is the seventh, registered only while the `tower-hmr` component row is on (shipped off) and returning `reload-unavailable` without an HMR service (so up to 29 tools: 22 core + 7 optional). `tower_doctor` and `tower_recover` are core: they are registered for every configuration (#122). Mission-scoped tools also accept `id` as an alias for `missionId`; snake/camel spellings such as `task_done`/`taskDone` are both accepted.
176
189
 
177
190
  ## Safety and guardrails
178
191
 
@@ -201,8 +214,8 @@ Workers use the bundled `tower-worker` preset (writable worktree surface); revie
201
214
 
202
215
  | Path | Contents |
203
216
  |---|---|
204
- | `package.json`, `cordis.patch.yml` | bundle manifest and loader patch (one `tower-bundle` group containing the Host, skills, and both presets) |
205
- | `index.js`, `lib/`, `worker.js`, `reviewer.js` | Host entry, protocol/config implementation, worker and reviewer preset policies |
217
+ | `package.json`, `cordis.patch.yml` | bundle manifest and loader patch (a mandatory `tower` host group plus the optional capability rows) |
218
+ | `index.js`, `host/`, `adapters/`, `app/`, `domain/`, `ports/`, `tools/`, `worker.js`, `reviewer.js` | Host entry; `domain/` pure core; `ports/` contracts; `adapters/` the only I/O; `app/` use cases; `host/` composition root and session glue; `tools/` one handler per tool; worker and reviewer preset policies |
206
219
  | `skills.js`, `skills/` | bundled agent skills (worker protocol, review checklist, recovery playbook) |
207
220
  | `docs/` | guides, reference, architecture, operations, FAQ and examples |
208
221
  | `locale/`, `icon.svg` | localization and icon |
@@ -217,7 +230,7 @@ npm test # node --test tests/*.test.mjs
217
230
  ```
218
231
 
219
232
  Hot-reload development: `npm run dev:hmr` adds this checkout to the current profile's HMR watch roots
220
- (one DSH restart); afterwards `/tower reload` or the automatic watcher applies `lib/` edits. See
233
+ (one DSH restart); afterwards `/tower reload` or the automatic watcher applies `host/`, `adapters/`, `app/` and `domain/` edits. See
221
234
  [docs/guide/hot-reload.md](docs/guide/hot-reload.md).
222
235
 
223
236
  The offline suite needs no DSH process and creates throwaway Git repositories in the OS temp directory. `tests/README.md` documents the isolated Web-runtime checks, model-driven acceptance, and the session-diagnostic scripts used while hardening the plugin.
@@ -228,18 +241,21 @@ Every push and PR runs the same set of jobs; each job backs one checkable claim
228
241
 
229
242
  | Job | Claim | Evidence |
230
243
  |---|---|---|
231
- | `test (22)`, `test (24)` (Ubuntu) | the offline suite, documentation consistency, generated references, the published file list, architecture, types, and domain purity all hold | `npm test`, `npm run docs:check`, the three `docs:check:generated*` checks, `pack:check`, `architecture:check`, `types:check`, `domain:check` |
244
+ | `test (22)`, `test (24)` (Ubuntu) | the offline suite, documentation consistency, generated references, the published file list, architecture, types, and domain purity all hold | `npm test`, `npm run docs:check`, the five `docs:check:generated*` checks (including the generated type vocabulary), `pack:check`, `architecture:check`, `types:coverage`, `types:strict:check`, `types:check`, `domain:check` |
232
245
  | `test (22, windows)` (`windows-latest`, not required) | the same offline suite and offline gates hold on a real Windows filesystem, so path casing, the `pwsh` shell, and the rename/unlink retries are measured instead of assumed | `npm test` plus the same offline gates as Ubuntu (no release/coverage) |
233
246
  | `test`'s `Coverage (Node 22)` step | coverage is actually measured in CI (reported only: no threshold, no badge) | `npm run test:coverage` |
234
247
  | `test`'s `Release check` step (Node 22) | a tag is a claim: the version moved past the previous version tag, a pushed tag is `v<version>`, and the changelog carries release content | `npm run release:check` |
235
248
  | `mount` (Node 22) | the packed tarball, added through the plugin CLI to a throwaway profile, mounts in the real loader and registers the surface the bundle claims | `npm run smoke:mount` |
236
249
  | `mount-fixtures` (Node 22, not required) | the mount smoke still goes red for the right seeded reasons (a renamed tool id, a removed skills section), with one cached host install shared by all runs | `npm run smoke:fixtures -- --host-dir <cached host>` |
250
+ | `live (<pinned host build>)` (nightly/manual, not required) | the browser live suite still drives a real Web runtime on the pinned host-version matrix; push/PR runs only the browserless environment and resolution check | nightly runs `npm run test:live -- --script nightly`; push runs `npm run test:live -- --check` |
237
251
 
238
252
  The `test` matrix pins each leg's context string through `matrix.name`: `test (22)`, `test (24)` and the new `test (22, windows)`. The first two are `main`'s required checks and keep their exact names; adding an `os` matrix key without an explicit name would rename them to `test (22, ubuntu-latest)`, and protected `main` would wait for a context that never reports. The Windows leg is Node 22 only and runs the offline suite and offline gates (no browser, no live suite, no release/coverage), in parallel with the existing jobs, so it does not extend the critical path. It is not a required context yet: making it green is the acceptance for #86, while adding it to the protection setting is a human step in #94.
239
253
 
254
+ The live suite downloads a browser and boots a real host, so it is out of push/PR: it runs on a nightly `schedule` (also `workflow_dispatch`) on a pinned host-version matrix, and its first output line prints the resolved `DSH_HOME` and host version. Push keeps only `--check` (environment + Playwright resolution, no browser). Playwright is pinned by `tests/live/package-lock.json`; the root `npm ci` downloads no browsers.
255
+
240
256
  `tests/platform.test.mjs` injects `platform`/`rename`/`unlink` so both the win32 and POSIX branches are asserted on any OS; the only case that needs a real Windows filesystem (renaming over an open destination) is counted as `# SKIP` on Linux (`tests 11`, `skipped 1`), never silently absent. There is no macOS runner: macOS follows the same POSIX branch as Linux, which is a #86 non-goal.
241
257
 
242
- `mount` asserts the throwaway profile's **loaded surface**, never the text of `cordis.patch.yml`: 29 `tower_*` tools (27 `tools/*.js` modules plus `tower_mode` / `tower_control`), the 3 bundled skills, both the `tower-worker` and `tower-reviewer` presets, the `/tower` command, and exactly one top-level `tower-bundle` group row (the #66 invariant). It calls no model and opens no browser. Measured on the maintainer's Windows machine: about 100 seconds on a cold host (install included) and about 85 seconds with a cached host; the CI step allows 3 minutes (`timeout-minutes: 3`) inside the 5-minute `mount` job. A red run prints the resolved profile path, the host build, the loaded counts, and every unmet claim.
258
+ `mount` asserts the throwaway profile's **loaded surface**, never the text of `cordis.patch.yml`: 28 `tower_*` tools in the shipped profile (27 `tools/*.js` modules plus `tower_mode` / `tower_control`, minus `tower_reload` because `tower-hmr` ships off; 29 with every optional capability row on), the 3 bundled skills, both the `tower-worker` and `tower-reviewer` presets, the `/tower` command, one top-level `tower` host group, and the optional top-level rows (`tower-hmr` is shipped off). It calls no model and opens no browser. Measured on the maintainer's Windows machine: about 100 seconds on a cold host (install included) and about 85 seconds with a cached host; the CI step allows 3 minutes (`timeout-minutes: 3`) inside the 5-minute `mount` job. A red run prints the resolved profile path, the host build, the loaded counts, and every unmet claim.
243
259
 
244
260
  The host build is pinned in exactly one place, `scripts/mount-smoke/host.json`; a unit test keeps the newest `COMPATIBILITY.md` row equal to it, so a release never retypes it. `npm run smoke:fixtures` proves the smoke still fails for the right seeded reasons (a renamed tool id, a removed skills section). CI runs it as the non-required `mount-fixtures` job, where the control and both seeds share one cached host install through `--host-dir` (about 2 minutes warm here).
245
261