@intx/db 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +2 -2
  2. package/dist/approval-store.d.ts +52 -0
  3. package/dist/approval-store.js +79 -0
  4. package/dist/asset-resolution.d.ts +2 -2
  5. package/dist/client.d.ts +10 -0
  6. package/dist/connection.js +11 -8
  7. package/dist/credential-resolution.d.ts +130 -18
  8. package/dist/credential-resolution.js +142 -3
  9. package/dist/grant-store.js +35 -13
  10. package/dist/index.d.ts +13 -4
  11. package/dist/index.js +11 -3
  12. package/dist/model-source-resolution.d.ts +52 -6
  13. package/dist/model-source-resolution.js +145 -19
  14. package/dist/parse-row.d.ts +212 -32
  15. package/dist/parse-row.js +109 -18
  16. package/dist/rekey-credential-secrets.d.ts +13 -0
  17. package/dist/rekey-credential-secrets.js +61 -0
  18. package/dist/schema/approvals.d.ts +245 -0
  19. package/dist/schema/approvals.js +52 -0
  20. package/dist/schema/catalog.d.ts +17 -0
  21. package/dist/schema/catalog.js +7 -1
  22. package/dist/schema/credentials.d.ts +1 -1
  23. package/dist/schema/git-tokens.js +1 -1
  24. package/dist/schema/grants.js +8 -2
  25. package/dist/schema/index.d.ts +8 -4
  26. package/dist/schema/index.js +8 -4
  27. package/dist/schema/messages.d.ts +5 -5
  28. package/dist/schema/messages.js +20 -9
  29. package/dist/schema/offerings.js +8 -2
  30. package/dist/schema/principals.d.ts +2 -2
  31. package/dist/schema/principals.js +7 -5
  32. package/dist/schema/providers.d.ts +17 -0
  33. package/dist/schema/providers.js +5 -0
  34. package/dist/schema/roles.js +6 -2
  35. package/dist/schema/session-assets.d.ts +1 -38
  36. package/dist/schema/session-assets.js +36 -19
  37. package/dist/schema/sessions.js +7 -2
  38. package/dist/schema/sidecar-allocation.d.ts +406 -0
  39. package/dist/schema/sidecar-allocation.js +57 -0
  40. package/dist/schema/sidecar.d.ts +19 -2
  41. package/dist/schema/sidecar.js +13 -3
  42. package/dist/schema/signal-correlations.d.ts +177 -0
  43. package/dist/schema/signal-correlations.js +31 -0
  44. package/dist/schema/wallets.d.ts +3 -3
  45. package/dist/schema/wallets.js +4 -2
  46. package/dist/schema/{agents.d.ts → workflow-definitions.d.ts} +79 -113
  47. package/dist/schema/workflow-definitions.js +97 -0
  48. package/dist/schema/workflow-run-dispatch.d.ts +328 -0
  49. package/dist/schema/workflow-run-dispatch.js +56 -0
  50. package/dist/schema/{workflow-deployments.d.ts → workflow-run-execution.d.ts} +43 -46
  51. package/dist/schema/workflow-run-execution.js +48 -0
  52. package/dist/schema/workflow-run-launch-spec.d.ts +200 -0
  53. package/dist/schema/workflow-run-launch-spec.js +26 -0
  54. package/dist/schema/{instances.d.ts → workflow-run.d.ts} +39 -71
  55. package/dist/schema/workflow-run.js +102 -0
  56. package/dist/sidecar-allocation-store.d.ts +171 -0
  57. package/dist/sidecar-allocation-store.js +512 -0
  58. package/dist/signal-correlation-store.d.ts +36 -0
  59. package/dist/signal-correlation-store.js +63 -0
  60. package/dist/tenant-hierarchy.d.ts +2 -1
  61. package/dist/tenant-hierarchy.js +10 -5
  62. package/dist/workflow-definition-store.d.ts +55 -0
  63. package/dist/workflow-definition-store.js +93 -0
  64. package/dist/workflow-run-dispatch-store.d.ts +80 -0
  65. package/dist/workflow-run-dispatch-store.js +298 -0
  66. package/dist/workflow-run-launch-spec-store.d.ts +13 -0
  67. package/dist/workflow-run-launch-spec-store.js +30 -0
  68. package/dist/workflow-run-store.d.ts +54 -0
  69. package/dist/workflow-run-store.js +85 -0
  70. package/migrations/0037_credential_use_backfill.sql +39 -0
  71. package/migrations/0038_chilly_blacklash.sql +37 -0
  72. package/migrations/0039_quick_carnage.sql +2 -0
  73. package/migrations/0040_reshape_approval_origin.sql +24 -0
  74. package/migrations/0041_make_approval_timeout_at_nullable.sql +1 -0
  75. package/migrations/0042_youthful_mantis.sql +2 -0
  76. package/migrations/0043_signal_correlation_deployment_fk.sql +1 -0
  77. package/migrations/0044_model_offering_quirks.sql +1 -0
  78. package/migrations/0045_create_workflow_run.sql +13 -0
  79. package/migrations/0046_approval_signal_correlation_run_fk.sql +2 -0
  80. package/migrations/0047_create_workflow_definition.sql +30 -0
  81. package/migrations/0048_workflow_definition_origin_agent_id.sql +2 -0
  82. package/migrations/0049_curly_omega_flight.sql +2 -0
  83. package/migrations/0050_late_crystal.sql +10 -0
  84. package/migrations/0051_funny_madelyne_pryor.sql +1 -0
  85. package/migrations/0052_drop_inference_turn_instance_fk.sql +1 -0
  86. package/migrations/0053_session_mail_session_id_index.sql +1 -0
  87. package/migrations/0054_rekey_instance_grants_to_workflow_run.sql +10 -0
  88. package/migrations/0055_backfill_anchor_workflow_runs.sql +69 -0
  89. package/migrations/0056_repoint_deployment_fks_to_anchor_run.sql +32 -0
  90. package/migrations/0057_drop_workflow_deployment_projection.sql +22 -0
  91. package/migrations/0058_repoint_offering_fk_to_definition.sql +41 -0
  92. package/migrations/0059_repoint_transaction_fk_to_run.sql +10 -0
  93. package/migrations/0060_drop_session_mail_instance_fk.sql +6 -0
  94. package/migrations/0061_drop_session_asset_instance_fk.sql +7 -0
  95. package/migrations/0062_drop_agent_asset_table.sql +11 -0
  96. package/migrations/0063_repoint_agent_role_fk_to_definition.sql +39 -0
  97. package/migrations/0064_repoint_agent_session_fk_to_definition.sql +47 -0
  98. package/migrations/0065_add_workflow_definition_model_requirements.sql +37 -0
  99. package/migrations/0066_rekey_agent_definition_principals_to_workflow.sql +27 -0
  100. package/migrations/0067_add_workflow_definition_kind.sql +10 -0
  101. package/migrations/0068_drop_agent_tables_and_origin_agent_id.sql +31 -0
  102. package/migrations/0069_drop_workflow_definition_kind.sql +10 -0
  103. package/migrations/0070_flashy_proteus.sql +13 -0
  104. package/migrations/0072_add_workflow_definition_credential_bindings.sql +1 -0
  105. package/migrations/0073_grant_target_exactly_one_check.sql +13 -0
  106. package/migrations/0074_add_provider_api_base_url.sql +1 -0
  107. package/migrations/0075_workflow_run_launch_spec.sql +17 -0
  108. package/migrations/0076_sidecar_allocation.sql +40 -0
  109. package/migrations/0077_workflow_run_dispatch.sql +29 -0
  110. package/migrations/0078_workflow_run_dispatch_kind.sql +2 -0
  111. package/migrations/0079_rename_workflow_run_deployment_id_to_anchor_run_id.sql +4 -0
  112. package/migrations/0080_rename_correlation_approval_deployment_id_to_anchor_run_id.sql +9 -0
  113. package/migrations/0081_workflow_definition_content_hash_and_approved_wire_hash.sql +4 -0
  114. package/migrations/0082_blue_black_queen.sql +1 -0
  115. package/migrations/0083_replace_launch_spec_snapshot_with_frozen_bundle.sql +3 -0
  116. package/migrations/0084_delete_orphaned_credential_grants.sql +22 -0
  117. package/migrations/meta/0037_snapshot.json +3237 -0
  118. package/migrations/meta/0038_snapshot.json +3470 -0
  119. package/migrations/meta/0039_snapshot.json +3470 -0
  120. package/migrations/meta/0040_snapshot.json +3489 -0
  121. package/migrations/meta/0041_snapshot.json +3489 -0
  122. package/migrations/meta/0042_snapshot.json +3489 -0
  123. package/migrations/meta/0043_snapshot.json +3498 -0
  124. package/migrations/meta/0044_snapshot.json +3504 -0
  125. package/migrations/meta/0045_snapshot.json +3589 -0
  126. package/migrations/meta/0046_snapshot.json +3607 -0
  127. package/migrations/meta/0047_snapshot.json +3832 -0
  128. package/migrations/meta/0048_snapshot.json +3853 -0
  129. package/migrations/meta/0049_snapshot.json +3854 -0
  130. package/migrations/meta/0050_snapshot.json +3924 -0
  131. package/migrations/meta/0051_snapshot.json +3940 -0
  132. package/migrations/meta/0052_snapshot.json +3931 -0
  133. package/migrations/meta/0053_snapshot.json +3952 -0
  134. package/migrations/meta/0054_snapshot.json +3952 -0
  135. package/migrations/meta/0055_snapshot.json +3952 -0
  136. package/migrations/meta/0056_snapshot.json +3952 -0
  137. package/migrations/meta/0057_snapshot.json +3839 -0
  138. package/migrations/meta/0058_snapshot.json +3839 -0
  139. package/migrations/meta/0059_snapshot.json +3839 -0
  140. package/migrations/meta/0060_snapshot.json +3830 -0
  141. package/migrations/meta/0061_snapshot.json +3821 -0
  142. package/migrations/meta/0062_snapshot.json +3723 -0
  143. package/migrations/meta/0063_snapshot.json +3723 -0
  144. package/migrations/meta/0064_snapshot.json +3723 -0
  145. package/migrations/meta/0065_snapshot.json +3729 -0
  146. package/migrations/meta/0066_snapshot.json +3729 -0
  147. package/migrations/meta/0067_snapshot.json +3736 -0
  148. package/migrations/meta/0068_snapshot.json +3347 -0
  149. package/migrations/meta/0069_snapshot.json +3340 -0
  150. package/migrations/meta/0070_snapshot.json +3444 -0
  151. package/migrations/meta/0072_snapshot.json +3450 -0
  152. package/migrations/meta/0073_snapshot.json +3455 -0
  153. package/migrations/meta/0074_snapshot.json +3461 -0
  154. package/migrations/meta/0075_snapshot.json +3567 -0
  155. package/migrations/meta/0076_snapshot.json +3851 -0
  156. package/migrations/meta/0077_snapshot.json +4067 -0
  157. package/migrations/meta/0078_snapshot.json +4078 -0
  158. package/migrations/meta/0079_snapshot.json +4078 -0
  159. package/migrations/meta/0080_snapshot.json +4078 -0
  160. package/migrations/meta/0081_snapshot.json +4096 -0
  161. package/migrations/meta/0082_snapshot.json +4102 -0
  162. package/migrations/meta/0083_snapshot.json +4096 -0
  163. package/migrations/meta/0084_snapshot.json +4096 -0
  164. package/migrations/meta/_journal.json +329 -0
  165. package/package.json +6 -3
  166. package/dist/schema/agent-assets.d.ts +0 -109
  167. package/dist/schema/agent-assets.js +0 -15
  168. package/dist/schema/agents.js +0 -57
  169. package/dist/schema/instances.js +0 -39
  170. package/dist/schema/workflow-deployments.js +0 -37
