@thincoder/core 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -2
- package/advisor/convergence.mjs +34 -3
- package/advisor/loop.mjs +42 -10
- package/advisor/messages.mjs +42 -25
- package/advisor/project-context.mjs +171 -42
- 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 +44 -3
- package/agent/dispatch-gates.mjs +6 -0
- package/agent/dispatch.mjs +8 -3
- package/agent/family-tools.mjs +27 -12
- package/agent/helpers.mjs +122 -1
- package/agent/offload.mjs +25 -29
- package/agent/post-turn.mjs +24 -10
- package/agent/record-results.mjs +18 -1
- package/agent/run-stages.mjs +77 -32
- package/agent/run-start.mjs +37 -0
- package/agent/setup-reminders.mjs +9 -2
- package/agent/setup.mjs +24 -11
- package/agent/spawn-child.mjs +38 -1
- package/agent/timers.mjs +5 -3
- package/agent/turn-loop.mjs +30 -5
- 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-gate-ledger.mjs +569 -0
- package/agent/write-gate.mjs +29 -352
- 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 +36 -47
- package/agent-tools/audit-block.mjs +6 -6
- package/agent-tools/batch-closeout.mjs +273 -35
- package/agent-tools/batch-gate.mjs +142 -342
- package/agent-tools/batch-ledger-bind.mjs +226 -17
- package/agent-tools/batch-ledger-view.mjs +109 -0
- package/agent-tools/batch-lifecycle.mjs +169 -46
- package/agent-tools/batch-paths.mjs +29 -8
- 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 +379 -0
- package/agent-tools/batch-skeleton.mjs +192 -239
- package/agent-tools/batch-supersede.mjs +232 -0
- package/agent-tools/batch-tier-gate.mjs +297 -0
- package/agent-tools/batch.mjs +182 -439
- package/agent-tools/consult.mjs +7 -4
- package/agent-tools/context.mjs +44 -17
- 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/doc-check.mjs +43 -33
- package/agent-tools/doc-graph.mjs +140 -0
- package/agent-tools/eng.mjs +9 -8
- package/agent-tools/escalate-async.mjs +2 -2
- package/agent-tools/manifest.mjs +34 -18
- package/agent-tools/read-history.mjs +112 -11
- package/agent-tools/review-facts.mjs +10 -3
- package/agent-tools/settings.mjs +23 -2
- package/agent-tools/spawn-gates.mjs +9 -8
- package/agent-tools/ssh-session.mjs +2 -2
- package/agent-tools/ssh-text.mjs +155 -0
- package/agent-tools/ssh-transport.mjs +19 -148
- package/agent-tools/subagent-actions-query.mjs +10 -6
- package/agent-tools/subagent-async.mjs +8 -9
- 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 +4 -4
- package/agent-tools/subagent-spawn.mjs +90 -110
- package/agent-tools/subagent.mjs +11 -10
- 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 +1 -1
- package/config-defaults.mjs +2 -1
- package/config-migrate.mjs +40 -0
- package/config-normalize.mjs +28 -2
- 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 +149 -83
- package/conventions.mjs +11 -9
- package/declaration.mjs +31 -5
- 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/explore-distill.mjs +11 -5
- 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 +6 -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 +78 -19
- package/ledger-write-ops.mjs +130 -41
- package/ledger.mjs +1 -1
- package/manifest-discovery.mjs +3 -1
- package/manifest-schema.mjs +27 -5
- package/memory/schema.mjs +2 -2
- package/package.json +3 -1
- package/path-resolve.mjs +338 -57
- package/prompt-files.mjs +91 -1
- package/prompt-overlays.mjs +9 -6
- package/prompts/advisor-design.md +62 -21
- package/prompts/advisor-round1.md +34 -1
- package/prompts/advisor-round2.md +40 -7
- package/prompts/advisor-round3.md +39 -6
- package/prompts/common.md +14 -387
- package/prompts/consult-base.md +5 -1
- package/prompts/discipline-engineering.md +226 -51
- package/prompts/discipline-normal.md +4 -255
- 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 +21 -3
- package/prompts/persona-eng-designer.md +131 -169
- package/prompts/persona-engineering.md +142 -84
- package/prompts/persona-explore.md +1 -1
- package/prompts/persona-plan.md +5 -1
- package/prompts/subagent-base.md +2 -0
- package/provider/anthropic.mjs +6 -4
- package/provider/core.mjs +3 -2
- package/provider/errors.mjs +29 -4
- package/provider/google.mjs +24 -7
- package/provider/responses.mjs +3 -1
- package/provider-flows.mjs +2 -2
- 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 +72 -17
- package/session-slot-write.mjs +37 -5
- package/session.mjs +24 -8
- package/skip-dirs.mjs +2 -2
- package/team-ledger.mjs +13 -9
- package/token-ttl.mjs +73 -4
- package/token-window.mjs +167 -33
- package/tool-docs/advisor.md +2 -27
- package/tool-docs/apply_patch.md +1 -15
- package/tool-docs/bash.md +2 -41
- 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 +52 -7
- 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 +1 -1
- package/tools/file.mjs +16 -8
- package/tools/git.mjs +24 -9
- package/tools/index.mjs +6 -0
- package/tools/knowledge.mjs +143 -0
- package/tools/linter.mjs +3 -3
- package/tools/ops.mjs +3 -1
- package/tools/patch.mjs +123 -43
- package/tools/shared.mjs +28 -27
- package/tools/write-gate-params.mjs +31 -0
- package/tools/write-path.mjs +16 -4
- package/window-policy.mjs +203 -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,7 +99,7 @@ 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",
|
|
@@ -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、不耗轮次),
|
|
@@ -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` +
|
|
@@ -7,18 +7,35 @@
|
|
|
7
7
|
* 本档承载三件(都不碰 fs 写、只读与判):
|
|
8
8
|
* ① `assertCloseoutGates` —— 收口两路(`close` ∥ `status` 写 `§1 已收口`)共调的判序:
|
|
9
9
|
* 链完整性门(§2/§3/§4/§6 各段须有内容——`不适用` 声明机制已退役)→ **`§3` 状态词臂**(无条件 = `评审通过`)
|
|
10
|
-
* → 本批批内单测档门(`TESTING.md` §3.5)→
|
|
10
|
+
* → 本批批内单测档门(`TESTING.md` §3.5)→ 文档机检门(判据 = `docs/core/design/DOC-CHECK.md` §1–§6;
|
|
11
|
+
* 调用点 = 同档 §7「落点」三处之一「批档写入与收口」)→ **档位臂**
|
|
12
|
+
* (`batch-tier-gate.mjs` 的 `assertTierPlan`——同一臂两节,一条拒文:本批改动面里在盘的码档,§2 必须有
|
|
13
|
+
* 它的行读数且与批起快照一致(判法 ∥ 拒文 = `docs/core/design/DOC-CHECK.md` §8);其中实测越了收口线的
|
|
14
|
+
* 源档,§2 还必须有它的正向形分拆方案。两节判的都是**记录缺件**(越线那一节拿收口时的当前长度当触发物,
|
|
15
|
+
* 判的仍是 §2 那一格);语义单源 = `docs/core/standards/CODE-TIER.md` §2.2,位次 = 本档的判序第 ⑤ 臂)。
|
|
11
16
|
* ② `assertSectionFiveGate` —— §5 写入门(段序门):两条合取——① `§3` 状态行 = `评审通过`;② `§3` 最近一轮
|
|
12
17
|
* 轮次块自己携 pass 裁定行(块 = `lastRoundBlock`;裁定读数 = 骨架档 `verdictGapOf`,`append §3` 写入闸与
|
|
13
18
|
* 签发面读同一个函数)。旧的第一条旁路(`§1` 声明 §3 不适用)已随本批删除:实现只发生在评审之后,没有例外段。
|
|
14
19
|
* ③ `reanchorReceiptLine` —— 收口重锚回执三行(§2.11 逐字)。
|
|
20
|
+
* ④ **全归档补关面**(§4.18-C · `docs/core/design/LEDGER.md` §11.2):拒文 `repairBlockedError`、档面
|
|
21
|
+
* 追记行 `repairTraceLine` 与回执段 `repairReceiptLine`。补关只跳过收口门的 ①②⑤ 三臂,③④ 与写序、
|
|
22
|
+
* 凭证消费、完成清单预检全部保留——「行全归档」不是「环节全免」;分派判据住 `batch-ledger-view.mjs`。
|
|
15
23
|
*
|
|
16
24
|
* 为什么 §3 内容臂留着(不换成只判状态词):内容臂守的是「段里真跑过」,状态词臂守的是「跑的结论是
|
|
17
25
|
* pass」——换掉内容臂 = 门被放宽(一段空着但状态词对就过),那正是本批要堵的洞。所以是**加**一条臂。
|
|
18
26
|
*
|
|
19
27
|
* 依赖单向(KD-4):`skeleton ← closeout ← bind ← reopen ← lifecycle`——本档不 import lifecycle。
|
|
20
28
|
*/
|
|
29
|
+
import { execFileSync } from "node:child_process"
|
|
21
30
|
import { readFileSync } from "node:fs"
|
|
31
|
+
import { isAbsolute, relative, resolve } from "node:path"
|
|
32
|
+
|
|
33
|
+
import { owningProject } from "../manifest.mjs"
|
|
34
|
+
import { batchProjectRoot } from "./batch-paths.mjs"
|
|
35
|
+
// 取材面的判据一族(比较键 ∥ 显示式 ∥ 三处判据)——依赖单向:本档 import 它,它不 import 本档。
|
|
36
|
+
import {
|
|
37
|
+
displayRelOf, neighborListClaims, selfAttributedOf, sessionClaimsOf, surfaceKey,
|
|
38
|
+
} from "../agent/batch-changed-surface.mjs"
|
|
22
39
|
|
|
23
40
|
import {
|
|
24
41
|
countRoundBlocks, inapplicableDeclarationError, lastRoundBlock, malformedInapplicableLine, readSectionStatusWord,
|
|
@@ -27,7 +44,10 @@ import {
|
|
|
27
44
|
// 裁定读数 = 骨架档 `verdictGapOf` 一个函数(设计档 §2.6.1「判据单源」):`§5` 门判据 2 与签发面判的是同一份
|
|
28
45
|
// 回执文本,组合序各写一遍必然一处变一处不变。本档不再 import 两条裁定锚——锚与序都在那个函数里。
|
|
29
46
|
import { assertUnitTestFilesCleared } from "./batch-unit-test-gate.mjs"
|
|
30
|
-
import {
|
|
47
|
+
import { assertTierPlan } from "./batch-tier-gate.mjs"
|
|
48
|
+
import { baseShaOf, gateRefusalMessage, runBatchGate } from "./batch-gate.mjs"
|
|
49
|
+
// 本批提交 diff 腿(现成的改动面——不另造一套登记):`committedDocs` 与本档无依赖方向冲突。
|
|
50
|
+
import { committedDocs } from "./batch-regions.mjs"
|
|
31
51
|
|
|
32
52
|
/** 链判段集(§2/§3/§4/§6——§5 段号豁免恒不判;§1 主 agent 自述段不设前置)。 */
|
|
33
53
|
const CHAIN_SEGMENTS = [2, 3, 4, 6]
|
|
@@ -70,30 +90,223 @@ export function assertCloseoutChainComplete(src) {
|
|
|
70
90
|
}
|
|
71
91
|
|
|
72
92
|
/**
|
|
73
|
-
* 收口两路共调判序(设计档 §2.4–§2.6 · 2026-10-27
|
|
93
|
+
* 收口两路共调判序(设计档 §2.4–§2.6 · 2026-10-27 四道门 + 2026-11-11 第 ⑤ 臂):
|
|
74
94
|
* ① 链完整性门(§2 / §3 / §4 / §6 各段须有内容)
|
|
75
95
|
* ② **`§3` 状态词臂**:`§3` 状态行 = `评审通过`(无条件)
|
|
76
96
|
* ③ 本批批内单测档门(仍在盘 ⇒ 拒——零留存的结构兜底)
|
|
77
97
|
* ④ 文档机检门(REFUSED ∥ ERROR ⇒ 拒)
|
|
78
|
-
*
|
|
79
|
-
*
|
|
98
|
+
* ⑤ **档位臂**(`batch-tier-gate.mjs` 的 `assertTierPlan`):两节一趟判完,一条拒文——
|
|
99
|
+
* ① 读数支:本批改动面里在盘的码档,§2 机读清单那一行须带行读数且与**批起快照**一致;
|
|
100
|
+
* ② 越线方案支:其中实测越了收口线的档,§2 须带它的正向形分拆方案。无在盘码档就两节都不启动
|
|
101
|
+
* (**§2 缺块不是拒因**)。
|
|
102
|
+
* 基线内容由本档交进去(`baseTextReaderOf`——门自己不读 git)。
|
|
103
|
+
* 位次 = 既有拒因之后、写盘之前(任一被拒 ⇒ 档字节不变)。返回 `④` 的门结果供回执拼行(`null` = 未跑);
|
|
104
|
+
* `mode === "normal"` 时同一笔把 ⑤ 的取材读数挂上 `changedSurface`,回执行从它取「只报不判」的那一半。
|
|
105
|
+
* @param {{abs:string, cwd:string, agent:object, src:string, action:"close"|"status", mode?:"normal"|"repair"|"supersede"}} o
|
|
80
106
|
* `src` = 调用方已读的写盘前全文(判据与写盘读同一份字节,不二次读盘)。
|
|
107
|
+
* `mode` = **哪一条收口边在跑**(三值闭集;跳过集由这一处决定):
|
|
108
|
+
* `normal` = 正常收口(五臂全跑)∥ `repair` = 全归档补关(§4.18-C)∥ `supersede` = 被取代的收口(§4.18-D)。
|
|
109
|
+
* `repair` ∥ `supersede` 两条都**只跳过 ①②⑤ 三臂**,③④ 照跑——补关与取代按定义没有可判的 §2,
|
|
110
|
+
* 而单测档门与机检门在那两条边上照旧生效;分派判据不在这里
|
|
111
|
+
* (补关住 `batch-ledger-view.mjs` 的一致性预读,取代由 `batch-supersede.mjs` 自己持),本档只承接
|
|
112
|
+
* 「已判定走哪条边」之后的判序。
|
|
81
113
|
* @returns {object|null} 文档机检门结果
|
|
82
114
|
*/
|
|
83
|
-
export function assertCloseoutGates({ abs, cwd, agent, src, action = "close" }) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
export function assertCloseoutGates({ abs, cwd, agent, src, action = "close", mode = "normal" }) {
|
|
116
|
+
if (mode === "normal") {
|
|
117
|
+
assertCloseoutChainComplete(src) // ① 链门(§2 / §3 / §4 / §6 各段须有内容)
|
|
118
|
+
// ② §3 状态词臂(无条件):评审须真跑过并给 pass。旧旁路「§1 声明 §3 不适用」已随声明机制退役删除。
|
|
119
|
+
const s3 = readSectionStatusWord(src, 3)
|
|
120
|
+
if (s3 !== STATUS_WORDS[3].done) throw new Error(closeoutS3Error(s3 ?? "(无状态行)"))
|
|
121
|
+
}
|
|
88
122
|
assertUnitTestFilesCleared(abs, action) // ③
|
|
89
123
|
const gate = runBatchGate({ abs, cwd, agent, scope: "close" }) // ④
|
|
90
124
|
if (gate.state === "refused" || gate.state === "error") throw new Error(gateRefusalMessage(gate, action))
|
|
125
|
+
// ⑤ 档位臂:与 ①② 同属 `mode === "normal"` 组(`repair` ∥ `supersede` 按定义没有可判的 §2)。
|
|
126
|
+
if (mode === "normal") {
|
|
127
|
+
const root = tierRootOf(abs, cwd)
|
|
128
|
+
const surface = changedSurface(abs, root, agent)
|
|
129
|
+
assertTierPlan(src, root, surface.judged, baseTextReaderOf(abs, root))
|
|
130
|
+
// 只报不判的那一半随门结果交回调用面(同一笔取材,不取第二次——两次取才可能各说各的)。
|
|
131
|
+
gate.changedSurface = surface
|
|
132
|
+
}
|
|
91
133
|
return gate
|
|
92
134
|
}
|
|
93
135
|
|
|
136
|
+
/**
|
|
137
|
+
* 本批 diff 腿读不出的拒文(判据单源 = 设计档 §4.18.1「提交 diff 读不出 ⇒ 拒收口,不静默少一腿」)。
|
|
138
|
+
* 三件必须点在串里:**根**(在哪儿跑)、**批起 sha**(拿什么比)、**下一步**(`git diff --name-only <sha> HEAD`
|
|
139
|
+
* 看 git 报什么),收尾句 = `Nothing was written.`。
|
|
140
|
+
* 为什么必须拒:`committedDocs` 的失败面是 `ok: false` + 空集;空集若被读成「本批没有提交改动」,不经记账工具
|
|
141
|
+
* 写的档(`bash` ∥ `execute` 落盘的、脚本生成的)就一档都判不到,而收口照样把记录冻成历史——业务失败变成功。
|
|
142
|
+
* 只属**本批自己的**这一笔:邻批那几笔读不出不拒(见 `batch-changed-surface.mjs` 的 `neighborListClaims`)。
|
|
143
|
+
* @param {string} root 项目根(拒文点名的那个根)
|
|
144
|
+
* @param {string} baseSha 本批批起 sha(`baseShaOf` 的返回形,此处必非 `null`)
|
|
145
|
+
*/
|
|
146
|
+
export function changedSurfaceUnreadableError(root, baseSha) {
|
|
147
|
+
return "batch: 本批改动面读不出(changed surface unreadable)— close refuses: this batch's own commit-diff leg " +
|
|
148
|
+
`could not be read at root ${root} with base sha ${baseSha}, so the changed surface has no diff side left. ` +
|
|
149
|
+
"Closing now would freeze the record while the files written outside the ledger (files dropped by `bash` / `execute` / a script) were never judged — " +
|
|
150
|
+
"an unread diff must not pass for \"this batch committed nothing\". " +
|
|
151
|
+
`下一步:在该根跑 \`git diff --name-only ${baseSha} HEAD\`,看 git 报什么(批起 sha 指向的对象在不在 ∥ 这个目录还在不在仓里),修好后再收口。 ` +
|
|
152
|
+
"Nothing was written."
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 本批改动面(**取材 = 现成两面,按批判**;判据单源 = 设计档 §4.18.1)——交绝对路径,供档位臂量长度。
|
|
157
|
+
*
|
|
158
|
+
* 两腿,**判据一在前**:
|
|
159
|
+
* 判据一 = 写时归属(记账面记下的「这笔写服务哪一批」,取自 `agent._batchAttribution`);
|
|
160
|
+
* 判据二 = 提交 diff,按认领收窄:减去**别的批已认领**的档。认领两源对批档状态的要求不同——观测源
|
|
161
|
+
* (本会话归属表里别的批档)不看那一批收没收口;计划源(盘上批档的 §2 机读清单)**状态可读即收**,
|
|
162
|
+
* 上界随状态定:未收口取 HEAD、已收口取那份批档自己的最后一次提交(取不到就不认领)。
|
|
163
|
+
* 三条合成规则:
|
|
164
|
+
* - 归属表里属本档 ⇒ **判**(一条直接的写记录不被另一个批的计划推翻);
|
|
165
|
+
* - 归属表里没有它、认领成立 ⇒ **不判,只报**(收口回执点名它,请人确认是否本批);
|
|
166
|
+
* - 两腿都不说话 ⇒ **判**(认领不成立就当它是本批的,fail-closed)。
|
|
167
|
+
* 触达账条目本就是绝对路径(写工具记账);提交清单以 **git 仓根**为基,故按 `committedDocs` 回的 `base`
|
|
168
|
+
* 还原成绝对路径——项目根住大仓子目录时也不丢条目。基 sha 未定 ⇒ 只以触达账为准(diff 腿不启动);
|
|
169
|
+
* **基 sha 有了却读不出**(`committed.ok === false`)⇒ 抛拒(`changedSurfaceUnreadableError`),不静默少一腿:
|
|
170
|
+
* 空集若被当成「本批没有提交改动」,不经记账工具写的档就一档都判不到,而收口照样冻记录。
|
|
171
|
+
* 拒收口只属**本批自己的这一笔**:邻批那几笔读不出由 `neighborListClaims` 按「认领不成立」处置。
|
|
172
|
+
* @returns {{root:string, judged:string[], reported:string[]}} `judged` = 交给档位臂判读数的档;
|
|
173
|
+
* `reported` = 认领成立、只进回执行的档(绝对路径)
|
|
174
|
+
*/
|
|
175
|
+
export function changedSurface(abs, root, agent) {
|
|
176
|
+
const touched = Array.isArray(agent?._touchedFiles) ? agent._touchedFiles : []
|
|
177
|
+
const baseSha = baseShaOf(abs)
|
|
178
|
+
const diff = []
|
|
179
|
+
if (baseSha !== null) {
|
|
180
|
+
const committed = committedDocs(root, baseSha)
|
|
181
|
+
if (!committed.ok) throw new Error(changedSurfaceUnreadableError(root, baseSha))
|
|
182
|
+
for (const f of committed.files ?? []) diff.push(resolve(committed.base, f))
|
|
183
|
+
}
|
|
184
|
+
// 同一档两腿都会给(触达账记过又提交过):按比较键去重,留首次出现的原形。
|
|
185
|
+
const entries = new Map()
|
|
186
|
+
for (const p of [...touched, ...diff]) {
|
|
187
|
+
if (typeof p !== "string" || p === "") continue
|
|
188
|
+
const key = surfaceKey(p)
|
|
189
|
+
if (!entries.has(key)) entries.set(key, p)
|
|
190
|
+
}
|
|
191
|
+
const mine = selfAttributedOf(agent, abs)
|
|
192
|
+
// 认领只在真有「不属于本档」的条目时才去问(会话归属是内存读,盘上清单那一路每个邻批各两次 git 调用)。
|
|
193
|
+
const claimed = new Set()
|
|
194
|
+
if ([...entries.keys()].some((k) => !mine.has(k))) {
|
|
195
|
+
for (const key of sessionClaimsOf(agent, abs)) claimed.add(key)
|
|
196
|
+
for (const key of neighborListClaims(root, abs).keys()) claimed.add(key)
|
|
197
|
+
}
|
|
198
|
+
const judged = []
|
|
199
|
+
const reported = []
|
|
200
|
+
for (const [key, p] of entries) {
|
|
201
|
+
if (mine.has(key) || !claimed.has(key)) judged.push(p) // 判据一说了算 ∥ 两腿都不说话
|
|
202
|
+
else reported.push(p) // 只报不判
|
|
203
|
+
}
|
|
204
|
+
return { root, judged, reported }
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* `[changed surface]` 收口回执段(判据单源 = 设计档 §4.18.1「被别的批认领的档只报不判」):这些档不判读数,
|
|
209
|
+
* 但**点名它们**,请人确认「是否本批」——判据收窄了,这件事仍然看得见。
|
|
210
|
+
* 认领的来源如实写成两源(本会话归属表 ∥ 盘上批档的 §2 清单):观测源不按状态筛;计划源**状态可读即收**、
|
|
211
|
+
* 上界随状态定(未收口取 HEAD、已收口取它自己的收口提交),所以串里不写「在途」那一个限定——回执说的必须是
|
|
212
|
+
* 它真做了的那件事。
|
|
213
|
+
* 承载面 = 收口那一笔返回给调用方的回执文本(与 `[doc-check gate]` ∥ `[ledger reanchor]` 同面);
|
|
214
|
+
* 读者 = 收口这一笔的调用者,他正是决定「这些档算不算本批」的人。不写进批档、不进台账:它不是规范,是一次收口的读数。
|
|
215
|
+
* @param {{root?:string, reported?:string[]}|null} surface — `assertCloseoutGates` 交回的取材读数
|
|
216
|
+
* @returns {string} 以换行起头;没有被认领的档 ⇒ 空串
|
|
217
|
+
*/
|
|
218
|
+
export function changedSurfaceReceiptLine(surface) {
|
|
219
|
+
const rows = surface?.reported ?? []
|
|
220
|
+
if (rows.length === 0) return ""
|
|
221
|
+
const items = rows.map((p) => `\n ${displayRelOf(surface.root, p)}`).join("")
|
|
222
|
+
return `\n[changed surface] 只报不判:${rows.length} 档被别的批认领(本会话归属表 ∥ 盘上批档的 §2 清单),本批没判它们的读数——确认是否本批${items}`
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** 仓根(§2 机读清单的第一列是仓根相对路径)——解析式与文档机检门同式
|
|
226
|
+
* (`batch-gate.mjs` 的 `evaluate`:`owningProject(批档) ?? batchProjectRoot(cwd)`):
|
|
227
|
+
* 两臂判同一批档、同一套相对路径,根不同就会一处判到档、一处判到空。 */
|
|
228
|
+
function tierRootOf(abs, cwd) {
|
|
229
|
+
const base = resolve(cwd)
|
|
230
|
+
return owningProject(resolve(abs), base) ?? batchProjectRoot(base)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ─── 读数支的基线内容(本档读 git 的唯一一处:门自己不读,内容由这里交进去)──────────────────
|
|
234
|
+
|
|
235
|
+
/** 一次 git 调用(`-C <cwd>`):失败不抛、返 `null`——分流判据在调用方(对象在不在 ∥ 路径在不在)。 */
|
|
236
|
+
function gitRun(cwd, argv) {
|
|
237
|
+
try {
|
|
238
|
+
return execFileSync("git", ["-C", cwd, ...argv], {
|
|
239
|
+
encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 8000,
|
|
240
|
+
})
|
|
241
|
+
} catch {
|
|
242
|
+
return null
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** 档在 git 树里的路径:快照的树以 **git 仓根**为基,§2 清单以**项目根**为基——项目根住大仓子目录时
|
|
247
|
+
* 两基不同(解析式与 `committedDocs` 的 `base` 同一条)。 */
|
|
248
|
+
function gitPathOf(top, root, relPath) {
|
|
249
|
+
const abs = isAbsolute(relPath) ? relPath : resolve(root, relPath)
|
|
250
|
+
const rel = relative(top, abs).replace(/\\/g, "/")
|
|
251
|
+
return rel === "" || rel.startsWith("../") || isAbsolute(rel) ? String(relPath).replace(/\\/g, "/") : rel
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 读数支的基线取值函数(判法单源 = `docs/core/design/DOC-CHECK.md` §8「两个失败怎么分开」):
|
|
256
|
+
* `git show <sha>:<档>` 对「快照里没这一档」与「对象读不到」报的错同形,照错文分流会把每个有新建档的批整批拒
|
|
257
|
+
* (`新` 正是那条判据的地基)。故按三步问、各问一件:对象在不在 ⇒ 路径在不在 ⇒ 取内容。
|
|
258
|
+
* **拒绝条件只有一条 = 记入行的 sha 指向的对象读不到**(`undefined`);`refs/thincoder/baseline/<批档名>`
|
|
259
|
+
* 在不在不进判据——ref 只负责让那个对象不被回收,不是取内容的入口。
|
|
260
|
+
* @param {string} abs — 批档绝对路径(记入行 `批起 sha` 的取法单源 = `baseShaOf`)
|
|
261
|
+
* @param {string} root — 项目根(清单第一列的基)
|
|
262
|
+
* @returns {(relPath:string) => string|null|undefined} 串 = 该档在快照里的内容 ∥ `null` = 快照里没有这一档 ∥
|
|
263
|
+
* `undefined` = 基线不可判(门按整批一条拒)
|
|
264
|
+
*/
|
|
265
|
+
function baseTextReaderOf(abs, root) {
|
|
266
|
+
const sha = baseShaOf(abs)
|
|
267
|
+
if (sha === null) return () => undefined
|
|
268
|
+
const top = (gitRun(root, ["rev-parse", "--show-toplevel"]) ?? "").trim() || root
|
|
269
|
+
let commitReadable = null // 一次收口只问一遍对象在不在
|
|
270
|
+
return (relPath) => {
|
|
271
|
+
if (commitReadable === null) commitReadable = gitRun(top, ["cat-file", "-e", `${sha}^{commit}`]) !== null
|
|
272
|
+
if (!commitReadable) return undefined
|
|
273
|
+
const gitPath = gitPathOf(top, root, relPath)
|
|
274
|
+
if (gitRun(top, ["cat-file", "-e", `${sha}:${gitPath}`]) === null) return null
|
|
275
|
+
const text = gitRun(top, ["show", `${sha}:${gitPath}`])
|
|
276
|
+
return text === null ? undefined : text // 取不到内容同样按「基线不可判」,不静默读成 `新`
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
94
280
|
/** 读档(本档只读一面——写盘归 lifecycle 与 bind;读错上抛不伪装)。 */
|
|
95
281
|
export function readCloseoutSource(abs) { return readFileSync(abs, "utf8") }
|
|
96
282
|
|
|
283
|
+
// ─── 全归档补关(§4.18-C · `docs/core/design/LEDGER.md` §11.2)────────────────────────────
|
|
284
|
+
|
|
285
|
+
/** 补关被其它半状态拦住(§4.18-C「其它不一致不放行」):全归档但还命中 `header-row-missing` 等任一读形 ⇒
|
|
286
|
+
* 拒,**逐项列出全部半状态**并指回 `check` 按各出路先修——归属错误不得被冻成历史。
|
|
287
|
+
* (无逐字原文;语域照 `batch` 族拒句:点名 + 下一步 + `Nothing was written.`)
|
|
288
|
+
* @param {{name:string, rows:number[]}[]} halfStates — `batchLedgerConsistency` 的 `halfStates`
|
|
289
|
+
*/
|
|
290
|
+
export function repairBlockedError(halfStates) {
|
|
291
|
+
const list = halfStates.map((h) => `${h.name}${h.rows?.length ? ` #${h.rows.join(" · #")}` : ""}`).join(";")
|
|
292
|
+
return "batch: 全归档批的补关被拒(ledger repair blocked)— the record's ledger rows are all archived, but the " +
|
|
293
|
+
`consistency read hits more than one half state, so freezing would cement a ledger mismatch as history. Half states: ${list}. ` +
|
|
294
|
+
"Run batch({action:\"check\"}) and follow each exit, then retry close. Nothing was written."
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** 补关在档面留的追记行(逐字 = `docs/core/design/LEDGER.md` §11.2;载体 = `appendLineToSection`——只追加
|
|
298
|
+
* 不改写,EOL 取 §1 段头行)。为什么不能只靠瞬时回执:四个段均空、状态行又已收口,不写一行就没有人
|
|
299
|
+
* 看得出这个档为何能冻结。 */
|
|
300
|
+
export const repairTraceLine = (date, rows) => `**补关记录**:${date} · 行集全归档(${rows} 行)· §3/§4/§6 未补写 · 操作者 = 主 agent`
|
|
301
|
+
|
|
302
|
+
/** 补关回执段(§4.13「本档特有面」——补关成功另出 `[ledger repair]`):把「零行改写」说成事实,
|
|
303
|
+
* 不把零行改写报成新结算。`null`(正常收口)⇒ 无该段。
|
|
304
|
+
* @param {{rows:number, date:string}|null} result */
|
|
305
|
+
export function repairReceiptLine(result) {
|
|
306
|
+
if (!result) return ""
|
|
307
|
+
return `\n[ledger repair] 全归档补关:本批 ${result.rows} 行全归档(已核销 / 已废弃)· 台账行零改写 · §3/§4/§6 未补写 · §1 段尾已追加一行 补关记录(${result.date})`
|
|
308
|
+
}
|
|
309
|
+
|
|
97
310
|
/**
|
|
98
311
|
* 判据 2 的块内裁定读数(设计档 §2.6「pass 谓词」):`null` = pass;否则 = 拒文括注里的那一格。
|
|
99
312
|
* 组合序不在本档——一律取骨架档 `verdictGapOf`(判据单源,设计档 §2.6.1):写面、`§5` 门与签发面三处同读
|
|
@@ -138,39 +351,64 @@ export function assertSectionFiveGate(src) {
|
|
|
138
351
|
if (gap !== null) throw new Error(sectionFiveVerdictBlockError(src, gap))
|
|
139
352
|
}
|
|
140
353
|
|
|
141
|
-
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* (认领行只有两种终局;未认领行本来就不该在本批),一句管两类正是要收的病句;汇总行因此只点名、不给建议。
|
|
148
|
-
* 第三行只在 N+M > 0 时出现(父侧全处置过 ⇒ 零该行,回执不噪)。失败 ⇒ 只出失败行(台账零写、冻结照常)。
|
|
149
|
-
* @param {{reanchored:Array, failed:string|null}|null} result — `ledgerReanchorBatch` 返回形
|
|
354
|
+
/** 收口重锚回执段(设计档 §2.17 收口步序 7)——**逐行点名每一枚被结清的行,两种起点各一行**:
|
|
355
|
+
* `<#id> 在途 → 待核销 → 已核销` 与 `<#id> 待核销 → 已核销`。后者是「已做完、没结账」的行被静默结清,
|
|
356
|
+
* 不点名就平账了(口径同 `docs/core/design/LEDGER.md` §3.3 安全阀)。
|
|
357
|
+
* 台账失败不再走本段:失败 ⇒ 补偿回滚档 + 抛拒(`closeLedgerFailedError` / `closeHalfStateError`),
|
|
358
|
+
* 收口那次调用根本没有回执。`conditioned` = 本批未动行改挂条件的既有段。
|
|
359
|
+
* @param {{settled?:Array, conditioned?:Array}|null} result — `ledgerReanchorBatch` 返回形
|
|
150
360
|
*/
|
|
151
361
|
export function reanchorReceiptLine(result) {
|
|
152
362
|
if (!result) return ""
|
|
153
|
-
if (result.failed) return `\n[ledger reanchor] 未重锚:${result.failed}——台账零写;记录冻结照常完成`
|
|
154
363
|
const face = (r) => `#${r.id} 「${r.title}」`
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
" —— 认领行只有两种终局:做完的 close 勾销(待核销 → 已核销),判定不做的 update → 已废弃 并写判据(认领即承诺,没有第三种)")
|
|
162
|
-
}
|
|
163
|
-
if (toCondition.length) {
|
|
164
|
-
lines.push(`\n[ledger reanchor] 本批未动行 → 条件 ${toCondition.length} 行:${toCondition.map(face).join(";")}` +
|
|
165
|
-
" —— 这些行不是本批的活(未认领却被绑在本档 = 点火违规);已落 trigger = 条件 + 复启句,由下一批接手,本批不再处置")
|
|
166
|
-
}
|
|
167
|
-
const all = result.reanchored ?? []
|
|
168
|
-
if (all.length) {
|
|
169
|
-
lines.push(`\n[ledger reanchor] 本批 ${all.length} 行由重锚默认推进,父侧未显式处置:${all.map((r) => `#${r.id}`).join(", ")}`)
|
|
364
|
+
const lines = (result.settled ?? []).map((r) =>
|
|
365
|
+
`\n[ledger reanchor] ${face(r)} ${r.from === "在途" ? "在途 → 待核销 → 已核销" : "待核销 → 已核销"}`)
|
|
366
|
+
const conditioned = result.conditioned ?? []
|
|
367
|
+
if (conditioned.length) {
|
|
368
|
+
lines.push(`\n[ledger reanchor] 本批未动行 → 条件 ${conditioned.length} 行:${conditioned.map(face).join(";")}` +
|
|
369
|
+
" —— 已落 trigger = 条件 + 复启句,由下一批接手")
|
|
170
370
|
}
|
|
171
371
|
return lines.join("")
|
|
172
372
|
}
|
|
173
373
|
|
|
374
|
+
/** 收口台账失败拒文(设计档 §2.17 收口步序 6 第一条串,逐字):档已回滚到写前字节 ⇒ 可原样重试。 */
|
|
375
|
+
export function closeLedgerFailedError(cause) {
|
|
376
|
+
return `batch: close failed — 台账事务未提交(${cause});批档已回滚到写前字节,可原样重试。Ledger: no committed change from this call (it never reached COMMIT).`
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** 收口补偿也失败拒文(同节第二条串,逐字——**不得复用第一条**:第一条声称已回滚,此时事实相反):
|
|
380
|
+
* 批档可能仍为已收口;是否半状态由 `check` 按实际行集判,全归档终态不重试,其余残态先修账再重开。 */
|
|
381
|
+
export function closeHalfStateError(abs, cause, rollbackCause) {
|
|
382
|
+
return `batch: close failed — 台账事务未提交(${cause});批档回滚也失败(${rollbackCause})——批档可能仍为已收口。` +
|
|
383
|
+
`Read it with batch({action:"check", path:"${abs}"}); if consistent=false, repair the ledger and reopen before retrying; if consistent=true, the batch is already closed and settled — do not retry.`
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** `[ledger consistency]` 行(设计档 §2.17「暴露面两处」第二条):`close` ∥ `reopen` ∥ `status` 回执末尾
|
|
387
|
+
* **恒带一行**——一致 ⇒ `一致(本批 N 行)`;不一致 ⇒ 逐项点名 + 出路。查询面单源 =
|
|
388
|
+
* `batchLedgerConsistency`(本档只格式化,不另判)。 */
|
|
389
|
+
export function consistencyReceiptLine(result) {
|
|
390
|
+
if (!result) return ""
|
|
391
|
+
// 读不出(台账库坏 / 打不开)⇒ 如实点名,**不吞成「一致」**:一条说「一致」却根本没读的读数,
|
|
392
|
+
// 比没有这行更坏——它正是本批要消掉的静默。
|
|
393
|
+
if (result.error) return `\n[ledger consistency] 读不出(${result.error})——半状态面不可用,按批档 §1 与台账行各自的状态自行核对`
|
|
394
|
+
if (result.consistent) return `\n[ledger consistency] 一致(本批 ${result.rows.length} 行)`
|
|
395
|
+
const items = result.halfStates.map((h) =>
|
|
396
|
+
`\n ${h.name}${h.rows.length ? ` #${h.rows.join(" · #")}` : ""}——出路:${h.exit}`)
|
|
397
|
+
return `\n[ledger consistency] 不一致(本批 ${result.rows.length} 行):${items.join("")}`
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** `batch({action:"check"})` 回执(设计档 §2.17「暴露面两处」第一条):逐行打印查询面读数——`record`
|
|
401
|
+
* 三态、行集逐行 `{id, status, trigger, title}`、档头号集 `{id, inLedger}`、半状态项与出路、`consistent`。只读动作,零写。 */
|
|
402
|
+
export function checkReceipt(result, abs) {
|
|
403
|
+
const lines = [
|
|
404
|
+
`batch: ledger consistency — ${abs}`,
|
|
405
|
+
` record = ${result.record} · rows = ${result.rows.length} · consistent = ${result.consistent}`,
|
|
406
|
+
...result.rows.map((r) => ` #${r.id} ${r.status} 「${r.title}」 · trigger = ${r.trigger ?? "—"}`),
|
|
407
|
+
...(result.headerRows ?? []).map((h) => ` headerRows #${h.id} inLedger = ${h.inLedger}`),
|
|
408
|
+
]
|
|
409
|
+
return lines.join("\n") + consistencyReceiptLine(result)
|
|
410
|
+
}
|
|
411
|
+
|
|
174
412
|
/** 新事理由的 `evidence` 前缀(单源 = `docs/core/design/LEDGER.md` §6.3「参数面」;写入侧由
|
|
175
413
|
* `thincoder-core/ledger-write-ops.mjs` 的 `NEW_DEBT_EVIDENCE_PREFIX` 造,本档按同一字面取文)。 */
|
|
176
414
|
const NEW_DEBT_PREFIX = "新事理由:"
|