@intx/db 0.1.2

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 (91) hide show
  1. package/README.md +37 -0
  2. package/drizzle.config.ts +23 -0
  3. package/migrations/.gitkeep +0 -0
  4. package/migrations/0000_brown_wither.sql +50 -0
  5. package/migrations/0001_white_aqueduct.sql +105 -0
  6. package/migrations/0002_clever_falcon.sql +56 -0
  7. package/migrations/0003_stiff_tyrannus.sql +44 -0
  8. package/migrations/0004_rename_capability_to_offering.sql +1 -0
  9. package/migrations/0005_gigantic_cardiac.sql +1 -0
  10. package/migrations/0006_sidecar.sql +8 -0
  11. package/migrations/0007_agent_running_session.sql +1 -0
  12. package/migrations/0008_session.sql +10 -0
  13. package/migrations/0009_session_messages.sql +18 -0
  14. package/migrations/0010_agent_sidecar_pubkey.sql +2 -0
  15. package/migrations/0011_session_message_from.sql +2 -0
  16. package/migrations/0012_agent_instance.sql +22 -0
  17. package/migrations/0013_instance_session_id.sql +2 -0
  18. package/migrations/0014_drop_agent_runtime_columns.sql +12 -0
  19. package/migrations/0015_add_instance_id_to_session_message.sql +2 -0
  20. package/migrations/0016_jazzy_gamma_corps.sql +3 -0
  21. package/migrations/0017_hesitant_marvex.sql +1 -0
  22. package/migrations/0018_natural_sinister_six.sql +5 -0
  23. package/migrations/0019_rename_grant_source_to_origin.sql +1 -0
  24. package/migrations/0020_add_agent_role.sql +9 -0
  25. package/migrations/0021_acoustic_ozymandias.sql +15 -0
  26. package/migrations/0022_material_sleepwalker.sql +27 -0
  27. package/migrations/0023_flawless_scarlet_witch.sql +2 -0
  28. package/migrations/0024_bumpy_sharon_ventura.sql +1 -0
  29. package/migrations/0025_curvy_firestar.sql +26 -0
  30. package/migrations/0026_keen_ultimo.sql +13 -0
  31. package/migrations/0027_git_tokens.sql +21 -0
  32. package/migrations/0028_wet_sugar_man.sql +1 -0
  33. package/migrations/meta/0000_snapshot.json +316 -0
  34. package/migrations/meta/0001_snapshot.json +968 -0
  35. package/migrations/meta/0002_snapshot.json +1315 -0
  36. package/migrations/meta/0003_snapshot.json +1594 -0
  37. package/migrations/meta/0004_snapshot.json +1594 -0
  38. package/migrations/meta/0005_snapshot.json +1600 -0
  39. package/migrations/meta/0011_snapshot.json +1921 -0
  40. package/migrations/meta/0012_snapshot.json +2067 -0
  41. package/migrations/meta/0013_snapshot.json +2082 -0
  42. package/migrations/meta/0014_snapshot.json +2049 -0
  43. package/migrations/meta/0015_snapshot.json +2064 -0
  44. package/migrations/meta/0016_snapshot.json +2085 -0
  45. package/migrations/meta/0017_snapshot.json +2085 -0
  46. package/migrations/meta/0018_snapshot.json +2070 -0
  47. package/migrations/meta/0019_snapshot.json +2070 -0
  48. package/migrations/meta/0020_snapshot.json +2126 -0
  49. package/migrations/meta/0021_snapshot.json +2239 -0
  50. package/migrations/meta/0022_snapshot.json +2425 -0
  51. package/migrations/meta/0023_snapshot.json +2260 -0
  52. package/migrations/meta/0024_snapshot.json +2254 -0
  53. package/migrations/meta/0025_snapshot.json +2418 -0
  54. package/migrations/meta/0026_snapshot.json +2508 -0
  55. package/migrations/meta/0027_snapshot.json +2657 -0
  56. package/migrations/meta/0028_snapshot.json +2657 -0
  57. package/migrations/meta/_journal.json +209 -0
  58. package/package.json +27 -0
  59. package/src/client.ts +24 -0
  60. package/src/config.ts +19 -0
  61. package/src/connection.ts +27 -0
  62. package/src/credential-resolution.ts +378 -0
  63. package/src/grant-store.ts +51 -0
  64. package/src/index.ts +32 -0
  65. package/src/migrate.test.ts +35 -0
  66. package/src/migrate.ts +168 -0
  67. package/src/parse-row.test.ts +113 -0
  68. package/src/parse-row.ts +185 -0
  69. package/src/schema/agent-assets.ts +21 -0
  70. package/src/schema/agents.ts +49 -0
  71. package/src/schema/assets.ts +24 -0
  72. package/src/schema/auth.ts +51 -0
  73. package/src/schema/credentials.ts +43 -0
  74. package/src/schema/git-tokens.ts +83 -0
  75. package/src/schema/grants.ts +26 -0
  76. package/src/schema/index.ts +19 -0
  77. package/src/schema/instances.ts +36 -0
  78. package/src/schema/messages.ts +108 -0
  79. package/src/schema/oauth-clients.ts +26 -0
  80. package/src/schema/offerings.ts +20 -0
  81. package/src/schema/principals.ts +28 -0
  82. package/src/schema/providers.ts +23 -0
  83. package/src/schema/roles.ts +51 -0
  84. package/src/schema/session-assets.ts +49 -0
  85. package/src/schema/sessions.ts +26 -0
  86. package/src/schema/sidecar.ts +14 -0
  87. package/src/schema/tenants.ts +41 -0
  88. package/src/schema/wallets.ts +44 -0
  89. package/src/tenant-hierarchy.ts +34 -0
  90. package/tsconfig.json +4 -0
  91. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,2070 @@
