conductor-remote 1.107.0 → 1.108.0
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.
- package/README.md +65 -44
- package/dist/assets/{PierrePatch-CfKXuj7p.js → PierrePatch-DF-STc4J.js} +1 -1
- package/dist/assets/index-DM7eCDXg.css +1 -0
- package/dist/assets/index-DWbWwEOp.js +59 -0
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/dist-node/src/logbuf.js +4 -3
- package/dist-node/src/mcp-tools.js +48 -138
- package/dist-node/src/model-cache.js +22 -7
- package/dist-node/src/orchestration-db.js +2150 -0
- package/dist-node/src/orchestration-schema.generated.js +306 -0
- package/dist-node/src/orchestration-schema.js +417 -0
- package/dist-node/src/preview-urls.js +1 -1
- package/dist-node/src/reads.js +135 -6
- package/dist-node/src/relay-processes.js +230 -0
- package/dist-node/src/roles.js +64 -12
- package/dist-node/src/routes.js +14 -1
- package/dist-node/src/search-worker.js +3 -1
- package/dist-node/src/server.js +1050 -211
- package/dist-node/src/shared.js +79 -2
- package/dist-node/src/transcript.js +20 -10
- package/dist-node/src/ui-lease-watchdog.js +94 -0
- package/dist-node/src/workflow-coordinator.js +2119 -0
- package/dist-node/src/workflow-effect-runner.js +336 -0
- package/dist-node/src/workflow-http.js +141 -0
- package/dist-node/src/workflow-machine.js +112 -0
- package/dist-node/src/workflow.js +111 -22
- package/dist-node/src/writes.js +157 -12
- package/package.json +9 -2
- package/dist/assets/index-BHV0KmAq.js +0 -58
- package/dist/assets/index-DwXH_w7X.css +0 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
// Generated by scripts/generate-orchestration-schema.ts. Do not edit.
|
|
2
|
+
export const ORCHESTRATION_BOOTSTRAP_SQL = `
|
|
3
|
+
CREATE TABLE \`orchestration_meta\` (
|
|
4
|
+
\`key\` text PRIMARY KEY,
|
|
5
|
+
\`value\` text NOT NULL
|
|
6
|
+
) STRICT;
|
|
7
|
+
|
|
8
|
+
CREATE TABLE \`relay_instances\` (
|
|
9
|
+
\`instance_id\` text PRIMARY KEY,
|
|
10
|
+
\`pid\` integer NOT NULL,
|
|
11
|
+
\`process_started_at\` text NOT NULL,
|
|
12
|
+
\`protocol_version\` integer NOT NULL,
|
|
13
|
+
\`can_drive_ui\` integer DEFAULT true NOT NULL,
|
|
14
|
+
\`heartbeat_at\` integer NOT NULL,
|
|
15
|
+
\`registered_at\` integer NOT NULL,
|
|
16
|
+
\`metadata_json\` text,
|
|
17
|
+
CONSTRAINT "relay_instances_can_drive_ui_boolean" CHECK("can_drive_ui" IN (0, 1)),
|
|
18
|
+
CONSTRAINT "relay_instances_metadata_json_valid" CHECK("metadata_json" IS NULL OR json_valid("metadata_json"))
|
|
19
|
+
) STRICT;
|
|
20
|
+
|
|
21
|
+
CREATE TABLE \`ui_mutex\` (
|
|
22
|
+
\`id\` integer PRIMARY KEY,
|
|
23
|
+
\`owner_instance_id\` text,
|
|
24
|
+
\`owner_pid\` integer,
|
|
25
|
+
\`owner_process_started_at\` text,
|
|
26
|
+
\`owner_protocol_version\` integer,
|
|
27
|
+
\`nonce\` text,
|
|
28
|
+
\`action_id\` text,
|
|
29
|
+
\`effect_id\` text,
|
|
30
|
+
\`external_pid\` integer,
|
|
31
|
+
\`external_process_started_at\` text,
|
|
32
|
+
\`external_process_group\` integer,
|
|
33
|
+
\`may_execute\` integer DEFAULT false NOT NULL,
|
|
34
|
+
\`deadline_at\` integer,
|
|
35
|
+
\`acquired_at\` integer,
|
|
36
|
+
\`updated_at\` integer,
|
|
37
|
+
CONSTRAINT "ui_mutex_singleton" CHECK("id" = 1),
|
|
38
|
+
CONSTRAINT "ui_mutex_may_execute_boolean" CHECK("may_execute" IN (0, 1))
|
|
39
|
+
) STRICT;
|
|
40
|
+
|
|
41
|
+
CREATE TABLE \`ui_quarantine\` (
|
|
42
|
+
\`id\` integer PRIMARY KEY,
|
|
43
|
+
\`active\` integer DEFAULT false NOT NULL,
|
|
44
|
+
\`action_id\` text,
|
|
45
|
+
\`effect_id\` text,
|
|
46
|
+
\`reason\` text,
|
|
47
|
+
\`owner_instance_id\` text,
|
|
48
|
+
\`owner_pid\` integer,
|
|
49
|
+
\`owner_process_started_at\` text,
|
|
50
|
+
\`owner_protocol_version\` integer,
|
|
51
|
+
\`external_pid\` integer,
|
|
52
|
+
\`external_process_started_at\` text,
|
|
53
|
+
\`external_process_group\` integer,
|
|
54
|
+
\`created_at\` integer,
|
|
55
|
+
\`cleared_at\` integer,
|
|
56
|
+
\`cleared_by\` text,
|
|
57
|
+
CONSTRAINT "ui_quarantine_singleton" CHECK("id" = 1),
|
|
58
|
+
CONSTRAINT "ui_quarantine_active_boolean" CHECK("active" IN (0, 1))
|
|
59
|
+
) STRICT;
|
|
60
|
+
|
|
61
|
+
CREATE TABLE \`workflow_capabilities\` (
|
|
62
|
+
\`id\` text PRIMARY KEY,
|
|
63
|
+
\`token_hash\` text NOT NULL UNIQUE,
|
|
64
|
+
\`run_id\` text NOT NULL,
|
|
65
|
+
\`root_session_id\` text NOT NULL,
|
|
66
|
+
\`cycle\` integer NOT NULL,
|
|
67
|
+
\`phase\` text NOT NULL,
|
|
68
|
+
\`revision\` integer NOT NULL,
|
|
69
|
+
\`allowed_roles_json\` text NOT NULL,
|
|
70
|
+
\`issued_with_rowid\` integer,
|
|
71
|
+
\`issued_with_turn_id\` text,
|
|
72
|
+
\`consumed_at\` integer,
|
|
73
|
+
\`revoked_at\` integer,
|
|
74
|
+
\`created_at\` integer NOT NULL,
|
|
75
|
+
CONSTRAINT \`fk_workflow_capabilities_run_id_workflow_runs_id_fk\` FOREIGN KEY (\`run_id\`) REFERENCES \`workflow_runs\`(\`id\`) ON DELETE CASCADE,
|
|
76
|
+
CONSTRAINT "workflow_capabilities_token_hash_length" CHECK(length("token_hash") = 64),
|
|
77
|
+
CONSTRAINT "workflow_capabilities_cycle_nonnegative" CHECK("cycle" >= 0),
|
|
78
|
+
CONSTRAINT "workflow_capabilities_revision_nonnegative" CHECK("revision" >= 0),
|
|
79
|
+
CONSTRAINT "workflow_capabilities_allowed_roles_json_valid" CHECK(json_valid("allowed_roles_json"))
|
|
80
|
+
) STRICT;
|
|
81
|
+
|
|
82
|
+
CREATE TABLE \`workflow_effect_attempts\` (
|
|
83
|
+
\`id\` text PRIMARY KEY,
|
|
84
|
+
\`effect_id\` text NOT NULL,
|
|
85
|
+
\`attempt_number\` integer NOT NULL,
|
|
86
|
+
\`state\` text NOT NULL,
|
|
87
|
+
\`owner_instance_id\` text NOT NULL,
|
|
88
|
+
\`owner_pid\` integer NOT NULL,
|
|
89
|
+
\`owner_process_started_at\` text NOT NULL,
|
|
90
|
+
\`owner_protocol_version\` integer NOT NULL,
|
|
91
|
+
\`launch_nonce\` text,
|
|
92
|
+
\`external_pid\` integer,
|
|
93
|
+
\`external_process_started_at\` text,
|
|
94
|
+
\`external_process_group\` integer,
|
|
95
|
+
\`may_execute\` integer DEFAULT false NOT NULL,
|
|
96
|
+
\`receipt_json\` text,
|
|
97
|
+
\`evidence_json\` text,
|
|
98
|
+
\`error_code\` text,
|
|
99
|
+
\`error_message\` text,
|
|
100
|
+
\`created_at\` integer NOT NULL,
|
|
101
|
+
\`updated_at\` integer NOT NULL,
|
|
102
|
+
\`terminal_at\` integer,
|
|
103
|
+
CONSTRAINT \`fk_workflow_effect_attempts_effect_id_workflow_effects_id_fk\` FOREIGN KEY (\`effect_id\`) REFERENCES \`workflow_effects\`(\`id\`) ON DELETE CASCADE,
|
|
104
|
+
CONSTRAINT \`workflow_effect_attempts_effect_number_unique\` UNIQUE(\`effect_id\`,\`attempt_number\`),
|
|
105
|
+
CONSTRAINT "workflow_effect_attempts_attempt_positive" CHECK("attempt_number" > 0),
|
|
106
|
+
CONSTRAINT "workflow_effect_attempts_state_valid" CHECK("state" IN ('prepared', 'dispatched', 'committed', 'failed', 'ambiguous', 'cancelled')),
|
|
107
|
+
CONSTRAINT "workflow_effect_attempts_may_execute_boolean" CHECK("may_execute" IN (0, 1)),
|
|
108
|
+
CONSTRAINT "workflow_effect_attempts_receipt_json_valid" CHECK("receipt_json" IS NULL OR json_valid("receipt_json")),
|
|
109
|
+
CONSTRAINT "workflow_effect_attempts_evidence_json_valid" CHECK("evidence_json" IS NULL OR json_valid("evidence_json"))
|
|
110
|
+
) STRICT;
|
|
111
|
+
|
|
112
|
+
CREATE TABLE \`workflow_effects\` (
|
|
113
|
+
\`id\` text PRIMARY KEY,
|
|
114
|
+
\`run_id\` text NOT NULL,
|
|
115
|
+
\`action_id\` text NOT NULL,
|
|
116
|
+
\`job_id\` text,
|
|
117
|
+
\`kind\` text NOT NULL,
|
|
118
|
+
\`state\` text NOT NULL,
|
|
119
|
+
\`target_json\` text,
|
|
120
|
+
\`inputs_json\` text,
|
|
121
|
+
\`baseline_json\` text,
|
|
122
|
+
\`cursor_json\` text,
|
|
123
|
+
\`receipt_json\` text,
|
|
124
|
+
\`error_code\` text,
|
|
125
|
+
\`error_message\` text,
|
|
126
|
+
\`owner_instance_id\` text,
|
|
127
|
+
\`owner_pid\` integer,
|
|
128
|
+
\`owner_process_started_at\` text,
|
|
129
|
+
\`owner_protocol_version\` integer,
|
|
130
|
+
\`launch_nonce\` text,
|
|
131
|
+
\`external_pid\` integer,
|
|
132
|
+
\`external_process_started_at\` text,
|
|
133
|
+
\`external_process_group\` integer,
|
|
134
|
+
\`may_execute\` integer DEFAULT false NOT NULL,
|
|
135
|
+
\`attempt_count\` integer DEFAULT 0 NOT NULL,
|
|
136
|
+
\`created_at\` integer NOT NULL,
|
|
137
|
+
\`updated_at\` integer NOT NULL,
|
|
138
|
+
\`terminal_at\` integer,
|
|
139
|
+
CONSTRAINT \`fk_workflow_effects_run_id_workflow_runs_id_fk\` FOREIGN KEY (\`run_id\`) REFERENCES \`workflow_runs\`(\`id\`) ON DELETE CASCADE,
|
|
140
|
+
CONSTRAINT \`fk_workflow_effects_job_id_workflow_jobs_id_fk\` FOREIGN KEY (\`job_id\`) REFERENCES \`workflow_jobs\`(\`id\`) ON DELETE CASCADE,
|
|
141
|
+
CONSTRAINT \`workflow_effects_run_action_unique\` UNIQUE(\`run_id\`,\`action_id\`),
|
|
142
|
+
CONSTRAINT "workflow_effects_state_valid" CHECK("state" IN ('prepared', 'dispatched', 'committed', 'failed', 'ambiguous', 'cancelled')),
|
|
143
|
+
CONSTRAINT "workflow_effects_target_json_valid" CHECK("target_json" IS NULL OR json_valid("target_json")),
|
|
144
|
+
CONSTRAINT "workflow_effects_inputs_json_valid" CHECK("inputs_json" IS NULL OR json_valid("inputs_json")),
|
|
145
|
+
CONSTRAINT "workflow_effects_baseline_json_valid" CHECK("baseline_json" IS NULL OR json_valid("baseline_json")),
|
|
146
|
+
CONSTRAINT "workflow_effects_cursor_json_valid" CHECK("cursor_json" IS NULL OR json_valid("cursor_json")),
|
|
147
|
+
CONSTRAINT "workflow_effects_receipt_json_valid" CHECK("receipt_json" IS NULL OR json_valid("receipt_json")),
|
|
148
|
+
CONSTRAINT "workflow_effects_may_execute_boolean" CHECK("may_execute" IN (0, 1)),
|
|
149
|
+
CONSTRAINT "workflow_effects_attempt_count_nonnegative" CHECK("attempt_count" >= 0)
|
|
150
|
+
) STRICT;
|
|
151
|
+
|
|
152
|
+
CREATE TABLE \`workflow_events\` (
|
|
153
|
+
\`id\` integer PRIMARY KEY AUTOINCREMENT,
|
|
154
|
+
\`run_id\` text NOT NULL,
|
|
155
|
+
\`event_key\` text NOT NULL,
|
|
156
|
+
\`type\` text NOT NULL,
|
|
157
|
+
\`data_json\` text,
|
|
158
|
+
\`created_at\` integer NOT NULL,
|
|
159
|
+
CONSTRAINT \`fk_workflow_events_run_id_workflow_runs_id_fk\` FOREIGN KEY (\`run_id\`) REFERENCES \`workflow_runs\`(\`id\`) ON DELETE CASCADE,
|
|
160
|
+
CONSTRAINT \`workflow_events_run_event_key_unique\` UNIQUE(\`run_id\`,\`event_key\`),
|
|
161
|
+
CONSTRAINT "workflow_events_data_json_valid" CHECK("data_json" IS NULL OR json_valid("data_json"))
|
|
162
|
+
) STRICT;
|
|
163
|
+
|
|
164
|
+
CREATE TABLE \`workflow_idempotency\` (
|
|
165
|
+
\`operation\` text NOT NULL,
|
|
166
|
+
\`client_id\` text NOT NULL,
|
|
167
|
+
\`request_hash\` text NOT NULL,
|
|
168
|
+
\`result_json\` text NOT NULL,
|
|
169
|
+
\`run_id\` text,
|
|
170
|
+
\`action_id\` text,
|
|
171
|
+
\`created_at\` integer NOT NULL,
|
|
172
|
+
CONSTRAINT \`workflow_idempotency_pk\` PRIMARY KEY(\`operation\`, \`client_id\`),
|
|
173
|
+
CONSTRAINT \`fk_workflow_idempotency_run_id_workflow_runs_id_fk\` FOREIGN KEY (\`run_id\`) REFERENCES \`workflow_runs\`(\`id\`) ON DELETE SET NULL,
|
|
174
|
+
CONSTRAINT "workflow_idempotency_request_hash_length" CHECK(length("request_hash") = 64),
|
|
175
|
+
CONSTRAINT "workflow_idempotency_result_json_valid" CHECK(json_valid("result_json"))
|
|
176
|
+
) STRICT;
|
|
177
|
+
|
|
178
|
+
CREATE TABLE \`workflow_job_attempts\` (
|
|
179
|
+
\`id\` text PRIMARY KEY,
|
|
180
|
+
\`job_id\` text NOT NULL,
|
|
181
|
+
\`attempt_number\` integer NOT NULL,
|
|
182
|
+
\`state\` text NOT NULL,
|
|
183
|
+
\`child_session_id\` text,
|
|
184
|
+
\`open_effect_id\` text,
|
|
185
|
+
\`configure_effect_id\` text,
|
|
186
|
+
\`task_effect_id\` text,
|
|
187
|
+
\`baton_effect_id\` text,
|
|
188
|
+
\`outcome_json\` text,
|
|
189
|
+
\`failure_evidence_json\` text,
|
|
190
|
+
\`owner_instance_id\` text,
|
|
191
|
+
\`owner_pid\` integer,
|
|
192
|
+
\`owner_process_started_at\` text,
|
|
193
|
+
\`owner_protocol_version\` integer,
|
|
194
|
+
\`created_at\` integer NOT NULL,
|
|
195
|
+
\`updated_at\` integer NOT NULL,
|
|
196
|
+
\`terminal_at\` integer,
|
|
197
|
+
CONSTRAINT \`fk_workflow_job_attempts_job_id_workflow_jobs_id_fk\` FOREIGN KEY (\`job_id\`) REFERENCES \`workflow_jobs\`(\`id\`) ON DELETE CASCADE,
|
|
198
|
+
CONSTRAINT \`workflow_job_attempts_job_number_unique\` UNIQUE(\`job_id\`,\`attempt_number\`),
|
|
199
|
+
CONSTRAINT "workflow_job_attempts_attempt_positive" CHECK("attempt_number" > 0),
|
|
200
|
+
CONSTRAINT "workflow_job_attempts_state_valid" CHECK("state" IN ('dormant', 'queued', 'owned', 'opening', 'configuring', 'sending', 'running', 'returning', 'returned', 'failed', 'cancelled')),
|
|
201
|
+
CONSTRAINT "workflow_job_attempts_outcome_json_valid" CHECK("outcome_json" IS NULL OR json_valid("outcome_json")),
|
|
202
|
+
CONSTRAINT "workflow_job_attempts_failure_evidence_json_valid" CHECK("failure_evidence_json" IS NULL OR json_valid("failure_evidence_json"))
|
|
203
|
+
) STRICT;
|
|
204
|
+
|
|
205
|
+
CREATE TABLE \`workflow_jobs\` (
|
|
206
|
+
\`id\` text PRIMARY KEY,
|
|
207
|
+
\`run_id\` text NOT NULL,
|
|
208
|
+
\`logical_key\` text NOT NULL,
|
|
209
|
+
\`role\` text NOT NULL,
|
|
210
|
+
\`cycle\` integer NOT NULL,
|
|
211
|
+
\`revision\` integer NOT NULL,
|
|
212
|
+
\`resolved_role_json\` text NOT NULL,
|
|
213
|
+
\`prompt\` text NOT NULL,
|
|
214
|
+
\`state\` text NOT NULL,
|
|
215
|
+
\`cancellation_generation\` integer NOT NULL,
|
|
216
|
+
\`owner_instance_id\` text,
|
|
217
|
+
\`owner_pid\` integer,
|
|
218
|
+
\`owner_process_started_at\` text,
|
|
219
|
+
\`owner_protocol_version\` integer,
|
|
220
|
+
\`transcript_cursor_json\` text,
|
|
221
|
+
\`child_session_id\` text,
|
|
222
|
+
\`outcome_json\` text,
|
|
223
|
+
\`task_receipt_json\` text,
|
|
224
|
+
\`baton_receipt_json\` text,
|
|
225
|
+
\`attempt_count\` integer DEFAULT 0 NOT NULL,
|
|
226
|
+
\`created_at\` integer NOT NULL,
|
|
227
|
+
\`updated_at\` integer NOT NULL,
|
|
228
|
+
\`terminal_at\` integer,
|
|
229
|
+
CONSTRAINT \`fk_workflow_jobs_run_id_workflow_runs_id_fk\` FOREIGN KEY (\`run_id\`) REFERENCES \`workflow_runs\`(\`id\`) ON DELETE CASCADE,
|
|
230
|
+
CONSTRAINT \`workflow_jobs_run_logical_key_unique\` UNIQUE(\`run_id\`,\`logical_key\`),
|
|
231
|
+
CONSTRAINT "workflow_jobs_role_valid" CHECK("role" IN ('exploration', 'implementation')),
|
|
232
|
+
CONSTRAINT "workflow_jobs_cycle_nonnegative" CHECK("cycle" >= 0),
|
|
233
|
+
CONSTRAINT "workflow_jobs_revision_nonnegative" CHECK("revision" >= 0),
|
|
234
|
+
CONSTRAINT "workflow_jobs_resolved_role_json_valid" CHECK(json_valid("resolved_role_json")),
|
|
235
|
+
CONSTRAINT "workflow_jobs_state_valid" CHECK("state" IN ('dormant', 'queued', 'owned', 'opening', 'configuring', 'sending', 'running', 'returning', 'returned', 'failed', 'cancelled')),
|
|
236
|
+
CONSTRAINT "workflow_jobs_cancellation_generation_nonnegative" CHECK("cancellation_generation" >= 0),
|
|
237
|
+
CONSTRAINT "workflow_jobs_transcript_cursor_json_valid" CHECK("transcript_cursor_json" IS NULL OR json_valid("transcript_cursor_json")),
|
|
238
|
+
CONSTRAINT "workflow_jobs_outcome_json_valid" CHECK("outcome_json" IS NULL OR json_valid("outcome_json")),
|
|
239
|
+
CONSTRAINT "workflow_jobs_task_receipt_json_valid" CHECK("task_receipt_json" IS NULL OR json_valid("task_receipt_json")),
|
|
240
|
+
CONSTRAINT "workflow_jobs_baton_receipt_json_valid" CHECK("baton_receipt_json" IS NULL OR json_valid("baton_receipt_json")),
|
|
241
|
+
CONSTRAINT "workflow_jobs_attempt_count_nonnegative" CHECK("attempt_count" >= 0)
|
|
242
|
+
) STRICT;
|
|
243
|
+
|
|
244
|
+
CREATE TABLE \`workflow_runs\` (
|
|
245
|
+
\`id\` text PRIMARY KEY,
|
|
246
|
+
\`objective\` text NOT NULL,
|
|
247
|
+
\`target_json\` text NOT NULL,
|
|
248
|
+
\`roles_json\` text NOT NULL,
|
|
249
|
+
\`phase\` text NOT NULL,
|
|
250
|
+
\`cycle\` integer DEFAULT 0 NOT NULL,
|
|
251
|
+
\`revision\` integer DEFAULT 0 NOT NULL,
|
|
252
|
+
\`workspace_id\` text,
|
|
253
|
+
\`root_session_id\` text,
|
|
254
|
+
\`pristine_evidence_json\` text,
|
|
255
|
+
\`delivery_baseline_json\` text,
|
|
256
|
+
\`planning_interpretation\` text,
|
|
257
|
+
\`cancellation_generation\` integer DEFAULT 0 NOT NULL,
|
|
258
|
+
\`blocked_action_id\` text,
|
|
259
|
+
\`blocked_error_code\` text,
|
|
260
|
+
\`blocked_message\` text,
|
|
261
|
+
\`resume_phase\` text,
|
|
262
|
+
\`retry_class\` text,
|
|
263
|
+
\`blocked_candidates_json\` text,
|
|
264
|
+
\`blocked_at\` integer,
|
|
265
|
+
\`implementation_batons_delivered\` integer DEFAULT 0 NOT NULL,
|
|
266
|
+
\`created_at\` integer NOT NULL,
|
|
267
|
+
\`updated_at\` integer NOT NULL,
|
|
268
|
+
\`terminal_at\` integer,
|
|
269
|
+
CONSTRAINT "workflow_runs_target_json_valid" CHECK(json_valid("target_json")),
|
|
270
|
+
CONSTRAINT "workflow_runs_roles_json_valid" CHECK(json_valid("roles_json")),
|
|
271
|
+
CONSTRAINT "workflow_runs_phase_valid" CHECK("phase" IN ('creating_workspace', 'binding_root', 'pending_root', 'exploring', 'planning', 'implementing', 'reviewing', 'blocked', 'completed', 'cancelled')),
|
|
272
|
+
CONSTRAINT "workflow_runs_cycle_nonnegative" CHECK("cycle" >= 0),
|
|
273
|
+
CONSTRAINT "workflow_runs_revision_nonnegative" CHECK("revision" >= 0),
|
|
274
|
+
CONSTRAINT "workflow_runs_pristine_evidence_json_valid" CHECK("pristine_evidence_json" IS NULL OR json_valid("pristine_evidence_json")),
|
|
275
|
+
CONSTRAINT "workflow_runs_delivery_baseline_json_valid" CHECK("delivery_baseline_json" IS NULL OR json_valid("delivery_baseline_json")),
|
|
276
|
+
CONSTRAINT "workflow_runs_cancellation_generation_nonnegative" CHECK("cancellation_generation" >= 0),
|
|
277
|
+
CONSTRAINT "workflow_runs_resume_phase_valid" CHECK("resume_phase" IS NULL OR "resume_phase" IN ('creating_workspace', 'binding_root', 'pending_root', 'exploring', 'planning', 'implementing', 'reviewing')),
|
|
278
|
+
CONSTRAINT "workflow_runs_retry_class_valid" CHECK("retry_class" IS NULL OR "retry_class" IN ('deterministic', 'ambiguous', 'terminal')),
|
|
279
|
+
CONSTRAINT "workflow_runs_blocked_candidates_json_valid" CHECK("blocked_candidates_json" IS NULL OR json_valid("blocked_candidates_json")),
|
|
280
|
+
CONSTRAINT "workflow_runs_implementation_batons_nonnegative" CHECK("implementation_batons_delivered" >= 0)
|
|
281
|
+
) STRICT;
|
|
282
|
+
|
|
283
|
+
CREATE INDEX \`relay_instances_protocol\` ON \`relay_instances\` (\`can_drive_ui\`,\`protocol_version\`,\`heartbeat_at\`);
|
|
284
|
+
|
|
285
|
+
CREATE INDEX \`workflow_capabilities_current\` ON \`workflow_capabilities\` (\`run_id\`,\`phase\`,\`cycle\`,\`revision\`) WHERE "workflow_capabilities"."consumed_at" IS NULL AND "workflow_capabilities"."revoked_at" IS NULL;
|
|
286
|
+
|
|
287
|
+
CREATE INDEX \`workflow_effects_runnable\` ON \`workflow_effects\` (\`state\`,\`updated_at\`) WHERE "workflow_effects"."state" = 'prepared';
|
|
288
|
+
|
|
289
|
+
CREATE INDEX \`workflow_effects_run_state\` ON \`workflow_effects\` (\`run_id\`,\`state\`);
|
|
290
|
+
|
|
291
|
+
CREATE INDEX \`workflow_events_run\` ON \`workflow_events\` (\`run_id\`,\`id\`);
|
|
292
|
+
|
|
293
|
+
CREATE INDEX \`workflow_jobs_runnable\` ON \`workflow_jobs\` (\`state\`,\`created_at\`) WHERE "workflow_jobs"."state" = 'queued';
|
|
294
|
+
|
|
295
|
+
CREATE INDEX \`workflow_jobs_run_state\` ON \`workflow_jobs\` (\`run_id\`,\`role\`,\`state\`);
|
|
296
|
+
|
|
297
|
+
CREATE UNIQUE INDEX \`workflow_runs_one_active_root\` ON \`workflow_runs\` (\`root_session_id\`) WHERE "workflow_runs"."root_session_id" IS NOT NULL AND "workflow_runs"."phase" NOT IN ('completed', 'cancelled');
|
|
298
|
+
|
|
299
|
+
CREATE INDEX \`workflow_runs_active_updated\` ON \`workflow_runs\` (\`phase\`,\`updated_at\`) WHERE "workflow_runs"."phase" NOT IN ('completed', 'cancelled');
|
|
300
|
+
|
|
301
|
+
CREATE INDEX \`workflow_runs_workspace_active\` ON \`workflow_runs\` (\`workspace_id\`,\`phase\`) WHERE "workflow_runs"."phase" NOT IN ('completed', 'cancelled');
|
|
302
|
+
|
|
303
|
+
INSERT INTO \`ui_mutex\` (\`id\`) VALUES (1);
|
|
304
|
+
|
|
305
|
+
INSERT INTO \`ui_quarantine\` (\`id\`) VALUES (1);
|
|
306
|
+
`;
|