team-chat 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +458 -2
  3. package/agents/rules.md +52 -0
  4. package/agents/runtimes/codex.md +14 -0
  5. package/bin/bridge +3 -0
  6. package/bin/runner +3 -0
  7. package/cli/lib/agents.js +97 -0
  8. package/cli/lib/docs.js +151 -0
  9. package/cli/lib/local.js +41 -0
  10. package/cli/lib/server.js +52 -0
  11. package/cli/lib/util.js +107 -0
  12. package/cli/team-chat.js +383 -0
  13. package/host/bridge/attempts.js +43 -0
  14. package/host/bridge/bridge.js +326 -0
  15. package/host/bridge/config.js +105 -0
  16. package/host/bridge/knowledge-outbox.js +96 -0
  17. package/host/bridge/launcher.js +126 -0
  18. package/host/bridge/main.js +87 -0
  19. package/host/bridge/progress.js +74 -0
  20. package/host/bridge/prompt.js +97 -0
  21. package/host/bridge/run-archive.js +200 -0
  22. package/host/bridge/thread.js +44 -0
  23. package/host/bridge/triage.js +97 -0
  24. package/host/bridge/workdir.js +41 -0
  25. package/host/knowledge/card.js +43 -0
  26. package/host/knowledge/errors.js +50 -0
  27. package/host/knowledge/lesson.js +153 -0
  28. package/host/knowledge/process.js +160 -0
  29. package/host/knowledge/scrub.js +29 -0
  30. package/host/knowledge/shell.js +74 -0
  31. package/host/knowledge/stack.js +229 -0
  32. package/host/knowledge/transcript.js +82 -0
  33. package/host/lib/chat-api.js +120 -0
  34. package/host/lib/log.js +6 -0
  35. package/host/lib/pid-lock.js +65 -0
  36. package/host/lib/shell-words.js +45 -0
  37. package/host/runner/bridge-process.js +82 -0
  38. package/host/runner/config.js +81 -0
  39. package/host/runner/main.js +69 -0
  40. package/host/runner/retention.js +40 -0
  41. package/host/runner/runner.js +161 -0
  42. package/package.json +67 -5
  43. package/server/dist/src/app.js +25 -0
  44. package/server/dist/src/app.module.js +50 -0
  45. package/server/dist/src/attachments/attachment-store.js +111 -0
  46. package/server/dist/src/attachments/attachments.controller.js +67 -0
  47. package/server/dist/src/attachments/mime.js +84 -0
  48. package/server/dist/src/attachments/uploads.interceptor.js +72 -0
  49. package/server/dist/src/auth/participant.guard.js +53 -0
  50. package/server/dist/src/bridges/bridge-restart.service.js +80 -0
  51. package/server/dist/src/bridges/bridges.controller.js +47 -0
  52. package/server/dist/src/chats/chats.controller.js +83 -0
  53. package/server/dist/src/chats/chats.service.js +128 -0
  54. package/server/dist/src/collector/collector.controller.js +71 -0
  55. package/server/dist/src/collector/collector.module.js +23 -0
  56. package/server/dist/src/collector/collector.service.js +111 -0
  57. package/server/dist/src/common/clock.js +20 -0
  58. package/server/dist/src/common/errors.js +37 -0
  59. package/server/dist/src/common/format.js +14 -0
  60. package/server/dist/src/common/http.js +17 -0
  61. package/server/dist/src/common/slug.js +28 -0
  62. package/server/dist/src/common/tokens.js +19 -0
  63. package/server/dist/src/common/validation.js +41 -0
  64. package/server/dist/src/config/config.js +39 -0
  65. package/server/dist/src/conversation.module.js +41 -0
  66. package/server/dist/src/db/database.js +73 -0
  67. package/server/dist/src/db/database.module.js +51 -0
  68. package/server/dist/src/db/schema.js +212 -0
  69. package/server/dist/src/decisions/decisions.controller.js +55 -0
  70. package/server/dist/src/decisions/decisions.service.js +109 -0
  71. package/server/dist/src/documents/documents.controller.js +87 -0
  72. package/server/dist/src/documents/documents.service.js +189 -0
  73. package/server/dist/src/health/health.controller.js +29 -0
  74. package/server/dist/src/knowledge/knowledge.controller.js +83 -0
  75. package/server/dist/src/knowledge/knowledge.module.js +25 -0
  76. package/server/dist/src/knowledge/knowledge.service.js +189 -0
  77. package/server/dist/src/local/docs-sync.service.js +97 -0
  78. package/server/dist/src/local/local.controller.js +197 -0
  79. package/server/dist/src/local/local.guard.js +55 -0
  80. package/server/dist/src/local/local.module.js +30 -0
  81. package/server/dist/src/local/setup.service.js +154 -0
  82. package/server/dist/src/local/transfer.service.js +151 -0
  83. package/server/dist/src/main.js +33 -0
  84. package/server/dist/src/mcp/chat-tools.js +282 -0
  85. package/server/dist/src/mcp/mcp.controller.js +58 -0
  86. package/server/dist/src/mcp/mcp.module.js +24 -0
  87. package/server/dist/src/mentions/mention-state.js +80 -0
  88. package/server/dist/src/mentions/mentions.controller.js +100 -0
  89. package/server/dist/src/mentions/mentions.service.js +203 -0
  90. package/server/dist/src/messages/message.presenter.js +102 -0
  91. package/server/dist/src/messages/messages.service.js +149 -0
  92. package/server/dist/src/messages/thread.controller.js +179 -0
  93. package/server/dist/src/participants/directory.service.js +68 -0
  94. package/server/dist/src/participants/participants.module.js +24 -0
  95. package/server/dist/src/participants/participants.service.js +84 -0
  96. package/server/dist/src/settings/settings.service.js +42 -0
  97. package/server/dist/src/sharing/consent.js +16 -0
  98. package/server/dist/src/sharing/sharing.module.js +22 -0
  99. package/server/dist/src/sharing/sharing.service.js +175 -0
  100. package/server/dist/src/team/runner.service.js +75 -0
  101. package/server/dist/src/team/team.controller.js +178 -0
  102. package/server/dist/src/team/team.module.js +25 -0
  103. package/server/dist/src/team/team.service.js +280 -0
  104. package/server/dist/src/web/template.js +57 -0
  105. package/server/dist/src/web/web-login.service.js +74 -0
  106. package/server/dist/src/web/web.controller.js +203 -0
  107. package/server/dist/src/web/web.module.js +25 -0
  108. package/server/drizzle/0000_init.sql +169 -0
  109. package/server/drizzle/0001_seed_roles.sql +25 -0
  110. package/server/drizzle/0002_knowledge.sql +17 -0
  111. package/server/drizzle/0003_sharing.sql +30 -0
  112. package/server/drizzle/meta/0000_snapshot.json +1224 -0
  113. package/server/drizzle/meta/0001_snapshot.json +1224 -0
  114. package/server/drizzle/meta/0002_snapshot.json +1359 -0
  115. package/server/drizzle/meta/0003_snapshot.json +1545 -0
  116. package/server/drizzle/meta/_journal.json +34 -0
  117. package/server/package.json +1 -0
  118. package/server/views/chat.html +865 -0
  119. package/server/views/documents.html +204 -0
  120. package/server/views/login.html +31 -0
  121. package/server/views/setup.html +60 -0
  122. package/server/views/team.html +369 -0
@@ -0,0 +1,1224 @@
1
+ {
2
+ "id": "66ef8767-4a0c-4e5f-ab75-4531d182620f",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.attachments": {
8
+ "name": "attachments",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "serial",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "message_id": {
18
+ "name": "message_id",
19
+ "type": "integer",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "name": {
24
+ "name": "name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "mime": {
30
+ "name": "mime",
31
+ "type": "varchar(191)",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "size": {
36
+ "name": "size",
37
+ "type": "bigint",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "path": {
42
+ "name": "path",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "created_at": {
48
+ "name": "created_at",
49
+ "type": "timestamp with time zone",
50
+ "primaryKey": false,
51
+ "notNull": true,
52
+ "default": "now()"
53
+ },
54
+ "updated_at": {
55
+ "name": "updated_at",
56
+ "type": "timestamp with time zone",
57
+ "primaryKey": false,
58
+ "notNull": true,
59
+ "default": "now()"
60
+ }
61
+ },
62
+ "indexes": {},
63
+ "foreignKeys": {
64
+ "attachments_message_id_messages_id_fk": {
65
+ "name": "attachments_message_id_messages_id_fk",
66
+ "tableFrom": "attachments",
67
+ "tableTo": "messages",
68
+ "columnsFrom": [
69
+ "message_id"
70
+ ],
71
+ "columnsTo": [
72
+ "id"
73
+ ],
74
+ "onDelete": "cascade",
75
+ "onUpdate": "no action"
76
+ }
77
+ },
78
+ "compositePrimaryKeys": {},
79
+ "uniqueConstraints": {},
80
+ "policies": {},
81
+ "checkConstraints": {},
82
+ "isRLSEnabled": false
83
+ },
84
+ "public.chat_agent_roles": {
85
+ "name": "chat_agent_roles",
86
+ "schema": "",
87
+ "columns": {
88
+ "id": {
89
+ "name": "id",
90
+ "type": "serial",
91
+ "primaryKey": true,
92
+ "notNull": true
93
+ },
94
+ "chat_id": {
95
+ "name": "chat_id",
96
+ "type": "integer",
97
+ "primaryKey": false,
98
+ "notNull": true
99
+ },
100
+ "participant_id": {
101
+ "name": "participant_id",
102
+ "type": "integer",
103
+ "primaryKey": false,
104
+ "notNull": true
105
+ },
106
+ "role": {
107
+ "name": "role",
108
+ "type": "text",
109
+ "primaryKey": false,
110
+ "notNull": true
111
+ },
112
+ "created_at": {
113
+ "name": "created_at",
114
+ "type": "timestamp with time zone",
115
+ "primaryKey": false,
116
+ "notNull": true,
117
+ "default": "now()"
118
+ },
119
+ "updated_at": {
120
+ "name": "updated_at",
121
+ "type": "timestamp with time zone",
122
+ "primaryKey": false,
123
+ "notNull": true,
124
+ "default": "now()"
125
+ }
126
+ },
127
+ "indexes": {},
128
+ "foreignKeys": {
129
+ "chat_agent_roles_chat_id_chats_id_fk": {
130
+ "name": "chat_agent_roles_chat_id_chats_id_fk",
131
+ "tableFrom": "chat_agent_roles",
132
+ "tableTo": "chats",
133
+ "columnsFrom": [
134
+ "chat_id"
135
+ ],
136
+ "columnsTo": [
137
+ "id"
138
+ ],
139
+ "onDelete": "cascade",
140
+ "onUpdate": "no action"
141
+ },
142
+ "chat_agent_roles_participant_id_participants_id_fk": {
143
+ "name": "chat_agent_roles_participant_id_participants_id_fk",
144
+ "tableFrom": "chat_agent_roles",
145
+ "tableTo": "participants",
146
+ "columnsFrom": [
147
+ "participant_id"
148
+ ],
149
+ "columnsTo": [
150
+ "id"
151
+ ],
152
+ "onDelete": "cascade",
153
+ "onUpdate": "no action"
154
+ }
155
+ },
156
+ "compositePrimaryKeys": {},
157
+ "uniqueConstraints": {
158
+ "chat_agent_roles_chat_id_participant_id_unique": {
159
+ "name": "chat_agent_roles_chat_id_participant_id_unique",
160
+ "nullsNotDistinct": false,
161
+ "columns": [
162
+ "chat_id",
163
+ "participant_id"
164
+ ]
165
+ }
166
+ },
167
+ "policies": {},
168
+ "checkConstraints": {},
169
+ "isRLSEnabled": false
170
+ },
171
+ "public.chats": {
172
+ "name": "chats",
173
+ "schema": "",
174
+ "columns": {
175
+ "id": {
176
+ "name": "id",
177
+ "type": "serial",
178
+ "primaryKey": true,
179
+ "notNull": true
180
+ },
181
+ "slug": {
182
+ "name": "slug",
183
+ "type": "text",
184
+ "primaryKey": false,
185
+ "notNull": true
186
+ },
187
+ "name": {
188
+ "name": "name",
189
+ "type": "text",
190
+ "primaryKey": false,
191
+ "notNull": true
192
+ },
193
+ "description": {
194
+ "name": "description",
195
+ "type": "text",
196
+ "primaryKey": false,
197
+ "notNull": false
198
+ },
199
+ "workdir": {
200
+ "name": "workdir",
201
+ "type": "text",
202
+ "primaryKey": false,
203
+ "notNull": false
204
+ },
205
+ "created_at": {
206
+ "name": "created_at",
207
+ "type": "timestamp with time zone",
208
+ "primaryKey": false,
209
+ "notNull": true,
210
+ "default": "now()"
211
+ },
212
+ "updated_at": {
213
+ "name": "updated_at",
214
+ "type": "timestamp with time zone",
215
+ "primaryKey": false,
216
+ "notNull": true,
217
+ "default": "now()"
218
+ }
219
+ },
220
+ "indexes": {},
221
+ "foreignKeys": {},
222
+ "compositePrimaryKeys": {},
223
+ "uniqueConstraints": {
224
+ "chats_slug_unique": {
225
+ "name": "chats_slug_unique",
226
+ "nullsNotDistinct": false,
227
+ "columns": [
228
+ "slug"
229
+ ]
230
+ }
231
+ },
232
+ "policies": {},
233
+ "checkConstraints": {},
234
+ "isRLSEnabled": false
235
+ },
236
+ "public.decisions": {
237
+ "name": "decisions",
238
+ "schema": "",
239
+ "columns": {
240
+ "id": {
241
+ "name": "id",
242
+ "type": "serial",
243
+ "primaryKey": true,
244
+ "notNull": true
245
+ },
246
+ "chat_id": {
247
+ "name": "chat_id",
248
+ "type": "integer",
249
+ "primaryKey": false,
250
+ "notNull": true
251
+ },
252
+ "number": {
253
+ "name": "number",
254
+ "type": "integer",
255
+ "primaryKey": false,
256
+ "notNull": true
257
+ },
258
+ "participant_id": {
259
+ "name": "participant_id",
260
+ "type": "integer",
261
+ "primaryKey": false,
262
+ "notNull": true
263
+ },
264
+ "title": {
265
+ "name": "title",
266
+ "type": "text",
267
+ "primaryKey": false,
268
+ "notNull": true
269
+ },
270
+ "body": {
271
+ "name": "body",
272
+ "type": "text",
273
+ "primaryKey": false,
274
+ "notNull": false
275
+ },
276
+ "message_id": {
277
+ "name": "message_id",
278
+ "type": "integer",
279
+ "primaryKey": false,
280
+ "notNull": false
281
+ },
282
+ "supersedes_id": {
283
+ "name": "supersedes_id",
284
+ "type": "integer",
285
+ "primaryKey": false,
286
+ "notNull": false
287
+ },
288
+ "created_at": {
289
+ "name": "created_at",
290
+ "type": "timestamp with time zone",
291
+ "primaryKey": false,
292
+ "notNull": true,
293
+ "default": "now()"
294
+ },
295
+ "updated_at": {
296
+ "name": "updated_at",
297
+ "type": "timestamp with time zone",
298
+ "primaryKey": false,
299
+ "notNull": true,
300
+ "default": "now()"
301
+ }
302
+ },
303
+ "indexes": {},
304
+ "foreignKeys": {
305
+ "decisions_chat_id_chats_id_fk": {
306
+ "name": "decisions_chat_id_chats_id_fk",
307
+ "tableFrom": "decisions",
308
+ "tableTo": "chats",
309
+ "columnsFrom": [
310
+ "chat_id"
311
+ ],
312
+ "columnsTo": [
313
+ "id"
314
+ ],
315
+ "onDelete": "cascade",
316
+ "onUpdate": "no action"
317
+ },
318
+ "decisions_participant_id_participants_id_fk": {
319
+ "name": "decisions_participant_id_participants_id_fk",
320
+ "tableFrom": "decisions",
321
+ "tableTo": "participants",
322
+ "columnsFrom": [
323
+ "participant_id"
324
+ ],
325
+ "columnsTo": [
326
+ "id"
327
+ ],
328
+ "onDelete": "cascade",
329
+ "onUpdate": "no action"
330
+ },
331
+ "decisions_message_id_messages_id_fk": {
332
+ "name": "decisions_message_id_messages_id_fk",
333
+ "tableFrom": "decisions",
334
+ "tableTo": "messages",
335
+ "columnsFrom": [
336
+ "message_id"
337
+ ],
338
+ "columnsTo": [
339
+ "id"
340
+ ],
341
+ "onDelete": "set null",
342
+ "onUpdate": "no action"
343
+ },
344
+ "decisions_supersedes_id_decisions_id_fk": {
345
+ "name": "decisions_supersedes_id_decisions_id_fk",
346
+ "tableFrom": "decisions",
347
+ "tableTo": "decisions",
348
+ "columnsFrom": [
349
+ "supersedes_id"
350
+ ],
351
+ "columnsTo": [
352
+ "id"
353
+ ],
354
+ "onDelete": "set null",
355
+ "onUpdate": "no action"
356
+ }
357
+ },
358
+ "compositePrimaryKeys": {},
359
+ "uniqueConstraints": {
360
+ "decisions_chat_id_number_unique": {
361
+ "name": "decisions_chat_id_number_unique",
362
+ "nullsNotDistinct": false,
363
+ "columns": [
364
+ "chat_id",
365
+ "number"
366
+ ]
367
+ }
368
+ },
369
+ "policies": {},
370
+ "checkConstraints": {},
371
+ "isRLSEnabled": false
372
+ },
373
+ "public.document_versions": {
374
+ "name": "document_versions",
375
+ "schema": "",
376
+ "columns": {
377
+ "id": {
378
+ "name": "id",
379
+ "type": "serial",
380
+ "primaryKey": true,
381
+ "notNull": true
382
+ },
383
+ "document_id": {
384
+ "name": "document_id",
385
+ "type": "integer",
386
+ "primaryKey": false,
387
+ "notNull": true
388
+ },
389
+ "revision": {
390
+ "name": "revision",
391
+ "type": "integer",
392
+ "primaryKey": false,
393
+ "notNull": true
394
+ },
395
+ "body": {
396
+ "name": "body",
397
+ "type": "text",
398
+ "primaryKey": false,
399
+ "notNull": true
400
+ },
401
+ "participant_id": {
402
+ "name": "participant_id",
403
+ "type": "integer",
404
+ "primaryKey": false,
405
+ "notNull": false
406
+ },
407
+ "note": {
408
+ "name": "note",
409
+ "type": "text",
410
+ "primaryKey": false,
411
+ "notNull": false
412
+ },
413
+ "created_at": {
414
+ "name": "created_at",
415
+ "type": "timestamp with time zone",
416
+ "primaryKey": false,
417
+ "notNull": true,
418
+ "default": "now()"
419
+ },
420
+ "updated_at": {
421
+ "name": "updated_at",
422
+ "type": "timestamp with time zone",
423
+ "primaryKey": false,
424
+ "notNull": true,
425
+ "default": "now()"
426
+ }
427
+ },
428
+ "indexes": {},
429
+ "foreignKeys": {
430
+ "document_versions_document_id_documents_id_fk": {
431
+ "name": "document_versions_document_id_documents_id_fk",
432
+ "tableFrom": "document_versions",
433
+ "tableTo": "documents",
434
+ "columnsFrom": [
435
+ "document_id"
436
+ ],
437
+ "columnsTo": [
438
+ "id"
439
+ ],
440
+ "onDelete": "cascade",
441
+ "onUpdate": "no action"
442
+ },
443
+ "document_versions_participant_id_participants_id_fk": {
444
+ "name": "document_versions_participant_id_participants_id_fk",
445
+ "tableFrom": "document_versions",
446
+ "tableTo": "participants",
447
+ "columnsFrom": [
448
+ "participant_id"
449
+ ],
450
+ "columnsTo": [
451
+ "id"
452
+ ],
453
+ "onDelete": "set null",
454
+ "onUpdate": "no action"
455
+ }
456
+ },
457
+ "compositePrimaryKeys": {},
458
+ "uniqueConstraints": {
459
+ "document_versions_document_id_revision_unique": {
460
+ "name": "document_versions_document_id_revision_unique",
461
+ "nullsNotDistinct": false,
462
+ "columns": [
463
+ "document_id",
464
+ "revision"
465
+ ]
466
+ }
467
+ },
468
+ "policies": {},
469
+ "checkConstraints": {},
470
+ "isRLSEnabled": false
471
+ },
472
+ "public.documents": {
473
+ "name": "documents",
474
+ "schema": "",
475
+ "columns": {
476
+ "id": {
477
+ "name": "id",
478
+ "type": "serial",
479
+ "primaryKey": true,
480
+ "notNull": true
481
+ },
482
+ "chat_id": {
483
+ "name": "chat_id",
484
+ "type": "integer",
485
+ "primaryKey": false,
486
+ "notNull": true
487
+ },
488
+ "slug": {
489
+ "name": "slug",
490
+ "type": "text",
491
+ "primaryKey": false,
492
+ "notNull": true
493
+ },
494
+ "title": {
495
+ "name": "title",
496
+ "type": "text",
497
+ "primaryKey": false,
498
+ "notNull": true
499
+ },
500
+ "kind": {
501
+ "name": "kind",
502
+ "type": "text",
503
+ "primaryKey": false,
504
+ "notNull": true
505
+ },
506
+ "status": {
507
+ "name": "status",
508
+ "type": "text",
509
+ "primaryKey": false,
510
+ "notNull": true,
511
+ "default": "'draft'"
512
+ },
513
+ "origin": {
514
+ "name": "origin",
515
+ "type": "text",
516
+ "primaryKey": false,
517
+ "notNull": false
518
+ },
519
+ "participant_id": {
520
+ "name": "participant_id",
521
+ "type": "integer",
522
+ "primaryKey": false,
523
+ "notNull": false
524
+ },
525
+ "created_at": {
526
+ "name": "created_at",
527
+ "type": "timestamp with time zone",
528
+ "primaryKey": false,
529
+ "notNull": true,
530
+ "default": "now()"
531
+ },
532
+ "updated_at": {
533
+ "name": "updated_at",
534
+ "type": "timestamp with time zone",
535
+ "primaryKey": false,
536
+ "notNull": true,
537
+ "default": "now()"
538
+ }
539
+ },
540
+ "indexes": {
541
+ "documents_status_kind_index": {
542
+ "name": "documents_status_kind_index",
543
+ "columns": [
544
+ {
545
+ "expression": "status",
546
+ "isExpression": false,
547
+ "asc": true,
548
+ "nulls": "last"
549
+ },
550
+ {
551
+ "expression": "kind",
552
+ "isExpression": false,
553
+ "asc": true,
554
+ "nulls": "last"
555
+ }
556
+ ],
557
+ "isUnique": false,
558
+ "concurrently": false,
559
+ "method": "btree",
560
+ "with": {}
561
+ }
562
+ },
563
+ "foreignKeys": {
564
+ "documents_chat_id_chats_id_fk": {
565
+ "name": "documents_chat_id_chats_id_fk",
566
+ "tableFrom": "documents",
567
+ "tableTo": "chats",
568
+ "columnsFrom": [
569
+ "chat_id"
570
+ ],
571
+ "columnsTo": [
572
+ "id"
573
+ ],
574
+ "onDelete": "cascade",
575
+ "onUpdate": "no action"
576
+ },
577
+ "documents_participant_id_participants_id_fk": {
578
+ "name": "documents_participant_id_participants_id_fk",
579
+ "tableFrom": "documents",
580
+ "tableTo": "participants",
581
+ "columnsFrom": [
582
+ "participant_id"
583
+ ],
584
+ "columnsTo": [
585
+ "id"
586
+ ],
587
+ "onDelete": "set null",
588
+ "onUpdate": "no action"
589
+ }
590
+ },
591
+ "compositePrimaryKeys": {},
592
+ "uniqueConstraints": {
593
+ "documents_chat_id_slug_unique": {
594
+ "name": "documents_chat_id_slug_unique",
595
+ "nullsNotDistinct": false,
596
+ "columns": [
597
+ "chat_id",
598
+ "slug"
599
+ ]
600
+ }
601
+ },
602
+ "policies": {},
603
+ "checkConstraints": {},
604
+ "isRLSEnabled": false
605
+ },
606
+ "public.login_codes": {
607
+ "name": "login_codes",
608
+ "schema": "",
609
+ "columns": {
610
+ "code_hash": {
611
+ "name": "code_hash",
612
+ "type": "varchar(64)",
613
+ "primaryKey": true,
614
+ "notNull": true
615
+ },
616
+ "participant_id": {
617
+ "name": "participant_id",
618
+ "type": "integer",
619
+ "primaryKey": false,
620
+ "notNull": true
621
+ },
622
+ "expires_at": {
623
+ "name": "expires_at",
624
+ "type": "timestamp with time zone",
625
+ "primaryKey": false,
626
+ "notNull": true
627
+ },
628
+ "created_at": {
629
+ "name": "created_at",
630
+ "type": "timestamp with time zone",
631
+ "primaryKey": false,
632
+ "notNull": true,
633
+ "default": "now()"
634
+ }
635
+ },
636
+ "indexes": {},
637
+ "foreignKeys": {
638
+ "login_codes_participant_id_participants_id_fk": {
639
+ "name": "login_codes_participant_id_participants_id_fk",
640
+ "tableFrom": "login_codes",
641
+ "tableTo": "participants",
642
+ "columnsFrom": [
643
+ "participant_id"
644
+ ],
645
+ "columnsTo": [
646
+ "id"
647
+ ],
648
+ "onDelete": "cascade",
649
+ "onUpdate": "no action"
650
+ }
651
+ },
652
+ "compositePrimaryKeys": {},
653
+ "uniqueConstraints": {},
654
+ "policies": {},
655
+ "checkConstraints": {},
656
+ "isRLSEnabled": false
657
+ },
658
+ "public.mentions": {
659
+ "name": "mentions",
660
+ "schema": "",
661
+ "columns": {
662
+ "id": {
663
+ "name": "id",
664
+ "type": "serial",
665
+ "primaryKey": true,
666
+ "notNull": true
667
+ },
668
+ "message_id": {
669
+ "name": "message_id",
670
+ "type": "integer",
671
+ "primaryKey": false,
672
+ "notNull": true
673
+ },
674
+ "participant_id": {
675
+ "name": "participant_id",
676
+ "type": "integer",
677
+ "primaryKey": false,
678
+ "notNull": true
679
+ },
680
+ "handled_at": {
681
+ "name": "handled_at",
682
+ "type": "timestamp with time zone",
683
+ "primaryKey": false,
684
+ "notNull": false
685
+ },
686
+ "run_started_at": {
687
+ "name": "run_started_at",
688
+ "type": "timestamp with time zone",
689
+ "primaryKey": false,
690
+ "notNull": false
691
+ },
692
+ "beat_at": {
693
+ "name": "beat_at",
694
+ "type": "timestamp with time zone",
695
+ "primaryKey": false,
696
+ "notNull": false
697
+ },
698
+ "beat_ttl": {
699
+ "name": "beat_ttl",
700
+ "type": "integer",
701
+ "primaryKey": false,
702
+ "notNull": false
703
+ },
704
+ "outcome": {
705
+ "name": "outcome",
706
+ "type": "varchar(16)",
707
+ "primaryKey": false,
708
+ "notNull": false
709
+ },
710
+ "outcome_at": {
711
+ "name": "outcome_at",
712
+ "type": "timestamp with time zone",
713
+ "primaryKey": false,
714
+ "notNull": false
715
+ },
716
+ "note": {
717
+ "name": "note",
718
+ "type": "text",
719
+ "primaryKey": false,
720
+ "notNull": false
721
+ },
722
+ "attempts": {
723
+ "name": "attempts",
724
+ "type": "integer",
725
+ "primaryKey": false,
726
+ "notNull": true,
727
+ "default": 0
728
+ },
729
+ "created_at": {
730
+ "name": "created_at",
731
+ "type": "timestamp with time zone",
732
+ "primaryKey": false,
733
+ "notNull": true,
734
+ "default": "now()"
735
+ },
736
+ "updated_at": {
737
+ "name": "updated_at",
738
+ "type": "timestamp with time zone",
739
+ "primaryKey": false,
740
+ "notNull": true,
741
+ "default": "now()"
742
+ }
743
+ },
744
+ "indexes": {
745
+ "mentions_participant_id_handled_at_index": {
746
+ "name": "mentions_participant_id_handled_at_index",
747
+ "columns": [
748
+ {
749
+ "expression": "participant_id",
750
+ "isExpression": false,
751
+ "asc": true,
752
+ "nulls": "last"
753
+ },
754
+ {
755
+ "expression": "handled_at",
756
+ "isExpression": false,
757
+ "asc": true,
758
+ "nulls": "last"
759
+ }
760
+ ],
761
+ "isUnique": false,
762
+ "concurrently": false,
763
+ "method": "btree",
764
+ "with": {}
765
+ }
766
+ },
767
+ "foreignKeys": {
768
+ "mentions_message_id_messages_id_fk": {
769
+ "name": "mentions_message_id_messages_id_fk",
770
+ "tableFrom": "mentions",
771
+ "tableTo": "messages",
772
+ "columnsFrom": [
773
+ "message_id"
774
+ ],
775
+ "columnsTo": [
776
+ "id"
777
+ ],
778
+ "onDelete": "cascade",
779
+ "onUpdate": "no action"
780
+ },
781
+ "mentions_participant_id_participants_id_fk": {
782
+ "name": "mentions_participant_id_participants_id_fk",
783
+ "tableFrom": "mentions",
784
+ "tableTo": "participants",
785
+ "columnsFrom": [
786
+ "participant_id"
787
+ ],
788
+ "columnsTo": [
789
+ "id"
790
+ ],
791
+ "onDelete": "cascade",
792
+ "onUpdate": "no action"
793
+ }
794
+ },
795
+ "compositePrimaryKeys": {},
796
+ "uniqueConstraints": {
797
+ "mentions_message_id_participant_id_unique": {
798
+ "name": "mentions_message_id_participant_id_unique",
799
+ "nullsNotDistinct": false,
800
+ "columns": [
801
+ "message_id",
802
+ "participant_id"
803
+ ]
804
+ }
805
+ },
806
+ "policies": {},
807
+ "checkConstraints": {},
808
+ "isRLSEnabled": false
809
+ },
810
+ "public.messages": {
811
+ "name": "messages",
812
+ "schema": "",
813
+ "columns": {
814
+ "id": {
815
+ "name": "id",
816
+ "type": "serial",
817
+ "primaryKey": true,
818
+ "notNull": true
819
+ },
820
+ "chat_id": {
821
+ "name": "chat_id",
822
+ "type": "integer",
823
+ "primaryKey": false,
824
+ "notNull": true
825
+ },
826
+ "participant_id": {
827
+ "name": "participant_id",
828
+ "type": "integer",
829
+ "primaryKey": false,
830
+ "notNull": true
831
+ },
832
+ "body": {
833
+ "name": "body",
834
+ "type": "text",
835
+ "primaryKey": false,
836
+ "notNull": true
837
+ },
838
+ "reply_to_id": {
839
+ "name": "reply_to_id",
840
+ "type": "integer",
841
+ "primaryKey": false,
842
+ "notNull": false
843
+ },
844
+ "asks_owner": {
845
+ "name": "asks_owner",
846
+ "type": "boolean",
847
+ "primaryKey": false,
848
+ "notNull": true,
849
+ "default": false
850
+ },
851
+ "created_at": {
852
+ "name": "created_at",
853
+ "type": "timestamp with time zone",
854
+ "primaryKey": false,
855
+ "notNull": true,
856
+ "default": "now()"
857
+ },
858
+ "updated_at": {
859
+ "name": "updated_at",
860
+ "type": "timestamp with time zone",
861
+ "primaryKey": false,
862
+ "notNull": true,
863
+ "default": "now()"
864
+ }
865
+ },
866
+ "indexes": {
867
+ "messages_chat_id_id_index": {
868
+ "name": "messages_chat_id_id_index",
869
+ "columns": [
870
+ {
871
+ "expression": "chat_id",
872
+ "isExpression": false,
873
+ "asc": true,
874
+ "nulls": "last"
875
+ },
876
+ {
877
+ "expression": "id",
878
+ "isExpression": false,
879
+ "asc": true,
880
+ "nulls": "last"
881
+ }
882
+ ],
883
+ "isUnique": false,
884
+ "concurrently": false,
885
+ "method": "btree",
886
+ "with": {}
887
+ },
888
+ "messages_created_at_index": {
889
+ "name": "messages_created_at_index",
890
+ "columns": [
891
+ {
892
+ "expression": "created_at",
893
+ "isExpression": false,
894
+ "asc": true,
895
+ "nulls": "last"
896
+ }
897
+ ],
898
+ "isUnique": false,
899
+ "concurrently": false,
900
+ "method": "btree",
901
+ "with": {}
902
+ }
903
+ },
904
+ "foreignKeys": {
905
+ "messages_chat_id_chats_id_fk": {
906
+ "name": "messages_chat_id_chats_id_fk",
907
+ "tableFrom": "messages",
908
+ "tableTo": "chats",
909
+ "columnsFrom": [
910
+ "chat_id"
911
+ ],
912
+ "columnsTo": [
913
+ "id"
914
+ ],
915
+ "onDelete": "cascade",
916
+ "onUpdate": "no action"
917
+ },
918
+ "messages_participant_id_participants_id_fk": {
919
+ "name": "messages_participant_id_participants_id_fk",
920
+ "tableFrom": "messages",
921
+ "tableTo": "participants",
922
+ "columnsFrom": [
923
+ "participant_id"
924
+ ],
925
+ "columnsTo": [
926
+ "id"
927
+ ],
928
+ "onDelete": "cascade",
929
+ "onUpdate": "no action"
930
+ },
931
+ "messages_reply_to_id_messages_id_fk": {
932
+ "name": "messages_reply_to_id_messages_id_fk",
933
+ "tableFrom": "messages",
934
+ "tableTo": "messages",
935
+ "columnsFrom": [
936
+ "reply_to_id"
937
+ ],
938
+ "columnsTo": [
939
+ "id"
940
+ ],
941
+ "onDelete": "set null",
942
+ "onUpdate": "no action"
943
+ }
944
+ },
945
+ "compositePrimaryKeys": {},
946
+ "uniqueConstraints": {},
947
+ "policies": {},
948
+ "checkConstraints": {},
949
+ "isRLSEnabled": false
950
+ },
951
+ "public.participant_tokens": {
952
+ "name": "participant_tokens",
953
+ "schema": "",
954
+ "columns": {
955
+ "id": {
956
+ "name": "id",
957
+ "type": "serial",
958
+ "primaryKey": true,
959
+ "notNull": true
960
+ },
961
+ "participant_id": {
962
+ "name": "participant_id",
963
+ "type": "integer",
964
+ "primaryKey": false,
965
+ "notNull": true
966
+ },
967
+ "token_hash": {
968
+ "name": "token_hash",
969
+ "type": "varchar(64)",
970
+ "primaryKey": false,
971
+ "notNull": true
972
+ },
973
+ "label": {
974
+ "name": "label",
975
+ "type": "text",
976
+ "primaryKey": false,
977
+ "notNull": true
978
+ },
979
+ "created_at": {
980
+ "name": "created_at",
981
+ "type": "timestamp with time zone",
982
+ "primaryKey": false,
983
+ "notNull": true,
984
+ "default": "now()"
985
+ },
986
+ "updated_at": {
987
+ "name": "updated_at",
988
+ "type": "timestamp with time zone",
989
+ "primaryKey": false,
990
+ "notNull": true,
991
+ "default": "now()"
992
+ }
993
+ },
994
+ "indexes": {},
995
+ "foreignKeys": {
996
+ "participant_tokens_participant_id_participants_id_fk": {
997
+ "name": "participant_tokens_participant_id_participants_id_fk",
998
+ "tableFrom": "participant_tokens",
999
+ "tableTo": "participants",
1000
+ "columnsFrom": [
1001
+ "participant_id"
1002
+ ],
1003
+ "columnsTo": [
1004
+ "id"
1005
+ ],
1006
+ "onDelete": "cascade",
1007
+ "onUpdate": "no action"
1008
+ }
1009
+ },
1010
+ "compositePrimaryKeys": {},
1011
+ "uniqueConstraints": {
1012
+ "participant_tokens_token_hash_unique": {
1013
+ "name": "participant_tokens_token_hash_unique",
1014
+ "nullsNotDistinct": false,
1015
+ "columns": [
1016
+ "token_hash"
1017
+ ]
1018
+ }
1019
+ },
1020
+ "policies": {},
1021
+ "checkConstraints": {},
1022
+ "isRLSEnabled": false
1023
+ },
1024
+ "public.participants": {
1025
+ "name": "participants",
1026
+ "schema": "",
1027
+ "columns": {
1028
+ "id": {
1029
+ "name": "id",
1030
+ "type": "serial",
1031
+ "primaryKey": true,
1032
+ "notNull": true
1033
+ },
1034
+ "name": {
1035
+ "name": "name",
1036
+ "type": "text",
1037
+ "primaryKey": false,
1038
+ "notNull": true
1039
+ },
1040
+ "handle": {
1041
+ "name": "handle",
1042
+ "type": "text",
1043
+ "primaryKey": false,
1044
+ "notNull": true
1045
+ },
1046
+ "kind": {
1047
+ "name": "kind",
1048
+ "type": "text",
1049
+ "primaryKey": false,
1050
+ "notNull": true
1051
+ },
1052
+ "role": {
1053
+ "name": "role",
1054
+ "type": "text",
1055
+ "primaryKey": false,
1056
+ "notNull": true
1057
+ },
1058
+ "accent": {
1059
+ "name": "accent",
1060
+ "type": "varchar(16)",
1061
+ "primaryKey": false,
1062
+ "notNull": true,
1063
+ "default": "'#0057c2'"
1064
+ },
1065
+ "token_hash": {
1066
+ "name": "token_hash",
1067
+ "type": "varchar(64)",
1068
+ "primaryKey": false,
1069
+ "notNull": false
1070
+ },
1071
+ "last_seen_at": {
1072
+ "name": "last_seen_at",
1073
+ "type": "timestamp with time zone",
1074
+ "primaryKey": false,
1075
+ "notNull": false
1076
+ },
1077
+ "runtime": {
1078
+ "name": "runtime",
1079
+ "type": "varchar(40)",
1080
+ "primaryKey": false,
1081
+ "notNull": false
1082
+ },
1083
+ "disabled_at": {
1084
+ "name": "disabled_at",
1085
+ "type": "timestamp with time zone",
1086
+ "primaryKey": false,
1087
+ "notNull": false
1088
+ },
1089
+ "host_id": {
1090
+ "name": "host_id",
1091
+ "type": "integer",
1092
+ "primaryKey": false,
1093
+ "notNull": false
1094
+ },
1095
+ "runtimes": {
1096
+ "name": "runtimes",
1097
+ "type": "jsonb",
1098
+ "primaryKey": false,
1099
+ "notNull": false
1100
+ },
1101
+ "created_at": {
1102
+ "name": "created_at",
1103
+ "type": "timestamp with time zone",
1104
+ "primaryKey": false,
1105
+ "notNull": true,
1106
+ "default": "now()"
1107
+ },
1108
+ "updated_at": {
1109
+ "name": "updated_at",
1110
+ "type": "timestamp with time zone",
1111
+ "primaryKey": false,
1112
+ "notNull": true,
1113
+ "default": "now()"
1114
+ }
1115
+ },
1116
+ "indexes": {},
1117
+ "foreignKeys": {
1118
+ "participants_host_id_participants_id_fk": {
1119
+ "name": "participants_host_id_participants_id_fk",
1120
+ "tableFrom": "participants",
1121
+ "tableTo": "participants",
1122
+ "columnsFrom": [
1123
+ "host_id"
1124
+ ],
1125
+ "columnsTo": [
1126
+ "id"
1127
+ ],
1128
+ "onDelete": "set null",
1129
+ "onUpdate": "no action"
1130
+ }
1131
+ },
1132
+ "compositePrimaryKeys": {},
1133
+ "uniqueConstraints": {
1134
+ "participants_handle_unique": {
1135
+ "name": "participants_handle_unique",
1136
+ "nullsNotDistinct": false,
1137
+ "columns": [
1138
+ "handle"
1139
+ ]
1140
+ },
1141
+ "participants_token_hash_unique": {
1142
+ "name": "participants_token_hash_unique",
1143
+ "nullsNotDistinct": false,
1144
+ "columns": [
1145
+ "token_hash"
1146
+ ]
1147
+ }
1148
+ },
1149
+ "policies": {},
1150
+ "checkConstraints": {},
1151
+ "isRLSEnabled": false
1152
+ },
1153
+ "public.roles": {
1154
+ "name": "roles",
1155
+ "schema": "",
1156
+ "columns": {
1157
+ "id": {
1158
+ "name": "id",
1159
+ "type": "serial",
1160
+ "primaryKey": true,
1161
+ "notNull": true
1162
+ },
1163
+ "slug": {
1164
+ "name": "slug",
1165
+ "type": "text",
1166
+ "primaryKey": false,
1167
+ "notNull": true
1168
+ },
1169
+ "name": {
1170
+ "name": "name",
1171
+ "type": "text",
1172
+ "primaryKey": false,
1173
+ "notNull": true
1174
+ },
1175
+ "instructions": {
1176
+ "name": "instructions",
1177
+ "type": "text",
1178
+ "primaryKey": false,
1179
+ "notNull": true
1180
+ },
1181
+ "created_at": {
1182
+ "name": "created_at",
1183
+ "type": "timestamp with time zone",
1184
+ "primaryKey": false,
1185
+ "notNull": true,
1186
+ "default": "now()"
1187
+ },
1188
+ "updated_at": {
1189
+ "name": "updated_at",
1190
+ "type": "timestamp with time zone",
1191
+ "primaryKey": false,
1192
+ "notNull": true,
1193
+ "default": "now()"
1194
+ }
1195
+ },
1196
+ "indexes": {},
1197
+ "foreignKeys": {},
1198
+ "compositePrimaryKeys": {},
1199
+ "uniqueConstraints": {
1200
+ "roles_slug_unique": {
1201
+ "name": "roles_slug_unique",
1202
+ "nullsNotDistinct": false,
1203
+ "columns": [
1204
+ "slug"
1205
+ ]
1206
+ }
1207
+ },
1208
+ "policies": {},
1209
+ "checkConstraints": {},
1210
+ "isRLSEnabled": false
1211
+ }
1212
+ },
1213
+ "enums": {},
1214
+ "schemas": {},
1215
+ "sequences": {},
1216
+ "roles": {},
1217
+ "policies": {},
1218
+ "views": {},
1219
+ "_meta": {
1220
+ "columns": {},
1221
+ "schemas": {},
1222
+ "tables": {}
1223
+ }
1224
+ }