export interface AiAttachment { id: string; name: string; size: number; sha256: string; } export interface AiOperation { action: string; target?: Record; params?: Record; query?: Record; attachmentId?: string; } export interface AiCapability { action: string; label: string; kind: 'read' | 'write'; dangerous: boolean; schema: Record; sensitiveFields: string[]; } export interface AiExecutionRequest { method: 'POST' | 'PUT' | 'PATCH' | 'DELETE'; path: string; query: Record; body: Record; attachmentId?: string; sha256?: string; } export interface AiPlanStep extends AiOperation { id: string; label: string; status: 'draft' | 'prepared' | 'confirmed' | 'running' | 'succeeded' | 'failed' | 'blocked'; summary: string; dangerous: boolean; sensitiveFields: string[]; before?: unknown; preview?: unknown; result?: unknown; error?: string; request?: AiExecutionRequest; } export interface AiConversationRequest { supersedesTaskId?: string; conversationId?: string; text: string; classId?: string; messages?: { role: 'user' | 'assistant'; content: string }[]; attachments?: AiAttachment[]; } export interface AiConversationResult { questions?: { id: string; text: string; options?: string[] }[]; planId: string | null; message: string; steps: AiPlanStep[]; results: { action: string; label: string; data: unknown; operation?: AiOperation }[]; } export interface AiTaskDto { classId?: string; conversationId?: string | null; turnNumber?: number; id: string; state: string; text: string; events: AiAgentEvent[]; result?: AiConversationResult; error?: string; } export type AiReasoningEffort = 'auto' | 'none' | 'low' | 'medium' | 'high' | 'max'; export interface AiModelInfo { id: string; name: string; efforts: AiReasoningEffort[]; } export type AiAgentEvent = | { type: 'status'; message: string } | { type: 'message'; text: string } | { type: 'result'; result: AiConversationResult } | { type: 'error'; code: string; message: string; retryable: boolean };