UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

49 lines (48 loc) • 3.21 kB
import { type PermissionMode } from "../core/ask-origin.js"; import type { EngineNotice } from "../core/types.js"; /** The drive's gate seat, read ONCE at its door. */ export type ParkedResumeGateReading = { readonly seat: { permissionMode?: PermissionMode; shellGate?: "always"; } | undefined; } | { readonly refusal: Error; }; /** * The drive's gate seat (`parkedResume.inheritedGate`, the caller's value read once by the caller) judged and copied in one * reading — each member read once, so what is judged is what the leg runs under: a seat that is not a record, a member outside * {@link PARKED_RESUME_GATE_MEMBERS} (by name: the door's name judgment, `strayMembersOf`), a member that cannot be read, a mode * outside the closed set or a shell floor other than `"always"` is refused (`config.deps_retired_key`, `detail.field` * `"inheritedGate"`); otherwise the copy of its two members. */ export declare function parkedResumeGate(seat: unknown): ParkedResumeGateReading; /** The drive's gate seat (`reviveClaim.parkedResume.inheritedGate`), the slot read once ({@link parkedResumeGate}); a read that * throws is the refusal. */ export declare function parkedResumeDoor(pr: { readonly inheritedGate?: unknown; }): ParkedResumeGateReading | { readonly refusal: unknown; }; /** * The root task's facts a drive must hand, or the refusal naming the first it lacks: the root's seat (`parentSpecSeat`, minted with * `parentSpecSeatOf` from the root's stored spec — the revived leg's instruction family, language, directories and mods are read from * it; the row records only the principal and the sandbox), then the root's current mode (`parkedResume.inheritedGate.permissionMode` * — the row froze the mode at the park, and the root may have tightened it since). Asked of every drive, an allow and a deny alike; * the drive refuses before the consume and rolls the claim back, as for any other fact it lacks. */ export declare function parkedResumeUnhanded(seat: unknown, gate: { readonly permissionMode?: PermissionMode; } | undefined): Error | undefined; /** The account of the resume's own rejection `e` when the chain raised it for a deny the resume validated on THIS card * (`takeDeniedChainRefusalToken`, the ladder's mark on that one throw, naming the card's token — every code and reason the chain's * rungs refuse with), else `undefined`: its code and reason, as the stopped agent's receipt names them (the refusal's own sentence * speaks of a checkpoint still pending, which the stop expired). Such a deny settles by the stop path. The mark is taken: asked * once, where the drive catches the resume's rejection, and never again. */ export declare function unresumableChainRefusal(e: unknown, token: string): { readonly code: string; readonly cause: string; } | undefined; /** The account of an agent revived from a row that records no delegation depth (an earlier release wrote it): it runs without * the delegation tool (`delegation.spawn_depth_unknown`) — the depth it was born at cannot be read, and the waking tool's is not its. */ export declare function spawnDepthUnknownNotice(taskId: string): EngineNotice;