import type { AgentNetwork, AgentSandboxGrants } from '../agent/folder.js'; /** * Guest `localhost` resolves to the microVM itself, not the host — host * loopback is reachable at this gateway, which sbx routes through the policy * proxy. Used both to rewrite `allowDomain` localhost entries (see * `composeSbxPolicyArgvs`) and caller-supplied base URLs (see * `rewriteLocalhostBaseUrl`). */ export declare const SBX_HOST_GATEWAY = "host.docker.internal"; /** A single sbx mount: a host path (preserved verbatim in the guest) and its access mode. */ export interface SbxMount { readonly path: string; readonly readonly: boolean; } /** * Everything `composeSbxCreateArgv`, `composeSbxPolicyArgvs`, * `composeSbxProvisionArgv`, and `composeSbxExecArgv` need — the sbx analog of * nono's `ProfileSpec`. */ export interface SbxSpec { /** Resolved path, or bare `sbx` for dry-run previews. */ readonly sbxBin: string; /** Sandbox name from `sbxSandboxName()`. */ readonly name: string; /** The target project — always the first (rw) workspace mount. */ readonly cwd: string; /** Host home dir — for the exec `HOME` override and the `~/.pi/agent` mount. */ readonly home: string; /** From `composeSbxMounts()`; cwd first. Fixed at sandbox creation time. */ readonly mounts: readonly SbxMount[]; /** Precedence-resolved network posture — the same shape nono consumes. */ readonly network?: AgentNetwork; /** Host pi version to pin in-guest; `null` = install only if missing. */ readonly piVersion: string | null; /** Pass `-t` on exec — set when a TTY is present. */ readonly tty: boolean; } /** Inputs to `composeSbxMounts` — everything that can contribute a guest mount. */ export interface SbxMountContext { readonly cwd: string; readonly agentDir: string; readonly stateDir: string; readonly home: string; readonly grants: AgentSandboxGrants; /** * The real git dir when `cwd` is a linked worktree or submodule checkout * (see `agent/linked-git-dir.ts`) — mirrors nono's `ProfileSpec.linkedGitDir`. * Absent for regular repos, where `.git` already sits inside the cwd mount. */ readonly linkedGitDir?: string; } /** * Build this run's guest mount list: cwd (rw), the agent folder (ro), the * state dir (rw), `~/.pi/agent` (rw — pi's auth/settings store; the exec * `HOME` override in `composeSbxExecArgv` makes pi find it there), the linked * git dir when present (rw), then the agent's own `sandbox/nono.json` grants * (`read` ro, `write`/`allow` rw), each expanded against `home`. Duplicate * paths collapse to one entry — rw wins over ro, first-occurrence order * otherwise — since sbx takes a flat mount list, not layered grants. */ export declare function composeSbxMounts(ctx: SbxMountContext): SbxMount[]; /** * `cradle--` — hash8 is the first 8 hex chars of a * sha256 over the order-insensitive sorted `path:ro|rw` strings, mirroring * `agentId` (`agent/state.ts`). Mounts are fixed at sbx creation time, so this * name keys the mount set: a changed mount set yields a new sandbox name * instead of silently attaching to (and running with) a stale mount list. */ export declare function sbxSandboxName(stateDirBasename: string, mounts: readonly SbxMount[]): string; /** `sbx create shell [:ro]... --name -q`. `spec.mounts` already carries cwd first. */ export declare function composeSbxCreateArgv(spec: SbxSpec): string[]; /** * Per-sandbox network policy argvs (idempotent re-adds — safe to run every * launch). `[]` when `spec.network` is absent. A `block: true` posture emits a * single deny-all — `allowDomain` is ignored under block, matching nono's * block-wins precedence, since a same-scope deny always beats an allow. * Otherwise, a non-empty `allowDomain` emits a single allow argv with every * expanded resource comma-joined (see `composeAllowResources`); an empty or * absent `allowDomain` under a non-blocking posture emits nothing. * `openPort`/`listenPort`/`networkProfile` have no sbx policy equivalent — * see `sbxNetworkWarnings` for their disclosures. */ export declare function composeSbxPolicyArgvs(spec: SbxSpec): string[][]; /** * Warn-and-drop disclosures for `AgentNetwork` fields sbx cannot enforce the * way nono does. Returns `[]` when nothing applies (including when `network` * is absent) — this module never throws, it only reports what it dropped. */ export declare function sbxNetworkWarnings(network: AgentNetwork | undefined): string[]; /** Warn-and-drop disclosure for Unix socket grants, which cannot cross the sbx VM boundary. */ export declare function sbxGrantWarnings(grants: AgentSandboxGrants): string[]; /** * `sbx exec bash -lc