@thincoder/core 0.11.3 → 0.11.5

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 (183) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/advisor/compaction.mjs +40 -17
  3. package/advisor/loop.mjs +14 -6
  4. package/advisor/notice.mjs +1 -1
  5. package/advisor/timeline.mjs +4 -4
  6. package/agent/completion.mjs +19 -0
  7. package/agent/dispatch-gates.mjs +2 -0
  8. package/agent/dispatch.mjs +2 -2
  9. package/agent/family-tools.mjs +13 -9
  10. package/agent/helpers.mjs +10 -6
  11. package/agent/planning-step.mjs +453 -0
  12. package/agent/post-turn.mjs +70 -2
  13. package/agent/run-stages.mjs +22 -50
  14. package/agent/run-start.mjs +17 -0
  15. package/agent/setup-reminders.mjs +71 -8
  16. package/agent/setup.mjs +8 -39
  17. package/agent/spawn-child.mjs +6 -2
  18. package/agent/task-lifecycle.mjs +146 -0
  19. package/agent/turn-loop.mjs +73 -11
  20. package/agent-tools/batch-closeout.mjs +21 -34
  21. package/agent-tools/batch-gate.mjs +7 -5
  22. package/agent-tools/batch-ledger-bind.mjs +21 -1
  23. package/agent-tools/batch-lifecycle.mjs +7 -7
  24. package/agent-tools/batch-record-write.mjs +237 -280
  25. package/agent-tools/batch-supersede.mjs +3 -3
  26. package/agent-tools/batch.mjs +42 -9
  27. package/agent-tools/context.mjs +0 -13
  28. package/agent-tools/escalate-async.mjs +7 -1
  29. package/agent-tools/parent-channel.mjs +7 -6
  30. package/agent-tools/plan.mjs +103 -67
  31. package/agent-tools/review-facts.mjs +3 -3
  32. package/agent-tools/settings.mjs +2 -0
  33. package/agent-tools/spawn-gates.mjs +37 -11
  34. package/agent-tools/ssh-session.mjs +68 -25
  35. package/agent-tools/ssh-transfer.mjs +7 -2
  36. package/agent-tools/ssh-transport.mjs +2 -2
  37. package/agent-tools/ssh-vault.mjs +2 -2
  38. package/agent-tools/step.mjs +462 -0
  39. package/agent-tools/subagent-actions.mjs +6 -1
  40. package/agent-tools/subagent-run.mjs +7 -0
  41. package/agent-tools/subagent-spawn.mjs +1 -1
  42. package/agent-tools/subagent.mjs +17 -11
  43. package/agent-tools/task.mjs +178 -26
  44. package/agent-tools.mjs +1 -0
  45. package/agent.mjs +2 -0
  46. package/config-defaults.mjs +17 -1
  47. package/config-migrate.mjs +8 -5
  48. package/config.mjs +7 -0
  49. package/context.mjs +5 -4
  50. package/declaration.mjs +4 -4
  51. package/generate-title.mjs +0 -6
  52. package/i18n.mjs +4 -0
  53. package/ledger-cmd.mjs +11 -1
  54. package/ledger-tools.mjs +15 -4
  55. package/manifest-schema.mjs +1 -0
  56. package/model-context.mjs +34 -11
  57. package/model-specs.mjs +5 -2
  58. package/package.json +1 -1
  59. package/prompt-files.mjs +48 -11
  60. package/prompt-overlays.mjs +79 -8
  61. package/prompts/advisor-design.md +253 -206
  62. package/prompts/advisor-round1.md +151 -145
  63. package/prompts/advisor-round2.md +136 -130
  64. package/prompts/advisor-round3.md +140 -134
  65. package/prompts/common.md +244 -96
  66. package/prompts/consult-base.md +29 -30
  67. package/prompts/discipline-engineering.md +73 -519
  68. package/prompts/discipline-normal.md +28 -136
  69. package/prompts/knowledge/batch-before-write.md +8 -0
  70. package/prompts/knowledge/batch-cycle-register.md +15 -0
  71. package/prompts/knowledge/batch-progress-ledger.md +29 -0
  72. package/prompts/knowledge/business-gates.md +24 -24
  73. package/prompts/knowledge/decision-quality.md +8 -19
  74. package/prompts/knowledge/doc-discipline-d-rules.md +63 -0
  75. package/prompts/knowledge/doc-lookup.md +25 -24
  76. package/prompts/knowledge/document-writing.md +11 -32
  77. package/prompts/knowledge/documentation-evaluation.md +42 -42
  78. package/prompts/knowledge/eng-dispatch-ops.md +34 -0
  79. package/prompts/knowledge/eng-ledger-ops.md +26 -0
  80. package/prompts/knowledge/evidence-discipline.md +10 -32
  81. package/prompts/knowledge/normal-batch-discipline.md +13 -0
  82. package/prompts/knowledge/normal-coding-workflow.md +97 -99
  83. package/prompts/knowledge/normal-delivery-collaboration.md +107 -112
  84. package/prompts/knowledge/normal-work-management.md +44 -44
  85. package/prompts/knowledge/product-security.md +7 -26
  86. package/prompts/knowledge/project-records.md +69 -64
  87. package/prompts/knowledge/tool-advisor.md +17 -17
  88. package/prompts/knowledge/tool-apply-patch.md +14 -14
  89. package/prompts/knowledge/tool-bash.md +32 -31
  90. package/prompts/knowledge/tool-batch-eng-coder.md +19 -13
  91. package/prompts/knowledge/tool-batch-eng-designer.md +21 -14
  92. package/prompts/knowledge/tool-batch-review.md +18 -12
  93. package/prompts/knowledge/tool-batch.md +93 -85
  94. package/prompts/knowledge/tool-browser.md +59 -59
  95. package/prompts/knowledge/tool-code-search.md +2 -2
  96. package/prompts/knowledge/tool-consult-start.md +6 -6
  97. package/prompts/knowledge/tool-consult-stop.md +3 -3
  98. package/prompts/knowledge/tool-context.md +4 -4
  99. package/prompts/knowledge/tool-delete.md +16 -16
  100. package/prompts/knowledge/tool-doc-check.md +39 -39
  101. package/prompts/knowledge/tool-doc-graph-read.md +11 -11
  102. package/prompts/knowledge/tool-doc-graph.md +48 -48
  103. package/prompts/knowledge/tool-doc-search.md +3 -3
  104. package/prompts/knowledge/tool-edit.md +30 -30
  105. package/prompts/knowledge/tool-eng.md +1 -1
  106. package/prompts/knowledge/tool-execute.md +16 -16
  107. package/prompts/knowledge/tool-fetch.md +15 -15
  108. package/prompts/knowledge/tool-file-ops.md +15 -15
  109. package/prompts/knowledge/tool-get-current-time.md +3 -3
  110. package/prompts/knowledge/tool-git-read.md +15 -15
  111. package/prompts/knowledge/tool-git.md +26 -26
  112. package/prompts/knowledge/tool-glob.md +14 -14
  113. package/prompts/knowledge/tool-goal.md +5 -5
  114. package/prompts/knowledge/tool-grep.md +19 -18
  115. package/prompts/knowledge/tool-hashline-edit.md +13 -13
  116. package/prompts/knowledge/tool-insert-after.md +14 -14
  117. package/prompts/knowledge/tool-instance-list.md +3 -3
  118. package/prompts/knowledge/tool-instance-send.md +5 -5
  119. package/prompts/knowledge/tool-knowledge.md +12 -12
  120. package/prompts/knowledge/tool-ledger-read.md +20 -20
  121. package/prompts/knowledge/tool-ledger.md +44 -44
  122. package/prompts/knowledge/tool-lint.md +10 -10
  123. package/prompts/knowledge/tool-ls.md +11 -11
  124. package/prompts/knowledge/tool-lsp.md +8 -8
  125. package/prompts/knowledge/tool-main-history.md +1 -1
  126. package/prompts/knowledge/tool-manifest-read.md +7 -7
  127. package/prompts/knowledge/tool-manifest.md +43 -32
  128. package/prompts/knowledge/tool-memory-read.md +12 -12
  129. package/prompts/knowledge/tool-memory.md +14 -14
  130. package/prompts/knowledge/tool-notify-parent.md +10 -10
  131. package/prompts/knowledge/tool-operations.md +88 -88
  132. package/prompts/knowledge/tool-peek.md +10 -0
  133. package/prompts/knowledge/tool-peer-instances.md +1 -1
  134. package/prompts/knowledge/tool-plan.md +6 -3
  135. package/prompts/knowledge/tool-process-read.md +8 -8
  136. package/prompts/knowledge/tool-process.md +11 -11
  137. package/prompts/knowledge/tool-question.md +11 -13
  138. package/prompts/knowledge/tool-read-history-batch.md +13 -13
  139. package/prompts/knowledge/tool-read-history.md +19 -19
  140. package/prompts/knowledge/tool-read-image.md +8 -8
  141. package/prompts/knowledge/tool-read.md +17 -17
  142. package/prompts/knowledge/tool-recent-changes.md +4 -4
  143. package/prompts/knowledge/tool-repo-outline.md +2 -2
  144. package/prompts/knowledge/tool-settings-read.md +5 -7
  145. package/prompts/knowledge/tool-settings.md +10 -10
  146. package/prompts/knowledge/tool-skill.md +4 -4
  147. package/prompts/knowledge/tool-ssh.md +66 -66
  148. package/prompts/knowledge/tool-step.md +26 -0
  149. package/prompts/knowledge/tool-subagent.md +52 -50
  150. package/prompts/knowledge/tool-task.md +14 -11
  151. package/prompts/knowledge/tool-team-ledger-read.md +7 -7
  152. package/prompts/knowledge/tool-team-ledger.md +13 -13
  153. package/prompts/knowledge/tool-timer.md +14 -14
  154. package/prompts/knowledge/tool-tree.md +11 -11
  155. package/prompts/knowledge/tool-verify.md +11 -11
  156. package/prompts/knowledge/tool-wait-for.md +20 -20
  157. package/prompts/knowledge/tool-websearch.md +16 -14
  158. package/prompts/knowledge/tool-write.md +10 -10
  159. package/prompts/knowledge/upstream-protocol.md +37 -38
  160. package/prompts/persona-coder.md +22 -22
  161. package/prompts/persona-eng-coder.md +87 -81
  162. package/prompts/persona-eng-designer.md +173 -153
  163. package/prompts/persona-engineering.md +53 -554
  164. package/prompts/persona-explore.md +18 -15
  165. package/prompts/persona-normal.md +62 -63
  166. package/prompts/persona-plan.md +36 -32
  167. package/prompts/persona-tester.md +39 -39
  168. package/prompts/planning-next-moves.md +9 -0
  169. package/prompts/subagent-base.md +4 -16
  170. package/provider/errors.mjs +0 -24
  171. package/provider/list-models.mjs +20 -2
  172. package/session-lifecycle.mjs +4 -3
  173. package/tool-args.mjs +25 -0
  174. package/tool-docs/peek.md +3 -0
  175. package/tool-docs/plan.md +1 -1
  176. package/tool-docs/question.md +1 -1
  177. package/tool-docs/step.md +3 -0
  178. package/tools/edit-diff.mjs +4 -4
  179. package/tools/index.mjs +3 -2
  180. package/tools/peek.mjs +447 -0
  181. package/tools/question.mjs +87 -9
  182. package/tools/ssh.mjs +1 -1
  183. package/window-policy.mjs +107 -80
