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

@eco-dsh/eco-permission-gate

v0.3.0

Published

dsh plugin: L1-L4 risk permission gate (port of eco-agent permissions.py)

Readme

eco-permission-gate

dsh plugin — L1-L4 风险权限闸门。

移植自 xiejianjun000/eco-agentagent_core/permissions.py(MIT License),能力对齐原版五级风险分级思路(L1-L4 + 默认 L3)。

作用

在 dsh 的工具调用前拦截(tools/pre-execute 钩子),按工具名/命令前缀解析风险等级,自动放行安全操作、对高危操作要求用户确认或直接拒绝:

| 级别 | 含义 | 默认行为 | |------|------|----------| | L1 | READ(只读查询) | 自动放行 | | L2 | WRITE_LOCAL(本地安全区写入) | 自动放行 | | L3 | EXEC(命令/代码执行) | 白名单自动放行,其余按 mode(auto/ask/deny) | | L4 | EXTERNAL(外部服务写入) | 默认 ask,可配 deny |

等级解析顺序:PERMISSION.md / 配置覆盖 > 前缀映射 > 默认 L3mcp__{server}__{tool} 远程工具一律保守解析为 L3。

v0.2.0 — 策略热更新 + 三插件联动

  • 新增 eco_policy_reload 工具:运行时重新解析 PERMISSION.md 与配置 overrides,无需重启插件;同时提供 ctx.ecoPolicy.reload() 服务。
  • 新增 recordDeniedToMemory 配置:开启后每次拒绝事件自动写入记忆树([SECURITY] 前缀 + security/denied/tool 标签),配合 eco-memory-tree 形成安全事件记忆。
  • 联动采用 ctx.get() 读取可选服务,未加载审计链 / 记忆树时静默降级,不影响权限闸门独立使用。

v0.3.0 — 声明式通配符规则引擎

  • 新增 rules 配置:有序的 allow / ask / deny 规则,支持工具名 glob(tools: ["mcp__*", "shell_*"])、参数 glob(params: { command: "rm -rf*" })、路径 glob(paths: ["/workspace/tmp/*"]),first-match-wins,先于 L1-L4 分级执行。
  • 生态对齐:遵循 dsh 生态(dsh-permission-rules / dsh-permissions / dsh-gov)惯例——拒绝规则写在前面、放行规则写在最后。
  • eco_policy_reload 返回体新增 rules 字段(当前生效规则数),热更新无需重启。

安装

npm install @eco-dsh/eco-permission-gate
import * as ecoPermissionGate from '@eco-dsh/eco-permission-gate'

app.plugin(ecoPermissionGate, {
  mode: 'ask',        // L3 非白名单:auto 放行 / ask 确认 / deny 拒绝
  l4Mode: 'ask',      // L4:ask / deny
  nonInteractive: false,
  riskOverrides: { web_search: 'L1' },
  l3Whitelist: ['python _scripts/lint.py'],
  policyFile: '',     // 可选 PERMISSION.md 路径
})

与 eco-audit-chain 联动

被拒绝的调用会通过 ctx.ecoAudit.recordDenied() 写入审计链(需同时加载 eco-audit-chain),拒绝事件可追溯。

配置项

| 字段 | 默认 | 说明 | |------|------|------| | mode | ask | L3 非白名单处理 | | l4Mode | ask | L4 处理 | | nonInteractive | false | 非交互模式下 ask 降级为 deny | | riskOverrides | {} | 工具级覆盖,如 { "web_search": "L1" } | | l3Whitelist | [] | 追加 L3 命令前缀白名单 | | policyFile | '' | PERMISSION.md 路径(tool_risk_overrides 块会被解析) |

许可

MIT。原始实现版权归 xiejianjun000/eco-agent 所有,本包为 dsh 生态移植版。