/* Auto-generated from Pydantic models - DO NOT EDIT */

/**
 * 授權請求狀態機
 *
 * PENDING → APPROVED → EXECUTION_SUCCESS
 *                   → EXECUTION_FAILED
 * PENDING → REJECTED
 * PENDING → EXPIRED
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ApprovalStatus".
 */
export type ApprovalStatus = "pending" | "approved" | "rejected" | "expired" | "execution_success" | "execution_failed";
export type AffectedPods = number;
export type EstimatedDowntime = string;
export type RelatedServices = string[];
/**
 * 資料影響類型
 */
export type DataImpact = "none" | "read_only" | "write" | "destructive";
/**
 * 資料影響類型
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "DataImpact".
 */
export type DataImpact1 = "none" | "read_only" | "write" | "destructive";
export type Name = string;
export type Passed = boolean;
export type Message = string | null;
/**
 * 風險等級 - 決定所需簽核人數
 *
 * - LOW: 0 人，自動放行
 * - MEDIUM: 需 1 人簽核
 * - HIGH: 需 1 人簽核 (信任引擎可降級至 MEDIUM)
 * - CRITICAL: 需 2 人 Multi-Sig 雙重簽核 (永不降級)
 *
 * 變更紀錄:
 * - 2026-03-25: 新增 HIGH (Phase 16 R2 合併自 trust_engine.py)
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "RiskLevel".
 */
export type RiskLevel = "low" | "medium" | "high" | "critical";
export type Id = string;
/**
 * 簽核者 ID
 */
export type SignerId = string;
/**
 * 簽核者名稱
 */
export type SignerName = string;
export type SignedAt = string;
export type Comment = string | null;
/**
 * 簽核來源通道 (web/telegram/api/system)
 */
export type SignatureSource = "web" | "telegram" | "api" | "system";
/**
 * Telegram User ID (永久追溯憑證)
 */
export type TelegramUserId = number | null;
/**
 * Telegram 訊息 ID
 */
export type TelegramMessageId = number | null;
/**
 * 簽核來源通道 (Phase 5.4.5: AuditLog 擴充)
 *
 * 用於追溯簽核是從哪個通道發起
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "SignatureSource".
 */
export type SignatureSource1 = "web" | "telegram" | "api" | "system";
/**
 * 執行動作描述
 */
export type Action = string;
/**
 * 詳細說明
 */
export type Description = string;
/**
 * 風險等級
 */
export type RiskLevel1 = "low" | "medium" | "high" | "critical";
export type DryRunChecks = DryRunCheck[];
/**
 * 請求發起者
 */
export type RequestedBy = string;
/**
 * 到期時間
 */
export type ExpiresAt = string | null;
/**
 * 額外元資料
 */
export type Metadata = {
  [k: string]: unknown;
} | null;
export type Id1 = string;
/**
 * 授權請求狀態機
 *
 * PENDING → APPROVED → EXECUTION_SUCCESS
 *                   → EXECUTION_FAILED
 * PENDING → REJECTED
 * PENDING → EXPIRED
 */
export type ApprovalStatus1 =
  | "pending"
  | "approved"
  | "rejected"
  | "expired"
  | "execution_success"
  | "execution_failed";
/**
 * 所需簽核數
 */
export type RequiredSignatures = number;
export type Signatures = Signature[];
export type CreatedAt = string;
export type UpdatedAt = string;
/**
 * 解決時間
 */
export type ResolvedAt = string | null;
export type RejectionReason = string | null;
/**
 * 告警指紋 Hash
 */
export type Fingerprint = string | null;
/**
 * 聚合觸發次數
 */
export type HitCount = number;
/**
 * 最後觸發時間
 */
export type LastSeenAt = string;
/**
 * 執行動作描述
 */
export type Action1 = string;
/**
 * 詳細說明
 */
export type Description1 = string;
/**
 * 風險等級
 */
export type RiskLevel2 = "low" | "medium" | "high" | "critical";
export type DryRunChecks1 = DryRunCheck[];
/**
 * 請求發起者
 */
export type RequestedBy1 = string;
/**
 * 到期時間
 */
export type ExpiresAt1 = string | null;
/**
 * 額外元資料
 */
export type Metadata1 = {
  [k: string]: unknown;
} | null;
export type Id2 = string;
export type Action2 = string;
export type Description2 = string;
export type DryRunChecks2 = DryRunCheck[];
export type RequiredSignatures1 = number;
export type CurrentSignatures = number;
export type Signatures1 = Signature[];
export type RequestedBy2 = string;
export type CreatedAt1 = string;
export type ExpiresAt2 = string | null;
export type ResolvedAt1 = string | null;
export type Fingerprint1 = string | null;
export type HitCount1 = number;
export type LastSeenAt1 = string | null;
export type Metadata2 = {
  [k: string]: unknown;
} | null;
export type Count = number;
export type Approvals = ApprovalRequestResponse[];
/**
 * 退回者 ID
 */
