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

@jeik/reply-interceptor

v1.0.3

Published

维护模式 / 宕机开关:在配置文件里打开开关后,网关**不再调用上游 LLM**,直接向渠道推送自定义文案(如「服务宕机,请稍后再试」)。

Readme

reply-interceptor

维护模式 / 宕机开关:在配置文件里打开开关后,网关不再调用上游 LLM,直接向渠道推送自定义文案(如「服务宕机,请稍后再试」)。

| 开关 | 行为 | |---|---| | enabled: false | 不决策(非终态),其它插件与上游照常 | | enabled: true | 终态 handled: true,合成回复推渠道;后续 before_agent_reply 插件不再执行,且跳过 LLM |

钩子优先级 1000(维护/熔断档),保证先于默认业务插件被问到。

配置支持 mtime 热重载:改 enabled / message 后下一轮消息生效,无需重启网关。


安装

方式一:npx 安装向导(推荐)

一条命令完成:装插件 + 自动开钩子权限 + 自动创建配置(无交互):

npx -y @jeik/reply-interceptor install

本地未发布时(WSL):

cd /mnt/e/my/openclaw-plugins/reply-interceptor
npm run build
node bin/cli.js install

或先 npm pack 再:

# 在包根目录执行 install(向导用本目录当插件源)
node bin/cli.js install

向导会自动:

  1. openclaw plugins install <本包> --force
  2. plugins.entries.reply-interceptor.hooks.allowConversationAccess = true
  3. 生成 ~/.openclaw/reply-interceptor/config.yaml(已存在不覆盖)

然后重启一次网关:

openclaw gateway restart

方式二:只装插件(自己配权限)

openclaw plugins install @jeik/reply-interceptor --force
# 或 tgz:
# openclaw plugins install /mnt/e/my/openclaw-plugins/reply-interceptor/jeik-reply-interceptor-1.0.0.tgz --force
openclaw config set plugins.entries.reply-interceptor.hooks.allowConversationAccess true --strict-json

必须的配置(向导已自动写入)

before_agent_reply 是对话敏感钩子,非内置插件必须放行。
用 npx … install / node bin/cli.js install 时会自动设置,一般不必再手敲。

手动补:

openclaw config set plugins.entries.reply-interceptor.hooks.allowConversationAccess true --strict-json

配置文件 ~/.openclaw/reply-interceptor/config.yaml

安装向导会自动创建。仓库内示例源文件:examples/config.yaml。

# 总开关:true = 维护/宕机模式
enabled: false

# 推送到渠道的固定文案
message: "服务宕机,请稍后再试"

# 是否也拦截心跳(默认 false)
interceptHeartbeat: false

# 口令开关(渠道发送「全文精确匹配」的消息即可;会写回 enabled)
switchOn: "服务宕机请关闭"      # 发这条 → enabled: true
switchOff: "服务恢复请回复"    # 发这条 → enabled: false

| 字段 | 默认 | 说明 | |---|---|---| | enabled | false | true 时终态拦截 | | message | 服务宕机,请稍后再试 | 渠道可见文案 | | interceptHeartbeat | false | true 时心跳回合也拦截 | | switchOn | 服务宕机请关闭 | 开启维护的口令;"" 禁用 | | switchOff | 服务恢复请回复 | 关闭维护的口令;"" 禁用 |

口令开关(渠道命令)

在钉钉等渠道单独发一条与配置完全相同的消息(不要多字空格):

| 你发送 | 效果 | |---|---| | 服务宕机请关闭(或你配置的 switchOn) | 写入 enabled: true,并回复「已开启维护模式…」 | | 服务恢复请回复(或你配置的 switchOff) | 写入 enabled: false,并回复「已关闭维护模式…」 |

  • 口令优先于维护拦截:已经宕机时仍可用 switchOff 恢复。
  • 匹配规则:trim 后全文精确相等(不是包含)。
  • ⚠️ 任何能给 bot 发消息的人都能开关;请改成私密口令,或把 switchOn/switchOff 设为 "" 禁用。

热重载

改 YAML 或通过口令写回后,下一轮用户消息即生效,无需 gateway restart。
解析失败时保留上一份有效配置。
装插件 / 改 hook 权限后仍需重启一次。

启用维护模式示例

方式 A:改配置

enabled: true
message: "服务升级中,预计 10 分钟后恢复,请稍后再试"

方式 B:渠道发口令 switchOn 对应句子。

恢复:enabled: false 或发 switchOff 口令。


工作原理

用户消息
  → before_agent_reply(本插件 priority=1000,最先)
      · 命中 switchOn/Off → 写回 config.enabled → 终态确认回复
      · enabled=false → return(非终态)→ 其它插件 → LLM
      · enabled=true  → { handled: true, reply: { text: message } }
                        → 后续 claim 插件停止 → 不调 LLM → 渠道收到固定文案

与 prompt-rewriter 等业务插件共存时:维护模式打开会短路整条回复链;关闭则完全透明。


开发

npm install
npm run build      # esbuild → dist/index.js
npm pack

源码: