Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,24 @@
`tests/runtime-preview.mjs` 的 eager-slot 用例需要已安装宿主(host-loader),不在
`npm test` 内。本机无 Windows 时不得声称真机通过,CHANGELOG 必须写明该边界。

4n. **全局 PTC SDK 开关与所有权(`globalPtcSdk`,默认关)**:该开关只写 profile patch 的两个 root executor 行
(`tool-executor-native: disabled true`、`tool-executor-ptc: disabled false`),不是 volatile 实时切换,
重启 DSH 后生效。**绝不复述 `preset-minimal`**:它的 `persona.complete: true` 会抹掉 SDK,minimal 不在
本开关支持范围内;需要 minimal + PTC 的部署必须自己维护 preset 覆盖,README/设置卡必须明说。
- 所有权由 patch 旁 `.gitbash-global-ptc-ownership.json` 记录:只登记本次实际新增的行 id 与指纹;
用户原先手写的同值行不认领。指纹 = 规范化数据 + YAML AST 上全部 `comment/commentBefore`
(含嵌套 key/value),因为 `toJSON()` 会丢注释;只改注释同样视为用户编辑。
- OFF / 禁用 / 卸载按 receipt 逐行 lift:只有 receipt 认领且当前指纹仍相同的行才可删;splice 前必须按
base 默认(native 开、PTC 关)+ 将保留的行模拟最终组合,**无法证明恰好一个 enabled executor 就不删**
(含 opaque)。一行被改不阻断另一行「组合安全」的撤回,`lifted-partial` 必须列出需人工处理的行;
会造成双 executor / 无 executor 时对应行与 receipt 保留并返回 `kept-user-choice`。无 receipt、
指纹不符、receipt 损坏均不得猜测删除。卸载 dispose 先等正在进行的 adopt,再用同一把 profile 文件锁
lift,失败只 log。
- 回归必须覆盖:用户手写同值、后续改值、只加注释、部分 lift、adopt→lift 字节回滚、receipt 生命周期、
禁用/卸载接线。改 `agent/created` 的 PTC readiness 时另跑 `tests/global-ptc-created.mjs` 的空 face、
取消与 dispose 用例;supersede 清 timer 后旧 Promise 必须链到替代 reconcile / Bash mount,dispose 才可
直接 settle;正常 firing 不得提前 settle 下一 attempt。

## 当前宿主测试与配置所有权

- 宿主预览使用真实 Native/Ptc executor,`tools.execute({calls,...})` 返回 `results`;不得用旧单调用签名或给 registry 打兼容补丁。
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
> 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。
> 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交;事故复盘、复现与真机验证记录也记在这里。

## Unreleased — 2026-11-09

**类型**: feat / fix / docs(全局 PTC SDK 开关与配置所有权;版本号由维护者发版时统一 bump)

