@happyvertical/smrt-chat 0.49.2 → 0.49.4

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.
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-chat",
5
- "packageVersion": "0.49.2",
5
+ "packageVersion": "0.49.4",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-chat:AgentSessionCollection": {
8
8
  "name": "agentsessioncollection",
@@ -138,7 +138,7 @@
138
138
  "collectionExportName": "AgentSessionCollectionCollection",
139
139
  "schema": {
140
140
  "tableName": "agent_sessions",
141
- "ddl": "CREATE TABLE IF NOT EXISTS \"agent_sessions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
141
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agent_sessions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"agent_id\" TEXT NOT NULL DEFAULT '',\n \"participant_profile_id\" UUID NOT NULL,\n \"chat_room_id\" UUID,\n \"status\" TEXT NOT NULL DEFAULT 'active',\n \"allowed_tools\" TEXT DEFAULT '[]',\n \"session_context\" TEXT DEFAULT '{}',\n \"system_prompt\" TEXT DEFAULT '',\n \"message_count\" INTEGER DEFAULT 0,\n \"total_tokens_used\" INTEGER DEFAULT 0,\n \"max_tokens\" INTEGER DEFAULT 0,\n \"max_messages\" INTEGER DEFAULT 0,\n \"last_message_at\" TIMESTAMP,\n \"expires_at\" TIMESTAMP,\n \"closed_at\" TIMESTAMP\n);",
142
142
  "columns": {
143
143
  "id": {
144
144
  "type": "UUID",
@@ -164,25 +164,133 @@
164
164
  "type": "TIMESTAMP",
165
165
  "notNull": true,
166
166
  "default": "current_timestamp"
167
+ },
168
+ "tenant_id": {
169
+ "type": "UUID",
170
+ "referenceKind": "tenantId",
171
+ "notNull": false,
172
+ "unique": false
173
+ },
174
+ "agent_id": {
175
+ "type": "TEXT",
176
+ "notNull": true,
177
+ "unique": false,
178
+ "default": ""
179
+ },
180
+ "participant_profile_id": {
181
+ "type": "UUID",
182
+ "referenceKind": "crossPackageRef",
183
+ "notNull": true,
184
+ "unique": false
185
+ },
186
+ "chat_room_id": {
187
+ "type": "UUID",
188
+ "referenceKind": "foreignKey",
189
+ "notNull": false,
190
+ "unique": false,
191
+ "foreignKey": {
192
+ "table": "chat_rooms",
193
+ "column": "id",
194
+ "onDelete": "NO ACTION",
195
+ "onUpdate": "CASCADE"
196
+ }
197
+ },
198
+ "status": {
199
+ "type": "TEXT",
200
+ "notNull": true,
201
+ "unique": false,
202
+ "default": "active"
203
+ },
204
+ "allowed_tools": {
205
+ "type": "TEXT",
206
+ "notNull": false,
207
+ "unique": false,
208
+ "default": "[]"
209
+ },
210
+ "session_context": {
211
+ "type": "TEXT",
212
+ "notNull": false,
213
+ "unique": false,
214
+ "default": "{}"
215
+ },
216
+ "system_prompt": {
217
+ "type": "TEXT",
218
+ "notNull": false,
219
+ "unique": false,
220
+ "default": ""
221
+ },
222
+ "message_count": {
223
+ "type": "INTEGER",
224
+ "notNull": false,
225
+ "unique": false,
226
+ "default": 0
227
+ },
228
+ "total_tokens_used": {
229
+ "type": "INTEGER",
230
+ "notNull": false,
231
+ "unique": false,
232
+ "default": 0
233
+ },
234
+ "max_tokens": {
235
+ "type": "INTEGER",
236
+ "notNull": false,
237
+ "unique": false,
238
+ "default": 0
239
+ },
240
+ "max_messages": {
241
+ "type": "INTEGER",
242
+ "notNull": false,
243
+ "unique": false,
244
+ "default": 0
245
+ },
246
+ "last_message_at": {
247
+ "type": "TIMESTAMP",
248
+ "notNull": false,
249
+ "unique": false
250
+ },
251
+ "expires_at": {
252
+ "type": "TIMESTAMP",
253
+ "notNull": false,
254
+ "unique": false
255
+ },
256
+ "closed_at": {
257
+ "type": "TIMESTAMP",
258
+ "notNull": false,
259
+ "unique": false
167
260
  }
168
261
  },
169
262
  "indexes": [
170
263
  {
171
264
  "name": "agent_sessions_slug_context_idx",
172
265
  "columns": [
266
+ "tenant_id",
173
267
  "slug",
174
268
  "context"
175
269
  ],
176
- "unique": true
270
+ "unique": true,
271
+ "nullsNotDistinct": true
177
272
  },
178
273
  {
179
- "name": "agent_sessions_created_at_idx",
274
+ "name": "agent_sessions_tenant_id_created_at_idx",
180
275
  "columns": [
276
+ "tenant_id",
181
277
  "created_at"
182
278
  ]
279
+ },
280
+ {
281
+ "name": "agent_sessions_participant_profile_id_idx",
282
+ "columns": [
283
+ "participant_profile_id"
284
+ ]
285
+ },
286
+ {
287
+ "name": "agent_sessions_chat_room_id_idx",
288
+ "columns": [
289
+ "chat_room_id"
290
+ ]
183
291
  }
184
292
  ],
185
- "version": "e5de0db6"
293
+ "version": "43eaea36"
186
294
  }
