@automagik/omni 2.260409.6 → 2.260421.3

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 (53) hide show
  1. package/db/drizzle/0018_supreme_puma.sql +6 -0
  2. package/db/drizzle/0019_idle_chat_follow_up.sql +23 -0
  3. package/db/drizzle/0020_follow_up_config.sql +2 -0
  4. package/db/drizzle/0021_idle_follow_up_seed.sql +51 -0
  5. package/db/drizzle/0022_idle_follow_up_prompt_v2.sql +34 -0
  6. package/db/drizzle/0023_dispatcher_inbound_age.sql +8 -0
  7. package/db/drizzle/0024_quiet_gabe_jones.sql +23 -0
  8. package/db/drizzle/0025_panoramic_sinister_six.sql +5 -0
  9. package/db/drizzle/0026_agent_key_profiles.sql +19 -0
  10. package/db/drizzle/0027_bridge_tmux_session.sql +13 -0
  11. package/db/drizzle/meta/{0014_snapshot.json → 0018_snapshot.json} +678 -430
  12. package/db/drizzle/meta/{0013_snapshot.json → 0019_snapshot.json} +919 -445
  13. package/db/drizzle/meta/0020_snapshot.json +7240 -0
  14. package/db/drizzle/meta/0021_snapshot.json +7240 -0
  15. package/db/drizzle/meta/0024_snapshot.json +7240 -0
  16. package/db/drizzle/meta/0025_snapshot.json +7240 -0
  17. package/db/drizzle/meta/0026_snapshot.json +7274 -0
  18. package/db/drizzle/meta/_journal.json +70 -0
  19. package/dist/__tests__/mock-api.d.ts +24 -0
  20. package/dist/__tests__/mock-api.d.ts.map +1 -1
  21. package/dist/commands/agents.d.ts +2 -0
  22. package/dist/commands/agents.d.ts.map +1 -1
  23. package/dist/commands/doctor.d.ts +24 -15
  24. package/dist/commands/doctor.d.ts.map +1 -1
  25. package/dist/commands/events.d.ts +25 -0
  26. package/dist/commands/events.d.ts.map +1 -1
  27. package/dist/commands/follow-up.d.ts +13 -0
  28. package/dist/commands/follow-up.d.ts.map +1 -0
  29. package/dist/commands/install.d.ts +28 -29
  30. package/dist/commands/install.d.ts.map +1 -1
  31. package/dist/commands/instances.d.ts.map +1 -1
  32. package/dist/commands/keys.d.ts +43 -0
  33. package/dist/commands/keys.d.ts.map +1 -1
  34. package/dist/commands/start.d.ts.map +1 -1
  35. package/dist/commands/update.d.ts +12 -0
  36. package/dist/commands/update.d.ts.map +1 -1
  37. package/dist/commands/voice.d.ts +11 -0
  38. package/dist/commands/voice.d.ts.map +1 -0
  39. package/dist/config.d.ts +1 -1
  40. package/dist/config.d.ts.map +1 -1
  41. package/dist/index.js +94536 -65466
  42. package/dist/install-helpers.d.ts +32 -0
  43. package/dist/install-helpers.d.ts.map +1 -0
  44. package/dist/nats-install.d.ts +11 -0
  45. package/dist/nats-install.d.ts.map +1 -0
  46. package/dist/output.d.ts +14 -5
  47. package/dist/output.d.ts.map +1 -1
  48. package/dist/pm2.d.ts +46 -0
  49. package/dist/pm2.d.ts.map +1 -1
  50. package/dist/server/davey.linux-x64-gnu-vevevdy2.node +0 -0
  51. package/dist/server/davey.linux-x64-musl-3vkb94zg.node +0 -0
  52. package/dist/server/index.js +97148 -13518
  53. package/package.json +10 -10
@@ -1,6 +1,6 @@
1
1
  {
2
- "id": "2b52d32f-8a5f-46f7-8838-f94761174881",
3
- "prevId": "130b40bc-8816-4685-93c5-00b49a1d9102",
2
+ "id": "4c5c9395-4417-4db7-9c8e-7a9fc8a6f704",
3
+ "prevId": "3269d455-1aa4-4d4c-b947-43817969639b",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
6
6
  "tables": {
@@ -117,9 +117,9 @@
117
117
  }
118
118
  ],
119
119
  "isUnique": false,
120
- "concurrently": false,
120
+ "with": {},
121
121
  "method": "btree",
122
- "with": {}
122
+ "concurrently": false
123
123
  },
124
124
  "access_rules_phone_idx": {
125
125
  "name": "access_rules_phone_idx",
@@ -132,9 +132,9 @@
132
132
  }
133
133
  ],
134
134
  "isUnique": false,
135
- "concurrently": false,
135
+ "with": {},
136
136
  "method": "btree",
137
- "with": {}
137
+ "concurrently": false
138
138
  },
139
139
  "access_rules_type_idx": {
140
140
  "name": "access_rules_type_idx",
@@ -147,9 +147,9 @@
147
147
  }
148
148
  ],
149
149
  "isUnique": false,
150
- "concurrently": false,
150
+ "with": {},
151
151
  "method": "btree",
152
- "with": {}
152
+ "concurrently": false
153
153
  },
154
154
  "access_rules_unique_idx": {
155
155
  "name": "access_rules_unique_idx",
@@ -174,9 +174,9 @@
174
174
  }
175
175
  ],
176
176
  "isUnique": true,
177
- "concurrently": false,
177
+ "with": {},
178
178
  "method": "btree",
179
- "with": {}
179
+ "concurrently": false
180
180
  },
181
181
  "idx_access_rules_pairing": {
182
182
  "name": "idx_access_rules_pairing",
@@ -201,29 +201,29 @@
201
201
  }
202
202
  ],
203
203
  "isUnique": false,
204
- "concurrently": false,
204
+ "with": {},
205
205
  "method": "btree",
206
- "with": {}
206
+ "concurrently": false
207
207
  }
208
208
  },
209
209
  "foreignKeys": {
210
210
  "access_rules_instance_id_instances_id_fk": {
211
211
  "name": "access_rules_instance_id_instances_id_fk",
212
212
  "tableFrom": "access_rules",
213
- "tableTo": "instances",
214
213
  "columnsFrom": ["instance_id"],
214
+ "tableTo": "instances",
215
215
  "columnsTo": ["id"],
216
- "onDelete": "cascade",
217
- "onUpdate": "no action"
216
+ "onUpdate": "no action",
217
+ "onDelete": "cascade"
218
218
  },
219
219
  "access_rules_person_id_persons_id_fk": {
220
220
  "name": "access_rules_person_id_persons_id_fk",
221
221
  "tableFrom": "access_rules",
222
- "tableTo": "persons",
223
222
  "columnsFrom": ["person_id"],
223
+ "tableTo": "persons",
224
224
  "columnsTo": ["id"],
225
- "onDelete": "cascade",
226
- "onUpdate": "no action"
225
+ "onUpdate": "no action",
226
+ "onDelete": "cascade"
227
227
  }
228
228
  },
229
229
  "compositePrimaryKeys": {},
@@ -380,9 +380,9 @@
380
380
  }
381
381
  ],
382
382
  "isUnique": false,
383
- "concurrently": false,
383
+ "with": {},
384
384
  "method": "btree",
385
- "with": {}
385
+ "concurrently": false
386
386
  },
387
387
  "agent_providers_schema_idx": {
388
388
  "name": "agent_providers_schema_idx",
@@ -395,9 +395,9 @@
395
395
  }
396
396
  ],
397
397
  "isUnique": false,
398
- "concurrently": false,
398
+ "with": {},
399
399
  "method": "btree",
400
- "with": {}
400
+ "concurrently": false
401
401
  },
402
402
  "agent_providers_active_idx": {
403
403
  "name": "agent_providers_active_idx",
@@ -410,9 +410,9 @@
410
410
  }
411
411
  ],
412
412
  "isUnique": false,
413
- "concurrently": false,
413
+ "with": {},
414
414
  "method": "btree",
415
- "with": {}
415
+ "concurrently": false
416
416
  }
417
417
  },
418
418
  "foreignKeys": {},
@@ -420,8 +420,8 @@
420
420
  "uniqueConstraints": {
421
421
  "agent_providers_name_unique": {
422
422
  "name": "agent_providers_name_unique",
423
- "nullsNotDistinct": false,
424
- "columns": ["name"]
423
+ "columns": ["name"],
424
+ "nullsNotDistinct": false
425
425
  }
426
426
  },
427
427
  "policies": {},
@@ -672,9 +672,9 @@
672
672
  }
673
673
  ],
674
674
  "isUnique": true,
675
- "concurrently": false,
675
+ "with": {},
676
676
  "method": "btree",
677
- "with": {}
677
+ "concurrently": false
678
678
  },
679
679
  "agent_routes_unique_user_route": {
680
680
  "name": "agent_routes_unique_user_route",
@@ -693,9 +693,9 @@
693
693
  }
694
694
  ],
695
695
  "isUnique": true,
696
- "concurrently": false,
696
+ "with": {},
697
697
  "method": "btree",
698
- "with": {}
698
+ "concurrently": false
699
699
  },
700
700
  "agent_routes_instance_idx": {
701
701
  "name": "agent_routes_instance_idx",
@@ -708,9 +708,9 @@
708
708
  }
709
709
  ],
710
710
  "isUnique": false,
711
- "concurrently": false,
711
+ "with": {},
712
712
  "method": "btree",
713
- "with": {}
713
+ "concurrently": false
714
714
  },
715
715
  "agent_routes_chat_idx": {
716
716
  "name": "agent_routes_chat_idx",
@@ -723,9 +723,9 @@
723
723
  }
724
724
  ],
725
725
  "isUnique": false,
726
- "concurrently": false,
726
+ "with": {},
727
727
  "method": "btree",
728
- "with": {}
728
+ "concurrently": false
729
729
  },
730
730
  "agent_routes_person_idx": {
731
731
  "name": "agent_routes_person_idx",
@@ -738,9 +738,9 @@
738
738
  }
739
739
  ],
740
740
  "isUnique": false,
741
- "concurrently": false,
741
+ "with": {},
742
742
  "method": "btree",
743
- "with": {}
743
+ "concurrently": false
744
744
  },
745
745
  "agent_routes_active_idx": {
746
746
  "name": "agent_routes_active_idx",
@@ -759,9 +759,9 @@
759
759
  }
760
760
  ],
761
761
  "isUnique": false,
762
- "concurrently": false,
762
+ "with": {},
763
763
  "method": "btree",
764
- "with": {}
764
+ "concurrently": false
765
765
  },
766
766
  "agent_routes_agent_id_idx": {
767
767
  "name": "agent_routes_agent_id_idx",
@@ -774,47 +774,47 @@
774
774
  }
775
775
  ],
776
776
  "isUnique": false,
777
- "concurrently": false,
777
+ "with": {},
778
778
  "method": "btree",
779
- "with": {}
779
+ "concurrently": false
780
780
  }
781
781
  },
782
782
  "foreignKeys": {
783
783
  "agent_routes_instance_id_instances_id_fk": {
784
784
  "name": "agent_routes_instance_id_instances_id_fk",
785
785
  "tableFrom": "agent_routes",
786
- "tableTo": "instances",
787
786
  "columnsFrom": ["instance_id"],
787
+ "tableTo": "instances",
788
788
  "columnsTo": ["id"],
789
- "onDelete": "cascade",
790
- "onUpdate": "no action"
789
+ "onUpdate": "no action",
790
+ "onDelete": "cascade"
791
791
  },
792
792
  "agent_routes_chat_id_chats_id_fk": {
793
793
  "name": "agent_routes_chat_id_chats_id_fk",
794
794
  "tableFrom": "agent_routes",
795
- "tableTo": "chats",
796
795
  "columnsFrom": ["chat_id"],
796
+ "tableTo": "chats",
797
797
  "columnsTo": ["id"],
798
- "onDelete": "cascade",
799
- "onUpdate": "no action"
798
+ "onUpdate": "no action",
799
+ "onDelete": "cascade"
800
800
  },
801
801
  "agent_routes_person_id_persons_id_fk": {
802
802
  "name": "agent_routes_person_id_persons_id_fk",
803
803
  "tableFrom": "agent_routes",
804
- "tableTo": "persons",
805
804
  "columnsFrom": ["person_id"],
805
+ "tableTo": "persons",
806
806
  "columnsTo": ["id"],
807
- "onDelete": "cascade",
808
- "onUpdate": "no action"
807
+ "onUpdate": "no action",
808
+ "onDelete": "cascade"
809
809
  },
810
810
  "agent_routes_agent_id_agents_id_fk": {
811
811
  "name": "agent_routes_agent_id_agents_id_fk",
812
812
  "tableFrom": "agent_routes",
813
- "tableTo": "agents",
814
813
  "columnsFrom": ["agent_id"],
814
+ "tableTo": "agents",
815
815
  "columnsTo": ["id"],
816
- "onDelete": "set null",
817
- "onUpdate": "no action"
816
+ "onUpdate": "no action",
817
+ "onDelete": "set null"
818
818
  }
819
819
  },
820
820
  "compositePrimaryKeys": {},
@@ -903,9 +903,9 @@
903
903
  }
904
904
  ],
905
905
  "isUnique": true,
906
- "concurrently": false,
906
+ "with": {},
907
907
  "method": "btree",
908
- "with": {}
908
+ "concurrently": false
909
909
  },
910
910
  "agent_sessions_expires_idx": {
911
911
  "name": "agent_sessions_expires_idx",
@@ -918,9 +918,9 @@
918
918
  }
919
919
  ],
