import type { OwnershipScope, SessionRecord } from "./contracts.js"; /** Conversation thread lifecycle state. Archive is soft; deletion goes through persistence lifecycle. */ export type ConversationThreadState = "active" | "archived"; /** Well-known `SessionRecord.metadata` key marking conversation threads. */ export declare const CONVERSATION_METADATA_KEY = "prismConversation"; export declare const DEFAULT_MAX_CONVERSATION_CURSOR_BYTES: number; export declare const HARD_MAX_CONVERSATION_CURSOR_BYTES: number; export interface ConversationBranchRef { readonly leafId: string; readonly createdAt: string; } /** * Durable user-scoped conversation thread. A thread is an ownership-scoped session * branch plus metadata; content lives in session entries and the redacted event ledger. */ export interface ConversationThread extends OwnershipScope { readonly id: string; readonly title?: string; readonly state: ConversationThreadState; readonly createdAt: string; readonly updatedAt: string; /** Branch leaves recorded by the conversation service; the entry tree remains the content source of truth. */ readonly branches: readonly ConversationBranchRef[]; /** CAS write version (stored `SessionRecord.version`); undefined on legacy rows. */ readonly version?: number; /** Host-supplied create metadata; never credentials or raw transcripts. */ readonly metadata?: Readonly>; } /** Opaque thread-bound replay cursor; prevents replaying a cursor minted for another thread. */ export interface ConversationReplayCursor { readonly v: 1; readonly threadId: string; /** Opaque store keyset cursor; undefined means the start of the thread. */ readonly cursor?: string; } export declare class ConversationError extends Error { readonly reason: string; readonly code = "ERR_PRISM_CONVERSATION"; constructor(message: string, reason: string); } export declare function encodeConversationReplayCursor(cursor: ConversationReplayCursor): string; export declare function decodeConversationReplayCursor(encoded: string, expectedThreadId: string, maxBytes?: number): ConversationReplayCursor; /** Project a persisted session record into a conversation thread. Undefined for non-conversation sessions. */ export declare function conversationThreadFromRecord(record: SessionRecord): ConversationThread | undefined; /** Serialize conversation marker metadata for `SessionRecord.metadata`. */ export declare function conversationMarkerMetadata(marker: { readonly title?: string; readonly state: ConversationThreadState; readonly branches?: readonly ConversationBranchRef[]; readonly requestId?: string; readonly metadata?: Readonly>; }): Readonly>;