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

@charclaw/agents

v0.2.1

Published

CharClaw Agents SDK — run AI coding agents (Claude, Codex, Gemini, Goose, OpenCode, Pi) inside Daytona sandboxes or on the local machine.

Readme

@charclaw/agents

npm version npm downloads License: AGPL v3 Node ≥ 18

The agents SDK that powers CharClaw. A TypeScript library for running AI coding agents — Claude, Codex, Gemini, Goose, OpenCode, Pi — inside Daytona cloud sandboxes or directly on the host machine.

Copyright © 2026 Anit Chaudhary · Licensed under AGPL-3.0-or-later.

Live on npm: @charclaw/[email protected]

Why

Coding agent CLIs (Claude Code, Codex, Gemini, …) are designed to run interactively. To wire them into a long-running web service or scheduled job, you need:

  • Background execution that survives your serverless function timeout
  • Polling-based event streaming instead of stdin/stdout pipes
  • Sandbox isolation so agent activity can't reach your production secrets
  • Re-attachment to ongoing turns after a process restart

@charclaw/agents gives you one TypeScript API across all of these agents and runs them in whichever sandbox you already use.

Install

npm install @charclaw/agents @daytonaio/sdk

Quick start (Daytona sandbox)

import { Daytona } from "@daytonaio/sdk"
import { adaptDaytonaSandbox, createSession } from "@charclaw/agents"

const daytona = new Daytona({ apiKey: process.env.DAYTONA_API_KEY! })
const raw = await daytona.create()
const sandbox = adaptDaytonaSandbox(raw)

const session = await createSession("claude", {
  sandbox,
  env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
  model: "sonnet",
  systemPrompt: "You are a careful, focused engineer.",
})

await session.start("Add input validation to the /signup route.")

while (true) {
  const { events, running } = await session.getEvents()
  for (const e of events) {
    if (e.type === "token") process.stdout.write(e.text)
    if (e.type === "tool_start") console.log(`\n[tool] ${e.name}`)
  }
  if (!running) break
  await new Promise(r => setTimeout(r, 1000))
}

await raw.delete()

Quick start (local sandbox)

import { createLocalSandbox, createSession, localWorkdir } from "@charclaw/agents"

const sandbox = createLocalSandbox({ cwd: localWorkdir() })
const session = await createSession("claude", {
  sandbox,
  env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
})
await session.start("Summarize the diff on this branch.")

Restart-tolerant turns

Persist session.id and reattach later:

import { adaptDaytonaSandbox, getSession } from "@charclaw/agents"

const sandbox = adaptDaytonaSandbox(await daytona.get(savedSandboxId))
const session = await getSession(savedSessionId, { sandbox })
const { events, running } = await session.getEvents()

The session writes its metadata and parser state to ~/.charclaw-sessions/<id>/ inside the sandbox, so a second process can pick up exactly where the first left off.

Supported agents

| Agent | CLI | Auth | Status | |---|---|---|---| | "claude" | Claude Code | ANTHROPIC_API_KEY or CLAUDE_CODE_CREDENTIALS | ✅ Stable parser | | "codex" | OpenAI Codex CLI | OPENAI_API_KEY | ⚠️ Tolerant parser, validate against your CLI version | | "gemini" | Google Gemini CLI | GEMINI_API_KEY | ⚠️ Tolerant parser | | "goose" | Block Goose | provider-specific | ⚠️ Tolerant parser | | "opencode" | OpenCode | provider-specific | ⚠️ Tolerant parser | | "pi" | Pi | provider-specific | ⚠️ Tolerant parser | | "mock" | (built-in) | none | ✅ Echo-only, useful for tests |

The parsers for Codex, Gemini, Goose, OpenCode, and Pi accept a tolerant superset of common JSON event shapes. End-to-end test against the version of the CLI you actually deploy and tighten if needed.

Event types

type Event =
  | { type: "session"; id: string }
  | { type: "token"; text: string }
  | { type: "tool_start"; name: string; id?: string; input?: unknown }
  | { type: "tool_delta"; id?: string; text: string }
  | { type: "tool_end"; name?: string; id?: string; output?: string; isError?: boolean }
  | { type: "end"; error?: string }
  | { type: "agent_crashed"; message?: string; output?: string }

How it works

  1. createSession provisions a session directory inside the sandbox and writes session.json (your config) and state.json (parser cursor).
  2. session.start(prompt) issues nohup (Daytona) or spawn(detached: true) (local) to launch the agent CLI, writing stdout to a turn-specific log file.
  3. session.getEvents() reads the log file's new bytes, runs the agent's JSON-Lines parser, and returns events plus a running flag.
  4. A .done sentinel file plus a process-liveness probe distinguish a clean finish from a crash.
  5. State is persisted between calls so a second process can getSession() and continue.

Debugging

CHARCLAW_AGENTS_DEBUG=1 node my-script.js

License

GNU AGPL v3 or later. See LICENSE for the full text.

This is strong copyleft — if you run a modified version of @charclaw/agents as a network service, you must offer the source code of your modifications to the users of that service. If that doesn't fit your use case, contact the author for commercial licensing.