Skip to main content

Installation

Runnable Smoke Tests

The repository includes end-to-end scenario scripts under tests/smoke/ in both JavaScript and TypeScript. These also serve as readable usage documentation.
For the guarded apply demos, set NONO_APPLY=1.
The scripts in tests/smoke/ are the canonical source for end-to-end behavior. This page keeps shorter teaching snippets and links back to those files.

Basic Usage

1. Check Platform Support

Before applying a sandbox, verify that the current platform supports it:

2. Define Capabilities

Create a CapabilitySet and add the permissions your application needs:

3. Apply the Sandbox

Calling apply() is irreversible. Once applied, the sandbox cannot be weakened or removed for the lifetime of the process.

End-to-End Patterns

For complete runnable flows, use these scenarios directly from tests/smoke/:
  • 02-build-capabilities for capability construction patterns
  • 03-query-policy for preflight allow/deny checks with QueryContext
  • 04-state-roundtrip for SandboxState serialization and restoration
  • 05-safe-apply-pattern for a guarded irreversible apply() flow
  • 06-10 for wrapper, agent workspace, diagnostics, config roundtrip, and subprocess patterns
  • npm run demo / npm run demo:attack-test for the end-to-end demonstrator

Next Steps

CapabilitySet

Learn all the ways to define capabilities

QueryContext

Test permissions before applying the sandbox

SandboxState

Serialize state for child processes

Functions

Module-level functions reference