eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
33 lines (32 loc) • 1.42 kB
TypeScript
import type { DeliverPayload } from "#channel/types.js";
import type { SessionControl, SessionInputQueue, TurnSelection } from "#execution/session/input-queue.js";
import type { SessionInboxReader } from "#execution/session-inbox/inbox.js";
import type { SessionStateCursor } from "#execution/session/state-cursor.js";
import type { WorkflowToolRunMessage } from "#execution/tools/workflow/messages.js";
export type NextTurnInstruction = {
readonly kind: "workflow";
readonly message: WorkflowToolRunMessage;
} | {
readonly kind: "authorization-resume";
readonly payloads: readonly DeliverPayload[];
} | {
readonly kind: SessionControl;
} | {
readonly kind: "closed";
} | {
readonly kind: "cancel-turn";
} | TurnSelection;
/**
* Waits for the next input the parked owner must act on. While an
* authorization challenge is open, its callbacks collect in the queue and
* resume the challenge once every expected attempt has reported; ordinary
* deliveries keep starting turns in the meantime. Fully routed descendant
* deliveries leave nothing for the parent, so the wait continues.
*/
export declare function nextTurnDelivery(input: {
readonly inbox: SessionInboxReader;
readonly cursor: SessionStateCursor;
readonly deferDeliveries?: boolean;
readonly expectedAttemptIds?: ReadonlySet<string>;
readonly queue: SessionInputQueue;
}): Promise<NextTurnInstruction>;