nao-core 0.0.16__py3-none-any.whl → 0.0.17__py3-none-any.whl

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 (48) hide show
  1. nao_core/__init__.py +1 -1
  2. nao_core/bin/chats/588bbb8a-dcbc-42dc-b0d8-b6b9ed13e2fb.json +45 -0
  3. nao_core/bin/fastapi/main.py +19 -2
  4. nao_core/bin/migrations-postgres/{0000_supreme_cable.sql → 0000_user_auth_and_chat_tables.sql} +35 -22
  5. nao_core/bin/migrations-postgres/meta/0000_snapshot.json +208 -111
  6. nao_core/bin/migrations-postgres/meta/_journal.json +2 -2
  7. nao_core/bin/migrations-sqlite/{0000_cloudy_squirrel_girl.sql → 0000_user_auth_and_chat_tables.sql} +35 -22
  8. nao_core/bin/migrations-sqlite/meta/0000_snapshot.json +189 -105
  9. nao_core/bin/migrations-sqlite/meta/_journal.json +2 -2
  10. nao_core/bin/nao-chat-server +0 -0
  11. nao_core/bin/public/assets/_chat-layout-Do0mWziW.js +1 -0
  12. nao_core/bin/public/assets/_chat-layout.index-mxrV7qZY.js +1 -0
  13. nao_core/bin/public/assets/agentProvider-cEZoyU1e.js +1 -0
  14. nao_core/bin/public/assets/code-block-F6WJLWQG-oIWcWPcR.js +153 -0
  15. nao_core/bin/public/assets/createLucideIcon-BGNfPWE_.js +1 -0
  16. nao_core/bin/public/assets/index-B-_pu_22.js +59 -0
  17. nao_core/bin/public/assets/index-CWAm1NQa.css +1 -0
  18. nao_core/bin/public/assets/login-CF4uOXFH.js +1 -0
  19. nao_core/bin/public/assets/mermaid-FSSLJTFX-BzFakw7W.js +380 -0
  20. nao_core/bin/public/assets/signinForm-D98dwmLQ.js +1 -0
  21. nao_core/bin/public/assets/signup-CQSmDpcH.js +1 -0
  22. nao_core/bin/public/assets/utils-DzJYey0s.js +1 -0
  23. nao_core/bin/public/index.html +2 -2
  24. nao_core/bin/public/nao-logo-greyscale.svg +25 -0
  25. nao_core/commands/init.py +111 -0
  26. nao_core/commands/sync/__init__.py +59 -0
  27. nao_core/commands/sync/accessors.py +212 -0
  28. nao_core/commands/sync/databases.py +132 -0
  29. nao_core/commands/sync/registry.py +23 -0
  30. nao_core/commands/sync/repositories.py +103 -0
  31. nao_core/config/base.py +2 -0
  32. nao_core/config/repos/__init__.py +3 -0
  33. nao_core/config/repos/base.py +11 -0
  34. {nao_core-0.0.16.dist-info → nao_core-0.0.17.dist-info}/METADATA +1 -1
  35. nao_core-0.0.17.dist-info/RECORD +51 -0
  36. nao_core/bin/public/assets/_chatId-z5gRlor1.js +0 -1
  37. nao_core/bin/public/assets/chat-messages-DUR3D342.js +0 -1
  38. nao_core/bin/public/assets/index-BDlcD_HE.js +0 -1
  39. nao_core/bin/public/assets/index-Bc7icYyJ.css +0 -1
  40. nao_core/bin/public/assets/index-CGg3ZQH6.js +0 -49
  41. nao_core/bin/public/assets/login-D87n9R5V.js +0 -1
  42. nao_core/bin/public/assets/signinForm-9PY1Lvqj.js +0 -1
  43. nao_core/bin/public/assets/signup-B7NC1g08.js +0 -1
  44. nao_core/commands/sync.py +0 -380
  45. nao_core-0.0.16.dist-info/RECORD +0 -39
  46. {nao_core-0.0.16.dist-info → nao_core-0.0.17.dist-info}/WHEEL +0 -0
  47. {nao_core-0.0.16.dist-info → nao_core-0.0.17.dist-info}/entry_points.txt +0 -0
  48. {nao_core-0.0.16.dist-info → nao_core-0.0.17.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "eb2e439e-63a8-425c-af2d-08560ac5920a",
2
+ "id": "d5afdaf9-2b7c-49ac-a06e-09ce0e992e96",
3
3
  "prevId": "00000000-0000-0000-0000-000000000000",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -126,8 +126,8 @@
126
126
  "checkConstraints": {},
127
127
  "isRLSEnabled": false
128
128
  },
