jarvis-ai-assistant 0.1.100__tar.gz → 0.1.102__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.100/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.102}/PKG-INFO +1 -47
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/README.md +0 -40
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/pyproject.toml +1 -10
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/setup.py +1 -10
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/__init__.py +1 -1
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/agent.py +3 -24
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_code_agent/main.py +1 -3
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_coder/patch_handler.py +5 -5
- jarvis_ai_assistant-0.1.102/src/jarvis/jarvis_github/main.py +232 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/ai8.py +2 -3
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/oyi.py +1 -3
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/registry.py +48 -40
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/utils.py +9 -124
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102/src/jarvis_ai_assistant.egg-info}/PKG-INFO +1 -47
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +2 -7
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -3
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis_ai_assistant.egg-info/requires.txt +0 -6
- jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_codebase/main.py +0 -875
- jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_coder/main.py +0 -241
- jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_coder/plan_generator.py +0 -145
- jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_rag/main.py +0 -822
- jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
- jarvis_ai_assistant-0.1.100/src/jarvis/tools/rag.py +0 -138
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/MANIFEST.in +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/setup.cfg +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_codebase → jarvis_ai_assistant-0.1.102/src/jarvis/jarvis_coder}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_coder/file_select.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_coder/git_utils.py +0 -0
- {jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_coder → jarvis_ai_assistant-0.1.102/src/jarvis/jarvis_github}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_platform/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_platform/main.py +0 -0
- {jarvis_ai_assistant-0.1.100/src/jarvis/jarvis_rag → jarvis_ai_assistant-0.1.102/src/jarvis/jarvis_smart_shell}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_smart_shell/main.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/base.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/kimi.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/ollama.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/openai.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/models/registry.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/ask_user.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/base.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/chdir.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/create_code_sub_agent.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/create_sub_agent.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/execute_code_modification.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/execute_shell.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/file_operation.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/find_files.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/generate_tool.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/methodology.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/read_webpage.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/search.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/select_code_files.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/tools/thinker.py +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
- {jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/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.102
|
|
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
|
|
@@ -46,14 +46,8 @@ Requires-Dist: prompt_toolkit>=3.0.0
|
|
|
46
46
|
Requires-Dist: openai>=1.20.0
|
|
47
47
|
Requires-Dist: playwright>=1.41.1
|
|
48
48
|
Requires-Dist: numpy>=1.24.0
|
|
49
|
-
Requires-Dist: faiss-cpu>=1.8.0
|
|
50
|
-
Requires-Dist: sentence-transformers>=2.2.2
|
|
51
49
|
Requires-Dist: bs4>=0.0.1
|
|
52
|
-
Requires-Dist: PyMuPDF>=1.21.0
|
|
53
|
-
Requires-Dist: python-docx>=0.8.11
|
|
54
|
-
Requires-Dist: tiktoken>=0.3.0
|
|
55
50
|
Requires-Dist: tqdm>=4.65.0
|
|
56
|
-
Requires-Dist: docx>=0.2.4
|
|
57
51
|
Requires-Dist: yaspin>=2.5.0
|
|
58
52
|
Provides-Extra: dev
|
|
59
53
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -154,27 +148,6 @@ Jarvis supports configuration through environment variables that can be set in t
|
|
|
154
148
|
jarvis
|
|
155
149
|
```
|
|
156
150
|
|
|
157
|
-
### Codebase Search
|
|
158
|
-
```bash
|
|
159
|
-
# Generate codebase index
|
|
160
|
-
jarvis-codebase --generate
|
|
161
|
-
|
|
162
|
-
# Search similar code
|
|
163
|
-
jarvis-codebase --search "your search query"
|
|
164
|
-
|
|
165
|
-
# Ask questions about codebase
|
|
166
|
-
jarvis-codebase --ask "your question"
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Document Analysis (RAG)
|
|
170
|
-
```bash
|
|
171
|
-
# Build document index
|
|
172
|
-
jarvis-rag --dir /path/to/documents --build
|
|
173
|
-
|
|
174
|
-
# Search documents
|
|
175
|
-
jarvis-rag --query "your search query"
|
|
176
|
-
```
|
|
177
|
-
|
|
178
151
|
### Search Tool
|
|
179
152
|
```bash
|
|
180
153
|
# Basic search
|
|
@@ -189,19 +162,6 @@ jarvis-search "your query" --max 3
|
|
|
189
162
|
|
|
190
163
|
## 🛠️ Tools
|
|
191
164
|
|
|
192
|
-
|
|
193
|
-
### Built-in Tools
|
|
194
|
-
|
|
195
|
-
| Tool | Description |
|
|
196
|
-
|------|-------------|
|
|
197
|
-
| execute_shell | Execute system commands and capture output |
|
|
198
|
-
| file_operation | File operations (read/write/append/delete) |
|
|
199
|
-
| generate_tool | AI-powered tool generation and integration |
|
|
200
|
-
| methodology | Experience accumulation and methodology management |
|
|
201
|
-
| create_sub_agent | Create specialized sub-agents for specific tasks |
|
|
202
|
-
| coder | Automatic code modification and generation tool |
|
|
203
|
-
| codebase | Codebase management and search tool |
|
|
204
|
-
|
|
205
165
|
### Tool Locations
|
|
206
166
|
- Built-in tools: `src/jarvis/tools/`
|
|
207
167
|
- User tools: `~/.jarvis/tools/`
|
|
@@ -214,27 +174,21 @@ jarvis-search "your query" --max 3
|
|
|
214
174
|
- Automatic code generation and integration
|
|
215
175
|
- Dynamic capability expansion through sub-agents
|
|
216
176
|
- Automatic code modification with version control
|
|
217
|
-
- Codebase indexing and semantic search
|
|
218
177
|
|
|
219
178
|
#### 2. Methodology Learning
|
|
220
179
|
- Automatic experience accumulation from interactions
|
|
221
180
|
- Pattern recognition and methodology extraction
|
|
222
181
|
- Continuous refinement through usage
|
|
223
182
|
- Code modification history tracking
|
|
224
|
-
- Codebase analysis and documentation generation
|
|
225
183
|
|
|
226
184
|
#### 3. Adaptive Problem Solving
|
|
227
185
|
- Context-aware sub-agent creation
|
|
228
186
|
- Dynamic tool composition
|
|
229
187
|
- Learning from execution feedback
|
|
230
|
-
- Codebase-aware problem solving
|
|
231
188
|
- Multi-model collaboration for complex tasks
|
|
232
189
|
|
|
233
190
|
#### 4. Code Intelligence
|
|
234
|
-
- Automatic codebase indexing
|
|
235
|
-
- Semantic code search
|
|
236
191
|
- Code modification with git integration
|
|
237
|
-
- Code analysis and documentation
|
|
238
192
|
- Multi-model code generation
|
|
239
193
|
|
|
240
194
|
## 🎯 Extending Jarvis
|
|
@@ -88,27 +88,6 @@ Jarvis supports configuration through environment variables that can be set in t
|
|
|
88
88
|
jarvis
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
### Codebase Search
|
|
92
|
-
```bash
|
|
93
|
-
# Generate codebase index
|
|
94
|
-
jarvis-codebase --generate
|
|
95
|
-
|
|
96
|
-
# Search similar code
|
|
97
|
-
jarvis-codebase --search "your search query"
|
|
98
|
-
|
|
99
|
-
# Ask questions about codebase
|
|
100
|
-
jarvis-codebase --ask "your question"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Document Analysis (RAG)
|
|
104
|
-
```bash
|
|
105
|
-
# Build document index
|
|
106
|
-
jarvis-rag --dir /path/to/documents --build
|
|
107
|
-
|
|
108
|
-
# Search documents
|
|
109
|
-
jarvis-rag --query "your search query"
|
|
110
|
-
```
|
|
111
|
-
|
|
112
91
|
### Search Tool
|
|
113
92
|
```bash
|
|
114
93
|
# Basic search
|
|
@@ -123,19 +102,6 @@ jarvis-search "your query" --max 3
|
|
|
123
102
|
|
|
124
103
|
## 🛠️ Tools
|
|
125
104
|
|
|
126
|
-
|
|
127
|
-
### Built-in Tools
|
|
128
|
-
|
|
129
|
-
| Tool | Description |
|
|
130
|
-
|------|-------------|
|
|
131
|
-
| execute_shell | Execute system commands and capture output |
|
|
132
|
-
| file_operation | File operations (read/write/append/delete) |
|
|
133
|
-
| generate_tool | AI-powered tool generation and integration |
|
|
134
|
-
| methodology | Experience accumulation and methodology management |
|
|
135
|
-
| create_sub_agent | Create specialized sub-agents for specific tasks |
|
|
136
|
-
| coder | Automatic code modification and generation tool |
|
|
137
|
-
| codebase | Codebase management and search tool |
|
|
138
|
-
|
|
139
105
|
### Tool Locations
|
|
140
106
|
- Built-in tools: `src/jarvis/tools/`
|
|
141
107
|
- User tools: `~/.jarvis/tools/`
|
|
@@ -148,27 +114,21 @@ jarvis-search "your query" --max 3
|
|
|
148
114
|
- Automatic code generation and integration
|
|
149
115
|
- Dynamic capability expansion through sub-agents
|
|
150
116
|
- Automatic code modification with version control
|
|
151
|
-
- Codebase indexing and semantic search
|
|
152
117
|
|
|
153
118
|
#### 2. Methodology Learning
|
|
154
119
|
- Automatic experience accumulation from interactions
|
|
155
120
|
- Pattern recognition and methodology extraction
|
|
156
121
|
- Continuous refinement through usage
|
|
157
122
|
- Code modification history tracking
|
|
158
|
-
- Codebase analysis and documentation generation
|
|
159
123
|
|
|
160
124
|
#### 3. Adaptive Problem Solving
|
|
161
125
|
- Context-aware sub-agent creation
|
|
162
126
|
- Dynamic tool composition
|
|
163
127
|
- Learning from execution feedback
|
|
164
|
-
- Codebase-aware problem solving
|
|
165
128
|
- Multi-model collaboration for complex tasks
|
|
166
129
|
|
|
167
130
|
#### 4. Code Intelligence
|
|
168
|
-
- Automatic codebase indexing
|
|
169
|
-
- Semantic code search
|
|
170
131
|
- Code modification with git integration
|
|
171
|
-
- Code analysis and documentation
|
|
172
132
|
- Multi-model code generation
|
|
173
133
|
|
|
174
134
|
## 🎯 Extending Jarvis
|
|
@@ -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.102"
|
|
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" }]
|
|
@@ -28,14 +28,8 @@ dependencies = [
|
|
|
28
28
|
"openai>=1.20.0",
|
|
29
29
|
"playwright>=1.41.1",
|
|
30
30
|
"numpy>=1.24.0",
|
|
31
|
-
"faiss-cpu>=1.8.0",
|
|
32
|
-
"sentence-transformers>=2.2.2",
|
|
33
31
|
"bs4>=0.0.1",
|
|
34
|
-
"PyMuPDF>=1.21.0",
|
|
35
|
-
"python-docx>=0.8.11",
|
|
36
|
-
"tiktoken>=0.3.0",
|
|
37
32
|
"tqdm>=4.65.0",
|
|
38
|
-
"docx>=0.2.4",
|
|
39
33
|
"yaspin>=2.5.0",
|
|
40
34
|
]
|
|
41
35
|
requires-python = ">=3.8"
|
|
@@ -49,9 +43,6 @@ Homepage = "https://github.com/skyfireitdiy/Jarvis"
|
|
|
49
43
|
[project.scripts]
|
|
50
44
|
jarvis = "jarvis.agent:main"
|
|
51
45
|
jarvis-code-agent = "jarvis.jarvis_code_agent.main:main"
|
|
52
|
-
jarvis-coder = "jarvis.jarvis_coder.main:main"
|
|
53
|
-
jarvis-codebase = "jarvis.jarvis_codebase.main:main"
|
|
54
|
-
jarvis-rag = "jarvis.jarvis_rag.main:main"
|
|
55
46
|
jarvis-smart-shell = "jarvis.jarvis_smart_shell.main:main"
|
|
56
47
|
jss = "jarvis.jarvis_smart_shell.main:main"
|
|
57
48
|
jarvis-platform = "jarvis.jarvis_platform.main: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.102",
|
|
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",
|
|
@@ -20,23 +20,14 @@ setup(
|
|
|
20
20
|
"openai>=1.20.0",
|
|
21
21
|
"playwright>=1.41.1",
|
|
22
22
|
"numpy>=1.24.0",
|
|
23
|
-
"faiss-cpu>=1.8.0",
|
|
24
|
-
"sentence-transformers>=2.2.2",
|
|
25
23
|
"bs4>=0.0.1",
|
|
26
|
-
"PyMuPDF>=1.21.0",
|
|
27
|
-
"python-docx>=0.8.11",
|
|
28
|
-
"tiktoken>=0.3.0",
|
|
29
24
|
"tqdm>=4.65.0",
|
|
30
|
-
"docx>=0.2.4",
|
|
31
25
|
"yaspin>=2.5.0",
|
|
32
26
|
],
|
|
33
27
|
entry_points={
|
|
34
28
|
"console_scripts": [
|
|
35
29
|
"jarvis=jarvis.agent:main",
|
|
36
30
|
"jarvis-code-agent=jarvis.jarvis_code_agent.main:main",
|
|
37
|
-
"jarvis-coder=jarvis.jarvis_coder.main:main",
|
|
38
|
-
"jarvis-codebase=jarvis.jarvis_codebase.main:main",
|
|
39
|
-
"jarvis-rag=jarvis.jarvis_rag.main:main",
|
|
40
31
|
"jarvis-smart-shell=jarvis.jarvis_smart_shell.main:main",
|
|
41
32
|
"jss=jarvis.jarvis_smart_shell.main:main",
|
|
42
33
|
"jarvis-platform=jarvis.jarvis_platform.main:main",
|
|
@@ -8,7 +8,7 @@ import yaml
|
|
|
8
8
|
from jarvis.models.registry import PlatformRegistry
|
|
9
9
|
from jarvis.tools import ToolRegistry
|
|
10
10
|
from jarvis.tools.registry import load_tools
|
|
11
|
-
from jarvis.utils import PrettyOutput, OutputType, get_single_line_input, load_methodology, add_agent, delete_current_agent, get_max_context_length, get_multiline_input,
|
|
11
|
+
from jarvis.utils import PrettyOutput, OutputType, get_single_line_input, load_methodology, add_agent, delete_current_agent, get_max_context_length, get_multiline_input, init_env
|
|
12
12
|
import os
|
|
13
13
|
|
|
14
14
|
class Agent:
|
|
@@ -35,29 +35,9 @@ class Agent:
|
|
|
35
35
|
self.conversation_length = 0 # Use length counter instead
|
|
36
36
|
self.system_prompt = system_prompt
|
|
37
37
|
# Load configuration from environment variables
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
self.max_context_length = get_max_context_length()
|
|
40
40
|
|
|
41
|
-
# Initialize embedding model
|
|
42
|
-
try:
|
|
43
|
-
self.embedding_model = load_embedding_model()
|
|
44
|
-
|
|
45
|
-
# Warm up model and get correct dimension
|
|
46
|
-
test_text = "This is a test text to ensure the model is fully loaded."
|
|
47
|
-
test_embedding = self.embedding_model.encode(
|
|
48
|
-
test_text,
|
|
49
|
-
convert_to_tensor=True,
|
|
50
|
-
normalize_embeddings=True
|
|
51
|
-
)
|
|
52
|
-
self.embedding_dimension = len(test_embedding)
|
|
53
|
-
PrettyOutput.print("Successfully loaded embedding model", OutputType.SUCCESS)
|
|
54
|
-
|
|
55
|
-
# Initialize HNSW index (use correct dimension)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
except Exception as e:
|
|
59
|
-
PrettyOutput.print(f"Failed to load embedding model: {str(e)}", OutputType.ERROR)
|
|
60
|
-
raise
|
|
61
41
|
|
|
62
42
|
# Initialize methodology related attributes
|
|
63
43
|
self.methodology_data = []
|
|
@@ -441,7 +421,6 @@ Strict Rules:
|
|
|
441
421
|
- Don't create fake dialogues
|
|
442
422
|
- If current information is insufficient, you may ask the user
|
|
443
423
|
- Not all problem-solving steps are mandatory, skip as appropriate
|
|
444
|
-
- Ask user before executing tools that might damage system or user's codebase
|
|
445
424
|
- Request user guidance when multiple iterations show no progress
|
|
446
425
|
- If yaml string contains colons, wrap the entire string in quotes to avoid yaml parsing errors
|
|
447
426
|
- Use | syntax for multi-line strings in yaml
|
|
@@ -459,7 +438,7 @@ def main():
|
|
|
459
438
|
|
|
460
439
|
try:
|
|
461
440
|
# 获取全局模型实例
|
|
462
|
-
agent = Agent(system_prompt=origin_agent_system_prompt)
|
|
441
|
+
agent = Agent(system_prompt=origin_agent_system_prompt, tool_registry=ToolRegistry())
|
|
463
442
|
|
|
464
443
|
# 加载预定义任务
|
|
465
444
|
tasks = load_tasks()
|
{jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_code_agent/main.py
RENAMED
|
@@ -79,8 +79,8 @@ DEVELOPMENT WORKFLOW:
|
|
|
79
79
|
<TOOL_CALL>
|
|
80
80
|
name: create_code_sub_agent
|
|
81
81
|
arguments:
|
|
82
|
+
name: code_sub_agent
|
|
82
83
|
subtask: Implement new authentication flow
|
|
83
|
-
codebase_dir: .
|
|
84
84
|
</TOOL_CALL>
|
|
85
85
|
|
|
86
86
|
FILE SELECTION WORKFLOW:
|
|
@@ -147,10 +147,8 @@ TOOL USAGE:
|
|
|
147
147
|
- ask_user: Ask user for confirmation and information if needed
|
|
148
148
|
- create_code_sub_agent: Create agent for each small change
|
|
149
149
|
- file_operation: Read files
|
|
150
|
-
- rag: Ask questions based on a document directory, supporting multiple document formats (txt, pdf, docx, etc.)
|
|
151
150
|
- search: Use Bing search engine to search for information, and extract key information based on the question
|
|
152
151
|
- thinker: Deep thinking and logical reasoning
|
|
153
|
-
|
|
154
152
|
2. Planning Tools:
|
|
155
153
|
- thinker: Generate a detailed modification plan based on user requirements and actual code conditions.
|
|
156
154
|
- create_code_sub_agent: Create agent for each small change
|
{jarvis_ai_assistant-0.1.100 → jarvis_ai_assistant-0.1.102}/src/jarvis/jarvis_coder/patch_handler.py
RENAMED
|
@@ -211,7 +211,7 @@ class PatchHandler:
|
|
|
211
211
|
else:
|
|
212
212
|
content = "<File does not exist, need to create>"
|
|
213
213
|
|
|
214
|
-
prompt = """You are a senior software development expert who can generate code patches based on the complete modification plan, current original code file path, code content, and current file's modification plan. The output format should be as follows:
|
|
214
|
+
prompt = """You are a senior software development expert who can generate code patches based on the complete modification plan, current original code file path, code content (with 4-digit hexadecimal line numbers), and current file's modification plan. The output format should be as follows:
|
|
215
215
|
|
|
216
216
|
<PATCH>
|
|
217
217
|
[start,end)
|
|
@@ -220,16 +220,16 @@ class PatchHandler:
|
|
|
220
220
|
|
|
221
221
|
Example:
|
|
222
222
|
<PATCH>
|
|
223
|
-
[
|
|
223
|
+
[000c,000c)
|
|
224
224
|
def new_function():
|
|
225
|
-
|
|
225
|
+
pass
|
|
226
226
|
</PATCH>
|
|
227
227
|
|
|
228
228
|
means:
|
|
229
|
-
Insert code BEFORE line
|
|
229
|
+
Insert code BEFORE line 12:
|
|
230
230
|
```
|
|
231
231
|
def new_function():
|
|
232
|
-
|
|
232
|
+
pass
|
|
233
233
|
```
|
|
234
234
|
|
|
235
235
|
Example 2:
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import argparse
|
|
4
|
+
from typing import Dict, List, Optional
|
|
5
|
+
import yaml
|
|
6
|
+
|
|
7
|
+
from jarvis.agent import Agent
|
|
8
|
+
from jarvis.utils import PrettyOutput, OutputType, get_single_line_input, init_env
|
|
9
|
+
from jarvis.tools import ToolRegistry
|
|
10
|
+
|
|
11
|
+
# System prompt for the GitHub workflow agent
|
|
12
|
+
github_workflow_prompt = """You are a GitHub Workflow Agent that helps manage the complete development workflow using GitHub CLI (gh). Follow these steps strictly:
|
|
13
|
+
|
|
14
|
+
1. Environment Check:
|
|
15
|
+
- Verify gh CLI installation
|
|
16
|
+
- Check authentication status
|
|
17
|
+
- Set up authentication if needed
|
|
18
|
+
|
|
19
|
+
2. Issue Management:
|
|
20
|
+
- List and display available issues
|
|
21
|
+
- Help user select an issue to work on
|
|
22
|
+
- Analyze the selected issue thoroughly
|
|
23
|
+
|
|
24
|
+
3. Development Planning:
|
|
25
|
+
- Create a development branch for the issue
|
|
26
|
+
- Generate a detailed modification plan
|
|
27
|
+
- Break down the task into smaller steps
|
|
28
|
+
|
|
29
|
+
4. Implementation:
|
|
30
|
+
- Guide through the implementation process
|
|
31
|
+
- Track changes and progress
|
|
32
|
+
- Ensure code quality
|
|
33
|
+
|
|
34
|
+
5. Review and Submit:
|
|
35
|
+
- Review changes before submission
|
|
36
|
+
- Create and submit pull request
|
|
37
|
+
- Handle review feedback
|
|
38
|
+
- Close the issue upon completion
|
|
39
|
+
|
|
40
|
+
Always follow GitHub best practices and provide clear feedback at each step.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
def check_gh_installation() -> bool:
|
|
44
|
+
"""Check if GitHub CLI is installed"""
|
|
45
|
+
return os.system("gh --version > /dev/null 2>&1") == 0
|
|
46
|
+
|
|
47
|
+
def check_gh_auth() -> bool:
|
|
48
|
+
"""Check if GitHub CLI is authenticated"""
|
|
49
|
+
return os.system("gh auth status > /dev/null 2>&1") == 0
|
|
50
|
+
|
|
51
|
+
def setup_gh_auth() -> bool:
|
|
52
|
+
"""Guide user through GitHub CLI authentication"""
|
|
53
|
+
PrettyOutput.print("Starting GitHub CLI authentication...", OutputType.INFO)
|
|
54
|
+
return os.system("gh auth login") == 0
|
|
55
|
+
|
|
56
|
+
def list_issues() -> List[Dict]:
|
|
57
|
+
"""List all available issues"""
|
|
58
|
+
try:
|
|
59
|
+
# Get issues in JSON format
|
|
60
|
+
result = os.popen("gh issue list --json number,title,body,url").read()
|
|
61
|
+
issues = yaml.safe_load(result)
|
|
62
|
+
return issues
|
|
63
|
+
except Exception as e:
|
|
64
|
+
PrettyOutput.print(f"Error listing issues: {str(e)}", OutputType.ERROR)
|
|
65
|
+
return []
|
|
66
|
+
|
|
67
|
+
def select_issue(issues: List[Dict]) -> Optional[Dict]:
|
|
68
|
+
"""Display issues and let user select one"""
|
|
69
|
+
if not issues:
|
|
70
|
+
PrettyOutput.print("No issues found.", OutputType.WARNING)
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
PrettyOutput.print("\nAvailable Issues:", OutputType.INFO)
|
|
74
|
+
for i, issue in enumerate(issues, 1):
|
|
75
|
+
print(f"{i}. #{issue['number']} - {issue['title']}")
|
|
76
|
+
|
|
77
|
+
while True:
|
|
78
|
+
try:
|
|
79
|
+
choice = get_single_line_input("\nSelect an issue number (or 0 to exit): ")
|
|
80
|
+
if not choice or choice == "0":
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
index = int(choice) - 1
|
|
84
|
+
if 0 <= index < len(issues):
|
|
85
|
+
return issues[index]
|
|
86
|
+
else:
|
|
87
|
+
PrettyOutput.print("Invalid selection. Please try again.", OutputType.WARNING)
|
|
88
|
+
except ValueError:
|
|
89
|
+
PrettyOutput.print("Please enter a valid number.", OutputType.WARNING)
|
|
90
|
+
|
|
91
|
+
def create_development_branch(issue_number: int) -> bool:
|
|
92
|
+
"""Create a development branch for the issue"""
|
|
93
|
+
try:
|
|
94
|
+
result = os.system(f"gh issue develop {issue_number} --checkout")
|
|
95
|
+
return result == 0
|
|
96
|
+
except Exception as e:
|
|
97
|
+
PrettyOutput.print(f"Error creating branch: {str(e)}", OutputType.ERROR)
|
|
98
|
+
return False
|
|
99
|
+
|
|
100
|
+
def create_pull_request(issue_number: int, title: str, body: str) -> bool:
|
|
101
|
+
"""Create a pull request for the changes"""
|
|
102
|
+
try:
|
|
103
|
+
cmd = f'gh pr create --title "{title}" --body "{body}" --issue {issue_number}'
|
|
104
|
+
result = os.system(cmd)
|
|
105
|
+
return result == 0
|
|
106
|
+
except Exception as e:
|
|
107
|
+
PrettyOutput.print(f"Error creating pull request: {str(e)}", OutputType.ERROR)
|
|
108
|
+
return False
|
|
109
|
+
|
|
110
|
+
def close_issue(issue_number: int) -> bool:
|
|
111
|
+
"""Close the issue"""
|
|
112
|
+
try:
|
|
113
|
+
result = os.system(f"gh issue close {issue_number}")
|
|
114
|
+
return result == 0
|
|
115
|
+
except Exception as e:
|
|
116
|
+
PrettyOutput.print(f"Error closing issue: {str(e)}", OutputType.ERROR)
|
|
117
|
+
return False
|
|
118
|
+
|
|
119
|
+
def install_gh_linux() -> bool:
|
|
120
|
+
"""Install GitHub CLI on Linux"""
|
|
121
|
+
PrettyOutput.print("Installing GitHub CLI...", OutputType.INFO)
|
|
122
|
+
|
|
123
|
+
# Detect package manager
|
|
124
|
+
package_managers = {
|
|
125
|
+
"apt": "curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
|
|
126
|
+
echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main\" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
|
|
127
|
+
sudo apt update && sudo apt install gh -y",
|
|
128
|
+
"dnf": "sudo dnf install 'dnf-command(config-manager)' -y && \
|
|
129
|
+
sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo && \
|
|
130
|
+
sudo dnf install gh -y",
|
|
131
|
+
"yum": "sudo yum install 'dnf-command(config-manager)' -y && \
|
|
132
|
+
sudo yum config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo && \
|
|
133
|
+
sudo yum install gh -y",
|
|
134
|
+
"pacman": "sudo pacman -S github-cli --noconfirm",
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
# Try to detect the package manager
|
|
138
|
+
for pm, cmd in package_managers.items():
|
|
139
|
+
if os.system(f"which {pm} > /dev/null 2>&1") == 0:
|
|
140
|
+
PrettyOutput.print(f"Detected {pm} package manager", OutputType.INFO)
|
|
141
|
+
if os.system(cmd) == 0:
|
|
142
|
+
PrettyOutput.print("GitHub CLI installed successfully!", OutputType.SUCCESS)
|
|
143
|
+
return True
|
|
144
|
+
else:
|
|
145
|
+
PrettyOutput.print(f"Failed to install using {pm}", OutputType.ERROR)
|
|
146
|
+
return False
|
|
147
|
+
|
|
148
|
+
PrettyOutput.print(
|
|
149
|
+
"Could not detect supported package manager. Please install manually:\n"
|
|
150
|
+
"https://github.com/cli/cli/blob/trunk/docs/install_linux.md",
|
|
151
|
+
OutputType.ERROR
|
|
152
|
+
)
|
|
153
|
+
return False
|
|
154
|
+
|
|
155
|
+
def main():
|
|
156
|
+
"""Main entry point for GitHub workflow"""
|
|
157
|
+
init_env()
|
|
158
|
+
|
|
159
|
+
# Check GitHub CLI installation
|
|
160
|
+
if not check_gh_installation():
|
|
161
|
+
if sys.platform.startswith('linux'):
|
|
162
|
+
if not install_gh_linux():
|
|
163
|
+
return 1
|
|
164
|
+
else:
|
|
165
|
+
PrettyOutput.print(
|
|
166
|
+
"GitHub CLI (gh) is not installed. Please install it first:\n"
|
|
167
|
+
"- Windows: winget install GitHub.cli\n"
|
|
168
|
+
"- macOS: brew install gh\n"
|
|
169
|
+
"- Linux: See https://github.com/cli/cli/blob/trunk/docs/install_linux.md",
|
|
170
|
+
OutputType.ERROR
|
|
171
|
+
)
|
|
172
|
+
return 1
|
|
173
|
+
|
|
174
|
+
# Check authentication
|
|
175
|
+
if not check_gh_auth():
|
|
176
|
+
PrettyOutput.print("GitHub CLI needs authentication.", OutputType.WARNING)
|
|
177
|
+
if not setup_gh_auth():
|
|
178
|
+
PrettyOutput.print("Authentication failed. Please try again.", OutputType.ERROR)
|
|
179
|
+
return 1
|
|
180
|
+
|
|
181
|
+
# List and select issue
|
|
182
|
+
issues = list_issues()
|
|
183
|
+
selected_issue = select_issue(issues)
|
|
184
|
+
if not selected_issue:
|
|
185
|
+
PrettyOutput.print("No issue selected. Exiting.", OutputType.INFO)
|
|
186
|
+
return 0
|
|
187
|
+
|
|
188
|
+
# Create GitHub workflow agent
|
|
189
|
+
tool_registry = ToolRegistry()
|
|
190
|
+
agent = Agent(
|
|
191
|
+
system_prompt=github_workflow_prompt,
|
|
192
|
+
name="GitHub Workflow Agent",
|
|
193
|
+
tool_registry=tool_registry
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
# Start the workflow
|
|
197
|
+
try:
|
|
198
|
+
# Create development branch
|
|
199
|
+
if not create_development_branch(selected_issue['number']):
|
|
200
|
+
return 1
|
|
201
|
+
|
|
202
|
+
# Run the agent with the selected issue
|
|
203
|
+
workflow_request = f"""
|
|
204
|
+
Working on issue #{selected_issue['number']}: {selected_issue['title']}
|
|
205
|
+
|
|
206
|
+
Issue description:
|
|
207
|
+
{selected_issue['body']}
|
|
208
|
+
|
|
209
|
+
Please guide through the development process and help create a pull request.
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
result = agent.run(workflow_request)
|
|
213
|
+
|
|
214
|
+
# Create pull request and close issue if successful
|
|
215
|
+
if result and "success" in result.lower():
|
|
216
|
+
if create_pull_request(
|
|
217
|
+
selected_issue['number'],
|
|
218
|
+
f"Fix #{selected_issue['number']}: {selected_issue['title']}",
|
|
219
|
+
"Implements the requested changes and fixes the issue."
|
|
220
|
+
):
|
|
221
|
+
close_issue(selected_issue['number'])
|
|
222
|
+
PrettyOutput.print("Workflow completed successfully!", OutputType.SUCCESS)
|
|
223
|
+
return 0
|
|
224
|
+
|
|
225
|
+
except Exception as e:
|
|
226
|
+
PrettyOutput.print(f"Error in workflow: {str(e)}", OutputType.ERROR)
|
|
227
|
+
return 1
|
|
228
|
+
|
|
229
|
+
return 1
|
|
230
|
+
|
|
231
|
+
if __name__ == "__main__":
|
|
232
|
+
sys.exit(main())
|
|
@@ -14,6 +14,7 @@ class AI8Model(BasePlatform):
|
|
|
14
14
|
|
|
15
15
|
def get_model_list(self) -> List[Tuple[str, str]]:
|
|
16
16
|
"""获取模型列表"""
|
|
17
|
+
self.get_available_models()
|
|
17
18
|
return [(name,info['desc']) for name,info in self.models.items()]
|
|
18
19
|
|
|
19
20
|
def __init__(self):
|
|
@@ -30,9 +31,7 @@ class AI8Model(BasePlatform):
|
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
self.model_name = os.getenv("JARVIS_MODEL") or "deepseek-chat"
|
|
33
|
-
|
|
34
|
-
PrettyOutput.print(f"Warning: The selected model {self.model_name} is not in the available list", OutputType.WARNING)
|
|
35
|
-
|
|
34
|
+
|
|
36
35
|
|
|
37
36
|
def set_model_name(self, model_name: str):
|
|
38
37
|
"""Set model name"""
|
|
@@ -14,6 +14,7 @@ class OyiModel(BasePlatform):
|
|
|
14
14
|
|
|
15
15
|
def get_model_list(self) -> List[Tuple[str, str]]:
|
|
16
16
|
"""Get model list"""
|
|
17
|
+
self.get_available_models()
|
|
17
18
|
return [(name,info['desc']) for name,info in self.models.items()]
|
|
18
19
|
|
|
19
20
|
def __init__(self):
|
|
@@ -31,9 +32,6 @@ class OyiModel(BasePlatform):
|
|
|
31
32
|
PrettyOutput.print("OYI_API_KEY is not set", OutputType.WARNING)
|
|
32
33
|
|
|
33
34
|
self.model_name = os.getenv("JARVIS_MODEL") or "deepseek-chat"
|
|
34
|
-
if self.model_name not in [m.split()[0] for m in self.get_available_models()]:
|
|
35
|
-
PrettyOutput.print(f"Warning: The selected model {self.model_name} is not in the available list", OutputType.WARNING)
|
|
36
|
-
|
|
37
35
|
|
|
38
36
|
def set_model_name(self, model_name: str):
|
|
39
37
|
"""Set model name"""
|