920
920
  "isUnique": false,
921
- "concurrently": false,
921
+ "with": {},
922
922
  "method": "btree",
923
- "with": {}
923
+ "concurrently": false
924
924
  },
925
925
  "agent_sessions_last_used_idx": {
926
926
  "name": "agent_sessions_last_used_idx",
@@ -933,20 +933,20 @@
933
933
  }
934
934
  ],
935
935
  "isUnique": false,
936
- "concurrently": false,
936
+ "with": {},
937
937
  "method": "btree",
938
- "with": {}
938
+ "concurrently": false
939
939
  }
940
940
  },
941
941
  "foreignKeys": {
942
942
  "agent_sessions_instance_id_instances_id_fk": {
943
943
  "name": "agent_sessions_instance_id_instances_id_fk",
944
944
  "tableFrom": "agent_sessions",
945
- "tableTo": "instances",
946
945
  "columnsFrom": ["instance_id"],
946
+ "tableTo": "instances",
947
947
  "columnsTo": ["id"],
948
- "onDelete": "cascade",
949
- "onUpdate": "no action"
948
+ "onUpdate": "no action",
949
+ "onDelete": "cascade"
950
950
  }
951
951
  },
952
952
  "compositePrimaryKeys": {},
@@ -1100,9 +1100,9 @@
1100
1100
  }
1101
1101
  ],
1102
1102
  "isUnique": false,
1103
- "concurrently": false,
1103
+ "with": {},
1104
1104
  "method": "btree",
1105
- "with": {}
1105
+ "concurrently": false
1106
1106
  },
1107
1107
  "agent_tasks_chat_id_idx": {
1108
1108
  "name": "agent_tasks_chat_id_idx",
@@ -1115,9 +1115,9 @@
1115
1115
  }
1116
1116
  ],
1117
1117
  "isUnique": false,
1118
- "concurrently": false,
1118
+ "with": {},
1119
1119
  "method": "btree",
1120
- "with": {}
1120
+ "concurrently": false
1121
1121
  },
1122
1122
  "agent_tasks_conversation_id_idx": {
1123
1123
  "name": "agent_tasks_conversation_id_idx",
@@ -1130,9 +1130,9 @@
1130
1130
  }
1131
1131
  ],
1132
1132
  "isUnique": false,
1133
- "concurrently": false,
1133
+ "with": {},
1134
1134
  "method": "btree",
1135
- "with": {}
1135
+ "concurrently": false
1136
1136
  },
1137
1137
  "agent_tasks_parent_task_id_idx": {
1138
1138
  "name": "agent_tasks_parent_task_id_idx",
@@ -1145,9 +1145,9 @@
1145
1145
  }
1146
1146
  ],
1147
1147
  "isUnique": false,
1148
- "concurrently": false,
1148
+ "with": {},
1149
1149
  "method": "btree",
1150
- "with": {}
1150
+ "concurrently": false
1151
1151
  },
1152
1152
  "agent_tasks_status_idx": {
1153
1153
  "name": "agent_tasks_status_idx",
@@ -1160,9 +1160,9 @@
1160
1160
  }
1161
1161
  ],
1162
1162
  "isUnique": false,
1163
- "concurrently": false,
1163
+ "with": {},
1164
1164
  "method": "btree",
1165
- "with": {}
1165
+ "concurrently": false
1166
1166
  },
1167
1167
  "agent_tasks_agent_chat_idx": {
1168
1168
  "name": "agent_tasks_agent_chat_idx",
@@ -1181,9 +1181,9 @@
1181
1181
  }
1182
1182
  ],
1183
1183
  "isUnique": false,
1184
- "concurrently": false,
1184
+ "with": {},
1185
1185
  "method": "btree",
1186
- "with": {}
1186
+ "concurrently": false
1187
1187
  },
1188
1188
  "agent_tasks_agent_status_idx": {
1189
1189
  "name": "agent_tasks_agent_status_idx",
@@ -1202,56 +1202,56 @@
1202
1202
  }
1203
1203
  ],
1204
1204
  "isUnique": false,
1205
- "concurrently": false,
1205
+ "with": {},
1206
1206
  "method": "btree",
1207
- "with": {}
1207
+ "concurrently": false
1208
1208
  }
1209
1209
  },
1210
1210
  "foreignKeys": {
1211
1211
  "agent_tasks_agent_id_agents_id_fk": {
1212
1212
  "name": "agent_tasks_agent_id_agents_id_fk",
1213
1213
  "tableFrom": "agent_tasks",
1214
- "tableTo": "agents",
1215
1214
  "columnsFrom": ["agent_id"],
1215
+ "tableTo": "agents",
1216
1216
  "columnsTo": ["id"],
1217
- "onDelete": "cascade",
1218
- "onUpdate": "no action"
1217
+ "onUpdate": "no action",
1218
+ "onDelete": "cascade"
1219
1219
  },
1220
1220
  "agent_tasks_chat_id_chats_id_fk": {
1221
1221
  "name": "agent_tasks_chat_id_chats_id_fk",
1222
1222
  "tableFrom": "agent_tasks",
1223
- "tableTo": "chats",
1224
1223
  "columnsFrom": ["chat_id"],
1224
+ "tableTo": "chats",
1225
1225
  "columnsTo": ["id"],
1226
- "onDelete": "cascade",
1227
- "onUpdate": "no action"
1226
+ "onUpdate": "no action",
1227
+ "onDelete": "cascade"
1228
1228
  },
1229
1229
  "agent_tasks_conversation_id_conversations_id_fk": {
1230
1230
  "name": "agent_tasks_conversation_id_conversations_id_fk",
1231
1231
  "tableFrom": "agent_tasks",
1232
- "tableTo": "conversations",
1233
1232
  "columnsFrom": ["conversation_id"],
1233
+ "tableTo": "conversations",
1234
1234
  "columnsTo": ["id"],
1235
- "onDelete": "set null",
1236
- "onUpdate": "no action"
1235
+ "onUpdate": "no action",
1236
+ "onDelete": "set null"
1237
1237
  },
1238
1238
  "agent_tasks_message_id_messages_id_fk": {
1239
1239
  "name": "agent_tasks_message_id_messages_id_fk",
1240
1240
  "tableFrom": "agent_tasks",
1241
- "tableTo": "messages",
1242
1241
  "columnsFrom": ["message_id"],
1242
+ "tableTo": "messages",
1243
1243
  "columnsTo": ["id"],
1244
- "onDelete": "set null",
1245
- "onUpdate": "no action"
1244
+ "onUpdate": "no action",
1245
+ "onDelete": "set null"
1246
1246
  },
1247
1247
  "agent_tasks_parent_task_id_agent_tasks_id_fk": {
1248
1248
  "name": "agent_tasks_parent_task_id_agent_tasks_id_fk",
1249
1249
  "tableFrom": "agent_tasks",
1250
- "tableTo": "agent_tasks",
1251
1250
  "columnsFrom": ["parent_task_id"],
1251
+ "tableTo": "agent_tasks",
1252
1252
  "columnsTo": ["id"],
1253
- "onDelete": "set null",
1254
- "onUpdate": "no action"
1253
+ "onUpdate": "no action",
1254
+ "onDelete": "set null"
1255
1255
  }
1256
1256
  },
1257
1257
  "compositePrimaryKeys": {},
@@ -1374,9 +1374,9 @@
1374
1374
  }
1375
1375
  ],
1376
1376
  "isUnique": false,
1377
- "concurrently": false,
1377
+ "with": {},
1378
1378
  "method": "btree",
1379
- "with": {}
1379
+ "concurrently": false
1380
1380
  },
1381
1381
  "agents_owner_idx": {
1382
1382
  "name": "agents_owner_idx",
@@ -1389,9 +1389,9 @@
1389
1389
  }
1390
1390
  ],
1391
1391
  "isUnique": false,
1392
- "concurrently": false,
1392
+ "with": {},
1393
1393
  "method": "btree",
1394
- "with": {}
1394
+ "concurrently": false
1395
1395
  },
1396
1396
  "agents_provider_idx": {
1397
1397
  "name": "agents_provider_idx",
@@ -1404,9 +1404,9 @@
1404
1404
  }
1405
1405
  ],
1406
1406
  "isUnique": false,
1407
- "concurrently": false,
1407
+ "with": {},
1408
1408
  "method": "btree",
1409
- "with": {}
1409
+ "concurrently": false
1410
1410
  },
1411
1411
  "agents_active_idx": {
1412
1412
  "name": "agents_active_idx",
@@ -1419,29 +1419,29 @@
1419
1419
  }
1420
1420
  ],
1421
1421
  "isUnique": false,
1422
- "concurrently": false,
1422
+ "with": {},
1423
1423
  "method": "btree",
1424
- "with": {}
1424
+ "concurrently": false
1425
1425
  }
1426
1426
  },
1427
1427
  "foreignKeys": {
1428
1428
  "agents_owner_id_persons_id_fk": {
1429
1429
  "name": "agents_owner_id_persons_id_fk",
1430
1430
  "tableFrom": "agents",
1431
- "tableTo": "persons",
1432
1431
  "columnsFrom": ["owner_id"],
1432
+ "tableTo": "persons",
1433
1433
  "columnsTo": ["id"],
1434
- "onDelete": "set null",
1435
- "onUpdate": "no action"
1434
+ "onUpdate": "no action",
1435
+ "onDelete": "set null"
1436
1436
  },
1437
1437
  "agents_agent_provider_id_agent_providers_id_fk": {
1438
1438
  "name": "agents_agent_provider_id_agent_providers_id_fk",
1439
1439
  "tableFrom": "agents",
1440
- "tableTo": "agent_providers",
1441
1440
  "columnsFrom": ["agent_provider_id"],
1441
+ "tableTo": "agent_providers",
1442
1442
  "columnsTo": ["id"],
1443
- "onDelete": "set null",
1444
- "onUpdate": "no action"
1443
+ "onUpdate": "no action",
1444
+ "onDelete": "set null"
1445
1445
  }
1446
1446
  },
1447
1447
  "compositePrimaryKeys": {},
@@ -1523,9 +1523,9 @@
1523
1523
  }
1524
1524
  ],
1525
1525
  "isUnique": false,
1526
- "concurrently": false,
1526
+ "with": {},
1527
1527
  "method": "btree",
1528
- "with": {}
1528
+ "concurrently": false
1529
1529
  },
1530
1530
  "api_key_audit_logs_timestamp_idx": {
1531
1531
  "name": "api_key_audit_logs_timestamp_idx",
@@ -1538,9 +1538,9 @@
1538
1538
  }
1539
1539
  ],
1540
1540
  "isUnique": false,
1541
- "concurrently": false,
1541
+ "with": {},
1542
1542
  "method": "btree",
1543
- "with": {}
1543
+ "concurrently": false
1544
1544
  },
1545
1545
  "api_key_audit_logs_path_idx": {
1546
1546
  "name": "api_key_audit_logs_path_idx",
@@ -1553,20 +1553,20 @@
1553
1553
  }
1554
1554
  ],
1555
1555
  "isUnique": false,
1556
- "concurrently": false,
1556
+ "with": {},
1557
1557
  "method": "btree",
1558
- "with": {}
1558
+ "concurrently": false
1559
1559
  }
1560
1560
  },
1561
1561
  "foreignKeys": {
1562
1562
  "api_key_audit_logs_api_key_id_api_keys_id_fk": {
1563
1563
  "name": "api_key_audit_logs_api_key_id_api_keys_id_fk",
1564
1564
  "tableFrom": "api_key_audit_logs",
1565
- "tableTo": "api_keys",
1566
1565
  "columnsFrom": ["api_key_id"],
1566
+ "tableTo": "api_keys",
1567
1567
  "columnsTo": ["id"],
1568
- "onDelete": "cascade",
1569
- "onUpdate": "no action"
1568
+ "onUpdate": "no action",
1569
+ "onDelete": "cascade"
1570
1570
  }
1571
1571
  },
1572
1572
  "compositePrimaryKeys": {},
@@ -1678,6 +1678,36 @@
1678
1678
  "primaryKey": false,
1679
1679
  "notNull": false
1680
1680
  },
1681
+ "active_instance_id": {
1682
+ "name": "active_instance_id",
1683
+ "type": "uuid",
1684
+ "primaryKey": false,
1685
+ "notNull": false
1686
+ },
1687
+ "context_instance_id": {
1688
+ "name": "context_instance_id",
1689
+ "type": "uuid",
1690
+ "primaryKey": false,
1691
+ "notNull": false
1692
+ },
1693
+ "context_chat_id": {
1694
+ "name": "context_chat_id",
1695
+ "type": "uuid",
1696
+ "primaryKey": false,
1697
+ "notNull": false
1698
+ },
1699
+ "context_message_id": {
1700
+ "name": "context_message_id",
1701
+ "type": "uuid",
1702
+ "primaryKey": false,
1703
+ "notNull": false
1704
+ },
1705
+ "context_updated_at": {
1706
+ "name": "context_updated_at",
1707
+ "type": "timestamp",
1708
+ "primaryKey": false,
1709
+ "notNull": false
1710
+ },
1681
1711
  "created_at": {
1682
1712
  "name": "created_at",
1683
1713
  "type": "timestamp",
@@ -1711,9 +1741,9 @@
1711
1741
  }
1712
1742
  ],
1713
1743
  "isUnique": false,
1714
- "concurrently": false,
1744
+ "with": {},
1715
1745
  "method": "btree",
1716
- "with": {}
1746
+ "concurrently": false
1717
1747
  },
