dsh-ops
中文 | English
解决 Windows 下 DSH 反复使用 PowerShell 报错造成的 token、时间和模型注意力浪费。本插件的三个主要功能:
- 提供独立 bash 5.3.15 并优先使用bash,让你的AI不再和PowerShell打架
- 独立 PowerShell 7.6.6,用于必要的 Windows 原生操作,沿用宿主
pwsh工具。PowerShell 7 比自带的 PowerShell 5 也有不少优化 - 一些 Rust 编写的性能更好的,更快的读取、查找、替换工具,加速任务运行,减少不必要的输入输出。由于部分工具不经过 DSH 的受限终端后端,命令与后台任务工具只在完全权限时启用。
- 未来会加入一系列docx,pdf处理轻量化的好用的rust工具,均可开关,不占用上下文
执行顺序:工具包 → bash → PowerShell 7。
仅支持 Windows x64,后续补充 Rust 工具后会支持 Linux 和 Mac(Linux 和 Mac 下不提供 bash 功能)。目标宿主 DSH 0.2.0-rc.2。有问题可以在eac交流群 1083832019 找风雪问。
安装、更新、卸载
官方插件市场
在目标 DSH 应用的插件市场中输入 npm 包名 dsh-ops,安装后选择启用。安装归属于当前运行的 profile,桌面端为 desktop。发布包依赖完整 FastCtx、bash 和 PowerShell 7 载荷;不使用安装脚本下载,不改系统 PATH。
npm 一键安装
npx --yes dsh-ops@latest install --profile desktop
npx --yes dsh-ops@latest install --profile web
npx --yes dsh-ops@latest install --profile tui
必须显式选择目标 profile;tui 映射到 dsh-TUI 产品的 dsh-tui profile,不是旧的 tui 目录。请先初始化目标应用。该入口委托官方 DSH CLI 安装,不另写一套 profile 锁与回滚逻辑。
桌面端必须使用桌面应用自带的 CLI;默认探测 %LOCALAPPDATA%\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd。安装在其它位置时加 --dsh-cli "<安装目录>\resources\runtime\cli\bin\dsh.cmd"。Web/TUI 需要可用的 DSH CLI,可同样显式指定。
也可以直接使用官方命令:
dsh plugin --profile web add dsh-ops
dsh plugin --profile dsh-tui add dsh-ops
"<桌面安装目录>\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add dsh-ops
普通 DSH CLI 不能管理保留的 desktop profile;不要把它与桌面自带入口混淆。
更新:重新运行相同的 npx --yes dsh-ops@latest install --profile ...,或用官方 CLI add dsh-ops@latest。按应用提示重载;替换已加载代码时重启应用。
当前版本 0.2.4 支持三个独立组件;bash 参数 schema 修复和自定义图标保留。三个二进制依赖继续使用 0.2.1,它们会自动安装,不影响主插件版本。原始载荷记录见 docs/release-0.2.1.md。
卸载与查看状态:
npx --yes dsh-ops@latest status --profile desktop
npx --yes dsh-ops@latest uninstall --profile desktop
把 desktop 换成 web 或 tui 即可。也可在市场卸载,或执行官方 dsh plugin --profile ... remove dsh-ops。二进制随 profile 的插件依赖管理;卸载移除依赖引用,不误删系统 shell、其它 profile 的副本或包管理器共享缓存。
旧版显式 provision 的 <DSH_HOME>/dsh-ops/ 文件需单独清理:npx --yes dsh-ops@latest uninstall --yes。默认不删 ~/.fastctx/ 持久状态;需要时显式加 --purge-fastctx。关闭后台组件会等待已发出的调用,然后尝试终止该组件当前连接记住的自有任务;失败会告警。断线丢失归属的旧任务及单纯降权不保证终止,先处理自己的任务。
组件开关与提示词
官方市场显示三个组件,分别启停,首次安装默认开启前两个:
| 组件 | 介绍 | 默认 | 发布的工具 |
|---|---|---|---|
dsh-ops-bash & powershell 7 |
将默认终端改为bash,以及bash覆盖不到时提供powershell7 | 开 | ops_bash;宿主 pwsh 使用随包 PowerShell 7 |
dsh-ops-file |
更快、更高性能、输出更精简更省token的rust文件检索 | 开 | 四个文件工具 |
dsh-ops-background |
为科研仿真、模型训练及其他长进程后台任务提供托管 | 关 | 启动、输出、列出、终止后台任务 |
“默认终端改为 bash”指模型提示优先使用 ops_bash,不修改系统默认终端、PATH 或宿主原有 shell 工具名称。Shell 组件开时,通过官方配置生命周期临时指定 pwsh-sandbox 的 PowerShell 7 路径;关时按执行器最新原配置恢复,不写 profile 配置。执行器配置切换不代表取消已在运行的宿主命令。
提示词注册为独立运行时段,不写 AGENTS.md:Shell 关就撤销 bash/pwsh 路由;文件关就撤销检索说明;后台关就不发布后台工具及自有 job 指导。文件与后台共享一个插件拥有的 FastCtx 连接,关闭其中一个不关闭另一个。默认仅新增五个工具,不发布重复前台 ops_run。这些改变减少固定声明成本。极简预设会覆盖附加 system sections;PTC 模式经 SDK 调用底层工具,权限门不变。
配置方式与工具列表
在 DSH 的配置编辑器中找到对应的 dsh-ops/shell、dsh-ops/file 或 dsh-ops/background 行,调整 config 后保存;未知配置键会点名报错。也可直接在市场切换组件。主要配置:
config:
# background component only; its market row is disabled by default
enableShellTools: true
publishBashTool: true
promptPolicy: true
toolCallTimeoutMs: 300000
required: false
shellPolicy: advise
allowSystemShellFallback: true
# binaryPath: 'C:\tools\fastctx.exe'
# bashPath: 'C:\tools\bash.exe'
enableShellTools:后台组件的部署开关,开启仍须会话danger-full-access才发布四个后台工具;文件组件不发布命令工具。publishBashTool:是否发布ops_bash,同样要求完全权限和宿主 subprocess 服务。promptPolicy:是否注入该组件的运行时说明;可用extraGuidance追加指导。toolCallTimeoutMs:FastCtx RPC 等待超时,不代表服务端工作已终止。required:运行时不可用时是否拒绝激活。shellPolicy:默认advise;deny-host-shell拒绝deniedHostTools列表中的宿主 shell(默认[pwsh, bash, pwsh_persistent])。这也会禁用第三层 pwsh,谨慎开启。binaryPath/bashPath:可选显式路径;不可用时报错,不悄悄换执行器。一般无需配置。
| 工具 | 用途 | 完全权限要求 |
|---|---|---|
ops_inspect_local_file |
批量文本范围、编码、PDF 文本、hex | 无命令权限门¹ |
ops_grep |
Rust 正则搜索、多文件过滤、计数/摘要 | 无命令权限门¹ |
ops_glob |
多模式找路径,支持排除 | 无命令权限门¹ |
ops_replace |
跨文件批量替换;精确编辑仍用宿主 edit | 无命令权限门¹ |
ops_bash |
优先的通用 bash 命令执行器 | 是 |
ops_run_background |
启动后台任务 | 是 |
ops_job_output / ops_job_list / ops_job_kill |
查看、列出、停止当前会话启动的任务 | 是 |
宿主 pwsh |
使用随包 PowerShell 7 的 Windows 原生操作 | 沿用宿主策略 |
¹ 文件工具不是宿主文件系统沙箱。 它们未接入 DSH 的受限文件后端,尤其 ops_replace 没有 workspace confinement。不要把该插件提供的部分工具视为不可信受任限环境的安全方案。
许可证
插件源码分发采用 MIT AND Apache-2.0:vendor/fastctx/ 之外为 MIT;vendored FastCtx 为 Apache-2.0。见 NOTICE、vendor/fastctx/LICENSE-APACHE 与 vendor/fastctx/NOTICE。
独立的 Windows 载荷包另按上游组件许可证分发:Git for Windows 包含 GPL 等许可组件,PowerShell 包含 MIT 与第三方组件。其原始许可证、声明及来源记录随载荷保留;插件的 MIT 许可不替代这些许可。详见 PROVENANCE.md。
致谢
Rust 工具基于 yc-duan 的 Codex 插件 FastCtx 并使用其源代码。vendor 标识与删除型分发改动记在 vendor/fastctx/FORK.md 和 vendor/fastctx/UPSTREAM.md。需要转载的 FastCtx 声明如下:
This product includes FastCtx (https://github.com/yc-duan/fastctx), Copyright (c) 2026 yc-duan, used under the Apache License 2.0.
FastCtx is redistributed and/or modified here by the maintainer of this distribution. Any such change is that maintainer's own work and their sole responsibility. It is not endorsed by, not supported by, and not attributable to the author of FastCtx, who accepts no liability of any kind arising from this distribution or from anything built on top of it.
No comments yet. Be the first to write one.