import { QueuedEntry, SessionState, TimelineEntry } from "../lib/sessionModel.mjs"; import { RpcImage } from "../lib/commands.mjs"; import { ApiTransport } from "@agimon-ai/po-core/web"; import { SessionLifecycle } from "@agimon-ai/po-core/sessionProtocol"; import { Store } from "@tanstack/store"; //#region src/web/stores/sessionStore.d.ts /** Newer reads and live projections supersede each independently fetched part. */ export declare function refreshSessionSelection(sessionId: string): Promise; /** * Flips a mode through the modes API, not a `/mode` prompt, so the switch settles as soon as the * action does. The answer supersedes any older read; a failure shows as a session error. */ export declare function invokeModeAction(modeId: string, action: string, sessionId?: string | null, request?: ApiTransport): Promise; /** * Flips a mode the way its switch would: through the modes API when the catalog offers an * input-free toggle, else through `/mode `, which asks for what the action still needs. */ export declare function toggleMode(modeId: string, sessionId?: string | null, request?: ApiTransport): Promise; export declare function setHasNewerHistory(sessionId: string, value: boolean): void; /** Sessions a live transcript stream currently feeds; any other store may hold stale facts. */ export declare const streamedSessions: Store, never>; export declare function setSessionStreamed(sessionId: string, streamed: boolean): void; export declare function sessionStoreFor(sessionId: string | null): Store; /** Reads the focused session's state; components stay on the useStore idiom. */ export declare function useActiveSession(selector: (state: SessionState) => T): T; /** Presentation frames from the Pi protocol, or from bounded replay when replay is true. */ export declare function applySessionFrame(sessionId: string, frame: Record, options?: { replay?: boolean; source?: 'hub'; }): void; /** Lets the presentation stream resume transcript ownership after a typed service failure. */ export declare function releaseProtocolTranscript(sessionId: string): void; /** A thread has no protocol session, so its journal remains its authoritative transcript. */ export declare function applyThreadFrame(threadKey: string, frame: Record): void; export declare function bindHistoryReader(sessionId: string, reader: (direction: 'older' | 'newer' | 'latest') => boolean, ready?: () => boolean): () => void; export declare function requestNewerHistory(sessionId: string | null): boolean; export declare function requestLatestHistory(sessionId: string | null): boolean; /** Whether more transcript exists above what this session's page holds. */ export declare function useHasOlderHistory(sessionId: string | null): boolean; /** * Asks the hub for the window above what this page holds. * * One request at a time: a reader flicking upwards would otherwise ask for the * same window repeatedly before the first answer lands, and every copy would * be prepended. */ export declare function requestOlderHistory(sessionId: string | null): boolean; /** Folds one answered window above the timeline and records how far back it reached. */ export declare function applyHistoryPage(sessionId: string, frames: Record[], next: HistoryPage): void; export interface HistoryPage { cursor: string | null; hasMore: boolean; } /** The oldest entry the page holds, which is where the next window ends. */ export declare function seedHistoryCursor(sessionId: string, cursor: string | null): void; /** * Replaces protocol-owned transcript items with the authoritative snapshot. * * Local echoes disappear when the protocol publishes them. Po-only entries, * such as notices, queued messages, and run dividers, retain their place beside * the protocol item that preceded them. */ export declare function applyProtocolTranscript(sessionId: string, entries: TimelineEntry[], streaming: boolean): void; /** Applies execution and retained-input state from the server, never from replayed history. */ export declare function applySessionLifecycle(sessionId: string, lifecycle: SessionLifecycle, newBinding?: boolean): void; /** Replaces composer queue rows with the protocol server's authoritative queue. */ export declare function applyProtocolQueue(sessionId: string, queue: readonly QueuedEntry[]): void; /** Marks the start of a subscription replay, so live projections beat an older snapshot. */ export declare function beginSessionReplay(sessionId: string): void; export declare function endSessionReplay(sessionId: string): void; export declare function resetSessionStore(sessionId: string, options?: { source?: 'hub'; }): void; export declare function dropSessionStore(sessionId: string): void; export declare function resetSessionStores(): void; /** * Asks for the facts the cockpit shows but Pi only reports on request. * * A session with no live protocol is skipped: it asks for these itself when it * connects, and a caller refreshing every listed session (after a settings save, * say) must not fail on one that is not open. */ export declare function refreshSessionFacts(sessionId: string): void; /** * Asks only for the usage figures, cheap enough to run once per message. * * `refreshSessionFacts` costs three round trips because it also re-reads the * state and the command list, and neither of those changes mid-turn. */ export declare function refreshSessionStats(sessionId: string): void; /** Asks what the model picker lists; Pi's answer depends on the current model. The picker opens on sessions that are not connected. */ export declare function loadModelChoices(sessionId?: string | null): void; /** * Switches the model, then re-reads the facts Pi adjusts alongside it: the * thinking level gets clamped to what the new model accepts, and the level * list changes with it. */ export declare function selectModel(provider: string, modelId: string, sessionId?: string | null): void; /** Read back server state rather than optimistically enabling priority. */ export declare function selectFastMode(enabled: boolean, sessionId?: string | null): void; /** Locking aborts a running local turn; the snapshot reports the new state back. */ export declare function setAgentLock(locked: boolean, sessionId?: string | null): void; /** The set reply carries nothing back, so get_state is what updates the chip. */ export declare function selectThinkingLevel(level: string, sessionId?: string | null): void; /** Sends a prompt, or steers an active run. Only non-journaled actions get a local echo. */ export declare function submitMessage(text: string, images?: RpcImage[], sessionId?: string | null): void; /** The composer retains its draft until the server acknowledges admission. */ export declare function submitMessageWithAck(text: string, images?: RpcImage[], sessionId?: string | null): Promise; export declare function rewindToMessage(itemId: string, sessionId?: string | null): void; export declare function queueFollowUp(text: string, images?: RpcImage[], sessionId?: string | null): void; /** A queued submission is acknowledged by the server; consumption is a later lifecycle event. */ export declare function queueFollowUpWithAck(text: string, images?: RpcImage[], sessionId?: string | null): Promise; export declare function clearQueuedMessages(sessionId?: string | null): Promise; /** Requests server-owned removal; the authoritative snapshot removes the row on success. */ export declare function deleteQueuedMessage(id: string, _knownQueueCount: number, sessionId?: string | null): Promise; /** The caller captures the active target at click time; absent means expected idle. */ export declare function promoteQueuedMessage(id: string, operationId?: string, sessionId?: string | null): Promise; export declare function resumeQueuedMessages(sessionId?: string | null): Promise; /** * Renames the session where the name actually lives: in the agent. Pi keeps * it in the session file and reports it back through get_state, which is * what the hub folds into every page's rail card. */ export declare function renameSession(name: string, sessionId?: string | null): void; export declare function abortRun(sessionId?: string | null): void; export declare function runCommand(name: string, sessionId?: string | null): void; export declare function answerDialogValue(id: string, value: string, sessionId?: string | null): void; export declare function answerDialogConfirm(id: string, confirmed: boolean, sessionId?: string | null): void; export declare function cancelDialog(id: string, sessionId?: string | null): void; //#endregion //# sourceMappingURL=sessionStore.d.mts.map