types.ts 5.3 KB

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