1
+ {
2
+ "id": "87cf217b-7a74-43a1-b829-9c2751f0edc8",
3
+ "prevId": "f07f6e70-f938-481f-9ff5-b67dbc89aee4",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.account": {
8
+ "name": "account",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "user_id": {
18
+ "name": "user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "account_id": {
24
+ "name": "account_id",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "provider_id": {
30
+ "name": "provider_id",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "access_token": {
36
+ "name": "access_token",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": false
40
+ },
41
+ "refresh_token": {
42
+ "name": "refresh_token",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": false
46
+ },
47
+ "access_token_expires_at": {
48
+ "name": "access_token_expires_at",
49
+ "type": "timestamp",
50
+ "primaryKey": false,
51
+ "notNull": false
52
+ },
53
+ "refresh_token_expires_at": {
54
+ "name": "refresh_token_expires_at",
55
+ "type": "timestamp",
56
+ "primaryKey": false,
57
+ "notNull": false
58
+ },
59
+ "scope": {
60
+ "name": "scope",
61
+ "type": "text",
62
+ "primaryKey": false,
63
+ "notNull": false
64
+ },
65
+ "id_token": {
66
+ "name": "id_token",
67
+ "type": "text",
68
+ "primaryKey": false,
69
+ "notNull": false
70
+ },
71
+ "password": {
72
+ "name": "password",
73
+ "type": "text",
74
+ "primaryKey": false,
75
+ "notNull": false
76
+ },
77
+ "created_at": {
78
+ "name": "created_at",
79
+ "type": "timestamp",
80
+ "primaryKey": false,
81
+ "notNull": true,
82
+ "default": "now()"
83
+ },
84
+ "updated_at": {
85
+ "name": "updated_at",
86
+ "type": "timestamp",
87
+ "primaryKey": false,
88
+ "notNull": true,
89
+ "default": "now()"
90
+ }
91
+ },
92
+ "indexes": {},
93
+ "foreignKeys": {
94
+ "account_user_id_user_id_fk": {
95
+ "name": "account_user_id_user_id_fk",
96
+ "tableFrom": "account",
97
+ "tableTo": "user",
98
+ "columnsFrom": ["user_id"],
99
+ "columnsTo": ["id"],
100
+ "onDelete": "cascade",
101
+ "onUpdate": "no action"
102
+ }
103
+ },
104
+ "compositePrimaryKeys": {},
105
+ "uniqueConstraints": {},
106
+ "policies": {},
107
+ "checkConstraints": {},
108
+ "isRLSEnabled": false
109
+ },
110
+ "public.session": {
111
+ "name": "session",
112
+ "schema": "",
113
+ "columns": {
114
+ "id": {
115
+ "name": "id",
116
+ "type": "text",
117
+ "primaryKey": true,
118
+ "notNull": true
119
+ },
120
+ "user_id": {
121
+ "name": "user_id",
122
+ "type": "text",
123
+ "primaryKey": false,
124
+ "notNull": true
125
+ },
126
+ "token": {
127
+ "name": "token",
128
+ "type": "text",
129
+ "primaryKey": false,
130
+ "notNull": true
131
+ },
132
+ "expires_at": {
133
+ "name": "expires_at",
134
+ "type": "timestamp",
135
+ "primaryKey": false,
136
+ "notNull": true
137
+ },
138
+ "ip_address": {
139
+ "name": "ip_address",
140
+ "type": "text",
141
+ "primaryKey": false,
142
+ "notNull": false
143
+ },
144
+ "user_agent": {
145
+ "name": "user_agent",
146
+ "type": "text",
147
+ "primaryKey": false,
148
+ "notNull": false
149
+ },
150
+ "created_at": {
151
+ "name": "created_at",
152
+ "type": "timestamp",
153
+ "primaryKey": false,
154
+ "notNull": true,
155
+ "default": "now()"
156
+ },
157
+ "updated_at": {
158
+ "name": "updated_at",
159
+ "type": "timestamp",
160
+ "primaryKey": false,
161
+ "notNull": true,
162
+ "default": "now()"
163
+ }
164
+ },
165
+ "indexes": {},
166
+ "foreignKeys": {
167
+ "session_user_id_user_id_fk": {
168
+ "name": "session_user_id_user_id_fk",
169
+ "tableFrom": "session",
170
+ "tableTo": "user",
171
+ "columnsFrom": ["user_id"],
172
+ "columnsTo": ["id"],
173
+ "onDelete": "cascade",
174
+ "onUpdate": "no action"
175
+ }
176
+ },
177
+ "compositePrimaryKeys": {},
178
+ "uniqueConstraints": {
179
+ "session_token_unique": {
180
+ "name": "session_token_unique",
181
+ "nullsNotDistinct": false,
182
+ "columns": ["token"]
183
+ }
184
+ },
185
+ "policies": {},
186
+ "checkConstraints": {},
187
+ "isRLSEnabled": false
188
+ },
189
+ "public.user": {
190
+ "name": "user",
191
+ "schema": "",
192
+ "columns": {
193
+ "id": {
194
+ "name": "id",
195
+ "type": "text",
196
+ "primaryKey": true,
197
+ "notNull": true
198
+ },
199
+ "name": {
200
+ "name": "name",
201
+ "type": "text",
202
+ "primaryKey": false,
203
+ "notNull": true
204
+ },
205
+ "email": {
206
+ "name": "email",
207
+ "type": "text",
208
+ "primaryKey": false,
209
+ "notNull": true
210
+ },
211
+ "email_verified": {
212
+ "name": "email_verified",
213
+ "type": "boolean",
214
+ "primaryKey": false,
215
+ "notNull": true,
216
+ "default": false
217
+ },
218
+ "image": {
219
+ "name": "image",
220
+ "type": "text",
221
+ "primaryKey": false,
222
+ "notNull": false
223
+ },
224
+ "created_at": {
225
+ "name": "created_at",
226
+ "type": "timestamp",
227
+ "primaryKey": false,
228
+ "notNull": true,
229
+ "default": "now()"
230
+ },
231
+ "updated_at": {
232
+ "name": "updated_at",
233
+ "type": "timestamp",
234
+ "primaryKey": false,
235
+ "notNull": true,
236
+ "default": "now()"
237
+ }
238
+ },
239
+ "indexes": {},
240
+ "foreignKeys": {},
241
+ "compositePrimaryKeys": {},
242
+ "uniqueConstraints": {
243
+ "user_email_unique": {
244
+ "name": "user_email_unique",
245
+ "nullsNotDistinct": false,
246
+ "columns": ["email"]
247
+ }
248
+ },
249
+ "policies": {},
250
+ "checkConstraints": {},
251
+ "isRLSEnabled": false
252
+ },
253
+ "public.verification": {
254
+ "name": "verification",
255
+ "schema": "",
256
+ "columns": {
257
+ "id": {
258
+ "name": "id",
259
+ "type": "text",
260
+ "primaryKey": true,
261
+ "notNull": true
262
+ },
263
+ "identifier": {
264
+ "name": "identifier",
265
+ "type": "text",
266
+ "primaryKey": false,
267
+ "notNull": true
268
+ },
269
+ "value": {
270
+ "name": "value",
271
+ "type": "text",
272
+ "primaryKey": false,
273
+ "notNull": true
274
+ },
275
+ "expires_at": {
276
+ "name": "expires_at",
277
+ "type": "timestamp",
278
+ "primaryKey": false,
279
+ "notNull": true
280
+ },
281
+ "created_at": {
282
+ "name": "created_at",
283
+ "type": "timestamp",
284
+ "primaryKey": false,
285
+ "notNull": true,
286
+ "default": "now()"
287
+ },
288
+ "updated_at": {
289
+ "name": "updated_at",
290
+ "type": "timestamp",
291
+ "primaryKey": false,
292
+ "notNull": true,
293
+ "default": "now()"
294
+ }
295
+ },
296
+ "indexes": {},
297
+ "foreignKeys": {},
298
+ "compositePrimaryKeys": {},
299
+ "uniqueConstraints": {},
300
+ "policies": {},
301
+ "checkConstraints": {},
302
+ "isRLSEnabled": false
303
+ },
304
+ "public.federation_trust": {
305
+ "name": "federation_trust",
306
+ "schema": "",
307
+ "columns": {
308
+ "id": {
309
+ "name": "id",
310
+ "type": "text",
311
+ "primaryKey": true,
312
+ "notNull": true
313
+ },
314
+ "tenant_id": {
315
+ "name": "tenant_id",
316
+ "type": "text",
317
+ "primaryKey": false,
318
+ "notNull": true
319
+ },
320
+ "target_tenant_id": {
321
+ "name": "target_tenant_id",
322
+ "type": "text",
323
+ "primaryKey": false,
324
+ "notNull": true
325
+ },
326
+ "direction": {
327
+ "name": "direction",
328
+ "type": "text",
329
+ "primaryKey": false,
330
+ "notNull": true
331
+ },
332
+ "created_at": {
333
+ "name": "created_at",
334
+ "type": "timestamp",
335
+ "primaryKey": false,
336
+ "notNull": true,
337
+ "default": "now()"
338
+ }
339
+ },
340
+ "indexes": {},
341
+ "foreignKeys": {
342
+ "federation_trust_tenant_id_tenant_id_fk": {
343
+ "name": "federation_trust_tenant_id_tenant_id_fk",
344
+ "tableFrom": "federation_trust",
345
+ "tableTo": "tenant",
346
+ "columnsFrom": ["tenant_id"],
347
+ "columnsTo": ["id"],
348
+ "onDelete": "cascade",
349
+ "onUpdate": "no action"
350
+ },
351
+ "federation_trust_target_tenant_id_tenant_id_fk": {
352
+ "name": "federation_trust_target_tenant_id_tenant_id_fk",
353
+ "tableFrom": "federation_trust",
354
+ "tableTo": "tenant",
355
+ "columnsFrom": ["target_tenant_id"],
356
+ "columnsTo": ["id"],
357
+ "onDelete": "cascade",
358
+ "onUpdate": "no action"
359
+ }
360
+ },
361
+ "compositePrimaryKeys": {},
362
+ "uniqueConstraints": {
363
+ "federation_trust_tenant_id_target_tenant_id_unique": {
364
+ "name": "federation_trust_tenant_id_target_tenant_id_unique",
365
+ "nullsNotDistinct": false,
366
+ "columns": ["tenant_id", "target_tenant_id"]
367
+ }
368
+ },
369
+ "policies": {},
370
+ "checkConstraints": {},
371
+ "isRLSEnabled": false
372
+ },
373
+ "public.tenant": {
374
+ "name": "tenant",
375
+ "schema": "",
376
+ "columns": {
377
+ "id": {
378
+ "name": "id",
379
+ "type": "text",
380
+ "primaryKey": true,
381
+ "notNull": true
382
+ },
383
+ "name": {
384
+ "name": "name",
385
+ "type": "text",
386
+ "primaryKey": false,
387
+ "notNull": true
388
+ },
389
+ "slug": {
390
+ "name": "slug",
391
+ "type": "text",
392
+ "primaryKey": false,
393
+ "notNull": true
394
+ },
395
+ "domain": {
396
+ "name": "domain",
397
+ "type": "text",
398
+ "primaryKey": false,
399
+ "notNull": true
400
+ },
401
+ "parent_id": {
402
+ "name": "parent_id",
403
+ "type": "text",
404
+ "primaryKey": false,
405
+ "notNull": false
406
+ },
407
+ "config": {
408
+ "name": "config",
409
+ "type": "jsonb",
410
+ "primaryKey": false,
411
+ "notNull": false
412
+ },
413
+ "created_at": {
414
+ "name": "created_at",
415
+ "type": "timestamp",
416
+ "primaryKey": false,
417
+ "notNull": true,
418
+ "default": "now()"
419
+ },
420
+ "updated_at": {
421
+ "name": "updated_at",
422
+ "type": "timestamp",
423
+ "primaryKey": false,
424
+ "notNull": true,
425
+ "default": "now()"
426
+ }
427
+ },
428
+ "indexes": {},
429
+ "foreignKeys": {
430
+ "tenant_parent_id_tenant_id_fk": {
431
+ "name": "tenant_parent_id_tenant_id_fk",
432
+ "tableFrom": "tenant",
433
+ "tableTo": "tenant",
434
+ "columnsFrom": ["parent_id"],
435
+ "columnsTo": ["id"],
436
+ "onDelete": "no action",
437
+ "onUpdate": "no action"
438
+ }
439
+ },
440
+ "compositePrimaryKeys": {},
441
+ "uniqueConstraints": {
442
+ "tenant_slug_unique": {
443
+ "name": "tenant_slug_unique",
444
+ "nullsNotDistinct": false,
445
+ "columns": ["slug"]
446
+ },
447
+ "tenant_domain_unique": {
448
+ "name": "tenant_domain_unique",
449
+ "nullsNotDistinct": false,
450
+ "columns": ["domain"]
451
+ }
452
+ },
453
+ "policies": {},
454
+ "checkConstraints": {},
455
+ "isRLSEnabled": false
456
+ },
457
+ "public.principal": {
458
+ "name": "principal",
459
+ "schema": "",
460
+ "columns": {
461
+ "id": {
462
+ "name": "id",
463
+ "type": "text",
464
+ "primaryKey": true,
465
+ "notNull": true
466
+ },
467
+ "tenant_id": {
468
+ "name": "tenant_id",
469
+ "type": "text",
470
+ "primaryKey": false,
471
+ "notNull": true
472
+ },
473
+ "kind": {
474
+ "name": "kind",
475
+ "type": "text",
476
+ "primaryKey": false,
477
+ "notNull": true
478
+ },
479
+ "ref_id": {
480
+ "name": "ref_id",
481
+ "type": "text",
482
+ "primaryKey": false,
483
+ "notNull": true
484
+ },
485
+ "status": {
486
+ "name": "status",
487
+ "type": "text",
488
+ "primaryKey": false,
489
+ "notNull": true
490
+ },
491
+ "created_at": {
492
+ "name": "created_at",
493
+ "type": "timestamp",
494
+ "primaryKey": false,
495
+ "notNull": true,
496
+ "default": "now()"
497
+ },
498
+ "updated_at": {
499
+ "name": "updated_at",
500
+ "type": "timestamp",
501
+ "primaryKey": false,
502
+ "notNull": true,
503
+ "default": "now()"
504
+ }
505
+ },
506
+ "indexes": {},
507
+ "foreignKeys": {
508
+ "principal_tenant_id_tenant_id_fk": {
509
+ "name": "principal_tenant_id_tenant_id_fk",
510
+ "tableFrom": "principal",
511
+ "tableTo": "tenant",
512
+ "columnsFrom": ["tenant_id"],
513
+ "columnsTo": ["id"],
514
+ "onDelete": "cascade",
515
+ "onUpdate": "no action"
516
+ }
517
+ },
518
+ "compositePrimaryKeys": {},
519
+ "uniqueConstraints": {
520
+ "principal_tenant_id_kind_ref_id_unique": {
521
+ "name": "principal_tenant_id_kind_ref_id_unique",
522
+ "nullsNotDistinct": false,
523
+ "columns": ["tenant_id", "kind", "ref_id"]
524
+ }
525
+ },
526
+ "policies": {},
527
+ "checkConstraints": {},
528
+ "isRLSEnabled": false
529
+ },
530
+ "public.principal_role": {
531
+ "name": "principal_role",
532
+ "schema": "",
533
+ "columns": {
534
+ "principal_id": {
535
+ "name": "principal_id",
536
+ "type": "text",
537
+ "primaryKey": false,
538
+ "notNull": true
539
+ },
540
+ "role_id": {
541
+ "name": "role_id",
542
+ "type": "text",
543
+ "primaryKey": false,
544
+ "notNull": true
545
+ },
546
+ "created_at": {
547
+ "name": "created_at",
548
+ "type": "timestamp",
549
+ "primaryKey": false,
550
+ "notNull": true,
551
+ "default": "now()"
552
+ }
553
+ },
554
+ "indexes": {},
555
+ "foreignKeys": {
556
+ "principal_role_principal_id_principal_id_fk": {
557
+ "name": "principal_role_principal_id_principal_id_fk",
558
+ "tableFrom": "principal_role",
559
+ "tableTo": "principal",
560
+ "columnsFrom": ["principal_id"],
561
+ "columnsTo": ["id"],
562
+ "onDelete": "cascade",
563
+ "onUpdate": "no action"
564
+ },
565
+ "principal_role_role_id_role_id_fk": {
566
+ "name": "principal_role_role_id_role_id_fk",
567
+ "tableFrom": "principal_role",
568
+ "tableTo": "role",
569
+ "columnsFrom": ["role_id"],
570
+ "columnsTo": ["id"],
571
+ "onDelete": "cascade",
572
+ "onUpdate": "no action"
573
+ }
574
+ },
575
+ "compositePrimaryKeys": {
576
+ "principal_role_principal_id_role_id_pk": {
577
+ "name": "principal_role_principal_id_role_id_pk",
578
+ "columns": ["principal_id", "role_id"]
579
+ }
580
+ },
581
+ "uniqueConstraints": {},
582
+ "policies": {},
583
+ "checkConstraints": {},
584
+ "isRLSEnabled": false
585
+ },
586
+ "public.role": {
587
+ "name": "role",
588
+ "schema": "",
589
+ "columns": {
590
+ "id": {
591
+ "name": "id",
592
+ "type": "text",
593
+ "primaryKey": true,
594
+ "notNull": true
595
+ },
596
+ "tenant_id": {
597
+ "name": "tenant_id",
598
+ "type": "text",
599
+ "primaryKey": false,
600
+ "notNull": true
601
+ },
602
+ "name": {
603
+ "name": "name",
604
+ "type": "text",
605
+ "primaryKey": false,
606
+ "notNull": true
607
+ },
608
+ "description": {
609
+ "name": "description",
610
+ "type": "text",
611
+ "primaryKey": false,
612
+ "notNull": false
613
+ },
614
+ "is_system": {
615
+ "name": "is_system",
616
+ "type": "boolean",
617
+ "primaryKey": false,
618
+ "notNull": true,
619
+ "default": false
620
+ },
621
+ "created_at": {
622
+ "name": "created_at",
623
+ "type": "timestamp",
624
+ "primaryKey": false,
625
+ "notNull": true,
626
+ "default": "now()"
627
+ },
628
+ "updated_at": {
629
+ "name": "updated_at",
630
+ "type": "timestamp",
631
+ "primaryKey": false,
632
+ "notNull": true,
633
+ "default": "now()"
634
+ }
635
+ },
636
+ "indexes": {},
637
+ "foreignKeys": {
638
+ "role_tenant_id_tenant_id_fk": {
639
+ "name": "role_tenant_id_tenant_id_fk",
640
+ "tableFrom": "role",
641
+ "tableTo": "tenant",
642
+ "columnsFrom": ["tenant_id"],
643
+ "columnsTo": ["id"],
644
+ "onDelete": "cascade",
645
+ "onUpdate": "no action"
646
+ }
647
+ },
648
+ "compositePrimaryKeys": {},
649
+ "uniqueConstraints": {},
650
+ "policies": {},
651
+ "checkConstraints": {},
652
+ "isRLSEnabled": false
653
+ },
654
+ "public.grant": {
655
+ "name": "grant",
656
+ "schema": "",
657
+ "columns": {
658
+ "id": {
659
+ "name": "id",
660
+ "type": "text",
661
+ "primaryKey": true,
662
+ "notNull": true
663
+ },
664
+ "tenant_id": {
665
+ "name": "tenant_id",
666
+ "type": "text",
667
+ "primaryKey": false,
668
+ "notNull": true
669
+ },
670
+ "role_id": {
671
+ "name": "role_id",
672
+ "type": "text",
673
+ "primaryKey": false,
674
+ "notNull": false
675
+ },
676
+ "principal_id": {
677
+ "name": "principal_id",
678
+ "type": "text",
679
+ "primaryKey": false,
680
+ "notNull": false
681
+ },
682
+ "resource": {
683
+ "name": "resource",
684
+ "type": "text",
685
+ "primaryKey": false,
686
+ "notNull": true
687
+ },
688
+ "action": {
689
+ "name": "action",
690
+ "type": "text",
691
+ "primaryKey": false,
692
+ "notNull": true
693
+ },
694
+ "effect": {
695
+ "name": "effect",
696
+ "type": "text",
697
+ "primaryKey": false,
698
+ "notNull": true
699
+ },
700
+ "conditions": {
701
+ "name": "conditions",
702
+ "type": "jsonb",
703
+ "primaryKey": false,
704
+ "notNull": false
705
+ },
706
+ "origin": {
707
+ "name": "origin",
708
+ "type": "text",
709
+ "primaryKey": false,
710
+ "notNull": true
711
+ },
712
+ "expires_at": {
713
+ "name": "expires_at",
714
+ "type": "timestamp",
715
+ "primaryKey": false,
716
+ "notNull": false
717
+ },
718
+ "created_at": {
719
+ "name": "created_at",
720
+ "type": "timestamp",
721
+ "primaryKey": false,
722
+ "notNull": true,
723
+ "default": "now()"
724
+ },
725
+ "updated_at": {
726
+ "name": "updated_at",
727
+ "type": "timestamp",
728
+ "primaryKey": false,
729
+ "notNull": true,
730
+ "default": "now()"
731
+ }
732
+ },
733
+ "indexes": {},
734
+ "foreignKeys": {
735
+ "grant_tenant_id_tenant_id_fk": {
736
+ "name": "grant_tenant_id_tenant_id_fk",
737
+ "tableFrom": "grant",
738
+ "tableTo": "tenant",
739
+ "columnsFrom": ["tenant_id"],
740
+ "columnsTo": ["id"],
741
+ "onDelete": "cascade",
742
+ "onUpdate": "no action"
743
+ },
744
+ "grant_role_id_role_id_fk": {
745
+ "name": "grant_role_id_role_id_fk",
746
+ "tableFrom": "grant",
747
+ "tableTo": "role",
748
+ "columnsFrom": ["role_id"],
749
+ "columnsTo": ["id"],
750
+ "onDelete": "cascade",
751
+ "onUpdate": "no action"
752
+ },
753
+ "grant_principal_id_principal_id_fk": {
754
+ "name": "grant_principal_id_principal_id_fk",
755
+ "tableFrom": "grant",
756
+ "tableTo": "principal",
757
+ "columnsFrom": ["principal_id"],
758
+ "columnsTo": ["id"],
759
+ "onDelete": "cascade",
760
+ "onUpdate": "no action"
761
+ }
762
+ },
763
+ "compositePrimaryKeys": {},
764
+ "uniqueConstraints": {},
765
+ "policies": {},
766
+ "checkConstraints": {},
767
+ "isRLSEnabled": false
768
+ },
769
+ "public.agent": {
770
+ "name": "agent",
771
+ "schema": "",
772
+ "columns": {
773
+ "id": {
774
+ "name": "id",
775
+ "type": "text",
776
+ "primaryKey": true,
777
+ "notNull": true
778
+ },
779
+ "tenant_id": {
780
+ "name": "tenant_id",
781
+ "type": "text",
782
+ "primaryKey": false,
783
+ "notNull": true
784
+ },
785
+ "creator_principal_id": {
786
+ "name": "creator_principal_id",
787
+ "type": "text",
788
+ "primaryKey": false,
789
+ "notNull": false
790
+ },
791
+ "name": {
792
+ "name": "name",
793
+ "type": "text",
794
+ "primaryKey": false,
795
+ "notNull": true
796
+ },
797
+ "description": {
798
+ "name": "description",
799
+ "type": "text",
800
+ "primaryKey": false,
801
+ "notNull": false
802
+ },
803
+ "system_prompt": {
804
+ "name": "system_prompt",
805
+ "type": "text",
806
+ "primaryKey": false,
807
+ "notNull": false
808
+ },
809
+ "skills": {
810
+ "name": "skills",
811
+ "type": "jsonb",
812
+ "primaryKey": false,
813
+ "notNull": false
814
+ },
815
+ "context_config": {
816
+ "name": "context_config",
817
+ "type": "jsonb",
818
+ "primaryKey": false,
819
+ "notNull": false
820
+ },
821
+ "initial_state": {
822
+ "name": "initial_state",
823
+ "type": "jsonb",
824
+ "primaryKey": false,
825
+ "notNull": false
826
+ },
827
+ "model_config": {
828
+ "name": "model_config",
829
+ "type": "jsonb",
830
+ "primaryKey": false,
831
+ "notNull": false
832
+ },
833
+ "capabilities": {
834
+ "name": "capabilities",
835
+ "type": "jsonb",
836
+ "primaryKey": false,
837
+ "notNull": false
838
+ },
839
+ "credential_requirements": {
840
+ "name": "credential_requirements",
841
+ "type": "jsonb",
842
+ "primaryKey": false,
843
+ "notNull": false
844
+ },
845
+ "grant_requirements": {
846
+ "name": "grant_requirements",
847
+ "type": "jsonb",
848
+ "primaryKey": false,
849
+ "notNull": false
850
+ },
851
+ "current_version": {
852
+ "name": "current_version",
853
+ "type": "text",
854
+ "primaryKey": false,
855
+ "notNull": true,
856
+ "default": "'1'"
857
+ },
858
+ "status": {
859
+ "name": "status",
860
+ "type": "text",
861
+ "primaryKey": false,
862
+ "notNull": true,
863
+ "default": "'deployed'"
864
+ },
865
+ "created_at": {
866
+ "name": "created_at",
867
+ "type": "timestamp",
868
+ "primaryKey": false,
869
+ "notNull": true,
870
+ "default": "now()"
871
+ },
872
+ "updated_at": {
873
+ "name": "updated_at",
874
+ "type": "timestamp",
875
+ "primaryKey": false,
876
+ "notNull": true,
877
+ "default": "now()"
878
+ }
879
+ },
880
+ "indexes": {},
881
+ "foreignKeys": {
882
+ "agent_tenant_id_tenant_id_fk": {
883
+ "name": "agent_tenant_id_tenant_id_fk",
884
+ "tableFrom": "agent",
885
+ "tableTo": "tenant",
886
+ "columnsFrom": ["tenant_id"],
887
+ "columnsTo": ["id"],
888
+ "onDelete": "cascade",
889
+ "onUpdate": "no action"
890
+ },
891
+ "agent_creator_principal_id_principal_id_fk": {
892
+ "name": "agent_creator_principal_id_principal_id_fk",
893
+ "tableFrom": "agent",
894
+ "tableTo": "principal",
895
+ "columnsFrom": ["creator_principal_id"],
896
+ "columnsTo": ["id"],
897
+ "onDelete": "no action",
898
+ "onUpdate": "no action"
899
+ }
900
+ },
901
+ "compositePrimaryKeys": {},
902
+ "uniqueConstraints": {},
903
+ "policies": {},
904
+ "checkConstraints": {},
905
+ "isRLSEnabled": false
906
+ },
907
+ "public.agent_version": {
908
+ "name": "agent_version",
909
+ "schema": "",
910
+ "columns": {
911
+ "id": {
912
+ "name": "id",
913
+ "type": "text",
914
+ "primaryKey": true,
915
+ "notNull": true
916
+ },
917
+ "agent_id": {
918
+ "name": "agent_id",
919
+ "type": "text",
920
+ "primaryKey": false,
921
+ "notNull": true
922
+ },
923
+ "version": {
924
+ "name": "version",
925
+ "type": "text",
926
+ "primaryKey": false,
927
+ "notNull": true
928
+ },
929
+ "status": {
930
+ "name": "status",
931
+ "type": "text",
932
+ "primaryKey": false,
933
+ "notNull": true,
934
+ "default": "'active'"
935
+ },
936
+ "created_at": {
937
+ "name": "created_at",
938
+ "type": "timestamp",
939
+ "primaryKey": false,
940
+ "notNull": true,
941
+ "default": "now()"
942
+ }
943
+ },
944
+ "indexes": {},
945
+ "foreignKeys": {
946
+ "agent_version_agent_id_agent_id_fk": {
947
+ "name": "agent_version_agent_id_agent_id_fk",
948
+ "tableFrom": "agent_version",
949
+ "tableTo": "agent",
950
+ "columnsFrom": ["agent_id"],
951
+ "columnsTo": ["id"],
952
+ "onDelete": "cascade",
953
+ "onUpdate": "no action"
954
+ }
955
+ },
956
+ "compositePrimaryKeys": {},
957
+ "uniqueConstraints": {},
958
+ "policies": {},
959
+ "checkConstraints": {},
960
+ "isRLSEnabled": false
961
+ },
962
+ "public.provider": {
963
+ "name": "provider",
964
+ "schema": "",
965
+ "columns": {
966
+ "id": {
967
+ "name": "id",
968
+ "type": "text",
969
+ "primaryKey": true,
970
+ "notNull": true
971
+ },
972
+ "tenant_id": {
973
+ "name": "tenant_id",
974
+ "type": "text",
975
+ "primaryKey": false,
976
+ "notNull": true
977
+ },
978
+ "name": {
979
+ "name": "name",
980
+ "type": "text",
981
+ "primaryKey": false,
982
+ "notNull": true
983
+ },
984
+ "plugin": {
985
+ "name": "plugin",
986
+ "type": "text",
987
+ "primaryKey": false,
988
+ "notNull": true
989
+ },
990
+ "authorization_url": {
991
+ "name": "authorization_url",
992
+ "type": "text",
993
+ "primaryKey": false,
994
+ "notNull": false
995
+ },
996
+ "token_url": {
997
+ "name": "token_url",
998
+ "type": "text",
999
+ "primaryKey": false,
1000
+ "notNull": false
1001
+ },
1002
+ "user_info_url": {
1003
+ "name": "user_info_url",
1004
+ "type": "text",
1005
+ "primaryKey": false,
1006
+ "notNull": false
1007
+ },
1008
+ "scopes": {
1009
+ "name": "scopes",
1010
+ "type": "text[]",
1011
+ "primaryKey": false,
1012
+ "notNull": false
1013
+ },
1014
+ "metadata": {
1015
+ "name": "metadata",
1016
+ "type": "jsonb",
1017
+ "primaryKey": false,
1018
+ "notNull": false
1019
+ },
1020
+ "created_at": {
1021
+ "name": "created_at",
1022
+ "type": "timestamp",
1023
+ "primaryKey": false,
1024
+ "notNull": true,
1025
+ "default": "now()"
1026
+ },
1027
+ "updated_at": {
1028
+ "name": "updated_at",
1029
+ "type": "timestamp",
1030
+ "primaryKey": false,
1031
+ "notNull": true,
1032
+ "default": "now()"
1033
+ }
1034
+ },
1035
+ "indexes": {},
1036
+ "foreignKeys": {
1037
+ "provider_tenant_id_tenant_id_fk": {
1038
+ "name": "provider_tenant_id_tenant_id_fk",
1039
+ "tableFrom": "provider",
1040
+ "tableTo": "tenant",
1041
+ "columnsFrom": ["tenant_id"],
1042
+ "columnsTo": ["id"],
1043
+ "onDelete": "cascade",
1044
+ "onUpdate": "no action"
1045
+ }
1046
+ },
1047
+ "compositePrimaryKeys": {},
1048
+ "uniqueConstraints": {
1049
+ "provider_tenant_name": {
1050
+ "name": "provider_tenant_name",
1051
+ "nullsNotDistinct": false,
1052
+ "columns": ["tenant_id", "name"]
1053
+ }
1054
+ },
1055
+ "policies": {},
1056
+ "checkConstraints": {},
1057
+ "isRLSEnabled": false
1058
+ },
1059
+ "public.oauth_client": {
1060
+ "name": "oauth_client",
1061
+ "schema": "",
1062
+ "columns": {
1063
+ "id": {
1064
+ "name": "id",
1065
+ "type": "text",
1066
+ "primaryKey": true,
1067
+ "notNull": true
1068
+ },
1069
+ "tenant_id": {
1070
+ "name": "tenant_id",
1071
+ "type": "text",
1072
+ "primaryKey": false,
1073
+ "notNull": true
1074
+ },
1075
+ "provider_id": {
1076
+ "name": "provider_id",
1077
+ "type": "text",
1078
+ "primaryKey": false,
1079
+ "notNull": true
1080
+ },
1081
+ "name": {
1082
+ "name": "name",
1083
+ "type": "text",
1084
+ "primaryKey": false,
1085
+ "notNull": true
1086
+ },
1087
+ "client_id": {
1088
+ "name": "client_id",
1089
+ "type": "text",
1090
+ "primaryKey": false,
1091
+ "notNull": true
1092
+ },
1093
+ "client_secret": {
1094
+ "name": "client_secret",
1095
+ "type": "text",
1096
+ "primaryKey": false,
1097
+ "notNull": true
1098
+ },
1099
+ "redirect_uris": {
1100
+ "name": "redirect_uris",
1101
+ "type": "text[]",
1102
+ "primaryKey": false,
1103
+ "notNull": false
1104
+ },
1105
+ "default_scopes": {
1106
+ "name": "default_scopes",
1107
+ "type": "text[]",
1108
+ "primaryKey": false,
1109
+ "notNull": false
1110
+ },
1111
+ "metadata": {
1112
+ "name": "metadata",
1113
+ "type": "jsonb",
1114
+ "primaryKey": false,
1115
+ "notNull": false
1116
+ },
1117
+ "created_at": {
1118
+ "name": "created_at",
1119
+ "type": "timestamp",
1120
+ "primaryKey": false,
1121
+ "notNull": true,
1122
+ "default": "now()"
1123
+ },
1124
+ "updated_at": {
1125
+ "name": "updated_at",
1126
+ "type": "timestamp",
1127
+ "primaryKey": false,
1128
+ "notNull": true,
1129
+ "default": "now()"
1130
+ }
1131
+ },
1132
+ "indexes": {},
1133
+ "foreignKeys": {
1134
+ "oauth_client_tenant_id_tenant_id_fk": {
1135
+ "name": "oauth_client_tenant_id_tenant_id_fk",
1136
+ "tableFrom": "oauth_client",
1137
+ "tableTo": "tenant",
1138
+ "columnsFrom": ["tenant_id"],
1139
+ "columnsTo": ["id"],
1140
+ "onDelete": "cascade",
1141
+ "onUpdate": "no action"
1142
+ },
1143
+ "oauth_client_provider_id_provider_id_fk": {
1144
+ "name": "oauth_client_provider_id_provider_id_fk",
1145
+ "tableFrom": "oauth_client",
1146
+ "tableTo": "provider",
1147
+ "columnsFrom": ["provider_id"],
1148
+ "columnsTo": ["id"],
1149
+ "onDelete": "cascade",
1150
+ "onUpdate": "no action"
1151
+ }
1152
+ },
1153
+ "compositePrimaryKeys": {},
1154
+ "uniqueConstraints": {
1155
+ "oauth_client_tenant_provider": {
1156
+ "name": "oauth_client_tenant_provider",
1157
+ "nullsNotDistinct": false,
1158
+ "columns": ["tenant_id", "provider_id"]
1159
+ }
1160
+ },
1161
+ "policies": {},
1162
+ "checkConstraints": {},
1163
+ "isRLSEnabled": false
1164
+ },
1165
+ "public.credential": {
1166
+ "name": "credential",
1167
+ "schema": "",
1168
+ "columns": {
1169
+ "id": {
1170
+ "name": "id",
1171
+ "type": "text",
1172
+ "primaryKey": true,
1173
+ "notNull": true
1174
+ },
1175
+ "tenant_id": {
1176
+ "name": "tenant_id",
1177
+ "type": "text",
1178
+ "primaryKey": false,
1179
+ "notNull": true
1180
+ },
1181
+ "principal_id": {
1182
+ "name": "principal_id",
1183
+ "type": "text",
1184
+ "primaryKey": false,
1185
+ "notNull": false
1186
+ },
1187
+ "provider_id": {
1188
+ "name": "provider_id",
1189
+ "type": "text",
1190
+ "primaryKey": false,
1191
+ "notNull": true
1192
+ },
1193
+ "oauth_client_id": {
1194
+ "name": "oauth_client_id",
1195
+ "type": "text",
1196
+ "primaryKey": false,
1197
+ "notNull": false
1198
+ },
1199
+ "name": {
1200
+ "name": "name",
1201
+ "type": "text",
1202
+ "primaryKey": false,
1203
+ "notNull": true
1204
+ },
1205
+ "type": {
1206
+ "name": "type",
1207
+ "type": "text",
1208
+ "primaryKey": false,
1209
+ "notNull": true
1210
+ },
1211
+ "description": {
1212
+ "name": "description",
1213
+ "type": "text",
1214
+ "primaryKey": false,
1215
+ "notNull": false
1216
+ },
1217
+ "secret": {
1218
+ "name": "secret",
1219
+ "type": "text",
1220
+ "primaryKey": false,
1221
+ "notNull": true
1222
+ },
1223
+ "refresh_secret": {
1224
+ "name": "refresh_secret",
1225
+ "type": "text",
1226
+ "primaryKey": false,
1227
+ "notNull": false
1228
+ },
1229
+ "scopes": {
1230
+ "name": "scopes",
1231
+ "type": "text[]",
1232
+ "primaryKey": false,
1233
+ "notNull": false
1234
+ },
1235
+ "expires_at": {
1236
+ "name": "expires_at",
1237
+ "type": "timestamp",
1238
+ "primaryKey": false,
1239
+ "notNull": false
1240
+ },
1241
+ "status": {
1242
+ "name": "status",
1243
+ "type": "text",
1244
+ "primaryKey": false,
1245
+ "notNull": true,
1246
+ "default": "'active'"
1247
+ },
1248
+ "metadata": {
1249
+ "name": "metadata",
1250
+ "type": "jsonb",
1251
+ "primaryKey": false,
1252
+ "notNull": false
1253
+ },
1254
+ "created_at": {
1255
+ "name": "created_at",
1256
+ "type": "timestamp",
1257
+ "primaryKey": false,
1258
+ "notNull": true,
1259
+ "default": "now()"
1260
+ },
1261
+ "updated_at": {
1262
+ "name": "updated_at",
1263
+ "type": "timestamp",
1264
+ "primaryKey": false,
1265
+ "notNull": true,
1266
+ "default": "now()"
1267
+ }
1268
+ },
1269
+ "indexes": {},
1270
+ "foreignKeys": {
1271
+ "credential_tenant_id_tenant_id_fk": {
1272
+ "name": "credential_tenant_id_tenant_id_fk",
1273
+ "tableFrom": "credential",
1274
+ "tableTo": "tenant",
1275
+ "columnsFrom": ["tenant_id"],
1276
+ "columnsTo": ["id"],
1277
+ "onDelete": "cascade",
1278
+ "onUpdate": "no action"
1279
+ },
1280
+ "credential_principal_id_principal_id_fk": {
1281
+ "name": "credential_principal_id_principal_id_fk",
1282
+ "tableFrom": "credential",
1283
+ "tableTo": "principal",
1284
+ "columnsFrom": ["principal_id"],
1285
+ "columnsTo": ["id"],
1286
+ "onDelete": "set null",
1287
+ "onUpdate": "no action"
1288
+ },
1289
+ "credential_provider_id_provider_id_fk": {
1290
+ "name": "credential_provider_id_provider_id_fk",
1291
+ "tableFrom": "credential",
1292
+ "tableTo": "provider",
1293
+ "columnsFrom": ["provider_id"],
1294
+ "columnsTo": ["id"],
1295
+ "onDelete": "cascade",
1296
+ "onUpdate": "no action"
1297
+ },
1298
+ "credential_oauth_client_id_oauth_client_id_fk": {
1299
+ "name": "credential_oauth_client_id_oauth_client_id_fk",
1300
+ "tableFrom": "credential",
1301
+ "tableTo": "oauth_client",
1302
+ "columnsFrom": ["oauth_client_id"],
1303
+ "columnsTo": ["id"],
1304
+ "onDelete": "set null",
1305
+ "onUpdate": "no action"
1306
+ }
1307
+ },
1308
+ "compositePrimaryKeys": {},
1309
+ "uniqueConstraints": {
1310
+ "credential_tenant_name": {
1311
+ "name": "credential_tenant_name",
1312
+ "nullsNotDistinct": false,
1313
+ "columns": ["tenant_id", "name"]
1314
+ }
1315
+ },
1316
+ "policies": {},
1317
+ "checkConstraints": {},
1318
+ "isRLSEnabled": false
1319
+ },
1320
+ "public.transaction": {
1321
+ "name": "transaction",
1322
+ "schema": "",
1323
+ "columns": {
1324
+ "id": {
1325
+ "name": "id",
1326
+ "type": "text",
1327
+ "primaryKey": true,
1328
+ "notNull": true
1329
+ },
1330
+ "wallet_id": {
1331
+ "name": "wallet_id",
1332
+ "type": "text",
1333
+ "primaryKey": false,
1334
+ "notNull": true
1335
+ },
1336
+ "agent_id": {
1337
+ "name": "agent_id",
1338
+ "type": "text",
1339
+ "primaryKey": false,
1340
+ "notNull": false
1341
+ },
1342
+ "direction": {
1343
+ "name": "direction",
1344
+ "type": "text",
1345
+ "primaryKey": false,
1346
+ "notNull": true
1347
+ },
1348
+ "amount": {
1349
+ "name": "amount",
1350
+ "type": "text",
1351
+ "primaryKey": false,
1352
+ "notNull": true
1353
+ },
1354
+ "currency": {
1355
+ "name": "currency",
1356
+ "type": "text",
1357
+ "primaryKey": false,
1358
+ "notNull": true
1359
+ },
1360
+ "recipient_id": {
1361
+ "name": "recipient_id",
1362
+ "type": "text",
1363
+ "primaryKey": false,
1364
+ "notNull": false
1365
+ },
1366
+ "sender_id": {
1367
+ "name": "sender_id",
1368
+ "type": "text",
1369
+ "primaryKey": false,
1370
+ "notNull": false
1371
+ },
1372
+ "request_id": {
1373
+ "name": "request_id",
1374
+ "type": "text",
1375
+ "primaryKey": false,
1376
+ "notNull": false
1377
+ },
1378
+ "status": {
1379
+ "name": "status",
1380
+ "type": "text",
1381
+ "primaryKey": false,
1382
+ "notNull": true,
1383
+ "default": "'pending'"
1384
+ },
1385
+ "created_at": {
1386
+ "name": "created_at",
1387
+ "type": "timestamp",
1388
+ "primaryKey": false,
1389
+ "notNull": true,
1390
+ "default": "now()"
1391
+ }
1392
+ },
1393
+ "indexes": {},
1394
+ "foreignKeys": {
1395
+ "transaction_wallet_id_wallet_id_fk": {
1396
+ "name": "transaction_wallet_id_wallet_id_fk",
1397
+ "tableFrom": "transaction",
1398
+ "tableTo": "wallet",
1399
+ "columnsFrom": ["wallet_id"],
1400
+ "columnsTo": ["id"],
1401
+ "onDelete": "cascade",
1402
+ "onUpdate": "no action"
1403
+ },
1404
+ "transaction_agent_id_agent_id_fk": {
1405
+ "name": "transaction_agent_id_agent_id_fk",
1406
+ "tableFrom": "transaction",
1407
+ "tableTo": "agent",
1408
+ "columnsFrom": ["agent_id"],
1409
+ "columnsTo": ["id"],
1410
+ "onDelete": "set null",
1411
+ "onUpdate": "no action"
1412
+ }
1413
+ },
1414
+ "compositePrimaryKeys": {},
1415
+ "uniqueConstraints": {},
1416
+ "policies": {},
1417
+ "checkConstraints": {},
1418
+ "isRLSEnabled": false
1419
+ },
1420
+ "public.wallet": {
1421
+ "name": "wallet",
1422
+ "schema": "",
1423
+ "columns": {
1424
+ "id": {
1425
+ "name": "id",
1426
+ "type": "text",
1427
+ "primaryKey": true,
1428
+ "notNull": true
1429
+ },
1430
+ "tenant_id": {
1431
+ "name": "tenant_id",
1432
+ "type": "text",
1433
+ "primaryKey": false,
1434
+ "notNull": true
1435
+ },
1436
+ "name": {
1437
+ "name": "name",
1438
+ "type": "text",
1439
+ "primaryKey": false,
1440
+ "notNull": true
1441
+ },
1442
+ "backend_type": {
1443
+ "name": "backend_type",
1444
+ "type": "text",
1445
+ "primaryKey": false,
1446
+ "notNull": true
1447
+ },
1448
+ "currency": {
1449
+ "name": "currency",
1450
+ "type": "text",
1451
+ "primaryKey": false,
1452
+ "notNull": true
1453
+ },
1454
+ "balance": {
1455
+ "name": "balance",
1456
+ "type": "text",
1457
+ "primaryKey": false,
1458
+ "notNull": true,
1459
+ "default": "'0'"
1460
+ },
1461
+ "config": {
1462
+ "name": "config",
1463
+ "type": "jsonb",
1464
+ "primaryKey": false,
1465
+ "notNull": false
1466
+ },
1467
+ "created_at": {
1468
+ "name": "created_at",
1469
+ "type": "timestamp",
1470
+ "primaryKey": false,
1471
+ "notNull": true,
1472
+ "default": "now()"
1473
+ },
1474
+ "updated_at": {
1475
+ "name": "updated_at",
1476
+ "type": "timestamp",
1477
+ "primaryKey": false,
1478
+ "notNull": true,
1479
+ "default": "now()"
1480
+ }
1481
+ },
1482
+ "indexes": {},
1483
+ "foreignKeys": {
1484
+ "wallet_tenant_id_tenant_id_fk": {
1485
+ "name": "wallet_tenant_id_tenant_id_fk",
1486
+ "tableFrom": "wallet",
1487
+ "tableTo": "tenant",
1488
+ "columnsFrom": ["tenant_id"],
1489
+ "columnsTo": ["id"],
1490
+ "onDelete": "cascade",
1491
+ "onUpdate": "no action"
1492
+ }
1493
+ },
1494
+ "compositePrimaryKeys": {},
1495
+ "uniqueConstraints": {},
1496
+ "policies": {},
1497
+ "checkConstraints": {},
1498
+ "isRLSEnabled": false
1499
+ },
1500
+ "public.offering": {
1501
+ "name": "offering",
1502
+ "schema": "",
1503
+ "columns": {
1504
+ "id": {
1505
+ "name": "id",
1506
+ "type": "text",
1507
+ "primaryKey": true,
1508
+ "notNull": true
1509
+ },
1510
+ "agent_id": {
1511
+ "name": "agent_id",
1512
+ "type": "text",
1513
+ "primaryKey": false,
1514
+ "notNull": true
1515
+ },
1516
+ "tenant_id": {
1517
+ "name": "tenant_id",
1518
+ "type": "text",
1519
+ "primaryKey": false,
1520
+ "notNull": true
1521
+ },
1522
+ "name": {
1523
+ "name": "name",
1524
+ "type": "text",
1525
+ "primaryKey": false,
1526
+ "notNull": true
1527
+ },
1528
+ "description": {
1529
+ "name": "description",
1530
+ "type": "text",
1531
+ "primaryKey": false,
1532
+ "notNull": false
1533
+ },
1534
+ "pricing": {
1535
+ "name": "pricing",
1536
+ "type": "jsonb",
1537
+ "primaryKey": false,
1538
+ "notNull": false
1539
+ },
1540
+ "schema": {
1541
+ "name": "schema",
1542
+ "type": "jsonb",
1543
+ "primaryKey": false,
1544
+ "notNull": false
1545
+ },
1546
+ "created_at": {
1547
+ "name": "created_at",
1548
+ "type": "timestamp",
1549
+ "primaryKey": false,
1550
+ "notNull": true,
1551
+ "default": "now()"
1552
+ },
1553
+ "updated_at": {
1554
+ "name": "updated_at",
1555
+ "type": "timestamp",
1556
+ "primaryKey": false,
1557
+ "notNull": true,
1558
+ "default": "now()"
1559
+ }
1560
+ },
1561
+ "indexes": {},
1562
+ "foreignKeys": {
1563
+ "offering_agent_id_agent_id_fk": {
1564
+ "name": "offering_agent_id_agent_id_fk",
1565
+ "tableFrom": "offering",
1566
+ "tableTo": "agent",
1567
+ "columnsFrom": ["agent_id"],
1568
+ "columnsTo": ["id"],
1569
+ "onDelete": "cascade",
1570
+ "onUpdate": "no action"
1571
+ },
1572
+ "offering_tenant_id_tenant_id_fk": {
1573
+ "name": "offering_tenant_id_tenant_id_fk",
1574
+ "tableFrom": "offering",
1575
+ "tableTo": "tenant",
1576
+ "columnsFrom": ["tenant_id"],
1577
+ "columnsTo": ["id"],
1578
+ "onDelete": "cascade",
1579
+ "onUpdate": "no action"
1580
+ }
1581
+ },
1582
+ "compositePrimaryKeys": {},
1583
+ "uniqueConstraints": {},
1584
+ "policies": {},
1585
+ "checkConstraints": {},
1586
+ "isRLSEnabled": false
1587
+ },
1588
+ "public.sidecar": {
1589
+ "name": "sidecar",
1590
+ "schema": "",
1591
+ "columns": {
1592
+ "id": {
1593
+ "name": "id",
1594
+ "type": "text",
1595
+ "primaryKey": true,
1596
+ "notNull": true
1597
+ },
1598
+ "url": {
1599
+ "name": "url",
1600
+ "type": "text",
1601
+ "primaryKey": false,
1602
+ "notNull": true
1603
+ },
1604
+ "status": {
1605
+ "name": "status",
1606
+ "type": "text",
1607
+ "primaryKey": false,
1608
+ "notNull": true,
1609
+ "default": "'online'"
1610
+ },
1611
+ "last_heartbeat": {
1612
+ "name": "last_heartbeat",
1613
+ "type": "timestamp",
1614
+ "primaryKey": false,
1615
+ "notNull": false
1616
+ },
1617
+ "created_at": {
1618
+ "name": "created_at",
1619
+ "type": "timestamp",
1620
+ "primaryKey": false,
1621
+ "notNull": true,
1622
+ "default": "now()"
1623
+ },
1624
+ "updated_at": {
1625
+ "name": "updated_at",
1626
+ "type": "timestamp",
1627
+ "primaryKey": false,
1628
+ "notNull": true,
1629
+ "default": "now()"
1630
+ }
1631
+ },
1632
+ "indexes": {},
1633
+ "foreignKeys": {},
1634
+ "compositePrimaryKeys": {},
1635
+ "uniqueConstraints": {},
1636
+ "policies": {},
1637
+ "checkConstraints": {},
1638
+ "isRLSEnabled": false
1639
+ },
1640
+ "public.agent_session": {
1641
+ "name": "agent_session",
1642
+ "schema": "",
1643
+ "columns": {
1644
+ "id": {
1645
+ "name": "id",
1646
+ "type": "text",
1647
+ "primaryKey": true,
1648
+ "notNull": true
1649
+ },
1650
+ "tenant_id": {
1651
+ "name": "tenant_id",
1652
+ "type": "text",
1653
+ "primaryKey": false,
1654
+ "notNull": true
1655
+ },
1656
+ "agent_id": {
1657
+ "name": "agent_id",
1658
+ "type": "text",
1659
+ "primaryKey": false,
1660
+ "notNull": true
1661
+ },
1662
+ "principal_id": {
1663
+ "name": "principal_id",
1664
+ "type": "text",
1665
+ "primaryKey": false,
1666
+ "notNull": true
1667
+ },
1668
+ "status": {
1669
+ "name": "status",
1670
+ "type": "text",
1671
+ "primaryKey": false,
1672
+ "notNull": true,
1673
+ "default": "'active'"
1674
+ },
1675
+ "created_at": {
1676
+ "name": "created_at",
1677
+ "type": "timestamp",
1678
+ "primaryKey": false,
1679
+ "notNull": true,
1680
+ "default": "now()"
1681
+ },
1682
+ "updated_at": {
1683
+ "name": "updated_at",
1684
+ "type": "timestamp",
1685
+ "primaryKey": false,
1686
+ "notNull": true,
1687
+ "default": "now()"
1688
+ },
1689
+ "ended_at": {
1690
+ "name": "ended_at",
1691
+ "type": "timestamp",
1692
+ "primaryKey": false,
1693
+ "notNull": false
1694
+ }
1695
+ },
1696
+ "indexes": {},
1697
+ "foreignKeys": {
1698
+ "agent_session_tenant_id_tenant_id_fk": {
1699
+ "name": "agent_session_tenant_id_tenant_id_fk",
1700
+ "tableFrom": "agent_session",
1701
+ "tableTo": "tenant",
1702
+ "columnsFrom": ["tenant_id"],
1703
+ "columnsTo": ["id"],
1704
+ "onDelete": "cascade",
1705
+ "onUpdate": "no action"
1706
+ },
1707
+ "agent_session_agent_id_agent_id_fk": {
1708
+ "name": "agent_session_agent_id_agent_id_fk",
1709
+ "tableFrom": "agent_session",
1710
+ "tableTo": "agent",
1711
+ "columnsFrom": ["agent_id"],
1712
+ "columnsTo": ["id"],
1713
+ "onDelete": "cascade",
1714
+ "onUpdate": "no action"
1715
+ },
1716
+ "agent_session_principal_id_principal_id_fk": {
1717
+ "name": "agent_session_principal_id_principal_id_fk",
1718
+ "tableFrom": "agent_session",
1719
+ "tableTo": "principal",
1720
+ "columnsFrom": ["principal_id"],
1721
+ "columnsTo": ["id"],
1722
+ "onDelete": "no action",
1723
+ "onUpdate": "no action"
1724
+ }
1725
+ },
1726
+ "compositePrimaryKeys": {},
1727
+ "uniqueConstraints": {},
1728
+ "policies": {},
1729
+ "checkConstraints": {},
1730
+ "isRLSEnabled": false
1731
+ },
1732
+ "public.agent_instance": {
1733
+ "name": "agent_instance",
1734
+ "schema": "",
1735
+ "columns": {
1736
+ "id": {
1737
+ "name": "id",
1738
+ "type": "text",
1739
+ "primaryKey": true,
1740
+ "notNull": true
1741
+ },
1742
+ "agent_id": {
1743
+ "name": "agent_id",
1744
+ "type": "text",
1745
+ "primaryKey": false,
1746
+ "notNull": true
1747
+ },
1748
+ "tenant_id": {
1749
+ "name": "tenant_id",
1750
+ "type": "text",
1751
+ "primaryKey": false,
1752
+ "notNull": true
1753
+ },
1754
+ "principal_id": {
1755
+ "name": "principal_id",
1756
+ "type": "text",
1757
+ "primaryKey": false,
1758
+ "notNull": true
1759
+ },
1760
+ "address": {
1761
+ "name": "address",
1762
+ "type": "text",
1763
+ "primaryKey": false,
1764
+ "notNull": true
1765
+ },
1766
+ "version_id": {
1767
+ "name": "version_id",
1768
+ "type": "text",
1769
+ "primaryKey": false,
1770
+ "notNull": false
1771
+ },
1772
+ "session_id": {
1773
+ "name": "session_id",
1774
+ "type": "text",
1775
+ "primaryKey": false,
1776
+ "notNull": false
1777
+ },
1778
+ "status": {
1779
+ "name": "status",
1780
+ "type": "text",
1781
+ "primaryKey": false,
1782
+ "notNull": true,
1783
+ "default": "'deployed'"
1784
+ },
1785
+ "sidecar_id": {
1786
+ "name": "sidecar_id",
1787
+ "type": "text",
1788
+ "primaryKey": false,
1789
+ "notNull": false
1790
+ },
1791
+ "public_key": {
1792
+ "name": "public_key",
1793
+ "type": "text",
1794
+ "primaryKey": false,
1795
+ "notNull": false
1796
+ },
1797
+ "kernel_id": {
1798
+ "name": "kernel_id",
1799
+ "type": "text",
1800
+ "primaryKey": false,
1801
+ "notNull": false
1802
+ },
1803
+ "created_at": {
1804
+ "name": "created_at",
1805
+ "type": "timestamp",
1806
+ "primaryKey": false,
1807
+ "notNull": true,
1808
+ "default": "now()"
1809
+ },
1810
+ "updated_at": {
1811
+ "name": "updated_at",
1812
+ "type": "timestamp",
1813
+ "primaryKey": false,
1814
+ "notNull": true,
1815
+ "default": "now()"
1816
+ },
1817
+ "ended_at": {
1818
+ "name": "ended_at",
1819
+ "type": "timestamp",
1820
+ "primaryKey": false,
1821
+ "notNull": false
1822
+ }
1823
+ },
1824
+ "indexes": {},
1825
+ "foreignKeys": {
1826
+ "agent_instance_agent_id_agent_id_fk": {
1827
+ "name": "agent_instance_agent_id_agent_id_fk",
1828
+ "tableFrom": "agent_instance",
1829
+ "tableTo": "agent",
1830
+ "columnsFrom": ["agent_id"],
1831
+ "columnsTo": ["id"],
1832
+ "onDelete": "cascade",
1833
+ "onUpdate": "no action"
1834
+ },
1835
+ "agent_instance_tenant_id_tenant_id_fk": {
1836
+ "name": "agent_instance_tenant_id_tenant_id_fk",
1837
+ "tableFrom": "agent_instance",
1838
+ "tableTo": "tenant",
1839
+ "columnsFrom": ["tenant_id"],
1840
+ "columnsTo": ["id"],
1841
+ "onDelete": "cascade",
1842
+ "onUpdate": "no action"
1843
+ },
1844
+ "agent_instance_principal_id_principal_id_fk": {
1845
+ "name": "agent_instance_principal_id_principal_id_fk",
1846
+ "tableFrom": "agent_instance",
1847
+ "tableTo": "principal",
1848
+ "columnsFrom": ["principal_id"],
1849
+ "columnsTo": ["id"],
1850
+ "onDelete": "no action",
1851
+ "onUpdate": "no action"
1852
+ },
1853
+ "agent_instance_version_id_agent_version_id_fk": {
1854
+ "name": "agent_instance_version_id_agent_version_id_fk",
1855
+ "tableFrom": "agent_instance",
1856
+ "tableTo": "agent_version",
1857
+ "columnsFrom": ["version_id"],
1858
+ "columnsTo": ["id"],
1859
+ "onDelete": "no action",
1860
+ "onUpdate": "no action"
1861
+ },
1862
+ "agent_instance_session_id_agent_session_id_fk": {
1863
+ "name": "agent_instance_session_id_agent_session_id_fk",
1864
+ "tableFrom": "agent_instance",
1865
+ "tableTo": "agent_session",
1866
+ "columnsFrom": ["session_id"],
1867
+ "columnsTo": ["id"],
1868
+ "onDelete": "no action",
1869
+ "onUpdate": "no action"
1870
+ },
1871
+ "agent_instance_sidecar_id_sidecar_id_fk": {
1872
+ "name": "agent_instance_sidecar_id_sidecar_id_fk",
1873
+ "tableFrom": "agent_instance",
1874
+ "tableTo": "sidecar",
1875
+ "columnsFrom": ["sidecar_id"],
1876
+ "columnsTo": ["id"],
1877
+ "onDelete": "set null",
1878
+ "onUpdate": "no action"
1879
+ }
1880
+ },
1881
+ "compositePrimaryKeys": {},
1882
+ "uniqueConstraints": {
1883
+ "agent_instance_address_unique": {
1884
+ "name": "agent_instance_address_unique",
1885
+ "nullsNotDistinct": false,
1886
+ "columns": ["address"]
1887
+ }
1888
+ },
1889
+ "policies": {},
1890
+ "checkConstraints": {},
1891
+ "isRLSEnabled": false
1892
+ },
1893
+ "public.message_part": {
1894
+ "name": "message_part",
1895
+ "schema": "",
1896
+ "columns": {
1897
+ "id": {
1898
+ "name": "id",
1899
+ "type": "text",
1900
+ "primaryKey": true,
1901
+ "notNull": true
1902
+ },
1903
+ "message_id": {
1904
+ "name": "message_id",
1905
+ "type": "text",
1906
+ "primaryKey": false,
1907
+ "notNull": true
1908
+ },
1909
+ "session_id": {
1910
+ "name": "session_id",
1911
+ "type": "text",
1912
+ "primaryKey": false,
1913
+ "notNull": true
1914
+ },
1915
+ "type": {
1916
+ "name": "type",
1917
+ "type": "text",
1918
+ "primaryKey": false,
1919
+ "notNull": true
1920
+ },
1921
+ "content": {
1922
+ "name": "content",
1923
+ "type": "text",
1924
+ "primaryKey": false,
1925
+ "notNull": false
1926
+ },
1927
+ "metadata": {
1928
+ "name": "metadata",
1929
+ "type": "jsonb",
1930
+ "primaryKey": false,
1931
+ "notNull": false
1932
+ },
1933
+ "ordinal": {
1934
+ "name": "ordinal",
1935
+ "type": "integer",
1936
+ "primaryKey": false,
1937
+ "notNull": true
1938
+ }
1939
+ },
1940
+ "indexes": {},
1941
+ "foreignKeys": {
1942
+ "message_part_message_id_session_message_id_fk": {
1943
+ "name": "message_part_message_id_session_message_id_fk",
1944
+ "tableFrom": "message_part",
1945
+ "tableTo": "session_message",
1946
+ "columnsFrom": ["message_id"],
1947
+ "columnsTo": ["id"],
1948
+ "onDelete": "cascade",
1949
+ "onUpdate": "no action"
1950
+ },
1951
+ "message_part_session_id_agent_session_id_fk": {
1952
+ "name": "message_part_session_id_agent_session_id_fk",
1953
+ "tableFrom": "message_part",
1954
+ "tableTo": "agent_session",
1955
+ "columnsFrom": ["session_id"],
1956
+ "columnsTo": ["id"],
1957
+ "onDelete": "cascade",
1958
+ "onUpdate": "no action"
1959
+ }
1960
+ },
1961
+ "compositePrimaryKeys": {},
1962
+ "uniqueConstraints": {},
1963
+ "policies": {},
1964
+ "checkConstraints": {},
1965
+ "isRLSEnabled": false
1966
+ },
1967
+ "public.session_message": {
1968
+ "name": "session_message",
1969
+ "schema": "",
1970
+ "columns": {
1971
+ "id": {
1972
+ "name": "id",
1973
+ "type": "text",
1974
+ "primaryKey": true,
1975
+ "notNull": true
1976
+ },
1977
+ "session_id": {
1978
+ "name": "session_id",
1979
+ "type": "text",
1980
+ "primaryKey": false,
1981
+ "notNull": true
1982
+ },
1983
+ "instance_id": {
1984
+ "name": "instance_id",
1985
+ "type": "text",
1986
+ "primaryKey": false,
1987
+ "notNull": false
1988
+ },
1989
+ "tenant_id": {
1990
+ "name": "tenant_id",
1991
+ "type": "text",
1992
+ "primaryKey": false,
1993
+ "notNull": true
1994
+ },
1995
+ "role": {
1996
+ "name": "role",
1997
+ "type": "text",
1998
+ "primaryKey": false,
1999
+ "notNull": true
2000
+ },
2001
+ "from": {
2002
+ "name": "from",
2003
+ "type": "text",
2004
+ "primaryKey": false,
2005
+ "notNull": true
2006
+ },
2007
+ "status": {
2008
+ "name": "status",
2009
+ "type": "text",
2010
+ "primaryKey": false,
2011
+ "notNull": true,
2012
+ "default": "'pending'"
2013
+ },
2014
+ "created_at": {
2015
+ "name": "created_at",
2016
+ "type": "timestamp",
2017
+ "primaryKey": false,
2018
+ "notNull": true,
2019
+ "default": "now()"
2020
+ }
2021
+ },
2022
+ "indexes": {},
2023
+ "foreignKeys": {
2024
+ "session_message_session_id_agent_session_id_fk": {
2025
+ "name": "session_message_session_id_agent_session_id_fk",
2026
+ "tableFrom": "session_message",
2027
+ "tableTo": "agent_session",
2028
+ "columnsFrom": ["session_id"],
2029
+ "columnsTo": ["id"],
2030
+ "onDelete": "cascade",
2031
+ "onUpdate": "no action"
2032
+ },
2033
+ "session_message_instance_id_agent_instance_id_fk": {
2034
+ "name": "session_message_instance_id_agent_instance_id_fk",
2035
+ "tableFrom": "session_message",
2036
+ "tableTo": "agent_instance",
2037
+ "columnsFrom": ["instance_id"],
2038
+ "columnsTo": ["id"],
2039
+ "onDelete": "cascade",
2040
+ "onUpdate": "no action"
2041
+ },
2042
+ "session_message_tenant_id_tenant_id_fk": {
2043
+ "name": "session_message_tenant_id_tenant_id_fk",
2044
+ "tableFrom": "session_message",
2045
+ "tableTo": "tenant",
2046
+ "columnsFrom": ["tenant_id"],
2047
+ "columnsTo": ["id"],
2048
+ "onDelete": "cascade",
2049
+ "onUpdate": "no action"
2050
+ }
2051
+ },
2052
+ "compositePrimaryKeys": {},
2053
+ "uniqueConstraints": {},
2054
+ "policies": {},
2055
+ "checkConstraints": {},
2056
+ "isRLSEnabled": false
2057
+ }
2058
+ },
2059
+ "enums": {},
2060
+ "schemas": {},
2061
+ "sequences": {},
2062
+ "roles": {},
2063
+ "policies": {},
2064
+ "views": {},
2065
+ "_meta": {
2066
+ "columns": {},
2067
+ "schemas": {},
2068
+ "tables": {}
2069
+ }
2070
+ }