export interface QueueItem { id: string; sessionId: string; sessionKey: string; prompt: string; status: "pending" | "running" | "cancelled" | "completed"; internal: boolean; /** The transcript row this item will run, when the enqueuing path had one. */ messageId: string | null; /** Engine-facing extras that must travel with the payload when rows rotate. * Null means this row never recorded any: the dispatch closure still decides. */ dispatch: QueueDispatch | null; position: number; createdAt: string; startedAt: string | null; completedAt: string | null; } /** What a turn runs on besides its text. */ export interface QueueDispatch { attachments: string[]; speechDerived: boolean; } export declare function enqueueQueueItem(sessionId: string, sessionKey: string, prompt: string, options?: { internal?: boolean; messageId?: string; dispatch?: QueueDispatch; }): string; export declare function markQueueItemRunning(itemId: string): boolean; export declare function markQueueItemCompleted(itemId: string): void; export declare function markRunningQueueItemsCompletedForSession(sessionId: string): number; export declare function getQueueItem(itemId: string): QueueItem | undefined; export declare function cancelQueueItem(itemId: string): boolean; /** * Rewrite a parked item's text, and the bubble it is showing, together. * * The two writes share a transaction because a queue row and its transcript row * disagreeing is the one state the chat cannot render honestly: the operator * would be reading one message and the engine would run another. The message * UPDATE is spelled out here rather than borrowed from `registry.ts` so this * module stays a leaf. * * Returns undefined when the item is gone or has already left `pending`. */ export declare function editPendingQueueItem(itemId: string, prompt: string): QueueItem | undefined; /** * Move payloads between parked rows, in one transaction so a reader never sees * two rows claiming the same message. The rows keep their positions and their * place in the committed promise chain; only what they will run changes. * * The whole payload moves - text, bubble, attachments, speech origin - because a * message arriving with a neighbour's attachment is worse than not reordering. */ export declare function reassignPendingQueuePayloads(assignments: ReadonlyArray<{ id: string; payload: QueueItem; }>): void; export declare function getQueueItems(sessionKey: string): QueueItem[]; export declare function cancelAllPendingQueueItems(sessionKey: string): number; export declare function recoverStaleQueueItems(): number; export declare function listAllPendingQueueItems(): QueueItem[]; export declare function claimWorkflowAttemptDispatch(sessionId: string, sessionKey: string, prompt: string): string | null; export declare function cancelWorkflowAttemptDispatch(sessionId: string): number; export declare function listPendingWorkflowAttemptDispatches(): QueueItem[]; //# sourceMappingURL=queue-item-registry.d.ts.map