UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

34 lines (33 loc) • 2.91 kB
import type { Checkpoint, CheckpointSummary, PendingAction } from "./checkpoint-store.js"; /** * Does approving (or editing) this pause ask the leg to leave plan mode? `true` exactly when the pause is a `plan_review` * (`pause`, its gate word `plan_review`) and the row recorded the leg's declared mode at the pause as `plan` * (`CheckpointState.inheritedGate.permissionMode`, the word the resume reads). A rejected plan never exits; that is the * decision's half, read by the resume's mode request, not by this answer. * * A REQUEST, not an outcome: the resumed leg asks for the word the approver re-passes (when it is not `plan`), else the word it * had before plan (`prePlanMode`), else its own default — and that request is still clamped under the leg's ceiling. A host's * root leg has none, so it leaves plan; a delegated leg that can park (a background child, a workflow member) is clamped under * its parent's mode, so under a parent in plan it stays in plan. The ONE comparison of a recorded mode with `plan`. */ export declare function approvalRequestsPlanExit(pause: string | undefined, recordedMode: unknown): boolean; /** The `plan_review` facts a face echoes — each member present only when the row states it (the summary's absence shape). */ export type PlanReviewFacts = Pick<CheckpointSummary, "requestedByCallId" | "planContentHash" | "approvalRequestsPlanExit">; /** * The ONE reading of a `plan_review` row's facts for every face that reports the pause (the paused cause, the inbox summary): * `requestedByCallId` ({@link planReviewRequesterOf}), `planContentHash` ({@link planReviewContentHashOf}) and * `approvalRequestsPlanExit` ({@link approvalRequestsPlanExit} over the pending action's kind and the recorded mode). Each * member is left off where the row does not state it — on any other pending kind, all three; the bit only as the literal * `true`, never `false`. */ export declare function planReviewFactsOf(row: Pick<Checkpoint, "pendingAction" | "state">): PlanReviewFacts; /** * The ONE reading of {@link PendingAction} `plan_review.requestedByCallId` — the id of the call that asked for a plan * pause. A non-empty string on a `plan_review` pending action; every other kind, an absent member and a damaged value * (a non-string, an empty string) read as `undefined`, so no consumer echoes a value the mint never wrote. */ export declare function planReviewRequesterOf(pendingAction: PendingAction): string | undefined; /** The ONE reading of {@link PendingAction} `plan_review.planContentHash` (the digest of the plan shown at the pause): a value * of the form the mint writes on a `plan_review` pending action; every other kind, an absent member and a damaged value read as * `undefined`, so no consumer echoes a value the mint never wrote. */ export declare function planReviewContentHashOf(pendingAction: PendingAction): string | undefined;