UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

20 lines (19 loc) • 1.96 kB
/** * What the memory phase does with a mount that did not complete, and how a capture opt-out that could not be recorded refuses — one * place for both, beside the phase (`prepare-memory.ts`) that throws them. * * A failing mount runs the task without its memory (the phase's fail-open arm, said to the operator and the person) — except: * - a DELIBERATE refusal ({@link isDeliberateMemoryRefusal}) is rethrown as itself: a configuration the scope contract refuses, overlapping * dual-root planes, a capture opt-out denied by policy or one that could not be recorded — running memory-less would hide it; * - a leg that declared a capture opt-out, or carries the spawning session's opt-out floor (both known before the mount), whose mount * failed before that opt-out was recorded is refused `memory.capture_optout_unpersisted` ({@link unpersistedOptOutRefusal}) with the * failure's cause: running memory-less would make no record, and the next resume of the session would run captured. */ import { type RunnerDeps } from "../types.js"; import { type CaptureOptOutUnpersistedReading } from "../memory-engine/mount-failed-notice.js"; /** Whether a throw out of the memory phase is a deliberate refusal the fail-open arm must not swallow (it is rethrown as itself). */ export declare function isDeliberateMemoryRefusal(err: unknown): boolean; /** The one way a capture opt-out that could not be recorded refuses, at either ingress (`declaration`: the run is refused — its mark * answered `"unpersisted"`, or the memory phase failed before the mark, `cause` being that failure; `flip-verb`: only the verb is * rejected): the person's notice is delivered here, and the typed error is returned for the caller to throw. */ export declare function unpersistedOptOutRefusal(onNotice: RunnerDeps["onNotice"], sessionId: string, ingress: "declaration" | "flip-verb", reading: CaptureOptOutUnpersistedReading, cause?: unknown): Error;