export type RejectorId = string;
/**
 * 退回者名稱
 */
export type RejectorName = string;
/**
 * 退回原因
 */
export type Reason = string;
/**
 * 簽核者 ID
 */
export type SignerId1 = string;
/**
 * 簽核者名稱
 */
export type SignerName1 = string;
/**
 * 簽核備註
 */
export type Comment1 = string | null;
export type Success = boolean;
export type Message1 = string;
/**
 * 是否觸發執行 (當簽核數滿足時)
 */
export type ExecutionTriggered = boolean;
/**
 * 觸發此推論的告警 ID 列表
 */
export type InputSignalIds = string[];
/**
 * 從記憶中檢索的上下文摘要
 */
export type ContextRetrieved = string[];
/**
 * 使用的 AI 模型 (如 ollama/llama3.2:latest, gemini/gemini-pro)
 */
export type ModelUsed = string;
/**
 * Prompt 模板版本號
 */
export type PromptTemplateVersion = string;
/**
 * AI 的根因推論
 */
export type Hypothesis = string;
/**
 * 信心指數 (0.0 - 1.0)
 */
export type Confidence = number;
/**
 * 推理步驟 (可解釋性)
 */
export type ReasoningSteps = string[];
/**
 * 可能的根本原因列表
 */
export type ProbableRootCauses = string[];
/**
 * 推論開始時間
 */
export type InferenceStartedAt = string;
/**
 * 推論完成時間
 */
export type InferenceCompletedAt = string;
/**
 * 推論延遲 (毫秒)
 */
export type LatencyMs = number;
/**
 * 異常簽名 Hash (前 16 字元)
 */
export type AnomalyKey = string;
/**
 * 1 小時內發生次數
 */
export type Count1H = number;
/**
 * 24 小時內發生次數
 */
export type Count24H = number;
/**
 * 7 天內發生次數
 */
export type Count7D = number;
/**
 * 30 天內發生次數
 */
export type Count30D = number;
/**
 * 升級建議 (基於 24h 頻率)
 */
export type EscalationLevel = ("REPEAT" | "ESCALATE" | "PERMANENT_FIX") | null;
/**
 * 自動修復嘗試次數
 */
export type AutoRepairCount = number;
/**
 * 最後一次修復動作
 */
export type LastRepairAction = string | null;
/**
 * 最後一次修復是否成功
 */
export type LastRepairSuccess = boolean | null;
/**
 * 是否已執行修復提案
 */
export type ProposalExecuted = boolean;
/**
 * 執行是否成功 (None = 未執行)
 */
export type ExecutionSuccess = boolean | null;
/**
 * 實際停機時間 (分鐘)
 */
export type ActualDowntimeMinutes = number | null;
/**
 * 人類的文字回饋 (如 '這個建議很準' 或 '下次應該先檢查 X')
 */
export type HumanFeedback = string | null;
/**
 * 有效性評分 (1-5 分)
 */
export type EffectivenessScore = number | null;
/**
 * 是否納入長期記憶 (Episodic Memory)
 */
export type ShouldRemember = boolean;
/**
 * 給未來 AI 的學習筆記
 */
export type LearningNotes = string | null;
/**
 * 事件狀態機
 *
 * INVESTIGATING → MITIGATING → RESOLVED → CLOSED
 *              ↘ (無法解決) → ESCALATED
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "IncidentStatus".
 */
export type IncidentStatus = "investigating" | "mitigating" | "resolved" | "closed" | "escalated";
/**
 * 事件嚴重度 (Incident Severity)
 *
 * 與 RiskLevel 的區別:
 * - Severity: 事件本身的嚴重程度 (P0 最嚴重)
 * - RiskLevel: 修復操作的風險等級 (CRITICAL 最危險)
 *
 * 用於:
 * - AI 分層調用策略 (P0 直接用 Claude，P2/P3 用 Ollama)
 * - SLA 響應時間門檻
 * - 告警通知優先級
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "Severity".
 */
export type Severity = "P0" | "P1" | "P2" | "P3";
/**
 * 信號唯一識別碼 (8 字元)
 */
export type SignalId = string;
/**
 * 告警名稱 (如 HighCPUUsage)
 */
export type AlertName = string;
/**
 * 告警嚴重度
 */
export type Severity1 = "P0" | "P1" | "P2" | "P3";
/**
 * 告警來源
 */
export type Source = "prometheus" | "signoz" | "alertmanager" | "manual" | "telegram";
/**
 * 告警觸發時間
 */
export type FiredAt = string;
/**
 * 告警解除時間
 */
export type ResolvedAt2 = string | null;
/**
 * 告警指紋 Hash，用於去重與聚合
 */
