@thincoder/core 0.11.1 → 0.11.3
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 +64 -2
- package/advisor/compaction.mjs +7 -5
- package/advisor/convergence.mjs +34 -3
- package/advisor/history.mjs +24 -11
- package/advisor/loop.mjs +49 -12
- package/advisor/messages.mjs +114 -33
- package/advisor/project-context.mjs +171 -42
- package/advisor/run.mjs +24 -10
- package/advisor.mjs +36 -46
- package/agent/batch-attribution.mjs +87 -0
- package/agent/batch-changed-surface.mjs +129 -0
- package/agent/chat-call.mjs +14 -9
- package/agent/completion.mjs +70 -41
- package/agent/continue-decision.mjs +14 -8
- package/agent/digest-account.mjs +133 -59
- package/agent/dispatch-gates.mjs +6 -0
- package/agent/dispatch-run.mjs +1 -1
- package/agent/dispatch.mjs +10 -4
- package/agent/family-tools.mjs +37 -23
- package/agent/helpers.mjs +139 -73
- package/agent/image-heal.mjs +18 -4
- package/agent/offload.mjs +25 -29
- package/agent/post-turn.mjs +36 -35
- package/agent/record-results.mjs +39 -7
- package/agent/run-stages.mjs +132 -52
- package/agent/run-start.mjs +150 -78
- package/agent/setup-reminders.mjs +194 -91
- package/agent/setup.mjs +219 -140
- package/agent/spawn-child.mjs +40 -3
- package/agent/suspension.mjs +43 -15
- package/agent/timers.mjs +9 -4
- package/agent/turn-domain-text.mjs +105 -0
- package/agent/turn-loop.mjs +84 -27
- package/agent/turn-projection.mjs +286 -0
- package/agent/turn-task-state.mjs +274 -0
- package/agent/turn-tool-process.mjs +163 -0
- package/agent/write-gate-ledger.mjs +569 -0
- package/agent/write-gate.mjs +29 -352
- package/agent-tools/advisor-async.mjs +35 -172
- package/agent-tools/advisor-launch.mjs +178 -0
- package/agent-tools/advisor-settle.mjs +28 -1
- package/agent-tools/advisor.mjs +37 -48
- package/agent-tools/async-discard.mjs +7 -2
- package/agent-tools/async-settle.mjs +18 -12
- package/agent-tools/audit-block.mjs +6 -6
- package/agent-tools/bash-async.mjs +5 -2
- package/agent-tools/batch-closeout.mjs +223 -35
- package/agent-tools/batch-gate.mjs +142 -342
- package/agent-tools/batch-ledger-bind.mjs +240 -20
- package/agent-tools/batch-ledger-view.mjs +109 -0
- package/agent-tools/batch-lifecycle.mjs +197 -48
- package/agent-tools/batch-paths.mjs +29 -8
- package/agent-tools/batch-read.mjs +151 -4
- package/agent-tools/batch-record-write.mjs +417 -0
- package/agent-tools/batch-regions.mjs +215 -0
- package/agent-tools/batch-reopen.mjs +23 -11
- package/agent-tools/batch-segment-vocab.mjs +459 -0
- package/agent-tools/batch-skeleton.mjs +196 -239
- package/agent-tools/batch-supersede.mjs +232 -0
- package/agent-tools/batch-tier-gate.mjs +214 -0
- package/agent-tools/batch.mjs +192 -439
- package/agent-tools/browser-async.mjs +5 -2
- package/agent-tools/consult.mjs +17 -11
- package/agent-tools/context.mjs +76 -33
- package/agent-tools/design-review-record.mjs +225 -0
- package/agent-tools/design-slots.mjs +1 -1
- package/agent-tools/design-token.mjs +279 -81
- package/agent-tools/digest-budget.mjs +10 -9
- package/agent-tools/doc-check.mjs +43 -33
- package/agent-tools/doc-graph.mjs +140 -0
- package/agent-tools/eng.mjs +12 -12
- package/agent-tools/escalate-async.mjs +5 -5
- package/agent-tools/goal.mjs +5 -2
- package/agent-tools/judge-domain.mjs +347 -0
- package/agent-tools/manifest.mjs +34 -18
- package/agent-tools/parent-channel.mjs +6 -3
- package/agent-tools/plan.mjs +11 -10
- package/agent-tools/read-history.mjs +112 -11
- package/agent-tools/review-facts.mjs +19 -6
- package/agent-tools/settings.mjs +23 -2
- package/agent-tools/skill.mjs +7 -8
- package/agent-tools/spawn-gates.mjs +14 -24
- package/agent-tools/ssh-session.mjs +8 -5
- package/agent-tools/ssh-text.mjs +155 -0
- package/agent-tools/ssh-transfer.mjs +1 -1
- package/agent-tools/ssh-transport.mjs +19 -148
- package/agent-tools/subagent-actions-query.mjs +10 -6
- package/agent-tools/subagent-actions.mjs +2 -2
- package/agent-tools/subagent-async.mjs +19 -17
- 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 +13 -13
- package/agent-tools/subagent-spawn.mjs +92 -112
- package/agent-tools/subagent.mjs +16 -28
- package/agent-tools/task.mjs +0 -8
- 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 +26 -7
- package/attachments.mjs +3 -3
- package/auto-think.mjs +5 -2
- 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 +1 -1
- package/compaction-work-state.mjs +230 -0
- package/compress-form.mjs +41 -6
- package/config-defaults.mjs +7 -3
- package/config-migrate.mjs +40 -0
- package/config-normalize.mjs +28 -2
- package/config-reload.mjs +59 -0
- package/config.mjs +110 -110
- package/context-degrade.mjs +93 -34
- package/context-echo.mjs +6 -15
- package/context-push.mjs +328 -31
- package/context.mjs +298 -170
- package/conventions.mjs +11 -9
- package/declaration.mjs +126 -22
- 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 +309 -213
- package/doc-check/line-refs.mjs +27 -101
- package/doc-check/paragraph.mjs +218 -102
- 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/escape.mjs +6 -5
- package/explore-distill.mjs +41 -8
- package/generate-title.mjs +10 -1
- package/i18n.mjs +1 -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 +10 -0
- package/ledger-close-proof.mjs +100 -49
- package/ledger-close.mjs +188 -0
- package/ledger-cmd.mjs +47 -91
- package/ledger-consistency.mjs +113 -0
- package/ledger-db.mjs +47 -15
- package/ledger-executors.mjs +1 -1
- package/ledger-tools.mjs +121 -62
- package/ledger-write-ops.mjs +162 -46
- package/ledger.mjs +1 -1
- package/manifest-discovery.mjs +3 -1
- package/manifest-schema.mjs +27 -5
- package/memory/docs.mjs +51 -15
- package/memory/file-list.mjs +6 -0
- package/memory/schema.mjs +2 -2
- package/model-specs.mjs +87 -21
- package/origin-guard.mjs +190 -0
- package/package.json +3 -1
- package/path-resolve.mjs +338 -57
- package/prompt-files.mjs +114 -2
- package/prompt-overlays.mjs +21 -11
- package/prompts/advisor-design.md +96 -36
- package/prompts/advisor-round1.md +48 -4
- package/prompts/advisor-round2.md +54 -10
- package/prompts/advisor-round3.md +53 -9
- package/prompts/common.md +99 -434
- package/prompts/consult-base.md +7 -4
- package/prompts/discipline-engineering.md +504 -295
- package/prompts/discipline-normal.md +106 -281
- package/prompts/knowledge/business-gates.md +30 -0
- package/prompts/knowledge/decision-quality.md +21 -0
- package/prompts/knowledge/doc-lookup.md +30 -0
- package/prompts/knowledge/document-writing.md +33 -0
- package/prompts/knowledge/documentation-evaluation.md +48 -0
- package/prompts/knowledge/evidence-discipline.md +38 -0
- package/prompts/knowledge/normal-coding-workflow.md +110 -0
- package/prompts/knowledge/normal-delivery-collaboration.md +124 -0
- package/prompts/knowledge/normal-work-management.md +60 -0
- package/prompts/knowledge/product-security.md +28 -0
- package/prompts/knowledge/project-records.md +73 -0
- package/prompts/knowledge/tool-advisor.md +29 -0
- package/prompts/knowledge/tool-apply-patch.md +17 -0
- package/prompts/knowledge/tool-bash.md +48 -0
- package/prompts/knowledge/tool-batch-eng-coder.md +19 -0
- package/prompts/knowledge/tool-batch-eng-designer.md +20 -0
- package/prompts/knowledge/tool-batch-review.md +18 -0
- package/prompts/knowledge/tool-batch.md +94 -0
- package/prompts/knowledge/tool-browser.md +68 -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 +21 -0
- package/prompts/knowledge/tool-doc-check.md +71 -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 +41 -0
- package/prompts/knowledge/tool-eng.md +2 -0
- package/prompts/knowledge/tool-execute.md +21 -0
- package/prompts/knowledge/tool-fetch.md +18 -0
- package/prompts/knowledge/tool-file-ops.md +21 -0
- package/prompts/knowledge/tool-get-current-time.md +7 -0
- package/prompts/knowledge/tool-git-read.md +21 -0
- package/prompts/knowledge/tool-git.md +29 -0
- package/prompts/knowledge/tool-glob.md +17 -0
- package/prompts/knowledge/tool-goal.md +8 -0
- package/prompts/knowledge/tool-grep.md +21 -0
- package/prompts/knowledge/tool-hashline-edit.md +16 -0
- package/prompts/knowledge/tool-insert-after.md +17 -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 +28 -0
- package/prompts/knowledge/tool-ledger.md +46 -0
- package/prompts/knowledge/tool-lint.md +16 -0
- package/prompts/knowledge/tool-ls.md +15 -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 +34 -0
- package/prompts/knowledge/tool-memory-read.md +20 -0
- package/prompts/knowledge/tool-memory.md +19 -0
- package/prompts/knowledge/tool-notify-parent.md +12 -0
- package/prompts/knowledge/tool-operations.md +102 -0
- package/prompts/knowledge/tool-peer-instances.md +2 -0
- package/prompts/knowledge/tool-plan.md +5 -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 +35 -0
- package/prompts/knowledge/tool-read-image.md +11 -0
- package/prompts/knowledge/tool-read.md +22 -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 +17 -0
- package/prompts/knowledge/tool-skill.md +6 -0
- package/prompts/knowledge/tool-ssh.md +74 -0
- package/prompts/knowledge/tool-subagent.md +57 -0
- package/prompts/knowledge/tool-task.md +14 -0
- package/prompts/knowledge/tool-team-ledger-read.md +11 -0
- package/prompts/knowledge/tool-team-ledger.md +15 -0
- package/prompts/knowledge/tool-timer.md +23 -0
- package/prompts/knowledge/tool-tree.md +16 -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 +12 -0
- package/prompts/knowledge/upstream-protocol.md +45 -0
- package/prompts/persona-coder.md +1 -3
- package/prompts/persona-eng-coder.md +24 -6
- package/prompts/persona-eng-designer.md +150 -171
- package/prompts/persona-engineering.md +531 -442
- package/prompts/persona-explore.md +1 -3
- package/prompts/persona-normal.md +17 -9
- package/prompts/persona-plan.md +5 -3
- package/prompts/persona-tester.md +0 -2
- package/prompts/subagent-base.md +2 -2
- package/provider/anthropic.mjs +10 -6
- package/provider/core.mjs +8 -5
- package/provider/errors.mjs +63 -4
- package/provider/google.mjs +29 -10
- package/provider/reasoning-echo.mjs +16 -0
- package/provider/responses.mjs +7 -3
- package/provider/sse.mjs +11 -6
- package/provider-flows.mjs +2 -2
- package/rules.mjs +11 -10
- 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 +131 -42
- package/session-slot-write.mjs +38 -6
- package/session.mjs +30 -11
- package/shell-identity.mjs +129 -22
- package/skip-dirs.mjs +26 -2
- package/team-ledger.mjs +34 -30
- package/text-budget.mjs +1 -1
- package/think-off.mjs +27 -0
- package/token-ttl.mjs +74 -5
- package/token-window.mjs +371 -47
- package/tool-docs/advisor.md +2 -27
- package/tool-docs/apply_patch.md +1 -15
- package/tool-docs/bash.md +2 -43
- 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 +2 -84
- package/tool-docs/browser.md +2 -49
- package/tool-docs/code_search.md +2 -2
- package/tool-docs/consult_start.md +2 -8
- package/tool-docs/consult_stop.md +2 -4
- package/tool-docs/context.md +1 -5
- package/tool-docs/delete.md +2 -17
- package/tool-docs/doc_check.md +2 -107
- package/tool-docs/doc_graph-read.md +3 -0
- package/tool-docs/doc_graph.md +3 -0
- package/tool-docs/doc_search.md +2 -4
- package/tool-docs/edit.md +1 -38
- package/tool-docs/eng.md +3 -1
- package/tool-docs/execute.md +2 -18
- package/tool-docs/fetch.md +2 -14
- package/tool-docs/file_ops.md +2 -18
- package/tool-docs/get_current_time.md +1 -6
- package/tool-docs/git-read.md +3 -0
- package/tool-docs/git.md +2 -35
- package/tool-docs/glob.md +2 -10
- package/tool-docs/goal.md +1 -6
- package/tool-docs/grep.md +2 -18
- package/tool-docs/hashline_edit.md +2 -15
- package/tool-docs/insert_after.md +2 -16
- 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 -10
- 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 -8
- package/tool-docs/manifest.md +2 -35
- package/tool-docs/memory-read.md +3 -0
- package/tool-docs/memory.md +2 -20
- package/tool-docs/notify_parent.md +2 -13
- package/tool-docs/peer_instances.md +3 -1
- package/tool-docs/plan.md +1 -5
- 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 -18
- package/tool-docs/read_image.md +2 -9
- package/tool-docs/recent_changes.md +2 -2
- package/tool-docs/repo_outline.md +2 -2
- package/tool-docs/settings-read.md +3 -0
- package/tool-docs/settings.md +1 -12
- package/tool-docs/skill.md +2 -6
- package/tool-docs/ssh.md +1 -62
- package/tool-docs/subagent.md +2 -100
- package/tool-docs/task.md +1 -7
- package/tool-docs/team_ledger-read.md +3 -0
- package/tool-docs/team_ledger.md +3 -9
- package/tool-docs/timer.md +2 -19
- package/tool-docs/tree.md +2 -13
- package/tool-docs/verify.md +2 -12
- package/tool-docs/wait_for.md +2 -32
- package/tool-docs/websearch.md +2 -19
- package/tool-docs/write.md +2 -12
- package/tools/browser.mjs +54 -9
- package/tools/doc-write-gate.mjs +73 -0
- package/tools/edit-batch.mjs +170 -92
- package/tools/edit-diff.mjs +78 -62
- package/tools/edit-receipt.mjs +39 -0
- package/tools/execute.mjs +3 -3
- package/tools/file.mjs +28 -14
- package/tools/git.mjs +36 -21
- package/tools/index.mjs +6 -0
- package/tools/knowledge.mjs +143 -0
- package/tools/linter.mjs +3 -3
- package/tools/ops.mjs +5 -3
- package/tools/patch.mjs +124 -44
- package/tools/process-doc-mark.mjs +33 -4
- package/tools/repomap.mjs +25 -3
- package/tools/search.mjs +74 -26
- package/tools/shared.mjs +29 -27
- package/tools/ssh.mjs +5 -5
- package/tools/tree.mjs +32 -10
- package/tools/web-deepseek.mjs +1 -1
- package/tools/web.mjs +2 -2
- package/tools/write-gate-params.mjs +31 -0
- package/tools/write-path.mjs +16 -4
- package/window-policy.mjs +243 -0
- package/doc-check/anchors.mjs +0 -235
package/agent-tools/advisor.mjs
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* The agent calls this explicitly to get an independent review.
|
|
4
4
|
* The top-level `type` is REQUIRED and must be exactly "code" or "design"
|
|
5
5
|
* (F30 fail-closed — no silent default; ADVISOR-GUARDS.md §2.4).
|
|
6
|
-
* AGENT-LOOP-ASYNC-POOL.md §6.10 (R13 — async advisor):
|
|
7
|
-
* background pool
|
|
8
|
-
*
|
|
6
|
+
* AGENT-LOOP-ASYNC-POOL.md §6.10 (R13 — async advisor): `async` is REQUIRED — `true` launches the
|
|
7
|
+
* review into the background pool at depth 0, `false` forces the blocking review (omitting it is
|
|
8
|
+
* refused: a default here would decide for the caller); depth>0 (eng-coder self-review) stays
|
|
9
|
+
* synchronous always.
|
|
9
10
|
*/
|
|
10
11
|
import { runAdvisorReview, advisorIncompleteMarker, ADVISOR_LAUNCH_REFUSAL_PREFIX } from "../advisor/run.mjs"
|
|
11
|
-
import { readFileSync } from "node:fs"
|
|
12
|
-
import { countRoundBlocks } from "./batch-skeleton.mjs"
|
|
13
12
|
import { resolveBatchDocPath } from "./batch.mjs"
|
|
14
13
|
// 设计评审的文档受理面单源 = review-facts.mjs 的 resolveReviewDocPaths(判据正文 =
|
|
15
14
|
// docs/core/design/ADVISOR-GUARDS.md §12:相对形按会话项目根 / 绝对形照用 / 受理 = 项目内现存 `.md`)。
|
|
@@ -37,21 +36,8 @@ import { DESC } from "../tools/shared.mjs"
|
|
|
37
36
|
export { validateDesignToken } from "./advisor-async.mjs"
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
|
-
*
|
|
41
|
-
* 已有的轮次块数(块计数单源 = `countRoundBlocks`);未绑 / 读不到 ⇒ `null`——读不到不等于
|
|
42
|
-
* 「没有记录要验」,结算面的 §3 落地门据此判 `batch-unreadable`。每轮发起刷新:同一实例的修轮
|
|
43
|
-
* 是新的一轮,基线随之推进(否则上一轮留下的块会让本轮一字未写也过门)。
|
|
39
|
+
* `batchDoc` 缺失形态(缺失 ∥ `null` ∥ 空串 ∥ 纯空白——非字符串不在此判,留给 `resolveBatchDocPath` 的既有文案)。
|
|
44
40
|
*/
|
|
45
|
-
function section3BlocksBaseline(batchDocAbs) {
|
|
46
|
-
if (typeof batchDocAbs !== "string" || !batchDocAbs) return null
|
|
47
|
-
try {
|
|
48
|
-
return countRoundBlocks(readFileSync(batchDocAbs, "utf8"), 3)
|
|
49
|
-
} catch {
|
|
50
|
-
return null
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** `batchDoc` 缺失形态(缺失 ∥ `null` ∥ 空串 ∥ 纯空白——非字符串不在此判,留给 `resolveBatchDocPath` 的既有文案)。 */
|
|
55
41
|
function missingBatchDoc(raw) {
|
|
56
42
|
return raw === undefined || raw === null || (typeof raw === "string" && raw.trim() === "")
|
|
57
43
|
}
|
|
@@ -113,14 +99,14 @@ export const advisorTool = {
|
|
|
113
99
|
type: { type: "string", enum: ["code", "design"], description: "Review type (required): 'design' for design doc review, 'code' for code review. Omitting it is refused — there is no default." },
|
|
114
100
|
async: {
|
|
115
101
|
type: "boolean",
|
|
116
|
-
description: "Background review:
|
|
102
|
+
description: "Background review: Required — `true` = review in the background (ack now, report via digest); `false` = the blocking review; omitting it is refused. depth>0 → always sync: an explicit `async: true` there is refused.",
|
|
117
103
|
},
|
|
118
104
|
object: {
|
|
119
105
|
type: "object",
|
|
120
106
|
properties: {
|
|
121
107
|
type: { type: "string", description: "Review type as declared by the caller (design/code)" },
|
|
122
108
|
target: { type: "string", description: "Review target — document + section, or file(s)" },
|
|
123
|
-
status: { type: "string", description: "Object state:
|
|
109
|
+
status: { type: "string", description: "Object state: pending-review / approved / implemented" },
|
|
124
110
|
reason: { type: "string", description: "Why this review runs: user-initiated / delivery verification" },
|
|
125
111
|
exclude: { type: "string", description: "Explicit exclusion list — approved/implemented items NOT in this review" },
|
|
126
112
|
},
|
|
@@ -134,11 +120,11 @@ export const advisorTool = {
|
|
|
134
120
|
documents: {
|
|
135
121
|
type: "array",
|
|
136
122
|
items: { type: "string" },
|
|
137
|
-
description: "Doc paths to review (design / requirements / referenced docs). One rule: a relative path resolves against the session project root (e.g. docs
|
|
123
|
+
description: "Doc paths to review (design / requirements / referenced docs). One rule: a relative path resolves against the session project root (e.g. docs/<area>/<name>.md); an absolute path is used as-is. Accepted = an existing .md file anywhere inside a project (a repo-root doc counts); anything else is refused with the resolved path, the reason, and the two expected forms. The advisor reviews ONLY these — no git diff scan. Use for both review types to pass the task's docs list.",
|
|
138
124
|
},
|
|
139
125
|
batchDoc: {
|
|
140
126
|
type: "string",
|
|
141
|
-
description: "
|
|
127
|
+
description: "Optional: the batch record this review belongs to. Carrying it binds the review to that record on either track. On a design review the settlement writes the round's block into that record's §3 (tool stamp + a settlement header line + the review verbatim) in the same stroke that decides the token, and the reviewer gets no batch tool in engineering mode; a code review bound to a record keeps the §3 write channel (there is no settlement to write for it), and so does a reviewer in normal mode. A design review that omits it is refused at launch (a token with no batch has no closer); a path that does not resolve to a readable file is refused. Relative paths resolve against the session cwd first, then candidate project roots (project-root-relative e.g. <repo>/docs/batches/…, or absolute). A tool-face batch — delivered files are scripts / tests / CI, no design doc — runs on the code track and passes this same parameter together with `paths` = the delivered files.",
|
|
142
128
|
},
|
|
143
129
|
},
|
|
144
130
|
required: ["type"],
|
|
@@ -168,6 +154,12 @@ export const advisorTool = {
|
|
|
168
154
|
})
|
|
169
155
|
}
|
|
170
156
|
const reviewType = args.type
|
|
157
|
+
// §6.10 (R13):`async` 必填——**参数级拒判放在类型门之后、账链门之前**(缺参不该先花一次台账查;
|
|
158
|
+
// 也不该让“先补另一个参数”成为模型的下一步)。depth 不再替调用方选。
|
|
159
|
+
if (args.async !== true && args.async !== false) {
|
|
160
|
+
if (ctx._toolCallId !== undefined) (agent._advisorRefusals ??= new Set()).add(ctx._toolCallId)
|
|
161
|
+
return "Advisor: async is required — pass true for the background review or false for the blocking review. Nothing was sent: no review instance, no round consumed, no design token minted, no LLM call."
|
|
162
|
+
}
|
|
171
163
|
// 准入门:`type="design"` 且 `batchDoc` 缺失 / 空 ⇒ 拒发(判据与拒文 = `docs/core/design/ADVISOR-GUARDS.md`
|
|
172
164
|
// §2 第 6 条);「携了须可读」那半幅随账链门(下段)一并判——判据与文案仍单源 `resolveBatchDocPath`。
|
|
173
165
|
// 绑定落 `resolved.run`(评审实例键)。
|
|
@@ -191,7 +183,8 @@ export const advisorTool = {
|
|
|
191
183
|
// 评审照发、token 照签,收口时重锚不到任何行。
|
|
192
184
|
// 批档绝对路径在本门就要用 ⇒ `resolveBatchDocPath` 从绑定行提前到此处调一次(绑定行复用同值,不二次解析);
|
|
193
185
|
// 携了不可读 ⇒ 走其既有 throw(顺序表第 3 行:可读是账链的前提,前提坏先报前提)。
|
|
194
|
-
//
|
|
186
|
+
// 代码评审不走本门(账链门仍只判设计轨——代码轨不签 token,没有可关之物)。绑定面则与轨无关:
|
|
187
|
+
// 携 `batchDoc` 即在绑定行落 `resolved.run.batchDoc`(判据单源 = `docs/core/design/BATCH-LEDGER-REVIEW-UNIFY.md` §2.15)。
|
|
195
188
|
let designBatchDocAbs = null
|
|
196
189
|
if (reviewType === "design") {
|
|
197
190
|
designBatchDocAbs = resolveBatchDocPath(agent.cwd, args.batchDoc)
|
|
@@ -234,7 +227,7 @@ export const advisorTool = {
|
|
|
234
227
|
const cands = [...new Set(invalid.flatMap((v) => v.candidates ?? []))]
|
|
235
228
|
if (cands.length > 0) lines.push(`Candidates: ${cands.join(" ∥ ")} — pass one explicitly (an absolute path is the surest form).`)
|
|
236
229
|
}
|
|
237
|
-
lines.push("Expected form 1 — project-root-relative: docs
|
|
230
|
+
lines.push("Expected form 1 — project-root-relative: docs/<area>/<name>.md (resolved against the session project root).", "Expected form 2 — absolute: D:\\repo\\docs\\<area>\\<name>.md (used as-is).")
|
|
238
231
|
return withIdentityLine(
|
|
239
232
|
`Advisor: design review documents must be documentation files (per the project's conventions). Invalid:\n${lines.join("\n")}`,
|
|
240
233
|
{ type: reviewType, scope: scopeSummary(documents), round: "—", criterion: "scope-not-doc" },
|
|
@@ -242,41 +235,35 @@ export const advisorTool = {
|
|
|
242
235
|
}
|
|
243
236
|
}
|
|
244
237
|
|
|
245
|
-
// §6.10 (R13 — ruling ②-3 A)
|
|
246
|
-
//
|
|
247
|
-
// an explicit async:true there is rejected, the default never flips.
|
|
248
|
-
// depth 显式校验(归一形态——判定单点:`depth` 取一次 + `asyncRequested` 显式布尔,
|
|
249
|
-
// 判定表与原逐值等价):
|
|
250
|
-
// depth 0 + 未传/true ⇒ 异步(本层默认)/ depth 0 + false ⇒ 同步;
|
|
251
|
-
// depth>0(或直调方无 depth) + 显式 true ⇒ 拒;其余 ⇒ 同步。
|
|
252
|
-
// 「无 depth」= 无 dispatch 上下文的直调方(测试/legacy)——按同步处理。
|
|
238
|
+
// §6.10 (R13 — ruling ②-3 A):depth 0 可异步、depth>0 一律同步——显式 `async:true` 在那里被拒
|
|
239
|
+
// (判据不变)。“无 depth” = 无 dispatch 上下文的直调方(测试/legacy)——按同步处理。
|
|
253
240
|
const depth = ctx?.depth ?? null
|
|
254
241
|
const asyncRequested = args.async === true
|
|
255
242
|
if (asyncRequested && depth !== 0) {
|
|
256
243
|
// 拒发登记(与 cap/池满拒同款):评审未跑——不置 called/不耗轮次(record-results
|
|
257
244
|
// 的 REFUSED 契约——advisor 评审发现 #1:拒发不得静默满足 guard)。
|
|
258
245
|
if (ctx._toolCallId !== undefined) (agent._advisorRefusals ??= new Set()).add(ctx._toolCallId)
|
|
259
|
-
return "Advisor: async reviews are only available at depth 0 — the top-level session owns the background pool; inside a child (eng-coder self-review) reviews run synchronously. Call advisor again
|
|
246
|
+
return "Advisor: async reviews are only available at depth 0 — the top-level session owns the background pool; inside a child (eng-coder self-review) reviews run synchronously. Call advisor again with async:false."
|
|
260
247
|
}
|
|
261
|
-
const isAsync = asyncRequested
|
|
248
|
+
const isAsync = asyncRequested
|
|
262
249
|
|
|
250
|
+
// BATCH-RECORD.md §4.2 评审侧批次档绑定(判据单源 = `docs/core/design/BATCH-LEDGER-REVIEW-UNIFY.md` §2.15):
|
|
251
|
+
// 绑定值在**发起时点取一次**,随后随 launch 载荷一路传下去(异步 = 条目 `batchDoc` 字段,同步 = callbacks)。
|
|
252
|
+
// 为什么不能在启动时读活字段:`resolved.run` 是实例级对象(代码轨续用同一实例)——发起①携 A 排队、
|
|
253
|
+
// 发起②携 B 覆盖同一字段,槽释放后①启动读到 B,评审就把裁定写进一本它没被指派的档。
|
|
254
|
+
// 不携即清:这一笔不携档(缺 / null / 空串 / 纯空白)⇒ null,不继承上一笔(静默继承比没有绑定更坏)。
|
|
255
|
+
// 位置 = 实例解析之前:路径不可读 ⇒ 在建实例与记账镜之前就炸(本档不变量「零实例 / 零 token / 零槽」)。
|
|
256
|
+
const launchBatchDoc = missingBatchDoc(args.batchDoc)
|
|
257
|
+
? null
|
|
258
|
+
// 设计评审的绝对路径由账链门那一段算好(`designBatchDocAbs`——不二次解析);代码评审仍走原解析。
|
|
259
|
+
: designBatchDocAbs ?? resolveBatchDocPath(agent.cwd, args.batchDoc)
|
|
263
260
|
// Per-review instance resolution (§6.10 ③ — ruling ②-5 A): fix rounds
|
|
264
261
|
// continue the same reviewId (design = the doc-set instance's designId —
|
|
265
262
|
// slot/spawn continuity; code = the newest OPEN instance). The resolution
|
|
266
263
|
// scopes agent._advisorRound/_lastAdvisorOutput so the message builder and
|
|
267
264
|
// the run.mjs cap read THIS instance's round/prior (multi-review isolation).
|
|
268
265
|
const resolved = resolveAdvisorLaunch(agent, reviewType, { documents })
|
|
269
|
-
|
|
270
|
-
// `batchDoc`(判据 = `docs/core/design/ADVISOR-GUARDS.md` §2 第 6 ∥ 7 条),本段只剩绑定落 `resolved.run`
|
|
271
|
-
// (评审实例键,与 reviewType/round/designId 同族)——并发设计评审各绑各档,不用单值会话态
|
|
272
|
-
// (BATCH-RECORD.md §4.7 #6)。
|
|
273
|
-
if (args.batchDoc !== undefined && args.batchDoc !== null) {
|
|
274
|
-
// 设计评审的绝对路径由账链门那一段算好(`designBatchDocAbs`——不二次解析);代码评审仍走原解析。
|
|
275
|
-
resolved.run.batchDoc = designBatchDocAbs ?? resolveBatchDocPath(agent.cwd, args.batchDoc)
|
|
276
|
-
}
|
|
277
|
-
// §3 点火基线(ADVISOR-GUARDS.md §1.1 判据 1):结算面判「§3 已被本轮写过」需要「本轮之前有几块」
|
|
278
|
-
// 这个点——只在点火拍可得(结算时再读只能得到「现在有几块」)。两轨同源(`run` 由池条目透传)。
|
|
279
|
-
resolved.run.section3BlocksAtStart = section3BlocksBaseline(resolved.run.batchDoc)
|
|
266
|
+
resolved.run.batchDoc = launchBatchDoc
|
|
280
267
|
// Design token minted for EVERY design round — the reviewer echoes it only on
|
|
281
268
|
// a clean pass; on pass it is slotted under the instance's designId at settle
|
|
282
269
|
// (sync: right here; async: the settle callback — fix #2). A NEW instance
|
|
@@ -293,6 +280,8 @@ export const advisorTool = {
|
|
|
293
280
|
const ack = launchAsyncAdvisor(agent, ctx, {
|
|
294
281
|
reviewType, documents, paths, object: reviewObject,
|
|
295
282
|
designToken, designId, run: resolved.run,
|
|
283
|
+
// 逐笔绑定快照:条目持此值,`entry.start()` 不再读活的 `run.batchDoc`(排队窗口的值会被后一笔覆盖)。
|
|
284
|
+
batchDoc: launchBatchDoc,
|
|
296
285
|
})
|
|
297
286
|
if (ack.error) {
|
|
298
287
|
// Pool-full refusal (②-6a — no queueing): the review did NOT launch — the
|
|
@@ -336,8 +325,8 @@ export const advisorTool = {
|
|
|
336
325
|
const result = await runAdvisorReview(agent, reviewType, {
|
|
337
326
|
onOutput: ctx.onOutput,
|
|
338
327
|
signal: ctx.signal,
|
|
339
|
-
//
|
|
340
|
-
batchDoc:
|
|
328
|
+
// 同步路径的绑定传递 = 同一逐笔值(异步路径走条目 `batchDoc` 字段,同值同形)。
|
|
329
|
+
batchDoc: launchBatchDoc,
|
|
341
330
|
}, designToken, documents, paths, reviewObject, designId)
|
|
342
331
|
|
|
343
332
|
// B 启动拒绝(稳定前缀):拒发登记(同池满 / cap 款——不置 called、不耗轮次),
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* `../log.mjs`——叶子向、无环。
|
|
43
43
|
*/
|
|
44
44
|
import { carrierField, getAsyncPool, parentAborted, writeTombstone } from "./async-settle.mjs"
|
|
45
|
-
import {
|
|
45
|
+
import { pushInject, pushRecord } from "../context.mjs"
|
|
46
46
|
import { escapeXml } from "../agent/helpers.mjs"
|
|
47
47
|
import { logEvent } from "../log.mjs"
|
|
48
48
|
// #9(后台 bash 任务族——收尾档②):杀单点(树杀)经 `bash-async.mjs` 落面。
|
|
@@ -127,7 +127,12 @@ function discardRole(parent, spec, ctx) {
|
|
|
127
127
|
// `pushReal`(机器 + 人读双线);**history 数组本体形**(VSC 挂起载体——池挂数组)无注入目标 ⇒
|
|
128
128
|
// 跳过(与对侧 VSC copy 的 `parent?.history` 守卫同判;§6.20.1「carrier 形无注入目标」先例)
|
|
129
129
|
// ——墓碑与 `ev:discarded` 照发,仅模型可见提醒缺席(数组形无人读线可达面)。
|
|
130
|
-
if (parent?.history)
|
|
130
|
+
if (parent?.history) {
|
|
131
|
+
const msg = { role: "user", content: spec.reminder(out.discarded.length, escapeXml(list)) }
|
|
132
|
+
// B 段:一次性投递走待发队,持久写入只落人读线。
|
|
133
|
+
pushInject(parent, msg)
|
|
134
|
+
pushRecord(parent, msg)
|
|
135
|
+
}
|
|
131
136
|
logEvent("ev:discarded", { n: out.discarded.length, ids: out.discarded.map((d) => `${d.role}#${d.id}`).join(", ") })
|
|
132
137
|
return out
|
|
133
138
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* escalate-async/consult)单向 import 本模块;scheduler 反向 import 本模块(getAsyncPool)
|
|
24
24
|
* 与既有 scheduler ↔ subagent-async 同款惰性环——无求值期依赖。
|
|
25
25
|
*
|
|
26
|
-
* S1 续轮第二批(2026-09-14——异步机械族 VSC 侧并入,AGENT-LOOP.md §
|
|
26
|
+
* S1 续轮第二批(2026-09-14——异步机械族 VSC 侧并入,AGENT-LOOP.md §9.1 载体字段):
|
|
27
27
|
* - #94 载体吸收:`carrierField`(父对象字段优先 / 回退 `history`——VSC 形跨 runAgent
|
|
28
28
|
* 载体)+ 墓碑三函数单点(`writeTombstoneTo` / `writeTombstone` / `tombstoneOf`,
|
|
29
29
|
* 原核内 3 处 inline 写全部收口);`getAsyncPool` / `parkAsyncPending` 走吸收。
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
* `bindChildController` = 链结单点(原 4 处逐字同构,interrupt 不逐链中止)。
|
|
32
32
|
*/
|
|
33
33
|
import { logEvent, errText } from "../log.mjs"
|
|
34
|
-
import {
|
|
34
|
+
import { pushInject, pushRecord } from "../context.mjs"
|
|
35
35
|
import { escapeXml } from "../agent/helpers.mjs"
|
|
36
36
|
import { TURN_CAP_MARK } from "../agent/spawn-child.mjs"
|
|
37
37
|
import { dependentLabels, maybeRefillAsync, refreshQueuedTokens } from "./subagent-scheduler.mjs"
|
|
38
38
|
// ED-4(2026-09-16):advisor 排队补位——同 scheduler ↔ 本模块惰性环(函数声明提升——无求值期依赖)
|
|
39
39
|
import { refillAdvisorQueue } from "./advisor-async.mjs"
|
|
40
40
|
|
|
41
|
-
// ─── #94 载体吸收(VSC 侧并入——AGENT-LOOP.md §
|
|
41
|
+
// ─── #94 载体吸收(VSC 侧并入——AGENT-LOOP.md §9.1 载体字段)───────────────
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* 载体字段读取吸收(#94——「VSC 的跨 runAgent 存活载体面按核内结构归一」):
|
|
45
|
-
* §
|
|
46
|
-
* `_pendingAsyncResults` · `_suspended`(AGENT-LOOP.md §
|
|
45
|
+
* §9.1 载体口径 = `_asyncSubagents` · `_asyncAdvisors` · `_consultSessions` ·
|
|
46
|
+
* `_pendingAsyncResults` · `_suspended`(AGENT-LOOP.md §9.1);#9 后台任务池
|
|
47
47
|
* `_bgTasks` 同列(写侧父字段 + 借用/别名 history——见 `bash-async.mjs` `ensureBgPool`)。
|
|
48
48
|
* CLI 形:字段直接挂 agent(跨 run 存活);VSC 形:字段挂 depth-0 `history`
|
|
49
49
|
* (agent per-run 重建——run 起始把 history 容器绑到 agent 字段,绑定不变式)。
|
|
@@ -171,7 +171,7 @@ export function buildChildSignal(parent, ctx) {
|
|
|
171
171
|
// ─── D3 settle 共享 helper ───────────────────────────────────────────────────
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
* AGENT-LOOP.md §
|
|
174
|
+
* AGENT-LOOP.md §9 消化窗口持有释放(TUI-OOM-ROOTCAUSE——D-SM2 表 2 候选 1):注入完成后置空条目
|
|
175
175
|
* 对子代理对象的引用(`childAgent`/`report`——条目前此从不显式释放,挂起期 = 分钟级驻留)。
|
|
176
176
|
* 幂等(重入不抛);池内/挂起未消化窗口语义零变(settle 时刻不释放——表 2 候选 2 否决:
|
|
177
177
|
* status/observe 在窗口内仍读 child 摘要)。三消费点(回合尾收集 / run 起始 pending 注入 /
|
|
@@ -267,25 +267,31 @@ export function settleAsyncEntry(parent, entry, opts = {}) {
|
|
|
267
267
|
ctx?.callbacks?.onToken?.(`${entry.relayPrefix}⟦ev⟧stopped\x1e0\x1e0\x1estopped\x1e`)
|
|
268
268
|
if (role === "advisor") {
|
|
269
269
|
// ②-6b:评审取消——token 未签发提醒(settleAdvisorRun 不消费预算)。
|
|
270
|
-
|
|
270
|
+
const msg300 = {
|
|
271
271
|
role: "user",
|
|
272
272
|
content: `[System reminder: async advisor review #${escapeXml(String(entry.id))} cancelled — the review did not settle; token not issued (评审已取消——token 未签发)]`,
|
|
273
|
-
}
|
|
273
|
+
}
|
|
274
|
+
pushInject(parent, msg300)
|
|
275
|
+
pushRecord(parent, msg300)
|
|
274
276
|
} else if (role === "escalate") {
|
|
275
|
-
|
|
277
|
+
const msg275 = {
|
|
276
278
|
role: "user",
|
|
277
279
|
content: `[System reminder: async escalate #${entry.id} (${entry.tag}) cancelled by user — partial changes not merged/audited]`,
|
|
278
|
-
}
|
|
280
|
+
}
|
|
281
|
+
pushInject(parent, msg275)
|
|
282
|
+
pushRecord(parent, msg275)
|
|
279
283
|
} else {
|
|
280
284
|
// §6.9 D-SD5:running 依赖取消——提醒列出依赖者(供模型决策)。
|
|
281
285
|
const dependents = dependentLabels(parent, String(entry.id))
|
|
282
286
|
const autoNote = parent.autoApprove
|
|
283
287
|
? " — AUTO session: they auto-start on slot availability (round2 #3)"
|
|
284
288
|
: " — they stay queued until you cancel them or an AUTO session starts them"
|
|
285
|
-
|
|
289
|
+
const msg285 = {
|
|
286
290
|
role: "user",
|
|
287
291
|
content: `[System reminder: subagent ${escapeXml(role)}#${entry.id} cancelled by user — partial changes not merged/audited${dependents.length > 0 ? `; queued dependents ${dependents.join(", ")} marked "dependency cancelled"${autoNote}` : ""}]`,
|
|
288
|
-
}
|
|
292
|
+
}
|
|
293
|
+
pushInject(parent, msg285)
|
|
294
|
+
pushRecord(parent, msg285)
|
|
289
295
|
}
|
|
290
296
|
} else if (!aborted) {
|
|
291
297
|
// 族记账 hook(advisor 陈旧判定/token D1 落盘;escalate 三分类 merge 决策;subagent/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* audit-block.mjs — 审计块构造器(AGENT-LOOP-SUBAGENT.md §6.26 · 台账 #23)。
|
|
3
3
|
*
|
|
4
|
-
* 自 `subagent-spawn.mjs` **逐字搬移**(D23-3 外提:spawn 档越 300
|
|
4
|
+
* 自 `subagent-spawn.mjs` **逐字搬移**(D23-3 外提:spawn 档越 300 行线 + 块构造成纯函数
|
|
5
5
|
* ⇒ 判据可直测;D23-4:块内文本零改——含块内自指词,整块搬移不改真值)。本档承载
|
|
6
6
|
* spawn 级固定机制性指令的第二块(审计模板 + 批档 §2 指向 + touched 快照):
|
|
7
7
|
* 装配侧只收集(`thincoder-core/agent-tools/subagent-spawn.mjs`),下发面 = system 固块
|
|
8
8
|
* (`child._spawnSystemBlock` → 核 `prepareRun` 拼接——`thincoder-core/agent/setup.mjs`)。
|
|
9
9
|
*
|
|
10
|
-
* 2026-10-24(§6.22 KD-SC6):任务书 =
|
|
10
|
+
* 2026-10-24(§6.22 KD-SC6):任务书 = 绑定批档,按角色切片(§8.1 现行;本块只引交付任务书 = §2);A2 拼装摘要面(按 marker 抽取
|
|
11
11
|
* 设计档 / 文件清单 / 验收三段)已随 KD-SC6 删除——审计块只注入批档路径行 + §2 指向句(路径取
|
|
12
12
|
* `ctx.agent._batchDoc`)。理由:工程角色 `_engTaskInput` 只剩一行机械文本,摘要失去来源。
|
|
13
13
|
*/
|
|
@@ -37,7 +37,7 @@ export function buildAuditBlock(ctx) {
|
|
|
37
37
|
`workspace changes not listed there are unrelated to this delivery and are NOT grounds for an out-of-list finding.\n` +
|
|
38
38
|
`Scope discipline (F-TS6 A1): read ONLY the audited files and the design-doc sections relevant to this delivery — do NOT re-read whole documents.\n` +
|
|
39
39
|
`Every deviation item MUST be fieldized: file:line + design reference (doc path + section/AC id) + severity + evidence (quoted code or doc text).\n` +
|
|
40
|
-
// §6.22 KD-SC6:任务书 =
|
|
40
|
+
// §6.22 KD-SC6:任务书 = 绑定批档,按角色切片(§8.1)——审计块注入批档路径 + 交付任务书 §2 的指向句
|
|
41
41
|
// (A2 拼装摘要面已删:工程角色 _engTaskInput = 一行机械文本,摘要无来源)。审计子代理本身是
|
|
42
42
|
// explore(任务书 = 父侧五项)——故指向句限定为「**交付**的任务书 = §2」,不冒称本 child 的唯一通道。
|
|
43
43
|
`Batch record (batchDoc): ${batchDoc}\n` +
|
|
@@ -49,9 +49,9 @@ export function buildAuditBlock(ctx) {
|
|
|
49
49
|
"Zero-git scope authority: this audit task receives NO git context — nothing is injected. " +
|
|
50
50
|
"The evidence base is the design documents, the current disk state (read/glob/grep), and the _touchedFiles list above. " +
|
|
51
51
|
"Workspace changes NOT listed in _touchedFiles are unrelated to this delivery — they are NOT grounds for an out-of-file-list finding." +
|
|
52
|
-
// §6.7.6
|
|
53
|
-
//
|
|
54
|
-
// 前导 \n
|
|
52
|
+
// §6.7.6(AGENT-LOOP-SUBAGENT.md):审计预算句——审计指令模板 + 批档指向块之后、审计报告模板之前(定序——评审 #7)。
|
|
53
|
+
// 逐字设计锚(§6.7.6 的「审计效率」行):只读该读的——10 轮机械预算——超时报 PROBLEM 下结论。
|
|
54
|
+
// 前导 \n 与审计报告模板同款块分隔约定(上一句 Zero-git 句末无换行——不触碰既有句)。
|
|
55
55
|
`\n[Audit budget — mechanical]: read ONLY the touched files listed above and the design-doc sections the parent task book names (affected-files table, acceptance criteria, status line). Do NOT read whole documents. Budget = 10 tool rounds max — if you cannot conclude within it, report PROBLEM (inconclusive) rather than continuing to explore.\n` +
|
|
56
56
|
// §6.7.6 D-TS6 A3:审计输出报告格式模板(三态——字段化行——不让模型自由发挥)。
|
|
57
57
|
`\n[Audit report format — mechanical template:]\n` +
|
|
@@ -35,7 +35,7 @@ import { join } from "node:path"
|
|
|
35
35
|
import { spawn } from "node:child_process"
|
|
36
36
|
import { configDir } from "../config.mjs"
|
|
37
37
|
import { cleanupOldToolResults, escapeXml } from "../agent/helpers.mjs"
|
|
38
|
-
import {
|
|
38
|
+
import { pushInject, pushRecord } from "../context.mjs"
|
|
39
39
|
import { makeDecoder, sanitizeOutput } from "../tools/shared.mjs"
|
|
40
40
|
import { killProcessTree } from "../tools/process-tree.mjs"
|
|
41
41
|
// 过程档标记(TOOLS.md §6.28):后台径的结算摘要也是输出行——解析基准 = entry 记下的 spawn 局部 `cwd`。
|
|
@@ -247,7 +247,10 @@ export async function injectBgResult(parent, entry) {
|
|
|
247
247
|
const { text, truncated } = renderTail(entry)
|
|
248
248
|
const body = text.trim() ? escapeXml(text) : "(no output)"
|
|
249
249
|
const note = truncated ? `\n[... tail truncated — the full output is in the log: ${entry.logPath}]` : ""
|
|
250
|
-
|
|
250
|
+
const msg = { role: "user", content: `${head}\n${body}${note}` }
|
|
251
|
+
// B 段:一次性投递走待发队,持久写入只落人读线(机读线零触)。
|
|
252
|
+
pushInject(parent, msg)
|
|
253
|
+
pushRecord(parent, msg)
|
|
251
254
|
writeTombstone(parent, entry.id, entry.error != null ? "failed" : "consumed", "bg")
|
|
252
255
|
}
|
|
253
256
|
|