manychat-ai-agent 0.16.0 → 0.17.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.
- package/CHANGELOG.md +17 -0
- package/db/migrations/0009_previous_maverick.sql +1 -0
- package/db/migrations/meta/0009_snapshot.json +665 -0
- package/db/migrations/meta/_journal.json +7 -0
- package/dist/channels/manychat/client.d.ts +20 -0
- package/dist/channels/manychat/client.js +33 -2
- package/dist/contracts/config.d.ts +1 -0
- package/dist/contracts/config.js +6 -0
- package/dist/conversation/turns.d.ts +25 -0
- package/dist/conversation/turns.js +36 -0
- package/dist/db/schema.js +8 -1
- package/dist/outbox/queue.d.ts +12 -0
- package/dist/outbox/queue.js +84 -10
- package/dist/outbox/worker.d.ts +9 -0
- package/dist/outbox/worker.js +71 -30
- package/dist/routes/turn.d.ts +19 -0
- package/dist/routes/turn.js +190 -13
- package/dist/server.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.17.0](https://github.com/pedronastasi/manychat-ai-agent/compare/v0.16.0...v0.17.0) (2026-10-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* pace replies to one contact, and run their turns one at a time (spec 037) ([6896cae](https://github.com/pedronastasi/manychat-ai-agent/commit/6896caee216985fb375593bdb58524bce8845053))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* give a turn's place back when the contact read fails ([f85f57f](https://github.com/pedronastasi/manychat-ai-agent/commit/f85f57f8c178e4d1d82d7cc2256d4795d4ac50fd))
|
|
14
|
+
* hand a waiting turn that fails to a person through the outbox ([db70c0b](https://github.com/pedronastasi/manychat-ai-agent/commit/db70c0b194b77901500b1c89f3e6c232fbd8bccc))
|
|
15
|
+
* hand any silent turn that cannot settle to a person ([80f5e3e](https://github.com/pedronastasi/manychat-ai-agent/commit/80f5e3efb74e14ee3df68c1c4044bdbe05320247))
|
|
16
|
+
* keep a retried reply ahead of the contact's later ones ([6fffa25](https://github.com/pedronastasi/manychat-ai-agent/commit/6fffa2546d80791fdf7252f40102dba830875556))
|
|
17
|
+
* move a contact's later replies back with a retried one ([f6acfa2](https://github.com/pedronastasi/manychat-ai-agent/commit/f6acfa2c249743f1e4890b8dbf010182f06ff6c2))
|
|
18
|
+
* take a turn's place in its contact's order on arrival ([6a9a309](https://github.com/pedronastasi/manychat-ai-agent/commit/6a9a3096e1f38817e194f6b5fa4c04fb7d42d7b8))
|
|
19
|
+
|
|
3
20
|
## [0.16.0](https://github.com/pedronastasi/manychat-ai-agent/compare/v0.15.3...v0.16.0) (2026-10-06)
|
|
4
21
|
|
|
5
22
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE INDEX "outbox_queued_reply_idx" ON "outbox" USING btree ("tenant_id","subscriber_id","created_at") WHERE "outbox"."kind" = 'reply' AND "outbox"."status" IN ('pending', 'delivering');
|
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "fc73de02-cf27-4dcd-9877-06dedc4bb17a",
|
|
3
|
+
"prevId": "448b0221-8d24-4bc7-9c56-17e6b6847049",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.budget_counters": {
|
|
8
|
+
"name": "budget_counters",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"tenant_id": {
|
|
12
|
+
"name": "tenant_id",
|
|
13
|
+
"type": "text",
|
|
14
|
+
"primaryKey": false,
|
|
15
|
+
"notNull": true
|
|
16
|
+
},
|
|
17
|
+
"day": {
|
|
18
|
+
"name": "day",
|
|
19
|
+
"type": "date",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true
|
|
22
|
+
},
|
|
23
|
+
"tokens": {
|
|
24
|
+
"name": "tokens",
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"primaryKey": false,
|
|
27
|
+
"notNull": true,
|
|
28
|
+
"default": 0
|
|
29
|
+
},
|
|
30
|
+
"cost_usd": {
|
|
31
|
+
"name": "cost_usd",
|
|
32
|
+
"type": "numeric(12, 6)",
|
|
33
|
+
"primaryKey": false,
|
|
34
|
+
"notNull": true,
|
|
35
|
+
"default": "'0'"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"indexes": {},
|
|
39
|
+
"foreignKeys": {},
|
|
40
|
+
"compositePrimaryKeys": {
|
|
41
|
+
"budget_counters_tenant_id_day_pk": {
|
|
42
|
+
"name": "budget_counters_tenant_id_day_pk",
|
|
43
|
+
"columns": [
|
|
44
|
+
"tenant_id",
|
|
45
|
+
"day"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"uniqueConstraints": {},
|
|
50
|
+
"policies": {},
|
|
51
|
+
"checkConstraints": {},
|
|
52
|
+
"isRLSEnabled": false
|
|
53
|
+
},
|
|
54
|
+
"public.conversations": {
|
|
55
|
+
"name": "conversations",
|
|
56
|
+
"schema": "",
|
|
57
|
+
"columns": {
|
|
58
|
+
"id": {
|
|
59
|
+
"name": "id",
|
|
60
|
+
"type": "uuid",
|
|
61
|
+
"primaryKey": true,
|
|
62
|
+
"notNull": true,
|
|
63
|
+
"default": "gen_random_uuid()"
|
|
64
|
+
},
|
|
65
|
+
"tenant_id": {
|
|
66
|
+
"name": "tenant_id",
|
|
67
|
+
"type": "text",
|
|
68
|
+
"primaryKey": false,
|
|
69
|
+
"notNull": true
|
|
70
|
+
},
|
|
71
|
+
"subscriber_id": {
|
|
72
|
+
"name": "subscriber_id",
|
|
73
|
+
"type": "text",
|
|
74
|
+
"primaryKey": false,
|
|
75
|
+
"notNull": true
|
|
76
|
+
},
|
|
77
|
+
"channel": {
|
|
78
|
+
"name": "channel",
|
|
79
|
+
"type": "text",
|
|
80
|
+
"primaryKey": false,
|
|
81
|
+
"notNull": true
|
|
82
|
+
},
|
|
83
|
+
"turn_count": {
|
|
84
|
+
"name": "turn_count",
|
|
85
|
+
"type": "integer",
|
|
86
|
+
"primaryKey": false,
|
|
87
|
+
"notNull": true,
|
|
88
|
+
"default": 0
|
|
89
|
+
},
|
|
90
|
+
"escalated_at": {
|
|
91
|
+
"name": "escalated_at",
|
|
92
|
+
"type": "timestamp with time zone",
|
|
93
|
+
"primaryKey": false,
|
|
94
|
+
"notNull": false
|
|
95
|
+
},
|
|
96
|
+
"last_message_at": {
|
|
97
|
+
"name": "last_message_at",
|
|
98
|
+
"type": "timestamp with time zone",
|
|
99
|
+
"primaryKey": false,
|
|
100
|
+
"notNull": true,
|
|
101
|
+
"default": "now()"
|
|
102
|
+
},
|
|
103
|
+
"token_hash": {
|
|
104
|
+
"name": "token_hash",
|
|
105
|
+
"type": "text",
|
|
106
|
+
"primaryKey": false,
|
|
107
|
+
"notNull": false
|
|
108
|
+
},
|
|
109
|
+
"previous_token_hash": {
|
|
110
|
+
"name": "previous_token_hash",
|
|
111
|
+
"type": "text",
|
|
112
|
+
"primaryKey": false,
|
|
113
|
+
"notNull": false
|
|
114
|
+
},
|
|
115
|
+
"token_issued_at": {
|
|
116
|
+
"name": "token_issued_at",
|
|
117
|
+
"type": "timestamp with time zone",
|
|
118
|
+
"primaryKey": false,
|
|
119
|
+
"notNull": false
|
|
120
|
+
},
|
|
121
|
+
"token_generation": {
|
|
122
|
+
"name": "token_generation",
|
|
123
|
+
"type": "integer",
|
|
124
|
+
"primaryKey": false,
|
|
125
|
+
"notNull": true,
|
|
126
|
+
"default": 0
|
|
127
|
+
},
|
|
128
|
+
"course": {
|
|
129
|
+
"name": "course",
|
|
130
|
+
"type": "text",
|
|
131
|
+
"primaryKey": false,
|
|
132
|
+
"notNull": false
|
|
133
|
+
},
|
|
134
|
+
"opening_sent_at": {
|
|
135
|
+
"name": "opening_sent_at",
|
|
136
|
+
"type": "timestamp with time zone",
|
|
137
|
+
"primaryKey": false,
|
|
138
|
+
"notNull": false
|
|
139
|
+
},
|
|
140
|
+
"created_at": {
|
|
141
|
+
"name": "created_at",
|
|
142
|
+
"type": "timestamp with time zone",
|
|
143
|
+
"primaryKey": false,
|
|
144
|
+
"notNull": true,
|
|
145
|
+
"default": "now()"
|
|
146
|
+
},
|
|
147
|
+
"updated_at": {
|
|
148
|
+
"name": "updated_at",
|
|
149
|
+
"type": "timestamp with time zone",
|
|
150
|
+
"primaryKey": false,
|
|
151
|
+
"notNull": true,
|
|
152
|
+
"default": "now()"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"indexes": {
|
|
156
|
+
"conversations_tenant_subscriber_uq": {
|
|
157
|
+
"name": "conversations_tenant_subscriber_uq",
|
|
158
|
+
"columns": [
|
|
159
|
+
{
|
|
160
|
+
"expression": "tenant_id",
|
|
161
|
+
"isExpression": false,
|
|
162
|
+
"asc": true,
|
|
163
|
+
"nulls": "last"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"expression": "subscriber_id",
|
|
167
|
+
"isExpression": false,
|
|
168
|
+
"asc": true,
|
|
169
|
+
"nulls": "last"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"isUnique": true,
|
|
173
|
+
"concurrently": false,
|
|
174
|
+
"method": "btree",
|
|
175
|
+
"with": {}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"foreignKeys": {},
|
|
179
|
+
"compositePrimaryKeys": {},
|
|
180
|
+
"uniqueConstraints": {},
|
|
181
|
+
"policies": {},
|
|
182
|
+
"checkConstraints": {},
|
|
183
|
+
"isRLSEnabled": false
|
|
184
|
+
},
|
|
185
|
+
"public.nudges": {
|
|
186
|
+
"name": "nudges",
|
|
187
|
+
"schema": "",
|
|
188
|
+
"columns": {
|
|
189
|
+
"id": {
|
|
190
|
+
"name": "id",
|
|
191
|
+
"type": "uuid",
|
|
192
|
+
"primaryKey": true,
|
|
193
|
+
"notNull": true,
|
|
194
|
+
"default": "gen_random_uuid()"
|
|
195
|
+
},
|
|
196
|
+
"conversation_id": {
|
|
197
|
+
"name": "conversation_id",
|
|
198
|
+
"type": "uuid",
|
|
199
|
+
"primaryKey": false,
|
|
200
|
+
"notNull": true
|
|
201
|
+
},
|
|
202
|
+
"due_at": {
|
|
203
|
+
"name": "due_at",
|
|
204
|
+
"type": "timestamp with time zone",
|
|
205
|
+
"primaryKey": false,
|
|
206
|
+
"notNull": true
|
|
207
|
+
},
|
|
208
|
+
"status": {
|
|
209
|
+
"name": "status",
|
|
210
|
+
"type": "text",
|
|
211
|
+
"primaryKey": false,
|
|
212
|
+
"notNull": true,
|
|
213
|
+
"default": "'pending'"
|
|
214
|
+
},
|
|
215
|
+
"cancel_reason": {
|
|
216
|
+
"name": "cancel_reason",
|
|
217
|
+
"type": "text",
|
|
218
|
+
"primaryKey": false,
|
|
219
|
+
"notNull": false
|
|
220
|
+
},
|
|
221
|
+
"scheduled_at": {
|
|
222
|
+
"name": "scheduled_at",
|
|
223
|
+
"type": "timestamp with time zone",
|
|
224
|
+
"primaryKey": false,
|
|
225
|
+
"notNull": true,
|
|
226
|
+
"default": "now()"
|
|
227
|
+
},
|
|
228
|
+
"created_at": {
|
|
229
|
+
"name": "created_at",
|
|
230
|
+
"type": "timestamp with time zone",
|
|
231
|
+
"primaryKey": false,
|
|
232
|
+
"notNull": true,
|
|
233
|
+
"default": "now()"
|
|
234
|
+
},
|
|
235
|
+
"updated_at": {
|
|
236
|
+
"name": "updated_at",
|
|
237
|
+
"type": "timestamp with time zone",
|
|
238
|
+
"primaryKey": false,
|
|
239
|
+
"notNull": true,
|
|
240
|
+
"default": "now()"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"indexes": {
|
|
244
|
+
"nudges_one_pending_uq": {
|
|
245
|
+
"name": "nudges_one_pending_uq",
|
|
246
|
+
"columns": [
|
|
247
|
+
{
|
|
248
|
+
"expression": "conversation_id",
|
|
249
|
+
"isExpression": false,
|
|
250
|
+
"asc": true,
|
|
251
|
+
"nulls": "last"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
"isUnique": true,
|
|
255
|
+
"where": "\"nudges\".\"status\" = 'pending'",
|
|
256
|
+
"concurrently": false,
|
|
257
|
+
"method": "btree",
|
|
258
|
+
"with": {}
|
|
259
|
+
},
|
|
260
|
+
"nudges_claim_idx": {
|
|
261
|
+
"name": "nudges_claim_idx",
|
|
262
|
+
"columns": [
|
|
263
|
+
{
|
|
264
|
+
"expression": "status",
|
|
265
|
+
"isExpression": false,
|
|
266
|
+
"asc": true,
|
|
267
|
+
"nulls": "last"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"expression": "due_at",
|
|
271
|
+
"isExpression": false,
|
|
272
|
+
"asc": true,
|
|
273
|
+
"nulls": "last"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"isUnique": false,
|
|
277
|
+
"concurrently": false,
|
|
278
|
+
"method": "btree",
|
|
279
|
+
"with": {}
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"foreignKeys": {
|
|
283
|
+
"nudges_conversation_id_conversations_id_fk": {
|
|
284
|
+
"name": "nudges_conversation_id_conversations_id_fk",
|
|
285
|
+
"tableFrom": "nudges",
|
|
286
|
+
"tableTo": "conversations",
|
|
287
|
+
"columnsFrom": [
|
|
288
|
+
"conversation_id"
|
|
289
|
+
],
|
|
290
|
+
"columnsTo": [
|
|
291
|
+
"id"
|
|
292
|
+
],
|
|
293
|
+
"onDelete": "cascade",
|
|
294
|
+
"onUpdate": "no action"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"compositePrimaryKeys": {},
|
|
298
|
+
"uniqueConstraints": {},
|
|
299
|
+
"policies": {},
|
|
300
|
+
"checkConstraints": {},
|
|
301
|
+
"isRLSEnabled": false
|
|
302
|
+
},
|
|
303
|
+
"public.outbox": {
|
|
304
|
+
"name": "outbox",
|
|
305
|
+
"schema": "",
|
|
306
|
+
"columns": {
|
|
307
|
+
"id": {
|
|
308
|
+
"name": "id",
|
|
309
|
+
"type": "uuid",
|
|
310
|
+
"primaryKey": true,
|
|
311
|
+
"notNull": true,
|
|
312
|
+
"default": "gen_random_uuid()"
|
|
313
|
+
},
|
|
314
|
+
"tenant_id": {
|
|
315
|
+
"name": "tenant_id",
|
|
316
|
+
"type": "text",
|
|
317
|
+
"primaryKey": false,
|
|
318
|
+
"notNull": true
|
|
319
|
+
},
|
|
320
|
+
"subscriber_id": {
|
|
321
|
+
"name": "subscriber_id",
|
|
322
|
+
"type": "text",
|
|
323
|
+
"primaryKey": false,
|
|
324
|
+
"notNull": true
|
|
325
|
+
},
|
|
326
|
+
"conversation_id": {
|
|
327
|
+
"name": "conversation_id",
|
|
328
|
+
"type": "uuid",
|
|
329
|
+
"primaryKey": false,
|
|
330
|
+
"notNull": false
|
|
331
|
+
},
|
|
332
|
+
"kind": {
|
|
333
|
+
"name": "kind",
|
|
334
|
+
"type": "text",
|
|
335
|
+
"primaryKey": false,
|
|
336
|
+
"notNull": true,
|
|
337
|
+
"default": "'reply'"
|
|
338
|
+
},
|
|
339
|
+
"payload": {
|
|
340
|
+
"name": "payload",
|
|
341
|
+
"type": "jsonb",
|
|
342
|
+
"primaryKey": false,
|
|
343
|
+
"notNull": true
|
|
344
|
+
},
|
|
345
|
+
"status": {
|
|
346
|
+
"name": "status",
|
|
347
|
+
"type": "text",
|
|
348
|
+
"primaryKey": false,
|
|
349
|
+
"notNull": true,
|
|
350
|
+
"default": "'pending'"
|
|
351
|
+
},
|
|
352
|
+
"attempts": {
|
|
353
|
+
"name": "attempts",
|
|
354
|
+
"type": "integer",
|
|
355
|
+
"primaryKey": false,
|
|
356
|
+
"notNull": true,
|
|
357
|
+
"default": 0
|
|
358
|
+
},
|
|
359
|
+
"next_attempt_at": {
|
|
360
|
+
"name": "next_attempt_at",
|
|
361
|
+
"type": "timestamp with time zone",
|
|
362
|
+
"primaryKey": false,
|
|
363
|
+
"notNull": true,
|
|
364
|
+
"default": "now()"
|
|
365
|
+
},
|
|
366
|
+
"last_error": {
|
|
367
|
+
"name": "last_error",
|
|
368
|
+
"type": "text",
|
|
369
|
+
"primaryKey": false,
|
|
370
|
+
"notNull": false
|
|
371
|
+
},
|
|
372
|
+
"created_at": {
|
|
373
|
+
"name": "created_at",
|
|
374
|
+
"type": "timestamp with time zone",
|
|
375
|
+
"primaryKey": false,
|
|
376
|
+
"notNull": true,
|
|
377
|
+
"default": "now()"
|
|
378
|
+
},
|
|
379
|
+
"delivered_at": {
|
|
380
|
+
"name": "delivered_at",
|
|
381
|
+
"type": "timestamp with time zone",
|
|
382
|
+
"primaryKey": false,
|
|
383
|
+
"notNull": false
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"indexes": {
|
|
387
|
+
"outbox_claim_idx": {
|
|
388
|
+
"name": "outbox_claim_idx",
|
|
389
|
+
"columns": [
|
|
390
|
+
{
|
|
391
|
+
"expression": "status",
|
|
392
|
+
"isExpression": false,
|
|
393
|
+
"asc": true,
|
|
394
|
+
"nulls": "last"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"expression": "next_attempt_at",
|
|
398
|
+
"isExpression": false,
|
|
399
|
+
"asc": true,
|
|
400
|
+
"nulls": "last"
|
|
401
|
+
}
|
|
402
|
+
],
|
|
403
|
+
"isUnique": false,
|
|
404
|
+
"concurrently": false,
|
|
405
|
+
"method": "btree",
|
|
406
|
+
"with": {}
|
|
407
|
+
},
|
|
408
|
+
"outbox_queued_reply_idx": {
|
|
409
|
+
"name": "outbox_queued_reply_idx",
|
|
410
|
+
"columns": [
|
|
411
|
+
{
|
|
412
|
+
"expression": "tenant_id",
|
|
413
|
+
"isExpression": false,
|
|
414
|
+
"asc": true,
|
|
415
|
+
"nulls": "last"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"expression": "subscriber_id",
|
|
419
|
+
"isExpression": false,
|
|
420
|
+
"asc": true,
|
|
421
|
+
"nulls": "last"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"expression": "created_at",
|
|
425
|
+
"isExpression": false,
|
|
426
|
+
"asc": true,
|
|
427
|
+
"nulls": "last"
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
"isUnique": false,
|
|
431
|
+
"where": "\"outbox\".\"kind\" = 'reply' AND \"outbox\".\"status\" IN ('pending', 'delivering')",
|
|
432
|
+
"concurrently": false,
|
|
433
|
+
"method": "btree",
|
|
434
|
+
"with": {}
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
"foreignKeys": {
|
|
438
|
+
"outbox_conversation_id_conversations_id_fk": {
|
|
439
|
+
"name": "outbox_conversation_id_conversations_id_fk",
|
|
440
|
+
"tableFrom": "outbox",
|
|
441
|
+
"tableTo": "conversations",
|
|
442
|
+
"columnsFrom": [
|
|
443
|
+
"conversation_id"
|
|
444
|
+
],
|
|
445
|
+
"columnsTo": [
|
|
446
|
+
"id"
|
|
447
|
+
],
|
|
448
|
+
"onDelete": "cascade",
|
|
449
|
+
"onUpdate": "no action"
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
"compositePrimaryKeys": {},
|
|
453
|
+
"uniqueConstraints": {},
|
|
454
|
+
"policies": {},
|
|
455
|
+
"checkConstraints": {},
|
|
456
|
+
"isRLSEnabled": false
|
|
457
|
+
},
|
|
458
|
+
"public.rate_counters": {
|
|
459
|
+
"name": "rate_counters",
|
|
460
|
+
"schema": "",
|
|
461
|
+
"columns": {
|
|
462
|
+
"tenant_id": {
|
|
463
|
+
"name": "tenant_id",
|
|
464
|
+
"type": "text",
|
|
465
|
+
"primaryKey": false,
|
|
466
|
+
"notNull": true
|
|
467
|
+
},
|
|
468
|
+
"subscriber_id": {
|
|
469
|
+
"name": "subscriber_id",
|
|
470
|
+
"type": "text",
|
|
471
|
+
"primaryKey": false,
|
|
472
|
+
"notNull": true
|
|
473
|
+
},
|
|
474
|
+
"window_start": {
|
|
475
|
+
"name": "window_start",
|
|
476
|
+
"type": "timestamp with time zone",
|
|
477
|
+
"primaryKey": false,
|
|
478
|
+
"notNull": true
|
|
479
|
+
},
|
|
480
|
+
"count": {
|
|
481
|
+
"name": "count",
|
|
482
|
+
"type": "integer",
|
|
483
|
+
"primaryKey": false,
|
|
484
|
+
"notNull": true,
|
|
485
|
+
"default": 0
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
"indexes": {},
|
|
489
|
+
"foreignKeys": {},
|
|
490
|
+
"compositePrimaryKeys": {
|
|
491
|
+
"rate_counters_tenant_id_subscriber_id_window_start_pk": {
|
|
492
|
+
"name": "rate_counters_tenant_id_subscriber_id_window_start_pk",
|
|
493
|
+
"columns": [
|
|
494
|
+
"tenant_id",
|
|
495
|
+
"subscriber_id",
|
|
496
|
+
"window_start"
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
"uniqueConstraints": {},
|
|
501
|
+
"policies": {},
|
|
502
|
+
"checkConstraints": {},
|
|
503
|
+
"isRLSEnabled": false
|
|
504
|
+
},
|
|
505
|
+
"public.turns": {
|
|
506
|
+
"name": "turns",
|
|
507
|
+
"schema": "",
|
|
508
|
+
"columns": {
|
|
509
|
+
"id": {
|
|
510
|
+
"name": "id",
|
|
511
|
+
"type": "uuid",
|
|
512
|
+
"primaryKey": true,
|
|
513
|
+
"notNull": true,
|
|
514
|
+
"default": "gen_random_uuid()"
|
|
515
|
+
},
|
|
516
|
+
"seq": {
|
|
517
|
+
"name": "seq",
|
|
518
|
+
"type": "serial",
|
|
519
|
+
"primaryKey": false,
|
|
520
|
+
"notNull": true
|
|
521
|
+
},
|
|
522
|
+
"conversation_id": {
|
|
523
|
+
"name": "conversation_id",
|
|
524
|
+
"type": "uuid",
|
|
525
|
+
"primaryKey": false,
|
|
526
|
+
"notNull": true
|
|
527
|
+
},
|
|
528
|
+
"role": {
|
|
529
|
+
"name": "role",
|
|
530
|
+
"type": "text",
|
|
531
|
+
"primaryKey": false,
|
|
532
|
+
"notNull": true
|
|
533
|
+
},
|
|
534
|
+
"text": {
|
|
535
|
+
"name": "text",
|
|
536
|
+
"type": "text",
|
|
537
|
+
"primaryKey": false,
|
|
538
|
+
"notNull": true
|
|
539
|
+
},
|
|
540
|
+
"outcome": {
|
|
541
|
+
"name": "outcome",
|
|
542
|
+
"type": "text",
|
|
543
|
+
"primaryKey": false,
|
|
544
|
+
"notNull": false
|
|
545
|
+
},
|
|
546
|
+
"model": {
|
|
547
|
+
"name": "model",
|
|
548
|
+
"type": "text",
|
|
549
|
+
"primaryKey": false,
|
|
550
|
+
"notNull": false
|
|
551
|
+
},
|
|
552
|
+
"bound": {
|
|
553
|
+
"name": "bound",
|
|
554
|
+
"type": "boolean",
|
|
555
|
+
"primaryKey": false,
|
|
556
|
+
"notNull": true,
|
|
557
|
+
"default": true
|
|
558
|
+
},
|
|
559
|
+
"media_kind": {
|
|
560
|
+
"name": "media_kind",
|
|
561
|
+
"type": "text",
|
|
562
|
+
"primaryKey": false,
|
|
563
|
+
"notNull": false
|
|
564
|
+
},
|
|
565
|
+
"actions": {
|
|
566
|
+
"name": "actions",
|
|
567
|
+
"type": "jsonb",
|
|
568
|
+
"primaryKey": false,
|
|
569
|
+
"notNull": false
|
|
570
|
+
},
|
|
571
|
+
"input_tokens": {
|
|
572
|
+
"name": "input_tokens",
|
|
573
|
+
"type": "integer",
|
|
574
|
+
"primaryKey": false,
|
|
575
|
+
"notNull": false
|
|
576
|
+
},
|
|
577
|
+
"output_tokens": {
|
|
578
|
+
"name": "output_tokens",
|
|
579
|
+
"type": "integer",
|
|
580
|
+
"primaryKey": false,
|
|
581
|
+
"notNull": false
|
|
582
|
+
},
|
|
583
|
+
"cache_read_tokens": {
|
|
584
|
+
"name": "cache_read_tokens",
|
|
585
|
+
"type": "integer",
|
|
586
|
+
"primaryKey": false,
|
|
587
|
+
"notNull": false
|
|
588
|
+
},
|
|
589
|
+
"cost_usd": {
|
|
590
|
+
"name": "cost_usd",
|
|
591
|
+
"type": "numeric(12, 6)",
|
|
592
|
+
"primaryKey": false,
|
|
593
|
+
"notNull": false
|
|
594
|
+
},
|
|
595
|
+
"latency_ms": {
|
|
596
|
+
"name": "latency_ms",
|
|
597
|
+
"type": "integer",
|
|
598
|
+
"primaryKey": false,
|
|
599
|
+
"notNull": false
|
|
600
|
+
},
|
|
601
|
+
"created_at": {
|
|
602
|
+
"name": "created_at",
|
|
603
|
+
"type": "timestamp with time zone",
|
|
604
|
+
"primaryKey": false,
|
|
605
|
+
"notNull": true,
|
|
606
|
+
"default": "now()"
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
"indexes": {
|
|
610
|
+
"turns_conversation_created_idx": {
|
|
611
|
+
"name": "turns_conversation_created_idx",
|
|
612
|
+
"columns": [
|
|
613
|
+
{
|
|
614
|
+
"expression": "conversation_id",
|
|
615
|
+
"isExpression": false,
|
|
616
|
+
"asc": true,
|
|
617
|
+
"nulls": "last"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"expression": "created_at",
|
|
621
|
+
"isExpression": false,
|
|
622
|
+
"asc": true,
|
|
623
|
+
"nulls": "last"
|
|
624
|
+
}
|
|
625
|
+
],
|
|
626
|
+
"isUnique": false,
|
|
627
|
+
"concurrently": false,
|
|
628
|
+
"method": "btree",
|
|
629
|
+
"with": {}
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
"foreignKeys": {
|
|
633
|
+
"turns_conversation_id_conversations_id_fk": {
|
|
634
|
+
"name": "turns_conversation_id_conversations_id_fk",
|
|
635
|
+
"tableFrom": "turns",
|
|
636
|
+
"tableTo": "conversations",
|
|
637
|
+
"columnsFrom": [
|
|
638
|
+
"conversation_id"
|
|
639
|
+
],
|
|
640
|
+
"columnsTo": [
|
|
641
|
+
"id"
|
|
642
|
+
],
|
|
643
|
+
"onDelete": "cascade",
|
|
644
|
+
"onUpdate": "no action"
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
"compositePrimaryKeys": {},
|
|
648
|
+
"uniqueConstraints": {},
|
|
649
|
+
"policies": {},
|
|
650
|
+
"checkConstraints": {},
|
|
651
|
+
"isRLSEnabled": false
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
"enums": {},
|
|
655
|
+
"schemas": {},
|
|
656
|
+
"sequences": {},
|
|
657
|
+
"roles": {},
|
|
658
|
+
"policies": {},
|
|
659
|
+
"views": {},
|
|
660
|
+
"_meta": {
|
|
661
|
+
"columns": {},
|
|
662
|
+
"schemas": {},
|
|
663
|
+
"tables": {}
|
|
664
|
+
}
|
|
665
|
+
}
|