@happyvertical/smrt-messages 0.62.12 → 0.62.14

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 (66) hide show
  1. package/AGENTS.md +13 -1
  2. package/agents/mail-search.md +40 -0
  3. package/agents/send-approval.md +101 -0
  4. package/dist/access.d.ts +33 -1
  5. package/dist/access.d.ts.map +1 -1
  6. package/dist/chunks/{AttachmentCollection-gv5YpGPo.js → AttachmentCollection-C0K7lITr.js} +4 -4
  7. package/dist/chunks/{AttachmentCollection-gv5YpGPo.js.map → AttachmentCollection-C0K7lITr.js.map} +1 -1
  8. package/dist/chunks/{Email---ifczUW.js → Email-DWF2VG_4.js} +11 -6
  9. package/dist/chunks/Email-DWF2VG_4.js.map +1 -0
  10. package/dist/chunks/EmailAccountCollection-OLTzu2T0.js +2472 -0
  11. package/dist/chunks/EmailAccountCollection-OLTzu2T0.js.map +1 -0
  12. package/dist/chunks/{EmailCollection-CHINTmyA.js → EmailCollection-8HeBXd0F.js} +18 -3
  13. package/dist/chunks/EmailCollection-8HeBXd0F.js.map +1 -0
  14. package/dist/chunks/{EmailFolder-C_H8u6bS.js → EmailFolder-Cl4sKRMB.js} +6 -6
  15. package/dist/chunks/{EmailFolder-C_H8u6bS.js.map → EmailFolder-Cl4sKRMB.js.map} +1 -1
  16. package/dist/chunks/{EmailFolderCollection-B83qLC-c.js → EmailFolderCollection-L0na2e1L.js} +2 -2
  17. package/dist/chunks/{EmailFolderCollection-B83qLC-c.js.map → EmailFolderCollection-L0na2e1L.js.map} +1 -1
  18. package/dist/chunks/{EmailSender-B-Rtq9du.js → EmailSender-BiAI0LWU.js} +8 -1
  19. package/dist/chunks/EmailSender-BiAI0LWU.js.map +1 -0
  20. package/dist/chunks/{Message-Ccqg6BLO.js → Message-CuvACyOv.js} +76 -9
  21. package/dist/chunks/Message-CuvACyOv.js.map +1 -0
  22. package/dist/chunks/{MessageCollection-BnHCLi1Q.js → MessageCollection-DOErodD3.js} +2 -2
  23. package/dist/chunks/{MessageCollection-BnHCLi1Q.js.map → MessageCollection-DOErodD3.js.map} +1 -1
  24. package/dist/chunks/{MessagingEndpointCollection-CHzGhkeL.js → MessagingEndpointCollection-CE3kQKQU.js} +2 -2
  25. package/dist/chunks/{MessagingEndpointCollection-CHzGhkeL.js.map → MessagingEndpointCollection-CE3kQKQU.js.map} +1 -1
  26. package/dist/collections/CorrespondentCollection.d.ts +6 -0
  27. package/dist/collections/CorrespondentCollection.d.ts.map +1 -0
  28. package/dist/collections/EmailCollection.d.ts +14 -0
  29. package/dist/collections/EmailCollection.d.ts.map +1 -1
  30. package/dist/connect.js +1 -1
  31. package/dist/index.d.ts +8 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +940 -13
  34. package/dist/index.js.map +1 -1
  35. package/dist/mail-drafts.d.ts +63 -0
  36. package/dist/mail-drafts.d.ts.map +1 -0
  37. package/dist/mail-triage.d.ts.map +1 -1
  38. package/dist/manifest.json +919 -40
  39. package/dist/models/Correspondent.d.ts +63 -0
  40. package/dist/models/Correspondent.d.ts.map +1 -0
  41. package/dist/models/Email.d.ts.map +1 -1
  42. package/dist/models/EmailAccount.d.ts +8 -1
  43. package/dist/models/EmailAccount.d.ts.map +1 -1
  44. package/dist/models/Message.d.ts +9 -0
  45. package/dist/models/Message.d.ts.map +1 -1
  46. package/dist/send-approval.d.ts +275 -0
  47. package/dist/send-approval.d.ts.map +1 -0
  48. package/dist/senders/EmailSender.d.ts.map +1 -1
  49. package/dist/services/CorrespondentService.d.ts +113 -0
  50. package/dist/services/CorrespondentService.d.ts.map +1 -0
  51. package/dist/services/MailSearchService.d.ts +127 -0
  52. package/dist/services/MailSearchService.d.ts.map +1 -0
  53. package/dist/smrt-knowledge.json +392 -9
  54. package/dist/smrt-knowledge.okf.md +14 -3
  55. package/dist/svelte/components/RecipientInput.svelte +54 -0
  56. package/dist/svelte/components/RecipientInput.svelte.d.ts +6 -0
  57. package/dist/svelte/components/RecipientInput.svelte.d.ts.map +1 -1
  58. package/dist/types.d.ts +20 -0
  59. package/dist/types.d.ts.map +1 -1
  60. package/package.json +12 -11
  61. package/dist/chunks/Email---ifczUW.js.map +0 -1
  62. package/dist/chunks/EmailAccountCollection-DkvT4tdP.js +0 -1992
  63. package/dist/chunks/EmailAccountCollection-DkvT4tdP.js.map +0 -1
  64. package/dist/chunks/EmailCollection-CHINTmyA.js.map +0 -1
  65. package/dist/chunks/EmailSender-B-Rtq9du.js.map +0 -1
  66. package/dist/chunks/Message-Ccqg6BLO.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-messages",
5
- "packageVersion": "0.62.12",
5
+ "packageVersion": "0.62.14",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-messages:AccountCollection": {
8
8
  "name": "accountcollection",
@@ -153,7 +153,7 @@
153
153
  ],
154
154
  "schema": {
155
155
  "tableName": "accounts",
156
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
156
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
157
157
  "columns": {
158
158
  "_sync_origin_device_id": {
159
159
  "type": "TEXT"
@@ -279,6 +279,10 @@
279
279
  "notNull": false,
280
280
  "default": false
281
281
  },
282
+ "agent_send_policy": {
283
+ "type": "TEXT",
284
+ "notNull": false
285
+ },
282
286
  "workspace_id": {
283
287
  "type": "TEXT",
284
288
  "notNull": false
@@ -348,7 +352,7 @@
348
352
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
349
353
  }
350
354
  ],
351
- "version": "f48d7a23"
355
+ "version": "ff134288"
352
356
  },
353
357
  "importPath": "@happyvertical/smrt-messages"
354
358
  },
@@ -884,6 +888,182 @@
884
888
  },
885
889
  "importPath": "@happyvertical/smrt-messages"
886
890
  },
