UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

38 lines (37 loc) • 2.4 kB
/** * The seatbelt confinement a shell start runs under on the engine's macOS host: the launcher, the deny-default base every * confined start runs under, the one assembly of a profile from the reads it refuses and the locations it holds in place, * and the one wrapping of a start in its floor's profile. Below the engine and the tools both: an environment spawns * through {@link confineShellStart} and probes with {@link SEATBELT_PROBE_PROFILE}; the floor's adapter translates its * table into the expressions {@link seatbeltProfile} assembles (`ReadFloor.confinement`). */ import type { ReadFloor } from "../internal/harness-types.js"; /** The seatbelt launcher, by its absolute path (a PATH lookup could run another program in its place). */ export declare const SANDBOX_EXEC = "/usr/bin/sandbox-exec"; /** A profile: the base; reads open but for each of `reads` (an expression in the dialect's regex syntax), directory metadata * still readable; writes open, and no unlink or create at any of `holds` (a rename cannot carry a refused file out from * under its row). No expression on a side ⇒ no block for it. */ export declare function seatbeltProfile(reads: readonly string[], holds: readonly string[]): string; /** The profile of no row: what an environment applies once to learn whether confinement works on this host at all. */ export declare const SEATBELT_PROBE_PROFILE: string; /** A shell start as an environment spawns it: the shell and its arguments, the command last. */ export interface ShellStart { readonly command: string; readonly args: readonly string[]; } /** * The start confined to `floor` — the one wrapping every environment that spawns on the engine's host takes: no floor ⇒ * the start as it is (`profile` undefined); a floor ⇒ `sandbox-exec -p <the floor's seatbelt profile>` running the start, * with that profile; a floor whose profile cannot be made ⇒ the row and why, and the start must not run. Pure: whether the * host can apply a profile at all is the environment's probe, and an apply that fails at the start is the environment's to * refuse. */ export declare function confineShellStart(start: ShellStart, floor: ReadFloor | undefined): { readonly ok: true; readonly start: ShellStart; readonly profile: string | undefined; } | { readonly ok: false; readonly row: string; readonly reason: string; };