@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
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* subagent-design-token.mjs — **设计令牌门**族:design-token 槽解析、七态拒句、eng-coder spawn 的令牌判定。
|
|
3
|
+
*
|
|
4
|
+
* 机制单源 = `docs/core/design/TOOLS.md` §6.25(③ 七态拒句 ∥ ④ 令牌门)与 `docs/core/design/ENGINEERING-MODE.md`
|
|
5
|
+
* 的设计令牌结算段;本档只实现,不重述口径。
|
|
6
|
+
* **为什么单独立档**:这一族是 spawn 门里唯一「判授权」的部分(其余门判参数与路径),消费者只有
|
|
7
|
+
* `subagent-spawn.mjs` 的 child 装配点——整族搬走不动装配面一字(`docs/core/design/PATH-RESOLUTION.md` §3 末条)。
|
|
8
|
+
*
|
|
9
|
+
* 导出面两处消费:装配点(`gateDesignToken`)与再导出面(`subagent-spawn.mjs` 原样再导出 `resolveDesignSlot`
|
|
10
|
+
* ∥ `designTokenRefusal` ⇒ `subagent.mjs` 的再导出行与用例的 import 行零改)。
|
|
11
|
+
*/
|
|
12
|
+
import { readEngTokenBatchesFromSlot, readEngTokenSealsFromSlot, removeDesignTokenSlot, reconcileEngTokensFromSlot, tokenExpired } from "../token-ttl.mjs"
|
|
13
|
+
import { validateDesignToken } from "./advisor.mjs"
|
|
14
|
+
// 评审封印的字节口径单源(settle 与闸面同调一个函数——两处各写一份字节法,必漂)。
|
|
15
|
+
import { designDocHash, designSealHash } from "./design-token.mjs"
|
|
16
|
+
// 批档比较的归一单源(§9 的匹配规则:`resolve` + 分隔符归一 + win32 折小写)——本门不自写第二份。
|
|
17
|
+
import { batchPathKey } from "./design-slots.mjs"
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the design-token slot for an eng-coder spawn (2026-09-01 multi-design, FR3):
|
|
21
|
+
* - designId given → exact slot lookup (no match = explicit error, never a fuzzy guess)
|
|
22
|
+
* - designId omitted → exactly ONE slot must exist (single-design compatibility); with
|
|
23
|
+
* multiple slots we refuse rather than pick one (T16: never silently aim the wrong design)
|
|
24
|
+
* Returns { token, designId } on success (designId = the slot actually resolved — the spawn may omit
|
|
25
|
+
* it while a single slot exists, and the batch/seal steps still need its key); throws with a
|
|
26
|
+
* parent-actionable message otherwise.
|
|
27
|
+
* R16 (2026-09-06): the slot Map is the authority; the format/TTL check itself stays in
|
|
28
|
+
* validateDesignToken (2026-09-06: HMAC 防伪层已删——token 为无签名流程凭证——见
|
|
29
|
+
* ENGINEERING-MODE.md 2026-09-06 段)。
|
|
30
|
+
* DESIGN-TOKEN-SETTLEMENT D2(2026-09-08):内存 Map miss(指定 designId 不在 / 空 Map)
|
|
31
|
+
* 时回读槽文件权威台账 reconcile + 判定(reconcileEngTokensFromSlot——与 dispatch 写门
|
|
32
|
+
* D3 同源)——覆盖"进程重启后槽有但 Map 未及回填/缓存与槽不一致"(槽文件 = 权威台账)。
|
|
33
|
+
* TTL 过滤保留(reconcile 只并入未过期项)。单值镜像 `_engDesignToken` 已随 D3 退役——
|
|
34
|
+
* 本门禁不再读镜像(AC3 零命中)。
|
|
35
|
+
*/
|
|
36
|
+
export function resolveDesignSlot(parent, designIdArg) {
|
|
37
|
+
let slots = parent._engDesignTokens
|
|
38
|
+
const hasSlots = slots instanceof Map && slots.size > 0
|
|
39
|
+
// D2:内存 miss(指定 designId 不在 或 空 Map)→ 权威槽回读 reconcile + 判定
|
|
40
|
+
if (designIdArg ? !(hasSlots && slots.has(designIdArg)) : !hasSlots) {
|
|
41
|
+
const rec = reconcileEngTokensFromSlot(parent)
|
|
42
|
+
if (rec && rec !== slots) slots = rec
|
|
43
|
+
}
|
|
44
|
+
// F2d: both refusal branches carry the HELD id list — after a
|
|
45
|
+
// persistence restore the parent has no digest to look the id up in; the error
|
|
46
|
+
// list is the only discovery path (ids are not credentials — the token is).
|
|
47
|
+
const size = slots instanceof Map ? slots.size : 0
|
|
48
|
+
const heldIds = size > 0 ? [...slots.keys()].join(", ") : "(none)"
|
|
49
|
+
if (designIdArg) {
|
|
50
|
+
if (!(slots instanceof Map) || !slots.has(designIdArg)) {
|
|
51
|
+
throw new Error(`designId not found — no approved design review holds this id. Run advisor with type='design' again and pass the designId echoed with the token. (session holds ${size} approved design slot(s); held design ids: ${heldIds})`)
|
|
52
|
+
}
|
|
53
|
+
return { token: slots.get(designIdArg), designId: designIdArg }
|
|
54
|
+
}
|
|
55
|
+
if (size > 1) {
|
|
56
|
+
throw new Error(`Multiple approved designs in this session (${size}) — pass the designId parameter (echoed with each token) to choose which design this eng-coder spawn belongs to. Held design ids: ${heldIds}`)
|
|
57
|
+
}
|
|
58
|
+
if (size === 1) return { token: [...slots.values()][0], designId: [...slots.keys()][0] }
|
|
59
|
+
throw designTokenRefusal("missing", null, {})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 七态拒句(逐字 = TOOLS.md §6.25 ③):missing / mismatch / expired / invalid /
|
|
63
|
+
* batch-mismatch / seal-mismatch / seal-unreadable。
|
|
64
|
+
* 第三参 `scope` **必传、不设默认值**(三参形单源 = DESIGN-TOKEN-SETTLEMENT §10.2):无名字可点的态传
|
|
65
|
+
* `{}`,缺参在构造器入口拒——缺省值会默默代调用方决定「没有名字」,而错位的判决三条层下去才看得出来。
|
|
66
|
+
* 四个带名字的态各自入参:mismatch ⇒ designId 走第二参 · batch-mismatch ⇒ `{boundBatch, givenBatch}` 两个绝对路径 ·
|
|
67
|
+
* seal-mismatch ⇒ `{changed: [<可变路径…>]}`(按 `docs` 原序;空数组 ⇒ 无路径形)· seal-unreadable ⇒ `{path}`。
|
|
68
|
+
* designId 与路径都不是凭证,七句均零令牌值回显。 */
|
|
69
|
+
export function designTokenRefusal(kind, designId, scope) {
|
|
70
|
+
if (scope === undefined || scope === null || typeof scope !== "object" || Array.isArray(scope)) {
|
|
71
|
+
const got = scope === null ? "null" : Array.isArray(scope) ? "an array" : typeof scope
|
|
72
|
+
throw new Error(`designTokenRefusal: the third parameter \`scope\` is required and must be an object — got ${got} for kind="${kind}"; pass {} when the refusal names nothing (DESIGN-TOKEN-SETTLEMENT §10.2「三参形」).`)
|
|
73
|
+
}
|
|
74
|
+
if (kind === "missing") return new Error("designToken missing — the eng-coder spawn is refused: no usable token for an approved design slot came with this spawn. Pass the designToken parameter with the exact value from the subagent action:'design-slots' row (the text after designToken=), copied verbatim; if that list is empty, no design review has been approved in this session yet — run advisor with type='design' first. No token value is echoed here.")
|
|
75
|
+
if (kind === "mismatch") return new Error("designToken mismatch — the eng-coder spawn is refused: the value passed does not equal the token held for this design slot. Re-read the subagent action:'design-slots' row and pass the value after designToken= verbatim, unchanged. No token value is echoed here." + (designId ? ` (designId: ${designId})` : ""))
|
|
76
|
+
if (kind === "expired") return new Error("designToken expired — the eng-coder spawn is refused: the token matches this design slot but is past its TTL. The expired slot has been removed; run advisor with type='design' again on the current design and pass the newly issued token — an expired authorization cannot be retried. No token value is echoed here.")
|
|
77
|
+
if (kind === "batch") return new Error(`designToken batch mismatch — the eng-coder spawn is refused: this token was issued for ${scope?.boundBatch ?? "(unknown)"}, but this spawn implements ${scope?.givenBatch ?? "(unknown)"}. Use the token from this batch's design review.`)
|
|
78
|
+
if (kind === "seal") {
|
|
79
|
+
// 点名判定(§10.2「拒文点名变了的那几份档」):有可比路径 ⇒ 列路径形;一条都点不出来(旧封印行
|
|
80
|
+
// 没有 `docHashes`)⇒ 保留无路径形。两形业务结果相同(照旧拒),差的只是报面上的名字。
|
|
81
|
+
const changed = Array.isArray(scope.changed) ? scope.changed.filter((p) => typeof p === "string" && p) : []
|
|
82
|
+
if (changed.length > 0) return new Error(`designToken seal mismatch — the reviewed documents changed after the review passed: ${changed.join(", ")} — re-run the review, or revert those files to the version the review approved.`)
|
|
83
|
+
return new Error("designToken seal mismatch — the reviewed documents changed after the review passed (this seal records no per-document hashes, so no path can be named) — re-run the review, or revert the change.")
|
|
84
|
+
}
|
|
85
|
+
if (kind === "seal-unreadable") return new Error(`designToken seal unreadable — the eng-coder spawn is refused: the reviewed document ${scope?.path ?? "(unknown)"} cannot be read, so the seal cannot be checked. Restore that file, or re-run the review, and spawn again.`)
|
|
86
|
+
return new Error("designToken invalid — the eng-coder spawn is refused: the value passed equals this design slot's stored token, but that stored value is not a well-formed token, so no expiry can be judged and the slot was left in place. Run advisor with type='design' to issue a fresh token for this design; a malformed record never passes the gate. No token value is echoed here.")
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** 拒文点名(DESIGN-TOKEN-SETTLEMENT §10.2「拒文点名变了的那几份档」):按封印行的 `docs` 原序逐档
|
|
90
|
+
* 重算,与 `docHashes` 里同一路径的记值比对,返回不等的那些路径。**只服务报面**——判定值仍是组合
|
|
91
|
+
* `hash`,本函数不参与放行与否。旧封印行没有 `docHashes`(本改动之前写下的)⇒ 空数组 ⇒ 拒文走无路径形。
|
|
92
|
+
* 逐档读不到由调用方的 `try` 收成 `seal-unreadable`(fail-closed:判不了就不放行)。
|
|
93
|
+
* @param {{docs: string[], docHashes?: {path: string, hash: string}[]}} seal 槽里那一行封印
|
|
94
|
+
* @returns {string[]} 变了的档路径(按 `docs` 原序) */
|
|
95
|
+
function changedDocsOf(seal) {
|
|
96
|
+
if (!Array.isArray(seal.docHashes)) return []
|
|
97
|
+
const recorded = new Map()
|
|
98
|
+
for (const d of seal.docHashes) {
|
|
99
|
+
if (d && typeof d === "object" && typeof d.path === "string" && typeof d.hash === "string" && !recorded.has(d.path)) recorded.set(d.path, d.hash)
|
|
100
|
+
}
|
|
101
|
+
const changed = []
|
|
102
|
+
for (const p of seal.docs) {
|
|
103
|
+
const want = recorded.get(p)
|
|
104
|
+
if (want === undefined) continue
|
|
105
|
+
if (designDocHash(p) !== want) changed.push(p)
|
|
106
|
+
}
|
|
107
|
+
return changed
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** eng-coder spawn 的令牌门(TOOLS.md §6.25 ④⑤⑥):resolveDesignSlot 的既有两条 designId
|
|
111
|
+
* 诊断零改 → 参数在场 → 值相等 → 值有效 → 批归属 → 评审封印。槽删除只在 tokenExpired(given)
|
|
112
|
+
* 成立时发生(D-R16c ③);mismatch / invalid / batch / seal 不删槽(T-R16d)。返回槽内令牌
|
|
113
|
+
* (调用方回写 designId 依赖它);sync / async 两路共经装配点——一处判定双路生效。
|
|
114
|
+
*
|
|
115
|
+
* ⑤ 批归属(DESIGN-TOKEN-SETTLEMENT §10.1):比较对象 = `buildSpawnChild` 的 batchDoc 门已解析
|
|
116
|
+
* 好的绝对路径(第三参;本步不自己解析 `args.batchDoc`——解析单源在那一处)。旁列**严格读**:
|
|
117
|
+
* 槽文件读不到 ⇒ 抛,不落进「旁列无值 ⇒ 不拦」。旁列无值(旧槽 ∥ 该次评审不带批档)⇒ 跳过。
|
|
118
|
+
* ⑥ 评审封印(§10.2):只读槽里记下的 `docs` 复算,不自己推清单(自己推 = 两处各自定义「被审档」)。
|
|
119
|
+
* 无封印值(旧槽)⇒ 跳过;被审档读不到 ⇒ 拒(fail-closed——判不了就不放行)。
|
|
120
|
+
* @param {string} opts.batchDocAbs 第三参恒由装配点给(eng-coder 缺 batchDoc 时更早的门已拒);旁列有值
|
|
121
|
+
* 而它不是串 = 接线故障 ⇒ throw(不是一条给用户看的拒因)。 */
|
|
122
|
+
export function gateDesignToken(parent, args, { batchDocAbs }) {
|
|
123
|
+
const slot = resolveDesignSlot(parent, args?.designId)
|
|
124
|
+
const issuedToken = slot.token
|
|
125
|
+
// 非字符串 ⇒ 空串 ⇒ missing(本意——T9 锁定)
|
|
126
|
+
const given = typeof args?.designToken === "string" ? args.designToken : ""
|
|
127
|
+
if (!issuedToken || !given.trim()) throw designTokenRefusal("missing", null, {})
|
|
128
|
+
if (given !== issuedToken) throw designTokenRefusal("mismatch", args?.designId, {})
|
|
129
|
+
if (!validateDesignToken(given)) {
|
|
130
|
+
const expired = tokenExpired(given)
|
|
131
|
+
if (expired) removeDesignTokenSlot(parent, args?.designId, given)
|
|
132
|
+
throw designTokenRefusal(expired ? "expired" : "invalid", null, {})
|
|
133
|
+
}
|
|
134
|
+
// ⑤ 批归属:旁列有值 ∧ 归一后 ≠ 本次 spawn 的 batchDoc 绝对路径 ⇒ 拒。排在封印之前 = 先判便宜的那条
|
|
135
|
+
// (归属不符时不必逐档读盘算 hash;判据顺序单源 = TOOLS.md §6.25 ③ 的顺序行)。
|
|
136
|
+
const batches = readEngTokenBatchesFromSlot(parent, { strict: true })
|
|
137
|
+
// 「读到、没有这个 designId 的行」与「行在、值不成形」同判为**无归属**(与 `restoreEngTokens` 同一取舍:
|
|
138
|
+
// 成形与否由写者保证;结构损坏在整档层已由严格读的 `JSON.parse` 兜住)。这不是一条宽容读。
|
|
139
|
+
const bound = batches && typeof batches[slot.designId] === "string" ? batches[slot.designId] : null
|
|
140
|
+
if (bound) {
|
|
141
|
+
if (typeof batchDocAbs !== "string" || !batchDocAbs.trim()) {
|
|
142
|
+
throw new Error(`gateDesignToken: design slot ${slot.designId} carries a batch attribution (${bound}) but the spawn passed no resolved batchDoc — the batchDoc gate runs before the token gate, so this is a wiring fault, not an input to judge.`)
|
|
143
|
+
}
|
|
144
|
+
if (batchPathKey(bound) !== batchPathKey(batchDocAbs)) {
|
|
145
|
+
throw designTokenRefusal("batch", null, { boundBatch: bound, givenBatch: batchDocAbs })
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// ⑥ 评审封印:有封印值 ∧ 重算的 sha256 ≠ 记下的值 ⇒ 拒;清单里一份档读不到 ⇒ 拒(fail-closed)。
|
|
149
|
+
const seals = readEngTokenSealsFromSlot(parent, { strict: true })
|
|
150
|
+
const seal = seals && seals[slot.designId]
|
|
151
|
+
// 成形不全的行也按「无封印值」跳过(与 `restoreEngTokens` 同一取舍)——它与「旧槽无值」不是同一种事实,
|
|
152
|
+
// 是写明的一笔降级:成形由写者保证,整档结构损坏已由严格读的解析失败兜住;设计 §10.2 只裁到「旧槽无值 ⇒ 不拦」。
|
|
153
|
+
const hasSeal = seal && typeof seal === "object" && typeof seal.hash === "string"
|
|
154
|
+
&& Array.isArray(seal.docs) && seal.docs.every((p) => typeof p === "string")
|
|
155
|
+
if (hasSeal) {
|
|
156
|
+
let actual
|
|
157
|
+
let changed = []
|
|
158
|
+
try {
|
|
159
|
+
actual = designSealHash(seal.docs)
|
|
160
|
+
// 只有组合值不等才逐档比(多数派单走不到这里);逐档读不到由同一条 catch 收成 seal-unreadable。
|
|
161
|
+
if (actual !== seal.hash) changed = changedDocsOf(seal)
|
|
162
|
+
} catch (e) {
|
|
163
|
+
throw designTokenRefusal("seal-unreadable", null, { path: e?.sealPath ?? "(unknown)" })
|
|
164
|
+
}
|
|
165
|
+
if (actual !== seal.hash) throw designTokenRefusal("seal", null, { changed })
|
|
166
|
+
}
|
|
167
|
+
return issuedToken
|
|
168
|
+
}
|
|
@@ -40,7 +40,7 @@ export function drainInjectedQueue(entry, agent) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Async branch (AGENT-LOOP-SUBAGENT.md §6.7.3
|
|
43
|
+
* Async branch (AGENT-LOOP-SUBAGENT.md §6.7.3): spawn without waiting.
|
|
44
44
|
* The child runs the EXACT blocking pipeline (runChildPipeline — relay /
|
|
45
45
|
* turn-cap / permission / MIN_REPORT_CHARS / mergeChildMutations all unchanged),
|
|
46
46
|
* but the parent does not await it: the promise is parked in _asyncSubagents and
|
|
@@ -3,19 +3,24 @@
|
|
|
3
3
|
* subagent-async.mjs 拆分——Module Split Policy——纯迁移零行为变化——
|
|
4
4
|
* AGENT-LOOP-SUBAGENT.md §6.9 D-SD1..SD5 + D-SL1 环形死锁修正)。
|
|
5
5
|
* 内容:normalizeFileList / filesOverlap / effectiveFiles(SCHEDULER-DYNAMIC-DOMAIN
|
|
6
|
-
* 动态域——声明 ∪ running touched)/ depInfo / describeBlockers /
|
|
6
|
+
* 动态域——声明 ∪ running touched)/ depInfo / describeBlockers / batchDocInFlight(
|
|
7
|
+
* AGENT-LOOP-SUBAGENT.md §6.58 批次档复用护栏——按档查在飞占用者)/ detectStall(
|
|
7
8
|
* P-SL2 停滞机械检测)/ queueRunnable / assertNoDepCycle / dependentLabels /
|
|
8
9
|
* refreshQueuedTokens / maybeRefillAsync。
|
|
9
10
|
* ASYNC_POOL_LIMITS/poolLimitsFor/runningPoolCount 回引自 subagent-async.mjs(主体保有——
|
|
10
11
|
* 仅调用期使用——与主体对此处调度符号的回引构成惰性环——无求值期依赖)。
|
|
11
12
|
*/
|
|
12
|
-
import { isAbsolute, relative
|
|
13
|
+
import { isAbsolute, relative } from "node:path"
|
|
13
14
|
import { existsSync, statSync } from "node:fs"
|
|
14
15
|
// zero-block 批 P1(TUI.md §6.8.3.2②):排队刷新 relay 异常留痕(禁静默——池状态仍不破坏)。
|
|
15
16
|
import { logEvent } from "../log.mjs"
|
|
16
17
|
// M5 F6(ENGINEERING-MODE-V2-MODULE-DELEGATION §2.3):files 声明面拦截谓词本体落
|
|
17
18
|
// spawn-gates.mjs(纯谓词零依赖——本处只加 import 调用,无环)。
|
|
18
|
-
import {
|
|
19
|
+
import { rejectProcessDocPaths } from "./spawn-gates.mjs"
|
|
20
|
+
// `files` 落点单源 = 统一解析层(`docs/core/design/PATH-RESOLUTION.md` §2.5 的「子代理 `files`(spawn 门)」行:`kind:"none"` /
|
|
21
|
+
// `order:"near-first"` ⇒ 恒解析出、只做调度、不校验存在性)。门判(目录声明 / 过程档)
|
|
22
|
+
// 仍吃**原始声明形状**——判据在转绝对之前跑,顺序零改。
|
|
23
|
+
import { resolvePathTarget } from "../path-resolve.mjs"
|
|
19
24
|
import { poolLimitsFor, runningPoolCount, ASYNC_POOL_LIMITS } from "./subagent-async.mjs"
|
|
20
25
|
// ASYNC-RESULT-CONTAINER.md D1:池 accessor——async-settle.mjs 反向 import 本模块
|
|
21
26
|
// (dependentLabels)构成同款惰性环(函数级绑定——无求值期依赖)。
|
|
@@ -43,7 +48,7 @@ import { carrierField, getAsyncPool, tombstoneOf } from "./async-settle.mjs"
|
|
|
43
48
|
* 大小写不敏感(todo.md/changelog.md 精确——路径任意层含 docs/、根、.thincoder/)——
|
|
44
49
|
* 命中 → throw(fail-closed——先于调度器准入——无排队残留——错误即工具结果);
|
|
45
50
|
* 提示列出全部违规条目——英文模板逐字定稿(AGENT-LOOP-SUBAGENT.md §6.9「父侧文件拦截(R26)」)。
|
|
46
|
-
* M5 F6(2026-09-17——2026-10-15 口径随正):黑名单随同迁入 spawn-gates.mjs
|
|
51
|
+
* M5 F6(2026-09-17——2026-10-15 口径随正):黑名单随同迁入 spawn-gates.mjs(族 = 过程档(CHANGELOG)+ 项目状态档(PROJECT-MANIFEST.json);老台账 md 族随 M2 退役)——本函数只留调用(错误文案逐字保留)。 */
|
|
47
52
|
export function normalizeFileList(files, cwd) {
|
|
48
53
|
const out = []
|
|
49
54
|
for (const f of Array.isArray(files) ? files : []) {
|
|
@@ -51,17 +56,19 @@ export function normalizeFileList(files, cwd) {
|
|
|
51
56
|
if (f.trimEnd().endsWith("/") || f.trimEnd().endsWith("\\")) { // 2.7 批:尾随空格目录声明("test/ ")同拒
|
|
52
57
|
throw new Error(`files must be file-level paths — directory declarations are not supported: ${f}`)
|
|
53
58
|
}
|
|
54
|
-
|
|
59
|
+
// 落点由统一解析层给(`kind:"none"` / `order:"near-first"` ⇒ 恒解析出、只做调度);
|
|
60
|
+
// **门判仍吃原始声明 `f`**:目录声明的尾分隔符判据按声明形状判——转成绝对路径后再判会漏。
|
|
61
|
+
const abs = resolvePathTarget(cwd, f, { kind: "none", order: "near-first" }).abs
|
|
55
62
|
if (existsSync(abs) && statSync(abs).isDirectory()) {
|
|
56
63
|
throw new Error(`files must be file-level paths — directory declarations are not supported: ${f}`)
|
|
57
64
|
}
|
|
58
65
|
if (!out.includes(abs)) out.push(abs)
|
|
59
66
|
}
|
|
60
|
-
// M5 F6(ENGINEERING-MODE-V2-MODULE-DELEGATION §2.2——2026-10-15
|
|
61
|
-
// 谓词本体落 spawn-gates.mjs
|
|
67
|
+
// M5 F6(ENGINEERING-MODE-V2-MODULE-DELEGATION §2.2——2026-10-15 口径随正):过程档 / 项目状态档拦截——
|
|
68
|
+
// 谓词本体落 spawn-gates.mjs(收集全部违规 + 抛合并错误);
|
|
62
69
|
// 循环内目录声明先行(错误序不变——目录错误先于过程档错误)。父侧维护文件
|
|
63
70
|
// basename 族(CHANGELOG——`ledger.db` 随 M2 退役)随同迁入谓词——错误文案逐字保留。
|
|
64
|
-
if (files !== undefined && files !== null)
|
|
71
|
+
if (files !== undefined && files !== null) rejectProcessDocPaths(files)
|
|
65
72
|
return out
|
|
66
73
|
}
|
|
67
74
|
|
|
@@ -79,7 +86,7 @@ export function filesOverlap(a, b) {
|
|
|
79
86
|
|
|
80
87
|
/** 冲突文件的显示形态(优先相对 cwd——面板/返回文本可读)。 */
|
|
81
88
|
function showFile(parent, key) {
|
|
82
|
-
const cwd = parent.cwd
|
|
89
|
+
const cwd = parent.cwd
|
|
83
90
|
const rel = relative(cwd, key)
|
|
84
91
|
return rel && !rel.startsWith("..") && !isAbsolute(rel) ? rel : key
|
|
85
92
|
}
|
|
@@ -176,6 +183,33 @@ export function describeBlockers(parent, entry) {
|
|
|
176
183
|
return { kind: "slot", detail: "" }
|
|
177
184
|
}
|
|
178
185
|
|
|
186
|
+
/**
|
|
187
|
+
* AGENT-LOOP-SUBAGENT.md §6.58 批次档复用护栏(2026-10-28 batchdoc-reuse-guard)——
|
|
188
|
+
* 按档查在飞占用者:池内条目 `_batchDoc` 与 `batchDocAbs` 按 `fileKey` 相等且**在飞**
|
|
189
|
+
* ⇒ `{ id, role, status }`;无 ⇒ `null`。池派生事实单源在此(与 `depInfo` /
|
|
190
|
+
* `describeBlockers` 同族),消费方单点 = `buildSpawnChild` 的 `batchDoc` 门。
|
|
191
|
+
* 三条判据各防一个具体的错:① 池**经访问器读**(`getAsyncPool`,读法同 `depInfo`)——
|
|
192
|
+
* 裸读 `parent._asyncSubagents` 在只携 `history` 的合成 parent 上读到空池 ⇒ 护栏不报错、
|
|
193
|
+
* 不生效、没人知道;② **按 status 过滤**(`done` / `cancelled` 皆假)——正常 settle 的条目
|
|
194
|
+
* 留在池里(`async-settle.mjs` 的「留池 done-in-pool」段)⇒ 只看「池里有同档条目」会把单席顺序交接全部误拒;
|
|
195
|
+
* ③ **占用判据只认 `_batchDoc`、不分角色**(普通面 coder 携档也算),而被检面只有工程角色的
|
|
196
|
+
* spawn、sync spawn 不入池也不是占用者(同档 §6.58.7 第 7 条)——**这个不对称勿「顺手统一」**。
|
|
197
|
+
* 入参 = 已解析的绝对路径(唯一消费方 `buildSpawnChild` 的工程分支,路径由 `resolveBatchReadPath`
|
|
198
|
+
* 保证非空);空入参返 `null` = 「无路径可比」——本谓词不替调用方判「该不该传路径」。
|
|
199
|
+
*/
|
|
200
|
+
export function batchDocInFlight(parent, batchDocAbs) {
|
|
201
|
+
if (!batchDocAbs) return null
|
|
202
|
+
const key = fileKey(batchDocAbs)
|
|
203
|
+
for (const e of getAsyncPool(parent, "subagent")?.values() ?? []) {
|
|
204
|
+
if (e.status !== "running" && e.status !== "queued") continue
|
|
205
|
+
if (e.done === true || e.cancelled === true) continue
|
|
206
|
+
if (!e._batchDoc || fileKey(e._batchDoc) !== key) continue
|
|
207
|
+
return { id: e.id, role: e.role, status: e.status }
|
|
208
|
+
}
|
|
209
|
+
return null
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
179
213
|
/** P-SL2(D-SL2——混合边环形等待停滞机械检测——AGENT-LOOP-SUBAGENT.md §6.9):
|
|
180
214
|
* 判据(收窄——零误报优先——宁可漏报不可误打断):池内 running = 0 && queued ≥ 2 &&
|
|
181
215
|
* 无 dependency-cancelled 标记条目 && 每 queued 的 blocker(files 冲突者 + 未 settle
|
|
@@ -340,7 +374,7 @@ export function dependentLabels(parent, depId) {
|
|
|
340
374
|
/** §6.9 D-SD3b 排队态面板刷新(⟦ev⟧queued 事件族——TUI routeSubToken 消费):对全部
|
|
341
375
|
* queued 条目重算等待态并发射变化(去重 sig——kind/position/detail 全变才发)——
|
|
342
376
|
* 调用点 = 一切队列突变与等待态变迁(spawn 入队 / settle 后补位与依赖转移 / cancel
|
|
343
|
-
* 出队 / 自动通道消费)。position =
|
|
377
|
+
* 出队 / 自动通道消费)。position = 队列序(§6.7.3 既有——cancel 前移同源)。
|
|
344
378
|
* P1 禁静默(zero-block 批 §6.8.3.2②):relay 异常不再静默——留痕一条
|
|
345
379
|
* `ev:queued-paint-failed`(**池状态不被破坏**语义不变——catch 不重抛)。 */
|
|
346
380
|
export function refreshQueuedTokens(parent, onToken) {
|
|
@@ -362,7 +396,7 @@ export function refreshQueuedTokens(parent, onToken) {
|
|
|
362
396
|
}
|
|
363
397
|
|
|
364
398
|
/**
|
|
365
|
-
* Slot-queue refill (AGENT-LOOP-SUBAGENT.md §6.7.3
|
|
399
|
+
* Slot-queue refill (AGENT-LOOP-SUBAGENT.md §6.7.3 + §6.9 D-SD4 + AGENT-LOOP-ASYNC-POOL.md §6.10 D-24a/R14 分域):
|
|
366
400
|
* start queue heads while a running slot is free — called from every settle
|
|
367
401
|
* (completion frees a slot) and from the turn-end collection's refill loop. 队列现可混合 waiting-deps 与 slot-queued——扫描选"依赖全满足 + 域无冲突"的最早
|
|
368
402
|
* 条目启动(waiting 越行不阻塞槽位;多任务同时解除按 queued 序逐个启动)。
|