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

@agentskillmania/sandbox

v1.1.3

Published

WASM sandbox for busybox and micropython

Readme

@agentskillmania/sandbox

WASM 沙箱,用于在隔离环境中执行 Shell 命令、Python 代码和 Git 操作。单个 ~8MB 二进制文件,通过 wasmtime 运行,不需要 Docker。

为什么不用 Docker

| | Docker | @agentskillmania/sandbox | |---|---|---| | 体积 | ~1GB 镜像 | ~8MB wasm | | 启动时间 | ~100ms+ 容器创建 | ~55ms 每条命令 | | 需要守护进程 | 是 | 否 | | 文件系统隔离 | 容器 fs | wasmtime --dir 映射 |

体积小 ~18 倍,速度快 ~2 倍,零守护进程开销。

功能

  • Shell: busybox wsh — ls、cat、grep、sed、awk、find、wc、sort、head、tail、管道、变量、if/for、&&/||、命令替换
  • Git: libgit2 1.9.2 — clone、log、status、diff、commit 等
  • Python: MicroPython 1.27,内置 30+ 标准库模块(见下方列表)
  • 网络: TCP/UDP 套接字、DNS、TLS(mbedTLS)、HTTP(requests 库)
  • 文件系统隔离: 仅可见 /workspace/tmp,其余全部阻断

安装

npm install @agentskillmania/sandbox

wasmtime v43 会在首次使用时自动安装到 ~/.agentskillmania/sandbox/wasmtime/。如果自动安装失败:

npx exec-in-sandbox install-runtime

命令行使用

# Shell
exec-in-sandbox -- "ls -la"
exec-in-sandbox -- "cat file.txt | grep hello"

# Python
exec-in-sandbox -- "python -c 'print(42)'"
exec-in-sandbox -- "python script.py"

# Git
exec-in-sandbox -- "git log --oneline"

-- 分隔符是必需的:选项在前,命令在后。

| 选项 | 默认值 | 说明 | |------|--------|------| | --timeout <ms> | 5000 | 执行超时时间 | | --sandbox-dir <dir> | 自动临时目录 | 映射到 /workspace 的宿主目录 | | --allow-network | 关闭 | 启用网络 | | --command-allowlist <cmds> | - | 逗号分隔的白名单 | | --command-blocklist <cmds> | - | 逗号分隔的黑名单 |

编程使用

import { Sandbox } from '@agentskillmania/sandbox';

const sandbox = new Sandbox({
  sandboxDir: '.sandbox',
  timeout: 10000,
  allowNetwork: false,
  commandPolicy: { mode: 'blacklist', list: ['rm'] },
});

const result = await sandbox.run('python -c "print(42)"');
console.log(result.stdout);   // "42"
console.log(result.exitCode); // 0

返回 { stdout: string, stderr: string, exitCode: number }

Python 模块

内置(C): json, re, hashlib, math, cmath, random, os, sys, io, struct, gc, time, socket, select, errno, binascii, collections (deque, OrderedDict), heapq, array, deflate, uctypes, platform

冻结(嵌入 wasm): datetime, itertools, functools, copy, types, string, base64, contextlib, logging, traceback, unittest, pprint, pickle, stat, operator, hmac, zlib, warnings, abc, bisect, fnmatch, shutil, tempfile, pathlib, gzip, asyncio, ssl, requests, collections.defaultdict

文件系统隔离

  • /workspace → 你的沙箱目录(读写)
  • /tmp → 每次执行独立的临时目录(自动清理)
  • 其余所有路径(/etc/home../)被 wasmtime 阻断

运行要求

  • Node.js >= 16
  • wasmtime v43+(自动安装)

许可证

MIT