DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

zhongzheng005-ux /

zhongzheng005-ux/dsh-approval-human

Verified

把 DSH 的沙箱越权审批弹窗翻译成人话:先说清要什么权限、会发生什么、最坏能坏到什么程度,原始提示折叠在最后。

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHubProject homepage
READMESource: main@36ba8765

dsh-approval-human

给 DSH 的审批弹窗配一个说人话的翻译官。

DSH 的越权审批弹窗,原文长这样:

escalate sandbox to danger-full-access: 写临时脚本到 workspace 外并枚举进程与监听端口
$code=@' import psutil, os for p in psutil.process_iter(...) ... '@

大概率你看不懂,于是只能闭眼点「允许一次」。 这个插件把它换成三句人话。

装完长这样

人话面板

展开折叠区,原始提示一个字不少:

展开原始提示

它回答三个问题

问题 例子(danger-full-access)
要什么权限 可以读写这台电脑上任何位置的文件,并运行任意命令。
点了会怎样 这一条命令不再被限制在项目文件夹里,能碰 D 盘、系统盘、桌面和你其他的项目。
最坏能坏到哪 如果命令写错,可能改坏或删掉项目之外的东西,且删掉的通常恢复不了。这次授权只对这一条命令有效,下一次还会再问你。

还有一行「它的说法」,是模型自己写的理由(从原始 reason 里剥出来),最后一行 ▸ 看不懂?点这里看原始提示和完整命令 展开后是原生英文提示 + 工具名 + 调用编号 + 完整命令原文。

三种权限模式

模式 标题
danger-full-access 它要「完全访问这台电脑」的权限
workspace-write 它要「修改项目文件」的权限
read-only 它要「读取更多内容」的权限
其他插件自定义的 reason 「<工具名> 需要你确认一下」,不编造风险描述,如实把原文摆出来

设计原则:只翻译,不改写风险等级。已知模式给出具体后果,未知模式老老实实说「影响取决于这条操作本身」,然后把原文给你看。不为了好看而淡化危险。

安装

需要 DSH 0.1.6-alpha 或更高、Windows(脚本是 PowerShell;macOS/Linux 见下面「手动安装」)。

git clone https://github.com/zhongzheng005-ux/dsh-approval-human.git
cd dsh-approval-human
powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1

脚本做的事:

  1. 复制到 %USERPROFILE%\.dsh\plugins\dsh-approval-human
  2. 备份你的 profile package.json(.bak-approval-<时间戳>)
  3. dependencies 加一条 "dsh-approval-human": "file:../../plugins/dsh-approval-human"
  4. dsh.profile.bundles 末尾追加 "dsh-approval-human"
  5. 在 profile 的 node_modules 下建 junction

改完 刷新页面 即可,不用重启 DSH(dsh-client-hmr 每 500ms 轮询 bundle mtime,变了就经 SSE /plugins/events 推 {type:"rebuilt"},浏览器自动 reload 那个模块)。

卸载

powershell -NoProfile -ExecutionPolicy Bypass -File .\uninstall.ps1

移除 profile 里的两处登记 + 摘掉软链,插件目录默认保留(加 -Purge 才删)。刷新页面即回到原生弹窗。

手动安装(macOS / Linux / 不想跑脚本)

# 1. 把仓库放到某个稳定位置,比如 ~/.dsh/plugins/dsh-approval-human
# 2. 编辑 ~/.dsh/profiles/web/package.json
#    dependencies 里加:  "dsh-approval-human": "file:<绝对路径>"
#    dsh.profile.bundles 末尾加: "dsh-approval-human"
# 3. 建软链
ln -s <绝对路径> ~/.dsh/profiles/web/node_modules/dsh-approval-human
# 4. 刷新页面

怎么看效果(没有真实审批时)

插件内置演示入口,不需要触发真的越权操作:

// 浏览器控制台
__aphDemo("danger-full-access")   // 还有 "workspace-write" / "read-only" / "generic"

或直接打开 http://127.0.0.1:3080/#aph-demo(默认演示 danger-full-access)。 上面那两张图就是这么截的。

它是怎么做到的(没动 node_modules 一个字节)

DSH 的 conversation.composer 是个 chain 槽:按 priority 升序依次调用每个条目的 select(ownerProps),第一个返回非 null 的被选中渲染。原生审批面板是 priority: 1, 本插件注册一个 priority: -1 的条目,命中 pendingInteraction 时接管,其他时候 return null 让位。

ctx.slots.inject("conversation.composer", () =>
  ctx.slots.register(
    {
      name: "conversation.composer",
      priority: -1,
      select: (ownerProps) => {
        const p = ownerProps?.pendingInteraction;
        // PendingApproval 是原包的内部 class,拿不到引用,只能按结构判断
        return p && p.kind === "approval" && typeof p.answer === "function" ? p : null;
      },
    },
    HumanApprovalPanel,
  ),
);

兼容性

项 值
DSH 0.1.6-alpha.2 实测通过
平台 web(浏览器侧插件)
OS 安装脚本 Windows;插件本体与系统无关
依赖 无(只用宿主提供的 react / primitives)

主题适配走 DSH 的 CSS 变量,浅色/深色都跟主题走。第三方 UI 皮肤插件只要没替换 conversation.composer 的 chain 语义,就不会冲突。

开发

npm run check   # node --check
npm test        # 两个离线冒烟测试(桩件模拟 __ModuleLoader__ / react / primitives)

源码只有两个文件:

文件 作用
lib/index.js host 半部,空 apply(全部工作在浏览器侧)
lib/client.js 面板 + 样式 + 槽注册 + 演示入口

改完 lib/client.js 直接覆盖到 %USERPROFILE%\.dsh\plugins\dsh-approval-human\lib\, 500ms 内 HMR 会自动 reload,不用重启。

相关文章

  • 给 AI 的越权弹窗配一个说人话的翻译官 —— 设计取舍与槽机制

License

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit 36ba876589f2

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout