UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

31 lines (30 loc) • 2.27 kB
/** * The value gates of the read-face list seats, shared by the two places that admit a value into them: the * prepare door (every leg reads the seats it was handed) and the hot-swap door (`Runner.swapDeps`). One gate, * so a value the swap admits is a value every later prepare admits. */ import { type ReadDenyEntry } from "../tools/fs/index.js"; /** Array-shape door for the read-face list seats (the tool-face door's twin). * These seats are typed `readonly string[]` but arrive from wire JSON / plain-JS deployments with no * runtime narrowing, and every consumer ITERATES them — `for (const dir of dirs)` and spread. * A bare string satisfies both iteration protocols CHARACTER BY CHARACTER, so `"/tmp/x"` admits the * single-character root `"/"` into a write-capable allowlist and a string deny "pattern" dissolves * into meaningless one-character entries with zero refusal. Garbage must refuse loudly at the door, * never be consumed letter by letter. */ export declare function assertStringArraySeat(value: unknown, seat: string, entryLaw: "strings" | "compiler-owned"): void; /** The three DEPLOYMENT read-deny seats. */ export declare const READ_DENY_DEPLOYMENT_SEATS: readonly ["readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude"]; export type ReadDenyDeploymentSeat = (typeof READ_DENY_DEPLOYMENT_SEATS)[number]; /** * The copy a read-deny seat keeps of its declared value — the one copy law of both doors that admit one (`new Runner` * and the hot swap): a list becomes a frozen list of frozen entry copies (each entry's members read once), so a later * write to the caller's list or entry objects cannot move the policy in force; anything else is kept as given, for the * seat's value gate to refuse. */ export declare function copyReadDenySeat(value: unknown): unknown; /** * Screen one deployment read-deny seat's value with the laws a prepare applies to it (the array door and the * one compiler's entry law for the additions; the built-in table's tier / row-name law for the other two) and * return a copy; `undefined` stays `undefined` (no declaration). */ export declare function screenReadDenySeat(seat: ReadDenyDeploymentSeat, value: unknown): readonly ReadDenyEntry[] | readonly string[] | undefined;