agentnik 0.11.1__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.
- agentnik-0.11.1/LICENSE +204 -0
- agentnik-0.11.1/PKG-INFO +85 -0
- agentnik-0.11.1/README.md +61 -0
- agentnik-0.11.1/agentnik/__init__.py +2 -0
- agentnik-0.11.1/agentnik/analysis_tools.py +106 -0
- agentnik-0.11.1/agentnik/assets/agentnik-dark-old.png +0 -0
- agentnik-0.11.1/agentnik/assets/agentnik-dark.png +0 -0
- agentnik-0.11.1/agentnik/assets/agentnik-dark.svg +1 -0
- agentnik-0.11.1/agentnik/assets/agentnik-icon.ico +0 -0
- agentnik-0.11.1/agentnik/assets/agentnik-icon.png +0 -0
- agentnik-0.11.1/agentnik/assets/agentnik-icon.svg +1 -0
- agentnik-0.11.1/agentnik/assets/agentnik-light-old.png +0 -0
- agentnik-0.11.1/agentnik/assets/agentnik-light.png +0 -0
- agentnik-0.11.1/agentnik/assets/agentnik-light.svg +1 -0
- agentnik-0.11.1/agentnik/chat_image.py +50 -0
- agentnik-0.11.1/agentnik/chat_mcp.py +415 -0
- agentnik-0.11.1/agentnik/citations.py +28 -0
- agentnik-0.11.1/agentnik/code_agent.py +2030 -0
- agentnik-0.11.1/agentnik/code_artifacts.py +59 -0
- agentnik-0.11.1/agentnik/code_image.py +80 -0
- agentnik-0.11.1/agentnik/code_limits.py +40 -0
- agentnik-0.11.1/agentnik/code_search.py +126 -0
- agentnik-0.11.1/agentnik/code_symbols.py +41 -0
- agentnik-0.11.1/agentnik/code_ui.py +1785 -0
- agentnik-0.11.1/agentnik/code_vision.py +51 -0
- agentnik-0.11.1/agentnik/coding.py +6 -0
- agentnik-0.11.1/agentnik/compat_tools.py +160 -0
- agentnik-0.11.1/agentnik/context_compaction.py +106 -0
- agentnik-0.11.1/agentnik/context_usage.py +42 -0
- agentnik-0.11.1/agentnik/core.py +421 -0
- agentnik-0.11.1/agentnik/decision_advice.py +44 -0
- agentnik-0.11.1/agentnik/directory_ops.py +26 -0
- agentnik-0.11.1/agentnik/document_outline.py +125 -0
- agentnik-0.11.1/agentnik/document_reader.py +134 -0
- agentnik-0.11.1/agentnik/document_ui.py +53 -0
- agentnik-0.11.1/agentnik/failures.py +58 -0
- agentnik-0.11.1/agentnik/git_credentials.py +32 -0
- agentnik-0.11.1/agentnik/git_service.py +529 -0
- agentnik-0.11.1/agentnik/hosted.py +119 -0
- agentnik-0.11.1/agentnik/image_generation.py +147 -0
- agentnik-0.11.1/agentnik/image_settings.py +11 -0
- agentnik-0.11.1/agentnik/independent_review.py +146 -0
- agentnik-0.11.1/agentnik/localization.py +38 -0
- agentnik-0.11.1/agentnik/managed_symbols.py +74 -0
- agentnik-0.11.1/agentnik/mcp_2026.py +94 -0
- agentnik-0.11.1/agentnik/mcp_2026_tasks.py +86 -0
- agentnik-0.11.1/agentnik/mcp_code.py +210 -0
- agentnik-0.11.1/agentnik/mcp_completion.py +34 -0
- agentnik-0.11.1/agentnik/mcp_content.py +127 -0
- agentnik-0.11.1/agentnik/mcp_elicitation.py +351 -0
- agentnik-0.11.1/agentnik/mcp_fallback.py +49 -0
- agentnik-0.11.1/agentnik/mcp_local.py +597 -0
- agentnik-0.11.1/agentnik/mcp_oauth.py +59 -0
- agentnik-0.11.1/agentnik/mcp_oauth_credentials.py +162 -0
- agentnik-0.11.1/agentnik/mcp_oauth_discovery.py +105 -0
- agentnik-0.11.1/agentnik/mcp_oauth_flow.py +177 -0
- agentnik-0.11.1/agentnik/mcp_prompts.py +75 -0
- agentnik-0.11.1/agentnik/mcp_remote.py +961 -0
- agentnik-0.11.1/agentnik/mcp_resources.py +234 -0
- agentnik-0.11.1/agentnik/mcp_schema.py +331 -0
- agentnik-0.11.1/agentnik/mcp_support.py +223 -0
- agentnik-0.11.1/agentnik/mcp_ui.py +457 -0
- agentnik-0.11.1/agentnik/ollama_tools.py +129 -0
- agentnik-0.11.1/agentnik/page_fetch.py +89 -0
- agentnik-0.11.1/agentnik/parallel_tools.py +100 -0
- agentnik-0.11.1/agentnik/project_memory.py +73 -0
- agentnik-0.11.1/agentnik/project_skills.py +158 -0
- agentnik-0.11.1/agentnik/project_tools.py +128 -0
- agentnik-0.11.1/agentnik/repositories.py +80 -0
- agentnik-0.11.1/agentnik/repository_guidance.py +53 -0
- agentnik-0.11.1/agentnik/research.py +487 -0
- agentnik-0.11.1/agentnik/research_settings.py +51 -0
- agentnik-0.11.1/agentnik/research_ui.py +178 -0
- agentnik-0.11.1/agentnik/responses_tools.py +280 -0
- agentnik-0.11.1/agentnik/retention.py +31 -0
- agentnik-0.11.1/agentnik/routing.py +134 -0
- agentnik-0.11.1/agentnik/script_symbols.py +68 -0
- agentnik-0.11.1/agentnik/search_cache.py +41 -0
- agentnik-0.11.1/agentnik/search_providers.py +27 -0
- agentnik-0.11.1/agentnik/selection_scroll.py +49 -0
- agentnik-0.11.1/agentnik/sessions.py +264 -0
- agentnik-0.11.1/agentnik/shell.py +107 -0
- agentnik-0.11.1/agentnik/storage.py +270 -0
- agentnik-0.11.1/agentnik/subagent_capabilities.py +34 -0
- agentnik-0.11.1/agentnik/subagent_outputs.py +80 -0
- agentnik-0.11.1/agentnik/subagent_status.py +18 -0
- agentnik-0.11.1/agentnik/systems_symbols.py +71 -0
- agentnik-0.11.1/agentnik/task_plan.py +31 -0
- agentnik-0.11.1/agentnik/test_reports.py +40 -0
- agentnik-0.11.1/agentnik/tls.py +34 -0
- agentnik-0.11.1/agentnik/tools.py +294 -0
- agentnik-0.11.1/agentnik/track_authoring.py +64 -0
- agentnik-0.11.1/agentnik/track_drafting.py +77 -0
- agentnik-0.11.1/agentnik/track_editing.py +50 -0
- agentnik-0.11.1/agentnik/track_execution.py +79 -0
- agentnik-0.11.1/agentnik/track_reconciliation.py +64 -0
- agentnik-0.11.1/agentnik/tracks.py +90 -0
- agentnik-0.11.1/agentnik/translations/agentnik_de.qm +0 -0
- agentnik-0.11.1/agentnik/translations/agentnik_de.ts +5297 -0
- agentnik-0.11.1/agentnik/translations/agentnik_es-MX.qm +0 -0
- agentnik-0.11.1/agentnik/translations/agentnik_es-MX.ts +5297 -0
- agentnik-0.11.1/agentnik/translations/agentnik_fr-CA.qm +0 -0
- agentnik-0.11.1/agentnik/translations/agentnik_fr-CA.ts +5297 -0
- agentnik-0.11.1/agentnik/translations/agentnik_ko.qm +0 -0
- agentnik-0.11.1/agentnik/translations/agentnik_ko.ts +5345 -0
- agentnik-0.11.1/agentnik/translations/agentnik_zh-Hans.qm +0 -0
- agentnik-0.11.1/agentnik/translations/agentnik_zh-Hans.ts +5297 -0
- agentnik-0.11.1/agentnik/translations/agentnik_zh-Hant.qm +0 -0
- agentnik-0.11.1/agentnik/translations/agentnik_zh-Hant.ts +5297 -0
- agentnik-0.11.1/agentnik/ui.py +1576 -0
- agentnik-0.11.1/agentnik/web.py +539 -0
- agentnik-0.11.1/agentnik.egg-info/PKG-INFO +85 -0
- agentnik-0.11.1/agentnik.egg-info/SOURCES.txt +201 -0
- agentnik-0.11.1/agentnik.egg-info/dependency_links.txt +1 -0
- agentnik-0.11.1/agentnik.egg-info/entry_points.txt +2 -0
- agentnik-0.11.1/agentnik.egg-info/requires.txt +13 -0
- agentnik-0.11.1/agentnik.egg-info/top_level.txt +1 -0
- agentnik-0.11.1/pyproject.toml +22 -0
- agentnik-0.11.1/setup.cfg +4 -0
- agentnik-0.11.1/tests/test_analysis_tools.py +131 -0
- agentnik-0.11.1/tests/test_brave_search.py +183 -0
- agentnik-0.11.1/tests/test_chat_image.py +62 -0
- agentnik-0.11.1/tests/test_chat_image_ui.py +57 -0
- agentnik-0.11.1/tests/test_chat_mcp.py +1217 -0
- agentnik-0.11.1/tests/test_code_agent.py +1932 -0
- agentnik-0.11.1/tests/test_code_agent_ui.py +1336 -0
- agentnik-0.11.1/tests/test_code_artifacts.py +105 -0
- agentnik-0.11.1/tests/test_code_directory.py +142 -0
- agentnik-0.11.1/tests/test_code_directory_errors.py +29 -0
- agentnik-0.11.1/tests/test_code_markdown.py +35 -0
- agentnik-0.11.1/tests/test_code_move.py +178 -0
- agentnik-0.11.1/tests/test_code_search.py +96 -0
- agentnik-0.11.1/tests/test_code_symbols.py +41 -0
- agentnik-0.11.1/tests/test_code_vision.py +333 -0
- agentnik-0.11.1/tests/test_coding.py +100 -0
- agentnik-0.11.1/tests/test_coding_compaction.py +103 -0
- agentnik-0.11.1/tests/test_compat_tools.py +145 -0
- agentnik-0.11.1/tests/test_context_compaction.py +105 -0
- agentnik-0.11.1/tests/test_context_usage.py +59 -0
- agentnik-0.11.1/tests/test_core.py +231 -0
- agentnik-0.11.1/tests/test_decision_advice.py +43 -0
- agentnik-0.11.1/tests/test_document_outline.py +58 -0
- agentnik-0.11.1/tests/test_documents.py +78 -0
- agentnik-0.11.1/tests/test_excerpt_search.py +114 -0
- agentnik-0.11.1/tests/test_firecrawl_keyless.py +124 -0
- agentnik-0.11.1/tests/test_git_credentials.py +25 -0
- agentnik-0.11.1/tests/test_git_service.py +323 -0
- agentnik-0.11.1/tests/test_identity.py +41 -0
- agentnik-0.11.1/tests/test_image_generation.py +86 -0
- agentnik-0.11.1/tests/test_independent_review.py +73 -0
- agentnik-0.11.1/tests/test_lifecycle.py +189 -0
- agentnik-0.11.1/tests/test_live_compat.py +77 -0
- agentnik-0.11.1/tests/test_localization.py +379 -0
- agentnik-0.11.1/tests/test_managed_symbols.py +75 -0
- agentnik-0.11.1/tests/test_mcp_2026.py +64 -0
- agentnik-0.11.1/tests/test_mcp_2026_local.py +278 -0
- agentnik-0.11.1/tests/test_mcp_2026_negotiation.py +95 -0
- agentnik-0.11.1/tests/test_mcp_2026_session.py +424 -0
- agentnik-0.11.1/tests/test_mcp_2026_tasks.py +107 -0
- agentnik-0.11.1/tests/test_mcp_array_constraints.py +48 -0
- agentnik-0.11.1/tests/test_mcp_completion.py +26 -0
- agentnik-0.11.1/tests/test_mcp_conditional_schema.py +63 -0
- agentnik-0.11.1/tests/test_mcp_elicitation.py +414 -0
- agentnik-0.11.1/tests/test_mcp_local_negotiation.py +51 -0
- agentnik-0.11.1/tests/test_mcp_oauth.py +623 -0
- agentnik-0.11.1/tests/test_mcp_pattern_properties.py +49 -0
- agentnik-0.11.1/tests/test_mcp_property_names.py +37 -0
- agentnik-0.11.1/tests/test_mcp_support.py +2557 -0
- agentnik-0.11.1/tests/test_mcp_task_input.py +82 -0
- agentnik-0.11.1/tests/test_mcp_unique_items.py +38 -0
- agentnik-0.11.1/tests/test_offline_guard.py +37 -0
- agentnik-0.11.1/tests/test_page_fetch.py +109 -0
- agentnik-0.11.1/tests/test_parallel_tools.py +92 -0
- agentnik-0.11.1/tests/test_project_memory.py +87 -0
- agentnik-0.11.1/tests/test_project_skills.py +205 -0
- agentnik-0.11.1/tests/test_project_tools.py +167 -0
- agentnik-0.11.1/tests/test_release_tooling.py +109 -0
- agentnik-0.11.1/tests/test_repositories.py +133 -0
- agentnik-0.11.1/tests/test_repository_guidance.py +121 -0
- agentnik-0.11.1/tests/test_research.py +370 -0
- agentnik-0.11.1/tests/test_research_settings.py +146 -0
- agentnik-0.11.1/tests/test_research_ui.py +185 -0
- agentnik-0.11.1/tests/test_responses_integrity.py +161 -0
- agentnik-0.11.1/tests/test_routing.py +363 -0
- agentnik-0.11.1/tests/test_routing_ui.py +134 -0
- agentnik-0.11.1/tests/test_script_symbols.py +47 -0
- agentnik-0.11.1/tests/test_selection_scroll.py +54 -0
- agentnik-0.11.1/tests/test_session_retention.py +153 -0
- agentnik-0.11.1/tests/test_shell.py +109 -0
- agentnik-0.11.1/tests/test_subagent_outputs.py +82 -0
- agentnik-0.11.1/tests/test_subagents.py +472 -0
- agentnik-0.11.1/tests/test_systems_symbols.py +67 -0
- agentnik-0.11.1/tests/test_task_plan.py +101 -0
- agentnik-0.11.1/tests/test_tls_context.py +47 -0
- agentnik-0.11.1/tests/test_tls_policy.py +57 -0
- agentnik-0.11.1/tests/test_track_authoring.py +131 -0
- agentnik-0.11.1/tests/test_track_drafting.py +138 -0
- agentnik-0.11.1/tests/test_track_editing.py +119 -0
- agentnik-0.11.1/tests/test_track_execution.py +110 -0
- agentnik-0.11.1/tests/test_track_reconciliation.py +98 -0
- agentnik-0.11.1/tests/test_tracks.py +70 -0
- agentnik-0.11.1/tests/test_ui.py +405 -0
- agentnik-0.11.1/tests/test_usage_config.py +104 -0
agentnik-0.11.1/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
204
|
+
Copyright 2026 Nikolaus Spence
|
agentnik-0.11.1/PKG-INFO
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentnik
|
|
3
|
+
Version: 0.11.1
|
|
4
|
+
Summary: Cross-platform LLM chat and System One decision desktop client
|
|
5
|
+
Author: Nikolaus Spence
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: PySide6<7,>=6.8
|
|
11
|
+
Requires-Dist: keyring<26,>=25
|
|
12
|
+
Requires-Dist: dulwich<0.26,>=0.25
|
|
13
|
+
Requires-Dist: PyYAML<7,>=6.0.3
|
|
14
|
+
Requires-Dist: regex<2027,>=2024.11.6
|
|
15
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
16
|
+
Requires-Dist: tree-sitter<0.27,>=0.25
|
|
17
|
+
Requires-Dist: tree-sitter-javascript<0.26,>=0.23
|
|
18
|
+
Requires-Dist: tree-sitter-typescript<0.24,>=0.23
|
|
19
|
+
Requires-Dist: tree-sitter-go<0.26,>=0.23
|
|
20
|
+
Requires-Dist: tree-sitter-rust<0.25,>=0.23
|
|
21
|
+
Requires-Dist: tree-sitter-c-sharp<0.24,>=0.23
|
|
22
|
+
Requires-Dist: tree-sitter-java<0.24,>=0.23
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Agentnik
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
**Code, chat, and research with your choice of local or cloud models.** Agentnik is a Python/Qt desktop application for Windows, macOS, and Linux. It brings model connections, conversations, projects, and research into one workspace, using Ollama, LiteLLM gateways, and compatible provider endpoints.
|
|
31
|
+
|
|
32
|
+
## What you can do
|
|
33
|
+
|
|
34
|
+
- **Code with your model:** work in local repositories or folders using Agentnik's own coding loop. Choose a model, delegate bounded analysis and artifact creation to subagents using that model, inspect and edit files, run shell commands and tests with a configurable approval switch, and use structured Git tools. [Coding features](CODE_FEATURES.md) · [Coding guide](CODING_GUIDE.md)
|
|
35
|
+
- **Plan with specifications and tracks:** the built-in **Spec & Plan** workflow follows a Conductor-style approach: draft requirements, a specification and a task plan, review project changes, then start a selected track. Persistent project context, editable drafts, task IDs and progress reconciliation keep larger changes organized. [Spec & Plan guide](CODING_GUIDE.md#spec--plan-track-preview) · [Track format](TRACK_FORMAT.md)
|
|
36
|
+
- **Extend workflows with Skills and MCP:** select repository or user Skills and connect local or remote MCP servers, including OAuth with a pre-registered public client or supported dynamic registration. Code can use supported tools, text resources, templates and prompts; Chat offers an opt-in preview for MCP tools, resources and prompts. MCP tools can write or perform external actions without approval. [Skills and MCP](CODE_FEATURES.md) · [Chat tools](CHAT_GUIDE.md)
|
|
37
|
+
- **Chat with images and documents:** keep conversations in independent tabs with Markdown, streaming, visible thinking, saved prompts, history and token statistics. Attach images and supported documents in Chat or Code, optionally generate or edit images using an image provider, and use local calculator and data-analysis tools. [Chat and history](CHAT_GUIDE.md) · [Coding guide](CODING_GUIDE.md)
|
|
38
|
+
- **Research the web:** combine managed search and public-page retrieval, or use hosted search on eligible OpenAI Responses connections. Sources, citations, activity and fallback are visible; configured search providers can also supply place, image and entity results. [Research guide](RESEARCH_GUIDE.md) · [Search providers](SEARCH_PROVIDERS.md)
|
|
39
|
+
- **Get shell command advice:** optionally use an Ollama System One decision model to advise on shell-command approvals in Code. [Coding guide](CODING_GUIDE.md)
|
|
40
|
+
- **Choose connections and keep local history:** use native Ollama or compatible Responses, Chat Completions and Messages endpoints, including LiteLLM gateways and supported cloud connections. Manage credentials, persistent sessions and attachments, prompt history, context compaction, themes and language settings. [Connections and local data](CONNECTIONS.md) · [Feature inventory](FEATURES.md)
|
|
41
|
+
|
|
42
|
+
Spec & Plan is a native Agentnik feature inspired by Conductor. It uses Agentnik's own track format and configured models; upstream plugin or track compatibility is not claimed. Reported progress requires user judgment.
|
|
43
|
+
|
|
44
|
+
For testing System One Decision models with varying states, images, and questions, we recommend [Promptnik](https://github.com/nikspence/promptnik).
|
|
45
|
+
|
|
46
|
+
Research and coding workflows include preview features. Model listings do not establish support for tools, images, research or System One. See [validation](VALIDATION.md) for observed behavior and remaining platform and compatibility checks.
|
|
47
|
+
|
|
48
|
+
## What Agentnik is not
|
|
49
|
+
|
|
50
|
+
Agentnik is not a remotely controlled or unattended automated agent. You start and direct work in the desktop application; Code can continue through steps of a goal while the application is running. Agentnik does not connect to messaging services and is not intended for multi-agent orchestration. Code subagents perform bounded work within a user-started run.
|
|
51
|
+
|
|
52
|
+
## Get started
|
|
53
|
+
|
|
54
|
+
Agentnik requires Python 3.11 or newer. See [installation and launch](GETTING_STARTED.md) for Windows, macOS and Linux instructions, or use the Windows archive described below. Endpoint, credential and storage configuration is covered in [connections and local data](CONNECTIONS.md).
|
|
55
|
+
|
|
56
|
+
## Windows release
|
|
57
|
+
|
|
58
|
+
The **v0.11.1** Windows x64 build is an unsigned onedir ZIP. Extract the complete archive and run `Agentnik/Agentnik.exe`, keeping `_internal` beside it. Python is bundled. Verify the accompanying SHA-256 checksum. Build-host startup results are recorded in the archive. This release has not been separately qualified on a clean machine; macOS/Linux distribution validation remains outstanding. See [release notes](RELEASE_NOTES.md) and the archive's `BUILD-MANIFEST.json` for details.
|
|
59
|
+
|
|
60
|
+
## Screenshots
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
These welcome screens were rendered offline with temporary data. Research screenshots below use simulated responses.
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
## Documentation and development
|
|
71
|
+
|
|
72
|
+
- [Coding features](CODE_FEATURES.md) and [coding guide](CODING_GUIDE.md): model selection, project tools, Spec & Plan, Skills, and MCP.
|
|
73
|
+
- [Chat and history](CHAT_GUIDE.md): attachments, prompts, history, and controls.
|
|
74
|
+
- [Research guide](RESEARCH_GUIDE.md) and [search providers](SEARCH_PROVIDERS.md): routes, configuration, sources, and limits.
|
|
75
|
+
- [Connections and local data](CONNECTIONS.md): endpoints, credentials, discovery, and storage.
|
|
76
|
+
- [Features](FEATURES.md), [validation](VALIDATION.md), and [development and builds](DEVELOPMENT_VALIDATION.md): feature inventory, evidence, offline checks, and release tooling.
|
|
77
|
+
- [Project roadmap](AGENTNIK_PLAN.md): remaining work and qualification priorities.
|
|
78
|
+
|
|
79
|
+
Ordinary tests use temporary storage and do not issue live inference. Build and validate on each target OS. Pillow is needed to rebuild branding assets, not to run Agentnik. See [DISCLAIMER.md](DISCLAIMER.md) for responsibility and use information.
|
|
80
|
+
|
|
81
|
+
The toolbar **Web** and **MCP** switches apply to new Chat and Code runs. **Settings** controls which tool wins a name conflict. Use **Settings** for shared search priority and providers, research and coding limits, optional Decision-model shell advice, and TLS verification. Select the Code model at the top of each Code pane. Settings changed during a run apply to the next run. Web defaults off.
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
Apache-2.0. Copyright 2026 Nikolaus Spence. Sole author: Nikolaus Spence.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Agentnik
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
**Code, chat, and research with your choice of local or cloud models.** Agentnik is a Python/Qt desktop application for Windows, macOS, and Linux. It brings model connections, conversations, projects, and research into one workspace, using Ollama, LiteLLM gateways, and compatible provider endpoints.
|
|
7
|
+
|
|
8
|
+
## What you can do
|
|
9
|
+
|
|
10
|
+
- **Code with your model:** work in local repositories or folders using Agentnik's own coding loop. Choose a model, delegate bounded analysis and artifact creation to subagents using that model, inspect and edit files, run shell commands and tests with a configurable approval switch, and use structured Git tools. [Coding features](CODE_FEATURES.md) · [Coding guide](CODING_GUIDE.md)
|
|
11
|
+
- **Plan with specifications and tracks:** the built-in **Spec & Plan** workflow follows a Conductor-style approach: draft requirements, a specification and a task plan, review project changes, then start a selected track. Persistent project context, editable drafts, task IDs and progress reconciliation keep larger changes organized. [Spec & Plan guide](CODING_GUIDE.md#spec--plan-track-preview) · [Track format](TRACK_FORMAT.md)
|
|
12
|
+
- **Extend workflows with Skills and MCP:** select repository or user Skills and connect local or remote MCP servers, including OAuth with a pre-registered public client or supported dynamic registration. Code can use supported tools, text resources, templates and prompts; Chat offers an opt-in preview for MCP tools, resources and prompts. MCP tools can write or perform external actions without approval. [Skills and MCP](CODE_FEATURES.md) · [Chat tools](CHAT_GUIDE.md)
|
|
13
|
+
- **Chat with images and documents:** keep conversations in independent tabs with Markdown, streaming, visible thinking, saved prompts, history and token statistics. Attach images and supported documents in Chat or Code, optionally generate or edit images using an image provider, and use local calculator and data-analysis tools. [Chat and history](CHAT_GUIDE.md) · [Coding guide](CODING_GUIDE.md)
|
|
14
|
+
- **Research the web:** combine managed search and public-page retrieval, or use hosted search on eligible OpenAI Responses connections. Sources, citations, activity and fallback are visible; configured search providers can also supply place, image and entity results. [Research guide](RESEARCH_GUIDE.md) · [Search providers](SEARCH_PROVIDERS.md)
|
|
15
|
+
- **Get shell command advice:** optionally use an Ollama System One decision model to advise on shell-command approvals in Code. [Coding guide](CODING_GUIDE.md)
|
|
16
|
+
- **Choose connections and keep local history:** use native Ollama or compatible Responses, Chat Completions and Messages endpoints, including LiteLLM gateways and supported cloud connections. Manage credentials, persistent sessions and attachments, prompt history, context compaction, themes and language settings. [Connections and local data](CONNECTIONS.md) · [Feature inventory](FEATURES.md)
|
|
17
|
+
|
|
18
|
+
Spec & Plan is a native Agentnik feature inspired by Conductor. It uses Agentnik's own track format and configured models; upstream plugin or track compatibility is not claimed. Reported progress requires user judgment.
|
|
19
|
+
|
|
20
|
+
For testing System One Decision models with varying states, images, and questions, we recommend [Promptnik](https://github.com/nikspence/promptnik).
|
|
21
|
+
|
|
22
|
+
Research and coding workflows include preview features. Model listings do not establish support for tools, images, research or System One. See [validation](VALIDATION.md) for observed behavior and remaining platform and compatibility checks.
|
|
23
|
+
|
|
24
|
+
## What Agentnik is not
|
|
25
|
+
|
|
26
|
+
Agentnik is not a remotely controlled or unattended automated agent. You start and direct work in the desktop application; Code can continue through steps of a goal while the application is running. Agentnik does not connect to messaging services and is not intended for multi-agent orchestration. Code subagents perform bounded work within a user-started run.
|
|
27
|
+
|
|
28
|
+
## Get started
|
|
29
|
+
|
|
30
|
+
Agentnik requires Python 3.11 or newer. See [installation and launch](GETTING_STARTED.md) for Windows, macOS and Linux instructions, or use the Windows archive described below. Endpoint, credential and storage configuration is covered in [connections and local data](CONNECTIONS.md).
|
|
31
|
+
|
|
32
|
+
## Windows release
|
|
33
|
+
|
|
34
|
+
The **v0.11.1** Windows x64 build is an unsigned onedir ZIP. Extract the complete archive and run `Agentnik/Agentnik.exe`, keeping `_internal` beside it. Python is bundled. Verify the accompanying SHA-256 checksum. Build-host startup results are recorded in the archive. This release has not been separately qualified on a clean machine; macOS/Linux distribution validation remains outstanding. See [release notes](RELEASE_NOTES.md) and the archive's `BUILD-MANIFEST.json` for details.
|
|
35
|
+
|
|
36
|
+
## Screenshots
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
These welcome screens were rendered offline with temporary data. Research screenshots below use simulated responses.
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
## Documentation and development
|
|
47
|
+
|
|
48
|
+
- [Coding features](CODE_FEATURES.md) and [coding guide](CODING_GUIDE.md): model selection, project tools, Spec & Plan, Skills, and MCP.
|
|
49
|
+
- [Chat and history](CHAT_GUIDE.md): attachments, prompts, history, and controls.
|
|
50
|
+
- [Research guide](RESEARCH_GUIDE.md) and [search providers](SEARCH_PROVIDERS.md): routes, configuration, sources, and limits.
|
|
51
|
+
- [Connections and local data](CONNECTIONS.md): endpoints, credentials, discovery, and storage.
|
|
52
|
+
- [Features](FEATURES.md), [validation](VALIDATION.md), and [development and builds](DEVELOPMENT_VALIDATION.md): feature inventory, evidence, offline checks, and release tooling.
|
|
53
|
+
- [Project roadmap](AGENTNIK_PLAN.md): remaining work and qualification priorities.
|
|
54
|
+
|
|
55
|
+
Ordinary tests use temporary storage and do not issue live inference. Build and validate on each target OS. Pillow is needed to rebuild branding assets, not to run Agentnik. See [DISCLAIMER.md](DISCLAIMER.md) for responsibility and use information.
|
|
56
|
+
|
|
57
|
+
The toolbar **Web** and **MCP** switches apply to new Chat and Code runs. **Settings** controls which tool wins a name conflict. Use **Settings** for shared search priority and providers, research and coding limits, optional Decision-model shell advice, and TLS verification. Select the Code model at the top of each Code pane. Settings changed during a run apply to the next run. Web defaults off.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
Apache-2.0. Copyright 2026 Nikolaus Spence. Sole author: Nikolaus Spence.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Pure bounded numeric tools: no eval, imports, filesystem, or network execution."""
|
|
2
|
+
import ast
|
|
3
|
+
import csv
|
|
4
|
+
import io
|
|
5
|
+
import json
|
|
6
|
+
import math
|
|
7
|
+
import operator
|
|
8
|
+
import statistics
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AnalysisError(ValueError):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def finite(value):
|
|
16
|
+
if type(value) not in (int, float) or not math.isfinite(value) or abs(value) > 1e100:
|
|
17
|
+
raise AnalysisError('Result is non-finite or exceeds magnitude 1e100.')
|
|
18
|
+
return value
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def calculate(expression):
|
|
22
|
+
if not isinstance(expression, str) or not 0 < len(expression) <= 1000:
|
|
23
|
+
raise AnalysisError('Expression must contain 1–1000 characters.')
|
|
24
|
+
ops = {ast.Add:operator.add, ast.Sub:operator.sub, ast.Mult:operator.mul, ast.Div:operator.truediv, ast.FloorDiv:operator.floordiv, ast.Mod:operator.mod, ast.Pow:operator.pow}
|
|
25
|
+
funcs = {'abs':abs, 'round':round, 'min':min, 'max':max, 'sqrt':math.sqrt, 'log':math.log, 'log10':math.log10, 'sin':math.sin, 'cos':math.cos, 'tan':math.tan, 'ceil':math.ceil, 'floor':math.floor}
|
|
26
|
+
try:
|
|
27
|
+
tree = ast.parse(expression, mode='eval')
|
|
28
|
+
if sum(1 for _ in ast.walk(tree)) > 120: raise AnalysisError('Expression is too complex.')
|
|
29
|
+
def visit(node, depth=0):
|
|
30
|
+
if depth > 20: raise AnalysisError('Expression nesting exceeds 20.')
|
|
31
|
+
if isinstance(node, ast.Constant): return finite(node.value)
|
|
32
|
+
if isinstance(node, ast.Name) and node.id in ('pi', 'e'): return getattr(math, node.id)
|
|
33
|
+
if isinstance(node, ast.UnaryOp) and isinstance(node.op, (ast.UAdd, ast.USub)):
|
|
34
|
+
value = visit(node.operand, depth+1); return finite(-value if isinstance(node.op, ast.USub) else value)
|
|
35
|
+
if isinstance(node, ast.BinOp) and type(node.op) in ops:
|
|
36
|
+
left, right = visit(node.left, depth+1), visit(node.right, depth+1)
|
|
37
|
+
if isinstance(node.op, ast.Pow) and abs(right) > 100: raise AnalysisError('Exponent magnitude exceeds 100.')
|
|
38
|
+
return finite(ops[type(node.op)](left, right))
|
|
39
|
+
if isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id in funcs and not node.keywords and 1 <= len(node.args) <= 20:
|
|
40
|
+
return finite(funcs[node.func.id](*[visit(arg, depth+1) for arg in node.args]))
|
|
41
|
+
raise AnalysisError('Only numeric arithmetic and documented math functions are allowed.')
|
|
42
|
+
return {'expression':expression, 'value':visit(tree.body), 'precision':'Python integer / IEEE-754 float; approximate for non-integer arithmetic'}
|
|
43
|
+
except AnalysisError: raise
|
|
44
|
+
except (ValueError, TypeError, ArithmeticError, SyntaxError, RecursionError):
|
|
45
|
+
raise AnalysisError('Invalid arithmetic, function arguments, or numeric domain.') from None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def analyze_data(data):
|
|
49
|
+
"""data is a JSON request containing format, content, optional group_by."""
|
|
50
|
+
if not isinstance(data, str) or len(data.encode()) > 16000: raise AnalysisError('Data request exceeds 16 KB.')
|
|
51
|
+
try:
|
|
52
|
+
request = json.loads(data)
|
|
53
|
+
if not isinstance(request, dict) or set(request) - {'format','content','group_by'} or not {'format','content'} <= set(request): raise AnalysisError('Use format, content, and optional group_by.')
|
|
54
|
+
content = request['content']; kind = request['format']
|
|
55
|
+
if not isinstance(content, str): raise AnalysisError('content must be a string.')
|
|
56
|
+
if kind == 'csv':
|
|
57
|
+
reader = csv.reader(io.StringIO(content)); headers = next(reader, [])
|
|
58
|
+
if not headers or len(headers) > 32 or len(set(headers)) != len(headers) or any(not h or len(h)>100 for h in headers): raise AnalysisError('CSV requires 1–32 unique nonempty column headers (up to 100 characters).')
|
|
59
|
+
rows = []
|
|
60
|
+
for values in reader:
|
|
61
|
+
if len(values) != len(headers): raise AnalysisError('CSV row width does not match headers.')
|
|
62
|
+
rows.append(dict(zip(headers, values)))
|
|
63
|
+
if len(rows)>1000: raise AnalysisError('At most 1000 rows are supported.')
|
|
64
|
+
elif kind == 'json':
|
|
65
|
+
rows = json.loads(content)
|
|
66
|
+
if not isinstance(rows,list) or not rows or len(rows)>1000 or any(not isinstance(r,dict) for r in rows): raise AnalysisError('JSON content must be 1–1000 row objects.')
|
|
67
|
+
headers = list(dict.fromkeys(key for row in rows for key in row))
|
|
68
|
+
if not 1<=len(headers)<=32 or any(not key or len(key)>100 for key in headers): raise AnalysisError('Use 1–32 nonempty column names (up to 100 characters).')
|
|
69
|
+
if any(type(v) not in (str,int,float,bool,type(None)) for row in rows for v in row.values()): raise AnalysisError('Nested JSON cells are not supported.')
|
|
70
|
+
else: raise AnalysisError('format must be csv or json.')
|
|
71
|
+
if not rows: raise AnalysisError('No data rows.')
|
|
72
|
+
def summary(selected):
|
|
73
|
+
result = {}
|
|
74
|
+
for column in headers:
|
|
75
|
+
numbers=[];missing=other=0
|
|
76
|
+
for row in selected:
|
|
77
|
+
value=row.get(column)
|
|
78
|
+
if value is None or isinstance(value,str) and not value.strip(): missing+=1;continue
|
|
79
|
+
try:
|
|
80
|
+
if isinstance(value,bool):raise ValueError()
|
|
81
|
+
number=float(value)
|
|
82
|
+
if not math.isfinite(number) or abs(number)>1e100:raise ValueError()
|
|
83
|
+
numbers.append(number)
|
|
84
|
+
except (ValueError,TypeError,OverflowError):other+=1
|
|
85
|
+
item={'numeric_count':len(numbers),'missing_count':missing,'nonnumeric_count':other}
|
|
86
|
+
if numbers:
|
|
87
|
+
item.update(min=min(numbers),max=max(numbers),sum=math.fsum(numbers),mean=statistics.fmean(numbers),median=statistics.median(numbers),sample_stdev=statistics.stdev(numbers) if len(numbers)>1 else None)
|
|
88
|
+
result[column]=item
|
|
89
|
+
return result
|
|
90
|
+
result={'rows':len(rows),'columns':summary(rows),'notice':'Statistics use finite numeric cells only; booleans and invalid numbers count as nonnumeric. Missing cells are excluded. Float arithmetic is approximate.'}
|
|
91
|
+
if 'group_by' in request:
|
|
92
|
+
column=request['group_by']
|
|
93
|
+
if not isinstance(column,str) or column not in headers:raise AnalysisError('group_by must name an existing column.')
|
|
94
|
+
groups={}
|
|
95
|
+
for row in rows:
|
|
96
|
+
value=row.get(column); key=json.dumps(value,ensure_ascii=False,allow_nan=False)
|
|
97
|
+
groups.setdefault(key,[]).append(row)
|
|
98
|
+
if len(groups)>10:raise AnalysisError('Grouping supports at most 10 distinct values.')
|
|
99
|
+
result['groups']=[{'value':json.loads(key),'rows':len(selected),'columns':summary(selected)} for key,selected in groups.items()]
|
|
100
|
+
if len(json.dumps(result,allow_nan=False).encode())>24000:raise AnalysisError('Analysis output exceeds 24 KB; select fewer columns or groups.')
|
|
101
|
+
return result
|
|
102
|
+
except AnalysisError:raise
|
|
103
|
+
except (ValueError,TypeError,OverflowError,csv.Error,RecursionError):raise AnalysisError('Invalid CSV/JSON data request.') from None
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
HANDLERS={'calculate':calculate,'analyze_data':analyze_data}
|
|
Binary file
|
|
Binary file
|