import type { ContentBlock, PendingQuestionRef, RunTiming, ToolBridgeContent } from "./projection"; import type { ContextProjectionData } from "./context"; export interface TextContentPart { type: "text"; text: string; } export interface ImageUrlContentPart { type: "image_url"; image_url: { url: string; source_path?: string; width?: number; height?: number; }; } export interface FileContentPart { type: "file"; name: string; data: string; } export type MessageContentPart = TextContentPart | ImageUrlContentPart | FileContentPart; export type MessageContent = string | MessageContentPart[]; export interface ToolCallInfo { id: string; name: string; display_name?: string | null; arguments: string; result?: unknown; status?: "pending" | "done" | "error" | "cancelled" | "awaiting_answer"; duration_ms?: number | null; pending_question_ref?: PendingQuestionRef | null; } export type { ToolBridgeContent }; /** Derive tool status from the result content string. */ export declare function inferToolStatus(resultStr: string): "done" | "error" | "cancelled"; export interface MemoryRefInfo { id: number; content_preview: string; skill_name?: string | null; } export interface CompactionInfo { compaction_id: string; summary_preview?: string | null; summary_full?: string | null; archived_count?: number | null; archived_files?: ArchivedFileInfo[] | null; archived_tool_calls?: ArchivedToolCallInfo[] | null; tokens_before?: number | null; tokens_after?: number | null; saved_ratio?: number | null; trigger?: "auto" | "manual" | "forced_retry" | null; failure_reason?: string | null; fallback_applied?: boolean | null; } export interface ArchivedFileInfo { tool_name?: string | null; filename?: string | null; relative_path?: string | null; size_bytes?: number | null; } export interface ArchivedToolCallInfo { tool_call_id?: string | null; tool_name?: string | null; archive_path?: string | null; replacement_content?: string | null; entry_id?: string | null; } export interface ChatMessage { role: "user" | "assistant" | "tool" | "error"; content: MessageContent; reasoning?: string; tool_calls?: ToolCallInfo[]; status?: "streaming" | "completed" | "paused" | "failed" | "interrupted"; duration_ms?: number; chat_run?: RunTiming | null; timestamp?: string; entry_id?: string; /** Stable React key retained when an optimistic user message is confirmed. */ render_id?: string; parent_id?: string | null; loop_name?: string; /** Entry kind from backend -- present for non-message entries like mode changes. */ kind?: string; /** Memory references injected into this turn's context */ memory_refs?: MemoryRefInfo[]; /** Raw projection blocks for block-level UI rendering. */ blocks?: ContentBlock[]; /** Compaction metadata for compaction turns. */ compaction?: CompactionInfo; /** Sourced Context metadata for rendering or headless consumers. */ context?: ContextProjectionData; }