@@ -1,41 +1,41 @@
1
1
  aliases: 编辑, 改档, 修改文件
2
- Two targeting forms, mutually exclusive:
2
+ 两种定位形式,互斥:
3
3
 
4
- ① line-based: `line: N` replaces that line, `startLine: N, endLine: M` the inclusive 1-based range. No old_string needed when you know the number. Give new_string to replace, or omit it (an empty string deletes too) to delete.
5
- ② content-based: old_string is the region's current content (must match exactly once); new_string is the result of that region.
4
+ ① 按行号:`line: N` 替换那一行,`startLine: N, endLine: M` 替换这个 1 起算的闭区间。知道行号时不需要 old_string。给 new_string 就替换,省略它(给空串也是删)就删除。
5
+ ② 按内容:old_string 是这个区域当前的内容(必须精确匹配一次);new_string 是这个区域的结果。
6
6
 
7
- old_string matching is tolerant: exact, then a unique whitespace-only variant, then a fuzzy match on a unique window. Indentation width and quote style are normalized on both sides, so a straight-quoted copy matches a curly-quoted original.
7
+ old_string 的匹配是宽容的:先精确,再唯一一份仅空白不同的变体,然后在一个唯一窗口上做模糊匹配。两侧的缩进宽度与引号风格都会归一,所以直引号的拷贝能匹配弯引号的原文。
8
8
 
9
- Shared lines are kept; new_string-only lines take their position relative to them (LCS order); old_string-only lines are deleted. A replacement never leaves old lines behind.
9
+ 共享的行被保留;只出现在 new_string 里的行按它们相对的位置落位(LCS 顺序);只出现在 old_string 里的行被删除。替换绝不留下旧行。
10
10
 
11
- A unique single-line old_string with a single-line new_string replaces that line in place (line count unchanged). To add a line without removing anything, use insert_after.
11
+ 一个唯一单行的 old_string 配一个单行的 new_string,就地把那一行替换掉(行数不变)。要加一行而不删任何东西,用 insert_after。
12
12
 
13
- replace_all applies to content-based edits only: literal replacement of every occurrence, and the diff rules do not apply.
13
+ replace_all 只适用于按内容的编辑:对每一处做字面替换,diff 规则不适用。
14
14
 
15
- **Routing — pick the right edit tool:**
16
- - Targeted change to one existing file → this tool, not write (safer, keeps the change targeted)
17
- - Delete a line/range by number → omit new_string
18
- - Line numbers fresh → `line` / `startLine` + `endLine`, no content copy needed
19
- - Line numbers may have drifted, or whitespace-encoding noise → `hashline_edit` (content-hash addressing, position-independent)
20
- - Add a line after a known line → insert_after
21
- - Same change across several files → apply_patch
22
- - Rewrite an entire file → write
23
- - Rename a symbol project-wide → `lsp` or `grep` first to map every caller
15
+ **路由 —— 挑对编辑工具:**
16
+ - 对一个已存在文件做定点改动 → 本工具,不是 write(更安全,改动保持定点)
17
+ - 按行号删一行 / 一段 → 省略 new_string
18
+ - 行号新鲜 → `line` / `startLine` + `endLine`,不用拷内容
19
+ - 行号可能漂了,或空白、编码有噪声 → `hashline_edit`(按内容哈希寻址,与位置无关)
20
+ - 在一行已知行之后加一行 → insert_after
21
+ - 同一个改动跨几个文件 → apply_patch
22
+ - 整档重写 → write
23
+ - 全项目改名一个符号 → 先用 `lsp` 或 `grep` 把每个调用方摸清,再一档一档 `edit` 的 `replace_all`,不走命令工具写回
24
24
 
25
- **Batch changes into ONE call via the `edits` array.** Each entry gets its own receipt block in call order; a failing entry is named and the rest still apply.
26
- A file whose final content the write gate rejects writes nothing and all its entries fail; a file already written is never rolled back.
27
- One permission ask and one turn instead of N. Per-entry shape and targeting are in the schema.
25
+ **批量改动合成一次调用,走 `edits` 数组。** 每个条目按调用顺序拿到自己的回执块;失败的条目会被指名,其余仍然生效。
26
+ 一个文件的最终内容被写闸拒绝时,它什么都不写,它的所有条目一起失败;已经写成的文件绝不回滚。
27
+ 一次权限询问、一个轮次,而不是 N 次。逐条目的形状与定位方式在 schema 里。
28
28
 
