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

ai-sdk-sandbox-local

v0.1.2

Published

HarnessV1SandboxProvider implementation backed by the local machine.

Readme

AI SDK - Local Sandbox

This package is experimental.

HarnessV1SandboxProvider implementation backed by the local machine.

[!WARNING] This provides no isolation. The agent runs commands and edits files directly on the host, with the host process's permissions. Use it only where the host is itself the trust boundary: your own machine, or a disposable container or VM you control. For real isolation, run against a remote or containerized sandbox provider.

Setup

npm i ai-sdk-sandbox-local @ai-sdk/harness

Usage

The factory is synchronous. The returned provider is stable; a session, rooted at a working directory on the host, is created inside provider.createSession().

import { createLocalSandbox } from 'ai-sdk-sandbox-local';

const localSandbox = createLocalSandbox({ cwd: process.cwd() });

const networkSandboxSession = await localSandbox.createSession();
const sandboxSession = networkSandboxSession.restricted();

await sandboxSession.writeTextFile({ path: 'hello.txt', content: 'hi' });

const { stdout } = await sandboxSession.run({ command: 'cat hello.txt' });
console.log(stdout); // "hi"

await networkSandboxSession.stop();

networkSandboxSession.restricted() is typed as Experimental_SandboxSession, so it is safe to pass to AI SDK tools that accept experimental_sandbox. The network sandbox session itself carries the infra surface (ports, getPortUrl, setPorts, setNetworkPolicy, stop) that only the harness should reach for.

Configuration

The environment is the host's, so the session inherits process.env. There are no credentials to resolve; the two settings shape where and how it runs.

const localSandbox = createLocalSandbox({
  cwd: '/path/to/repo', // working directory; defaults to process.cwd()
  ports: [3000], // pin a bridge port; by default one is leased
});
  • cwd the working directory the session is rooted at. Relative paths in file operations resolve against it. Defaults to process.cwd().
  • ports ports to pre-expose. The harness leases a bridge port via setPorts, and on localhost exposing is a no-op, so this is usually unnecessary. Set one to pin a fixed bridge port.

Per-command environment and working directory are set on each call, not on the provider:

await sandboxSession.run({
  command: 'echo $GREETING',
  env: { GREETING: 'hi' },
  workingDirectory: 'packages/app',
});

Resuming

The host persists, so resumeSession({ sessionId }) rebinds to the same cwd for a given session id without recreating anything.

Ports and network policy

getPortUrl resolves to http://127.0.0.1:<port> and throws HarnessCapabilityUnsupportedError for a port that was never exposed. There is no network boundary to enforce, so setNetworkPolicy is a no-op. For real egress control, run against an isolating provider.

License

Apache-2.0