891
+ "@happyvertical/smrt-messages:CorrespondentCollection": {
892
+ "name": "correspondentcollection",
893
+ "className": "CorrespondentCollection",
894
+ "qualifiedName": "@happyvertical/smrt-messages:CorrespondentCollection",
895
+ "collection": "correspondents",
896
+ "filePath": "src/collections/CorrespondentCollection.ts",
897
+ "packageName": "@happyvertical/smrt-messages",
898
+ "fields": {},
899
+ "methods": {},
900
+ "decoratorConfig": {
901
+ "tableName": "correspondents",
902
+ "api": false,
903
+ "mcp": false,
904
+ "cli": false
905
+ },
906
+ "extends": "SmrtCollection",
907
+ "extendsTypeArg": "Correspondent",
908
+ "exportName": "CorrespondentCollection",
909
+ "collectionExportName": "CorrespondentCollectionCollection",
910
+ "collectionOf": "@happyvertical/smrt-messages:Correspondent",
911
+ "inheritedExposure": [
912
+ "api",
913
+ "mcp",
914
+ "cli"
915
+ ],
916
+ "schema": {
917
+ "tableName": "correspondents",
918
+ "ddl": "CREATE TABLE IF NOT EXISTS \"correspondents\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"owner_user_id\" UUID NOT NULL,\n \"address\" TEXT NOT NULL,\n \"display_name\" TEXT,\n \"message_count\" INTEGER NOT NULL DEFAULT 0,\n \"sent_count\" INTEGER NOT NULL DEFAULT 0,\n \"received_count\" INTEGER NOT NULL DEFAULT 0,\n \"first_contact_at\" TIMESTAMP,\n \"last_contact_at\" TIMESTAMP,\n \"account_ids\" TEXT,\n \"account_breakdown\" TEXT,\n \"profile_id\" UUID\n);",
919
+ "columns": {
920
+ "_sync_origin_device_id": {
921
+ "type": "TEXT"
922
+ },
923
+ "_sync_revision": {
924
+ "type": "INTEGER"
925
+ },
926
+ "id": {
927
+ "type": "UUID",
928
+ "primaryKey": true,
929
+ "referenceKind": "id",
930
+ "notNull": true
931
+ },
932
+ "slug": {
933
+ "type": "TEXT",
934
+ "notNull": true
935
+ },
936
+ "context": {
937
+ "type": "TEXT",
938
+ "notNull": true,
939
+ "default": ""
940
+ },
941
+ "created_at": {
942
+ "type": "TIMESTAMP",
943
+ "notNull": true,
944
+ "default": "current_timestamp"
945
+ },
946
+ "updated_at": {
947
+ "type": "TIMESTAMP",
948
+ "notNull": true,
949
+ "default": "current_timestamp"
950
+ },
951
+ "tenant_id": {
952
+ "type": "UUID",
953
+ "referenceKind": "tenantId",
954
+ "notNull": true,
955
+ "unique": false
956
+ },
957
+ "owner_user_id": {
958
+ "type": "UUID",
959
+ "referenceKind": "crossPackageRef",
960
+ "notNull": true,
961
+ "unique": false
962
+ },
963
+ "address": {
964
+ "type": "TEXT",
965
+ "notNull": true,
966
+ "unique": false
967
+ },
968
+ "display_name": {
969
+ "type": "TEXT",
970
+ "notNull": false,
971
+ "unique": false
972
+ },
973
+ "message_count": {
974
+ "type": "INTEGER",
975
+ "notNull": true,
976
+ "unique": false,
977
+ "default": 0
978
+ },
979
+ "sent_count": {
980
+ "type": "INTEGER",
981
+ "notNull": true,
982
+ "unique": false,
983
+ "default": 0
984
+ },
985
+ "received_count": {
986
+ "type": "INTEGER",
987
+ "notNull": true,
988
+ "unique": false,
989
+ "default": 0
990
+ },
991
+ "first_contact_at": {
992
+ "type": "TIMESTAMP",
993
+ "notNull": false,
994
+ "unique": false
995
+ },
996
+ "last_contact_at": {
997
+ "type": "TIMESTAMP",
998
+ "notNull": false,
999
+ "unique": false
1000
+ },
1001
+ "account_ids": {
1002
+ "type": "TEXT",
1003
+ "notNull": false,
1004
+ "unique": false
1005
+ },
1006
+ "account_breakdown": {
1007
+ "type": "TEXT",
1008
+ "notNull": false,
1009
+ "unique": false
1010
+ },
1011
+ "profile_id": {
1012
+ "type": "UUID",
1013
+ "referenceKind": "crossPackageRef",
1014
+ "notNull": false,
1015
+ "unique": false
1016
+ }
1017
+ },
1018
+ "indexes": [
1019
+ {
1020
+ "name": "correspondents_tenant_id_owner_user_id_idx",
1021
+ "columns": [
1022
+ "tenant_id",
1023
+ "owner_user_id",
1024
+ "address"
1025
+ ],
1026
+ "unique": true
1027
+ },
1028
+ {
1029
+ "name": "correspondents_slug_context_idx",
1030
+ "columns": [
1031
+ "slug",
1032
+ "context"
1033
+ ]
1034
+ },
1035
+ {
1036
+ "name": "correspondents_owner_last_contact_idx",
1037
+ "columns": [
1038
+ "tenant_id",
1039
+ "owner_user_id",
1040
+ "last_contact_at"
1041
+ ]
1042
+ },
1043
+ {
1044
+ "name": "correspondents_tenant_id_created_at_idx",
1045
+ "columns": [
1046
+ "tenant_id",
1047
+ "created_at"
1048
+ ]
1049
+ },
1050
+ {
1051
+ "name": "correspondents_owner_user_id_idx",
1052
+ "columns": [
1053
+ "owner_user_id"
1054
+ ]
1055
+ },
1056
+ {
1057
+ "name": "correspondents_profile_id_idx",
1058
+ "columns": [
1059
+ "profile_id"
1060
+ ]
1061
+ }
1062
+ ],
1063
+ "version": "d0cc8363"
1064
+ },
1065
+ "importPath": "@happyvertical/smrt-messages"
1066
+ },
887
1067
  "@happyvertical/smrt-messages:EmailAccountCollection": {
888
1068
  "name": "emailaccountcollection",
889
1069
  "className": "EmailAccountCollection",
@@ -1124,7 +1304,7 @@
1124
1304
  ],
1125
1305
  "schema": {
1126
1306
  "tableName": "accounts",
1127
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
1307
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
1128
1308
  "columns": {
1129
1309
  "_sync_origin_device_id": {
1130
1310
  "type": "TEXT"
@@ -1250,6 +1430,10 @@
1250
1430
  "notNull": false,
1251
1431
  "default": false
1252
1432
  },
1433
+ "agent_send_policy": {
1434
+ "type": "TEXT",
1435
+ "notNull": false
1436
+ },
1253
1437
  "workspace_id": {
1254
1438
  "type": "TEXT",
1255
1439
  "notNull": false
@@ -1319,7 +1503,7 @@
1319
1503
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
1320
1504
  }
1321
1505
  ],
1322
- "version": "f48d7a23"
1506
+ "version": "ff134288"
1323
1507
  },
1324
1508
  "importPath": "@happyvertical/smrt-messages"
1325
1509
  },
@@ -2110,6 +2294,33 @@
2110
2294
  "isStatic": false,
2111
2295
  "isPublic": true
2112
2296
  },
2297
+ "semanticMatches": {
2298
+ "name": "semanticMatches",
2299
+ "async": true,
2300
+ "parameters": [
2301
+ {
2302
+ "name": "query",
2303
+ "type": "string",
2304
+ "optional": false
2305
+ },
2306
+ {
2307
+ "name": "where",
2308
+ "type": "Record<string, unknown>",
2309
+ "optional": false
2310
+ },
2311
+ {
2312
+ "name": "options",
2313
+ "type": "object",
2314
+ "optional": true,
2315
+ "memberTypes": [
2316
+ "number"
2317
+ ]
2318
+ }
2319
+ ],
2320
+ "returnType": "Promise<Array<object> | null>",
2321
+ "isStatic": false,
2322
+ "isPublic": true
2323
+ },
2113
2324
  "markFolderRead": {
2114
2325
  "name": "markFolderRead",
2115
2326
  "async": true,
@@ -2167,7 +2378,7 @@
2167
2378
  ],
2168
2379
  "schema": {
2169
2380
  "tableName": "messages",
2170
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
2381
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"handled_by_id\" TEXT,\n \"handled_by_kind\" TEXT,\n \"handled_at\" TIMESTAMP,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
2171
2382
  "columns": {
2172
2383
  "_sync_origin_device_id": {
2173
2384
  "type": "TEXT"
@@ -2334,6 +2545,18 @@
2334
2545
  "onUpdate": "CASCADE"
2335
2546
  }
2336
2547
  },
2548
+ "handled_by_id": {
2549
+ "type": "TEXT",
2550
+ "notNull": false
2551
+ },
2552
+ "handled_by_kind": {
2553
+ "type": "TEXT",
2554
+ "notNull": false
2555
+ },
2556
+ "handled_at": {
2557
+ "type": "TIMESTAMP",
2558
+ "notNull": false
2559
+ },
2337
2560
  "message_id": {
2338
2561
  "type": "TEXT",
2339
2562
  "notNull": false
@@ -2587,7 +2810,7 @@
2587
2810
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
2588
2811
  }
2589
2812
  ],
2590
- "version": "f48614e6"
2813
+ "version": "da95c653"
2591
2814
  },
2592
2815
  "importPath": "@happyvertical/smrt-messages"
2593
2816
  },
@@ -3281,7 +3504,7 @@
3281
3504
  ],
3282
3505
  "schema": {
3283
3506
  "tableName": "messages",
3284
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
3507
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"handled_by_id\" TEXT,\n \"handled_by_kind\" TEXT,\n \"handled_at\" TIMESTAMP,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
3285
3508
  "columns": {
3286
3509
  "_sync_origin_device_id": {
3287
3510
  "type": "TEXT"
@@ -3448,6 +3671,18 @@
3448
3671
  "onUpdate": "CASCADE"
3449
3672
  }
3450
3673
  },
3674
+ "handled_by_id": {
3675
+ "type": "TEXT",
3676
+ "notNull": false
3677
+ },
3678
+ "handled_by_kind": {
3679
+ "type": "TEXT",
3680
+ "notNull": false
3681
+ },
3682
+ "handled_at": {
3683
+ "type": "TIMESTAMP",
3684
+ "notNull": false
3685
+ },
3451
3686
  "message_id": {
3452
3687
  "type": "TEXT",
3453
3688
  "notNull": false
@@ -3701,7 +3936,7 @@
3701
3936
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
3702
3937
  }
3703
3938
  ],
3704
- "version": "d8da74ce"
3939
+ "version": "e51be371"
3705
3940
  },
3706
3941
  "importPath": "@happyvertical/smrt-messages"
3707
3942
  },
@@ -5203,7 +5438,7 @@
5203
5438
  ],
5204
5439
  "schema": {
5205
5440
  "tableName": "accounts",
5206
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
5441
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
5207
5442
  "columns": {
5208
5443
  "_sync_origin_device_id": {
5209
5444
  "type": "TEXT"
@@ -5329,6 +5564,10 @@
5329
5564
  "notNull": false,
5330
5565
  "default": false
5331
5566
  },
5567
+ "agent_send_policy": {
5568
+ "type": "TEXT",
5569
+ "notNull": false
5570
+ },
5332
5571
  "workspace_id": {
5333
5572
  "type": "TEXT",
5334
5573
  "notNull": false
@@ -5398,7 +5637,7 @@
5398
5637
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
5399
5638
  }
5400
5639
  ],
5401
- "version": "f48d7a23"
5640
+ "version": "ff134288"
5402
5641
  },
5403
5642
  "importPath": "@happyvertical/smrt-messages"
5404
5643
  },
