xiayuhkust/dsh-toolbelt--packages-script-exec0

dsh-plugin-script-exec

run_script tool for DeepSeek Harness: write multi-line scripts to a temp file and execute, avoiding Windows inline-quoting pitfalls.

AI 분석

核心用途是解决Windows系统下多行脚本执行时的转义和乱码问题。适合经常需要在DSH中运行pwsh、python或node脚本的Windows用户。

패키지
dsh-plugin-script-exec
버전
0.1.0
라이선스
MIT
최근 업데이트
2026. 8. 15.

설치

검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗

dsh-plugin-script-exec

给 DeepSeek Harness 增加 run_script 工具:脚本先写入临时文件再执行(pwsh / python / node),执行后删除。

背景:Windows 上内联传递多行脚本(pwsh -Commandpython -c)在含引号、中文时频繁因转义失败报错,agent 往往要试错多次。落盘执行从根上绕开转义问题。ps1 文件写入时附带 UTF-8 BOM(PowerShell 5.1 对无 BOM UTF-8 按 ANSI 解码)。

执行走 ctx.subprocess,与内置 pwsh 工具同一沙箱与审批策略,不新增权限面。

安装

dsh plugin --profile web add dsh-plugin-script-exec

cordis.patch.yml:

- id: script-exec
  name: dsh-plugin-script-exec
  config:
    timeoutMs: 120000
    maxOutputChars: 30000

状态

v0.1,已实测。

实测记录(2026-08-15,dsh 0.1.0-rc.6 / deepseek-v4-flash / Windows 11):

  • headless 会话中执行含中文与嵌套引号的 pwsh 脚本 Write-Output '中文测试:他说"你好"'; Write-Output (1+1),run_script 正确回传 stdout(中文与引号完整保留、1+1=2),退出码 0;
  • python / node 分支同样跑通。

实现注记:

  • 本插件零 dsh import。dsh 0.1.0-rc.6 的加载器不为第三方插件的内部 import 解析 host 内部包(如 dsh-tools),故手工构造 ToolDefinition 对象而非 import defineTool;
  • 执行走 ctx.shell.resolvectx.shell.run;其 stdout/stderr 是 CollectedOutput 对象({text, truncated, spillPath?}),需取 .text(联调时踩过 [object Object] 坑,已修)。

已知待改进:不拦截脚本正文内的间接文件读取(如 python open() 读敏感文件),需与 secret-guard v0.2 的脚本正文扫描协同。