@thincoder/core 0.11.1 → 0.11.2

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 (333) hide show
  1. package/CHANGELOG.md +46 -2
  2. package/advisor/convergence.mjs +34 -3
  3. package/advisor/loop.mjs +42 -10
  4. package/advisor/messages.mjs +42 -25
  5. package/advisor/project-context.mjs +171 -42
  6. package/advisor/run.mjs +7 -4
  7. package/advisor.mjs +29 -43
  8. package/agent/batch-attribution.mjs +87 -0
  9. package/agent/batch-changed-surface.mjs +129 -0
  10. package/agent/completion.mjs +44 -3
  11. package/agent/dispatch-gates.mjs +6 -0
  12. package/agent/dispatch.mjs +8 -3
  13. package/agent/family-tools.mjs +27 -12
  14. package/agent/helpers.mjs +122 -1
  15. package/agent/offload.mjs +25 -29
  16. package/agent/post-turn.mjs +24 -10
  17. package/agent/record-results.mjs +18 -1
  18. package/agent/run-stages.mjs +77 -32
  19. package/agent/run-start.mjs +37 -0
  20. package/agent/setup-reminders.mjs +9 -2
  21. package/agent/setup.mjs +24 -11
  22. package/agent/spawn-child.mjs +38 -1
  23. package/agent/timers.mjs +5 -3
  24. package/agent/turn-loop.mjs +30 -5
  25. package/agent/turn-projection.mjs +386 -0
  26. package/agent/turn-task-state.mjs +274 -0
  27. package/agent/turn-tool-process.mjs +168 -0
  28. package/agent/write-gate-ledger.mjs +569 -0
  29. package/agent/write-gate.mjs +29 -352
  30. package/agent-tools/advisor-async.mjs +29 -169
  31. package/agent-tools/advisor-launch.mjs +178 -0
  32. package/agent-tools/advisor-settle.mjs +28 -1
  33. package/agent-tools/advisor.mjs +36 -47
  34. package/agent-tools/audit-block.mjs +6 -6
  35. package/agent-tools/batch-closeout.mjs +273 -35
  36. package/agent-tools/batch-gate.mjs +142 -342
  37. package/agent-tools/batch-ledger-bind.mjs +226 -17
  38. package/agent-tools/batch-ledger-view.mjs +109 -0
  39. package/agent-tools/batch-lifecycle.mjs +169 -46
  40. package/agent-tools/batch-paths.mjs +29 -8
  41. package/agent-tools/batch-record-write.mjs +417 -0
  42. package/agent-tools/batch-regions.mjs +215 -0
  43. package/agent-tools/batch-reopen.mjs +23 -11
  44. package/agent-tools/batch-segment-vocab.mjs +379 -0
  45. package/agent-tools/batch-skeleton.mjs +192 -239
  46. package/agent-tools/batch-supersede.mjs +232 -0
  47. package/agent-tools/batch-tier-gate.mjs +297 -0
  48. package/agent-tools/batch.mjs +182 -439
  49. package/agent-tools/consult.mjs +7 -4
  50. package/agent-tools/context.mjs +44 -17
  51. package/agent-tools/design-review-record.mjs +225 -0
  52. package/agent-tools/design-slots.mjs +1 -1
  53. package/agent-tools/design-token.mjs +279 -81
  54. package/agent-tools/doc-check.mjs +43 -33
  55. package/agent-tools/doc-graph.mjs +140 -0
  56. package/agent-tools/eng.mjs +9 -8
  57. package/agent-tools/escalate-async.mjs +2 -2
  58. package/agent-tools/manifest.mjs +34 -18
  59. package/agent-tools/read-history.mjs +112 -11
  60. package/agent-tools/review-facts.mjs +10 -3
  61. package/agent-tools/settings.mjs +23 -2
  62. package/agent-tools/spawn-gates.mjs +9 -8
  63. package/agent-tools/ssh-session.mjs +2 -2
  64. package/agent-tools/ssh-text.mjs +155 -0
  65. package/agent-tools/ssh-transport.mjs +19 -148
  66. package/agent-tools/subagent-actions-query.mjs +10 -6
  67. package/agent-tools/subagent-async.mjs +8 -9
  68. package/agent-tools/subagent-brief.mjs +76 -0
  69. package/agent-tools/subagent-design-token.mjs +168 -0
  70. package/agent-tools/subagent-run.mjs +1 -1
  71. package/agent-tools/subagent-scheduler.mjs +4 -4
  72. package/agent-tools/subagent-spawn.mjs +90 -110
  73. package/agent-tools/subagent.mjs +11 -10
  74. package/agent-tools/taskbook-block.mjs +94 -0
  75. package/agent-tools/timer.mjs +12 -8
  76. package/agent-tools/verify.mjs +13 -4
  77. package/agent-tools.mjs +7 -3
  78. package/agent.mjs +20 -1
  79. package/attachments.mjs +3 -3
  80. package/browser/actions.mjs +9 -3
  81. package/browser/cdp.mjs +45 -17
  82. package/browser/launch.mjs +25 -43
  83. package/browser/pool.mjs +299 -0
  84. package/browser/queue.mjs +2 -0
  85. package/browser/session-state.mjs +450 -0
  86. package/browser/session.mjs +127 -151
  87. package/browser/snapshot.mjs +89 -0
  88. package/client-identity.mjs +1 -1
  89. package/config-defaults.mjs +2 -1
  90. package/config-migrate.mjs +40 -0
  91. package/config-normalize.mjs +28 -2
  92. package/config-reload.mjs +59 -0
  93. package/config.mjs +62 -98
  94. package/context-degrade.mjs +38 -10
  95. package/context-echo.mjs +11 -0
  96. package/context.mjs +149 -83
  97. package/conventions.mjs +11 -9
  98. package/declaration.mjs +31 -5
  99. package/declared-repos.mjs +94 -0
  100. package/doc-check/doc-names.mjs +73 -0
  101. package/doc-check/doc-tokens.mjs +110 -0
  102. package/doc-check/existence.mjs +160 -0
  103. package/doc-check/index.mjs +309 -213
  104. package/doc-check/line-refs.mjs +27 -101
  105. package/doc-check/paragraph.mjs +218 -102
  106. package/doc-graph/anchors.mjs +474 -0
  107. package/doc-graph/doc-batch-face.mjs +59 -0
  108. package/doc-graph/doc-suffix.mjs +27 -0
  109. package/doc-graph/graph-tokens.mjs +160 -0
  110. package/doc-graph.mjs +778 -0
  111. package/explore-distill.mjs +11 -5
  112. package/i18n.mjs +1 -1
  113. package/instance-inbox-watch.mjs +272 -0
  114. package/instance-inbox.mjs +218 -0
  115. package/instance-registry.mjs +179 -0
  116. package/knowledge/README.md +3 -0
  117. package/knowledge/prompt-resources.md +6 -0
  118. package/ledger-close-proof.mjs +100 -49
  119. package/ledger-close.mjs +188 -0
  120. package/ledger-cmd.mjs +47 -91
  121. package/ledger-consistency.mjs +113 -0
  122. package/ledger-db.mjs +47 -15
  123. package/ledger-executors.mjs +1 -1
  124. package/ledger-tools.mjs +78 -19
  125. package/ledger-write-ops.mjs +130 -41
  126. package/ledger.mjs +1 -1
  127. package/manifest-discovery.mjs +3 -1
  128. package/manifest-schema.mjs +27 -5
  129. package/memory/schema.mjs +2 -2
  130. package/package.json +3 -1
  131. package/path-resolve.mjs +338 -57
  132. package/prompt-files.mjs +91 -1
  133. package/prompt-overlays.mjs +9 -6
  134. package/prompts/advisor-design.md +62 -21
  135. package/prompts/advisor-round1.md +34 -1
  136. package/prompts/advisor-round2.md +40 -7
  137. package/prompts/advisor-round3.md +39 -6
  138. package/prompts/common.md +14 -387
  139. package/prompts/consult-base.md +5 -1
  140. package/prompts/discipline-engineering.md +226 -51
  141. package/prompts/discipline-normal.md +4 -255
  142. package/prompts/knowledge/business-gates.md +22 -0
  143. package/prompts/knowledge/decision-quality.md +23 -0
  144. package/prompts/knowledge/doc-lookup.md +35 -0
  145. package/prompts/knowledge/document-writing.md +51 -0
  146. package/prompts/knowledge/documentation-evaluation.md +56 -0
  147. package/prompts/knowledge/evidence-discipline.md +57 -0
  148. package/prompts/knowledge/normal-coding-workflow.md +104 -0
  149. package/prompts/knowledge/normal-delivery-collaboration.md +108 -0
  150. package/prompts/knowledge/normal-work-management.md +57 -0
  151. package/prompts/knowledge/product-security.md +23 -0
  152. package/prompts/knowledge/project-records.md +62 -0
  153. package/prompts/knowledge/tool-advisor.md +29 -0
  154. package/prompts/knowledge/tool-apply-patch.md +18 -0
  155. package/prompts/knowledge/tool-bash.md +39 -0
  156. package/prompts/knowledge/tool-batch-eng-coder.md +12 -0
  157. package/prompts/knowledge/tool-batch-eng-designer.md +12 -0
  158. package/prompts/knowledge/tool-batch-review.md +12 -0
  159. package/prompts/knowledge/tool-batch.md +80 -0
  160. package/prompts/knowledge/tool-browser.md +57 -0
  161. package/prompts/knowledge/tool-code-search.md +4 -0
  162. package/prompts/knowledge/tool-consult-start.md +12 -0
  163. package/prompts/knowledge/tool-consult-stop.md +6 -0
  164. package/prompts/knowledge/tool-context.md +6 -0
  165. package/prompts/knowledge/tool-delete.md +17 -0
  166. package/prompts/knowledge/tool-doc-check.md +70 -0
  167. package/prompts/knowledge/tool-doc-graph-read.md +20 -0
  168. package/prompts/knowledge/tool-doc-graph.md +49 -0
  169. package/prompts/knowledge/tool-doc-search.md +6 -0
  170. package/prompts/knowledge/tool-edit.md +38 -0
  171. package/prompts/knowledge/tool-eng.md +2 -0
  172. package/prompts/knowledge/tool-execute.md +16 -0
  173. package/prompts/knowledge/tool-fetch.md +12 -0
  174. package/prompts/knowledge/tool-file-ops.md +16 -0
  175. package/prompts/knowledge/tool-get-current-time.md +7 -0
  176. package/prompts/knowledge/tool-git-read.md +19 -0
  177. package/prompts/knowledge/tool-git.md +29 -0
  178. package/prompts/knowledge/tool-glob.md +15 -0
  179. package/prompts/knowledge/tool-goal.md +8 -0
  180. package/prompts/knowledge/tool-grep.md +18 -0
  181. package/prompts/knowledge/tool-hashline-edit.md +14 -0
  182. package/prompts/knowledge/tool-insert-after.md +15 -0
  183. package/prompts/knowledge/tool-instance-list.md +6 -0
  184. package/prompts/knowledge/tool-instance-send.md +10 -0
  185. package/prompts/knowledge/tool-knowledge.md +18 -0
  186. package/prompts/knowledge/tool-ledger-read.md +35 -0
  187. package/prompts/knowledge/tool-ledger.md +42 -0
  188. package/prompts/knowledge/tool-lint.md +16 -0
  189. package/prompts/knowledge/tool-ls.md +13 -0
  190. package/prompts/knowledge/tool-lsp.md +11 -0
  191. package/prompts/knowledge/tool-main-history.md +2 -0
  192. package/prompts/knowledge/tool-manifest-read.md +14 -0
  193. package/prompts/knowledge/tool-manifest.md +31 -0
  194. package/prompts/knowledge/tool-memory-read.md +20 -0
  195. package/prompts/knowledge/tool-memory.md +15 -0
  196. package/prompts/knowledge/tool-notify-parent.md +12 -0
  197. package/prompts/knowledge/tool-operations.md +114 -0
  198. package/prompts/knowledge/tool-peer-instances.md +2 -0
  199. package/prompts/knowledge/tool-plan.md +6 -0
  200. package/prompts/knowledge/tool-process-read.md +13 -0
  201. package/prompts/knowledge/tool-process.md +15 -0
  202. package/prompts/knowledge/tool-question.md +16 -0
  203. package/prompts/knowledge/tool-read-history-batch.md +22 -0
  204. package/prompts/knowledge/tool-read-history.md +36 -0
  205. package/prompts/knowledge/tool-read-image.md +11 -0
  206. package/prompts/knowledge/tool-read.md +21 -0
  207. package/prompts/knowledge/tool-recent-changes.md +6 -0
  208. package/prompts/knowledge/tool-repo-outline.md +4 -0
  209. package/prompts/knowledge/tool-settings-read.md +12 -0
  210. package/prompts/knowledge/tool-settings.md +18 -0
  211. package/prompts/knowledge/tool-skill.md +6 -0
  212. package/prompts/knowledge/tool-ssh.md +52 -0
  213. package/prompts/knowledge/tool-subagent.md +59 -0
  214. package/prompts/knowledge/tool-task.md +12 -0
  215. package/prompts/knowledge/tool-team-ledger-read.md +11 -0
  216. package/prompts/knowledge/tool-team-ledger.md +11 -0
  217. package/prompts/knowledge/tool-timer.md +23 -0
  218. package/prompts/knowledge/tool-tree.md +14 -0
  219. package/prompts/knowledge/tool-verify.md +19 -0
  220. package/prompts/knowledge/tool-wait-for.md +25 -0
  221. package/prompts/knowledge/tool-websearch.md +19 -0
  222. package/prompts/knowledge/tool-write.md +9 -0
  223. package/prompts/knowledge/upstream-protocol.md +43 -0
  224. package/prompts/persona-eng-coder.md +21 -3
  225. package/prompts/persona-eng-designer.md +131 -169
  226. package/prompts/persona-engineering.md +142 -84
  227. package/prompts/persona-explore.md +1 -1
  228. package/prompts/persona-plan.md +5 -1
  229. package/prompts/subagent-base.md +2 -0
  230. package/provider/anthropic.mjs +6 -4
  231. package/provider/core.mjs +3 -2
  232. package/provider/errors.mjs +29 -4
  233. package/provider/google.mjs +24 -7
  234. package/provider/responses.mjs +3 -1
  235. package/provider-flows.mjs +2 -2
  236. package/session-index-build.mjs +1 -1
  237. package/session-index-pass.mjs +1 -1
  238. package/session-index-query.mjs +1 -1
  239. package/session-index.mjs +1 -1
  240. package/session-lifecycle.mjs +72 -17
  241. package/session-slot-write.mjs +37 -5
  242. package/session.mjs +24 -8
  243. package/skip-dirs.mjs +2 -2
  244. package/team-ledger.mjs +13 -9
  245. package/token-ttl.mjs +73 -4
  246. package/token-window.mjs +167 -33
  247. package/tool-docs/advisor.md +2 -27
  248. package/tool-docs/apply_patch.md +1 -15
  249. package/tool-docs/bash.md +2 -41
  250. package/tool-docs/batch-eng-coder.md +3 -0
  251. package/tool-docs/batch-eng-designer.md +3 -0
  252. package/tool-docs/batch-review.md +3 -0
  253. package/tool-docs/batch.md +2 -84
  254. package/tool-docs/browser.md +2 -49
  255. package/tool-docs/code_search.md +2 -2
  256. package/tool-docs/consult_start.md +2 -8
  257. package/tool-docs/consult_stop.md +2 -4
  258. package/tool-docs/context.md +1 -5
  259. package/tool-docs/delete.md +2 -17
  260. package/tool-docs/doc_check.md +2 -107
  261. package/tool-docs/doc_graph-read.md +3 -0
  262. package/tool-docs/doc_graph.md +3 -0
  263. package/tool-docs/doc_search.md +2 -4
  264. package/tool-docs/edit.md +1 -38
  265. package/tool-docs/eng.md +3 -1
  266. package/tool-docs/execute.md +2 -18
  267. package/tool-docs/fetch.md +2 -14
  268. package/tool-docs/file_ops.md +2 -18
  269. package/tool-docs/get_current_time.md +1 -6
  270. package/tool-docs/git-read.md +3 -0
  271. package/tool-docs/git.md +2 -35
  272. package/tool-docs/glob.md +2 -10
  273. package/tool-docs/goal.md +1 -6
  274. package/tool-docs/grep.md +2 -18
  275. package/tool-docs/hashline_edit.md +2 -15
  276. package/tool-docs/insert_after.md +2 -16
  277. package/tool-docs/instance_list.md +3 -0
  278. package/tool-docs/instance_send.md +3 -0
  279. package/tool-docs/knowledge.md +3 -0
  280. package/tool-docs/ledger-read.md +3 -0
  281. package/tool-docs/ledger.md +3 -8
  282. package/tool-docs/lint.md +2 -10
  283. package/tool-docs/ls.md +2 -11
  284. package/tool-docs/lsp.md +2 -9
  285. package/tool-docs/main_history.md +3 -1
  286. package/tool-docs/manifest-read.md +2 -8
  287. package/tool-docs/manifest.md +2 -35
  288. package/tool-docs/memory-read.md +3 -0
  289. package/tool-docs/memory.md +2 -20
  290. package/tool-docs/notify_parent.md +2 -13
  291. package/tool-docs/peer_instances.md +3 -1
  292. package/tool-docs/plan.md +1 -5
  293. package/tool-docs/process-read.md +3 -0
  294. package/tool-docs/process.md +2 -13
  295. package/tool-docs/question.md +3 -17
  296. package/tool-docs/read.md +2 -19
  297. package/tool-docs/read_history-batch.md +3 -0
  298. package/tool-docs/read_history.md +2 -18
  299. package/tool-docs/read_image.md +2 -9
  300. package/tool-docs/recent_changes.md +2 -2
  301. package/tool-docs/repo_outline.md +2 -2
  302. package/tool-docs/settings-read.md +3 -0
  303. package/tool-docs/settings.md +1 -12
  304. package/tool-docs/skill.md +2 -6
  305. package/tool-docs/ssh.md +1 -62
  306. package/tool-docs/subagent.md +2 -100
  307. package/tool-docs/task.md +1 -7
  308. package/tool-docs/team_ledger-read.md +3 -0
  309. package/tool-docs/team_ledger.md +3 -9
  310. package/tool-docs/timer.md +2 -19
  311. package/tool-docs/tree.md +2 -13
  312. package/tool-docs/verify.md +2 -12
  313. package/tool-docs/wait_for.md +2 -32
  314. package/tool-docs/websearch.md +2 -19
  315. package/tool-docs/write.md +2 -12
  316. package/tools/browser.mjs +52 -7
  317. package/tools/doc-write-gate.mjs +73 -0
  318. package/tools/edit-batch.mjs +170 -92
  319. package/tools/edit-diff.mjs +78 -62
  320. package/tools/edit-receipt.mjs +39 -0
  321. package/tools/execute.mjs +1 -1
  322. package/tools/file.mjs +16 -8
  323. package/tools/git.mjs +24 -9
  324. package/tools/index.mjs +6 -0
  325. package/tools/knowledge.mjs +143 -0
  326. package/tools/linter.mjs +3 -3
  327. package/tools/ops.mjs +3 -1
  328. package/tools/patch.mjs +123 -43
  329. package/tools/shared.mjs +28 -27
  330. package/tools/write-gate-params.mjs +31 -0
  331. package/tools/write-path.mjs +16 -4
  332. package/window-policy.mjs +203 -0
  333. package/doc-check/anchors.mjs +0 -235