@@ -5949,35 +6188,379 @@
5949
6188
  "auto_archive": {
5950
6189
  "type": "BOOLEAN",
5951
6190
  "notNull": false,
5952
- "unique": false,
5953
- "default": true
6191
+ "unique": false,
6192
+ "default": true
6193
+ },
6194
+ "tenant_id": {
6195
+ "type": "UUID",
6196
+ "referenceKind": "tenantId",
6197
+ "notNull": true,
6198
+ "unique": false
6199
+ }
6200
+ },
6201
+ "indexes": [
6202
+ {
6203
+ "name": "blacklists_slug_context_idx",
6204
+ "columns": [
6205
+ "tenant_id",
6206
+ "slug",
6207
+ "context"
6208
+ ],
6209
+ "unique": true
6210
+ },
6211
+ {
6212
+ "name": "blacklists_tenant_id_created_at_idx",
6213
+ "columns": [
6214
+ "tenant_id",
6215
+ "created_at"
6216
+ ]
6217
+ }
6218
+ ],
6219
+ "version": "478c8724"
6220
+ },
6221
+ "importPath": "@happyvertical/smrt-messages"
6222
+ },
6223
+ "@happyvertical/smrt-messages:Correspondent": {
6224
+ "name": "correspondent",
6225
+ "className": "Correspondent",
6226
+ "qualifiedName": "@happyvertical/smrt-messages:Correspondent",
6227
+ "collection": "correspondents",
6228
+ "description": "Someone one person writes to or hears from, derived from that person's synced mail (#5132).",
6229
+ "filePath": "src/models/Correspondent.ts",
6230
+ "packageName": "@happyvertical/smrt-messages",
6231
+ "fields": {
6232
+ "tenantId": {
6233
+ "type": "text",
6234
+ "_meta": {
6235
+ "__tenancy": {
6236
+ "isTenantIdField": true,
6237
+ "autoFilter": true,
6238
+ "required": true,
6239
+ "autoPopulate": true,
6240
+ "nullable": false,
6241
+ "mode": "required",
6242
+ "field": "tenantId",
6243
+ "allowSuperAdminBypass": false
6244
+ },
6245
+ "__statedOptions": [
6246
+ "sqlType",
6247
+ "requiredFor",
6248
+ "__tenancy"
6249
+ ],
6250
+ "sqlType": "UUID",
6251
+ "requiredFor": "tenant-scope"
6252
+ },
6253
+ "required": true
6254
+ },
6255
+ "ownerUserId": {
6256
+ "type": "crossPackageRef",
6257
+ "_meta": {
6258
+ "__statedOptions": [
6259
+ "required",
6260
+ "requiredFor",
6261
+ "related"
6262
+ ],
6263
+ "required": true,
6264
+ "requiredFor": "identity"
6265
+ },
6266
+ "required": true,
6267
+ "related": "@happyvertical/smrt-users:User"
6268
+ },
6269
+ "address": {
6270
+ "type": "text",
6271
+ "_meta": {
6272
+ "__statedOptions": [
6273
+ "required",
6274
+ "requiredFor"
6275
+ ],
6276
+ "required": true,
6277
+ "requiredFor": "identity"
6278
+ },
6279
+ "required": true
6280
+ },
6281
+ "displayName": {
6282
+ "type": "text",
6283
+ "_meta": {
6284
+ "__statedOptions": []
6285
+ },
6286
+ "required": false
6287
+ },
6288
+ "messageCount": {
6289
+ "type": "integer",
6290
+ "_meta": {
6291
+ "__statedOptions": [
6292
+ "default"
6293
+ ]
6294
+ },
6295
+ "required": true,
6296
+ "default": 0
6297
+ },
6298
+ "sentCount": {
6299
+ "type": "integer",
6300
+ "_meta": {
6301
+ "__statedOptions": [
6302
+ "default"
6303
+ ]
6304
+ },
6305
+ "required": true,
6306
+ "default": 0
6307
+ },
6308
+ "receivedCount": {
6309
+ "type": "integer",
6310
+ "_meta": {
6311
+ "__statedOptions": [
6312
+ "default"
6313
+ ]
6314
+ },
6315
+ "required": true,
6316
+ "default": 0
6317
+ },
6318
+ "firstContactAt": {
6319
+ "type": "datetime",
6320
+ "_meta": {
6321
+ "__statedOptions": []
6322
+ },
6323
+ "required": false
6324
+ },
6325
+ "lastContactAt": {
6326
+ "type": "datetime",
6327
+ "_meta": {
6328
+ "__statedOptions": []
6329
+ },
6330
+ "required": false
6331
+ },
6332
+ "accountIds": {
6333
+ "type": "text",
6334
+ "_meta": {
6335
+ "__statedOptions": []
6336
+ },
6337
+ "required": false
6338
+ },
6339
+ "accountBreakdown": {
6340
+ "type": "text",
6341
+ "_meta": {
6342
+ "__statedOptions": []
6343
+ },
6344
+ "required": false
6345
+ },
6346
+ "profileId": {
6347
+ "type": "crossPackageRef",
6348
+ "_meta": {
6349
+ "__statedOptions": [
6350
+ "nullable",
6351
+ "related",
6352
+ "required"
6353
+ ],
6354
+ "nullable": true,
6355
+ "required": false
6356
+ },
6357
+ "required": false,
6358
+ "related": "@happyvertical/smrt-profiles:Profile"
6359
+ }
6360
+ },
6361
+ "methods": {},
6362
+ "decoratorConfig": {
6363
+ "tableName": "correspondents",
6364
+ "api": false,
6365
+ "mcp": false,
6366
+ "cli": false,
6367
+ "conflictColumns": [
6368
+ "tenant_id",
6369
+ "owner_user_id",
6370
+ "address"
6371
+ ],
6372
+ "indexes": [
6373
+ {
6374
+ "name": "correspondents_owner_last_contact_idx",
6375
+ "columns": [
6376
+ "tenantId",
6377
+ "ownerUserId",
6378
+ "lastContactAt"
6379
+ ]
6380
+ }
6381
+ ],
6382
+ "tenantScoped": {
6383
+ "mode": "required"
6384
+ }
6385
+ },
6386
+ "extends": "SmrtObject",
6387
+ "exportName": "Correspondent",
6388
+ "collectionExportName": "CorrespondentCollection",
6389
+ "validationRules": [
6390
+ {
6391
+ "field": "ownerUserId",
6392
+ "rule": "required",
6393
+ "fieldType": "crossPackageRef"
6394
+ },
6395
+ {
6396
+ "field": "address",
6397
+ "rule": "required",
6398
+ "fieldType": "text"
6399
+ },
6400
+ {
6401
+ "field": "messageCount",
6402
+ "rule": "required",
6403
+ "fieldType": "integer"
6404
+ },
6405
+ {
6406
+ "field": "sentCount",
6407
+ "rule": "required",
6408
+ "fieldType": "integer"
6409
+ },
6410
+ {
6411
+ "field": "receivedCount",
6412
+ "rule": "required",
6413
+ "fieldType": "integer"
6414
+ }
6415
+ ],
6416
+ "schema": {
6417
+ "tableName": "correspondents",
6418
+ "ddl": "CREATE TABLE IF NOT EXISTS \"correspondents\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"owner_user_id\" UUID NOT NULL,\n \"address\" TEXT NOT NULL,\n \"display_name\" TEXT,\n \"message_count\" INTEGER NOT NULL DEFAULT 0,\n \"sent_count\" INTEGER NOT NULL DEFAULT 0,\n \"received_count\" INTEGER NOT NULL DEFAULT 0,\n \"first_contact_at\" TIMESTAMP,\n \"last_contact_at\" TIMESTAMP,\n \"account_ids\" TEXT,\n \"account_breakdown\" TEXT,\n \"profile_id\" UUID\n);",
6419
+ "columns": {
6420
+ "_sync_origin_device_id": {
6421
+ "type": "TEXT"
6422
+ },
6423
+ "_sync_revision": {
6424
+ "type": "INTEGER"
6425
+ },
6426
+ "id": {
6427
+ "type": "UUID",
6428
+ "primaryKey": true,
6429
+ "referenceKind": "id",
6430
+ "notNull": true
6431
+ },
6432
+ "slug": {
6433
+ "type": "TEXT",
6434
+ "notNull": true
6435
+ },
6436
+ "context": {
6437
+ "type": "TEXT",
6438
+ "notNull": true,
6439
+ "default": ""
6440
+ },
6441
+ "created_at": {
6442
+ "type": "TIMESTAMP",
6443
+ "notNull": true,
6444
+ "default": "current_timestamp"
6445
+ },
6446
+ "updated_at": {
6447
+ "type": "TIMESTAMP",
6448
+ "notNull": true,
6449
+ "default": "current_timestamp"
6450
+ },
6451
+ "tenant_id": {
6452
+ "type": "UUID",
6453
+ "referenceKind": "tenantId",
6454
+ "notNull": true,
6455
+ "unique": false
6456
+ },
6457
+ "owner_user_id": {
6458
+ "type": "UUID",
6459
+ "referenceKind": "crossPackageRef",
6460
+ "notNull": true,
6461
+ "unique": false
6462
+ },
6463
+ "address": {
6464
+ "type": "TEXT",
6465
+ "notNull": true,
6466
+ "unique": false
6467
+ },
6468
+ "display_name": {
6469
+ "type": "TEXT",
6470
+ "notNull": false,
6471
+ "unique": false
6472
+ },
6473
+ "message_count": {
6474
+ "type": "INTEGER",
6475
+ "notNull": true,
6476
+ "unique": false,
6477
+ "default": 0
6478
+ },
6479
+ "sent_count": {
6480
+ "type": "INTEGER",
6481
+ "notNull": true,
6482
+ "unique": false,
6483
+ "default": 0
6484
+ },
6485
+ "received_count": {
6486
+ "type": "INTEGER",
6487
+ "notNull": true,
6488
+ "unique": false,
6489
+ "default": 0
6490
+ },
6491
+ "first_contact_at": {
6492
+ "type": "TIMESTAMP",
6493
+ "notNull": false,
6494
+ "unique": false
6495
+ },
6496
+ "last_contact_at": {
6497
+ "type": "TIMESTAMP",
6498
+ "notNull": false,
6499
+ "unique": false
6500
+ },
6501
+ "account_ids": {
6502
+ "type": "TEXT",
6503
+ "notNull": false,
6504
+ "unique": false
6505
+ },
6506
+ "account_breakdown": {
6507
+ "type": "TEXT",
6508
+ "notNull": false,
6509
+ "unique": false
5954
6510
  },
5955
- "tenant_id": {
6511
+ "profile_id": {
5956
6512
  "type": "UUID",
5957
- "referenceKind": "tenantId",
5958
- "notNull": true,
6513
+ "referenceKind": "crossPackageRef",
6514
+ "notNull": false,
5959
6515
  "unique": false
5960
6516
  }
5961
6517
  },
5962
6518
  "indexes": [
5963
6519
  {
5964
- "name": "blacklists_slug_context_idx",
6520
+ "name": "correspondents_tenant_id_owner_user_id_idx",
5965
6521
  "columns": [
5966
6522
  "tenant_id",
5967
- "slug",
5968
- "context"
6523
+ "owner_user_id",
6524
+ "address"
5969
6525
  ],
5970
6526
  "unique": true
5971
6527
  },
5972
6528
  {
5973
- "name": "blacklists_tenant_id_created_at_idx",
6529
+ "name": "correspondents_slug_context_idx",
6530
+ "columns": [
6531
+ "slug",
6532
+ "context"
6533
+ ]
6534
+ },
6535
+ {
6536
+ "name": "correspondents_owner_last_contact_idx",
6537
+ "columns": [
6538
+ "tenant_id",
6539
+ "owner_user_id",
6540
+ "last_contact_at"
6541
+ ]
6542
+ },
6543
+ {
6544
+ "name": "correspondents_tenant_id_created_at_idx",
5974
6545
  "columns": [
5975
6546
  "tenant_id",
5976
6547
  "created_at"
5977
6548
  ]
6549
+ },
6550
+ {
6551
+ "name": "correspondents_owner_user_id_idx",
6552
+ "columns": [
6553
+ "owner_user_id"
6554
+ ]
6555
+ },
6556
+ {
6557
+ "name": "correspondents_profile_id_idx",
6558
+ "columns": [
6559
+ "profile_id"
6560
+ ]
5978
6561
  }
5979
6562
  ],
5980
- "version": "478c8724"
6563
+ "version": "d0cc8363"
5981
6564
  },
5982
6565
  "importPath": "@happyvertical/smrt-messages"
5983
6566
  },
@@ -6313,6 +6896,48 @@
6313
6896
  "related": "Message",
6314
6897
  "description": "The earlier message this one replies to."
6315
6898
  },
6899
+ "handledById": {
6900
+ "type": "text",
6901
+ "_meta": {
6902
+ "__statedOptions": [
6903
+ "readonly",
6904
+ "description"
6905
+ ],
6906
+ "description": "The person or assistant who last acted on this message.",
6907
+ "readonly": true
6908
+ },
6909
+ "required": false,
6910
+ "description": "The person or assistant who last acted on this message.",
6911
+ "readonly": true
6912
+ },
6913
+ "handledByKind": {
6914
+ "type": "text",
6915
+ "_meta": {
6916
+ "__statedOptions": [
6917
+ "readonly",
6918
+ "description"
6919
+ ],
6920
+ "description": "Whether a person or an assistant last acted on this message.",
6921
+ "readonly": true
6922
+ },
6923
+ "required": false,
6924
+ "description": "Whether a person or an assistant last acted on this message.",
6925
+ "readonly": true
6926
+ },
6927
+ "handledAt": {
6928
+ "type": "datetime",
6929
+ "_meta": {
6930
+ "__statedOptions": [
6931
+ "readonly",
6932
+ "description"
6933
+ ],
6934
+ "description": "When someone last acted on this message.",
6935
+ "readonly": true
6936
+ },
6937
+ "required": false,
6938
+ "description": "When someone last acted on this message.",
6939
+ "readonly": true
6940
+ },
6316
6941
  "createdAt": {
6317
6942
  "type": "text",
6318
6943
  "_meta": {
@@ -6714,6 +7339,14 @@
6714
7339
  "isStatic": false,
6715
7340
  "isPublic": true
6716
7341
  },
7342
+ "getHandledBy": {
7343
+ "name": "getHandledBy",
7344
+ "async": false,
7345
+ "parameters": [],
7346
+ "returnType": "object | null",
7347
+ "isStatic": false,
7348
+ "isPublic": true
7349
+ },
6717
7350
  "isSendOutcomeUnknown": {
6718
7351
  "name": "isSendOutcomeUnknown",
6719
7352
  "async": false,
@@ -6898,6 +7531,14 @@
6898
7531
  },
6899
7532
  "decoratorConfig": {
6900
7533
  "tableStrategy": "sti",
7534
+ "embeddings": {
7535
+ "fields": [
7536
+ "subject",
7537
+ "textBody"
7538
+ ],
7539
+ "provider": "auto",
7540
+ "autoGenerate": false
7541
+ },
6901
7542
  "api": {
6902
7543
  "include": [
6903
7544
  "list",
@@ -6972,7 +7613,7 @@
6972
7613
  ],
6973
7614
  "schema": {
6974
7615
  "tableName": "messages",
6975
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
7616
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"handled_by_id\" TEXT,\n \"handled_by_kind\" TEXT,\n \"handled_at\" TIMESTAMP,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
6976
7617
  "columns": {
6977
7618
  "_sync_origin_device_id": {
6978
7619
  "type": "TEXT"
@@ -7139,6 +7780,18 @@
7139
7780
  "onUpdate": "CASCADE"
7140
7781
  }
7141
7782
  },
7783
+ "handled_by_id": {
7784
+ "type": "TEXT",
7785
+ "notNull": false
7786
+ },
7787
+ "handled_by_kind": {
7788
+ "type": "TEXT",
7789
+ "notNull": false
7790
+ },
7791
+ "handled_at": {
7792
+ "type": "TIMESTAMP",
7793
+ "notNull": false
7794
+ },
7142
7795
  "message_id": {
7143
7796
  "type": "TEXT",
7144
7797
  "notNull": false
@@ -7392,7 +8045,7 @@
7392
8045
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
7393
8046
  }
7394
8047
  ],
7395
- "version": "f48614e6"
8048
+ "version": "da95c653"
7396
8049
  },
7397
8050
  "importPath": "@happyvertical/smrt-messages"
7398
8051
  },
@@ -7693,6 +8346,25 @@
7693
8346
  "required": true,
7694
8347
  "default": false,
7695
8348
  "description": "Whether more mail was still waiting after the last check."
8349
+ },
8350
+ "agentSendPolicy": {
8351
+ "type": "text",
8352
+ "_meta": {
8353
+ "__statedOptions": [
8354
+ "readonly",
8355
+ "description",
8356
+ "enum"
8357
+ ],
8358
+ "description": "Whether an assistant may send from this mailbox on its own, or needs a person to approve each message first.",
8359
+ "readonly": true
8360
+ },
8361
+ "required": false,
8362
+ "description": "Whether an assistant may send from this mailbox on its own, or needs a person to approve each message first.",
8363
+ "enum": [
8364
+ "require_approval",
8365
+ "auto_send"
8366
+ ],
8367
+ "readonly": true
7696
8368
  }
