import type { Interaction, RespondToInteractionRequest, SessionTranscriptMessage, SessionTranscriptTurn } from "./api/index.js"; import type { Client, InvokeAgentOptions, TranscriptUpdate, WatchSessionTranscriptOptions } from "./client.js"; import type { SessionTranscript } from "./transcript.js"; export type SessionChatPhase = "queued" | "running" | "waiting"; export interface SessionChatCallbacks { /** Fires whenever a message first appears or its folded content changes. */ onMessage?: (message: SessionTranscriptMessage, transcript: SessionTranscript) => void; /** Fires when the current active chat phase changes. */ onPhase?: (phase: SessionChatPhase | null, turn: SessionTranscriptTurn | null, transcript: SessionTranscript) => void; /** Fires for every new or changed interaction, including terminal upserts. */ onInteraction?: (interaction: Interaction, transcript: SessionTranscript) => void; /** * Fires only when a previously observed pending interaction transitions to * a terminal status. A terminal interaction first seen after reconnect is * reported through onInteraction only. */ onInteractionResolved?: (interaction: Interaction, transcript: SessionTranscript) => void; } export interface SessionChatUpdate extends TranscriptUpdate { phase: SessionChatPhase | null; pendingInteractions: Interaction[]; } /** * High-level embedded-chat protocol: invoke an agent, follow the canonical v2 * transcript through reconnects/rotations, observe human-input interactions, * and respond without implementing frame dispatch or polling. */ export declare class SessionChat { #private; constructor(client: Client, callbacks?: SessionChatCallbacks); /** Invoke and follow one turn until it settles. */ send(input: InvokeAgentOptions, opts?: { signal?: AbortSignal; }): AsyncGenerator; /** Follow an existing session; reconnect, rotate, idle, and cursor handling are managed by the client. */ watch(sessionId: string, opts?: WatchSessionTranscriptOptions): AsyncGenerator; /** Respond to a pushed interaction. The stream remains authoritative. */ respond(interactionId: string, input: RespondToInteractionRequest): Promise; } //# sourceMappingURL=chat.d.ts.map