Mojibake guard bundle for DSH: feature-based garbled-text detection before writes with review-then-release (an identical retry passes), plus pre-execution pwsh encoding audit (ANSI/GBK/UTF-16/Default), Windows and Chinese first.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:fire-disposal/dsh-mojibake-interceptor
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
给 DeepSeek Harness 装的乱码拦截插件:AI 把乱码写进文件之前先拦一次,让它复查;当前版本 0.3.0,对齐 DSH 0.2.2-alpha.2 插件协议。
状态:可用;要求:Node >=24.9.0、DSH >=0.2.2-alpha.2 <0.3.0;仓库:fire-disposal/dsh-mojibake-interceptor
本质
在写入前拦截乱码、靠字符统计与编码回环判断的 DeepSeek Harness 插件。
选型
基于 Cordis 的 DeepSeek Harness 插件,纯 JS ESM,运行依赖 iconv-lite,测试 Node runner。
- 插件框架
- DeepSeek Harness
- Cordis 4
- @deepseek-ai/dsh-tools
- @deepseek-ai/schemastery
- DeepSeek Harness
- 核心
- 原生 JS
- iconv-lite
- 测试
- node:test
- 分发
- npm
- cordis.patch.yml
功能
tools/pre-execute:扫write/edit/str_replace_editor/apply_patch的待写入文本,以及pwsh/bash/terminal_send的命令文本,命中就deny并附上特征与还原结果;补丁只扫新增行,不拦修复乱码时保留的旧行tools/post-execute:扫pwsh/bash/terminal_open/terminal_send/terminal_read/job_output/read的捕获结果,输出乱码时注入通知- pwsh 写入编码审计:危险编码(
-Encoding Default/ANSI/OEM/Unicode、GetEncoding(936)、chcp非 65001)严重拦截;含非 ASCII 却没声明-Encoding utf8的按中等拦截 - 16 类检测特征,覆盖 UTF-8↔CP1252/GBK/Big5 双向误读、UTF-16 残留、替换符、ANSI 转义、BOM 异常、字面转义与 HTML 实体
- 三档模式
warn/block/ask,SHA-256 指纹键是「工具 + 路径 + 待写入文本」,LRU 表封顶 4096 条,不长期保留原始写入内容 - 性能:门控正则先挡掉纯 ASCII(1 MB 约 2 ms),候选段按
maxRunChars2048 /maxRuns64 /maxFindings8 止损 - 测试 88 项全过(含 1 MB ASCII、200 KB 中文性能冒烟与最新工具协议行为)
启动流程
# 从 GitHub 安装;bundle 安装后重启 dsh web
dsh plugin --profile web add "github:fire-disposal/dsh-mojibake-interceptor#main"
# 本地开发(替换为实际绝对路径)
dsh plugin --profile web add link:/absolute/path/to/dsh-mojibake-interceptor
# 检查 bundle 已进入组合树
dsh --profile web --dump-config
dsh plugin --profile web remove dsh-mojibake-interceptor
npm install
npm test
package.json 用 engines.dsh 声明运行时装载兼容范围,dsh.bundle.patch 指向 cordis.patch.yml。用户可在 profile 的 cordis.patch.yml 覆盖 mojibake-interceptor 行;注意 config 是整行替换,不是深合并。
配置项:mode、tools、resultWatchTools、pwshEncodingGuard、minSeverity、excludePaths、maxFindings、maxRunChars、maxRuns、maxPreviewChars。
边界与已知问题
- 拦截只在有结构化文本载荷的工具上生效;
run_code、ctx.fs这类入口拿不到待写入的纯文本,tools列表也扩不过去。 - 缺
iconv-lite时运行时会自动降级(CP1252 与统计特征照常,GBK/Big5 方向失效),但测试不降级:不装依赖跑,regression-normal里 5 项会失败。 - GBK 扩展区、生僻字构成的乱码,回环到常用区之外可能漏报(
gbk-as-cp1252为压误报刻意收紧)。 - 状态表在内存里,会话恢复后清空,「拦一次再放行」的记忆也随之丢失。
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 37331
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 36916
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
superdesigndev/treg★ 7889
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 5766
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
sixtysevenlf/dsh-blender-plugin★ 2051
Lets a DSH agent drive a local Blender over a direct TCP channel with 15 tools: viewport frames, custom-angle renders, Python execution, headless and job offload, transaction rollback, and a planning layer of 228 ops across 34 families.
yjl9903/AnimeGarden#dsh★ 1399
Anime Garden for DSH: search anime torrent resources from 動漫花園, 蜜柑计划, 萌番组 and ANi inside DSH — via chat, a sidebar panel with fansub and type filters, a seasonal calendar, and an in-app floating player.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.