187
295
  },
188
296
  "@happyvertical/smrt-chat:ChatMessageCollection": {
@@ -336,7 +444,7 @@
336
444
  "collectionExportName": "ChatMessageCollectionCollection",
337
445
  "schema": {
338
446
  "tableName": "chat_messages",
339
- "ddl": "CREATE TABLE IF NOT EXISTS \"chat_messages\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
447
+ "ddl": "CREATE TABLE IF NOT EXISTS \"chat_messages\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"room_id\" UUID NOT NULL,\n \"thread_id\" UUID,\n \"sender_profile_id\" UUID NOT NULL,\n \"agent_session_id\" UUID,\n \"content\" TEXT DEFAULT '',\n \"message_type\" TEXT NOT NULL DEFAULT 'text',\n \"role\" TEXT NOT NULL DEFAULT 'user',\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"edited_at\" TIMESTAMP,\n \"is_deleted\" BOOLEAN DEFAULT FALSE,\n \"reply_to_message_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}',\n \"tool_call_data\" TEXT,\n \"attachments\" TEXT DEFAULT '[]'\n);",
340
448
  "columns": {
341
449
  "id": {
342
450
  "type": "UUID",
@@ -362,25 +470,169 @@
362
470
  "type": "TIMESTAMP",
363
471
  "notNull": true,
364
472
  "default": "current_timestamp"
473
+ },
474
+ "tenant_id": {
475
+ "type": "UUID",
476
+ "referenceKind": "tenantId",
477
+ "notNull": true,
478
+ "unique": false
479
+ },
480
+ "room_id": {
481
+ "type": "UUID",
482
+ "referenceKind": "foreignKey",
483
+ "notNull": true,
484
+ "unique": false,
485
+ "foreignKey": {
486
+ "table": "chat_rooms",
487
+ "column": "id",
488
+ "onDelete": "NO ACTION",
489
+ "onUpdate": "CASCADE"
490
+ }
491
+ },
492
+ "thread_id": {
493
+ "type": "UUID",
494
+ "referenceKind": "foreignKey",
495
+ "notNull": false,
496
+ "unique": false,
497
+ "foreignKey": {
498
+ "table": "chat_threads",
499
+ "column": "id",
500
+ "onDelete": "NO ACTION",
501
+ "onUpdate": "CASCADE"
502
+ }
503
+ },
504
+ "sender_profile_id": {
505
+ "type": "UUID",
506
+ "referenceKind": "crossPackageRef",
507
+ "notNull": true,
508
+ "unique": false
509
+ },
510
+ "agent_session_id": {
511
+ "type": "UUID",
512
+ "referenceKind": "foreignKey",
513
+ "notNull": false,
514
+ "unique": false,
515
+ "foreignKey": {
516
+ "table": "agent_sessions",
517
+ "column": "id",
518
+ "onDelete": "NO ACTION",
519
+ "onUpdate": "CASCADE"
520
+ }
521
+ },
522
+ "content": {
523
+ "type": "TEXT",
524
+ "notNull": false,
525
+ "unique": false,
526
+ "default": ""
527
+ },
528
+ "message_type": {
529
+ "type": "TEXT",
530
+ "notNull": true,
531
+ "unique": false,
532
+ "default": "text"
533
+ },
534
+ "role": {
535
+ "type": "TEXT",
536
+ "notNull": true,
537
+ "unique": false,
538
+ "default": "user"
539
+ },
540
+ "is_edited": {
541
+ "type": "BOOLEAN",
542
+ "notNull": false,
543
+ "unique": false,
544
+ "default": false
545
+ },
546
+ "edited_at": {
547
+ "type": "TIMESTAMP",
548
+ "notNull": false,
549
+ "unique": false
550
+ },
551
+ "is_deleted": {
552
+ "type": "BOOLEAN",
553
+ "notNull": false,
554
+ "unique": false,
555
+ "default": false
556
+ },
557
+ "reply_to_message_id": {
558
+ "type": "UUID",
559
+ "referenceKind": "foreignKey",
560
+ "notNull": false,
561
+ "unique": false,
562
+ "foreignKey": {
563
+ "table": "chat_messages",
564
+ "column": "id",
565
+ "onDelete": "NO ACTION",
566
+ "onUpdate": "CASCADE"
567
+ }
568
+ },
569
+ "metadata": {
570
+ "type": "TEXT",
571
+ "notNull": false,
572
+ "unique": false,
573
+ "default": "{}"
574
+ },
575
+ "tool_call_data": {
576
+ "type": "TEXT",
577
+ "notNull": false,
578
+ "unique": false
579
+ },
580
+ "attachments": {
581
+ "type": "TEXT",
582
+ "notNull": false,
583
+ "unique": false,
584
+ "default": "[]"
365
585
  }
366
586
  },
367
587
  "indexes": [
368
588
  {
369
589
  "name": "chat_messages_slug_context_idx",
370
590
  "columns": [
591
+ "tenant_id",
371
592
  "slug",
372
593
  "context"
373
594
  ],
374
595
  "unique": true
375
596
  },
376
597
  {
377
- "name": "chat_messages_created_at_idx",
598
+ "name": "chat_messages_tenant_id_created_at_idx",
378
599
  "columns": [
600
+ "tenant_id",
379
601
  "created_at"
380
602
  ]
603
+ },
604
+ {
605
+ "name": "chat_messages_room_id_idx",
606
+ "columns": [
607
+ "room_id"
608
+ ]
609
+ },
610
+ {
611
+ "name": "chat_messages_thread_id_idx",
612
+ "columns": [
613
+ "thread_id"
614
+ ]
615
+ },
616
+ {
617
+ "name": "chat_messages_sender_profile_id_idx",
618
+ "columns": [
619
+ "sender_profile_id"
620
+ ]
621
+ },
622
+ {
623
+ "name": "chat_messages_agent_session_id_idx",
624
+ "columns": [
625
+ "agent_session_id"
626
+ ]
627
+ },
628
+ {
629
+ "name": "chat_messages_reply_to_message_id_idx",
630
+ "columns": [
631
+ "reply_to_message_id"
632
+ ]
381
633
  }
382
634
  ],
383
- "version": "13b2dccb"
635
+ "version": "cca14e75"
384
636
  }
385
637
  },