export type Fingerprint2 = string | null;
/**
 * 事件唯一識別碼 (如 INC-20260322-A1B2C3)
 */
export type IncidentId = string;
/**
 * 事件狀態
 */
export type IncidentStatus1 = "investigating" | "mitigating" | "resolved" | "closed" | "escalated";
/**
 * 事件嚴重度
 */
export type Severity2 = "P0" | "P1" | "P2" | "P3";
/**
 * 關聯的告警信號列表
 */
export type Signals = Signal[];
/**
 * 受影響的服務列表 (GraphRAG Blast Radius)
 */
export type AffectedServices = string[];
/**
 * 關聯的 ApprovalRequest ID 列表 (支援多重決策軌跡)
 */
export type ProposalIds = string[];
/**
 * 事件建立時間
 */
export type CreatedAt2 = string;
/**
 * 最後更新時間
 */
export type UpdatedAt1 = string;
/**
 * 事件解決時間
 */
export type ResolvedAt3 = string | null;
/**
 * 事件關閉時間 (含回饋)
 */
export type ClosedAt = string | null;
/**
 * Working Memory TTL (天)
 */
export type TtlDays = number;
/**
 * 是否已固化到 PostgreSQL (Episodic Memory)
 */
export type PersistedToPg = boolean;
/**
 * 是否已向量化到 Vector DB (Semantic Memory)
 */
export type Vectorized = boolean;
export type Signals1 = Signal[];
export type AffectedServices1 = string[];
export type IncidentId1 = string;
export type Signals2 = Signal[];
export type AffectedServices2 = string[];
export type ProposalIds1 = string[];
export type CreatedAt3 = string;
export type UpdatedAt2 = string;
export type ResolvedAt4 = string | null;
export type ClosedAt1 = string | null;
export type AffectedServices3 = string[] | null;
/**
 * 統帥當前所在的路由
 */
export type CurrentPage = string;
/**
 * 正在檢視的實體 ID (incident/approval)
 */
export type FocusedEntityId = string | null;
/**
 * 統帥輸入的原始指令或意圖
 */
export type Intent = string;
/**
 * 現有 Session ID (用於續傳)
 */
export type SessionId = string | null;
/**
 * Session UUID
 */
export type SessionId1 = string;
/**
 * SSE 串流訂閱 URL
 */
export type StreamUrl = string;
export type CreatedAt4 = string;
/**
 * Terminal Session 狀態
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalSessionStatus".
 */
export type TerminalSessionStatus = "pending" | "processing" | "completed" | "aborted" | "error";
export type SessionId2 = string;
export type CreatedAt5 = string;
export type LastEventId = number;
export type MessageCount = number;
/**
 * 中斷原因
 */
export type Reason1 = string | null;
export type SessionId3 = string;
export type Aborted = boolean;
export type Message2 = string;
/**
 * 代理人名稱
 */
export type Agent = string;
/**
 * 思考內容
 */
export type Msg = string;
/**
 * 執行類型
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ActionType".
 */
export type ActionType = "kubectl" | "script" | "manual";
/**
 * Playbook 來源
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookSource".
 */
export type PlaybookSource = "extracted" | "manual";
/**
 * Playbook 狀態
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookStatus".
 */
export type PlaybookStatus = "draft" | "approved" | "deprecated";
/**
 * 步驟序號
 */
export type StepNumber = number;
/**
 * 執行命令或操作描述
 */
export type Command = string;
/**
 * 預期結果
 */
export type ExpectedResult = string | null;
/**
 * 回滾命令
 */
export type RollbackCommand = string | null;
/**
 * 是否需要人工審核
 */
export type RequiresApproval = boolean;
/**
 * 風險等級 - 決定所需簽核人數
 *
 * - LOW: 0 人，自動放行
 * - MEDIUM: 需 1 人簽核
 * - HIGH: 需 1 人簽核 (信任引擎可降級至 MEDIUM)
 * - CRITICAL: 需 2 人 Multi-Sig 雙重簽核 (永不降級)
 *
 * 變更紀錄:
 * - 2026-03-25: 新增 HIGH (Phase 16 R2 合併自 trust_engine.py)
 */
export type RiskLevel3 = "low" | "medium" | "high" | "critical";
/**
 * 告警名稱模式 (如 HighCPU*, PodCrash*)
 */
export type AlertNames = string[];
/**
 * 受影響服務模式
 */
export type AffectedServices4 = string[];
/**
 * 適用嚴重度範圍
 */
export type SeverityRange = string[];
/**
 * 關鍵字 (從 annotations 提取)
 */
export type Keywords = string[];
/**
 * Playbook 唯一識別碼
 */
export type PlaybookId = string;
/**
 * Playbook 名稱 (人類可讀)
 */
export type Name1 = string;
/**
 * 問題描述與修復策略摘要
 */
export type Description3 = string;
/**
 * Playbook 狀態
 */
export type PlaybookStatus1 = "draft" | "approved" | "deprecated";
/**
 * Playbook 來源
 */
export type PlaybookSource1 = "extracted" | "manual";
/**
 * 修復步驟列表
 */
export type RepairSteps = RepairStep[];
/**
 * 預估修復時間 (分鐘)
 */
export type EstimatedDurationMinutes = number;
/**
 * 萃取來源的 Incident ID
 */
export type SourceIncidentIds = string[];
/**
 * AI 萃取信心度
 */
export type AiConfidence = number;
/**
 * 成功執行次數
 */
export type SuccessCount = number;
/**
 * 失敗執行次數
 */
export type FailureCount = number;
/**
 * 最後使用時間
 */
export type LastUsedAt = string | null;
/**
 * 核准者
 */
export type ApprovedBy = string | null;
/**
 * 核准時間
 */
export type ApprovedAt = string | null;
/**
 * 標籤
 */
export type Tags = string[];
/**
 * 人工補充說明
 */
export type Notes = string | null;
export type CreatedAt6 = string;
export type UpdatedAt3 = string;
export type SuccessRate = number;
export type IsHighQuality = boolean;
export type Items = PlaybookResponse[];
export type Total = number;
export type Limit = number;
export type Offset = number;
export type Name2 = string;
export type Description4 = string;
/**
 * @minItems 1
 */
export type RepairSteps1 = [RepairStep, ...RepairStep[]];
export type EstimatedDurationMinutes1 = number;
export type Tags1 = string[];
export type Notes1 = string | null;
export type Name3 = string | null;
export type Description5 = string | null;
export type RepairSteps2 = RepairStep[] | null;
export type EstimatedDurationMinutes2 = number | null;
export type Tags2 = string[] | null;
export type Notes2 = string | null;
/**
 * 相似度分數
 */
export type SimilarityScore = number;
/**
 * 匹配的症狀
 */
export type MatchedSymptoms = string[];
/**
 * 推薦原因
 */
export type Reason2 = string;
/**
 * Tool 函數名稱
 */
export type Name4 = string;
/**
 * Tool 參數 (JSON 字串)
 */
export type Arguments = string;
/**
 * Tool Call ID
 */
export type Id3 = string;
/**
 * Tool 類型
 */
export type Type = string;
/**
 * 訊息角色 (assistant/user/system)
 */
export type Role = string;
/**
 * 訊息內容
 */
export type Content = string | null;
/**
 * Tool Calls (僅 assistant)
 */
export type ToolCalls = ToolCall[] | null;
/**
 * 選項索引
 */
export type Index = number;
/**
 * 結束原因 (stop/tool_calls)
 */
export type FinishReason = string | null;
/**
 * 輸入 Token 數
 */
export type PromptTokens = number;
/**
 * 輸出 Token 數
 */
export type CompletionTokens = number;
/**
 * 總 Token 數
 */
export type TotalTokens = number;
/**
 * 回應 ID
 */
export type Id4 = string;
/**
 * 物件類型
 */
export type Object = string;
/**
 * 建立時間戳
 */
export type Created = number;
/**
 * 模型名稱
 */
export type Model = string;
/**
 * 回應選項
 */
export type Choices = NvidiaChoice[];
/**
 * Tool 類型
 */
export type Type1 = string;
/**
 * CSRF Token (64 字元十六進位)
 */
export type Token = string;
/**
 * Cookie 名稱
 */
export type CookieName = string;
/**
 * Header 名稱 (敏感請求時使用)
 */
export type HeaderName = string;

/**
 * Auto-generated from Pydantic models - DO NOT EDIT
 */
export interface AWOOOIAPITypes {
  [k: string]: unknown;
}
/**
 * 爆炸半徑 - 影響範圍評估
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "BlastRadius".
 */
export interface BlastRadius {
  affected_pods?: AffectedPods;
  estimated_downtime?: EstimatedDowntime;
  related_services?: RelatedServices;
  data_impact?: DataImpact;
  [k: string]: unknown;
}
/**
 * Dry-Run 預演檢查結果
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "DryRunCheck".
 */
export interface DryRunCheck {
  name: Name;
  passed: Passed;
  message?: Message;
  [k: string]: unknown;
}
/**
 * 簽核記錄
 *
 * Phase 5.4.5: 新增 Telegram 審計欄位
 * - source: 簽核來源通道
 * - telegram_user_id: Telegram User ID (永久追溯憑證)
 * - telegram_message_id: Telegram 訊息 ID
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "Signature".
 */
export interface Signature {
  id?: Id;
  signer_id: SignerId;
  signer_name: SignerName;
  signed_at?: SignedAt;
  comment?: Comment;
  source?: SignatureSource;
  telegram_user_id?: TelegramUserId;
  telegram_message_id?: TelegramMessageId;
  [k: string]: unknown;
}
/**
 * 完整授權請求模型
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ApprovalRequest".
 */
