agent-conveyor 0.1.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.
Files changed (85) hide show
  1. package/README.md +1123 -0
  2. package/dist/cli/main.d.ts +2 -0
  3. package/dist/cli/main.js +19 -0
  4. package/dist/cli/main.js.map +1 -0
  5. package/dist/cli/program-name.d.ts +2 -0
  6. package/dist/cli/program-name.js +12 -0
  7. package/dist/cli/program-name.js.map +1 -0
  8. package/dist/cli/typescript-runtime.d.ts +52 -0
  9. package/dist/cli/typescript-runtime.js +18009 -0
  10. package/dist/cli/typescript-runtime.js.map +1 -0
  11. package/dist/index.d.ts +37 -0
  12. package/dist/index.js +20 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/runtime/audit.d.ts +96 -0
  15. package/dist/runtime/audit.js +298 -0
  16. package/dist/runtime/audit.js.map +1 -0
  17. package/dist/runtime/classify.d.ts +8 -0
  18. package/dist/runtime/classify.js +128 -0
  19. package/dist/runtime/classify.js.map +1 -0
  20. package/dist/runtime/codex-session.d.ts +103 -0
  21. package/dist/runtime/codex-session.js +408 -0
  22. package/dist/runtime/codex-session.js.map +1 -0
  23. package/dist/runtime/commands.d.ts +92 -0
  24. package/dist/runtime/commands.js +408 -0
  25. package/dist/runtime/commands.js.map +1 -0
  26. package/dist/runtime/dispatch.d.ts +74 -0
  27. package/dist/runtime/dispatch.js +669 -0
  28. package/dist/runtime/dispatch.js.map +1 -0
  29. package/dist/runtime/export.d.ts +22 -0
  30. package/dist/runtime/export.js +77 -0
  31. package/dist/runtime/export.js.map +1 -0
  32. package/dist/runtime/ingest.d.ts +28 -0
  33. package/dist/runtime/ingest.js +177 -0
  34. package/dist/runtime/ingest.js.map +1 -0
  35. package/dist/runtime/loop-evidence.d.ts +87 -0
  36. package/dist/runtime/loop-evidence.js +448 -0
  37. package/dist/runtime/loop-evidence.js.map +1 -0
  38. package/dist/runtime/manager-config.d.ts +20 -0
  39. package/dist/runtime/manager-config.js +34 -0
  40. package/dist/runtime/manager-config.js.map +1 -0
  41. package/dist/runtime/manager-permissions.d.ts +7 -0
  42. package/dist/runtime/manager-permissions.js +85 -0
  43. package/dist/runtime/manager-permissions.js.map +1 -0
  44. package/dist/runtime/notifications.d.ts +89 -0
  45. package/dist/runtime/notifications.js +208 -0
  46. package/dist/runtime/notifications.js.map +1 -0
  47. package/dist/runtime/replay.d.ts +29 -0
  48. package/dist/runtime/replay.js +331 -0
  49. package/dist/runtime/replay.js.map +1 -0
  50. package/dist/runtime/tasks.d.ts +54 -0
  51. package/dist/runtime/tasks.js +195 -0
  52. package/dist/runtime/tasks.js.map +1 -0
  53. package/dist/runtime/tmux.d.ts +61 -0
  54. package/dist/runtime/tmux.js +189 -0
  55. package/dist/runtime/tmux.js.map +1 -0
  56. package/dist/runtime/visual-diff.d.ts +23 -0
  57. package/dist/runtime/visual-diff.js +234 -0
  58. package/dist/runtime/visual-diff.js.map +1 -0
  59. package/dist/state/database.d.ts +21 -0
  60. package/dist/state/database.js +142 -0
  61. package/dist/state/database.js.map +1 -0
  62. package/dist/state/files.d.ts +38 -0
  63. package/dist/state/files.js +73 -0
  64. package/dist/state/files.js.map +1 -0
  65. package/dist/state/schema-v22.d.ts +1 -0
  66. package/dist/state/schema-v22.js +566 -0
  67. package/dist/state/schema-v22.js.map +1 -0
  68. package/dist/state/sqlite-contract.d.ts +4 -0
  69. package/dist/state/sqlite-contract.js +78 -0
  70. package/dist/state/sqlite-contract.js.map +1 -0
  71. package/dist/state/status.d.ts +12 -0
  72. package/dist/state/status.js +40 -0
  73. package/dist/state/status.js.map +1 -0
  74. package/docs/typescript-migration/cli-contract.md +147 -0
  75. package/docs/typescript-migration/dashboard-contract.md +76 -0
  76. package/docs/typescript-migration/package-install-contract.md +98 -0
  77. package/docs/typescript-migration/qa-gate-matrix.md +103 -0
  78. package/docs/typescript-migration/sqlite-state-contract.md +92 -0
  79. package/docs/typescript-migration/t005-runtime-parity.md +47 -0
  80. package/package.json +88 -0
  81. package/scripts/capture-static-html-screenshot.mjs +88 -0
  82. package/skills/codex-review/SKILL.md +116 -0
  83. package/skills/codex-review/scripts/codex-review +344 -0
  84. package/skills/manage-codex-workers/SKILL.md +696 -0
  85. package/skills/manage-codex-workers/agents/openai.yaml +5 -0
