import { AssistantRawMessage, AssistantWidgetMessage } from './types'; export declare function getRawMessageCreatedAt(message: AssistantRawMessage): number; export declare function getAssistantText(parts: AssistantRawMessage['parts']): string; /** * Render inbound non-text parts (an image or file the agent returned) as * markdown, so any renderer already handling the text channel displays them with * no extra plumbing: images become `![name](src)`, files become `[name](src)`. * * Bytes may arrive by reference (`url`) or inline (`data`, bare base64); inline * image bytes become a `data:` URL. Today's agent emits `text | tool` only, so * this returns `[]` and nothing downstream changes. * * Everything interpolated here is UNTRUSTED — it reaches us from a model that * has read tool output, web pages and user uploads — so the label is escaped and * the source is protocol-checked. A part we cannot render safely is DROPPED. */ export declare function getAssistantMedia(parts: AssistantRawMessage['parts']): string[]; /** * One line per tool part: `": "`, with `" · "` appended * when the agent said what it was doing. * * ★★ APPENDED, not substituted. `parseToolActivity` puts the text after the verb * into `step.tool` — which is what the collapsed "Details" row renders and what * `step.id` is keyed on — so replacing the tool name with the description would * blank the only place the raw tool is visible, and churn the React key (and the * preview rail's follow-the-run logic, which tracks steps by id) on every poll * where the wording changed. */ export declare function getToolProgress(parts: AssistantRawMessage['parts']): string[]; /** * Reduce the assistant messages created at/after `sinceMs` into display content + * a done flag. Done ⇔ the newest assistant message has `info.time.completed` and * carries either text or tool progress. */ /** * Per-reduction behaviour a MODE may ask for. Every field is optional and every * default reproduces today's output byte for byte — this reducer is what every * product wrapping the shared transport renders through, so a behaviour change * here is a behaviour change for all of them at once. */ export interface AssistantProgressOptions { /** * Join this run's narration across ALL of its messages, oldest first, instead * of reporting only the newest one (BC1, BOFF-7334). * * ★★ Why it is opt-in. The agent grows text parts INSIDE one message, so * content grows while it stays in message N — and the instant it opens message * N+1, everything narrated in messages 1..N disappears on the next poll. A * consumer that harvests entity links out of that prose loses every link * printed before the current message. But latest-only is what every existing * product renders today, so only a mode that asks for accumulation gets it. * * ★★ It changes what is STORED, not just what is shown: the orchestrator * persists this content as the turn's answer, so an accumulating mode keeps a * running account of the build rather than a final reply — and that is what * Copy, Export and read-aloud will carry. Correct for a mode whose answer IS * the build; wrong for a conversational one. Hence per mode, never global. */ readonly accumulateNarration?: boolean; } export declare function buildProgress(messages: AssistantRawMessage[], sinceMs: number, options?: AssistantProgressOptions): { content: string; done: boolean; }; /** Redact credentials that might leak into a rendered answer. */ export declare function sanitize(response: string): string; /** * Cloudflare's sandbox proxy emits this exact connection-refused copy after a * sandbox has been reaped but its control-plane record still looks RUNNING. * Keep this deliberately narrow: replaying an arbitrary timeout can duplicate * a prompt whose first attempt actually reached the model. */ export declare function isReapedSandboxConnectionError(error: unknown): boolean; /** Whether an error is worth one retry from a clean runtime (union of fleet fragments). */ export declare function isRecoverable(error: unknown): boolean; /** * Upsert delta messages into an accumulator keyed by message id. Correct against * BOTH a `?since=` delta (a few messages) and an old agent that returns the full * window (upsert is idempotent), so enabling the delta param is always safe. */ export declare function mergeMessagesById(accumulator: AssistantRawMessage[], incoming: AssistantRawMessage[]): AssistantRawMessage[]; /** Map raw session messages to widget history, dropping injected-context noReply turns. */ export declare function mapSessionToHistory(messages: AssistantRawMessage[]): AssistantWidgetMessage[]; //# sourceMappingURL=progress.d.ts.map