Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ci

on:
push:
branches: [main, 'fix/**']
branches: [main, 'fix/**', 'alpha适配']
pull_request:
workflow_dispatch:

Expand All @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node: [22, 24]
node: ['24.9.0', '24']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
Expand Down
14 changes: 11 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
反引号语境下出现插值起点),绝不半改——半改的程序比不改更糟;
② **只翻「整体是路径」的字面量**:注释里的路径、带 scheme 的串、`$VAR`(JS 字面量是数据,不做
shell 展开)、已是 Windows 形式、相对路径一律不动;
③ **开关独立**:设置卡 `codePaths`(默认开,21 语言词典同齐),关掉只影响程序字面量,不动工具参数
③ **运行时语言门控**:只对调用 agent 的实际 `ptcRuntime.language === "typescript"` 添加 JavaScript prelude 和改写源码;Python/未知语言不改源码,不能用全局 peer 意图推断。
④ **开关独立**:设置卡 `codePaths`(默认开,21 语言词典同齐),关掉只影响程序字面量,不动工具参数
方言;`posixPaths` 仍是总开关。
仍**不在覆盖内**:动态拼出来的路径(`'/c/' + name`)与插值模板——只有「整条路径是一个字面量」才
可判定,其余靠指令表述说清(模型侧纪律:程序里的路径写成实路径)。同源官方事实:run_code 的
Expand Down Expand Up @@ -628,7 +629,7 @@
§4j 硬注入、v0.38.2 fiber 时序同一失败家族的第无数课)。
实验 native 与 Bash 的 cwd 消费共用 `src/session-workdir.js`;native 同样不得硬 inject
workingDirectory。服务存在时 ensure 错误不得吞掉,只有缺服务才走旧接缝。
companion 激活必须确认 apply 已执行;scope 就绪与实际注册成功分别记录。初始挂载、volatile 开关和 Jobs 刷新必须共用按 agent 检查所有权的注册入口:注销自身注册后,外部全局/同 agent 同名工具均让位,knownNames 可用时包含隐藏工具,旧宿主回退 schemas;检查失败或注册异常记录日志,不阻断其他 companion。让位后保留待命 scope,下一次刷新可恢复。
companion 激活必须确认 apply 已执行;scope 就绪与实际注册成功分别记录。初始挂载、volatile 开关和 Jobs 刷新必须共用按 agent 检查所有权的注册入口:注销自身注册后,外部全局/同 agent 同名工具均让位,通过当前宿主公开 `scopeChainOf` 逐层检查 global/祖先/当前 scope 的 schemas,包含在子 scope 隐藏的工具;检查失败或注册异常记录日志,不阻断其他 companion。让位后保留待命 scope,下一次刷新可恢复。

4m. **native 工具首步稳定(v0.47.1,issue #38)**:任何模型可见工具都不允许在 `agent/created`
之后才异步注册——step 1 少一个、step 2 补上会重写 provider 前缀,把整段会话缓存打掉
Expand All @@ -642,12 +643,19 @@
状态重新推导)。槽位与真实 executor 必须共用 `src/native-tool.js` 的
`nativeToolDefinition()`,name/description/parameters/output/presentCall 逐字节一致。
- 真实模块只允许 `slot.install(definition)` 换实现,绝不二次 register;槽位在
`experimentalNative` 关闭、agent dispose、face 不再需要 bash 时 `dispose`。调用早于
agent dispose、face 不再需要 bash 时 `dispose`。运行中 agent 的 eager schema 按 toolFace 快照保持稳定,`experimentalNative` 关闭仍立即拒绝其执行;新会话应用新工具面。调用早于
真实 executor 时等待就绪(15s 上限 + 可取消),不把未初始化调用当成功。
- 回归:smoke 的 #38 源码断言 + native-executor 的定义一致性;真实 ToolRuntime 预览
`tests/runtime-preview.mjs` 的 eager-slot 用例需要已安装宿主(host-loader),不在
`npm test` 内。本机无 Windows 时不得声称真机通过,CHANGELOG 必须写明该边界。

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

- 宿主预览使用真实 Native/Ptc executor,`tools.execute({calls,...})` 返回 `results`;不得用旧单调用签名或给 registry 打兼容补丁。
- 路由文案由自有 Bash definition 与 PTC prompt section 提供;`system-prompt/assemble` 不拥有工具声明,修改 `schemas()` 的副本不会进入模型请求。
- 持久终端补全只改 `config.shellPath`,保留其它配置/注释;整个读改写使用与 configEditor 相同的 profile 锁。
- dsh-ops 只恢复 `.gitbash-ops-ownership.json` 记录的实际修改字段;原有 false、不明来源的历史 false 和后续用户选择不得认领。重试计时器、正在进行的接管与恢复都由注入 scope 管理。

