nao-core 0.0.16__tar.gz → 0.0.18__tar.gz

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 (60) hide show
  1. {nao_core-0.0.16 → nao_core-0.0.18}/PKG-INFO +1 -1
  2. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/__init__.py +1 -1
  3. nao_core-0.0.18/nao_core/bin/chats/588bbb8a-dcbc-42dc-b0d8-b6b9ed13e2fb.json +45 -0
  4. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/fastapi/main.py +19 -2
  5. nao_core-0.0.16/nao_core/bin/migrations-postgres/0000_supreme_cable.sql → nao_core-0.0.18/nao_core/bin/migrations-postgres/0000_user_auth_and_chat_tables.sql +35 -22
  6. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/migrations-postgres/meta/0000_snapshot.json +208 -111
  7. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/migrations-postgres/meta/_journal.json +2 -2
  8. nao_core-0.0.16/nao_core/bin/migrations-sqlite/0000_cloudy_squirrel_girl.sql → nao_core-0.0.18/nao_core/bin/migrations-sqlite/0000_user_auth_and_chat_tables.sql +35 -22
  9. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/migrations-sqlite/meta/0000_snapshot.json +189 -105
  10. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/migrations-sqlite/meta/_journal.json +2 -2
  11. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/nao-chat-server +0 -0
  12. nao_core-0.0.18/nao_core/bin/public/assets/_chat-layout-Do0mWziW.js +1 -0
  13. nao_core-0.0.18/nao_core/bin/public/assets/_chat-layout.index-mxrV7qZY.js +1 -0
  14. nao_core-0.0.18/nao_core/bin/public/assets/agentProvider-cEZoyU1e.js +1 -0
  15. nao_core-0.0.18/nao_core/bin/public/assets/code-block-F6WJLWQG-oIWcWPcR.js +153 -0
  16. nao_core-0.0.18/nao_core/bin/public/assets/createLucideIcon-BGNfPWE_.js +1 -0
  17. nao_core-0.0.18/nao_core/bin/public/assets/index-B-_pu_22.js +59 -0
  18. nao_core-0.0.18/nao_core/bin/public/assets/index-CWAm1NQa.css +1 -0
  19. nao_core-0.0.18/nao_core/bin/public/assets/login-CF4uOXFH.js +1 -0
  20. nao_core-0.0.18/nao_core/bin/public/assets/mermaid-FSSLJTFX-BzFakw7W.js +380 -0
  21. nao_core-0.0.18/nao_core/bin/public/assets/signinForm-D98dwmLQ.js +1 -0
  22. nao_core-0.0.18/nao_core/bin/public/assets/signup-CQSmDpcH.js +1 -0
  23. nao_core-0.0.18/nao_core/bin/public/assets/utils-DzJYey0s.js +1 -0
  24. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/public/index.html +2 -2
  25. nao_core-0.0.18/nao_core/bin/public/nao-logo-greyscale.svg +25 -0
  26. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/commands/init.py +111 -0
  27. nao_core-0.0.18/nao_core/commands/sync/__init__.py +59 -0
  28. nao_core-0.0.18/nao_core/commands/sync/accessors.py +212 -0
  29. nao_core-0.0.18/nao_core/commands/sync/databases.py +132 -0
  30. nao_core-0.0.18/nao_core/commands/sync/registry.py +23 -0
  31. nao_core-0.0.18/nao_core/commands/sync/repositories.py +103 -0
  32. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/config/base.py +2 -0
  33. nao_core-0.0.18/nao_core/config/repos/__init__.py +3 -0
  34. nao_core-0.0.18/nao_core/config/repos/base.py +11 -0
  35. {nao_core-0.0.16 → nao_core-0.0.18}/pyproject.toml +1 -1
  36. nao_core-0.0.16/nao_core/bin/public/assets/_chatId-z5gRlor1.js +0 -1
  37. nao_core-0.0.16/nao_core/bin/public/assets/chat-messages-DUR3D342.js +0 -1
  38. nao_core-0.0.16/nao_core/bin/public/assets/index-BDlcD_HE.js +0 -1
  39. nao_core-0.0.16/nao_core/bin/public/assets/index-Bc7icYyJ.css +0 -1
  40. nao_core-0.0.16/nao_core/bin/public/assets/index-CGg3ZQH6.js +0 -49
  41. nao_core-0.0.16/nao_core/bin/public/assets/login-D87n9R5V.js +0 -1
  42. nao_core-0.0.16/nao_core/bin/public/assets/signinForm-9PY1Lvqj.js +0 -1
  43. nao_core-0.0.16/nao_core/bin/public/assets/signup-B7NC1g08.js +0 -1
  44. nao_core-0.0.16/nao_core/commands/sync.py +0 -380
  45. {nao_core-0.0.16 → nao_core-0.0.18}/.gitignore +0 -0
  46. {nao_core-0.0.16 → nao_core-0.0.18}/LICENSE +0 -0
  47. {nao_core-0.0.16 → nao_core-0.0.18}/README.md +0 -0
  48. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/db.sqlite +0 -0
  49. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/public/favicon.ico +0 -0
  50. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/public/github-icon.svg +0 -0
  51. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/bin/public/google-icon.svg +0 -0
  52. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/commands/__init__.py +0 -0
  53. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/commands/chat.py +0 -0
  54. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/commands/debug.py +0 -0
  55. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/config/__init__.py +0 -0
  56. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/config/databases/__init__.py +0 -0
  57. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/config/databases/base.py +0 -0
  58. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/config/databases/bigquery.py +0 -0
  59. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/config/llm/__init__.py +0 -0
  60. {nao_core-0.0.16 → nao_core-0.0.18}/nao_core/main.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nao-core
