Repository navigation
feat: globalPtcSdk row switch (default OFF) + agent/created bash readiness - #44
Conversation
A global PTC executor resolves its SDK right after agent creation. The listener returned nothing, so the first admission could see a face without bash (step 1 missing, step 2 present). Return the in-flight reconcile task so the serial agent/created emission waits for it.
A deployment that wants every agent to reach its tools through the PTC
run_code SDK needs the ROOT executor switched. That is a profile-patch
decision (bundle patches are read before the profile patch file) and a
row-level `disabled` that configEditor cannot write, so the switch writes
it the way the persistent-terminal adoption already does: parseDocument,
targeted edits, an atomic write, verify-by-reread and rollback.
Default OFF writes nothing and never removes rows the user added. Turning
it OFF again lifts only the rows this switch wrote, matched by exact
value; a row the user shaped differently is left alone.
What it writes:
- tool-executor-native: disabled true
- tool-executor-ptc: disabled false
- preset-minimal restated with persona.complete:false, because a
complete persona erases the PTC SDK at assembly (re-align that block
when DSH is upgraded).
|
感谢 PR,方向我认可。我本地跑完并检查了 writer,发现一个当前测试没覆盖的阻断项,先说明,辛苦确认: P0:OFF 会删除用户手写的同值行(数据丢失)
- id: tool-executor-native
disabled: true
- id: tool-executor-ptc
disabled: false
- id: preset-minimal
name: '@deepseek-ai/dsh-agent-preset'
config:
plugins:
- id: persona
name: '@deepseek-ai/dsh-persona'
config:
complete: false调用 建议:在 patch 旁加 ownership receipt(可参考 P1:设置页没有开关
P1:preset-minimal 复述fragment 漏了 P2:空 face 的 created 重试
本地 |
…it the retry chain Review P0 — OFF no longer deletes user-written rows. add src/global-ptc-ownership.js: a receipt beside the patch records exactly which row ids this switch wrote and each written row's canonical fingerprint. Lift deletes a row only when the receipt names it AND the row still fingerprints to the recorded value. No receipt means nothing is owned, so a patch the user hand-wrote before ever toggling the switch is byte-identical after OFF. Covered by the reviewer's reproducer plus an edited-after-write case and an adopt→lift round-trip. Review P1 (minimal) — the preset-minimal restatement is GONE. AGENTS §4l rejects it (freezes the official row set, and the fragment had drifted from minimal.patch.yml's persistent-bash/persistent-pwsh descriptions). The switch now writes only the two executor rows; the module header and CHANGELOG say minimal needs the deployment to own its own restatement. Review P1 (settings) — the settings card grows a Global PTC SDK row with 21 locale entries, labelled "restart to apply". Review P2 — the empty-face retry in inline-tools now returns the retry promise, so the SERIAL agent/created emission waits for the composed face instead of admitting an agent with no shell at all. npm test: 397 pass / 0 fail / 0 skip.
|
四条都已处理,已推 P0 — 数据丢失(已修)新增
P1 — preset-minimal 复述(已移除)按你给的第二个选项:不再覆盖 minimal。fragment 整个删掉,开关只写两个 executor 行。模块头与提交信息写明:minimal 的 P1 — 设置页(已补)
P2 — 空 face 重试链(已修)
验证
一点如实说明:空 face 那条边缘没有单独补成用例—— |
|
感谢更新。P0 的 ownership receipt 方向正确;四条主项我也复跑了(本地 397 项 / 396 pass / 1 platform skip,CI 4/4 success)。复核后还有几个需要处理: P1 — 注释仍会被当成“无变化”而删除
P1 — 一行被用户改过之后,OFF 不再移除另一条仍归开关所有的行
P1 — 卸载/禁用插件没有恢复 patchterminal/ops adoption 都有 dispose 恢复;global PTC 没有。开关 ON 时卸载或禁用插件,profile patch 里的两个 executor 行会永久留下,而插件自己的 bash 也随卸载消失,用户没有 UI 可以再关掉。建议在 dispose 时按 receipt 执行一次 lift(同一把锁;失败只 log),或在 README/设置里明确写出持久配置不会随卸载恢复及迁移步骤。 P1 — minimal 的限制没有告诉用户现在只写两个 executor 行,模块注释也承认 minimal 的 P2 — 21 门词典实际没有翻译
P2 — 注释/文档与实现不一致
P2 — 空 face 仍没有用例承认的测试缺口还在;另外 以上不影响 receipt 的主体设计;前四项修好我再合。 |
Address the second PR review round. - Receipt fingerprints now include YAML comment/commentBefore tokens as well as canonical row data, so a comment-only user edit blocks lifting. - Lift simulates the base composition (native ON, PTC OFF) plus retained rows before every splice. It never creates zero/two root executors; opaque rows fail closed. Safe partial lifts remain possible, missing siblings work in both directions, and stale receipt entries are pruned. - Disable/uninstall awaits in-flight adoption and lifts under the same profile lock, logging rather than failing host shutdown. - Empty-face retries use per-attempt records. A superseding reconcile chains the old created promise to its replacement (including the Bash mount); dispose settles directly. Timer firing cannot resolve early. - Settings copy is genuinely localized in all 21 locales and documents the minimal limitation. README/README_EN/AGENTS/CHANGELOG now describe ownership, disposal and composition safety; stale comments are fixed. Validation: npm test 410/410, node --check, git diff --check and npm pack --dry-run. Independent read-only re-review: APPROVE, no blockers.
|
七项都已处理,已推 P1 — 注释所有权
新增「adopt 后只加注释 → OFF 保留行与注释」用例;另补 native / PTC 两个 comment-only 方向,防止恢复过程破坏 executor 组合。 P1 — 部分 lift / root executor 不变量没有简单逐行删除:splice 前按 base 默认(native ON / PTC OFF)+ 将保留的行模拟最终组合,必须能证明恰好一个 enabled executor;opaque 行 fail-closed。
P1 — 禁用 / 卸载恢复dispose 先 P1 — minimal 限制21 门设置卡 hint、README、README_EN、AGENTS、CHANGELOG 均明确:本开关不支持 P2 — 21 门词典21 个 label / hint 均已本地化,不再复用英文占位;zh-CN 为简体,zh-HK / zh-MO / zh-TW 为繁体。测试锁定 21 块、文本多样性与每块 minimal 限制。 P2 — 注释 / 文档一致性
P2 — 空 face 重试链每次 attempt 有独立 retry record,区分 detach 与 settle:
现有 4 个空 face 用例:正常重试、foreign bash 取消、替代 reconcile 需要挂 Bash(created 返回时 Bash 必须 ready)、agent dispose 取消。 验证
未验证:真实 Desktop GUI / 模型调用,以及完整桌面实例卸载时的 patch 回滚;这些没有写成已通过。 |
|
已合并并随 v0.52.0 发布:关闭开关时设置卡显示 21 语言可见提示,README/README_EN/AGENTS 补充 CLI 停服卸载的 dispose 盲区。感谢修复与配合。 |
概要
新增
globalPtcSdk行配置开关(默认 OFF):打开时本插件把 root executor 切换为 PTC,让所有未显式挂 scoped native executor 的 agent 通过run_codeSDK 调用工具——SDK 内含本插件的 Git Bash,不含独立pwsh。默认行为完全不变,OFF 不写任何东西。附带一个前置修复:
agent/created监听器现在返回 in-flight 的挂载任务,使串行事件等待 bash 就位。没有它,全局 PTC executor 在创建后的首次 admission 会看到一个没有 bash 的工具面(step 1 缺 bash、step 2 才有)。为什么需要
希望整个部署统一走 PTC 的场景,需要
tool-executor-native关、tool-executor-ptc开。这是 profile patch 层面的决定(bundle patch 先于 profile patch 读取),并且是 configEditor 写不了的行级disabled。preset-minimal还需一并重述:它的persona.complete: true会在 prompt 组装后只留 persona、抹掉 PTC SDK 段,于是 minimal 会发布一个背后没有可用 SDK 的run_code。改动
src/global-ptc.js:plan 矩阵(纯函数)+ patch 写入器(parseDocument、原子写、回读校验、失败回滚、lift)。src/index.js:Config 增globalPtcSdk(非 volatile,改动即时重挂载插件——patch 写入的正确重量);ctx.inject(['profileContext'])接线,与既有 terminal 采用共用同一把withFileLock。tests/global-ptc.mjs:19 例(plan 12 + writer 7)。为什么直接编辑 profile patch 而不是 configEditor
沿用
src/terminal-bundle.js已有的实测结论(packages/boot/config-editor):entries()只看 include-mounted 顶层行,edit()只写 config 键、从不写行级disabled。安全轨道与之相同:parseDocument保住注释与!!js、定向编辑、原子写、回读校验、任何不符即回滚到原字节。安全约束
native: disabled false/ptc: disabled true/minimal: complete true):一律kept-user-choice退让,不覆盖。!!js等):绝不替换成字面量。验证
npm test:396 项 / 396 pass / 0 fail / 0 skip(含新增 19 例)。未验证
需要维护者判断的一点
AGENTS.md §4l 记载「restatement 会冻结官方行集,禁走」——那条结论针对的是改 preset 组合内的 tool-bash/tool-pwsh 行。这里重述
preset-minimal是为了改它自身的persona.complete,没有别的通道能到达(configEditor 写不了行级字段,bundle patch 按 id 够不到 preset 声明内的行)。代价是每次 DSH 升级要重新对齐这块。如果维护者认为该代价不可接受,请指路替代形态,我可以把 minimal 部分拆出去,只保留两个 executor 行。