← 返回列表
D

dsh-plugin-pwsh-utf8

v0.1.1 · 3 天前发布

DeepSeek Harness plugin: a sandboxed pwsh tool with UTF-8 file-I/O defaults forced, fixing garbled Get-Content/Set-Content on CJK Windows (codepage 936).

dshdsh-plugindeepseek-harnesspowershellutf8encodingwindows

README

dsh-plugin-pwsh-utf8

DeepSeek Harness 插件:一个强制 UTF-8 文件 I/O 默认值的沙箱化 pwsh 工具。

背景

中文 Windows(系统代码页 936)下,harness 自带的 pwsh 工具只设置了 [Console]::OutputEncoding,而 Get-Content / Set-Content 仍按 ANSI 代码页读写——harness 自己写的 UTF-8 文件(session 日志、workspace.json、代码文件)会被读成乱码(实测复现)。pwsh_utf8 在每个命令前注入:

powershell
$PSDefaultParameterValues['Get-Content:Encoding']='UTF8'
$PSDefaultParameterValues['Set-Content:Encoding']='UTF8'
$PSDefaultParameterValues['Add-Content:Encoding']='UTF8'
[Console]::InputEncoding=[System.Text.UTF8Encoding]::new($false)
$OutputEncoding=[System.Text.UTF8Encoding]::new($false)

效果

注册 pwsh_utf8 工具,语义与 pwsh 相同(走 ctx.shell,保留沙箱/审批),但文件读写按 UTF-8 处理。模型在中文 Windows 上读 UTF-8 文件时应优先用这个工具。

安装

bash
dsh plugin --profile web add dsh-plugin-pwsh-utf8

版本兼容矩阵

DSH 版本状态说明
dsh@0.1.0-rc.6 ❓ 未知 metadata 缺失
dsh@0.1.0 ❓ 未知
dsh@0.2.0 ⚠️ 待验证 待实测(API 可能在变)
dsh@0.3.0+ ❓ 未知 尚未发布

💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正

元数据

License
MIT
npm
dsh-plugin-pwsh-utf8
Repo
Engines
{"node":">=18"}
Weekly DL
0
Monthly DL
0
dsh.bundle
{}