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,7 +1,7 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "3f42e028-937d-4923-b9a2-9102012a7cc2",
4
+ "id": "a929d7d8-a1ad-4cfe-ba25-452885ebbfdc",
5
5
  "prevId": "00000000-0000-0000-0000-000000000000",
6
6
  "tables": {
7
7
  "account": {
@@ -128,8 +128,8 @@
128
128
  "uniqueConstraints": {},
129
129
  "checkConstraints": {}
130
130
  },
131
- "chat_message": {
132
- "name": "chat_message",
131
+ "chat": {
132
+ "name": "chat",
133
133
  "columns": {
134
134
  "id": {
135
135
  "name": "id",
@@ -138,29 +138,31 @@
138
138
  "notNull": true,
139
139
  "autoincrement": false
140
140
  },
141
- "conversation_id": {
142
- "name": "conversation_id",
141
+ "user_id": {
142
+ "name": "user_id",
143
143
  "type": "text",
144
144
  "primaryKey": false,
145
145
  "notNull": true,
146
146
  "autoincrement": false
147
147
  },
148
- "role": {
149
- "name": "role",
148
+ "title": {
149
+ "name": "title",
150
150
  "type": "text",
151
151
  "primaryKey": false,
152
152
  "notNull": true,
153
- "autoincrement": false
153
+ "autoincrement": false,
154
+ "default": "'New Conversation'"
154
155
  },
155
- "content": {
156
- "name": "content",
157
- "type": "text",
156
+ "created_at": {
157
+ "name": "created_at",
158
+ "type": "integer",
158
159
  "primaryKey": false,
159
160
  "notNull": true,
160
- "autoincrement": false
161
+ "autoincrement": false,
162
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
161
163
  },
162
- "created_at": {
163
- "name": "created_at",
164
+ "updated_at": {
165
+ "name": "updated_at",
164
166
  "type": "integer",
165
167
  "primaryKey": false,
166
168
  "notNull": true,
@@ -169,21 +171,21 @@
169
171
  }
170
172
  },
171
173
  "indexes": {
172
- "chat_message_conversationId_idx": {
173
- "name": "chat_message_conversationId_idx",
174
+ "chat_userId_idx": {
175
+ "name": "chat_userId_idx",
174
176
  "columns": [
175
- "conversation_id"
177
+ "user_id"
176
178
  ],
177
179
  "isUnique": false
178
180
  }
179
181
  },
180
182
  "foreignKeys": {
181
- "chat_message_conversation_id_conversation_id_fk": {
182
- "name": "chat_message_conversation_id_conversation_id_fk",
183
- "tableFrom": "chat_message",
184
- "tableTo": "conversation",
183
+ "chat_user_id_user_id_fk": {
184
+ "name": "chat_user_id_user_id_fk",
185
+ "tableFrom": "chat",
186
+ "tableTo": "user",
185
187
  "columnsFrom": [
186
- "conversation_id"
188
+ "user_id"
187
189
  ],
188
190
  "columnsTo": [
189
191
  "id"
@@ -196,8 +198,8 @@
196
198
  "uniqueConstraints": {},
197
199
  "checkConstraints": {}
198
200
  },
199
- "conversation": {
200
- "name": "conversation",
201
+ "chat_message": {
202
+ "name": "chat_message",
201
203
  "columns": {
202
204
  "id": {
203
205
  "name": "id",
@@ -206,20 +208,19 @@
206
208
  "notNull": true,
207
209
  "autoincrement": false
208
210
  },
209
- "user_id": {
210
- "name": "user_id",
211
+ "chat_id": {
212
+ "name": "chat_id",
211
213
  "type": "text",
212
214
  "primaryKey": false,
213
215
  "notNull": true,
214
216
  "autoincrement": false
215
217
  },
216
- "title": {
217
- "name": "title",
218
+ "role": {
219
+ "name": "role",
218
220
  "type": "text",
219
221
  "primaryKey": false,
220
222
  "notNull": true,
221
- "autoincrement": false,
222
- "default": "'New Conversation'"
223
+ "autoincrement": false
223
224
  },
224
225
  "created_at": {
225
226
  "name": "created_at",
@@ -228,32 +229,31 @@
228
229
  "notNull": true,
229
230
  "autoincrement": false,
230
231
  "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
231
- },
232
- "updated_at": {
233
- "name": "updated_at",
234
- "type": "integer",
235
- "primaryKey": false,
236
- "notNull": true,
237
- "autoincrement": false,
238
- "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
239
232
  }
240
233
  },
241
234
  "indexes": {
242
- "conversation_userId_idx": {
243
- "name": "conversation_userId_idx",
235
+ "chat_message_chatId_idx": {
236
+ "name": "chat_message_chatId_idx",
244
237
  "columns": [
245
- "user_id"
238
+ "chat_id"
239
+ ],
240
+ "isUnique": false
241
+ },
242
+ "chat_message_createdAt_idx": {
243
+ "name": "chat_message_createdAt_idx",
244
+ "columns": [
245
+ "created_at"
246
246
  ],
247
247
  "isUnique": false
248
248
  }
249
249
  },
250
250
  "foreignKeys": {
251
- "conversation_user_id_user_id_fk": {
252
- "name": "conversation_user_id_user_id_fk",
253
- "tableFrom": "conversation",
254
- "tableTo": "user",
251
+ "chat_message_chat_id_chat_id_fk": {
252
+ "name": "chat_message_chat_id_chat_id_fk",
253
+ "tableFrom": "chat_message",
254
+ "tableTo": "chat",
255
255
  "columnsFrom": [
256
- "user_id"
256
+ "chat_id"
257
257
  ],
258
258
  "columnsTo": [
259
259
  "id"
@@ -266,8 +266,8 @@
266
266
  "uniqueConstraints": {},
267
267
  "checkConstraints": {}
268
268
  },
269
- "session": {
270
- "name": "session",
269
+ "message_part": {
270
+ "name": "message_part",
271
271
  "columns": {
272
272
  "id": {
273
273
  "name": "id",
@@ -276,16 +276,16 @@
276
276
  "notNull": true,
277
277
  "autoincrement": false
278
278
  },
279
- "expires_at": {
280
- "name": "expires_at",
281
- "type": "integer",
279
+ "message_id": {
280
+ "name": "message_id",
281
+ "type": "text",
282
282
  "primaryKey": false,
283
283
  "notNull": true,
284
284
  "autoincrement": false
285
285
  },
286
- "token": {
287
- "name": "token",
288
- "type": "text",
286
+ "order": {
287
+ "name": "order",
288
+ "type": "integer",
289
289
  "primaryKey": false,
290
290
  "notNull": true,
291
291
  "autoincrement": false
@@ -298,58 +298,115 @@
298
298
  "autoincrement": false,
299
299
  "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
300
300
  },
301
- "updated_at": {
302
- "name": "updated_at",
303
- "type": "integer",
301
+ "type": {
302
+ "name": "type",
303
+ "type": "text",
304
304
  "primaryKey": false,
305
305
  "notNull": true,
306
306
  "autoincrement": false
307
307
  },
308
- "ip_address": {
309
- "name": "ip_address",
308
+ "text": {
309
+ "name": "text",
310
310
  "type": "text",
311
311
  "primaryKey": false,
312
312
  "notNull": false,
313
313
  "autoincrement": false
314
314
  },
315
- "user_agent": {
316
- "name": "user_agent",
315
+ "reasoning_text": {
316
+ "name": "reasoning_text",
317
317
  "type": "text",
318
318
  "primaryKey": false,
319
319
  "notNull": false,
320
320
  "autoincrement": false
321
321
  },
322
- "user_id": {
323
- "name": "user_id",
322
+ "tool_call_id": {
323
+ "name": "tool_call_id",
324
324
  "type": "text",
325
325
  "primaryKey": false,
326
- "notNull": true,
326
+ "notNull": false,
327
+ "autoincrement": false
328
+ },
329
+ "tool_name": {
330
+ "name": "tool_name",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": false,
334
+ "autoincrement": false
335
+ },
336
+ "tool_state": {
337
+ "name": "tool_state",
338
+ "type": "text",
339
+ "primaryKey": false,
340
+ "notNull": false,
341
+ "autoincrement": false
342
+ },
343
+ "tool_error_text": {
344
+ "name": "tool_error_text",
345
+ "type": "text",
346
+ "primaryKey": false,
347
+ "notNull": false,
348
+ "autoincrement": false
349
+ },
350
+ "tool_input": {
351
+ "name": "tool_input",
352
+ "type": "text",
353
+ "primaryKey": false,
354
+ "notNull": false,
355
+ "autoincrement": false
356
+ },
357
+ "tool_output": {
358
+ "name": "tool_output",
359
+ "type": "text",
360
+ "primaryKey": false,
361
+ "notNull": false,
362
+ "autoincrement": false
363
+ },
364
+ "tool_approval_id": {
365
+ "name": "tool_approval_id",
366
+ "type": "text",
367
+ "primaryKey": false,
368
+ "notNull": false,
369
+ "autoincrement": false
370
+ },
371
+ "tool_approval_approved": {
372
+ "name": "tool_approval_approved",
373
+ "type": "integer",
374
+ "primaryKey": false,
375
+ "notNull": false,
376
+ "autoincrement": false
377
+ },
378
+ "tool_approval_reason": {
379
+ "name": "tool_approval_reason",
380
+ "type": "text",
381
+ "primaryKey": false,
382
+ "notNull": false,
327
383
  "autoincrement": false
328
384
  }
329
385
  },
330
386
  "indexes": {
331
- "session_token_unique": {
332
- "name": "session_token_unique",
387
+ "parts_message_id_idx": {
388
+ "name": "parts_message_id_idx",
333
389
  "columns": [
334
- "token"
390
+ "message_id"
335
391
  ],
336
- "isUnique": true
392
+ "isUnique": false
337
393
  },
338
- "session_userId_idx": {
339
- "name": "session_userId_idx",
394
+ "parts_message_id_order_idx": {
395
+ "name": "parts_message_id_order_idx",
340
396
  "columns": [
341
- "user_id"
397
+ "message_id",
398
+ "order"
342
399
  ],
343
400
  "isUnique": false
344
401
  }
345
402
  },
346
403
  "foreignKeys": {
347
- "session_user_id_user_id_fk": {
348
- "name": "session_user_id_user_id_fk",
349
- "tableFrom": "session",
350
- "tableTo": "user",
404
+ "message_part_message_id_chat_message_id_fk": {
405
+ "name": "message_part_message_id_chat_message_id_fk",
406
+ "tableFrom": "message_part",
407
+ "tableTo": "chat_message",
351
408
  "columnsFrom": [
352
- "user_id"
409
+ "message_id"
353
410
  ],
354
411
  "columnsTo": [
355
412
  "id"
@@ -360,10 +417,23 @@
360
417
  },
361
418
  "compositePrimaryKeys": {},
362
419
  "uniqueConstraints": {},
363
- "checkConstraints": {}
420
+ "checkConstraints": {
421
+ "text_required_if_type_is_text": {
422
+ "name": "text_required_if_type_is_text",
423
+ "value": "CASE WHEN \"message_part\".\"type\" = 'text' THEN \"message_part\".\"text\" IS NOT NULL ELSE TRUE END"
424
+ },
425
+ "reasoning_text_required_if_type_is_reasoning": {
426
+ "name": "reasoning_text_required_if_type_is_reasoning",
427
+ "value": "CASE WHEN \"message_part\".\"type\" = 'reasoning' THEN \"message_part\".\"reasoning_text\" IS NOT NULL ELSE TRUE END"
428
+ },
429
+ "tool_call_fields_required": {
430
+ "name": "tool_call_fields_required",
431
+ "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"
432
+ }
433
+ }
364
434
  },
365
- "tool_call": {
366
- "name": "tool_call",
435
+ "session": {
436
+ "name": "session",
367
437
  "columns": {
368
438
  "id": {
369
439
  "name": "id",
@@ -372,66 +442,80 @@
372
442
  "notNull": true,
373
443
  "autoincrement": false
374
444
  },
375
- "message_id": {
376
- "name": "message_id",
377
- "type": "text",
445
+ "expires_at": {
446
+ "name": "expires_at",
447
+ "type": "integer",
378
448
  "primaryKey": false,
379
449
  "notNull": true,
380
450
  "autoincrement": false
381
451
  },
382
- "tool_call_id": {
383
- "name": "tool_call_id",
452
+ "token": {
453
+ "name": "token",
384
454
  "type": "text",
385
455
  "primaryKey": false,
386
456
  "notNull": true,
387
457
  "autoincrement": false
388
458
  },
389
- "tool_name": {
390
- "name": "tool_name",
391
- "type": "text",
459
+ "created_at": {
460
+ "name": "created_at",
461
+ "type": "integer",
462
+ "primaryKey": false,
463
+ "notNull": true,
464
+ "autoincrement": false,
465
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
466
+ },
467
+ "updated_at": {
468
+ "name": "updated_at",
469
+ "type": "integer",
392
470
  "primaryKey": false,
393
471
  "notNull": true,
394
472
  "autoincrement": false
395
473
  },
396
- "input": {
397
- "name": "input",
474
+ "ip_address": {
475
+ "name": "ip_address",
398
476
  "type": "text",
399
477
  "primaryKey": false,
400
- "notNull": true,
478
+ "notNull": false,
401
479
  "autoincrement": false
402
480
  },
403
- "output": {
404
- "name": "output",
481
+ "user_agent": {
482
+ "name": "user_agent",
405
483
  "type": "text",
406
484
  "primaryKey": false,
407
485
  "notNull": false,
408
486
  "autoincrement": false
409
487
  },
410
- "created_at": {
411
- "name": "created_at",
412
- "type": "integer",
488
+ "user_id": {
489
+ "name": "user_id",
490
+ "type": "text",
413
491
  "primaryKey": false,
414
492
  "notNull": true,
415
- "autoincrement": false,
416
- "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
493
+ "autoincrement": false
417
494
  }
418
495
  },
419
496
  "indexes": {
420
- "tool_call_messageId_idx": {
421
- "name": "tool_call_messageId_idx",
497
+ "session_token_unique": {
498
+ "name": "session_token_unique",
422
499
  "columns": [
423
- "message_id"
500
+ "token"
501
+ ],
502
+ "isUnique": true
503
+ },
504
+ "session_userId_idx": {
505
+ "name": "session_userId_idx",
506
+ "columns": [
507
+ "user_id"
424
508
  ],
425
509
  "isUnique": false
426
510
  }
427
511
  },
428
512
  "foreignKeys": {
429
- "tool_call_message_id_chat_message_id_fk": {
430
- "name": "tool_call_message_id_chat_message_id_fk",
431
- "tableFrom": "tool_call",
432
- "tableTo": "chat_message",
513
+ "session_user_id_user_id_fk": {
514
+ "name": "session_user_id_user_id_fk",
515
+ "tableFrom": "session",
516
+ "tableTo": "user",
433
517
  "columnsFrom": [
434
- "message_id"
518
+ "user_id"
435
519
  ],
436
520
  "columnsTo": [
437
521
  "id"
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "6",
8
- "when": 1767804099092,
9
- "tag": "0000_cloudy_squirrel_girl",
8
+ "when": 1768388391105,
9
+ "tag": "0000_user_auth_and_chat_tables",
10
10
  "breakpoints": true
11
11
  }
12
12
  ]
Binary file
@@ -0,0 +1 @@
1
+ import{S as N,d as C,e as f,g as M,n as b,f as S,r as d,i as z,k as O,j as e,l as g,m as I,O as E,c as _,t as v,u as K}from"./index-B-_pu_22.js";import{c as h,a as y,B as x}from"./createLucideIcon-BGNfPWE_.js";import{a as u}from"./utils-DzJYey0s.js";import{L as D,A as L}from"./agentProvider-cEZoyU1e.js";var R=class extends N{#e;#a=void 0;#t;#s;constructor(t,s){super(),this.#e=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#e.defaultMutationOptions(t),C(this.options,s)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&f(s.mutationKey)!==f(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#n(t)}getCurrentResult(){return this.#a}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#n()}mutate(t,s){return this.#s=s,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??M();this.#a={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#n(t){b.batch(()=>{if(this.#s&&this.hasListeners()){const s=this.#a.variables,n=this.#a.context,a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#s.onSuccess?.(t.data,s,n,a)}catch(r){Promise.reject(r)}try{this.#s.onSettled?.(t.data,null,s,n,a)}catch(r){Promise.reject(r)}}else if(t?.type==="error"){try{this.#s.onError?.(t.error,s,n,a)}catch(r){Promise.reject(r)}try{this.#s.onSettled?.(void 0,t.error,s,n,a)}catch(r){Promise.reject(r)}}}this.listeners.forEach(s=>{s(this.#a)})})}};function A(t,s){const n=S(),[a]=d.useState(()=>new R(n,t));d.useEffect(()=>{a.setOptions(t)},[a,t]);const r=d.useSyncExternalStore(d.useCallback(o=>a.subscribe(b.batchCalls(o)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),i=d.useCallback((o,p)=>{a.mutate(o,p).catch(z)},[a]);if(r.error&&O(a.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}const P=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],q=h("arrow-up",P);const V=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],$=h("message-square",V);const G=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],T=h("panel-left-close",G);const F=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],B=h("panel-left-open",F);const Q=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],U=h("plus",Q);const H=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],J=h("trash",H);function W({className:t,...s}){return e.jsx("textarea",{"data-slot":"textarea",className:u("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...s})}function X({className:t,...s}){return e.jsx("label",{"data-slot":"input-group",role:"group",className:u("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-2xl border shadow-xs transition-[color,box-shadow] outline-none bg-card","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",t),...s})}const Y=y("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function Z({className:t,align:s="inline-start",...n}){return e.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":s,className:u(Y({align:s}),t),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const tt=y("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function et({className:t,type:s="button",variant:n="ghost",size:a="xs",...r}){return e.jsx(x,{type:s,"data-size":a,variant:n,className:u(tt({size:a}),t),...r})}function st({className:t,...s}){return e.jsx(W,{"data-slot":"input-group-control",className:u("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",t),...s})}function at({onSubmit:t,isLoading:s,disabled:n=!1}){const a=g({strict:!1,select:l=>l.chatId}),[r,i]=d.useState(""),o=l=>{l.preventDefault(),!(!r.trim()||s)&&(t(r),i(""))},p=l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),o(l))};return e.jsx("div",{className:"p-4 pt-0 backdrop-blur-sm dark:bg-slate-900/50",children:e.jsx("form",{onSubmit:o,className:"mx-auto max-w-3xl",children:e.jsxs(X,{htmlFor:"chat-input",children:[e.jsx(st,{autoFocus:!0,placeholder:"Ask anything about your data...",value:r,onChange:l=>i(l.target.value),onKeyDown:p,id:"chat-input"},a),e.jsx(Z,{align:"block-end",children:e.jsxs(et,{type:"submit",variant:"default",className:"rounded-full ml-auto",size:"icon-xs",disabled:n||!r||s,children:[s?e.jsx(D,{className:"animate-spin"}):e.jsx(q,{}),e.jsx("span",{className:"sr-only",children:"Send"})]})})]})})})}function rt(){const t=I(),s=n=>{t.isRunning||t.sendMessage({text:n})};return e.jsx(L,{agent:t,children:e.jsxs("div",{className:"flex flex-1 flex-col bg-slate-100 min-w-0",children:[e.jsx(E,{}),e.jsx(at,{onSubmit:s,isLoading:t.isRunning,disabled:!t.isReadyForNewMessages})]})})}function nt(t){const n=Date.now()-t,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),o=Math.floor(i/24);return o>0?`${o}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:"Just now"}function it({chat:t,isActive:s,onChatSelect:n,onChatDelete:a,className:r,...i}){return e.jsxs("div",{role:"button",tabIndex:0,className:u("group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer","hover:bg-sidebar-accent",s&&"bg-sidebar-accent",r),onClick:()=>n(t.id),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(t.id))},...i,children:[e.jsx($,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:nt(t.updatedAt)})]}),e.jsxs(x,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 size-7",onClick:o=>{o.stopPropagation(),a(t.id)},children:[e.jsx(J,{className:"size-3.5 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:"Delete chat"})]})]})}function ot({chats:t,activeChatId:s,onChatSelect:n,onChatDelete:a,className:r,...i}){return t.length===0?e.jsx("div",{className:u("flex-1 flex items-center justify-center p-4",r),...i,children:e.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["No chats yet.",e.jsx("br",{}),"Start a new chat!"]})}):e.jsx("div",{className:u("flex-1 overflow-y-auto p-2 space-y-1",r),...i,children:t.map(o=>e.jsx(it,{chat:o,isActive:o.id===s,onChatSelect:n,onChatDelete:a},o.id))})}const lt=()=>_(v.chat.list.queryOptions());function ut({className:t,...s}){const n=lt(),a=K(),{chatId:r}=g({strict:!1}),[i,o]=d.useState(!1),p=A(v.chat.delete.mutationOptions({onSuccess:(c,m,dt,w)=>{a({to:"/"}),w.client.invalidateQueries()}})),l=d.useCallback(()=>{a({to:"/"})},[a]);d.useEffect(()=>{const c=m=>{m.shiftKey&&m.metaKey&&m.key.toLowerCase()==="o"&&(m.preventDefault(),l())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]);const j=c=>{a({to:"/$chatId",params:{chatId:c}})},k=c=>{p.mutate({chatId:c})};return e.jsxs("div",{className:u("flex flex-col bg-sidebar border-r border-sidebar-border transition-all duration-300",i?"w-14":"w-72",t),...s,children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-sidebar-border",children:[!i&&e.jsx("h2",{className:"font-semibold text-sm",children:"Chats"}),e.jsxs(x,{variant:"ghost",size:"icon-sm",onClick:()=>o(!i),className:u(i&&"mx-auto"),children:[i?e.jsx(B,{className:"size-4"}):e.jsx(T,{className:"size-4"}),e.jsxs("span",{className:"sr-only",children:[i?"Expand":"Collapse"," sidebar"]})]})]}),e.jsx("div",{className:"p-2 border-b border-sidebar-border",children:e.jsxs(x,{variant:"outline",className:u("w-full justify-start gap-2",i&&"justify-center px-0"),onClick:l,children:[e.jsx(U,{className:"size-4"}),!i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"New Chat"}),e.jsx("kbd",{className:"ml-auto text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded font-sans",children:"⇧⌘O"})]})]})}),!i&&e.jsx(ot,{chats:n.data?.chats||[],activeChatId:r,onChatSelect:j,onChatDelete:k})]})}function xt(){return e.jsxs(e.Fragment,{children:[e.jsx(ut,{}),e.jsx(rt,{})]})}export{xt as component};
@@ -0,0 +1 @@
1
+ import{b as a,j as e}from"./index-B-_pu_22.js";import{c as n}from"./utils-DzJYey0s.js";function l(){const{data:s}=a(),t=s?.user?.name;return e.jsxs("div",{className:"flex flex-col items-center justify-end pb-8 mt-[20vh]",children:[e.jsx("div",{className:"relative w-full h-[200px] flex items-center justify-center px-6",children:e.jsx("img",{src:"/nao-logo-greyscale.svg",alt:"",className:"w-[200px] h-auto select-none opacity-[0.05]","aria-hidden":"true"})}),e.jsxs("h1",{className:"text-3xl md:text-4xl font-light tracking-tight text-slate-700 text-center px-6",children:[t?n(t):"",", what do you want to analyse?"]})]})}export{l as component};
@@ -0,0 +1 @@
1
+ import{c as s}from"./createLucideIcon-BGNfPWE_.js";import{r as t,j as n}from"./index-B-_pu_22.js";const a=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],x=s("loader-circle",a),c=e=>t.useMemo(()=>e,Object.values(e)),o=t.createContext(null),C=()=>{const e=t.useContext(o);if(!e)throw new Error("useChatContext must be used within a ChatContextProvider");return e},d=({agent:e,children:r})=>n.jsx(o.Provider,{value:c({...e}),children:r});export{d as A,x as L,C as u};