package/tool-docs/task.md CHANGED
@@ -1,9 +1,3 @@
1
1
  Plan and track a task list for complex multi-step work.
2
- Each call replaces the entire list.
3
- Keep exactly one item in_progress at a time; mark items done as you complete them; never mark done if tests fail or work is partial.
4
2
 
5
- Statuses: pending | in_progress | done — synonyms (completed/finished/complete, todo/open/waiting, active/running/working, …) are accepted and normalized with a warning.
6
- IMPORTANT: title is required and must be a non-empty string — items with empty titles are silently dropped.
7
-
8
- For cross-session / project-level tracking, use `/ledger`.
9
- Returns the updated task list (or the new item's ID on add).
3
+ {{knowledge:tool-task}}
@@ -0,0 +1,3 @@
1
+ The team ledger, read-only: one book on the server, shared by the whole team, usable once you are logged in.
2
+
3
+ {{knowledge:tool-team-ledger-read}}
@@ -1,9 +1,3 @@
1
- 团队台账(服务端一本——登录后可用;与**本机台账两账独立**:本机账照旧,团队账零离线缓存)。action = query / count / add / update / close。
2
- - query / count:只读全角色;add / update / close:写仅主 agent 装配面(子代理只读)。
3
- - 仓标记自动派生(当前项目根的 git 源——不手挑):无 git 仓 ∥ 无 remote.origin.url ⇒ 明示失败、零请求。
4
- - query:scope = "repo"(缺省——当前仓)∥ "team"(全队跨仓);过滤 status(六态:待讨论 / 待设计 / 在途 / 待核销 / 已核销 / 已废弃)∥ owner(用户名精确匹配);行集携 aged(未决四态 ∧ 行龄 > 30 天)。
5
- - count:同 query 参数,出 total。
6
- - add:title 必填(≤200)∥ detail(≤4000)∥ owner(缺省 = 自己)——status 恒 待讨论。
7
- - update:id 必填;title / detail / owner / status 至少一件;status = 迁移表合法后继(待讨论→待设计 ∥ 待设计→在途 ∥ 在途→待核销 ∥ 待核销→已核销 ∥ 未归档→已废弃);已归档(已核销 / 已废弃)⇒ 拒;仓不可改。
8
- - close:id + status(已核销 ∥ 已废弃)——已核销:勾销(只自 待核销;其余现态 400,出路 = 先 PATCH 推进到 待核销);已废弃 = 撤回(任意未归档态)。
9
- - 登录态门:未登录 ⇒ 明示「未登录」且零请求;401(token 失效)⇒ 「登录已失效——请重新登录」;不可达 ⇒ 「服务器不可达」(零离线缓存,重试不落旧值)。
1
+ The team ledger: one book on the server, shared by the whole team, usable once you are logged in.
2
+
3
+ {{knowledge:tool-team-ledger}}
@@ -1,20 +1,3 @@
1
- Set a timer before you start analyzing code.
2
- When the timer fires, a system reminder will be injected suggesting you try running code or adding debug logs.
3
- Use this to enforce a thinking budget: you get N seconds to reason, then the timer reminds you to act.
1
+ Set a timer whose expiry injects a reminder — a way to hold yourself to a thinking budget.
4
2
 
5
- Beyond a one-shot countdown, three schedule forms are available, one per call (`seconds`, `at`, `every` and `daily` are mutually exclusive — passing more than one is a validation error):
6
-
7
- `at` takes a local clock time such as "2026-10-13T09:00" and fires once at that moment — a time already past fires immediately.
8
- `every` takes a fixed interval in seconds (minimum 60): the first reminder comes N seconds after setting, then every N seconds, until cancelled.
9
-
10
- `daily` takes a local "HH:MM" and repeats every day at that time (a time already past today fires tomorrow), until cancelled.
11
- All times are local to the host.
12
-
13
- `cancel` takes the id from the set confirmation and stops that timer; `list` shows every pending timer with its next due time. Repeating timers occupy one pending slot each until cancelled.
14
- Returns the set confirmation — the reminder fires at the deadline.
15
-
16
- Delivery: when the session is idle it is delivered on the spot and starts a turn — the idle wake is available on the CLI / VSC / desktop foregrounds and suspension windows (headless is structurally unsupported).
17
-
18
- A user turn gets no delivery: while a session turn is running, an expired timer waits for the next delivery round (suspension window / idle latch); other paths keep the step-boundary behavior.
19
-
20
- A pending timer survives across runs; at most 8 timers may be pending at once, and further timer calls are rejected until some expire.
3
+ {{knowledge:tool-timer}}
package/tool-docs/tree.md CHANGED
@@ -1,14 +1,3 @@
1
- Generate a directory tree of the codebase (default depth 3). Skips dotfiles, .git/node_modules/dist/build/bin/obj and other build/vendor dirs, and binary files. Use to quickly see which modules exist and where files live.
1
+ Generate a directory tree of the codebase.
2
2
 
3
- **Route to tree instead of bash:**
4
- - `tree` / `find .` / `dir /s` → tree
5
-
6
- Parameters:
7
- - path: Root directory (default cwd)
8
- - depth: Tree depth (default 3, max 6). Directories are listed before files, both sorted.
9
-
10
- Notes:
11
- - Capped at 200 entries.
12
- - Directories end with `/`; tree-drawing uses `├──`/`└──`/`│`.
13
- - Use depth for a shallow overview; use `ls` for one directory, `glob` for a specific file pattern.
14
- - Returns the directory text tree — directories first (`dir/`), files after, both sorted, capped at 200 entries.
3
+ {{knowledge:tool-tree}}
@@ -1,13 +1,3 @@
1
- Generic pre-completion verification gate — language/framework/project agnostic. verify does NOT run any test/verification command for you and does NOT require a test per change.
1
+ Generic pre-completion verification gate — language, framework and project agnostic.
2
2
 
3
- You DECLARE your verification status via the verification argument ({ status: 'passed' | 'failed' | 'skipped', command?, summary?, basis? } — effects per parameter): the declaration is self-reported evidence —
4
-
5
- verify only mechanically gates on it ('passed' → allowed; 'failed' → blocked; 'skipped' → allowed but needs a reason).
6
-
7
- 'basis' (optional) is the 'what it stands on' dimension of the declaration — a judgment source, the exact words you read at their path, or an explicit 'unverified' (declaration-only: no format is enforced or machine-checked);
8
-
9
- a passed / skipped declaration with no basis gets one advisory hint line in the report — never blocking and never changing the gate — while the failed face gets no basis hint (already blocked).
10
-
11
- Whether/how to verify is described in natural language in the project's AGENTS.md and is decided + executed by you. The report also carries the changed files (git diff), an advisory node --check hint on changed .js/.mjs (not gating), the task list, and a self-review checklist.
12
-
13
- Call this BEFORE declaring a coding task complete — do not say 'done' until verify passes.
3
+ {{knowledge:tool-verify}}
@@ -1,33 +1,3 @@
1
- Wait until a condition becomes true — polls every interval_ms and returns as soon as it holds or timeout_ms passes.
1
+ Wait until a condition becomes true.
2
2
 
3
- **Use it only for states that cannot announce themselves**: a file appearing, a port opening, a background bash or browser task finishing. Nothing delivers those into the session, so a blocking wait is the only way to learn about them.
4
-
5
- **Never use it to wait for a subagent or a review report.** Those arrive on their own when the session is idle — the act of waiting for one is simply ending the turn.
6
-
7
- `wait_for "subagent id:N done"` and `wait_for "advisor settled"` park the session for the whole budget, poll hundreds of times, and learn nothing you would not have been handed anyway.
8
-
9
- Measured in practice: two such waits in one session burned ~4.5 minutes and 210 polls on reports that were already on their way. The conditions stay supported (a background task genuinely may need joining), but reaching for them on a child is the classic misuse.
10
-
11
- Parameters:
12
- - condition (required): a semantic condition expression:
13
- - `advisor settled` — an in-flight advisor review session has finished — **discouraged**: the report is delivered automatically; end the turn instead
14
- - `subagent id:N done` — async subagent N (the id your async spawn ack returned) has settled — **discouraged**, same reason
15
- - `consult done` — every consult_start session has drained — the verdict text is delivered automatically; wait only when a synchronous caller cannot proceed without it
16
- - `bash id:N done` — background bash task N (the id from the bash async ack, `bash#N`) has finished — settled, or already left the pool (nothing left to wait on)
17
- - `browser id:N done` — a background browser task N (the id from the ack, `browser#N`) has settled — finished, or already left the pool (nothing left to wait on)
18
- - `file exists:path` — the file at path exists (path relative to cwd)
19
- - `port open:N` — something is listening on 127.0.0.1 port N
20
- - The agent-internal conditions (advisor / subagent / consult / bash) apply to ASYNC sessions only — a synchronous call already completed before it returned and has nothing to wait for.
21
- - An unknown condition is an explicit error (`wait_for: unsupported condition "..."` — the supported forms are listed above), never a silent wait.
22
- - interval_ms: poll interval (default 1000, floor 100 — polling never busy-spins)
23
- - timeout_ms: overall ceiling (default 30000; config.json `agent.waitForTimeoutMs` overrides the default; hard cap 600000 like the execute tool)
24
-
25
- Returns:
26
- - `wait_for: condition satisfied after Nms (N checks): "<condition>"` — condition held
27
- - `wait_for: timed out after Nms waiting for "<condition>" ...` — ceiling passed with the condition still false (never burns beyond the ceiling)
28
- - interrupts (Ctrl+C / cancel) exit immediately; malformed conditions and unsupported syntax error out explicitly
29
-
30
- Notes:
31
- - Read-only and non-destructive — it only observes (agent pools, the filesystem, a local port probe).
32
- - Blocking by design — call it ALONE in a turn, not batched with calls that depend on its result.
33
- - This is the one blocking call an agent usually should not reach for. Before calling it, ask: **will this state announce itself to me anyway?** If yes (a subagent report, a review digest, a timer), end the turn and let it arrive.
3
+ {{knowledge:tool-wait-for}}
@@ -1,20 +1,3 @@
1
- Search the web (DeepSeek Search when a DeepSeek provider is configured; otherwise Tavily with a key, else Bing). Returns result titles, URLs, and snippets — DeepSeek results also carry a date · authority (0–4) · rerank (0–3) line and a long summary.
1
+ Search the web and return result titles, URLs and snippets.
2
2
 
3
- Use for looking up current information, docs, error messages.
4
-
5
- Parameters:
6
- - query (required): Search query
7
- - limit: Max results (default 8, max 20)
8
- - engine: Specific engine to use — "bing" (Bing). Omit to search all engines concurrently.
9
- - page: Page number for pagination (1-based, default 1). Only used when engine is specified.
10
- - proxy: http://host:port explicit proxy (optional) — use ONLY when passed; no proxy = direct. config.json proxy is NOT auto-applied (2026-08-31 ruling); Bing/foreign sites usually need a proxy, domestic targets don't
11
-
12
- Notes:
13
- - Before searching the web, call the memory tool (action: search) first — you may already know the answer from a previous session. Only reach for websearch if memory comes up empty.
14
- - Runs synchronously — returns when the search completes (all selected engines run in parallel).
15
- - Use this for information that is NOT in the local codebase — current docs, error messages, API references
16
- - Follow up with `fetch` to read full pages from the results
17
- - **Weak engine warning**: Bing's index is noisy for technical queries — if a first websearch returns irrelevant/townhall-grade results, DO NOT retry the same query. Configure a search MCP tool (e.g. `glm-websearch` via the MCP config) for technical lookups; websearch is the fallback.
18
- - Proxy: NOT auto-applied from config.json (2026-08-31 ruling). Pass `proxy: "http://host:port"` explicitly when the target needs one; omit for domestic targets.
19
- - Backend priority: DeepSeek (auto — a providers[] entry with baseURL host api.deepseek.com and a key) → Tavily → Bing. websearch.backend: "local" disables the DeepSeek backend.
20
- - DeepSeek query operators: site:, lang:, after:/before:, and quoted phrases pass through as-is; limit maps to count (1–20).
3
+ {{knowledge:tool-websearch}}
@@ -1,13 +1,3 @@
1
- Write content to a file. Creates parent directories; overwrites existing file.
1
+ Write content to a file, creating parent directories; an existing file is overwritten.
2
2
 
3
- Parameters:
4
- - path (required): File path, relative to cwd or absolute
5
- - content (required): Full content to write
6
-
7
- Notes:
8
- - write replaces the WHOLE file — read it first and confirm you intend to rewrite it entirely; for a small change use edit / insert_after.
9
- - Returns `Wrote N chars to <path>` + git diff + syntax-check note.
10
- - This overwrites the entire file — use `edit` for targeted changes
11
- - The file is atomic: it either writes completely or fails
12
-
13
- **`ledger`** — the in-flight ledger row this call serves: `"#N"` or `"N"`. In engineering mode the parent agent must pass it — a call that does not say which row it serves is refused.
3
+ {{knowledge:tool-write}}
package/tools/browser.mjs CHANGED
@@ -2,9 +2,11 @@
2
2
  * tools/browser.mjs — 浏览器工具面:schema ∥ 参数校验 ∥ `isReadonlyAction` ∥ 回执/错误形(§2.1/§2.2/§3.1)。
3
3
  *
4
4
  * 设计权威 = `docs/core/design/BROWSER-TOOL.md`(工具系统档 §6.7 只留指针)。
5
- * 分类钩子(KD-2 ∥ KD-11):过门 = `click` ∥ `evaluate` + `press` ∥ `mouse` ∥ `drag` ∥ `touch` 点按 ∥
5
+ * 分类钩子(KD-2 ∥ KD-11 ∥ N-BT7):过门 = `click` ∥ `evaluate` + `press` ∥ `mouse` ∥ `drag` ∥ `touch` 点按 ∥
6
6
  * `clipboard` 全量;免审 = `navigate` ∥ `type` ∥ `snapshot` ∥ `screenshot` ∥ `wait` ∥ `close` +
7
- * `hover` ∥ `wheel` ∥ `insert` ∥ `touch` 手势(swipe / pinch)——同一钩子按参数分类,机制零新增。
7
+ * `hover` ∥ `wheel` ∥ `insert` ∥ `touch` 手势(swipe / pinch)+ `cookies` ∥ `storage` 六形
8
+ * (会话态是测试数据,不是对用户系统的破坏性动作——用户 2026-11-06 裁「不要搞鸡毛审核」)
9
+ * ——同一钩子按参数分类,机制零新增。
8
10
  * 失败回执**返回**(不 throw)——首行 `Error: …` = 模型面失败形(`bash`/`execute` 既例;dispatch 侧按该前缀
9
11
  * 判失败——`agent/dispatch-run.mjs` 的 `runPreparedItem`(三处))。
10
12
  * 异步面(§2.11——批 browser-async-fix):`async:true`(depth-0 专项)⇒ `agent-tools/browser-async.mjs`
@@ -12,12 +14,16 @@
12
14
  */
13
15
  import { CLIPBOARD_OPS } from "../browser/clipboard.mjs"
14
16
  import { TOUCH_GESTURES, parseTargetSpec } from "../browser/input.mjs"
17
+ import {
18
+ COOKIE_OPS, STORAGE_AREAS, STORAGE_OPS, cookieDomainError, cookieSetError, storageKeyError,
19
+ unknownCookieOp, unknownStorageArea, unknownStorageOp,
20
+ } from "../browser/session-state.mjs"
15
21
  import { runAction } from "../browser/session.mjs"
16
22
  import { DESC } from "./shared.mjs"
17
23
 
18
24
  export const BROWSER_ACTIONS = [
19
25
  "navigate", "snapshot", "click", "type", "evaluate", "wait", "screenshot", "close",
20
- "press", "hover", "wheel", "mouse", "drag", "touch", "insert", "clipboard",
26
+ "press", "hover", "wheel", "mouse", "drag", "touch", "insert", "clipboard", "cookies", "storage",
21
27
  ]
22
28
  const REF_RE = /^e\d+$/
23
29
  const GATED_ACTIONS = new Set(["click", "evaluate", "press", "mouse", "drag", "clipboard"])
@@ -85,6 +91,41 @@ export function validateArgs(args) {
85
91
  if (!CLIPBOARD_OPS.includes(op)) return `Error: unknown clipboard op "${op}" — ops: ${CLIPBOARD_OPS.join(", ")}`
86
92
  if (op === "write" && typeof args.text !== "string") return "Error: clipboard write requires text"
87
93
  }
94
+ // 会话态条件校验(§2.2 两段;逐项文案单源 = `browser/session-state.mjs`)。判法只有一条:键不存在 = 没给;
95
+ // 给了就必须是声明类型且形合法,否则显式拒(`null` 也算「给了但形不对」)。`cookieSetError` 是 `cookies[]`
96
+ // 逐项的唯一判法,工具面与动作面同调它 ⇒ 两处同句(D2)。
97
+ if (action === "cookies") {
98
+ if (!nonEmpty(args.op)) return "Error: cookies requires op"
99
+ if (!COOKIE_OPS.includes(String(args.op))) return `Error: ${unknownCookieOp(String(args.op))}`
100
+ // 形不对就拒,不当作「没给」(§2.2 · U86 ∥ U93):当作没给会让 `clear` 兑现成全域清空;带端口的 `localhost:3000`
101
+ // 放行就等于一次零匹配过滤(回 0 条,读起来像「本来就没有」)
102
+ if (args.domain !== undefined) {
103
+ const badDomain = cookieDomainError(args.domain)
104
+ if (badDomain) return `Error: ${badDomain}`
105
+ }
106
+ if (args.op === "set") {
107
+ const bad = cookieSetError(args.cookies)
108
+ if (bad) return `Error: ${bad}`
109
+ }
110
+ }
111
+ if (action === "storage") {
112
+ const op = String(args.op ?? "")
113
+ if (!nonEmpty(args.op)) return "Error: storage requires op"
114
+ if (!STORAGE_OPS.includes(op)) return `Error: ${unknownStorageOp(op)}`
115
+ // 形不对就拒,不当作「没给」(§2.2 · U86):`null` ∥ 非串 ∥ 空串静默落缺省,与 `clear` 落全域同一类;
116
+ // 判形只认 `typeof`——`String()` 仅用于渲染错误句(`["localStorage"]` 也 stringify 成合法域名)。
117
+ if (args.area !== undefined && (typeof args.area !== "string" || !STORAGE_AREAS.includes(args.area))) {
118
+ return `Error: ${unknownStorageArea(String(args.area))}`
119
+ }
120
+ if (op === "set" && (typeof args.key !== "string" || typeof args.value !== "string")) {
121
+ return "Error: storage set requires key and value"
122
+ }
123
+ // 形不对就拒,不当作「没给」(§2.2 · U86):当作没给会让 `clear` 清整份 store;空串是合法键名,不拒
124
+ if (args.key !== undefined) {
125
+ const badKey = storageKeyError(args.key)
126
+ if (badKey) return `Error: ${badKey}`
127
+ }
128
+ }
88
129
  return null
89
130
  }
