@ottocode/database 0.1.301 → 0.1.303

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.
@@ -0,0 +1,3 @@
1
+ ALTER TABLE `messages` ADD `finish_reason` text;--> statement-breakpoint
2
+ ALTER TABLE `messages` ADD `raw_finish_reason` text;--> statement-breakpoint
3
+ ALTER TABLE `messages` ADD `finish_details` text;
@@ -0,0 +1,650 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "0b3353f1-fd1a-45ca-b54c-1d5d22307685",
5
+ "prevId": "86ce56a0-2b18-45fc-9829-95c9ff2c8b7e",
6
+ "tables": {
7
+ "artifacts": {
8
+ "name": "artifacts",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "message_part_id": {
18
+ "name": "message_part_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ },
24
+ "kind": {
25
+ "name": "kind",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "path": {
32
+ "name": "path",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": false,
36
+ "autoincrement": false
37
+ },
38
+ "mime": {
39
+ "name": "mime",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "size": {
46
+ "name": "size",
47
+ "type": "integer",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
+ "autoincrement": false
51
+ },
52
+ "sha256": {
53
+ "name": "sha256",
54
+ "type": "text",
55
+ "primaryKey": false,
56
+ "notNull": false,
57
+ "autoincrement": false
58
+ }
59
+ },
60
+ "indexes": {
61
+ "artifacts_message_part_id_unique": {
62
+ "name": "artifacts_message_part_id_unique",
63
+ "columns": ["message_part_id"],
64
+ "isUnique": true
65
+ }
66
+ },
67
+ "foreignKeys": {
68
+ "artifacts_message_part_id_message_parts_id_fk": {
69
+ "name": "artifacts_message_part_id_message_parts_id_fk",
70
+ "tableFrom": "artifacts",
71
+ "tableTo": "message_parts",
72
+ "columnsFrom": ["message_part_id"],
73
+ "columnsTo": ["id"],
74
+ "onDelete": "cascade",
75
+ "onUpdate": "no action"
76
+ }
77
+ },
78
+ "compositePrimaryKeys": {},
79
+ "uniqueConstraints": {},
80
+ "checkConstraints": {}
81
+ },
82
+ "message_parts": {
83
+ "name": "message_parts",
84
+ "columns": {
85
+ "id": {
86
+ "name": "id",
87
+ "type": "text",
88
+ "primaryKey": true,
89
+ "notNull": true,
90
+ "autoincrement": false
91
+ },
92
+ "message_id": {
93
+ "name": "message_id",
94
+ "type": "text",
95
+ "primaryKey": false,
96
+ "notNull": true,
97
+ "autoincrement": false
98
+ },
99
+ "index": {
100
+ "name": "index",
101
+ "type": "integer",
102
+ "primaryKey": false,
103
+ "notNull": true,
104
+ "autoincrement": false
105
+ },
106
+ "step_index": {
107
+ "name": "step_index",
108
+ "type": "integer",
109
+ "primaryKey": false,
110
+ "notNull": false,
111
+ "autoincrement": false
112
+ },
113
+ "type": {
114
+ "name": "type",
115
+ "type": "text",
116
+ "primaryKey": false,
117
+ "notNull": true,
118
+ "autoincrement": false
119
+ },
120
+ "content": {
121
+ "name": "content",
122
+ "type": "text",
123
+ "primaryKey": false,
124
+ "notNull": true,
125
+ "autoincrement": false
126
+ },
127
+ "agent": {
128
+ "name": "agent",
129
+ "type": "text",
130
+ "primaryKey": false,
131
+ "notNull": true,
132
+ "autoincrement": false
133
+ },
134
+ "provider": {
135
+ "name": "provider",
136
+ "type": "text",
137
+ "primaryKey": false,
138
+ "notNull": true,
139
+ "autoincrement": false
140
+ },
141
+ "model": {
142
+ "name": "model",
143
+ "type": "text",
144
+ "primaryKey": false,
145
+ "notNull": true,
146
+ "autoincrement": false
147
+ },
148
+ "started_at": {
149
+ "name": "started_at",
150
+ "type": "integer",
151
+ "primaryKey": false,
152
+ "notNull": false,
153
+ "autoincrement": false
154
+ },
155
+ "completed_at": {
156
+ "name": "completed_at",
157
+ "type": "integer",
158
+ "primaryKey": false,
159
+ "notNull": false,
160
+ "autoincrement": false
161
+ },
162
+ "compacted_at": {
163
+ "name": "compacted_at",
164
+ "type": "integer",
165
+ "primaryKey": false,
166
+ "notNull": false,
167
+ "autoincrement": false
168
+ },
169
+ "tool_name": {
170
+ "name": "tool_name",
171
+ "type": "text",
172
+ "primaryKey": false,
173
+ "notNull": false,
174
+ "autoincrement": false
175
+ },
176
+ "tool_call_id": {
177
+ "name": "tool_call_id",
178
+ "type": "text",
179
+ "primaryKey": false,
180
+ "notNull": false,
181
+ "autoincrement": false
182
+ },
183
+ "tool_duration_ms": {
184
+ "name": "tool_duration_ms",
185
+ "type": "integer",
186
+ "primaryKey": false,
187
+ "notNull": false,
188
+ "autoincrement": false
189
+ }
190
+ },
191
+ "indexes": {},
192
+ "foreignKeys": {
193
+ "message_parts_message_id_messages_id_fk": {
194
+ "name": "message_parts_message_id_messages_id_fk",
195
+ "tableFrom": "message_parts",
196
+ "tableTo": "messages",
197
+ "columnsFrom": ["message_id"],
198
+ "columnsTo": ["id"],
199
+ "onDelete": "cascade",
200
+ "onUpdate": "no action"
201
+ }
202
+ },
203
+ "compositePrimaryKeys": {},
204
+ "uniqueConstraints": {},
205
+ "checkConstraints": {}
206
+ },
207
+ "messages": {
208
+ "name": "messages",
209
+ "columns": {
210
+ "id": {
211
+ "name": "id",
212
+ "type": "text",
213
+ "primaryKey": true,
214
+ "notNull": true,
215
+ "autoincrement": false
216
+ },
217
+ "session_id": {
218
+ "name": "session_id",
219
+ "type": "text",
220
+ "primaryKey": false,
221
+ "notNull": true,
222
+ "autoincrement": false
223
+ },
224
+ "role": {
225
+ "name": "role",
226
+ "type": "text",
227
+ "primaryKey": false,
228
+ "notNull": true,
229
+ "autoincrement": false
230
+ },
231
+ "status": {
232
+ "name": "status",
233
+ "type": "text",
234
+ "primaryKey": false,
235
+ "notNull": true,
236
+ "autoincrement": false
237
+ },
238
+ "agent": {
239
+ "name": "agent",
240
+ "type": "text",
241
+ "primaryKey": false,
242
+ "notNull": true,
243
+ "autoincrement": false
244
+ },
245
+ "provider": {
246
+ "name": "provider",
247
+ "type": "text",
248
+ "primaryKey": false,
249
+ "notNull": true,
250
+ "autoincrement": false
251
+ },
252
+ "model": {
253
+ "name": "model",
254
+ "type": "text",
255
+ "primaryKey": false,
256
+ "notNull": true,
257
+ "autoincrement": false
258
+ },
259
+ "created_at": {
260
+ "name": "created_at",
261
+ "type": "integer",
262
+ "primaryKey": false,
263
+ "notNull": true,
264
+ "autoincrement": false
265
+ },
266
+ "completed_at": {
267
+ "name": "completed_at",
268
+ "type": "integer",
269
+ "primaryKey": false,
270
+ "notNull": false,
271
+ "autoincrement": false
272
+ },
273
+ "latency_ms": {
274
+ "name": "latency_ms",
275
+ "type": "integer",
276
+ "primaryKey": false,
277
+ "notNull": false,
278
+ "autoincrement": false
279
+ },
280
+ "prompt_tokens": {
281
+ "name": "prompt_tokens",
282
+ "type": "integer",
283
+ "primaryKey": false,
284
+ "notNull": false,
285
+ "autoincrement": false
286
+ },
287
+ "completion_tokens": {
288
+ "name": "completion_tokens",
289
+ "type": "integer",
290
+ "primaryKey": false,
291
+ "notNull": false,
292
+ "autoincrement": false
293
+ },
294
+ "total_tokens": {
295
+ "name": "total_tokens",
296
+ "type": "integer",
297
+ "primaryKey": false,
298
+ "notNull": false,
299
+ "autoincrement": false
300
+ },
301
+ "cached_input_tokens": {
302
+ "name": "cached_input_tokens",
303
+ "type": "integer",
304
+ "primaryKey": false,
305
+ "notNull": false,
306
+ "autoincrement": false
307
+ },
308
+ "cache_creation_input_tokens": {
309
+ "name": "cache_creation_input_tokens",
310
+ "type": "integer",
311
+ "primaryKey": false,
312
+ "notNull": false,
313
+ "autoincrement": false
314
+ },
315
+ "reasoning_tokens": {
316
+ "name": "reasoning_tokens",
317
+ "type": "integer",
318
+ "primaryKey": false,
319
+ "notNull": false,
320
+ "autoincrement": false
321
+ },
322
+ "finish_reason": {
323
+ "name": "finish_reason",
324
+ "type": "text",
325
+ "primaryKey": false,
326
+ "notNull": false,
327
+ "autoincrement": false
328
+ },
329
+ "raw_finish_reason": {
330
+ "name": "raw_finish_reason",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": false,
334
+ "autoincrement": false
335
+ },
336
+ "finish_details": {
337
+ "name": "finish_details",
338
+ "type": "text",
339
+ "primaryKey": false,
340
+ "notNull": false,
341
+ "autoincrement": false
342
+ },
343
+ "error": {
344
+ "name": "error",
345
+ "type": "text",
346
+ "primaryKey": false,
347
+ "notNull": false,
348
+ "autoincrement": false
349
+ },
350
+ "error_type": {
351
+ "name": "error_type",
352
+ "type": "text",
353
+ "primaryKey": false,
354
+ "notNull": false,
355
+ "autoincrement": false
356
+ },
357
+ "error_details": {
358
+ "name": "error_details",
359
+ "type": "text",
360
+ "primaryKey": false,
361
+ "notNull": false,
362
+ "autoincrement": false
363
+ },
364
+ "is_aborted": {
365
+ "name": "is_aborted",
366
+ "type": "integer",
367
+ "primaryKey": false,
368
+ "notNull": false,
369
+ "autoincrement": false
370
+ }
371
+ },
372
+ "indexes": {},
373
+ "foreignKeys": {
374
+ "messages_session_id_sessions_id_fk": {
375
+ "name": "messages_session_id_sessions_id_fk",
376
+ "tableFrom": "messages",
377
+ "tableTo": "sessions",
378
+ "columnsFrom": ["session_id"],
379
+ "columnsTo": ["id"],
380
+ "onDelete": "cascade",
381
+ "onUpdate": "no action"
382
+ }
383
+ },
384
+ "compositePrimaryKeys": {},
385
+ "uniqueConstraints": {},
386
+ "checkConstraints": {}
387
+ },
388
+ "sessions": {
389
+ "name": "sessions",
390
+ "columns": {
391
+ "id": {
392
+ "name": "id",
393
+ "type": "text",
394
+ "primaryKey": true,
395
+ "notNull": true,
396
+ "autoincrement": false
397
+ },
398
+ "title": {
399
+ "name": "title",
400
+ "type": "text",
401
+ "primaryKey": false,
402
+ "notNull": false,
403
+ "autoincrement": false
404
+ },
405
+ "agent": {
406
+ "name": "agent",
407
+ "type": "text",
408
+ "primaryKey": false,
409
+ "notNull": true,
410
+ "autoincrement": false
411
+ },
412
+ "provider": {
413
+ "name": "provider",
414
+ "type": "text",
415
+ "primaryKey": false,
416
+ "notNull": true,
417
+ "autoincrement": false
418
+ },
419
+ "model": {
420
+ "name": "model",
421
+ "type": "text",
422
+ "primaryKey": false,
423
+ "notNull": true,
424
+ "autoincrement": false
425
+ },
426
+ "project_path": {
427
+ "name": "project_path",
428
+ "type": "text",
429
+ "primaryKey": false,
430
+ "notNull": true,
431
+ "autoincrement": false
432
+ },
433
+ "created_at": {
434
+ "name": "created_at",
435
+ "type": "integer",
436
+ "primaryKey": false,
437
+ "notNull": true,
438
+ "autoincrement": false
439
+ },
440
+ "last_active_at": {
441
+ "name": "last_active_at",
442
+ "type": "integer",
443
+ "primaryKey": false,
444
+ "notNull": false,
445
+ "autoincrement": false
446
+ },
447
+ "last_viewed_at": {
448
+ "name": "last_viewed_at",
449
+ "type": "integer",
450
+ "primaryKey": false,
451
+ "notNull": false,
452
+ "autoincrement": false
453
+ },
454
+ "pinned_at": {
455
+ "name": "pinned_at",
456
+ "type": "integer",
457
+ "primaryKey": false,
458
+ "notNull": false,
459
+ "autoincrement": false
460
+ },
461
+ "total_input_tokens": {
462
+ "name": "total_input_tokens",
463
+ "type": "integer",
464
+ "primaryKey": false,
465
+ "notNull": false,
466
+ "autoincrement": false
467
+ },
468
+ "total_output_tokens": {
469
+ "name": "total_output_tokens",
470
+ "type": "integer",
471
+ "primaryKey": false,
472
+ "notNull": false,
473
+ "autoincrement": false
474
+ },
475
+ "total_cached_tokens": {
476
+ "name": "total_cached_tokens",
477
+ "type": "integer",
478
+ "primaryKey": false,
479
+ "notNull": false,
480
+ "autoincrement": false
481
+ },
482
+ "total_cache_creation_tokens": {
483
+ "name": "total_cache_creation_tokens",
484
+ "type": "integer",
485
+ "primaryKey": false,
486
+ "notNull": false,
487
+ "autoincrement": false
488
+ },
489
+ "total_reasoning_tokens": {
490
+ "name": "total_reasoning_tokens",
491
+ "type": "integer",
492
+ "primaryKey": false,
493
+ "notNull": false,
494
+ "autoincrement": false
495
+ },
496
+ "total_tool_time_ms": {
497
+ "name": "total_tool_time_ms",
498
+ "type": "integer",
499
+ "primaryKey": false,
500
+ "notNull": false,
501
+ "autoincrement": false
502
+ },
503
+ "tool_counts_json": {
504
+ "name": "tool_counts_json",
505
+ "type": "text",
506
+ "primaryKey": false,
507
+ "notNull": false,
508
+ "autoincrement": false
509
+ },
510
+ "current_context_tokens": {
511
+ "name": "current_context_tokens",
512
+ "type": "integer",
513
+ "primaryKey": false,
514
+ "notNull": false,
515
+ "autoincrement": false
516
+ },
517
+ "context_summary": {
518
+ "name": "context_summary",
519
+ "type": "text",
520
+ "primaryKey": false,
521
+ "notNull": false,
522
+ "autoincrement": false
523
+ },
524
+ "last_compacted_at": {
525
+ "name": "last_compacted_at",
526
+ "type": "integer",
527
+ "primaryKey": false,
528
+ "notNull": false,
529
+ "autoincrement": false
530
+ },
531
+ "parent_session_id": {
532
+ "name": "parent_session_id",
533
+ "type": "text",
534
+ "primaryKey": false,
535
+ "notNull": false,
536
+ "autoincrement": false
537
+ },
538
+ "branch_point_message_id": {
539
+ "name": "branch_point_message_id",
540
+ "type": "text",
541
+ "primaryKey": false,
542
+ "notNull": false,
543
+ "autoincrement": false
544
+ },
545
+ "session_type": {
546
+ "name": "session_type",
547
+ "type": "text",
548
+ "primaryKey": false,
549
+ "notNull": false,
550
+ "autoincrement": false,
551
+ "default": "'main'"
552
+ }
553
+ },
554
+ "indexes": {},
555
+ "foreignKeys": {},
556
+ "compositePrimaryKeys": {},
557
+ "uniqueConstraints": {},
558
+ "checkConstraints": {}
559
+ },
560
+ "shares": {
561
+ "name": "shares",
562
+ "columns": {
563
+ "session_id": {
564
+ "name": "session_id",
565
+ "type": "text",
566
+ "primaryKey": true,
567
+ "notNull": true,
568
+ "autoincrement": false
569
+ },
570
+ "share_id": {
571
+ "name": "share_id",
572
+ "type": "text",
573
+ "primaryKey": false,
574
+ "notNull": true,
575
+ "autoincrement": false
576
+ },
577
+ "secret": {
578
+ "name": "secret",
579
+ "type": "text",
580
+ "primaryKey": false,
581
+ "notNull": true,
582
+ "autoincrement": false
583
+ },
584
+ "url": {
585
+ "name": "url",
586
+ "type": "text",
587
+ "primaryKey": false,
588
+ "notNull": true,
589
+ "autoincrement": false
590
+ },
591
+ "title": {
592
+ "name": "title",
593
+ "type": "text",
594
+ "primaryKey": false,
595
+ "notNull": false,
596
+ "autoincrement": false
597
+ },
598
+ "description": {
599
+ "name": "description",
600
+ "type": "text",
601
+ "primaryKey": false,
602
+ "notNull": false,
603
+ "autoincrement": false
604
+ },
605
+ "created_at": {
606
+ "name": "created_at",
607
+ "type": "integer",
608
+ "primaryKey": false,
609
+ "notNull": true,
610
+ "autoincrement": false
611
+ },
612
+ "last_synced_at": {
613
+ "name": "last_synced_at",
614
+ "type": "integer",
615
+ "primaryKey": false,
616
+ "notNull": true,
617
+ "autoincrement": false
618
+ },
619
+ "last_synced_message_id": {
620
+ "name": "last_synced_message_id",
621
+ "type": "text",
622
+ "primaryKey": false,
623
+ "notNull": true,
624
+ "autoincrement": false
625
+ }
626
+ },
627
+ "indexes": {
628
+ "shares_share_id_unique": {
629
+ "name": "shares_share_id_unique",
630
+ "columns": ["share_id"],
631
+ "isUnique": true
632
+ }
633
+ },
634
+ "foreignKeys": {},
635
+ "compositePrimaryKeys": {},
636
+ "uniqueConstraints": {},
637
+ "checkConstraints": {}
638
+ }
639
+ },
640
+ "views": {},
641
+ "enums": {},
642
+ "_meta": {
643
+ "schemas": {},
644
+ "tables": {},
645
+ "columns": {}
646
+ },
647
+ "internal": {
648
+ "indexes": {}
649
+ }
650
+ }
@@ -22,6 +22,13 @@
22
22
  "when": 1780499685486,
23
23
  "tag": "0002_flawless_stature",
24
24
  "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "6",
29
+ "when": 1781032538297,
30
+ "tag": "0003_public_ted_forrester",
31
+ "breakpoints": true
25
32
  }
26
33
  ]
27
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/database",
3
- "version": "0.1.301",
3
+ "version": "0.1.303",
4
4
  "description": "Database and persistence layer for ottocode",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -22,12 +22,12 @@
22
22
  "typecheck": "tsc --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@ottocode/sdk": "0.1.301",
26
- "drizzle-orm": "^0.44.5"
25
+ "@ottocode/sdk": "0.1.303",
26
+ "drizzle-orm": "0.44.7"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/bun": "latest",
30
- "drizzle-kit": "^0.31.4",
31
- "typescript": "~5.9.3"
29
+ "@types/bun": "1.3.14",
30
+ "drizzle-kit": "0.31.9",
31
+ "typescript": "5.9.3"
32
32
  }
33
33
  }
@@ -5,9 +5,13 @@ import mig0001 from '../../drizzle/0001_elite_ego.sql' with { type: 'text' };
5
5
  import mig0002 from '../../drizzle/0002_flawless_stature.sql' with {
6
6
  type: 'text',
7
7
  };
8
+ import mig0003 from '../../drizzle/0003_public_ted_forrester.sql' with {
9
+ type: 'text',
10
+ };
8
11
 
9
12
  export const bundledMigrations: Array<{ name: string; content: string }> = [
10
13
  { name: '0000_material_swarm.sql', content: mig0000 },
11
14
  { name: '0001_elite_ego.sql', content: mig0001 },
12
15
  { name: '0002_flawless_stature.sql', content: mig0002 },
16
+ { name: '0003_public_ted_forrester.sql', content: mig0003 },
13
17
  ];
@@ -21,6 +21,10 @@ export const messages = sqliteTable('messages', {
21
21
  cachedInputTokens: integer('cached_input_tokens'),
22
22
  cacheCreationInputTokens: integer('cache_creation_input_tokens'),
23
23
  reasoningTokens: integer('reasoning_tokens'),
24
+ // Stream completion diagnostics
25
+ finishReason: text('finish_reason'),
26
+ rawFinishReason: text('raw_finish_reason'),
27
+ finishDetails: text('finish_details'), // JSON string with provider/stream details
24
28
  // Error fields
25
29
  error: text('error'),
26
30
  errorType: text('error_type'), // 'api_error', 'abort', 'validation_error', etc.