UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

41 lines (40 loc) • 2.66 kB
export declare const RUN_ORIGINS: readonly ["scheduled"]; export type RunOrigin = (typeof RUN_ORIGINS)[number]; /** Membership test for {@link RunOrigin}: the one a host checks the word it is about to stamp against. */ export declare function isRunOrigin(v: unknown): v is RunOrigin; /** The checkpoint row's recorded word: absent or a member passes; anything else is a row this engine cannot resume under * (`config.run_origin_invalid`). A resume's screen asks it after the row's reader requirements were judged, so a row a newer * engine wrote is refused as newer first. */ export declare function screenRecordedRunOrigin(recorded: unknown): RunOrigin | undefined; /** * THE door of the declared word, and the leg's one reading of it. `declared` is the leg's config's word — the task spec's on a * fresh leg, where it is the objective's; `row` is present on a resumed leg only and carries the word its checkpoint recorded * and, when the resume hands over inputs to open the leg with (a wake), the newest one's word as `opening.word` * ({@link wakeOpening}). On a fresh leg absent passes as absent, a member passes, and anything else present is refused loudly * (`config.run_origin_invalid`), never folded to "the host said nothing" (that silence is exactly the invisibility the word * exists to end). * * A resume config carries NO word, any value refused: a resume hands the engine no objective, so the field would have nothing * to describe — the resumed leg's word is its opening input's when a wake opened it (absent included: a message that says * nothing is not the row's word), the row's otherwise. Prepare's config doors and a resume's screen before the claim call this * one function, so a resume prepare would refuse is refused while the row is pending. */ export declare function runOriginOfLeg(declared: unknown, row?: { readonly recorded: RunOrigin | undefined; readonly opening?: { readonly word: unknown; }; }): RunOrigin | undefined; /** * The input that opens a woken leg: the NEWEST the wake hands over — its message, else the parked entry it delivers last * (`parked` in `seq` order) — so a message-bearing wake and its atomic equivalent (`setPendingSteer` then a message-less wake) * give the leg the same word. `undefined` when it hands over nothing. A decision on a parked leg opens nothing: what it * delivers rides along with the answer, and the leg continues the row's word. */ export declare function wakeOpening(parked: ReadonlyArray<{ readonly runOrigin?: unknown; }>, message: { readonly runOrigin?: unknown; } | undefined): { readonly word: unknown; } | undefined;