3
- Version: 0.0.16
3
+ Version: 0.0.18
4
4
  Summary: nao Core is your analytics context builder with the best chat interface.
5
5
  Project-URL: Homepage, https://getnao.io
6
6
  Project-URL: Repository, https://github.com/naolabs/chat
@@ -1,2 +1,2 @@
1
1
  # nao Core CLI package
2
- __version__ = "0.0.16"
2
+ __version__ = "0.0.18"
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "588bbb8a-dcbc-42dc-b0d8-b6b9ed13e2fb",
3
+ "title": "hello",
4
+ "createdAt": 1768466612813,
5
+ "updatedAt": 1768466612813,
6
+ "messages": [
7
+ {
8
+ "parts": [
9
+ {
10
+ "type": "text",
11
+ "text": "hello"
12
+ }
13
+ ],
14
+ "id": "0Tpxv0d7sz7KWBN7",
15
+ "role": "user"
16
+ },
17
+ {
18
+ "id": "dGKqwzEtjD2wtI5C",
19
+ "role": "assistant",
20
+ "parts": [
21
+ {
22
+ "type": "data-newChat",
23
+ "data": {
24
+ "id": "588bbb8a-dcbc-42dc-b0d8-b6b9ed13e2fb",
25
+ "title": "hello",
26
+ "createdAt": 1768466612820,
27
+ "updatedAt": 1768466612820,
28
+ "messages": [
29
+ {
30
+ "parts": [
31
+ {
32
+ "type": "text",
33
+ "text": "hello"
34
+ }
35
+ ],
36
+ "id": "0Tpxv0d7sz7KWBN7",
37
+ "role": "user"
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ ]
43
+ }
44
+ ]
45
+ }
@@ -4,6 +4,7 @@ from pydantic import BaseModel
4
4
  import uvicorn
5
5
  import os
6
6
  import sys
7
+ import numpy as np
7
8
  from pathlib import Path
8
9
 
9
10
  cli_path = Path(__file__).parent.parent.parent / "cli"
@@ -87,12 +88,28 @@ async def execute_sql(request: ExecuteSQLRequest):
87
88
  result = connection.sql(request.sql)
88
89
 
89
90
  df = result.to_pandas()
90
- data = df.to_dict(orient="records")
91
+
92
+ # Convert numpy types to native Python types for JSON serialization
93
+ def convert_value(v):
94
+ if isinstance(v, (np.integer,)):
95
+ return int(v)
96
+ if isinstance(v, (np.floating,)):
97
+ return float(v)
98
+ if isinstance(v, np.ndarray):
99
+ return v.tolist()
100
+ if hasattr(v, 'item'): # numpy scalar
101
+ return v.item()
102
+ return v
103
+
104
+ data = [
105
+ {k: convert_value(v) for k, v in row.items()}
106
+ for row in df.to_dict(orient="records")
107
+ ]
91
108
 
92
109
  return ExecuteSQLResponse(
93
110
  data=data,
94
111
  row_count=len(data),
95
- columns=df.columns.tolist(),
112
+ columns=[str(c) for c in df.columns.tolist()],
96
113
  )
97
114
  except Exception as e:
98
115
  raise HTTPException(status_code=500, detail=str(e))
@@ -14,20 +14,41 @@ CREATE TABLE "account" (
14
14
  "updated_at" timestamp NOT NULL
15
15
  );
16
16
  --> statement-breakpoint
17
+ CREATE TABLE "chat" (
18
+ "id" text PRIMARY KEY NOT NULL,
19
+ "user_id" text NOT NULL,
20
+ "title" text DEFAULT 'New Conversation' NOT NULL,
21
+ "created_at" timestamp DEFAULT now() NOT NULL,
22
+ "updated_at" timestamp DEFAULT now() NOT NULL
23
+ );
24
+ --> statement-breakpoint
17
25
  CREATE TABLE "chat_message" (
18
26
  "id" text PRIMARY KEY NOT NULL,
19
- "conversation_id" text NOT NULL,
27
+ "chat_id" text NOT NULL,
20
28
  "role" text NOT NULL,
21
- "content" text NOT NULL,
22
29
  "created_at" timestamp DEFAULT now() NOT NULL
23
30
  );
24
31
  --> statement-breakpoint
25
- CREATE TABLE "conversation" (
32
+ CREATE TABLE "message_part" (
26
33
  "id" text PRIMARY KEY NOT NULL,
27
- "user_id" text NOT NULL,
28
- "title" text DEFAULT 'New Conversation' NOT NULL,
34
+ "message_id" text NOT NULL,
35
+ "order" integer NOT NULL,
29
36
  "created_at" timestamp DEFAULT now() NOT NULL,
30
- "updated_at" timestamp DEFAULT now() NOT NULL
37
+ "type" text NOT NULL,
38
+ "text" text,
39
+ "reasoning_text" text,
40
+ "tool_call_id" text,
41
+ "tool_name" text,
42
+ "tool_state" text,
43
+ "tool_error_text" text,
44
+ "tool_input" jsonb,
45
+ "tool_output" jsonb,
46
+ "tool_approval_id" text,
47
+ "tool_approval_approved" boolean,
48
+ "tool_approval_reason" text,
49
+ CONSTRAINT "text_required_if_type_is_text" CHECK (CASE WHEN "message_part"."type" = 'text' THEN "message_part"."text" IS NOT NULL ELSE TRUE END),
50
+ 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),
51
+ 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)
31
52
  );
32
53
  --> statement-breakpoint
33
54
  CREATE TABLE "session" (
@@ -42,16 +63,6 @@ CREATE TABLE "session" (
42
63
  CONSTRAINT "session_token_unique" UNIQUE("token")
43
64
  );
44
65
  --> statement-breakpoint
45
- CREATE TABLE "tool_call" (
46
- "id" text PRIMARY KEY NOT NULL,
47
- "message_id" text NOT NULL,
48
- "tool_call_id" text NOT NULL,
49
- "tool_name" text NOT NULL,
50
- "input" jsonb NOT NULL,
51
- "output" jsonb,
52
- "created_at" timestamp DEFAULT now() NOT NULL
53
- );
54
- --> statement-breakpoint
55
66
  CREATE TABLE "user" (
56
67
  "id" text PRIMARY KEY NOT NULL,
57
68
  "name" text NOT NULL,
@@ -73,13 +84,15 @@ CREATE TABLE "verification" (
73
84
  );
74
85
  --> statement-breakpoint
75
86
  ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
76
- ALTER TABLE "chat_message" ADD CONSTRAINT "chat_message_conversation_id_conversation_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."conversation"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
77
- ALTER TABLE "conversation" ADD CONSTRAINT "conversation_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
87
+ ALTER TABLE "chat" ADD CONSTRAINT "chat_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
88
+ ALTER TABLE "chat_message" ADD CONSTRAINT "chat_message_chat_id_chat_id_fk" FOREIGN KEY ("chat_id") REFERENCES "public"."chat"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
89
+ ALTER TABLE "message_part" ADD CONSTRAINT "message_part_message_id_chat_message_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."chat_message"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
78
90
  ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
79
- ALTER TABLE "tool_call" ADD CONSTRAINT "tool_call_message_id_chat_message_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."chat_message"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
80
91
  CREATE INDEX "account_userId_idx" ON "account" USING btree ("user_id");--> statement-breakpoint
81
- CREATE INDEX "chat_message_conversationId_idx" ON "chat_message" USING btree ("conversation_id");--> statement-breakpoint
82
- CREATE INDEX "conversation_userId_idx" ON "conversation" USING btree ("user_id");--> statement-breakpoint
92
+ CREATE INDEX "chat_userId_idx" ON "chat" USING btree ("user_id");--> statement-breakpoint
93
+ CREATE INDEX "chat_message_chatId_idx" ON "chat_message" USING btree ("chat_id");--> statement-breakpoint
94
+ CREATE INDEX "chat_message_createdAt_idx" ON "chat_message" USING btree ("created_at");--> statement-breakpoint
95
+ CREATE INDEX "parts_message_id_idx" ON "message_part" USING btree ("message_id");--> statement-breakpoint
96
+ CREATE INDEX "parts_message_id_order_idx" ON "message_part" USING btree ("message_id","order");--> statement-breakpoint
83
97
  CREATE INDEX "session_userId_idx" ON "session" USING btree ("user_id");--> statement-breakpoint
84
- CREATE INDEX "tool_call_messageId_idx" ON "tool_call" USING btree ("message_id");--> statement-breakpoint
85
98
  CREATE INDEX "verification_identifier_idx" ON "verification" USING btree ("identifier");