@agi-cli/database 0.1.135 → 0.1.137

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,2 @@
1
+ ALTER TABLE `messages` ADD `cache_creation_input_tokens` integer;--> statement-breakpoint
2
+ ALTER TABLE `sessions` ADD `total_cache_creation_tokens` integer;
@@ -0,0 +1,529 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "cb773c80-eb96-4a98-9bc5-0df2343dd327",
5
+ "prevId": "0e23f72e-9c0a-4922-9152-d7292dd92544",
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
+ "error": {
323
+ "name": "error",
324
+ "type": "text",
325
+ "primaryKey": false,
326
+ "notNull": false,
327
+ "autoincrement": false
328
+ },
329
+ "error_type": {
330
+ "name": "error_type",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": false,
334
+ "autoincrement": false
335
+ },
336
+ "error_details": {
337
+ "name": "error_details",
338
+ "type": "text",
339
+ "primaryKey": false,
340
+ "notNull": false,
341
+ "autoincrement": false
342
+ },
343
+ "is_aborted": {
344
+ "name": "is_aborted",
345
+ "type": "integer",
346
+ "primaryKey": false,
347
+ "notNull": false,
348
+ "autoincrement": false
349
+ }
350
+ },
351
+ "indexes": {},
352
+ "foreignKeys": {
353
+ "messages_session_id_sessions_id_fk": {
354
+ "name": "messages_session_id_sessions_id_fk",
355
+ "tableFrom": "messages",
356
+ "tableTo": "sessions",
357
+ "columnsFrom": ["session_id"],
358
+ "columnsTo": ["id"],
359
+ "onDelete": "cascade",
360
+ "onUpdate": "no action"
361
+ }
362
+ },
363
+ "compositePrimaryKeys": {},
364
+ "uniqueConstraints": {},
365
+ "checkConstraints": {}
366
+ },
367
+ "sessions": {
368
+ "name": "sessions",
369
+ "columns": {
370
+ "id": {
371
+ "name": "id",
372
+ "type": "text",
373
+ "primaryKey": true,
374
+ "notNull": true,
375
+ "autoincrement": false
376
+ },
377
+ "title": {
378
+ "name": "title",
379
+ "type": "text",
380
+ "primaryKey": false,
381
+ "notNull": false,
382
+ "autoincrement": false
383
+ },
384
+ "agent": {
385
+ "name": "agent",
386
+ "type": "text",
387
+ "primaryKey": false,
388
+ "notNull": true,
389
+ "autoincrement": false
390
+ },
391
+ "provider": {
392
+ "name": "provider",
393
+ "type": "text",
394
+ "primaryKey": false,
395
+ "notNull": true,
396
+ "autoincrement": false
397
+ },
398
+ "model": {
399
+ "name": "model",
400
+ "type": "text",
401
+ "primaryKey": false,
402
+ "notNull": true,
403
+ "autoincrement": false
404
+ },
405
+ "project_path": {
406
+ "name": "project_path",
407
+ "type": "text",
408
+ "primaryKey": false,
409
+ "notNull": true,
410
+ "autoincrement": false
411
+ },
412
+ "created_at": {
413
+ "name": "created_at",
414
+ "type": "integer",
415
+ "primaryKey": false,
416
+ "notNull": true,
417
+ "autoincrement": false
418
+ },
419
+ "last_active_at": {
420
+ "name": "last_active_at",
421
+ "type": "integer",
422
+ "primaryKey": false,
423
+ "notNull": false,
424
+ "autoincrement": false
425
+ },
426
+ "total_input_tokens": {
427
+ "name": "total_input_tokens",
428
+ "type": "integer",
429
+ "primaryKey": false,
430
+ "notNull": false,
431
+ "autoincrement": false
432
+ },
433
+ "total_output_tokens": {
434
+ "name": "total_output_tokens",
435
+ "type": "integer",
436
+ "primaryKey": false,
437
+ "notNull": false,
438
+ "autoincrement": false
439
+ },
440
+ "total_cached_tokens": {
441
+ "name": "total_cached_tokens",
442
+ "type": "integer",
443
+ "primaryKey": false,
444
+ "notNull": false,
445
+ "autoincrement": false
446
+ },
447
+ "total_cache_creation_tokens": {
448
+ "name": "total_cache_creation_tokens",
449
+ "type": "integer",
450
+ "primaryKey": false,
451
+ "notNull": false,
452
+ "autoincrement": false
453
+ },
454
+ "total_reasoning_tokens": {
455
+ "name": "total_reasoning_tokens",
456
+ "type": "integer",
457
+ "primaryKey": false,
458
+ "notNull": false,
459
+ "autoincrement": false
460
+ },
461
+ "total_tool_time_ms": {
462
+ "name": "total_tool_time_ms",
463
+ "type": "integer",
464
+ "primaryKey": false,
465
+ "notNull": false,
466
+ "autoincrement": false
467
+ },
468
+ "tool_counts_json": {
469
+ "name": "tool_counts_json",
470
+ "type": "text",
471
+ "primaryKey": false,
472
+ "notNull": false,
473
+ "autoincrement": false
474
+ },
475
+ "context_summary": {
476
+ "name": "context_summary",
477
+ "type": "text",
478
+ "primaryKey": false,
479
+ "notNull": false,
480
+ "autoincrement": false
481
+ },
482
+ "last_compacted_at": {
483
+ "name": "last_compacted_at",
484
+ "type": "integer",
485
+ "primaryKey": false,
486
+ "notNull": false,
487
+ "autoincrement": false
488
+ },
489
+ "parent_session_id": {
490
+ "name": "parent_session_id",
491
+ "type": "text",
492
+ "primaryKey": false,
493
+ "notNull": false,
494
+ "autoincrement": false
495
+ },
496
+ "branch_point_message_id": {
497
+ "name": "branch_point_message_id",
498
+ "type": "text",
499
+ "primaryKey": false,
500
+ "notNull": false,
501
+ "autoincrement": false
502
+ },
503
+ "session_type": {
504
+ "name": "session_type",
505
+ "type": "text",
506
+ "primaryKey": false,
507
+ "notNull": false,
508
+ "autoincrement": false,
509
+ "default": "'main'"
510
+ }
511
+ },
512
+ "indexes": {},
513
+ "foreignKeys": {},
514
+ "compositePrimaryKeys": {},
515
+ "uniqueConstraints": {},
516
+ "checkConstraints": {}
517
+ }
518
+ },
519
+ "views": {},
520
+ "enums": {},
521
+ "_meta": {
522
+ "schemas": {},
523
+ "tables": {},
524
+ "columns": {}
525
+ },
526
+ "internal": {
527
+ "indexes": {}
528
+ }
529
+ }
@@ -57,6 +57,13 @@
57
57
  "when": 1768941311425,
58
58
  "tag": "0007_milky_rhodey",
59
59
  "breakpoints": true
60
+ },
61
+ {
62
+ "idx": 8,
63
+ "version": "6",
64
+ "when": 1769321704801,
65
+ "tag": "0008_chunky_miss_america",
66
+ "breakpoints": true
60
67
  }
61
68
  ]
62
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-cli/database",
3
- "version": "0.1.135",
3
+ "version": "0.1.137",
4
4
  "description": "Database and persistence layer for AGI CLI",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@agi-cli/sdk": "0.1.135",
25
+ "@agi-cli/sdk": "0.1.137",
26
26
  "drizzle-orm": "^0.44.5"
27
27
  },
28
28
  "devDependencies": {
@@ -19,6 +19,9 @@ import mig0006 from '../../drizzle/0006_jazzy_warlock.sql' with {
19
19
  type: 'text',
20
20
  };
21
21
  import mig0007 from '../../drizzle/0007_milky_rhodey.sql' with { type: 'text' };
22
+ import mig0008 from '../../drizzle/0008_chunky_miss_america.sql' with {
23
+ type: 'text',
24
+ };
22
25
 
23
26
  export const bundledMigrations: Array<{ name: string; content: string }> = [
24
27
  { name: '0000_tense_shadow_king.sql', content: mig0000 },
@@ -29,4 +32,5 @@ export const bundledMigrations: Array<{ name: string; content: string }> = [
29
32
  { name: '0005_hard_gravity.sql', content: mig0005 },
30
33
  { name: '0006_jazzy_warlock.sql', content: mig0006 },
31
34
  { name: '0007_milky_rhodey.sql', content: mig0007 },
35
+ { name: '0008_chunky_miss_america.sql', content: mig0008 },
32
36
  ];
@@ -19,6 +19,7 @@ export const messages = sqliteTable('messages', {
19
19
  completionTokens: integer('completion_tokens'),
20
20
  totalTokens: integer('total_tokens'),
21
21
  cachedInputTokens: integer('cached_input_tokens'),
22
+ cacheCreationInputTokens: integer('cache_creation_input_tokens'),
22
23
  reasoningTokens: integer('reasoning_tokens'),
23
24
  // Error fields
24
25
  error: text('error'),
@@ -13,6 +13,7 @@ export const sessions = sqliteTable('sessions', {
13
13
  totalInputTokens: integer('total_input_tokens'),
14
14
  totalOutputTokens: integer('total_output_tokens'),
15
15
  totalCachedTokens: integer('total_cached_tokens'),
16
+ totalCacheCreationTokens: integer('total_cache_creation_tokens'),
16
17
  totalReasoningTokens: integer('total_reasoning_tokens'),
17
18
  totalToolTimeMs: integer('total_tool_time_ms'),
18
19
  toolCountsJson: text('tool_counts_json'), // JSON object of name->count