import { Sandbox, SandboxCode, SandboxResult, SandboxRunOptions } from "@graphorin/core/contracts"; //#region src/sandbox/sandbox.d.ts /** * Discriminator for the four built-in sandbox kinds. Custom adapters * may register additional kinds by declaring `(string & {})` literals * in user code. * * @stable */ type SandboxKind = 'none' | 'worker-threads' | 'isolated-vm' | 'docker' | (string & {}); /** * Capability self-description. Each adapter advertises whether it * supports network blocking, filesystem blocking, and process-level * memory limits so the dispatcher can fall back gracefully when a * deployment requests a feature an adapter cannot satisfy. * * @stable */ interface SandboxCapabilities { /** Adapter can block outgoing network calls. */ readonly canBlockNetwork: boolean; /** Adapter can block filesystem access. */ readonly canBlockFilesystem: boolean; /** Adapter can enforce a hard wall-clock timeout via signal/terminate. */ readonly canEnforceTimeout: boolean; /** Adapter can enforce a memory limit (MB) on the executed code. */ readonly canEnforceMemoryLimit: boolean; } /** * Concrete `Sandbox` implementation contract. Extends the core * interface with a discriminator + capability advertisement. * * @stable */ interface SandboxImpl extends Sandbox { /** Discriminator. */ readonly kind: SandboxKind; /** What the adapter can enforce; surfaced through `resolveSandbox(...)`. */ readonly capabilities: SandboxCapabilities; } /** * Per-tool / per-skill sandbox policy. The dispatcher resolves the * effective policy from the trust tier, the source, and any operator * overrides; downstream code consumes the resolved object verbatim. * * @stable */ interface ResolvedSandboxPolicy { readonly kind: SandboxKind; /** Block outbound network calls. */ readonly noNetwork: boolean; /** Block filesystem access. */ readonly noFilesystem: boolean; /** Hard wall-clock timeout in milliseconds. */ readonly timeoutMs: number; /** Memory ceiling in MB. */ readonly maxMemoryMb: number; /** Whether the resolver mandated this policy regardless of operator preference. */ readonly forced: boolean; /** Human-readable explanation surfaced through traces / WARN logs. */ readonly reason: string; } /** * Default per-tier policies, per the canonical sandbox tier table. * Operator overrides are merged into these defaults inside * `resolveSandbox(...)`. * * @stable */ declare const DEFAULT_TIMEOUTS_MS: Readonly>; /** * Default per-tier memory limits (MB). The defaults follow the * canonical sandbox tier table - `worker-threads` 256 MB; mandatory * untrusted-skill tier 128 MB; `isolated-vm` 128 MB. * * @stable */ declare const DEFAULT_MEMORY_LIMITS_MB: Readonly>; //#endregion export { DEFAULT_MEMORY_LIMITS_MB, DEFAULT_TIMEOUTS_MS, ResolvedSandboxPolicy, SandboxCapabilities, type SandboxCode, SandboxImpl, SandboxKind, type SandboxResult, type SandboxRunOptions }; //# sourceMappingURL=sandbox.d.ts.map