npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-permissions

v1.2.2

Published

DeepSeek Harness 权限规则引擎:hard/deny/ask/allow 四级规则(hard 高于全访问)、全局与 workspace 作用域、通配符路径保护、可视化草稿式编辑器,规则持久化于 settings.yaml

Readme

dsh-permissions

中文 | English

Awesome DSH Plugin Awesome DSH Plugin

面向 DeepSeek Harness(dsh)的 Claude Code 风格权限规则引擎。双面 Cordis 插件:宿主侧在 tools/pre-execute 瀑布上做拦截判定,浏览器侧提供 设置 → 权限 可视化编辑器。

亮点

  • 四级规则、严格优先级hard > deny > ask > allow
  • hard 高于全访问:即使会话处于全访问档(审批策略 never),hard 规则依然拦截、不可豁免;ask 规则跟随会话策略,全访问下自动放行。
  • 作用域global 规则全局生效;按 workspace 的规则叠加合并(冲突时 deny 永远胜出)。
  • 通配符匹配(文件类工具 read/write/edit/glob/grep/read_image):
    • write(*.pem) —— 路径以 .pem 结尾
    • write(*secret*) —— 路径包含 secret
    • write(.ssh) —— 路径任意位置出现 .ssh 片段(大小写不敏感,\// 统一归一化)
    • write(C:\users\*) —— 绝对路径前缀
    • write —— 该工具全部调用
  • 持久化:规则存于 dsh-permissions 设置命名空间,跨重启保留(<harness home>/settings.yaml)。
  • 模型透明:生效规则注入系统提示([active-permission-rules] 段)。
  • 可视化编辑器:草稿式(staged)编辑——所有修改点「保存并应用」后才生效,附一键预设(保护敏感目录 / 密钥文件 / 拦截危险命令)。

界面截图

| 顶部:作用域与规则构建器 | 规则面板 / 试算器 / 决策日志 | 草稿式保存 | |---|---|---| | 顶部概览 | 规则面板 | 草稿态 |

规则语法

| 规则 | 含义 | |---|---| | pwsh | 该工具的全部调用 | | pwsh(npm run) | 首参以 npm run 开头 | | write(*.pem) | 文件路径以 .pem 结尾 | | write(*secret*) | 文件路径包含 secret | | write(.ssh) | 路径任意位置出现 .ssh 片段 | | pwsh(*) | 全部调用(显式写法) |

非文件工具按首参原文做前缀匹配;grep 额外匹配其 path 参数。

安装

方式 A —— 官方安装器(推荐):

dsh plugin add dsh-permissions

方式 B —— 手工补丁行: 把本仓库 cordis.patch.yml 中的 insert 列表追加到你的 profile 补丁(~/.dsh/cordis.patch.yml~/.dsh/profiles/<profile>/cordis.patch.yml),并确保包已安装到 profile 可解析的位置(~/.dsh/node_modules/dsh-permissions):

- insert:
    - id: permissions
      name: dsh-permissions

然后重启应用。设置 → 权限 页自动出现;引擎自带安全默认值(16 条 hard 规则保护 .ssh / .aws / .gnupg / AppData / *.pem / *.key / *.env / *.htpasswd,以及 deny: pwsh(rm -rf *))。

权限设置页

  • 引擎开关、三张一键预设卡、点选式规则构建器(动作 × 工具 × 匹配方式 × 参数 → 实时预览)、四个彩色规则面板。
  • 所有修改先进入草稿:点「保存并应用」前不影响 AI 行为;「放弃修改」恢复上次保存状态。

安全说明

  • 引擎只会收窄会话现有的沙箱/审批姿态:allow 只跳过本插件的询问,绝不绕过 DSH 沙箱或 tools.guard 守卫。
  • 拦截以工具错误呈现给模型(Error: 权限规则拒绝…;hard 为 硬规则拒绝(高于 full access,不可豁免)…),模型可见完整规则原文,可据此改道。
  • 设置页路由(GET/POST /api/dperm/rules)是命名空间所有者自建的端点——DSH api-proxy 的 settings 白名单刻意不暴露第三方命名空间。

开发与发布

PUBLISH.md:发布清单与本插件踩过的坑(客户端包 exports 必须含 ./package.json;bundle 模块 id 必须等于包名;useSyncExternalStore 不能传未绑定方法引用等)。

License

MIT