/** * Message and communication block types * Dependencies: Core (Usage) */ import type { Usage } from "./core.js"; export declare enum MessageSource { USER = "user", HOOK = "hook" } export interface Message { id: string; role: "user" | "assistant"; blocks: MessageBlock[]; timestamp: string; usage?: Usage; additionalFields?: Record; isMeta?: boolean; } export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | BangBlock | CompactBlock | ReasoningBlock | FileHistoryBlock | TaskNotificationBlock; export interface TextBlock { type: "text"; content: string; customCommandContent?: string; source?: MessageSource; stage?: "streaming" | "end"; } export interface ErrorBlock { type: "error"; content: string; } export interface ToolBlock { type: "tool"; parameters?: string; result?: string; shortResult?: string; startLineNumber?: number; images?: Array<{ data: string; mediaType?: string; }>; id?: string; name?: string; /** * Tool execution stage: * - 'start': Tool call initiated (from AI service streaming) * - 'streaming': Tool parameters being streamed (from AI service) * - 'running': Tool execution in progress (from AI manager) * - 'end': Tool execution completed (from AI manager) */ stage: "start" | "streaming" | "running" | "end"; success?: boolean; error?: string | Error; compactParams?: string; parametersChunk?: string; isManuallyBackgrounded?: boolean; timestamp?: number; } export interface ImageBlock { type: "image"; imageUrls?: string[]; } export interface BangBlock { type: "bang"; command: string; output: string; stage: "running" | "end"; exitCode: number | null; } export interface CompactBlock { type: "compact"; content: string; } export interface ReasoningBlock { type: "reasoning"; content: string; stage?: "streaming" | "end"; startTime?: number; endTime?: number; } export interface FileHistoryBlock { type: "file_history"; snapshots: import("./reversion.js").FileSnapshot[]; } export interface TaskNotificationBlock { type: "task_notification"; taskId: string; taskType: "shell" | "agent" | "workflow"; status: "completed" | "failed" | "killed" | "aborted"; summary: string; outputFile?: string; }