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

@ai0x0/codex-ts

v0.5.5

Published

A TypeScript port of the codex-rs agent core — runs the Codex sampling loop (Responses API streaming + tool calls + auto-compaction) directly in Node or the browser, with no spawned process.

Readme

@ai0x0/codex-ts

A TypeScript port of the codex-rs agent core — runs the Codex sampling loop (Responses API streaming + tool calls + auto-compaction) directly in Node or the browser, with no spawned process.

import { CodexThread } from "@ai0x0/codex-ts";

const thread = new CodexThread({
  apiKey: "…",
  baseUrl: "https://api.openai.com/v1",
  model: "gpt-5.4",
});

const turnId = await thread.submit({
  type: "UserInput",
  items: [{ type: "text", text: "hello" }],
});

for (;;) {
  const { msg } = await thread.nextEvent();
  if (msg.type === "AgentMessage") console.log(msg.event.message);
  if (msg.type === "TurnComplete") break;
}

Retries

Transient Responses failures are retried automatically with exponential backoff — mirrors codex-rs's stream retry loop (responses_retry.rs).

A failure is retried when it happens before any visible output has streamed and is transient:

  • a network error (fetch rejects: connection reset, DNS, CORS-masked failure…);
  • an HTTP 408, 409, 429, or any 5xx (e.g. a 502 during a deploy window);
  • the SSE stream dropping before the first text delta.

A failure is not retried when:

  • visible output has already streamed (a re-stream would duplicate text);
  • the error is terminal — 4xx other than the above (e.g. 400, 401), or the turn was interrupted (AbortError);
  • the retry budget (maxRetries) is exhausted.

Each retry waits an exponential backoff — 200ms × 2^(n-1) with ±10% jitter — honoring a server Retry-After header when present. A Warning event (Reconnecting... n/m) is emitted before each attempt so the UI can surface it.

Configuration

const thread = new CodexThread({
  apiKey: "…",
  model: "gpt-5.4",
  // Max retries for transient request/stream failures. Default: 5.
  // Pass 0 to disable retries entirely.
  maxRetries: 5,
});

| Option | Default | Meaning | | ------------ | ------- | ---------------------------------------------------------- | | maxRetries | 5 | Max retry attempts after the initial request. 0 disables. |

The same budget covers both the initial request and a stream that drops before any output; Retry-After overrides the computed backoff for that attempt.