export type DataOrigin = "production_db" | "runtime_export" | "mixed_with_runtime_export"; export type RunListItem = { run_id: string; policy_run_id?: string | null; status?: string | null; current_step?: string | null; platform?: string | null; platform_mode?: string | null; content_format?: string | null; strategy_version?: string | null; demand_name?: string | null; demand_desc?: string | null; validation_status?: string | null; error_code?: string | null; started_at?: string | null; completed_at?: string | null; }; export type RunListResponse = { items: RunListItem[]; page: number; page_size: number; total: number; data_origin: DataOrigin; }; export type DashboardResponse = { run_id: string; summary: Record; counts: Record; files: Record; runtime_files: RuntimeFileStatus[]; validation: Record; final_output_summary: Record; strategy_review_status: string; business_summary: BusinessSummary; stage_conclusions: StageConclusion[]; rule_application_summary: RuleApplicationSummary[]; walk_graph: WalkGraph; primary_failure_reason?: Record | null; technical_refs: Record; data_origin: DataOrigin; links: Record; }; export type BusinessSummary = { headline: string; status: string; source_label: string; query_count: number; content_count: number; kept_count: number; review_count: number; rejected_count: number; asset_count: number; primary_failure_reason?: Record | null; }; export type StageConclusion = { stage_id: string; label: string; status: string; headline: string; detail: string; metric: string; }; export type RuleApplicationSummary = { decision_id?: string | null; content_title?: string | null; platform_content_id?: string | null; rule_pack?: string | null; hard_gate_status?: string | null; score?: number | string | null; decision_action?: string | null; decision_reason_code?: string | null; content_effect_status?: string | null; primary_reason?: string | null; technical_ref?: Record; }; export type WalkGraphNode = { id: string; type: string; label: string; status: string; }; export type WalkGraphEdge = { id: string; source: string; target: string; label?: string | null; status?: string | null; rule_pack?: string | null; rule_pack_executed?: boolean | null; executed_rule_pack_id?: string | null; budget_tier?: string | null; reason_code?: string | null; }; export type WalkGraph = { nodes: WalkGraphNode[]; edges: WalkGraphEdge[]; source_path_count: number; }; export type RuntimeFileStatus = { filename: string; exists: boolean; record_count: number; file_type: "json" | "jsonl"; contract_status: string; data_origin: DataOrigin; }; export type QueryListResponse = { run_id: string; items: Array>; total: number; data_origin: DataOrigin; }; export type TimelineSummary = { total_duration_ms: number | null; stage_duration_ms: Record; query_failure_count: number; platform_rate_limited_count: number; // V2 decode 历史字段:V3 run 为空 dict,仅老 run 回看时有值。 decode_status_counts?: Record; error_counts: Record; walk_status_counts: Record; }; export type TimelineItem = { source: string; stage?: string | null; event_type?: string | null; status?: string | null; timestamp?: string | null; error_code?: string | null; walk_action_id?: string | null; record: Record; }; export type TimelineResponse = { run_id: string; items: TimelineItem[]; total: number; data_origin: DataOrigin; summary: TimelineSummary; }; export type ContentItemsResponse = { run_id: string; items: Array>; total: number; data_origin: DataOrigin; }; export type RuntimeFilesResponse = { run_id: string; files: RuntimeFileStatus[]; data_origin: DataOrigin; }; export type RuntimeFileResponse = { run_id: string; filename: string; data_origin: DataOrigin; data?: Record; records?: Array>; offset?: number; limit?: number; total?: number; }; export type ConfigFileResponse = { source_file: string; data: Record; }; // 平台展示目录(/config/platforms):从 platform_profiles 派生,前端按此渲染平台名与互动指标。 export type PlatformDescriptor = { platform: string; label: string; status?: string | null; heat_fields: string[]; }; export type PlatformCatalogResponse = { platforms: Record; }; // walk_policy.json 的拍板值可能裸值,也可能带 {value, provenance, tbd} 留痕包裹。 export type PolicyValue = | string | number | boolean | null | { value: string | number | boolean | null; provenance?: string; tbd?: boolean; note?: string }; export type WalkPolicyData = { global?: Record; edge_budgets?: Array>; edge_permissions?: Record | string>; budget_tiers?: Record; dedup?: Record; reseed_quality_gate?: Record; [key: string]: unknown; };