@igorjpimenta/manifold 0.0.0-bootstrap.1 → 0.0.0-stage

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +2 -1583
  2. package/package.json +4 -49
  3. package/.migrations/ops/0000_futuristic_karma.sql +0 -111
  4. package/.migrations/ops/0001_low_maximus.sql +0 -7
  5. package/.migrations/ops/meta/0000_snapshot.json +0 -763
  6. package/.migrations/ops/meta/0001_snapshot.json +0 -173
  7. package/.migrations/ops/meta/_journal.json +0 -20
  8. package/.migrations/runtime/0000_real_boomer.sql +0 -180
  9. package/.migrations/runtime/0001_hot_dakota_north.sql +0 -2
  10. package/.migrations/runtime/0002_breezy_vertigo.sql +0 -8
  11. package/.migrations/runtime/0003_dashing_jack_flag.sql +0 -5
  12. package/.migrations/runtime/0004_panoramic_ego.sql +0 -1
  13. package/.migrations/runtime/0005_tidy_ben_grimm.sql +0 -10
  14. package/.migrations/runtime/0006_wet_nightmare.sql +0 -57
  15. package/.migrations/runtime/0007_ambiguous_chronomancer.sql +0 -8
  16. package/.migrations/runtime/0008_wealthy_thundra.sql +0 -301
  17. package/.migrations/runtime/0009_lying_shocker.sql +0 -96
  18. package/.migrations/runtime/0010_solid_phantom_reporter.sql +0 -160
  19. package/.migrations/runtime/0011_windy_demogoblin.sql +0 -175
  20. package/.migrations/runtime/0012_restore_harness_fks.sql +0 -103
  21. package/.migrations/runtime/meta/0000_snapshot.json +0 -1181
  22. package/.migrations/runtime/meta/0001_snapshot.json +0 -1209
  23. package/.migrations/runtime/meta/0002_snapshot.json +0 -1261
  24. package/.migrations/runtime/meta/0003_snapshot.json +0 -1292
  25. package/.migrations/runtime/meta/0004_snapshot.json +0 -1240
  26. package/.migrations/runtime/meta/0006_snapshot.json +0 -1310
  27. package/.migrations/runtime/meta/0007_snapshot.json +0 -1362
  28. package/.migrations/runtime/meta/0008_snapshot.json +0 -1742
  29. package/.migrations/runtime/meta/0009_snapshot.json +0 -2413
  30. package/.migrations/runtime/meta/0010_snapshot.json +0 -2562
  31. package/.migrations/runtime/meta/0011_snapshot.json +0 -2812
  32. package/.migrations/runtime/meta/0012_snapshot.json +0 -2812
  33. package/.migrations/runtime/meta/_journal.json +0 -97
  34. package/RELEASING.md +0 -89
  35. package/agent/fleet.js +0 -100
  36. package/bin/cli.js +0 -854
  37. package/bin/manifold.js +0 -4
  38. package/boot/flow-revival.js +0 -536
  39. package/budget/index.js +0 -495
  40. package/budget/lib.js +0 -59
  41. package/dashboard/cost.js +0 -528
  42. package/dashboard/dist/assets/index-CUfp63sj.css +0 -1
  43. package/dashboard/dist/assets/index-Qy9JMpma.js +0 -371
  44. package/dashboard/dist/index.html +0 -13
  45. package/dashboard/event-log.js +0 -267
  46. package/dashboard/index.html +0 -12
  47. package/dashboard/package-lock.json +0 -2877
  48. package/dashboard/package.json +0 -37
  49. package/dashboard/pipeline-graph.js +0 -131
  50. package/dashboard/postcss.config.js +0 -6
  51. package/dashboard/search.js +0 -183
  52. package/dashboard/server.js +0 -1015
  53. package/dashboard/src/App.tsx +0 -42
  54. package/dashboard/src/api/client.ts +0 -118
  55. package/dashboard/src/api/types.ts +0 -510
  56. package/dashboard/src/api/ws.tsx +0 -112
  57. package/dashboard/src/components/CancelButton.tsx +0 -63
  58. package/dashboard/src/components/ClickToCopy.tsx +0 -68
  59. package/dashboard/src/components/CopyButton.tsx +0 -61
  60. package/dashboard/src/components/DailyCostTrend.tsx +0 -85
  61. package/dashboard/src/components/DailyTimeTrend.tsx +0 -94
  62. package/dashboard/src/components/Funnel.tsx +0 -149
  63. package/dashboard/src/components/GateForm.tsx +0 -158
  64. package/dashboard/src/components/GraphView.tsx +0 -302
  65. package/dashboard/src/components/GroupPathsSummary.tsx +0 -47
  66. package/dashboard/src/components/Histogram.tsx +0 -292
  67. package/dashboard/src/components/Layout.tsx +0 -28
  68. package/dashboard/src/components/NeedsAttention.tsx +0 -98
  69. package/dashboard/src/components/NodeContextCard.tsx +0 -132
  70. package/dashboard/src/components/PathTrail.tsx +0 -35
  71. package/dashboard/src/components/PipelineCostBreakdown.tsx +0 -277
  72. package/dashboard/src/components/RerunButton.tsx +0 -46
  73. package/dashboard/src/components/RunComparison.tsx +0 -53
  74. package/dashboard/src/components/Sparkline.tsx +0 -94
  75. package/dashboard/src/components/StatStrip.tsx +0 -147
  76. package/dashboard/src/components/StateTree.tsx +0 -84
  77. package/dashboard/src/components/StatusBadge.tsx +0 -18
  78. package/dashboard/src/components/SubflowPathPills.tsx +0 -38
  79. package/dashboard/src/components/SubflowSummary.tsx +0 -24
  80. package/dashboard/src/components/SubflowsCard.tsx +0 -327
  81. package/dashboard/src/components/TodayStrip.tsx +0 -86
  82. package/dashboard/src/components/TranscriptPane.tsx +0 -99
  83. package/dashboard/src/components/TranscriptRow.tsx +0 -69
  84. package/dashboard/src/components/ui/badge.tsx +0 -38
  85. package/dashboard/src/components/ui/button.tsx +0 -28
  86. package/dashboard/src/components/ui/card.tsx +0 -42
  87. package/dashboard/src/components/ui/skeleton.tsx +0 -9
  88. package/dashboard/src/components/ui/table.tsx +0 -62
  89. package/dashboard/src/index.css +0 -26
  90. package/dashboard/src/lib/anomaly.ts +0 -42
  91. package/dashboard/src/lib/format.ts +0 -30
  92. package/dashboard/src/lib/step-history.ts +0 -13
  93. package/dashboard/src/lib/subflow.ts +0 -154
  94. package/dashboard/src/lib/use-click-outside.ts +0 -28
  95. package/dashboard/src/lib/use-ignored-clusters.ts +0 -67
  96. package/dashboard/src/lib/utils.ts +0 -6
  97. package/dashboard/src/main.tsx +0 -10
  98. package/dashboard/src/types/shims.d.ts +0 -4
  99. package/dashboard/src/views/Home.tsx +0 -478
  100. package/dashboard/src/views/PipelineDetail.tsx +0 -1185
  101. package/dashboard/src/views/PipelinesList.tsx +0 -111
  102. package/dashboard/src/views/RunDetail.tsx +0 -248
  103. package/dashboard/src/views/Search.tsx +0 -196
  104. package/dashboard/stats.js +0 -668
  105. package/dashboard/tailwind.config.ts +0 -43
  106. package/dashboard/tree-stats.js +0 -12
  107. package/dashboard/tsconfig.json +0 -25
  108. package/dashboard/views.js +0 -231
  109. package/dashboard/vite.config.ts +0 -34
  110. package/drizzle.config.js +0 -12
  111. package/drizzle.config.ops.js +0 -12
  112. package/elevation.js +0 -116
  113. package/engine/admission-promotion-resume.js +0 -127
  114. package/engine/agent-dispatch.js +0 -64
  115. package/engine/child-resume-trigger.js +0 -315
  116. package/engine/executor-budget.js +0 -87
  117. package/engine/executor-cancel.js +0 -83
  118. package/engine/executor-errors.js +0 -122
  119. package/engine/executor-helpers.js +0 -254
  120. package/engine/executor-nodes.js +0 -292
  121. package/engine/executor-persist.js +0 -212
  122. package/engine/executor-subflow-children.js +0 -275
  123. package/engine/executor.js +0 -1013
  124. package/engine/global-concurrency.js +0 -33
  125. package/engine/loader.js +0 -528
  126. package/engine/needs-resolver.js +0 -229
  127. package/engine/pipelines-watcher.js +0 -133
  128. package/engine/result-replay.js +0 -34
  129. package/engine/revival-messages.js +0 -11
  130. package/engine/spawn-child.js +0 -55
  131. package/engine/wait-for-flow-settlement.js +0 -109
  132. package/events/catalog.js +0 -26
  133. package/events/emit.js +0 -44
  134. package/events/kinds.js +0 -118
  135. package/events/serve-ws.js +0 -74
  136. package/events/stream.js +0 -35
  137. package/events/ws-dialog.js +0 -257
  138. package/events/ws-frame.js +0 -194
  139. package/events/ws-run-events.js +0 -70
  140. package/events.js +0 -32
  141. package/gates/gate-resolver.js +0 -576
  142. package/gates/paused-flows.js +0 -55
  143. package/graphql/columns.js +0 -67
  144. package/graphql/schema.js +0 -333
  145. package/index.js +0 -49
  146. package/mcp/http.js +0 -159
  147. package/mcp/identity.js +0 -94
  148. package/mcp/stdio.js +0 -80
  149. package/mcp/tools.js +0 -245
  150. package/mcp/wire-ops.js +0 -178
  151. package/routes/bearer-auth.js +0 -57
  152. package/routes/discuss-audio.js +0 -87
  153. package/routes/discuss-component.js +0 -39
  154. package/routes/discuss-draft.js +0 -159
  155. package/routes/discuss-helpers.js +0 -20
  156. package/routes/discuss.js +0 -848
  157. package/routes/failures.js +0 -104
  158. package/routes/graphql.js +0 -61
  159. package/routes/health.js +0 -54
  160. package/routes/operator-discuss.js +0 -193
  161. package/routes/operator-resume.js +0 -32
  162. package/routes/operator-retry.js +0 -301
  163. package/routes/operator.js +0 -539
  164. package/routes/pipelines.js +0 -118
  165. package/routes/runs.js +0 -1129
  166. package/scripts/ci/import-check.mjs +0 -50
  167. package/scripts/link-core-self.mjs +0 -31
  168. package/scripts/with-guard.sh +0 -24
  169. package/server/app.js +0 -503
  170. package/server/registry.js +0 -53
  171. package/server/serve.js +0 -163
  172. package/state/admission-queue-store.js +0 -325
  173. package/state/attribution-registries.js +0 -102
  174. package/state/batch-writer.js +0 -162
  175. package/state/db-guard.js +0 -63
  176. package/state/db-health.js +0 -27
  177. package/state/db.js +0 -122
  178. package/state/discuss-store.js +0 -299
  179. package/state/failure-store.js +0 -427
  180. package/state/migrate.js +0 -104
  181. package/state/node-cost.js +0 -67
  182. package/state/node-executions.js +0 -775
  183. package/state/node-health-store.js +0 -124
  184. package/state/ops-merge.js +0 -93
  185. package/state/paths.js +0 -146
  186. package/state/pipeline-dirs.js +0 -99
  187. package/state/pipeline-registry.js +0 -449
  188. package/state/run-store.js +0 -697
  189. package/state/schema.js +0 -438
  190. package/state/schema.ops.js +0 -44
  191. package/state/session-index.js +0 -177
  192. package/state/session-keys.js +0 -39
  193. package/state/state-store.js +0 -311
  194. package/state/subflow-state.js +0 -126
  195. package/state/tool-handoff.js +0 -169
  196. package/telemetry/budget-alert.js +0 -353
  197. package/telemetry/cli.js +0 -331
  198. package/telemetry/grammar.js +0 -119
  199. package/telemetry/http-budget.js +0 -132
  200. package/telemetry/http-cost.js +0 -670
  201. package/telemetry/http-helpers.js +0 -134
  202. package/telemetry/http-tree.js +0 -349
  203. package/telemetry/http.js +0 -44
  204. package/telemetry/index.js +0 -307
  205. package/telemetry/ingest.js +0 -134
  206. package/telemetry/labels.js +0 -115
  207. package/telemetry/pricer.js +0 -77
  208. package/telemetry/resolver.js +0 -314
  209. package/telemetry/store.js +0 -147
  210. package/utils/run-patch.js +0 -43