1718
1748
  "api_keys_key_hash_idx": {
1719
1749
  "name": "api_keys_key_hash_idx",
@@ -1726,9 +1756,9 @@
1726
1756
  }
1727
1757
  ],
1728
1758
  "isUnique": true,
1729
- "concurrently": false,
1759
+ "with": {},
1730
1760
  "method": "btree",
1731
- "with": {}
1761
+ "concurrently": false
1732
1762
  },
1733
1763
  "api_keys_status_idx": {
1734
1764
  "name": "api_keys_status_idx",
@@ -1741,9 +1771,9 @@
1741
1771
  }
1742
1772
  ],
1743
1773
  "isUnique": false,
1744
- "concurrently": false,
1774
+ "with": {},
1745
1775
  "method": "btree",
1746
- "with": {}
1776
+ "concurrently": false
1747
1777
  },
1748
1778
  "api_keys_expires_at_idx": {
1749
1779
  "name": "api_keys_expires_at_idx",
@@ -1756,9 +1786,9 @@
1756
1786
  }
1757
1787
  ],
1758
1788
  "isUnique": false,
1759
- "concurrently": false,
1789
+ "with": {},
1760
1790
  "method": "btree",
1761
- "with": {}
1791
+ "concurrently": false
1762
1792
  }
1763
1793
  },
1764
1794
  "foreignKeys": {},
@@ -1841,9 +1871,9 @@
1841
1871
  }
1842
1872
  ],
1843
1873
  "isUnique": false,
1844
- "concurrently": false,
1874
+ "with": {},
1845
1875
  "method": "btree",
1846
- "with": {}
1876
+ "concurrently": false
1847
1877
  },
1848
1878
  "automation_logs_event_id_idx": {
1849
1879
  "name": "automation_logs_event_id_idx",
@@ -1856,9 +1886,9 @@
1856
1886
  }
1857
1887
  ],
1858
1888
  "isUnique": false,
1859
- "concurrently": false,
1889
+ "with": {},
1860
1890
  "method": "btree",
1861
- "with": {}
1891
+ "concurrently": false
1862
1892
  },
1863
1893
  "automation_logs_status_idx": {
1864
1894
  "name": "automation_logs_status_idx",
@@ -1871,9 +1901,9 @@
1871
1901
  }
1872
1902
  ],
1873
1903
  "isUnique": false,
1874
- "concurrently": false,
1904
+ "with": {},
1875
1905
  "method": "btree",
1876
- "with": {}
1906
+ "concurrently": false
1877
1907
  },
1878
1908
  "automation_logs_created_at_idx": {
1879
1909
  "name": "automation_logs_created_at_idx",
@@ -1886,20 +1916,20 @@
1886
1916
  }
1887
1917
  ],
1888
1918
  "isUnique": false,
1889
- "concurrently": false,
1919
+ "with": {},
1890
1920
  "method": "btree",
1891
- "with": {}
1921
+ "concurrently": false
1892
1922
  }
1893
1923
  },
1894
1924
  "foreignKeys": {
1895
1925
  "automation_logs_automation_id_automations_id_fk": {
1896
1926
  "name": "automation_logs_automation_id_automations_id_fk",
1897
1927
  "tableFrom": "automation_logs",
1898
- "tableTo": "automations",
1899
1928
  "columnsFrom": ["automation_id"],
1929
+ "tableTo": "automations",
1900
1930
  "columnsTo": ["id"],
1901
- "onDelete": "cascade",
1902
- "onUpdate": "no action"
1931
+ "onUpdate": "no action",
1932
+ "onDelete": "cascade"
1903
1933
  }
1904
1934
  },
1905
1935
  "compositePrimaryKeys": {},
@@ -2003,9 +2033,9 @@
2003
2033
  }
2004
2034
  ],
2005
2035
  "isUnique": false,
2006
- "concurrently": false,
2036
+ "with": {},
2007
2037
  "method": "btree",
2008
- "with": {}
2038
+ "concurrently": false
2009
2039
  },
2010
2040
  "automations_trigger_idx": {
2011
2041
  "name": "automations_trigger_idx",
@@ -2018,9 +2048,9 @@
2018
2048
  }
2019
2049
  ],
2020
2050
  "isUnique": false,
2021
- "concurrently": false,
2051
+ "with": {},
2022
2052
  "method": "btree",
2023
- "with": {}
2053
+ "concurrently": false
2024
2054
  },
2025
2055
  "automations_enabled_idx": {
2026
2056
  "name": "automations_enabled_idx",
@@ -2033,9 +2063,9 @@
2033
2063
  }
2034
2064
  ],
2035
2065
  "isUnique": false,
2036
- "concurrently": false,
2066
+ "with": {},
2037
2067
  "method": "btree",
2038
- "with": {}
2068
+ "concurrently": false
2039
2069
  },
2040
2070
  "automations_priority_idx": {
2041
2071
  "name": "automations_priority_idx",
@@ -2048,9 +2078,9 @@
2048
2078
  }
2049
2079
  ],
2050
2080
  "isUnique": false,
2051
- "concurrently": false,
2081
+ "with": {},
2052
2082
  "method": "btree",
2053
- "with": {}
2083
+ "concurrently": false
2054
2084
  }
2055
2085
  },
2056
2086
  "foreignKeys": {},
@@ -2186,9 +2216,9 @@
2186
2216
  }
2187
2217
  ],
2188
2218
  "isUnique": false,
2189
- "concurrently": false,
2219
+ "with": {},
2190
2220
  "method": "btree",
2191
- "with": {}
2221
+ "concurrently": false
2192
2222
  },
2193
2223
  "batch_jobs_instance_idx": {
2194
2224
  "name": "batch_jobs_instance_idx",
@@ -2201,9 +2231,9 @@
2201
2231
  }
2202
2232
  ],
2203
2233
  "isUnique": false,
2204
- "concurrently": false,
2234
+ "with": {},
2205
2235
  "method": "btree",
2206
- "with": {}
2236
+ "concurrently": false
2207
2237
  },
2208
2238
  "batch_jobs_created_at_idx": {
2209
2239
  "name": "batch_jobs_created_at_idx",
@@ -2216,20 +2246,20 @@
2216
2246
  }
2217
2247
  ],
2218
2248
  "isUnique": false,
2219
- "concurrently": false,
2249
+ "with": {},
2220
2250
  "method": "btree",
2221
- "with": {}
2251
+ "concurrently": false
2222
2252
  }
2223
2253
  },
2224
2254
  "foreignKeys": {
2225
2255
  "batch_jobs_instance_id_instances_id_fk": {
2226
2256
  "name": "batch_jobs_instance_id_instances_id_fk",
2227
2257
  "tableFrom": "batch_jobs",
2228
- "tableTo": "instances",
2229
2258
  "columnsFrom": ["instance_id"],
2259
+ "tableTo": "instances",
2230
2260
  "columnsTo": ["id"],
2231
- "onDelete": "set null",
2232
- "onUpdate": "no action"
2261
+ "onUpdate": "no action",
2262
+ "onDelete": "set null"
2233
2263
  }
2234
2264
  },
2235
2265
  "compositePrimaryKeys": {},
@@ -2299,9 +2329,9 @@
2299
2329
  }
2300
2330
  ],
2301
2331
  "isUnique": true,
2302
- "concurrently": false,
2332
+ "with": {},
2303
2333
  "method": "btree",
2304
- "with": {}
2334
+ "concurrently": false
2305
2335
  },
2306
2336
  "chat_id_mappings_instance_phone_idx": {
2307
2337
  "name": "chat_id_mappings_instance_phone_idx",
@@ -2320,20 +2350,20 @@
2320
2350
  }
2321
2351
  ],
2322
2352
  "isUnique": false,
2323
- "concurrently": false,
2353
+ "with": {},
2324
2354
  "method": "btree",
2325
- "with": {}
2355
+ "concurrently": false
2326
2356
  }
2327
2357
  },
2328
2358
  "foreignKeys": {
2329
2359
  "chat_id_mappings_instance_id_instances_id_fk": {
2330
2360
  "name": "chat_id_mappings_instance_id_instances_id_fk",
2331
2361
  "tableFrom": "chat_id_mappings",
2332
- "tableTo": "instances",
2333
2362
  "columnsFrom": ["instance_id"],
2363
+ "tableTo": "instances",
2334
2364
  "columnsTo": ["id"],
2335
- "onDelete": "cascade",
2336
- "onUpdate": "no action"
2365
+ "onUpdate": "no action",
2366
+ "onDelete": "cascade"
2337
2367
  }
2338
2368
  },
2339
2369
  "compositePrimaryKeys": {},
@@ -2467,9 +2497,9 @@
2467
2497
  }
2468
2498
  ],
2469
2499
  "isUnique": true,
2470
- "concurrently": false,
2500
+ "with": {},
2471
2501
  "method": "btree",
2472
- "with": {}
2502
+ "concurrently": false
2473
2503
  },
2474
2504
  "chat_participants_chat_idx": {
2475
2505
  "name": "chat_participants_chat_idx",
@@ -2482,9 +2512,9 @@
2482
2512
  }
2483
2513
  ],
2484
2514
  "isUnique": false,
2485
- "concurrently": false,
2515
+ "with": {},
2486
2516
  "method": "btree",
2487
- "with": {}
2517
+ "concurrently": false
2488
2518
  },
2489
2519
  "chat_participants_person_idx": {
2490
2520
  "name": "chat_participants_person_idx",
@@ -2497,9 +2527,9 @@
2497
2527
  }
2498
2528
  ],
2499
2529
  "isUnique": false,
2500
- "concurrently": false,
2530
+ "with": {},
2501
2531
  "method": "btree",
2502
- "with": {}
2532
+ "concurrently": false
2503
2533
  },
2504
2534
  "chat_participants_platform_identity_idx": {
2505
2535
  "name": "chat_participants_platform_identity_idx",
@@ -2512,9 +2542,9 @@
2512
2542
  }
2513
2543
  ],
2514
2544
  "isUnique": false,
2515
- "concurrently": false,
2545
+ "with": {},
2516
2546
  "method": "btree",
2517
- "with": {}
2547
+ "concurrently": false
2518
2548
  },
2519
2549
  "chat_participants_role_idx": {
2520
2550
  "name": "chat_participants_role_idx",
@@ -2527,38 +2557,38 @@
2527
2557
  }
2528
2558
  ],
2529
2559
  "isUnique": false,
2530
- "concurrently": false,
2560
+ "with": {},
2531
2561
  "method": "btree",
2532
- "with": {}
2562
+ "concurrently": false
2533
2563
  }
2534
2564
  },
2535
2565
  "foreignKeys": {
2536
2566
  "chat_participants_chat_id_chats_id_fk": {
2537
2567
  "name": "chat_participants_chat_id_chats_id_fk",
2538
2568
  "tableFrom": "chat_participants",
2539
- "tableTo": "chats",
2540
2569
  "columnsFrom": ["chat_id"],
2570
+ "tableTo": "chats",
2541
2571
  "columnsTo": ["id"],
2542
- "onDelete": "cascade",
2543
- "onUpdate": "no action"
2572
+ "onUpdate": "no action",
2573
+ "onDelete": "cascade"
2544
2574
  },
2545
2575
  "chat_participants_person_id_persons_id_fk": {
2546
2576
  "name": "chat_participants_person_id_persons_id_fk",
2547
2577
  "tableFrom": "chat_participants",
2548
- "tableTo": "persons",
2549
2578
  "columnsFrom": ["person_id"],
2579
+ "tableTo": "persons",
2550
2580
  "columnsTo": ["id"],
2551
- "onDelete": "set null",
2552
- "onUpdate": "no action"
2581
+ "onUpdate": "no action",
2582
+ "onDelete": "set null"
2553
2583
  },
2554
2584
  "chat_participants_platform_identity_id_platform_identities_id_fk": {
2555
2585
  "name": "chat_participants_platform_identity_id_platform_identities_id_fk",
2556
2586
  "tableFrom": "chat_participants",
2557
- "tableTo": "platform_identities",
2558
2587
  "columnsFrom": ["platform_identity_id"],
2588
+ "tableTo": "platform_identities",
2559
2589
  "columnsTo": ["id"],
2560
- "onDelete": "set null",
2561
- "onUpdate": "no action"
2590
+ "onUpdate": "no action",
2591
+ "onDelete": "set null"
2562
2592
  }
2563
2593
  },
2564
2594
  "compositePrimaryKeys": {},
@@ -2748,9 +2778,9 @@
2748
2778
  }
2749
2779
  ],
2750
2780
  "isUnique": true,
2751
- "concurrently": false,
2781
+ "with": {},
2752
2782
  "method": "btree",
2753
- "with": {}
2783
+ "concurrently": false
2754
2784
  },
2755
2785
  "chats_canonical_id_idx": {
2756
2786
  "name": "chats_canonical_id_idx",
@@ -2763,9 +2793,9 @@
2763
2793
  }
2764
2794
  ],
2765
2795
  "isUnique": false,
2766
- "concurrently": false,
2796
+ "with": {},
2767
2797
  "method": "btree",
2768
- "with": {}
2798
+ "concurrently": false
2769
2799
  },
2770
2800
  "chats_instance_canonical_unique_idx": {
2771
2801
  "name": "chats_instance_canonical_unique_idx",
@@ -2784,10 +2814,10 @@
2784
2814
  }
2785
2815
  ],
2786
2816
  "isUnique": true,
2787
- "where": "\"chats\".\"canonical_id\" IS NOT NULL",
2788
- "concurrently": false,
2817
+ "with": {},
2789
2818
  "method": "btree",
2790
- "with": {}
2819
+ "where": "\"chats\".\"canonical_id\" IS NOT NULL",
2820
+ "concurrently": false
2791
2821
  },
2792
2822
  "chats_type_idx": {
2793
2823
  "name": "chats_type_idx",
@@ -2800,9 +2830,9 @@
2800
2830
  }
2801
2831
  ],
2802
2832
  "isUnique": false,
2803
- "concurrently": false,
2833
+ "with": {},
2804
2834
  "method": "btree",
2805
- "with": {}
2835
+ "concurrently": false
2806
2836
  },
2807
2837
  "chats_channel_idx": {
2808
2838
  "name": "chats_channel_idx",
@@ -2815,9 +2845,9 @@
2815
2845
  }
2816
2846
  ],
2817
2847
  "isUnique": false,
2818
- "concurrently": false,
2848
+ "with": {},
2819
2849
  "method": "btree",
2820
- "with": {}
2850
+ "concurrently": false
2821
2851
  },
2822
2852
  "chats_parent_idx": {
2823
2853
  "name": "chats_parent_idx",
@@ -2830,9 +2860,9 @@
2830
2860
  }
2831
2861
  ],
2832
2862
  "isUnique": false,
2833
- "concurrently": false,
2863
+ "with": {},
2834
2864
  "method": "btree",
2835
- "with": {}
2865
+ "concurrently": false
2836
2866
  },
2837
2867
  "chats_last_message_idx": {
2838
2868
  "name": "chats_last_message_idx",
@@ -2845,9 +2875,9 @@
2845
2875
  }
2846
2876
  ],
2847
2877
  "isUnique": false,
2848
- "concurrently": false,
2878
+ "with": {},
2849
2879
  "method": "btree",
2850
- "with": {}
2880
+ "concurrently": false
2851
2881
  },
2852
2882
  "chats_conversation_id_idx": {
2853
2883
  "name": "chats_conversation_id_idx",
@@ -2860,29 +2890,29 @@
2860
2890
  }
2861
2891
  ],
2862
2892
  "isUnique": false,
2863
- "concurrently": false,
2893
+ "with": {},
2864
2894
  "method": "btree",
2865
- "with": {}
2895
+ "concurrently": false
2866
2896
  }
2867
2897
  },
2868
2898
  "foreignKeys": {
2869
2899
  "chats_instance_id_instances_id_fk": {
2870
2900
  "name": "chats_instance_id_instances_id_fk",
2871
2901
  "tableFrom": "chats",
2872
- "tableTo": "instances",
2873
2902
  "columnsFrom": ["instance_id"],
2903
+ "tableTo": "instances",
2874
2904
  "columnsTo": ["id"],
2875
- "onDelete": "cascade",
2876
- "onUpdate": "no action"
2905
+ "onUpdate": "no action",
2906
+ "onDelete": "cascade"
2877
2907
  },
2878
2908
  "chats_conversation_id_conversations_id_fk": {
2879
2909
  "name": "chats_conversation_id_conversations_id_fk",
2880
2910
  "tableFrom": "chats",
2881
- "tableTo": "conversations",
2882
2911
  "columnsFrom": ["conversation_id"],
2912
+ "tableTo": "conversations",
2883
2913
  "columnsTo": ["id"],
2884
- "onDelete": "set null",
2885
- "onUpdate": "no action"
2914
+ "onUpdate": "no action",
2915
+ "onDelete": "set null"
2886
2916
  }
2887
2917
  },
2888
2918
  "compositePrimaryKeys": {},
@@ -2992,9 +3022,9 @@
2992
3022
  }
2993
3023
  ],
2994
3024
  "isUnique": false,
2995
- "concurrently": false,
3025
+ "with": {},
2996
3026
  "method": "btree",
2997
- "with": {}
3027
+ "concurrently": false
2998
3028
  },
2999
3029
  "conversations_updated_at_idx": {
3000
3030
  "name": "conversations_updated_at_idx",
@@ -3007,9 +3037,9 @@
3007
3037
  }
3008
3038
  ],
3009
3039
  "isUnique": false,
3010
- "concurrently": false,
3040
+ "with": {},
3011
3041
  "method": "btree",
3012
- "with": {}
3042
+ "concurrently": false
3013
3043
  }
3014
3044
  },
3015
3045
  "foreignKeys": {},
@@ -3131,9 +3161,9 @@
3131
3161
  }
3132
3162
  ],
3133
3163
  "isUnique": false,
3134
- "concurrently": false,
3164
+ "with": {},
3135
3165
  "method": "btree",
3136
- "with": {}
3166
+ "concurrently": false
3137
3167
  },
3138
3168
  "dead_letter_events_event_type_idx": {
3139
3169
  "name": "dead_letter_events_event_type_idx",
@@ -3146,9 +3176,9 @@
3146
3176
  }
3147
3177
  ],
3148
3178
  "isUnique": false,
3149
- "concurrently": false,
3179
+ "with": {},
3150
3180
  "method": "btree",
3151
- "with": {}
3181
+ "concurrently": false
3152
3182
  },
3153
3183
  "dead_letter_events_status_idx": {
3154
3184
  "name": "dead_letter_events_status_idx",
@@ -3161,9 +3191,9 @@
3161
3191
  }
3162
3192
  ],
3163
3193
  "isUnique": false,
3164
- "concurrently": false,
3194
+ "with": {},
3165
3195
  "method": "btree",
3166
- "with": {}
3196
+ "concurrently": false
3167
3197
  },
3168
3198
  "dead_letter_events_created_at_idx": {
3169
3199
  "name": "dead_letter_events_created_at_idx",
@@ -3176,9 +3206,9 @@
3176
3206
  }
3177
3207
  ],
3178
3208
  "isUnique": false,
3179
- "concurrently": false,
3209
+ "with": {},
3180
3210
  "method": "btree",
3181
- "with": {}
3211
+ "concurrently": false
3182
3212
  },
3183
3213
  "dead_letter_events_next_retry_idx": {
3184
3214
  "name": "dead_letter_events_next_retry_idx",
@@ -3191,9 +3221,9 @@
3191
3221
  }
3192
3222
  ],
3193
3223
  "isUnique": false,
3194
- "concurrently": false,
3224
+ "with": {},
3195
3225
  "method": "btree",
3196
- "with": {}
3226
+ "concurrently": false
3197
3227
  }
3198
3228
  },
3199
3229
  "foreignKeys": {},
@@ -3302,9 +3332,9 @@
3302
3332
  }
3303
3333
  ],
3304
3334
  "isUnique": false,
3305
- "concurrently": false,
3335
+ "with": {},
3306
3336
  "method": "btree",
3307
- "with": {}
3337
+ "concurrently": false
3308
3338
  },
3309
3339
  "event_payloads_event_type_idx": {
3310
3340
  "name": "event_payloads_event_type_idx",
@@ -3317,9 +3347,9 @@
3317
3347
  }
3318
3348
  ],
3319
3349
  "isUnique": false,
3320
- "concurrently": false,
3350
+ "with": {},
3321
3351
  "method": "btree",
3322
- "with": {}
3352
+ "concurrently": false
3323
3353
  },
3324
3354
  "event_payloads_stage_idx": {
3325
3355
  "name": "event_payloads_stage_idx",
@@ -3332,9 +3362,9 @@
3332
3362
  }
3333
3363
  ],
3334
3364
  "isUnique": false,
3335
- "concurrently": false,
3365
+ "with": {},
3336
3366
  "method": "btree",
3337
- "with": {}
3367
+ "concurrently": false
3338
3368
  },
3339
3369
  "event_payloads_timestamp_idx": {
3340
3370
  "name": "event_payloads_timestamp_idx",
@@ -3347,9 +3377,9 @@
3347
3377
  }
3348
3378
  ],
3349
3379
  "isUnique": false,
3350
- "concurrently": false,
3380
+ "with": {},
3351
3381
  "method": "btree",
3352
- "with": {}
3382
+ "concurrently": false
3353
3383
  },
3354
3384
  "event_payloads_deleted_at_idx": {
3355
3385
  "name": "event_payloads_deleted_at_idx",
@@ -3362,9 +3392,9 @@
3362
3392
  }
3363
3393
  ],
3364
3394
  "isUnique": false,
3365
- "concurrently": false,
3395
+ "with": {},
3366
3396
  "method": "btree",
3367
- "with": {}
3397
+ "concurrently": false
3368
3398
  },
3369
3399
  "event_payloads_event_stage_idx": {
3370
3400
  "name": "event_payloads_event_stage_idx",
@@ -3383,9 +3413,9 @@
3383
3413
  }
3384
3414
  ],
3385
3415
  "isUnique": false,
3386
- "concurrently": false,
3416
+ "with": {},
3387
3417
  "method": "btree",
3388
- "with": {}
3418
+ "concurrently": false
3389
3419
  }
3390
3420
  },
3391
3421
  "foreignKeys": {},
@@ -3502,9 +3532,9 @@
3502
3532
  }
3503
3533
  ],
3504
3534
  "isUnique": true,
3505
- "concurrently": false,
3535
+ "with": {},
3506
3536
  "method": "btree",
3507
- "with": {}
3537
+ "concurrently": false
3508
3538
  },
3509
3539
  "global_settings_category_idx": {
3510
3540
  "name": "global_settings_category_idx",
@@ -3517,9 +3547,9 @@
3517
3547
  }
3518
3548
  ],
3519
3549
  "isUnique": false,
3520
- "concurrently": false,
3550
+ "with": {},
3521
3551
  "method": "btree",
3522
- "with": {}
3552
+ "concurrently": false
3523
3553
  }
3524
3554
  },
3525
3555
  "foreignKeys": {},
@@ -3527,8 +3557,8 @@
3527
3557
  "uniqueConstraints": {
3528
3558
  "global_settings_key_unique": {
3529
3559
  "name": "global_settings_key_unique",
3530
- "nullsNotDistinct": false,
3531
- "columns": ["key"]
3560
+ "columns": ["key"],
3561
+ "nullsNotDistinct": false
3532
3562
  }
3533
3563
  },
3534
3564
  "policies": {},
@@ -4021,6 +4051,13 @@
4021
4051
  "primaryKey": false,
4022
4052
  "notNull": false
4023
4053
  },
4054
+ "agent_stalled_timeout_ms": {
4055
+ "name": "agent_stalled_timeout_ms",
4056
+ "type": "integer",
4057
+ "primaryKey": false,
4058
+ "notNull": true,
4059
+ "default": 600000
4060
+ },
4024
4061
  "agent_chain_to_instance_id": {
4025
4062
  "name": "agent_chain_to_instance_id",
4026
4063
  "type": "uuid",
@@ -4061,9 +4098,9 @@
4061
4098
  }
4062
4099
  ],
4063
4100
  "isUnique": true,
4064
- "concurrently": false,
4101
+ "with": {},
4065
4102
  "method": "btree",
4066
- "with": {}
4103
+ "concurrently": false
4067
4104
  },
4068
4105
  "instances_channel_idx": {
4069
4106
  "name": "instances_channel_idx",
@@ -4076,9 +4113,9 @@
4076
4113
  }
4077
4114
  ],
4078
4115
  "isUnique": false,
4079
- "concurrently": false,
4116
+ "with": {},
4080
4117
  "method": "btree",
4081
- "with": {}
4118
+ "concurrently": false
4082
4119
  },
4083
4120
  "instances_is_active_idx": {
4084
4121
  "name": "instances_is_active_idx",
@@ -4091,9 +4128,9 @@
4091
4128
  }
4092
4129
  ],
4093
4130
  "isUnique": false,
4094
- "concurrently": false,
4131
+ "with": {},
4095
4132
  "method": "btree",
4096
- "with": {}
4133
+ "concurrently": false
4097
4134
  },
4098
4135
  "instances_is_default_idx": {
4099
4136
  "name": "instances_is_default_idx",
@@ -4106,9 +4143,9 @@
4106
4143
  }
4107
4144
  ],
4108
4145
  "isUnique": false,
4109
- "concurrently": false,
4146
+ "with": {},
4110
4147
  "method": "btree",
4111
- "with": {}
4148
+ "concurrently": false
4112
4149
  },
4113
4150
  "instances_agent_id_idx": {
4114
4151
  "name": "instances_agent_id_idx",
@@ -4121,37 +4158,37 @@
4121
4158
  }
4122
4159
  ],
4123
4160
  "isUnique": false,
4124
- "concurrently": false,
4161
+ "with": {},
4125
4162
  "method": "btree",
4126
- "with": {}
4163
+ "concurrently": false
4127
4164
  }
4128
4165
  },
4129
4166
  "foreignKeys": {
4130
4167
  "instances_agent_id_agents_id_fk": {
4131
4168
  "name": "instances_agent_id_agents_id_fk",
4132
4169
  "tableFrom": "instances",
4133
- "tableTo": "agents",
4134
4170
  "columnsFrom": ["agent_id"],
4171
+ "tableTo": "agents",
4135
4172
  "columnsTo": ["id"],
4136
- "onDelete": "set null",
4137
- "onUpdate": "no action"
4173
+ "onUpdate": "no action",
4174
+ "onDelete": "set null"
4138
4175
  },
4139
4176
  "instances_agent_chain_to_instance_id_instances_id_fk": {
4140
4177
  "name": "instances_agent_chain_to_instance_id_instances_id_fk",
4141
4178
  "tableFrom": "instances",
4142
- "tableTo": "instances",
4143
4179
  "columnsFrom": ["agent_chain_to_instance_id"],
4180
+ "tableTo": "instances",
4144
4181
  "columnsTo": ["id"],
4145
- "onDelete": "set null",
4146
- "onUpdate": "no action"
4182
+ "onUpdate": "no action",
4183
+ "onDelete": "set null"
4147
4184
  }
4148
4185
  },