29
- Write-gate parameters:
30
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`.
31
- - project: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
29
+ 写闸参数:
30
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
31
+ - project:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
32
32
 
33
- Line-number entries in one array must not overlap: an overlapping pair fails on both sides, each naming the other's range, and the rest of the batch still applies. Each anchors on the numbers you last read, and the receipt stays in call order.
33
+ 一个数组里的按行号条目不得重叠:重叠的一对两边都失败,各自指名对方的范围,批量里其余条目仍然生效。每条锚在你最后一次读到的行号上,回执保持调用顺序。
34
34
 
35
- Notes:
36
- - A `line` / `startLine` + `endLine` target is judged against the last write to that file. A drifted target is refused, naming the path and two ways on: re-read, or address the region without line numbers. The write point and the offset (`L<startLine>`, `±shift`) are named only when a write point was recorded and the drift can be measured; a file rewritten in full by a write since the last read, a file changed with no recorded write point to check against, and a file whose drift cannot be measured because a write in this session changed it after the recorded write point are each refused without those numbers, and the refusal says why they are unavailable.
37
- - old_string matching zero times (even fuzzy) is an error; matching twice without replace_all is an error — add surrounding context to make it unique.
38
- - Never fabricate old_string: copy it verbatim from a read.
39
- - Use the most recent read as the source of old_string, line numbers and hashes — re-read after the file changed.
40
- - Returns `Edited <path>: replaced N occurrence(s)` (delete mode: `Deleted line N of <path>` / `Deleted lines N-M of <path>`) plus git diff, syntax-check note and a context block (L..-L..).
41
- - Batch form returns one block per entry — `edits[i] — failed: <reason>`, the reason verbatim and possibly over several lines — then `edit batch: 2/3 entries applied, 1 failed — 2 file(s) written: a.md, b.md`.
35
+ 注意:
36
+ - 一个 `line` / `startLine` + `endLine` 目标,是对该文件最后一次写入来判断的。漂了的目标被拒绝,指名路径并给两条出路:重读,或不用行号而按区域寻址。写入点与偏移(`L<startLine>`、`±shift`)只在记录过写入点、且漂移量可以量出来时才给出名字;用一次 write 整档重写过、自上次读取以来改过却没有记录过写入点、以及因为本次会话在记录的写入点之后又写过它而量不出漂移的文件,都拒绝且不给那些数字,拒绝里会说明它们为什么不可用。
37
+ - old_string 零命中(哪怕模糊)是错误;没有 replace_all 却命中两次也是错误 —— 加上周边上下文让它唯一。
38
+ - 绝不编造 old_string:从一次 read 里逐字拷来。不要从 grep 回执抄:特殊字符会显示成 `??`,按字节对不上。
39
+ - 用最近一次 read 作为 old_string、行号与哈希的来源 —— 文件变了就重读。grep 只告诉你在哪一档哪一行。
40
+ - 返回 `Edited <path>: replaced N occurrence(s)`(删除模式:`Deleted line N of <path>` / `Deleted lines N-M of <path>`),另加 git diff、语法检查提示与一个上下文块(L..-L..)。
41
+ - 批量形式每个条目返回一个块 —— `edits[i] — failed: <reason>`,原因是原文,可能跨几行 —— 最后是 `edit batch: 2/3 entries applied, 1 failed — 2 file(s) written: a.md, b.md`。
@@ -1,2 +1,2 @@
1
1
  aliases: 工程模式, 切换档位
2
- In engineering mode, follow design-before-code: write a design document, run advisor design review, get user approval, then implement via eng-coder subagents. Returns the mode state — 'Engineering mode activated/exited' (an already-active state is acknowledged).
2
+ 工程模式下遵循「先设计后代码」:写一份设计文档、跑 advisor 设计评审、拿到用户批准,然后经 eng-coder 子代理实施。返回模式状态 —— 'Engineering mode activated/exited'(已经处于该状态时只作确认)。
@@ -1,21 +1,21 @@
1
1
  aliases: 执行脚本, 运行代码, node
2
- The child is a pure node ESM environment: top-level `await` and dynamic `import()` are available, and no globals are injected.
2
+ 子进程是一个纯 node ESM 环境:顶层 `await` 与动态 `import()` 可用,也不注入任何全局变量。
3
3
 
4
- File reads/writes/searches belong to the dedicated read/ls/glob/grep/write/edit tools, not to execute. If a script genuinely needs fs/path, `import` the `node:` module inside the code — one explicit import line.
4
+ 文件的读 / 写 / 搜索归专门的 read/ls/glob/grep/write/edit 工具,不归 execute。脚本确实需要 fs/path 时,在代码里 `import` 那个 `node:` 模块 —— 一行显式 import。
5
5
 
6
- **Route to execute instead of bash:**
7
- - `node -e "…"` → execute (inline code; top-level await + import() + console all work)
8
- - `node <script.mjs>` → execute with scriptFile (runs the file in a child node process)
9
- - `node --test <file>` / `node --check <file>` → execute with scriptFile + nodeArgs (timeoutMs up to 600000 — long suites fit)
6
+ **改用 execute,而不是 bash:**
7
+ - `node -e "…"` → execute(内联代码;顶层 await + import() + console 都能用)
8
+ - `node <script.mjs>` → execute 配 scriptFile(在一个子 node 进程里跑该文件)
9
+ - `node --test <file>` / `node --check <file>` → execute 配 scriptFile + nodeArgs(timeoutMs 最高 600000 —— 长套件也放得下)
10
10
 
11
- Write-gate parameters:
12
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`.
13
- - project: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
14
- `project` is asked for only where the engineering write gate applies, and only when the call passes no `workdir`.
11
+ 写闸参数:
12
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
13
+ - project:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
14
+ 只有工程写闸适用的地方、且调用没传 `workdir` 时才要 `project`。
15
15
 
16
- Notes:
17
- - `console.log(...)` prints to the result; objects are JSON-stringified where needed.
18
- - A non-zero exit or thrown exception returns the stderr (error + stack) as the result.
19
- - Output is capped at ~50KB; overrun appends an explicit `[output truncated]` marker — print large results in chunks, or have the script write them to a file (node:fs) and read that file back with the `read` tool.
20
- - Use `write`/`edit`/`apply_patch` for source edits. `bash` still covers package-manager/CLI subprocesses (`npm test`/`npm publish`/`vsce`), servers, and interactive/TTY programs — execute covers in-process JS and `node <script>`/`node --test`/`node --check`, not arbitrary CLI or long-running programs.
21
- - Irreversibility: it runs with full filesystem access and no automatic undo — script side effects are permanent; checkpoint (git) before risky bulk operations.
16
+ 注意:
17
+ - `console.log(...)` 打到结果里;对象在需要处会被 JSON 字符串化。
18
+ - 非零退出或抛出的异常,会把 stderr(错误 + 栈)作为结果返回。
19
+ - 输出上限约 50KB;超出时会追加一个显式的 `[output truncated]` 标记 —— 大结果分段打印,或让脚本写进文件(node:fs),再用 `read` 工具把它读回来。
20
+ - 源码改动用 `write`/`edit`/`apply_patch`。`bash` 仍覆盖包管理器 / CLI 子进程(`npm test`/`npm publish`/`vsce`)、服务器与交互式 / TTY 程序 —— execute 覆盖进程内 JS 与 `node <script>`/`node --test`/`node --check`,不覆盖任意 CLI 或长跑程序。
21
+ - 不可逆性:它以完整的文件系统权限运行,没有自动撤销 —— 脚本的副作用是永久的;有风险的批量操作之前先打检查点(git)。
@@ -1,18 +1,18 @@
1
1
  aliases: 抓取, 网页读取, 取页面
2
- Use it after websearch to read full pages. Internal, private and metadata addresses are refused before any request goes out.
2
+ 用在 websearch 之后,读完整页面。内部、私有与元数据地址在任何请求发出之前就被拒绝。
3
3
 
4
- Parameters:
5
- - url (required): http/https URL; any other scheme is refused.
6
- - proxy: http://host:port explicit proxy (optional) — use ONLY when passed; no proxy = direct. A proxy set in config.json is not applied here, and neither is a proxy environment variable: pick one per target (github/foreign sites usually need one, domestic sites do not).
4
+ 参数:
5
+ - url(必填):http/https URL;其他任何协议都被拒绝。
6
+ - proxy:http://host:port 显式代理(可选)—— **仅**在你传它时使用;不传 = 直连。config.json 里设置的代理不在这里生效,代理环境变量也不生效:按目标各挑一个(github / 境外站点通常需要,境内站点不需要)。
7
7
 
