export interface AiGenerateInput {
  messages: Array<{ role: 'system' | 'user' | 'assistant'; content: string }>;
  model: string;
  temperature?: number;
  maxTokens?: number;
  responseFormat?: { type: 'json_object' } | { type: 'text' };
  signal?: AbortSignal;
}

export interface AiGenerateOutput {
  rawText: string;
  usage: {
    model: string;
    inputTokens: number;
    outputTokens: number;
  };
  latencyMs: number;
}

export interface StreamChunk {
  type: 'thinking' | 'content' | 'error' | 'done';
  content?: string;
  usage?: { inputTokens: number; outputTokens: number };
}

export interface AiProvider {
  readonly name: string;
  generate(input: AiGenerateInput): Promise<AiGenerateOutput>;
  generateStream?(input: AiGenerateInput): AsyncGenerator<StreamChunk, void, undefined>;
}
