import type { AdminUser, IAdminForth } from "adminforth"; import type { ChatSurfaceIncomingMessage } from "adminforth"; import type { PreviousUserMessage } from "../domain/languageDetect.js"; import type { PluginOptions } from "../types.js"; export declare const AGENT_SYSTEM_TURN_PROMPT = "__adminforth_system_message__"; export declare const STEER_PROMPT_MARKER = "__adminforth_steer__:"; export declare class AgentSessionStore { private getAdminforth; private options; constructor(getAdminforth: () => IAdminForth, options: PluginOptions); createNewTurn(sessionId: string, prompt: string, response?: string): Promise; createSystemTurn(sessionId: string, systemMessage: string): Promise; /** * Append a mid-turn steer to the current (running) turn's prompt instead of creating a * new record. Targets the latest non-system turn so a steer attaches to the real * conversation turn, never an audio/system note. */ appendSteerToCurrentTurn(sessionId: string, steerText: string): Promise; getSessionTurns(sessionId: string): Promise<{ id: any; prompt: any; response: any; }[]>; /** * Ordered non-system (real conversation) turns with their stored checkpoint id. * Used by message editing to locate the target turn and its previous turn's * fork point. Stable order (`createdAt ASC, id ASC`) so positions never drift. */ getAgentTurns(sessionId: string): Promise<{ id: any; prompt: any; response: any; checkpointId: string | null; }[]>; /** * Apply a message edit and branch: replace the edited turn's prompt and truncate * everything after it. Deletes later turns FIRST, then updates the edited turn, so * an interruption can only leave a consistent "truncated, edit-not-yet-applied" * state (recoverable by retry) — never "edited but stale later turns remain". * (AdminForth's resource API has no transactions, hence the deliberate ordering.) */ editTurnAndTruncateAfter(input: { sessionId: string; turnId: string; newPrompt: string; }): Promise; getPreviousUserMessages(sessionId: string): Promise; getLatestTurn(sessionId: string): Promise; getChatSurfaceSessionId(incoming: ChatSurfaceIncomingMessage): string; getOrCreateChatSurfaceSession(incoming: ChatSurfaceIncomingMessage, adminUser: AdminUser): Promise; touchSession(sessionId: string): Promise; saveTurnResponse(input: { turnId: string; responseText: string; debugHistory?: unknown; /** * Tip checkpoint id for this turn. Persisted only when provided AND the field is * configured — so aborted/failed turns (which pass undefined) never overwrite it * with a stale value. */ checkpointId?: string | null; }): Promise; getResumeState(sessionId: string): Promise<{ turnId: string; initialResponse: string; }>; }