386
638
  "@happyvertical/smrt-chat:ChatParticipantCollection": {
@@ -544,7 +796,7 @@
544
796
  "collectionExportName": "ChatParticipantCollectionCollection",
545
797
  "schema": {
546
798
  "tableName": "chat_participants",
547
- "ddl": "CREATE TABLE IF NOT EXISTS \"chat_participants\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
799
+ "ddl": "CREATE TABLE IF NOT EXISTS \"chat_participants\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"room_id\" UUID NOT NULL,\n \"profile_id\" UUID NOT NULL,\n \"role\" TEXT NOT NULL DEFAULT 'member',\n \"status\" TEXT NOT NULL DEFAULT 'active',\n \"online_status\" TEXT NOT NULL DEFAULT 'offline',\n \"last_read_message_id\" UUID,\n \"last_seen_at\" TIMESTAMP,\n \"joined_at\" TIMESTAMP,\n \"nickname\" TEXT DEFAULT '',\n \"is_muted\" BOOLEAN DEFAULT FALSE,\n \"is_pinned\" BOOLEAN DEFAULT FALSE\n);",
548
800
  "columns": {
549
801
  "id": {
550
802
  "type": "UUID",
@@ -554,41 +806,143 @@
554
806
  },
555
807
  "slug": {
556
808
  "type": "TEXT",
557
- "notNull": true
809
+ "notNull": true
810
+ },
811
+ "context": {
812
+ "type": "TEXT",
813
+ "notNull": true,
814
+ "default": ""
815
+ },
816
+ "created_at": {
817
+ "type": "TIMESTAMP",
818
+ "notNull": true,
819
+ "default": "current_timestamp"
820
+ },
821
+ "updated_at": {
822
+ "type": "TIMESTAMP",
823
+ "notNull": true,
824
+ "default": "current_timestamp"
825
+ },
826
+ "tenant_id": {
827
+ "type": "UUID",
828
+ "referenceKind": "tenantId",
829
+ "notNull": true,
830
+ "unique": false
831
+ },
832
+ "room_id": {
833
+ "type": "UUID",
834
+ "referenceKind": "foreignKey",
835
+ "notNull": true,
836
+ "unique": false,
837
+ "foreignKey": {
838
+ "table": "chat_rooms",
839
+ "column": "id",
840
+ "onDelete": "NO ACTION",
841
+ "onUpdate": "CASCADE"
842
+ }
843
+ },
844
+ "profile_id": {
845
+ "type": "UUID",
846
+ "referenceKind": "crossPackageRef",
847
+ "notNull": true,
848
+ "unique": false
849
+ },
850
+ "role": {
851
+ "type": "TEXT",
852
+ "notNull": true,
853
+ "unique": false,
854
+ "default": "member"
855
+ },
856
+ "status": {
857
+ "type": "TEXT",
858
+ "notNull": true,
859
+ "unique": false,
860
+ "default": "active"
558
861
  },
559
- "context": {
862
+ "online_status": {
560
863
  "type": "TEXT",
561
864
  "notNull": true,
562
- "default": ""
865
+ "unique": false,
866
+ "default": "offline"
563
867
  },
564
- "created_at": {
868
+ "last_read_message_id": {
869
+ "type": "UUID",
870
+ "referenceKind": "foreignKey",
871
+ "notNull": false,
872
+ "unique": false,
873
+ "foreignKey": {
874
+ "table": "chat_messages",
875
+ "column": "id",
876
+ "onDelete": "NO ACTION",
877
+ "onUpdate": "CASCADE"
878
+ }
879
+ },
880
+ "last_seen_at": {
565
881
  "type": "TIMESTAMP",
566
- "notNull": true,
567
- "default": "current_timestamp"
882
+ "notNull": false,
883
+ "unique": false
568
884
  },
569
- "updated_at": {
885
+ "joined_at": {
570
886
  "type": "TIMESTAMP",
571
- "notNull": true,
572
- "default": "current_timestamp"
887
+ "notNull": false,
888
+ "unique": false
889
+ },
890
+ "nickname": {
891
+ "type": "TEXT",
892
+ "notNull": false,
893
+ "unique": false,
894
+ "default": ""
895
+ },
896
+ "is_muted": {
897
+ "type": "BOOLEAN",
898
+ "notNull": false,
899
+ "unique": false,
900
+ "default": false
901
+ },
902
+ "is_pinned": {
903
+ "type": "BOOLEAN",
904
+ "notNull": false,
905
+ "unique": false,
906
+ "default": false
573
907
  }
574
908
  },
575
909
  "indexes": [
576
910
  {
577
911
  "name": "chat_participants_slug_context_idx",
578
912
  "columns": [
913
+ "tenant_id",
579
914
  "slug",
580
915
  "context"
581
916
  ],
582
917
  "unique": true
583
918
  },
584
919
  {
585
- "name": "chat_participants_created_at_idx",
920
+ "name": "chat_participants_tenant_id_created_at_idx",
586
921
  "columns": [
922
+ "tenant_id",
587
923
  "created_at"
588
924
  ]
925
+ },
926
+ {
927
+ "name": "chat_participants_room_id_idx",
928
+ "columns": [
929
+ "room_id"
930
+ ]
931
+ },
932
+ {
933
+ "name": "chat_participants_profile_id_idx",
934
+ "columns": [
935
+ "profile_id"
936
+ ]
937
+ },
938
+ {
939
+ "name": "chat_participants_last_read_message_id_idx",
940
+ "columns": [
941
+ "last_read_message_id"
942
+ ]
589
943
  }
590
944
  ],
591
- "version": "f70abec0"
945
+ "version": "07714046"
592
946
  }
593
947
  },
594
948
  "@happyvertical/smrt-chat:ChatReactionCollection": {
@@ -668,7 +1022,7 @@
668
1022
  "collectionExportName": "ChatReactionCollectionCollection",
669
1023
  "schema": {
670
1024
  "tableName": "chat_reactions",
671
- "ddl": "CREATE TABLE IF NOT EXISTS \"chat_reactions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1025
+ "ddl": "CREATE TABLE IF NOT EXISTS \"chat_reactions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"message_id\" UUID NOT NULL,\n \"profile_id\" UUID NOT NULL,\n \"emoji\" TEXT NOT NULL DEFAULT ''\n);",
672
1026
  "columns": {
673
1027
  "id": {
674
1028
  "type": "UUID",
@@ -694,25 +1048,69 @@
694
1048
  "type": "TIMESTAMP",
695
1049
  "notNull": true,
696
1050
  "default": "current_timestamp"
1051
+ },
1052
+ "tenant_id": {
1053
+ "type": "UUID",
1054
+ "referenceKind": "tenantId",
1055
+ "notNull": true,
1056
+ "unique": false
1057
+ },
1058
+ "message_id": {
1059
+ "type": "UUID",
1060
+ "referenceKind": "foreignKey",
1061
+ "notNull": true,
1062
+ "unique": false,
1063
+ "foreignKey": {
1064
+ "table": "chat_messages",
1065
+ "column": "id",
1066
+ "onDelete": "NO ACTION",
1067
+ "onUpdate": "CASCADE"
1068
+ }
1069
+ },
1070
+ "profile_id": {
1071
+ "type": "UUID",
1072
+ "referenceKind": "crossPackageRef",
1073
+ "notNull": true,
1074
+ "unique": false
1075
+ },
1076
+ "emoji": {
1077
+ "type": "TEXT",
1078
+ "notNull": true,
1079
+ "unique": false,
1080
+ "default": ""
697
1081
  }
698
1082
  },
699
1083
  "indexes": [
700
1084
  {
701
1085
  "name": "chat_reactions_slug_context_idx",
702
1086
  "columns": [
1087
+ "tenant_id",
703
1088
  "slug",
704
1089
  "context"
705
1090
  ],
706
1091
  "unique": true
707
1092
  },
708
1093
  {
709
- "name": "chat_reactions_created_at_idx",
1094
+ "name": "chat_reactions_tenant_id_created_at_idx",
710
1095
  "columns": [
1096
+ "tenant_id",
711
1097
  "created_at"
712
1098
  ]
1099
+ },
1100
+ {
1101
+ "name": "chat_reactions_message_id_idx",
1102
+ "columns": [
1103
+ "message_id"
1104
+ ]
1105
+ },
1106
+ {
1107
+ "name": "chat_reactions_profile_id_idx",
1108
+ "columns": [
1109
+ "profile_id"
1110
+ ]
713
1111
  }
714
1112
  ],
715
- "version": "0ea62683"
1113
+ "version": "5b1969a6"
716
1114
  }
717
1115
  },
718
1116
  "@happyvertical/smrt-chat:ChatRoomCollection": {
@@ -823,7 +1221,7 @@
823
1221
  "collectionExportName": "ChatRoomCollectionCollection",
824
1222
  "schema": {
825
1223
  "tableName": "chat_rooms",
826
- "ddl": "CREATE TABLE IF NOT EXISTS \"chat_rooms\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1224
+ "ddl": "CREATE TABLE IF NOT EXISTS \"chat_rooms\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"room_type\" TEXT NOT NULL DEFAULT 'public',\n \"status\" TEXT NOT NULL DEFAULT 'active',\n \"topic\" TEXT DEFAULT '',\n \"avatar_url\" TEXT DEFAULT '',\n \"is_archived\" BOOLEAN DEFAULT FALSE,\n \"max_participants\" INTEGER DEFAULT 0,\n \"metadata\" TEXT DEFAULT '{}',\n \"created_by_profile_id\" UUID,\n \"last_message_at\" TIMESTAMP\n);",
827
1225
  "columns": {
828
1226
  "id": {
829
1227
  "type": "UUID",
@@ -849,25 +1247,104 @@
849
1247
  "type": "TIMESTAMP",
850
1248
  "notNull": true,
851
1249
  "default": "current_timestamp"
1250
+ },
1251
+ "tenant_id": {
1252
+ "type": "UUID",
1253
+ "referenceKind": "tenantId",
1254
+ "notNull": true,
1255
+ "unique": false
1256
+ },
1257
+ "name": {
1258
+ "type": "TEXT",
1259
+ "notNull": false,
1260
+ "unique": false,
1261
+ "default": ""
1262
+ },
1263
+ "description": {
1264
+ "type": "TEXT",
1265
+ "notNull": false,
1266
+ "unique": false,
1267
+ "default": ""
1268
+ },
1269
+ "room_type": {
1270
+ "type": "TEXT",
1271
+ "notNull": true,
1272
+ "unique": false,
1273
+ "default": "public"
1274
+ },
1275
+ "status": {
1276
+ "type": "TEXT",
1277
+ "notNull": true,
1278
+ "unique": false,
1279
+ "default": "active"
1280
+ },
1281
+ "topic": {
1282
+ "type": "TEXT",
1283
+ "notNull": false,
1284
+ "unique": false,
1285
+ "default": ""
1286
+ },
1287
+ "avatar_url": {
1288
+ "type": "TEXT",
1289
+ "notNull": false,
1290
+ "unique": false,
1291
+ "default": ""
1292
+ },
1293
+ "is_archived": {
1294
+ "type": "BOOLEAN",
1295
+ "notNull": false,
1296
+ "unique": false,
1297
+ "default": false
1298
+ },
1299
+ "max_participants": {
1300
+ "type": "INTEGER",
1301
+ "notNull": false,
1302
+ "unique": false,
1303
+ "default": 0
1304
+ },
1305
+ "metadata": {
1306
+ "type": "TEXT",
1307
+ "notNull": false,
1308
+ "unique": false,
1309
+ "default": "{}"
1310
+ },
1311
+ "created_by_profile_id": {
1312
+ "type": "UUID",
1313
+ "referenceKind": "crossPackageRef",
1314
+ "notNull": false,
1315
+ "unique": false
1316
+ },
1317
+ "last_message_at": {
1318
+ "type": "TIMESTAMP",
1319
+ "notNull": false,
1320
+ "unique": false
852
1321
  }
853
1322
  },
854
1323
  "indexes": [
855
1324
  {
856
1325
  "name": "chat_rooms_slug_context_idx",
857
1326
  "columns": [
1327
+ "tenant_id",
858
1328
  "slug",
859
1329
  "context"
860
1330
  ],
861
1331
  "unique": true
862
1332
  },
863
1333
  {
864
- "name": "chat_rooms_created_at_idx",
1334
+ "name": "chat_rooms_tenant_id_created_at_idx",
865
1335
  "columns": [
1336
+ "tenant_id",
866
1337
  "created_at"
867
1338
  ]
1339
+ },
1340
+ {
1341
+ "name": "chat_rooms_created_by_profile_id_idx",
1342
+ "columns": [
1343
+ "created_by_profile_id"
1344
+ ]
868
1345
  }
869
1346
  ],
870
- "version": "40be4b86"
1347
+ "version": "3665d881"
871
1348
  }
872
1349
  },
873
1350
  "@happyvertical/smrt-chat:ChatThreadCollection": {
@@ -925,7 +1402,7 @@
925
1402
  "collectionExportName": "ChatThreadCollectionCollection",
926
1403
  "schema": {
927
1404
  "tableName": "chat_threads",
928
- "ddl": "CREATE TABLE IF NOT EXISTS \"chat_threads\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1405
+ "ddl": "CREATE TABLE IF NOT EXISTS \"chat_threads\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"room_id\" UUID NOT NULL,\n \"root_message_id\" UUID,\n \"title\" TEXT DEFAULT '',\n \"is_resolved\" BOOLEAN DEFAULT FALSE,\n \"message_count\" INTEGER DEFAULT 0,\n \"last_message_at\" TIMESTAMP,\n \"participant_count\" INTEGER DEFAULT 0\n);",
929
1406
  "columns": {
930
1407
  "id": {
931
1408
  "type": "UUID",
@@ -942,34 +1419,107 @@
942
1419
  "notNull": true,
943
1420
  "default": ""
944
1421
  },
945
- "created_at": {
1422
+ "created_at": {
1423
+ "type": "TIMESTAMP",
1424
+ "notNull": true,
1425
+ "default": "current_timestamp"
1426
+ },
1427
+ "updated_at": {
1428
+ "type": "TIMESTAMP",
1429
+ "notNull": true,
1430
+ "default": "current_timestamp"
1431
+ },
1432
+ "tenant_id": {
1433
+ "type": "UUID",
1434
+ "referenceKind": "tenantId",
1435
+ "notNull": true,
1436
+ "unique": false
1437
+ },
1438
+ "room_id": {
1439
+ "type": "UUID",
1440
+ "referenceKind": "foreignKey",
1441
+ "notNull": true,
1442
+ "unique": false,
1443
+ "foreignKey": {
1444
+ "table": "chat_rooms",
1445
+ "column": "id",
1446
+ "onDelete": "NO ACTION",
1447
+ "onUpdate": "CASCADE"
1448
+ }
1449
+ },
1450
+ "root_message_id": {
1451
+ "type": "UUID",
1452
+ "referenceKind": "foreignKey",
1453
+ "notNull": false,
1454
+ "unique": false,
1455
+ "foreignKey": {
1456
+ "table": "chat_messages",
1457
+ "column": "id",
1458
+ "onDelete": "NO ACTION",
1459
+ "onUpdate": "CASCADE"
1460
+ }
1461
+ },
1462
+ "title": {
1463
+ "type": "TEXT",
1464
+ "notNull": false,
1465
+ "unique": false,
1466
+ "default": ""
1467
+ },
1468
+ "is_resolved": {
1469
+ "type": "BOOLEAN",
1470
+ "notNull": false,
1471
+ "unique": false,
1472
+ "default": false
1473
+ },
1474
+ "message_count": {
1475
+ "type": "INTEGER",
1476
+ "notNull": false,
1477
+ "unique": false,
1478
+ "default": 0
1479
+ },
1480
+ "last_message_at": {
946
1481
  "type": "TIMESTAMP",
947
- "notNull": true,
948
- "default": "current_timestamp"
1482
+ "notNull": false,
1483
+ "unique": false
949
1484
  },
950
- "updated_at": {
951
- "type": "TIMESTAMP",
952
- "notNull": true,
953
- "default": "current_timestamp"
1485
+ "participant_count": {
1486
+ "type": "INTEGER",
1487
+ "notNull": false,
1488
+ "unique": false,
1489
+ "default": 0
954
1490
  }
955
1491
  },
956
1492
  "indexes": [
957
1493
  {
958
1494
  "name": "chat_threads_slug_context_idx",
959
1495
  "columns": [
1496
+ "tenant_id",
960
1497
  "slug",
961
1498
  "context"
962
1499
  ],
963
1500
  "unique": true
964
1501
  },
965
1502
  {
966
- "name": "chat_threads_created_at_idx",
1503
+ "name": "chat_threads_tenant_id_created_at_idx",
967
1504
  "columns": [
1505
+ "tenant_id",
968
1506
  "created_at"
969
1507
  ]
1508
+ },
1509
+ {
1510
+ "name": "chat_threads_room_id_idx",
1511
+ "columns": [
1512
+ "room_id"
1513
+ ]
1514
+ },
1515
+ {
1516
+ "name": "chat_threads_root_message_id_idx",
1517
+ "columns": [
1518
+ "root_message_id"
1519
+ ]
970
1520
  }
971
1521
  ],
972
- "version": "760b62bd"
1522
+ "version": "e1ae958b"
973
1523
  }
974
1524
  },
975
1525
  "@happyvertical/smrt-chat:VoiceGatewayTurnCollection": {
@@ -1009,7 +1559,7 @@
1009
1559
  "collectionExportName": "VoiceGatewayTurnCollectionCollection",
1010
1560
  "schema": {
1011
1561
  "tableName": "voice_gateway_turns",
1012
- "ddl": "CREATE TABLE IF NOT EXISTS \"voice_gateway_turns\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1562
+ "ddl": "CREATE TABLE IF NOT EXISTS \"voice_gateway_turns\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"voice_session_id\" UUID NOT NULL,\n \"gateway_session_id\" TEXT NOT NULL DEFAULT '',\n \"gateway_turn_id\" TEXT NOT NULL DEFAULT '',\n \"target\" TEXT NOT NULL DEFAULT 'smrt:chat',\n \"status\" TEXT NOT NULL DEFAULT 'processing',\n \"completed_at\" TIMESTAMP,\n \"failed_at\" TIMESTAMP\n);",
1013
1563
  "columns": {
1014
1564
  "id": {
1015
1565
  "type": "UUID",
@@ -1035,25 +1585,85 @@
1035
1585
  "type": "TIMESTAMP",
1036
1586
  "notNull": true,
1037
1587
  "default": "current_timestamp"
1588
+ },
1589
+ "tenant_id": {
1590
+ "type": "UUID",
1591
+ "referenceKind": "tenantId",
1592
+ "notNull": true,
1593
+ "unique": false
1594
+ },
1595
+ "voice_session_id": {
1596
+ "type": "UUID",
1597
+ "referenceKind": "foreignKey",
1598
+ "notNull": true,
1599
+ "unique": false,
1600
+ "foreignKey": {
1601
+ "table": "voice_sessions",
1602
+ "column": "id",
1603
+ "onDelete": "CASCADE",
1604
+ "onUpdate": "CASCADE"
1605
+ }
1606
+ },
1607
+ "gateway_session_id": {
1608
+ "type": "TEXT",
1609
+ "notNull": true,
1610
+ "unique": false,
1611
+ "default": ""
1612
+ },
1613
+ "gateway_turn_id": {
1614
+ "type": "TEXT",
1615
+ "notNull": true,
1616
+ "unique": false,
1617
+ "default": ""
1618
+ },
1619
+ "target": {
1620
+ "type": "TEXT",
1621
+ "notNull": true,
1622
+ "unique": false,
1623
+ "default": "smrt:chat"
1624
+ },
1625
+ "status": {
1626
+ "type": "TEXT",
1627
+ "notNull": true,
1628
+ "unique": false,
1629
+ "default": "processing"
1630
+ },
1631
+ "completed_at": {
1632
+ "type": "TIMESTAMP",
1633
+ "notNull": false,
1634
+ "unique": false
1635
+ },
1636
+ "failed_at": {
1637
+ "type": "TIMESTAMP",
1638
+ "notNull": false,
1639
+ "unique": false
1038
1640
  }
1039
1641
  },
1040
1642
  "indexes": [
1643
+ {
1644
+ "name": "voice_gateway_turns_voice_session_id_gateway_turn_id_idx",
1645
+ "columns": [
1646
+ "voice_session_id",
1647
+ "gateway_turn_id"
1648
+ ],
1649
+ "unique": true
1650
+ },
1041
1651
  {
1042
1652
  "name": "voice_gateway_turns_slug_context_idx",
1043
1653
  "columns": [
1044
1654
  "slug",
1045
1655
  "context"
1046
- ],
1047
- "unique": true
1656
+ ]
1048
1657
  },
1049
1658
  {
1050
- "name": "voice_gateway_turns_created_at_idx",
1659
+ "name": "voice_gateway_turns_tenant_id_created_at_idx",
1051
1660
  "columns": [
1661
+ "tenant_id",
1052
1662
  "created_at"
1053
1663
  ]
1054
1664
  }
1055
1665
  ],
1056
- "version": "b0808d94"
1666
+ "version": "c4d871b8"
1057
1667
  }
1058
1668
  },
1059
1669
  "@happyvertical/smrt-chat:VoiceSessionCollection": {
@@ -1117,7 +1727,7 @@
1117
1727
  "collectionExportName": "VoiceSessionCollectionCollection",
1118
1728
  "schema": {
1119
1729
  "tableName": "voice_sessions",
1120
- "ddl": "CREATE TABLE IF NOT EXISTS \"voice_sessions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1730
+ "ddl": "CREATE TABLE IF NOT EXISTS \"voice_sessions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"gateway_session_id\" TEXT NOT NULL DEFAULT '',\n \"actor_profile_id\" UUID NOT NULL,\n \"actor_user_id\" UUID,\n \"persona_id\" UUID NOT NULL,\n \"agent_session_id\" UUID NOT NULL,\n \"chat_room_id\" UUID NOT NULL,\n \"thread_id\" UUID,\n \"target\" TEXT NOT NULL DEFAULT 'smrt:chat',\n \"status\" TEXT NOT NULL DEFAULT 'active',\n \"expires_at\" TIMESTAMP NOT NULL,\n \"last_turn_at\" TIMESTAMP,\n \"last_gateway_turn_id\" TEXT,\n \"persona_snapshot\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}',\n \"processed_turn_ids\" TEXT DEFAULT '[]'\n);",
1121
1731
  "columns": {
1122
1732
  "id": {
1123
1733
  "type": "UUID",
@@ -1143,25 +1753,174 @@
1143
1753
  "type": "TIMESTAMP",
1144
1754
  "notNull": true,
1145
1755
  "default": "current_timestamp"
1756
+ },
1757
+ "tenant_id": {
1758
+ "type": "UUID",
1759
+ "referenceKind": "tenantId",
1760
+ "notNull": true,
1761
+ "unique": false
1762
+ },
1763
+ "gateway_session_id": {
1764
+ "type": "TEXT",
1765
+ "notNull": true,
1766
+ "unique": false,
1767
+ "default": ""
1768
+ },
1769
+ "actor_profile_id": {
1770
+ "type": "UUID",
1771
+ "referenceKind": "crossPackageRef",
1772
+ "notNull": true,
1773
+ "unique": false
1774
+ },
1775
+ "actor_user_id": {
1776
+ "type": "UUID",
1777
+ "referenceKind": "crossPackageRef",
1778
+ "notNull": false,
1779
+ "unique": false
1780
+ },
1781
+ "persona_id": {
1782
+ "type": "UUID",
1783
+ "referenceKind": "crossPackageRef",
1784
+ "notNull": true,
1785
+ "unique": false
1786
+ },
1787
+ "agent_session_id": {
1788
+ "type": "UUID",
1789
+ "referenceKind": "foreignKey",
1790
+ "notNull": true,
1791
+ "unique": false,
1792
+ "foreignKey": {
1793
+ "table": "agent_sessions",
1794
+ "column": "id",
1795
+ "onDelete": "NO ACTION",
1796
+ "onUpdate": "CASCADE"
1797
+ }
1798
+ },
1799
+ "chat_room_id": {
1800
+ "type": "UUID",
1801
+ "referenceKind": "foreignKey",
1802
+ "notNull": true,
1803
+ "unique": false,
1804
+ "foreignKey": {
1805
+ "table": "chat_rooms",
1806
+ "column": "id",
1807
+ "onDelete": "NO ACTION",
1808
+ "onUpdate": "CASCADE"
1809
+ }
1810
+ },
1811
+ "thread_id": {
1812
+ "type": "UUID",
1813
+ "referenceKind": "foreignKey",
1814
+ "notNull": false,
1815
+ "unique": false,
1816
+ "foreignKey": {
1817
+ "table": "chat_threads",
1818
+ "column": "id",
1819
+ "onDelete": "NO ACTION",
1820
+ "onUpdate": "CASCADE"
1821
+ }
1822
+ },
1823
+ "target": {
1824
+ "type": "TEXT",
1825
+ "notNull": true,
1826
+ "unique": false,
1827
+ "default": "smrt:chat"
1828
+ },
1829
+ "status": {
1830
+ "type": "TEXT",
1831
+ "notNull": true,
1832
+ "unique": false,
1833
+ "default": "active"
1834
+ },
1835
+ "expires_at": {
1836
+ "type": "TIMESTAMP",
1837
+ "notNull": true,
1838
+ "unique": false
1839
+ },
1840
+ "last_turn_at": {
1841
+ "type": "TIMESTAMP",
1842
+ "notNull": false,
1843
+ "unique": false
1844
+ },
1845
+ "last_gateway_turn_id": {
1846
+ "type": "TEXT",
1847
+ "notNull": false,
1848
+ "unique": false
1849
+ },
1850
+ "persona_snapshot": {
1851
+ "type": "TEXT",
1852
+ "notNull": false,
1853
+ "unique": false,
1854
+ "default": "{}"
1855
+ },
1856
+ "metadata": {
1857
+ "type": "TEXT",
1858
+ "notNull": false,
1859
+ "unique": false,
1860
+ "default": "{}"
1861
+ },
1862
+ "processed_turn_ids": {
1863
+ "type": "TEXT",
1864
+ "notNull": false,
1865
+ "unique": false,
1866
+ "default": "[]"
1146
1867
  }
1147
1868
  },
1148
1869
  "indexes": [
1149
1870
  {
1150
1871
  "name": "voice_sessions_slug_context_idx",
1151
1872
  "columns": [
1873
+ "tenant_id",
1152
1874
  "slug",
1153
1875
  "context"
1154
1876
  ],
1155
1877
  "unique": true
1156
1878
  },
1157
1879
  {
1158
- "name": "voice_sessions_created_at_idx",
1880
+ "name": "voice_sessions_tenant_id_created_at_idx",
1159
1881
  "columns": [
1882
+ "tenant_id",
1160
1883
  "created_at"
1161
1884
  ]
1885
+ },
1886
+ {
1887
+ "name": "voice_sessions_actor_profile_id_idx",
1888
+ "columns": [
1889
+ "actor_profile_id"
1890
+ ]
1891
+ },
1892
+ {
1893
+ "name": "voice_sessions_actor_user_id_idx",
1894
+ "columns": [
1895
+ "actor_user_id"
1896
+ ]
1897
+ },
1898
+ {
1899
+ "name": "voice_sessions_persona_id_idx",
1900
+ "columns": [
1901
+ "persona_id"
1902
+ ]
1903
+ },
1904
+ {
1905
+ "name": "voice_sessions_agent_session_id_idx",
1906
+ "columns": [
1907
+ "agent_session_id"
1908
+ ]
1909
+ },
1910
+ {
1911
+ "name": "voice_sessions_chat_room_id_idx",
1912
+ "columns": [
1913
+ "chat_room_id"
1914
+ ]
1915
+ },
1916
+ {
1917
+ "name": "voice_sessions_thread_id_idx",
1918
+ "columns": [
1919
+ "thread_id"
1920
+ ]
1162
1921
  }
1163
1922
  ],
1164
- "version": "d9f462ed"
1923
+ "version": "d5cfb90c"
1165
1924
  }
1166
1925
  },
1167
1926
  "@happyvertical/smrt-chat:AgentSession": {
@@ -1569,7 +2328,8 @@
1569
2328
  "slug",
1570
2329
  "context"
1571
2330
  ],
1572
- "unique": true
2331
+ "unique": true,
2332
+ "nullsNotDistinct": true
1573
2333
  },
1574
2334
  {
1575
2335
  "name": "agent_sessions_tenant_id_created_at_idx",