@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,173 +0,0 @@
1
- {
2
- "version": "6",
3
- "dialect": "sqlite",
4
- "id": "68538696-4840-4f67-9954-bb688e8d37eb",
5
- "prevId": "c0104d99-7954-47d4-abbb-e7a8d3921257",
6
- "tables": {
7
- "budget_alert_events": {
8
- "name": "budget_alert_events",
9
- "columns": {
10
- "id": {
11
- "name": "id",
12
- "type": "text",
13
- "primaryKey": true,
14
- "notNull": true,
15
- "autoincrement": false
16
- },
17
- "threshold": {
18
- "name": "threshold",
19
- "type": "real",
20
- "primaryKey": false,
21
- "notNull": true,
22
- "autoincrement": false
23
- },
24
- "total_usd": {
25
- "name": "total_usd",
26
- "type": "real",
27
- "primaryKey": false,
28
- "notNull": true,
29
- "autoincrement": false
30
- },
31
- "cap_usd": {
32
- "name": "cap_usd",
33
- "type": "real",
34
- "primaryKey": false,
35
- "notNull": true,
36
- "autoincrement": false
37
- },
38
- "fired_at": {
39
- "name": "fired_at",
40
- "type": "integer",
41
- "primaryKey": false,
42
- "notNull": true,
43
- "autoincrement": false
44
- }
45
- },
46
- "indexes": {
47
- "idx_bae_fired_at": {
48
- "name": "idx_bae_fired_at",
49
- "columns": [
50
- "fired_at"
51
- ],
52
- "isUnique": false
53
- }
54
- },
55
- "foreignKeys": {},
56
- "compositePrimaryKeys": {},
57
- "uniqueConstraints": {},
58
- "checkConstraints": {}
59
- },
60
- "cap_versions": {
61
- "name": "cap_versions",
62
- "columns": {
63
- "id": {
64
- "name": "id",
65
- "type": "text",
66
- "primaryKey": true,
67
- "notNull": true,
68
- "autoincrement": false
69
- },
70
- "cap_usd": {
71
- "name": "cap_usd",
72
- "type": "real",
73
- "primaryKey": false,
74
- "notNull": true,
75
- "autoincrement": false
76
- },
77
- "lock_threshold": {
78
- "name": "lock_threshold",
79
- "type": "real",
80
- "primaryKey": false,
81
- "notNull": true,
82
- "autoincrement": false
83
- },
84
- "registered_at": {
85
- "name": "registered_at",
86
- "type": "integer",
87
- "primaryKey": false,
88
- "notNull": true,
89
- "autoincrement": false
90
- },
91
- "retired_at": {
92
- "name": "retired_at",
93
- "type": "integer",
94
- "primaryKey": false,
95
- "notNull": false,
96
- "autoincrement": false
97
- }
98
- },
99
- "indexes": {
100
- "idx_cv_lookup": {
101
- "name": "idx_cv_lookup",
102
- "columns": [
103
- "registered_at"
104
- ],
105
- "isUnique": false
106
- },
107
- "idx_cv_active": {
108
- "name": "idx_cv_active",
109
- "columns": [
110
- "(1)"
111
- ],
112
- "isUnique": true,
113
- "where": "\"cap_versions\".\"retired_at\" IS NULL"
114
- }
115
- },
116
- "foreignKeys": {},
117
- "compositePrimaryKeys": {},
118
- "uniqueConstraints": {},
119
- "checkConstraints": {}
120
- },
121
- "gate_state": {
122
- "name": "gate_state",
123
- "columns": {
124
- "id": {
125
- "name": "id",
126
- "type": "text",
127
- "primaryKey": true,
128
- "notNull": true,
129
- "autoincrement": false,
130
- "default": "'singleton'"
131
- },
132
- "locked": {
133
- "name": "locked",
134
- "type": "integer",
135
- "primaryKey": false,
136
- "notNull": true,
137
- "autoincrement": false,
138
- "default": 0
139
- },
140
- "day": {
141
- "name": "day",
142
- "type": "text",
143
- "primaryKey": false,
144
- "notNull": false,
145
- "autoincrement": false
146
- }
147
- },
148
- "indexes": {},
149
- "foreignKeys": {},
150
- "compositePrimaryKeys": {},
151
- "uniqueConstraints": {},
152
- "checkConstraints": {}
153
- }
154
- },
155
- "views": {},
156
- "enums": {},
157
- "_meta": {
158
- "schemas": {},
159
- "tables": {},
160
- "columns": {}
161
- },
162
- "internal": {
163
- "indexes": {
164
- "idx_cv_active": {
165
- "columns": {
166
- "(1)": {
167
- "isExpression": true
168
- }
169
- }
170
- }
171
- }
172
- }
173
- }
@@ -1,20 +0,0 @@
1
- {
2
- "version": "7",
3
- "dialect": "sqlite",
4
- "entries": [
5
- {
6
- "idx": 0,
7
- "version": "6",
8
- "when": 1792696076489,
9
- "tag": "0000_futuristic_karma",
10
- "breakpoints": true
11
- },
12
- {
13
- "idx": 1,
14
- "version": "6",
15
- "when": 1795035782344,
16
- "tag": "0001_low_maximus",
17
- "breakpoints": true
18
- }
19
- ]
20
- }
@@ -1,180 +0,0 @@
1
- CREATE TABLE IF NOT EXISTS `discuss_state` (
2
- `flow_id` text NOT NULL,
3
- `item_id` text NOT NULL,
4
- `messages_json` text DEFAULT '[]' NOT NULL,
5
- `turn_status` text DEFAULT 'idle' NOT NULL,
6
- `active_turn_id` text,
7
- `pending_json` text,
8
- `updated_at` integer NOT NULL,
9
- `components_json` text DEFAULT '[]' NOT NULL
10
- );
11
- --> statement-breakpoint
12
- CREATE INDEX IF NOT EXISTS `idx_discuss_updated` ON `discuss_state` (`updated_at`);--> statement-breakpoint
13
- CREATE TABLE IF NOT EXISTS `failure_events` (
14
- `id` text PRIMARY KEY NOT NULL,
15
- `flow_id` text NOT NULL,
16
- `failed_at` integer NOT NULL,
17
- `failure_summary` text NOT NULL,
18
- `invocation_id` text,
19
- `execution_id` text,
20
- `error_type` text
21
- );
22
- --> statement-breakpoint
23
- CREATE INDEX IF NOT EXISTS `idx_failures_flow` ON `failure_events` (`flow_id`);--> statement-breakpoint
24
- CREATE INDEX IF NOT EXISTS `idx_failures_invocation` ON `failure_events` (`invocation_id`);--> statement-breakpoint
25
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_failures_execution` ON `failure_events` (`execution_id`) WHERE "failure_events"."execution_id" IS NOT NULL;--> statement-breakpoint
26
- CREATE TABLE IF NOT EXISTS `flow_admission_queue` (
27
- `id` text PRIMARY KEY NOT NULL,
28
- `kind` text NOT NULL,
29
- `flow_id` text NOT NULL,
30
- `node_id` text,
31
- `status` text NOT NULL,
32
- `created_at` integer NOT NULL,
33
- `admitted_at` integer
34
- );
35
- --> statement-breakpoint
36
- CREATE INDEX IF NOT EXISTS `idx_admission_status` ON `flow_admission_queue` (`status`);--> statement-breakpoint
37
- CREATE INDEX IF NOT EXISTS `idx_admission_flow` ON `flow_admission_queue` (`flow_id`);--> statement-breakpoint
38
- CREATE INDEX IF NOT EXISTS `idx_admission_status_created` ON `flow_admission_queue` (`status`,`created_at`);--> statement-breakpoint
39
- CREATE TABLE IF NOT EXISTS `flow_events` (
40
- `id` text PRIMARY KEY NOT NULL,
41
- `flow_id` text NOT NULL,
42
- `event_type` text NOT NULL,
43
- `prev_step` text,
44
- `curr_step` text,
45
- `prev_status` text,
46
- `curr_status` text,
47
- `wait_kind` text,
48
- `occurred_at` integer NOT NULL
49
- );
50
- --> statement-breakpoint
51
- CREATE INDEX IF NOT EXISTS `idx_flow_events_flow_id` ON `flow_events` (`flow_id`);--> statement-breakpoint
52
- CREATE INDEX IF NOT EXISTS `idx_flow_events_occurred_at` ON `flow_events` (`occurred_at`);--> statement-breakpoint
53
- CREATE TABLE IF NOT EXISTS `flow_node_executions` (
54
- `id` text PRIMARY KEY NOT NULL,
55
- `invocation_id` text NOT NULL,
56
- `entered_at` integer NOT NULL,
57
- `exited_at` integer NOT NULL,
58
- `kind` text DEFAULT 'legacy' NOT NULL
59
- );
60
- --> statement-breakpoint
61
- CREATE INDEX IF NOT EXISTS `idx_fne_invocation` ON `flow_node_executions` (`invocation_id`);--> statement-breakpoint
62
- CREATE INDEX IF NOT EXISTS `idx_fne_exited` ON `flow_node_executions` (`exited_at`);--> statement-breakpoint
63
- CREATE TABLE IF NOT EXISTS `flow_node_invocations` (
64
- `id` text PRIMARY KEY NOT NULL,
65
- `flow_id` text NOT NULL,
66
- `pipeline_id` text,
67
- `node_id` text NOT NULL,
68
- `subflow_key` text,
69
- `visit_seq` integer DEFAULT 1 NOT NULL,
70
- `invoked_at` integer NOT NULL,
71
- `result_json` text,
72
- `result_written_at` integer,
73
- `result_too_large_bytes` integer
74
- );
75
- --> statement-breakpoint
76
- CREATE INDEX IF NOT EXISTS `idx_invocations_flow` ON `flow_node_invocations` (`flow_id`);--> statement-breakpoint
77
- CREATE INDEX IF NOT EXISTS `idx_invocations_node_subflow` ON `flow_node_invocations` (`node_id`,`subflow_key`);--> statement-breakpoint
78
- CREATE INDEX IF NOT EXISTS `idx_invocations_pipe_node` ON `flow_node_invocations` (`pipeline_id`,`node_id`);--> statement-breakpoint
79
- CREATE TABLE IF NOT EXISTS `flow_runs` (
80
- `flow_id` text PRIMARY KEY NOT NULL,
81
- `owner_key` text DEFAULT '' NOT NULL,
82
- `revision` integer DEFAULT 0 NOT NULL,
83
- `status` text NOT NULL,
84
- `last_step` text,
85
- `status_reason` text,
86
- `state_json` text DEFAULT '{}' NOT NULL,
87
- `wait_json` text,
88
- `cancel_requested_at` integer,
89
- `created_at` integer NOT NULL,
90
- `updated_at` integer NOT NULL,
91
- `ended_at` integer,
92
- `parent_invocation_id` text,
93
- `pipeline_id` text
94
- );
95
- --> statement-breakpoint
96
- CREATE INDEX IF NOT EXISTS `idx_pfr_status` ON `flow_runs` (`status`) WHERE "flow_runs"."ended_at" IS NULL;--> statement-breakpoint
97
- CREATE INDEX IF NOT EXISTS `idx_pfr_updated` ON `flow_runs` ("updated_at" desc);--> statement-breakpoint
98
- 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;--> statement-breakpoint
99
- CREATE INDEX IF NOT EXISTS `idx_flow_runs_pipeline_id` ON `flow_runs` (`pipeline_id`);--> statement-breakpoint
100
- CREATE TABLE IF NOT EXISTS `flow_sessions` (
101
- `id` text PRIMARY KEY NOT NULL,
102
- `flow_id` text NOT NULL,
103
- `session_key` text NOT NULL,
104
- `node_id` text,
105
- `branch_item_id` text,
106
- `spawned_at` integer NOT NULL
107
- );
108
- --> statement-breakpoint
109
- CREATE INDEX IF NOT EXISTS `idx_flow_sessions_flow_id` ON `flow_sessions` (`flow_id`);--> statement-breakpoint
110
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_flow_sessions_uniq` ON `flow_sessions` (`flow_id`,`session_key`);--> statement-breakpoint
111
- CREATE TABLE IF NOT EXISTS `gate_records` (
112
- `flow_id` text NOT NULL,
113
- `node_id` text NOT NULL,
114
- `record_json` text NOT NULL,
115
- `updated_at` integer NOT NULL,
116
- PRIMARY KEY(`flow_id`, `node_id`)
117
- );
118
- --> statement-breakpoint
119
- CREATE TABLE IF NOT EXISTS `model_health` (
120
- `id` text PRIMARY KEY NOT NULL,
121
- `ref` text NOT NULL,
122
- `status` text NOT NULL,
123
- `reason` text NOT NULL,
124
- `down_since` integer NOT NULL,
125
- `until_ms` integer,
126
- `probing` integer DEFAULT 0 NOT NULL,
127
- `strike_level` integer DEFAULT 0 NOT NULL,
128
- `strike_ended_at` integer,
129
- `created_at` integer NOT NULL,
130
- `updated_at` integer NOT NULL
131
- );
132
- --> statement-breakpoint
133
- CREATE TABLE IF NOT EXISTS `node_health` (
134
- `id` text PRIMARY KEY NOT NULL,
135
- `pipeline_id` text NOT NULL,
136
- `node_id` text NOT NULL,
137
- `status` text NOT NULL,
138
- `reason` text NOT NULL,
139
- `blocked_by_flow_id` text,
140
- `resolved_via` text,
141
- `created_at` integer NOT NULL,
142
- `updated_at` integer NOT NULL,
143
- `ended_at` integer
144
- );
145
- --> statement-breakpoint
146
- 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
147
- CREATE INDEX IF NOT EXISTS `idx_node_health_pipeline` ON `node_health` (`pipeline_id`,`status`);--> statement-breakpoint
148
- CREATE TABLE IF NOT EXISTS `pipeline_node_versions` (
149
- `id` text PRIMARY KEY NOT NULL,
150
- `pipeline_version_id` text NOT NULL,
151
- `pipeline_id` text NOT NULL,
152
- `node_name` text NOT NULL,
153
- `node_id` text,
154
- `kind` text NOT NULL,
155
- `agent` text,
156
- `mode` text,
157
- `content_hash` text NOT NULL,
158
- `registered_at` integer NOT NULL,
159
- `retired_at` integer,
160
- FOREIGN KEY (`pipeline_version_id`) REFERENCES `pipeline_versions`(`id`) ON UPDATE no action ON DELETE no action
161
- );
162
- --> statement-breakpoint
163
- CREATE INDEX IF NOT EXISTS `idx_pnv_lookup` ON `pipeline_node_versions` (`pipeline_id`,`node_name`,`registered_at`);--> statement-breakpoint
164
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_pnv_active` ON `pipeline_node_versions` (`pipeline_id`,`node_name`) WHERE "pipeline_node_versions"."retired_at" IS NULL;--> statement-breakpoint
165
- CREATE TABLE IF NOT EXISTS `pipeline_versions` (
166
- `id` text PRIMARY KEY NOT NULL,
167
- `pipeline_id` text NOT NULL,
168
- `kind` text,
169
- `allow_concurrent` text,
170
- `is_synthetic` integer NOT NULL,
171
- `parent_pipeline_id` text,
172
- `source_path` text,
173
- `content_hash` text NOT NULL,
174
- `registered_at` integer NOT NULL,
175
- `retired_at` integer
176
- );
177
- --> statement-breakpoint
178
- CREATE INDEX IF NOT EXISTS `idx_pv_lookup` ON `pipeline_versions` (`pipeline_id`,`registered_at`);--> statement-breakpoint
179
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_pv_active` ON `pipeline_versions` (`pipeline_id`) WHERE "pipeline_versions"."retired_at" IS NULL;--> statement-breakpoint
180
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_invocations_identity` ON `flow_node_invocations` (`flow_id`,`node_id`,COALESCE(`subflow_key`, ''),`visit_seq`);
@@ -1,2 +0,0 @@
1
- CREATE INDEX IF NOT EXISTS `idx_failures_failed_at` ON `failure_events` ("failed_at" desc);--> statement-breakpoint
2
- CREATE INDEX IF NOT EXISTS `idx_pfr_created` ON `flow_runs` ("created_at" desc);
@@ -1,8 +0,0 @@
1
- CREATE TABLE IF NOT EXISTS `push_targets` (
2
- `harness` text PRIMARY KEY NOT NULL,
3
- `url` text NOT NULL,
4
- `bearer` text,
5
- `timeout_ms` integer,
6
- `created_at` integer NOT NULL,
7
- `updated_at` integer NOT NULL
8
- );
@@ -1,5 +0,0 @@
1
- CREATE TABLE IF NOT EXISTS `pipeline_dirs` (
2
- `harness` text PRIMARY KEY NOT NULL,
3
- `path` text NOT NULL,
4
- `created_at` integer NOT NULL
5
- );
@@ -1 +0,0 @@
1
- DROP TABLE `push_targets`;
@@ -1,10 +0,0 @@
1
- CREATE TABLE IF NOT EXISTS `discuss_threads` (
2
- `flow_id` text NOT NULL,
3
- `gate_node_id` text NOT NULL,
4
- `item_id` text NOT NULL,
5
- `agent_id` text,
6
- `session_key` text NOT NULL,
7
- `updated_at` integer NOT NULL
8
- );
9
- --> statement-breakpoint
10
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_discuss_threads_unique` ON `discuss_threads` (`flow_id`,`gate_node_id`,`item_id`);
@@ -1,57 +0,0 @@
1
- -- Make discuss_state one row per (flow_id, item_id).
2
- --
3
- -- discuss_state shipped without a uniqueness constraint, so two concurrent
4
- -- appendMessage calls could each insert their own row for the same thread.
5
- -- Every write updates all rows of the group, so the rows converge on the
6
- -- same values; the survivor is the one carrying the most messages, and the
7
- -- group's newest non-null pending wins so a proposal is never dropped.
8
- WITH `grouped` AS MATERIALIZED (
9
- SELECT
10
- `rowid` AS `rid`,
11
- `flow_id` AS `flow_id`,
12
- `item_id` AS `item_id`,
13
- `messages_json` AS `messages_json`,
14
- `turn_status` AS `turn_status`,
15
- `active_turn_id` AS `active_turn_id`,
16
- `components_json` AS `components_json`,
17
- COUNT(*) OVER (PARTITION BY `flow_id`, `item_id`) AS `group_size`,
18
- ROW_NUMBER() OVER (
19
- PARTITION BY `flow_id`, `item_id`
20
- ORDER BY (CASE WHEN json_valid(`messages_json`) THEN json_array_length(`messages_json`) ELSE 0 END) DESC,
21
- `updated_at` DESC,
22
- `rowid` DESC
23
- ) AS `survivor_rn`,
24
- FIRST_VALUE(`pending_json`) OVER (
25
- PARTITION BY `flow_id`, `item_id`
26
- ORDER BY (`pending_json` IS NULL) ASC,
27
- `updated_at` DESC,
28
- `rowid` DESC
29
- ) AS `group_pending_json`
30
- FROM `discuss_state`
31
- )
32
- UPDATE `discuss_state`
33
- SET
34
- `messages_json` = (SELECT g.`messages_json` FROM `grouped` g WHERE g.`rid` = `discuss_state`.`rowid`),
35
- `turn_status` = (SELECT g.`turn_status` FROM `grouped` g WHERE g.`rid` = `discuss_state`.`rowid`),
36
- `active_turn_id` = (SELECT g.`active_turn_id` FROM `grouped` g WHERE g.`rid` = `discuss_state`.`rowid`),
37
- `components_json` = (SELECT g.`components_json` FROM `grouped` g WHERE g.`rid` = `discuss_state`.`rowid`),
38
- `pending_json` = (SELECT g.`group_pending_json` FROM `grouped` g WHERE g.`rid` = `discuss_state`.`rowid`)
39
- WHERE `rowid` IN (
40
- SELECT g.`rid` FROM `grouped` g WHERE g.`survivor_rn` = 1 AND g.`group_size` > 1
41
- );
42
- --> statement-breakpoint
43
- WITH `ranked` AS MATERIALIZED (
44
- SELECT
45
- `rowid` AS `rid`,
46
- ROW_NUMBER() OVER (
47
- PARTITION BY `flow_id`, `item_id`
48
- ORDER BY (CASE WHEN json_valid(`messages_json`) THEN json_array_length(`messages_json`) ELSE 0 END) DESC,
49
- `updated_at` DESC,
50
- `rowid` DESC
51
- ) AS `rn`
52
- FROM `discuss_state`
53
- )
54
- DELETE FROM `discuss_state`
55
- WHERE `rowid` IN (SELECT `rid` FROM `ranked` WHERE `rn` > 1);
56
- --> statement-breakpoint
57
- CREATE UNIQUE INDEX IF NOT EXISTS `idx_discuss_state_unique` ON `discuss_state` (`flow_id`,`item_id`);
@@ -1,8 +0,0 @@
1
- CREATE TABLE IF NOT EXISTS `tool_results` (
2
- `session_key` text PRIMARY KEY NOT NULL,
3
- `run_id` text,
4
- `agent_id` text,
5
- `kind` text,
6
- `payload_json` text NOT NULL,
7
- `updated_at` integer NOT NULL
8
- );