batteries/sandbox/node
Remarks
This subpath is deliberately NOT re-exported from @nhtio/adk/batteries/sandbox. srt_enforcer imports node:child_process and fs_node imports node:fs/node:path, so folding this barrel into the main one would break the browser build and the portability suite. (search_ripgrep has no node:* import of its own — it spawns THROUGH the enforcer — but it belongs here because it is meaningless without one.) Reach for it explicitly:
import { srtEnforcer } from "@nhtio/adk/batteries/sandbox/node";The OS boundary lives here and nowhere else. srtEnforcer is the ONLY place the ADK-to-SRT policy mapping exists — if a second translation appears anywhere, the "ADK-owned types" firewall is nominal and no non-SRT enforcer can implement the contract. fs_node is the in-process evaluator used by the tools that run OUR code (open_file*, stage_file, save_media, list_directory); it reproduces SRT's derived rules AND its profile-injected mandatory denies, because a gap there lets save_media write paths the shell tool is refused. Only the shell and search paths get real OS enforcement — SRT restricts spawned children, not this process.
Attribution: the sandbox is Anthropic's @anthropic-ai/sandbox-runtime (Apache-2.0), consumed as an optional peer.
Type Aliases
| Type Alias | Description |
|---|---|
| FsNode | The in-process policy decision procedure. |
| RipgrepFailure | A classified ripgrep outcome. |
| SrtEnforcerOptions | Construction options for srtEnforcer. |
Variables
| Variable | Description |
|---|---|
| DANGEROUS_DIRECTORIES | Directories SRT mandatory-denies, reproduced from upstream. |
| DANGEROUS_FILES | The exact upstream dangerous file names, retained for parity tests. |
Functions
| Function | Description |
|---|---|
| createFsNode | In-process counterpart of SRT's two derived restriction lists. |
| createRipgrepSearch | Ripgrep backend. Both child pipes are drained immediately and concurrently. |
| derivedRulesFromSrt | Construct a derived snapshot from the shapes returned by SRT. |
| loadGlobToRegex | Load upstream's own glob matcher. |
| mapPolicy | The sole ADK-to-SRT translation point. Keep the upstream type behind this local firewall. |
| primeGlobMatcher | Compile every glob-bearing rule through upstream's own globToRegex. |
| reproduceMandatoryDeny | Reproduce SRT's profile-injected mandatory-deny set for the CURRENT platform. |
| srtEnforcer | Construct the SRT-backed policy enforcer — the OS boundary. |