// Single source of truth for cross-app message metadata contracts. // ErrorReason + MessageMetadata: sentinel shapes stored in messages.metadata // and carried on WS frames. AgentSessionConfig: the required/nullable shape // used by CoderPane/AgentComposerBar for provider dispatch. 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; threshold: number; } | { kind: 'mistake_recovery'; failure_kinds: string[]; count: number; escalated: boolean; can_continue?: boolean; } | { kind: 'error'; error_reason: ErrorReason; error_text: 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; }