129
- "public.chat_message": {
130
- "name": "chat_message",
129
+ "public.chat": {
130
+ "name": "chat",
131
131
  "schema": "",
132
132
  "columns": {
133
133
  "id": {
@@ -136,23 +136,18 @@
136
136
  "primaryKey": true,
137
137
  "notNull": true
138
138
  },
139
- "conversation_id": {
140
- "name": "conversation_id",
141
- "type": "text",
142
- "primaryKey": false,
143
- "notNull": true
144
- },
145
- "role": {
146
- "name": "role",
139
+ "user_id": {
140
+ "name": "user_id",
147
141
  "type": "text",
148
142
  "primaryKey": false,
149
143
  "notNull": true
150
144
  },
151
- "content": {
152
- "name": "content",
145
+ "title": {
146
+ "name": "title",
153
147
  "type": "text",
154
148
  "primaryKey": false,
155
- "notNull": true
149
+ "notNull": true,
150
+ "default": "'New Conversation'"
156
151
  },
157
152
  "created_at": {
158
153
  "name": "created_at",
@@ -160,14 +155,21 @@
160
155
  "primaryKey": false,
161
156
  "notNull": true,
162
157
  "default": "now()"
158
+ },
159
+ "updated_at": {
160
+ "name": "updated_at",
161
+ "type": "timestamp",
162
+ "primaryKey": false,
163
+ "notNull": true,
164
+ "default": "now()"
163
165
  }
164
166
  },
165
167
  "indexes": {
166
- "chat_message_conversationId_idx": {
167
- "name": "chat_message_conversationId_idx",
168
+ "chat_userId_idx": {
169
+ "name": "chat_userId_idx",
168
170
  "columns": [
169
171
  {
170
- "expression": "conversation_id",
172
+ "expression": "user_id",
171
173
  "isExpression": false,
172
174
  "asc": true,
173
175
  "nulls": "last"
@@ -180,12 +182,12 @@
180
182
  }
181
183
  },
182
184
  "foreignKeys": {
183
- "chat_message_conversation_id_conversation_id_fk": {
184
- "name": "chat_message_conversation_id_conversation_id_fk",
185
- "tableFrom": "chat_message",
186
- "tableTo": "conversation",
185
+ "chat_user_id_user_id_fk": {
186
+ "name": "chat_user_id_user_id_fk",
187
+ "tableFrom": "chat",
188
+ "tableTo": "user",
187
189
  "columnsFrom": [
188
- "conversation_id"
190
+ "user_id"
189
191
  ],
190
192
  "columnsTo": [
191
193
  "id"
@@ -200,8 +202,8 @@
200
202
  "checkConstraints": {},
201
203
  "isRLSEnabled": false
202
204
  },
203
- "public.conversation": {
204
- "name": "conversation",
205
+ "public.chat_message": {
206
+ "name": "chat_message",
205
207
  "schema": "",
206
208
  "columns": {
207
209
  "id": {
@@ -210,18 +212,17 @@
210
212
  "primaryKey": true,
211
213
  "notNull": true
212
214
  },
213
- "user_id": {
214
- "name": "user_id",
215
+ "chat_id": {
216
+ "name": "chat_id",
215
217
  "type": "text",
216
218
  "primaryKey": false,
217
219
  "notNull": true
218
220
  },
219
- "title": {
220
- "name": "title",
221
+ "role": {
222
+ "name": "role",
221
223
  "type": "text",
222
224
  "primaryKey": false,
223
- "notNull": true,
224
- "default": "'New Conversation'"
225
+ "notNull": true
225
226
  },
226
227
  "created_at": {
227
228
  "name": "created_at",
@@ -229,21 +230,29 @@
229
230
  "primaryKey": false,
230
231
  "notNull": true,
231
232
  "default": "now()"
232
- },
233
- "updated_at": {
234
- "name": "updated_at",
235
- "type": "timestamp",
236
- "primaryKey": false,
237
- "notNull": true,
238
- "default": "now()"
239
233
  }
240
234
  },
241
235
  "indexes": {
242
- "conversation_userId_idx": {
243
- "name": "conversation_userId_idx",
236
+ "chat_message_chatId_idx": {
237
+ "name": "chat_message_chatId_idx",
244
238
  "columns": [
245
239
  {
246
- "expression": "user_id",
240
+ "expression": "chat_id",
241
+ "isExpression": false,
242
+ "asc": true,
243
+ "nulls": "last"
244
+ }
245
+ ],
246
+ "isUnique": false,
247
+ "concurrently": false,
248
+ "method": "btree",
249
+ "with": {}
250
+ },
251
+ "chat_message_createdAt_idx": {
252
+ "name": "chat_message_createdAt_idx",
253
+ "columns": [
254
+ {
255
+ "expression": "created_at",
247
256
  "isExpression": false,
248
257
  "asc": true,
249
258
  "nulls": "last"
@@ -256,12 +265,12 @@
256
265
  }
257
266
  },
258
267
  "foreignKeys": {
259
- "conversation_user_id_user_id_fk": {
260
- "name": "conversation_user_id_user_id_fk",
261
- "tableFrom": "conversation",
262
- "tableTo": "user",
268
+ "chat_message_chat_id_chat_id_fk": {
269
+ "name": "chat_message_chat_id_chat_id_fk",
270
+ "tableFrom": "chat_message",
271
+ "tableTo": "chat",
263
272
  "columnsFrom": [
264
- "user_id"
273
+ "chat_id"
265
274
  ],
266
275
  "columnsTo": [
267
276
  "id"
@@ -276,8 +285,8 @@
276
285
  "checkConstraints": {},
277
286
  "isRLSEnabled": false
278
287
  },
279
- "public.session": {
280
- "name": "session",
288
+ "public.message_part": {
289
+ "name": "message_part",
281
290
  "schema": "",
282
291
  "columns": {
283
292
  "id": {
@@ -286,15 +295,15 @@
286
295
  "primaryKey": true,
287
296
  "notNull": true
288
297
  },
289
- "expires_at": {
290
- "name": "expires_at",
291
- "type": "timestamp",
298
+ "message_id": {
299
+ "name": "message_id",
300
+ "type": "text",
292
301
  "primaryKey": false,
293
302
  "notNull": true
294
303
  },
295
- "token": {
296
- "name": "token",
297
- "type": "text",
304
+ "order": {
305
+ "name": "order",
306
+ "type": "integer",
298
307
  "primaryKey": false,
299
308
  "notNull": true
300
309
  },
@@ -305,37 +314,106 @@
305
314
  "notNull": true,
306
315
  "default": "now()"
307
316
  },
308
- "updated_at": {
309
- "name": "updated_at",
310
- "type": "timestamp",
317
+ "type": {
318
+ "name": "type",
319
+ "type": "text",
311
320
  "primaryKey": false,
312
321
  "notNull": true
313
322
  },
314
- "ip_address": {
315
- "name": "ip_address",
323
+ "text": {
324
+ "name": "text",
316
325
  "type": "text",
317
326
  "primaryKey": false,
318
327
  "notNull": false
319
328
  },
320
- "user_agent": {
321
- "name": "user_agent",
329
+ "reasoning_text": {
330
+ "name": "reasoning_text",
322
331
  "type": "text",
323
332
  "primaryKey": false,
324
333
  "notNull": false
325
334
  },
326
- "user_id": {
327
- "name": "user_id",
335
+ "tool_call_id": {
336
+ "name": "tool_call_id",
328
337
  "type": "text",
329
338
  "primaryKey": false,
330
- "notNull": true
339
+ "notNull": false
340
+ },
341
+ "tool_name": {
342
+ "name": "tool_name",
343
+ "type": "text",
344
+ "primaryKey": false,
345
+ "notNull": false
346
+ },
347
+ "tool_state": {
348
+ "name": "tool_state",
349
+ "type": "text",
350
+ "primaryKey": false,
351
+ "notNull": false
352
+ },
353
+ "tool_error_text": {
354
+ "name": "tool_error_text",
355
+ "type": "text",
356
+ "primaryKey": false,
357
+ "notNull": false
358
+ },
359
+ "tool_input": {
360
+ "name": "tool_input",
361
+ "type": "jsonb",
362
+ "primaryKey": false,
363
+ "notNull": false
364
+ },
365
+ "tool_output": {
366
+ "name": "tool_output",
367
+ "type": "jsonb",
368
+ "primaryKey": false,
369
+ "notNull": false
370
+ },
371
+ "tool_approval_id": {
372
+ "name": "tool_approval_id",
373
+ "type": "text",
374
+ "primaryKey": false,
375
+ "notNull": false
376
+ },
377
+ "tool_approval_approved": {
378
+ "name": "tool_approval_approved",
379
+ "type": "boolean",
380
+ "primaryKey": false,
381
+ "notNull": false
382
+ },
383
+ "tool_approval_reason": {
384
+ "name": "tool_approval_reason",
385
+ "type": "text",
386
+ "primaryKey": false,
387
+ "notNull": false
331
388
  }
332
389
  },
333
390
  "indexes": {
334
- "session_userId_idx": {
335
- "name": "session_userId_idx",
391
+ "parts_message_id_idx": {
392
+ "name": "parts_message_id_idx",
336
393
  "columns": [
337
394
  {
338
- "expression": "user_id",
395
+ "expression": "message_id",
396
+ "isExpression": false,
397
+ "asc": true,
398
+ "nulls": "last"
399
+ }
400
+ ],
401
+ "isUnique": false,
402
+ "concurrently": false,
403
+ "method": "btree",
404
+ "with": {}
405
+ },
406
+ "parts_message_id_order_idx": {
407
+ "name": "parts_message_id_order_idx",
408
+ "columns": [
409
+ {
410
+ "expression": "message_id",
411
+ "isExpression": false,
412
+ "asc": true,
413
+ "nulls": "last"
414
+ },
415
+ {
416
+ "expression": "order",
339
417
  "isExpression": false,
340
418
  "asc": true,
341
419
  "nulls": "last"
@@ -348,12 +426,12 @@
348
426
  }
349
427
  },
350
428
  "foreignKeys": {
351
- "session_user_id_user_id_fk": {
352
- "name": "session_user_id_user_id_fk",
353
- "tableFrom": "session",
354
- "tableTo": "user",
429
+ "message_part_message_id_chat_message_id_fk": {
430
+ "name": "message_part_message_id_chat_message_id_fk",
431
+ "tableFrom": "message_part",
432
+ "tableTo": "chat_message",
355
433
  "columnsFrom": [
356
- "user_id"
434
+ "message_id"
357
435
  ],
358
436
  "columnsTo": [
359
437
  "id"
@@ -363,21 +441,26 @@
363
441
  }
364
442
  },
365
443
  "compositePrimaryKeys": {},
366
- "uniqueConstraints": {
367
- "session_token_unique": {
368
- "name": "session_token_unique",
369
- "nullsNotDistinct": false,
370
- "columns": [
371
- "token"
372
- ]
444
+ "uniqueConstraints": {},
445
+ "policies": {},
446
+ "checkConstraints": {
447
+ "text_required_if_type_is_text": {
448
+ "name": "text_required_if_type_is_text",
449
+ "value": "CASE WHEN \"message_part\".\"type\" = 'text' THEN \"message_part\".\"text\" IS NOT NULL ELSE TRUE END"
450
+ },
451
+ "reasoning_text_required_if_type_is_reasoning": {
452
+ "name": "reasoning_text_required_if_type_is_reasoning",
453
+ "value": "CASE WHEN \"message_part\".\"type\" = 'reasoning' THEN \"message_part\".\"reasoning_text\" IS NOT NULL ELSE TRUE END"
454
+ },
455
+ "tool_call_fields_required": {
456
+ "name": "tool_call_fields_required",
457
+ "value": "CASE WHEN \"message_part\".\"type\" LIKE 'tool-%' THEN \"message_part\".\"tool_call_id\" IS NOT NULL AND \"message_part\".\"tool_state\" IS NOT NULL ELSE TRUE END"
373
458
  }
374
459
  },
375
- "policies": {},
376
- "checkConstraints": {},
377
460
  "isRLSEnabled": false
378
461
  },
379
- "public.tool_call": {
380
- "name": "tool_call",
462
+ "public.session": {
463
+ "name": "session",
381
464
  "schema": "",
382
465
  "columns": {
383
466
  "id": {
@@ -386,50 +469,56 @@
386
469
  "primaryKey": true,
387
470
  "notNull": true
388
471
  },
389
- "message_id": {
390
- "name": "message_id",
391
- "type": "text",
472
+ "expires_at": {
473
+ "name": "expires_at",
474
+ "type": "timestamp",
392
475
  "primaryKey": false,
393
476
  "notNull": true
394
477
  },
395
- "tool_call_id": {
396
- "name": "tool_call_id",
478
+ "token": {
479
+ "name": "token",
397
480
  "type": "text",
398
481
  "primaryKey": false,
399
482
  "notNull": true
400
483
  },
401
- "tool_name": {
402
- "name": "tool_name",
403
- "type": "text",
484
+ "created_at": {
485
+ "name": "created_at",
486
+ "type": "timestamp",
404
487
  "primaryKey": false,
405
- "notNull": true
488
+ "notNull": true,
489
+ "default": "now()"
406
490
  },
407
- "input": {
408
- "name": "input",
409
- "type": "jsonb",
491
+ "updated_at": {
492
+ "name": "updated_at",
493
+ "type": "timestamp",
410
494
  "primaryKey": false,
411
495
  "notNull": true
412
496
  },
413
- "output": {
414
- "name": "output",
415
- "type": "jsonb",
497
+ "ip_address": {
498
+ "name": "ip_address",
499
+ "type": "text",
416
500
  "primaryKey": false,
417
501
  "notNull": false
418
502
  },
419
- "created_at": {
420
- "name": "created_at",
421
- "type": "timestamp",
503
+ "user_agent": {
504
+ "name": "user_agent",
505
+ "type": "text",
422
506
  "primaryKey": false,
423
- "notNull": true,
424
- "default": "now()"
507
+ "notNull": false
508
+ },
509
+ "user_id": {
510
+ "name": "user_id",
511
+ "type": "text",
512
+ "primaryKey": false,
513
+ "notNull": true
425
514
  }
426
515
  },
427
516
  "indexes": {
428
- "tool_call_messageId_idx": {
429
- "name": "tool_call_messageId_idx",
517
+ "session_userId_idx": {
518
+ "name": "session_userId_idx",
430
519
  "columns": [
431
520
  {
432
- "expression": "message_id",
521
+ "expression": "user_id",
433
522
  "isExpression": false,
434
523
  "asc": true,
435
524
  "nulls": "last"
@@ -442,12 +531,12 @@
442
531
  }
443
532
  },
444
533
  "foreignKeys": {
445
- "tool_call_message_id_chat_message_id_fk": {
446
- "name": "tool_call_message_id_chat_message_id_fk",
447
- "tableFrom": "tool_call",
448
- "tableTo": "chat_message",
534
+ "session_user_id_user_id_fk": {
535
+ "name": "session_user_id_user_id_fk",
536
+ "tableFrom": "session",
537
+ "tableTo": "user",
449
538
  "columnsFrom": [
450
- "message_id"
539
+ "user_id"
451
540
  ],
452
541
  "columnsTo": [
453
542
  "id"
@@ -457,7 +546,15 @@
457
546
  }
458
547
  },
459
548
  "compositePrimaryKeys": {},
460
- "uniqueConstraints": {},
549
+ "uniqueConstraints": {
550
+ "session_token_unique": {
551
+ "name": "session_token_unique",
552
+ "nullsNotDistinct": false,
553
+ "columns": [
554
+ "token"
555
+ ]
556
+ }
557
+ },
461
558
  "policies": {},
462
559
  "checkConstraints": {},
463
560
  "isRLSEnabled": false
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "7",
8
- "when": 1767804105559,
9
- "tag": "0000_supreme_cable",
8
+ "when": 1768388561542,
9
+ "tag": "0000_user_auth_and_chat_tables",
10
10
  "breakpoints": true
11
11
  }
12
12
  ]
@@ -16,26 +16,51 @@ CREATE TABLE `account` (
16
16
  );
17
17
  --> statement-breakpoint
18
18
  CREATE INDEX `account_userId_idx` ON `account` (`user_id`);--> statement-breakpoint
19
+ CREATE TABLE `chat` (
20
+ `id` text PRIMARY KEY NOT NULL,
21
+ `user_id` text NOT NULL,
22
+ `title` text DEFAULT 'New Conversation' NOT NULL,
23
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
24
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
25
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
26
+ );
27
+ --> statement-breakpoint
28
+ CREATE INDEX `chat_userId_idx` ON `chat` (`user_id`);--> statement-breakpoint
19
29
  CREATE TABLE `chat_message` (
20
30
  `id` text PRIMARY KEY NOT NULL,
21
- `conversation_id` text NOT NULL,
31
+ `chat_id` text NOT NULL,
22
32
  `role` text NOT NULL,
23
- `content` text NOT NULL,
24
33
  `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
25
- FOREIGN KEY (`conversation_id`) REFERENCES `conversation`(`id`) ON UPDATE no action ON DELETE cascade
34
+ FOREIGN KEY (`chat_id`) REFERENCES `chat`(`id`) ON UPDATE no action ON DELETE cascade
26
35
  );
27
36
  --> statement-breakpoint
28
- CREATE INDEX `chat_message_conversationId_idx` ON `chat_message` (`conversation_id`);--> statement-breakpoint
29
- CREATE TABLE `conversation` (
37
+ CREATE INDEX `chat_message_chatId_idx` ON `chat_message` (`chat_id`);--> statement-breakpoint
38
+ CREATE INDEX `chat_message_createdAt_idx` ON `chat_message` (`created_at`);--> statement-breakpoint
39
+ CREATE TABLE `message_part` (
30
40
  `id` text PRIMARY KEY NOT NULL,
31
- `user_id` text NOT NULL,
32
- `title` text DEFAULT 'New Conversation' NOT NULL,
41
+ `message_id` text NOT NULL,
42
+ `order` integer NOT NULL,
33
43
  `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
34
- `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
35
- FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
44
+ `type` text NOT NULL,
45
+ `text` text,
46
+ `reasoning_text` text,
47
+ `tool_call_id` text,
48
+ `tool_name` text,
49
+ `tool_state` text,
50
+ `tool_error_text` text,
51
+ `tool_input` text,
52
+ `tool_output` text,
53
+ `tool_approval_id` text,
54
+ `tool_approval_approved` integer,
55
+ `tool_approval_reason` text,
56
+ FOREIGN KEY (`message_id`) REFERENCES `chat_message`(`id`) ON UPDATE no action ON DELETE cascade,
57
+ CONSTRAINT "text_required_if_type_is_text" CHECK(CASE WHEN "message_part"."type" = 'text' THEN "message_part"."text" IS NOT NULL ELSE TRUE END),
58
+ CONSTRAINT "reasoning_text_required_if_type_is_reasoning" CHECK(CASE WHEN "message_part"."type" = 'reasoning' THEN "message_part"."reasoning_text" IS NOT NULL ELSE TRUE END),
59
+ CONSTRAINT "tool_call_fields_required" CHECK(CASE WHEN "message_part"."type" LIKE 'tool-%' THEN "message_part"."tool_call_id" IS NOT NULL AND "message_part"."tool_state" IS NOT NULL ELSE TRUE END)
36
60
  );
37
61
  --> statement-breakpoint
38
- CREATE INDEX `conversation_userId_idx` ON `conversation` (`user_id`);--> statement-breakpoint
62
+ CREATE INDEX `parts_message_id_idx` ON `message_part` (`message_id`);--> statement-breakpoint
63
+ CREATE INDEX `parts_message_id_order_idx` ON `message_part` (`message_id`,`order`);--> statement-breakpoint
39
64
  CREATE TABLE `session` (
40
65
  `id` text PRIMARY KEY NOT NULL,
41
66
  `expires_at` integer NOT NULL,
@@ -50,18 +75,6 @@ CREATE TABLE `session` (
50
75
  --> statement-breakpoint
51
76
  CREATE UNIQUE INDEX `session_token_unique` ON `session` (`token`);--> statement-breakpoint
52
77
  CREATE INDEX `session_userId_idx` ON `session` (`user_id`);--> statement-breakpoint
53
- CREATE TABLE `tool_call` (
54
- `id` text PRIMARY KEY NOT NULL,
55
- `message_id` text NOT NULL,
56
- `tool_call_id` text NOT NULL,
57
- `tool_name` text NOT NULL,
58
- `input` text NOT NULL,
59
- `output` text,
60
- `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
61
- FOREIGN KEY (`message_id`) REFERENCES `chat_message`(`id`) ON UPDATE no action ON DELETE cascade
62
- );
63
- --> statement-breakpoint
64
- CREATE INDEX `tool_call_messageId_idx` ON `tool_call` (`message_id`);--> statement-breakpoint
65
78
  CREATE TABLE `user` (
66
79
  `id` text PRIMARY KEY NOT NULL,
67
80
  `name` text NOT NULL,