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

@whisq/sandbox

v0.1.0-alpha.10

Published

Sandboxed code execution for Whisq — isolated environment with configurable limits

Downloads

940

Readme

@whisq/sandbox

Two isolation primitives for Whisq: a code-execution sandbox that evaluates arbitrary source and returns a value, and a UI-rendering sandbox that mounts AI-generated Whisq source into an isolated iframe on the current page. Both are standards-only (no WASM, no extra runtime) so they compose with any Whisq app.

Install

npm install @whisq/sandbox

createSandbox() — run arbitrary code, return a value

import { createSandbox } from "@whisq/sandbox";

const sandbox = createSandbox({ timeout: 5000 });

const result = await sandbox.execute(`
  const count = 1 + 1;
  return count;
`);

console.log(result); // { success: true, value: 2 }

sandbox.dispose();

Shadows dangerous globals and enforces a timeout. Suitable for evaluating expressions or small scripts where you want the return value rather than a UI. A future revision may back this with QuickJS-WASM for true process-level isolation.

mountSandboxed() — render AI-generated Whisq UI into an iframe

Mount an AI-generated Whisq fragment into a sandboxed iframe on the current page. Uses <iframe sandbox="allow-scripts" srcdoc="…"> with a strict CSP — the frame runs in a unique origin, can't access the parent's DOM, and only fetches scripts from origins listed in your import map.

import { mountSandboxed } from "@whisq/sandbox";

const handle = mountSandboxed({
  source: `
    import { div, signal } from "@whisq/core";
    const n = signal(0);
    setInterval(() => (n.value += 1), 1000);
    document.body.append(div(() => String(n.value)).el);
    window.__whisqPost({ type: "ready" });
  `,
  container: document.getElementById("agent-output")!,
  importMap: { "@whisq/core": "https://esm.sh/@whisq/core@latest" },
  onMessage: (msg) => console.log("from sandbox:", msg),
});

// Send a message the other way:
handle.postMessage({ type: "shutdown" });

// Tear down when done:
handle.dispose();

How isolation works

  • sandbox="allow-scripts" — unique origin; no forms, popups, top-navigation, or same-origin access. Widen via sandboxAttrs only when the agent UI legitimately needs one of those capabilities.
  • CSP meta injected into the iframe's srcdoc. The default policy is default-src 'none' with script-src allowing inline + every origin from your importMap. Override with cspDirectives.
  • srcdoc, not src= — the iframe starts as a blank document that we write. No network navigation.
  • postMessage bridge is __whisq-tagged so other frames on the page can't spoof messages into your onMessage callback; parent messages arrive as a whisq:parent CustomEvent on the iframe-side window.

When to use which

| You want to… | Reach for | |---|---| | Evaluate a bit of JS, get a return value | createSandbox().execute(code) | | Mount AI-generated UI that shouldn't see your host DOM | mountSandboxed({ source, container }) |

Documentation

Full documentation at whisq.dev.

License

MIT