90
131
 
@@ -94,7 +135,7 @@ export const browserTool = {
94
135
  parameters: {
95
136
  type: "object",
96
137
  properties: {
97
- action: { type: "string", enum: BROWSER_ACTIONS, description: "Action to run (one per call): navigate | snapshot | click | type | evaluate | wait | screenshot | close | press | hover | wheel | mouse | drag | touch | insert | clipboard." },
138
+ action: { type: "string", enum: BROWSER_ACTIONS, description: "Action to run (one per call): navigate | snapshot | click | type | evaluate | wait | screenshot | close | press | hover | wheel | mouse | drag | touch | insert | clipboard | cookies | storage." },
98
139
  url: { type: "string", description: "navigate: http/https URL to open — also the `wait` url predicate (substring of location.href)." },
99
140
  ref: { type: "string", description: "click / type / press / hover / wheel / mouse / touch / insert: element reference from the last snapshot (`e<N>`)." },
100
141
  text: { type: "string", description: "type: text to enter — insert: text to insert; clipboard write: text to write; wait: the awaited visible text." },
@@ -105,8 +146,8 @@ export const browserTool = {
105
146
  networkIdle: { type: "boolean", description: "wait: true = wait until network activity is quiet for 500ms." },
106
147
  timeoutMs: { type: "number", description: "Budget override in ms: wait = the predicate timeout (default 30000, cap 120000); other actions = the whole-call budget (default per action table, hard cap 120000)." },
107
148
  fullPage: { type: "boolean", description: "screenshot: true = capture the whole page, false = viewport (default)." },
108
- headless: { type: "boolean", description: "Session-open parameter (any action): default true. A different value on a running session is an error — close it first." },
109
- key: { type: "string", description: "press: key name (Enter, Escape, Tab, Backspace, Delete, Space, Insert, Home, End, PageUp, PageDown, Arrows, F1-F12, modifiers) or a single character." },
149
+ headless: { type: "boolean", description: "The shared browser's first-open attribute (any action): default true. When another instance already started it, your value cannot be applied — the session reuses the running mode and the receipt carries a `[note: the shared browser is running headless=<actual> …]` line saying so. Switching modes needs every instance to release the browser first." },
150
+ key: { type: "string", description: "press: key name (Enter, Escape, Tab, Backspace, Delete, Space, Insert, Home, End, PageUp, PageDown, Arrows, F1-F12, modifiers) or a single character. storage: the target key (get / clear address one key; storage set requires it)." },
110
151
  modifiers: { type: "array", items: { type: "string" }, description: "press: modifier keys held (and observed by the page) — Control | Alt | Shift | Meta, any combination." },
111
152
  phase: { type: "string", description: "press: press (default) | down | up. mouse: click (default) | down | up." },
112
153
  repeat: { type: "number", description: "press: auto-repeat count while the key is held (0-100, default 0)." },
@@ -123,7 +164,11 @@ export const browserTool = {
123
164
  gesture: { type: "string", description: "touch: tap (default) | doubleTap | swipe | pinch." },
124
165
  scale: { type: "number", description: "touch pinch: scale factor (>1 zoom in, <1 zoom out)." },
125
166
  ime: { type: "string", description: "insert: IME composition text staged before the committed text is inserted." },
126
- op: { type: "string", description: "clipboard: read | write | copy | paste." },
167
+ op: { type: "string", description: "clipboard: read | write | copy | paste. cookies / storage: get | set | clear." },
168
+ cookies: { type: "array", items: { type: "object" }, description: "cookies set: one or more cookies — { name, value, domain?, path?, expires?, httpOnly?, secure?, sameSite? }. Every declared field is type-checked before anything is written: `path` must be a string starting with \"/\", `expires` must be Unix seconds as a number (a string is rejected, never coerced), `httpOnly` and `secure` must be booleans, `sameSite` must be Strict | Lax | None. A value of the wrong type is an error naming the field, never silently defaulted — `httpOnly:\"true\"` would otherwise store a cookie that is not httpOnly while the receipt reported success. A given `domain` is written as-is: cross-domain writes are intentional (no switch, no approval), but it must be a bare host — a scheme, a path or a `host:port` pair (`localhost:3000`; cookie domains never carry a port) is an error, never treated as omitted. Omit `domain` to land on the current page's origin." },
169
+ domain: { type: "string", description: "cookies: get = domain filter (subdomains included; an IP literal matches itself only); clear = scope. A value that is not a non-empty host string is an error, never treated as omitted — a `host:port` pair such as `localhost:3000` counts as one (cookie domains never carry a port, so it would filter to nothing and read as \"that domain has no cookies\"). Omit it on get ⇒ every cookie in the shared profile, on clear ⇒ the whole profile's cookies are wiped for every instance." },
170
+ area: { type: "string", description: "storage: localStorage (default) | sessionStorage. The two areas are separate scopes and never bleed into each other. Any other value — null, a non-string, an empty string — is an error naming the value, never treated as omitted: only leaving it out selects the default." },
171
+ value: { type: "string", description: "storage set: the value (a string; a non-string is rejected, never silently stringified)." },
127
172
  async: { type: "boolean", description: "Run this action in the background (default false, depth-0 only): returns an ack at once (browser#<N> started (running) — <action> <subject>); the finished result arrives later as a system reminder summary. Use wait_for \"browser id:N done\" to wait; process {action:\"kill\", id:N} to cancel." },
128
173
  },
129
174
  required: ["action"],
@@ -0,0 +1,73 @@
1
+ /**
2
+ * tools/doc-write-gate.mjs — 写前文档机检门(写盘面)。
3
+ *
4
+ * 判据句单源 = `docs/core/design/DOC-CHECK.md`(本档只装配,不重述口径):一段太长 ∥ 拿行号做锚 ∥ 悬空指针。
5
+ * 挂点唯一 = `./write-path.mjs` 的 `writeThroughPath`(`op === "write"`,含 `apply_patch` 的 stage 段)。
6
+ *
7
+ * 一句话:文档面 `.md` 的每一笔内容写,在**落盘之前**判**这一笔改的行**——命中即 throw、零字节。
8
+ * **时点 = 写时点**(判据句单源 = `docs/core/design/DOC-CHECK.md` §9):判域谓词原样交回,所以批档面在这一刻
9
+ * 照判段长 ∥ 行号锚(悬空按 §3 第二条例免)——与 §9 之前逐字相同。
10
+ * **判域 = 这一笔改的行**(单源 = `docs/core/design/DOC-CHECK.md` §6「写时点怎么取区间」):盘上现文与改后整份内容
11
+ * 两份交 `../doc-check/index.mjs` 的 `changedRegionOf` 求区——变了的行,加上被删那几行所在的缝;没变的行一条都不出。
12
+ * 盘上还没有这份档 ∥ 现文读不出来(目标是目录 `EISDIR` ∥ 权限拒绝 `EACCES`)⇒ 没有可比的旧文本 ⇒ 交 `region: null` 整份判。
13
+ *
14
+ * 判据本体零副本(D2):三条判据与报面句子全部来自 `../doc-check/index.mjs` 的导出。
15
+ */
16
+ import { readFileSync } from "node:fs"
17
+ import { parse, resolve } from "node:path"
18
+
19
+ import { owningProject } from "../manifest.mjs"
20
+ import { changedRegionOf, hitLine, judgeText, judgedDomainDocs, MOMENT } from "../doc-check/index.mjs"
21
+ import { pathIndexOf, plannedPathsOf } from "../doc-check/existence.mjs"
22
+ import { faceDetail } from "../agent/write-face.mjs"
23
+
24
+ /**
25
+ * 写前门(挂点唯一的入口)。
26
+ *
27
+ * @param {{abs:string, content:string, root?:string}} o
28
+ * `abs` = 目标绝对路径;`content` = **改后整份内容**(各写径实读同形 ⇒ 门不必自己合并改动);
29
+ * `root` = 文档机检的基根,**显式参数**,缺省回落 = `owningProject(abs, <目标所在盘根>)`。
30
+ * @returns {{judged:boolean, hits:number}} 面窄化(非 `.md` ∥ 出辖 ∥ 排除面上的档 ∥ 内容逐字未变)⇒ `judged:false`;
31
+ * 放行 ⇒ `hits:0`。命中 ⇒ **throw**(拒串 = verdict + 逐条命中行 + 零字节声明),目标档字节不变。
32
+ */
33
+ export async function runDocWriteGate({ abs, content, root } = {}) {
34
+ const target = resolve(String(abs ?? ""))
35
+ if (typeof content !== "string") return { judged: false, hits: 0 }
36
+ if (!target.toLowerCase().endsWith(".md")) return { judged: false, hits: 0 }
37
+ const projectRoot = root ? resolve(root) : owningProject(target, parse(target).root)
38
+ if (!projectRoot) return { judged: false, hits: 0 }
39
+ if (faceDetail(target).reason !== "doc-root") return { judged: false, hits: 0 }
40
+ // 逐字未变 ⇒ 这一笔不写任何字节 ⇒ 判面为空(不是「放行一条有问题的档」)。
41
+ let old = null
42
+ try { old = readFileSync(target, "utf8") } catch { old = null }
43
+ if (old !== null && old === content) return { judged: false, hits: 0 }
44
+
45
+ // 判域谓词(判据句单源 = `docs/core/design/DOC-CHECK.md` §9):本门站在**写时点**——那一刻判域原样交回,
46
+ // 所以批档面照判段长 ∥ 行号锚(悬空按 §3 第二条例免)。这一笔写出去的是目标档改后整份内容,判域里只有它自己:
47
+ // 谓词在这里是「报到」,不是过滤器——**除排除面外**:排除面上声明过的档在这一刻确实不在判域里(§10),
48
+ // 那一支在下面按「没判」放行。判域那一维不变;判的是**哪几行**——区间取 `old`(盘上现文)与
49
+ // `content`(改后整份)两份,见下(§6「写时点怎么取区间」)。
50
+ const domain = judgedDomainDocs([target], { moment: MOMENT.writer, root: projectRoot })
51
+ // 排除面上的档(判据句单源 = `docs/core/design/DOC-CHECK.md` §10)不进判域 ⇒ 这一刻**没有要判的行**:
52
+ // 与「非 `.md` ∥ 出辖」同一形,不判、不拦。排除是声明面给的放行,不是接线错——把它报成错就是把一笔合法写拒掉。
53
+ if (domain.length === 0) return { judged: false, hits: 0 }
54
+ // 判域非空却对不上目标档 = 接线错了,不是「这一笔没病」:当场抛带门名的错,不转发 `resolve(undefined)` 那种语言错,
55
+ // 也不静默判零条(判零条会交一个 `hits:0` 的放行——门没判过却报干净)。
56
+ if (domain.length !== 1 || domain[0] !== target) {
57
+ throw new Error(`doc_write_gate: 判域异常——写时点判域除排除面外应恒含目标档本身,实得 ${domain.length} 档(判域与写时点不一致;本笔未落盘)。Nothing was written.`)
58
+ }
59
+ const [file] = domain
60
+ const planned = plannedPathsOf(projectRoot)
61
+ const indexPath = pathIndexOf(projectRoot)
62
+ // 区间 = 两份文本直接求(§6):盘上现文 → 这一笔要写的改后整份。取不到现文(新档 ∥ 读不出来)⇒ `null` = 整份判:
63
+ // 盘上没有可比的旧文本时,这一笔写的每一行都是变更行,没有别的取法。
64
+ const region = old === null ? null : changedRegionOf(old, content)
65
+ const hits = judgeText(content, { file, root: projectRoot, planned, indexPath, region })
66
+ if (hits.length === 0) return { judged: true, hits: 0 }
67
+ throw new Error([
68
+ "doc_write_gate: 文档机检门拒写(doc-check gate)—— 本次写入未落盘,目标档字节逐字不变(零字节)。",
69
+ "DOC-CHECK GATE: REFUSED",
70
+ ...hits.map((h) => hitLine(projectRoot, h)),
71
+ "处置:改掉上面每一处再写同一笔;拿不准 ⇒ 上抛主 agent 裁决。Nothing was written.",
72
+ ].join("\n"))
73
+ }