UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

45 lines (44 loc) • 3.35 kB
/** * The durable-suspend checkpoint ROW-IDENTITY vocabulary — the default isolation scope, the ONE derivation of a row's * scope, and the ONE reading of the placement fields' empty string — moved whole out of the orchestrator so the * park-lane phases (the suspend stamp), the driver (the leg's scope, derived once and handed to every mint lane; the * restore fold) and runtask (the resume rung) reach DOWN for the same names. Pure: a constant and two string functions. */ /** The multi-tenant scope used when a durable suspend fires for an IRREVERSIBLE tool in an * unattended deployment that did NOT opt into `durableApproval` (so there is no caller-supplied scope). The * checkpoint carries this scope; resume reads it back from the checkpoint (`cp.scope`), so it is * self-consistent without needing the original `TaskSpec`. Kept distinct from any tenant key to make an * unattended irreversible suspend auditable as such. */ export declare const DEFAULT_IRREVERSIBLE_SCOPE = "irreversible"; /** * The SINGLE derivation of a durable-suspend checkpoint's scope — the LEG's scope, computed once per prepare and * read by every mint lane of that leg (approval park, resource and `plan_review` parks, the forceDurableGate * synthesis) and by its children; a re-derived copy that drifted was the exact bug the park tests caught (expire * against the wrong scope silently no-ops). `seat` is the scope the leg was already given: on a spawn lane the * PARENT leg's (`RunInternals.checkpointScope`) — a child's rows land where its parent's do, which the child's own * spec cannot say, since the synchronous lane does not carry the parent's `durableApproval` (it would also arm the * child's plain asks to park); on a resume that hands no seat, the leg's own recorded scope * (`CheckpointState.legScope`), so the resume config cannot move it. The seat moves the scope and nothing else. A * root leg's first prepare has no seat. * * `||` on EVERY rung (not `??`): a blank string — a config-centre / env lookup that came back empty is the * realistic source — is the absence of an isolation key wearing its clothes. Kept as a literal `""` it would be * one bucket for every tenant that hit it: `listByScope("")` reads all their pending approvals (with each * summary's `toolInput` preview) and `reap("")` / `resolve(token, "")` act across all of them. */ export declare function checkpointScopeOf(spec: { durableApproval?: { scope?: string; }; principal?: string; }, seat?: string): string; /** * The ONE spelling of the placement fields' empty-string discipline: `""` is absence * wearing clothes (the resume entry's principal-rung posture), and every placement read that must * treat it so — the resume rung's two sides (runtask), the restore fold's seed and the suspend * stamp — goes through THIS helper, so three sites cannot drift into three readings. Deliberately * NOT applied to the live `internals.placementRoot`/`rootSessionId` reads of the RESOLUTION fold: * an empty supplied claim there is an assembly error the execution-env phase's `mintPlacementRootSessionId` refuses * loudly on the factory path, and normalizing it away would silently repair what should be loud. */ export declare function placementValueOrAbsent(value: string | undefined): string | undefined;