@@ -260,6 +260,335 @@
260
260
  "when": 1783998502613,
261
261
  "tag": "0036_sharp_the_executioner",
262
262
  "breakpoints": true
263
+ },
264
+ {
265
+ "idx": 37,
266
+ "version": "7",
267
+ "when": 1784193583232,
268
+ "tag": "0037_credential_use_backfill",
269
+ "breakpoints": true
270
+ },
271
+ {
272
+ "idx": 38,
273
+ "version": "7",
274
+ "when": 1784229989017,
275
+ "tag": "0038_chilly_blacklash",
276
+ "breakpoints": true
277
+ },
278
+ {
279
+ "idx": 39,
280
+ "version": "7",
281
+ "when": 1784262044343,
282
+ "tag": "0039_quick_carnage",
283
+ "breakpoints": true
284
+ },
285
+ {
286
+ "idx": 40,
287
+ "version": "7",
288
+ "when": 1784290369159,
289
+ "tag": "0040_reshape_approval_origin",
290
+ "breakpoints": true
291
+ },
292
+ {
293
+ "idx": 41,
294
+ "version": "7",
295
+ "when": 1784291992954,
296
+ "tag": "0041_make_approval_timeout_at_nullable",
297
+ "breakpoints": true
298
+ },
299
+ {
300
+ "idx": 42,
301
+ "version": "7",
302
+ "when": 1784385053475,
303
+ "tag": "0042_youthful_mantis",
304
+ "breakpoints": true
305
+ },
306
+ {
307
+ "idx": 43,
308
+ "version": "7",
309
+ "when": 1784574028729,
310
+ "tag": "0043_signal_correlation_deployment_fk",
311
+ "breakpoints": true
312
+ },
313
+ {
314
+ "idx": 44,
315
+ "version": "7",
316
+ "when": 1784647908094,
317
+ "tag": "0044_model_offering_quirks",
318
+ "breakpoints": true
319
+ },
320
+ {
321
+ "idx": 45,
322
+ "version": "7",
323
+ "when": 1784683821134,
324
+ "tag": "0045_create_workflow_run",
325
+ "breakpoints": true
326
+ },
327
+ {
328
+ "idx": 46,
329
+ "version": "7",
330
+ "when": 1784685004809,
331
+ "tag": "0046_approval_signal_correlation_run_fk",
332
+ "breakpoints": true
333
+ },
334
+ {
335
+ "idx": 47,
336
+ "version": "7",
337
+ "when": 1784837465838,
338
+ "tag": "0047_create_workflow_definition",
339
+ "breakpoints": true
340
+ },
341
+ {
342
+ "idx": 48,
343
+ "version": "7",
344
+ "when": 1784843439588,
345
+ "tag": "0048_workflow_definition_origin_agent_id",
346
+ "breakpoints": true
347
+ },
348
+ {
349
+ "idx": 49,
350
+ "version": "7",
351
+ "when": 1784874344480,
352
+ "tag": "0049_curly_omega_flight",
353
+ "breakpoints": true
354
+ },
355
+ {
356
+ "idx": 50,
357
+ "version": "7",
358
+ "when": 1784900369564,
359
+ "tag": "0050_late_crystal",
360
+ "breakpoints": true
361
+ },
362
+ {
363
+ "idx": 51,
364
+ "version": "7",
365
+ "when": 1784904262816,
366
+ "tag": "0051_funny_madelyne_pryor",
367
+ "breakpoints": true
368
+ },
369
+ {
370
+ "idx": 52,
371
+ "version": "7",
372
+ "when": 1784930942498,
373
+ "tag": "0052_drop_inference_turn_instance_fk",
374
+ "breakpoints": true
375
+ },
376
+ {
377
+ "idx": 53,
378
+ "version": "7",
379
+ "when": 1784937859340,
380
+ "tag": "0053_session_mail_session_id_index",
381
+ "breakpoints": true
382
+ },
383
+ {
384
+ "idx": 54,
385
+ "version": "7",
386
+ "when": 1784954863099,
387
+ "tag": "0054_rekey_instance_grants_to_workflow_run",
388
+ "breakpoints": true
389
+ },
390
+ {
391
+ "idx": 55,
392
+ "version": "7",
393
+ "when": 1785022747684,
394
+ "tag": "0055_backfill_anchor_workflow_runs",
395
+ "breakpoints": true
396
+ },
397
+ {
398
+ "idx": 56,
399
+ "version": "7",
400
+ "when": 1785077765166,
401
+ "tag": "0056_repoint_deployment_fks_to_anchor_run",
402
+ "breakpoints": true
403
+ },
404
+ {
405
+ "idx": 57,
406
+ "version": "7",
407
+ "when": 1785081029417,
408
+ "tag": "0057_drop_workflow_deployment_projection",
409
+ "breakpoints": true
410
+ },
411
+ {
412
+ "idx": 58,
413
+ "version": "7",
414
+ "when": 1785085643398,
415
+ "tag": "0058_repoint_offering_fk_to_definition",
416
+ "breakpoints": true
417
+ },
418
+ {
419
+ "idx": 59,
420
+ "version": "7",
421
+ "when": 1785087256544,
422
+ "tag": "0059_repoint_transaction_fk_to_run",
423
+ "breakpoints": true
424
+ },
425
+ {
426
+ "idx": 60,
427
+ "version": "7",
428
+ "when": 1785089581427,
429
+ "tag": "0060_drop_session_mail_instance_fk",
430
+ "breakpoints": true
431
+ },
432
+ {
433
+ "idx": 61,
434
+ "version": "7",
435
+ "when": 1785089702623,
436
+ "tag": "0061_drop_session_asset_instance_fk",
437
+ "breakpoints": true
438
+ },
439
+ {
440
+ "idx": 62,
441
+ "version": "7",
442
+ "when": 1785165557463,
443
+ "tag": "0062_drop_agent_asset_table",
444
+ "breakpoints": true
445
+ },
446
+ {
447
+ "idx": 63,
448
+ "version": "7",
449
+ "when": 1785167954461,
450
+ "tag": "0063_repoint_agent_role_fk_to_definition",
451
+ "breakpoints": true
452
+ },
453
+ {
454
+ "idx": 64,
455
+ "version": "7",
456
+ "when": 1785169484868,
457
+ "tag": "0064_repoint_agent_session_fk_to_definition",
458
+ "breakpoints": true
459
+ },
460
+ {
461
+ "idx": 65,
462
+ "version": "7",
463
+ "when": 1785179839765,
464
+ "tag": "0065_add_workflow_definition_model_requirements",
465
+ "breakpoints": true
466
+ },
467
+ {
468
+ "idx": 66,
469
+ "version": "7",
470
+ "when": 1785280000000,
471
+ "tag": "0066_rekey_agent_definition_principals_to_workflow",
472
+ "breakpoints": true
473
+ },
474
+ {
475
+ "idx": 67,
476
+ "version": "7",
477
+ "when": 1785400000000,
478
+ "tag": "0067_add_workflow_definition_kind",
479
+ "breakpoints": true
480
+ },
481
+ {
482
+ "idx": 68,
483
+ "version": "7",
484
+ "when": 1785500000000,
485
+ "tag": "0068_drop_agent_tables_and_origin_agent_id",
486
+ "breakpoints": true
487
+ },
488
+ {
489
+ "idx": 69,
490
+ "version": "7",
491
+ "when": 1785337102704,
492
+ "tag": "0069_drop_workflow_definition_kind",
493
+ "breakpoints": true
494
+ },
495
+ {
496
+ "idx": 70,
497
+ "version": "7",
498
+ "when": 1785519721882,
499
+ "tag": "0070_flashy_proteus",
500
+ "breakpoints": true
501
+ },
502
+ {
503
+ "idx": 72,
504
+ "version": "7",
505
+ "when": 1785788422511,
506
+ "tag": "0072_add_workflow_definition_credential_bindings",
507
+ "breakpoints": true
508
+ },
509
+ {
510
+ "idx": 73,
511
+ "version": "7",
512
+ "when": 1785791424774,
513
+ "tag": "0073_grant_target_exactly_one_check",
514
+ "breakpoints": true
515
+ },
516
+ {
517
+ "idx": 74,
518
+ "version": "7",
519
+ "when": 1785884353793,
520
+ "tag": "0074_add_provider_api_base_url",
521
+ "breakpoints": true
522
+ },
523
+ {
524
+ "idx": 75,
525
+ "version": "7",
526
+ "when": 1786055554289,
527
+ "tag": "0075_workflow_run_launch_spec",
528
+ "breakpoints": true
529
+ },
530
+ {
531
+ "idx": 76,
532
+ "version": "7",
533
+ "when": 1786055582673,
534
+ "tag": "0076_sidecar_allocation",
535
+ "breakpoints": true
536
+ },
537
+ {
538
+ "idx": 77,
539
+ "version": "7",
540
+ "when": 1786055601046,
541
+ "tag": "0077_workflow_run_dispatch",
542
+ "breakpoints": true
543
+ },
544
+ {
545
+ "idx": 78,
546
+ "version": "7",
547
+ "when": 1786055642946,
548
+ "tag": "0078_workflow_run_dispatch_kind",
549
+ "breakpoints": true
550
+ },
551
+ {
552
+ "idx": 79,
553
+ "version": "7",
554
+ "when": 1786480852752,
555
+ "tag": "0079_rename_workflow_run_deployment_id_to_anchor_run_id",
556
+ "breakpoints": true
557
+ },
558
+ {
559
+ "idx": 80,
560
+ "version": "7",
561
+ "when": 1786481000000,
562
+ "tag": "0080_rename_correlation_approval_deployment_id_to_anchor_run_id",
563
+ "breakpoints": true
564
+ },
565
+ {
566
+ "idx": 81,
567
+ "version": "7",
568
+ "when": 1786665226312,
569
+ "tag": "0081_workflow_definition_content_hash_and_approved_wire_hash",
570
+ "breakpoints": true
571
+ },
572
+ {
573
+ "idx": 82,
574
+ "version": "7",
575
+ "when": 1787066175571,
576
+ "tag": "0082_blue_black_queen",
577
+ "breakpoints": true
578
+ },
579
+ {
580
+ "idx": 83,
581
+ "version": "7",
582
+ "when": 1787096121244,
583
+ "tag": "0083_replace_launch_spec_snapshot_with_frozen_bundle",
584
+ "breakpoints": true
585
+ },
586
+ {
587
+ "idx": 84,
588
+ "version": "7",
589
+ "when": 1787169492000,
590
+ "tag": "0084_delete_orphaned_credential_grants",
591
+ "breakpoints": true
263
592
  }