## 上游追踪纪律:dsh 终端面与 dsh-ops(2026-10-19 用户要求)

本插件的三个接管面都锚在**别人的包结构**上,上游任何一侧发新版都必须主动核对并做出适配决断,
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
> 倒序排列,新版本条目在最上面。条目格式:`## vX.Y.Z — YYYY-MM-DD` + 类型(feat / fix / docs / chore)+ 要点 + 相关链接。
> 纪律见 AGENTS.md「变更记录纪律」:发版前先更新本文件并随版本提交;事故复盘、复现与真机验证记录也记在这里。

## Unreleased — 2026-11-06

**类型**: fix / test(Windows 本机审计修复,宿主基线仍为 0.2.2-rc.1)

- **Python 程序保留**:从调用 agent 的实际 PTC runtime 读取语言;只对 TypeScript 执行程序字面量转换及 JS TEMP prelude。Python/未知运行时源码不变,工具路径字段仍独立转换。
- **终端配置保留**:只填 `config.shellPath`,保留其它参数与 YAML 注释;读/改/写/回读全程使用宿主 configEditor 同款 profile 文件锁。
- **隐藏工具所有权**:经公开 scopeChainOf 逐层检查全局、祖先和当前 agent 的 schema,动态 companion 和 eager native slot 共用判据;不读取私有 tools.view,也不假设跨 scope 注册会冲突。
- **dsh-ops 精确恢复**:profile 旁原子保存原值收据,先记账后编辑;只恢复实际认领且仍为插件写入值的字段。原有 false、后续 true/删除、并发编辑均保留;拒绝写入撤销新增认领,恢复失败保留记录以便重试。卸载先清理重试定时器、等待正在进行的接管,再恢复。
- **模型路由提示**:Bash 自有定义动态提供描述,由宿主 native/PTC provider 投影;PTC 指引使用真实 prompt section。run_code 提示从选中 executor 的声明判断,并按实际语言门控,删除无效的 schema 副本修改。
- **测试设施**:host-loader 防同步 require.resolve 重入;preview 统一挂载当前 Native/Ptc executor 并使用 calls/results 批次接口;修正过期的 live face、SDK 与 registry 夹具。终端 YAML 测试纳入 npm test,移除个人路径探测,增加锁定 yaml dev dependency;测试 Cordis 对齐 4.1.0,CI 覆盖 Node 24.9 下限与 24。
- **独立回归**:完整插件入口的最终 native/PTC 提示、complete persona、真实 Python 解释器、隐藏祖先工具;跨进程 dsh-ops 恢复、原有 false、并发/失败编辑;终端其它配置及注释保留。
- **验证**:Windows 本机 Desktop/Core 0.2.2-rc.1(Cordis 4.1.0,内置 Node 24.21.0)只读提取后进行隔离预览;npm test 372/372 通过;内置 Node 执行完整 test:preview 93/93 通过,均无跳过;npm pack dry-run 与 diff --check 通过。未修改生产 profile 或安装目录,未调用模型、未发 npm 版本;不声称完成 GUI、真实 dsh-ops 插件或 Python PTC 插件的完整会话验证。

## v0.50.0 — 2026-11-06

**类型**:breaking(feat:适配 dsh-ops 0.5.0 单行配置,放弃 0.4.x 旧行集)
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ POSIX 宿主上完整保留;
0.5.0 已移除旧 `dsh-ops-shell`/`dsh-ops-file`/`dsh-ops-mode-*` 行,本版也删掉对应接管逻辑:
旧 dsh-ops 的 profile 不再被本插件去重,请先升级 dsh-ops 0.5.0(或留在本插件 v0.49.0)。
**停用或卸载本插件的瞬间自动还原**(dispose 钩子只撤回自己写的 `bash:false`,同 section 的其它设置原样保留),
重新启用又会自动接管。三个边界:①关机状态下卸载的残余覆盖,可用 dsh-ops 设置卡恢复默认,或重新安装/停用本插件
重新启用又会自动接管。接管前会在 profile 目录的 `.gitbash-ops-ownership.json` 中原子记录实际修改字段的原值,
重启后仍可精确恢复;用户原先设置的 `bash:false` 不会被认领或删除。升级前留下且没有记录的 `false` 保持原样,
不猜测它属于用户还是旧插件。三个边界:①关机状态下卸载的残余覆盖,可用 dsh-ops 设置卡恢复默认,或重新安装/停用本插件
触发还原;②停用时若覆盖值已被你手动改回 `true`,视为你的选择、不动它;③**0.5.0 只对四个内置模式生效**:
dsh-ops 不再全局接入未列出的自定义 preset,本插件的 `ptc-cordis` 与「· Git Bash」变体 id 不在四个内置模式中,
那些会话里 dsh-ops 不会发布 `ops_bash`;dsh-ptc-cordis-preset v0.26.0 自己挂 `dsh-ops/integration` 取文件工具,
Expand Down Expand Up @@ -433,7 +435,7 @@ PTC/创造及用户自建模式一律覆盖。

