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

@impz/client

v6.12.0

Published

Typed client for impd, the imp host daemon: imps, checkpoints, images and exec

Readme

@impz/client

A typed client for impd, the imp host daemon. It runs in Bun, in binaries that bun build --compile makes, in Node 22.6 or later, and in browsers with Promise.withResolvers: Chrome 119, Firefox 121 and Safari 17.4 or later. CI checks each release under Node, Bun and a compiled Bun binary.

npm install @impz/client

@opentelemetry/api is an optional peer: oRPC's type declarations name it, so a project that type-checks its dependencies (no skipLibCheck) installs it too.

Connect

import { createImpClient } from '@impz/client';

const imp = createImpClient({
  url: 'http://localhost:7070',
  token: process.env.IMP_TOKEN,
});
  • url is impd's API. A path prefix is kept, so impd can sit behind a proxy at /impd/.
  • token is the bearer token from <IMP_DATA_DIR>/token. It controls every imp on the host, so keep it on a server. A browser app sends its requests through a proxy that adds the token, and leaves token out.
  • fetch swaps the transport, for example to call an in-process app in tests.

Imps, checkpoints and forks

Every procedure of impd's API is on the client, with its input and output types.

const dev = await imp.imps.create({ name: 'dev', memoryMib: 2048 });

const checkpoint = await imp.checkpoints.create({ name: 'dev', label: 'clean' });

// a new imp from the checkpoint's disk
await imp.imps.fork({ source: 'dev', name: 'dev-2', checkpoint: checkpoint.id });

await imp.imps.sleep({ name: 'dev' });

imp.requireAwake(name) makes one wake call. It wakes a sleeping imp, boots a stopped one and returns a running one as it is. impd refuses an imp in the error state with INVALID_STATE, because a wake would restart it; pass { restartError: true } to restart it anyway. While impd stops, calls fail with SERVICE_UNAVAILABLE, and while it restarts, fetch cannot connect; pass { retryUnavailable: { attempts, delayMs } } to wait for it to come back. RAM_BUDGET_EXCEEDED is never retried.

watchEvents(imp, { onEvent }) follows events.stream: every imp first, then each change. name keeps one imp's events, and reconnect: { delayMs } opens a fresh stream whenever one ends, until impd refuses the call or signal aborts. A reconnect resumes after the last event the watch read, across impd restarts, so onEvent misses nothing. On a resumed stream, the watch also reads impd's Position events, which move its cursor past the events of imps the token may not see, and passes none of them on. It passes over an event kind it does not know, which a newer impd may send. When impd no longer holds the events since then, onEvent gets Reset and then every imp again. onOpen runs as each stream opens, with the cursor it opens at: a stream with no after starts with every imp, and the caller may have missed what changed while it was away.

openForwardTunnel relays one connection to a port in the imp over /tunnel, and openReverseForward listens in the imp and relays each client back. openToolExec runs an agent tool such as tar over /exec with acked stdin and stdout. Each takes a connect that opens the WebSocket, and resolveImpdWebSocketUrl gives the URL for an impd endpoint.

Run commands

imp.run runs a command to its exit and collects its output. Without stdin, stdin closes at once.

const result = await imp.run('dev', ['sh', '-c', 'uname -a; cat'], { stdin: 'hi\n' });

console.log(result.code, new TextDecoder().decode(result.stdout));

imp.openExec streams the output instead, imp.openConsole opens a login shell with a tty, and a named session outlives the socket, so a client can attach to it again and resume where it stopped.

Errors, features and versions

A failed call throws an ORPCError with impd's code and typed data; safe and isDefinedError narrow it. A call to a procedure that an older impd lacks throws an UnknownProcedureError instead. An older impd drops an input field it does not know, so requireFeatures checks the features a call needs first. imp.checkServer() tells whether impd speaks this client's API.

Documentation

The client guide covers streaming, consoles, sessions and resume, every error code, the features table and the version check.