@thincoder/core 0.10.13 → 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.
- package/CHANGELOG.md +74 -1
- package/advisor/convergence.mjs +34 -3
- package/advisor/loop.mjs +42 -10
- package/advisor/messages.mjs +46 -27
- package/advisor/notice.mjs +1 -1
- package/advisor/project-context.mjs +253 -14
- package/advisor/run.mjs +7 -4
- package/advisor.mjs +29 -43
- package/agent/batch-attribution.mjs +87 -0
- package/agent/batch-changed-surface.mjs +129 -0
- package/agent/completion.mjs +57 -4
- package/agent/digest-account.mjs +73 -46
- package/agent/dispatch-gates.mjs +6 -0
- package/agent/dispatch-run.mjs +1 -1
- package/agent/dispatch.mjs +35 -22
- package/agent/family-tools.mjs +36 -17
- package/agent/helpers.mjs +123 -95
- package/agent/offload.mjs +84 -0
- package/agent/post-turn.mjs +24 -10
- package/agent/record-results.mjs +19 -7
- package/agent/run-stages.mjs +127 -61
- package/agent/run-start.mjs +45 -8
- package/agent/setup-reminders.mjs +9 -2
- package/agent/setup.mjs +27 -22
- package/agent/spawn-child.mjs +38 -1
- package/agent/suspension.mjs +1 -1
- package/agent/timers.mjs +5 -3
- package/agent/turn-loop.mjs +60 -6
- package/agent/turn-projection.mjs +386 -0
- package/agent/turn-task-state.mjs +274 -0
- package/agent/turn-tool-process.mjs +168 -0
- package/agent/write-face.mjs +99 -0
- package/agent/write-gate-ledger.mjs +569 -0
- package/agent/write-gate.mjs +39 -13
- package/agent-tools/advisor-async.mjs +29 -169
- package/agent-tools/advisor-launch.mjs +178 -0
- package/agent-tools/advisor-settle.mjs +28 -1
- package/agent-tools/advisor.mjs +136 -31
- package/agent-tools/async-settle.mjs +2 -2
- package/agent-tools/audit-block.mjs +6 -6
- package/agent-tools/bash-async.mjs +8 -2
- package/agent-tools/batch-closeout.mjs +444 -0
- package/agent-tools/batch-gate.mjs +152 -138
- package/agent-tools/batch-ledger-bind.mjs +392 -0
- package/agent-tools/batch-ledger-link.mjs +73 -0
- package/agent-tools/batch-ledger-view.mjs +109 -0
- package/agent-tools/batch-lifecycle.mjs +245 -376
- package/agent-tools/batch-paths.mjs +73 -47
- package/agent-tools/batch-read.mjs +1 -1
- package/agent-tools/batch-record-write.mjs +417 -0
- package/agent-tools/batch-regions.mjs +215 -0
- package/agent-tools/batch-reopen.mjs +154 -0
- package/agent-tools/batch-segment-vocab.mjs +379 -0
- package/agent-tools/batch-skeleton.mjs +344 -196
- package/agent-tools/batch-supersede.mjs +232 -0
- package/agent-tools/batch-tier-gate.mjs +297 -0
- package/agent-tools/batch.mjs +189 -253
- package/agent-tools/consult.mjs +7 -4
- package/agent-tools/context.mjs +47 -17
- package/agent-tools/design-review-record.mjs +225 -0
- package/agent-tools/design-slots.mjs +24 -24
- package/agent-tools/design-token.mjs +318 -39
- package/agent-tools/doc-check.mjs +55 -29
- package/agent-tools/doc-graph.mjs +140 -0
- package/agent-tools/eng.mjs +10 -9
- package/agent-tools/escalate-async.mjs +5 -5
- package/agent-tools/manifest.mjs +34 -15
- package/agent-tools/read-history.mjs +115 -14
- package/agent-tools/review-facts.mjs +40 -15
- package/agent-tools/settings.mjs +23 -2
- package/agent-tools/spawn-gates.mjs +19 -22
- package/agent-tools/ssh-session.mjs +120 -111
- package/agent-tools/ssh-text.mjs +155 -0
- package/agent-tools/ssh-transfer.mjs +210 -0
- package/agent-tools/ssh-transport.mjs +183 -81
- package/agent-tools/subagent-actions-query.mjs +11 -7
- package/agent-tools/subagent-actions.mjs +1 -1
- package/agent-tools/subagent-async.mjs +11 -11
- package/agent-tools/subagent-brief.mjs +76 -0
- package/agent-tools/subagent-design-token.mjs +168 -0
- package/agent-tools/subagent-run.mjs +1 -1
- package/agent-tools/subagent-scheduler.mjs +45 -11
- package/agent-tools/subagent-spawn.mjs +143 -104
- package/agent-tools/subagent.mjs +26 -23
- package/agent-tools/taskbook-block.mjs +94 -0
- package/agent-tools/timer.mjs +12 -8
- package/agent-tools/verify.mjs +13 -4
- package/agent-tools.mjs +7 -3
- package/agent.mjs +20 -1
- package/attachments.mjs +3 -3
- package/browser/actions.mjs +9 -3
- package/browser/cdp.mjs +45 -17
- package/browser/launch.mjs +25 -43
- package/browser/pool.mjs +299 -0
- package/browser/queue.mjs +2 -0
- package/browser/session-state.mjs +450 -0
- package/browser/session.mjs +127 -151
- package/browser/snapshot.mjs +89 -0
- package/client-identity.mjs +22 -6
- package/config-defaults.mjs +2 -1
- package/config-migrate.mjs +40 -0
- package/config-normalize.mjs +28 -2
- package/config-presets.mjs +5 -3
- package/config-reload.mjs +59 -0
- package/config.mjs +62 -98
- package/context-degrade.mjs +38 -10
- package/context-echo.mjs +11 -0
- package/context.mjs +165 -68
- package/conventions.mjs +11 -9
- package/declaration.mjs +33 -7
- package/declared-repos.mjs +94 -0
- package/doc-check/doc-names.mjs +73 -0
- package/doc-check/doc-tokens.mjs +110 -0
- package/doc-check/existence.mjs +160 -0
- package/doc-check/index.mjs +312 -163
- package/doc-check/line-refs.mjs +38 -0
- package/doc-check/paragraph.mjs +220 -91
- package/doc-graph/anchors.mjs +474 -0
- package/doc-graph/doc-batch-face.mjs +59 -0
- package/doc-graph/doc-suffix.mjs +27 -0
- package/doc-graph/graph-tokens.mjs +160 -0
- package/doc-graph.mjs +778 -0
- package/explore-distill.mjs +12 -6
- package/i18n.mjs +2 -2
- package/index-discover.mjs +4 -1
- package/instance-inbox-watch.mjs +272 -0
- package/instance-inbox.mjs +218 -0
- package/instance-registry.mjs +179 -0
- package/knowledge/README.md +3 -0
- package/knowledge/prompt-resources.md +6 -0
- package/ledger-close-proof.mjs +95 -62
- package/ledger-close.mjs +188 -0
- package/ledger-cmd.mjs +76 -244
- package/ledger-consistency.mjs +113 -0
- package/ledger-db.mjs +70 -37
- package/ledger-executors.mjs +1 -1
- package/ledger-migrate.mjs +4 -4
- package/ledger-read.mjs +10 -8
- package/ledger-surface.mjs +1 -1
- package/ledger-tools.mjs +83 -24
- package/ledger-variant-notice.mjs +1 -1
- package/ledger-write-ops.mjs +462 -0
- package/ledger.mjs +2 -2
- package/manifest-discovery.mjs +5 -3
- package/manifest-schema.mjs +28 -2
- package/memory/memory-tool.mjs +5 -2
- package/memory/schema.mjs +6 -27
- package/package.json +3 -1
- package/path-resolve.mjs +498 -0
- package/permission.mjs +4 -0
- package/prompt-files.mjs +91 -1
- package/prompt-overlays.mjs +14 -6
- package/prompts/advisor-design.md +66 -22
- package/prompts/advisor-round1.md +37 -3
- package/prompts/advisor-round2.md +44 -10
- package/prompts/advisor-round3.md +43 -9
- package/prompts/common.md +15 -375
- package/prompts/consult-base.md +6 -1
- package/prompts/discipline-engineering.md +251 -95
- package/prompts/discipline-normal.md +4 -250
- package/prompts/knowledge/business-gates.md +22 -0
- package/prompts/knowledge/decision-quality.md +23 -0
- package/prompts/knowledge/doc-lookup.md +35 -0
- package/prompts/knowledge/document-writing.md +51 -0
- package/prompts/knowledge/documentation-evaluation.md +56 -0
- package/prompts/knowledge/evidence-discipline.md +57 -0
- package/prompts/knowledge/normal-coding-workflow.md +104 -0
- package/prompts/knowledge/normal-delivery-collaboration.md +108 -0
- package/prompts/knowledge/normal-work-management.md +57 -0
- package/prompts/knowledge/product-security.md +23 -0
- package/prompts/knowledge/project-records.md +62 -0
- package/prompts/knowledge/tool-advisor.md +29 -0
- package/prompts/knowledge/tool-apply-patch.md +18 -0
- package/prompts/knowledge/tool-bash.md +39 -0
- package/prompts/knowledge/tool-batch-eng-coder.md +12 -0
- package/prompts/knowledge/tool-batch-eng-designer.md +12 -0
- package/prompts/knowledge/tool-batch-review.md +12 -0
- package/prompts/knowledge/tool-batch.md +80 -0
- package/prompts/knowledge/tool-browser.md +57 -0
- package/prompts/knowledge/tool-code-search.md +4 -0
- package/prompts/knowledge/tool-consult-start.md +12 -0
- package/prompts/knowledge/tool-consult-stop.md +6 -0
- package/prompts/knowledge/tool-context.md +6 -0
- package/prompts/knowledge/tool-delete.md +17 -0
- package/prompts/knowledge/tool-doc-check.md +70 -0
- package/prompts/knowledge/tool-doc-graph-read.md +20 -0
- package/prompts/knowledge/tool-doc-graph.md +49 -0
- package/prompts/knowledge/tool-doc-search.md +6 -0
- package/prompts/knowledge/tool-edit.md +38 -0
- package/prompts/knowledge/tool-eng.md +2 -0
- package/prompts/knowledge/tool-execute.md +16 -0
- package/prompts/knowledge/tool-fetch.md +12 -0
- package/prompts/knowledge/tool-file-ops.md +16 -0
- package/prompts/knowledge/tool-get-current-time.md +7 -0
- package/prompts/knowledge/tool-git-read.md +19 -0
- package/prompts/knowledge/tool-git.md +29 -0
- package/prompts/knowledge/tool-glob.md +15 -0
- package/prompts/knowledge/tool-goal.md +8 -0
- package/prompts/knowledge/tool-grep.md +18 -0
- package/prompts/knowledge/tool-hashline-edit.md +14 -0
- package/prompts/knowledge/tool-insert-after.md +15 -0
- package/prompts/knowledge/tool-instance-list.md +6 -0
- package/prompts/knowledge/tool-instance-send.md +10 -0
- package/prompts/knowledge/tool-knowledge.md +18 -0
- package/prompts/knowledge/tool-ledger-read.md +35 -0
- package/prompts/knowledge/tool-ledger.md +42 -0
- package/prompts/knowledge/tool-lint.md +16 -0
- package/prompts/knowledge/tool-ls.md +13 -0
- package/prompts/knowledge/tool-lsp.md +11 -0
- package/prompts/knowledge/tool-main-history.md +2 -0
- package/prompts/knowledge/tool-manifest-read.md +14 -0
- package/prompts/knowledge/tool-manifest.md +31 -0
- package/prompts/knowledge/tool-memory-read.md +20 -0
- package/prompts/knowledge/tool-memory.md +15 -0
- package/prompts/knowledge/tool-notify-parent.md +12 -0
- package/prompts/knowledge/tool-operations.md +114 -0
- package/prompts/knowledge/tool-peer-instances.md +2 -0
- package/prompts/knowledge/tool-plan.md +6 -0
- package/prompts/knowledge/tool-process-read.md +13 -0
- package/prompts/knowledge/tool-process.md +15 -0
- package/prompts/knowledge/tool-question.md +16 -0
- package/prompts/knowledge/tool-read-history-batch.md +22 -0
- package/prompts/knowledge/tool-read-history.md +36 -0
- package/prompts/knowledge/tool-read-image.md +11 -0
- package/prompts/knowledge/tool-read.md +21 -0
- package/prompts/knowledge/tool-recent-changes.md +6 -0
- package/prompts/knowledge/tool-repo-outline.md +4 -0
- package/prompts/knowledge/tool-settings-read.md +12 -0
- package/prompts/knowledge/tool-settings.md +18 -0
- package/prompts/knowledge/tool-skill.md +6 -0
- package/prompts/knowledge/tool-ssh.md +52 -0
- package/prompts/knowledge/tool-subagent.md +59 -0
- package/prompts/knowledge/tool-task.md +12 -0
- package/prompts/knowledge/tool-team-ledger-read.md +11 -0
- package/prompts/knowledge/tool-team-ledger.md +11 -0
- package/prompts/knowledge/tool-timer.md +23 -0
- package/prompts/knowledge/tool-tree.md +14 -0
- package/prompts/knowledge/tool-verify.md +19 -0
- package/prompts/knowledge/tool-wait-for.md +25 -0
- package/prompts/knowledge/tool-websearch.md +19 -0
- package/prompts/knowledge/tool-write.md +9 -0
- package/prompts/knowledge/upstream-protocol.md +43 -0
- package/prompts/persona-eng-coder.md +29 -3
- package/prompts/persona-eng-designer.md +131 -159
- package/prompts/persona-engineering.md +202 -131
- package/prompts/persona-explore.md +1 -1
- package/prompts/persona-plan.md +6 -1
- package/prompts/persona-tester.md +55 -0
- package/prompts/subagent-base.md +2 -0
- package/provider/anthropic.mjs +6 -4
- package/provider/core.mjs +5 -4
- package/provider/errors.mjs +29 -4
- package/provider/google.mjs +39 -12
- package/provider/rate.mjs +11 -3
- package/provider/responses.mjs +3 -1
- package/provider/sse.mjs +15 -4
- package/provider-flows.mjs +2 -2
- package/session-identity.mjs +21 -0
- package/session-index-build.mjs +1 -1
- package/session-index-pass.mjs +1 -1
- package/session-index-query.mjs +1 -1
- package/session-index.mjs +1 -1
- package/session-lifecycle.mjs +79 -19
- package/session-slot-write.mjs +37 -5
- package/session-slots.mjs +9 -14
- package/session.mjs +29 -8
- package/skip-dirs.mjs +48 -0
- package/team-ledger.mjs +17 -13
- package/text-budget.mjs +4 -0
- package/token-ttl.mjs +73 -4
- package/token-window.mjs +244 -34
- package/tool-docs/advisor.md +2 -27
- package/tool-docs/apply_patch.md +1 -13
- package/tool-docs/bash.md +2 -37
- package/tool-docs/batch-eng-coder.md +3 -0
- package/tool-docs/batch-eng-designer.md +3 -0
- package/tool-docs/batch-review.md +3 -0
- package/tool-docs/batch.md +3 -1
- package/tool-docs/browser.md +2 -47
- package/tool-docs/code_search.md +3 -1
- package/tool-docs/consult_start.md +2 -4
- package/tool-docs/consult_stop.md +2 -2
- package/tool-docs/context.md +1 -5
- package/tool-docs/delete.md +2 -14
- package/tool-docs/doc_check.md +2 -72
- package/tool-docs/doc_graph-read.md +3 -0
- package/tool-docs/doc_graph.md +3 -0
- package/tool-docs/doc_search.md +3 -1
- package/tool-docs/edit.md +2 -18
- package/tool-docs/eng.md +3 -1
- package/tool-docs/execute.md +2 -12
- package/tool-docs/fetch.md +2 -12
- package/tool-docs/file_ops.md +2 -16
- package/tool-docs/get_current_time.md +1 -6
- package/tool-docs/git-read.md +3 -0
- package/tool-docs/git.md +2 -27
- package/tool-docs/glob.md +2 -10
- package/tool-docs/goal.md +2 -5
- package/tool-docs/grep.md +2 -18
- package/tool-docs/hashline_edit.md +2 -13
- package/tool-docs/insert_after.md +2 -14
- package/tool-docs/instance_list.md +3 -0
- package/tool-docs/instance_send.md +3 -0
- package/tool-docs/knowledge.md +3 -0
- package/tool-docs/ledger-read.md +3 -0
- package/tool-docs/ledger.md +3 -8
- package/tool-docs/lint.md +2 -9
- package/tool-docs/ls.md +2 -11
- package/tool-docs/lsp.md +2 -9
- package/tool-docs/main_history.md +3 -1
- package/tool-docs/manifest-read.md +2 -7
- package/tool-docs/manifest.md +2 -28
- package/tool-docs/memory-read.md +3 -0
- package/tool-docs/memory.md +3 -11
- package/tool-docs/notify_parent.md +2 -13
- package/tool-docs/peer_instances.md +3 -1
- package/tool-docs/plan.md +2 -4
- package/tool-docs/process-read.md +3 -0
- package/tool-docs/process.md +2 -13
- package/tool-docs/question.md +3 -17
- package/tool-docs/read.md +2 -19
- package/tool-docs/read_history-batch.md +3 -0
- package/tool-docs/read_history.md +2 -6
- package/tool-docs/read_image.md +2 -7
- package/tool-docs/recent_changes.md +3 -1
- package/tool-docs/repo_outline.md +3 -1
- package/tool-docs/settings-read.md +3 -0
- package/tool-docs/settings.md +2 -5
- package/tool-docs/skill.md +3 -5
- package/tool-docs/ssh.md +2 -50
- package/tool-docs/subagent.md +2 -63
- package/tool-docs/task.md +2 -6
- package/tool-docs/team_ledger-read.md +3 -0
- package/tool-docs/team_ledger.md +3 -9
- package/tool-docs/timer.md +3 -13
- package/tool-docs/tree.md +2 -13
- package/tool-docs/verify.md +3 -1
- package/tool-docs/wait_for.md +2 -32
- package/tool-docs/websearch.md +2 -17
- package/tool-docs/write.md +2 -10
- package/tools/bash.mjs +12 -2
- package/tools/browser.mjs +52 -7
- package/tools/doc-write-gate.mjs +73 -0
- package/tools/edit-batch.mjs +176 -91
- package/tools/edit-diff.mjs +129 -45
- package/tools/edit-receipt.mjs +39 -0
- package/tools/execute.mjs +11 -5
- package/tools/file.mjs +32 -34
- package/tools/git.mjs +43 -2
- package/tools/index.mjs +6 -0
- package/tools/knowledge.mjs +143 -0
- package/tools/linter.mjs +3 -3
- package/tools/ops.mjs +4 -1
- package/tools/patch.mjs +127 -38
- package/tools/process-doc-mark.mjs +139 -0
- package/tools/search.mjs +15 -6
- package/tools/shared.mjs +31 -7
- package/tools/ssh.mjs +48 -7
- package/tools/tree.mjs +4 -1
- package/tools/write-gate-params.mjs +31 -0
- package/tools/write-path.mjs +79 -6
- package/traces/trace-store.mjs +4 -3
- package/window-policy.mjs +203 -0
- package/agent/light-round.mjs +0 -63
- package/agent/unbooked-pen.mjs +0 -62
- package/doc-check/anchors.mjs +0 -135
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,79 @@
|
|
|
3
3
|
All notable changes to the core package are documented here.
|
|
4
4
|
Format: Keep a Changelog · 中文 · 号在发布时定(CalVer——见 `docs/RELEASE.md` §4)。
|
|
5
5
|
|
|
6
|
+
## [0.11.2] — 2026-11-16
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **设计评审射程天花板**:`§4`/`§5`/`§6` 永在判域之外——它们写在本轮 pass 之后,空着不是发现;可判面 = `§1–§3` 与评审范围文档。**读不受限**:挡的是「对段的发现」,不是读代码。
|
|
11
|
+
- **设计评审判据不随轮次衰减**:第 N 轮可判的发现范围与第 1 轮相同;上一轮输出改由 `buildPriorReviewBlock` 作背景传入,不是本轮的验证清单。
|
|
12
|
+
- **收口门「被取代」边**:对象已消失、永不会实施且能指名后继的批档走 `supersede` 冻结,不靠补写四段内容去过 `close`。
|
|
13
|
+
- **收口门改动面按批归属**:写时归属为主判据、提交 diff 按认领收窄;已收口批的区间上界取它自己的收口提交,取不到则不认领。
|
|
14
|
+
- **写前文档机检门**:`.md` 每一笔写盘前判本笔触碰的段落,区外存量一条不出。
|
|
15
|
+
- **行号坐标成为交付门第三判据**。
|
|
16
|
+
- **`index.docCheckExcludePaths`**:项目可声明文档检查的排除目录。
|
|
17
|
+
- **`index.publicRepos` 出边机检**:跨仓引用未声明即拒、成环即拒。
|
|
18
|
+
- **工具参数零默认值**:缺了就拒,不替调用方拿主意。
|
|
19
|
+
- **`commit` 携未跟踪 path 逐条预检**:调 git 前点名,不为一个 path 回滚整批。
|
|
20
|
+
- **`edit` 行号形态空 `new_string` 按删除生效**。
|
|
21
|
+
- **任务书按角色分**:eng-coder 读批档 §2、eng-designer 读整档;任务书正文进 spawn 系统固块。
|
|
22
|
+
- **批档 §3 只承载本轮结论表**:轮次块由结算自写,评审回执全文不再进档。
|
|
23
|
+
- **单池共享浏览器**。
|
|
24
|
+
- **knowledge 检索**:分词剥首尾标点,停用词过滤;tiny 档常驻查询指引。
|
|
25
|
+
- **tiny 档有效窗口覆盖 256K**。
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **收口门越线支改判 800**(收口线),与设计时线 500 各归各判者。
|
|
30
|
+
- **收口门判域 = 本批变更区**:区内照判三件,区外一个字都不出。
|
|
31
|
+
- **窗口预算单向派生**,压缩线封顶 262144,基线重定并补处置链。
|
|
32
|
+
- **工作模式 `minimal` → `tiny`** 全链改名;工具描述一句话化并按档装配。
|
|
33
|
+
- **引用三形按作用域分工**:正文 / 工具参数 / 证据各一形;编号作用域 = 发它的那份档,跨档带档名。
|
|
34
|
+
- **段落写作标准改挂 `doc_check`**:停用字数自量。
|
|
35
|
+
- **「一把尺子」**:同一读数的不同取法不可互比,射程放开到任何读数。
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **设计评审第 2 轮起被判据降级为收敛轮**——只验上一轮点名项、不再读全文;`§5 实施记录为空` 这类发现正是从这条路径出来的。
|
|
40
|
+
- **推回预算不再被每轮工具批清零**:未评审的收尾必带一句声明。
|
|
41
|
+
- **段判据认中文项目符号**:合法列表文档不再被写门挡住。
|
|
42
|
+
- **`batch edit` 触达账接上改动区**;`standards` 键根解析修复。
|
|
43
|
+
- **设计收尾不判红**;设计轮提醒有上限;`timer` 行去字形。
|
|
44
|
+
|
|
45
|
+
### Removed
|
|
46
|
+
|
|
47
|
+
- **退役措辞族清场**。
|
|
48
|
+
- **fragment 档退役**。
|
|
49
|
+
|
|
50
|
+
## [0.11.1] — 2026-11-04
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **`ssh` 文件传输**:工具新增 `put` / `get` 两动作(单文件、二进制安全)——执行体 = 系统 `scp`,缺省 `-O`(经典协议,网络设备普遍只实现这一支),`protocol:"sftp"` 可覆盖;硬超时杀树;`get` 半截档按「字节数或 mtime 变过」才删,未被动过的旧档不删。
|
|
55
|
+
- **写门射程扩到十三把**:`ssh` 入入口集,但**只 `get` 要号**(`put` 写远端,本门不判);`touchedPaths` 钩子回绝对形,`~` 落点不再被判成「项目内虚构路径」。
|
|
56
|
+
- **项目标准档声明口 `docRoot.standards`**:评审的「方法论符合度」维度不再是空跑。
|
|
57
|
+
- **`path-resolve.mjs`** ∥ **`tools/process-doc-mark.mjs`** ∥ **`thincoder-core/prompts/persona-tester.md`**(tester 角色人格)。
|
|
58
|
+
- **SSE 首 chunk 与流中途分窗**:长 prefill 不再被 120s 静默超时误杀。
|
|
59
|
+
- **`x-opencode-session` 改为每会话一个**(值位模板 `${sessionId}`)。
|
|
60
|
+
- **`ledger/count` 跨项目读面**:界改用调用方 `cwd`。
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- **派单动作表 = 四列**(动作 / 落点 / 期望 / **原因**)——原因格写依据(设计判据 / 实测 / 裁定),不是「不改会怎样」;写门教学块射程行同步补 `ssh` 并写明两半。
|
|
65
|
+
- **台账契约五面收到同一句上**:回执分流 ∥ 待核销拒文 ∥ 逐边枚举 ∥ §5 门判据 ∥ 六态迁移表。
|
|
66
|
+
- **一本批档一并发**;打回即重置 §3 状态行。
|
|
67
|
+
- **提示词面**:单测档住哪 ∥ 先例必须在盘 ∥ 无一越档。
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- **doc-check 围栏闭合判定加长度**:嵌套围栏不再把代码行并成段落落。
|
|
72
|
+
- **`ssh` 有状态剥离 + 帽窗**:保头保尾、中段可取回。
|
|
73
|
+
- **`ledger` evidence 读数**从「尺寸超标」改成「太长、读不下去」。
|
|
74
|
+
|
|
75
|
+
### Removed
|
|
76
|
+
|
|
77
|
+
- **轻通道退役**:`agent/light-round.mjs` ∥ `agent/live-batch.mjs` ∥ `agent/unbooked-pen.mjs` ∥ `scripts/api-contract.mjs` 及其文档三档。
|
|
78
|
+
|
|
6
79
|
## [0.10.13] — 2026-10-26
|
|
7
80
|
|
|
8
81
|
### Added
|
|
@@ -84,7 +157,7 @@ Format: Keep a Changelog · 中文 · 号在发布时定(CalVer——见 `docs
|
|
|
84
157
|
|
|
85
158
|
### Fixed
|
|
86
159
|
|
|
87
|
-
- **核包 `files` 白名单补 `browser/`**(P0——0.10.5 装机缺该目录 ⇒ CLI 装后启动崩(`ERR_MODULE_NOT_FOUND`):`tools/browser.mjs
|
|
160
|
+
- **核包 `files` 白名单补 `browser/`**(P0——0.10.5 装机缺该目录 ⇒ CLI 装后启动崩(`ERR_MODULE_NOT_FOUND`):`tools/browser.mjs` ∥ `permission.mjs` 引 `../browser/*` 而白名单未列;台账 #1362)。发布守则教训:白名单须覆盖运行时引用闭包——发布预检现只对根 `.mjs` ∥ `prompts/` ∥ `tool-docs/` 计数(引闭包断言待另轮补,已登记)。
|
|
88
161
|
|
|
89
162
|
## [0.10.5] — 2026-10-13
|
|
90
163
|
|
package/advisor/convergence.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* advisor/convergence.mjs — shared convergence-round message building (round 2+).
|
|
3
|
-
* SINGLE source for the
|
|
3
|
+
* buildConvergenceBody / buildConvergenceInstructions: SINGLE source for the
|
|
4
|
+
* round-2+ sections of CODE reviews, used by BOTH the normal flow
|
|
4
5
|
* (buildAdvisorFollowUp) and the legacy path (buildAdvisorUserMessage) — fixes must
|
|
5
|
-
* not be replicated in two places.
|
|
6
|
+
* not be replicated in two places. buildPriorReviewBlock serves the design-review
|
|
7
|
+
* round 2+, whose prior output is a reference rather than a verification list.
|
|
8
|
+
* Lives in its own module to avoid the advisor-entry
|
|
6
9
|
* ↔ message-building import cycle.
|
|
7
10
|
*/
|
|
8
11
|
|
|
@@ -24,7 +27,7 @@ export function buildConvergenceInstructions(round, scopeFiles = null) {
|
|
|
24
27
|
"2. STALE-CONTEXT WARNING: any diff or file content from earlier messages is a historical snapshot — treat it as expired. Only fresh `read` results describe the current state.",
|
|
25
28
|
"3. You have no git tool; git output in earlier messages is historical and untrustworthy (committed fixes never show in a diff).",
|
|
26
29
|
"4. `read` the files named in the prior review output (or the review surface above) in full — ALWAYS. Batch reads/greps in a single reply.",
|
|
27
|
-
"5. Evidence rule: every 'Unfixed'/'New' finding MUST quote the exact line content from THIS round's `read` output
|
|
30
|
+
"5. Evidence rule: every 'Unfixed'/'New' finding MUST quote the exact line content from THIS round's `read` output — one CONTIGUOUS excerpt, quoted exactly as it stands. Line numbers alone are NOT evidence — they may be stale or fabricated. Findings without a fresh quoted line are treated as unverified and will not be accepted.",
|
|
28
31
|
"6. Produce your verification table. Do not re-read content you already have.",
|
|
29
32
|
round === 2
|
|
30
33
|
? "7. You may flag obvious NEW issues introduced by the fixes (crashes, data loss, logic errors — not style)."
|
|
@@ -78,3 +81,31 @@ export function buildConvergenceBody(p, response, round, scopeFiles) {
|
|
|
78
81
|
]
|
|
79
82
|
return parts.join("\n")
|
|
80
83
|
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Design-review reference block for round 2+ (decision 2026-11-16 — a design
|
|
87
|
+
* review has NO convergence decay). The prior review output and the agent's fix
|
|
88
|
+
* claims travel so the reviewer does not re-report what is already fixed, but
|
|
89
|
+
* both are REFERENCE: the round is a full review at the same standard as the
|
|
90
|
+
* first, and the prior items are not the verification list.
|
|
91
|
+
* Deliberately separate from buildConvergenceBody — that one keeps serving code
|
|
92
|
+
* reviews, whose rounds DO narrow (round 2 semi-convergence, round 3+ strict).
|
|
93
|
+
* @param {string} p — full prior review output (verbatim)
|
|
94
|
+
* @param {string} response — agent fix-claims table (or fallback text)
|
|
95
|
+
* @returns {string} the reference block
|
|
96
|
+
*/
|
|
97
|
+
export function buildPriorReviewBlock(p, response) {
|
|
98
|
+
return [
|
|
99
|
+
"## Prior Review Output (previous round — reference, not the verification list)",
|
|
100
|
+
p,
|
|
101
|
+
"",
|
|
102
|
+
"## Agent Response (fix claims — reference only)",
|
|
103
|
+
response,
|
|
104
|
+
"",
|
|
105
|
+
"## Instructions",
|
|
106
|
+
"1. This round is a FULL review at the same standard as the first: the system prompt's complete criteria apply, and every document in the review scope is read in full.",
|
|
107
|
+
"2. The prior review output above is a reference, not the verification list: report an item as still open only where the current file state shows it, and report anything new you find.",
|
|
108
|
+
"3. Evidence rule: every finding MUST quote the exact line content from THIS round's `read` output — one CONTIGUOUS excerpt, quoted exactly as it stands. Line numbers alone are NOT evidence.",
|
|
109
|
+
"",
|
|
110
|
+
].join("\n")
|
|
111
|
+
}
|
package/advisor/loop.mjs
CHANGED
|
@@ -13,6 +13,18 @@ import { providerSpec, assistantToolCallMessage } from "../config.mjs"
|
|
|
13
13
|
import { toOpenAISchema } from "../tools/index.mjs"
|
|
14
14
|
import { truncateAdvisorResult } from "./truncate.mjs"
|
|
15
15
|
import { batchTool } from "../agent-tools/batch.mjs"
|
|
16
|
+
// 文档工具面(`docs/core/design/AGENT-LOOP-SUBAGENT.md` §6.60.2 ③ · 需求 `docs/core/requirements/DOC-GRAPH.md`
|
|
17
|
+
// §4 AC-10):评审段拿到两件只读工具:`doc_check` 本体 ∥ `doc_graph` 只读变体(三动作、无 `scan`)。
|
|
18
|
+
// **工具在场 ≠ 义务**:评审的判据来自文档本体(读那一节、与代码和需求对出来),机检的 PASS 只说明锚点与段长
|
|
19
|
+
// 合规、`doc_graph` 只回答「谁引了谁」——两者都不是判据面。拿到它们是为了「核一个锚在不在盘」这类局部事实时
|
|
20
|
+
// 不必上抛,而不是给它一条结论捷径;没有机制禁止它调用,也不该有。静态 import(同 `batchTool` 那条):
|
|
21
|
+
// `doc-graph.mjs` 的静态闭包不达 `node:sqlite`(机制档只在 execute 里动态 import);`doc-check.mjs` 的静态闭包
|
|
22
|
+
// 经 `doc-check/index.mjs → declaration.mjs → memory/file-walk.mjs` 到达 `node:sqlite`。而本档**原有**的 `batchTool`
|
|
23
|
+
// 静态链早已同达(可逐跳核到的一条:`agent-tools/batch.mjs → batch-paths.mjs → path-resolve.mjs →
|
|
24
|
+
// declared-repos.mjs → declaration.mjs → memory/file-walk.mjs → memory/schema.mjs`)⇒ 本条不是本批新引入的
|
|
25
|
+
// 通路;本批只按同一条静态 import 先例接入,模块域零新增 TLA(两档都不是 TLA import)。
|
|
26
|
+
import { docCheckTool } from "../agent-tools/doc-check.mjs"
|
|
27
|
+
import { docGraphReadTool } from "../agent-tools/doc-graph.mjs"
|
|
16
28
|
import {
|
|
17
29
|
shouldBudgetNudge, budgetNudgeText, timeoutTail, renderTimeline, compactContextIfNeeded,
|
|
18
30
|
MAX_ADVISOR_TURNS, advisorContextBudget, TOOL_TIMEOUT_MS, REVIEW_TIMEOUT_MS, MAX_RESULT_CHARS,
|
|
@@ -25,11 +37,13 @@ const { lspTool } = await import("../tools/lsp.mjs")
|
|
|
25
37
|
const { codeSearchTool } = await import("../memory/code-sync.mjs")
|
|
26
38
|
|
|
27
39
|
/**
|
|
28
|
-
* Advisor tool set — ZERO git,
|
|
40
|
+
* Advisor tool set — ZERO git, every round:只读六件 + 文档工具面两件(`doc_check` ∥ `doc_graph` 只读变体)
|
|
41
|
+
* + 绑定档时追加 `batch`(写面限 `§3`;工程设计轨不追加——`BATCH-RECORD.md` §4.3)。
|
|
42
|
+
* The change surface comes from the
|
|
29
43
|
* review scope (paths / _touchedFiles injected by the caller), never from git: git output misled
|
|
30
44
|
* reviews (committed fixes never show in `git diff HEAD`, so "no changes" was read as "not
|
|
31
45
|
* fixed") and the user mandate is full decoupling (7d49a52 + d3be613). The reviewer reads files
|
|
32
|
-
* and searches code; it never touches git
|
|
46
|
+
* and searches code; it never touches git. No round parameter — the set is
|
|
33
47
|
* constant across all rounds. 检索面**恒在**(与索引绑定解耦):`code_search` 永远在集内,
|
|
34
48
|
* 未绑定索引的会话在**执行面**降级为一句端中立说明(不崩、不伪造结果)——工具清单恒定。
|
|
35
49
|
* @param {Object} agent — 索引面载体(`agent.memory`);缺省时执行面降级。
|
|
@@ -40,12 +54,25 @@ function advisorCodeSearchTool(agent) {
|
|
|
40
54
|
: { ...codeSearchTool(undefined), async execute() { return "(code index not available in this session)" } }
|
|
41
55
|
}
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
/**
|
|
58
|
+
* 评审侧工具表(纯函数)。
|
|
59
|
+
* @param {Object} agent — 索引面载体(`agent.memory`)+ 模式位(`agent.config.agent.engineering`)。
|
|
60
|
+
* @param {string} reviewType — 本评审实例的**评审轨**(`"design"` ∥ `"code"`)——挂载判据的一半
|
|
61
|
+
* (`docs/core/design/BATCH-RECORD.md` §4.3)。**不给默认值**:模式 × 评审轨两项缺一即判不出,
|
|
62
|
+
* 用默认值顶替就等于替调用方选了一条路。
|
|
63
|
+
* @param {string|null} [batchDoc] — 本评审逐笔绑定的批次档(绝对路径);非空 ⇒ 按下方判据追加 `batch`(写面限 `§3`)。
|
|
64
|
+
* @returns {{schemas: object[], byName: Map<string, object>}}
|
|
65
|
+
*/
|
|
66
|
+
function advisorToolsFor(agent, reviewType, batchDoc = null) {
|
|
67
|
+
const tools = [readTool, globTool, grepTool, lsTool, lspTool, advisorCodeSearchTool(agent), docCheckTool, docGraphReadTool]
|
|
68
|
+
// BATCH-RECORD.md §4.3:挂载判据 = 绑定 ∧ ¬(工程模式 ∧ 设计轨)。工程设计轨的 §3 对一切工具通道只读、
|
|
69
|
+
// 轮次块由结算写,工具给了它也只会收到一条拒——不发(fail-closed)。代码轨与普通模式照旧追加:那两条路
|
|
70
|
+
// 没有设计结算可代写,而收口门读的是 §3 的段级状态行(工具面批走代码轨,评审员要写 §3 就靠这一条)。
|
|
71
|
+
// 未绑定 → 不挂载(fail-closed)。
|
|
72
|
+
const engineering = !!agent?.config?.agent?.engineering
|
|
73
|
+
if (batchDoc && !(engineering && reviewType !== "code")) tools.push(batchTool(batchDoc, { review: true, reviewType }))
|
|
74
|
+
// 工具描述取完整档(设计 TOOLS §1):评审是独立基底,不随会话 mode 变化(requirements §9.1)。
|
|
75
|
+
return { schemas: tools.map((tool) => toOpenAISchema(tool, "normal")), byName: new Map(tools.map((t) => [t.name, t])) }
|
|
49
76
|
}
|
|
50
77
|
// Test seam: the tool set is pure(恒在六工具 + 批次档绑定條件)。
|
|
51
78
|
export { advisorToolsFor, advisorToolsFor as _advisorToolsFor }
|
|
@@ -62,7 +89,7 @@ export { advisorToolsFor, advisorToolsFor as _advisorToolsFor }
|
|
|
62
89
|
* @param {{now?: Function, chat?: Function, describeArgs?: Function}} [seams] — 测试缝 + ④ 端差注入点
|
|
63
90
|
* (默认 Date.now / chat / 无进度行——生产调用不传时进度行由端装配层补齐)。
|
|
64
91
|
*/
|
|
65
|
-
async function runAdvisorToolLoop(provider, messages, onOutput, signal, agent, cwd, toolsOverride = null, reviewType
|
|
92
|
+
async function runAdvisorToolLoop(provider, messages, onOutput, signal, agent, cwd, toolsOverride = null, reviewType, batchDoc = null, pinned = null, seams = {}) {
|
|
66
93
|
const now = seams.now ?? Date.now
|
|
67
94
|
const chatCall = seams.chat ?? chat
|
|
68
95
|
// ④ 端差注入点(CORE-UNIFICATION §2.5 #109「进度行按端注入」):工具进度行的参数摘要
|
|
@@ -252,7 +279,12 @@ async function runAdvisorToolLoop(provider, messages, onOutput, signal, agent, c
|
|
|
252
279
|
})
|
|
253
280
|
let toolPromise
|
|
254
281
|
try {
|
|
255
|
-
|
|
282
|
+
// 归一成 Promise(设计单源 = `docs/core/design/ADVISOR-CONVERGENCE.md` §18):工具的 `execute` 允许同步
|
|
283
|
+
// 返回(`doc_check` 就是一个),而下面 `finally` 里要给同一返回值挂 `.catch`——同步值上没有 `.catch`,
|
|
284
|
+
// 收尾句抱 `TypeError` 盖过竞速结果,一次成功的工具调用被归成 `: "execution_error"`。
|
|
285
|
+
// **别以为评审的工具集特殊**:主代理侧是 `await item.tool.execute(...)`,`await` 对同步值与 Promise 同判,
|
|
286
|
+
// 那里不产生 `.catch`;评审循环是唯一在 `finally` 里挂 `.catch` 的地方,于是只有它撞。
|
|
287
|
+
toolPromise = Promise.resolve(p.tool.execute(p.args, { cwd, agent, onOutput, signal }))
|
|
256
288
|
return await Promise.race([toolPromise, timeoutPromise])
|
|
257
289
|
} finally {
|
|
258
290
|
clearTimeout(timeoutId)
|
package/advisor/messages.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { join, relative, sep } from "node:path"
|
|
9
9
|
import { findReviewRepos, collectRepoSnapshots, collectChangedFiles } from "./repos.mjs"
|
|
10
|
-
import { buildConvergenceBody, buildConvergenceInstructions } from "./convergence.mjs"
|
|
10
|
+
import { buildConvergenceBody, buildConvergenceInstructions, buildPriorReviewBlock } from "./convergence.mjs"
|
|
11
11
|
import { loadAdvisorMd, extractConversationBackground, extractAgentResponseTable } from "./history.mjs"
|
|
12
12
|
import { injectProjectGuide, injectDocumentMap, injectProjectStandards, NO_GIT_NOTICE } from "./project-context.mjs"
|
|
13
13
|
|
|
@@ -54,6 +54,7 @@ export function buildDesignApprovalBlock(designToken, designId) {
|
|
|
54
54
|
"## Approval Signal",
|
|
55
55
|
echo,
|
|
56
56
|
"The verdict line is checked mechanically: without a `VERDICT: pass` line, or with a `VERDICT: changes-required` line, no token is issued even when the token is echoed.",
|
|
57
|
+
"Put that same verdict line on its own line inside the text you append to the batch record's §3 (`batch append`): the §3 write itself is checked the same way, and a §3 append that states no verdict — or states both — is refused before anything lands.",
|
|
57
58
|
"🟡 (Advisory) and 🔵 (Note) findings do NOT block approval — list them if present, but still include the token. If any 🔴 (Critical) issue remains unresolved, do NOT include the token. A reasoned non-fix accepted by the reviewer does not block (🔴 only — 🟡/🔵 never block approval); anything else stays unresolved.",
|
|
58
59
|
].join("\n")
|
|
59
60
|
}
|
|
@@ -86,7 +87,7 @@ export function buildAdvisorUserMessage(agent, prior, reviewType, designToken =
|
|
|
86
87
|
return `${body}\n\n${buildDesignApprovalBlock(designToken, designId)}`
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
/**
|
|
90
|
+
/** 内层构建(无自愈尾包)。设计评审每轮走这里:首轮无 prior 参考块,轮 2+ 带 prior 参考块,其余消息形态相同。 */
|
|
90
91
|
function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = null, documents = null, paths = null, object = null, designId = null) {
|
|
91
92
|
// prior = the full prior review output (string) when a convergence round is
|
|
92
93
|
// being built (decision 2026-08-08 — verbatim injection, model understands it).
|
|
@@ -95,24 +96,29 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
95
96
|
|
|
96
97
|
const parts = []
|
|
97
98
|
// Review-object declaration FIRST — D-OA1: at the start of the user message
|
|
98
|
-
// (after the system prompt, before the review content). Covers
|
|
99
|
-
//
|
|
100
|
-
//
|
|
99
|
+
// (after the system prompt, before the review content). Covers every design
|
|
100
|
+
// round and code round 1 here; the code-review round-2+ path prepends it in
|
|
101
|
+
// buildAdvisorFollowUp (T-OA2 — every round stays anchored).
|
|
101
102
|
const declaration = buildObjectDeclarationBlock(object)
|
|
102
103
|
if (declaration) parts.push(declaration)
|
|
103
104
|
const docList = Array.isArray(documents) ? documents.filter((d) => typeof d === "string" && d.trim()) : []
|
|
104
105
|
const pathList = Array.isArray(paths) ? [...new Set(paths.filter((p) => typeof p === "string" && p.trim()))] : []
|
|
106
|
+
// 评审范围项 = 指南 ∥ 标准层 ∥ 文档地图共用的**同一份操作数**(序 = 喂给 `findGuideRoot` 的那个序)。
|
|
107
|
+
// 只算一处:两条 base 推导同源的前提是三个调用点拿到的确实是同一份列表。
|
|
108
|
+
const scopeFiles = [...pathList, ...docList]
|
|
105
109
|
|
|
106
|
-
// Project guide FIRST in EVERY review path (code AND design
|
|
110
|
+
// Project guide FIRST in EVERY review path (code AND design): the map
|
|
107
111
|
// to the requirements docs is needed for design reviews too (design must fit
|
|
108
|
-
// the requirements, not just the methodology).
|
|
112
|
+
// the requirements, not just the methodology). The design branch early-returns
|
|
109
113
|
// below — the guide must be injected before that return. Project root is
|
|
110
114
|
// discovered from the review scope (code paths AND design-doc paths, so a
|
|
111
115
|
// documents-only design review still finds the subproject guide).
|
|
112
|
-
const guideRoot = injectProjectGuide(agent, parts,
|
|
116
|
+
const guideRoot = injectProjectGuide(agent, parts, scopeFiles)
|
|
113
117
|
|
|
114
|
-
// Design review
|
|
115
|
-
|
|
118
|
+
// Design review — EVERY round (decision 2026-11-16: no convergence decay; each
|
|
119
|
+
// round re-reads the whole scope against the complete criteria). Round 2+ adds
|
|
120
|
+
// the prior review output as a REFERENCE block below.
|
|
121
|
+
if (reviewType === "design") {
|
|
116
122
|
const repos = findReviewRepos(agent)
|
|
117
123
|
parts.push("## Design Review")
|
|
118
124
|
// FR15/P8: no git → change-set context is unavailable. Say it (never silent).
|
|
@@ -125,7 +131,7 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
125
131
|
// doc list — the advisor reviews ONLY these. No git-diff change-set
|
|
126
132
|
// collection: diff-based discovery reviewed unrelated files, and untracked
|
|
127
133
|
// design docs were invisible to git diff anyway (ENGINEERING-MODE.md §2.4).
|
|
128
|
-
parts.push("The documents below are the review scope
|
|
134
|
+
parts.push("The documents below are the review scope — the review target is these documents only. Do not scan git diff; reading other files is allowed where a criterion needs it (feasibility, affected-file size), but findings outside these documents are out of scope.")
|
|
129
135
|
parts.push("")
|
|
130
136
|
parts.push("## Documents to Review")
|
|
131
137
|
parts.push(docList.map((d) => `- ${d} — Read this file in full`).join("\n"))
|
|
@@ -155,15 +161,20 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
155
161
|
}
|
|
156
162
|
}
|
|
157
163
|
|
|
158
|
-
// Engineering mode: the project standards section —
|
|
159
|
-
//
|
|
164
|
+
// Engineering mode: the project standards section — read from the project's own
|
|
165
|
+
// declaration (`docRoot.standards`); three states, each machine-distinguishable:
|
|
166
|
+
// undeclared / declared-but-unreadable / injected. Never a probed convention name (PO-2).
|
|
167
|
+
// The base is derived inside the injector from this review's scope (the owning project of
|
|
168
|
+
// those paths) — NOT from `guideRoot`: the guide's root is the nearest AGENTS.md, which is a
|
|
169
|
+
// different question, and under a workspace anchor it is the anchor (no manifest ⇒ state 1).
|
|
160
170
|
if (agent.config?.agent?.engineering) {
|
|
161
|
-
injectProjectStandards(agent, parts,
|
|
171
|
+
injectProjectStandards(agent, parts, scopeFiles)
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
// Document map: derived from the manifest `docRoot` (declared roots' README, then their common
|
|
165
|
-
// ancestor); neither → explicit degradation sentence (never a silent skip).
|
|
166
|
-
|
|
175
|
+
// ancestor); neither → explicit degradation sentence (never a silent skip). Same base as the
|
|
176
|
+
// standards face (one derivation, two consumers).
|
|
177
|
+
injectDocumentMap(agent, parts, scopeFiles)
|
|
167
178
|
|
|
168
179
|
parts.push("## Instructions")
|
|
169
180
|
if (docList.length > 0) {
|
|
@@ -175,6 +186,16 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
175
186
|
parts.push("3. If the ## Project Guide (AGENTS.md) section above is present, also check requirement fit: does the design match what the requirements documents it points to actually ask for?")
|
|
176
187
|
parts.push("4. Do NOT run git diff or look for code changes — there are none at this stage.")
|
|
177
188
|
parts.push("5. If you find issues, produce your review table with the format: | # | Category | Severity | Issue | Suggestion |. If the design passes, no table is needed.")
|
|
189
|
+
// Round 2+: the prior review output and the agent's fix claims travel as
|
|
190
|
+
// REFERENCE — they keep the reviewer from re-reporting what is already fixed,
|
|
191
|
+
// and they are explicitly NOT the verification list (this round is a full
|
|
192
|
+
// review at the same standard as the first).
|
|
193
|
+
if (p && (agent._advisorRound || 0) > 0) {
|
|
194
|
+
const response = extractAgentResponseTable(agent.history, agent._advisorResponseAnchor ?? undefined)
|
|
195
|
+
|| "(Agent did not provide a response table — report every issue the current file state shows)"
|
|
196
|
+
parts.push("")
|
|
197
|
+
parts.push(buildPriorReviewBlock(p, response))
|
|
198
|
+
}
|
|
178
199
|
if (designToken) {
|
|
179
200
|
parts.push("")
|
|
180
201
|
parts.push(buildDesignApprovalBlock(designToken, designId))
|
|
@@ -182,11 +203,11 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
182
203
|
return parts.join("\n")
|
|
183
204
|
}
|
|
184
205
|
|
|
185
|
-
// Convergence data (round 2+). LEGACY COMPATIBILITY PATH: the normal
|
|
206
|
+
// Convergence data (round 2+). LEGACY COMPATIBILITY PATH: the normal code-review
|
|
186
207
|
// flow routes convergence rounds through buildAdvisorFollowUp (fresh session,
|
|
187
|
-
// decision d698434);
|
|
188
|
-
//
|
|
189
|
-
// breaking those. Same rule as buildAdvisorFollowUp: the FULL prior review
|
|
208
|
+
// decision d698434); a design review never reaches here (it returns above, every round).
|
|
209
|
+
// This block only fires for direct external callers of buildAdvisorUserMessage
|
|
210
|
+
// with a stored prior review output. Kept to avoid breaking those. Same rule as buildAdvisorFollowUp: the FULL prior review
|
|
190
211
|
// output is injected verbatim (decision 2026-08-08 — the model understands it;
|
|
191
212
|
// no table/header/phrase parsing).
|
|
192
213
|
// NOTE: this legacy path does NOT apply escapeLiteralEscapes (that lives in
|
|
@@ -216,11 +237,8 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
216
237
|
parts.push("")
|
|
217
238
|
}
|
|
218
239
|
if (docList.length > 0) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} else {
|
|
222
|
-
parts.push("The documents below define acceptance criteria and review context. Read them for context, then read the code files specified in the review scope. Judge the implementation against these documents.")
|
|
223
|
-
}
|
|
240
|
+
// Code-review path only — a design review returns inside its own branch above.
|
|
241
|
+
parts.push("The documents below define acceptance criteria and review context. Read them for context, then read the code files specified in the review scope. Judge the implementation against these documents.")
|
|
224
242
|
parts.push("")
|
|
225
243
|
parts.push("## Documents to Review")
|
|
226
244
|
parts.push(docList.map((d) => `- ${d} — Read this file in full`).join("\n"))
|
|
@@ -248,9 +266,10 @@ function buildAdvisorUserMessageInner(agent, prior, reviewType, designToken = nu
|
|
|
248
266
|
parts.push("")
|
|
249
267
|
|
|
250
268
|
// Engineering mode: project standards (declaration-only, same helper as the
|
|
251
|
-
// design path) — undeclared degrades visibly (PO-2).
|
|
269
|
+
// design path) — undeclared degrades visibly (PO-2). Base = this review's scope's owning
|
|
270
|
+
// project (same derivation as the document map), not `guideRoot`.
|
|
252
271
|
if (agent.config?.agent?.engineering) {
|
|
253
|
-
injectProjectStandards(agent, parts,
|
|
272
|
+
injectProjectStandards(agent, parts, scopeFiles)
|
|
254
273
|
}
|
|
255
274
|
|
|
256
275
|
// Instructions — round-aware: re-reviews skip convention discovery entirely.
|
package/advisor/notice.mjs
CHANGED
|
@@ -78,7 +78,7 @@ export function buildTypeGateRefusal({ criterion, received = null, declared = nu
|
|
|
78
78
|
}
|
|
79
79
|
parts.push(
|
|
80
80
|
' • type="code" — code review: reviews the code you changed; pass paths=[...] to scope files/directories (documents=[...] adds acceptance-criteria context).',
|
|
81
|
-
' • type="design" — design review: reviews design / requirement documents; pass documents=[...] (the explicit list)
|
|
81
|
+
' • type="design" — design review: reviews design / requirement documents; pass documents=[...] (the explicit list) and batchDoc — required, the batch record this review belongs to.',
|
|
82
82
|
"Nothing was sent: no review instance, no round consumed, no design token minted, no LLM call.",
|
|
83
83
|
)
|
|
84
84
|
return parts.join("\n")
|