UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

48 lines (47 loc) • 3.01 kB
import { type PermissionResult, type ToolCallRequest } from "../tool-policy.js"; import type { ShellReadCheck } from "../../tools/fs/shell-read-check.js"; import type { PersonDirectories } from "./person-path-rows.js"; /** * Does this leg refuse reads outside its declared directories? The declaration (`TaskSpec.blockReadsOutsideRoots`, screened at * the door: present ⇒ a boolean) or, on a resume leg, the row's record of it (`CheckpointState.readBlock`): a resume never lifts * it, so a host that does not send it again keeps it. Called once per leg, by the branch that mounts the leg (with hands or * without), so every reader of the declaration takes this one answer. */ export declare function readBlockOf(leg: { readonly spec: { readonly blockReadsOutsideRoots?: boolean; }; readonly resume?: { readonly seed: { readonly readBlock?: true; }; }; }): boolean; /** What the seat changes on a leg with hands, answered once: the remedy its read faces name in place of the escape hint when they * refuse a read outside their roots (the one mint of it), whether a person may add a read root mid-run (a card's "allow + this * directory" — not where the roots are what was declared; the one answer the grant seat and the shell cards read), and how the * read roots take the person's read directories. */ export declare function readBlockLeg(readBlock: boolean): { readonly outsideReadRemedy: string | undefined; readonly grantsReadRootMidRun: boolean; readonly personDirectories: PersonDirectories; }; /** The read station's refusal of a call's bytes, or `undefined` (no judge on this leg, or the station does not refuse them). */ export type ReadBoundaryRefusal = (creq: ToolCallRequest, args: unknown, csignal: AbortSignal | undefined) => Promise<Extract<PermissionResult, { action: "deny"; }> | undefined>; /** * The read station's refusal of `args`, judged BEFORE an inherited station puts an ancestor's question about the call — the * ONE mint of that refusal, for the three places such a question is put (an inherited installation's settlement, the * shared-instance adapter's arbitration, the approved edit's re-check). `undefined` unless the leg refuses reads outside its * directories (`judge`) and the station refuses these bytes. The judge is the fold's own station, bounded as the fold * bounds it (the gate's default deadline; a judgment that elapsed or failed is the station's `unanswered`, a refusal on such a * leg); its answer is received as the fold receives one (`readStationAnswer`). The refusal is the station's words and card, * and its record names the station's layer (`stationRefusal`): the gate files it as the read boundary's, as when the fold's * station refuses the same call. */ export declare function readBoundaryRefusalOver(seat: { readonly judge: ShellReadCheck | undefined; readonly cwd: () => string | undefined; readonly signal: AbortSignal; }): ReadBoundaryRefusal;