// Copyright (C) 2025 Keygraph, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License version 3 // as published by the Free Software Foundation. // Type definitions for Claude executor message processing pipeline import type { SDKAssistantMessageError } from '@anthropic-ai/claude-agent-sdk'; export interface ExecutionContext { isParallelExecution: boolean; useCleanOutput: boolean; agentType: string; agentKey: string; } export interface AssistantResult { content: string; cleanedContent: string; apiErrorDetected: boolean; shouldThrow?: Error; logData: { turn: number; content: string; timestamp: string; }; } export interface ResultData { result: string | null; cost: number; duration_ms: number; subtype?: string; stop_reason?: string | null; permissionDenials: number; } export interface ToolUseData { toolName: string; parameters: Record; timestamp: string; } export interface ToolResultData { content: unknown; displayContent: string; timestamp: string; } export interface ContentBlock { type?: string; text?: string; } export interface AssistantMessage { type: 'assistant'; error?: SDKAssistantMessageError; message: { content: ContentBlock[] | string; }; } export interface ResultMessage { type: 'result'; result?: string; total_cost_usd?: number; duration_ms?: number; subtype?: string; stop_reason?: string | null; permission_denials?: unknown[]; } export interface ToolUseMessage { type: 'tool_use'; name: string; input?: Record; } export interface ToolResultMessage { type: 'tool_result'; content?: unknown; } export interface ApiErrorDetection { detected: boolean; shouldThrow?: Error; } export interface SystemInitMessage { type: 'system'; subtype: 'init'; model?: string; permissionMode?: string; mcp_servers?: Array<{ name: string; status: string }>; } export interface UserMessage { type: 'user'; }