thincoder 0.12.59 → 0.12.61
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 +62 -4
- package/README.md +10 -8
- package/bin/thincoder.mjs +99 -133
- package/package.json +6 -4
- package/src/abort-provenance.mjs +116 -0
- package/src/acp/bridge.mjs +45 -21
- package/src/acp.mjs +6 -1
- package/src/advisor/citations.mjs +83 -21
- package/src/advisor/compaction.mjs +174 -0
- package/src/advisor/loop.mjs +293 -0
- package/src/advisor/messages.mjs +59 -137
- package/src/advisor/project-context.mjs +194 -0
- package/src/advisor/repos.mjs +17 -40
- package/src/advisor/run.mjs +156 -359
- package/src/advisor/truncate.mjs +57 -0
- package/src/advisor.mjs +27 -7
- package/src/agent/completion.mjs +17 -11
- package/src/agent/dispatch.mjs +145 -27
- package/src/agent/helpers.mjs +107 -13
- package/src/agent/record-results.mjs +55 -11
- package/src/agent/relay-prefix.mjs +39 -0
- package/src/agent/run-stages.mjs +242 -0
- package/src/agent/setup-reminders.mjs +69 -0
- package/src/agent/setup.mjs +107 -127
- package/src/agent/spawn-child.mjs +55 -13
- package/src/agent-tools/advisor-async.mjs +346 -0
- package/src/agent-tools/advisor-settle.mjs +231 -0
- package/src/agent-tools/advisor.mjs +167 -116
- package/src/agent-tools/async-settle.mjs +191 -0
- package/src/agent-tools/batch-segment.mjs +195 -0
- package/src/agent-tools/consult.mjs +139 -107
- package/src/agent-tools/design-token.mjs +117 -0
- package/src/agent-tools/digest-budget.mjs +76 -0
- package/src/agent-tools/eng.mjs +24 -29
- package/src/agent-tools/escalate-async.mjs +289 -0
- package/src/agent-tools/read-history.mjs +166 -32
- package/src/agent-tools/recent-changes.mjs +2 -1
- package/src/agent-tools/review-streak.mjs +93 -0
- package/src/agent-tools/settings.mjs +137 -34
- package/src/agent-tools/subagent-actions.mjs +180 -133
- package/src/agent-tools/subagent-async.mjs +184 -177
- package/src/agent-tools/subagent-panel.mjs +160 -0
- package/src/agent-tools/subagent-run.mjs +205 -0
- package/src/agent-tools/subagent-scheduler.mjs +100 -27
- package/src/agent-tools/subagent-spawn.mjs +453 -0
- package/src/agent-tools/subagent.mjs +256 -578
- package/src/agent-tools/verify.mjs +119 -292
- package/src/agent-tools.mjs +1 -0
- package/src/agent.mjs +89 -205
- package/src/cli/distill-command.mjs +12 -6
- package/src/cli/make-agent.mjs +26 -8
- package/src/cli/memory-command.mjs +4 -3
- package/src/cli/permission.mjs +2 -2
- package/src/cli/setup-wizard.mjs +42 -17
- package/src/completions.mjs +114 -0
- package/src/config-migrate.mjs +70 -0
- package/src/config.mjs +180 -63
- package/src/context.mjs +5 -147
- package/src/conventions.mjs +223 -0
- package/src/crash-reports.mjs +128 -0
- package/src/distill.mjs +11 -11
- package/src/expand-home.mjs +16 -0
- package/src/explore-distill.mjs +155 -0
- package/src/generate-title.mjs +1 -1
- package/src/hooks.mjs +7 -3
- package/src/memory/code-index.mjs +9 -3
- package/src/memory/code-sync.mjs +72 -32
- package/src/memory/core.mjs +6 -193
- package/src/memory/delete.mjs +236 -0
- package/src/memory/docs.mjs +68 -54
- package/src/memory/file-walk.mjs +109 -0
- package/src/memory/schema.mjs +15 -3
- package/src/memory.mjs +3 -1
- package/src/model-ref.mjs +66 -0
- package/src/model-specs.mjs +42 -8
- package/src/peer-domains.mjs +265 -0
- package/src/peer-instances.mjs +231 -0
- package/src/prompt-overlays.mjs +82 -0
- package/src/prompts/advisor-design.md +18 -75
- package/src/prompts/advisor-round1.md +14 -67
- package/src/prompts/advisor-round2.md +15 -51
- package/src/prompts/advisor-round3.md +15 -51
- package/src/prompts/common.md +115 -0
- package/src/prompts/consult-base.md +5 -23
- package/src/prompts/discipline-engineering.md +217 -0
- package/src/prompts/discipline-normal.md +179 -0
- package/src/prompts/persona-coder.md +21 -0
- package/src/prompts/persona-eng-coder.md +37 -0
- package/src/prompts/persona-eng-designer.md +55 -0
- package/src/prompts/persona-engineering.md +54 -0
- package/src/prompts/persona-explore.md +15 -0
- package/src/prompts/persona-normal.md +27 -0
- package/src/prompts/persona-plan.md +26 -0
- package/src/provider/anthropic.mjs +4 -4
- package/src/provider/core.mjs +18 -98
- package/src/provider/errors.mjs +101 -0
- package/src/provider/google.mjs +5 -6
- package/src/provider/index.mjs +2 -1
- package/src/provider/list-models.mjs +93 -0
- package/src/provider/rate.mjs +2 -1
- package/src/provider/responses.mjs +5 -3
- package/src/provider/retry.mjs +8 -45
- package/src/provider/sse.mjs +3 -4
- package/src/proxy.mjs +9 -14
- package/src/session-gc.mjs +214 -0
- package/src/session-guard.mjs +47 -0
- package/src/session-rename.mjs +38 -0
- package/src/session-slots.mjs +188 -60
- package/src/session.mjs +104 -124
- package/src/token-ttl.mjs +274 -0
- package/src/tools/{system.mjs → bash.mjs} +19 -221
- package/src/tools/checklist-sync.mjs +181 -0
- package/src/tools/checklist.mjs +52 -39
- package/src/tools/edit-batch.mjs +109 -10
- package/src/tools/edit-diff.mjs +110 -27
- package/src/tools/edit.md +17 -12
- package/src/tools/execute.mjs +31 -4
- package/src/tools/file.mjs +41 -16
- package/src/tools/git.md +1 -1
- package/src/tools/git.mjs +23 -34
- package/src/tools/glob-dialect.mjs +130 -0
- package/src/tools/glob.md +3 -3
- package/src/tools/grep.md +1 -1
- package/src/tools/index.mjs +9 -8
- package/src/tools/ops.mjs +188 -3
- package/src/tools/patch.mjs +3 -3
- package/src/tools/question.md +4 -0
- package/src/tools/question.mjs +26 -0
- package/src/tools/read.md +1 -2
- package/src/tools/read_image.md +1 -1
- package/src/tools/search.mjs +236 -0
- package/src/tools/shared.mjs +14 -13
- package/src/tools/wait_for.md +22 -0
- package/src/tui/agent-turn.mjs +36 -228
- package/src/tui/ansi.mjs +2 -0
- package/src/tui/clipboard.mjs +7 -1
- package/src/tui/cmd-advisor.mjs +3 -2
- package/src/tui/cmd-config.mjs +142 -30
- package/src/tui/cmd-eng.mjs +28 -40
- package/src/tui/cmd-exit.mjs +6 -8
- package/src/tui/cmd-mcp.mjs +8 -2
- package/src/tui/cmd-model.mjs +14 -12
- package/src/tui/cmd-new.mjs +3 -2
- package/src/tui/cmd-reindex.mjs +7 -0
- package/src/tui/cmd-session.mjs +19 -4
- package/src/tui/cmd-submodel.mjs +8 -5
- package/src/tui/cmd-think.mjs +10 -10
- package/src/tui/cmd-undo.mjs +4 -3
- package/src/tui/cmd-upgrade.mjs +19 -4
- package/src/tui/config-helpers.mjs +28 -16
- package/src/tui/distill-cmd.mjs +1 -1
- package/src/tui/index.mjs +40 -38
- package/src/tui/interaction.mjs +3 -3
- package/src/tui/key-handler.mjs +61 -17
- package/src/tui/key-modes.mjs +86 -8
- package/src/tui/layout.mjs +18 -10
- package/src/tui/model-catalog.mjs +89 -0
- package/src/tui/model-picker.mjs +498 -0
- package/src/tui/mouse.mjs +52 -9
- package/src/tui/pickers.mjs +28 -392
- package/src/tui/render-frame.mjs +32 -16
- package/src/tui/render-loop.mjs +2 -0
- package/src/tui/render-segments.mjs +12 -9
- package/src/tui/render.mjs +37 -5
- package/src/tui/slash-commands.mjs +2 -2
- package/src/tui/startup.mjs +4 -0
- package/src/tui/subagent-blocks.mjs +106 -295
- package/src/tui/subagent-children.mjs +162 -0
- package/src/tui/subagent-freeze.mjs +169 -0
- package/src/tui/subagent-panel.mjs +24 -31
- package/src/tui/suspension-drive.mjs +297 -0
- package/src/tui/tool-args.mjs +7 -5
- package/src/tui/tool-display.mjs +143 -0
- package/src/tui/tool-events.mjs +56 -185
- package/src/tui/tui-lifecycle.mjs +46 -4
- package/src/tui/update-notice.mjs +4 -0
- package/src/tui/wizard.mjs +61 -21
- package/src/tui/wrapped-spawn.mjs +38 -0
- package/src/prompts/coder.md +0 -56
- package/src/prompts/discipline.md +0 -102
- package/src/prompts/eng-coder.md +0 -44
- package/src/prompts/engineering-sub.md +0 -34
- package/src/prompts/engineering.md +0 -340
- package/src/prompts/explore.md +0 -21
- package/src/prompts/main.md +0 -56
- package/src/prompts/methodology-template.md +0 -58
- package/src/prompts/plan.md +0 -16
- package/src/prompts/system.md +0 -63
- package/src/tools/pdf-parse-text.mjs +0 -497
- package/src/tools/pdf-parse-xref.mjs +0 -499
- package/src/tools/pdf.mjs +0 -155
- package/src/tools/read_pdf.md +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,68 @@
|
|
|
1
|
+
## [0.12.61] — 2026-09-11
|
|
2
|
+
|
|
3
|
+
> 0.12.60 → 0.12.61(§4.3 连续号——发布时定号)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **集成集 + 发布门三环(TEST-LIFECYCLE 批)**:`test/integration/`(7 场景 22 用例:普通模式工具流 / 工程模式全链 / 子代理生命周期 / 会话恢复 / TUI 基本盘 / commit 验证关口 / 配置与 provider 选路)+ `test/run-integration.mjs`;`npm run release:check` = lint → test:full → test:integration(prepublishOnly 接线)——发布唯一门禁。
|
|
8
|
+
- **需求池机检 `scripts/check-ledger.mjs`**(FR18 收拢):指针解析 / D3 组计数 / 六态 / 触发字段 / 老化报告 / 基线降报告;两仓台账收拢(活 30+9 · 归档档 40+11)。
|
|
9
|
+
- **provider.headers 全通路铺开**(Gitee #IKDWH7)· **`~` 家目录展开**(HOME-EXPANSION)· **websearch provider key**(工具面)。
|
|
10
|
+
- **DeepSeek V4.1-Flash 接入** + 模型清单 provider 化(去候选否决权)。
|
|
11
|
+
- **工程模式链路**:角色重定义(FR9 三分 + 内容权)/ 公共层扩容(common.md 10 节·双端 18 档)/ 批次档段写入工具 / 可移植性 FR10–FR15(项目约定去硬编码:`conventions.mjs` + `project-context.mjs`)。
|
|
12
|
+
- **逃生与可观测面**:子代理 abort 来源标注 · 评审池丢弃(报告不达提醒 + 不签发 token)· consult/escalate 完全异步化 · `read_history` 跨会话检索(R19)。
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **测试生命周期 v3**:三层来源(单元=开发期脚手架 / 集成-业务 / 集成-生产)+ 退役常态 + 削段合档(11 档退役 ~880 行 · 3 并 · 防回潮静态锚 T75/T76 收归)。
|
|
17
|
+
- **台账体系**:TODO 归档机制(活文件只留未决 + `TODO-archive.md`)+ 归属修订「记录 + 状态推进 + 物理落笔 = 主 agent」+ 六态机检。
|
|
18
|
+
- **TUI**:选择面统一(picker/wizard/question)· 输入修复集 · 方向键(连续上溯/多行竖移)· Stop 钩子 · 跨段 turn 累计 · attention 状态。
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- settings 工具 null 默认键类型校验 · ACP 通道修整(headless 裁剪 + relay 前缀剥离)· 评审注入路径硬编码(可移植性 A 家族)· advisor 上下文预算(CJK 加权)· 文档一致性检查扩面 + 宽度基线。
|
|
23
|
+
|
|
24
|
+
## [0.12.60] — 2026-09-08
|
|
25
|
+
|
|
26
|
+
> 0.12.59 → 0.12.60(§4.5 连续号——发布时定号)
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **R17 会诊/飞刀完全异步化(AGENT-LOOP.md §25——2026-09-06/07)**:consult_check 退役(digest 自动注入闭环);escalate 入 other 池异步化(async:false 保留);三族 pending 注入/驱动推广;T-R17a..r 全绿(CLI L2 1626/1626 + VS 1301/1301)
|
|
31
|
+
- **记账路径 join→resolve 双前缀修复(R-bug——2026-09-07——AGENT-LOOP.md §24 尾修复注)**:record-results.mjs ×2 + agent.mjs ×1 `join(agent.cwd, p)` → `resolve(agent.cwd, p)`(绝对路径 p 双前缀——touchedFiles/记账错路径——修复前先验失败实拍——guards.test +12 断言)
|
|
32
|
+
- **R18 长测试输出先落盘纪律条款(AGENT-LOOP.md §26——2026-09-06 快车道)**:`src/prompts/system.md` Rules 工具纪律区插逐字条款("长输出命令先落盘"——全量/长测试(≥60s)先重定向日志再查——汇总读尾部/失败 grep——禁过滤管道直跑长命令——镜像锚逐字稿照抄 AGENT-LOOP §26.2——各端独立断言)+ 日志位置执行细则(OS 临时/~/.thincoder 类非工作区——查毕删除——防 git 工作区 untracked 污染——条款逐字不改)。锚测试 T-R18.1/T-R18.2(fail-when-unchanged)。双端各自落端(VS Code 侧并行照抄)。
|
|
33
|
+
- **R19 跨会话历史检索 + 检索族消歧(SESSION.md §13——2026-09-06)**:`read_history` 加 `path` 参数(可选——缺省 = 本会话零行为变化)——path = 会话文件路径 → 跨会话单槽深查(同 filter 面 role/keyword/tool/since/until/limit/direction 应用 + limit clamp);path = "cwd:xxx" → 发现面(列该 cwd 全部槽——每槽摘要行含槽号 + 完整文件路径 + title/消息数/updatedAt——不做死槽过滤——时间序);行扫护栏 READ_HISTORY_SCAN_MAX = 200,000 行——超限返回定稿文案 `{"error":"session too large — refine keyword or since/until"}`(不再读全文);read_history 描述尾段插族表总纲(D-R19b 逐字——checkpoint cat/versions 经核验保留——git 动作面含 versions);recent_changes/memory/doc_search/code_search 描述补互指句。测试 T-R19.1..7(含 3b/3c/3d 错误/边界子行 + 描述锚)。压缩刀锋 fixture 随 schema 增重校准(session-compaction T3b 15500 → 17000——沿革注更新)。
|
|
34
|
+
|
|
35
|
+
- **legacy v1 扩展删除集(SESSION.md §12.7——2026-09-06)**:`session gc` 冷 cwd 整前缀删除集补裸 `{hash}.json`(v1 死数据——§12.6 裁决代码同步);三处同源单集合(dry-run 报告/confirm 警告/删除共用);自动残留 GC 面零触碰。测试 T-V1a..d(含 v1 报告/删除/--all/活跃拒绝)。父侧 L2 1543/1543 全绿。
|
|
36
|
+
|
|
37
|
+
- **测试分层 Phase 3:存量清理 + 红线收窄(TESTING.md §1 D-T4/D-T5——2026-09-06——用户逐项批准删除清单)**:删除一次性迁移零残留锁 11 组 + 防回潮元测试 4 案 + 同锚多断 3 组(1492→1486,差额 -6 全对账);"断言数不减"红线收窄为拆分轮专用(system.md Module Split Policy + 双 METHODOLOGY.md 拆后两验注——清理轮改删除清单制)。测试 T-T5 收窄锚断言。**五杠杆批全链收口——总目标 AC-T4 ✓:链测试墙钟 ~4.5-5.5min → ~1.6min(降 ~70%)**。
|
|
38
|
+
|
|
39
|
+
- **测试分层 Phase 2:eng-coder 首次实现降 L0+(TESTING.md §1 D-T3——2026-09-06——supersede §18.7 D-TS1 首次实现全量 L1 口径)**:`engineering-sub.md` 验证粒度段修订——首次实现 = L0+(语法检查 + §18.12 定向相关测试,秒级),L1 收窄为显式升级档(兜底语义保留),修正轮 L0 与父侧 L2 不变;交付报告义务锚句("not full-suite verified — the parent-side L2 run is the only full-suite point."——双端逐字镜像)。AGENT-LOOP §18.7 原位 supersede 注。测试 T-T4 锚断言(fail-when-unchanged + 旧句零残留)。实测快层 18.5s 全绿 1492 用例。
|
|
40
|
+
|
|
41
|
+
- **测试分层 Phase 1:slow 门防漏拦截 + 快层归册(TESTING.md §1——2026-09-06——用户"测试已成包袱"五杠杆批之零冲突先行段)**:`test/slow-gate.mjs`(reporter 收集叶子用例耗时——未标 slow 超 800ms 拦截阈值即报错红,防快层腐化——env `THINCODER_SLOW_GATE_MS` 可覆盖)+ `test/run-fast.mjs`(npm test 新入口——spec 直通 + gate 判定非零退出 + `--test-concurrency=6`);60 条重 IO 用例归册(只加 slow() 标记,零删除零本体改动);机制自验 `test/slow-gate.test.mjs` 红/绿双证。**实测:快层 38.0s → 19.2-19.7s(≤20s 达标),test:full 1491/1491 全绿**。
|
|
42
|
+
|
|
43
|
+
- **拆分判据修辞防博弈加固(METHODOLOGY.md 2026-09-06 变更条——快车道——用户实测模型引用"才 500 多行、没 2300 行大"拒绝拆分)**:文件档升同级判定表(>500 = 必须拆——硬限、无例外、无相对比较通道——原"兜底红线"定性退役);函数档改定位 = 早期预警线、文件档 = 不可协商底线;新增"相对大小永远不是豁免"封堵句(中英镜像)+ 动机节封口句 + 反例档案新行(相对大小打折硬限实测反例);**AGENTS.md / .thincoder/advisor.md 测试文件+生成代码豁免说辞全删(用户裁定"不允许豁免"——工作区根两文件同删)**——存量 26 个 >500 测试文件登记 TODO 拆分轮。测试 T-S1/S2/S3/S5 锚断言(prompts.test.mjs——含旧修辞零残留负向断言)。
|
|
44
|
+
|
|
45
|
+
- **question 工具使用抑制(AGENT-LOOP.md §22——2026-09-06 快车道——用户实测过度提问/大段文字/一条多问)**:工具描述 Notes 补三条逐字锚(一次一问不塞子问题 / 问题文本要短、背景走正文回复 / 例行确认门走普通文本回复、question 仅留真实决策场景);提示词三文件锚(engineering.md Questioning Style 两条 + system.md 确认门形式句 + discipline.md 工具表反模式扩展);questionTool execute 机械上限(git.mjs 寄生段——question >100 字符 / options >4 条返回错误串、不弹卡不调 onQuestion——用户裁定值——guard 仅 `Array.isArray(options) && length > 4` 触发、非数组透传)。测试 T-Q1/T-Q3/T-Q4/T-Q5/T-Q6/T-Q7(git.test + prompts.test——锚 fail-when-unchanged + 超限拒绝/边界透传)。
|
|
46
|
+
|
|
47
|
+
- **async spawn 收尾引导(AGENT-LOOP.md §19.7——2026-09-06)**:subagent 工具描述 Async spawn 段尾部补收尾引导锚句("After an async spawn the turn winds down normally — nothing expects you to wait for it…"——逐字定稿于设计文档 §19.7 D-A2)——模型 async spawn 后回合自然收尾、unchecked 结果自动到达(下轮注入/挂起态 digest)、无需自发 status/check 轮询等待;锚句内容断言 fail-when-unchanged(设计锚 + 两端各自断言——防描述再漂移——D-A4)。测试 T-D-A2。
|
|
48
|
+
- **subagent check 动作删除 + 锚句收紧(AGENT-LOOP.md §19.8——2026-09-06 用户裁定"check 是冗余 API")**:工具面六动作 → 五动作(spawn/status/escalate/cancel/panel)——删 `action:"check"` + `n` 参数 + `executeCheckAction`/`MAX_ASYNC_CHECKS`/`_asyncCheckLastN` 全链路;async 子代理结果仅自动通道送达(回合尾 collect/挂起 digest——§17.5 机制零改动——consumed 终态墓碑保留——dependsOn 语义不变);Async spawn 段描述替换为 D-CH2 锚句逐字("…do not poll or wait for the result…use a synchronous spawn instead—pass `async:false`…"——fail-when-unchanged 断言);main.md/discipline.md/工具描述 check 引导句改自动送达口径;停滞检测(P-SL2)check 守卫路径删除——F-SL2 语义面迁至 status 视图(可显示停滞标记不变)。测试:check 域用例删 8 条(逐条见交付报告)+ 2 条在位改自动通道形态(T-SD14/T-H3)+ T-M16 改 status 形态 + D-A2 断言在位改 D-CH2。
|
|
49
|
+
- **工程模式 token 防伪层删除(ENGINEERING-MODE.md 2026-09-06 段——用户裁定"过度工程给我删了")**:advisor.mjs 删 DEFAULT_TOKEN_SECRET / USING_DEFAULT_SECRET / TOKEN_SECRET / warnIfDefaultSecret + 启动警告与 HMAC 签名/验签——token 回归**无签名流程凭证**(格式 uuid:expiresAt——TTL 检查 fail-closed + designId 槽位精确匹配不变);存量 3 段 token 格式判错 fail-closed 拒绝(不迁移——重评一次);NFR3/§2.3/§2.7/§2.6 文档同步。
|
|
50
|
+
- **会话"当前槽位"按端分离(R4——2026-09-05——SESSION.md §10)**:CLI 与 VS Code 各自 end marker(`{manifest}.cli|.vscode`,本端单写者)记录"本端最后使用的槽位"——恢复决策 resumeSlot(本端记录 → 无记录一次性继承 active 死主槽 → 全新分配)替代共享 manifest.active 作为恢复依据——双端同开时退出 CLI 重进不再进错会话/空白新槽;启动即钉 _slot 闭合"load→首保存"迁移窗口;/session 列表高亮按本端记录(含被删守卫)。双端同批镜像(L2:CLI 1485/1437+48skip/0 + VS Code 1196/1196 全绿)。
|
|
51
|
+
- **git 工具 add/rm/commit 多路径(2026-09-05 发版后——git add 单路径被迫 N 次调用)**:`path` 空格分隔多路径(`git add a b c`——ref 多值先例同法——split(/\s+/));path 描述尾追加注(保既有原子串断言);双端同改(CLI git.test + VS Code git.test 镜像用例——add/rm/commit 三动作多路径覆盖)。
|
|
52
|
+
- **release:check 一键发版门禁(scripts/release-check.mjs——2026-09-05 0.12.59 发版教训)**:lint + test:full 合并一键;全量输出捕获不刷屏(只打摘要);失败自动提取 failing tests 详情段(此前为看错误详情跑 3 次全量);RELEASE.md §1 发布前检查合并 + 修复迭代局部重跑纪律 + prepublishOnly 双保险注。
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- fix: 子代理块 done 后定格修复批(2026-09-07 id:14)——CLI trimSubTree done 豁免 + route* done 守卫(迟到 chunk 丢弃)
|
|
57
|
+
- fix: prompts.test 折行断言折叠化收口(2026-09-07 id:3)——双侧 \s+ 归一匹配——负守卫保持负向——锚整块/落位序断言加固
|
|
58
|
+
|
|
1
59
|
## [0.12.59] — 2026-09-05
|
|
2
60
|
|
|
3
|
-
> 0.12.58 → 0.12.59(§
|
|
61
|
+
> 0.12.58 → 0.12.59(§4.5 连续号——发布时定号)
|
|
4
62
|
|
|
5
63
|
### Added
|
|
6
64
|
|
|
7
|
-
- **settings 工具(SETTINGS-TOOL.md——2026-09-05 用户三项裁定)**:agent 配置调整通道——list/get/set(全量 config.json 任意键点分路径);set = 写盘 + 热应用(运行中即生效);敏感键(apiKey/token/secret/password 段)回显永遮罩;已知键类型校验(DEFAULTS 自动派生);list/get 只读动作(planMode 放行);set 审批门。测试 T-S1.1-11(CLI 11 + VS Code 6
|
|
65
|
+
- **settings 工具(SETTINGS-TOOL.md——2026-09-05 用户三项裁定)**:agent 配置调整通道——list/get/set(全量 config.json 任意键点分路径);set = 写盘 + 热应用(运行中即生效);敏感键(apiKey/token/secret/password 段)回显永遮罩;已知键类型校验(DEFAULTS 自动派生);list/get 只读动作(planMode 放行);set 审批门。测试 T-S1.1-11(CLI 11 + VS Code 6)——**记账更正(2026-09-11):原声称的测试未随批落地(欠账);已于 2026-09-11 补齐:CLI 25 例 / VS Code 6 例(第 8 批)。**
|
|
8
66
|
- **subagent-async 模块拆分(§20.9 Module Split Policy——2026-09-05 F-N1.5 两段式首批)**:CLI subagent-async.mjs 1020 → 405 行(subagent-scheduler.mjs 231——§20 调度组 + 文件域组 / subagent-actions.mjs 416——status/panel/escalate 动作执行器组)——纯迁移零行为变化(测试零改动 + 断言计数前后对拍一致)。
|
|
9
67
|
- **P-SL2 停滞机械检测(AGENT-LOOP §21.1 扩展注 P-SL2——2026-09-05)**:混合边环形等待停滞 → check/status 守卫明确报错列阻塞链(cancel 破环引导)——防御性(自然流不可达——人工注入可构造)。测试 T-SL2 ①-⑤(scheduler 22 → 27 用例)。
|
|
10
68
|
|
|
@@ -16,7 +74,7 @@
|
|
|
16
74
|
- **普通模式两段式(AGENT-LOOP.md §21 F-N1.5——2026-09-05 用户"把 coder 用起来……解决自查问题")**:规模实现批次默认委托 coder 子代理(async——设计书为 task book)——执行/检查心智分离(隔离上下文破自查盲区);小改动/探索留内联;复核走 F-N1.4(偏差退回 coder ≤2 轮)。测试 T-N1.9 双端。
|
|
17
75
|
- **委托操作标准(AGENT-LOOP.md §21 扩展注 4——F-N1.6——2026-09-05 用户"spawn coder 干活现在并没有明确的标准是吗")**:规模判据可操作化(≥2 文件/单文件 >30 行逻辑/模块边界/双端镜像 → 委托;≤30 行/文档同步/探索 → 内联);任务书七字段标准(目标/已知事实/设计+禁止/约束/硬验收/报告格式/调度元数据——缺字段=委托缺陷);委托模式判据(async 默认/sync 仅依赖链/并行仅文件域互斥);通用验收基线。测试 T-N1.10 双端。
|
|
18
76
|
- **/config 交互修复(2026-09-05)**:改配置项保存后回主菜单(不再退到输入框)——每轮刷新 ac/tc 配置引用(reloadConfig 换对象后显示新值);view 浏览态同回菜单。
|
|
19
|
-
- **版本号连续性规则(RELEASE.md §
|
|
77
|
+
- **版本号连续性规则(RELEASE.md §4.2/§4.3——2026-09-05 用户裁定"不要跳号")**:号在发布时定、开发期不预占(CHANGELOG 挂 [Unreleased]);待发号 = registry 最高 + 1;缺口不补。
|
|
20
78
|
|
|
21
79
|
### Fixed
|
|
22
80
|
|
|
@@ -80,7 +138,7 @@
|
|
|
80
138
|
|
|
81
139
|
### Added
|
|
82
140
|
|
|
83
|
-
- **`/mcp` edit/add 统一字段 picker 表单(v2)+ agent 代配闭环**(docs/design/MCP.md §5,CLI-only):① **edit = 字段选择表单**——picker 列可编辑字段行(`HTTP URL https://…` / `Token
|
|
141
|
+
- **`/mcp` edit/add 统一字段 picker 表单(v2)+ agent 代配闭环**(docs/design/MCP.md §5,CLI-only):① **edit = 字段选择表单**——picker 列可编辑字段行(`HTTP URL https://…` / `Token ••••…` 打码 / `Headers 2 items`;stdio `Command/Args/Env`;name 不可改无行)+ 末行 `✓ Save & test`;选中字段只输入该字段新值(提示 `(current: …)`——空=不变、`-`=删可选字段、`k=`=删 header/env 项、required 字段拒绝 `-`)→ 回 picker 循环连改多字段(中间 Esc 回 picker 不丢已改值);**废除逐字段预填重问**(改 token 不再被迫路过 URL/headers);② **add 复用同一表单**——空 entry 起、必填字段 `(required)` 标注、Save 校验必填非空(未满足提示并停留表单不落盘)、headers/env 不选即跳过、add 的 name 可编辑(重复名检查);③ **保存前预览 + 探活 + 字段级重试合一**——`showPreview`(token 遮蔽)→ `probeMcpServer` 零副作用探活(`✓ N tools, Xms` / `✗ 错误`)→ `Save? (Y/n)`;探活失败 → `Save anyway? (y/N)` 显式 y,否则**回同一字段表单**只重输失败字段复 probe(**独立 retry 路径废除**,不重启流程;save-anyway 显式 y 保留);④ **表单文件拆分**——新增 `src/tui/cmd-mcp-form.mjs`(fieldPicker 机制独立文件;`cmd-mcp.mjs` 499→382 行,脱离 500 硬限压线);⑤ **列表即菜单**——主菜单 = server 行(●/○ 连接态 + tool 数)+ `+ Add server` + `↻ Refresh` + 顶部 agent 代配提示行;选中行 → per-server 子菜单(Edit/Test/Reconnect/Remove),"先选操作再选 server"双弹层与 View list 废除;⑥ **磁盘重读**——`config.mjs` 新增 `reloadMcpFromDisk()`(菜单打开边界 + Refresh):磁盘→内存仅替换 mcp 段;畸形 config.json 回退内存态 + `⚠ disk config unreadable` 提示行;disk 删除/变更的已连接 server 连接不断 + 行尾 `⚠ disk changed` 对账标记(persistRaw 落盘后重读幂等防环);⑦ AI 生成降 transport picker 末位(生成的 entry 同走预览+探活确认环,失败回表单补齐/修正);`/mcp edit|test|remove|connect <name>` 直达参数路径零改动
|
|
84
142
|
- **MCP Streamable POST 误判修复 + `/mcp edit`/`/mcp test` + token 一等字段**(docs/design/MCP.md §4,两端落地):① `httpTransport` 增 postOnly 标记——GET SSE 405 降级后的纯 POST 模式 `isAlive()` 不再因 `eventSource == null` 误判死(glm-websearch "reconnect failed after 4 attempts" 根因:降级后 isAlive 恒 false → ensureAlive 触发无意义重连循环;legacy SSE 流断仍正常 fireDead 重连不回归);② `/mcp edit [name]`:逐字段预填重问(空输入保留 / `-` 删除可选字段 / `k=` 删除单个 header 项),persistRaw 原位替换保数组序,保存后自动重连(config 指纹含 token,变更自动关旧连接);③ `/mcp test [name]`:probeMcpServer 一次性探活(initialize + tools/list 计时 → `OK — N tools, Xms` / 错误透传),零副作用(不进 session 表、不动 agent.tools、探完即关);④ token 一等字段:config 增 `token` 字段,connect 链自动合成 `Authorization: Bearer <token>`(显式 headers 优先,不写回 config);⑤ parseHeaders 改逗号分隔(`Authorization=Bearer abc, X-Foo=bar`——修复空格截断把 Bearer token 截成 "Bearer" 的缺陷);⑥ VS Code 同构:http transport 同款修复 + probeMcpServer 镜像 + 面板 [Edit]/[Test] 按钮(同一表单编辑预填,token 字段 + 逗号分隔 headers 提示)+ **面板 [Reconnect] 死按钮修复**(webview 发的 `reconnectMcp` 消息在路由拆分时丢失 case,按钮此前无效)
|
|
85
143
|
- **memory_delete 工具**(跨端):三层记忆条目删除——personal 行级删(embedding/FTS 随行)、project/team 文件级删;scope 与 id 前缀匹配校验,非法 scope 明确报错
|
|
86
144
|
|
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@ Design philosophy (the entire meaning of the name): if the Node standard library
|
|
|
15
15
|
- **Fix-verify loop**: file changes without `verify` get pushed back — syntax check + tests must pass before the agent can claim completion (auto-repair up to 3 rounds)
|
|
16
16
|
- **Checkpoint system**: auto-snapshot before every user task, `list`/`create`/`rewind` tools for the model, single-file restore — rewinding itself is reversible (pre-rewind state auto-saved)
|
|
17
17
|
- **Codebase understanding** ⭐0.5.0: `repo_outline` (dependency outline, auto-injected at startup), `code_search` (source FTS5 + vectors + JSDoc extraction), `doc_search` (docs chunked by ## headings) — background indexing, auto-incremental updates on file writes, three tools guided by "structure → intent → details"
|
|
18
|
-
- **Model adaptation** ⭐: top-tier only, latest only. Built-in flagship models from
|
|
18
|
+
- **Model adaptation** ⭐: top-tier only, latest only. Built-in flagship models from twenty providers — DeepSeek / Kimi / Kimi For Coding / GLM / GLM Coding Plan (智谱 Coding) / Qwen / Qwen Token Plan / MiMo (小米) / MiMo Token Plan (小米套餐) / MiniMax / OpenAI / Claude / Gemini / Grok / Mistral / Volcengine Ark (豆包) / Hunyuan (腾讯混元) / SiliconFlow (硅基流动) / OpenRouter / Groq. No legacy model compatibility. Auto-matched context windows, truncation-resume protocols (prefix/partial), thinking-mode APIs (thinking.type / reasoning_effort), reasoning_content echo strategies (reasoningEcho), output limits, temperature range clamping — all deeply adapted.
|
|
19
19
|
- **Toolset**: `read` / `write` / `edit` / `bash` / `glob` (supports `**`) / `grep` / `websearch` / `ls` / `fetch` + `read_image` (image/video paste) + three retrieval tools + MCP — all zero-dependency, file tools confined to the working directory
|
|
20
20
|
- **Memory system**: three layers (personal/project/team), FTS5 + vector RRF hybrid retrieval, git-friendly markdown format
|
|
21
21
|
- **Two-phase tool scheduling**: permission prompts serialized, read-only tools parallelized, side-effect tools serialized
|
|
22
22
|
- **Session persistence** ⭐0.5.0: unlimited archive slots, `/session` to switch anytime, tool results visible after restore. Process-level isolation — multiple instances in the same directory each get their own session slot
|
|
23
23
|
- **Concurrent subagents**: three roles — `explore`/`plan`/`coder` — dispatched in parallel, streaming output visible, reports land in the conversation; per-subagent model override (`subagent` tool `model` arg or `agent.subagentModel` config — e.g. discuss with `glm-5.2`, let `deepseek-v4-flash` implement)
|
|
24
|
-
- **Multi-model consultation 会诊 + 飞刀 (escalate)** ⭐0.12.30: `consult_start`/`
|
|
24
|
+
- **Multi-model consultation 会诊 + 飞刀 (escalate)** ⭐0.12.30: `consult_start`/`consult_stop` run several configured models in parallel as independent read-only consultants (each with its own TUI activity card, `main_history` access to the failure trail); when every model settles, the full verdict digest is delivered automatically (R17 — consult_check retired). `escalate` flies in a stronger model for a single expert implementation run with full write access (default-async since R17 — the post-op report arrives automatically with its mutations merged). Candidate pool = `agent.consultModels` ([{ provider, model, effort? }], up to 5); budgets via `agent.consultTurns` / `agent.consultTimeoutMs`
|
|
25
25
|
- **Plan Mode**: read-only exploration + design, implement after user approval
|
|
26
26
|
- **AUTO mode**: `/auto` full authorization, no confirmations on long tasks
|
|
27
27
|
- **Task tracking**: `task` tool breaks down multi-step work, status bar ✓n/m live progress, auto-filters completed items
|
|
@@ -121,7 +121,7 @@ Configuration comes exclusively from `~/.thincoder/config.json` — no environme
|
|
|
121
121
|
},
|
|
122
122
|
],
|
|
123
123
|
"activeProvider": "deepseek", // currently active provider name
|
|
124
|
-
"shell": null, // bash tool shell (win11: e.g. "C:\\Program Files\\Git\\bin\\bash.exe" or "pwsh"); null = system default — cmd on Windows (UTF-8 forced per command), /bin/sh elsewhere. TUI: /shell
|
|
124
|
+
"shell": null, // bash tool shell (win11: e.g. "C:\\Program Files\\Git\\bin\\bash.exe" or "pwsh"); null = system default — cmd on Windows (UTF-8 forced per command), /bin/sh elsewhere. TUI: /shell; a leading ~ in the path expands to the home directory
|
|
125
125
|
"embedding": {
|
|
126
126
|
// optional: without it, retrieval is pure FTS
|
|
127
127
|
"baseURL": "https://api.siliconflow.cn/v1",
|
|
@@ -135,8 +135,9 @@ Configuration comes exclusively from `~/.thincoder/config.json` — no environme
|
|
|
135
135
|
"compactThreshold": 100000, // context compaction threshold (approx. tokens)
|
|
136
136
|
},
|
|
137
137
|
"memory": {
|
|
138
|
-
|
|
139
|
-
"
|
|
138
|
+
// Path fields (dbPath / projectDir / team.dir / shell) expand a leading ~ (~, ~/, ~\) to the home directory at load time
|
|
139
|
+
"dbPath": "~/.thincoder/memory.db", // sqlite index path (~ expands to the home directory)
|
|
140
|
+
"projectDir": ".thincoder/memory", // Project layer directory (relative to project root; ~ expands to an absolute path used as-is)
|
|
140
141
|
"team": {
|
|
141
142
|
// optional: Team layer disabled without it
|
|
142
143
|
"name": "myteam",
|
|
@@ -156,7 +157,6 @@ Configuration comes exclusively from `~/.thincoder/config.json` — no environme
|
|
|
156
157
|
"websearch": {
|
|
157
158
|
// optional: Tavily structured search (stable JSON API, no HTML scraping).
|
|
158
159
|
// Empty apiKey → silently falls back to Bing HTML extraction (zero-config).
|
|
159
|
-
"provider": "tavily",
|
|
160
160
|
"apiKey": "tvly-...", // https://tavily.com — has a free monthly tier
|
|
161
161
|
},
|
|
162
162
|
}
|
|
@@ -196,8 +196,10 @@ src/
|
|
|
196
196
|
clipboard.mjs (paste/copy), ansi.mjs
|
|
197
197
|
tui.mjs re-export shim → src/tui/index.mjs
|
|
198
198
|
tui-render.mjs re-export shim → src/tui/render.mjs
|
|
199
|
-
prompts/ prompt texts —
|
|
200
|
-
|
|
199
|
+
prompts/ prompt texts — slot-based (PROMPT-SYSTEM): persona-engineering / persona-normal /
|
|
200
|
+
persona-{eng-coder,explore,coder,plan} + common + discipline-engineering / discipline-normal
|
|
201
|
+
+ special modules (consult-base / advisor-design / advisor-round{1,2,3});
|
|
202
|
+
assembly = assemblePrompt (prompt-overlays.mjs): persona → common → discipline → [4] AGENTS+skills
|
|
201
203
|
test/ node:test offline unit tests (npm test)
|
|
202
204
|
scripts/ real-environment verification scripts (compaction, team sync)
|
|
203
205
|
```
|
package/bin/thincoder.mjs
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
* thincoder memory <sub> Memory management: list / search / put / remove
|
|
8
8
|
* thincoder upgrade Update to the latest version from npm
|
|
9
9
|
* thincoder completion <sh> Shell completion: bash / zsh / fish
|
|
10
|
+
* thincoder session gc Session dir GC: --dry-run report / --confirm delete cold projects (SESSION.md §12)
|
|
10
11
|
* thincoder acp Agent Client Protocol server (stdio, for Zed/JetBrains/Paseo)
|
|
11
12
|
* thincoder -v Print version
|
|
12
13
|
* thincoder --help Print help
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
import { readFileSync } from "node:fs"
|
|
16
|
-
import { join } from "node:path"
|
|
17
|
+
import { isAbsolute, join } from "node:path"
|
|
17
18
|
import { runAgent } from "../src/agent.mjs"
|
|
18
19
|
import { loadConfig, configPath } from "../src/config.mjs"
|
|
19
20
|
import { cleanupTraces } from "../src/traces/trace-store.mjs"
|
|
@@ -23,19 +24,63 @@ import { memoryCommand } from "../src/cli/memory-command.mjs"
|
|
|
23
24
|
import { setupWizard } from "../src/cli/setup-wizard.mjs"
|
|
24
25
|
import { summarize, askPermission } from "../src/cli/permission.mjs"
|
|
25
26
|
import { distillCommand } from "../src/cli/distill-command.mjs"
|
|
27
|
+
import { prepareCrashReporting, recentCrashHint, writeCrashRecord } from "../src/crash-reports.mjs"
|
|
28
|
+
import { setTuiActive, restoreTerminalAfterCrash } from "../src/tui/tui-lifecycle.mjs"
|
|
29
|
+
import { spawnTuiWrapped } from "../src/tui/wrapped-spawn.mjs"
|
|
26
30
|
|
|
27
31
|
const [command, ...args] = process.argv.slice(2)
|
|
32
|
+
// TUI-STDERR-CAPTURE(F-1):TUI 启动(tui/无命令)默认包装——父 spawn 子 tee stderr 落盘(外部
|
|
33
|
+
// 终止/native abort——第 4 类崩溃面——诊断默认捕获)。须在 prepareCrashReporting 前(父不预建/不设
|
|
34
|
+
// report——子进程做——R25 保留)。env 门已设(包装内子进程)或包装失败 → 直行现逻辑(尽力面)。
|
|
35
|
+
if ((command === undefined || command === "tui") && !process.env.THINCODER_TUI_WRAPPED) {
|
|
36
|
+
if (spawnTuiWrapped()) await new Promise(() => {}) // 包装成功 → 挂起(tee/收尾退出全在 wrapped-spawn——不达下方 switch)
|
|
37
|
+
}
|
|
28
38
|
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version
|
|
29
39
|
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
// R25(F-R25b):crash-reports 预建 + process.report 启用——入口最前(一切重活前——缩编程
|
|
41
|
+
// 期窗口)——V8 OOM/原生 fatal 自动写 report.*.json(实现批实测:目录缺失时 Node 静默不写
|
|
42
|
+
// ——预建为必要动作)。失败不阻断启动(尽力面)。
|
|
43
|
+
prepareCrashReporting()
|
|
44
|
+
|
|
45
|
+
// R25(F-R25a)异常钩子升级:原"只 console.error 一行(TUI 全屏下不可见)"→ ① 落盘
|
|
46
|
+
// crash-{ts}-{pid}.json ② TUI 活动态终端恢复 ③ console.error(恢复后打印才可见)
|
|
47
|
+
// ④ exit 非 0。执行序列定死(评审 #5 + 复审 #2):一次性 guard(防再入递归)→ 同步写 →
|
|
48
|
+
// 终端恢复 → console.error → exit 非 0——各步独立 try/catch(写失败/恢复失败不阻断后续步)。
|
|
49
|
+
let crashHandled = false
|
|
50
|
+
function handleFatal(type, error) {
|
|
51
|
+
if (crashHandled) {
|
|
52
|
+
// 再入(本序列内又抛异常)→ 直接退出,不再递归
|
|
53
|
+
process.exit(1)
|
|
54
|
+
}
|
|
55
|
+
crashHandled = true
|
|
56
|
+
try {
|
|
57
|
+
// ① 同步写诊断记录(设计字段集:时间/类型/消息+堆栈/uptime/argv/cwd/内存/node+版本)
|
|
58
|
+
writeCrashRecord({ type, error })
|
|
59
|
+
} catch { /* 写失败不阻断后续步 */ }
|
|
60
|
+
try {
|
|
61
|
+
// ② TUI 终端恢复:仅 TUI 活动态执行(writeCleanupSequence 同源——chat 模式 stdout
|
|
62
|
+
// 管道不得收 ANSI——误判即污染输出)
|
|
63
|
+
restoreTerminalAfterCrash()
|
|
64
|
+
} catch { /* 恢复失败不阻断后续步 */ }
|
|
65
|
+
try {
|
|
66
|
+
// ③ 原 console.error 行保留(非 TUI 模式可见——恢复后打印才可见)
|
|
67
|
+
console.error(`[error] ${error?.message ?? error}`)
|
|
68
|
+
} catch { /* 打印失败不阻断 exit */ }
|
|
69
|
+
// ④ exit 非 0 恒达(exitSoon——Windows/Node 24 上 fetch 后立即 exit 触发 libuv 断言先例)
|
|
37
70
|
exitSoon(1)
|
|
38
|
-
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Top-level safety net: print one-line error and exit cleanly, no stack traces to the user
|
|
74
|
+
process.on("uncaughtException", (error) => handleFatal("uncaughtException", error))
|
|
75
|
+
process.on("unhandledRejection", (error) => handleFatal("unhandledRejection", error))
|
|
76
|
+
|
|
77
|
+
// R25 测试门(T-R25a.1/a.2——子进程 env 注入——生产零路径):THINCODER_TEST_CRASH=1 抛
|
|
78
|
+
// 未捕获异常走完整崩溃序列;THINCODER_TEST_TUI_ACTIVE=1 模拟 TUI 活动态(同一 setter——
|
|
79
|
+
// 测试缝同源);THINCODER_TEST_CLEANUP_OUT 指向文件时恢复序列写入该文件(tui-lifecycle 读)。
|
|
80
|
+
if (process.env.THINCODER_TEST_CRASH === "1") {
|
|
81
|
+
if (process.env.THINCODER_TEST_TUI_ACTIVE === "1") setTuiActive(true)
|
|
82
|
+
throw new Error("R25 test crash (THINCODER_TEST_CRASH)")
|
|
83
|
+
}
|
|
39
84
|
|
|
40
85
|
const USAGE = `thincoder - thin coding agent
|
|
41
86
|
|
|
@@ -49,14 +94,16 @@ Usage:
|
|
|
49
94
|
thincoder memory remove <id> Remove an entry
|
|
50
95
|
thincoder sync Sync team memory repo (pull --rebase + reindex)
|
|
51
96
|
thincoder reindex Rebuild the local index from markdown sources
|
|
52
|
-
thincoder distill <file> [--yes] [--
|
|
97
|
+
thincoder distill <file> [--yes] [--layer=<s>]
|
|
53
98
|
Extract knowledge candidates from a session
|
|
54
99
|
transcript file; confirm each before saving
|
|
100
|
+
thincoder session gc --dry-run | --confirm <hash|--all>
|
|
101
|
+
Session dir GC: report/delete cold project data (cold = manifest idle >90d, no live slots)
|
|
55
102
|
thincoder upgrade Update to the latest version from npm
|
|
56
103
|
thincoder completion <sh> Generate shell completion script (bash / zsh / fish)
|
|
57
104
|
thincoder -v, --version Print version
|
|
58
105
|
|
|
59
|
-
Config: ~/.thincoder/config.json
|
|
106
|
+
Config: ~/.thincoder/config.json — providers[] (one default model per channel) + defaultModel (new-session starting point); the available-model list is fetched from the provider at runtime (GET /models); manage via /config → 默认模型 and /model (session-level) in TUI
|
|
60
107
|
`
|
|
61
108
|
|
|
62
109
|
/** Unified message when no API key is configured */
|
|
@@ -86,11 +133,16 @@ switch (command) {
|
|
|
86
133
|
break
|
|
87
134
|
}
|
|
88
135
|
|
|
136
|
+
// R25(F-R25c):非交互/chat 模式——上次异常终止提示写 stderr 一行(无匹配不提示)
|
|
137
|
+
const crashNotice = recentCrashHint()
|
|
138
|
+
if (crashNotice) console.error(crashNotice)
|
|
139
|
+
|
|
89
140
|
const agent = await assembleAgent()
|
|
90
|
-
// SESSION.md §8 D-S4(F4
|
|
141
|
+
// SESSION.md §8 D-S4(F4)+ MODEL-MERGE-SESSION:headless 无 TUI —— 可读错误 + 退出码 1,
|
|
142
|
+
// 不弹 UI、不崩溃;文案改引 defaultModel(F-6 引导 A headless 面——/config → 默认模型)
|
|
91
143
|
if (agent._providerInvalid) {
|
|
92
|
-
const
|
|
93
|
-
console.error(`[error]
|
|
144
|
+
const dm = agent.config?.defaultModel
|
|
145
|
+
console.error(`[error] 未配置有效模型(defaultModel "${dm ?? "(not set)"}":${agent._providerInvalidReason})。请运行 thincoder 进入 TUI 设置(/config → 默认模型;或 /model 选择后以会话槽生效),或编辑 ${configPath}`)
|
|
94
146
|
exitSoon(1)
|
|
95
147
|
break
|
|
96
148
|
}
|
|
@@ -172,7 +224,7 @@ switch (command) {
|
|
|
172
224
|
memory.embedder = createEmbedder(config.embedding)
|
|
173
225
|
}
|
|
174
226
|
if (config.memory.projectDir) {
|
|
175
|
-
memory.projectOrigin = join(process.cwd(), config.memory.projectDir)
|
|
227
|
+
memory.projectOrigin = isAbsolute(config.memory.projectDir) ? config.memory.projectDir : join(process.cwd(), config.memory.projectDir)
|
|
176
228
|
}
|
|
177
229
|
const code = await memoryCommand(memory, args)
|
|
178
230
|
if (code) exitSoon(code)
|
|
@@ -217,7 +269,7 @@ switch (command) {
|
|
|
217
269
|
const cwd = process.cwd()
|
|
218
270
|
let total = { added: 0, removed: 0 }
|
|
219
271
|
if (config.memory.projectDir) {
|
|
220
|
-
const s = await syncDir(memory, { layer: "project", dir: join(cwd, config.memory.projectDir) })
|
|
272
|
+
const s = await syncDir(memory, { layer: "project", dir: isAbsolute(config.memory.projectDir) ? config.memory.projectDir : join(cwd, config.memory.projectDir) })
|
|
221
273
|
total.added += s.added
|
|
222
274
|
}
|
|
223
275
|
const team = teamConfig(config)
|
|
@@ -239,17 +291,23 @@ switch (command) {
|
|
|
239
291
|
if (agent._providerInvalid) agent.provider = null
|
|
240
292
|
const config = loadConfig()
|
|
241
293
|
// 恢复上次的会话(同一项目目录);provider 按保存的名字切回(用户上次可能换过模型)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
294
|
+
// 2026-09-05 §10(R4):恢复决策按本端记录 resumeSlot(D-2 ①②③)——manifest active
|
|
295
|
+
// 只作"无记录端"的一次性继承源,不再作本端恢复第一依据(D-6)。
|
|
296
|
+
const { resumeSlot, applySession } = await import("../src/session.mjs")
|
|
297
|
+
const { slot, data } = resumeSlot(process.cwd())
|
|
298
|
+
if (data) {
|
|
299
|
+
// applySession 内部已按槽复合重算 compactThreshold(auto 时)——不再需要 switched 分支
|
|
300
|
+
applySession(agent, data)
|
|
301
|
+
// SESSION.md §11.2(2026-09-08——N6 评审 🔴 修复):process restarted 句 = 进程级
|
|
302
|
+
// 信号——仅本启动 resume 路径设一次(真进程重启恢复盘上会话);/session 切换与 ACP
|
|
303
|
+
// 加载走同一 applySession 收敛但不设(不误报进程重启)。prepareRun 发句即清——进程
|
|
304
|
+
// 内一次。resumed:yes 独立由 applySession 的恢复事件武装(data.history 非空)。
|
|
305
|
+
agent._processRestartPending = true
|
|
252
306
|
}
|
|
307
|
+
// D-3 钉槽:applySession 清 _slot 后立即钉回恢复槽——首保存必落恢复槽(消除
|
|
308
|
+
// "load → 首回合保存"窗口内并发方翻 active 导致的静默迁移);/new 经 resetSessionState
|
|
309
|
+
// 清 _slot(newSession 已认领 + 写记录,语义保留)
|
|
310
|
+
agent._slot = slot
|
|
253
311
|
// D-S3 优先级补全:applySession 可能已用会话中的有效 provider 修复(config 无效 + 会话有效)——
|
|
254
312
|
// 修复后复验清除标记,仅当两者都无效才弹重选(validateProvider 幂等)
|
|
255
313
|
if (agent._providerInvalid) validateProvider(agent)
|
|
@@ -265,10 +323,12 @@ switch (command) {
|
|
|
265
323
|
const { startTUI } = await import("../src/tui.mjs")
|
|
266
324
|
try {
|
|
267
325
|
await startTUI(agent, {
|
|
268
|
-
projectDir: config.memory.projectDir ? join(process.cwd(), config.memory.projectDir) : null,
|
|
326
|
+
projectDir: config.memory.projectDir ? (isAbsolute(config.memory.projectDir) ? config.memory.projectDir : join(process.cwd(), config.memory.projectDir)) : null,
|
|
269
327
|
team: teamConfig(config),
|
|
270
328
|
author: gitAuthor(),
|
|
271
|
-
restored,
|
|
329
|
+
restored: data,
|
|
330
|
+
// R25(F-R25c):TUI 启动显示一行"上次运行异常终止"提示(showStartup 渲染——无匹配不传)
|
|
331
|
+
crashNotice: recentCrashHint() ?? undefined,
|
|
272
332
|
})
|
|
273
333
|
} catch (error) {
|
|
274
334
|
console.error(`[error] ${error.message}`)
|
|
@@ -284,111 +344,10 @@ switch (command) {
|
|
|
284
344
|
exitSoon(1)
|
|
285
345
|
break
|
|
286
346
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
292
|
-
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
293
|
-
case "\${COMP_WORDS[1]}" in
|
|
294
|
-
chat) COMPREPLY=( \\$(compgen -W "--auto" -- "\\$cur") ) ;;
|
|
295
|
-
memory)
|
|
296
|
-
case "\\$prev" in
|
|
297
|
-
memory) COMPREPLY=( \\$(compgen -W "list search put remove" -- "\\$cur") ) ;;
|
|
298
|
-
list) COMPREPLY=( \\$(compgen -W "--type=rule --type=knowledge --type=decision --type=pattern" -- "\\$cur") ) ;;
|
|
299
|
-
put) COMPREPLY=( \\$(compgen -W "--type= --title= --content= --tags=" -- "\\$cur") ) ;;
|
|
300
|
-
esac ;;
|
|
301
|
-
distill) COMPREPLY=( \\$(compgen -W "--yes --scope=" -- "\\$cur") ) ;;
|
|
302
|
-
completion) COMPREPLY=( \\$(compgen -W "bash zsh fish" -- "\\$cur") ) ;;
|
|
303
|
-
*)
|
|
304
|
-
COMPREPLY=( \\$(compgen -W "chat acp memory sync reindex distill upgrade completion -v --version -h --help" -- "\\$cur") ) ;;
|
|
305
|
-
esac
|
|
306
|
-
}
|
|
307
|
-
complete -F _thincoder thincoder
|
|
308
|
-
`)
|
|
309
|
-
} else if (shell === "zsh") {
|
|
310
|
-
process.stdout.write(`#compdef thincoder
|
|
311
|
-
|
|
312
|
-
_thincoder() {
|
|
313
|
-
local context state state_descr line
|
|
314
|
-
typeset -A opt_args
|
|
315
|
-
_arguments -C \\
|
|
316
|
-
'1: :->cmd' \\
|
|
317
|
-
'*:: :->args'
|
|
318
|
-
|
|
319
|
-
case "\\$state" in
|
|
320
|
-
cmd)
|
|
321
|
-
_values 'command' \\
|
|
322
|
-
'chat[One-shot agent run with tools]' \\
|
|
323
|
-
'acp[Agent Client Protocol server for IDEs]' \\
|
|
324
|
-
'memory[Manage long-term memory]' \\
|
|
325
|
-
'sync[Sync team memory repo]' \\
|
|
326
|
-
'reindex[Rebuild local index from markdown]' \\
|
|
327
|
-
'distill[Extract knowledge from session transcript]' \\
|
|
328
|
-
'upgrade[Update to latest version from npm]' \\
|
|
329
|
-
'completion[Generate shell completion script]'
|
|
330
|
-
;;
|
|
331
|
-
args)
|
|
332
|
-
case "\\$words[1]" in
|
|
333
|
-
chat) _arguments '--auto[Auto-approve all tool calls]' ;;
|
|
334
|
-
memory)
|
|
335
|
-
case "\\$words[2]" in
|
|
336
|
-
list) _arguments '--type=[Filter by type]' ;;
|
|
337
|
-
put) _arguments '--type=[Entry type]' '--title=[Title]' '--content=[Content]' '--tags=[Space-separated tags]' ;;
|
|
338
|
-
esac ;;
|
|
339
|
-
distill) _arguments '--yes[Skip confirmation]' '--scope=[Scope filter]' ;;
|
|
340
|
-
completion) _values 'shell' 'bash' 'zsh' 'fish' ;;
|
|
341
|
-
esac ;;
|
|
342
|
-
esac
|
|
343
|
-
}
|
|
344
|
-
_thincoder
|
|
345
|
-
`)
|
|
346
|
-
} else if (shell === "fish") {
|
|
347
|
-
process.stdout.write(`# thincoder completions for fish shell
|
|
348
|
-
complete -c thincoder -f
|
|
349
|
-
|
|
350
|
-
# Subcommands
|
|
351
|
-
complete -c thincoder -a chat -d 'One-shot agent run with tools'
|
|
352
|
-
complete -c thincoder -a memory -d 'Manage long-term memory'
|
|
353
|
-
complete -c thincoder -a sync -d 'Sync team memory repo'
|
|
354
|
-
complete -c thincoder -a reindex -d 'Rebuild local index from markdown'
|
|
355
|
-
complete -c thincoder -a distill -d 'Extract knowledge from session'
|
|
356
|
-
complete -c thincoder -a upgrade -d 'Update to latest version'
|
|
357
|
-
complete -c thincoder -a completion -d 'Shell completion'
|
|
358
|
-
complete -c thincoder -a acp -d 'Agent Client Protocol server for IDEs'
|
|
359
|
-
|
|
360
|
-
# Flags
|
|
361
|
-
complete -c thincoder -s v -l version -d 'Print version'
|
|
362
|
-
complete -c thincoder -s h -l help -d 'Print help'
|
|
363
|
-
|
|
364
|
-
# chat flags
|
|
365
|
-
complete -c thincoder -n '__fish_seen_subcommand_from chat' -l auto -d 'Auto-approve tool calls'
|
|
366
|
-
|
|
367
|
-
# memory subcommands
|
|
368
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory' -a list -d 'List entries'
|
|
369
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory' -a search -d 'Search memory'
|
|
370
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory' -a put -d 'Add entry'
|
|
371
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory' -a remove -d 'Remove entry'
|
|
372
|
-
|
|
373
|
-
# memory list flags
|
|
374
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory; and __fish_seen_subcommand_from list' -l type -d 'Filter by type' -xa 'rule knowledge decision pattern'
|
|
375
|
-
|
|
376
|
-
# memory put flags
|
|
377
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory; and __fish_seen_subcommand_from put' -l type -d 'Entry type'
|
|
378
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory; and __fish_seen_subcommand_from put' -l title -d 'Title'
|
|
379
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory; and __fish_seen_subcommand_from put' -l content -d 'Content'
|
|
380
|
-
complete -c thincoder -n '__fish_seen_subcommand_from memory; and __fish_seen_subcommand_from put' -l tags -d 'Space-separated tags'
|
|
381
|
-
|
|
382
|
-
# distill flags
|
|
383
|
-
complete -c thincoder -n '__fish_seen_subcommand_from distill' -l yes -d 'Skip confirmation'
|
|
384
|
-
complete -c thincoder -n '__fish_seen_subcommand_from distill' -l scope -d 'Scope filter'
|
|
385
|
-
|
|
386
|
-
# completion shells
|
|
387
|
-
complete -c thincoder -n '__fish_seen_subcommand_from completion' -a bash -d 'Bash completions'
|
|
388
|
-
complete -c thincoder -n '__fish_seen_subcommand_from completion' -a zsh -d 'Zsh completions'
|
|
389
|
-
complete -c thincoder -n '__fish_seen_subcommand_from completion' -a fish -d 'Fish completions'
|
|
390
|
-
`)
|
|
391
|
-
}
|
|
347
|
+
// §11.2 交付行数债(2026-09-08——500 行硬限触碰执行):直写段逐字迁出
|
|
348
|
+
// src/completions.mjs(脚本字节不变——printCompletion 发射)
|
|
349
|
+
const { printCompletion } = await import("../src/completions.mjs")
|
|
350
|
+
printCompletion(shell)
|
|
392
351
|
break
|
|
393
352
|
}
|
|
394
353
|
|
|
@@ -419,6 +378,13 @@ complete -c thincoder -n '__fish_seen_subcommand_from completion' -a fish -d 'Fi
|
|
|
419
378
|
break
|
|
420
379
|
}
|
|
421
380
|
|
|
381
|
+
case "session": {
|
|
382
|
+
// SESSION.md §12:会话目录 GC 手动面(F2 冷 cwd 报告/删除——VS Code 端无 shell 通道,仅 CLI)
|
|
383
|
+
const { runSessionGc } = await import("../src/session-gc.mjs")
|
|
384
|
+
process.exitCode = runSessionGc(args)
|
|
385
|
+
break
|
|
386
|
+
}
|
|
387
|
+
|
|
422
388
|
case "--help":
|
|
423
389
|
case "-h": {
|
|
424
390
|
process.stdout.write(USAGE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thincoder",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.61",
|
|
4
4
|
"description": "Thin coding agent - zero dependencies, no build step, Node.js native. Sharp code, zero bloat.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
"url": "git+https://github.com/xinbo-tech/thincoder.git"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
|
-
"test": "node
|
|
35
|
-
"prepublishOnly": "npm run
|
|
34
|
+
"test": "node test/run-fast.mjs",
|
|
35
|
+
"prepublishOnly": "npm run release:check",
|
|
36
36
|
"lint": "node scripts/check-syntax.mjs",
|
|
37
|
-
"
|
|
37
|
+
"release:check": "node scripts/release-check.mjs",
|
|
38
|
+
"test:full": "node test/run-full.mjs",
|
|
39
|
+
"test:integration": "node test/run-integration.mjs"
|
|
38
40
|
},
|
|
39
41
|
"author": "liwei <liwei@51marine.com> (上海新舶)",
|
|
40
42
|
"license": "MIT"
|