types.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. decode_status_counts: Record<string, number>;
  116. error_counts: Record<string, number>;
  117. walk_status_counts: Record<string, number>;
  118. };
  119. export type TimelineItem = {
  120. source: string;
  121. stage?: string | null;
  122. event_type?: string | null;
  123. status?: string | null;
  124. timestamp?: string | null;
  125. error_code?: string | null;
  126. walk_action_id?: string | null;
  127. record: Record<string, unknown>;
  128. };
  129. export type TimelineResponse = {
  130. run_id: string;
  131. items: TimelineItem[];
  132. total: number;
  133. data_origin: DataOrigin;
  134. summary: TimelineSummary;
  135. };
  136. export type ContentItemsResponse = {
  137. run_id: string;
  138. items: Array<Record<string, unknown>>;
  139. total: number;
  140. data_origin: DataOrigin;
  141. };
  142. export type RuntimeFilesResponse = {
  143. run_id: string;
  144. files: RuntimeFileStatus[];
  145. data_origin: DataOrigin;
  146. };
  147. export type RuntimeFileResponse = {
  148. run_id: string;
  149. filename: string;
  150. data_origin: DataOrigin;
  151. data?: Record<string, unknown>;
  152. records?: Array<Record<string, unknown>>;
  153. offset?: number;
  154. limit?: number;
  155. total?: number;
  156. };
  157. export type ConfigFileResponse = {
  158. source_file: string;
  159. data: Record<string, unknown>;
  160. };