import type { ComposerDraft, EffectiveSessionControl, McpPersonalConnectionSummary, SessionEvent, SessionQueueSnapshot, SessionPendingInputPreview, SessionTurn } from "@opengeni/sdk"; import { type EmbeddedSessionClientOverride } from "../session-context.js"; import { type SessionEventFeedOptions } from "./internal.js"; /** Events that can change the authoritative prompt queue or effective control. */ export declare function isTurnQueueEvent(event: Pick): boolean; export type QueueMutationKind = "move" | "edit" | "steer" | "delete"; export type AcceptedQueueSteer = { turnId: string; triggerEventId: string; text: string; annotations: SessionTurn["annotations"]; resources: SessionTurn["resources"]; tools: SessionTurn["tools"]; occurredAt: string; state: "sending" | "queued"; }; export type UseTurnQueueOptions = EmbeddedSessionClientOverride & SessionEventFeedOptions & { pollIntervalMs?: number | undefined; }; export type UseTurnQueueResult = { snapshot: SessionQueueSnapshot | null; /** Human/API prompts exactly in server execution order. Never client-sorted. */ queue: SessionTurn[]; /** Canonical pending machine inputs. Events only trigger an authoritative refresh. */ pendingInputs: SessionPendingInputPreview[]; /** Exact pending members projected to join an already-waiting prompt. */ pendingInputAttachment: SessionQueueSnapshot["pendingInputAttachment"]; /** Secret-safe personal MCP summaries frozen on the exact active turn. */ activePersonalConnections: McpPersonalConnectionSummary[]; effectiveControl: EffectiveSessionControl | null; /** The latest interrupted attempt has not yet durably proved physical quiescence. */ stoppingPreviousAttempt: boolean; loading: boolean; error: Error | null; refresh: () => Promise; moveTurn: (turnId: string, beforeTurnId: string | null) => Promise; /** Atomically withdraw a waiting prompt into the private durable composer draft. */ editTurn: (turnId: string, options: { expectedDraftRevision: number; replaceDraft: boolean; }) => Promise; /** Advance the same durable waiting prompt; no duplicate prompt is created. */ steerTurn: (turnId: string) => Promise; removeTurn: (turnId: string) => Promise; pendingByTurn: Readonly>; mutationFor: (turnId: string) => QueueMutationKind | null; mutating: boolean; mutationError: Error | null; clearMutationError: () => void; /** Immediate chat bridge while the durable Steer event catches up over SSE. */ acceptedSteers?: AcceptedQueueSteer[] | undefined; }; /** * The one authoritative human prompt queue. Every mutation carries the exact * server versions the operator saw and accepts only monotonic snapshots. A * conflict immediately reloads server truth; the client never invents order. */ export declare function useTurnQueue(sessionId: string | null | undefined, options?: UseTurnQueueOptions): UseTurnQueueResult;