import { M as Message, m as StreamEvent } from '../types-CHPP16pW.js'; type BrowserRuntimeEvent = { type: "session.created" | "session.resumed" | "session.cleared"; sessionId?: string; } | { type: "message.started"; idempotencyKey: string; } | { type: "message.completed"; idempotencyKey: string; executionId?: string; } | { type: "message.failed"; idempotencyKey: string; error: BrowserChatError; } | { type: "feedback.submitted"; executionId: string; value: 1 | -1; } | { type: "token.refreshed"; expiresAt: number; }; interface BrowserMessageContext { [key: string]: unknown; } interface BrowserRuntimeMessage { /** Text stored in chat history and displayed after a resume. */ content: string; /** Structured, untrusted page context supplied separately to the agent. */ context?: BrowserMessageContext; /** Stable key used when the same request must be retried. */ idempotencyKey?: string; } interface BrowserRuntimeConfig { /** Public browser-only API key. Never pass a management/provider key. */ apiKey: string; agentId: string; baseUrl?: string; workspaceId?: string; title?: string; metadata?: Record; /** Enable anonymous visitor attribution across browser chat sessions. Defaults to false. */ visitorTracking?: boolean; /** Optional anonymous end-user ID used only for trace attribution. */ visitorId?: string; /** Maximum lifetime of the browser visitor ID in seconds. Defaults to 90 days. */ visitorMaxAge?: number; persistSession?: boolean; sessionMaxAge?: number; /** Override the localStorage namespace without changing authorization. */ storageKey?: string; /** Coordinates one resumable session between same-origin tabs. Defaults to true. */ coordinateTabs?: boolean; /** Host-owned observability hook; the runtime never sends analytics elsewhere. */ onEvent?: (event: BrowserRuntimeEvent) => void; } interface BrowserSessionSnapshot { sessionId: string; resumeToken: string; lastActivityAt: number; } interface BrowserSessionResponse { id?: string; session_id?: string; agent_id?: string; title?: string; resume_token?: string; visitor_id?: string; created_at?: string; } declare class BrowserChatError extends Error { readonly status: number; readonly retryable: boolean; constructor(message: string, status: number, retryable?: boolean); } interface BrowserChatRuntime { readonly sessionId: string; createSession(title?: string): Promise; hydrate(): Promise; listMessages(): Promise; sendMessageStream(message: BrowserRuntimeMessage, signal?: AbortSignal): AsyncGenerator; newSession(): Promise; /** Forget the cross-session visitor identity without affecting the active chat. */ clearVisitor(): void; submitFeedback(executionId: string, value: 1 | -1): Promise; disconnect(): void; } declare function createBrowserChatRuntime(config: BrowserRuntimeConfig): BrowserChatRuntime; export { BrowserChatError, type BrowserChatRuntime, type BrowserMessageContext, type BrowserRuntimeConfig, type BrowserRuntimeEvent, type BrowserRuntimeMessage, type BrowserSessionSnapshot, createBrowserChatRuntime };