7697
8369
  },
7698
8370
  "methods": {
@@ -8028,7 +8700,7 @@
8028
8700
  ],
8029
8701
  "schema": {
8030
8702
  "tableName": "accounts",
8031
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
8703
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
8032
8704
  "columns": {
8033
8705
  "_sync_origin_device_id": {
8034
8706
  "type": "TEXT"
@@ -8154,6 +8826,10 @@
8154
8826
  "notNull": false,
8155
8827
  "default": false
8156
8828
  },
8829
+ "agent_send_policy": {
8830
+ "type": "TEXT",
8831
+ "notNull": false
8832
+ },
8157
8833
  "workspace_id": {
8158
8834
  "type": "TEXT",
8159
8835
  "notNull": false
@@ -8223,7 +8899,7 @@
8223
8899
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
8224
8900
  }
8225
8901
  ],
8226
- "version": "f48d7a23"
8902
+ "version": "ff134288"
8227
8903
  },
8228
8904
  "importPath": "@happyvertical/smrt-messages"
8229
8905
  },
@@ -9357,6 +10033,48 @@
9357
10033
  "related": "Message",
9358
10034
  "description": "The earlier message this one replies to."
9359
10035
  },
10036
+ "handledById": {
10037
+ "type": "text",
10038
+ "_meta": {
10039
+ "__statedOptions": [
10040
+ "readonly",
10041
+ "description"
10042
+ ],
10043
+ "description": "The person or assistant who last acted on this message.",
10044
+ "readonly": true
10045
+ },
10046
+ "required": false,
10047
+ "description": "The person or assistant who last acted on this message.",
10048
+ "readonly": true
10049
+ },
10050
+ "handledByKind": {
10051
+ "type": "text",
10052
+ "_meta": {
10053
+ "__statedOptions": [
10054
+ "readonly",
10055
+ "description"
10056
+ ],
10057
+ "description": "Whether a person or an assistant last acted on this message.",
10058
+ "readonly": true
10059
+ },
10060
+ "required": false,
10061
+ "description": "Whether a person or an assistant last acted on this message.",
10062
+ "readonly": true
10063
+ },
10064
+ "handledAt": {
10065
+ "type": "datetime",
10066
+ "_meta": {
10067
+ "__statedOptions": [
10068
+ "readonly",
10069
+ "description"
10070
+ ],
10071
+ "description": "When someone last acted on this message.",
10072
+ "readonly": true
10073
+ },
10074
+ "required": false,
10075
+ "description": "When someone last acted on this message.",
10076
+ "readonly": true
10077
+ },
9360
10078
  "createdAt": {
9361
10079
  "type": "text",
9362
10080
  "_meta": {
@@ -9567,6 +10285,14 @@
9567
10285
  "isStatic": false,
9568
10286
  "isPublic": true
9569
10287
  },
10288
+ "getHandledBy": {
10289
+ "name": "getHandledBy",
10290
+ "async": false,
10291
+ "parameters": [],
10292
+ "returnType": "object | null",
10293
+ "isStatic": false,
10294
+ "isPublic": true
10295
+ },
9570
10296
  "isSendOutcomeUnknown": {
9571
10297
  "name": "isSendOutcomeUnknown",
9572
10298
  "async": false,
@@ -9693,7 +10419,7 @@
9693
10419
  ],
9694
10420
  "schema": {
9695
10421
  "tableName": "messages",
9696
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
10422
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"handled_by_id\" TEXT,\n \"handled_by_kind\" TEXT,\n \"handled_at\" TIMESTAMP,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
9697
10423
  "columns": {
9698
10424
  "_sync_origin_device_id": {
9699
10425
  "type": "TEXT"
@@ -9860,6 +10586,18 @@
9860
10586
  "onUpdate": "CASCADE"
9861
10587
  }
9862
10588
  },
10589
+ "handled_by_id": {
10590
+ "type": "TEXT",
10591
+ "notNull": false
10592
+ },
10593
+ "handled_by_kind": {
10594
+ "type": "TEXT",
10595
+ "notNull": false
10596
+ },
10597
+ "handled_at": {
10598
+ "type": "TIMESTAMP",
10599
+ "notNull": false
10600
+ },
9863
10601
  "message_id": {
9864
10602
  "type": "TEXT",
9865
10603
  "notNull": false
@@ -10113,7 +10851,7 @@
10113
10851
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
10114
10852
  }
10115
10853
  ],
10116
- "version": "d8da74ce"
10854
+ "version": "e51be371"
10117
10855
  },
10118
10856
  "importPath": "@happyvertical/smrt-messages"
10119
10857
  },
@@ -12124,7 +12862,7 @@
12124
12862
  ],
12125
12863
  "schema": {
12126
12864
  "tableName": "accounts",
12127
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
12865
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
12128
12866
  "columns": {
12129
12867
  "_sync_origin_device_id": {
12130
12868
  "type": "TEXT"
@@ -12250,6 +12988,10 @@
12250
12988
  "notNull": false,
12251
12989
  "default": false
12252
12990
  },
12991
+ "agent_send_policy": {
12992
+ "type": "TEXT",
12993
+ "notNull": false
12994
+ },
12253
12995
  "workspace_id": {
12254
12996
  "type": "TEXT",
12255
12997
  "notNull": false
@@ -12319,7 +13061,7 @@
12319
13061
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
12320
13062
  }
12321
13063
  ],
12322
- "version": "f48d7a23"
13064
+ "version": "ff134288"
12323
13065
  },
12324
13066
  "importPath": "@happyvertical/smrt-messages"
12325
13067
  },
@@ -12655,6 +13397,48 @@
12655
13397
  "related": "Message",
12656
13398
  "description": "The earlier message this one replies to."
12657
13399
  },
13400
+ "handledById": {
13401
+ "type": "text",
13402
+ "_meta": {
13403
+ "__statedOptions": [
13404
+ "readonly",
13405
+ "description"
13406
+ ],
13407
+ "description": "The person or assistant who last acted on this message.",
13408
+ "readonly": true
13409
+ },
13410
+ "required": false,
13411
+ "description": "The person or assistant who last acted on this message.",
13412
+ "readonly": true
13413
+ },
13414
+ "handledByKind": {
13415
+ "type": "text",
13416
+ "_meta": {
13417
+ "__statedOptions": [
13418
+ "readonly",
13419
+ "description"
13420
+ ],
13421
+ "description": "Whether a person or an assistant last acted on this message.",
13422
+ "readonly": true
13423
+ },
13424
+ "required": false,
13425
+ "description": "Whether a person or an assistant last acted on this message.",
13426
+ "readonly": true
13427
+ },
13428
+ "handledAt": {
13429
+ "type": "datetime",
13430
+ "_meta": {
13431
+ "__statedOptions": [
13432
+ "readonly",
13433
+ "description"
13434
+ ],
13435
+ "description": "When someone last acted on this message.",
13436
+ "readonly": true
13437
+ },
13438
+ "required": false,
13439
+ "description": "When someone last acted on this message.",
13440
+ "readonly": true
13441
+ },
12658
13442
  "createdAt": {
12659
13443
  "type": "text",
12660
13444
  "_meta": {
@@ -12955,6 +13739,14 @@
12955
13739
  "isStatic": false,
12956
13740
  "isPublic": true
12957
13741
  },
13742
+ "getHandledBy": {
13743
+ "name": "getHandledBy",
13744
+ "async": false,
13745
+ "parameters": [],
13746
+ "returnType": "object | null",
13747
+ "isStatic": false,
13748
+ "isPublic": true
13749
+ },
12958
13750
  "isSendOutcomeUnknown": {
12959
13751
  "name": "isSendOutcomeUnknown",
12960
13752
  "async": false,
@@ -13116,7 +13908,7 @@
13116
13908
  ],
13117
13909
  "schema": {
13118
13910
  "tableName": "messages",
13119
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
13911
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"handled_by_id\" TEXT,\n \"handled_by_kind\" TEXT,\n \"handled_at\" TIMESTAMP,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
13120
13912
  "columns": {
13121
13913
  "_sync_origin_device_id": {
13122
13914
  "type": "TEXT"
@@ -13283,6 +14075,18 @@
13283
14075
  "onUpdate": "CASCADE"
13284
14076
  }
13285
14077
  },
14078
+ "handled_by_id": {
14079
+ "type": "TEXT",
14080
+ "notNull": false
14081
+ },
14082
+ "handled_by_kind": {
14083
+ "type": "TEXT",
14084
+ "notNull": false
14085
+ },
14086
+ "handled_at": {
14087
+ "type": "TIMESTAMP",
14088
+ "notNull": false
14089
+ },
13286
14090
  "message_id": {
13287
14091
  "type": "TEXT",
13288
14092
  "notNull": false
@@ -13536,7 +14340,7 @@
13536
14340
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
13537
14341
  }
13538
14342
  ],
13539
- "version": "63b1a1ae"
14343
+ "version": "2f466c21"
13540
14344
  },
13541
14345
  "importPath": "@happyvertical/smrt-messages"
13542
14346
  },
@@ -13914,7 +14718,7 @@
13914
14718
  ],
13915
14719
  "schema": {
13916
14720
  "tableName": "accounts",
13917
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
14721
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
13918
14722
  "columns": {
13919
14723
  "_sync_origin_device_id": {
13920
14724
  "type": "TEXT"
@@ -14040,6 +14844,10 @@
14040
14844
  "notNull": false,
14041
14845
  "default": false
14042
14846
  },
14847
+ "agent_send_policy": {
14848
+ "type": "TEXT",
14849
+ "notNull": false
14850
+ },
14043
14851
  "workspace_id": {
14044
14852
  "type": "TEXT",
14045
14853
  "notNull": false
@@ -14109,7 +14917,7 @@
14109
14917
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
14110
14918
  }
14111
14919
  ],
14112
- "version": "f48d7a23"
14920
+ "version": "ff134288"
14113
14921
  },
14114
14922
  "importPath": "@happyvertical/smrt-messages"
14115
14923
  },
@@ -14445,6 +15253,48 @@
14445
15253
  "related": "Message",
14446
15254
  "description": "The earlier message this one replies to."
14447
15255
  },