4149
4186
  "compositePrimaryKeys": {},
4150
4187
  "uniqueConstraints": {
4151
4188
  "instances_name_unique": {
4152
4189
  "name": "instances_name_unique",
4153
- "nullsNotDistinct": false,
4154
- "columns": ["name"]
4190
+ "columns": ["name"],
4191
+ "nullsNotDistinct": false
4155
4192
  }
4156
4193
  },
4157
4194
  "policies": {},
@@ -4266,9 +4303,9 @@
4266
4303
  }
4267
4304
  ],
4268
4305
  "isUnique": false,
4269
- "concurrently": false,
4306
+ "with": {},
4270
4307
  "method": "btree",
4271
- "with": {}
4308
+ "concurrently": false
4272
4309
  },
4273
4310
  "media_content_media_idx": {
4274
4311
  "name": "media_content_media_idx",
@@ -4281,9 +4318,9 @@
4281
4318
  }
4282
4319
  ],
4283
4320
  "isUnique": false,
4284
- "concurrently": false,
4321
+ "with": {},
4285
4322
  "method": "btree",
4286
- "with": {}
4323
+ "concurrently": false
4287
4324
  },
4288
4325
  "media_content_batch_job_idx": {
4289
4326
  "name": "media_content_batch_job_idx",
@@ -4296,29 +4333,29 @@
4296
4333
  }
4297
4334
  ],
4298
4335
  "isUnique": false,
4299
- "concurrently": false,
4336
+ "with": {},
4300
4337
  "method": "btree",
4301
- "with": {}
4338
+ "concurrently": false
4302
4339
  }
4303
4340
  },
4304
4341
  "foreignKeys": {
4305
4342
  "media_content_event_id_omni_events_id_fk": {
4306
4343
  "name": "media_content_event_id_omni_events_id_fk",
4307
4344
  "tableFrom": "media_content",
4308
- "tableTo": "omni_events",
4309
4345
  "columnsFrom": ["event_id"],
4346
+ "tableTo": "omni_events",
4310
4347
  "columnsTo": ["id"],
4311
- "onDelete": "cascade",
4312
- "onUpdate": "no action"
4348
+ "onUpdate": "no action",
4349
+ "onDelete": "cascade"
4313
4350
  },
4314
4351
  "media_content_batch_job_id_batch_jobs_id_fk": {
4315
4352
  "name": "media_content_batch_job_id_batch_jobs_id_fk",
4316
4353
  "tableFrom": "media_content",
4317
- "tableTo": "batch_jobs",
4318
4354
  "columnsFrom": ["batch_job_id"],
4355
+ "tableTo": "batch_jobs",
4319
4356
  "columnsTo": ["id"],
4320
- "onDelete": "set null",
4321
- "onUpdate": "no action"
4357
+ "onUpdate": "no action",
4358
+ "onDelete": "set null"
4322
4359
  }
4323
4360
  },
4324
4361
  "compositePrimaryKeys": {},
@@ -4637,9 +4674,9 @@
4637
4674
  }
4638
4675
  ],
4639
4676
  "isUnique": true,
4640
- "concurrently": false,
4677
+ "with": {},
4641
4678
  "method": "btree",
4642
- "with": {}
4679
+ "concurrently": false
4643
4680
  },
4644
4681
  "messages_chat_idx": {
4645
4682
  "name": "messages_chat_idx",
@@ -4652,9 +4689,9 @@
4652
4689
  }
4653
4690
  ],
4654
4691
  "isUnique": false,
4655
- "concurrently": false,
4692
+ "with": {},
4656
4693
  "method": "btree",
4657
- "with": {}
4694
+ "concurrently": false
4658
4695
  },
4659
4696
  "messages_sender_person_idx": {
4660
4697
  "name": "messages_sender_person_idx",
@@ -4667,9 +4704,9 @@
4667
4704
  }
4668
4705
  ],
4669
4706
  "isUnique": false,
4670
- "concurrently": false,
4707
+ "with": {},
4671
4708
  "method": "btree",
4672
- "with": {}
4709
+ "concurrently": false
4673
4710
  },
4674
4711
  "messages_sender_platform_identity_idx": {
4675
4712
  "name": "messages_sender_platform_identity_idx",
@@ -4682,9 +4719,9 @@
4682
4719
  }
4683
4720
  ],
4684
4721
  "isUnique": false,
4685
- "concurrently": false,
4722
+ "with": {},
4686
4723
  "method": "btree",
4687
- "with": {}
4724
+ "concurrently": false
4688
4725
  },
4689
4726
  "messages_sender_agent_idx": {
4690
4727
  "name": "messages_sender_agent_idx",
@@ -4697,9 +4734,9 @@
4697
4734
  }
4698
4735
  ],
4699
4736
  "isUnique": false,
4700
- "concurrently": false,
4737
+ "with": {},
4701
4738
  "method": "btree",
4702
- "with": {}
4739
+ "concurrently": false
4703
4740
  },
4704
4741
  "messages_source_idx": {
4705
4742
  "name": "messages_source_idx",
@@ -4712,9 +4749,9 @@
4712
4749
  }
4713
4750
  ],
4714
4751
  "isUnique": false,
4715
- "concurrently": false,
4752
+ "with": {},
4716
4753
  "method": "btree",
4717
- "with": {}
4754
+ "concurrently": false
4718
4755
  },
4719
4756
  "messages_type_idx": {
4720
4757
  "name": "messages_type_idx",
@@ -4727,9 +4764,9 @@
4727
4764
  }
4728
4765
  ],
4729
4766
  "isUnique": false,
4730
- "concurrently": false,
4767
+ "with": {},
4731
4768
  "method": "btree",
4732
- "with": {}
4769
+ "concurrently": false
4733
4770
  },
4734
4771
  "messages_status_idx": {
4735
4772
  "name": "messages_status_idx",
@@ -4742,9 +4779,9 @@
4742
4779
  }
4743
4780
  ],
4744
4781
  "isUnique": false,
4745
- "concurrently": false,
4782
+ "with": {},
4746
4783
  "method": "btree",
4747
- "with": {}
4784
+ "concurrently": false
4748
4785
  },
4749
4786
  "messages_platform_timestamp_idx": {
4750
4787
  "name": "messages_platform_timestamp_idx",
@@ -4757,9 +4794,9 @@
4757
4794
  }
4758
4795
  ],
4759
4796
  "isUnique": false,
4760
- "concurrently": false,
4797
+ "with": {},
4761
4798
  "method": "btree",
4762
- "with": {}
4799
+ "concurrently": false
4763
4800
  },
4764
4801
  "messages_reply_to_idx": {
4765
4802
  "name": "messages_reply_to_idx",
@@ -4772,9 +4809,9 @@
4772
4809
  }
4773
4810
  ],
4774
4811
  "isUnique": false,
4775
- "concurrently": false,
4812
+ "with": {},
4776
4813
  "method": "btree",
4777
- "with": {}
4814
+ "concurrently": false
4778
4815
  },
4779
4816
  "messages_reply_to_external_idx": {
4780
4817
  "name": "messages_reply_to_external_idx",
@@ -4799,9 +4836,9 @@
4799
4836
  }
4800
4837
  ],
4801
4838
  "isUnique": false,
4802
- "concurrently": false,
4839
+ "with": {},
4803
4840
  "method": "btree",
4804
- "with": {}
4841
+ "concurrently": false
4805
4842
  },
4806
4843
  "messages_has_media_idx": {
4807
4844
  "name": "messages_has_media_idx",
@@ -4814,9 +4851,9 @@
4814
4851
  }
4815
4852
  ],
4816
4853
  "isUnique": false,
4817
- "concurrently": false,
4854
+ "with": {},
4818
4855
  "method": "btree",
4819
- "with": {}
4856
+ "concurrently": false
4820
4857
  },
4821
4858
  "messages_original_event_idx": {
4822
4859
  "name": "messages_original_event_idx",
@@ -4829,47 +4866,47 @@
4829
4866
  }
4830
4867
  ],
4831
4868
  "isUnique": false,
4832
- "concurrently": false,
4869
+ "with": {},
4833
4870
  "method": "btree",
4834
- "with": {}
4871
+ "concurrently": false
4835
4872
  }
4836
4873
  },
4837
4874
  "foreignKeys": {
4838
4875
  "messages_chat_id_chats_id_fk": {
4839
4876
  "name": "messages_chat_id_chats_id_fk",
4840
4877
  "tableFrom": "messages",
4841
- "tableTo": "chats",
4842
4878
  "columnsFrom": ["chat_id"],
4879
+ "tableTo": "chats",
4843
4880
  "columnsTo": ["id"],
4844
- "onDelete": "cascade",
4845
- "onUpdate": "no action"
4881
+ "onUpdate": "no action",
4882
+ "onDelete": "cascade"
4846
4883
  },
4847
4884
  "messages_sender_person_id_persons_id_fk": {
4848
4885
  "name": "messages_sender_person_id_persons_id_fk",
4849
4886
  "tableFrom": "messages",
4850
- "tableTo": "persons",
4851
4887
  "columnsFrom": ["sender_person_id"],
4888
+ "tableTo": "persons",
4852
4889
  "columnsTo": ["id"],
4853
- "onDelete": "set null",
4854
- "onUpdate": "no action"
4890
+ "onUpdate": "no action",
4891
+ "onDelete": "set null"
4855
4892
  },
4856
4893
  "messages_sender_platform_identity_id_platform_identities_id_fk": {
4857
4894
  "name": "messages_sender_platform_identity_id_platform_identities_id_fk",
4858
4895
  "tableFrom": "messages",
4859
- "tableTo": "platform_identities",
4860
4896
  "columnsFrom": ["sender_platform_identity_id"],
4897
+ "tableTo": "platform_identities",
4861
4898
  "columnsTo": ["id"],
4862
- "onDelete": "set null",
4863
- "onUpdate": "no action"
4899
+ "onUpdate": "no action",
4900
+ "onDelete": "set null"
4864
4901
  },
4865
4902
  "messages_sender_agent_id_agents_id_fk": {
4866
4903
  "name": "messages_sender_agent_id_agents_id_fk",
4867
4904
  "tableFrom": "messages",
4868
- "tableTo": "agents",
4869
4905
  "columnsFrom": ["sender_agent_id"],
4906
+ "tableTo": "agents",
4870
4907
  "columnsTo": ["id"],
4871
- "onDelete": "set null",
4872
- "onUpdate": "no action"
4908
+ "onUpdate": "no action",
4909
+ "onDelete": "set null"
4873
4910
  }
4874
4911
  },
4875
4912
  "compositePrimaryKeys": {},
@@ -5140,9 +5177,9 @@
5140
5177
  }
5141
5178
  ],
5142
5179
  "isUnique": false,
5143
- "concurrently": false,
5180
+ "with": {},
5144
5181
  "method": "btree",
5145
- "with": {}
5182
+ "concurrently": false
5146
5183
  },
5147
5184
  "omni_events_channel_idx": {
5148
5185
  "name": "omni_events_channel_idx",
@@ -5155,9 +5192,9 @@
5155
5192
  }
5156
5193
  ],
5157
5194
  "isUnique": false,
5158
- "concurrently": false,
5195
+ "with": {},
5159
5196
  "method": "btree",
5160
- "with": {}
5197
+ "concurrently": false
5161
5198
  },
5162
5199
  "omni_events_instance_idx": {
5163
5200
  "name": "omni_events_instance_idx",
@@ -5170,9 +5207,9 @@
5170
5207
  }
5171
5208
  ],
5172
5209
  "isUnique": false,
5173
- "concurrently": false,
5210
+ "with": {},
5174
5211
  "method": "btree",
5175
- "with": {}
5212
+ "concurrently": false
5176
5213
  },
5177
5214
  "omni_events_person_idx": {
5178
5215
  "name": "omni_events_person_idx",
@@ -5185,9 +5222,9 @@
5185
5222
  }
5186
5223
  ],
5187
5224
  "isUnique": false,
5188
- "concurrently": false,
5225
+ "with": {},
5189
5226
  "method": "btree",
5190
- "with": {}
5227
+ "concurrently": false
5191
5228
  },
5192
5229
  "omni_events_type_idx": {
5193
5230
  "name": "omni_events_type_idx",
@@ -5200,9 +5237,9 @@
5200
5237
  }
5201
5238
  ],
5202
5239
  "isUnique": false,
5203
- "concurrently": false,
5240
+ "with": {},
5204
5241
  "method": "btree",
5205
- "with": {}
5242
+ "concurrently": false
5206
5243
  },
5207
5244
  "omni_events_status_idx": {
5208
5245
  "name": "omni_events_status_idx",
@@ -5215,9 +5252,9 @@
5215
5252
  }
5216
5253
  ],
5217
5254
  "isUnique": false,
5218
- "concurrently": false,
5255
+ "with": {},
5219
5256
  "method": "btree",
5220
- "with": {}
5257
+ "concurrently": false
5221
5258
  },
5222
5259
  "omni_events_received_at_idx": {
5223
5260
  "name": "omni_events_received_at_idx",
@@ -5230,9 +5267,9 @@
5230
5267
  }
5231
5268
  ],
5232
5269
  "isUnique": false,
5233
- "concurrently": false,
5270
+ "with": {},
5234
5271
  "method": "btree",
5235
- "with": {}
5272
+ "concurrently": false
5236
5273
  },
5237
5274
  "omni_events_chat_id_idx": {
5238
5275
  "name": "omni_events_chat_id_idx",
@@ -5245,9 +5282,9 @@
5245
5282
  }
