import { AgentEngineType } from '../../value-objects/agent-engine-type.vo';

export interface AgentEnginePort {
  readonly engineType: AgentEngineType;
  executeTask(params: EngineTaskParams): AsyncGenerator<EngineStreamEvent>;
  cancelTask(sessionId: string): Promise<void>;
  continueSession(sessionId: string, message: string): AsyncGenerator<EngineStreamEvent>;
  healthCheck(): Promise<boolean>;
}

export interface EngineTaskParams {
  sessionId: string;
  prompt: string;
  systemPrompt: string;
  allowedTools: string[];
  maxTurns: number;
  maxBudgetUsd?: number;
  context?: Record<string, unknown>;
  skill?: { name: string; arguments: string };
}

export type EngineStreamEvent =
  | { type: 'thinking'; content: string }
  | { type: 'text'; content: string }
  | { type: 'tool_use'; toolName: string; input: Record<string, unknown> }
  | { type: 'tool_result'; toolName: string; output: string; isError: boolean }
  | { type: 'approval_required'; command: string; riskLevel: number; taskId: string }
  | { type: 'completed'; summary: string; tokensUsed?: number }
  | { type: 'error'; message: string; code: string };
