nao-core 0.0.38__py3-none-manylinux2014_aarch64.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 (98) hide show
  1. nao_core/__init__.py +2 -0
  2. nao_core/__init__.py.bak +2 -0
  3. nao_core/bin/build-info.json +5 -0
  4. nao_core/bin/fastapi/main.py +268 -0
  5. nao_core/bin/fastapi/test_main.py +156 -0
  6. nao_core/bin/migrations-postgres/0000_user_auth_and_chat_tables.sql +98 -0
  7. nao_core/bin/migrations-postgres/0001_message_feedback.sql +9 -0
  8. nao_core/bin/migrations-postgres/0002_chat_message_stop_reason_and_error_message.sql +2 -0
  9. nao_core/bin/migrations-postgres/0003_handle_slack_with_thread.sql +2 -0
  10. nao_core/bin/migrations-postgres/0004_input_and_output_tokens.sql +8 -0
  11. nao_core/bin/migrations-postgres/0005_add_project_tables.sql +39 -0
  12. nao_core/bin/migrations-postgres/0006_llm_model_ids.sql +4 -0
  13. nao_core/bin/migrations-postgres/0007_chat_message_llm_info.sql +2 -0
  14. nao_core/bin/migrations-postgres/meta/0000_snapshot.json +707 -0
  15. nao_core/bin/migrations-postgres/meta/0001_snapshot.json +766 -0
  16. nao_core/bin/migrations-postgres/meta/0002_snapshot.json +778 -0
  17. nao_core/bin/migrations-postgres/meta/0003_snapshot.json +799 -0
  18. nao_core/bin/migrations-postgres/meta/0004_snapshot.json +847 -0
  19. nao_core/bin/migrations-postgres/meta/0005_snapshot.json +1129 -0
  20. nao_core/bin/migrations-postgres/meta/0006_snapshot.json +1141 -0
  21. nao_core/bin/migrations-postgres/meta/_journal.json +62 -0
  22. nao_core/bin/migrations-sqlite/0000_user_auth_and_chat_tables.sql +98 -0
  23. nao_core/bin/migrations-sqlite/0001_message_feedback.sql +8 -0
  24. nao_core/bin/migrations-sqlite/0002_chat_message_stop_reason_and_error_message.sql +2 -0
  25. nao_core/bin/migrations-sqlite/0003_handle_slack_with_thread.sql +2 -0
  26. nao_core/bin/migrations-sqlite/0004_input_and_output_tokens.sql +8 -0
  27. nao_core/bin/migrations-sqlite/0005_add_project_tables.sql +38 -0
  28. nao_core/bin/migrations-sqlite/0006_llm_model_ids.sql +4 -0
  29. nao_core/bin/migrations-sqlite/0007_chat_message_llm_info.sql +2 -0
  30. nao_core/bin/migrations-sqlite/meta/0000_snapshot.json +674 -0
  31. nao_core/bin/migrations-sqlite/meta/0001_snapshot.json +735 -0
  32. nao_core/bin/migrations-sqlite/meta/0002_snapshot.json +749 -0
  33. nao_core/bin/migrations-sqlite/meta/0003_snapshot.json +763 -0
  34. nao_core/bin/migrations-sqlite/meta/0004_snapshot.json +819 -0
  35. nao_core/bin/migrations-sqlite/meta/0005_snapshot.json +1086 -0
  36. nao_core/bin/migrations-sqlite/meta/0006_snapshot.json +1100 -0
  37. nao_core/bin/migrations-sqlite/meta/_journal.json +62 -0
  38. nao_core/bin/nao-chat-server +0 -0
  39. nao_core/bin/public/assets/code-block-F6WJLWQG-CV0uOmNJ.js +153 -0
  40. nao_core/bin/public/assets/index-DcbndLHo.css +1 -0
  41. nao_core/bin/public/assets/index-t1hZI3nl.js +560 -0
  42. nao_core/bin/public/favicon.ico +0 -0
  43. nao_core/bin/public/index.html +18 -0
  44. nao_core/bin/rg +0 -0
  45. nao_core/commands/__init__.py +6 -0
  46. nao_core/commands/chat.py +225 -0
  47. nao_core/commands/debug.py +158 -0
  48. nao_core/commands/init.py +358 -0
  49. nao_core/commands/sync/__init__.py +124 -0
  50. nao_core/commands/sync/accessors.py +290 -0
  51. nao_core/commands/sync/cleanup.py +156 -0
  52. nao_core/commands/sync/providers/__init__.py +32 -0
  53. nao_core/commands/sync/providers/base.py +113 -0
  54. nao_core/commands/sync/providers/databases/__init__.py +17 -0
  55. nao_core/commands/sync/providers/databases/bigquery.py +79 -0
  56. nao_core/commands/sync/providers/databases/databricks.py +79 -0
  57. nao_core/commands/sync/providers/databases/duckdb.py +78 -0
  58. nao_core/commands/sync/providers/databases/postgres.py +79 -0
  59. nao_core/commands/sync/providers/databases/provider.py +129 -0
  60. nao_core/commands/sync/providers/databases/snowflake.py +79 -0
  61. nao_core/commands/sync/providers/notion/__init__.py +5 -0
  62. nao_core/commands/sync/providers/notion/provider.py +205 -0
  63. nao_core/commands/sync/providers/repositories/__init__.py +5 -0
  64. nao_core/commands/sync/providers/repositories/provider.py +134 -0
  65. nao_core/commands/sync/registry.py +23 -0
  66. nao_core/config/__init__.py +30 -0
  67. nao_core/config/base.py +100 -0
  68. nao_core/config/databases/__init__.py +55 -0
  69. nao_core/config/databases/base.py +85 -0
  70. nao_core/config/databases/bigquery.py +99 -0
  71. nao_core/config/databases/databricks.py +79 -0
  72. nao_core/config/databases/duckdb.py +41 -0
  73. nao_core/config/databases/postgres.py +83 -0
  74. nao_core/config/databases/snowflake.py +125 -0
  75. nao_core/config/exceptions.py +7 -0
  76. nao_core/config/llm/__init__.py +19 -0
  77. nao_core/config/notion/__init__.py +8 -0
  78. nao_core/config/repos/__init__.py +3 -0
  79. nao_core/config/repos/base.py +11 -0
  80. nao_core/config/slack/__init__.py +12 -0
  81. nao_core/context/__init__.py +54 -0
  82. nao_core/context/base.py +57 -0
  83. nao_core/context/git.py +177 -0
  84. nao_core/context/local.py +59 -0
  85. nao_core/main.py +13 -0
  86. nao_core/templates/__init__.py +41 -0
  87. nao_core/templates/context.py +193 -0
  88. nao_core/templates/defaults/databases/columns.md.j2 +23 -0
  89. nao_core/templates/defaults/databases/description.md.j2 +32 -0
  90. nao_core/templates/defaults/databases/preview.md.j2 +22 -0
  91. nao_core/templates/defaults/databases/profiling.md.j2 +34 -0
  92. nao_core/templates/engine.py +133 -0
  93. nao_core/templates/render.py +196 -0
  94. nao_core-0.0.38.dist-info/METADATA +150 -0
  95. nao_core-0.0.38.dist-info/RECORD +98 -0
  96. nao_core-0.0.38.dist-info/WHEEL +4 -0
  97. nao_core-0.0.38.dist-info/entry_points.txt +2 -0
  98. nao_core-0.0.38.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,62 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1768388561542,