5246
5283
  ],
5247
5284
  "isUnique": false,
5248
- "concurrently": false,
5285
+ "with": {},
5249
5286
  "method": "btree",
5250
- "with": {}
5287
+ "concurrently": false
5251
5288
  },
5252
5289
  "omni_events_canonical_chat_idx": {
5253
5290
  "name": "omni_events_canonical_chat_idx",
@@ -5260,9 +5297,9 @@
5260
5297
  }
5261
5298
  ],
5262
5299
  "isUnique": false,
5263
- "concurrently": false,
5300
+ "with": {},
5264
5301
  "method": "btree",
5265
- "with": {}
5302
+ "concurrently": false
5266
5303
  },
5267
5304
  "omni_events_agent_id_idx": {
5268
5305
  "name": "omni_events_agent_id_idx",
@@ -5275,9 +5312,9 @@
5275
5312
  }
5276
5313
  ],
5277
5314
  "isUnique": false,
5278
- "concurrently": false,
5315
+ "with": {},
5279
5316
  "method": "btree",
5280
- "with": {}
5317
+ "concurrently": false
5281
5318
  },
5282
5319
  "omni_events_chat_uuid_idx": {
5283
5320
  "name": "omni_events_chat_uuid_idx",
@@ -5290,9 +5327,9 @@
5290
5327
  }
5291
5328
  ],
5292
5329
  "isUnique": false,
5293
- "concurrently": false,
5330
+ "with": {},
5294
5331
  "method": "btree",
5295
- "with": {}
5332
+ "concurrently": false
5296
5333
  },
5297
5334
  "omni_events_conversation_id_idx": {
5298
5335
  "name": "omni_events_conversation_id_idx",
@@ -5305,65 +5342,65 @@
5305
5342
  }
5306
5343
  ],
5307
5344
  "isUnique": false,
5308
- "concurrently": false,
5345
+ "with": {},
5309
5346
  "method": "btree",
5310
- "with": {}
5347
+ "concurrently": false
5311
5348
  }
5312
5349
  },
5313
5350
  "foreignKeys": {
5314
5351
  "omni_events_instance_id_instances_id_fk": {
5315
5352
  "name": "omni_events_instance_id_instances_id_fk",
5316
5353
  "tableFrom": "omni_events",
5317
- "tableTo": "instances",
5318
5354
  "columnsFrom": ["instance_id"],
5355
+ "tableTo": "instances",
5319
5356
  "columnsTo": ["id"],
5320
- "onDelete": "set null",
5321
- "onUpdate": "no action"
5357
+ "onUpdate": "no action",
5358
+ "onDelete": "set null"
5322
5359
  },
5323
5360
  "omni_events_person_id_persons_id_fk": {
5324
5361
  "name": "omni_events_person_id_persons_id_fk",
5325
5362
  "tableFrom": "omni_events",
5326
- "tableTo": "persons",
5327
5363
  "columnsFrom": ["person_id"],
5364
+ "tableTo": "persons",
5328
5365
  "columnsTo": ["id"],
5329
- "onDelete": "set null",
5330
- "onUpdate": "no action"
5366
+ "onUpdate": "no action",
5367
+ "onDelete": "set null"
5331
5368
  },
5332
5369
  "omni_events_platform_identity_id_platform_identities_id_fk": {
5333
5370
  "name": "omni_events_platform_identity_id_platform_identities_id_fk",
5334
5371
  "tableFrom": "omni_events",
5335
- "tableTo": "platform_identities",
5336
5372
  "columnsFrom": ["platform_identity_id"],
5373
+ "tableTo": "platform_identities",
5337
5374
  "columnsTo": ["id"],
5338
- "onDelete": "set null",
5339
- "onUpdate": "no action"
5375
+ "onUpdate": "no action",
5376
+ "onDelete": "set null"
5340
5377
  },
5341
5378
  "omni_events_chat_uuid_chats_id_fk": {
5342
5379
  "name": "omni_events_chat_uuid_chats_id_fk",
5343
5380
  "tableFrom": "omni_events",
5344
- "tableTo": "chats",
5345
5381
  "columnsFrom": ["chat_uuid"],
5382
+ "tableTo": "chats",
5346
5383
  "columnsTo": ["id"],
5347
- "onDelete": "set null",
5348
- "onUpdate": "no action"
5384
+ "onUpdate": "no action",
5385
+ "onDelete": "set null"
5349
5386
  },
5350
5387
  "omni_events_agent_id_agents_id_fk": {
5351
5388
  "name": "omni_events_agent_id_agents_id_fk",
5352
5389
  "tableFrom": "omni_events",
5353
- "tableTo": "agents",
5354
5390
  "columnsFrom": ["agent_id"],
5391
+ "tableTo": "agents",
5355
5392
  "columnsTo": ["id"],
5356
- "onDelete": "set null",
5357
- "onUpdate": "no action"
5393
+ "onUpdate": "no action",
5394
+ "onDelete": "set null"
5358
5395
  },
5359
5396
  "omni_events_conversation_id_conversations_id_fk": {
5360
5397
  "name": "omni_events_conversation_id_conversations_id_fk",
5361
5398
  "tableFrom": "omni_events",
5362
- "tableTo": "conversations",
5363
5399
  "columnsFrom": ["conversation_id"],
5400
+ "tableTo": "conversations",
5364
5401
  "columnsTo": ["id"],
5365
- "onDelete": "set null",
5366
- "onUpdate": "no action"
5402
+ "onUpdate": "no action",
5403
+ "onDelete": "set null"
5367
5404
  }
5368
5405
  },
5369
5406
  "compositePrimaryKeys": {},
@@ -5497,9 +5534,9 @@
5497
5534
  }
5498
5535
  ],
5499
5536
  "isUnique": true,
5500
- "concurrently": false,
5537
+ "with": {},
5501
5538
  "method": "btree",
5502
- "with": {}
5539
+ "concurrently": false
5503
5540
  },
5504
5541
  "omni_groups_instance_idx": {
5505
5542
  "name": "omni_groups_instance_idx",
@@ -5512,9 +5549,9 @@
5512
5549
  }
5513
5550
  ],
5514
5551
  "isUnique": false,
5515
- "concurrently": false,
5552
+ "with": {},
5516
5553
  "method": "btree",
5517
- "with": {}
5554
+ "concurrently": false
5518
5555
  },
5519
5556
  "omni_groups_channel_idx": {
5520
5557
  "name": "omni_groups_channel_idx",
@@ -5527,9 +5564,9 @@
5527
5564
  }
5528
5565
  ],
5529
5566
  "isUnique": false,
5530
- "concurrently": false,
5567
+ "with": {},
5531
5568
  "method": "btree",
5532
- "with": {}
5569
+ "concurrently": false
5533
5570
  },
5534
5571
  "omni_groups_name_idx": {
5535
5572
  "name": "omni_groups_name_idx",
@@ -5542,20 +5579,20 @@
5542
5579
  }
5543
5580
  ],
5544
5581
  "isUnique": false,
5545
- "concurrently": false,
5582
+ "with": {},
5546
5583
  "method": "btree",
5547
- "with": {}
5584
+ "concurrently": false
5548
5585
  }
5549
5586
  },
5550
5587
  "foreignKeys": {
5551
5588
  "omni_groups_instance_id_instances_id_fk": {
5552
5589
  "name": "omni_groups_instance_id_instances_id_fk",
5553
5590
  "tableFrom": "omni_groups",
5554
- "tableTo": "instances",
5555
5591
  "columnsFrom": ["instance_id"],
5592
+ "tableTo": "instances",
5556
5593
  "columnsTo": ["id"],
5557
- "onDelete": "cascade",
5558
- "onUpdate": "no action"
5594
+ "onUpdate": "no action",
5595
+ "onDelete": "cascade"
5559
5596
  }
5560
5597
  },
5561
5598
  "compositePrimaryKeys": {},
@@ -5650,9 +5687,9 @@
5650
5687
  }
5651
5688
  ],
5652
5689
  "isUnique": true,
5653
- "concurrently": false,
5690
+ "with": {},
5654
5691
  "method": "btree",
5655
- "with": {}
5692
+ "concurrently": false
5656
5693
  }
5657
5694
  },
5658
5695
  "foreignKeys": {},
@@ -5660,8 +5697,8 @@
5660
5697
  "uniqueConstraints": {
5661
5698
  "payload_storage_config_event_type_unique": {
5662
5699
  "name": "payload_storage_config_event_type_unique",
5663
- "nullsNotDistinct": false,
5664
- "columns": ["event_type"]
5700
+ "columns": ["event_type"],
5701
+ "nullsNotDistinct": false
5665
5702
  }
5666
5703
  },
5667
5704
  "policies": {},
@@ -5736,9 +5773,9 @@
5736
5773
  }
5737
5774
  ],
5738
5775
  "isUnique": true,
5739
- "concurrently": false,
5776
+ "with": {},
5740
5777
  "method": "btree",
5741
- "with": {}
5778
+ "concurrently": false
5742
5779
  },
5743
5780
  "persons_email_idx": {
5744
5781
  "name": "persons_email_idx",
@@ -5751,9 +5788,9 @@
5751
5788
  }
5752
5789
  ],
5753
5790
  "isUnique": false,
5754
- "concurrently": false,
5791
+ "with": {},
5755
5792
  "method": "btree",
5756
- "with": {}
5793
+ "concurrently": false
5757
5794
  },
5758
5795
  "persons_name_idx": {
5759
5796
  "name": "persons_name_idx",
@@ -5766,9 +5803,9 @@
5766
5803
  }
5767
5804
  ],
5768
5805
  "isUnique": false,
5769
- "concurrently": false,
5806
+ "with": {},
5770
5807
  "method": "btree",
5771
- "with": {}
5808
+ "concurrently": false
5772
5809
  }
5773
5810
  },
5774
5811
  "foreignKeys": {},
@@ -5903,9 +5940,9 @@
5903
5940
  }
5904
5941
  ],
5905
5942
  "isUnique": false,
5906
- "concurrently": false,
5943
+ "with": {},
5907
5944
  "method": "btree",
5908
- "with": {}
5945
+ "concurrently": false
5909
5946
  },
5910
5947
  "platform_identities_agent_idx": {
5911
5948
  "name": "platform_identities_agent_idx",
@@ -5918,9 +5955,9 @@
5918
5955
  }
5919
5956
  ],
5920
5957
  "isUnique": false,
5921
- "concurrently": false,
5958
+ "with": {},
5922
5959
  "method": "btree",
5923
- "with": {}
5960
+ "concurrently": false
5924
5961
  },
5925
5962
  "platform_identities_channel_idx": {
5926
5963
  "name": "platform_identities_channel_idx",
@@ -5933,9 +5970,9 @@
5933
5970
  }
5934
5971
  ],
5935
5972
  "isUnique": false,
5936
- "concurrently": false,
5973
+ "with": {},
5937
5974
  "method": "btree",
5938
- "with": {}
5975
+ "concurrently": false
5939
5976
  },
5940
5977
  "platform_identities_instance_idx": {
5941
5978
  "name": "platform_identities_instance_idx",
@@ -5948,9 +5985,9 @@
5948
5985
  }
5949
5986
  ],
5950
5987
  "isUnique": false,
5951
- "concurrently": false,
5988
+ "with": {},
5952
5989
  "method": "btree",
5953
- "with": {}
5990
+ "concurrently": false
5954
5991
  },
5955
5992
  "platform_identities_platform_user_idx": {
5956
5993
  "name": "platform_identities_platform_user_idx",
@@ -5963,9 +6000,9 @@
5963
6000
  }
5964
6001
  ],
5965
6002
  "isUnique": false,
5966
- "concurrently": false,
6003
+ "with": {},
5967
6004
  "method": "btree",
5968
- "with": {}
6005
+ "concurrently": false
5969
6006
  },
5970
6007
  "platform_identities_channel_user_idx": {
5971
6008
  "name": "platform_identities_channel_user_idx",
@@ -5990,38 +6027,38 @@
5990
6027
  }
5991
6028
  ],
5992
6029
  "isUnique": true,
5993
- "concurrently": false,
6030
+ "with": {},
5994
6031
  "method": "btree",
5995
- "with": {}
6032
+ "concurrently": false
5996
6033
  }
5997
6034
  },
5998
6035
  "foreignKeys": {
5999
6036
  "platform_identities_person_id_persons_id_fk": {
6000
6037
  "name": "platform_identities_person_id_persons_id_fk",
6001
6038
  "tableFrom": "platform_identities",
6002
- "tableTo": "persons",
6003
6039
  "columnsFrom": ["person_id"],
6040
+ "tableTo": "persons",
6004
6041
  "columnsTo": ["id"],
6005
- "onDelete": "cascade",
6006
- "onUpdate": "no action"
6042
+ "onUpdate": "no action",
6043
+ "onDelete": "cascade"
6007
6044
  },
6008
6045
  "platform_identities_agent_id_agents_id_fk": {
6009
6046
  "name": "platform_identities_agent_id_agents_id_fk",
6010
6047
  "tableFrom": "platform_identities",
6011
- "tableTo": "agents",
6012
6048
  "columnsFrom": ["agent_id"],
6049
+ "tableTo": "agents",
6013
6050
  "columnsTo": ["id"],
6014
- "onDelete": "set null",
6015
- "onUpdate": "no action"
6051
+ "onUpdate": "no action",
6052
+ "onDelete": "set null"
6016
6053
  },
6017
6054
  "platform_identities_instance_id_instances_id_fk": {
6018
6055
  "name": "platform_identities_instance_id_instances_id_fk",
6019
6056
  "tableFrom": "platform_identities",
6020
- "tableTo": "instances",
6021
6057
  "columnsFrom": ["instance_id"],
6058
+ "tableTo": "instances",
6022
6059
  "columnsTo": ["id"],
6023
- "onDelete": "cascade",
6024
- "onUpdate": "no action"
6060
+ "onUpdate": "no action",
6061
+ "onDelete": "cascade"
6025
6062
  }
6026
6063
  },
