Installation
Runnable Examples
Use the repository examples for end-to-end runnable flows:/examples/js/01-support-check.js/examples/js/02-build-capabilities.js/examples/js/03-query-policy.js/examples/js/04-state-roundtrip.js/examples/js/05-safe-apply-pattern.js/examples/ts/01-support-check.ts/examples/ts/02-build-capabilities.ts/examples/ts/03-query-policy.ts/examples/ts/04-state-roundtrip.ts/examples/ts/05-safe-apply-pattern.ts
NONO_APPLY=1.
The runnable files in
examples/ 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 aCapabilitySet and add the permissions your application needs:
3. Apply the Sandbox
End-to-End Patterns
For complete runnable flows, use these scenarios directly fromexamples/:
02-build-capabilitiesfor capability construction patterns03-query-policyfor preflight allow/deny checks withQueryContext04-state-roundtripforSandboxStateserialization and restoration05-safe-apply-patternfor a guarded irreversibleapply()flow06-10for wrapper, agent workspace, diagnostics, config roundtrip, and subprocess patternsnpm run demo/npm run demo:attack-testfor 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