9
+ "tag": "0000_user_auth_and_chat_tables",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1768496717318,
16
+ "tag": "0001_message_feedback",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1768559969318,
23
+ "tag": "0002_chat_message_stop_reason_and_error_message",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1768561547301,
30
+ "tag": "0003_handle_slack_with_thread",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1768817988521,
37
+ "tag": "0004_input_and_output_tokens",
38
+ "breakpoints": true
39
+ },
40
+ {
41
+ "idx": 5,
42
+ "version": "7",
43
+ "when": 1769164031408,
44
+ "tag": "0005_add_project_tables",
45
+ "breakpoints": true
46
+ },
47
+ {
48
+ "idx": 6,
49
+ "version": "7",
50
+ "when": 1769513746509,
51
+ "tag": "0006_llm_model_ids",
52
+ "breakpoints": true
53
+ },
54
+ {
55
+ "idx": 7,
56
+ "version": "7",
57
+ "when": 1769686400000,
58
+ "tag": "0007_chat_message_llm_info",
59
+ "breakpoints": true
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,98 @@
1
+ CREATE TABLE `account` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `account_id` text NOT NULL,
4
+ `provider_id` text NOT NULL,
5
+ `user_id` text NOT NULL,
6
+ `access_token` text,
7
+ `refresh_token` text,
8
+ `id_token` text,
9
+ `access_token_expires_at` integer,
10
+ `refresh_token_expires_at` integer,
11
+ `scope` text,
12
+ `password` text,
13
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
14
+ `updated_at` integer NOT NULL,
15
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
16
+ );
17
+ --> statement-breakpoint
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
29
+ CREATE TABLE `chat_message` (
30
+ `id` text PRIMARY KEY NOT NULL,
31
+ `chat_id` text NOT NULL,
32
+ `role` text NOT NULL,
33
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
34
+ FOREIGN KEY (`chat_id`) REFERENCES `chat`(`id`) ON UPDATE no action ON DELETE cascade
35
+ );
36
+ --> statement-breakpoint
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` (
40
+ `id` text PRIMARY KEY NOT NULL,
41
+ `message_id` text NOT NULL,
42
+ `order` integer NOT NULL,
43
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
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)
60
+ );
61
+ --> 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
64
+ CREATE TABLE `session` (
65
+ `id` text PRIMARY KEY NOT NULL,
66
+ `expires_at` integer NOT NULL,
67
+ `token` text NOT NULL,
68
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
69
+ `updated_at` integer NOT NULL,
70
+ `ip_address` text,
71
+ `user_agent` text,
72
+ `user_id` text NOT NULL,
73
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
74
+ );
75
+ --> statement-breakpoint
76
+ CREATE UNIQUE INDEX `session_token_unique` ON `session` (`token`);--> statement-breakpoint
77
+ CREATE INDEX `session_userId_idx` ON `session` (`user_id`);--> statement-breakpoint
78
+ CREATE TABLE `user` (
79
+ `id` text PRIMARY KEY NOT NULL,
80
+ `name` text NOT NULL,
81
+ `email` text NOT NULL,
82
+ `email_verified` integer DEFAULT false NOT NULL,
83
+ `image` text,
84
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
85
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL
86
+ );
87
+ --> statement-breakpoint
88
+ CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
89
+ CREATE TABLE `verification` (
90
+ `id` text PRIMARY KEY NOT NULL,
91
+ `identifier` text NOT NULL,
92
+ `value` text NOT NULL,
93
+ `expires_at` integer NOT NULL,
94
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
95
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL
96
+ );
97
+ --> statement-breakpoint
98
+ CREATE INDEX `verification_identifier_idx` ON `verification` (`identifier`);
@@ -0,0 +1,8 @@
1
+ CREATE TABLE `message_feedback` (
2
+ `message_id` text PRIMARY KEY NOT NULL,
3
+ `vote` text NOT NULL,
4
+ `explanation` text,
5
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
6
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
7
+ FOREIGN KEY (`message_id`) REFERENCES `chat_message`(`id`) ON UPDATE no action ON DELETE cascade
8
+ );
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `chat_message` ADD `stop_reason` text;--> statement-breakpoint
2
+ ALTER TABLE `chat_message` ADD `error_message` text;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `chat` ADD `slack_thread_id` text;--> statement-breakpoint
2
+ CREATE INDEX `chat_slack_thread_idx` ON `chat` (`slack_thread_id`);
@@ -0,0 +1,8 @@
1
+ ALTER TABLE `message_part` ADD `input_total_tokens` integer;--> statement-breakpoint
2
+ ALTER TABLE `message_part` ADD `input_no_cache_tokens` integer;--> statement-breakpoint
3
+ ALTER TABLE `message_part` ADD `input_cache_read_tokens` integer;--> statement-breakpoint
4
+ ALTER TABLE `message_part` ADD `input_cache_write_tokens` integer;--> statement-breakpoint
5
+ ALTER TABLE `message_part` ADD `output_total_tokens` integer;--> statement-breakpoint
6
+ ALTER TABLE `message_part` ADD `output_text_tokens` integer;--> statement-breakpoint
7
+ ALTER TABLE `message_part` ADD `output_reasoning_tokens` integer;--> statement-breakpoint
8
+ ALTER TABLE `message_part` ADD `total_tokens` integer;
@@ -0,0 +1,38 @@
1
+ CREATE TABLE `project` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `name` text NOT NULL,
4
+ `type` text NOT NULL,
5
+ `path` text,
6
+ `slack_bot_token` text,
7
+ `slack_signing_secret` text,
8
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
9
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
10
+ CONSTRAINT "local_project_path_required" CHECK(CASE WHEN "project"."type" = 'local' THEN "project"."path" IS NOT NULL ELSE TRUE END)
11
+ );
12
+ --> statement-breakpoint
13
+ CREATE TABLE `project_llm_config` (
14
+ `id` text PRIMARY KEY NOT NULL,
15
+ `project_id` text NOT NULL,
16
+ `provider` text NOT NULL,
17
+ `api_key` text NOT NULL,
18
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
19
+ `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
20
+ FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE INDEX `project_llm_config_projectId_idx` ON `project_llm_config` (`project_id`);--> statement-breakpoint
24
+ CREATE UNIQUE INDEX `project_llm_config_unique` ON `project_llm_config` (`id`,`project_id`,`provider`);--> statement-breakpoint
25
+ CREATE TABLE `project_member` (
26
+ `project_id` text NOT NULL,
27
+ `user_id` text NOT NULL,
28
+ `role` text NOT NULL,
29
+ `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,
30
+ PRIMARY KEY(`project_id`, `user_id`),
31
+ FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade,
32
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
33
+ );
34
+ --> statement-breakpoint
35
+ CREATE INDEX `project_member_userId_idx` ON `project_member` (`user_id`);--> statement-breakpoint
36
+ DELETE FROM `chat`;--> statement-breakpoint
37
+ ALTER TABLE `chat` ADD `project_id` text NOT NULL REFERENCES project(id);--> statement-breakpoint
38
+ CREATE INDEX `chat_projectId_idx` ON `chat` (`project_id`);
@@ -0,0 +1,4 @@
1
+ DROP INDEX `project_llm_config_unique`;--> statement-breakpoint
2
+ ALTER TABLE `project_llm_config` ADD `enabled_models` text DEFAULT '[]' NOT NULL;--> statement-breakpoint
3
+ ALTER TABLE `project_llm_config` ADD `base_url` text;--> statement-breakpoint
4
+ CREATE UNIQUE INDEX `project_llm_config_project_provider` ON `project_llm_config` (`project_id`,`provider`);
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `chat_message` ADD `llm_provider` text;--> statement-breakpoint
2
+ ALTER TABLE `chat_message` ADD `llm_model_id` text;