- **新增 `globalPtcSdk`(默认关)**:设置卡控制 profile root executor,只写 `tool-executor-native: disabled true` 与 `tool-executor-ptc: disabled false`;未显式挂 scoped native executor 的 agent 经 `run_code` SDK 使用工具,SDK 含 Git Bash、无独立 pwsh。写入 profile patch,重启 DSH 后生效。
- **minimal 明确不支持**:不复述 `preset-minimal`;其 `persona.complete: true` 会抹掉 SDK。需要 minimal + PTC 的部署自行维护 preset 覆盖。README / README_EN / AGENTS 与 21 门设置卡文案同步说明。
- **ownership receipt 防数据丢失**:patch 旁 `.gitbash-global-ptc-ownership.json` 只登记实际写入的行与「规范化数据 + YAML 注释」指纹。用户手写同值行不认领;后续改值、加配置或只加注释都视为用户编辑并保留。receipt 损坏 fail-closed。
- **组合安全的逐行恢复与卸载还原**:OFF / 禁用 / 卸载按 receipt 逐行 lift;splice 前按 base 默认与保留行模拟,必须恰好一个 enabled executor,否则保留对应行与 receipt 并返回 `kept-user-choice`。一行被改不阻断另一行「组合安全」的撤回;部分恢复返回 `lifted-partial` 并指出需人工处理的行。dispose 等正在进行的 adopt 后,以同一把 profile 锁执行 lift,失败只记录日志。
- **PTC 首步 readiness**:`agent/created` 等待 bash 挂载;空 face 的有界重试也纳入等待。每次重试有独立 record;superseding reconcile 清 timer 后让旧 created Promise 等待本次 reconcile / Bash mount,dispose 才直接 settle;正常 firing 先按 identity 摘除当前 record,避免提前 resolve 下一 attempt。
- **验证**:Windows / Node 24 完整 `npm test` **410 pass / 0 fail / 0 skip**;空 face 正常重试、foreign bash 取消、替代 reconcile 挂 Bash、agent dispose 取消四例,以及 comment-only / missing-sibling 的双向 executor 组合回归已进 CI。真实 Desktop GUI、真实模型及卸载时的整实例 patch 回滚仍未验证。
- **链接**:[PR #44](https://github.com/KannaKuron/dsh-gitbash-shell/pull/44)

## v0.51.0 — 2026-11-07

**类型**: feat / fix(运行时正确性、配置所有权与提示词投影;宿主基线仍为 0.2.2-rc.1)
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,26 @@ preset 会被插件自动清理;宿主官方 PowerShell 执行器原样保留(
**依赖版本**:去重开关本体在**本插件 ≥ 0.25.0**;对方的协作能力在
**dsh-ptc-cordis-preset ≥ 0.14.0**。

### 全局 PTC SDK:`globalPtcSdk`(默认关)

设置卡的「Global PTC SDK」控制 profile 的 root executor。默认关闭时不新增任何覆盖;开启后写入
`tool-executor-native: { disabled: true }` 与 `tool-executor-ptc: { disabled: false }`,让未显式挂载
scoped native executor 的 agent 通过 `run_code` SDK 调用工具。SDK 内含本插件的 Git Bash,不发布独立 `pwsh`。
**写入的是 profile patch,重启 DSH 后生效。**

- **不覆盖 `preset-minimal`**:minimal 的 `persona.complete: true` 会在 prompt 组装时抹掉 PTC SDK,
得到没有可用 SDK 的 `run_code`。本开关**不支持 minimal**,也不替部署复述该 preset(避免冻结官方行集);
要在 minimal 使用 PTC,需自行维护对应 preset 覆盖,或改用 standard/ptc/cordis。
- **只撤回自己写且未被改过的行**:patch 旁的 `.gitbash-global-ptc-ownership.json` 记录本开关写入的行 id
与「数据 + YAML 注释」指纹。关闭开关、禁用或卸载插件时,只 lift receipt 认领且指纹仍一致的行;
用户手写同值行、后续改值/加配置/加注释的行一律保留。
- **组合安全的逐行恢复**:splice 前按 base 默认(native 开、PTC 关)与将保留的行模拟最终组合,
**必须仍能证明恰好一个 enabled executor**;一行被用户改过时,另一行只有在满足该不变量时才撤回,
结果日志为 `lifted-partial`。若删除会造成「双 executor」或「无 executor」(含 `!!js` 等无法判定的行),
对应行及其 receipt 都保留,日志返回 `kept-user-choice` 并明确要求手工处理。
- **失败边界**:receipt 损坏时拒绝猜测所有权;写入与回读使用宿主原子写和同一把 profile 文件锁,
校验失败回滚原 patch 字节。卸载恢复只记录失败日志,不阻断宿主关闭。

### run_code 后端开关:`pythonRuntime`(默认关,v0.26.0)

dsh 有一个**实验性 CPython 后端**用于 PTC 的 `run_code`
Expand Down
24 changes: 24 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,30 @@ there is no second copy and no sync logic.
**Versions**: the switch itself ships in **this plugin ≥ 0.25.0**; the peer's cooperation
capability ships in **dsh-ptc-cordis-preset ≥ 0.14.0**.

### Global PTC SDK: `globalPtcSdk` (off by default)

The settings card's **Global PTC SDK** row controls the profile's root executor. OFF adopts no overrides.
ON writes `tool-executor-native: { disabled: true }` and `tool-executor-ptc: { disabled: false }`, so agents
without an explicitly scoped native executor reach their tools through the `run_code` SDK. The SDK carries
this plugin's Git Bash and no separate `pwsh`. **This writes the profile patch and takes effect after a DSH restart.**

- **`preset-minimal` is not covered**: its `persona.complete: true` erases the PTC SDK during prompt assembly,
leaving `run_code` without a usable SDK. This switch does not support minimal and deliberately does not restate
that preset (which would freeze the official rows). Own a deployment-specific preset override for minimal,
or use standard/ptc/cordis instead.
- **Only unchanged rows written by this switch are lifted**: `.gitbash-global-ptc-ownership.json` beside the patch
records the written row ids and their data-plus-YAML-comment fingerprints. Turning the switch off, disabling,
or uninstalling the plugin lifts only receipted rows whose fingerprints still match. Handwritten same-value rows,
later value/config edits, and added comments are preserved.
- **Per-row recovery is composition-safe**: before splicing, the writer simulates the base defaults (native ON, PTC OFF)
plus every retained row and requires exactly one enabled executor. An untouched sibling is lifted only when that
invariant still holds; partial recovery logs `lifted-partial`. If a removal would leave two executors or none
(including an opaque `!!js` row), the row and its receipt stay in place and the log says `kept-user-choice`
with manual review required.
- **Failure boundaries**: a malformed receipt fails closed. Patch writes and rereads use the host atomic writer and
the same profile lock; a verification failure restores the previous patch bytes. Disposal logs lift failures without
blocking host shutdown.

## POSIX path dialect (introduced in v0.7.0, gated by the `posixPaths` switch)

While commands default to this plugin's own Git Bash tool on Windows, the
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"icon.svg"
],
"scripts": {
"test": "node --test tests/smoke.mjs tests/private-executor.mjs tests/client-regressions.mjs tests/bridge-regressions.mjs tests/runtime-regressions.mjs tests/host-regressions.mjs tests/compatibility-regressions.mjs tests/path-tool.mjs tests/native-output.mjs tests/native-executor.mjs tests/ops-adopt.mjs tests/terminal-cancel.mjs tests/review-core-regressions.mjs tests/review-native-regressions.mjs tests/terminal-bundle.mjs tests/audit-regressions.mjs",
"test": "node --test tests/smoke.mjs tests/private-executor.mjs tests/client-regressions.mjs tests/bridge-regressions.mjs tests/runtime-regressions.mjs tests/host-regressions.mjs tests/compatibility-regressions.mjs tests/path-tool.mjs tests/native-output.mjs tests/native-executor.mjs tests/ops-adopt.mjs tests/terminal-cancel.mjs tests/review-core-regressions.mjs tests/review-native-regressions.mjs tests/terminal-bundle.mjs tests/audit-regressions.mjs tests/global-ptc-created.mjs tests/global-ptc.mjs",
"test:preview": "node --import ./tests/host-loader.mjs --import ./tests/preview-env.mjs --test tests/preview.mjs tests/bridge-preview.mjs tests/runtime-preview.mjs tests/host-preview.mjs tests/path-preview.mjs tests/native-output-preview.mjs tests/native-preview.mjs tests/native-integration-preview.mjs tests/review-native-preview.mjs tests/audit-preview.mjs",
"version": "node -e \"const fs=require('fs');const m=JSON.parse(fs.readFileSync('dsh.plugin.json','utf8'));const v=JSON.parse(fs.readFileSync('package.json','utf8')).version;m.version=v;fs.writeFileSync('dsh.plugin.json',JSON.stringify(m,null,2)+'\\n')\" && git add dsh.plugin.json"
},
Expand Down
Loading
Loading