team-chat 0.0.0-stage → 0.3.1

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 +61 -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,1359 @@
1
+ {
2
+ "id": "efcc6ed3-9449-4389-a5dc-b2d1ff11ee7a",
3
+ "prevId": "4a26c3d6-98f8-4589-b636-ceb16b1f619e",
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.knowledge_cards": {
607
+ "name": "knowledge_cards",
608
+ "schema": "",
609
+ "columns": {
610
+ "id": {
611
+ "name": "id",
612
+ "type": "serial",
613
+ "primaryKey": true,
614
+ "notNull": true
615
+ },
616
+ "chat_id": {
617
+ "name": "chat_id",
618
+ "type": "integer",
619
+ "primaryKey": false,
620
+ "notNull": true
621
+ },
622
+ "participant_id": {
623
+ "name": "participant_id",
624
+ "type": "integer",
625
+ "primaryKey": false,
626
+ "notNull": false
627
+ },
628
+ "key": {
629
+ "name": "key",
630
+ "type": "text",
631
+ "primaryKey": false,
632
+ "notNull": true
633
+ },
634
+ "format": {
635
+ "name": "format",
636
+ "type": "integer",
637
+ "primaryKey": false,
638
+ "notNull": true
639
+ },
640
+ "card": {
641
+ "name": "card",
642
+ "type": "jsonb",
643
+ "primaryKey": false,
644
+ "notNull": true
645
+ },
646
+ "search": {
647
+ "name": "search",
648
+ "type": "text",
649
+ "primaryKey": false,
650
+ "notNull": false
651
+ },
652
+ "created_at": {
653
+ "name": "created_at",
654
+ "type": "timestamp with time zone",
655
+ "primaryKey": false,
656
+ "notNull": true,
657
+ "default": "now()"
658
+ },
659
+ "updated_at": {
660
+ "name": "updated_at",
661
+ "type": "timestamp with time zone",
662
+ "primaryKey": false,
663
+ "notNull": true,
664
+ "default": "now()"
665
+ }
666
+ },
667
+ "indexes": {
668
+ "knowledge_cards_search_idx": {
669
+ "name": "knowledge_cards_search_idx",
670
+ "columns": [
671
+ {
672
+ "expression": "to_tsvector('russian', \"search\")",
673
+ "asc": true,
674
+ "isExpression": true,
675
+ "nulls": "last"
676
+ }
677
+ ],
678
+ "isUnique": false,
679
+ "concurrently": false,
680
+ "method": "gin",
681
+ "with": {}
682
+ },
683
+ "knowledge_cards_chat_id_index": {
684
+ "name": "knowledge_cards_chat_id_index",
685
+ "columns": [
686
+ {
687
+ "expression": "chat_id",
688
+ "isExpression": false,
689
+ "asc": true,
690
+ "nulls": "last"
691
+ }
692
+ ],
693
+ "isUnique": false,
694
+ "concurrently": false,
695
+ "method": "btree",
696
+ "with": {}
697
+ }
698
+ },
699
+ "foreignKeys": {
700
+ "knowledge_cards_chat_id_chats_id_fk": {
701
+ "name": "knowledge_cards_chat_id_chats_id_fk",
702
+ "tableFrom": "knowledge_cards",
703
+ "tableTo": "chats",
704
+ "columnsFrom": [
705
+ "chat_id"
706
+ ],
707
+ "columnsTo": [
708
+ "id"
709
+ ],
710
+ "onDelete": "cascade",
711
+ "onUpdate": "no action"
712
+ },
713
+ "knowledge_cards_participant_id_participants_id_fk": {
714
+ "name": "knowledge_cards_participant_id_participants_id_fk",
715
+ "tableFrom": "knowledge_cards",
716
+ "tableTo": "participants",
717
+ "columnsFrom": [
718
+ "participant_id"
719
+ ],
720
+ "columnsTo": [
721
+ "id"
722
+ ],
723
+ "onDelete": "set null",
724
+ "onUpdate": "no action"
725
+ }
726
+ },
727
+ "compositePrimaryKeys": {},
728
+ "uniqueConstraints": {
729
+ "knowledge_cards_key_unique": {
730
+ "name": "knowledge_cards_key_unique",
731
+ "nullsNotDistinct": false,
732
+ "columns": [
733
+ "key"
734
+ ]
735
+ }
736
+ },
737
+ "policies": {},
738
+ "checkConstraints": {},
739
+ "isRLSEnabled": false
740
+ },
741
+ "public.login_codes": {
742
+ "name": "login_codes",
743
+ "schema": "",
744
+ "columns": {
745
+ "code_hash": {
746
+ "name": "code_hash",
747
+ "type": "varchar(64)",
748
+ "primaryKey": true,
749
+ "notNull": true
750
+ },
751
+ "participant_id": {
752
+ "name": "participant_id",
753
+ "type": "integer",
754
+ "primaryKey": false,
755
+ "notNull": true
756
+ },
757
+ "expires_at": {
758
+ "name": "expires_at",
759
+ "type": "timestamp with time zone",
760
+ "primaryKey": false,
761
+ "notNull": true
762
+ },
763
+ "created_at": {
764
+ "name": "created_at",
765
+ "type": "timestamp with time zone",
766
+ "primaryKey": false,
767
+ "notNull": true,
768
+ "default": "now()"
769
+ }
770
+ },
771
+ "indexes": {},
772
+ "foreignKeys": {
773
+ "login_codes_participant_id_participants_id_fk": {
774
+ "name": "login_codes_participant_id_participants_id_fk",
775
+ "tableFrom": "login_codes",
776
+ "tableTo": "participants",
777
+ "columnsFrom": [
778
+ "participant_id"
779
+ ],
780
+ "columnsTo": [
781
+ "id"
782
+ ],
783
+ "onDelete": "cascade",
784
+ "onUpdate": "no action"
785
+ }
786
+ },
787
+ "compositePrimaryKeys": {},
788
+ "uniqueConstraints": {},
789
+ "policies": {},
790
+ "checkConstraints": {},
791
+ "isRLSEnabled": false
792
+ },
793
+ "public.mentions": {
794
+ "name": "mentions",
795
+ "schema": "",
796
+ "columns": {
797
+ "id": {
798
+ "name": "id",
799
+ "type": "serial",
800
+ "primaryKey": true,
801
+ "notNull": true
802
+ },
803
+ "message_id": {
804
+ "name": "message_id",
805
+ "type": "integer",
806
+ "primaryKey": false,
807
+ "notNull": true
808
+ },
809
+ "participant_id": {
810
+ "name": "participant_id",
811
+ "type": "integer",
812
+ "primaryKey": false,
813
+ "notNull": true
814
+ },
815
+ "handled_at": {
816
+ "name": "handled_at",
817
+ "type": "timestamp with time zone",
818
+ "primaryKey": false,
819
+ "notNull": false
820
+ },
821
+ "run_started_at": {
822
+ "name": "run_started_at",
823
+ "type": "timestamp with time zone",
824
+ "primaryKey": false,
825
+ "notNull": false
826
+ },
827
+ "beat_at": {
828
+ "name": "beat_at",
829
+ "type": "timestamp with time zone",
830
+ "primaryKey": false,
831
+ "notNull": false
832
+ },
833
+ "beat_ttl": {
834
+ "name": "beat_ttl",
835
+ "type": "integer",
836
+ "primaryKey": false,
837
+ "notNull": false
838
+ },
839
+ "outcome": {
840
+ "name": "outcome",
841
+ "type": "varchar(16)",
842
+ "primaryKey": false,
843
+ "notNull": false
844
+ },
845
+ "outcome_at": {
846
+ "name": "outcome_at",
847
+ "type": "timestamp with time zone",
848
+ "primaryKey": false,
849
+ "notNull": false
850
+ },
851
+ "note": {
852
+ "name": "note",
853
+ "type": "text",
854
+ "primaryKey": false,
855
+ "notNull": false
856
+ },
857
+ "attempts": {
858
+ "name": "attempts",
859
+ "type": "integer",
860
+ "primaryKey": false,
861
+ "notNull": true,
862
+ "default": 0
863
+ },
864
+ "created_at": {
865
+ "name": "created_at",
866
+ "type": "timestamp with time zone",
867
+ "primaryKey": false,
868
+ "notNull": true,
869
+ "default": "now()"
870
+ },
871
+ "updated_at": {
872
+ "name": "updated_at",
873
+ "type": "timestamp with time zone",
874
+ "primaryKey": false,
875
+ "notNull": true,
876
+ "default": "now()"
877
+ }
878
+ },
879
+ "indexes": {
880
+ "mentions_participant_id_handled_at_index": {
881
+ "name": "mentions_participant_id_handled_at_index",
882
+ "columns": [
883
+ {
884
+ "expression": "participant_id",
885
+ "isExpression": false,
886
+ "asc": true,
887
+ "nulls": "last"
888
+ },
889
+ {
890
+ "expression": "handled_at",
891
+ "isExpression": false,
892
+ "asc": true,
893
+ "nulls": "last"
894
+ }
895
+ ],
896
+ "isUnique": false,
897
+ "concurrently": false,
898
+ "method": "btree",
899
+ "with": {}
900
+ }
901
+ },
902
+ "foreignKeys": {
903
+ "mentions_message_id_messages_id_fk": {
904
+ "name": "mentions_message_id_messages_id_fk",
905
+ "tableFrom": "mentions",
906
+ "tableTo": "messages",
907
+ "columnsFrom": [
908
+ "message_id"
909
+ ],
910
+ "columnsTo": [
911
+ "id"
912
+ ],
913
+ "onDelete": "cascade",
914
+ "onUpdate": "no action"
915
+ },
916
+ "mentions_participant_id_participants_id_fk": {
917
+ "name": "mentions_participant_id_participants_id_fk",
918
+ "tableFrom": "mentions",
919
+ "tableTo": "participants",
920
+ "columnsFrom": [
921
+ "participant_id"
922
+ ],
923
+ "columnsTo": [
924
+ "id"
925
+ ],
926
+ "onDelete": "cascade",
927
+ "onUpdate": "no action"
928
+ }
929
+ },
930
+ "compositePrimaryKeys": {},
931
+ "uniqueConstraints": {
932
+ "mentions_message_id_participant_id_unique": {
933
+ "name": "mentions_message_id_participant_id_unique",
934
+ "nullsNotDistinct": false,
935
+ "columns": [
936
+ "message_id",
937
+ "participant_id"
938
+ ]
939
+ }
940
+ },
941
+ "policies": {},
942
+ "checkConstraints": {},
943
+ "isRLSEnabled": false
944
+ },
945
+ "public.messages": {
946
+ "name": "messages",
947
+ "schema": "",
948
+ "columns": {
949
+ "id": {
950
+ "name": "id",
951
+ "type": "serial",
952
+ "primaryKey": true,
953
+ "notNull": true
954
+ },
955
+ "chat_id": {
956
+ "name": "chat_id",
957
+ "type": "integer",
958
+ "primaryKey": false,
959
+ "notNull": true
960
+ },
961
+ "participant_id": {
962
+ "name": "participant_id",
963
+ "type": "integer",
964
+ "primaryKey": false,
965
+ "notNull": true
966
+ },
967
+ "body": {
968
+ "name": "body",
969
+ "type": "text",
970
+ "primaryKey": false,
971
+ "notNull": true
972
+ },
973
+ "reply_to_id": {
974
+ "name": "reply_to_id",
975
+ "type": "integer",
976
+ "primaryKey": false,
977
+ "notNull": false
978
+ },
979
+ "asks_owner": {
980
+ "name": "asks_owner",
981
+ "type": "boolean",
982
+ "primaryKey": false,
983
+ "notNull": true,
984
+ "default": false
985
+ },
986
+ "created_at": {
987
+ "name": "created_at",
988
+ "type": "timestamp with time zone",
989
+ "primaryKey": false,
990
+ "notNull": true,
991
+ "default": "now()"
992
+ },
993
+ "updated_at": {
994
+ "name": "updated_at",
995
+ "type": "timestamp with time zone",
996
+ "primaryKey": false,
997
+ "notNull": true,
998
+ "default": "now()"
999
+ }
1000
+ },
1001
+ "indexes": {
1002
+ "messages_chat_id_id_index": {
1003
+ "name": "messages_chat_id_id_index",
1004
+ "columns": [
1005
+ {
1006
+ "expression": "chat_id",
1007
+ "isExpression": false,
1008
+ "asc": true,
1009
+ "nulls": "last"
1010
+ },
1011
+ {
1012
+ "expression": "id",
1013
+ "isExpression": false,
1014
+ "asc": true,
1015
+ "nulls": "last"
1016
+ }
1017
+ ],
1018
+ "isUnique": false,
1019
+ "concurrently": false,
1020
+ "method": "btree",
1021
+ "with": {}
1022
+ },
1023
+ "messages_created_at_index": {
1024
+ "name": "messages_created_at_index",
1025
+ "columns": [
1026
+ {
1027
+ "expression": "created_at",
1028
+ "isExpression": false,
1029
+ "asc": true,
1030
+ "nulls": "last"
1031
+ }
1032
+ ],
1033
+ "isUnique": false,
1034
+ "concurrently": false,
1035
+ "method": "btree",
1036
+ "with": {}
1037
+ }
1038
+ },
1039
+ "foreignKeys": {
1040
+ "messages_chat_id_chats_id_fk": {
1041
+ "name": "messages_chat_id_chats_id_fk",
1042
+ "tableFrom": "messages",
1043
+ "tableTo": "chats",
1044
+ "columnsFrom": [
1045
+ "chat_id"
1046
+ ],
1047
+ "columnsTo": [
1048
+ "id"
1049
+ ],
1050
+ "onDelete": "cascade",
1051
+ "onUpdate": "no action"
1052
+ },
1053
+ "messages_participant_id_participants_id_fk": {
1054
+ "name": "messages_participant_id_participants_id_fk",
1055
+ "tableFrom": "messages",
1056
+ "tableTo": "participants",
1057
+ "columnsFrom": [
1058
+ "participant_id"
1059
+ ],
1060
+ "columnsTo": [
1061
+ "id"
1062
+ ],
1063
+ "onDelete": "cascade",
1064
+ "onUpdate": "no action"
1065
+ },
1066
+ "messages_reply_to_id_messages_id_fk": {
1067
+ "name": "messages_reply_to_id_messages_id_fk",
1068
+ "tableFrom": "messages",
1069
+ "tableTo": "messages",
1070
+ "columnsFrom": [
1071
+ "reply_to_id"
1072
+ ],
1073
+ "columnsTo": [
1074
+ "id"
1075
+ ],
1076
+ "onDelete": "set null",
1077
+ "onUpdate": "no action"
1078
+ }
1079
+ },
1080
+ "compositePrimaryKeys": {},
1081
+ "uniqueConstraints": {},
1082
+ "policies": {},
1083
+ "checkConstraints": {},
1084
+ "isRLSEnabled": false
1085
+ },
1086
+ "public.participant_tokens": {
1087
+ "name": "participant_tokens",
1088
+ "schema": "",
1089
+ "columns": {
1090
+ "id": {
1091
+ "name": "id",
1092
+ "type": "serial",
1093
+ "primaryKey": true,
1094
+ "notNull": true
1095
+ },
1096
+ "participant_id": {
1097
+ "name": "participant_id",
1098
+ "type": "integer",
1099
+ "primaryKey": false,
1100
+ "notNull": true
1101
+ },
1102
+ "token_hash": {
1103
+ "name": "token_hash",
1104
+ "type": "varchar(64)",
1105
+ "primaryKey": false,
1106
+ "notNull": true
1107
+ },
1108
+ "label": {
1109
+ "name": "label",
1110
+ "type": "text",
1111
+ "primaryKey": false,
1112
+ "notNull": true
1113
+ },
1114
+ "created_at": {
1115
+ "name": "created_at",
1116
+ "type": "timestamp with time zone",
1117
+ "primaryKey": false,
1118
+ "notNull": true,
1119
+ "default": "now()"
1120
+ },
1121
+ "updated_at": {
1122
+ "name": "updated_at",
1123
+ "type": "timestamp with time zone",
1124
+ "primaryKey": false,
1125
+ "notNull": true,
1126
+ "default": "now()"
1127
+ }
1128
+ },
1129
+ "indexes": {},
1130
+ "foreignKeys": {
1131
+ "participant_tokens_participant_id_participants_id_fk": {
1132
+ "name": "participant_tokens_participant_id_participants_id_fk",
1133
+ "tableFrom": "participant_tokens",
1134
+ "tableTo": "participants",
1135
+ "columnsFrom": [
1136
+ "participant_id"
1137
+ ],
1138
+ "columnsTo": [
1139
+ "id"
1140
+ ],
1141
+ "onDelete": "cascade",
1142
+ "onUpdate": "no action"
1143
+ }
1144
+ },
1145
+ "compositePrimaryKeys": {},
1146
+ "uniqueConstraints": {
1147
+ "participant_tokens_token_hash_unique": {
1148
+ "name": "participant_tokens_token_hash_unique",
1149
+ "nullsNotDistinct": false,
1150
+ "columns": [
1151
+ "token_hash"
1152
+ ]
1153
+ }
1154
+ },
1155
+ "policies": {},
1156
+ "checkConstraints": {},
1157
+ "isRLSEnabled": false
1158
+ },
1159
+ "public.participants": {
1160
+ "name": "participants",
1161
+ "schema": "",
1162
+ "columns": {
1163
+ "id": {
1164
+ "name": "id",
1165
+ "type": "serial",
1166
+ "primaryKey": true,
1167
+ "notNull": true
1168
+ },
1169
+ "name": {
1170
+ "name": "name",
1171
+ "type": "text",
1172
+ "primaryKey": false,
1173
+ "notNull": true
1174
+ },
1175
+ "handle": {
1176
+ "name": "handle",
1177
+ "type": "text",
1178
+ "primaryKey": false,
1179
+ "notNull": true
1180
+ },
1181
+ "kind": {
1182
+ "name": "kind",
1183
+ "type": "text",
1184
+ "primaryKey": false,
1185
+ "notNull": true
1186
+ },
1187
+ "role": {
1188
+ "name": "role",
1189
+ "type": "text",
1190
+ "primaryKey": false,
1191
+ "notNull": true
1192
+ },
1193
+ "accent": {
1194
+ "name": "accent",
1195
+ "type": "varchar(16)",
1196
+ "primaryKey": false,
1197
+ "notNull": true,
1198
+ "default": "'#0057c2'"
1199
+ },
1200
+ "token_hash": {
1201
+ "name": "token_hash",
1202
+ "type": "varchar(64)",
1203
+ "primaryKey": false,
1204
+ "notNull": false
1205
+ },
1206
+ "last_seen_at": {
1207
+ "name": "last_seen_at",
1208
+ "type": "timestamp with time zone",
1209
+ "primaryKey": false,
1210
+ "notNull": false
1211
+ },
1212
+ "runtime": {
1213
+ "name": "runtime",
1214
+ "type": "varchar(40)",
1215
+ "primaryKey": false,
1216
+ "notNull": false
1217
+ },
1218
+ "disabled_at": {
1219
+ "name": "disabled_at",
1220
+ "type": "timestamp with time zone",
1221
+ "primaryKey": false,
1222
+ "notNull": false
1223
+ },
1224
+ "host_id": {
1225
+ "name": "host_id",
1226
+ "type": "integer",
1227
+ "primaryKey": false,
1228
+ "notNull": false
1229
+ },
1230
+ "runtimes": {
1231
+ "name": "runtimes",
1232
+ "type": "jsonb",
1233
+ "primaryKey": false,
1234
+ "notNull": false
1235
+ },
1236
+ "created_at": {
1237
+ "name": "created_at",
1238
+ "type": "timestamp with time zone",
1239
+ "primaryKey": false,
1240
+ "notNull": true,
1241
+ "default": "now()"
1242
+ },
1243
+ "updated_at": {
1244
+ "name": "updated_at",
1245
+ "type": "timestamp with time zone",
1246
+ "primaryKey": false,
1247
+ "notNull": true,
1248
+ "default": "now()"
1249
+ }
1250
+ },
1251
+ "indexes": {},
1252
+ "foreignKeys": {
1253
+ "participants_host_id_participants_id_fk": {
1254
+ "name": "participants_host_id_participants_id_fk",
1255
+ "tableFrom": "participants",
1256
+ "tableTo": "participants",
1257
+ "columnsFrom": [
1258
+ "host_id"
1259
+ ],
1260
+ "columnsTo": [
1261
+ "id"
1262
+ ],
1263
+ "onDelete": "set null",
1264
+ "onUpdate": "no action"
1265
+ }
1266
+ },
1267
+ "compositePrimaryKeys": {},
1268
+ "uniqueConstraints": {
1269
+ "participants_handle_unique": {
1270
+ "name": "participants_handle_unique",
1271
+ "nullsNotDistinct": false,
1272
+ "columns": [
1273
+ "handle"
1274
+ ]
1275
+ },
1276
+ "participants_token_hash_unique": {
1277
+ "name": "participants_token_hash_unique",
1278
+ "nullsNotDistinct": false,
1279
+ "columns": [
1280
+ "token_hash"
1281
+ ]
1282
+ }
1283
+ },
1284
+ "policies": {},
1285
+ "checkConstraints": {},
1286
+ "isRLSEnabled": false
1287
+ },
1288
+ "public.roles": {
1289
+ "name": "roles",
1290
+ "schema": "",
1291
+ "columns": {
1292
+ "id": {
1293
+ "name": "id",
1294
+ "type": "serial",
1295
+ "primaryKey": true,
1296
+ "notNull": true
1297
+ },
1298
+ "slug": {
1299
+ "name": "slug",
1300
+ "type": "text",
1301
+ "primaryKey": false,
1302
+ "notNull": true
1303
+ },
1304
+ "name": {
1305
+ "name": "name",
1306
+ "type": "text",
1307
+ "primaryKey": false,
1308
+ "notNull": true
1309
+ },
1310
+ "instructions": {
1311
+ "name": "instructions",
1312
+ "type": "text",
1313
+ "primaryKey": false,
1314
+ "notNull": true
1315
+ },
1316
+ "created_at": {
1317
+ "name": "created_at",
1318
+ "type": "timestamp with time zone",
1319
+ "primaryKey": false,
1320
+ "notNull": true,
1321
+ "default": "now()"
1322
+ },
1323
+ "updated_at": {
1324
+ "name": "updated_at",
1325
+ "type": "timestamp with time zone",
1326
+ "primaryKey": false,
1327
+ "notNull": true,
1328
+ "default": "now()"
1329
+ }
1330
+ },
1331
+ "indexes": {},
1332
+ "foreignKeys": {},
1333
+ "compositePrimaryKeys": {},
1334
+ "uniqueConstraints": {
1335
+ "roles_slug_unique": {
1336
+ "name": "roles_slug_unique",
1337
+ "nullsNotDistinct": false,
1338
+ "columns": [
1339
+ "slug"
1340
+ ]
1341
+ }
1342
+ },
1343
+ "policies": {},
1344
+ "checkConstraints": {},
1345
+ "isRLSEnabled": false
1346
+ }
1347
+ },
1348
+ "enums": {},
1349
+ "schemas": {},
1350
+ "sequences": {},
1351
+ "roles": {},
1352
+ "policies": {},
1353
+ "views": {},
1354
+ "_meta": {
1355
+ "columns": {},
1356
+ "schemas": {},
1357
+ "tables": {}
1358
+ }
1359
+ }