import type { EventBus } from '../../events/index.js'; import type { ConversationHistoryRepo, InteractionKind, InteractionStatus, InteractionPayload, InteractionResult, InteractionResolvedVia } from '../../store/conversation-history-repo.js'; /** Shared pending TTL — matches hook-bridge / ask-user TTLs (30 minutes). */ export declare const INTERACTION_TTL_MS: number; export interface InteractionIndexEntry { id: string; sessionId: string; channel: string; kind: InteractionKind; status: InteractionStatus; payload: InteractionPayload; createdAt: number; } interface HistoryDep { appendInteractionCreated: ConversationHistoryRepo['appendInteractionCreated']; appendInteractionResolved: ConversationHistoryRepo['appendInteractionResolved']; } export declare function buildCreatedText(kind: InteractionKind, payload: InteractionPayload): string; export declare function buildResolvedText(kind: InteractionKind, status: InteractionStatus, result?: InteractionResult): string; /** Legacy-compatible subtype for display (old clients render InteractionRow off this). */ export declare function deriveSubtype(kind: InteractionKind, status: InteractionStatus): string; export declare class InteractionRecords { private index; private history; private bus; /** Called once from app.ts during startup. */ init(deps: { history: HistoryDep; bus: EventBus; }): void; /** Register + persist a new pending interaction, then broadcast its arrival. */ create(args: { id: string; sessionId: string; channel: string; kind: InteractionKind; payload: InteractionPayload; }): Promise; /** Move a pending interaction to a terminal status. First-writer-wins. */ resolve(args: { id: string; status: Exclude; result?: InteractionResult; resolvedVia: InteractionResolvedVia; }): Promise<'resolved' | 'already-resolved' | 'unknown'>; /** Resolve every pending interaction on a channel (e.g. `!new` → cancelled). */ resolvePendingByChannel(channel: string, status: Exclude, resolvedVia: InteractionResolvedVia): Promise; get(id: string): InteractionIndexEntry | null; /** Liveness signal for read-time derivation: true only for a live, un-expired pending entry. */ isPending(id: string): boolean; /** All live pending interactions for a channel (payload included, TTL-filtered). */ getPendingByChannel(channel: string): InteractionIndexEntry[]; private publish; /** Drop terminal entries older than the retention window (bounded memory). */ private prune; _testReset(): void; } export declare const interactionRecords: InteractionRecords; export {};