eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
40 lines (39 loc) • 2.07 kB
TypeScript
import type { DeliverHookPayload, HookPayload, SessionCapabilities } from "#channel/types.js";
import type { DurableSessionState } from "#execution/durable-session-store.js";
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
import { SessionStateCursor } from "#execution/session-state-cursor.js";
import type { TurnDriverAction } from "#execution/turn-control-receiver.js";
import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
import type { RunMode } from "#shared/run-mode.js";
/** One settled turn: its terminal driver action plus deferred hook cleanup. */
export interface DispatchedTurn {
readonly action: TurnDriverAction;
/**
* Disposes the turn's control hook. Deferred until the *next* turn
* settles (or the session ends): the turn run's final control send is
* at-least-once, and `sendTurnControlStep` does not treat
* `HookNotFoundError` as benign, so a late duplicate resume must land
* on a live hook. By the next settle, the previous run has completed
* and can no longer re-send.
*/
dispose(): Promise<void>;
}
/** Dispatches one turn and services its private-inbox control protocol until it terminates. */
interface TurnDispatchInput {
readonly bufferedDeliveries: DeliverHookPayload[];
readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">;
readonly capabilities?: SessionCapabilities;
readonly cancelledTaskIds?: Set<string>;
readonly controlToken: string;
readonly delivery: HookPayload;
readonly commandInbox: SessionCommandInbox;
readonly mode: RunMode;
readonly parentWritable: WritableStream<Uint8Array>;
readonly retention?: AgentWorkflowRetentionDefinition;
readonly serializedContext: Record<string, unknown>;
readonly seenTaskDeliveries?: Set<string>;
readonly sessionState: DurableSessionState;
readonly stateCursor?: SessionStateCursor;
}
export declare function dispatchAndAwaitTurn(input: TurnDispatchInput): Promise<DispatchedTurn>;
export {};