
export type ErrorReason =
  | 'llm_provider_error'
  | 'tool_execution_failed'
  | 'summary_after_cap_failed';

export type MessageMetadata =
  | {
      kind: 'cap_hit';
      used: number;
      limit: number;
      agent_name: string | null;
      can_continue: boolean;
    }
  | {
      kind: 'doom_loop';
      tool_name: string;
      args: Record<string, unknown>;
      threshold: number;
    }
  | {
      kind: 'mistake_recovery';
      failure_kinds: string[];
      count: number;
      escalated: boolean;
      can_continue?: boolean;
    }
  | {
      kind: 'error';
      error_reason: ErrorReason;
      error_text: string;
    }
  | {
      kind: 'feedback';
      value: 'up' | 'down';
      chat_id: string;
    };

// Unified definition is the web required/nullable shape (the coder's all-optional
// copy was dead — zero importers in apps/coder/src).
export interface AgentSessionConfig {
  provider: string;
  model: string;
  modeId: string | null;
  thinkingOptionId: string | null;
}