6027
6064
  "compositePrimaryKeys": {},
@@ -6103,9 +6140,9 @@
6103
6140
  }
6104
6141
  ],
6105
6142
  "isUnique": true,
6106
- "concurrently": false,
6143
+ "with": {},
6107
6144
  "method": "btree",
6108
- "with": {}
6145
+ "concurrently": false
6109
6146
  },
6110
6147
  "plugin_storage_plugin_idx": {
6111
6148
  "name": "plugin_storage_plugin_idx",
@@ -6118,9 +6155,9 @@
6118
6155
  }
6119
6156
  ],
6120
6157
  "isUnique": false,
6121
- "concurrently": false,
6158
+ "with": {},
6122
6159
  "method": "btree",
6123
- "with": {}
6160
+ "concurrently": false
6124
6161
  },
6125
6162
  "plugin_storage_expires_at_idx": {
6126
6163
  "name": "plugin_storage_expires_at_idx",
@@ -6133,9 +6170,9 @@
6133
6170
  }
6134
6171
  ],
6135
6172
  "isUnique": false,
6136
- "concurrently": false,
6173
+ "with": {},
6137
6174
  "method": "btree",
6138
- "with": {}
6175
+ "concurrently": false
6139
6176
  }
6140
6177
  },
6141
6178
  "foreignKeys": {},
@@ -6206,9 +6243,9 @@
6206
6243
  }
6207
6244
  ],
6208
6245
  "isUnique": false,
6209
- "concurrently": false,
6246
+ "with": {},
6210
6247
  "method": "btree",
6211
- "with": {}
6248
+ "concurrently": false
6212
6249
  },
6213
6250
  "setting_change_history_changed_at_idx": {
6214
6251
  "name": "setting_change_history_changed_at_idx",
@@ -6221,20 +6258,20 @@
6221
6258
  }
6222
6259
  ],
6223
6260
  "isUnique": false,
6224
- "concurrently": false,
6261
+ "with": {},
6225
6262
  "method": "btree",
6226
- "with": {}
6263
+ "concurrently": false
6227
6264
  }
6228
6265
  },
6229
6266
  "foreignKeys": {
6230
6267
  "setting_change_history_setting_id_global_settings_id_fk": {
6231
6268
  "name": "setting_change_history_setting_id_global_settings_id_fk",
6232
6269
  "tableFrom": "setting_change_history",
6233
- "tableTo": "global_settings",
6234
6270
  "columnsFrom": ["setting_id"],
6271
+ "tableTo": "global_settings",
6235
6272
  "columnsTo": ["id"],
6236
- "onDelete": "cascade",
6237
- "onUpdate": "no action"
6273
+ "onUpdate": "no action",
6274
+ "onDelete": "cascade"
6238
6275
  }
6239
6276
  },
6240
6277
  "compositePrimaryKeys": {},
@@ -6331,9 +6368,9 @@
6331
6368
  }
6332
6369
  ],
6333
6370
  "isUnique": false,
6334
- "concurrently": false,
6371
+ "with": {},
6335
6372
  "method": "btree",
6336
- "with": {}
6373
+ "concurrently": false
6337
6374
  },
6338
6375
  "sync_jobs_status_idx": {
6339
6376
  "name": "sync_jobs_status_idx",
@@ -6346,9 +6383,9 @@
6346
6383
  }
6347
6384
  ],
6348
6385
  "isUnique": false,
6349
- "concurrently": false,
6386
+ "with": {},
6350
6387
  "method": "btree",
6351
- "with": {}
6388
+ "concurrently": false
6352
6389
  },
6353
6390
  "sync_jobs_type_idx": {
6354
6391
  "name": "sync_jobs_type_idx",
@@ -6361,9 +6398,9 @@
6361
6398
  }
6362
6399
  ],
6363
6400
  "isUnique": false,
6364
- "concurrently": false,
6401
+ "with": {},
6365
6402
  "method": "btree",
6366
- "with": {}
6403
+ "concurrently": false
6367
6404
  },
6368
6405
  "sync_jobs_created_at_idx": {
6369
6406
  "name": "sync_jobs_created_at_idx",
@@ -6376,20 +6413,20 @@
6376
6413
  }
6377
6414
  ],
6378
6415
  "isUnique": false,
6379
- "concurrently": false,
6416
+ "with": {},
6380
6417
  "method": "btree",
6381
- "with": {}
6418
+ "concurrently": false
6382
6419
  }
6383
6420
  },
6384
6421
  "foreignKeys": {
6385
6422
  "sync_jobs_instance_id_instances_id_fk": {
6386
6423
  "name": "sync_jobs_instance_id_instances_id_fk",
6387
6424
  "tableFrom": "sync_jobs",
6388
- "tableTo": "instances",
6389
6425
  "columnsFrom": ["instance_id"],
6426
+ "tableTo": "instances",
6390
6427
  "columnsTo": ["id"],
6391
- "onDelete": "cascade",
6392
- "onUpdate": "no action"
6428
+ "onUpdate": "no action",
6429
+ "onDelete": "cascade"
6393
6430
  }
6394
6431
  },
6395
6432
  "compositePrimaryKeys": {},
@@ -6545,9 +6582,9 @@
6545
6582
  }
6546
6583
  ],
6547
6584
  "isUnique": false,
6548
- "concurrently": false,
6585
+ "with": {},
6549
6586
  "method": "btree",
6550
- "with": {}
6587
+ "concurrently": false
6551
6588
  },
6552
6589
  "trigger_logs_trace_idx": {
6553
6590
  "name": "trigger_logs_trace_idx",
@@ -6560,9 +6597,9 @@
6560
6597
  }
6561
6598
  ],
6562
6599
  "isUnique": false,
6563
- "concurrently": false,
6600
+ "with": {},
6564
6601
  "method": "btree",
6565
- "with": {}
6602
+ "concurrently": false
6566
6603
  },
6567
6604
  "trigger_logs_fired_at_idx": {
6568
6605
  "name": "trigger_logs_fired_at_idx",
@@ -6575,9 +6612,9 @@
6575
6612
  }
6576
6613
  ],
6577
6614
  "isUnique": false,
6578
- "concurrently": false,
6615
+ "with": {},
6579
6616
  "method": "btree",
6580
- "with": {}
6617
+ "concurrently": false
6581
6618
  },
6582
6619
  "trigger_logs_event_type_idx": {
6583
6620
  "name": "trigger_logs_event_type_idx",
@@ -6590,38 +6627,38 @@
6590
6627
  }
6591
6628
  ],
6592
6629
  "isUnique": false,
6593
- "concurrently": false,
6630
+ "with": {},
6594
6631
  "method": "btree",
6595
- "with": {}
6632
+ "concurrently": false
6596
6633
  }
6597
6634
  },
6598
6635
  "foreignKeys": {
6599
6636
  "trigger_logs_instance_id_instances_id_fk": {
6600
6637
  "name": "trigger_logs_instance_id_instances_id_fk",
6601
6638
  "tableFrom": "trigger_logs",
6602
- "tableTo": "instances",
6603
6639
  "columnsFrom": ["instance_id"],
6640
+ "tableTo": "instances",
6604
6641
  "columnsTo": ["id"],
6605
- "onDelete": "cascade",
6606
- "onUpdate": "no action"
6642
+ "onUpdate": "no action",
6643
+ "onDelete": "cascade"
6607
6644
  },
6608
6645
  "trigger_logs_provider_id_agent_providers_id_fk": {
6609
6646
  "name": "trigger_logs_provider_id_agent_providers_id_fk",
6610
6647
  "tableFrom": "trigger_logs",
6611
- "tableTo": "agent_providers",
6612
6648
  "columnsFrom": ["provider_id"],
6649
+ "tableTo": "agent_providers",
6613
6650
  "columnsTo": ["id"],
6614
- "onDelete": "set null",
6615
- "onUpdate": "no action"
6651
+ "onUpdate": "no action",
6652
+ "onDelete": "set null"
6616
6653
  },
6617
6654
  "trigger_logs_route_id_agent_routes_id_fk": {
6618
6655
  "name": "trigger_logs_route_id_agent_routes_id_fk",
6619
6656
  "tableFrom": "trigger_logs",
6620
- "tableTo": "agent_routes",
6621
6657
  "columnsFrom": ["route_id"],
6658
+ "tableTo": "agent_routes",
6622
6659
  "columnsTo": ["id"],
6623
- "onDelete": "set null",
6624
- "onUpdate": "no action"
6660
+ "onUpdate": "no action",
6661
+ "onDelete": "set null"
6625
6662
  }
6626
6663
  },
6627
6664
  "compositePrimaryKeys": {},
@@ -6630,8 +6667,8 @@
6630
6667
  "checkConstraints": {},
6631
6668
  "isRLSEnabled": false
6632
6669
  },