15256
+ "handledById": {
15257
+ "type": "text",
15258
+ "_meta": {
15259
+ "__statedOptions": [
15260
+ "readonly",
15261
+ "description"
15262
+ ],
15263
+ "description": "The person or assistant who last acted on this message.",
15264
+ "readonly": true
15265
+ },
15266
+ "required": false,
15267
+ "description": "The person or assistant who last acted on this message.",
15268
+ "readonly": true
15269
+ },
15270
+ "handledByKind": {
15271
+ "type": "text",
15272
+ "_meta": {
15273
+ "__statedOptions": [
15274
+ "readonly",
15275
+ "description"
15276
+ ],
15277
+ "description": "Whether a person or an assistant last acted on this message.",
15278
+ "readonly": true
15279
+ },
15280
+ "required": false,
15281
+ "description": "Whether a person or an assistant last acted on this message.",
15282
+ "readonly": true
15283
+ },
15284
+ "handledAt": {
15285
+ "type": "datetime",
15286
+ "_meta": {
15287
+ "__statedOptions": [
15288
+ "readonly",
15289
+ "description"
15290
+ ],
15291
+ "description": "When someone last acted on this message.",
15292
+ "readonly": true
15293
+ },
15294
+ "required": false,
15295
+ "description": "When someone last acted on this message.",
15296
+ "readonly": true
15297
+ },
14448
15298
  "createdAt": {
14449
15299
  "type": "text",
14450
15300
  "_meta": {
@@ -14733,6 +15583,14 @@
14733
15583
  "isStatic": false,
14734
15584
  "isPublic": true
14735
15585
  },
15586
+ "getHandledBy": {
15587
+ "name": "getHandledBy",
15588
+ "async": false,
15589
+ "parameters": [],
15590
+ "returnType": "object | null",
15591
+ "isStatic": false,
15592
+ "isPublic": true
15593
+ },
14736
15594
  "isSendOutcomeUnknown": {
14737
15595
  "name": "isSendOutcomeUnknown",
14738
15596
  "async": false,
@@ -14914,7 +15772,7 @@
14914
15772
  ],
14915
15773
  "schema": {
14916
15774
  "tableName": "messages",
14917
- "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
15775
+ "ddl": "CREATE TABLE IF NOT EXISTS \"messages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"account_id\" UUID,\n \"persona_id\" UUID,\n \"endpoint_id\" UUID,\n \"correlation_id\" TEXT,\n \"thread_id\" TEXT,\n \"subject\" TEXT,\n \"body\" TEXT,\n \"from_address\" TEXT,\n \"from_name\" TEXT,\n \"to_addresses\" TEXT,\n \"date\" TIMESTAMP,\n \"is_read\" BOOLEAN DEFAULT FALSE,\n \"is_flagged\" BOOLEAN DEFAULT FALSE,\n \"has_attachments\" BOOLEAN DEFAULT FALSE,\n \"size\" INTEGER DEFAULT 0,\n \"metadata\" TEXT,\n \"send_status\" TEXT DEFAULT 'draft',\n \"sent_at\" TIMESTAMP,\n \"send_error\" TEXT,\n \"retry_count\" INTEGER DEFAULT 0,\n \"max_retries\" INTEGER DEFAULT 3,\n \"scheduled_send_at\" TIMESTAMP,\n \"in_reply_to_message_id\" UUID,\n \"handled_by_id\" TEXT,\n \"handled_by_kind\" TEXT,\n \"handled_at\" TIMESTAMP,\n \"message_id\" TEXT,\n \"in_reply_to\" TEXT,\n \"provider_message_id\" TEXT,\n \"cc_addresses\" TEXT,\n \"bcc_addresses\" TEXT,\n \"reply_to_address\" TEXT,\n \"reply_to_name\" TEXT,\n \"text_body\" TEXT,\n \"html_body\" TEXT,\n \"folder_id\" TEXT,\n \"folder_path\" TEXT,\n \"labels\" TEXT,\n \"flags\" TEXT,\n \"is_answered\" BOOLEAN DEFAULT FALSE,\n \"is_draft\" BOOLEAN DEFAULT FALSE,\n \"raw_message\" TEXT,\n \"headers\" TEXT,\n \"channel_id\" TEXT,\n \"channel_name\" TEXT,\n \"slack_ts\" TEXT,\n \"slack_thread_ts\" TEXT,\n \"reactions\" TEXT,\n \"is_edited\" BOOLEAN DEFAULT FALSE,\n \"message_type\" TEXT,\n \"blocks\" TEXT,\n \"tweet_id\" TEXT,\n \"retweet_count\" INTEGER DEFAULT 0,\n \"like_count\" INTEGER DEFAULT 0,\n \"reply_count\" INTEGER DEFAULT 0,\n \"is_retweet\" BOOLEAN DEFAULT FALSE,\n \"is_reply\" BOOLEAN DEFAULT FALSE,\n \"media_urls\" TEXT,\n \"hashtags\" TEXT,\n \"mentions\" TEXT\n);",
14918
15776
  "columns": {
14919
15777
  "_sync_origin_device_id": {
14920
15778
  "type": "TEXT"
@@ -15081,6 +15939,18 @@
15081
15939
  "onUpdate": "CASCADE"
15082
15940
  }
15083
15941
  },
15942
+ "handled_by_id": {
15943
+ "type": "TEXT",
15944
+ "notNull": false
15945
+ },
15946
+ "handled_by_kind": {
15947
+ "type": "TEXT",
15948
+ "notNull": false
15949
+ },
15950
+ "handled_at": {
15951
+ "type": "TIMESTAMP",
15952
+ "notNull": false
15953
+ },
15084
15954
  "message_id": {
15085
15955
  "type": "TEXT",
15086
15956
  "notNull": false
@@ -15334,7 +16204,7 @@
15334
16204
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \"retweet_count\" IS NOT NULL"
15335
16205
  }
15336
16206
  ],
15337
- "version": "28598df2"
16207
+ "version": "8541efa0"
15338
16208
  },
15339
16209
  "importPath": "@happyvertical/smrt-messages"
15340
16210
  },
@@ -15726,7 +16596,7 @@
15726
16596
  ],
15727
16597
  "schema": {
15728
16598
  "tableName": "accounts",
15729
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
16599
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
15730
16600
  "columns": {
15731
16601
  "_sync_origin_device_id": {
15732
16602
  "type": "TEXT"
@@ -15852,6 +16722,10 @@
15852
16722
  "notNull": false,
15853
16723
  "default": false
15854
16724
  },
16725
+ "agent_send_policy": {
16726
+ "type": "TEXT",
16727
+ "notNull": false
16728
+ },
15855
16729
  "workspace_id": {
15856
16730
  "type": "TEXT",
15857
16731
  "notNull": false
@@ -15921,7 +16795,7 @@
15921
16795
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
15922
16796
  }
15923
16797
  ],
15924
- "version": "f48d7a23"
16798
+ "version": "ff134288"
15925
16799
  },
15926
16800
  "importPath": "@happyvertical/smrt-messages"
15927
16801
  },
@@ -16799,7 +17673,7 @@
16799
17673
  ],
16800
17674
  "schema": {
16801
17675
  "tableName": "accounts",
16802
- "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
17676
+ "ddl": "CREATE TABLE IF NOT EXISTS \"accounts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT,\n \"provider_type\" TEXT,\n \"channel_type\" TEXT,\n \"credential_secret_id\" TEXT,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"owner_user_id\" UUID,\n \"label\" TEXT,\n \"connection_status\" TEXT,\n \"status_message\" TEXT,\n \"last_sync_at\" TIMESTAMP,\n \"settings\" TEXT,\n \"configuration\" TEXT,\n \"email\" TEXT,\n \"sync_interval_minutes\" INTEGER DEFAULT 60,\n \"sync_cursor\" TEXT,\n \"backfill_since\" TIMESTAMP,\n \"cursor_horizon\" TIMESTAMP,\n \"last_sync_error\" TEXT,\n \"backlog\" BOOLEAN DEFAULT FALSE,\n \"agent_send_policy\" TEXT,\n \"workspace_id\" TEXT,\n \"workspace_name\" TEXT,\n \"bot_user_id\" TEXT,\n \"handle\" TEXT,\n \"twitter_user_id\" TEXT\n);",
16803
17677
  "columns": {
16804
17678
  "_sync_origin_device_id": {
16805
17679
  "type": "TEXT"
@@ -16925,6 +17799,10 @@
16925
17799
  "notNull": false,
16926
17800
  "default": false
16927
17801
  },
17802
+ "agent_send_policy": {
17803
+ "type": "TEXT",
17804
+ "notNull": false
17805
+ },
16928
17806
  "workspace_id": {
16929
17807
  "type": "TEXT",
16930
17808
  "notNull": false
@@ -16994,7 +17872,7 @@
16994
17872
  "expression": "_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \"sync_interval_minutes\" IS NOT NULL"
16995
17873
  }
16996
17874
  ],
16997
- "version": "f48d7a23"
17875
+ "version": "ff134288"
16998
17876
  },
16999
17877
  "importPath": "@happyvertical/smrt-messages"
17000
17878
  }
@@ -17455,6 +18333,7 @@
17455
18333
  }
17456
18334
  ],
17457
18335
  "smrtDependencies": [
18336
+ "@happyvertical/smrt-approvals",
17458
18337
  "@happyvertical/smrt-core",
17459
18338
  "@happyvertical/smrt-jobs",
17460
18339
  "@happyvertical/smrt-ledgers",
@@ -17480,6 +18359,6 @@
17480
18359
  "@happyvertical/smrt-users"
17481
18360
  ]
17482
18361
  },
17483
- "schemaFingerprint": "d64b9eaef506b9ae1c64ad7f6e10f1cba78507606dc1dad60a5eb5eb594849b6",
18362
+ "schemaFingerprint": "6c2d289dee64b26574af5772316114fe544e87d90bbd30b5b70472341882fdb7",
17484
18363
  "stampsConstructors": true
17485
18364
  }