@thincoder/core 0.11.5 → 0.12.1
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 +27 -0
- package/abort-provenance.mjs +23 -0
- package/advisor/citations.mjs +5 -1
- package/advisor/compaction.mjs +13 -10
- package/advisor/history.mjs +6 -1
- package/advisor/loop.mjs +35 -10
- package/advisor/messages.mjs +31 -43
- package/advisor/project-context.mjs +49 -45
- package/advisor/run.mjs +82 -26
- package/advisor.mjs +40 -11
- package/agent/assemble.mjs +5 -5
- package/agent/chat-call.mjs +21 -1
- package/agent/completion.mjs +1 -20
- package/agent/dispatch-gates.mjs +8 -3
- package/agent/dispatch-run.mjs +131 -20
- package/agent/dispatch.mjs +23 -22
- package/agent/family-tools.mjs +4 -7
- package/agent/goal-judge.mjs +99 -0
- package/agent/goal-state.mjs +96 -0
- package/agent/helpers.mjs +13 -4
- package/agent/offload.mjs +1 -1
- package/agent/planning-graph-guardrail.mjs +224 -0
- package/agent/planning-prompt.mjs +179 -0
- package/agent/planning-step.mjs +460 -173
- package/agent/post-turn.mjs +23 -33
- package/agent/record-results.mjs +8 -5
- package/agent/run-stages.mjs +18 -38
- package/agent/run-start.mjs +26 -19
- package/agent/setup-reminders.mjs +16 -14
- package/agent/setup.mjs +3 -2
- package/agent/spawn-child.mjs +17 -4
- package/agent/suspension.mjs +42 -21
- package/agent/task-lifecycle.mjs +165 -52
- package/agent/timers.mjs +9 -1
- package/agent/turn-loop.mjs +160 -69
- package/agent/turn-projection.mjs +26 -15
- package/agent/turn-task-state.mjs +4 -4
- package/agent/write-gate-ledger.mjs +1 -1
- package/agent/write-gate.mjs +14 -11
- package/agent-tools/advisor-async.mjs +2 -0
- package/agent-tools/advisor-launch.mjs +27 -13
- package/agent-tools/advisor-settle.mjs +19 -18
- package/agent-tools/advisor.mjs +90 -13
- package/agent-tools/bash-async.mjs +3 -3
- package/agent-tools/batch-ledger-bind.mjs +8 -5
- package/agent-tools/batch-read.mjs +42 -0
- package/agent-tools/batch-record-write.mjs +20 -12
- package/agent-tools/batch-segment-vocab.mjs +6 -4
- package/agent-tools/batch-skeleton.mjs +43 -12
- package/agent-tools/consult.mjs +5 -1
- package/agent-tools/context.mjs +5 -4
- package/agent-tools/design-slots.mjs +7 -4
- package/agent-tools/design-token.mjs +3 -2
- package/agent-tools/doc-graph.mjs +257 -95
- package/agent-tools/escalate-async.mjs +4 -1
- package/agent-tools/goal.mjs +28 -95
- package/agent-tools/plan.mjs +1 -1
- package/agent-tools/review-facts.mjs +56 -7
- package/agent-tools/settings.mjs +35 -1
- package/agent-tools/ssh-transport.mjs +23 -22
- package/agent-tools/step.mjs +24 -4
- package/agent-tools/subagent-actions.mjs +6 -2
- package/agent-tools/subagent-async.mjs +4 -2
- package/agent-tools/subagent.mjs +1 -1
- package/agent-tools/task.mjs +73 -65
- package/agent-tools.mjs +3 -3
- package/agent.mjs +12 -3
- package/auto-think.mjs +16 -3
- package/browser/actions.mjs +5 -1
- package/browser/cdp.mjs +1 -1
- package/browser/pool.mjs +110 -17
- package/compaction-work-state.mjs +103 -13
- package/compress-form.mjs +29 -3
- package/config-defaults.mjs +27 -3
- package/config-io.mjs +3 -14
- package/config-normalize.mjs +24 -4
- package/config-presets.mjs +40 -26
- package/config-warn.mjs +30 -0
- package/config.mjs +139 -63
- package/context-degrade.mjs +4 -4
- package/context-push.mjs +20 -9
- package/context.mjs +65 -20
- package/doc-graph/anchors.mjs +39 -40
- package/doc-graph/clusters.mjs +49 -0
- package/doc-graph/code-parsers.mjs +494 -0
- package/doc-graph/context-pack.mjs +392 -0
- package/doc-graph/dir-signals.mjs +228 -0
- package/doc-graph/edges.mjs +231 -0
- package/doc-graph/format.mjs +70 -0
- package/doc-graph/gc-cmd.mjs +104 -0
- package/doc-graph/gc.mjs +112 -0
- package/doc-graph/glob-work-graph.mjs +307 -0
- package/doc-graph/golden-set.mjs +131 -0
- package/doc-graph/ls-work-graph.mjs +534 -0
- package/doc-graph/outline.mjs +377 -0
- package/doc-graph/output-annotations.mjs +85 -0
- package/doc-graph/process-docs.mjs +68 -0
- package/doc-graph/read-work-graph.mjs +91 -0
- package/doc-graph/rebuild-cmd.mjs +75 -0
- package/doc-graph/resolvers.mjs +322 -0
- package/doc-graph/roots.mjs +86 -0
- package/doc-graph/schema.mjs +110 -0
- package/doc-graph/search-augment.mjs +418 -0
- package/doc-graph/store.mjs +231 -0
- package/doc-graph/target-resolve.mjs +352 -0
- package/doc-graph/walk.mjs +87 -0
- package/doc-graph.mjs +583 -707
- package/explore-distill.mjs +52 -17
- package/generate-title.mjs +7 -4
- package/ledger-close.mjs +6 -6
- package/ledger-cmd.mjs +3 -3
- package/ledger-consistency.mjs +8 -6
- package/ledger-db.mjs +45 -10
- package/ledger-migrate.mjs +25 -10
- package/ledger-read.mjs +1 -1
- package/ledger-write-ops.mjs +6 -6
- package/ledger.mjs +2 -2
- package/model-context.mjs +54 -18
- package/model-specs.mjs +86 -67
- package/package.json +1 -1
- package/prompt-overlays.mjs +3 -3
- package/prompts/advisor-round1.md +6 -5
- package/prompts/common.md +16 -6
- package/prompts/consult-base.md +2 -1
- package/prompts/discipline-engineering.md +1 -1
- package/prompts/discipline-normal.md +12 -8
- package/prompts/knowledge/doc-lookup.md +2 -2
- package/prompts/knowledge/normal-batch-discipline.md +2 -2
- package/prompts/knowledge/normal-delivery-collaboration.md +3 -3
- package/prompts/knowledge/tool-advisor.md +2 -2
- package/prompts/knowledge/tool-apply-patch.md +1 -1
- package/prompts/knowledge/tool-bash.md +2 -2
- package/prompts/knowledge/tool-batch.md +4 -4
- package/prompts/knowledge/tool-glob.md +9 -2
- package/prompts/knowledge/tool-goal.md +9 -6
- package/prompts/knowledge/tool-grep.md +7 -2
- package/prompts/knowledge/tool-ls.md +11 -5
- package/prompts/knowledge/tool-lsp.md +1 -1
- package/prompts/knowledge/tool-operations.md +3 -2
- package/prompts/knowledge/tool-plan.md +1 -1
- package/prompts/knowledge/tool-read.md +7 -6
- package/prompts/knowledge/tool-repo-graph-read.md +12 -0
- package/prompts/knowledge/tool-repo-graph.md +12 -0
- package/prompts/knowledge/tool-step.md +1 -1
- package/prompts/knowledge/tool-subagent.md +2 -2
- package/prompts/knowledge/tool-task.md +10 -9
- package/prompts/knowledge/tool-tree.md +7 -1
- package/prompts/persona-eng-coder.md +1 -1
- package/prompts/persona-eng-designer.md +1 -1
- package/prompts/persona-engineering.md +2 -1
- package/prompts/persona-explore.md +1 -1
- package/prompts/persona-normal.md +7 -6
- package/prompts/persona-plan.md +2 -2
- package/prompts/planning-next-moves.md +7 -8
- package/provider/anthropic.mjs +53 -51
- package/provider/core.mjs +85 -34
- package/provider/errors.mjs +33 -10
- package/provider/google.mjs +244 -37
- package/provider/list-models.mjs +28 -14
- package/provider/responses-request.mjs +15 -9
- package/provider/responses.mjs +10 -8
- package/provider/sse.mjs +3 -6
- package/proxy-transport.mjs +228 -119
- package/rules-file.mjs +79 -0
- package/rules.mjs +13 -51
- package/session-lifecycle.mjs +32 -20
- package/team-ledger.mjs +7 -7
- package/think-off.mjs +37 -18
- package/token-window.mjs +48 -31
- package/tool-args.mjs +8 -8
- package/tool-docs/bash.md +1 -1
- package/tool-docs/glob.md +3 -1
- package/tool-docs/goal.md +2 -2
- package/tool-docs/grep.md +3 -1
- package/tool-docs/ls.md +7 -1
- package/tool-docs/read.md +1 -1
- package/tool-docs/repo_graph-read.md +3 -0
- package/tool-docs/repo_graph.md +3 -0
- package/tool-docs/tree.md +1 -1
- package/tools/bash.mjs +53 -8
- package/tools/browser.mjs +4 -4
- package/tools/file.mjs +34 -7
- package/tools/glob-dialect.mjs +57 -7
- package/tools/index.mjs +3 -7
- package/tools/patch.mjs +8 -7
- package/tools/process-doc-mark.mjs +13 -0
- package/tools/search.mjs +152 -37
- package/tools/shared.mjs +6 -0
- package/tools/tree.mjs +211 -8
- package/window-policy.mjs +205 -126
- package/prompts/knowledge/tool-doc-graph-read.md +0 -20
- package/prompts/knowledge/tool-doc-graph.md +0 -49
- package/prompts/knowledge/tool-peek.md +0 -10
- package/prompts/knowledge/tool-repo-outline.md +0 -4
- package/tool-docs/doc_graph-read.md +0 -3
- package/tool-docs/doc_graph.md +0 -3
- package/tool-docs/peek.md +0 -3
- package/tool-docs/repo_outline.md +0 -3
- package/tools/peek.mjs +0 -447
|
@@ -8,33 +8,67 @@
|
|
|
8
8
|
* `resolveReviewRootsFor` 判定本体自 `agent/write-gate.mjs` 迁入(write-gate 同名再出口保
|
|
9
9
|
* 既有 import 面);`resolveReviewDocPaths` = 评审文档路径解析单源;
|
|
10
10
|
* - 2026-10-25(评审文档路径收正批):该解析器收为**单规则**——相对形按会话项目根 / 绝对形
|
|
11
|
-
* 照用 / 受理 = 项目内现存 `.md`;候选试探与歧义归一退场(判据正文 = `ADVISOR-GUARDS.md` §
|
|
11
|
+
* 照用 / 受理 = 项目内现存 `.md`;候选试探与歧义归一退场(判据正文 = `ADVISOR-GUARDS.md` §10)。
|
|
12
12
|
* - 2026-11-02(path-resolution-unify 批):路径判定改调统一解析层(`../path-resolve.mjs`)——
|
|
13
13
|
* 本面只留受理判据;拒因词 `no-project-root` 退役,拆成 `ambiguous-path`(判不出唯一基根)
|
|
14
14
|
* ∥ `dangling-path`(无项目根)。
|
|
15
15
|
*/
|
|
16
16
|
import { existsSync, statSync } from "node:fs"
|
|
17
|
-
import { isAbsolute, join, relative, sep } from "node:path"
|
|
17
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path"
|
|
18
18
|
import { DEFAULT_MANIFEST, docRootPaths, readManifest } from "../manifest.mjs"
|
|
19
19
|
import { owningProject, projectRootView } from "../manifest-discovery.mjs"
|
|
20
20
|
import { resolvePathTarget } from "../path-resolve.mjs"
|
|
21
21
|
|
|
22
|
-
/** ABS 归一(cwd 相对 → cwd 拼接)——陈旧判定 / 冻结拦截 /
|
|
22
|
+
/** ABS 归一(cwd 相对 → cwd 拼接)——陈旧判定 / 冻结拦截 / 评审范围键同源(`ADVISOR-GUARDS.md` §5.3 判据同源)。 */
|
|
23
23
|
export function normAbs(p, cwd) {
|
|
24
24
|
const s = String(p)
|
|
25
25
|
return /^[a-zA-Z]:[\\/]/.test(s) || s.startsWith("/") || s.startsWith("\\\\") ? s : join(cwd, s)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/**
|
|
28
|
+
/** 路径归一为可作实例键的形:`resolve` 折叠 `.` / `..` 与重复分隔符 → 统一正斜杠 → win32 折小写
|
|
29
|
+
* (宿主事实;同维度判例 = `design-slots.mjs` 的 `batchPathKey` 与 `design-slots.mjs` 的 `resolve` 径)。
|
|
30
|
+
* `docSetKey` ∥ `codeReviewScopeKey` **共用这一处**——同一档写成正斜杠 / 反斜杠 / 相对 / 绝对 /
|
|
31
|
+
* 尾分隔符 / 含 `..`,必须落到同一个键上;否则一次运行里同一个文档集会算成两件事,静默开新实例、
|
|
32
|
+
* 丢掉修复轮的 prior(2026-12-01 统一,此前只有代码轨归一)。
|
|
33
|
+
* **UNC 前导双反斜杠**:`resolve` 保留,折成正斜杠后为 `//server/share/…`——两侧写法一致即同键,不做剥头。 */
|
|
34
|
+
function canonPath(p, cwd) {
|
|
35
|
+
const s = resolve(normAbs(p, cwd)).replace(/\\/g, "/")
|
|
36
|
+
return process.platform === "win32" ? s.toLowerCase() : s
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Canonical scope key for design reviews(写法差异不误建新实例;第 33 批自 advisor-async.mjs 迁入;
|
|
40
|
+
* 2026-12-01 归一口径与 `codeReviewScopeKey` 统一——见 `canonPath`)。 */
|
|
29
41
|
export function docSetKey(documents, cwd) {
|
|
30
42
|
const list = [...new Set((documents ?? [])
|
|
31
43
|
.filter((d) => typeof d === "string" && d.trim())
|
|
32
|
-
.map((d) =>
|
|
44
|
+
.map((d) => canonPath(d, cwd)))]
|
|
33
45
|
return JSON.stringify(list.sort())
|
|
34
46
|
}
|
|
35
47
|
|
|
48
|
+
/** Canonical scope key for **code** reviews(与 `docSetKey` 同式,扩到 `paths` ∪ `documents`)。
|
|
49
|
+
* 代码评审的被审对象 = `paths`(文件 / 目录);`documents` 是验收判据上下文,也入键(同一次活
|
|
50
|
+
* 换了判据档就是另一件事)。两者归一为绝对路径后排序去重——**写法差异(相对 / 绝对、顺序)
|
|
51
|
+
* 不误建新实例**。两边都空 ⇒ `null`(调用方决定 sentinel)。
|
|
52
|
+
* 为何要这把尺:`openCodeRun` 原先只取「最新 OPEN」的 code 实例,不看范围 —— 一次运行里换了被审
|
|
53
|
+
* 文件的第二件活被读成第一件活的修复轮,上一批结论表作为 prior 注入(2026-12-01 实测三次)。 */
|
|
54
|
+
export function codeReviewScopeKey(paths, documents, cwd) {
|
|
55
|
+
// 入参守卫与同族消费面同形(`advisor/messages.mjs` 的 `resolveScopeFiles` ∥ `advisor/notice.mjs` 的
|
|
56
|
+
// `scopeSummary` 都是 `Array.isArray(x) ? x : []`):工具面无 schema 校验器,`paths` 传字符串时
|
|
57
|
+
// 不得在这里 TypeError——那不是设计好的拒发(不带判据名、不登记 `_advisorRefusals`,F21/N8 两头落空)。
|
|
58
|
+
// 分隔符、尾分隔符、win32 大小写全归一(`canonPath`——与 `docSetKey` 共用同一处):`normAbs`
|
|
59
|
+
// 把相对形 join 到 cwd 后得本机分隔符,而模型给的绝对形常是正斜杠——不归一就会因为一个字符
|
|
60
|
+
// 开新实例、静默丢掉修复轮的 prior。
|
|
61
|
+
const norm = (list) => [...new Set((Array.isArray(list) ? list : [])
|
|
62
|
+
.filter((p) => typeof p === "string" && p.trim())
|
|
63
|
+
.map((p) => canonPath(p, cwd)))].sort()
|
|
64
|
+
const p = norm(paths)
|
|
65
|
+
const d = norm(documents)
|
|
66
|
+
if (p.length === 0 && d.length === 0) return null
|
|
67
|
+
return JSON.stringify({ p, d })
|
|
68
|
+
}
|
|
69
|
+
|
|
36
70
|
/** **写门面**评审根的 docRoot 键集(`agent/write-gate.mjs` 的 `resolveReviewTargetPaths` 消费)——
|
|
37
|
-
* 设计评审**受理面不再消费**本键集(受理 = 项目内现存 `.md`,判据单源 = `ADVISOR-GUARDS.md` §
|
|
71
|
+
* 设计评审**受理面不再消费**本键集(受理 = 项目内现存 `.md`,判据单源 = `ADVISOR-GUARDS.md` §10)。
|
|
38
72
|
* 2026-10-04 自 `agent/write-gate.mjs` 迁入(键集本体零变;write-gate 同名再出口)。
|
|
39
73
|
*
|
|
40
74
|
* **七层**(`docs/core/design/MANIFEST.md` §2.3「Schema 与默认值」的 `docRoot` 七键条):`standards` = 标准层(目录语义,见同档
|
|
@@ -72,8 +106,23 @@ function isInside(p, root) {
|
|
|
72
106
|
return rel === "" || (rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel))
|
|
73
107
|
}
|
|
74
108
|
|
|
109
|
+
/** 实发相容提示(workspace 锚专属,零推断):候选根里哪个是**本会话真正碰过**的(有运行期改动记录)。
|
|
110
|
+
* 证据 = `agent._touchedFiles`(advisor.mjs 范围回退面同源——它已经在消费这张表,口径零新立);
|
|
111
|
+
* 逐字前缀匹配(normAbs 归一 + 路径分隔符归一,大小写不敏感——Windows 大小写漂移免疫);**零猜测**:
|
|
112
|
+
* 零命中 ∥ 多命中 ∥ 空候选 ∥ 非数组都返回 null,一行都不加(宁缺勿错——错行比缺行更误导)。 */
|
|
113
|
+
export function touchedCandidateHint(candidates, touchedFiles) {
|
|
114
|
+
if (!Array.isArray(candidates) || candidates.length === 0) return null
|
|
115
|
+
if (!Array.isArray(touchedFiles) || touchedFiles.length === 0) return null
|
|
116
|
+
const norm = (p) => String(p).replace(/[\\/]+/g, "/").toLowerCase()
|
|
117
|
+
const hits = candidates.filter((c) => {
|
|
118
|
+
const base = norm(c)
|
|
119
|
+
return touchedFiles.some((f) => norm(f).startsWith(base.endsWith("/") ? base : base + "/"))
|
|
120
|
+
})
|
|
121
|
+
return hits.length === 1 ? hits[0] : null
|
|
122
|
+
}
|
|
123
|
+
|
|
75
124
|
/**
|
|
76
|
-
* **评审文档路径解析单规则**(判据正文 = `docs/core/design/ADVISOR-GUARDS.md` §
|
|
125
|
+
* **评审文档路径解析单规则**(判据正文 = `docs/core/design/ADVISOR-GUARDS.md` §10)——逐文档:
|
|
77
126
|
* ① 路径判定全部经统一解析层(`kind:"file"` / `order:"root-first"` / `bases` = 无 /
|
|
78
127
|
* `scanBases` = `docRoot` 各键——只喂同名候选,不作受理基底;本面受理面零放宽);
|
|
79
128
|
* ② 判不出唯一基根(层判 `ambiguous`——工作区锚)⇒ `ambiguous-path` + 候选全列;
|
package/agent-tools/settings.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 走显式形状表(_NULL_LEAF_SHAPES 相等面 / _SIBLING_SHAPES 存在性面——按各自真实消费形态
|
|
13
13
|
* 校验,完备性机械锁 + 一次性警告;SETTINGS-TOOL.md §8);set 侧效走审批门(dispatch 动作级分类)。
|
|
14
14
|
*/
|
|
15
|
-
import { DEFAULTS, WORK_MODES, configPath, promoteAgentViews, resolveWorkMode, setConfigWorkMode, writeConfigAtomic } from "../config.mjs"
|
|
15
|
+
import { DEFAULTS, WORK_MODES, bindProviderContextPolicy, configPath, promoteAgentViews, resolveWorkMode, setConfigWorkMode, writeConfigAtomic } from "../config.mjs"
|
|
16
16
|
import { DESC } from "../tools/shared.mjs" // #15 描述外置:文本单点 = tool-docs/settings.md
|
|
17
17
|
|
|
18
18
|
/** 敏感键段判定(完整点分路径的段级匹配——两句取或:词表段 ∨ 开口键族段;SETTINGS-TOOL.md §2.4)。
|
|
@@ -40,6 +40,7 @@ export function isSensitiveKey(path) {
|
|
|
40
40
|
const _NULL_LEAF_SHAPES = {
|
|
41
41
|
defaultModel: { kind: "nonEmptyString", providerModel: true, expects: 'non-empty string ("provider:model" composite)' },
|
|
42
42
|
"agent.subagentModel": { kind: "nonEmptyString", expects: "non-empty string" },
|
|
43
|
+
"agent.goalJudgeModel": { kind: "nonEmptyString", expects: "non-empty string" },
|
|
43
44
|
"agent.planningNextMoves.model": { kind: "nonEmptyString", expects: 'non-empty string ("provider:model" or model name)' },
|
|
44
45
|
"agent.planningNextMoves.reasoningEffort": { kind: "nonEmptyString", expects: "non-empty string (low|medium|high|xhigh)" },
|
|
45
46
|
shell: { kind: "nonEmptyString", expects: "non-empty string" },
|
|
@@ -157,6 +158,28 @@ function _checkAdvisorTimeout(value) {
|
|
|
157
158
|
throw new Error("advisor.timeoutMs must be a finite positive number (ms) or null")
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
/** 档位上下文上限三键(`CONTEXT-COMPACTION.md` §2.1 ∥ `CONFIG.md` §5.6)的写面形状:值是正整数 K。
|
|
162
|
+
* 0 ∥ 负数 ∥ 小数 ∥ 文本一律拒——与装载期回缺省那条谓词(`positiveIntValue`)同一族;逐键与整对象两半写法同判,
|
|
163
|
+
* 键集 = `WORK_MODES` 闭集,表外键不落盘。 */
|
|
164
|
+
const _CONTEXT_CAP_PATH = /^agent\.contextCaps\.(tiny|normal|engineering)$/
|
|
165
|
+
|
|
166
|
+
function _checkContextCapValue(path, value) {
|
|
167
|
+
if (value === null) return
|
|
168
|
+
if (typeof value === "number" && Number.isInteger(value) && value > 0) return
|
|
169
|
+
throw _expectsError(path, "a positive integer in K (e.g. 256 = 256K)", value)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function _checkContextCapsTable(value) {
|
|
173
|
+
if (value === null) return
|
|
174
|
+
if (value === undefined || typeof value !== "object" || Array.isArray(value)) {
|
|
175
|
+
throw _expectsError("agent.contextCaps", "an object { tiny, normal, engineering } of positive integers in K", value)
|
|
176
|
+
}
|
|
177
|
+
for (const [key, v] of Object.entries(value)) {
|
|
178
|
+
if (!WORK_MODES.includes(key)) throw _expectsError(`agent.contextCaps.${key}`, `a mode key (${WORK_MODES.join(" / ")})`, v)
|
|
179
|
+
_checkContextCapValue(`agent.contextCaps.${key}`, v)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
160
183
|
/**
|
|
161
184
|
* 已知键值校验(set 写盘前;违例抛错——磁盘/内存零变化):
|
|
162
185
|
* ⓪ advisor 写面两键先判(D-ST18:只收 null ∥ 有限正数;整段赋值腿对对象内 timeoutMs 同规则);
|
|
@@ -179,11 +202,14 @@ function _checkKnownKeyValue(path, value) {
|
|
|
179
202
|
if (Object.hasOwn(value, "mode") && !WORK_MODES.includes(value.mode)) {
|
|
180
203
|
throw new Error(`settings set: agent.mode expects one of ${WORK_MODES.join(", ")} — got ${_shownValue("agent.mode", value.mode)}`)
|
|
181
204
|
}
|
|
205
|
+
if (Object.hasOwn(value, "contextCaps")) _checkContextCapsTable(value.contextCaps) // 档位上限三键:经 agent 整段写入的腿同判(§2.1 值域)
|
|
182
206
|
}
|
|
183
207
|
if (path === "agent.advisor.timeoutMs" || path === "advisor.timeoutMs") return _checkAdvisorTimeout(value)
|
|
184
208
|
if ((path === "agent.advisor" || path === "advisor") && value !== null && typeof value === "object" && !Array.isArray(value) && "timeoutMs" in value) {
|
|
185
209
|
_checkAdvisorTimeout(value.timeoutMs) // 整段赋值腿(两个段名):对象内该键同规则校验(§2.6)
|
|
186
210
|
}
|
|
211
|
+
if (_CONTEXT_CAP_PATH.test(path)) return _checkContextCapValue(path, value)
|
|
212
|
+
if (path === "agent.contextCaps") return _checkContextCapsTable(value)
|
|
187
213
|
const spec = _NULL_LEAF_SHAPES[path] ?? _SIBLING_SHAPES[path]
|
|
188
214
|
if (spec) {
|
|
189
215
|
if (value === null) return // 显式清除 = 有效动作(消费面均有「未设置」态——D-S2.3)
|
|
@@ -361,6 +387,14 @@ export function settingsTool(opts = {}) {
|
|
|
361
387
|
// mode and its derived boolean unchanged; session commands and host controls switch slots.
|
|
362
388
|
const modeDefaultWrite = args.key === "agent.mode" || args.key === "agent"
|
|
363
389
|
if (modeDefaultWrite) setConfigWorkMode(config, sessionMode)
|
|
390
|
+
// 档位上限是运行面派生视图的输入(`config.agent.contextCaps`;`window-policy` 的每一处读数经 `settings` 尾参现读它)——
|
|
391
|
+
// 2026-12-03 批(用户裁定):上限表不再挂到 provider 形状的对象上,所以本处重绑只为同步会话档位(`mode`)。
|
|
392
|
+
const capsWrite = String(args.key) === "agent.contextCaps" || _CONTEXT_CAP_PATH.test(String(args.key))
|
|
393
|
+
|| (args.key === "agent" && value !== null && typeof value === "object" && !Array.isArray(value) && Object.hasOwn(value, "contextCaps"))
|
|
394
|
+
if (capsWrite) {
|
|
395
|
+
bindProviderContextPolicy(config.provider, config)
|
|
396
|
+
if (ctx.agent.provider) bindProviderContextPolicy(ctx.agent.provider, config)
|
|
397
|
+
}
|
|
364
398
|
const sensitive = isSensitiveKey(String(args.key))
|
|
365
399
|
const shown = sensitive ? MASKED : value
|
|
366
400
|
const suffix = value === null
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ssh-transport.mjs — SSH 传输面单点(askpass 链 ∥ 子进程 ∥ 沉降 ∥ 输出帽)。
|
|
3
|
-
*
|
|
3
|
+
* 机制归属 = `docs/core/design/TOOLS.md` §6「SSH」(四门 ∥ 帽窗 ∥ askpass 分工居 §6–§6.5;
|
|
4
|
+
* 台账 #1436 已核销)。
|
|
4
5
|
*
|
|
5
|
-
* 拆档由 = 设计轮判定机制档改前读数过 500(`docs/core/
|
|
6
|
+
* 拆档由 = 设计轮判定机制档改前读数过 500(`docs/core/standards/CODE-TIER.md`「文件档位与两个时点」)——本档收**运行面**
|
|
6
7
|
* (与会话语义无关的传输原语),`ssh-session.mjs` 收**会话面**(池 / 生命周期 / 动作)。条目形
|
|
7
8
|
* (entry)由 `ssh-session.mjs` 定义并持有;本档只经其字段工作(`buf` / `mask` / `_waiters` /
|
|
8
9
|
* `promptRe` / `state` / `child` / `logStream` / `_notify` / `lastDataAt` / `bytes`)。
|
|
@@ -35,19 +36,19 @@ import { capText as capBudgetText, fillMarker } from "../text-budget.mjs"
|
|
|
35
36
|
import { createStripper, createMask, escapeNote, normalizeText } from "./ssh-text.mjs"
|
|
36
37
|
export { createStripper, createMask, escapeNote, normalizeText }
|
|
37
38
|
|
|
38
|
-
/**
|
|
39
|
+
/** 静默窗(TOOLS.md §6「SSH」):**只作去抖**——判尾部这半条标记到没到齐;不再单独构成「已就绪」。 */
|
|
39
40
|
export const SSH_SETTLE_MS = 800
|
|
40
|
-
/**
|
|
41
|
+
/** 硬超时(TOOLS.md §6「SSH」):`send` / `read` / `secret_input` 的本次等待;到点返回部分输出 + 可读句。 */
|
|
41
42
|
export const SSH_TIMEOUT_MS = 60_000
|
|
42
|
-
/** `connect`
|
|
43
|
+
/** `connect` 首屏等待(TOOLS.md §6「SSH」拆两常量——慢设备才拖不动连接)。 */
|
|
43
44
|
export const SSH_CONNECT_SETTLE_MS = 10_000
|
|
44
|
-
/**
|
|
45
|
+
/** 单次返回帽(TOOLS.md §6「SSH」):**返回窗口** = 保头 + 注记 + 保尾;省略中段回填未读缓冲。 */
|
|
45
46
|
export const SSH_RETURN_CAP = 8000
|
|
46
|
-
/**
|
|
47
|
+
/** 帽窗头尾比例(TOOLS.md §6「SSH」:头 60% ∥ 尾 40%——头段装接口 / ACL,尾段装结束证据)。 */
|
|
47
48
|
const CAP_HEAD_RATIO = 0.6
|
|
48
|
-
/**
|
|
49
|
+
/** 保活缺省(TOOLS.md §6「SSH」:`ServerAliveInterval=30`;测试态时间缝按 ms 传入后换算)。 */
|
|
49
50
|
export const SSH_KEEPALIVE_MS = 30_000
|
|
50
|
-
/**
|
|
51
|
+
/** 秘密环境变量名(TOOLS.md §6「SSH」秘密传递面)。 */
|
|
51
52
|
export const SECRET_ENV = "TC_SSH_SECRET"
|
|
52
53
|
/** 内存缓冲保留量(仅覆盖返回帽;全量恒在 log)。 */
|
|
53
54
|
export const BUF_KEEP_CHARS = 64 * 1024
|
|
@@ -93,14 +94,14 @@ export function unlinkAskpass(entry) {
|
|
|
93
94
|
export function buildSshEnv({ wrapper, secret }) {
|
|
94
95
|
const env = { ...process.env, SSH_ASKPASS: wrapper, SSH_ASKPASS_REQUIRE: "force" }
|
|
95
96
|
// 占位 DISPLAY:OpenSSH < 8.4 无 `SSH_ASKPASS_REQUIRE`(RHEL 8 / CentOS 8 代)——无 DISPLAY 时
|
|
96
|
-
// askpass 不被放行(`readpass.c` allow_askpass 判据);占位后新旧两代同走 askpass
|
|
97
|
+
// askpass 不被放行(`readpass.c` allow_askpass 判据);占位后新旧两代同走 askpass。
|
|
97
98
|
if (!env.DISPLAY) env.DISPLAY = ":0"
|
|
98
99
|
if (secret != null) env[SECRET_ENV] = secret
|
|
99
100
|
else delete env[SECRET_ENV]
|
|
100
101
|
return nodeChildEnv(env)
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
/**
|
|
104
|
+
/** 会话命令形(TOOLS.md §6「SSH」):`-tt` 强制远端 PTY + 保活三件 + 单提示;`port`/`user` 未给 ⇒ 不下发。
|
|
104
105
|
* `identityFile` 显式给出 / 记录有值 ⇒ `-i <路径>`(追加候选身份,不夺本机配置与 agent 的既有尝试序列)。
|
|
105
106
|
* 预探 = `NumberOfPasswordPrompts=0`(password ∥ keyboard-interactive 两径同被短路——
|
|
106
107
|
* `sshconnect2.c` `userauth_passwd` / `userauth_kbdint` 两处同判 `attempt++ >= n`;私钥口令提示
|
|
@@ -141,8 +142,8 @@ function handleChunk(entry, text) {
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/** 子进程挂载(双流解码 ∥ 剥离 → 遮蔽 ∥ 退出 ∥ spawn 错误——探连与会话同径)。
|
|
144
|
-
* 顺序 =
|
|
145
|
-
*
|
|
145
|
+
* 顺序 = **先剥离后遮蔽**(TOOLS.md §6「SSH」):剥离只删字节、不插入 ⇒ 切不断秘密字面;每条流一份剥离状态
|
|
146
|
+
* (两个流各自成序列,不共用一个半条状态)。到达计数在这之前记(门④ 口径 = 「回了没有」,
|
|
146
147
|
* 不随遮蔽尾缓冲的后扣而变)。 */
|
|
147
148
|
export function attachChild(entry, child) {
|
|
148
149
|
entry.child = child
|
|
@@ -200,7 +201,7 @@ export function spawnSession(entry, { user, port, secret, identityFile = null, k
|
|
|
200
201
|
return child
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
// ───
|
|
204
|
+
// ─── 就绪判据(TOOLS.md §6「SSH」四门)─────────────────────────────────────
|
|
204
205
|
|
|
205
206
|
/** 待答标记(门①——设备正等我发键;`--More--` 走空格、确认走 y/n)。 */
|
|
206
207
|
const ANSWER_MARKERS = ["--More--", "(y/n)", "Password:"]
|
|
@@ -238,8 +239,8 @@ function timeoutLabel(entry, startBytes) {
|
|
|
238
239
|
|
|
239
240
|
/** 等到就绪(返回 reason):`marker` ∥ `prompt` ∥ `timeout` ∥ `exited` ∥ `aborted`(`connect` 另有 `silence`)。
|
|
240
241
|
* 门①② 在**每个到达 chunk** 上求值;静默窗只判「尾部这半条标记到没到齐」(去抖)——不参与求值、不推迟
|
|
241
|
-
*
|
|
242
|
-
*
|
|
242
|
+
* 判断时点,也不再单独构成「已就绪」。`settleOnSilence` = `connect` 首屏沿用旧口径
|
|
243
|
+
* (TOOLS.md §6「SSH」:四门只判 `send` / `read` / `secret_input`)。 */
|
|
243
244
|
export function waitSettled(entry, { timeoutMs = SSH_TIMEOUT_MS, signal = null, settleOnSilence = false } = {}) {
|
|
244
245
|
return new Promise((resolve) => {
|
|
245
246
|
let done = false
|
|
@@ -288,7 +289,7 @@ export function waitSettled(entry, { timeoutMs = SSH_TIMEOUT_MS, signal = null,
|
|
|
288
289
|
})
|
|
289
290
|
}
|
|
290
291
|
|
|
291
|
-
/**
|
|
292
|
+
/** 就绪结论注记(TOOLS.md §6「SSH」):提示符 ∥ 待答标记 ∥ 硬超时(**点名失败门**)∥ 中断 ∥ 退出。 */
|
|
292
293
|
export function settleNote(entry, reason, waitedMs) {
|
|
293
294
|
if (reason === "prompt") return "settled (prompt matched)"
|
|
294
295
|
if (reason === "marker") return "settled (the device is waiting for input — the marker is shown above)"
|
|
@@ -319,7 +320,7 @@ export function drain(entry) {
|
|
|
319
320
|
return { text, dropped }
|
|
320
321
|
}
|
|
321
322
|
|
|
322
|
-
/**
|
|
323
|
+
/** 回填未读缓冲(丢最旧、保住尾证据;TOOLS.md §6「SSH」)。 */
|
|
323
324
|
function backfill(entry, middle) {
|
|
324
325
|
if (!middle || !entry) return
|
|
325
326
|
entry.buf = middle + entry.buf // 中段先于更新字节(回填顺序 = 原序)
|
|
@@ -329,7 +330,7 @@ function backfill(entry, middle) {
|
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
|
|
332
|
-
/**
|
|
333
|
+
/** 返回帽窗(TOOLS.md §6「SSH」):**返回总长 ≤ 帽(注记计入帽内)**——头 60% ∥ 注记 ∥ 尾 40%,
|
|
333
334
|
* 切点按行边界取整、取整只在头段(头段可少不可多);省略中段**回填未读缓冲**(下一次 `read` 先交出)
|
|
334
335
|
* ⇒ 长配置按窗口连续取全,不靠翻日志。截断本体 = `text-budget.mjs` `capText`(零新截断实现)。 */
|
|
335
336
|
export function capWindow(entry, text, max = SSH_RETURN_CAP) {
|
|
@@ -363,7 +364,7 @@ export function capWindow(entry, text, max = SSH_RETURN_CAP) {
|
|
|
363
364
|
return capBudgetText(t, { max, keepHead: head, keepTail: tail, marker: markerOf })
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
/**
|
|
367
|
+
/** 注记形(TOOLS.md §6「SSH」):`N` 走 `text-budget.mjs` `fillMarker` 占位约定;`H` ∥ `T` = 实保头 ∥ 尾长。 */
|
|
367
368
|
const WINDOW_MARKER = "[… N chars omitted (head H / tail T) — the omitted middle is kept; call read again to collect it …]\n"
|
|
368
369
|
const windowMarker = (omitted, head, tail) =>
|
|
369
370
|
fillMarker(WINDOW_MARKER, omitted).replace("H", String(head)).replace("T", String(tail))
|
|
@@ -374,7 +375,7 @@ const alignHead = (text, n) => {
|
|
|
374
375
|
return nl >= 0 ? nl + 1 : n
|
|
375
376
|
}
|
|
376
377
|
|
|
377
|
-
/**
|
|
378
|
+
/** 半条序列的收场(TOOLS.md §6「SSH」收场边界):尾部半条丢弃并计一次;其前后的可见字节照常交出。 */
|
|
378
379
|
export function flushEscapes(entry) {
|
|
379
380
|
let dropped = 0
|
|
380
381
|
for (const strip of entry.strippers ?? []) {
|
|
@@ -385,7 +386,7 @@ export function flushEscapes(entry) {
|
|
|
385
386
|
return dropped
|
|
386
387
|
}
|
|
387
388
|
|
|
388
|
-
/**
|
|
389
|
+
/** 状态行冠形(TOOLS.md §6「SSH」动作表末行):每返回首行。 */
|
|
389
390
|
export function statusLine(entry) {
|
|
390
391
|
const idle = Math.max(0, Math.round((Date.now() - entry.lastActivityAt) / 1000))
|
|
391
392
|
return `[ssh (${idLabel(entry)}) ${entry.host} — ${entry.state} · idle ${idle}s]`
|
package/agent-tools/step.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { DESC } from "../tools/shared.mjs"
|
|
|
14
14
|
import { runTurnLoop } from "../agent/turn-loop.mjs"
|
|
15
15
|
import { callModelTurn } from "../agent/chat-call.mjs"
|
|
16
16
|
import { ContinueError } from "../agent/helpers.mjs"
|
|
17
|
-
import {
|
|
17
|
+
import { readonlyActionOf } from "../agent/dispatch-gates.mjs"
|
|
18
18
|
import { allocRelay, emitRelayModel, wrapChildCallbacks, emitNestedChildEvent, stripEventTokensForCapture, CAPTURE_CAP_OPTS, TURN_CAP_MARK, STOPPED_MARK } from "../agent/spawn-child.mjs"
|
|
19
19
|
import { appendCappedText } from "../text-budget.mjs"
|
|
20
20
|
import { mergeChildMutations } from "./subagent-async.mjs"
|
|
@@ -168,6 +168,25 @@ export function buildForkedAgent(parent, { toolCallId, goal, verify = "", readon
|
|
|
168
168
|
_usageAt: (parent._lastPromptTokens != null && parent._usageFixedBase != null && parent._usageAt) ? { ...parent._usageAt } : null,
|
|
169
169
|
_usageFixedBase: (parent._lastPromptTokens != null && parent._usageFixedBase != null && parent._usageAt) ? parent._usageFixedBase : null,
|
|
170
170
|
_tokenSamples: Array.isArray(parent._tokenSamples) ? [...parent._tokenSamples] : [],
|
|
171
|
+
// 压缩面读的会话状态(`context.mjs` 的 `compressIfNeeded` ∥ `applyCompression` ∥ `reinjectAfterCompaction`):
|
|
172
|
+
// 分叉是同一段对话的延续,压缩在分叉里必须看到与主会话同一份状态。
|
|
173
|
+
// - 缺 `tasks`:`reinjectAfterCompaction` 在切完线之后抛(`agent.tasks.length`),压缩被报成摘要失败,
|
|
174
|
+
// 再走一遍 `compressFallback`——第二次切同一条线,并把好摘要换成降级文本。
|
|
175
|
+
// - 缺 `_compactCheckpoint`:分叉的第一次压缩传 `previousSummary: null`,合并摘要丢掉主会话此前压出来的事实(§6.2)。
|
|
176
|
+
// - 缺 `_tok` / `_tokRatio`:估算退回中性值 1,压缩判定比主会话偏晚。
|
|
177
|
+
// 写面全是整体赋值(`agent.tasks = items` ∥ `agent._compactCheckpoint = {…}`),浅拷贝即隔离——分叉的写入不回主会话。
|
|
178
|
+
tasks: Array.isArray(parent.tasks) ? [...parent.tasks] : [],
|
|
179
|
+
goal: parent.goal ? { ...parent.goal } : null,
|
|
180
|
+
_turns: Array.isArray(parent._turns) ? [...parent._turns] : [],
|
|
181
|
+
_compactCheckpoint: parent._compactCheckpoint ?? null,
|
|
182
|
+
_tok: parent._tok ? { ...parent._tok } : null,
|
|
183
|
+
_tokRatio: parent._tokRatio ?? 1,
|
|
184
|
+
// 压缩路径上另读的三个标量:`pushSessionHeadBlock` 的 `agent?._slot`、`compressIfNeeded` 的 `logCtx`
|
|
185
|
+
// 里的 `agent._logId` 与 `agent._sessionStart`。不继承的话,分叉压缩后重写的头块少掉 `· slot: <值>` 一项,
|
|
186
|
+
// 压缩轨迹也丢掉 child / session 关联。三者都是标量,无隔离问题。
|
|
187
|
+
_slot: parent._slot ?? null,
|
|
188
|
+
_logId: parent._logId ?? null,
|
|
189
|
+
_sessionStart: parent._sessionStart ?? null,
|
|
171
190
|
_stepContext: null,
|
|
172
191
|
}
|
|
173
192
|
}
|
|
@@ -195,9 +214,9 @@ export function buildForkToolMap(parentToolByName, { readonly = false } = {}) {
|
|
|
195
214
|
...tool,
|
|
196
215
|
execute: async (args, ctx) => {
|
|
197
216
|
if (FORK_BLOCKED_BATCH_ACTIONS.has(args?.action)) {
|
|
198
|
-
return `Error: batch action '${args.action}' is reserved for the main agent; inside a step fork only read/append/edit/status are allowed.`
|
|
217
|
+
return `Error: batch action '${args.action}' is reserved for the main agent; inside a step fork only read/check/append/edit/status are allowed.`
|
|
199
218
|
}
|
|
200
|
-
if (readonly &&
|
|
219
|
+
if (readonly && !readonlyActionOf(tool, "batch", args)) {
|
|
201
220
|
return `Error: this step is readonly=true — batch '${args?.action}' is blocked.`
|
|
202
221
|
}
|
|
203
222
|
return tool.execute(args, ctx)
|
|
@@ -210,7 +229,7 @@ export function buildForkToolMap(parentToolByName, { readonly = false } = {}) {
|
|
|
210
229
|
map.set(name, {
|
|
211
230
|
...tool,
|
|
212
231
|
execute: async (args, ctx) => {
|
|
213
|
-
if (
|
|
232
|
+
if (readonlyActionOf(tool, name, args)) return tool.execute(args, ctx)
|
|
214
233
|
return `Error: this step is readonly=true — '${name}' is blocked because it may modify files or external state.`
|
|
215
234
|
},
|
|
216
235
|
})
|
|
@@ -365,6 +384,7 @@ async function executeStep(args, ctx, { forceReadonly = false } = {}) {
|
|
|
365
384
|
turn: maxTurns,
|
|
366
385
|
})
|
|
367
386
|
if (wrapResp?.usage) {
|
|
387
|
+
forkCallbacks.onUsage?.(wrapResp.usage)
|
|
368
388
|
forkAgent._cacheHitTokens = (forkAgent._cacheHitTokens ?? 0) + (wrapResp.usage.prompt_cache_hit_tokens ?? 0)
|
|
369
389
|
forkAgent._cacheMissTokens = (forkAgent._cacheMissTokens ?? 0) + (wrapResp.usage.prompt_cache_miss_tokens ?? 0)
|
|
370
390
|
forkAgent._usageTurns = (forkAgent._usageTurns ?? 0) + 1
|
|
@@ -131,7 +131,10 @@ export async function executeEscalateAction(args, ctx) {
|
|
|
131
131
|
return `Error: provider "${pick.provider}" has no API key — set it in config.json before flying it in`
|
|
132
132
|
}
|
|
133
133
|
let effortNote = ""
|
|
134
|
-
|
|
134
|
+
// 2026-12-03 批(台账 #133):escalate 池的 effort 覆盖不再写 provider 克隆——写**子 agent 的会话视图**
|
|
135
|
+
//(克隆一份——子 agent 否则与父会话的 `config.modelParams` 同一引用)。
|
|
136
|
+
const escalateModelParams = { ...(parent.modelParams ?? {}) }
|
|
137
|
+
if (pick.effort && !clampEffort(escalateModelParams, pick.model, pick.effort)) {
|
|
135
138
|
// enum 外 effort 丢弃(preset 默认也可能对 override model 是 enum 外值)
|
|
136
139
|
effortNote = ` (effort "${pick.effort}" unsupported by ${pick.model}, dropped)`
|
|
137
140
|
}
|
|
@@ -144,7 +147,7 @@ export async function executeEscalateAction(args, ctx) {
|
|
|
144
147
|
// ASYNC-RESULT-CONTAINER.md D2)。
|
|
145
148
|
// `async: false` keeps the legacy synchronous flight below (backward compat).
|
|
146
149
|
if (args?.async !== false) {
|
|
147
|
-
return launchEscalateAsync(parent, ctx, { task: String(task), provider, tag, effortNote })
|
|
150
|
+
return launchEscalateAsync(parent, ctx, { task: String(task), provider, tag, effortNote, modelParams: escalateModelParams })
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
const relayPrefix = makeRelay(parent, "escalate", ctx.callbacks?.onToken, provider.model ?? tag)
|
|
@@ -173,6 +176,7 @@ export async function executeEscalateAction(args, ctx) {
|
|
|
173
176
|
role: "coder",
|
|
174
177
|
})
|
|
175
178
|
child._historyWindow = RECORD_WINDOW_MESSAGES // TUI-OOM-ROOTCAUSE·AGENT-LOOP.md §9.2:子代理人读线窗口(四处创建点同置)
|
|
179
|
+
child.modelParams = escalateModelParams // escalate 池的 effort 覆盖(已钳制)住子会话视图(2026-12-03 批)
|
|
176
180
|
child._logId = escId // LOGGING:子内事件归属(escalate#N)
|
|
177
181
|
// SUBAGENT-UPSTREAM-CHANNEL(§6.27.4 W2——escalate **sync**:单向;工具返回注走同步形)。
|
|
178
182
|
child._upstream = { parent, label: escId, sync: true }
|
|
@@ -41,6 +41,8 @@ import { injectBgResult } from "./bash-async.mjs"
|
|
|
41
41
|
// 批 browser-async-fix:后台浏览器动作注入器(同族——role="browser" 分发到 browser-async.mjs)。
|
|
42
42
|
import { injectBrowserResult } from "./browser-async.mjs"
|
|
43
43
|
import { mergeAttribution } from "../agent/batch-attribution.mjs" // 归属表合入(收口取材的判据一;子代理记在自己的 agent 上,并回父侧)
|
|
44
|
+
// 值告警的唯一出口(`CONFIG.md` §2.4):stderr 不是终端时静默。
|
|
45
|
+
import { warnConfig } from "../config-warn.mjs"
|
|
44
46
|
|
|
45
47
|
// agent-tools 共享:并行子代理的审批/继续弹窗经 owner 上命名 promise 链串行——
|
|
46
48
|
// 永不叠弹窗(返回链供调用方 .then 续接)。
|
|
@@ -91,7 +93,7 @@ export function resolvePoolLimits(raw) {
|
|
|
91
93
|
return limits
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
/** One-time fallback warn dedupe (warnedModels /
|
|
96
|
+
/** One-time fallback warn dedupe (warnedModels / warnedContextCaps precedent). */
|
|
95
97
|
const warnedPoolConfigs = new Set()
|
|
96
98
|
|
|
97
99
|
/**
|
|
@@ -121,7 +123,7 @@ export function poolLimitsFor(agent) {
|
|
|
121
123
|
function warnPoolFallback(what, sig) {
|
|
122
124
|
if (warnedPoolConfigs.has(sig)) return
|
|
123
125
|
warnedPoolConfigs.add(sig)
|
|
124
|
-
|
|
126
|
+
warnConfig(`[config] agent.poolLimits: ${what} — must be a positive integer ≥1 — falling back to default ${JSON.stringify(ASYNC_POOL_LIMITS)}`)
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
/** Running count within ONE pool domain (口径同 AGENT-LOOP-SUBAGENT.md §6.7.3 T6: queued 与已完成不计入;
|
package/agent-tools/subagent.mjs
CHANGED
|
@@ -253,7 +253,7 @@ export const subagentTool = {
|
|
|
253
253
|
throw new Error("Engineering mode: role='coder' is disabled — use role='eng-coder' for implementation tasks (or role='eng-designer' for design writing).")
|
|
254
254
|
}
|
|
255
255
|
if (role === "plan") {
|
|
256
|
-
throw new Error("role='plan' subagent is retired — plan micro-steps directly in the main session with `
|
|
256
|
+
throw new Error("role='plan' subagent is retired — plan micro-steps directly in the main session with `repo_graph` + `task` (or enter read-only plan mode via the `plan` tool).")
|
|
257
257
|
}
|
|
258
258
|
if (!parent.config?.agent?.engineering && role === "eng-coder") {
|
|
259
259
|
throw new Error("Engineering mode is not active — use role='coder' for implementation tasks.")
|