jarvis-ai-assistant 0.1.104__tar.gz → 0.1.106__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.
Potentially problematic release.
This version of jarvis-ai-assistant might be problematic. Click here for more details.
- {jarvis_ai_assistant-0.1.104/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.106}/PKG-INFO +23 -16
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/README.md +21 -15
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/pyproject.toml +5 -5
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/setup.py +5 -5
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/__init__.py +1 -1
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/agent.py +124 -67
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_code_agent/code_agent.py +133 -22
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_code_agent/patch.py +4 -7
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_code_agent/relevant_files.py +188 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_codebase/main.py +36 -15
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_lsp/base.py +143 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_lsp/cpp.py +134 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_lsp/go.py +140 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_lsp/python.py +135 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_lsp/registry.py +234 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_lsp/rust.py +142 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/ai8.py +1 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/kimi.py +1 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/ollama.py +1 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/openai.py +1 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/oyi.py +1 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/registry.py +11 -11
- {jarvis_ai_assistant-0.1.104/src/jarvis/jarvis_platform → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform_manager}/main.py +1 -1
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_rag/main.py +6 -6
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_smart_shell/main.py +3 -3
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/ask_user.py +1 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/code_review.py +34 -8
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/create_code_agent.py +115 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/create_sub_agent.py +1 -1
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/deep_thinking.py +160 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/deep_thinking_agent.py +146 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/git_commiter.py +2 -2
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/lsp_find_definition.py +134 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/lsp_find_references.py +111 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/lsp_get_diagnostics.py +121 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/lsp_get_document_symbols.py +87 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/lsp_prepare_rename.py +130 -0
- jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools/lsp_validate_edit.py +141 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/methodology.py +6 -1
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/registry.py +6 -5
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/search.py +2 -2
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/utils.py +68 -25
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106/src/jarvis_ai_assistant.egg-info}/PKG-INFO +23 -16
- jarvis_ai_assistant-0.1.106/src/jarvis_ai_assistant.egg-info/SOURCES.txt +67 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis_ai_assistant.egg-info/entry_points.txt +3 -4
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis_ai_assistant.egg-info/requires.txt +1 -0
- jarvis_ai_assistant-0.1.104/src/jarvis/jarvis_code_agent/relevant_files.py +0 -97
- jarvis_ai_assistant-0.1.104/src/jarvis/tools/create_code_test_agent.py +0 -115
- jarvis_ai_assistant-0.1.104/src/jarvis/tools/create_ctags_agent.py +0 -164
- jarvis_ai_assistant-0.1.104/src/jarvis/tools/find_in_codebase.py +0 -78
- jarvis_ai_assistant-0.1.104/src/jarvis_ai_assistant.egg-info/SOURCES.txt +0 -55
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/MANIFEST.in +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/setup.cfg +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_code_agent/file_select.py +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_codebase/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/models → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform}/base.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/jarvis_platform → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_platform_manager}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_rag/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/ask_codebase.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/base.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/chdir.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/execute_shell.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/file_operation.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/rag.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/read_code.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/read_webpage.py +0 -0
- {jarvis_ai_assistant-0.1.104/src/jarvis/tools → jarvis_ai_assistant-0.1.106/src/jarvis/jarvis_tools}/select_code_files.py +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
- {jarvis_ai_assistant-0.1.104 → jarvis_ai_assistant-0.1.106}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: jarvis-ai-assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.106
|
|
4
4
|
Summary: Jarvis: An AI assistant that uses tools to interact with the system
|
|
5
5
|
Home-page: https://github.com/skyfireitdiy/Jarvis
|
|
6
6
|
Author: skyfire
|
|
@@ -59,6 +59,7 @@ Requires-Dist: rich>=13.3.1
|
|
|
59
59
|
Requires-Dist: pygments>=2.15.0
|
|
60
60
|
Requires-Dist: fuzzywuzzy>=0.18.0
|
|
61
61
|
Requires-Dist: python-Levenshtein>=0.26.1
|
|
62
|
+
Requires-Dist: jedi>=0.19.0
|
|
62
63
|
Provides-Extra: dev
|
|
63
64
|
Requires-Dist: pytest; extra == "dev"
|
|
64
65
|
Requires-Dist: black; extra == "dev"
|
|
@@ -133,15 +134,25 @@ Jarvis supports configuration through environment variables that can be set in t
|
|
|
133
134
|
|
|
134
135
|
| Environment Variable | Description | Default Value | Required |
|
|
135
136
|
|---------|------|--------|------|
|
|
136
|
-
| JARVIS_PLATFORM | AI platform to use
|
|
137
|
-
| JARVIS_MODEL | Model name to use |
|
|
138
|
-
| JARVIS_CODEGEN_PLATFORM |
|
|
139
|
-
| JARVIS_CODEGEN_MODEL | Model
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
| JARVIS_THREAD_COUNT | Number of threads
|
|
137
|
+
| JARVIS_PLATFORM | AI platform to use | kimi | Yes |
|
|
138
|
+
| JARVIS_MODEL | Model name to use | kimi | No |
|
|
139
|
+
| JARVIS_CODEGEN_PLATFORM | Platform for code generation | Same as JARVIS_PLATFORM | No |
|
|
140
|
+
| JARVIS_CODEGEN_MODEL | Model for code generation | Same as JARVIS_MODEL | No |
|
|
141
|
+
| JARVIS_THINKING_PLATFORM | Platform for thinking tasks | Same as JARVIS_PLATFORM | No |
|
|
142
|
+
| JARVIS_THINKING_MODEL | Model for thinking tasks | Same as JARVIS_MODEL | No |
|
|
143
|
+
| JARVIS_CHEAP_PLATFORM | Platform for cheap operations | Same as JARVIS_PLATFORM | No |
|
|
144
|
+
| JARVIS_CHEAP_MODEL | Model for cheap operations | Same as JARVIS_MODEL | No |
|
|
145
|
+
| JARVIS_THREAD_COUNT | Number of threads | 1 | No |
|
|
146
|
+
| JARVIS_MAX_CONTEXT_LENGTH | Maximum context length | 131072 | No |
|
|
147
|
+
| JARVIS_MIN_PARAGRAPH_LENGTH | Minimum paragraph length | 50 | No |
|
|
148
|
+
| JARVIS_MAX_PARAGRAPH_LENGTH | Maximum paragraph length | 1000 | No |
|
|
149
|
+
| JARVIS_CONTEXT_WINDOW | Context window size | 5 | No |
|
|
150
|
+
| JARVIS_AUTO_COMPLETE | Enable auto completion | false | No |
|
|
151
|
+
| JARVIS_DISABLE_CODEBASE | Disable codebase features | false | No |
|
|
152
|
+
| JARVIS_USE_METHODOLOGY | Enable methodology | true | No |
|
|
153
|
+
| JARVIS_RECORD_METHODOLOGY | Record methodology | true | No |
|
|
154
|
+
| JARVIS_NEED_SUMMARY | Generate summaries | true | No |
|
|
155
|
+
| JARVIS_DONT_USE_LOCAL_MODEL | Avoid using local models | false | No |
|
|
145
156
|
| OPENAI_API_KEY | API key for OpenAI platform | - | Required for OpenAI |
|
|
146
157
|
| OPENAI_API_BASE | Base URL for OpenAI API | https://api.deepseek.com | No |
|
|
147
158
|
| OPENAI_MODEL_NAME | Model name for OpenAI | deepseek-chat | No |
|
|
@@ -191,11 +202,8 @@ jss "describe what you want to do"
|
|
|
191
202
|
# Manage git commits
|
|
192
203
|
jarvis-git-commit
|
|
193
204
|
|
|
194
|
-
# Generate and manage ctags
|
|
195
|
-
jarvis-ctags
|
|
196
|
-
|
|
197
205
|
# Manage AI platforms
|
|
198
|
-
jarvis-platform
|
|
206
|
+
jarvis-platform-manager
|
|
199
207
|
```
|
|
200
208
|
|
|
201
209
|
Each command supports `--help` flag for detailed usage information:
|
|
@@ -205,9 +213,8 @@ jarvis-code-agent --help
|
|
|
205
213
|
jarvis-codebase --help
|
|
206
214
|
jarvis-rag --help
|
|
207
215
|
jarvis-smart-shell --help
|
|
208
|
-
jarvis-platform --help
|
|
216
|
+
jarvis-platform-manager --help
|
|
209
217
|
jarvis-git-commit --help
|
|
210
|
-
jarvis-ctags --help
|
|
211
218
|
```
|
|
212
219
|
|
|
213
220
|
## 🛠️ Tools
|
|
@@ -63,15 +63,25 @@ Jarvis supports configuration through environment variables that can be set in t
|
|
|
63
63
|
|
|
64
64
|
| Environment Variable | Description | Default Value | Required |
|
|
65
65
|
|---------|------|--------|------|
|
|
66
|
-
| JARVIS_PLATFORM | AI platform to use
|
|
67
|
-
| JARVIS_MODEL | Model name to use |
|
|
68
|
-
| JARVIS_CODEGEN_PLATFORM |
|
|
69
|
-
| JARVIS_CODEGEN_MODEL | Model
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| JARVIS_THREAD_COUNT | Number of threads
|
|
66
|
+
| JARVIS_PLATFORM | AI platform to use | kimi | Yes |
|
|
67
|
+
| JARVIS_MODEL | Model name to use | kimi | No |
|
|
68
|
+
| JARVIS_CODEGEN_PLATFORM | Platform for code generation | Same as JARVIS_PLATFORM | No |
|
|
69
|
+
| JARVIS_CODEGEN_MODEL | Model for code generation | Same as JARVIS_MODEL | No |
|
|
70
|
+
| JARVIS_THINKING_PLATFORM | Platform for thinking tasks | Same as JARVIS_PLATFORM | No |
|
|
71
|
+
| JARVIS_THINKING_MODEL | Model for thinking tasks | Same as JARVIS_MODEL | No |
|
|
72
|
+
| JARVIS_CHEAP_PLATFORM | Platform for cheap operations | Same as JARVIS_PLATFORM | No |
|
|
73
|
+
| JARVIS_CHEAP_MODEL | Model for cheap operations | Same as JARVIS_MODEL | No |
|
|
74
|
+
| JARVIS_THREAD_COUNT | Number of threads | 1 | No |
|
|
75
|
+
| JARVIS_MAX_CONTEXT_LENGTH | Maximum context length | 131072 | No |
|
|
76
|
+
| JARVIS_MIN_PARAGRAPH_LENGTH | Minimum paragraph length | 50 | No |
|
|
77
|
+
| JARVIS_MAX_PARAGRAPH_LENGTH | Maximum paragraph length | 1000 | No |
|
|
78
|
+
| JARVIS_CONTEXT_WINDOW | Context window size | 5 | No |
|
|
79
|
+
| JARVIS_AUTO_COMPLETE | Enable auto completion | false | No |
|
|
80
|
+
| JARVIS_DISABLE_CODEBASE | Disable codebase features | false | No |
|
|
81
|
+
| JARVIS_USE_METHODOLOGY | Enable methodology | true | No |
|
|
82
|
+
| JARVIS_RECORD_METHODOLOGY | Record methodology | true | No |
|
|
83
|
+
| JARVIS_NEED_SUMMARY | Generate summaries | true | No |
|
|
84
|
+
| JARVIS_DONT_USE_LOCAL_MODEL | Avoid using local models | false | No |
|
|
75
85
|
| OPENAI_API_KEY | API key for OpenAI platform | - | Required for OpenAI |
|
|
76
86
|
| OPENAI_API_BASE | Base URL for OpenAI API | https://api.deepseek.com | No |
|
|
77
87
|
| OPENAI_MODEL_NAME | Model name for OpenAI | deepseek-chat | No |
|
|
@@ -121,11 +131,8 @@ jss "describe what you want to do"
|
|
|
121
131
|
# Manage git commits
|
|
122
132
|
jarvis-git-commit
|
|
123
133
|
|
|
124
|
-
# Generate and manage ctags
|
|
125
|
-
jarvis-ctags
|
|
126
|
-
|
|
127
134
|
# Manage AI platforms
|
|
128
|
-
jarvis-platform
|
|
135
|
+
jarvis-platform-manager
|
|
129
136
|
```
|
|
130
137
|
|
|
131
138
|
Each command supports `--help` flag for detailed usage information:
|
|
@@ -135,9 +142,8 @@ jarvis-code-agent --help
|
|
|
135
142
|
jarvis-codebase --help
|
|
136
143
|
jarvis-rag --help
|
|
137
144
|
jarvis-smart-shell --help
|
|
138
|
-
jarvis-platform --help
|
|
145
|
+
jarvis-platform-manager --help
|
|
139
146
|
jarvis-git-commit --help
|
|
140
|
-
jarvis-ctags --help
|
|
141
147
|
```
|
|
142
148
|
|
|
143
149
|
## 🛠️ Tools
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "jarvis-ai-assistant"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.106"
|
|
8
8
|
description = "Jarvis: An AI assistant that uses tools to interact with the system"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Your Name", email = "your.email@example.com" }]
|
|
@@ -41,6 +41,7 @@ dependencies = [
|
|
|
41
41
|
"pygments>=2.15.0",
|
|
42
42
|
"fuzzywuzzy>=0.18.0",
|
|
43
43
|
"python-Levenshtein>=0.26.1",
|
|
44
|
+
"jedi>=0.19.0",
|
|
44
45
|
]
|
|
45
46
|
requires-python = ">=3.8"
|
|
46
47
|
|
|
@@ -57,7 +58,6 @@ jarvis-codebase = "jarvis.jarvis_codebase.main:main"
|
|
|
57
58
|
jarvis-rag = "jarvis.jarvis_rag.main:main"
|
|
58
59
|
jarvis-smart-shell = "jarvis.jarvis_smart_shell.main:main"
|
|
59
60
|
jss = "jarvis.jarvis_smart_shell.main:main"
|
|
60
|
-
jarvis-platform = "jarvis.
|
|
61
|
-
jarvis-git-commit = "jarvis.
|
|
62
|
-
jarvis-
|
|
63
|
-
jarvis-code-review = "jarvis.tools.code_review:main"
|
|
61
|
+
jarvis-platform-manager = "jarvis.jarvis_platform_manager.main:main"
|
|
62
|
+
jarvis-git-commit = "jarvis.jarvis_tools.git_commiter:main"
|
|
63
|
+
jarvis-code-review = "jarvis.jarvis_tools.code_review:main"
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="jarvis-ai-assistant",
|
|
5
|
-
version="0.1.
|
|
5
|
+
version="0.1.106",
|
|
6
6
|
author="skyfire",
|
|
7
7
|
author_email="skyfireitdiy@hotmail.com",
|
|
8
8
|
description="An AI assistant that uses various tools to interact with the system",
|
|
@@ -33,6 +33,7 @@ setup(
|
|
|
33
33
|
"pygments>=2.15.0",
|
|
34
34
|
"fuzzywuzzy>=0.18.0",
|
|
35
35
|
"python-Levenshtein>=0.26.1",
|
|
36
|
+
"jedi>=0.19.0",
|
|
36
37
|
],
|
|
37
38
|
entry_points={
|
|
38
39
|
"console_scripts": [
|
|
@@ -42,10 +43,9 @@ setup(
|
|
|
42
43
|
"jarvis-rag=jarvis.jarvis_rag.main:main",
|
|
43
44
|
"jarvis-smart-shell=jarvis.jarvis_smart_shell.main:main",
|
|
44
45
|
"jss=jarvis.jarvis_smart_shell.main:main",
|
|
45
|
-
"jarvis-platform=jarvis.
|
|
46
|
-
"jarvis-git-commit=jarvis.
|
|
47
|
-
"jarvis-
|
|
48
|
-
"jarvis-code-review=jarvis.tools.code_review:main",
|
|
46
|
+
"jarvis-platform-manager=jarvis.jarvis_platform_manager.main:main",
|
|
47
|
+
"jarvis-git-commit=jarvis.jarvis_tools.git_commiter:main",
|
|
48
|
+
"jarvis-code-review=jarvis.jarvis_tools.code_review:main",
|
|
49
49
|
],
|
|
50
50
|
},
|
|
51
51
|
python_requires=">=3.8",
|
|
@@ -5,22 +5,29 @@ from typing import Callable, Dict, List, Optional
|
|
|
5
5
|
from prompt_toolkit import prompt
|
|
6
6
|
import yaml
|
|
7
7
|
|
|
8
|
-
from jarvis.
|
|
9
|
-
from jarvis.
|
|
10
|
-
from jarvis.
|
|
11
|
-
from jarvis.utils import PrettyOutput, OutputType, is_auto_complete, load_methodology, add_agent, delete_current_agent, get_max_context_length, get_multiline_input, init_env
|
|
8
|
+
from jarvis.jarvis_platform.base import BasePlatform
|
|
9
|
+
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
10
|
+
from jarvis.jarvis_tools.registry import ToolRegistry, tool_call_help
|
|
11
|
+
from jarvis.utils import PrettyOutput, OutputType, is_auto_complete, is_need_summary, is_record_methodology, load_methodology, add_agent, delete_current_agent, get_max_context_length, get_multiline_input, init_env, is_use_methodology
|
|
12
12
|
import os
|
|
13
13
|
|
|
14
14
|
class Agent:
|
|
15
15
|
|
|
16
|
-
def __del__(self):
|
|
17
|
-
delete_current_agent()
|
|
18
|
-
|
|
19
16
|
def set_summary_prompt(self, summary_prompt: str):
|
|
17
|
+
"""Set the summary prompt for task completion.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
summary_prompt: The prompt template for generating task summaries
|
|
21
|
+
"""
|
|
20
22
|
self.summary_prompt = summary_prompt
|
|
21
23
|
|
|
22
|
-
def
|
|
23
|
-
|
|
24
|
+
def set_output_handler_before_tool(self, handler: List[Callable]):
|
|
25
|
+
"""Set handlers to process output before tool execution.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
handler: List of callable functions to process output
|
|
29
|
+
"""
|
|
30
|
+
self.output_handler_before_tool = handler
|
|
24
31
|
|
|
25
32
|
def __init__(self,
|
|
26
33
|
system_prompt: str,
|
|
@@ -29,35 +36,47 @@ class Agent:
|
|
|
29
36
|
tool_registry: Optional[ToolRegistry] = None,
|
|
30
37
|
platform: Optional[BasePlatform] = None,
|
|
31
38
|
summary_prompt: Optional[str] = None,
|
|
32
|
-
auto_complete: bool =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
auto_complete: Optional[bool] = None,
|
|
40
|
+
output_handler_before_tool: Optional[List[Callable]] = None,
|
|
41
|
+
output_handler_after_tool: Optional[List[Callable]] = None,
|
|
42
|
+
use_methodology: Optional[bool] = None,
|
|
43
|
+
record_methodology: Optional[bool] = None,
|
|
44
|
+
need_summary: Optional[bool] = None,
|
|
45
|
+
max_context_length: Optional[int] = None):
|
|
46
|
+
"""Initialize an Agent instance.
|
|
37
47
|
|
|
38
48
|
Args:
|
|
39
|
-
system_prompt:
|
|
40
|
-
name: Agent name,
|
|
41
|
-
is_sub_agent: Whether
|
|
42
|
-
tool_registry:
|
|
43
|
-
platform:
|
|
49
|
+
system_prompt: The system prompt defining agent behavior
|
|
50
|
+
name: Agent name, defaults to "Jarvis"
|
|
51
|
+
is_sub_agent: Whether this is a sub-agent
|
|
52
|
+
tool_registry: Registry of available tools
|
|
53
|
+
platform: AI platform to use
|
|
54
|
+
summary_prompt: Template for generating summaries
|
|
55
|
+
auto_complete: Whether to enable auto-completion
|
|
56
|
+
output_handler_before_tool: Handlers to process output before tool execution
|
|
57
|
+
output_handler_after_tool: Handlers to process output after tool execution
|
|
58
|
+
use_methodology: Whether to use methodology
|
|
59
|
+
record_methodology: Whether to record methodology
|
|
60
|
+
need_summary: Whether to generate summaries
|
|
61
|
+
max_context_length: Maximum context length
|
|
44
62
|
"""
|
|
45
|
-
add_agent(name)
|
|
46
63
|
PrettyOutput.print(f"Welcome to Jarvis, your AI assistant, Initiating...", OutputType.SYSTEM)
|
|
47
64
|
if platform is not None:
|
|
48
65
|
self.model = platform
|
|
49
66
|
else:
|
|
50
67
|
self.model = PlatformRegistry.get_global_platform_registry().get_normal_platform()
|
|
51
68
|
self.tool_registry = tool_registry if tool_registry else ToolRegistry()
|
|
52
|
-
self.record_methodology = record_methodology
|
|
69
|
+
self.record_methodology = record_methodology if record_methodology is not None else is_record_methodology()
|
|
70
|
+
self.use_methodology = use_methodology if use_methodology is not None else is_use_methodology()
|
|
53
71
|
self.name = name
|
|
54
72
|
self.is_sub_agent = is_sub_agent
|
|
55
73
|
self.prompt = ""
|
|
56
74
|
self.conversation_length = 0 # Use length counter instead
|
|
57
75
|
self.system_prompt = system_prompt
|
|
58
|
-
self.need_summary = need_summary
|
|
76
|
+
self.need_summary = need_summary if need_summary is not None else is_need_summary()
|
|
59
77
|
# Load configuration from environment variables
|
|
60
|
-
self.
|
|
78
|
+
self.output_handler_before_tool = output_handler_before_tool if output_handler_before_tool else []
|
|
79
|
+
self.output_handler_after_tool = output_handler_after_tool if output_handler_after_tool else []
|
|
61
80
|
|
|
62
81
|
self.summary_prompt = summary_prompt if summary_prompt else f"""Please generate a concise summary report of the task execution, including:
|
|
63
82
|
|
|
@@ -70,28 +89,22 @@ class Agent:
|
|
|
70
89
|
Please describe in concise bullet points, highlighting important information.
|
|
71
90
|
"""
|
|
72
91
|
|
|
73
|
-
self.max_context_length = get_max_context_length()
|
|
74
|
-
|
|
75
|
-
self.auto_complete = auto_complete
|
|
76
|
-
|
|
92
|
+
self.max_context_length = max_context_length if max_context_length is not None else get_max_context_length()
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
# Initialize methodology related attributes
|
|
81
|
-
self.methodology_data = []
|
|
94
|
+
self.auto_complete = auto_complete if auto_complete is not None else is_auto_complete()
|
|
82
95
|
|
|
83
96
|
PrettyOutput.section(f"Jarvis initialized - With {self.model.name()}", OutputType.SYSTEM)
|
|
97
|
+
|
|
84
98
|
tools = self.tool_registry.get_all_tools()
|
|
85
99
|
if tools:
|
|
86
100
|
PrettyOutput.section(f"Available tools: {', '.join([tool['name'] for tool in tools])}", OutputType.SYSTEM)
|
|
87
101
|
|
|
88
|
-
|
|
89
|
-
# Load methodology
|
|
90
102
|
|
|
91
103
|
tools_prompt = self.tool_registry.load_tools()
|
|
92
104
|
complete_prompt = """"""
|
|
93
105
|
if self.auto_complete:
|
|
94
106
|
complete_prompt = """
|
|
107
|
+
## Task Completion
|
|
95
108
|
When the task is completed, you should print the following message:
|
|
96
109
|
<!!!COMPLETE!!!>
|
|
97
110
|
"""
|
|
@@ -106,8 +119,18 @@ Please describe in concise bullet points, highlighting important information.
|
|
|
106
119
|
self.first = True
|
|
107
120
|
|
|
108
121
|
@staticmethod
|
|
109
|
-
def
|
|
110
|
-
"""Extract tool calls from content
|
|
122
|
+
def _extract_tool_calls(content: str) -> List[Dict]:
|
|
123
|
+
"""Extract tool calls from content.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
content: The content containing tool calls
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
List[Dict]: List of extracted tool calls with name and arguments
|
|
130
|
+
|
|
131
|
+
Raises:
|
|
132
|
+
Exception: If tool call is missing necessary fields
|
|
133
|
+
"""
|
|
111
134
|
# Split content into lines
|
|
112
135
|
lines = content.split('\n')
|
|
113
136
|
tool_call_lines = []
|
|
@@ -143,7 +166,17 @@ Please describe in concise bullet points, highlighting important information.
|
|
|
143
166
|
return []
|
|
144
167
|
|
|
145
168
|
def _call_model(self, message: str) -> str:
|
|
146
|
-
"""Call model
|
|
169
|
+
"""Call the AI model with retry logic.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
message: The input message for the model
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
str: Model's response
|
|
176
|
+
|
|
177
|
+
Note:
|
|
178
|
+
Will retry with exponential backoff up to 30 seconds between retries
|
|
179
|
+
"""
|
|
147
180
|
sleep_time = 5
|
|
148
181
|
while True:
|
|
149
182
|
ret = self.model.chat_until_success(message)
|
|
@@ -159,16 +192,17 @@ Please describe in concise bullet points, highlighting important information.
|
|
|
159
192
|
|
|
160
193
|
|
|
161
194
|
def _summarize_and_clear_history(self) -> None:
|
|
162
|
-
"""
|
|
163
|
-
[System message]
|
|
164
|
-
Summarize current conversation history and clear history, only keep system message and summary
|
|
195
|
+
"""Summarize current conversation and clear history.
|
|
165
196
|
|
|
166
197
|
This method will:
|
|
167
|
-
1.
|
|
198
|
+
1. Generate a summary of key information
|
|
168
199
|
2. Clear the conversation history
|
|
169
200
|
3. Keep the system message
|
|
170
|
-
4. Add
|
|
171
|
-
5. Reset
|
|
201
|
+
4. Add summary as new context
|
|
202
|
+
5. Reset conversation length
|
|
203
|
+
|
|
204
|
+
Note:
|
|
205
|
+
Used when context length exceeds maximum
|
|
172
206
|
"""
|
|
173
207
|
# Create a new model instance to summarize, avoid affecting the main conversation
|
|
174
208
|
|
|
@@ -203,10 +237,14 @@ Please continue the task based on the above information.
|
|
|
203
237
|
PrettyOutput.print(f"Failed to summarize conversation history: {str(e)}", OutputType.ERROR)
|
|
204
238
|
|
|
205
239
|
def _complete_task(self) -> str:
|
|
206
|
-
"""Complete task and generate summary
|
|
240
|
+
"""Complete the current task and generate summary if needed.
|
|
207
241
|
|
|
208
242
|
Returns:
|
|
209
243
|
str: Task summary or completion status
|
|
244
|
+
|
|
245
|
+
Note:
|
|
246
|
+
- For main agent: May generate methodology if enabled
|
|
247
|
+
- For sub-agent: May generate summary if enabled
|
|
210
248
|
"""
|
|
211
249
|
PrettyOutput.section("Task completed", OutputType.SUCCESS)
|
|
212
250
|
|
|
@@ -227,7 +265,7 @@ Please continue the task based on the above information.
|
|
|
227
265
|
|
|
228
266
|
# 检查是否包含工具调用
|
|
229
267
|
try:
|
|
230
|
-
tool_calls = Agent.
|
|
268
|
+
tool_calls = Agent._extract_tool_calls(response)
|
|
231
269
|
if tool_calls:
|
|
232
270
|
self.tool_registry.handle_tool_calls(tool_calls)
|
|
233
271
|
except Exception as e:
|
|
@@ -246,17 +284,23 @@ Please continue the task based on the above information.
|
|
|
246
284
|
|
|
247
285
|
|
|
248
286
|
def run(self, user_input: str, file_list: Optional[List[str]] = None) -> str:
|
|
249
|
-
"""Process user input and
|
|
287
|
+
"""Process user input and execute the task.
|
|
250
288
|
|
|
251
289
|
Args:
|
|
252
|
-
user_input: User
|
|
253
|
-
file_list: Optional
|
|
254
|
-
|
|
290
|
+
user_input: User's task description or request
|
|
291
|
+
file_list: Optional list of files to process
|
|
292
|
+
|
|
255
293
|
Returns:
|
|
256
294
|
str: Task summary report
|
|
295
|
+
|
|
296
|
+
Note:
|
|
297
|
+
- Handles context management
|
|
298
|
+
- Processes tool calls
|
|
299
|
+
- Manages conversation flow
|
|
300
|
+
- Supports interactive mode
|
|
257
301
|
"""
|
|
258
302
|
|
|
259
|
-
|
|
303
|
+
add_agent(self.name)
|
|
260
304
|
|
|
261
305
|
try:
|
|
262
306
|
PrettyOutput.section("Preparing environment", OutputType.PLANNING)
|
|
@@ -266,7 +310,7 @@ Please continue the task based on the above information.
|
|
|
266
310
|
# 显示任务开始
|
|
267
311
|
PrettyOutput.section(f"Starting new task: {self.name}", OutputType.PLANNING)
|
|
268
312
|
|
|
269
|
-
if self.first:
|
|
313
|
+
if self.first and self.use_methodology:
|
|
270
314
|
self.prompt = f"{user_input}\n\n{load_methodology(user_input)}"
|
|
271
315
|
self.first = False
|
|
272
316
|
else:
|
|
@@ -289,11 +333,11 @@ Please continue the task based on the above information.
|
|
|
289
333
|
self.prompt = ""
|
|
290
334
|
self.conversation_length += len(current_response)
|
|
291
335
|
|
|
292
|
-
for
|
|
293
|
-
self.prompt +=
|
|
336
|
+
for handler in self.output_handler_before_tool:
|
|
337
|
+
self.prompt += handler(current_response)
|
|
294
338
|
|
|
295
339
|
try:
|
|
296
|
-
result = Agent.
|
|
340
|
+
result = Agent._extract_tool_calls(current_response)
|
|
297
341
|
except Exception as e:
|
|
298
342
|
PrettyOutput.print(f"Tool call error: {str(e)}", OutputType.ERROR)
|
|
299
343
|
self.prompt += f"Tool call error: {str(e)}"
|
|
@@ -303,6 +347,9 @@ Please continue the task based on the above information.
|
|
|
303
347
|
PrettyOutput.print("Executing tool call...", OutputType.PROGRESS)
|
|
304
348
|
tool_result = self.tool_registry.handle_tool_calls(result)
|
|
305
349
|
self.prompt += tool_result
|
|
350
|
+
|
|
351
|
+
for handler in self.output_handler_after_tool:
|
|
352
|
+
self.prompt += handler(current_response)
|
|
306
353
|
|
|
307
354
|
if self.prompt:
|
|
308
355
|
continue
|
|
@@ -328,9 +375,17 @@ Please continue the task based on the above information.
|
|
|
328
375
|
PrettyOutput.print(str(e), OutputType.ERROR)
|
|
329
376
|
return f"Task failed: {str(e)}"
|
|
330
377
|
|
|
378
|
+
finally:
|
|
379
|
+
delete_current_agent()
|
|
331
380
|
|
|
332
|
-
def
|
|
333
|
-
"""Clear conversation history
|
|
381
|
+
def _clear_history(self):
|
|
382
|
+
"""Clear conversation history while preserving system prompt.
|
|
383
|
+
|
|
384
|
+
This will:
|
|
385
|
+
1. Clear the prompt
|
|
386
|
+
2. Reset the model
|
|
387
|
+
3. Reset conversation length counter
|
|
388
|
+
"""
|
|
334
389
|
self.prompt = ""
|
|
335
390
|
self.model.reset()
|
|
336
391
|
self.conversation_length = 0 # Reset conversation length
|
|
@@ -338,7 +393,7 @@ Please continue the task based on the above information.
|
|
|
338
393
|
|
|
339
394
|
|
|
340
395
|
|
|
341
|
-
def
|
|
396
|
+
def _load_tasks() -> dict:
|
|
342
397
|
"""Load tasks from .jarvis files in user home and current directory."""
|
|
343
398
|
tasks = {}
|
|
344
399
|
|
|
@@ -375,18 +430,20 @@ def load_tasks() -> dict:
|
|
|
375
430
|
except Exception as e:
|
|
376
431
|
PrettyOutput.print(f"Error loading .jarvis/pre-command file: {str(e)}", OutputType.ERROR)
|
|
377
432
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
433
|
+
|
|
434
|
+
if is_use_methodology():
|
|
435
|
+
# Read methodology
|
|
436
|
+
method_path = os.path.expanduser("~/.jarvis/methodology")
|
|
437
|
+
if os.path.exists(method_path):
|
|
438
|
+
with open(method_path, "r", encoding="utf-8") as f:
|
|
439
|
+
methodology = yaml.safe_load(f)
|
|
440
|
+
if isinstance(methodology, dict):
|
|
441
|
+
for name, desc in methodology.items():
|
|
442
|
+
tasks[f"Run Methodology: {str(name)}\n {str(desc)}" ] = str(desc)
|
|
386
443
|
|
|
387
444
|
return tasks
|
|
388
445
|
|
|
389
|
-
def
|
|
446
|
+
def _select_task(tasks: dict) -> str:
|
|
390
447
|
"""Let user select a task from the list or skip. Returns task description if selected."""
|
|
391
448
|
if not tasks:
|
|
392
449
|
return ""
|
|
@@ -462,9 +519,9 @@ def main():
|
|
|
462
519
|
agent = Agent(system_prompt=origin_agent_system_prompt, tool_registry=ToolRegistry())
|
|
463
520
|
|
|
464
521
|
# 加载预定义任务
|
|
465
|
-
tasks =
|
|
522
|
+
tasks = _load_tasks()
|
|
466
523
|
if tasks:
|
|
467
|
-
selected_task =
|
|
524
|
+
selected_task = _select_task(tasks)
|
|
468
525
|
if selected_task:
|
|
469
526
|
PrettyOutput.print(f"\nExecute task: {selected_task}", OutputType.INFO)
|
|
470
527
|
agent.run(selected_task, args.files)
|