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

@shivamhwp/t3code-sdk

v0.1.0

Published

Unofficial TypeScript SDK for the T3 Code backend

Readme

t3code-sdk

DO NOT USE IT. THIS IS JUST ME JUST DOING EXPERIMENTATION. THIS IS ALSO NOT AFFILIATED TO THE T3CODE.

Unofficial, Node-first TypeScript SDK for controlling a T3 Code backend.

Early experimental development. The API is not stable yet.

Why

T3 Code already provides a strong backend for agent sessions, projects, worktrees, approvals, terminals, Git, and multiple providers. This SDK makes that backend usable from bots, CI, automations, and custom applications without importing T3 Code's UI runtime.

Current status

Implemented:

  • environment discovery

  • one-time bootstrap token exchange and bearer authentication

  • access-token suppliers, refresh hooks, and single retry on 401/403

  • project and thread snapshots

  • project and thread creation and deletion

  • turns, interrupts, and approval responses

  • a high-level threads.run() that correlates a turn to its outcome and interrupts on abort

  • caller-supplied deterministic command, project, thread, and message ids

  • image attachments as native model input

  • typed Effect RPC transport over WebSocket

  • shell and thread subscriptions that reconnect, resume from the last seen sequence, and drop replayed items

  • threads.stream(): the same run as a normalized AsyncGenerator of events (dispatched, working, title, text deltas, activity, completed)

  • threads.wait(): re-attach to an in-flight turn after a restart using its threadId, messageId, and createdAt

  • proactive token refresh ahead of expires_in, plus retry on 401/403

  • session(), live capabilities(), and a WebSocket health() probe

  • raw HTTP and orchestration command escape hatches

  • exact, integrity-checked upstream contract pinning

  • live compatibility CI: scripts/live-smoke.mjs runs against released t3 versions in the compat workflow matrix

  • a vendored contract snapshot trimmed to the SDK's transitive import closure, with a narrow orchestration-only RPC group

Next:

  • optional managed t3 serve process lifecycle
  • approval and user-input handling inside run()/stream()

Usage

Start a T3 Code backend with t3 serve. It prints a connection string and one-time token.

import { T3Code } from "@shivamhwp/t3code-sdk";

await using t3 = await T3Code.connect({
  baseUrl: "http://localhost:3773",
  bootstrapToken: process.env.T3_BOOTSTRAP_TOKEN!,
  scopes: ["orchestration:read", "orchestration:operate"],
  client: { label: "my automation", deviceType: "bot" },
});

const projects = await t3.projects.list();
const created = await t3.projects.create({
  workspaceRoot: "/path/to/repo",
});

const thread = await t3.threads.create({
  projectId: created.id,
  title: "Fix the login bug",
  modelSelection: { instanceId: "codex", model: "gpt-5.6-sol" },
});

const result = await t3.threads.run(
  { threadId: thread.id, prompt: "Fix the login bug and run the tests." },
  { onWorking: () => console.log("working…"), onTitle: (title) => console.log(title) },
);
console.log(result.response);

for await (const item of t3.subscribeShell()) {
  console.log(item); // reconnects and resumes automatically
}

An existing bearer token from t3 auth session issue --token-only can be supplied as accessToken instead — either a string or an async supplier, with an optional refreshAccessToken hook for rotation.

Upstream pinning

The SDK does not clone, fork, or track T3 Code's moving main branch. upstream/t3code.lock.json records one exact upstream commit, Effect version, source paths, and an aggregate integrity hash.

The pinned packages/contracts snapshot is committed under upstream/contracts and bundled into the SDK. T3 Code's client-runtime is not shipped or imported.

Update intentionally:

bun run sync:upstream <t3code-commit>
bun run check
bun run test
bun run build

Verify the committed snapshot without changing it:

bun run sync:upstream:check

TypeScript consumers

Node 22.16+ and TypeScript 5.2+ are required. Use "lib": ["esnext"] (or add "esnext.disposable") for await using, install @types/node, and keep "skipLibCheck": true — the pinned effect beta's own declarations do not pass a full lib check. Verified against a strict nodenext consumer.

Development

bun install
bun run check
bun run test
bun run build