export interface ApprovalRequest {
  action: Action;
  description: Description;
  risk_level: RiskLevel1;
  blast_radius?: BlastRadius;
  dry_run_checks?: DryRunChecks;
  requested_by: RequestedBy;
  expires_at?: ExpiresAt;
  metadata?: Metadata;
  id?: Id1;
  status?: ApprovalStatus1;
  required_signatures: RequiredSignatures;
  signatures?: Signatures;
  created_at?: CreatedAt;
  updated_at?: UpdatedAt;
  resolved_at?: ResolvedAt;
  rejection_reason?: RejectionReason;
  fingerprint?: Fingerprint;
  hit_count?: HitCount;
  last_seen_at?: LastSeenAt;
  [k: string]: unknown;
}
/**
 * 建立授權請求 (API 輸入)
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ApprovalRequestCreate".
 */
export interface ApprovalRequestCreate {
  action: Action1;
  description: Description1;
  risk_level: RiskLevel2;
  blast_radius?: BlastRadius;
  dry_run_checks?: DryRunChecks1;
  requested_by: RequestedBy1;
  expires_at?: ExpiresAt1;
  metadata?: Metadata1;
  [k: string]: unknown;
}
/**
 * 授權請求 API 回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ApprovalRequestResponse".
 */
export interface ApprovalRequestResponse {
  id: Id2;
  action: Action2;
  description: Description2;
  status: ApprovalStatus;
  risk_level: RiskLevel;
  blast_radius: BlastRadius;
  dry_run_checks: DryRunChecks2;
  required_signatures: RequiredSignatures1;
  current_signatures: CurrentSignatures;
  signatures: Signatures1;
  requested_by: RequestedBy2;
  created_at: CreatedAt1;
  expires_at: ExpiresAt2;
  resolved_at: ResolvedAt1;
  fingerprint?: Fingerprint1;
  hit_count?: HitCount1;
  last_seen_at?: LastSeenAt1;
  metadata?: Metadata2;
  [k: string]: unknown;
}
/**
 * 待簽核清單回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PendingApprovalsResponse".
 */
export interface PendingApprovalsResponse {
  count: Count;
  approvals: Approvals;
  [k: string]: unknown;
}
/**
 * 退回請求
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "RejectRequest".
 */
export interface RejectRequest {
  rejector_id: RejectorId;
  rejector_name: RejectorName;
  reason: Reason;
  [k: string]: unknown;
}
/**
 * 簽核請求
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "SignRequest".
 */
export interface SignRequest {
  signer_id: SignerId1;
  signer_name: SignerName1;
  comment?: Comment1;
  [k: string]: unknown;
}
/**
 * 簽核回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "SignResponse".
 */
export interface SignResponse {
  success: Success;
  message: Message1;
  approval: ApprovalRequestResponse;
  execution_triggered?: ExecutionTriggered;
  [k: string]: unknown;
}
/**
 * AI 決策鏈 - 完整記錄推論過程，供稽核使用
 *
 * CISO 要求:
 * - 必須記錄 AI 使用的模型、Prompt 版本
 * - 必須記錄推理步驟 (可解釋性)
 * - 必須記錄推論延遲 (效能監控)
 *
 * 用於回答:
 * - 「AI 為什麼做出這個建議？」
 * - 「AI 當時參考了哪些資料？」
 * - 「這個決策可以被重現嗎？」
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "AIDecisionChain".
 */
export interface AIDecisionChain {
  input_signal_ids?: InputSignalIds;
  context_retrieved?: ContextRetrieved;
  model_used: ModelUsed;
  prompt_template_version?: PromptTemplateVersion;
  hypothesis: Hypothesis;
  confidence: Confidence;
  reasoning_steps?: ReasoningSteps;
  /**
   * 爆炸半徑分析結果 (復用現有模型)
   */
  blast_radius?: BlastRadius | null;
  probable_root_causes?: ProbableRootCauses;
  inference_started_at: InferenceStartedAt;
  inference_completed_at: InferenceCompletedAt;
  latency_ms: LatencyMs;
  [k: string]: unknown;
}
/**
 * 事件頻率統計 - ADR-037 監控增強架構
 *
 * 2026-03-29 ogt: 統帥指示「重啟只是治標，太常發生的異常必須徹底解決」
 *
 * 用途:
 * - 統計同一異常在不同時間窗口內的發生次數
 * - 根據頻率決定修復策略的升級 (Tier 1→4)
 * - 讓使用者知道這個問題有多頻繁
 *
 * 升級閾值:
 * - REPEAT: ≥ 3 次/24h (標記重複)
 * - ESCALATE: ≥ 5 次/24h (升級 Tier，通知 Owner)
 * - PERMANENT_FIX: ≥ 10 次/24h (強制根因修復)
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "IncidentFrequencyStats".
 */
export interface IncidentFrequencyStats {
  anomaly_key: AnomalyKey;
  count_1h?: Count1H;
  count_24h?: Count24H;
  count_7d?: Count7D;
  count_30d?: Count30D;
  escalation_level?: EscalationLevel;
  auto_repair_count?: AutoRepairCount;
  last_repair_action?: LastRepairAction;
  last_repair_success?: LastRepairSuccess;
  [k: string]: unknown;
}
/**
 * 事件結果 - AI 學習的關鍵回饋
 *
 * CPO 要求:
 * - 必須記錄執行結果 (成功/失敗)
 * - 必須收集人類回饋 (AI 建議是否有效)
 * - 必須標記是否納入長期記憶
 *
 * 這是讓 AI 「從經驗中學習」的關鍵:
 * - 如果 AI 的建議有效 → 強化這個模式
 * - 如果 AI 的建議無效 → 記錄為負面案例
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "IncidentOutcome".
 */
export interface IncidentOutcome {
  proposal_executed?: ProposalExecuted;
  execution_success?: ExecutionSuccess;
  actual_downtime_minutes?: ActualDowntimeMinutes;
  human_feedback?: HumanFeedback;
  effectiveness_score?: EffectivenessScore;
  should_remember?: ShouldRemember;
  learning_notes?: LearningNotes;
  [k: string]: unknown;
}
/**
 * 原始告警信號 - 從 Prometheus/SignOz/Alertmanager 接收
 *
 * 這是 Incident 的「感知輸入」，一個 Incident 可能包含多個 Signal。
 * 例如: CPU Spike + Memory OOM + Pod Restart 三個告警可能屬於同一個 Incident。
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "Signal".
 */
export interface Signal {
  signal_id?: SignalId;
  alert_name: AlertName;
  severity: Severity1;
  source: Source;
  fired_at: FiredAt;
  resolved_at?: ResolvedAt2;
  labels?: Labels;
  annotations?: Annotations;
  fingerprint?: Fingerprint2;
  [k: string]: unknown;
}
/**
 * Prometheus 標籤 (如 pod, namespace, service)
 */
export interface Labels {
  [k: string]: string;
}
/**
 * 告警附加資訊 (如 summary, description)
 */
export interface Annotations {
  [k: string]: string;
}
/**
 * 事件模型 - AWOOOI 認知系統的核心資料結構
 *
 * 這是 AWOOOI 2.0「認知覺醒計畫」的基石，承載了:
 * - 感知 (Signals): 原始告警
 * - 認知 (Decision Chain): AI 推論過程
 * - 決策 (Proposals): 修復建議
 * - 記憶 (Outcome): 結果回饋
 *
 * 三層記憶架構:
 * ┌─────────────────┐
 * │ Working Memory  │ ← Redis Hash, 7 天 TTL
 * │ (活躍事件)       │
 * └────────┬────────┘
 *          │ 定期遷移
 *          ▼
 * ┌─────────────────┐
 * │ Episodic Memory │ ← PostgreSQL, 永久保留
 * │ (歷史事件)       │
 * └────────┬────────┘
 *          │ 向量化
 *          ▼
 * ┌─────────────────┐
 * │ Semantic Memory │ ← Vector DB, RAG 檢索
 * │ (知識庫)        │
 * └─────────────────┘
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "Incident".
 */
export interface Incident {
  incident_id?: IncidentId;
  status?: IncidentStatus1;
  severity: Severity2;
  signals?: Signals;
  affected_services?: AffectedServices;
  /**
   * AI 決策鏈 (完整推論過程)
   */
  decision_chain?: AIDecisionChain | null;
  proposal_ids?: ProposalIds;
  /**
   * 事件結果與人類回饋
   */
  outcome?: IncidentOutcome | null;
  /**
   * 異常頻率統計 (用於 Tier 分級修復策略)
   */
  frequency_stats?: IncidentFrequencyStats | null;
  created_at?: CreatedAt2;
  updated_at?: UpdatedAt1;
  resolved_at?: ResolvedAt3;
  closed_at?: ClosedAt;
  ttl_days?: TtlDays;
  persisted_to_pg?: PersistedToPg;
  vectorized?: Vectorized;
  [k: string]: unknown;
}
/**
 * 建立事件的 DTO
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "IncidentCreate".
 */
export interface IncidentCreate {
  severity: Severity;
  signals?: Signals1;
  affected_services?: AffectedServices1;
  [k: string]: unknown;
}
/**
 * 事件 API 回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "IncidentResponse".
 */
export interface IncidentResponse {
  incident_id: IncidentId1;
  status: IncidentStatus;
  severity: Severity;
  signals: Signals2;
  affected_services: AffectedServices2;
  decision_chain: AIDecisionChain | null;
  proposal_ids: ProposalIds1;
  outcome: IncidentOutcome | null;
  created_at: CreatedAt3;
  updated_at: UpdatedAt2;
  resolved_at: ResolvedAt4;
  closed_at: ClosedAt1;
  [k: string]: unknown;
}
/**
 * 更新事件的 DTO
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "IncidentUpdate".
 */
export interface IncidentUpdate {
  status?: IncidentStatus | null;
  severity?: Severity | null;
  affected_services?: AffectedServices3;
  decision_chain?: AIDecisionChain | null;
  outcome?: IncidentOutcome | null;
  [k: string]: unknown;
}
/**
 * 空間感知上下文 (Ghost Payload)
 *
 * 前端隱形夾帶，讓 AI 知道使用者正在看什麼
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "SpatialContext".
 */
export interface SpatialContext {
  current_page: CurrentPage;
  focused_entity_id?: FocusedEntityId;
  [k: string]: unknown;
}
/**
 * Terminal Intent 請求
 *
 * 統帥輸入的指令或問題
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalIntentRequest".
 */
export interface TerminalIntentRequest {
  intent: Intent;
  context: SpatialContext1;
  session_id?: SessionId;
  [k: string]: unknown;
}
/**
 * 前端空間感知上下文
 */
export interface SpatialContext1 {
  current_page: CurrentPage;
  focused_entity_id?: FocusedEntityId;
  [k: string]: unknown;
}
/**
 * Intent 請求回應
 *
 * 返回 session_id 供前端訂閱 SSE
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalIntentResponse".
 */
export interface TerminalIntentResponse {
  session_id: SessionId1;
  stream_url: StreamUrl;
  created_at?: CreatedAt4;
  [k: string]: unknown;
}
/**
 * Session 狀態查詢回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalStatusResponse".
 */
export interface TerminalStatusResponse {
  session_id: SessionId2;
  status: TerminalSessionStatus;
  created_at: CreatedAt5;
  last_event_id: LastEventId;
  message_count: MessageCount;
  [k: string]: unknown;
}
/**
 * 中斷執行請求
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalAbortRequest".
 */
export interface TerminalAbortRequest {
  reason?: Reason1;
  [k: string]: unknown;
}
/**
 * 中斷執行回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalAbortResponse".
 */
export interface TerminalAbortResponse {
  session_id: SessionId3;
  aborted: Aborted;
  message: Message2;
  [k: string]: unknown;
}
/**
 * AI 思考軌跡事件
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "TerminalThoughtEvent".
 */
export interface TerminalThoughtEvent {
  agent: Agent;
  msg: Msg;
  [k: string]: unknown;
}
/**
 * 修復步驟
 *
 * 設計: 支援多種執行類型
 * - kubectl: Kubernetes 命令
 * - script: 腳本執行
 * - manual: 需人工操作
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "RepairStep".
 */
export interface RepairStep {
  step_number: StepNumber;
  action_type: ActionType;
  command: Command;
  expected_result?: ExpectedResult;
  rollback_command?: RollbackCommand;
  requires_approval?: RequiresApproval;
  risk_level?: RiskLevel3;
  [k: string]: unknown;
}
/**
 * 症狀模式 - 用於相似度比對
 *
 * 設計: 多維度特徵向量
 * - alert_names: 告警名稱集合
 * - affected_services: 受影響服務集合
 * - severity: 嚴重度
 * - labels: Prometheus 標籤 (k8s namespace, deployment, etc.)
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "SymptomPattern".
 */
export interface SymptomPattern {
  alert_names?: AlertNames;
  affected_services?: AffectedServices4;
  severity_range?: SeverityRange;
  label_patterns?: LabelPatterns;
  keywords?: Keywords;
  [k: string]: unknown;
}
/**
 * 標籤匹配 (regex)
 */
export interface LabelPatterns {
  [k: string]: string;
}
/**
 * Playbook - 修復劇本
 *
 * 三層記憶位置:
 * - Working Memory (Redis): playbook:{playbook_id} TTL 7天
 * - Episodic Memory (PostgreSQL): playbooks 表
 * - Semantic Memory (Vector DB): 向量化症狀特徵 (Phase 8+)
 *
 * 設計遵循:
 * - ADR-003 leWOOOgo 模組化架構
 * - ADR-007 資料保留策略
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "Playbook".
 */
export interface Playbook {
  playbook_id?: PlaybookId;
  name: Name1;
  description: Description3;
  status?: PlaybookStatus1;
  source?: PlaybookSource1;
  symptom_pattern?: SymptomPattern1;
  repair_steps?: RepairSteps;
  estimated_duration_minutes?: EstimatedDurationMinutes;
  source_incident_ids?: SourceIncidentIds;
  ai_confidence?: AiConfidence;
  success_count?: SuccessCount;
  failure_count?: FailureCount;
  last_used_at?: LastUsedAt;
  approved_by?: ApprovedBy;
  approved_at?: ApprovedAt;
  tags?: Tags;
  notes?: Notes;
  created_at?: CreatedAt6;
  updated_at?: UpdatedAt3;
  [k: string]: unknown;
}
/**
 * 觸發此 Playbook 的症狀模式
 */
export interface SymptomPattern1 {
  alert_names?: AlertNames;
  affected_services?: AffectedServices4;
  severity_range?: SeverityRange;
  label_patterns?: LabelPatterns;
  keywords?: Keywords;
  [k: string]: unknown;
}
/**
 * 單一 Playbook 回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookResponse".
 */
export interface PlaybookResponse {
  playbook: Playbook;
  success_rate: SuccessRate;
  is_high_quality: IsHighQuality;
  [k: string]: unknown;
}
/**
 * Playbook 列表回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookListResponse".
 */
export interface PlaybookListResponse {
  items: Items;
  total: Total;
  limit: Limit;
  offset: Offset;
  [k: string]: unknown;
}
/**
 * 建立 Playbook 請求 (人工建立)
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookCreateRequest".
 */
export interface PlaybookCreateRequest {
  name: Name2;
  description: Description4;
  symptom_pattern: SymptomPattern;
  repair_steps: RepairSteps1;
  estimated_duration_minutes?: EstimatedDurationMinutes1;
  tags?: Tags1;
  notes?: Notes1;
  [k: string]: unknown;
}
/**
 * 更新 Playbook 請求
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookUpdateRequest".
 */
export interface PlaybookUpdateRequest {
  name?: Name3;
  description?: Description5;
  symptom_pattern?: SymptomPattern | null;
  repair_steps?: RepairSteps2;
  estimated_duration_minutes?: EstimatedDurationMinutes2;
  tags?: Tags2;
  notes?: Notes2;
  status?: PlaybookStatus | null;
  [k: string]: unknown;
}
/**
 * Playbook 推薦結果
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "PlaybookRecommendation".
 */
export interface PlaybookRecommendation {
  playbook: Playbook;
  similarity_score: SimilarityScore;
  matched_symptoms?: MatchedSymptoms;
  reason: Reason2;
  [k: string]: unknown;
}
/**
 * Tool Function 定義
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ToolFunction".
 */
export interface ToolFunction {
  name: Name4;
  arguments: Arguments;
  [k: string]: unknown;
}
/**
 * Tool Call 結構
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ToolCall".
 */
export interface ToolCall {
  id: Id3;
  type?: Type;
  function: ToolFunction1;
  [k: string]: unknown;
}
/**
 * Tool 函數
 */
export interface ToolFunction1 {
  name: Name4;
  arguments: Arguments;
  [k: string]: unknown;
}
/**
 * NVIDIA API Message 結構
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "NvidiaMessage".
 */
export interface NvidiaMessage {
  role: Role;
  content?: Content;
  tool_calls?: ToolCalls;
  [k: string]: unknown;
}
/**
 * NVIDIA API Choice 結構
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "NvidiaChoice".
 */
export interface NvidiaChoice {
  index?: Index;
  message: NvidiaMessage1;
  finish_reason?: FinishReason;
  [k: string]: unknown;
}
/**
 * 回應訊息
 */
export interface NvidiaMessage1 {
  role: Role;
  content?: Content;
  tool_calls?: ToolCalls;
  [k: string]: unknown;
}
/**
 * NVIDIA API Token 使用統計
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "NvidiaUsage".
 */
export interface NvidiaUsage {
  prompt_tokens?: PromptTokens;
  completion_tokens?: CompletionTokens;
  total_tokens?: TotalTokens;
  [k: string]: unknown;
}
/**
 * NVIDIA Nemotron API 完整回應
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "NvidiaResponse".
 */
export interface NvidiaResponse {
  id: Id4;
  object?: Object;
  created: Created;
  model: Model;
  choices: Choices;
  /**
   * Token 使用統計
   */
  usage?: NvidiaUsage | null;
  [k: string]: unknown;
}
/**
 * Tool 定義 (發送給 API)
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "ToolDefinition".
 */
export interface ToolDefinition {
  type?: Type1;
  function: Function;
  [k: string]: unknown;
}
/**
 * 函數定義 (JSON Schema)
 */
export interface Function {
  [k: string]: unknown;
}
/**
 * CSRF Token 回應模型
 *
 * This interface was referenced by `AWOOOIAPITypes`'s JSON-Schema
 * via the `definition` "CSRFTokenResponse".
 */
export interface CSRFTokenResponse {
  token: Token;
  cookie_name?: CookieName;
  header_name?: HeaderName;
  [k: string]: unknown;
}
