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

@infinisys/is-stream-guard

v0.1.0

Published

Infinity System stream guard: retry a step when one corrupt server-sent event frame breaks the model response stream.

Readme

@infinisys/is-stream-guard

Infinity System 的流损坏自愈插件:一条读不出来的流帧,不该让整个回合作废。

它做什么

模型请求可以前半段一切正常,到中途坏一帧——HTTP 200、text/event-stream 照旧,但某一帧的 data: 不是合法 JSON。Harness 用的 OpenAI 客户端遇到这种帧直接抛:

Error reading response: malformed server-sent event JSON.

这句话既没有状态码,也不是超时或连接关闭,落不进任何一条错误分类,最后成为一个不带重试资格的通用失败码。于是 Harness 不重试,回合直接失败——尽管下一次同样的请求大概率能读完。

本插件只接管这一种失败:在 Harness 已经提供的 agent/request-error 重试接缝上回答“这一步再来一次”。其它任何失败都原样交还,不做判断。

为什么是重试,而不是修解析

坏帧来自一次真实的传输/上游抖动,不是解析器的 bug:同一条链路上连续两次 1900+ 帧的探测都是干净的 SSE,而现场出现的错误文案就出自 openai/core/streaming.js 的 JSON.parse。

重试是一次完整的重新采样,因此中途已经流出的半段回答不会被拼接:Harness 会丢弃这次尝试,用同样的消息重新请求这一步。没有执行过的工具调用本来就不会执行,排队消息也保持不动。

预算

  • 默认每一步最多再试 2 次(maxRetries,上限 5,0 表示关闭);
  • 等待 800ms 起,逐次翻倍,封顶 5 秒(delayMs 是首次等待,同样有上限);
  • 预算按「会话:回合:步骤」记账,新步骤重新计;超过 30 分钟没再用的记录会被清掉,长回合不会无限攒内存。

真实的故障(上游持续 5xx、Key 失效)不会因此变成死循环:预算用尽就交回 Harness,回合照旧失败,日志里留一条 is-stream-guard: … used its retries。

关掉它

bundle 行支持 config.enabled: false,或在 cordis.patch.yml 里把这一行的 config 写成 { "maxRetries": 0 };两者都不会注册监听器。