import type { AgentChatEvent } from "./types.js"; export interface PersistAgentTurnToThreadInput { threadId: string; /** Must own the thread: this writes into a thread found only by id. */ ownerEmail: string; /** When set, must match the thread's organization. */ orgId?: string | null; /** The user message that started the turn. */ prompt: string; runId: string; /** Defaults to `runId`. */ turnId?: string; /** Epoch ms; stamps the reply with how long the run took. */ startedAt?: number; /** What the run's `send` received, in order. */ events: readonly AgentChatEvent[]; /** Replaces the thread's title when non-empty. */ threadTitle?: string; /** Saved as a terminal error on the reply when the run failed outside the loop. */ persistFailure?: { message: string; errorCode: string; }; } /** * `runAgentLoop` streams a turn to `send` but never writes the thread, so a * turn run directly leaves `thread_data` empty. This saves the prompt and the * reply the events describe, which is what opening the thread shows. */ export declare function persistAgentTurnToThread(input: PersistAgentTurnToThreadInput): Promise;