@crewx/sdk 0.9.0-rc.140 → 0.9.0-rc.142

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 (37) hide show
  1. package/dist/app/app.d.ts +49 -1
  2. package/dist/app/content-media-types.d.ts +2 -0
  3. package/dist/app/context.d.ts +2 -0
  4. package/dist/app/frame.d.ts +56 -0
  5. package/dist/app/index.d.ts +4 -2
  6. package/dist/app/index.js +10 -9
  7. package/dist/app/protocol.d.ts +9 -0
  8. package/dist/app/runtime.d.ts +4 -2
  9. package/dist/app/tool-mode.d.ts +3 -0
  10. package/dist/esm/app/index.js +10 -9
  11. package/dist/esm/index.js +321 -288
  12. package/dist/esm/plugins/index.js +56 -56
  13. package/dist/esm/publish/index.js +2 -2
  14. package/dist/esm/repository/index.js +78 -78
  15. package/dist/esm/skills/index.js +2 -2
  16. package/dist/index.browser.js +3 -3
  17. package/dist/index.d.ts +5 -4
  18. package/dist/index.js +322 -289
  19. package/dist/mcp-app/content-channel.d.ts +3 -6
  20. package/dist/mcp-app/content-declarations.d.ts +4 -2
  21. package/dist/mcp-app/skill-backend.d.ts +3 -4
  22. package/dist/migrations/0036_ui_definition_archive.sql +8 -0
  23. package/dist/migrations/meta/0036_snapshot.json +3591 -0
  24. package/dist/migrations/meta/_journal.json +7 -0
  25. package/dist/plugins/index.js +55 -55
  26. package/dist/publish/index.js +2 -2
  27. package/dist/repository/index.js +74 -74
  28. package/dist/schema/index.d.ts +1 -0
  29. package/dist/schema/ui-definition-archive.d.ts +63 -0
  30. package/dist/skills/index.js +2 -2
  31. package/dist/ui-instance/index.d.ts +3 -3
  32. package/dist/ui-instance/lineage.d.ts +2 -0
  33. package/dist/ui-instance/store.d.ts +14 -0
  34. package/dist/ui-plugin/app-manifest.d.ts +7 -2
  35. package/dist/ui-plugin/index.d.ts +2 -2
  36. package/dist/ui-plugin/types.d.ts +10 -1
  37. package/package.json +1 -1
@@ -0,0 +1,3591 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "9afe787c-71aa-479c-97cd-d3ccca84d444",
5
+ "prevId": "f7a2e51c-bab5-4ea7-9bc7-94405e6e4ff2",
6
+ "tables": {
7
+ "workspaces": {
8
+ "name": "workspaces",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "slug": {
18
+ "name": "slug",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "name": {
25
+ "name": "name",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "workspace_path": {
32
+ "name": "workspace_path",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": false,
36
+ "autoincrement": false
37
+ },
38
+ "description": {
39
+ "name": "description",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "is_active": {
46
+ "name": "is_active",
47
+ "type": "integer",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false,
51
+ "default": 1
52
+ },
53
+ "created_at": {
54
+ "name": "created_at",
55
+ "type": "text",
56
+ "primaryKey": false,
57
+ "notNull": true,
58
+ "autoincrement": false
59
+ },
60
+ "updated_at": {
61
+ "name": "updated_at",
62
+ "type": "text",
63
+ "primaryKey": false,
64
+ "notNull": true,
65
+ "autoincrement": false
66
+ },
67
+ "starred": {
68
+ "name": "starred",
69
+ "type": "integer",
70
+ "primaryKey": false,
71
+ "notNull": true,
72
+ "autoincrement": false,
73
+ "default": 0
74
+ }
75
+ },
76
+ "indexes": {
77
+ "workspaces_slug_unique": {
78
+ "name": "workspaces_slug_unique",
79
+ "columns": [
80
+ "slug"
81
+ ],
82
+ "isUnique": true
83
+ }
84
+ },
85
+ "foreignKeys": {},
86
+ "compositePrimaryKeys": {},
87
+ "uniqueConstraints": {},
88
+ "checkConstraints": {}
89
+ },
90
+ "tasks": {
91
+ "name": "tasks",
92
+ "columns": {
93
+ "id": {
94
+ "name": "id",
95
+ "type": "text",
96
+ "primaryKey": true,
97
+ "notNull": true,
98
+ "autoincrement": false
99
+ },
100
+ "agent_id": {
101
+ "name": "agent_id",
102
+ "type": "text",
103
+ "primaryKey": false,
104
+ "notNull": true,
105
+ "autoincrement": false
106
+ },
107
+ "user_id": {
108
+ "name": "user_id",
109
+ "type": "text",
110
+ "primaryKey": false,
111
+ "notNull": false,
112
+ "autoincrement": false
113
+ },
114
+ "actor_kind": {
115
+ "name": "actor_kind",
116
+ "type": "text",
117
+ "primaryKey": false,
118
+ "notNull": false,
119
+ "autoincrement": false
120
+ },
121
+ "actor_id": {
122
+ "name": "actor_id",
123
+ "type": "text",
124
+ "primaryKey": false,
125
+ "notNull": false,
126
+ "autoincrement": false
127
+ },
128
+ "prompt": {
129
+ "name": "prompt",
130
+ "type": "text",
131
+ "primaryKey": false,
132
+ "notNull": true,
133
+ "autoincrement": false
134
+ },
135
+ "mode": {
136
+ "name": "mode",
137
+ "type": "text",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "autoincrement": false,
141
+ "default": "'execute'"
142
+ },
143
+ "status": {
144
+ "name": "status",
145
+ "type": "text",
146
+ "primaryKey": false,
147
+ "notNull": true,
148
+ "autoincrement": false,
149
+ "default": "'running'"
150
+ },
151
+ "result": {
152
+ "name": "result",
153
+ "type": "text",
154
+ "primaryKey": false,
155
+ "notNull": false,
156
+ "autoincrement": false
157
+ },
158
+ "error": {
159
+ "name": "error",
160
+ "type": "text",
161
+ "primaryKey": false,
162
+ "notNull": false,
163
+ "autoincrement": false
164
+ },
165
+ "started_at": {
166
+ "name": "started_at",
167
+ "type": "text",
168
+ "primaryKey": false,
169
+ "notNull": true,
170
+ "autoincrement": false
171
+ },
172
+ "completed_at": {
173
+ "name": "completed_at",
174
+ "type": "text",
175
+ "primaryKey": false,
176
+ "notNull": false,
177
+ "autoincrement": false
178
+ },
179
+ "duration_ms": {
180
+ "name": "duration_ms",
181
+ "type": "integer",
182
+ "primaryKey": false,
183
+ "notNull": false,
184
+ "autoincrement": false
185
+ },
186
+ "metadata": {
187
+ "name": "metadata",
188
+ "type": "text",
189
+ "primaryKey": false,
190
+ "notNull": false,
191
+ "autoincrement": false
192
+ },
193
+ "workspace_id": {
194
+ "name": "workspace_id",
195
+ "type": "text",
196
+ "primaryKey": false,
197
+ "notNull": false,
198
+ "autoincrement": false
199
+ },
200
+ "trace_id": {
201
+ "name": "trace_id",
202
+ "type": "text",
203
+ "primaryKey": false,
204
+ "notNull": false,
205
+ "autoincrement": false
206
+ },
207
+ "parent_task_id": {
208
+ "name": "parent_task_id",
209
+ "type": "text",
210
+ "primaryKey": false,
211
+ "notNull": false,
212
+ "autoincrement": false
213
+ },
214
+ "caller_agent_id": {
215
+ "name": "caller_agent_id",
216
+ "type": "text",
217
+ "primaryKey": false,
218
+ "notNull": false,
219
+ "autoincrement": false
220
+ },
221
+ "model": {
222
+ "name": "model",
223
+ "type": "text",
224
+ "primaryKey": false,
225
+ "notNull": false,
226
+ "autoincrement": false
227
+ },
228
+ "platform": {
229
+ "name": "platform",
230
+ "type": "text",
231
+ "primaryKey": false,
232
+ "notNull": false,
233
+ "autoincrement": false,
234
+ "default": "'cli'"
235
+ },
236
+ "crewx_version": {
237
+ "name": "crewx_version",
238
+ "type": "text",
239
+ "primaryKey": false,
240
+ "notNull": false,
241
+ "autoincrement": false
242
+ },
243
+ "input_tokens": {
244
+ "name": "input_tokens",
245
+ "type": "integer",
246
+ "primaryKey": false,
247
+ "notNull": false,
248
+ "autoincrement": false,
249
+ "default": 0
250
+ },
251
+ "output_tokens": {
252
+ "name": "output_tokens",
253
+ "type": "integer",
254
+ "primaryKey": false,
255
+ "notNull": false,
256
+ "autoincrement": false,
257
+ "default": 0
258
+ },
259
+ "cost_usd": {
260
+ "name": "cost_usd",
261
+ "type": "real",
262
+ "primaryKey": false,
263
+ "notNull": false,
264
+ "autoincrement": false,
265
+ "default": 0
266
+ },
267
+ "pid": {
268
+ "name": "pid",
269
+ "type": "integer",
270
+ "primaryKey": false,
271
+ "notNull": false,
272
+ "autoincrement": false
273
+ },
274
+ "heartbeat_at": {
275
+ "name": "heartbeat_at",
276
+ "type": "text",
277
+ "primaryKey": false,
278
+ "notNull": false,
279
+ "autoincrement": false
280
+ },
281
+ "stop_requested_at": {
282
+ "name": "stop_requested_at",
283
+ "type": "text",
284
+ "primaryKey": false,
285
+ "notNull": false,
286
+ "autoincrement": false
287
+ },
288
+ "stop_requested_epoch": {
289
+ "name": "stop_requested_epoch",
290
+ "type": "integer",
291
+ "primaryKey": false,
292
+ "notNull": false,
293
+ "autoincrement": false
294
+ },
295
+ "rendered_prompt": {
296
+ "name": "rendered_prompt",
297
+ "type": "text",
298
+ "primaryKey": false,
299
+ "notNull": false,
300
+ "autoincrement": false
301
+ },
302
+ "command": {
303
+ "name": "command",
304
+ "type": "text",
305
+ "primaryKey": false,
306
+ "notNull": false,
307
+ "autoincrement": false
308
+ },
309
+ "coding_agent_command": {
310
+ "name": "coding_agent_command",
311
+ "type": "text",
312
+ "primaryKey": false,
313
+ "notNull": false,
314
+ "autoincrement": false
315
+ },
316
+ "exit_code": {
317
+ "name": "exit_code",
318
+ "type": "integer",
319
+ "primaryKey": false,
320
+ "notNull": false,
321
+ "autoincrement": false
322
+ },
323
+ "logs": {
324
+ "name": "logs",
325
+ "type": "text",
326
+ "primaryKey": false,
327
+ "notNull": false,
328
+ "autoincrement": false
329
+ },
330
+ "log_storage": {
331
+ "name": "log_storage",
332
+ "type": "text",
333
+ "primaryKey": false,
334
+ "notNull": true,
335
+ "autoincrement": false,
336
+ "default": "'blob'"
337
+ },
338
+ "last_log_seq": {
339
+ "name": "last_log_seq",
340
+ "type": "integer",
341
+ "primaryKey": false,
342
+ "notNull": true,
343
+ "autoincrement": false,
344
+ "default": 0
345
+ },
346
+ "log_revision": {
347
+ "name": "log_revision",
348
+ "type": "integer",
349
+ "primaryKey": false,
350
+ "notNull": true,
351
+ "autoincrement": false,
352
+ "default": 0
353
+ },
354
+ "thread_id": {
355
+ "name": "thread_id",
356
+ "type": "text",
357
+ "primaryKey": false,
358
+ "notNull": false,
359
+ "autoincrement": false
360
+ },
361
+ "workspace_ref": {
362
+ "name": "workspace_ref",
363
+ "type": "text",
364
+ "primaryKey": false,
365
+ "notNull": false,
366
+ "autoincrement": false
367
+ },
368
+ "cwd": {
369
+ "name": "cwd",
370
+ "type": "text",
371
+ "primaryKey": false,
372
+ "notNull": false,
373
+ "autoincrement": false
374
+ },
375
+ "project_id": {
376
+ "name": "project_id",
377
+ "type": "text",
378
+ "primaryKey": false,
379
+ "notNull": false,
380
+ "autoincrement": false
381
+ },
382
+ "project_ref": {
383
+ "name": "project_ref",
384
+ "type": "text",
385
+ "primaryKey": false,
386
+ "notNull": false,
387
+ "autoincrement": false
388
+ },
389
+ "cached_input_tokens": {
390
+ "name": "cached_input_tokens",
391
+ "type": "integer",
392
+ "primaryKey": false,
393
+ "notNull": false,
394
+ "autoincrement": false,
395
+ "default": 0
396
+ },
397
+ "run_epoch": {
398
+ "name": "run_epoch",
399
+ "type": "integer",
400
+ "primaryKey": false,
401
+ "notNull": false,
402
+ "autoincrement": false,
403
+ "default": 0
404
+ }
405
+ },
406
+ "indexes": {
407
+ "idx_tasks_agent_id": {
408
+ "name": "idx_tasks_agent_id",
409
+ "columns": [
410
+ "agent_id"
411
+ ],
412
+ "isUnique": false
413
+ },
414
+ "idx_tasks_status": {
415
+ "name": "idx_tasks_status",
416
+ "columns": [
417
+ "status"
418
+ ],
419
+ "isUnique": false
420
+ },
421
+ "idx_tasks_started_at": {
422
+ "name": "idx_tasks_started_at",
423
+ "columns": [
424
+ "started_at"
425
+ ],
426
+ "isUnique": false
427
+ },
428
+ "idx_tasks_trace_id": {
429
+ "name": "idx_tasks_trace_id",
430
+ "columns": [
431
+ "trace_id"
432
+ ],
433
+ "isUnique": false
434
+ },
435
+ "idx_tasks_parent_task_id": {
436
+ "name": "idx_tasks_parent_task_id",
437
+ "columns": [
438
+ "parent_task_id"
439
+ ],
440
+ "isUnique": false
441
+ },
442
+ "idx_tasks_crewx_version": {
443
+ "name": "idx_tasks_crewx_version",
444
+ "columns": [
445
+ "crewx_version"
446
+ ],
447
+ "isUnique": false
448
+ },
449
+ "idx_tasks_pid": {
450
+ "name": "idx_tasks_pid",
451
+ "columns": [
452
+ "pid"
453
+ ],
454
+ "isUnique": false
455
+ },
456
+ "idx_tasks_status_heartbeat": {
457
+ "name": "idx_tasks_status_heartbeat",
458
+ "columns": [
459
+ "status",
460
+ "heartbeat_at"
461
+ ],
462
+ "isUnique": false
463
+ },
464
+ "idx_tasks_thread_id": {
465
+ "name": "idx_tasks_thread_id",
466
+ "columns": [
467
+ "thread_id"
468
+ ],
469
+ "isUnique": false
470
+ },
471
+ "idx_tasks_thread_creator": {
472
+ "name": "idx_tasks_thread_creator",
473
+ "columns": [
474
+ "id",
475
+ "thread_id",
476
+ "actor_kind",
477
+ "actor_id"
478
+ ],
479
+ "isUnique": false
480
+ },
481
+ "idx_tasks_workspace_id": {
482
+ "name": "idx_tasks_workspace_id",
483
+ "columns": [
484
+ "workspace_id"
485
+ ],
486
+ "isUnique": false
487
+ },
488
+ "idx_tasks_workspace_ref": {
489
+ "name": "idx_tasks_workspace_ref",
490
+ "columns": [
491
+ "workspace_ref"
492
+ ],
493
+ "isUnique": false
494
+ },
495
+ "idx_tasks_project_id": {
496
+ "name": "idx_tasks_project_id",
497
+ "columns": [
498
+ "project_id"
499
+ ],
500
+ "isUnique": false
501
+ },
502
+ "idx_tasks_ws_started": {
503
+ "name": "idx_tasks_ws_started",
504
+ "columns": [
505
+ "workspace_id",
506
+ "started_at"
507
+ ],
508
+ "isUnique": false
509
+ }
510
+ },
511
+ "foreignKeys": {},
512
+ "compositePrimaryKeys": {},
513
+ "uniqueConstraints": {},
514
+ "checkConstraints": {
515
+ "tasks_log_storage_ck": {
516
+ "name": "tasks_log_storage_ck",
517
+ "value": "\"tasks\".\"log_storage\" IN ('blob', 'events')"
518
+ }
519
+ }
520
+ },
521
+ "task_log_events": {
522
+ "name": "task_log_events",
523
+ "columns": {
524
+ "id": {
525
+ "name": "id",
526
+ "type": "integer",
527
+ "primaryKey": true,
528
+ "notNull": true,
529
+ "autoincrement": false
530
+ },
531
+ "task_id": {
532
+ "name": "task_id",
533
+ "type": "text",
534
+ "primaryKey": false,
535
+ "notNull": true,
536
+ "autoincrement": false
537
+ },
538
+ "seq": {
539
+ "name": "seq",
540
+ "type": "integer",
541
+ "primaryKey": false,
542
+ "notNull": true,
543
+ "autoincrement": false
544
+ },
545
+ "timestamp": {
546
+ "name": "timestamp",
547
+ "type": "text",
548
+ "primaryKey": false,
549
+ "notNull": true,
550
+ "autoincrement": false
551
+ },
552
+ "level": {
553
+ "name": "level",
554
+ "type": "text",
555
+ "primaryKey": false,
556
+ "notNull": true,
557
+ "autoincrement": false
558
+ },
559
+ "message": {
560
+ "name": "message",
561
+ "type": "text",
562
+ "primaryKey": false,
563
+ "notNull": true,
564
+ "autoincrement": false
565
+ }
566
+ },
567
+ "indexes": {
568
+ "task_log_events_task_seq_uq": {
569
+ "name": "task_log_events_task_seq_uq",
570
+ "columns": [
571
+ "task_id",
572
+ "seq"
573
+ ],
574
+ "isUnique": true
575
+ },
576
+ "task_log_events_timestamp_id_idx": {
577
+ "name": "task_log_events_timestamp_id_idx",
578
+ "columns": [
579
+ "timestamp",
580
+ "id"
581
+ ],
582
+ "isUnique": false
583
+ }
584
+ },
585
+ "foreignKeys": {
586
+ "task_log_events_task_id_tasks_id_fk": {
587
+ "name": "task_log_events_task_id_tasks_id_fk",
588
+ "tableFrom": "task_log_events",
589
+ "tableTo": "tasks",
590
+ "columnsFrom": [
591
+ "task_id"
592
+ ],
593
+ "columnsTo": [
594
+ "id"
595
+ ],
596
+ "onDelete": "cascade",
597
+ "onUpdate": "no action"
598
+ }
599
+ },
600
+ "compositePrimaryKeys": {},
601
+ "uniqueConstraints": {},
602
+ "checkConstraints": {}
603
+ },
604
+ "threads": {
605
+ "name": "threads",
606
+ "columns": {
607
+ "id": {
608
+ "name": "id",
609
+ "type": "text",
610
+ "primaryKey": true,
611
+ "notNull": true,
612
+ "autoincrement": false
613
+ },
614
+ "workspace_id": {
615
+ "name": "workspace_id",
616
+ "type": "text",
617
+ "primaryKey": false,
618
+ "notNull": false,
619
+ "autoincrement": false
620
+ },
621
+ "created_by_kind": {
622
+ "name": "created_by_kind",
623
+ "type": "text",
624
+ "primaryKey": false,
625
+ "notNull": false,
626
+ "autoincrement": false
627
+ },
628
+ "created_by_id": {
629
+ "name": "created_by_id",
630
+ "type": "text",
631
+ "primaryKey": false,
632
+ "notNull": false,
633
+ "autoincrement": false
634
+ },
635
+ "created_by_task_id": {
636
+ "name": "created_by_task_id",
637
+ "type": "text",
638
+ "primaryKey": false,
639
+ "notNull": false,
640
+ "autoincrement": false
641
+ },
642
+ "platform": {
643
+ "name": "platform",
644
+ "type": "text",
645
+ "primaryKey": false,
646
+ "notNull": true,
647
+ "autoincrement": false,
648
+ "default": "'cli'"
649
+ },
650
+ "title": {
651
+ "name": "title",
652
+ "type": "text",
653
+ "primaryKey": false,
654
+ "notNull": false,
655
+ "autoincrement": false
656
+ },
657
+ "first_message": {
658
+ "name": "first_message",
659
+ "type": "text",
660
+ "primaryKey": false,
661
+ "notNull": false,
662
+ "autoincrement": false
663
+ },
664
+ "last_message": {
665
+ "name": "last_message",
666
+ "type": "text",
667
+ "primaryKey": false,
668
+ "notNull": false,
669
+ "autoincrement": false
670
+ },
671
+ "message_count": {
672
+ "name": "message_count",
673
+ "type": "integer",
674
+ "primaryKey": false,
675
+ "notNull": true,
676
+ "autoincrement": false,
677
+ "default": 0
678
+ },
679
+ "created_at": {
680
+ "name": "created_at",
681
+ "type": "text",
682
+ "primaryKey": false,
683
+ "notNull": true,
684
+ "autoincrement": false
685
+ },
686
+ "updated_at": {
687
+ "name": "updated_at",
688
+ "type": "text",
689
+ "primaryKey": false,
690
+ "notNull": true,
691
+ "autoincrement": false
692
+ },
693
+ "metadata": {
694
+ "name": "metadata",
695
+ "type": "text",
696
+ "primaryKey": false,
697
+ "notNull": false,
698
+ "autoincrement": false
699
+ },
700
+ "title_locked": {
701
+ "name": "title_locked",
702
+ "type": "integer",
703
+ "primaryKey": false,
704
+ "notNull": true,
705
+ "autoincrement": false,
706
+ "default": 0
707
+ },
708
+ "pinned": {
709
+ "name": "pinned",
710
+ "type": "integer",
711
+ "primaryKey": false,
712
+ "notNull": true,
713
+ "autoincrement": false,
714
+ "default": 0
715
+ },
716
+ "starred": {
717
+ "name": "starred",
718
+ "type": "integer",
719
+ "primaryKey": false,
720
+ "notNull": true,
721
+ "autoincrement": false,
722
+ "default": 0
723
+ }
724
+ },
725
+ "indexes": {
726
+ "idx_threads_updated_at": {
727
+ "name": "idx_threads_updated_at",
728
+ "columns": [
729
+ "updated_at"
730
+ ],
731
+ "isUnique": false
732
+ },
733
+ "idx_threads_workspace_id": {
734
+ "name": "idx_threads_workspace_id",
735
+ "columns": [
736
+ "workspace_id"
737
+ ],
738
+ "isUnique": false
739
+ },
740
+ "idx_threads_ws_updated": {
741
+ "name": "idx_threads_ws_updated",
742
+ "columns": [
743
+ "workspace_id",
744
+ "updated_at"
745
+ ],
746
+ "isUnique": false
747
+ },
748
+ "idx_threads_workspace_created_by_kind_updated_at": {
749
+ "name": "idx_threads_workspace_created_by_kind_updated_at",
750
+ "columns": [
751
+ "workspace_id",
752
+ "created_by_kind",
753
+ "updated_at"
754
+ ],
755
+ "isUnique": false
756
+ },
757
+ "idx_threads_title": {
758
+ "name": "idx_threads_title",
759
+ "columns": [
760
+ "title"
761
+ ],
762
+ "isUnique": false
763
+ },
764
+ "idx_threads_workspace_thread_state": {
765
+ "name": "idx_threads_workspace_thread_state",
766
+ "columns": [
767
+ "workspace_id",
768
+ "json_extract(metadata, '$.threadTitle.state')"
769
+ ],
770
+ "isUnique": false
771
+ },
772
+ "idx_threads_workspace_thread_priority": {
773
+ "name": "idx_threads_workspace_thread_priority",
774
+ "columns": [
775
+ "workspace_id",
776
+ "json_extract(metadata, '$.threadTitle.priority')"
777
+ ],
778
+ "isUnique": false
779
+ }
780
+ },
781
+ "foreignKeys": {
782
+ "threads_workspace_id_workspaces_id_fk": {
783
+ "name": "threads_workspace_id_workspaces_id_fk",
784
+ "tableFrom": "threads",
785
+ "tableTo": "workspaces",
786
+ "columnsFrom": [
787
+ "workspace_id"
788
+ ],
789
+ "columnsTo": [
790
+ "id"
791
+ ],
792
+ "onDelete": "set null",
793
+ "onUpdate": "no action"
794
+ }
795
+ },
796
+ "compositePrimaryKeys": {},
797
+ "uniqueConstraints": {},
798
+ "checkConstraints": {}
799
+ },
800
+ "thread_creator_unverified": {
801
+ "name": "thread_creator_unverified",
802
+ "columns": {
803
+ "thread_id": {
804
+ "name": "thread_id",
805
+ "type": "text",
806
+ "primaryKey": false,
807
+ "notNull": true,
808
+ "autoincrement": false
809
+ },
810
+ "created_by_task_id": {
811
+ "name": "created_by_task_id",
812
+ "type": "text",
813
+ "primaryKey": false,
814
+ "notNull": true,
815
+ "autoincrement": false
816
+ }
817
+ },
818
+ "indexes": {},
819
+ "foreignKeys": {},
820
+ "compositePrimaryKeys": {
821
+ "thread_creator_unverified_thread_id_created_by_task_id_pk": {
822
+ "columns": [
823
+ "thread_id",
824
+ "created_by_task_id"
825
+ ],
826
+ "name": "thread_creator_unverified_thread_id_created_by_task_id_pk"
827
+ }
828
+ },
829
+ "uniqueConstraints": {},
830
+ "checkConstraints": {}
831
+ },
832
+ "spans": {
833
+ "name": "spans",
834
+ "columns": {
835
+ "id": {
836
+ "name": "id",
837
+ "type": "text",
838
+ "primaryKey": true,
839
+ "notNull": true,
840
+ "autoincrement": false
841
+ },
842
+ "task_id": {
843
+ "name": "task_id",
844
+ "type": "text",
845
+ "primaryKey": false,
846
+ "notNull": false,
847
+ "autoincrement": false
848
+ },
849
+ "parent_span_id": {
850
+ "name": "parent_span_id",
851
+ "type": "text",
852
+ "primaryKey": false,
853
+ "notNull": false,
854
+ "autoincrement": false
855
+ },
856
+ "name": {
857
+ "name": "name",
858
+ "type": "text",
859
+ "primaryKey": false,
860
+ "notNull": true,
861
+ "autoincrement": false
862
+ },
863
+ "kind": {
864
+ "name": "kind",
865
+ "type": "text",
866
+ "primaryKey": false,
867
+ "notNull": true,
868
+ "autoincrement": false,
869
+ "default": "'internal'"
870
+ },
871
+ "status": {
872
+ "name": "status",
873
+ "type": "text",
874
+ "primaryKey": false,
875
+ "notNull": true,
876
+ "autoincrement": false,
877
+ "default": "'ok'"
878
+ },
879
+ "started_at": {
880
+ "name": "started_at",
881
+ "type": "text",
882
+ "primaryKey": false,
883
+ "notNull": true,
884
+ "autoincrement": false
885
+ },
886
+ "completed_at": {
887
+ "name": "completed_at",
888
+ "type": "text",
889
+ "primaryKey": false,
890
+ "notNull": false,
891
+ "autoincrement": false
892
+ },
893
+ "duration_ms": {
894
+ "name": "duration_ms",
895
+ "type": "integer",
896
+ "primaryKey": false,
897
+ "notNull": false,
898
+ "autoincrement": false
899
+ },
900
+ "input": {
901
+ "name": "input",
902
+ "type": "text",
903
+ "primaryKey": false,
904
+ "notNull": false,
905
+ "autoincrement": false
906
+ },
907
+ "output": {
908
+ "name": "output",
909
+ "type": "text",
910
+ "primaryKey": false,
911
+ "notNull": false,
912
+ "autoincrement": false
913
+ },
914
+ "error": {
915
+ "name": "error",
916
+ "type": "text",
917
+ "primaryKey": false,
918
+ "notNull": false,
919
+ "autoincrement": false
920
+ },
921
+ "attributes": {
922
+ "name": "attributes",
923
+ "type": "text",
924
+ "primaryKey": false,
925
+ "notNull": false,
926
+ "autoincrement": false
927
+ }
928
+ },
929
+ "indexes": {
930
+ "idx_spans_task_id": {
931
+ "name": "idx_spans_task_id",
932
+ "columns": [
933
+ "task_id"
934
+ ],
935
+ "isUnique": false
936
+ },
937
+ "idx_spans_parent_span_id": {
938
+ "name": "idx_spans_parent_span_id",
939
+ "columns": [
940
+ "parent_span_id"
941
+ ],
942
+ "isUnique": false
943
+ }
944
+ },
945
+ "foreignKeys": {
946
+ "spans_task_id_tasks_id_fk": {
947
+ "name": "spans_task_id_tasks_id_fk",
948
+ "tableFrom": "spans",
949
+ "tableTo": "tasks",
950
+ "columnsFrom": [
951
+ "task_id"
952
+ ],
953
+ "columnsTo": [
954
+ "id"
955
+ ],
956
+ "onDelete": "set null",
957
+ "onUpdate": "no action"
958
+ },
959
+ "spans_parent_span_id_spans_id_fk": {
960
+ "name": "spans_parent_span_id_spans_id_fk",
961
+ "tableFrom": "spans",
962
+ "tableTo": "spans",
963
+ "columnsFrom": [
964
+ "parent_span_id"
965
+ ],
966
+ "columnsTo": [
967
+ "id"
968
+ ],
969
+ "onDelete": "set null",
970
+ "onUpdate": "no action"
971
+ }
972
+ },
973
+ "compositePrimaryKeys": {},
974
+ "uniqueConstraints": {},
975
+ "checkConstraints": {}
976
+ },
977
+ "tool_calls": {
978
+ "name": "tool_calls",
979
+ "columns": {
980
+ "id": {
981
+ "name": "id",
982
+ "type": "text",
983
+ "primaryKey": true,
984
+ "notNull": true,
985
+ "autoincrement": false
986
+ },
987
+ "task_id": {
988
+ "name": "task_id",
989
+ "type": "text",
990
+ "primaryKey": false,
991
+ "notNull": false,
992
+ "autoincrement": false
993
+ },
994
+ "session_id": {
995
+ "name": "session_id",
996
+ "type": "text",
997
+ "primaryKey": false,
998
+ "notNull": false,
999
+ "autoincrement": false
1000
+ },
1001
+ "tool_name": {
1002
+ "name": "tool_name",
1003
+ "type": "text",
1004
+ "primaryKey": false,
1005
+ "notNull": true,
1006
+ "autoincrement": false
1007
+ },
1008
+ "files": {
1009
+ "name": "files",
1010
+ "type": "text",
1011
+ "primaryKey": false,
1012
+ "notNull": false,
1013
+ "autoincrement": false
1014
+ },
1015
+ "input": {
1016
+ "name": "input",
1017
+ "type": "text",
1018
+ "primaryKey": false,
1019
+ "notNull": false,
1020
+ "autoincrement": false
1021
+ },
1022
+ "output": {
1023
+ "name": "output",
1024
+ "type": "text",
1025
+ "primaryKey": false,
1026
+ "notNull": false,
1027
+ "autoincrement": false
1028
+ },
1029
+ "duration_ms": {
1030
+ "name": "duration_ms",
1031
+ "type": "integer",
1032
+ "primaryKey": false,
1033
+ "notNull": false,
1034
+ "autoincrement": false
1035
+ },
1036
+ "timestamp": {
1037
+ "name": "timestamp",
1038
+ "type": "text",
1039
+ "primaryKey": false,
1040
+ "notNull": true,
1041
+ "autoincrement": false
1042
+ }
1043
+ },
1044
+ "indexes": {
1045
+ "idx_tool_calls_task_id": {
1046
+ "name": "idx_tool_calls_task_id",
1047
+ "columns": [
1048
+ "task_id"
1049
+ ],
1050
+ "isUnique": false
1051
+ },
1052
+ "idx_tool_calls_tool_name": {
1053
+ "name": "idx_tool_calls_tool_name",
1054
+ "columns": [
1055
+ "tool_name"
1056
+ ],
1057
+ "isUnique": false
1058
+ },
1059
+ "idx_tool_calls_timestamp": {
1060
+ "name": "idx_tool_calls_timestamp",
1061
+ "columns": [
1062
+ "timestamp"
1063
+ ],
1064
+ "isUnique": false
1065
+ }
1066
+ },
1067
+ "foreignKeys": {
1068
+ "tool_calls_task_id_tasks_id_fk": {
1069
+ "name": "tool_calls_task_id_tasks_id_fk",
1070
+ "tableFrom": "tool_calls",
1071
+ "tableTo": "tasks",
1072
+ "columnsFrom": [
1073
+ "task_id"
1074
+ ],
1075
+ "columnsTo": [
1076
+ "id"
1077
+ ],
1078
+ "onDelete": "cascade",
1079
+ "onUpdate": "no action"
1080
+ }
1081
+ },
1082
+ "compositePrimaryKeys": {},
1083
+ "uniqueConstraints": {},
1084
+ "checkConstraints": {}
1085
+ },
1086
+ "thread_boxes": {
1087
+ "name": "thread_boxes",
1088
+ "columns": {
1089
+ "id": {
1090
+ "name": "id",
1091
+ "type": "text",
1092
+ "primaryKey": true,
1093
+ "notNull": true,
1094
+ "autoincrement": false
1095
+ },
1096
+ "thread_id": {
1097
+ "name": "thread_id",
1098
+ "type": "text",
1099
+ "primaryKey": false,
1100
+ "notNull": true,
1101
+ "autoincrement": false
1102
+ },
1103
+ "seq": {
1104
+ "name": "seq",
1105
+ "type": "integer",
1106
+ "primaryKey": false,
1107
+ "notNull": true,
1108
+ "autoincrement": false
1109
+ },
1110
+ "first_task_id": {
1111
+ "name": "first_task_id",
1112
+ "type": "text",
1113
+ "primaryKey": false,
1114
+ "notNull": true,
1115
+ "autoincrement": false
1116
+ },
1117
+ "mid_task_id": {
1118
+ "name": "mid_task_id",
1119
+ "type": "text",
1120
+ "primaryKey": false,
1121
+ "notNull": true,
1122
+ "autoincrement": false
1123
+ },
1124
+ "last_task_id": {
1125
+ "name": "last_task_id",
1126
+ "type": "text",
1127
+ "primaryKey": false,
1128
+ "notNull": true,
1129
+ "autoincrement": false
1130
+ },
1131
+ "task_count": {
1132
+ "name": "task_count",
1133
+ "type": "integer",
1134
+ "primaryKey": false,
1135
+ "notNull": true,
1136
+ "autoincrement": false
1137
+ },
1138
+ "summary": {
1139
+ "name": "summary",
1140
+ "type": "text",
1141
+ "primaryKey": false,
1142
+ "notNull": false,
1143
+ "autoincrement": false
1144
+ },
1145
+ "source_tokens": {
1146
+ "name": "source_tokens",
1147
+ "type": "integer",
1148
+ "primaryKey": false,
1149
+ "notNull": true,
1150
+ "autoincrement": false
1151
+ },
1152
+ "summary_tokens": {
1153
+ "name": "summary_tokens",
1154
+ "type": "integer",
1155
+ "primaryKey": false,
1156
+ "notNull": false,
1157
+ "autoincrement": false
1158
+ },
1159
+ "created_at": {
1160
+ "name": "created_at",
1161
+ "type": "text",
1162
+ "primaryKey": false,
1163
+ "notNull": true,
1164
+ "autoincrement": false
1165
+ }
1166
+ },
1167
+ "indexes": {
1168
+ "idx_thread_boxes_thread_id": {
1169
+ "name": "idx_thread_boxes_thread_id",
1170
+ "columns": [
1171
+ "thread_id"
1172
+ ],
1173
+ "isUnique": false
1174
+ },
1175
+ "idx_thread_boxes_seq": {
1176
+ "name": "idx_thread_boxes_seq",
1177
+ "columns": [
1178
+ "thread_id",
1179
+ "seq"
1180
+ ],
1181
+ "isUnique": false
1182
+ },
1183
+ "thread_boxes_thread_id_seq_unique": {
1184
+ "name": "thread_boxes_thread_id_seq_unique",
1185
+ "columns": [
1186
+ "thread_id",
1187
+ "seq"
1188
+ ],
1189
+ "isUnique": true
1190
+ }
1191
+ },
1192
+ "foreignKeys": {
1193
+ "thread_boxes_thread_id_threads_id_fk": {
1194
+ "name": "thread_boxes_thread_id_threads_id_fk",
1195
+ "tableFrom": "thread_boxes",
1196
+ "tableTo": "threads",
1197
+ "columnsFrom": [
1198
+ "thread_id"
1199
+ ],
1200
+ "columnsTo": [
1201
+ "id"
1202
+ ],
1203
+ "onDelete": "cascade",
1204
+ "onUpdate": "no action"
1205
+ }
1206
+ },
1207
+ "compositePrimaryKeys": {},
1208
+ "uniqueConstraints": {},
1209
+ "checkConstraints": {}
1210
+ },
1211
+ "request_logs": {
1212
+ "name": "request_logs",
1213
+ "columns": {
1214
+ "id": {
1215
+ "name": "id",
1216
+ "type": "text",
1217
+ "primaryKey": true,
1218
+ "notNull": true,
1219
+ "autoincrement": false
1220
+ },
1221
+ "path": {
1222
+ "name": "path",
1223
+ "type": "text",
1224
+ "primaryKey": false,
1225
+ "notNull": true,
1226
+ "autoincrement": false
1227
+ },
1228
+ "method": {
1229
+ "name": "method",
1230
+ "type": "text",
1231
+ "primaryKey": false,
1232
+ "notNull": true,
1233
+ "autoincrement": false
1234
+ },
1235
+ "status_code": {
1236
+ "name": "status_code",
1237
+ "type": "integer",
1238
+ "primaryKey": false,
1239
+ "notNull": true,
1240
+ "autoincrement": false
1241
+ },
1242
+ "duration_ms": {
1243
+ "name": "duration_ms",
1244
+ "type": "integer",
1245
+ "primaryKey": false,
1246
+ "notNull": true,
1247
+ "autoincrement": false
1248
+ },
1249
+ "ip": {
1250
+ "name": "ip",
1251
+ "type": "text",
1252
+ "primaryKey": false,
1253
+ "notNull": false,
1254
+ "autoincrement": false
1255
+ },
1256
+ "request_headers": {
1257
+ "name": "request_headers",
1258
+ "type": "text",
1259
+ "primaryKey": false,
1260
+ "notNull": false,
1261
+ "autoincrement": false
1262
+ },
1263
+ "response_headers": {
1264
+ "name": "response_headers",
1265
+ "type": "text",
1266
+ "primaryKey": false,
1267
+ "notNull": false,
1268
+ "autoincrement": false
1269
+ },
1270
+ "request_body": {
1271
+ "name": "request_body",
1272
+ "type": "text",
1273
+ "primaryKey": false,
1274
+ "notNull": false,
1275
+ "autoincrement": false
1276
+ },
1277
+ "response_body": {
1278
+ "name": "response_body",
1279
+ "type": "text",
1280
+ "primaryKey": false,
1281
+ "notNull": false,
1282
+ "autoincrement": false
1283
+ },
1284
+ "query": {
1285
+ "name": "query",
1286
+ "type": "text",
1287
+ "primaryKey": false,
1288
+ "notNull": false,
1289
+ "autoincrement": false
1290
+ },
1291
+ "user_id": {
1292
+ "name": "user_id",
1293
+ "type": "text",
1294
+ "primaryKey": false,
1295
+ "notNull": false,
1296
+ "autoincrement": false
1297
+ },
1298
+ "project_id": {
1299
+ "name": "project_id",
1300
+ "type": "text",
1301
+ "primaryKey": false,
1302
+ "notNull": false,
1303
+ "autoincrement": false
1304
+ },
1305
+ "partition_key": {
1306
+ "name": "partition_key",
1307
+ "type": "text",
1308
+ "primaryKey": false,
1309
+ "notNull": true,
1310
+ "autoincrement": false
1311
+ },
1312
+ "timestamp": {
1313
+ "name": "timestamp",
1314
+ "type": "text",
1315
+ "primaryKey": false,
1316
+ "notNull": true,
1317
+ "autoincrement": false,
1318
+ "default": "(datetime('now'))"
1319
+ },
1320
+ "metadata": {
1321
+ "name": "metadata",
1322
+ "type": "text",
1323
+ "primaryKey": false,
1324
+ "notNull": false,
1325
+ "autoincrement": false
1326
+ }
1327
+ },
1328
+ "indexes": {
1329
+ "idx_request_logs_timestamp": {
1330
+ "name": "idx_request_logs_timestamp",
1331
+ "columns": [
1332
+ "timestamp"
1333
+ ],
1334
+ "isUnique": false
1335
+ },
1336
+ "idx_request_logs_path": {
1337
+ "name": "idx_request_logs_path",
1338
+ "columns": [
1339
+ "path"
1340
+ ],
1341
+ "isUnique": false
1342
+ },
1343
+ "idx_request_logs_status_code": {
1344
+ "name": "idx_request_logs_status_code",
1345
+ "columns": [
1346
+ "status_code"
1347
+ ],
1348
+ "isUnique": false
1349
+ },
1350
+ "idx_request_logs_partition_key": {
1351
+ "name": "idx_request_logs_partition_key",
1352
+ "columns": [
1353
+ "partition_key"
1354
+ ],
1355
+ "isUnique": false
1356
+ }
1357
+ },
1358
+ "foreignKeys": {},
1359
+ "compositePrimaryKeys": {},
1360
+ "uniqueConstraints": {},
1361
+ "checkConstraints": {}
1362
+ },
1363
+ "request_log_daily": {
1364
+ "name": "request_log_daily",
1365
+ "columns": {
1366
+ "day": {
1367
+ "name": "day",
1368
+ "type": "text",
1369
+ "primaryKey": false,
1370
+ "notNull": true,
1371
+ "autoincrement": false
1372
+ },
1373
+ "scope": {
1374
+ "name": "scope",
1375
+ "type": "text",
1376
+ "primaryKey": false,
1377
+ "notNull": true,
1378
+ "autoincrement": false
1379
+ },
1380
+ "ok": {
1381
+ "name": "ok",
1382
+ "type": "integer",
1383
+ "primaryKey": false,
1384
+ "notNull": true,
1385
+ "autoincrement": false
1386
+ },
1387
+ "client": {
1388
+ "name": "client",
1389
+ "type": "integer",
1390
+ "primaryKey": false,
1391
+ "notNull": true,
1392
+ "autoincrement": false
1393
+ },
1394
+ "server": {
1395
+ "name": "server",
1396
+ "type": "integer",
1397
+ "primaryKey": false,
1398
+ "notNull": true,
1399
+ "autoincrement": false
1400
+ },
1401
+ "p50_ms": {
1402
+ "name": "p50_ms",
1403
+ "type": "integer",
1404
+ "primaryKey": false,
1405
+ "notNull": false,
1406
+ "autoincrement": false
1407
+ },
1408
+ "p95_ms": {
1409
+ "name": "p95_ms",
1410
+ "type": "integer",
1411
+ "primaryKey": false,
1412
+ "notNull": false,
1413
+ "autoincrement": false
1414
+ },
1415
+ "computed_at": {
1416
+ "name": "computed_at",
1417
+ "type": "text",
1418
+ "primaryKey": false,
1419
+ "notNull": true,
1420
+ "autoincrement": false
1421
+ }
1422
+ },
1423
+ "indexes": {},
1424
+ "foreignKeys": {},
1425
+ "compositePrimaryKeys": {
1426
+ "request_log_daily_day_scope_pk": {
1427
+ "columns": [
1428
+ "day",
1429
+ "scope"
1430
+ ],
1431
+ "name": "request_log_daily_day_scope_pk"
1432
+ }
1433
+ },
1434
+ "uniqueConstraints": {},
1435
+ "checkConstraints": {}
1436
+ },
1437
+ "usage_limit_snapshots": {
1438
+ "name": "usage_limit_snapshots",
1439
+ "columns": {
1440
+ "id": {
1441
+ "name": "id",
1442
+ "type": "text",
1443
+ "primaryKey": true,
1444
+ "notNull": true,
1445
+ "autoincrement": false
1446
+ },
1447
+ "provider": {
1448
+ "name": "provider",
1449
+ "type": "text",
1450
+ "primaryKey": false,
1451
+ "notNull": true,
1452
+ "autoincrement": false
1453
+ },
1454
+ "account_ref": {
1455
+ "name": "account_ref",
1456
+ "type": "text",
1457
+ "primaryKey": false,
1458
+ "notNull": true,
1459
+ "autoincrement": false,
1460
+ "default": "'default'"
1461
+ },
1462
+ "limit_window": {
1463
+ "name": "limit_window",
1464
+ "type": "text",
1465
+ "primaryKey": false,
1466
+ "notNull": true,
1467
+ "autoincrement": false
1468
+ },
1469
+ "bucket_start": {
1470
+ "name": "bucket_start",
1471
+ "type": "text",
1472
+ "primaryKey": false,
1473
+ "notNull": true,
1474
+ "autoincrement": false
1475
+ },
1476
+ "captured_at": {
1477
+ "name": "captured_at",
1478
+ "type": "text",
1479
+ "primaryKey": false,
1480
+ "notNull": true,
1481
+ "autoincrement": false
1482
+ },
1483
+ "used_percent": {
1484
+ "name": "used_percent",
1485
+ "type": "integer",
1486
+ "primaryKey": false,
1487
+ "notNull": true,
1488
+ "autoincrement": false
1489
+ },
1490
+ "remaining_percent": {
1491
+ "name": "remaining_percent",
1492
+ "type": "integer",
1493
+ "primaryKey": false,
1494
+ "notNull": true,
1495
+ "autoincrement": false
1496
+ },
1497
+ "resets_at": {
1498
+ "name": "resets_at",
1499
+ "type": "text",
1500
+ "primaryKey": false,
1501
+ "notNull": false,
1502
+ "autoincrement": false
1503
+ },
1504
+ "source": {
1505
+ "name": "source",
1506
+ "type": "text",
1507
+ "primaryKey": false,
1508
+ "notNull": true,
1509
+ "autoincrement": false
1510
+ },
1511
+ "metadata": {
1512
+ "name": "metadata",
1513
+ "type": "text",
1514
+ "primaryKey": false,
1515
+ "notNull": false,
1516
+ "autoincrement": false
1517
+ }
1518
+ },
1519
+ "indexes": {
1520
+ "uniq_usage_limit_snapshots_bucket": {
1521
+ "name": "uniq_usage_limit_snapshots_bucket",
1522
+ "columns": [
1523
+ "provider",
1524
+ "account_ref",
1525
+ "limit_window",
1526
+ "bucket_start"
1527
+ ],
1528
+ "isUnique": true
1529
+ },
1530
+ "idx_usage_limit_snapshots_window_bucket": {
1531
+ "name": "idx_usage_limit_snapshots_window_bucket",
1532
+ "columns": [
1533
+ "limit_window",
1534
+ "bucket_start"
1535
+ ],
1536
+ "isUnique": false
1537
+ },
1538
+ "idx_usage_limit_snapshots_provider_window_bucket": {
1539
+ "name": "idx_usage_limit_snapshots_provider_window_bucket",
1540
+ "columns": [
1541
+ "provider",
1542
+ "limit_window",
1543
+ "bucket_start"
1544
+ ],
1545
+ "isUnique": false
1546
+ }
1547
+ },
1548
+ "foreignKeys": {},
1549
+ "compositePrimaryKeys": {},
1550
+ "uniqueConstraints": {},
1551
+ "checkConstraints": {}
1552
+ },
1553
+ "usage_reports": {
1554
+ "name": "usage_reports",
1555
+ "columns": {
1556
+ "id": {
1557
+ "name": "id",
1558
+ "type": "text",
1559
+ "primaryKey": true,
1560
+ "notNull": true,
1561
+ "autoincrement": false
1562
+ },
1563
+ "workspace_id": {
1564
+ "name": "workspace_id",
1565
+ "type": "text",
1566
+ "primaryKey": false,
1567
+ "notNull": true,
1568
+ "autoincrement": false
1569
+ },
1570
+ "month": {
1571
+ "name": "month",
1572
+ "type": "text",
1573
+ "primaryKey": false,
1574
+ "notNull": true,
1575
+ "autoincrement": false
1576
+ },
1577
+ "generated_at": {
1578
+ "name": "generated_at",
1579
+ "type": "text",
1580
+ "primaryKey": false,
1581
+ "notNull": true,
1582
+ "autoincrement": false
1583
+ },
1584
+ "source_range": {
1585
+ "name": "source_range",
1586
+ "type": "text",
1587
+ "primaryKey": false,
1588
+ "notNull": true,
1589
+ "autoincrement": false
1590
+ },
1591
+ "tier": {
1592
+ "name": "tier",
1593
+ "type": "text",
1594
+ "primaryKey": false,
1595
+ "notNull": true,
1596
+ "autoincrement": false
1597
+ },
1598
+ "total_tokens": {
1599
+ "name": "total_tokens",
1600
+ "type": "integer",
1601
+ "primaryKey": false,
1602
+ "notNull": true,
1603
+ "autoincrement": false
1604
+ },
1605
+ "total_cost_usd": {
1606
+ "name": "total_cost_usd",
1607
+ "type": "real",
1608
+ "primaryKey": false,
1609
+ "notNull": true,
1610
+ "autoincrement": false
1611
+ },
1612
+ "payload": {
1613
+ "name": "payload",
1614
+ "type": "text",
1615
+ "primaryKey": false,
1616
+ "notNull": true,
1617
+ "autoincrement": false
1618
+ },
1619
+ "payload_hash": {
1620
+ "name": "payload_hash",
1621
+ "type": "text",
1622
+ "primaryKey": false,
1623
+ "notNull": false,
1624
+ "autoincrement": false
1625
+ },
1626
+ "signature": {
1627
+ "name": "signature",
1628
+ "type": "text",
1629
+ "primaryKey": false,
1630
+ "notNull": false,
1631
+ "autoincrement": false
1632
+ },
1633
+ "signed_at": {
1634
+ "name": "signed_at",
1635
+ "type": "text",
1636
+ "primaryKey": false,
1637
+ "notNull": false,
1638
+ "autoincrement": false
1639
+ },
1640
+ "issuer": {
1641
+ "name": "issuer",
1642
+ "type": "text",
1643
+ "primaryKey": false,
1644
+ "notNull": false,
1645
+ "autoincrement": false
1646
+ }
1647
+ },
1648
+ "indexes": {
1649
+ "uniq_usage_reports_ws_month": {
1650
+ "name": "uniq_usage_reports_ws_month",
1651
+ "columns": [
1652
+ "workspace_id",
1653
+ "month"
1654
+ ],
1655
+ "isUnique": true
1656
+ }
1657
+ },
1658
+ "foreignKeys": {},
1659
+ "compositePrimaryKeys": {},
1660
+ "uniqueConstraints": {},
1661
+ "checkConstraints": {}
1662
+ },
1663
+ "notification_reads": {
1664
+ "name": "notification_reads",
1665
+ "columns": {
1666
+ "notification_id": {
1667
+ "name": "notification_id",
1668
+ "type": "text",
1669
+ "primaryKey": false,
1670
+ "notNull": true,
1671
+ "autoincrement": false
1672
+ },
1673
+ "user_id": {
1674
+ "name": "user_id",
1675
+ "type": "text",
1676
+ "primaryKey": false,
1677
+ "notNull": true,
1678
+ "autoincrement": false
1679
+ },
1680
+ "read_at": {
1681
+ "name": "read_at",
1682
+ "type": "text",
1683
+ "primaryKey": false,
1684
+ "notNull": true,
1685
+ "autoincrement": false
1686
+ }
1687
+ },
1688
+ "indexes": {},
1689
+ "foreignKeys": {},
1690
+ "compositePrimaryKeys": {
1691
+ "notification_reads_notification_id_user_id_pk": {
1692
+ "columns": [
1693
+ "notification_id",
1694
+ "user_id"
1695
+ ],
1696
+ "name": "notification_reads_notification_id_user_id_pk"
1697
+ }
1698
+ },
1699
+ "uniqueConstraints": {},
1700
+ "checkConstraints": {}
1701
+ },
1702
+ "notifications": {
1703
+ "name": "notifications",
1704
+ "columns": {
1705
+ "id": {
1706
+ "name": "id",
1707
+ "type": "text",
1708
+ "primaryKey": true,
1709
+ "notNull": true,
1710
+ "autoincrement": false
1711
+ },
1712
+ "workspace_id": {
1713
+ "name": "workspace_id",
1714
+ "type": "text",
1715
+ "primaryKey": false,
1716
+ "notNull": true,
1717
+ "autoincrement": false
1718
+ },
1719
+ "agent_id": {
1720
+ "name": "agent_id",
1721
+ "type": "text",
1722
+ "primaryKey": false,
1723
+ "notNull": false,
1724
+ "autoincrement": false
1725
+ },
1726
+ "task_id": {
1727
+ "name": "task_id",
1728
+ "type": "text",
1729
+ "primaryKey": false,
1730
+ "notNull": false,
1731
+ "autoincrement": false
1732
+ },
1733
+ "thread_id": {
1734
+ "name": "thread_id",
1735
+ "type": "text",
1736
+ "primaryKey": false,
1737
+ "notNull": false,
1738
+ "autoincrement": false
1739
+ },
1740
+ "source": {
1741
+ "name": "source",
1742
+ "type": "text",
1743
+ "primaryKey": false,
1744
+ "notNull": true,
1745
+ "autoincrement": false,
1746
+ "default": "'agent'"
1747
+ },
1748
+ "level": {
1749
+ "name": "level",
1750
+ "type": "text",
1751
+ "primaryKey": false,
1752
+ "notNull": true,
1753
+ "autoincrement": false,
1754
+ "default": "'info'"
1755
+ },
1756
+ "title": {
1757
+ "name": "title",
1758
+ "type": "text",
1759
+ "primaryKey": false,
1760
+ "notNull": true,
1761
+ "autoincrement": false
1762
+ },
1763
+ "body": {
1764
+ "name": "body",
1765
+ "type": "text",
1766
+ "primaryKey": false,
1767
+ "notNull": false,
1768
+ "autoincrement": false
1769
+ },
1770
+ "target_user_id": {
1771
+ "name": "target_user_id",
1772
+ "type": "text",
1773
+ "primaryKey": false,
1774
+ "notNull": false,
1775
+ "autoincrement": false
1776
+ },
1777
+ "created_at": {
1778
+ "name": "created_at",
1779
+ "type": "text",
1780
+ "primaryKey": false,
1781
+ "notNull": true,
1782
+ "autoincrement": false
1783
+ },
1784
+ "metadata": {
1785
+ "name": "metadata",
1786
+ "type": "text",
1787
+ "primaryKey": false,
1788
+ "notNull": false,
1789
+ "autoincrement": false
1790
+ }
1791
+ },
1792
+ "indexes": {
1793
+ "idx_notifications_ws_created": {
1794
+ "name": "idx_notifications_ws_created",
1795
+ "columns": [
1796
+ "workspace_id",
1797
+ "\"created_at\" DESC"
1798
+ ],
1799
+ "isUnique": false
1800
+ }
1801
+ },
1802
+ "foreignKeys": {},
1803
+ "compositePrimaryKeys": {},
1804
+ "uniqueConstraints": {},
1805
+ "checkConstraints": {}
1806
+ },
1807
+ "agent_suggestions": {
1808
+ "name": "agent_suggestions",
1809
+ "columns": {
1810
+ "id": {
1811
+ "name": "id",
1812
+ "type": "text",
1813
+ "primaryKey": true,
1814
+ "notNull": true,
1815
+ "autoincrement": false
1816
+ },
1817
+ "workspace_id": {
1818
+ "name": "workspace_id",
1819
+ "type": "text",
1820
+ "primaryKey": false,
1821
+ "notNull": true,
1822
+ "autoincrement": false
1823
+ },
1824
+ "agent_id": {
1825
+ "name": "agent_id",
1826
+ "type": "text",
1827
+ "primaryKey": false,
1828
+ "notNull": true,
1829
+ "autoincrement": false
1830
+ },
1831
+ "task_id": {
1832
+ "name": "task_id",
1833
+ "type": "text",
1834
+ "primaryKey": false,
1835
+ "notNull": false,
1836
+ "autoincrement": false
1837
+ },
1838
+ "type": {
1839
+ "name": "type",
1840
+ "type": "text",
1841
+ "primaryKey": false,
1842
+ "notNull": true,
1843
+ "autoincrement": false
1844
+ },
1845
+ "status": {
1846
+ "name": "status",
1847
+ "type": "text",
1848
+ "primaryKey": false,
1849
+ "notNull": true,
1850
+ "autoincrement": false,
1851
+ "default": "'pending'"
1852
+ },
1853
+ "payload": {
1854
+ "name": "payload",
1855
+ "type": "text",
1856
+ "primaryKey": false,
1857
+ "notNull": true,
1858
+ "autoincrement": false
1859
+ },
1860
+ "applied_commit_sha": {
1861
+ "name": "applied_commit_sha",
1862
+ "type": "text",
1863
+ "primaryKey": false,
1864
+ "notNull": false,
1865
+ "autoincrement": false
1866
+ },
1867
+ "created_at": {
1868
+ "name": "created_at",
1869
+ "type": "text",
1870
+ "primaryKey": false,
1871
+ "notNull": true,
1872
+ "autoincrement": false
1873
+ },
1874
+ "updated_at": {
1875
+ "name": "updated_at",
1876
+ "type": "text",
1877
+ "primaryKey": false,
1878
+ "notNull": true,
1879
+ "autoincrement": false
1880
+ }
1881
+ },
1882
+ "indexes": {
1883
+ "idx_agent_suggestions_ws_agent": {
1884
+ "name": "idx_agent_suggestions_ws_agent",
1885
+ "columns": [
1886
+ "workspace_id",
1887
+ "agent_id"
1888
+ ],
1889
+ "isUnique": false
1890
+ },
1891
+ "idx_agent_suggestions_ws_created": {
1892
+ "name": "idx_agent_suggestions_ws_created",
1893
+ "columns": [
1894
+ "workspace_id",
1895
+ "created_at"
1896
+ ],
1897
+ "isUnique": false
1898
+ }
1899
+ },
1900
+ "foreignKeys": {},
1901
+ "compositePrimaryKeys": {},
1902
+ "uniqueConstraints": {},
1903
+ "checkConstraints": {}
1904
+ },
1905
+ "ui_instances": {
1906
+ "name": "ui_instances",
1907
+ "columns": {
1908
+ "id": {
1909
+ "name": "id",
1910
+ "type": "text",
1911
+ "primaryKey": true,
1912
+ "notNull": true,
1913
+ "autoincrement": false
1914
+ },
1915
+ "definition_id": {
1916
+ "name": "definition_id",
1917
+ "type": "text",
1918
+ "primaryKey": false,
1919
+ "notNull": true,
1920
+ "autoincrement": false
1921
+ },
1922
+ "definition_version": {
1923
+ "name": "definition_version",
1924
+ "type": "integer",
1925
+ "primaryKey": false,
1926
+ "notNull": true,
1927
+ "autoincrement": false
1928
+ },
1929
+ "definition_hash": {
1930
+ "name": "definition_hash",
1931
+ "type": "text",
1932
+ "primaryKey": false,
1933
+ "notNull": true,
1934
+ "autoincrement": false
1935
+ },
1936
+ "workspace_id": {
1937
+ "name": "workspace_id",
1938
+ "type": "text",
1939
+ "primaryKey": false,
1940
+ "notNull": true,
1941
+ "autoincrement": false
1942
+ },
1943
+ "thread_id": {
1944
+ "name": "thread_id",
1945
+ "type": "text",
1946
+ "primaryKey": false,
1947
+ "notNull": true,
1948
+ "autoincrement": false
1949
+ },
1950
+ "app_id": {
1951
+ "name": "app_id",
1952
+ "type": "text",
1953
+ "primaryKey": false,
1954
+ "notNull": false,
1955
+ "autoincrement": false
1956
+ },
1957
+ "anchor_task_id": {
1958
+ "name": "anchor_task_id",
1959
+ "type": "text",
1960
+ "primaryKey": false,
1961
+ "notNull": false,
1962
+ "autoincrement": false
1963
+ },
1964
+ "domain_ref_json": {
1965
+ "name": "domain_ref_json",
1966
+ "type": "text",
1967
+ "primaryKey": false,
1968
+ "notNull": true,
1969
+ "autoincrement": false
1970
+ },
1971
+ "state_json": {
1972
+ "name": "state_json",
1973
+ "type": "text",
1974
+ "primaryKey": false,
1975
+ "notNull": true,
1976
+ "autoincrement": false
1977
+ },
1978
+ "revision": {
1979
+ "name": "revision",
1980
+ "type": "integer",
1981
+ "primaryKey": false,
1982
+ "notNull": true,
1983
+ "autoincrement": false,
1984
+ "default": 0
1985
+ },
1986
+ "status": {
1987
+ "name": "status",
1988
+ "type": "text",
1989
+ "primaryKey": false,
1990
+ "notNull": true,
1991
+ "autoincrement": false,
1992
+ "default": "'active'"
1993
+ },
1994
+ "granted_capabilities_json": {
1995
+ "name": "granted_capabilities_json",
1996
+ "type": "text",
1997
+ "primaryKey": false,
1998
+ "notNull": true,
1999
+ "autoincrement": false,
2000
+ "default": "'[]'"
2001
+ },
2002
+ "opened_by_json": {
2003
+ "name": "opened_by_json",
2004
+ "type": "text",
2005
+ "primaryKey": false,
2006
+ "notNull": false,
2007
+ "autoincrement": false
2008
+ },
2009
+ "created_at": {
2010
+ "name": "created_at",
2011
+ "type": "integer",
2012
+ "primaryKey": false,
2013
+ "notNull": true,
2014
+ "autoincrement": false
2015
+ },
2016
+ "updated_at": {
2017
+ "name": "updated_at",
2018
+ "type": "integer",
2019
+ "primaryKey": false,
2020
+ "notNull": true,
2021
+ "autoincrement": false
2022
+ }
2023
+ },
2024
+ "indexes": {
2025
+ "ui_instances_workspace_thread_idx": {
2026
+ "name": "ui_instances_workspace_thread_idx",
2027
+ "columns": [
2028
+ "workspace_id",
2029
+ "thread_id"
2030
+ ],
2031
+ "isUnique": false
2032
+ },
2033
+ "ui_instances_workspace_thread_app_uq": {
2034
+ "name": "ui_instances_workspace_thread_app_uq",
2035
+ "columns": [
2036
+ "workspace_id",
2037
+ "thread_id",
2038
+ "app_id"
2039
+ ],
2040
+ "isUnique": true,
2041
+ "where": "\"ui_instances\".\"status\" = 'active'"
2042
+ }
2043
+ },
2044
+ "foreignKeys": {},
2045
+ "compositePrimaryKeys": {},
2046
+ "uniqueConstraints": {},
2047
+ "checkConstraints": {
2048
+ "ui_instances_id_ck": {
2049
+ "name": "ui_instances_id_ck",
2050
+ "value": "length(\"ui_instances\".\"id\") BETWEEN 5 AND 128 AND \"ui_instances\".\"id\" GLOB 'uic_*'"
2051
+ },
2052
+ "ui_instances_definition_id_ck": {
2053
+ "name": "ui_instances_definition_id_ck",
2054
+ "value": "length(\"ui_instances\".\"definition_id\") BETWEEN 1 AND 128"
2055
+ },
2056
+ "ui_instances_definition_version_ck": {
2057
+ "name": "ui_instances_definition_version_ck",
2058
+ "value": "\"ui_instances\".\"definition_version\" >= 1"
2059
+ },
2060
+ "ui_instances_definition_hash_ck": {
2061
+ "name": "ui_instances_definition_hash_ck",
2062
+ "value": "length(\"ui_instances\".\"definition_hash\") = 64 AND \"ui_instances\".\"definition_hash\" NOT GLOB '*[^0-9a-f]*'"
2063
+ },
2064
+ "ui_instances_workspace_id_ck": {
2065
+ "name": "ui_instances_workspace_id_ck",
2066
+ "value": "length(\"ui_instances\".\"workspace_id\") BETWEEN 1 AND 256"
2067
+ },
2068
+ "ui_instances_thread_id_ck": {
2069
+ "name": "ui_instances_thread_id_ck",
2070
+ "value": "length(\"ui_instances\".\"thread_id\") BETWEEN 1 AND 256"
2071
+ },
2072
+ "ui_instances_app_id_ck": {
2073
+ "name": "ui_instances_app_id_ck",
2074
+ "value": "\"ui_instances\".\"app_id\" IS NULL OR length(\"ui_instances\".\"app_id\") BETWEEN 1 AND 128"
2075
+ },
2076
+ "ui_instances_domain_ref_json_ck": {
2077
+ "name": "ui_instances_domain_ref_json_ck",
2078
+ "value": "json_valid(\"ui_instances\".\"domain_ref_json\") AND json_type(\"ui_instances\".\"domain_ref_json\") = 'object'"
2079
+ },
2080
+ "ui_instances_state_json_ck": {
2081
+ "name": "ui_instances_state_json_ck",
2082
+ "value": "json_valid(\"ui_instances\".\"state_json\") AND json_type(\"ui_instances\".\"state_json\") = 'object'"
2083
+ },
2084
+ "ui_instances_revision_ck": {
2085
+ "name": "ui_instances_revision_ck",
2086
+ "value": "\"ui_instances\".\"revision\" >= 0"
2087
+ },
2088
+ "ui_instances_status_ck": {
2089
+ "name": "ui_instances_status_ck",
2090
+ "value": "\"ui_instances\".\"status\" IN ('active', 'completed', 'expired', 'revoked', 'unsupported')"
2091
+ },
2092
+ "ui_instances_granted_capabilities_json_ck": {
2093
+ "name": "ui_instances_granted_capabilities_json_ck",
2094
+ "value": "json_valid(\"ui_instances\".\"granted_capabilities_json\") AND json_type(\"ui_instances\".\"granted_capabilities_json\") = 'array'"
2095
+ },
2096
+ "ui_instances_opened_by_json_ck": {
2097
+ "name": "ui_instances_opened_by_json_ck",
2098
+ "value": "\"ui_instances\".\"opened_by_json\" IS NULL OR (json_valid(\"ui_instances\".\"opened_by_json\") AND json_type(\"ui_instances\".\"opened_by_json\") = 'object')"
2099
+ },
2100
+ "ui_instances_created_at_ck": {
2101
+ "name": "ui_instances_created_at_ck",
2102
+ "value": "\"ui_instances\".\"created_at\" >= 0"
2103
+ },
2104
+ "ui_instances_updated_at_ck": {
2105
+ "name": "ui_instances_updated_at_ck",
2106
+ "value": "\"ui_instances\".\"updated_at\" >= \"ui_instances\".\"created_at\""
2107
+ }
2108
+ }
2109
+ },
2110
+ "ui_action_receipts": {
2111
+ "name": "ui_action_receipts",
2112
+ "columns": {
2113
+ "id": {
2114
+ "name": "id",
2115
+ "type": "text",
2116
+ "primaryKey": true,
2117
+ "notNull": true,
2118
+ "autoincrement": false
2119
+ },
2120
+ "instance_id": {
2121
+ "name": "instance_id",
2122
+ "type": "text",
2123
+ "primaryKey": false,
2124
+ "notNull": true,
2125
+ "autoincrement": false
2126
+ },
2127
+ "definition_id": {
2128
+ "name": "definition_id",
2129
+ "type": "text",
2130
+ "primaryKey": false,
2131
+ "notNull": false,
2132
+ "autoincrement": false
2133
+ },
2134
+ "definition_version": {
2135
+ "name": "definition_version",
2136
+ "type": "integer",
2137
+ "primaryKey": false,
2138
+ "notNull": false,
2139
+ "autoincrement": false
2140
+ },
2141
+ "definition_hash": {
2142
+ "name": "definition_hash",
2143
+ "type": "text",
2144
+ "primaryKey": false,
2145
+ "notNull": false,
2146
+ "autoincrement": false
2147
+ },
2148
+ "request_id": {
2149
+ "name": "request_id",
2150
+ "type": "text",
2151
+ "primaryKey": false,
2152
+ "notNull": true,
2153
+ "autoincrement": false
2154
+ },
2155
+ "action_id": {
2156
+ "name": "action_id",
2157
+ "type": "text",
2158
+ "primaryKey": false,
2159
+ "notNull": true,
2160
+ "autoincrement": false
2161
+ },
2162
+ "actor_json": {
2163
+ "name": "actor_json",
2164
+ "type": "text",
2165
+ "primaryKey": false,
2166
+ "notNull": true,
2167
+ "autoincrement": false
2168
+ },
2169
+ "source": {
2170
+ "name": "source",
2171
+ "type": "text",
2172
+ "primaryKey": false,
2173
+ "notNull": true,
2174
+ "autoincrement": false
2175
+ },
2176
+ "expected_revision": {
2177
+ "name": "expected_revision",
2178
+ "type": "integer",
2179
+ "primaryKey": false,
2180
+ "notNull": true,
2181
+ "autoincrement": false
2182
+ },
2183
+ "before_revision": {
2184
+ "name": "before_revision",
2185
+ "type": "integer",
2186
+ "primaryKey": false,
2187
+ "notNull": true,
2188
+ "autoincrement": false
2189
+ },
2190
+ "after_revision": {
2191
+ "name": "after_revision",
2192
+ "type": "integer",
2193
+ "primaryKey": false,
2194
+ "notNull": false,
2195
+ "autoincrement": false
2196
+ },
2197
+ "status": {
2198
+ "name": "status",
2199
+ "type": "text",
2200
+ "primaryKey": false,
2201
+ "notNull": true,
2202
+ "autoincrement": false
2203
+ },
2204
+ "outcome": {
2205
+ "name": "outcome",
2206
+ "type": "text",
2207
+ "primaryKey": false,
2208
+ "notNull": false,
2209
+ "autoincrement": false
2210
+ },
2211
+ "input_json": {
2212
+ "name": "input_json",
2213
+ "type": "text",
2214
+ "primaryKey": false,
2215
+ "notNull": true,
2216
+ "autoincrement": false
2217
+ },
2218
+ "result_json": {
2219
+ "name": "result_json",
2220
+ "type": "text",
2221
+ "primaryKey": false,
2222
+ "notNull": false,
2223
+ "autoincrement": false
2224
+ },
2225
+ "error_code": {
2226
+ "name": "error_code",
2227
+ "type": "text",
2228
+ "primaryKey": false,
2229
+ "notNull": false,
2230
+ "autoincrement": false
2231
+ },
2232
+ "requested_at": {
2233
+ "name": "requested_at",
2234
+ "type": "integer",
2235
+ "primaryKey": false,
2236
+ "notNull": true,
2237
+ "autoincrement": false
2238
+ },
2239
+ "settled_at": {
2240
+ "name": "settled_at",
2241
+ "type": "integer",
2242
+ "primaryKey": false,
2243
+ "notNull": false,
2244
+ "autoincrement": false
2245
+ }
2246
+ },
2247
+ "indexes": {
2248
+ "ui_action_receipts_instance_request_uq": {
2249
+ "name": "ui_action_receipts_instance_request_uq",
2250
+ "columns": [
2251
+ "instance_id",
2252
+ "request_id"
2253
+ ],
2254
+ "isUnique": true
2255
+ },
2256
+ "ui_action_receipts_instance_id_idx": {
2257
+ "name": "ui_action_receipts_instance_id_idx",
2258
+ "columns": [
2259
+ "instance_id"
2260
+ ],
2261
+ "isUnique": false
2262
+ },
2263
+ "ui_action_receipts_requested_at_idx": {
2264
+ "name": "ui_action_receipts_requested_at_idx",
2265
+ "columns": [
2266
+ "requested_at"
2267
+ ],
2268
+ "isUnique": false
2269
+ }
2270
+ },
2271
+ "foreignKeys": {},
2272
+ "compositePrimaryKeys": {},
2273
+ "uniqueConstraints": {},
2274
+ "checkConstraints": {
2275
+ "ui_action_receipts_id_ck": {
2276
+ "name": "ui_action_receipts_id_ck",
2277
+ "value": "length(\"ui_action_receipts\".\"id\") BETWEEN 5 AND 128"
2278
+ },
2279
+ "ui_action_receipts_instance_id_ck": {
2280
+ "name": "ui_action_receipts_instance_id_ck",
2281
+ "value": "length(\"ui_action_receipts\".\"instance_id\") BETWEEN 1 AND 128"
2282
+ },
2283
+ "ui_action_receipts_request_id_ck": {
2284
+ "name": "ui_action_receipts_request_id_ck",
2285
+ "value": "length(\"ui_action_receipts\".\"request_id\") BETWEEN 1 AND 128"
2286
+ },
2287
+ "ui_action_receipts_action_id_ck": {
2288
+ "name": "ui_action_receipts_action_id_ck",
2289
+ "value": "length(\"ui_action_receipts\".\"action_id\") BETWEEN 1 AND 128"
2290
+ },
2291
+ "ui_action_receipts_actor_json_ck": {
2292
+ "name": "ui_action_receipts_actor_json_ck",
2293
+ "value": "json_valid(\"ui_action_receipts\".\"actor_json\") AND json_type(\"ui_action_receipts\".\"actor_json\") = 'object'"
2294
+ },
2295
+ "ui_action_receipts_source_ck": {
2296
+ "name": "ui_action_receipts_source_ck",
2297
+ "value": "\"ui_action_receipts\".\"source\" IN ('ui_host', 'cli', 'system', 'mcp')"
2298
+ },
2299
+ "ui_action_receipts_expected_revision_ck": {
2300
+ "name": "ui_action_receipts_expected_revision_ck",
2301
+ "value": "\"ui_action_receipts\".\"expected_revision\" >= 0"
2302
+ },
2303
+ "ui_action_receipts_before_revision_ck": {
2304
+ "name": "ui_action_receipts_before_revision_ck",
2305
+ "value": "\"ui_action_receipts\".\"before_revision\" >= 0"
2306
+ },
2307
+ "ui_action_receipts_after_revision_ck": {
2308
+ "name": "ui_action_receipts_after_revision_ck",
2309
+ "value": "\"ui_action_receipts\".\"after_revision\" IS NULL OR \"ui_action_receipts\".\"after_revision\" >= 0"
2310
+ },
2311
+ "ui_action_receipts_status_ck": {
2312
+ "name": "ui_action_receipts_status_ck",
2313
+ "value": "\"ui_action_receipts\".\"status\" IN ('requested', 'settled')"
2314
+ },
2315
+ "ui_action_receipts_outcome_ck": {
2316
+ "name": "ui_action_receipts_outcome_ck",
2317
+ "value": "\"ui_action_receipts\".\"outcome\" IS NULL OR \"ui_action_receipts\".\"outcome\" IN ('succeeded', 'rejected', 'failed', 'conflicted', 'expired')"
2318
+ },
2319
+ "ui_action_receipts_input_json_ck": {
2320
+ "name": "ui_action_receipts_input_json_ck",
2321
+ "value": "json_valid(\"ui_action_receipts\".\"input_json\") AND json_type(\"ui_action_receipts\".\"input_json\") = 'object'"
2322
+ },
2323
+ "ui_action_receipts_result_json_ck": {
2324
+ "name": "ui_action_receipts_result_json_ck",
2325
+ "value": "\"ui_action_receipts\".\"result_json\" IS NULL OR (json_valid(\"ui_action_receipts\".\"result_json\") AND json_type(\"ui_action_receipts\".\"result_json\") = 'object')"
2326
+ },
2327
+ "ui_action_receipts_requested_at_ck": {
2328
+ "name": "ui_action_receipts_requested_at_ck",
2329
+ "value": "\"ui_action_receipts\".\"requested_at\" >= 0"
2330
+ },
2331
+ "ui_action_receipts_settled_at_ck": {
2332
+ "name": "ui_action_receipts_settled_at_ck",
2333
+ "value": "\"ui_action_receipts\".\"settled_at\" IS NULL OR \"ui_action_receipts\".\"settled_at\" >= \"ui_action_receipts\".\"requested_at\""
2334
+ },
2335
+ "ui_action_receipts_status_transition_ck": {
2336
+ "name": "ui_action_receipts_status_transition_ck",
2337
+ "value": "(\n (\"ui_action_receipts\".\"status\" = 'requested' AND \"ui_action_receipts\".\"after_revision\" IS NULL AND \"ui_action_receipts\".\"outcome\" IS NULL AND \"ui_action_receipts\".\"settled_at\" IS NULL)\n OR\n (\"ui_action_receipts\".\"status\" = 'settled' AND \"ui_action_receipts\".\"after_revision\" IS NOT NULL AND \"ui_action_receipts\".\"outcome\" IS NOT NULL AND \"ui_action_receipts\".\"settled_at\" IS NOT NULL)\n )"
2338
+ }
2339
+ }
2340
+ },
2341
+ "ui_instance_repins": {
2342
+ "name": "ui_instance_repins",
2343
+ "columns": {
2344
+ "instance_id": {
2345
+ "name": "instance_id",
2346
+ "type": "text",
2347
+ "primaryKey": false,
2348
+ "notNull": true,
2349
+ "autoincrement": false
2350
+ },
2351
+ "from_version": {
2352
+ "name": "from_version",
2353
+ "type": "integer",
2354
+ "primaryKey": false,
2355
+ "notNull": true,
2356
+ "autoincrement": false
2357
+ },
2358
+ "from_hash": {
2359
+ "name": "from_hash",
2360
+ "type": "text",
2361
+ "primaryKey": false,
2362
+ "notNull": true,
2363
+ "autoincrement": false
2364
+ },
2365
+ "to_version": {
2366
+ "name": "to_version",
2367
+ "type": "integer",
2368
+ "primaryKey": false,
2369
+ "notNull": true,
2370
+ "autoincrement": false
2371
+ },
2372
+ "to_hash": {
2373
+ "name": "to_hash",
2374
+ "type": "text",
2375
+ "primaryKey": false,
2376
+ "notNull": true,
2377
+ "autoincrement": false
2378
+ },
2379
+ "from_revision": {
2380
+ "name": "from_revision",
2381
+ "type": "integer",
2382
+ "primaryKey": false,
2383
+ "notNull": true,
2384
+ "autoincrement": false
2385
+ },
2386
+ "to_revision": {
2387
+ "name": "to_revision",
2388
+ "type": "integer",
2389
+ "primaryKey": false,
2390
+ "notNull": false,
2391
+ "autoincrement": false
2392
+ },
2393
+ "status": {
2394
+ "name": "status",
2395
+ "type": "text",
2396
+ "primaryKey": false,
2397
+ "notNull": true,
2398
+ "autoincrement": false
2399
+ },
2400
+ "code": {
2401
+ "name": "code",
2402
+ "type": "text",
2403
+ "primaryKey": false,
2404
+ "notNull": false,
2405
+ "autoincrement": false
2406
+ },
2407
+ "attempts": {
2408
+ "name": "attempts",
2409
+ "type": "integer",
2410
+ "primaryKey": false,
2411
+ "notNull": true,
2412
+ "autoincrement": false,
2413
+ "default": 1
2414
+ },
2415
+ "first_at": {
2416
+ "name": "first_at",
2417
+ "type": "integer",
2418
+ "primaryKey": false,
2419
+ "notNull": true,
2420
+ "autoincrement": false
2421
+ },
2422
+ "last_at": {
2423
+ "name": "last_at",
2424
+ "type": "integer",
2425
+ "primaryKey": false,
2426
+ "notNull": true,
2427
+ "autoincrement": false
2428
+ }
2429
+ },
2430
+ "indexes": {},
2431
+ "foreignKeys": {},
2432
+ "compositePrimaryKeys": {
2433
+ "ui_instance_repins_pk": {
2434
+ "columns": [
2435
+ "instance_id",
2436
+ "to_hash"
2437
+ ],
2438
+ "name": "ui_instance_repins_pk"
2439
+ }
2440
+ },
2441
+ "uniqueConstraints": {},
2442
+ "checkConstraints": {
2443
+ "ui_instance_repins_instance_id_ck": {
2444
+ "name": "ui_instance_repins_instance_id_ck",
2445
+ "value": "length(\"ui_instance_repins\".\"instance_id\") BETWEEN 5 AND 128 AND \"ui_instance_repins\".\"instance_id\" GLOB 'uic_*'"
2446
+ },
2447
+ "ui_instance_repins_from_version_ck": {
2448
+ "name": "ui_instance_repins_from_version_ck",
2449
+ "value": "\"ui_instance_repins\".\"from_version\" >= 1"
2450
+ },
2451
+ "ui_instance_repins_to_version_ck": {
2452
+ "name": "ui_instance_repins_to_version_ck",
2453
+ "value": "\"ui_instance_repins\".\"to_version\" >= 1"
2454
+ },
2455
+ "ui_instance_repins_from_hash_ck": {
2456
+ "name": "ui_instance_repins_from_hash_ck",
2457
+ "value": "length(\"ui_instance_repins\".\"from_hash\") = 64 AND \"ui_instance_repins\".\"from_hash\" NOT GLOB '*[^0-9a-f]*'"
2458
+ },
2459
+ "ui_instance_repins_to_hash_ck": {
2460
+ "name": "ui_instance_repins_to_hash_ck",
2461
+ "value": "length(\"ui_instance_repins\".\"to_hash\") = 64 AND \"ui_instance_repins\".\"to_hash\" NOT GLOB '*[^0-9a-f]*'"
2462
+ },
2463
+ "ui_instance_repins_from_revision_ck": {
2464
+ "name": "ui_instance_repins_from_revision_ck",
2465
+ "value": "\"ui_instance_repins\".\"from_revision\" >= 0"
2466
+ },
2467
+ "ui_instance_repins_to_revision_ck": {
2468
+ "name": "ui_instance_repins_to_revision_ck",
2469
+ "value": "\"ui_instance_repins\".\"to_revision\" IS NULL OR \"ui_instance_repins\".\"to_revision\" >= 0"
2470
+ },
2471
+ "ui_instance_repins_status_ck": {
2472
+ "name": "ui_instance_repins_status_ck",
2473
+ "value": "\"ui_instance_repins\".\"status\" IN ('applied', 'deferred', 'failed')"
2474
+ },
2475
+ "ui_instance_repins_attempts_ck": {
2476
+ "name": "ui_instance_repins_attempts_ck",
2477
+ "value": "\"ui_instance_repins\".\"attempts\" >= 1"
2478
+ },
2479
+ "ui_instance_repins_dates_ck": {
2480
+ "name": "ui_instance_repins_dates_ck",
2481
+ "value": "\"ui_instance_repins\".\"first_at\" >= 0 AND \"ui_instance_repins\".\"last_at\" >= \"ui_instance_repins\".\"first_at\""
2482
+ },
2483
+ "ui_instance_repins_result_ck": {
2484
+ "name": "ui_instance_repins_result_ck",
2485
+ "value": "(\n (\"ui_instance_repins\".\"status\" = 'applied' AND \"ui_instance_repins\".\"code\" IS NULL\n AND \"ui_instance_repins\".\"to_revision\" = \"ui_instance_repins\".\"from_revision\" + 1)\n OR\n (\"ui_instance_repins\".\"status\" IN ('deferred', 'failed') AND \"ui_instance_repins\".\"code\" IS NOT NULL\n AND \"ui_instance_repins\".\"to_revision\" IS NULL)\n )"
2486
+ }
2487
+ }
2488
+ },
2489
+ "ui_definition_archive": {
2490
+ "name": "ui_definition_archive",
2491
+ "columns": {
2492
+ "definition_hash": {
2493
+ "name": "definition_hash",
2494
+ "type": "text",
2495
+ "primaryKey": true,
2496
+ "notNull": true,
2497
+ "autoincrement": false
2498
+ },
2499
+ "definition_json": {
2500
+ "name": "definition_json",
2501
+ "type": "text",
2502
+ "primaryKey": false,
2503
+ "notNull": true,
2504
+ "autoincrement": false
2505
+ },
2506
+ "created_at": {
2507
+ "name": "created_at",
2508
+ "type": "integer",
2509
+ "primaryKey": false,
2510
+ "notNull": true,
2511
+ "autoincrement": false
2512
+ }
2513
+ },
2514
+ "indexes": {},
2515
+ "foreignKeys": {},
2516
+ "compositePrimaryKeys": {},
2517
+ "uniqueConstraints": {},
2518
+ "checkConstraints": {
2519
+ "ui_definition_archive_definition_hash_ck": {
2520
+ "name": "ui_definition_archive_definition_hash_ck",
2521
+ "value": "length(\"ui_definition_archive\".\"definition_hash\") = 64 AND \"ui_definition_archive\".\"definition_hash\" NOT GLOB '*[^0-9a-f]*'"
2522
+ },
2523
+ "ui_definition_archive_definition_json_ck": {
2524
+ "name": "ui_definition_archive_definition_json_ck",
2525
+ "value": "json_valid(\"ui_definition_archive\".\"definition_json\") AND json_type(\"ui_definition_archive\".\"definition_json\") = 'object'"
2526
+ },
2527
+ "ui_definition_archive_created_at_ck": {
2528
+ "name": "ui_definition_archive_created_at_ck",
2529
+ "value": "\"ui_definition_archive\".\"created_at\" >= 0"
2530
+ }
2531
+ }
2532
+ },
2533
+ "project_criteria": {
2534
+ "name": "project_criteria",
2535
+ "columns": {
2536
+ "id": {
2537
+ "name": "id",
2538
+ "type": "text",
2539
+ "primaryKey": true,
2540
+ "notNull": true,
2541
+ "autoincrement": false
2542
+ },
2543
+ "project_id": {
2544
+ "name": "project_id",
2545
+ "type": "text",
2546
+ "primaryKey": false,
2547
+ "notNull": true,
2548
+ "autoincrement": false
2549
+ },
2550
+ "position": {
2551
+ "name": "position",
2552
+ "type": "integer",
2553
+ "primaryKey": false,
2554
+ "notNull": true,
2555
+ "autoincrement": false
2556
+ },
2557
+ "statement": {
2558
+ "name": "statement",
2559
+ "type": "text",
2560
+ "primaryKey": false,
2561
+ "notNull": true,
2562
+ "autoincrement": false
2563
+ },
2564
+ "verify_status": {
2565
+ "name": "verify_status",
2566
+ "type": "text",
2567
+ "primaryKey": false,
2568
+ "notNull": true,
2569
+ "autoincrement": false,
2570
+ "default": "'pending'"
2571
+ },
2572
+ "verified_at": {
2573
+ "name": "verified_at",
2574
+ "type": "text",
2575
+ "primaryKey": false,
2576
+ "notNull": false,
2577
+ "autoincrement": false
2578
+ },
2579
+ "evidence_json": {
2580
+ "name": "evidence_json",
2581
+ "type": "text",
2582
+ "primaryKey": false,
2583
+ "notNull": true,
2584
+ "autoincrement": false,
2585
+ "default": "'[]'"
2586
+ },
2587
+ "created_at": {
2588
+ "name": "created_at",
2589
+ "type": "text",
2590
+ "primaryKey": false,
2591
+ "notNull": true,
2592
+ "autoincrement": false
2593
+ },
2594
+ "updated_at": {
2595
+ "name": "updated_at",
2596
+ "type": "text",
2597
+ "primaryKey": false,
2598
+ "notNull": true,
2599
+ "autoincrement": false
2600
+ }
2601
+ },
2602
+ "indexes": {
2603
+ "project_criteria_project_position_uq": {
2604
+ "name": "project_criteria_project_position_uq",
2605
+ "columns": [
2606
+ "project_id",
2607
+ "position"
2608
+ ],
2609
+ "isUnique": true
2610
+ }
2611
+ },
2612
+ "foreignKeys": {
2613
+ "project_criteria_project_id_projects_id_fk": {
2614
+ "name": "project_criteria_project_id_projects_id_fk",
2615
+ "tableFrom": "project_criteria",
2616
+ "tableTo": "projects",
2617
+ "columnsFrom": [
2618
+ "project_id"
2619
+ ],
2620
+ "columnsTo": [
2621
+ "id"
2622
+ ],
2623
+ "onDelete": "cascade",
2624
+ "onUpdate": "no action"
2625
+ }
2626
+ },
2627
+ "compositePrimaryKeys": {},
2628
+ "uniqueConstraints": {},
2629
+ "checkConstraints": {
2630
+ "project_criteria_id_ck": {
2631
+ "name": "project_criteria_id_ck",
2632
+ "value": "\"project_criteria\".\"id\" GLOB 'pjc_*'"
2633
+ },
2634
+ "project_criteria_verify_status_ck": {
2635
+ "name": "project_criteria_verify_status_ck",
2636
+ "value": "\"project_criteria\".\"verify_status\" IN ('pending', 'verifying', 'passed', 'failed')"
2637
+ },
2638
+ "project_criteria_evidence_json_ck": {
2639
+ "name": "project_criteria_evidence_json_ck",
2640
+ "value": "json_valid(\"project_criteria\".\"evidence_json\") AND json_type(\"project_criteria\".\"evidence_json\") = 'array'"
2641
+ }
2642
+ }
2643
+ },
2644
+ "project_events": {
2645
+ "name": "project_events",
2646
+ "columns": {
2647
+ "id": {
2648
+ "name": "id",
2649
+ "type": "text",
2650
+ "primaryKey": true,
2651
+ "notNull": true,
2652
+ "autoincrement": false
2653
+ },
2654
+ "project_id": {
2655
+ "name": "project_id",
2656
+ "type": "text",
2657
+ "primaryKey": false,
2658
+ "notNull": true,
2659
+ "autoincrement": false
2660
+ },
2661
+ "seq": {
2662
+ "name": "seq",
2663
+ "type": "integer",
2664
+ "primaryKey": false,
2665
+ "notNull": true,
2666
+ "autoincrement": false
2667
+ },
2668
+ "actor_type": {
2669
+ "name": "actor_type",
2670
+ "type": "text",
2671
+ "primaryKey": false,
2672
+ "notNull": true,
2673
+ "autoincrement": false
2674
+ },
2675
+ "actor_id": {
2676
+ "name": "actor_id",
2677
+ "type": "text",
2678
+ "primaryKey": false,
2679
+ "notNull": false,
2680
+ "autoincrement": false
2681
+ },
2682
+ "type": {
2683
+ "name": "type",
2684
+ "type": "text",
2685
+ "primaryKey": false,
2686
+ "notNull": true,
2687
+ "autoincrement": false
2688
+ },
2689
+ "title": {
2690
+ "name": "title",
2691
+ "type": "text",
2692
+ "primaryKey": false,
2693
+ "notNull": true,
2694
+ "autoincrement": false
2695
+ },
2696
+ "summary": {
2697
+ "name": "summary",
2698
+ "type": "text",
2699
+ "primaryKey": false,
2700
+ "notNull": false,
2701
+ "autoincrement": false
2702
+ },
2703
+ "payload_json": {
2704
+ "name": "payload_json",
2705
+ "type": "text",
2706
+ "primaryKey": false,
2707
+ "notNull": true,
2708
+ "autoincrement": false,
2709
+ "default": "'{}'"
2710
+ },
2711
+ "created_at": {
2712
+ "name": "created_at",
2713
+ "type": "text",
2714
+ "primaryKey": false,
2715
+ "notNull": true,
2716
+ "autoincrement": false
2717
+ }
2718
+ },
2719
+ "indexes": {
2720
+ "project_events_project_seq_uq": {
2721
+ "name": "project_events_project_seq_uq",
2722
+ "columns": [
2723
+ "project_id",
2724
+ "seq"
2725
+ ],
2726
+ "isUnique": true
2727
+ }
2728
+ },
2729
+ "foreignKeys": {
2730
+ "project_events_project_id_projects_id_fk": {
2731
+ "name": "project_events_project_id_projects_id_fk",
2732
+ "tableFrom": "project_events",
2733
+ "tableTo": "projects",
2734
+ "columnsFrom": [
2735
+ "project_id"
2736
+ ],
2737
+ "columnsTo": [
2738
+ "id"
2739
+ ],
2740
+ "onDelete": "restrict",
2741
+ "onUpdate": "no action"
2742
+ }
2743
+ },
2744
+ "compositePrimaryKeys": {},
2745
+ "uniqueConstraints": {},
2746
+ "checkConstraints": {
2747
+ "project_events_id_ck": {
2748
+ "name": "project_events_id_ck",
2749
+ "value": "\"project_events\".\"id\" GLOB 'pje_*'"
2750
+ },
2751
+ "project_events_actor_type_ck": {
2752
+ "name": "project_events_actor_type_ck",
2753
+ "value": "\"project_events\".\"actor_type\" IN ('user', 'project_manager', 'system')"
2754
+ },
2755
+ "project_events_payload_json_ck": {
2756
+ "name": "project_events_payload_json_ck",
2757
+ "value": "json_valid(\"project_events\".\"payload_json\") AND json_type(\"project_events\".\"payload_json\") = 'object'"
2758
+ }
2759
+ }
2760
+ },
2761
+ "projects": {
2762
+ "name": "projects",
2763
+ "columns": {
2764
+ "id": {
2765
+ "name": "id",
2766
+ "type": "text",
2767
+ "primaryKey": true,
2768
+ "notNull": true,
2769
+ "autoincrement": false
2770
+ },
2771
+ "workspace_id": {
2772
+ "name": "workspace_id",
2773
+ "type": "text",
2774
+ "primaryKey": false,
2775
+ "notNull": true,
2776
+ "autoincrement": false
2777
+ },
2778
+ "name": {
2779
+ "name": "name",
2780
+ "type": "text",
2781
+ "primaryKey": false,
2782
+ "notNull": true,
2783
+ "autoincrement": false
2784
+ },
2785
+ "outcome": {
2786
+ "name": "outcome",
2787
+ "type": "text",
2788
+ "primaryKey": false,
2789
+ "notNull": true,
2790
+ "autoincrement": false
2791
+ },
2792
+ "due_date": {
2793
+ "name": "due_date",
2794
+ "type": "text",
2795
+ "primaryKey": false,
2796
+ "notNull": false,
2797
+ "autoincrement": false
2798
+ },
2799
+ "scene": {
2800
+ "name": "scene",
2801
+ "type": "text",
2802
+ "primaryKey": false,
2803
+ "notNull": true,
2804
+ "autoincrement": false,
2805
+ "default": "'planning'"
2806
+ },
2807
+ "stages_json": {
2808
+ "name": "stages_json",
2809
+ "type": "text",
2810
+ "primaryKey": false,
2811
+ "notNull": true,
2812
+ "autoincrement": false
2813
+ },
2814
+ "stage_index": {
2815
+ "name": "stage_index",
2816
+ "type": "integer",
2817
+ "primaryKey": false,
2818
+ "notNull": true,
2819
+ "autoincrement": false
2820
+ },
2821
+ "created_at": {
2822
+ "name": "created_at",
2823
+ "type": "text",
2824
+ "primaryKey": false,
2825
+ "notNull": true,
2826
+ "autoincrement": false
2827
+ },
2828
+ "updated_at": {
2829
+ "name": "updated_at",
2830
+ "type": "text",
2831
+ "primaryKey": false,
2832
+ "notNull": true,
2833
+ "autoincrement": false
2834
+ },
2835
+ "accepted_at": {
2836
+ "name": "accepted_at",
2837
+ "type": "text",
2838
+ "primaryKey": false,
2839
+ "notNull": false,
2840
+ "autoincrement": false
2841
+ },
2842
+ "archived_at": {
2843
+ "name": "archived_at",
2844
+ "type": "text",
2845
+ "primaryKey": false,
2846
+ "notNull": false,
2847
+ "autoincrement": false
2848
+ }
2849
+ },
2850
+ "indexes": {},
2851
+ "foreignKeys": {},
2852
+ "compositePrimaryKeys": {},
2853
+ "uniqueConstraints": {},
2854
+ "checkConstraints": {
2855
+ "projects_id_ck": {
2856
+ "name": "projects_id_ck",
2857
+ "value": "\"projects\".\"id\" GLOB 'prj_*'"
2858
+ },
2859
+ "projects_scene_ck": {
2860
+ "name": "projects_scene_ck",
2861
+ "value": "\"projects\".\"scene\" IN ('planning', 'plan_review', 'running', 'human_wait', 'limit_wait', 'failed_stop', 'analyzing_feedback', 'replanned', 'awaiting_review', 'accepted')"
2862
+ },
2863
+ "projects_stages_json_ck": {
2864
+ "name": "projects_stages_json_ck",
2865
+ "value": "json_valid(\"projects\".\"stages_json\") AND json_type(\"projects\".\"stages_json\") = 'array'"
2866
+ },
2867
+ "projects_stage_index_ck": {
2868
+ "name": "projects_stage_index_ck",
2869
+ "value": "\"projects\".\"stage_index\" >= 1"
2870
+ }
2871
+ }
2872
+ },
2873
+ "common_codes": {
2874
+ "name": "common_codes",
2875
+ "columns": {
2876
+ "code_group": {
2877
+ "name": "code_group",
2878
+ "type": "text",
2879
+ "primaryKey": false,
2880
+ "notNull": true,
2881
+ "autoincrement": false
2882
+ },
2883
+ "code": {
2884
+ "name": "code",
2885
+ "type": "text",
2886
+ "primaryKey": false,
2887
+ "notNull": true,
2888
+ "autoincrement": false
2889
+ },
2890
+ "code_name": {
2891
+ "name": "code_name",
2892
+ "type": "text",
2893
+ "primaryKey": false,
2894
+ "notNull": false,
2895
+ "autoincrement": false
2896
+ },
2897
+ "color": {
2898
+ "name": "color",
2899
+ "type": "text",
2900
+ "primaryKey": false,
2901
+ "notNull": true,
2902
+ "autoincrement": false,
2903
+ "default": "'gray'"
2904
+ },
2905
+ "sort_order": {
2906
+ "name": "sort_order",
2907
+ "type": "integer",
2908
+ "primaryKey": false,
2909
+ "notNull": true,
2910
+ "autoincrement": false
2911
+ },
2912
+ "workspace_id": {
2913
+ "name": "workspace_id",
2914
+ "type": "text",
2915
+ "primaryKey": false,
2916
+ "notNull": false,
2917
+ "autoincrement": false
2918
+ },
2919
+ "is_builtin": {
2920
+ "name": "is_builtin",
2921
+ "type": "integer",
2922
+ "primaryKey": false,
2923
+ "notNull": true,
2924
+ "autoincrement": false,
2925
+ "default": 0
2926
+ },
2927
+ "is_archived": {
2928
+ "name": "is_archived",
2929
+ "type": "integer",
2930
+ "primaryKey": false,
2931
+ "notNull": true,
2932
+ "autoincrement": false,
2933
+ "default": 0
2934
+ },
2935
+ "metadata": {
2936
+ "name": "metadata",
2937
+ "type": "text",
2938
+ "primaryKey": false,
2939
+ "notNull": false,
2940
+ "autoincrement": false
2941
+ },
2942
+ "created_at": {
2943
+ "name": "created_at",
2944
+ "type": "text",
2945
+ "primaryKey": false,
2946
+ "notNull": true,
2947
+ "autoincrement": false
2948
+ },
2949
+ "updated_at": {
2950
+ "name": "updated_at",
2951
+ "type": "text",
2952
+ "primaryKey": false,
2953
+ "notNull": true,
2954
+ "autoincrement": false
2955
+ }
2956
+ },
2957
+ "indexes": {
2958
+ "idx_common_codes_group_archived_order": {
2959
+ "name": "idx_common_codes_group_archived_order",
2960
+ "columns": [
2961
+ "code_group",
2962
+ "is_archived",
2963
+ "sort_order"
2964
+ ],
2965
+ "isUnique": false
2966
+ }
2967
+ },
2968
+ "foreignKeys": {},
2969
+ "compositePrimaryKeys": {
2970
+ "common_codes_code_group_code_pk": {
2971
+ "columns": [
2972
+ "code_group",
2973
+ "code"
2974
+ ],
2975
+ "name": "common_codes_code_group_code_pk"
2976
+ }
2977
+ },
2978
+ "uniqueConstraints": {},
2979
+ "checkConstraints": {
2980
+ "common_codes_metadata_ck": {
2981
+ "name": "common_codes_metadata_ck",
2982
+ "value": "\"common_codes\".\"metadata\" IS NULL OR (json_valid(\"common_codes\".\"metadata\") AND json_type(\"common_codes\".\"metadata\") = 'object')"
2983
+ },
2984
+ "common_codes_builtin_ck": {
2985
+ "name": "common_codes_builtin_ck",
2986
+ "value": "\"common_codes\".\"is_builtin\" IN (0, 1)"
2987
+ },
2988
+ "common_codes_archived_ck": {
2989
+ "name": "common_codes_archived_ck",
2990
+ "value": "\"common_codes\".\"is_archived\" IN (0, 1)"
2991
+ }
2992
+ }
2993
+ },
2994
+ "thread_events": {
2995
+ "name": "thread_events",
2996
+ "columns": {
2997
+ "id": {
2998
+ "name": "id",
2999
+ "type": "text",
3000
+ "primaryKey": true,
3001
+ "notNull": true,
3002
+ "autoincrement": false
3003
+ },
3004
+ "thread_id": {
3005
+ "name": "thread_id",
3006
+ "type": "text",
3007
+ "primaryKey": false,
3008
+ "notNull": true,
3009
+ "autoincrement": false
3010
+ },
3011
+ "seq": {
3012
+ "name": "seq",
3013
+ "type": "integer",
3014
+ "primaryKey": false,
3015
+ "notNull": true,
3016
+ "autoincrement": false
3017
+ },
3018
+ "type": {
3019
+ "name": "type",
3020
+ "type": "text",
3021
+ "primaryKey": false,
3022
+ "notNull": true,
3023
+ "autoincrement": false
3024
+ },
3025
+ "actor_type": {
3026
+ "name": "actor_type",
3027
+ "type": "text",
3028
+ "primaryKey": false,
3029
+ "notNull": true,
3030
+ "autoincrement": false
3031
+ },
3032
+ "payload_json": {
3033
+ "name": "payload_json",
3034
+ "type": "text",
3035
+ "primaryKey": false,
3036
+ "notNull": true,
3037
+ "autoincrement": false
3038
+ },
3039
+ "created_at": {
3040
+ "name": "created_at",
3041
+ "type": "text",
3042
+ "primaryKey": false,
3043
+ "notNull": true,
3044
+ "autoincrement": false
3045
+ },
3046
+ "actor_id": {
3047
+ "name": "actor_id",
3048
+ "type": "text",
3049
+ "primaryKey": false,
3050
+ "notNull": false,
3051
+ "autoincrement": false
3052
+ },
3053
+ "task_id": {
3054
+ "name": "task_id",
3055
+ "type": "text",
3056
+ "primaryKey": false,
3057
+ "notNull": false,
3058
+ "autoincrement": false
3059
+ },
3060
+ "highlight_id": {
3061
+ "name": "highlight_id",
3062
+ "type": "text",
3063
+ "primaryKey": false,
3064
+ "notNull": false,
3065
+ "autoincrement": false
3066
+ }
3067
+ },
3068
+ "indexes": {
3069
+ "idx_thread_events_thread_seq": {
3070
+ "name": "idx_thread_events_thread_seq",
3071
+ "columns": [
3072
+ "thread_id",
3073
+ "seq"
3074
+ ],
3075
+ "isUnique": false
3076
+ },
3077
+ "idx_thread_events_thread_created": {
3078
+ "name": "idx_thread_events_thread_created",
3079
+ "columns": [
3080
+ "thread_id",
3081
+ "created_at"
3082
+ ],
3083
+ "isUnique": false
3084
+ },
3085
+ "thread_events_thread_seq_uq": {
3086
+ "name": "thread_events_thread_seq_uq",
3087
+ "columns": [
3088
+ "thread_id",
3089
+ "seq"
3090
+ ],
3091
+ "isUnique": true
3092
+ }
3093
+ },
3094
+ "foreignKeys": {
3095
+ "thread_events_thread_id_threads_id_fk": {
3096
+ "name": "thread_events_thread_id_threads_id_fk",
3097
+ "tableFrom": "thread_events",
3098
+ "tableTo": "threads",
3099
+ "columnsFrom": [
3100
+ "thread_id"
3101
+ ],
3102
+ "columnsTo": [
3103
+ "id"
3104
+ ],
3105
+ "onDelete": "cascade",
3106
+ "onUpdate": "no action"
3107
+ }
3108
+ },
3109
+ "compositePrimaryKeys": {},
3110
+ "uniqueConstraints": {},
3111
+ "checkConstraints": {
3112
+ "thread_events_type_ck": {
3113
+ "name": "thread_events_type_ck",
3114
+ "value": "\"thread_events\".\"type\" IN ('thread.snapshot.imported', 'thread.title.changed', 'thread.priority.changed', 'thread.state.changed', 'thread.highlight.created', 'thread.highlight.updated', 'thread.highlight.deleted', 'thread.highlights.regenerated')"
3115
+ },
3116
+ "thread_events_actor_type_ck": {
3117
+ "name": "thread_events_actor_type_ck",
3118
+ "value": "\"thread_events\".\"actor_type\" IN ('user', 'agent', 'system')"
3119
+ },
3120
+ "thread_events_payload_json_ck": {
3121
+ "name": "thread_events_payload_json_ck",
3122
+ "value": "json_valid(\"thread_events\".\"payload_json\") AND json_type(\"thread_events\".\"payload_json\") = 'object'"
3123
+ }
3124
+ }
3125
+ },
3126
+ "thread_highlight_runs": {
3127
+ "name": "thread_highlight_runs",
3128
+ "columns": {
3129
+ "id": {
3130
+ "name": "id",
3131
+ "type": "text",
3132
+ "primaryKey": true,
3133
+ "notNull": true,
3134
+ "autoincrement": false
3135
+ },
3136
+ "thread_id": {
3137
+ "name": "thread_id",
3138
+ "type": "text",
3139
+ "primaryKey": false,
3140
+ "notNull": true,
3141
+ "autoincrement": false
3142
+ },
3143
+ "request_id": {
3144
+ "name": "request_id",
3145
+ "type": "text",
3146
+ "primaryKey": false,
3147
+ "notNull": true,
3148
+ "autoincrement": false
3149
+ },
3150
+ "status": {
3151
+ "name": "status",
3152
+ "type": "text",
3153
+ "primaryKey": false,
3154
+ "notNull": true,
3155
+ "autoincrement": false
3156
+ },
3157
+ "detector_version": {
3158
+ "name": "detector_version",
3159
+ "type": "text",
3160
+ "primaryKey": false,
3161
+ "notNull": true,
3162
+ "autoincrement": false
3163
+ },
3164
+ "requested_at": {
3165
+ "name": "requested_at",
3166
+ "type": "text",
3167
+ "primaryKey": false,
3168
+ "notNull": true,
3169
+ "autoincrement": false
3170
+ },
3171
+ "started_at": {
3172
+ "name": "started_at",
3173
+ "type": "text",
3174
+ "primaryKey": false,
3175
+ "notNull": false,
3176
+ "autoincrement": false
3177
+ },
3178
+ "completed_at": {
3179
+ "name": "completed_at",
3180
+ "type": "text",
3181
+ "primaryKey": false,
3182
+ "notNull": false,
3183
+ "autoincrement": false
3184
+ },
3185
+ "error_code": {
3186
+ "name": "error_code",
3187
+ "type": "text",
3188
+ "primaryKey": false,
3189
+ "notNull": false,
3190
+ "autoincrement": false
3191
+ },
3192
+ "previous_auto_count": {
3193
+ "name": "previous_auto_count",
3194
+ "type": "integer",
3195
+ "primaryKey": false,
3196
+ "notNull": false,
3197
+ "autoincrement": false
3198
+ },
3199
+ "new_auto_count": {
3200
+ "name": "new_auto_count",
3201
+ "type": "integer",
3202
+ "primaryKey": false,
3203
+ "notNull": false,
3204
+ "autoincrement": false
3205
+ }
3206
+ },
3207
+ "indexes": {
3208
+ "thread_highlight_runs_thread_request_uq": {
3209
+ "name": "thread_highlight_runs_thread_request_uq",
3210
+ "columns": [
3211
+ "thread_id",
3212
+ "request_id"
3213
+ ],
3214
+ "isUnique": true
3215
+ },
3216
+ "thread_highlight_runs_in_progress_thread_uq": {
3217
+ "name": "thread_highlight_runs_in_progress_thread_uq",
3218
+ "columns": [
3219
+ "thread_id"
3220
+ ],
3221
+ "isUnique": true,
3222
+ "where": "\"thread_highlight_runs\".\"status\" IN ('queued', 'running')"
3223
+ },
3224
+ "idx_thread_highlight_runs_thread_status_requested": {
3225
+ "name": "idx_thread_highlight_runs_thread_status_requested",
3226
+ "columns": [
3227
+ "thread_id",
3228
+ "status",
3229
+ "requested_at"
3230
+ ],
3231
+ "isUnique": false
3232
+ }
3233
+ },
3234
+ "foreignKeys": {
3235
+ "thread_highlight_runs_thread_id_threads_id_fk": {
3236
+ "name": "thread_highlight_runs_thread_id_threads_id_fk",
3237
+ "tableFrom": "thread_highlight_runs",
3238
+ "tableTo": "threads",
3239
+ "columnsFrom": [
3240
+ "thread_id"
3241
+ ],
3242
+ "columnsTo": [
3243
+ "id"
3244
+ ],
3245
+ "onDelete": "cascade",
3246
+ "onUpdate": "no action"
3247
+ }
3248
+ },
3249
+ "compositePrimaryKeys": {},
3250
+ "uniqueConstraints": {},
3251
+ "checkConstraints": {
3252
+ "thread_highlight_runs_status_ck": {
3253
+ "name": "thread_highlight_runs_status_ck",
3254
+ "value": "\"thread_highlight_runs\".\"status\" IN ('queued', 'running', 'completed', 'failed')"
3255
+ },
3256
+ "thread_highlight_runs_counts_ck": {
3257
+ "name": "thread_highlight_runs_counts_ck",
3258
+ "value": "(\"thread_highlight_runs\".\"previous_auto_count\" IS NULL OR \"thread_highlight_runs\".\"previous_auto_count\" >= 0) AND (\"thread_highlight_runs\".\"new_auto_count\" IS NULL OR \"thread_highlight_runs\".\"new_auto_count\" >= 0)"
3259
+ }
3260
+ }
3261
+ },
3262
+ "thread_highlights": {
3263
+ "name": "thread_highlights",
3264
+ "columns": {
3265
+ "id": {
3266
+ "name": "id",
3267
+ "type": "text",
3268
+ "primaryKey": true,
3269
+ "notNull": true,
3270
+ "autoincrement": false
3271
+ },
3272
+ "thread_id": {
3273
+ "name": "thread_id",
3274
+ "type": "text",
3275
+ "primaryKey": false,
3276
+ "notNull": true,
3277
+ "autoincrement": false
3278
+ },
3279
+ "source": {
3280
+ "name": "source",
3281
+ "type": "text",
3282
+ "primaryKey": false,
3283
+ "notNull": true,
3284
+ "autoincrement": false
3285
+ },
3286
+ "kind": {
3287
+ "name": "kind",
3288
+ "type": "text",
3289
+ "primaryKey": false,
3290
+ "notNull": true,
3291
+ "autoincrement": false
3292
+ },
3293
+ "status": {
3294
+ "name": "status",
3295
+ "type": "text",
3296
+ "primaryKey": false,
3297
+ "notNull": true,
3298
+ "autoincrement": false,
3299
+ "default": "'active'"
3300
+ },
3301
+ "text": {
3302
+ "name": "text",
3303
+ "type": "text",
3304
+ "primaryKey": false,
3305
+ "notNull": false,
3306
+ "autoincrement": false
3307
+ },
3308
+ "covers_from_task_id": {
3309
+ "name": "covers_from_task_id",
3310
+ "type": "text",
3311
+ "primaryKey": false,
3312
+ "notNull": true,
3313
+ "autoincrement": false
3314
+ },
3315
+ "covers_to_task_id": {
3316
+ "name": "covers_to_task_id",
3317
+ "type": "text",
3318
+ "primaryKey": false,
3319
+ "notNull": true,
3320
+ "autoincrement": false
3321
+ },
3322
+ "revision": {
3323
+ "name": "revision",
3324
+ "type": "integer",
3325
+ "primaryKey": false,
3326
+ "notNull": true,
3327
+ "autoincrement": false,
3328
+ "default": 0
3329
+ },
3330
+ "created_at": {
3331
+ "name": "created_at",
3332
+ "type": "text",
3333
+ "primaryKey": false,
3334
+ "notNull": true,
3335
+ "autoincrement": false
3336
+ },
3337
+ "updated_at": {
3338
+ "name": "updated_at",
3339
+ "type": "text",
3340
+ "primaryKey": false,
3341
+ "notNull": true,
3342
+ "autoincrement": false
3343
+ },
3344
+ "agent_id": {
3345
+ "name": "agent_id",
3346
+ "type": "text",
3347
+ "primaryKey": false,
3348
+ "notNull": false,
3349
+ "autoincrement": false
3350
+ },
3351
+ "source_task_id": {
3352
+ "name": "source_task_id",
3353
+ "type": "text",
3354
+ "primaryKey": false,
3355
+ "notNull": false,
3356
+ "autoincrement": false
3357
+ },
3358
+ "detector_version": {
3359
+ "name": "detector_version",
3360
+ "type": "text",
3361
+ "primaryKey": false,
3362
+ "notNull": false,
3363
+ "autoincrement": false
3364
+ },
3365
+ "content_fingerprint": {
3366
+ "name": "content_fingerprint",
3367
+ "type": "text",
3368
+ "primaryKey": false,
3369
+ "notNull": false,
3370
+ "autoincrement": false
3371
+ },
3372
+ "dismissed_at": {
3373
+ "name": "dismissed_at",
3374
+ "type": "text",
3375
+ "primaryKey": false,
3376
+ "notNull": false,
3377
+ "autoincrement": false
3378
+ }
3379
+ },
3380
+ "indexes": {
3381
+ "idx_thread_highlights_thread_status_created": {
3382
+ "name": "idx_thread_highlights_thread_status_created",
3383
+ "columns": [
3384
+ "thread_id",
3385
+ "status",
3386
+ "created_at"
3387
+ ],
3388
+ "isUnique": false
3389
+ },
3390
+ "idx_thread_highlights_thread_covers": {
3391
+ "name": "idx_thread_highlights_thread_covers",
3392
+ "columns": [
3393
+ "thread_id",
3394
+ "covers_from_task_id",
3395
+ "covers_to_task_id"
3396
+ ],
3397
+ "isUnique": false
3398
+ },
3399
+ "thread_highlights_auto_idempotency_uq": {
3400
+ "name": "thread_highlights_auto_idempotency_uq",
3401
+ "columns": [
3402
+ "thread_id",
3403
+ "source_task_id",
3404
+ "detector_version",
3405
+ "content_fingerprint"
3406
+ ],
3407
+ "isUnique": true,
3408
+ "where": "\"thread_highlights\".\"source\" = 'auto'"
3409
+ }
3410
+ },
3411
+ "foreignKeys": {
3412
+ "thread_highlights_thread_id_threads_id_fk": {
3413
+ "name": "thread_highlights_thread_id_threads_id_fk",
3414
+ "tableFrom": "thread_highlights",
3415
+ "tableTo": "threads",
3416
+ "columnsFrom": [
3417
+ "thread_id"
3418
+ ],
3419
+ "columnsTo": [
3420
+ "id"
3421
+ ],
3422
+ "onDelete": "cascade",
3423
+ "onUpdate": "no action"
3424
+ }
3425
+ },
3426
+ "compositePrimaryKeys": {},
3427
+ "uniqueConstraints": {},
3428
+ "checkConstraints": {
3429
+ "thread_highlights_source_ck": {
3430
+ "name": "thread_highlights_source_ck",
3431
+ "value": "\"thread_highlights\".\"source\" IN ('auto', 'manual')"
3432
+ },
3433
+ "thread_highlights_kind_ck": {
3434
+ "name": "thread_highlights_kind_ck",
3435
+ "value": "\"thread_highlights\".\"kind\" IN ('decision', 'judgment', 'issue', 'result', 'pivot')"
3436
+ },
3437
+ "thread_highlights_status_ck": {
3438
+ "name": "thread_highlights_status_ck",
3439
+ "value": "\"thread_highlights\".\"status\" IN ('active', 'dismissed')"
3440
+ },
3441
+ "thread_highlights_active_text_ck": {
3442
+ "name": "thread_highlights_active_text_ck",
3443
+ "value": "\"thread_highlights\".\"status\" = 'dismissed' OR (\"thread_highlights\".\"text\" IS NOT NULL AND length(\"thread_highlights\".\"text\") > 0)"
3444
+ },
3445
+ "thread_highlights_covers_ck": {
3446
+ "name": "thread_highlights_covers_ck",
3447
+ "value": "length(\"thread_highlights\".\"covers_from_task_id\") > 0 AND length(\"thread_highlights\".\"covers_to_task_id\") > 0"
3448
+ },
3449
+ "thread_highlights_auto_key_ck": {
3450
+ "name": "thread_highlights_auto_key_ck",
3451
+ "value": "\"thread_highlights\".\"source\" = 'manual' OR (\"thread_highlights\".\"source\" = 'auto' AND \"thread_highlights\".\"source_task_id\" IS NOT NULL AND \"thread_highlights\".\"detector_version\" IS NOT NULL AND \"thread_highlights\".\"content_fingerprint\" IS NOT NULL AND length(\"thread_highlights\".\"source_task_id\") > 0 AND length(\"thread_highlights\".\"detector_version\") > 0 AND length(\"thread_highlights\".\"content_fingerprint\") > 0)"
3452
+ }
3453
+ }
3454
+ },
3455
+ "storage_metadata": {
3456
+ "name": "storage_metadata",
3457
+ "columns": {
3458
+ "source_kind": {
3459
+ "name": "source_kind",
3460
+ "type": "text",
3461
+ "primaryKey": false,
3462
+ "notNull": true,
3463
+ "autoincrement": false
3464
+ },
3465
+ "source_id": {
3466
+ "name": "source_id",
3467
+ "type": "text",
3468
+ "primaryKey": false,
3469
+ "notNull": true,
3470
+ "autoincrement": false
3471
+ },
3472
+ "utc_ts": {
3473
+ "name": "utc_ts",
3474
+ "type": "text",
3475
+ "primaryKey": false,
3476
+ "notNull": false,
3477
+ "autoincrement": false
3478
+ },
3479
+ "bytes": {
3480
+ "name": "bytes",
3481
+ "type": "integer",
3482
+ "primaryKey": false,
3483
+ "notNull": true,
3484
+ "autoincrement": false
3485
+ }
3486
+ },
3487
+ "indexes": {
3488
+ "idx_storage_metadata_kind_ts_bytes": {
3489
+ "name": "idx_storage_metadata_kind_ts_bytes",
3490
+ "columns": [
3491
+ "source_kind",
3492
+ "utc_ts",
3493
+ "bytes"
3494
+ ],
3495
+ "isUnique": false
3496
+ }
3497
+ },
3498
+ "foreignKeys": {},
3499
+ "compositePrimaryKeys": {
3500
+ "storage_metadata_source_kind_source_id_pk": {
3501
+ "columns": [
3502
+ "source_kind",
3503
+ "source_id"
3504
+ ],
3505
+ "name": "storage_metadata_source_kind_source_id_pk"
3506
+ }
3507
+ },
3508
+ "uniqueConstraints": {},
3509
+ "checkConstraints": {}
3510
+ },
3511
+ "storage_metadata_state": {
3512
+ "name": "storage_metadata_state",
3513
+ "columns": {
3514
+ "unit": {
3515
+ "name": "unit",
3516
+ "type": "text",
3517
+ "primaryKey": true,
3518
+ "notNull": true,
3519
+ "autoincrement": false
3520
+ },
3521
+ "cursor_rowid": {
3522
+ "name": "cursor_rowid",
3523
+ "type": "integer",
3524
+ "primaryKey": false,
3525
+ "notNull": true,
3526
+ "autoincrement": false,
3527
+ "default": 0
3528
+ },
3529
+ "end_rowid": {
3530
+ "name": "end_rowid",
3531
+ "type": "integer",
3532
+ "primaryKey": false,
3533
+ "notNull": false,
3534
+ "autoincrement": false
3535
+ },
3536
+ "complete": {
3537
+ "name": "complete",
3538
+ "type": "integer",
3539
+ "primaryKey": false,
3540
+ "notNull": true,
3541
+ "autoincrement": false,
3542
+ "default": 0
3543
+ },
3544
+ "updated_at": {
3545
+ "name": "updated_at",
3546
+ "type": "text",
3547
+ "primaryKey": false,
3548
+ "notNull": true,
3549
+ "autoincrement": false
3550
+ }
3551
+ },
3552
+ "indexes": {},
3553
+ "foreignKeys": {},
3554
+ "compositePrimaryKeys": {},
3555
+ "uniqueConstraints": {},
3556
+ "checkConstraints": {}
3557
+ }
3558
+ },
3559
+ "views": {},
3560
+ "enums": {},
3561
+ "_meta": {
3562
+ "schemas": {},
3563
+ "tables": {},
3564
+ "columns": {}
3565
+ },
3566
+ "internal": {
3567
+ "indexes": {
3568
+ "idx_threads_workspace_thread_state": {
3569
+ "columns": {
3570
+ "json_extract(metadata, '$.threadTitle.state')": {
3571
+ "isExpression": true
3572
+ }
3573
+ }
3574
+ },
3575
+ "idx_threads_workspace_thread_priority": {
3576
+ "columns": {
3577
+ "json_extract(metadata, '$.threadTitle.priority')": {
3578
+ "isExpression": true
3579
+ }
3580
+ }
3581
+ },
3582
+ "idx_notifications_ws_created": {
3583
+ "columns": {
3584
+ "\"created_at\" DESC": {
3585
+ "isExpression": true
3586
+ }
3587
+ }
3588
+ }
3589
+ }
3590
+ }
3591
+ }