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

@max10240/opencode-plugin-infinite-loop

v1.0.39

Published

Keep a session working: nudge it whenever it idles, until a configured time window ends

Readme

opencode-plugin-infinite-loop

让会话持续工作。为你激活它的会话在空闲时等待一个短暂的安静窗口,然后发送一条 nudge 消息,让 agent 持续推进,直到配置的时间窗结束。冷却按“上一次成功 nudge”计算,而不是按 “这次检查”计算。

工作方式

  • 通过 TUI 按会话激活,不影响其他对话。
  • 每次空闲边界先检查实时后台任务:后台 Bash、子 Agent、图像/视频任务。运行期间不发送 nudge。
  • 实时目录由事件维护:会话树、执行状态和 shell 事件增量更新,热路径不扫描会话数据库。
  • 没有后台任务时打开安静窗口(默认 3 秒)。窗口内出现任何新输入——你打字、跨会话消息、 steering——都会取消本次 nudge。
  • 提问不能卡住循环:任务存在期间 question 工具会被拒绝,agent 收到 questionMessage 作为反馈后继续当前 turn。子 Agent 的提问同样会被拦截;停止任务后提问恢复正常。
  • 每次成功 nudge 后进入冷却。下一次尝试时间 = max(现在 + 安静窗口, 上次 nudge + 冷却)。例如上次 nudge 在 3 分钟前、冷却为 5 分钟, 就只再等 2 分钟;到点后重新检查 busy/后台,再决定是否发送。
  • 异常结束不会中断循环:turn 失败或系统级中断(shutdown、superseded、inactivity)会从 执行事件流捕获并重试。
  • 只有你手动打断才暂停循环,并在你下一个正常完成的 turn 后自动恢复。显式停止 (面板 ctrl+d 连按两次、RPC stop、ctrl+shift+d 停止全部)才真正终止任务。
  • 任务只存在于内存:没有历史记录,服务重启后任务消失。
  • 同一个 OpenCode 进程内所有项目共享 runtime,所以“所有项目”面板能看到并停止全部 Loop。

用法

  • /infinite-loop 2h 为当前会话启动 2 小时的时间窗。
  • /infinite-loop 90m cooldown=10m 按本次任务覆盖冷却。
  • /infinite-loop(或 ctrl+shift+i)打开面板:可点击的预设档位(15m、1h、2h、3h、8h、1d)、 自定义时长(90m、1h30m、2d12h,纯数字按小时)、自定义冷却(5m、1h、0, 纯数字按分钟)、实时状态,ctrl+d 连按两次停止。
  • /infinite-loops(或 ctrl+shift+o)打开“所有项目”面板。任意面板内 ctrl+a 可在 “当前会话”和“所有项目”之间切换。
  • 所有项目面板:↑/↓ 选择,ctrl+d 连按两次停止选中 Loop,ctrl+shift+d 停止全部(二次确认), ctrl+r 刷新,f1 帮助,esc 关闭。
  • 可打印字符始终输入到时长和冷却输入框;面板动作统一使用 Ctrl 组合键,不依赖焦点。
  • 边界:默认时间窗 5 分钟到 7 天;冷却 0 到 30 天。超界输入会被拒绝并提示合法范围。
  • f1 打开键位帮助;esc 先关帮助,再关面板。

配置

{
  "infiniteLoop": {
    "message": "Keep working without asking any questions. Do not stop until you have finished everything you need to do.",
    "questionMessage": "Don't ask any questions. Keep doing what you think we need most.",
    "blockQuestions": true,
    "delayMs": 3000,
    "recheckMs": 2000,
    "cooldownMs": 300000,
    "defaultDurationMs": 3600000,
    "minDurationMs": 300000,
    "maxDurationMs": 604800000,
    "presets": ["15m", "1h", "2h", "3h", "8h", "1d"],
    "keybind": "ctrl+shift+i",
    "overviewKeybind": "ctrl+shift+o"
  },
  "features": { "infiniteLoop": false }
}
  • message:每次 nudge 发送的文本。
  • questionMessage:任务存在期间 agent 提问时收到的文本。
  • blockQuestions:任务存在期间拒绝 question 工具(true);设为 false 则允许提问并等待你回答。
  • delayMs:空闲后的安静窗口(100–600000)。
  • recheckMs:复查后台任务的间隔(100–600000)。
  • cooldownMs:两次成功 nudge 之间的最小间隔(0–30 天);0 表示关闭冷却。
  • defaultDurationMs:自定义输入为空时使用的默认时长。
  • minDurationMs / maxDurationMs:自定义时长允许的范围。
  • presets:面板快捷档位;加载时校验,非法项会被拒绝。
  • keybind / overviewKeybind:全局快捷键,设为 false 关闭键位绑定(slash 命令仍可用)。
  • features.infiniteLoop: false(或 enabled: false)在 server 与 TUI 两侧同时关闭本插件。

说明

  • 使用实验性的 experimental.idle 会话 hook,需要 OpenCode 2.3 或更新版本。旧版本上插件 自行禁用。
  • 提问拦截使用 tool 的 execute.before hook;宿主未暴露 tool hook 时仍会继续 nudge, 但无法拦截提问。
  • 如果启动任务时已经有一个待回答的提问,它仍会等待你的回答:hook 只拒绝新的调用。回答或 关闭一次后,任务会继续,不会再次被提问卡住。
  • turn 失败或系统级中断不会触发该 hook,循环通过执行事件流和发送后的复查自愈。
  • 手动打断任务会话或它的任意子 Agent,会暂停整个任务家族。
  • 图像/视频后台任务也视为忙;实时门禁的核心是 Bash 和 Subagent。