8
- Notes:
9
- - With a DeepSeek provider configured, the page is fetched through DeepSeek's servers and comes back as Markdown (`[deepseek] title + content`); otherwise it is fetched locally and HTML is reduced to readable text (scripts, styles, navigation stripped).
10
- - Follows one redirect, http/https only; a redirect into an internal, private or metadata address is refused.
11
- - `FETCH_TIMEOUT` (15 seconds) is the deadline of each search leg and the connect deadline of every proxied request.
12
- - The Tavily and engine legs abort on it; the DeepSeek leg aborts on its own 15 seconds.
13
- - The local `fetch` leg passes no signal of its own, so it has no request deadline of its own.
14
- - Direct, it waits as long as the server takes.
15
- - Through a proxy the CONNECT/TLS phase is capped at 15 seconds and the response-header phase at 60 (the `_headerTimeoutMs` default — raised from the shared 15 because a DeepSeek queue can exceed 15s TTFB).
16
- - An `http://` target through a proxy keeps 15 seconds for its header phase.
17
- - Non-HTML responses come back as-is, truncated at 200000 chars.
18
- - `fetch.backend: "local"` disables the DeepSeek backend.
8
+ 注意:
9
+ - 配置了 DeepSeek 提供方时,页面经 DeepSeek 的服务器抓取,以 Markdown 回来(`[deepseek] title + content`);否则在本地抓取,HTML 被压成可读文本(脚本、样式、导航被剥掉)。
10
+ - 最多跟随一次重定向,仅 http/https;重定向到内部、私有或元数据地址会被拒绝。
11
+ - `FETCH_TIMEOUT`(15 秒)是每条搜索腿的期限,也是每个走代理请求的连接期限。
12
+ - Tavily 腿与引擎腿在它上面中止;DeepSeek 腿按它自己的 15 秒中止。
13
+ - 本地的 `fetch` 腿不传自己的信号,所以它没有自己的请求期限。
14
+ - 直连时,服务器要多久它等多久。
15
+ - 走代理时,CONNECT/TLS 阶段上限 15 秒,响应头阶段上限 60 秒(`_headerTimeoutMs` 的默认值 —— 从共用的 15 秒抬高,因为 DeepSeek 的排队可能超过 15 秒 TTFB)。
16
+ - 一个 `http://` 目标经代理时,头部阶段仍是 15 秒。
17
+ - 非 HTML 的响应原样返回,截到 200000 字符。
18
+ - `fetch.backend: "local"` 关掉 DeepSeek 后端。
@@ -1,21 +1,21 @@
1
1
  aliases: 移动, 复制, 改名, 文件操作
2
- **Route to file_ops instead of bash:**
2
+ **改用 file_ops,而不是 bash:**
3
3
  - `mv a b` → file_ops action=move
4
4
  - `cp a b` / `copy` → file_ops action=copy
5
5
  - `ren a b` / `rename a b` → file_ops action=rename
6
6
 
7
- Parameters:
8
- - action (required): move | copy | rename
9
- - source (required): source path, relative to cwd or absolute
10
- - dest (required): destination path
11
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`.
12
- - project: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
7
+ 参数:
8
+ - action(必填):move | copy | rename
9
+ - source(必填):源路径,相对于 cwd 或绝对路径
10
+ - dest(必填):目标路径
11
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
12
+ - project:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
13
13
 
14
- Notes:
15
- - Paths resolve relative to cwd — no directory restriction (same boundary as bash; the approval gate is the guard).
16
- - `copy` is recursive for directories and merges into what `dest` already holds: an existing directory keeps its own entries and gains the source's, and an existing file is replaced.
17
- A directory source onto an existing file is refused instead of replaced — `ERR_FS_CP_DIR_TO_NON_DIR` (Node's own `fs.cp` code; measured on win32, not yet measured on POSIX).
18
- - `move` / `rename` land through the rename syscall, and the platform decides what an existing `dest` does. On Windows (measured on win32) an existing file `dest` is replaced, and an existing directory `dest` fails with `EPERM` — empty or not.
19
- On POSIX the call keeps `rename(2)` semantics: a file onto a directory fails with `EISDIR`, a directory onto a non-empty directory fails with `ENOTEMPTY` / `EEXIST`, a directory onto an empty one replaces it, and a directory onto an existing file fails with `ENOTDIR`. A cross-device `move` / `rename` falls back to copy + remove.
20
- - To create a directory, use `write` (creates parent dirs) or `bash mkdir`.
21
- - Returns one line: `Moved` / `Copied` / `Renamed`, then the two paths exactly as you passed them separated by an arrow; or `Error: ...` (same path, missing path, unknown action).
14
+ 注意:
15
+ - 路径按 cwd 解析 —— 没有目录限制(与 bash 同一条边界;审批闸就是那道护栏)。
16
+ - `copy` 对目录是递归的,并合并进 `dest` 已有的内容:已存在的目录保留自己的条目并接纳源的,已存在的文件被替换。
17
+ 目录源落到一个已存在的文件上时被拒绝而不是替换 —— `ERR_FS_CP_DIR_TO_NON_DIR`(Node 自己的 `fs.cp` 错误码;在 win32 上量过,POSIX 上尚未量过)。
18
+ - `move` / `rename` 经 rename 系统调用落地,已存在的 `dest` 怎么办由平台决定。Windows 上(在 win32 量过)已存在的文件 `dest` 被替换,已存在的目录 `dest` 以 `EPERM` 失败 —— 空的不空都一样。
19
+ POSIX 上保持 `rename(2)` 语义:文件落到目录上以 `EISDIR` 失败,目录落到非空目录上以 `ENOTEMPTY` / `EEXIST` 失败,目录落到空目录上替换它,目录落到已存在的文件上以 `ENOTDIR` 失败。跨设备的 `move` / `rename` 回退为复制 + 删除。
20
+ - 要创建目录,用 `write`(会建父目录)或 `bash mkdir`。
21
+ - 返回一行:`Moved` / `Copied` / `Renamed`,然后是你原样传入的两个路径,中间一个箭头;或 `Error: ...`(同一路径、路径缺失、未知动作)。
@@ -1,7 +1,7 @@
1
1
  aliases: 时间, 当前时间, 日期
2
- **Route to get_current_time instead of bash:**
2
+ **改用 get_current_time,而不是 bash:**
3
3
  - `date` / `time` → get_current_time
4
4
 
5
- Use it whenever a task depends on the current time or date (deadlines, freshness, timestamps) rather than shelling out.
5
+ 任务依赖当前时间或日期时(截止期、新鲜度、时间戳)就用它,而不是 shell 出去。
6
6
 
7
- Returns `Date` / `Timezone` / `Weekday` / `Local` lines (UTC + local timezone).
7
+ 返回 `Date` / `Timezone` / `Weekday` / `Local` 各行(UTC 加本地时区)。
@@ -1,21 +1,21 @@
1
1
  aliases: git, 只读, 版本库, 查看提交
2
- Nothing here writes the repository: no commit, no staging, no branch or tag changes, no push, no checkout, no snapshot restore. One exception sits in `checkpoint`, described below.
2
+ 这里什么都不写仓库:不提交、不暂存、不改分支或标签、不推送、不检出、不恢复快照。唯一的例外在 `checkpoint` 里,下面会说明。
3
3
 
4
- The actions this tool face carries: diff / status / log / show / ls-remote / blame / checkpoint list·cat / tag list / branch list / stash list / remote list / worktree list.
4
+ 这一工具面承载的动作:diff / status / log / show / ls-remote / blame / checkpoint 的 list·cat / tag 的 list / branch 的 list / stash 的 list / remote 的 list / worktree 的 list。
5
5
 
6
- - diff: unified diff since last commit (`staged` — staged only; `ref` — compare a commit/branch; `path` — scope).
7
- - status: working tree state — staged / unstaged / untracked / conflicts.
8
- - log: recent commits (`count`, `oneline`, `path` — one file's history).
9
- - show: one commit with --stat (`ref`, default HEAD).
10
- - ls-remote: light remote-ref check — network (`remote`, optional `ref`).
11
- - blame: file blame (`path` required).
12
- - checkpoint: snapshots — `checkpointAction` `list` (shows file tree) or `cat` (a file from the snapshot id); `checkpointId` for `cat`.
13
- `list` first clears this project's snapshot directory when HEAD is newer than the newest snapshot,
14
- so a `list` can remove files while adding none; `cat` does not take that path.
15
- - tag / branch / stash / remote / worktree: `tagAction` / `branchAction` / `stashAction` / `remoteAction` / `worktreeAction` `list` only.
6
+ - diff:自上次提交以来的 unified diff(`staged` —— 仅暂存区;`ref` —— 与某个提交 / 分支比较;`path` —— 限定范围)。
7
+ - status:工作树状态 —— 已暂存 / 未暂存 / 未追踪 / 冲突。
8
+ - log:最近的提交(`count`、`oneline`、`path` —— 一个文件的历史)。
9
+ - show:一个提交加 --stat(`ref`,默认 HEAD)。
10
+ - ls-remote:轻量远端引用检查 —— 走网络(`remote`,可选 `ref`)。
11
+ - blame:文件 blame(`path` 必填)。
12
+ - checkpoint:快照 —— `checkpointAction` 取 `list`(显示文件树)或 `cat`(从快照 id 取一个文件);`cat` 要 `checkpointId`。
13
+ HEAD 比最新快照更新时,`list` 会先清掉本项目的快照目录,
14
+ 所以一次 `list` 可能只删不加;`cat` 不走那条路径。
15
+ - tag / branch / stash / remote / worktree:`tagAction` / `branchAction` / `stashAction` / `remoteAction` / `worktreeAction` 只支持 `list`。
16
16
 
17
- `filter` narrows any of these outputs (case-insensitive regex); `workdir` runs git in a subdirectory (default: the discovered project repo root); `config` carries `git -c` overrides for `ls-remote`.
17
+ `filter` 收窄以上任何输出(不区分大小写的正则);`workdir` 在子目录里跑 git(默认:发现的项目仓库根);`config` 为 `ls-remote` 携带 `git -c` 覆盖项。
18
18
 
19
- Two things this variant does not do, by design: it never runs a write action, and calling one directly is refused before anything executes — nothing is staged, committed, restored or pushed. If the work needs a write, report it and let the role that owns writes do it.
19
+ 这个变体有意不做两件事:它绝不运行写动作,直接调用一个写动作会在任何执行之前被拒绝 —— 什么都不暂存、不提交、不恢复、不推送。活需要写时,报出去,让拥有写权的角色来做。
20
20
 
21
- Failures come back as errors — `git <action> failed: <reason>`.
21
+ 失败以错误回来 —— `git <action> failed: <reason>`。
@@ -1,29 +1,29 @@
1
1
  aliases: git, 版本库, 提交, 分支
2
- **Route to git instead of bash** — every sub-command maps to the same-named action:
2
+ **改用 git,而不是 bash** —— 每个子命令映射到同名的动作:
3
3
 
4
- status / log / diff / show / add / rm / commit / push / tag / branch / checkout / restore / stash / fetch / pull / reset / revert / merge / cherry-pick / ls-remote / clone / init / rebase / remote / clean / switch / apply / worktree / archive / blame / mv.
4
+ status / log / diff / show / add / rm / commit / push / tag / branch / checkout / restore / stash / fetch / pull / reset / revert / merge / cherry-pick / ls-remote / clone / init / rebase / remote / clean / switch / apply / worktree / archive / blame / mv。
5
5
 
6
- - diff: unified diff since last commit (`staged` — staged only; `ref` — compare a commit/branch; `path` — scope).
7
- - status: working tree state — staged / unstaged / untracked / conflicts.
8
- - log: recent commits (`count`, `oneline`, `path` — one file's history).
9
- - show: one commit with --stat (`ref`, default HEAD).
10
- - add: stage files — `path` (granular) or all changes.
11
- - rm: untrack a file/dir (`git rm --cached` — kept on disk; `path` required).
12
- - commit: `message` required. With `path` → `git commit --only <paths>`: commits those files' working-tree content only, atomic — other staged batches are NOT mixed in; without → add -A + full commit. New (untracked) files: `git add` them first — the tool refuses a path list with any untracked entry and names them (staging extra is safe — `--only` commits only the listed files).
13
- - push / fetch / pull: sync with remote — `remote`, `ref`, `tags` for --tags. `push` takes several refs in one space-separated `ref` (so does `ls-remote`); `fetch` and `pull` take exactly one, and a space there is `Invalid ref`.
14
- - tag / branch: manage via `tagAction` / `branchAction` — list / create (name, optional ref) / delete (snapshots first); branch also switch (name).
15
- - checkout: switch to `ref`; with `path`, restore a file from the index (discards its working-tree changes — snapshots first).
16
- - restore: restore a file from index/HEAD (`path` required; `staged` restores the staged copy — snapshots first).
17
- - stash: `stashAction` push (message) / pop / list (pop snapshots first).
18
- - reset: `ref` (default HEAD), `mode` soft / mixed / hard — hard drops working-tree changes (snapshots first).
19
- - revert: revert a commit (safe, `ref` default HEAD); merge: `ref` — conflicts come back for you to resolve; cherry-pick: `ref`.
20
- - rebase: `rebaseAction` start / abort / continue (snapshots first).
21
- - ls-remote: light remote-ref check — read-only, network (`remote`, optional `ref`).
22
- - clone: `remote` required (URL or local path), optional `path` (target dir); init: create a repo in the current workdir.
23
- - remote: manage remotes — `remoteAction` list / add / remove / set-url (`remoteUrl` for add / set-url).
24
- - clean: remove untracked files/dirs — `dryRun` previews (-n; the real clean snapshots first).
25
- - switch: switch branch (`name` required; `create` = -c); apply: apply a patch (`path` required); archive: tar of a `ref` (`path` required, output file); blame: file blame (`path` required); mv: rename/move (`path` + `dest` required); worktree: `worktreeAction` list / add / remove.
26
- - checkpoint: local snapshots — `checkpointAction` list / create / rewind / cat / versions (`checkpointId` for rewind / cat).
27
- - Destructive ops (checkout -- path / restore / reset --hard / stash pop / branch|tag delete / clean / rebase) auto-snapshot first; restore a snapshot via `checkpointAction=rewind`.
28
- - Failures come back as errors — `git <action> failed: <reason>`.
29
- - `filter` narrows any read-only action's output (case-insensitive regex); `config` (git -c overrides, e.g. a proxy) applies to the network actions (push / fetch / pull / ls-remote / clone). Other parameter defaults and applicability live in the schema.
6
+ - diff:自上次提交以来的 unified diff(`staged` —— 仅暂存区;`ref` —— 与某个提交 / 分支比较;`path` —— 限定范围)。
7
+ - status:工作树状态 —— 已暂存 / 未暂存 / 未追踪 / 冲突。
8
+ - log:最近的提交(`count`、`oneline`、`path` —— 一个文件的历史)。
9
+ - show:一个提交加 --stat(`ref`,默认 HEAD)。
10
+ - add:暂存文件 —— `path`(粒到文件)或全部改动。
11
+ - rm:取消追踪一个文件 / 目录(`git rm --cached` —— 留在盘上;`path` 必填)。
12
+ - commit:`message` 必填。带 `path` → `git commit --only <paths>`:只提交这些文件工作树里的内容,原子 —— 别的已暂存批次**不**会被混进来;不带 → add -A 加全量提交。新(未追踪)文件:先 `git add` 它们 —— 路径列表里只要有未追踪条目,工具就拒绝并逐条指名(多暂存是安全的 —— `--only` 只提交列出的文件)。
13
+ - push / fetch / pull:与远端同步 —— `remote`、`ref`,`tags` 对应 --tags。`push` 在一个空格分隔的 `ref` 里接受多个引用(`ls-remote` 也一样);`fetch` 与 `pull` 恰好一个,那里出现空格就是 `Invalid ref`。
14
+ - tag / branch:经 `tagAction` / `branchAction` 管理 —— list / create(name,可选 ref)/ delete(先打快照);branch 另有 switch(name)。
15
+ - checkout:切到 `ref`;带 `path` 时,从索引恢复一个文件(丢弃它的工作树改动 —— 先打快照)。
16
+ - restore:从索引 / HEAD 恢复一个文件(`path` 必填;`staged` 恢复暂存区那份 —— 先打快照)。
17
+ - stash:`stashAction` 取 push(message)/ pop / list(pop 先打快照)。
18
+ - reset:`ref`(默认 HEAD),`mode` 取 soft / mixed / hard —— hard 丢弃工作树改动(先打快照)。
19
+ - revert:回退一个提交(安全,`ref` 默认 HEAD);merge:`ref` —— 冲突回来给你解;cherry-pick:`ref`。
20
+ - rebase:`rebaseAction` 取 start / abort / continue(先打快照)。
21
+ - ls-remote:轻量远端引用检查 —— 只读,走网络(`remote`,可选 `ref`)。
22
+ - clone:`remote` 必填(URL 或本地路径),可选 `path`(目标目录);init:在当前工作目录建一个仓库。
23
+ - remote:管理远端 —— `remoteAction` 取 list / add / remove / set-url(add / set-url 要 `remoteUrl`)。
24
+ - clean:删未追踪的文件 / 目录 —— `dryRun` 预览(-n;真删先打快照)。
25
+ - switch:切换分支(`name` 必填;`create` = -c);apply:应用一个补丁(`path` 必填);archive:把一个 `ref` 打成 tar(`path` 必填,输出文件);blame:文件 blame(`path` 必填);mv:改名 / 移动(`path` + `dest` 必填);worktree:`worktreeAction` 取 list / add / remove。
26
+ - checkpoint:本地快照 —— `checkpointAction` 取 list / create / rewind / cat / versions(rewind / cat 要 `checkpointId`)。
27
+ - 破坏性操作(checkout -- path / restore / reset --hard / stash pop / branch|tag delete / clean / rebase)先自动打快照;恢复快照用 `checkpointAction=rewind`。
28
+ - 失败以错误回来 —— `git <action> failed: <reason>`。
29
+ - `filter` 收窄任何只读动作的输出(不区分大小写的正则);`config`(git -c 覆盖项,例如代理)作用于走网络的动作(push / fetch / pull / ls-remote / clone)。其余参数的默认值与适用范围在 schema 里。
@@ -1,17 +1,17 @@
1
1
  aliases: 文件匹配, 找文件, 通配
2
- Returns matching paths (relative to the search path), sorted, capped at 1000. Use it to discover file structure; use `grep` to search file contents.
2
+ 返回匹配的路径(相对于搜索路径),已排序,上限 1000 条。用它发现文件结构;搜文件内容用 `grep`。
3
3
 
4
- Parameters:
5
- - `pattern` (required): glob pattern, relative to `path`. Supported:
6
- - `**` (recursive), `**/`, `*` (within a segment), `?` (single char), `[..]` character classes, and `{a,b}` brace expansion - e.g. `**/*.{js,txt}` matches .js and .txt files at any depth.
7
- - Exclusions: a space-separated `!` token - `**/*.js !test/**` matches .js files except those under test/.
8
- - Several extension alternatives go in one `{a,b}` group (e.g. `**/*.{js,md}`); adjacent space-separated includes are not a supported form. A pattern containing a literal space is fine on its own - spaces separate patterns only when a `!` exclusion is present.
9
- - `path`: directory to search in (default cwd).
10
- - `includeProcessDocs`: include docs from process layers (batch records, archived material) - excluded by default; pass `true` to get them back.
4
+ 参数:
5
+ - `pattern`(必填):glob 模式,相对于 `path`。支持:
6
+ - `**`(递归)、`**/`、`*`(段内)、`?`(单个字符)、`[..]` 字符类,以及 `{a,b}` 花括号展开 —— 例如 `**/*.{js,txt}` 匹配任意深度的 .js 与 .txt 文件。
7
+ - 排除:一个空格分隔的 `!` token —— `**/*.js !test/**` 匹配 .js 文件,但排除 test/ 之下的。
8
+ - 多个扩展名备选放进一个 `{a,b}` 组(例如 `**/*.{js,md}`);相邻的空格分隔包含式不是受支持的形式。一个含字面空格的花括号模式本身没问题 —— 只有在出现 `!` 排除时,空格才用来分隔模式。
9
+ - `path`:在哪搜索的目录(默认 cwd)。
10
+ - `includeProcessDocs`:包含过程层的文档(批次档、归档材料)—— 默认排除;传 `true` 把它们取回来。
11
11
 
12
- Notes:
13
- - Invalid glob syntax is an EXPLICIT error, never a silent no-match: unsupported extglob dialects (`?(x)` / `@(a|b)` / `+(x)`) and malformed braces (empty `{}`, unclosed `{`, nested `{a,{b,c}}`) return `glob error: ...` - use `{a,b}`, or a space-separated `!exclude`, instead.
14
- - Skips noise directories before matching — `node_modules`, `.git`, `dist`, `build`, `.turbo`, `coverage` are examples, not the list. The whole set is `SKIP_DIRS` in `thincoder-core/skip-dirs.mjs`, one list behind the index, the tree walk and both search tools.
15
- - Results are capped at 1000 matches.
16
- - Every row carries the layer label of its document, e.g. `[design] docs/core/design/TOOLS.md`; when rows from process layers are excluded (or included on request), a final line reports how many. Excluded rows spend none of the 1000-match cap.
17
- - Prefer a pattern with a literal anchor (an extension or a subdirectory) over a bare wildcard.
12
+ 注意:
13
+ - 非法的 glob 语法是**显式**错误,绝不是静默的零匹配:不支持的 extglob 方言(`?(x)` / `@(a|b)` / `+(x)`)与畸形的花括号(空的 `{}`、未闭合的 `{`、嵌套的 `{a,{b,c}}`)返回 `glob error: ...` —— 改用 `{a,b}`,或空格分隔的 `!exclude`。
14
+ - 匹配之前跳过噪声目录 —— `node_modules`、`.git`、`dist`、`build`、`.turbo`、`coverage` 是例子,不是全部清单。整套清单是 `thincoder-core/skip-dirs.mjs` 里的 `SKIP_DIRS`,索引、树遍历与两个搜索工具共用这一张表。
15
+ - 结果上限 1000 条匹配。
16
+ - 每一行携带它所属文档的层标签,例如 `[design] docs/core/design/TOOLS.md`;过程层的行被排除时(或按请求被包含时),最后一行报告有多少条。被排除的行不占用 1000 条上限。
17
+ - 优先用带字面锚点的模式(一个扩展名或一个子目录),而不是裸通配符。
@@ -1,8 +1,8 @@
1
1
  aliases: 目标, 任务目标
2
- action='set': create or replace the goal — must have a verifiable completion criterion (a machine-checkable proof, not vague effort).
2
+ action='set':创建或替换目标 —— 必须带一条可验证的完成判据(一个机器可查的证明,不是含糊的努力)。
3
3
 
4
- action='complete': mark achieved — only after the criterion's check has actually passed.
5
- action='blocked': report an impasse (requires 'reason') — only after 3 genuine attempts.
6
- action='cancel': abandon the goal.
4
+ action='complete':标记为达成 —— 只在判据的检查真的通过之后。
5
+ action='blocked':报告僵局(需要 'reason')—— 只在三次实打实的尝试之后。
6
+ action='cancel':放弃目标。
7
7
 
8
- Returns a status line — the goal set/updated/completed/blocked/cancelled confirmation, or Error: ... with the reason.
8
+ 返回一行状态 —— 目标已设置 / 已更新 / 已完成 / 已阻塞 / 已取消的确认,或带原因的 Error: ...。
@@ -1,21 +1,22 @@
1
1
  aliases: 搜索内容, 正则, 查找文本
2
- **Route to grep instead of bash:** `findstr /c:"pat" file` / `grep -rn pat .` → grep. Searching file contents is a read - never shell out for it.
2
+ **改用 grep,而不是 bash:** `findstr /c:"pat" file` / `grep -rn pat .` → grep。搜文件内容是一次读 —— 绝不为它 shell 出去。
3
3
 
4
- Parameters:
5
- - `pattern` (required): a JavaScript regular expression, or a literal string when `literal: true`.
6
- - `path`: directory or file to search (default cwd).
7
- - `glob`: only search files matching this glob - supports `**`, `*`, `?`, `[..]`, `{a,b}` braces and space-separated exclusion (`"**/*.js !test/**"` = .js files outside test/); e.g. `'*.mjs'`.
8
- - `ignoreCase`: case-insensitive match (default false).
9
- - `literal`: literal string match, no regex interpretation (default false; use it for strings carrying `.` or `\`).
10
- - `before`: lines of context to show before each match (like `grep -B`). Default 0.
11
- - `after`: lines of context to show after each match (like `grep -A`). Default 0.
12
- - `includeProcessDocs`: include docs from process layers (batch records, archived material) - excluded by default; pass `true` to get them back.
4
+ 参数:
5
+ - `pattern`(必填):一个 JavaScript 正则;`literal: true` 时按字面字符串。
6
+ - `path`:要搜索的目录或文件(默认 cwd)。
7
+ - `glob`:只搜索匹配这个 glob 的文件 —— 支持 `**`、`*`、`?`、`[..]`、`{a,b}` 花括号与空格分隔的排除(`"**/*.js !test/**"` = test/ 之外的 .js 文件);例如 `'*.mjs'`。
8
+ - `ignoreCase`:不区分大小写(默认 false)。
9
+ - `literal`:按字面字符串匹配,不做正则解释(默认 false;字符串里带 `.` 或 `\` 时用它)。
10
+ - `before`:每条命中之前显示几行上下文(类似 `grep -B`)。默认 0。
11
+ - `after`:每条命中之后显示几行上下文(类似 `grep -A`)。默认 0。
12
+ - `includeProcessDocs`:包含过程层的文档(批次档、归档材料)—— 默认排除;传 `true` 把它们取回来。
13
13
 
14
- Notes:
15
- - Skips noise directories before matching — `node_modules`, `.git`, `dist`, `build`, `.turbo`, `coverage` are examples, not the list. The whole set is `SKIP_DIRS` in `thincoder-core/skip-dirs.mjs`, one list behind the index, the tree walk and both search tools.
16
- - Results are capped at 200 matches.
17
- - Every document row carries its layer label at line start, e.g. `[design] path:line: text`; a row from a process layer keeps the `[process doc: not a design basis]` prefix and then its layer.
18
- - When the output would contain rows from process layers, a final line reports how many were excluded, or how many were included on request. Excluded rows spend none of the 200-match cap.
19
- - Unreadable files are skipped silently, and so is anything over 10 MB. A binary file is not detected as one: it is read as UTF-8 and searched, so a match inside it can come back garbled.
20
- - Use this to find usages, definitions and patterns; use `glob` to find files by name.
21
- - With `before` / `after`: a matching line uses the `:` separator and a context line uses `-` (as in ripgrep), and overlapping context ranges in one file are merged and de-duplicated - you see each context line once.
14
+ 注意:
15
+ - 匹配之前跳过噪声目录 —— `node_modules`、`.git`、`dist`、`build`、`.turbo`、`coverage` 是例子,不是全部清单。整套清单是 `thincoder-core/skip-dirs.mjs` 里的 `SKIP_DIRS`,索引、树遍历与两个搜索工具共用这一张表。
16
+ - 结果上限 200 条匹配。
17
+ - 每条文档行在行首携带它的层标签,例如 `[design] path:line: text`;来自过程层的行保留 `[process doc: not a design basis]` 前缀,然后是它的层。
18
+ - 输出里将要出现过程层的行时,最后一行报告被排除了多少条,或按请求包含了多少条。被排除的行不占用 200 条上限。
19
+ - 读不了的文件被静默跳过,超过 10 MB 的也一样。二进制文件不会被识别成二进制:它按 UTF-8 读入并搜索,所以它内部的命中可能以乱码回来。
20
+ - 用它找用法、定义与模式;按文件名找文件用 `glob`。
21
+ - grep 只定位路径和行号。要改的原文从 `read` 抄。显示文本会把特殊字符变成 `??`,拿去当 `old_string` 必然对不上。
22
+ - 配 `before` / `after` 时:命中行用 `:` 分隔符,上下文行用 `-`(与 ripgrep 一致),同一文件里重叠的上下文区间会被合并去重 —— 每条上下文行你只看到一次。
@@ -1,16 +1,16 @@
1
1
  aliases: 按行哈希, 精确改行
2
- More reliable than `edit` when whitespace or encoding varies, because the addresses are SHA256 hashes of the line text after UTF-8 decoding and CRLF-to-LF normalization — the same rule `read` uses with `hashes=true` — not of the raw bytes on disk.
2
+ 当空白或编码有出入时,它比 `edit` 更可靠,因为地址是行文本按 UTF-8 解码、CRLF 归一成 LF 之后的 SHA256 哈希 —— 与 `read` 在 `hashes=true` 时用的同一条规则 —— 而不是盘上的原始字节。
3
3
 
4
- Parameters:
5
- - `path` (required): file path.
6
- - `old_hashes` (required): array of the line hashes to replace (12-char hex). Read the file with `hashes=true` first to get them; a single line takes `[hash]`, a contiguous block takes `[hash1, hash2, ...]` in order.
7
- - `new_content` (required): the replacement text (multi-line ok, `\n` separated).
8
- - `ledger`: the in-flight ledger row this call serves — `"#N"` or `"N"`.
9
- - `project`: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
4
+ 参数:
5
+ - `path`(必填):文件路径。
6
+ - `old_hashes`(必填):要替换的那些行的哈希数组(12 位十六进制)。先用 `hashes=true` 读文件拿到它们;单行传 `[hash]`,连续一块按顺序传 `[hash1, hash2, ...]`。
7
+ - `new_content`(必填):替换文本(可以多行,用 `\n` 分隔)。
8
+ - `ledger`:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
9
+ - `project`:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
10
10
 
11
- Notes:
12
- - Hashes are position-independent: they identify lines by content, not by line number, so a line-number drift after an edit does not touch them.
13
- - When the hash sequence is not found, the error carries the current hashes of the file's first 50 lines (all of them when the file is shorter), each with its line number and the first 80 characters of that line.
14
- - Prefer this over `edit` when (1) the file may have mixed whitespace or encoding, or (2) you want to edit a block of lines in one call.
15
- - The replacement replaces exactly the lines the hashes identify - whatever is not in `new_content` is deleted. For a new line after a known line use `insert_after`; for a single simple string swap use `edit`.
16
- - Re-read the file after it changed: hashes taken before a write are stale.
11
+ 注意:
12
+ - 哈希与位置无关:它们按内容识别行,不按行号,所以一次编辑之后行号漂了也碰不到它们。
13
+ - 哈希序列找不到时,错误里带着该文件前 50 行的当前哈希(文件更短时就是全部),每行带行号与该行的前 80 个字符。
14
+ - 以下情形优先用它而不是 `edit`:(1)文件可能混着不同空白或编码,或(2)你想一次编辑一整块行。
15
+ - 替换恰好换掉哈希指认的那些行 —— 不在 `new_content` 里的一律删除。要在一行已知行之后加新行,用 `insert_after`;只做一处简单的字符串替换,用 `edit`。
16
+ - 文件变了就重读:写入之前取的哈希已经过期。
@@ -1,17 +1,17 @@
1
1
  aliases: 插入行, 加一行
2
- Safer than `edit` for adding new content - no surrounding context to copy, so no exact-string matching to get wrong.
2
+ 加新内容时,它比 `edit` 更安全 —— 没有周边上下文要拷,也就没有可能搞错的精确字符串匹配。
3
3
 
4
- Parameters:
5
- - `path` (required): file path.
6
- - `content` (required): the text to insert; it becomes its own line, placed after the target line.
7
- - `after_line`: line number to insert after (1-based). Preferred when you know the exact line number from `read`.
8
- - `after_regex`: a JavaScript regex finding the line to insert after. It must match exactly one line; when it matches several the tool errors and shows the matching line numbers.
9
- - `ledger`: the in-flight ledger row this call serves — `"#N"` or `"N"`.
10
- - `project`: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
4
+ 参数:
5
+ - `path`(必填):文件路径。
6
+ - `content`(必填):要插入的文本;它成为自己的一行,放在目标行之后。
7
+ - `after_line`:在第几行之后插入(1 起算)。你知道 `read` 给出的确切行号时优先用它。
8
+ - `after_regex`:一个 JavaScript 正则,用来找到要插在其后的那一行。它必须恰好匹配一行;匹配到多行时工具报错并列出匹配的行号。
9
+ - `ledger`:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
10
+ - `project`:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
11
11
 
12
- Notes:
13
- - Either `after_line` or `after_regex` is required; if both are given, `after_line` wins.
14
- - Use this instead of `edit` when you are adding a line - a checklist item, a doc heading, a line of prose, a function, an import, or a block - rather than fabricating surrounding context to anchor an exact-string match.
15
- - Returns a diff of the change.
16
- - **Read-before-insert guard**: `after_line` is judged against the last write to that file: a line above that write's write point is allowed, and a line at the write point itself is allowed only when that write was itself an insertion. Inside or below it the call is refused, naming the path and two ways on: re-read, or address the region without line numbers. The write point and the offset (`L<startLine>`, `±shift`) are named only when a write point was recorded and the drift can be measured; a file rewritten in full by a write since the last read, a file changed with no recorded write point to check against, and a file whose drift cannot be measured because a write in this session changed it after the recorded write point are each refused without those numbers, and the refusal says why they are unavailable.
17
- - Take line numbers from the most recent `read` of that file; re-read after the file changed.
12
+ 注意:
13
+ - `after_line` 与 `after_regex` 必须给一个;两个都给时 `after_line` 胜出。
14
+ - 你在加一行时用它而不是 `edit` —— 一条清单项、一个文档标题、一行叙述、一个函数、一条 import,或一个块 —— 而不是为了锚定一次精确字符串匹配去编造周边上下文。
15
+ - 返回这次改动的 diff。
16
+ - **先读后插守卫**:`after_line` 是对该文件的最后一次写入来判断的:那次写入的写入点之上的行允许,写入点那一行本身只在“那次写入本身就是一次插入”时才允许。在写入点之内或之下,调用被拒绝,指名路径并给两条出路:重读,或不用行号而按区域寻址。写入点与偏移(`L<startLine>`、`±shift`)只在记录过写入点、且漂移量可以量出来时才给出名字;用一次 write 整档重写过、自上次读取以来改过却没有记录过写入点、以及因为本次会话在记录的写入点之后又写过它而量不出漂移的文件,都拒绝且不给那些数字,拒绝里会说明它们为什么不可用。
17
+ - 行号取该文件最近一次 `read` 的;文件变了就重读。
@@ -1,6 +1,6 @@
1
1
  aliases: 实例列表, 多实例, 跨实例
2
- Any cwd — a target in another repository is addressable.
2
+ 任何 cwd 都行 —— 另一个仓库里的目标也可寻址。
3
3
 
4
- Returns [{ sessionId, end, cwd, pid }]; never includes self; pure read — writes nothing.
4
+ 返回 [{ sessionId, end, cwd, pid }];从不包含自己;纯读 —— 不写任何东西。
5
5
 
6
- Only sessions that have a pickup face register here, so a headless session (one-shot chat / ACP / direct runAgent) never appears.
6
+ 只有带取件面的会话才在这里登记,所以无头会话(一次性聊天 / ACP / 直接 runAgent)永远不会出现。
@@ -1,10 +1,10 @@
1
1
  aliases: 跨实例消息, 发消息, 实例
2
- Parameters: sessionId (required, no default — an id from instance_list) · text (required, no default — the message body) · re (optional — the requestId this message answers, a non-empty string of at most 128 chars; omit it for a first message).
2
+ 参数:sessionId(必填,无默认 —— 来自 instance_list 的 id)· text(必填,无默认 —— 消息正文)· re(可选 —— 本条消息回复的 requestId,非空、至多 128 字符;首次发消息时省略)。
3
3
 
4
- Returns { requestId, target: { sessionId, end }, status: "delivered-to-inbox" }. requestId is the inbox message id — pass it as re when you answer back.
4
+ 返回 { requestId, target: { sessionId, end }, status: "delivered-to-inbox" }。requestId 是收件箱的消息 id —— 你回话时把它当 re 传。
5
5
 
6
- The target takes the message only when it has no turn in flight: during its turn the message waits in the inbox (never injected mid-turn) and starts a new normal user turn afterwards.
6
+ 目标只在自己没有轮次在飞时才收下消息:它的轮次进行中,消息就在收件箱里等(绝不中途注入),之后开启一个新的普通用户轮次。
7
7
 
8
- An unreachable target (no such session / exited / unverifiable / inbox not writable) fails the call with the target and the reason named — nothing is queued for later and nothing is dropped silently.
8
+ 目标不可达(没有该会话 / 已退出 / 无法验证 / 收件箱不可写)时调用失败,并指名目标与原因 —— 没有东西排队等以后,也没有东西被静默丢弃。
9
9
 
10
- Delivering does not make the target your subordinate: it may ignore the message or answer "I won't".
10
+ 投递成功不代表目标就成了你的下属:它可以不理这条消息,或回答「我不干」。
@@ -1,18 +1,18 @@
1
1
  aliases: 知识, 主题, 检索知识, 查主题
2
- Pure-reference topics are never inlined into system prompts.
2
+ 纯参考类主题永远不会被内联进系统提示。
3
3
 
4
- Actions: `list` shows globally unique topic ids and titles; `search` returns bounded locating snippets; `get` returns the complete topic by exact id.
4
+ 动作:`list` 显示全局唯一的话题 id 与标题;`search` 返回有界的定位片段;`get` 按精确 id 返回完整主题。
5
5
 
6
- Search splits the query on whitespace, lowercases each word, trims the punctuation at both ends of each word and then drops high-frequency function words (`the`, `of`, `a`, `的`, `了` …).
7
- A word's inner characters stay as written, so `doc?` searches `doc` while `doc-check` is searched whole.
8
- A query left with no word fails explicitly and names `query` — type a concrete noun instead of retrying the same shape.
9
- Every remaining word matching the id, the title, an alias or the body puts that topic in the result (OR — not all words must match).
10
- Ranking: title-level hits first (a distinct word hitting the id, the title or an alias), then total hits, then id ascending.
6
+ 搜索按空白切分查询,把每个词转成小写,去掉每个词两端的标点,然后丢掉高频虚词(`the`、`of`、`a`、`的`、`了` ……)。
7
+ 一个词内部的字符保持原样,所以 `doc?` 搜的是 `doc`,而 `doc-check` 按整词搜。
8
+ 切完一个词都不剩的查询显式失败并指名 `query` —— 换一个具体的名词,别用同一个形状重试。
9
+ 剩下每个词只要命中 id、标题、别名或正文,该主题就进结果(是 OR —— 不是所有词都要命中)。
10
+ 排序:标题级命中在前(某个不同的词命中 id、标题或别名),然后是命中总数,再按 id 升序。
11
11
 
12
- A topic's first line may carry `aliases: word, word` — near-synonyms, Chinese included. Aliases are metadata, never part of the body a `get` returns; they exist so a Chinese query can find an English-id topic.
12
+ 一个主题的第一行可以带 `aliases: word, word` —— 近义词,含中文。别名是元数据,永远不是 `get` 返回的正文的一部分;它们存在是为了让中文查询能找到英文 id 的主题。
13
13
 
14
- Results are capped at 10 topics and 6,000 characters, so a wide query cannot swallow the window.
15
- The envelope reports `matched` (topics that matched), `shown` (topics returned) and `truncated` — never read a short list as "these are all the matches".
16
- No match returns an explicit empty result that names the next step: retry with one English keyword, or run `list` for every topic id first.
14
+ 结果上限 10 个主题、6,000 字符,所以一个宽的查询吞不掉窗口。
15
+ 信封报告 `matched`(命中的主题数)、`shown`(返回的主题数)与 `truncated` —— 绝不把一份短清单读成「这就是全部命中」。
16
+ 无命中时返回显式的空结果,并指名下一步:换一个英文关键词重试,或先跑 `list` 拿到全部主题 id。
17
17
 
18
- Search only to locate: read `get` before acting on a rule. Unknown actions, missing arguments, unknown topics and duplicate ids fail explicitly; no match is an explicit empty result.
18
+ 搜索只用来定位:照着某条规则行动之前先读 `get`。未知动作、缺参数、未知主题与重复 id 都显式失败;无命中是显式的空结果。