@mzzsfy/dsh-shell-select 0.4.1 → 0.4.4
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/README.md +13 -20
- package/cordis.patch.yml +3 -189
- package/package.json +10 -4
- package/src/api.mjs +7 -1
- package/src/client.js +439 -389
- package/src/executor.mjs +31 -7
- package/src/prompt-projection.mjs +34 -0
- package/src/pwsh-takeover.mjs +23 -0
- package/src/resolve.mjs +35 -23
- package/src/tool.mjs +58 -25
- package/src/web-routes.mjs +3 -0
- package/test/background-owner.test.mjs +14 -0
- package/test/client-card.test.mjs +0 -21
- package/test/client-id.test.mjs +0 -56
- package/test/client-render.test.mjs +38 -12
- package/test/client-settings.test.mjs +251 -0
- package/test/config-entry.test.mjs +2 -1
- package/test/deny-output-schema.test.mjs +53 -0
- package/test/executor-seam.test.mjs +2 -1
- package/test/executor.test.mjs +23 -3
- package/test/official-contract.test.mjs +208 -0
- package/test/path-guidance.test.mjs +77 -0
- package/test/path-rescue.test.mjs +173 -0
- package/test/preset-drift.test.mjs +30 -139
- package/test/prompt-projection.test.mjs +120 -0
- package/test/pwsh-takeover.test.mjs +41 -0
- package/test/resolve.test.mjs +43 -13
- package/test/web-routes.test.mjs +15 -2
- package/test/client-drift.test.mjs +0 -27
- package/test/switch-guard.test.mjs +0 -37
package/README.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# @mzzsfy/dsh-shell-select
|
|
2
2
|
|
|
3
|
-
Windows shell
|
|
3
|
+
Windows 宿主 shell 链接管:接管根组合中的官方 `pwsh` 工具与执行器,提供可配置多客户端的 `shell` 工具——pwsh / git bash / cmd / WSL / 任意第三方实现,自定义路径,多个客户端并存,设默认,模型经工具参数按名选择。执行器活跃且会话可见 `shell` 时,模型工具定义不再暴露 `pwsh`,包括官方预设内的同名工具。
|
|
4
4
|
|
|
5
|
-
**宿主要求 ≥ 0.1.7-rc.1
|
|
5
|
+
**宿主要求 ≥ 0.1.7-rc.1**:保留现有 settings/行配置契约的最低版本要求。已移除会话预设声明和 `@deepseek-ai/dsh-agent-preset` 依赖,不扩大旧宿主兼容范围。
|
|
6
6
|
|
|
7
7
|
## 工作方式
|
|
8
8
|
|
|
9
|
-
- **运行时接管**:bundle 补丁不静态禁用官方 `tool-pwsh`、`pwsh-sandbox` 两行——boot 期官方 pwsh 链先服务,主行(`ctx.shell` 执行器 + `shell` 工具 + systemPrompt 段)apply 落定后经 `entry.update` 运行时禁用官方两行(dsh-market 同款,内存态不持久),再挂载执行器接管。本包任意死法(import 崩/apply 崩/被禁/卸载)下官方行保持启用,官方 pwsh 链自服务,系统不出现 shell 全灭窗口;重启后由行树声明态收敛。web 行(
|
|
10
|
-
- 配置事实源 = 主行 Config(dsh 0.1.7 settings 面以 profile 条目为存储,ns `shell-select`)
|
|
9
|
+
- **运行时接管**:bundle 补丁不静态禁用官方 `tool-pwsh`、`pwsh-sandbox` 两行——boot 期官方 pwsh 链先服务,主行(`ctx.shell` 执行器 + `shell` 工具 + systemPrompt 段)apply 落定后经 `entry.update` 运行时禁用官方两行(dsh-market 同款,内存态不持久),再挂载执行器接管。本包任意死法(import 崩/apply 崩/被禁/卸载)下官方行保持启用,官方 pwsh 链自服务,系统不出现 shell 全灭窗口;重启后由行树声明态收敛。web 行(`/api/shell-select/*` 数据通道,`inject: ['webServer', 'settings']` 声明式门控——服务就绪才激活)与 guard 哨兵行同 patch 插入。
|
|
10
|
+
- 配置事实源 = 主行 Config(dsh 0.1.7 settings 面以 profile 条目为存储,ns `shell-select`);设置中的 **Shell 管理** 页面经现有 API 读写宿主 settings,写路径 `settings.replace` 后刷新执行面(工具描述与默认客户端即时更新),也可通过宿主配置编辑器维护。
|
|
11
11
|
- client 半区 `dsh.client.inject` 声明(官方机制,dsh-client-file-upload 等官方包同款):保证 client 运行时模块表中 `primitives`/`slots` 面在场;primitives 另有 try/catch 降级自绘兜底。
|
|
12
12
|
- 本包执行器完整实现官方 `ctx.shell` seam(`resolve`/`run`/`start`/`runFor`/`startFor`/`entryFor`/`sandboxMode`),结构官方 PwshLocalExecutor 同构(实例状态/方法全公有——cordis 服务代理会把经 `ctx.shell` 调用的方法 `this` 重定向到阴影对象,`#` 私有触发品牌检查错误)。
|
|
13
|
-
-
|
|
13
|
+
- **不管理会话预设**:bundle 补丁仅插入主行、guard、web,不声明 `shell-select` 预设,不覆写 `agent-preset-registry` 默认值。宿主及用户选择的预设保持原样,已存活代理及其子代理可继续持有旧预设修订;部署若显式指定已删除的 `shell-select` 预设,应通过宿主预设选择入口改选现存预设,本包不保留别名或迁移路径。
|
|
14
|
+
- **只隐藏模型展示,不禁执行能力**:执行器生命周期内通过官方 `system-prompt/assemble` 最终投影删除 `pwsh` 工具 schema 与重复的 `tool:pwsh` 段;native/both 移除模型工具 schema,PTC/both 重建 TypeScript/Python SDK,SDK 使用宿主公开 renderer 重建,不改官方预设、不添加禁止调用提示词。下一次模型步骤重新组装时生效,已发送请求不追溯修改。工具注册和 PowerShell 执行契约仍保留,旧/在途调用及历史卡不受影响;这是减少模型选择与提示成本的展示策略,不是硬拒绝,模型仍可能凭历史猜名调用。若该代理看不到 `shell`(如子代理工具允许集仅保留 `pwsh`),原展示保持不变,避免失去唯一终端;SDK renderer 不可用时整体不改并告警。执行器卸载自动移除投影监听。
|
|
14
15
|
- 沙箱语义官方同构:`danger-full-access` 直跑;受限模式经 `ctx.sandbox.confine` 包装并按官方方言分类拒绝/runner 失败,权限模型不变。
|
|
15
16
|
- 死态自愈:用户 patch 层禁用主行的窗口(接管中 runtime-disable 残留)内,guard 哨兵(id 含 `/`,市场不写该层)代挂官方 `dsh-tool-pwsh` + `dsh-pwsh-sandbox` 恢复 host 面服务与 boot 组合(预载失败退避重试,至多 3 次),任一方复活先卸代挂。哨兵/复活让位语义逐项同构 `dsh-llm-pi-gateway`。边界:cordis 服务按 fiber 树解析,代挂对 agent preset 作用域不可见,死态窗口新会话的 preset tool-pwsh 行拒挂(报错清晰)属预期。
|
|
16
17
|
- escape hatch(用户想用官方 pwsh 链):market 禁用 shell-select 或 user patch 写 `- id: shell-select / disabled: true`——主行退场后官方行保持启用自服务,重启后官方自然回归;删除禁行重启即恢复接管。(官方两行带平台表达式,行级 `disabled: false` 与宿主默认启用同形,不作让位信号。)
|
|
@@ -21,6 +22,7 @@ Windows shell 链接管:禁用官方 `pwsh` 工具与执行器,替换为可配
|
|
|
21
22
|
`shell` 工具(官方 `pwsh` 工具逐调用镜像):
|
|
22
23
|
|
|
23
24
|
- 参数:`command`、`description`、`shell`(客户端 id,缺省用默认)、`timeoutMs`、`workdir`、`run_in_background`,沙箱升权面与官方一致。
|
|
25
|
+
- 模型主描述先说明当前默认 `shell`,再按配置逐项列出客户端 id 与工作环境(WSL 附已配置发行版,不可用项标记 `unavailable`);存在可用 Bash 时统一追加 Windows 路径提示。主描述只讲常规调用,不包含拒绝重试流程;系统提示保留退出失败与 Windows 中断处理纪律,不重复客户端选择和独立进程说明。拒绝返回及权限执行契约不变。
|
|
24
26
|
- 输出标记与官方逐字同构:`[exit code: N]`、`[killed by signal: X]`、`[timed out after …]`、`[sandbox: …]`、截断 spill 提示;terminal 卡退出 pill 照常复原。
|
|
25
27
|
|
|
26
28
|
## 会话卡(tool.call.toolview)
|
|
@@ -29,6 +31,7 @@ Windows shell 链接管:禁用官方 `pwsh` 工具与执行器,替换为可配
|
|
|
29
31
|
|
|
30
32
|
- 折叠行:状态点(失败红/中断黄/其余工具图标)+ `Shell` 标题 + 描述首行摘要,失败摘要红显。
|
|
31
33
|
- 展开卡:状态点 + cwd 末段目录 + 客户端名徽标 + 失败 pill(退出码/信号)+ 复制命令/复制输出按钮 + 命令折行带行号 + 输出区(横向滚动,竖向限高)。徽章忠实于执行事实:每次调用结果尾附 `[shell: <id>]` 标记(模型可见,官方退出标记同族),卡片按标记回放实际生效的客户端——缺省调用在配置事后变更或跨宿主查看时不被查看时读数改写;无标记的历史块回退显式参数 → 当前 default 推导。`pwsh`/`bash` 官方工具的调用无标记无 shell 参数,徽章按工具名钉死(客户端即工具名),永不落 default 读数。
|
|
34
|
+
- **直接 pwsh 接管徽章**:模型直接调用 `pwsh` 且由本包执行器处理、结果落定并记录接管事实后,折叠行与展开卡显示独立「插件接管」徽章,客户端徽章仍为 `pwsh`。接管事实通过独立结构化结果块持久化,不进入模型文本、不改命令输出;未记录接管事实的历史调用不补标,stdout 中的相似文案不会冒充接管事实。普通 `shell` 调用(含 `shell: pwsh`)不显示该徽章。
|
|
32
35
|
- 非终端意图回退简版行:摘要 + 可展开原文 + 检查按钮。
|
|
33
36
|
- 图标取官方 `dsh-client-ui-primitives`(StateDot/IconApi/IconInspect),模块表缺席时降级自绘。行首无展开箭头,与官方组件一致,可展开性由指针与整行点击承载。
|
|
34
37
|
|
|
@@ -56,7 +59,7 @@ shell-select:
|
|
|
56
59
|
default: pwsh
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
出厂默认即上述三客户端。设置中的 **Shell 管理** 沿用客户端卡片:在卡片内单选默认客户端,可添加/移除条目、探测路径及扫描本机、配置登录壳与 WSL 发行版。参数为空格分隔的文本,含空格的单项用引号包裹,例如 `-c "echo hello" {command}`,普通引号中的 Windows 反斜线不解码为控制字符,控制字符参数使用显式 `$'…'` 转义。环境按每行 `K=V` 编辑,普通值可含空格、等号和反斜线;含换行或以双引号开头的值显示为双引号字符串,仅此形式解析 `\n` 等转义。命令黑名单逐条添加/删除并显示行级正则错误,非法正则阻止保存;保留模式原有空白与换行,空字符串规则不参与拦截。没有编辑时保存按钮禁用;保存不会拆分未编辑的参数、改写正则或把自动探测路径写回声明值。保存后回读完整配置,执行预算保持不变,回读失败明确提示已保存但刷新失败。第三方实现:任意可执行文件 + 自定义 args 模板。
|
|
60
63
|
|
|
61
64
|
env 优先级(同键高右):内置覆盖集(NO_COLOR/PAGER/GIT_PAGER)< 条目 `env` < 调用方环境(spec.env + 会话 `DSH_*` 事实)。wsl 形把条目 env 与调用方环境全部键(WSLENV 本身除外)追加进 WSLENV 白名单,过 WSL 边界不静默失效。
|
|
62
65
|
|
|
@@ -64,8 +67,8 @@ env 优先级(同键高右):内置覆盖集(NO_COLOR/PAGER/GIT_PAGER)< 条目 `e
|
|
|
64
67
|
|
|
65
68
|
- 配置节顶层 `deny`:正则字符串数组,对模型提交的整条命令文本匹配(大小写不敏感),命中即拒绝——**deny 绝对,无豁免语义**;空数组 = 不拦截(出厂默认)。
|
|
66
69
|
- 精细放行在模式内用正则前瞻表达:`deny: ['rm -rf\\s+(?!\\S*node_modules)']` 禁 rm -rf 但放行清依赖目录;默认放行系统下独立 allow 列表的唯一语义就是覆盖 deny,与"deny 绝对"矛盾,故不设。
|
|
67
|
-
- 拦截点在执行器 runFor/startFor
|
|
68
|
-
- 定位是防误触护栏而非安全边界:整文本正则挡不住间接包装(编码/嵌套壳)
|
|
70
|
+
- 拦截点在执行器 runFor/startFor 入口:经本包 `ctx.shell` 代理的消费方(如 hooks 桥)与预设内消费该服务的官方 pwsh 工具同样受管。拒绝以模型可见标记返回:`[blocked by shell-select: matches deny pattern …]`,后台任务在启动前同步拒绝,不产生僵尸任务。
|
|
71
|
+
- 定位是防误触护栏而非安全边界:整文本正则挡不住间接包装(编码/嵌套壳),真正的边界始终是访问模式与沙箱。坏正则条目容错跳过,不瘫执行链。
|
|
69
72
|
|
|
70
73
|
### bash 形探测与 msys2
|
|
71
74
|
|
|
@@ -78,7 +81,7 @@ env 优先级(同键高右):内置覆盖集(NO_COLOR/PAGER/GIT_PAGER)< 条目 `e
|
|
|
78
81
|
|
|
79
82
|
- **受限模式 × Cygwin 系运行时**(git-bash/msys2):confine 包装后 Cygwin mmap 在受限令牌下崩溃(`CreateFileMapping … fatal error`,exit 256)。命令失败可见、错误自解释,模型可换客户端或升权重跑;危险模式与 pwsh/cmd/wsl 不受影响。与 dsh-bash-terminal-ts 观察一致,属 Cygwin 运行时限制而非本包缺陷。
|
|
80
83
|
- wsl 形在未安装发行版的机器上:wsl.exe 输出 UTF-16 帮助文本,呈现为乱码;正常发行版下 bash 输出走管道为 UTF-8 不受影响。
|
|
81
|
-
- 竞品来源主张的评审结论:不受配置清单约束的模型自选任意终端未采纳(
|
|
84
|
+
- 竞品来源主张的评审结论:不受配置清单约束的模型自选任意终端未采纳(本包的按名选择以 settings JSON 配置清单为边界,越界即报配置指引,官方升权面已覆盖安全需求);不受限 bash 危害面不做;交互式 PTY 终端本轮不做,列入路线图后续立项。
|
|
82
85
|
|
|
83
86
|
## 组合
|
|
84
87
|
|
|
@@ -95,14 +98,4 @@ env 优先级(同键高右):内置覆盖集(NO_COLOR/PAGER/GIT_PAGER)< 条目 `e
|
|
|
95
98
|
|
|
96
99
|
## dsh 版本兼容
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- 0.2.0-rc.2:完全适配(设置面通过;16 格 LLM 工具调用格因模拟模型无 tool_calls 能力登记环境不可测,历史真机记录与单元测试覆盖)
|
|
101
|
-
- 0.1.7-rc.2:不崩溃底线通过(全家桶 crash-only)
|
|
102
|
-
- 0.1.5-rc.3:未承诺(本包宿主要求 ≥0.1.7-rc.1,该版本不安装;全家桶在该版本不启动,详见仓库 docs/兼容性测试/逐包测试进度.md)
|
|
103
|
-
|
|
104
|
-
历史验收(Round 30,2026-09-27):0.1.7-rc.2 设置面 7 格过(自动探测/自定义路径/坏路径徽标/黑名单往返含行号拦截/默认热更落盘/preset 接管入册);运行时接管(Round 29)9291 keep 宿主实证 runtime-disable→fiber 激活+INV-6 残影稳定。
|
|
105
|
-
|
|
106
|
-
更细的逐包结论见仓库 `docs/兼容性测试/逐包测试进度.md` 与本包 `兼容性测试.md`。
|
|
107
|
-
|
|
108
|
-
测试:`node --test "test/*.test.mjs"`(包目录内)。
|
|
101
|
+
按仓库动态窗口验证(scripts/compat/window.mjs),不预置任何固定版本槽:主测 = 渠道 dist-tag 最新 rc,完全适配口径;基线 = npm latest,不崩溃底线口径;主测与基线同版时收敛单槽。本包声明 `dsh.hostMin = "0.1.7-rc.1"`:低于该代际的宿主 API 面未验证,compat 装载层自动排除。逐轮实测结论见 `docs/兼容性测试/逐包测试进度.md` 与本包 `兼容性测试.md`。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,192 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
# 官方 tool-pwsh 与 pwsh-sandbox
|
|
3
|
-
#
|
|
4
|
-
# (import 崩/apply 崩/被禁/卸载)下官方 pwsh 链保持启用自服务,系统不出现
|
|
5
|
-
# shell 全灭窗口(不变式与场景见 运行时接管-BDD.md)。主行提供 ctx.shell
|
|
6
|
-
# 执行器、shell 工具与 systemPrompt 段,web 行提供设置页数据通道,guard 行
|
|
7
|
-
# 哨兵自愈(死窗=接管中主行被禁的内存残留)。
|
|
8
|
-
#
|
|
9
|
-
# 平台门控:本包全部 insert 行在非 win32 停用(host 半区 apply 内另有平台早退,
|
|
10
|
-
# 双重防护)。POSIX 官方 bash 链(tool-bash/bash-sandbox)与本包零接触;官方
|
|
11
|
-
# pwsh 两行在 POSIX 本就被 dsh-base 平台表达式停用,Linux 行为与无本包逐字
|
|
12
|
-
# 一致。接管空间判定:官方两行 win32 平台默认 disabled=false(启用),与用户
|
|
13
|
-
# 显式启用在行树不可区分,凡非 true 即接管空间;POSIX 显式启用场景被 apply
|
|
14
|
-
# 平台早退拦截,不会越过宿主平台门控强启官方行。
|
|
15
|
-
#
|
|
16
|
-
# escape hatch(用户想用官方 pwsh 链):market 禁用 shell-select,或 user patch
|
|
17
|
-
# 写 `- id: shell-select / disabled: true`——主行退场后官方行保持启用自服务
|
|
18
|
-
# (接管中被禁由 guard 代挂),重启后官方自然回归;删除禁行重启即恢复接管。
|
|
19
|
-
#
|
|
20
|
-
# 哨兵自愈与复活让位语义逐项同构 packages/dsh-llm-pi-gateway 的 guard/takeover,
|
|
21
|
-
# 差异仅两处:官方代挂对象为 tool-pwsh + pwsh-sandbox 两行;行配置读官方
|
|
22
|
-
# `shell` settings 节(pwsh-sandbox 经其 Config 消费,保持官方 pwshPath 配置)。
|
|
23
|
-
#
|
|
24
|
-
# preset 面:0.1.7 起 agent 面整体移入预设(preset-* 声明行内联 roster,旧
|
|
25
|
-
# agent-presets roots 挂载机制已移除)。本包 patch insert 自带预设声明
|
|
26
|
-
# (standard 全量 − tool-pwsh 行,逐项同构 dsh-web-app presets/standard.patch.yml)
|
|
27
|
-
# 并覆写 agent-preset-registry 的 default——win32 切到本包预设、POSIX 保持
|
|
28
|
-
# standard(本包行在 POSIX 全停用,行为须与上游逐字一致)。用户显式选择恒优先;
|
|
29
|
-
# 上游 standard 漂移由 test/preset-drift.test.mjs 守卫,升级后须对表。
|
|
30
|
-
|
|
31
|
-
# ── 预设面(0.1.7 架构):声明本包预设并接管 default ─────────────────────────
|
|
32
|
-
# 0.1.7 的 agent 面整体移入预设:web 表面在根组合树禁用全部 agent 工具行,
|
|
33
|
-
# 由 preset-* 声明行(@deepseek-ai/dsh-agent-preset,config.plugins 内联 roster)
|
|
34
|
-
# 决定每个会话的工具面。旧架构的 agent-presets 行(roots 目录挂载)已不存在,
|
|
35
|
-
# 覆写它只会得到 "patch: entry not found" 且 default 保持 standard——standard
|
|
36
|
-
# 内联 roster 的 tool-pwsh(win32 启用)即模型工具面,pwsh 未被接管。
|
|
37
|
-
# 收口 = 两段:insert 本包预设声明(standard 全量 − tool-pwsh),覆写
|
|
38
|
-
# agent-preset-registry 的 default(patch 语义为整体替换 config,须逐键重述)。
|
|
39
|
-
# win32 default 切到本包预设;POSIX 保持 standard(本包行在 POSIX 全停用,
|
|
40
|
-
# 行为须与上游逐字一致)。用户显式选择其他预设恒优先;官方 minimal/cordis/ptc
|
|
41
|
-
# 预设自带 persistent pwsh 链,显式选用时不在接管范围(README 已标注)。
|
|
42
|
-
|
|
43
|
-
- insert:
|
|
44
|
-
- id: preset-shell-select
|
|
45
|
-
name: '@deepseek-ai/dsh-agent-preset'
|
|
46
|
-
disabled: !!js process.platform !== 'win32'
|
|
47
|
-
config:
|
|
48
|
-
id: shell-select
|
|
49
|
-
name: Shell 管理
|
|
50
|
-
order: 2
|
|
51
|
-
plugins:
|
|
52
|
-
- id: persona
|
|
53
|
-
name: '@deepseek-ai/dsh-persona'
|
|
54
|
-
config:
|
|
55
|
-
suffix: Your working directory is {{cwd}}.
|
|
56
|
-
prefix: >-
|
|
57
|
-
You are a coding agent powered by the {{model}} model.
|
|
58
|
-
- id: agent-instructions
|
|
59
|
-
name: '@deepseek-ai/dsh-agent-instructions'
|
|
60
|
-
config:
|
|
61
|
-
maxBytes: 65536
|
|
62
|
-
- id: tool-bash
|
|
63
|
-
name: '@deepseek-ai/dsh-tool-bash'
|
|
64
|
-
disabled: !!js process.platform === 'win32'
|
|
65
|
-
- id: tool-fs
|
|
66
|
-
name: '@deepseek-ai/dsh-tool-fs'
|
|
67
|
-
- id: tool-fs-search
|
|
68
|
-
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
69
|
-
config:
|
|
70
|
-
sampleOverCapGlobResults: false
|
|
71
|
-
- id: tool-jobs
|
|
72
|
-
name: '@deepseek-ai/dsh-tool-jobs'
|
|
73
|
-
- id: skill-filesystem
|
|
74
|
-
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
75
|
-
- id: tool-skill
|
|
76
|
-
name: '@deepseek-ai/dsh-tool-skill'
|
|
77
|
-
- id: command-goal
|
|
78
|
-
name: '@deepseek-ai/dsh-command-goal'
|
|
79
|
-
- id: tool-goal
|
|
80
|
-
name: '@deepseek-ai/dsh-tool-goal'
|
|
81
|
-
- id: planning
|
|
82
|
-
name: cordis:group
|
|
83
|
-
group: true
|
|
84
|
-
isolate:
|
|
85
|
-
planMode: true
|
|
86
|
-
config:
|
|
87
|
-
- id: plan-mode
|
|
88
|
-
name: '@deepseek-ai/dsh-plan-mode'
|
|
89
|
-
config:
|
|
90
|
-
section: |
|
|
91
|
-
You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
92
|
-
|
|
93
|
-
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
94
|
-
|
|
95
|
-
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
96
|
-
|
|
97
|
-
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
98
|
-
|
|
99
|
-
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
100
|
-
|
|
101
|
-
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
102
|
-
- id: compaction
|
|
103
|
-
name: cordis:group
|
|
104
|
-
group: true
|
|
105
|
-
isolate:
|
|
106
|
-
compaction: true
|
|
107
|
-
toolResultPruner: true
|
|
108
|
-
config:
|
|
109
|
-
- id: compaction-basic
|
|
110
|
-
name: '@deepseek-ai/dsh-compaction-basic'
|
|
111
|
-
- id: command-compact
|
|
112
|
-
name: '@deepseek-ai/dsh-command-compact'
|
|
113
|
-
- id: tool-result-pruner
|
|
114
|
-
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
115
|
-
config:
|
|
116
|
-
thresholdChars: 8192
|
|
117
|
-
headChars: 4096
|
|
118
|
-
tailChars: 1024
|
|
119
|
-
- id: delegation
|
|
120
|
-
name: cordis:group
|
|
121
|
-
group: true
|
|
122
|
-
isolate:
|
|
123
|
-
workflowEngine: true
|
|
124
|
-
config:
|
|
125
|
-
- id: tool-subagent-control
|
|
126
|
-
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
127
|
-
- id: tool-subagent-list-agents
|
|
128
|
-
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
129
|
-
- id: tool-subagent
|
|
130
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
131
|
-
config:
|
|
132
|
-
provider: spawn
|
|
133
|
-
toolName: subagent
|
|
134
|
-
modelSelectionSettings: true
|
|
135
|
-
backgroundMode: continuable
|
|
136
|
-
- id: tool-subagent-fork
|
|
137
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
138
|
-
config:
|
|
139
|
-
provider: fork
|
|
140
|
-
toolName: subagent_fork
|
|
141
|
-
backgroundMode: continuable
|
|
142
|
-
- id: tool-subagent-codex
|
|
143
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
144
|
-
disabled: true
|
|
145
|
-
config:
|
|
146
|
-
provider: codex
|
|
147
|
-
toolName: subagent_codex
|
|
148
|
-
backgroundMode: one-shot
|
|
149
|
-
maxDepth: provider-managed
|
|
150
|
-
- id: tool-subagent-claude-code
|
|
151
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
152
|
-
disabled: true
|
|
153
|
-
config:
|
|
154
|
-
provider: claude-code
|
|
155
|
-
toolName: subagent_claude_code
|
|
156
|
-
backgroundMode: one-shot
|
|
157
|
-
maxDepth: provider-managed
|
|
158
|
-
- id: workflow-ptc
|
|
159
|
-
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
160
|
-
config:
|
|
161
|
-
provider: spawn
|
|
162
|
-
- id: tool-workflow
|
|
163
|
-
name: '@deepseek-ai/dsh-tool-workflow'
|
|
164
|
-
- id: tool-ralph
|
|
165
|
-
name: '@deepseek-ai/dsh-tool-ralph'
|
|
166
|
-
disabled: true
|
|
167
|
-
config:
|
|
168
|
-
subagentProvider: spawn
|
|
169
|
-
maxRounds: 64
|
|
170
|
-
- id: tool-ask-user
|
|
171
|
-
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
172
|
-
- id: tool-todo
|
|
173
|
-
name: '@deepseek-ai/dsh-tool-todo'
|
|
174
|
-
config:
|
|
175
|
-
allowParallelInProgress: true
|
|
176
|
-
- id: tool-web
|
|
177
|
-
name: '@deepseek-ai/dsh-tool-web'
|
|
178
|
-
config:
|
|
179
|
-
fetch: true
|
|
180
|
-
searchTimeoutMs: 60000
|
|
181
|
-
- id: present
|
|
182
|
-
name: '@deepseek-ai/dsh-tool-present'
|
|
183
|
-
- id: tool-plugin-manager
|
|
184
|
-
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
|
185
|
-
disabled: true
|
|
186
|
-
|
|
187
|
-
- id: agent-preset-registry
|
|
188
|
-
config:
|
|
189
|
-
default: !!js "process.platform === 'win32' ? 'shell-select' : 'standard'"
|
|
1
|
+
# Windows 宿主 shell 链运行时接管;不声明会话预设、不修改默认预设。
|
|
2
|
+
# 官方 tool-pwsh 与 pwsh-sandbox 不静态禁用:主行可服务后接管,失败回滚。
|
|
3
|
+
# guard 守服务,web 提供配置通道;POSIX 全部停用,官方 bash 链不受影响。
|
|
190
4
|
|
|
191
5
|
- insert:
|
|
192
6
|
- id: shell-select
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mzzsfy/dsh-shell-select",
|
|
3
|
-
"description": "Windows shell 接管:替换默认 pwsh 工具为可配置多客户端的 shell 工具(git bash/WSL/cmd/pwsh,自定义路径,默认客户端,模型按名选择)",
|
|
4
|
-
"version": "0.4.
|
|
3
|
+
"description": "Windows shell 接管:替换默认 pwsh 工具为可配置多客户端的 shell 工具(git bash/WSL/cmd/pwsh,自定义路径,默认客户端,模型按名选择);支持命令 deny 黑名单、会话终端卡增强和直接 pwsh 接管徽章,接管失败自动回退官方 pwsh 链",
|
|
4
|
+
"version": "0.4.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -26,7 +26,14 @@
|
|
|
26
26
|
"@deepseek-ai/dsh-client-ui-conversation"
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
|
-
"hostMin": "0.1.7-rc.1"
|
|
29
|
+
"hostMin": "0.1.7-rc.1",
|
|
30
|
+
"compatibility": {
|
|
31
|
+
"dshReleases": {
|
|
32
|
+
"0.2.0-rc.1": "unknown",
|
|
33
|
+
"0.2.0-rc.2": "compatible",
|
|
34
|
+
"0.2.1-alpha.1": "unknown"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
30
37
|
},
|
|
31
38
|
"scripts": {
|
|
32
39
|
"test": "node --test \"test/*.test.mjs\"",
|
|
@@ -42,7 +49,6 @@
|
|
|
42
49
|
},
|
|
43
50
|
"peerDependencies": {
|
|
44
51
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
45
|
-
"@deepseek-ai/dsh-agent-preset": ">=0.1.7-rc.1",
|
|
46
52
|
"@deepseek-ai/dsh-http-proxy": ">=0.1.5-rc.2",
|
|
47
53
|
"@deepseek-ai/dsh-jobs": ">=0.1.5-rc.2",
|
|
48
54
|
"@deepseek-ai/dsh-llm": ">=0.1.5-rc.2",
|
package/src/api.mjs
CHANGED
|
@@ -61,7 +61,7 @@ function readBody(req) {
|
|
|
61
61
|
/**
|
|
62
62
|
* 挂载配置/探测路由。可写操作(settings.update)在 settings 缺席时由闭包抛错归一 400。
|
|
63
63
|
* @param {object} ctx cordis context
|
|
64
|
-
* @param {{listShells: Function, readConfig: Function, updateConfig: Function, detect: Function, probe: Function}} faces
|
|
64
|
+
* @param {{listShells: Function, readConfig: Function, updateConfig: Function, detect: Function, probe: Function, pathMap: Function}} faces
|
|
65
65
|
*/
|
|
66
66
|
export function mountRoutes(ctx, faces) {
|
|
67
67
|
const webServer = ctx.get('webServer')
|
|
@@ -94,6 +94,12 @@ export function mountRoutes(ctx, faces) {
|
|
|
94
94
|
sendJson(res, 200, { exists: faces.probe(candidatePath) })
|
|
95
95
|
}),
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
path: `${API_ROOT}/pathmap`,
|
|
99
|
+
handler: route('GET', async (req, res) => {
|
|
100
|
+
sendJson(res, 200, faces.pathMap())
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
97
103
|
{
|
|
98
104
|
path: `${API_ROOT}/detect`,
|
|
99
105
|
handler: route('POST', async (req, res) => {
|