6633
- "public.webhook_sources": {
6634
- "name": "webhook_sources",
6670
+ "public.turns": {
6671
+ "name": "turns",
6635
6672
  "schema": "",
6636
6673
  "columns": {
6637
6674
  "id": {
@@ -6641,27 +6678,268 @@
6641
6678
  "notNull": true,
6642
6679
  "default": "gen_random_uuid()"
6643
6680
  },
6644
- "name": {
6645
- "name": "name",
6646
- "type": "varchar(100)",
6681
+ "instance_id": {
6682
+ "name": "instance_id",
6683
+ "type": "uuid",
6647
6684
  "primaryKey": false,
6648
6685
  "notNull": true
6649
6686
  },
6650
- "description": {
6651
- "name": "description",
6687
+ "chat_id": {
6688
+ "name": "chat_id",
6652
6689
  "type": "text",
6653
6690
  "primaryKey": false,
6654
- "notNull": false
6691
+ "notNull": true
6655
6692
  },
6656
- "expected_headers": {
6657
- "name": "expected_headers",
6658
- "type": "jsonb",
6693
+ "message_id": {
6694
+ "name": "message_id",
6695
+ "type": "text",
6659
6696
  "primaryKey": false,
6660
- "notNull": false
6697
+ "notNull": true
6661
6698
  },
6662
- "enabled": {
6663
- "name": "enabled",
6664
- "type": "boolean",
6699
+ "agent_id": {
6700
+ "name": "agent_id",
6701
+ "type": "uuid",
6702
+ "primaryKey": false,
6703
+ "notNull": true
6704
+ },
6705
+ "api_key_id": {
6706
+ "name": "api_key_id",
6707
+ "type": "uuid",
6708
+ "primaryKey": false,
6709
+ "notNull": true
6710
+ },
6711
+ "status": {
6712
+ "name": "status",
6713
+ "type": "varchar(20)",
6714
+ "primaryKey": false,
6715
+ "notNull": true,
6716
+ "default": "'open'"
6717
+ },
6718
+ "action": {
6719
+ "name": "action",
6720
+ "type": "varchar(20)",
6721
+ "primaryKey": false,
6722
+ "notNull": false
6723
+ },
6724
+ "nudge_count": {
6725
+ "name": "nudge_count",
6726
+ "type": "integer",
6727
+ "primaryKey": false,
6728
+ "notNull": true,
6729
+ "default": 0
6730
+ },
6731
+ "messages_sent": {
6732
+ "name": "messages_sent",
6733
+ "type": "integer",
6734
+ "primaryKey": false,
6735
+ "notNull": true,
6736
+ "default": 0
6737
+ },
6738
+ "started_at": {
6739
+ "name": "started_at",
6740
+ "type": "timestamp",
6741
+ "primaryKey": false,
6742
+ "notNull": true,
6743
+ "default": "now()"
6744
+ },
6745
+ "last_activity_at": {
6746
+ "name": "last_activity_at",
6747
+ "type": "timestamp",
6748
+ "primaryKey": false,
6749
+ "notNull": true,
6750
+ "default": "now()"
6751
+ },
6752
+ "closed_at": {
6753
+ "name": "closed_at",
6754
+ "type": "timestamp",
6755
+ "primaryKey": false,
6756
+ "notNull": false
6757
+ },
6758
+ "closed_reason": {
6759
+ "name": "closed_reason",
6760
+ "type": "text",
6761
+ "primaryKey": false,
6762
+ "notNull": false
6763
+ },
6764
+ "metadata": {
6765
+ "name": "metadata",
6766
+ "type": "jsonb",
6767
+ "primaryKey": false,
6768
+ "notNull": false
6769
+ }
6770
+ },
6771
+ "indexes": {
6772
+ "turns_instance_chat_idx": {
6773
+ "name": "turns_instance_chat_idx",
6774
+ "columns": [
6775
+ {
6776
+ "expression": "instance_id",
6777
+ "isExpression": false,
6778
+ "asc": true,
6779
+ "nulls": "last"
6780
+ },
6781
+ {
6782
+ "expression": "chat_id",
6783
+ "isExpression": false,
6784
+ "asc": true,
6785
+ "nulls": "last"
6786
+ }
6787
+ ],
6788
+ "isUnique": false,
6789
+ "with": {},
6790
+ "method": "btree",
6791
+ "concurrently": false
6792
+ },
6793
+ "turns_status_idx": {
6794
+ "name": "turns_status_idx",
6795
+ "columns": [
6796
+ {
6797
+ "expression": "status",
6798
+ "isExpression": false,
6799
+ "asc": true,
6800
+ "nulls": "last"
6801
+ }
6802
+ ],
6803
+ "isUnique": false,
6804
+ "with": {},
6805
+ "method": "btree",
6806
+ "concurrently": false
6807
+ },
6808
+ "turns_api_key_idx": {
6809
+ "name": "turns_api_key_idx",
6810
+ "columns": [
6811
+ {
6812
+ "expression": "api_key_id",
6813
+ "isExpression": false,
6814
+ "asc": true,
6815
+ "nulls": "last"
6816
+ }
6817
+ ],
6818
+ "isUnique": false,
6819
+ "with": {},
6820
+ "method": "btree",
6821
+ "concurrently": false
6822
+ },
6823
+ "turns_agent_idx": {
6824
+ "name": "turns_agent_idx",
6825
+ "columns": [
6826
+ {
6827
+ "expression": "agent_id",
6828
+ "isExpression": false,
6829
+ "asc": true,
6830
+ "nulls": "last"
6831
+ }
6832
+ ],
6833
+ "isUnique": false,
6834
+ "with": {},
6835
+ "method": "btree",
6836
+ "concurrently": false
6837
+ },
6838
+ "turns_last_activity_idx": {
6839
+ "name": "turns_last_activity_idx",
6840
+ "columns": [
6841
+ {
6842
+ "expression": "last_activity_at",
6843
+ "isExpression": false,
6844
+ "asc": true,
6845
+ "nulls": "last"
6846
+ }
6847
+ ],
6848
+ "isUnique": false,
6849
+ "with": {},
6850
+ "method": "btree",
6851
+ "concurrently": false
6852
+ },
6853
+ "turns_open_idx": {
6854
+ "name": "turns_open_idx",
6855
+ "columns": [
6856
+ {
6857
+ "expression": "status",
6858
+ "isExpression": false,
6859
+ "asc": true,
6860
+ "nulls": "last"
6861
+ },
6862
+ {
6863
+ "expression": "last_activity_at",
6864
+ "isExpression": false,
6865
+ "asc": true,
6866
+ "nulls": "last"
6867
+ }
6868
+ ],
6869
+ "isUnique": false,
6870
+ "with": {},
6871
+ "method": "btree",
6872
+ "where": "\"turns\".\"status\" = 'open'",
6873
+ "concurrently": false
6874
+ }
6875
+ },
6876
+ "foreignKeys": {
6877
+ "turns_instance_id_instances_id_fk": {
6878
+ "name": "turns_instance_id_instances_id_fk",
6879
+ "tableFrom": "turns",
6880
+ "columnsFrom": ["instance_id"],
6881
+ "tableTo": "instances",
6882
+ "columnsTo": ["id"],
6883
+ "onUpdate": "no action",
6884
+ "onDelete": "cascade"
6885
+ },
6886
+ "turns_agent_id_agents_id_fk": {
6887
+ "name": "turns_agent_id_agents_id_fk",
6888
+ "tableFrom": "turns",
6889
+ "columnsFrom": ["agent_id"],
6890
+ "tableTo": "agents",
6891
+ "columnsTo": ["id"],
6892
+ "onUpdate": "no action",
6893
+ "onDelete": "cascade"
6894
+ },
6895
+ "turns_api_key_id_api_keys_id_fk": {
6896
+ "name": "turns_api_key_id_api_keys_id_fk",
6897
+ "tableFrom": "turns",
6898
+ "columnsFrom": ["api_key_id"],
6899
+ "tableTo": "api_keys",
6900
+ "columnsTo": ["id"],
6901
+ "onUpdate": "no action",
6902
+ "onDelete": "cascade"
6903
+ }
6904
+ },
6905
+ "compositePrimaryKeys": {},
6906
+ "uniqueConstraints": {},
6907
+ "policies": {},
6908
+ "checkConstraints": {},
6909
+ "isRLSEnabled": false
6910
+ },
6911
+ "public.webhook_sources": {
6912
+ "name": "webhook_sources",
6913
+ "schema": "",
6914
+ "columns": {
6915
+ "id": {
6916
+ "name": "id",
6917
+ "type": "uuid",
6918
+ "primaryKey": true,
6919
+ "notNull": true,
6920
+ "default": "gen_random_uuid()"
6921
+ },
6922
+ "name": {
6923
+ "name": "name",
6924
+ "type": "varchar(100)",
6925
+ "primaryKey": false,
6926
+ "notNull": true
6927
+ },
6928
+ "description": {
6929
+ "name": "description",
6930
+ "type": "text",
6931
+ "primaryKey": false,
6932
+ "notNull": false
6933
+ },
6934
+ "expected_headers": {
6935
+ "name": "expected_headers",
6936
+ "type": "jsonb",
6937
+ "primaryKey": false,
6938
+ "notNull": false
6939
+ },
6940
+ "enabled": {
6941
+ "name": "enabled",
6942
+ "type": "boolean",
6665
6943
  "primaryKey": false,
6666
6944
  "notNull": true,
6667
6945
  "default": true
@@ -6706,9 +6984,9 @@
6706
6984
  }
6707
6985
  ],
6708
6986
  "isUnique": true,
6709
- "concurrently": false,
6987
+ "with": {},
6710
6988
  "method": "btree",
6711
- "with": {}
6989
+ "concurrently": false
6712
6990
  },
6713
6991
  "webhook_sources_enabled_idx": {
6714
6992
  "name": "webhook_sources_enabled_idx",
@@ -6721,9 +6999,9 @@
6721
6999
  }
6722
7000
  ],
6723
7001
  "isUnique": false,
6724
- "concurrently": false,
7002
+ "with": {},
6725
7003
  "method": "btree",
6726
- "with": {}
7004
+ "concurrently": false
6727
7005
  }
6728
7006
  },
6729
7007
  "foreignKeys": {},
@@ -6731,21 +7009,217 @@
6731
7009
  "uniqueConstraints": {
6732
7010
  "webhook_sources_name_unique": {
6733
7011
  "name": "webhook_sources_name_unique",
6734
- "nullsNotDistinct": false,
6735
- "columns": ["name"]
7012
+ "columns": ["name"],
7013
+ "nullsNotDistinct": false
6736
7014
  }
6737
7015
  },
6738
7016
  "policies": {},
6739
7017
  "checkConstraints": {},
6740
7018
  "isRLSEnabled": false
7019
+ },
7020
+ "public.chat_follow_up_state": {
7021
+ "name": "chat_follow_up_state",
7022
+ "schema": "",
7023
+ "columns": {
7024
+ "id": {
7025
+ "name": "id",
7026
+ "type": "uuid",
7027
+ "primaryKey": true,
7028
+ "notNull": true,
7029
+ "default": "gen_random_uuid()"
7030
+ },
7031
+ "chat_id": {
7032
+ "name": "chat_id",
7033
+ "type": "uuid",
7034
+ "primaryKey": false,
7035
+ "notNull": true
7036
+ },
7037
+ "instance_id": {
7038
+ "name": "instance_id",
7039
+ "type": "uuid",
7040
+ "primaryKey": false,
7041
+ "notNull": true
7042
+ },
7043
+ "agent_id": {
7044
+ "name": "agent_id",
7045
+ "type": "uuid",
7046
+ "primaryKey": false,
7047
+ "notNull": false
7048
+ },
7049
+ "sequence_config": {
7050
+ "name": "sequence_config",
7051
+ "type": "jsonb",
7052
+ "primaryKey": false,
7053
+ "notNull": true
7054
+ },
7055
+ "sequence_index": {
7056
+ "name": "sequence_index",
7057
+ "type": "integer",
7058
+ "primaryKey": false,
7059
+ "notNull": true,
7060
+ "default": 0
7061
+ },
7062
+ "last_agent_message_at": {
7063
+ "name": "last_agent_message_at",
7064
+ "type": "timestamp with time zone",
7065
+ "primaryKey": false,
7066
+ "notNull": true
7067
+ },
7068
+ "last_inbound_customer_message_at": {
7069
+ "name": "last_inbound_customer_message_at",
7070
+ "type": "timestamp with time zone",
7071
+ "primaryKey": false,
7072
+ "notNull": false
7073
+ },
7074
+ "next_fire_at": {
7075
+ "name": "next_fire_at",
7076
+ "type": "timestamp with time zone",
7077
+ "primaryKey": false,
7078
+ "notNull": false
7079
+ },
7080
+ "disarm_reason": {
7081
+ "name": "disarm_reason",
7082
+ "type": "varchar(32)",
7083
+ "primaryKey": false,
7084
+ "notNull": false
7085
+ },
7086
+ "disarmed_at": {
7087
+ "name": "disarmed_at",
7088
+ "type": "timestamp with time zone",
7089
+ "primaryKey": false,
7090
+ "notNull": false
7091
+ },
7092
+ "created_at": {
7093
+ "name": "created_at",
7094
+ "type": "timestamp with time zone",
7095
+ "primaryKey": false,
7096
+ "notNull": true,
7097
+ "default": "now()"
7098
+ },
7099
+ "updated_at": {
7100
+ "name": "updated_at",
7101
+ "type": "timestamp with time zone",
7102
+ "primaryKey": false,
7103
+ "notNull": true,
7104
+ "default": "now()"
7105
+ }
7106
+ },
7107
+ "indexes": {
7108
+ "chat_follow_up_state_sweeper_idx": {
7109
+ "name": "chat_follow_up_state_sweeper_idx",
7110
+ "columns": [
7111
+ {
7112
+ "expression": "next_fire_at",
7113
+ "isExpression": false,
7114
+ "asc": true,
7115
+ "nulls": "last"
7116
+ },
7117
+ {
7118
+ "expression": "disarm_reason",
7119
+ "isExpression": false,
7120
+ "asc": true,
7121
+ "nulls": "last"
7122
+ }
7123
+ ],
7124
+ "isUnique": false,
7125
+ "concurrently": false,
7126
+ "method": "btree",
7127
+ "with": {}
7128
+ },
7129
+ "chat_follow_up_state_chat_instance_unique": {
7130
+ "name": "chat_follow_up_state_chat_instance_unique",
7131
+ "columns": [
7132
+ {
7133
+ "expression": "chat_id",
7134
+ "isExpression": false,
7135
+ "asc": true,
7136
+ "nulls": "last"
7137
+ },
7138
+ {
7139
+ "expression": "instance_id",
7140
+ "isExpression": false,
7141
+ "asc": true,
7142
+ "nulls": "last"
7143
+ }
7144
+ ],
7145
+ "isUnique": true,
7146
+ "concurrently": false,
7147
+ "method": "btree",
7148
+ "with": {}
7149
+ },
7150
+ "chat_follow_up_state_chat_idx": {
7151
+ "name": "chat_follow_up_state_chat_idx",
7152
+ "columns": [
7153
+ {
7154
+ "expression": "chat_id",
7155
+ "isExpression": false,
7156
+ "asc": true,
7157
+ "nulls": "last"
7158
+ }
7159
+ ],
7160
+ "isUnique": false,
7161
+ "concurrently": false,
7162
+ "method": "btree",
7163
+ "with": {}
7164
+ },
7165
+ "chat_follow_up_state_instance_idx": {
7166
+ "name": "chat_follow_up_state_instance_idx",
7167
+ "columns": [
7168
+ {
7169
+ "expression": "instance_id",
7170
+ "isExpression": false,
7171
+ "asc": true,
7172
+ "nulls": "last"
7173
+ }
7174
+ ],
7175
+ "isUnique": false,
7176
+ "concurrently": false,
7177
+ "method": "btree",
7178
+ "with": {}
7179
+ }
7180
+ },
7181
+ "foreignKeys": {
7182
+ "chat_follow_up_state_chat_id_chats_id_fk": {
7183
+ "name": "chat_follow_up_state_chat_id_chats_id_fk",
7184
+ "tableFrom": "chat_follow_up_state",
7185
+ "tableTo": "chats",
7186
+ "columnsFrom": ["chat_id"],
7187
+ "columnsTo": ["id"],
7188
+ "onDelete": "cascade",
7189
+ "onUpdate": "no action"
7190
+ },
7191
+ "chat_follow_up_state_instance_id_instances_id_fk": {
7192
+ "name": "chat_follow_up_state_instance_id_instances_id_fk",
7193
+ "tableFrom": "chat_follow_up_state",
7194
+ "tableTo": "instances",
7195
+ "columnsFrom": ["instance_id"],
7196
+ "columnsTo": ["id"],
7197
+ "onDelete": "cascade",
7198
+ "onUpdate": "no action"
7199
+ },
7200
+ "chat_follow_up_state_agent_id_agents_id_fk": {
7201
+ "name": "chat_follow_up_state_agent_id_agents_id_fk",
7202
+ "tableFrom": "chat_follow_up_state",
7203
+ "tableTo": "agents",
7204
+ "columnsFrom": ["agent_id"],
7205
+ "columnsTo": ["id"],
7206
+ "onDelete": "set null",
7207
+ "onUpdate": "no action"
7208
+ }
7209
+ },
7210
+ "compositePrimaryKeys": {},
7211
+ "uniqueConstraints": {},
7212
+ "policies": {},
7213
+ "checkConstraints": {},
7214
+ "isRLSEnabled": false
6741
7215
  }
6742
7216
  },
6743
7217
  "enums": {},
6744
7218
  "schemas": {},
7219
+ "views": {},
6745
7220
  "sequences": {},
6746
7221
  "roles": {},
6747
7222
  "policies": {},
6748
- "views": {},
6749
7223
  "_meta": {
6750
7224
  "columns": {},
6751
7225
  "schemas": {},