@@ -0,0 +1,566 @@
1
+ // Generated from a Python-created Agent Conveyor v22 database schema.
2
+ // Regenerate deliberately when workerctl/db.py SCHEMA_VERSION changes.
3
+ export const SCHEMA_V22_SQL = String.raw `
4
+ CREATE TABLE acceptance_criteria(
5
+ id integer primary key autoincrement,
6
+ task_id text not null references tasks(id),
7
+ criterion text not null,
8
+ status text not null check (status in ('proposed','accepted','satisfied','deferred','rejected')),
9
+ source text not null check (source in ('user_requested','manager_inferred','worker_proposed','final_audit')),
10
+ proof text,
11
+ rationale text,
12
+ evidence_json text not null check (json_valid(evidence_json)),
13
+ created_at text not null,
14
+ updated_at text not null
15
+ );
16
+
17
+ CREATE TABLE agent_observations(
18
+ id integer primary key autoincrement,
19
+ task_id text not null references tasks(id),
20
+ worker_id text references workers(id),
21
+ manager_id text references managers(id),
22
+ role text not null check (role in ('worker','manager','workerctl')),
23
+ observation_type text not null check (observation_type in ('status','error','decision','blocker','summary','command_output','health','capture')),
24
+ severity text not null check (severity in ('info','warning','error')),
25
+ source_capture_id integer references terminal_captures(id),
26
+ command_id text references commands(id),
27
+ created_at text not null,
28
+ message text not null,
29
+ payload_json text not null check (json_valid(payload_json))
30
+ );
31
+
32
+ CREATE TABLE bindings(
33
+ id text primary key,
34
+ task_id text not null references tasks(id),
35
+ worker_id text references workers(id),
36
+ manager_id text references managers(id),
37
+ worker_session_id text references sessions(id),
38
+ manager_session_id text references sessions(id),
39
+ state text not null check (state in ('active','ending','ended','invalid')),
40
+ created_at text not null,
41
+ ended_at text
42
+ );
43
+
44
+ CREATE TABLE budgets(
45
+ task_id text primary key references tasks(id),
46
+ max_nudges integer not null check (max_nudges >= 0),
47
+ nudges_used integer not null default 0 check (nudges_used >= 0),
48
+ expires_at text not null,
49
+ check (nudges_used <= max_nudges)
50
+ );
51
+
52
+ CREATE TABLE codex_events(
53
+ id integer primary key autoincrement,
54
+ session_id text not null references sessions(id),
55
+ timestamp text not null,
56
+ type text not null,
57
+ subtype text,
58
+ payload_json text not null check (json_valid(payload_json)),
59
+ byte_offset integer not null,
60
+ ingested_at text not null
61
+ );
62
+
63
+ CREATE TABLE command_attempts(
64
+ id integer primary key autoincrement,
65
+ command_id text not null references commands(id),
66
+ correlation_id text not null,
67
+ dispatcher_id text not null,
68
+ started_at text not null,
69
+ finished_at text,
70
+ state text not null check (state in ('running','succeeded','failed','abandoned','blocked')),
71
+ result_json text check (result_json is null or json_valid(result_json)),
72
+ error text,
73
+ side_effect_started integer not null default 0 check (side_effect_started in (0, 1)),
74
+ side_effect_completed integer not null default 0 check (side_effect_completed in (0, 1))
75
+ );
76
+
77
+ CREATE TABLE commands(
78
+ id text primary key,
79
+ idempotency_key text unique not null,
80
+ created_at text not null,
81
+ updated_at text not null,
82
+ task_id text references tasks(id),
83
+ worker_id text references workers(id),
84
+ manager_id text references managers(id),
85
+ correlation_id text,
86
+ type text not null,
87
+ state text not null check (state in ('pending','attempted','succeeded','failed','blocked')),
88
+ available_at text,
89
+ claimed_by text,
90
+ claimed_at text,
91
+ claim_expires_at text,
92
+ attempts integer not null default 0 check (attempts >= 0),
93
+ max_attempts integer not null default 1 check (max_attempts > 0),
94
+ required_permission text,
95
+ payload_json text not null check (json_valid(payload_json)),
96
+ result_json text check (result_json is null or json_valid(result_json)),
97
+ error text
98
+ );
99
+
100
+ CREATE TABLE continuation_reviews(
101
+ id integer primary key autoincrement,
102
+ task_id text not null references tasks(id),
103
+ worker_continuation_id integer not null references task_continuations(id),
104
+ manager_continuation_id integer not null references task_continuations(id),
105
+ agreement text not null check (agreement in ('match','compatible','divergent')),
106
+ verdict text not null check (verdict in ('proceed','amend','stop')),
107
+ addendum text,
108
+ rationale text not null,
109
+ subagent_run_json text not null check (json_valid(subagent_run_json)),
110
+ created_at text not null,
111
+ correlation_id text not null
112
+ );
113
+
114
+ CREATE TABLE data_migrations(
115
+ name text primary key,
116
+ source_path text not null,
117
+ source_hash text not null,
118
+ applied_at text not null
119
+ );
120
+
121
+ CREATE TABLE epilogue_runs(
122
+ id integer primary key autoincrement,
123
+ task_id text not null references tasks(id),
124
+ step_name text not null,
125
+ state text not null check (state in ('pending','running','succeeded','failed','skipped')),
126
+ started_at text not null,
127
+ finished_at text,
128
+ result_json text check (result_json is null or json_valid(result_json)),
129
+ error text,
130
+ correlation_id text
131
+ );
132
+
133
+ CREATE TABLE events(
134
+ id integer primary key autoincrement,
135
+ created_at text not null,
136
+ actor text not null,
137
+ command_id text references commands(id),
138
+ correlation_id text,
139
+ task_id text references tasks(id),
140
+ worker_id text references workers(id),
141
+ manager_id text references managers(id),
142
+ type text not null,
143
+ payload_json text not null check (json_valid(payload_json))
144
+ );
145
+
146
+ CREATE TABLE manager_configs(
147
+ task_id text primary key references tasks(id),
148
+ supervision_mode text not null check (supervision_mode in ('light','guided','strict')),
149
+ objective text,
150
+ guidelines_json text not null check (json_valid(guidelines_json)),
151
+ acceptance_criteria_json text not null check (json_valid(acceptance_criteria_json)),
152
+ reference_paths_json text not null check (json_valid(reference_paths_json)),
153
+ permissions_json text not null check (json_valid(permissions_json)),
154
+ tools_json text not null default '[]' check (json_valid(tools_json)),
155
+ epilogues_json text not null default '[]' check (json_valid(epilogues_json)),
156
+ nudge_on_completion text not null default 'ask-operator' check (nudge_on_completion in ('off','ask-operator','auto-review','auto-proceed')),
157
+ require_acks integer not null default 0 check (require_acks in (0, 1)),
158
+ revision integer not null default 1 check (revision > 0),
159
+ created_at text not null,
160
+ updated_at text not null
161
+ );
162
+
163
+ CREATE TABLE manager_cycle_spans(
164
+ id integer primary key autoincrement,
165
+ manager_cycle_id integer not null references manager_cycles(id),
166
+ task_id text not null references tasks(id),
167
+ run_id text references runs(id),
168
+ phase text not null,
169
+ started_at text not null,
170
+ completed_at text not null,
171
+ duration_ms real not null check (duration_ms >= 0),
172
+ state text not null check (state in ('succeeded','failed','degraded')),
173
+ attributes_json text not null check (json_valid(attributes_json)),
174
+ error_type text,
175
+ manager_decision_id integer references manager_decisions(id),
176
+ command_id text references commands(id)
177
+ );
178
+
179
+ CREATE TABLE manager_cycles(
180
+ id integer primary key autoincrement,
181
+ task_id text not null references tasks(id),
182
+ manager_id text references managers(id),
183
+ started_at text not null,
184
+ completed_at text,
185
+ state text not null check (state in ('started','succeeded','failed')),
186
+ health_observation_id integer references agent_observations(id),
187
+ manager_capture_id integer references terminal_captures(id),
188
+ worker_capture_id integer references terminal_captures(id),
189
+ status_json text check (status_json is null or json_valid(status_json)),
190
+ health_json text check (health_json is null or json_valid(health_json)),
191
+ decision text,
192
+ error text
193
+ );
194
+
195
+ CREATE TABLE manager_decisions(
196
+ id integer primary key autoincrement,
197
+ task_id text not null references tasks(id),
198
+ manager_id text references managers(id),
199
+ manager_cycle_id integer references manager_cycles(id),
200
+ decision text not null check (decision in ('wait','nudge','interrupt','escalate','stop','inspect')),
201
+ reason text not null,
202
+ created_at text not null,
203
+ payload_json text not null check (json_valid(payload_json))
204
+ );
205
+
206
+ CREATE TABLE managers(
207
+ id text primary key,
208
+ name text unique not null,
209
+ task_id text not null references tasks(id),
210
+ tmux_session text unique not null,
211
+ tmux_pane_id text,
212
+ state text not null check (state in ('starting','ready','stopping','stopped','missing','failed')),
213
+ codex_args_json text not null check (json_valid(codex_args_json)),
214
+ started_at text not null,
215
+ stopped_at text,
216
+ last_seen_at text,
217
+ last_capture_sha256 text,
218
+ exit_detected_at text,
219
+ exit_reason text
220
+ );
221
+
222
+ CREATE TABLE prompts(
223
+ id integer primary key autoincrement,
224
+ task_id text references tasks(id),
225
+ manager_id text references managers(id),
226
+ kind text not null check (kind in ('manager','worker_contract','resume')),
227
+ content text not null,
228
+ content_sha256 text not null,
229
+ generator_version text not null,
230
+ source_snapshot_json text not null check (json_valid(source_snapshot_json)),
231
+ policy_json text not null check (json_valid(policy_json)),
232
+ artifact_path text,
233
+ created_at text not null
234
+ );
235
+
236
+ CREATE TABLE routed_notifications(
237
+ id integer primary key autoincrement,
238
+ task_id text not null references tasks(id),
239
+ binding_id text not null references bindings(id),
240
+ correlation_id text not null,
241
+ source_session_id text not null references sessions(id),
242
+ target_session_id text not null references sessions(id),
243
+ signal_type text not null,
244
+ source_event_id integer references codex_events(id),
245
+ source_event_timestamp text,
246
+ dedupe_key text not null unique,
247
+ command_id text references commands(id),
248
+ created_at text not null,
249
+ delivered_at text,
250
+ consumed_manager_cycle_id integer references manager_cycles(id),
251
+ consumed_by_session_id text references sessions(id),
252
+ consumed_at text,
253
+ delivery_mode text not null default 'push' check (delivery_mode in ('push','pull_required')),
254
+ state text not null check (state in ('pending','delivered','failed','suppressed')),
255
+ claimed_by text,
256
+ claimed_at text,
257
+ claim_expires_at text,
258
+ side_effect_started integer not null default 0 check (side_effect_started in (0, 1)),
259
+ side_effect_completed integer not null default 0 check (side_effect_completed in (0, 1)),
260
+ payload_json text not null check (json_valid(payload_json)),
261
+ error text
262
+ );
263
+
264
+ CREATE TABLE runs(
265
+ id text primary key,
266
+ task_id text not null references tasks(id),
267
+ name text not null,
268
+ purpose text,
269
+ status text not null check (status in ('active','finished','failed','abandoned')),
270
+ started_at text not null,
271
+ ended_at text,
272
+ metadata_json text not null check (json_valid(metadata_json))
273
+ );
274
+
275
+ CREATE TABLE schema_migrations(
276
+ version integer primary key,
277
+ applied_at text not null
278
+ );
279
+
280
+ CREATE TABLE sessions(
281
+ id text primary key,
282
+ name text unique not null,
283
+ role text not null check (role in ('worker','manager')),
284
+ identity_token text unique not null,
285
+ tmux_session text,
286
+ tmux_pane_id text,
287
+ codex_session_path text,
288
+ codex_session_id text,
289
+ pid integer,
290
+ cwd text not null,
291
+ registered_at text not null,
292
+ last_heartbeat_at text,
293
+ state text not null check (state in ('active','gone'))
294
+ , last_ingest_offset integer);
295
+
296
+ CREATE TABLE statuses(
297
+ id integer primary key autoincrement,
298
+ worker_id text not null references workers(id),
299
+ state text not null check (state in ('planning','editing','running_tests','blocked','waiting','done','unknown')),
300
+ current_task text,
301
+ next_action text,
302
+ blocker text,
303
+ created_at text not null
304
+ );
305
+
306
+ CREATE TABLE task_acknowledgements(
307
+ id integer primary key autoincrement,
308
+ task_id text not null references tasks(id),
309
+ binding_id text references bindings(id),
310
+ role text not null check (role in ('worker','manager')),
311
+ payload_json text not null check (json_valid(payload_json)),
312
+ revision integer not null check (revision > 0),
313
+ manager_config_revision integer check (manager_config_revision is null or manager_config_revision > 0),
314
+ created_at text not null,
315
+ correlation_id text
316
+ );
317
+
318
+ CREATE TABLE task_continuations(
319
+ id integer primary key autoincrement,
320
+ task_id text not null references tasks(id),
321
+ proposer text not null check (proposer in ('worker','manager')),
322
+ payload_json text not null check (json_valid(payload_json)),
323
+ revision integer not null check (revision > 0),
324
+ created_at text not null,
325
+ correlation_id text not null
326
+ );
327
+
328
+ CREATE TABLE tasks(
329
+ id text primary key,
330
+ name text not null,
331
+ goal text not null,
332
+ summary text,
333
+ state text not null check (state in ('candidate','managed','paused','done','failed')),
334
+ created_at text not null,
335
+ updated_at text not null
336
+ );
337
+
338
+ CREATE TABLE telemetry_events(
339
+ id text primary key,
340
+ run_id text references runs(id),
341
+ task_id text references tasks(id),
342
+ timestamp text not null,
343
+ actor text not null check (actor in ('dispatch','manager','worker','operator','workerctl','system')),
344
+ event_type text not null,
345
+ severity text not null check (severity in ('debug','info','warning','error')),
346
+ summary text not null,
347
+ correlation_json text not null check (json_valid(correlation_json)),
348
+ attributes_json text not null check (json_valid(attributes_json))
349
+ );
350
+
351
+ CREATE VIRTUAL TABLE telemetry_events_fts using fts5(
352
+ event_id unindexed,
353
+ task_id unindexed,
354
+ run_id unindexed,
355
+ actor unindexed,
356
+ event_type unindexed,
357
+ summary,
358
+ attributes
359
+ );
360
+
361
+ CREATE TABLE terminal_captures(
362
+ id integer primary key autoincrement,
363
+ task_id text not null references tasks(id),
364
+ worker_id text references workers(id),
365
+ manager_id text references managers(id),
366
+ role text not null check (role in ('worker','manager')),
367
+ tmux_session text not null,
368
+ tmux_pane_id text,
369
+ command_id text references commands(id),
370
+ captured_at text not null,
371
+ history_lines integer not null,
372
+ content_sha256 text not null,
373
+ content text,
374
+ content_path text,
375
+ byte_count integer not null,
376
+ line_count integer not null,
377
+ classifier_json text not null check (json_valid(classifier_json)),
378
+ source text not null
379
+ );
380
+
381
+ CREATE TABLE transcript_captures(
382
+ id integer primary key autoincrement,
383
+ worker_id text not null references workers(id),
384
+ sha256 text not null,
385
+ content text,
386
+ captured_at text not null,
387
+ changed_at text not null,
388
+ history_lines integer not null,
389
+ byte_count integer not null,
390
+ line_count integer not null,
391
+ capture_kind text not null check (capture_kind in ('latest','changed','metadata_only','archived')),
392
+ retention_class text not null check (retention_class in ('hot','warm','archive'))
393
+ );
394
+
395
+ CREATE TABLE transcript_segments(
396
+ id integer primary key autoincrement,
397
+ task_id text not null references tasks(id),
398
+ role text not null check (role in ('worker','manager')),
399
+ source_capture_id integer not null references terminal_captures(id),
400
+ previous_capture_id integer references terminal_captures(id),
401
+ captured_at text not null,
402
+ content_sha256 text not null,
403
+ segment_text text,
404
+ segment_start_line integer,
405
+ segment_end_line integer,
406
+ byte_count integer not null,
407
+ line_count integer not null,
408
+ retention_class text not null check (retention_class in ('hot','warm','cold','redacted')),
409
+ segment_kind text not null check (segment_kind in ('metadata','excerpt','snapshot','segment','reset')),
410
+ redacted integer not null default 0 check (redacted in (0, 1)),
411
+ created_at text not null
412
+ );
413
+
414
+ CREATE TABLE worker_handoffs(
415
+ id integer primary key autoincrement,
416
+ task_id text not null references tasks(id),
417
+ worker_session_id text references sessions(id),
418
+ summary text not null,
419
+ next_steps_json text not null check (json_valid(next_steps_json)),
420
+ payload_json text not null check (json_valid(payload_json)),
421
+ created_at text not null
422
+ );
423
+
424
+ CREATE TABLE workers(
425
+ id text primary key,
426
+ name text unique not null,
427
+ tmux_session text unique not null,
428
+ tmux_pane_id text,
429
+ identity_token text unique not null,
430
+ cwd text not null,
431
+ state text not null check (state in ('candidate','active','stopped','missing','failed')),
432
+ created_at text not null,
433
+ updated_at text not null,
434
+ last_seen_at text,
435
+ exit_detected_at text,
436
+ exit_reason text
437
+ );
438
+
439
+ CREATE UNIQUE INDEX acceptance_criteria_task_source_criterion
440
+ on acceptance_criteria(task_id, source, criterion);
441
+
442
+ CREATE INDEX acceptance_criteria_task_status
443
+ on acceptance_criteria(task_id, status, id);
444
+
445
+ CREATE INDEX agent_observations_task_id
446
+ on agent_observations(task_id, id);
447
+
448
+ CREATE INDEX codex_events_session_id
449
+ on codex_events(session_id, id);
450
+
451
+ CREATE INDEX command_attempts_command_id
452
+ on command_attempts(command_id, id);
453
+
454
+ CREATE INDEX command_attempts_correlation_id
455
+ on command_attempts(correlation_id);
456
+
457
+ CREATE INDEX commands_claimable
458
+ on commands(state, type, available_at, created_at, id);
459
+
460
+ CREATE INDEX commands_task_state_created
461
+ on commands(task_id, state, created_at);
462
+
463
+ CREATE INDEX continuation_reviews_task
464
+ on continuation_reviews(task_id, id);
465
+
466
+ CREATE INDEX epilogue_runs_task_step
467
+ on epilogue_runs(task_id, step_name, id);
468
+
469
+ CREATE INDEX events_task_id
470
+ on events(task_id, id);
471
+
472
+ CREATE INDEX manager_configs_task_id
473
+ on manager_configs(task_id);
474
+
475
+ CREATE INDEX manager_cycle_spans_cycle_phase
476
+ on manager_cycle_spans(manager_cycle_id, phase, id);
477
+
478
+ CREATE INDEX manager_cycle_spans_task
479
+ on manager_cycle_spans(task_id, id);
480
+
481
+ CREATE UNIQUE INDEX one_active_binding_per_manager_session
482
+ on bindings(manager_session_id) where state in ('active', 'ending');
483
+
484
+ CREATE UNIQUE INDEX one_active_binding_per_task
485
+ on bindings(task_id)
486
+ where state in ('active', 'ending');
487
+
488
+ CREATE UNIQUE INDEX one_active_binding_per_worker
489
+ on bindings(worker_id)
490
+ where state in ('active', 'ending');
491
+
492
+ CREATE UNIQUE INDEX one_active_binding_per_worker_session
493
+ on bindings(worker_session_id) where state in ('active', 'ending');
494
+
495
+ CREATE UNIQUE INDEX one_active_manager_per_task
496
+ on managers(task_id)
497
+ where state in ('starting', 'ready', 'stopping');
498
+
499
+ CREATE UNIQUE INDEX one_active_run_per_task
500
+ on runs(task_id)
501
+ where status = 'active';
502
+
503
+ CREATE INDEX routed_notifications_claimable
504
+ on routed_notifications(state, signal_type, side_effect_started, claim_expires_at, created_at);
505
+
506
+ CREATE INDEX routed_notifications_consumed_cycle
507
+ on routed_notifications(consumed_manager_cycle_id);
508
+
509
+ CREATE UNIQUE INDEX routed_notifications_dedupe_key
510
+ on routed_notifications(dedupe_key);
511
+
512
+ CREATE INDEX routed_notifications_source_event
513
+ on routed_notifications(source_event_id);
514
+
515
+ CREATE INDEX routed_notifications_target_inbox
516
+ on routed_notifications(target_session_id, consumed_at, state, created_at, id);
517
+
518
+ CREATE INDEX runs_task_status
519
+ on runs(task_id, status, started_at);
520
+
521
+ CREATE INDEX statuses_worker_id
522
+ on statuses(worker_id, id);
523
+
524
+ CREATE INDEX task_acknowledgements_task_role_revision
525
+ on task_acknowledgements(task_id, role, revision desc, id desc);
526
+
527
+ CREATE INDEX task_continuations_task_role_revision
528
+ on task_continuations(task_id, proposer, revision desc, id desc);
529
+
530
+ CREATE INDEX telemetry_events_actor_timestamp
531
+ on telemetry_events(actor, timestamp, id);
532
+
533
+ CREATE INDEX telemetry_events_run_timestamp
534
+ on telemetry_events(run_id, timestamp, id);
535
+
536
+ CREATE INDEX telemetry_events_task_timestamp
537
+ on telemetry_events(task_id, timestamp, id);
538
+
539
+ CREATE INDEX telemetry_events_type_timestamp
540
+ on telemetry_events(event_type, timestamp, id);
541
+
542
+ CREATE INDEX terminal_captures_task_role
543
+ on terminal_captures(task_id, role, id);
544
+
545
+ CREATE INDEX transcript_captures_worker_id
546
+ on transcript_captures(worker_id, id);
547
+
548
+ CREATE INDEX transcript_segments_task_role
549
+ on transcript_segments(task_id, role, id);
550
+
551
+ CREATE INDEX worker_handoffs_task_id
552
+ on worker_handoffs(task_id, id);
553
+
554
+ CREATE TRIGGER events_no_delete
555
+ before delete on events
556
+ begin
557
+ select raise(abort, 'events are append-only');
558
+ end;
559
+
560
+ CREATE TRIGGER events_no_update
561
+ before update on events
562
+ begin
563
+ select raise(abort, 'events are append-only');
564
+ end;
565
+ `;
566
+ //# sourceMappingURL=schema-v22.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-v22.js","sourceRoot":"","sources":["../../src/state/schema-v22.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkjBvC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const SCHEMA_VERSION = 22;
2
+ export declare const REQUIRED_TABLES: Set<string>;
3
+ export declare const REQUIRED_INDEXES: Set<string>;
4
+ export declare const REQUIRED_TRIGGERS: Set<string>;
@@ -0,0 +1,78 @@
1
+ export const SCHEMA_VERSION = 22;
2
+ export const REQUIRED_TABLES = new Set([
3
+ "acceptance_criteria",
4
+ "agent_observations",
5
+ "bindings",
6
+ "budgets",
7
+ "codex_events",
8
+ "command_attempts",
9
+ "commands",
10
+ "continuation_reviews",
11
+ "data_migrations",
12
+ "epilogue_runs",
13
+ "events",
14
+ "manager_configs",
15
+ "manager_cycles",
16
+ "manager_cycle_spans",
17
+ "manager_decisions",
18
+ "managers",
19
+ "prompts",
20
+ "routed_notifications",
21
+ "runs",
22
+ "schema_migrations",
23
+ "sessions",
24
+ "statuses",
25
+ "task_acknowledgements",
26
+ "task_continuations",
27
+ "tasks",
28
+ "telemetry_events",
29
+ "telemetry_events_fts",
30
+ "terminal_captures",
31
+ "transcript_captures",
32
+ "transcript_segments",
33
+ "worker_handoffs",
34
+ "workers",
35
+ ]);
36
+ export const REQUIRED_INDEXES = new Set([
37
+ "acceptance_criteria_task_source_criterion",
38
+ "acceptance_criteria_task_status",
39
+ "agent_observations_task_id",
40
+ "codex_events_session_id",
41
+ "command_attempts_command_id",
42
+ "command_attempts_correlation_id",
43
+ "commands_claimable",
44
+ "commands_task_state_created",
45
+ "continuation_reviews_task",
46
+ "epilogue_runs_task_step",
47
+ "events_task_id",
48
+ "manager_configs_task_id",
49
+ "manager_cycle_spans_cycle_phase",
50
+ "manager_cycle_spans_task",
51
+ "one_active_binding_per_manager_session",
52
+ "one_active_binding_per_task",
53
+ "one_active_binding_per_worker",
54
+ "one_active_binding_per_worker_session",
55
+ "one_active_manager_per_task",
56
+ "one_active_run_per_task",
57
+ "routed_notifications_claimable",
58
+ "routed_notifications_dedupe_key",
59
+ "routed_notifications_source_event",
60
+ "routed_notifications_target_inbox",
61
+ "runs_task_status",
62
+ "statuses_worker_id",
63
+ "task_acknowledgements_task_role_revision",
64
+ "task_continuations_task_role_revision",
65
+ "telemetry_events_actor_timestamp",
66
+ "telemetry_events_run_timestamp",
67
+ "telemetry_events_task_timestamp",
68
+ "telemetry_events_type_timestamp",
69
+ "terminal_captures_task_role",
70
+ "transcript_captures_worker_id",
71
+ "transcript_segments_task_role",
72
+ "worker_handoffs_task_id",
73
+ ]);
74
+ export const REQUIRED_TRIGGERS = new Set([
75
+ "events_no_delete",
76
+ "events_no_update",
77
+ ]);
78
+ //# sourceMappingURL=sqlite-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-contract.js","sourceRoot":"","sources":["../../src/state/sqlite-contract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACrC,qBAAqB;IACrB,oBAAoB;IACpB,UAAU;IACV,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,UAAU;IACV,sBAAsB;IACtB,iBAAiB;IACjB,eAAe;IACf,QAAQ;IACR,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,mBAAmB;IACnB,UAAU;IACV,SAAS;IACT,sBAAsB;IACtB,MAAM;IACN,mBAAmB;IACnB,UAAU;IACV,UAAU;IACV,uBAAuB;IACvB,oBAAoB;IACpB,OAAO;IACP,kBAAkB;IAClB,sBAAsB;IACtB,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,iBAAiB;IACjB,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IACtC,2CAA2C;IAC3C,iCAAiC;IACjC,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,iCAAiC;IACjC,oBAAoB;IACpB,6BAA6B;IAC7B,2BAA2B;IAC3B,yBAAyB;IACzB,gBAAgB;IAChB,yBAAyB;IACzB,iCAAiC;IACjC,0BAA0B;IAC1B,wCAAwC;IACxC,6BAA6B;IAC7B,+BAA+B;IAC/B,uCAAuC;IACvC,6BAA6B;IAC7B,yBAAyB;IACzB,gCAAgC;IAChC,iCAAiC;IACjC,mCAAmC;IACnC,mCAAmC;IACnC,kBAAkB;IAClB,oBAAoB;IACpB,0CAA0C;IAC1C,uCAAuC;IACvC,kCAAkC;IAClC,gCAAgC;IAChC,iCAAiC;IACjC,iCAAiC;IACjC,6BAA6B;IAC7B,+BAA+B;IAC/B,+BAA+B;IAC/B,yBAAyB;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,kBAAkB;IAClB,kBAAkB;CACnB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface WorkerStatus {
2
+ blocker?: string | null;
3
+ current_task?: string;
4
+ last_update?: string;
5
+ next_action?: string;
6
+ state?: string;
7
+ }
8
+ export declare function latestStatusSync(name: string, options?: {
9
+ cwd?: string;
10
+ dbPath?: string;
11
+ env?: NodeJS.ProcessEnv;
12
+ }): WorkerStatus;