types.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. export type DataOrigin = "production_db" | "runtime_export" | "mixed_with_runtime_export";
  2. export type RunListItem = {
  3. run_id: string;
  4. policy_run_id?: string | null;
  5. status?: string | null;
  6. current_step?: string | null;
  7. platform?: string | null;
  8. platform_mode?: string | null;
  9. strategy_version?: string | null;
  10. validation_status?: string | null;
  11. error_code?: string | null;
  12. started_at?: string | null;
  13. completed_at?: string | null;
  14. };
  15. export type RunListResponse = {
  16. items: RunListItem[];
  17. page: number;
  18. page_size: number;
  19. total: number;
  20. data_origin: DataOrigin;
  21. };
  22. export type DashboardResponse = {
  23. run_id: string;
  24. summary: Record<string, unknown>;
  25. counts: Record<string, number>;
  26. files: Record<string, boolean>;
  27. runtime_files: RuntimeFileStatus[];
  28. validation: Record<string, unknown>;
  29. final_output_summary: Record<string, unknown>;
  30. strategy_review_status: string;
  31. business_summary: BusinessSummary;
  32. stage_conclusions: StageConclusion[];
  33. rule_application_summary: RuleApplicationSummary[];
  34. walk_graph: WalkGraph;
  35. primary_failure_reason?: Record<string, unknown> | null;
  36. technical_refs: Record<string, unknown>;
  37. data_origin: DataOrigin;
  38. links: Record<string, string>;
  39. };
  40. export type BusinessSummary = {
  41. headline: string;
  42. status: string;
  43. source_label: string;
  44. query_count: number;
  45. content_count: number;
  46. kept_count: number;
  47. review_count: number;
  48. rejected_count: number;
  49. asset_count: number;
  50. primary_failure_reason?: Record<string, unknown> | null;
  51. };
  52. export type StageConclusion = {
  53. stage_id: string;
  54. label: string;
  55. status: string;
  56. headline: string;
  57. detail: string;
  58. metric: string;
  59. };
  60. export type RuleApplicationSummary = {
  61. decision_id?: string | null;
  62. content_title?: string | null;
  63. platform_content_id?: string | null;
  64. rule_pack?: string | null;
  65. hard_gate_status?: string | null;
  66. score?: number | string | null;
  67. decision_action?: string | null;
  68. decision_reason_code?: string | null;
  69. content_effect_status?: string | null;
  70. primary_reason?: string | null;
  71. technical_ref?: Record<string, unknown>;
  72. };
  73. export type WalkGraphNode = {
  74. id: string;
  75. type: string;
  76. label: string;
  77. status: string;
  78. };
  79. export type WalkGraphEdge = {
  80. id: string;
  81. source: string;
  82. target: string;
  83. label?: string | null;
  84. status?: string | null;
  85. rule_pack?: string | null;
  86. rule_pack_executed?: boolean | null;
  87. executed_rule_pack_id?: string | null;
  88. budget_tier?: string | null;
  89. reason_code?: string | null;
  90. };
  91. export type WalkGraph = {
  92. nodes: WalkGraphNode[];
  93. edges: WalkGraphEdge[];
  94. source_path_count: number;
  95. };
  96. export type RuntimeFileStatus = {
  97. filename: string;
  98. exists: boolean;
  99. record_count: number;
  100. file_type: "json" | "jsonl";
  101. contract_status: string;
  102. data_origin: DataOrigin;
  103. };
  104. export type QueryListResponse = {
  105. run_id: string;
  106. items: Array<Record<string, unknown>>;
  107. total: number;
  108. data_origin: DataOrigin;
  109. };
  110. export type TimelineSummary = {
  111. total_duration_ms: number | null;
  112. stage_duration_ms: Record<string, number>;
  113. query_failure_count: number;
  114. platform_rate_limited_count: number;
  115. // V2 decode 历史字段:V3 run 为空 dict,仅老 run 回看时有值。
  116. decode_status_counts?: Record<string, number>;
  117. error_counts: Record<string, number>;
  118. walk_status_counts: Record<string, number>;
  119. };
  120. export type TimelineItem = {
  121. source: string;
  122. stage?: string | null;
  123. event_type?: string | null;
  124. status?: string | null;
  125. timestamp?: string | null;
  126. error_code?: string | null;
  127. walk_action_id?: string | null;
  128. record: Record<string, unknown>;
  129. };
  130. export type TimelineResponse = {
  131. run_id: string;
  132. items: TimelineItem[];
  133. total: number;
  134. data_origin: DataOrigin;
  135. summary: TimelineSummary;
  136. };
  137. export type ContentItemsResponse = {
  138. run_id: string;
  139. items: Array<Record<string, unknown>>;
  140. total: number;
  141. data_origin: DataOrigin;
  142. };
  143. export type RuntimeFilesResponse = {
  144. run_id: string;
  145. files: RuntimeFileStatus[];
  146. data_origin: DataOrigin;
  147. };
  148. export type RuntimeFileResponse = {
  149. run_id: string;
  150. filename: string;
  151. data_origin: DataOrigin;
  152. data?: Record<string, unknown>;
  153. records?: Array<Record<string, unknown>>;
  154. offset?: number;
  155. limit?: number;
  156. total?: number;
  157. };
  158. export type ConfigFileResponse = {
  159. source_file: string;
  160. data: Record<string, unknown>;
  161. };
  162. // walk_policy.json 的拍板值可能裸值,也可能带 {value, provenance, tbd} 留痕包裹。
  163. export type PolicyValue =
  164. | string
  165. | number
  166. | boolean
  167. | null
  168. | { value: string | number | boolean | null; provenance?: string; tbd?: boolean; note?: string };
  169. export type WalkPolicyData = {
  170. global?: Record<string, PolicyValue>;
  171. edge_budgets?: Array<Record<string, PolicyValue>>;
  172. edge_permissions?: Record<string, Record<string, PolicyValue> | string>;
  173. budget_tiers?: Record<string, PolicyValue>;
  174. dedup?: Record<string, PolicyValue>;
  175. reseed_quality_gate?: Record<string, PolicyValue>;
  176. [key: string]: unknown;
  177. };