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

@remotehost/sdk

v2.0.0

Published

Official TypeScript SDK for RemoteHost

Readme

RemoteHost TypeScript SDK

The official server-side TypeScript SDK for the RemoteHost API, licensed under Apache-2.0.

Source, issues, and contributions: remotehostai/sdk.

The low-level request and response types in src/generated are generated from the published public spec, contracts/openapi/dist/remotehost.json: the TS API's contracts/openapi/base/openapi.json plus the contracts/openapi documents listed in contracts/openapi/published.yaml. The public resource API is maintained by hand in the rest of src.

Install

npm install @remotehost/sdk

Usage

import RemoteHost from "@remotehost/sdk";

const remotehost = new RemoteHost({
  apiKey: process.env.REMOTEHOST_API_KEY,
  orgId: "org_123",
});

const sandbox = await remotehost.sandboxes.create({
  projectId: "project_123",
  agent: "codex",
});

console.log(sandbox.id, sandbox.status);
const result = await sandbox.commands.run("pnpm test");
const source = await sandbox.files.readText("src/index.ts");
const preview = await sandbox.previews.create({ port: 3000 });
await sandbox.sleep();

apiKey defaults to REMOTEHOST_API_KEY in server environments. Browser use is rejected by default to prevent accidentally exposing a secret key. Sandbox creation waits until the sandbox is running and the agent inside it answers, so the first command works; pass waitForReady: false to get the provisioning response immediately.

An organization's work is split into workspaces, each internal or external for good; projects live in one. A project's environments are durable work (a disk, checkpoints, a git branch) that a sandbox attaches to, and each boots from one of the project's environment templates:

const workspaces = await remotehost.workspaces.list();

const [template] = await remotehost.environmentTemplates.list({ projectId: "project_123" });
const environment = await remotehost.environments.create({
  projectId: "project_123",
  name: "feature-x",
  environmentTemplateId: template?.id,
});
const { sandbox: attached } = await remotehost.environments.attach(environment.id, {
  projectId: "project_123",
});
await remotehost.environments.detach(environment.id, { projectId: "project_123" });

remotehost.workspaces answers 404 until the workspace API is enabled for the deployment.

A Session is one person's work on one host, and the processes that run in it outlive the call that started them: start one, go away, come back to it.

const session = await remotehost.sessions.create({
  workspaceId: "ws_123",
  host: { kind: "sandbox", id: sandbox.id },
  label: "ship the checkout fix",
});

const dev = await session.processes.start({
  kind: "backend",
  argv: ["pnpm", "dev"],
  cwd: "/code/app",
  ports: [3000],
});

// The API holds the request until the condition is true, so nothing polls.
await dev.wait({ port: 3000 }, { timeoutMs: 120_000 });

for await (const event of dev.attach({ fromOffset: 0 })) {
  if (event.type === "output") process.stdout.write(event.data);
  if (event.type === "exited") break;
}

await dev.send("rs\n");
await dev.kill();

attach is resumed by byte offset: with fromOffset it carries on from exactly that byte, so an agent that comes back reads what it missed and nothing else, and a connection that drops is opened again behind the iterator from the offset it reached. It needs a WebSocket: Node 22 and browsers have one, and on Node 20 pass webSocket. Sessions are a person's own: an API key is refused 403 people_only.

API failures throw RemoteHostAPIError with status, code (for example rate_limited or limit_reached), requestId, and the response body.

For endpoints without a convenience resource, use the fully typed remotehost.raw OpenAPI client. Generated paths, operations, and components types are available from @remotehost/sdk/openapi.

See the SDK guide for commands, files, previews, metrics, lifecycle methods, errors, retries, and cancellation.

Sync client

@remotehost/sdk/sync keeps a local copy of a workspace's backends (issues, the Atlas tracker's issues, teams and states) and syncs it live over sync protocol v1. Writes show at once and settle when the service answers; a refused write disappears and its write() resolves refused. Stores: indexedDbStore() in a browser (one leader tab owns the socket), memoryStore() for scripts, and sqliteStore() from @remotehost/sdk/sync/sqlite on Node 22.13 or later.

import { createSyncClient, issues, type IssuesIssue, type IssuesState } from "@remotehost/sdk/sync";
import { sqliteStore } from "@remotehost/sdk/sync/sqlite";

const sync = createSyncClient({
  url: "wss://sync-staging.remotehost.ai/v1/connect",
  workspace: workspaceId,
  token: async () => ({ token: await mintSyncToken() }), // POST /v1/auth/sync-token
  store: sqliteStore({ path: "./replica.db" }),
  backends: ["issues"],
});
await sync.start(); // resolves once caught up

const rows = sync.records<IssuesIssue>("issues", "issue");
rows.subscribe((change) => console.log(change.kind, change.confirmed));

// A new issue in the first state's team; the service numbers it.
const todo = sync.records<IssuesState>("issues", "state").all()[0];
if (!todo) throw new Error("the workspace has no states yet");
const issue = issues.putIssue({
  identifier: "",
  number: 0,
  title: "Ship the launch",
  state_id: todo.id,
  team_id: todo.team_id,
});
const [outcome] = await sync.write(issue);
console.log(outcome?.status, await sync.pending());
await sync.stop();

Development

The public repository is a standalone source mirror maintained from RemoteHost's monorepo. Clone it to inspect the implementation, run tests, or contribute a fix:

git clone https://github.com/remotehostai/sdk.git
cd sdk
npm ci
npm test
npm run typecheck
npm run build

The generated API types are checked in, so building does not require access to the API server or the monorepo. Do not edit src/generated/schema.ts by hand; report contract changes in an issue so they can be regenerated upstream.

Public pull requests are welcome. Maintainers integrate changes into the monorepo and synchronize them back here. Published versions have matching v<version> tags and GitHub releases; main may contain an unpublished snapshot. See CONTRIBUTING.md.

For development inside the monorepo:

pnpm --filter @remotehost/sdk generate
pnpm --filter @remotehost/sdk test
pnpm --filter @remotehost/sdk build

License

Apache License, Version 2.0, from the version after 1.0.0; NOTICE holds the copyright line. 1.0.0, already published, remains under MIT. Dependencies retain their own licenses; see THIRD-PARTY-NOTICES.md.