## 显式工具(Unreleased)

**运行时开关 `experimentalNative`(默认 true):** 设置 → 插件 → dsh-gitbash-shell →「实验原生执行 / fail-closed」。开启时 Windows 受限/未确定模式拒绝 Bash,提供可用的两个显式工具;关闭立即注销并禁用两个工具,恢复明确标注 `unconfined` 的兼容 Bash(不执行 shell 文件写入限制)。修改作用于现有会话后续调用,无需重启,不终止已启动的任务。拒绝时用户也可在会话访问模式控件选择 `danger-full-access`;Agent 不得自行放宽权限。与路径方言及 codePaths 开关独立。
**运行时开关 `experimentalNative`(默认 true):** 设置 → 插件 → dsh-gitbash-shell →「实验原生执行 / fail-closed」。开启时 Windows 受限/未确定模式拒绝 Bash,提供可用的两个显式工具;关闭立即禁用两个工具的执行;已有 eager native 槽位保留当前会话的 schema,下一会话应用新工具面,并恢复明确标注 `unconfined` 的兼容 Bash(不执行 shell 文件写入限制)。修改作用于现有会话后续调用,无需重启,不终止已启动的任务。拒绝时用户也可在会话访问模式控件选择 `danger-full-access`;Agent 不得自行放宽权限。与路径方言及 codePaths 开关独立。


两个工具随 Windows 的自有 bash 工具挂入同一 agent-owned scope;不替换官方工具或 root
Expand Down Expand Up @@ -518,3 +520,10 @@ return await fs.readFile(resolved.native_path, 'utf8');
## 许可

MIT © KannaKuron。参考与致敬:[dsh-ptc-cordis-preset](https://github.com/KannaKuron/dsh-ptc-cordis-preset)。

### 运行时兼容性与配置保留

- `run_code` 的程序字面量转换和 JavaScript TEMP 前置代码只适用于当前会话实际使用的 TypeScript 运行时;Python 或未知运行时的源码保持原样,普通工具路径参数仍独立转换。
- 自动补全持久终端的 `shellPath` 保留已有 `shellArgs`、超时、回滚行数等设置及注释,并与宿主配置编辑器使用同一个 profile 锁。
- 同名工具的全局、祖先和当前 agent 所有权均被检查;隐藏的外部工具也不会被插件重新注册覆盖。
- Bash 路由提示通过插件自有工具定义进入普通模式及 PTC SDK;PTC 程序指引通过独立提示段提供,不再修改宿主返回的 schema 副本。
16 changes: 16 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,19 @@ When [dsh-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) (v0.1

MIT © KannaKuron. Inspired by
[dsh-ptc-cordis-preset](https://github.com/KannaKuron/dsh-ptc-cordis-preset).

### Runtime compatibility and configuration preservation

- Program-literal rewriting and the JavaScript TEMP prelude run only for the
invoking session's actual TypeScript runtime. Python and unknown runtime source
stays unchanged; ordinary tool path parameters are translated independently.
- Persistent-terminal shellPath adoption preserves other options and comments,
using the same profile lock as Core's configuration editor.
- dsh-ops adoption atomically records original values in the profile-local
`.gitbash-ops-ownership.json` before editing. Restoration survives a restart,
changes only owned fields, and preserves pre-existing false and later user
choices. Unjournalled false values left by older versions are deliberately
left alone because their ownership cannot be determined.
- Companion ownership checks include hidden global and ancestor tools. Bash
routing is emitted by its owned definition for native schemas and PTC SDKs;
PTC program guidance uses a separate prompt section rather than schema copies.
49 changes: 29 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"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",
"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",
"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: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"
},
"keywords": [
Expand Down Expand Up @@ -90,6 +90,8 @@
},
"icon": "./icon.svg",
"devDependencies": {
"@deepseek-ai/schemastery": "^3.19.0"
"@deepseek-ai/cordis": "^4.1.0",
"@deepseek-ai/schemastery": "^3.19.0",
"yaml": "^2.8.1"
}
}
Loading
Loading