@@ -1,175 +0,0 @@
1
- CREATE TABLE IF NOT EXISTS `flow_items` (
2
- `flow_id` text NOT NULL,
3
- `item_key` text NOT NULL,
4
- `first_seen_at` integer NOT NULL,
5
- PRIMARY KEY(`flow_id`, `item_key`)
6
- );
7
- --> statement-breakpoint
8
- CREATE INDEX IF NOT EXISTS `idx_flow_items_key` ON `flow_items` (`item_key`);--> statement-breakpoint
9
- CREATE TABLE IF NOT EXISTS `pipeline_nodes` (
10
- `pipeline_id` text NOT NULL,
11
- `node_name` text NOT NULL,
12
- `first_seen_at` integer NOT NULL,
13
- PRIMARY KEY(`pipeline_id`, `node_name`),
14
- FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`) ON UPDATE no action ON DELETE cascade
15
- );
16
- --> statement-breakpoint
17
- CREATE INDEX IF NOT EXISTS `idx_pipeline_nodes_name` ON `pipeline_nodes` (`node_name`);--> statement-breakpoint
18
- CREATE TABLE IF NOT EXISTS `turn_runs` (
19
- `run_id` text PRIMARY KEY NOT NULL,
20
- `first_seen_at` integer NOT NULL
21
- );
22
- --> statement-breakpoint
23
- PRAGMA foreign_keys=OFF;--> statement-breakpoint
24
- CREATE TABLE IF NOT EXISTS `__new_cost_by_call` (
25
- `session_id` text NOT NULL,
26
- `msg_id` text NOT NULL,
27
- `ts` integer NOT NULL,
28
- `provider` text,
29
- `model` text,
30
- `input_tokens` integer,
31
- `output_tokens` integer,
32
- `cache_read_tokens` integer,
33
- `cache_write_tokens` integer,
34
- `total_tokens` integer,
35
- `cost_input` real,
36
- `cost_output` real,
37
- `cost_cache_read` real,
38
- `cost_cache_write` real,
39
- `cost_total` real NOT NULL,
40
- `session_key` text,
41
- `agent_id` text,
42
- `root_session_key` text,
43
- `root_kind` text,
44
- `root_label` text,
45
- `pipeline_id` text,
46
- `flow_id` text,
47
- `node_id` text,
48
- `item_key` text,
49
- PRIMARY KEY(`session_id`, `msg_id`),
50
- FOREIGN KEY (`session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE set null,
51
- FOREIGN KEY (`root_session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE set null,
52
- FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`) ON UPDATE no action ON DELETE set null,
53
- FOREIGN KEY (`flow_id`) REFERENCES `flow_runs`(`flow_id`) ON UPDATE no action ON DELETE set null,
54
- FOREIGN KEY (`pipeline_id`,`node_id`) REFERENCES `pipeline_nodes`(`pipeline_id`,`node_name`) ON UPDATE no action ON DELETE no action,
55
- FOREIGN KEY (`flow_id`,`item_key`) REFERENCES `flow_items`(`flow_id`,`item_key`) ON UPDATE no action ON DELETE no action
56
- );
57
- --> statement-breakpoint
58
- INSERT INTO `__new_cost_by_call`("session_id", "msg_id", "ts", "provider", "model", "input_tokens", "output_tokens", "cache_read_tokens", "cache_write_tokens", "total_tokens", "cost_input", "cost_output", "cost_cache_read", "cost_cache_write", "cost_total", "session_key", "agent_id", "root_session_key", "root_kind", "root_label", "pipeline_id", "flow_id", "node_id", "item_key") SELECT "session_id", "msg_id", "ts", "provider", "model", "input_tokens", "output_tokens", "cache_read_tokens", "cache_write_tokens", "total_tokens", "cost_input", "cost_output", "cost_cache_read", "cost_cache_write", "cost_total", "session_key", "agent_id", "root_session_key", "root_kind", "root_label", "pipeline_id", "flow_id", "node_id", "item_key" FROM `cost_by_call`;--> statement-breakpoint
59
- DROP TABLE `cost_by_call`;--> statement-breakpoint
60
- ALTER TABLE `__new_cost_by_call` RENAME TO `cost_by_call`;--> statement-breakpoint
61
- PRAGMA foreign_keys=ON;--> statement-breakpoint
62
- CREATE INDEX IF NOT EXISTS `idx_cost_ts` ON `cost_by_call` (`ts`);--> statement-breakpoint
63
- CREATE INDEX IF NOT EXISTS `idx_cost_root_key` ON `cost_by_call` (`root_session_key`);--> statement-breakpoint
64
- CREATE INDEX IF NOT EXISTS `idx_cost_root_kind_ts` ON `cost_by_call` (`root_kind`,`ts`);--> statement-breakpoint
65
- CREATE INDEX IF NOT EXISTS `idx_cost_pipeline_ts` ON `cost_by_call` (`pipeline_id`,`ts`);--> statement-breakpoint
66
- CREATE INDEX IF NOT EXISTS `idx_cost_flow_node` ON `cost_by_call` (`flow_id`,`node_id`);--> statement-breakpoint
67
- CREATE INDEX IF NOT EXISTS `idx_cost_model_ts` ON `cost_by_call` (`model`,`ts`);--> statement-breakpoint
68
- CREATE INDEX IF NOT EXISTS `idx_cost_session` ON `cost_by_call` (`session_id`);--> statement-breakpoint
69
- CREATE TABLE IF NOT EXISTS `__new_flow_sessions` (
70
- `id` text PRIMARY KEY NOT NULL,
71
- `flow_id` text NOT NULL,
72
- `session_key` text NOT NULL,
73
- `node_id` text,
74
- `branch_item_id` text,
75
- `spawned_at` integer NOT NULL,
76
- FOREIGN KEY (`flow_id`) REFERENCES `flow_runs`(`flow_id`) ON UPDATE no action ON DELETE cascade,
77
- FOREIGN KEY (`session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE no action,
78
- FOREIGN KEY (`flow_id`,`branch_item_id`) REFERENCES `flow_items`(`flow_id`,`item_key`) ON UPDATE no action ON DELETE no action
79
- );
80
- --> statement-breakpoint
81
- INSERT INTO `__new_flow_sessions`("id", "flow_id", "session_key", "node_id", "branch_item_id", "spawned_at") SELECT "id", "flow_id", "session_key", "node_id", "branch_item_id", "spawned_at" FROM `flow_sessions`;--> statement-breakpoint
82
- DROP TABLE `flow_sessions`;--> statement-breakpoint
83
- ALTER TABLE `__new_flow_sessions` RENAME TO `flow_sessions`;--> statement-breakpoint
84
- CREATE INDEX IF NOT EXISTS `idx_flow_sessions_flow_id` ON `flow_sessions` (`flow_id`);--> statement-breakpoint
85
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_flow_sessions_uniq` ON `flow_sessions` (`flow_id`,`session_key`);--> statement-breakpoint
86
- CREATE TABLE IF NOT EXISTS `__new_node_health` (
87
- `id` text PRIMARY KEY NOT NULL,
88
- `pipeline_id` text NOT NULL,
89
- `node_id` text NOT NULL,
90
- `status` text NOT NULL,
91
- `reason` text NOT NULL,
92
- `blocked_by_flow_id` text,
93
- `resolved_via` text,
94
- `created_at` integer NOT NULL,
95
- `updated_at` integer NOT NULL,
96
- `ended_at` integer,
97
- FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`) ON UPDATE no action ON DELETE restrict,
98
- FOREIGN KEY (`blocked_by_flow_id`) REFERENCES `flow_runs`(`flow_id`) ON UPDATE no action ON DELETE set null,
99
- FOREIGN KEY (`pipeline_id`,`node_id`) REFERENCES `pipeline_nodes`(`pipeline_id`,`node_name`) ON UPDATE no action ON DELETE no action
100
- );
101
- --> statement-breakpoint
102
- INSERT INTO `__new_node_health`("id", "pipeline_id", "node_id", "status", "reason", "blocked_by_flow_id", "resolved_via", "created_at", "updated_at", "ended_at") SELECT "id", "pipeline_id", "node_id", "status", "reason", "blocked_by_flow_id", "resolved_via", "created_at", "updated_at", "ended_at" FROM `node_health`;--> statement-breakpoint
103
- DROP TABLE `node_health`;--> statement-breakpoint
104
- ALTER TABLE `__new_node_health` RENAME TO `node_health`;--> statement-breakpoint
105
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_node_health_one_active` ON `node_health` (`pipeline_id`,`node_id`) WHERE "node_health"."status" = 'blocked';--> statement-breakpoint
106
- CREATE INDEX IF NOT EXISTS `idx_node_health_pipeline` ON `node_health` (`pipeline_id`,`status`);--> statement-breakpoint
107
- CREATE TABLE IF NOT EXISTS `__new_queue_items` (
108
- `id` text PRIMARY KEY NOT NULL,
109
- `label` text NOT NULL,
110
- `agent` text NOT NULL,
111
- `agent_emoji` text DEFAULT '🤖' NOT NULL,
112
- `trigger` text DEFAULT 'manual' NOT NULL,
113
- `cost_low` real DEFAULT 0 NOT NULL,
114
- `cost_high` real DEFAULT 0 NOT NULL,
115
- `brief` text,
116
- `model_chain` text,
117
- `pipeline` text,
118
- `node` text,
119
- `token_estimate` integer,
120
- `status` text DEFAULT 'pending' NOT NULL,
121
- `created_at` integer NOT NULL,
122
- `expires_at` integer,
123
- `decided_at` integer,
124
- `decision` text,
125
- `pipeline_id` text,
126
- `pipeline_args` text,
127
- `flow_id` text,
128
- `enqueuer_session_key` text,
129
- `kind` text,
130
- FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`) ON UPDATE no action ON DELETE set null,
131
- FOREIGN KEY (`flow_id`) REFERENCES `flow_runs`(`flow_id`) ON UPDATE no action ON DELETE set null,
132
- FOREIGN KEY (`enqueuer_session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE set null,
133
- FOREIGN KEY (`pipeline_id`,`node`) REFERENCES `pipeline_nodes`(`pipeline_id`,`node_name`) ON UPDATE no action ON DELETE no action
134
- );
135
- --> statement-breakpoint
136
- INSERT INTO `__new_queue_items`("id", "label", "agent", "agent_emoji", "trigger", "cost_low", "cost_high", "brief", "model_chain", "pipeline", "node", "token_estimate", "status", "created_at", "expires_at", "decided_at", "decision", "pipeline_id", "pipeline_args", "flow_id", "enqueuer_session_key", "kind") SELECT "id", "label", "agent", "agent_emoji", "trigger", "cost_low", "cost_high", "brief", "model_chain", "pipeline", "node", "token_estimate", "status", "created_at", "expires_at", "decided_at", "decision", "pipeline_id", "pipeline_args", "flow_id", "enqueuer_session_key", "kind" FROM `queue_items`;--> statement-breakpoint
137
- DROP TABLE `queue_items`;--> statement-breakpoint
138
- ALTER TABLE `__new_queue_items` RENAME TO `queue_items`;--> statement-breakpoint
139
- CREATE INDEX IF NOT EXISTS `idx_status` ON `queue_items` (`status`);--> statement-breakpoint
140
- CREATE INDEX IF NOT EXISTS `idx_created_at` ON `queue_items` ("created_at" desc);--> statement-breakpoint
141
- CREATE INDEX IF NOT EXISTS `idx_flow_node` ON `queue_items` (`flow_id`,`node`);--> statement-breakpoint
142
- CREATE TABLE IF NOT EXISTS `__new_session_lineage` (
143
- `child_session_key` text PRIMARY KEY NOT NULL,
144
- `parent_session_key` text,
145
- `root_session_key` text NOT NULL,
146
- `kind` text NOT NULL,
147
- `root_kind` text NOT NULL,
148
- `root_label` text,
149
- `agent_id` text,
150
- `pipeline_id` text,
151
- `flow_id` text,
152
- `node_id` text,
153
- `item_key` text,
154
- `first_seen_at` integer NOT NULL,
155
- `source` text NOT NULL,
156
- `run_id` text,
157
- FOREIGN KEY (`child_session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE no action,
158
- FOREIGN KEY (`parent_session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE set null,
159
- FOREIGN KEY (`root_session_key`) REFERENCES `sessions`(`session_key`) ON UPDATE no action ON DELETE no action,
160
- FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`) ON UPDATE no action ON DELETE set null,
161
- FOREIGN KEY (`flow_id`) REFERENCES `flow_runs`(`flow_id`) ON UPDATE no action ON DELETE set null,
162
- FOREIGN KEY (`run_id`) REFERENCES `turn_runs`(`run_id`) ON UPDATE no action ON DELETE set null,
163
- FOREIGN KEY (`pipeline_id`,`node_id`) REFERENCES `pipeline_nodes`(`pipeline_id`,`node_name`) ON UPDATE no action ON DELETE no action,
164
- FOREIGN KEY (`flow_id`,`item_key`) REFERENCES `flow_items`(`flow_id`,`item_key`) ON UPDATE no action ON DELETE no action
165
- );
166
- --> statement-breakpoint
167
- INSERT INTO `__new_session_lineage`("child_session_key", "parent_session_key", "root_session_key", "kind", "root_kind", "root_label", "agent_id", "pipeline_id", "flow_id", "node_id", "item_key", "first_seen_at", "source", "run_id") SELECT "child_session_key", "parent_session_key", "root_session_key", "kind", "root_kind", "root_label", "agent_id", "pipeline_id", "flow_id", "node_id", "item_key", "first_seen_at", "source", "run_id" FROM `session_lineage`;--> statement-breakpoint
168
- DROP TABLE `session_lineage`;--> statement-breakpoint
169
- ALTER TABLE `__new_session_lineage` RENAME TO `session_lineage`;--> statement-breakpoint
170
- CREATE INDEX IF NOT EXISTS `idx_lineage_root` ON `session_lineage` (`root_session_key`);--> statement-breakpoint
171
- CREATE INDEX IF NOT EXISTS `idx_lineage_parent` ON `session_lineage` (`parent_session_key`);--> statement-breakpoint
172
- CREATE INDEX IF NOT EXISTS `idx_lineage_pipeline` ON `session_lineage` (`pipeline_id`);--> statement-breakpoint
173
- CREATE INDEX IF NOT EXISTS `idx_lineage_flow` ON `session_lineage` (`flow_id`);--> statement-breakpoint
174
- CREATE INDEX IF NOT EXISTS `idx_lineage_root_kind` ON `session_lineage` (`root_kind`);--> statement-breakpoint
175
- CREATE INDEX IF NOT EXISTS `idx_lineage_run` ON `session_lineage` (`run_id`);
@@ -1,103 +0,0 @@
1
- -- Restore the harness / parent-invocation constraints on databases that
2
- -- applied an earlier revision of 0008/0009 before those FKs were added to the
3
- -- files. drizzle records an applied migration by timestamp, so editing an
4
- -- already-applied file never re-runs it: the table keeps its old shape while
5
- -- the snapshot says it is current.
6
- --
7
- -- Adds:
8
- -- pipelines.harness -> harnesses(id) ON DELETE set null
9
- -- pipeline_dirs.harness -> harnesses(id) ON DELETE cascade
10
- -- flow_runs.parent_invocation_id -> flow_node_invocations(id) ON DELETE set null
11
- -- flow_admission_queue.flow_id -> flow_runs(flow_id) ON DELETE cascade
12
- --
13
- -- The 12-step rebuild is not guardable: CREATE/RENAME fail if the target
14
- -- exists, so this migration runs exactly once per database. Column lists are
15
- -- explicit and ordered as the source tables define them.
16
- CREATE TABLE `__new_pipelines` (
17
- `id` text PRIMARY KEY NOT NULL,
18
- `name` text NOT NULL,
19
- `harness` text,
20
- `created_at` integer NOT NULL,
21
- `updated_at` integer NOT NULL,
22
- `deleted_at` integer,
23
- FOREIGN KEY (`harness`) REFERENCES `harnesses`(`id`) ON UPDATE no action ON DELETE set null
24
- );
25
- --> statement-breakpoint
26
- INSERT INTO `__new_pipelines`(`id`, `name`, `harness`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `name`, `harness`, `created_at`, `updated_at`, `deleted_at` FROM `pipelines`;
27
- --> statement-breakpoint
28
- DROP TABLE `pipelines`;
29
- --> statement-breakpoint
30
- ALTER TABLE `__new_pipelines` RENAME TO `pipelines`;
31
- --> statement-breakpoint
32
- CREATE INDEX IF NOT EXISTS `idx_pipelines_harness_name` ON `pipelines` (`harness`,`name`);
33
- --> statement-breakpoint
34
- CREATE TABLE `__new_pipeline_dirs` (
35
- `harness` text PRIMARY KEY NOT NULL,
36
- `path` text NOT NULL,
37
- `created_at` integer NOT NULL,
38
- FOREIGN KEY (`harness`) REFERENCES `harnesses`(`id`) ON UPDATE no action ON DELETE cascade
39
- );
40
- --> statement-breakpoint
41
- INSERT INTO `__new_pipeline_dirs`(`harness`, `path`, `created_at`) SELECT `harness`, `path`, `created_at` FROM `pipeline_dirs`;
42
- --> statement-breakpoint
43
- DROP TABLE `pipeline_dirs`;
44
- --> statement-breakpoint
45
- ALTER TABLE `__new_pipeline_dirs` RENAME TO `pipeline_dirs`;
46
- --> statement-breakpoint
47
- CREATE TABLE `__new_flow_admission_queue` (
48
- `id` text PRIMARY KEY NOT NULL,
49
- `kind` text NOT NULL,
50
- `flow_id` text NOT NULL,
51
- `node_id` text,
52
- `status` text NOT NULL,
53
- `created_at` integer NOT NULL,
54
- `admitted_at` integer,
55
- FOREIGN KEY (`flow_id`) REFERENCES `flow_runs`(`flow_id`) ON UPDATE no action ON DELETE cascade
56
- );
57
- --> statement-breakpoint
58
- INSERT INTO `__new_flow_admission_queue`(`id`, `kind`, `flow_id`, `node_id`, `status`, `created_at`, `admitted_at`) SELECT `id`, `kind`, `flow_id`, `node_id`, `status`, `created_at`, `admitted_at` FROM `flow_admission_queue`;
59
- --> statement-breakpoint
60
- DROP TABLE `flow_admission_queue`;
61
- --> statement-breakpoint
62
- ALTER TABLE `__new_flow_admission_queue` RENAME TO `flow_admission_queue`;
63
- --> statement-breakpoint
64
- CREATE INDEX IF NOT EXISTS `idx_admission_status` ON `flow_admission_queue` (`status`);
65
- --> statement-breakpoint
66
- CREATE INDEX IF NOT EXISTS `idx_admission_flow` ON `flow_admission_queue` (`flow_id`);
67
- --> statement-breakpoint
68
- CREATE INDEX IF NOT EXISTS `idx_admission_status_created` ON `flow_admission_queue` (`status`,`created_at`);
69
- --> statement-breakpoint
70
- CREATE TABLE `__new_flow_runs` (
71
- `flow_id` text PRIMARY KEY NOT NULL,
72
- `owner_key` text DEFAULT '' NOT NULL,
73
- `revision` integer DEFAULT 0 NOT NULL,
74
- `status` text NOT NULL,
75
- `last_step` text,
76
- `status_reason` text,
77
- `state_json` text DEFAULT '{}' NOT NULL,
78
- `wait_json` text,
79
- `cancel_requested_at` integer,
80
- `created_at` integer NOT NULL,
81
- `updated_at` integer NOT NULL,
82
- `ended_at` integer,
83
- `parent_invocation_id` text,
84
- `pipeline_id` text,
85
- FOREIGN KEY (`parent_invocation_id`) REFERENCES `flow_node_invocations`(`id`) ON UPDATE no action ON DELETE set null,
86
- FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`) ON UPDATE no action ON DELETE set null
87
- );
88
- --> statement-breakpoint
89
- INSERT INTO `__new_flow_runs`(`flow_id`, `owner_key`, `revision`, `status`, `last_step`, `status_reason`, `state_json`, `wait_json`, `cancel_requested_at`, `created_at`, `updated_at`, `ended_at`, `parent_invocation_id`, `pipeline_id`) SELECT `flow_id`, `owner_key`, `revision`, `status`, `last_step`, `status_reason`, `state_json`, `wait_json`, `cancel_requested_at`, `created_at`, `updated_at`, `ended_at`, `parent_invocation_id`, `pipeline_id` FROM `flow_runs`;
90
- --> statement-breakpoint
91
- DROP TABLE `flow_runs`;
92
- --> statement-breakpoint
93
- ALTER TABLE `__new_flow_runs` RENAME TO `flow_runs`;
94
- --> statement-breakpoint
95
- CREATE INDEX IF NOT EXISTS `idx_pfr_status` ON `flow_runs` (`status`) WHERE "flow_runs"."ended_at" IS NULL;
96
- --> statement-breakpoint
97
- CREATE INDEX IF NOT EXISTS `idx_pfr_updated` ON `flow_runs` (`updated_at` DESC);
98
- --> statement-breakpoint
99
- CREATE INDEX IF NOT EXISTS `idx_pfr_created` ON `flow_runs` (`created_at` DESC);
100
- --> statement-breakpoint
101
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_pfr_parent_invocation` ON `flow_runs` (`parent_invocation_id`) WHERE "flow_runs"."parent_invocation_id" IS NOT NULL;
102
- --> statement-breakpoint
103
- CREATE INDEX IF NOT EXISTS `idx_flow_runs_pipeline_id` ON `flow_runs` (`pipeline_id`);