264
593
  ]
265
594
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@intx/db",
3
- "version": "0.2.2",
3
+ "description": "Client, schema, migrations, and row parsers for the hub's PostgreSQL database",
4
+ "version": "0.3.0",
4
5
  "license": "LGPL-2.1-only",
5
6
  "type": "module",
6
7
  "exports": {
@@ -16,8 +17,10 @@
16
17
  }
17
18
  },
18
19
  "dependencies": {
19
- "@intx/log": "0.2.2",
20
- "@intx/types": "0.2.2",
20
+ "@intx/authz": "0.3.0",
21
+ "@intx/crypto": "0.3.0",
22
+ "@intx/log": "0.3.0",
23
+ "@intx/types": "0.3.0",
21
24
  "arktype": "^2.1.29",
22
25
  "drizzle-orm": "^0.45.1",
23
26
  "postgres": "^3.4.8"
@@ -1,109 +0,0 @@
1
- export declare const agentAsset: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
- name: "agent_asset";
3
- schema: undefined;
4
- columns: {
5
- id: import("drizzle-orm/pg-core").PgColumn<{
6
- name: "id";
7
- tableName: "agent_asset";
8
- dataType: "string";
9
- columnType: "PgText";
10
- data: string;
11
- driverParam: string;
12
- notNull: true;
13
- hasDefault: false;
14
- isPrimaryKey: true;
15
- isAutoincrement: false;
16
- hasRuntimeDefault: false;
17
- enumValues: [string, ...string[]];
18
- baseColumn: never;
19
- identity: undefined;
20
- generated: undefined;
21
- }, {}, {}>;
22
- agentId: import("drizzle-orm/pg-core").PgColumn<{
23
- name: "agent_id";
24
- tableName: "agent_asset";
25
- dataType: "string";
26
- columnType: "PgText";
27
- data: string;
28
- driverParam: string;
29
- notNull: true;
30
- hasDefault: false;
31
- isPrimaryKey: false;
32
- isAutoincrement: false;
33
- hasRuntimeDefault: false;
34
- enumValues: [string, ...string[]];
35
- baseColumn: never;
36
- identity: undefined;
37
- generated: undefined;
38
- }, {}, {}>;
39
- assetId: import("drizzle-orm/pg-core").PgColumn<{
40
- name: "asset_id";
41
- tableName: "agent_asset";
42
- dataType: "string";
43
- columnType: "PgText";
44
- data: string;
45
- driverParam: string;
46
- notNull: true;
47
- hasDefault: false;
48
- isPrimaryKey: false;
49
- isAutoincrement: false;
50
- hasRuntimeDefault: false;
51
- enumValues: [string, ...string[]];
52
- baseColumn: never;
53
- identity: undefined;
54
- generated: undefined;
55
- }, {}, {}>;
56
- ref: import("drizzle-orm/pg-core").PgColumn<{
57
- name: "ref";
58
- tableName: "agent_asset";
59
- dataType: "string";
60
- columnType: "PgText";
61
- data: string;
62
- driverParam: string;
63
- notNull: true;
64
- hasDefault: false;
65
- isPrimaryKey: false;
66
- isAutoincrement: false;
67
- hasRuntimeDefault: false;
68
- enumValues: [string, ...string[]];
69
- baseColumn: never;
70
- identity: undefined;
71
- generated: undefined;
72
- }, {}, {}>;
73
- accessMode: import("drizzle-orm/pg-core").PgColumn<{
74
- name: "access_mode";
75
- tableName: "agent_asset";
76
- dataType: "string";
77
- columnType: "PgText";
78
- data: string;
79
- driverParam: string;
80
- notNull: true;
81
- hasDefault: true;
82
- isPrimaryKey: false;
83
- isAutoincrement: false;
84
- hasRuntimeDefault: false;
85
- enumValues: [string, ...string[]];
86
- baseColumn: never;
87
- identity: undefined;
88
- generated: undefined;
89
- }, {}, {}>;
90
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
91
- name: "created_at";
92
- tableName: "agent_asset";
93
- dataType: "date";
94
- columnType: "PgTimestamp";
95
- data: Date;
96
- driverParam: string;
97
- notNull: true;
98
- hasDefault: true;
99
- isPrimaryKey: false;
100
- isAutoincrement: false;
101
- hasRuntimeDefault: false;
102
- enumValues: undefined;
103
- baseColumn: never;
104
- identity: undefined;
105
- generated: undefined;
106
- }, {}, {}>;
107
- };
108
- dialect: "pg";
109
- }>;
@@ -1,15 +0,0 @@
1
- import { pgTable, text, timestamp, unique } from "drizzle-orm/pg-core";
2
- import { agent } from "./agents.js";
3
- import { asset } from "./assets.js";
4
- export const agentAsset = pgTable("agent_asset", {
5
- id: text("id").primaryKey(),
6
- agentId: text("agent_id")
7
- .notNull()
8
- .references(() => agent.id, { onDelete: "cascade" }),
9
- assetId: text("asset_id")
10
- .notNull()
11
- .references(() => asset.id, { onDelete: "cascade" }),
12
- ref: text("ref").notNull(),
13
- accessMode: text("access_mode").notNull().default("read-only"),
14
- createdAt: timestamp("created_at").notNull().defaultNow(),
15
- }, (t) => [unique("agent_asset_agent_asset").on(t.agentId, t.assetId)]);
@@ -1,57 +0,0 @@
1
- import { jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
2
- import { principal } from "./principals.js";
3
- import { tenant } from "./tenants.js";
4
- export const agent = pgTable("agent", {
5
- id: text("id").primaryKey(),
6
- tenantId: text("tenant_id")
7
- .notNull()
8
- .references(() => tenant.id, { onDelete: "cascade" }),
9
- // Tracks the definition author's principal for resolving source:"creator"
10
- // grant requirements at launch. See AUTH.md § Grant Requirements on Definitions.
11
- creatorPrincipalId: text("creator_principal_id")
12
- .notNull()
13
- .references(() => principal.id),
14
- name: text("name").notNull(),
15
- description: text("description"),
16
- systemPrompt: text("system_prompt"),
17
- contextConfig: jsonb("context_config"),
18
- initialState: jsonb("initial_state"),
19
- modelConfig: jsonb("model_config"),
20
- capabilities: jsonb("capabilities"),
21
- credentialRequirements: jsonb("credential_requirements"),
22
- // Model needs declared by canonical name with per-model provider
23
- // preferences, validated as ModelRequirements at parse time. The control
24
- // plane resolves these against the tenant catalog at launch to build the
25
- // ordered inference sources; credentialRequirements covers only
26
- // tool/integration credentials, not inference.
27
- modelRequirements: jsonb("model_requirements"),
28
- // Pinned tool packages, validated as ToolPackagePin[] at parse time.
29
- // Empty array (the default) means the agent has no NPM-distributed
30
- // tool packages wired to it; the loader receives an empty closure
31
- // and produces no tool factories for this agent.
32
- toolPackages: jsonb("tool_packages").notNull().default([]),
33
- // Grant requirements manifest — resolved at launch into materialized grants
34
- // on the instance principal. See AUTH.md § Grant Requirements on Definitions.
35
- grantRequirements: jsonb("grant_requirements"),
36
- currentVersion: text("current_version").notNull().default("1"),
37
- status: text("status", {
38
- enum: ["deployed", "stopped"],
39
- })
40
- .notNull()
41
- .default("deployed"),
42
- createdAt: timestamp("created_at").notNull().defaultNow(),
43
- updatedAt: timestamp("updated_at").notNull().defaultNow(),
44
- });
45
- export const agentVersion = pgTable("agent_version", {
46
- id: text("id").primaryKey(),
47
- agentId: text("agent_id")
48
- .notNull()
49
- .references(() => agent.id, { onDelete: "cascade" }),
50
- version: text("version").notNull(),
51
- status: text("status", {
52
- enum: ["active", "inactive", "failed"],
53
- })
54
- .notNull()
55
- .default("active"),
56
- createdAt: timestamp("created_at").notNull().defaultNow(),
57
- });
@@ -1,39 +0,0 @@
1
- import { jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
2
- import { agent, agentVersion } from "./agents.js";
3
- import { agentSession } from "./sessions.js";
4
- import { principal } from "./principals.js";
5
- import { sidecar } from "./sidecar.js";
6
- import { tenant } from "./tenants.js";
7
- export const agentInstance = pgTable("agent_instance", {
8
- id: text("id").primaryKey(),
9
- agentId: text("agent_id")
10
- .notNull()
11
- .references(() => agent.id, { onDelete: "cascade" }),
12
- tenantId: text("tenant_id")
13
- .notNull()
14
- .references(() => tenant.id, { onDelete: "cascade" }),
15
- principalId: text("principal_id")
16
- .notNull()
17
- .references(() => principal.id),
18
- address: text("address").notNull().unique(),
19
- versionId: text("version_id").references(() => agentVersion.id),
20
- sessionId: text("session_id").references(() => agentSession.id),
21
- status: text("status", {
22
- enum: ["deployed", "running", "updating", "error", "stopped"],
23
- })
24
- .notNull()
25
- .default("deployed"),
26
- sidecarId: text("sidecar_id").references(() => sidecar.id, {
27
- onDelete: "set null",
28
- }),
29
- publicKey: text("public_key"),
30
- kernelId: text("kernel_id"),
31
- // The invoker's launch-time per-model provider preferences, validated as
32
- // InvokerModelPreferences at parse time. Persisted here so re-resolving an
33
- // instance's sources (on credential rotation or sidecar reconnect) reuses
34
- // the invoker's reorder/restrict, not just the definition's preferences.
35
- modelPreferences: jsonb("model_preferences"),
36
- createdAt: timestamp("created_at").notNull().defaultNow(),
37
- updatedAt: timestamp("updated_at").notNull().defaultNow(),
38
- endedAt: timestamp("ended_at"),
39
- });
@@ -1,37 +0,0 @@
1
- import { index, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
2
- import { asset } from "./assets.js";
3
- import { tenant } from "./tenants.js";
4
- export const workflowDeployment = pgTable("workflow_deployment", {
5
- id: text("id").primaryKey(),
6
- tenantId: text("tenant_id")
7
- .notNull()
8
- .references(() => tenant.id, { onDelete: "cascade" }),
9
- definitionAssetId: text("definition_asset_id")
10
- .notNull()
11
- .references(() => asset.id, { onDelete: "cascade" }),
12
- // The deployment's routable address (`ins_<id>@<domain>`), stored rather
13
- // than re-derived at read time so the reconnect ownership challenge can
14
- // look up the deployment's public key by address, symmetrically with the
15
- // `agent_instance` path. Unique so a double-insert fails loud.
16
- //
17
- // Added NOT NULL with no default and no backfill. Like the repo's other
18
- // such adds (e.g. `credential.provider_id`), the migration relies on the
19
- // table being empty when it runs: this table and the `address` column
20
- // land one migration apart, both unreleased, so no populated row predates
21
- // the column and none needs a backfilled address.
22
- address: text("address").notNull(),
23
- // The Ed25519 public key the sidecar minted for this deployment address,
24
- // persisted at deploy-ack. Nullable by design: the row is written at
25
- // deploy-start and the key arrives at ack, so a not-yet-acked deployment
26
- // reads `null` and its reconnect challenge fails closed -- the address
27
- // stays unrouted rather than routing without ownership proof.
28
- publicKey: text("public_key"),
29
- status: text("status")
30
- .$type()
31
- .notNull()
32
- .default("deployed"),
33
- createdAt: timestamp("created_at").notNull().defaultNow(),
34
- }, (t) => [
35
- index("workflow_deployment_tenant_idx").on(t.tenantId, t.createdAt),
36
- uniqueIndex("workflow_deployment_address_idx").on(t.address),
37
- ]);