/** * Queue presentation shared by the web queue surface and native docks: the * bounded head/tail previews of queued prompts, and the reorder plan and its * optimistic projection. No DOM, no React. */ import type { SessionQueueSnapshot, SessionTurn } from "@opengeni/sdk"; import { QUEUE_ITEM_CONTENT_UNAVAILABLE, queueItemContent } from "./components/queue-item-content.js"; import { type OpenGeniText } from "./messages/runtime.js"; export { QUEUE_ITEM_CONTENT_UNAVAILABLE, queueItemContent }; export declare const QUEUE_ROW_PREVIEW_CHARACTERS = 360; export declare const QUEUE_COLLAPSED_PREVIEW_CHARACTERS = 180; export type QueuePromptPreview = { summary: string; collapsedVisual: string; visibleStart: string; visibleIdentity: string | null; visibleIdentityLabel: string | null; isFallback: boolean; }; export declare function queueTurnPreview(t: OpenGeniText, turn: SessionTurn | undefined, maxCharacters: number): QueuePromptPreview; export declare function queueContentPreview(t: OpenGeniText, prompt: string, annotationCount: number, maxCharacters: number): QueuePromptPreview; /** * Build a bounded head/tail summary of an arbitrary queued prompt. Sampling * both ends distinguishes prompts with equal long prefixes. Each sampled edge * has a small amount of grapheme context so ordinary emoji/combining sequences * can be retained whole. A cluster that exceeds that context is omitted rather * than fragmented, and malformed UTF-16 is replaced only in the summary. The * durable prompt remains exact and no operation scans or copies it in full. */ export declare function queuePromptPreview(t: OpenGeniText, prompt: string, maxCharacters: number): QueuePromptPreview; /** Move one item, as dnd-kit's arrayMove does. */ export declare function moveQueueItem(items: readonly T[], from: number, to: number): T[]; export type QueueMovePlan = { /** The turn ids in their new order. */ turnIds: string[]; /** The server anchor: the turn the moved one now precedes, null for last. */ beforeTurnId: string | null; /** The bounded destination index. */ index: number; }; /** The reorder request for moving a queued turn to an index, or null for a no-op. */ export declare function queueMovePlan(queue: readonly SessionTurn[], turnId: string, nextIndex: number): QueueMovePlan | null; export type PendingQueueMove = { baseVersion: number | null; turnIds: string[]; }; /** * The queue as shown while a move is in flight: the optimistic order, unless * any authoritative change arrived. A projection never omits or invents a row. */ export declare function projectPendingQueueMove(queue: SessionTurn[], pendingMove: PendingQueueMove | null, snapshot: Pick | null): SessionTurn[]; /** Copy for the "replace your draft with this queued prompt" confirmation. */ export declare const QUEUE_REPLACE_DRAFT_COPY: (t: OpenGeniText) => { readonly title: string; readonly detail: string; readonly keep: string; readonly replace: string; }; export type QueuedTurnPresentation = { kind: "prompt" | "realtime_voice" | "realtime_voice_handoff"; text: string; }; /** What a queued row shows: the prompt, or the transcript of a voice request. */ export declare function queuedTurnPresentation(t: OpenGeniText, turn: SessionTurn): QueuedTurnPresentation; export declare function isSteeringTurn(turn: SessionTurn): boolean; /** A queued turn that is really waiting: not already a steer in flight. */ export declare function isAuthoritativeQueuedTurn(turn: SessionTurn, mutationFor: (turnId: string) => string | null): boolean; export declare function countAuthoritativeQueuedTurns(turns: readonly SessionTurn[], mutationFor: (turnId: string) => string | null): number; /** The move anchors for one row's Move up / Move down. */ export declare function queueNeighborAnchors(turns: readonly SessionTurn[], index: number): { beforeUp: string | null; beforeDown: string | null; };