jarvis-ai-assistant 0.1.125__py3-none-any.whl → 0.1.126__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jarvis-ai-assistant might be problematic. Click here for more details.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +116 -116
- jarvis/jarvis_code_agent/code_agent.py +96 -100
- jarvis/jarvis_code_agent/patch.py +39 -47
- jarvis/jarvis_code_agent/shell_input_handler.py +22 -0
- jarvis/jarvis_codebase/main.py +83 -84
- jarvis/jarvis_dev/main.py +691 -713
- jarvis/jarvis_lsp/base.py +0 -12
- jarvis/jarvis_lsp/cpp.py +0 -9
- jarvis/jarvis_lsp/go.py +0 -9
- jarvis/jarvis_lsp/python.py +0 -28
- jarvis/jarvis_lsp/registry.py +0 -1
- jarvis/jarvis_lsp/rust.py +0 -9
- jarvis/jarvis_multi_agent/__init__.py +52 -52
- jarvis/jarvis_tools/ask_codebase.py +6 -6
- jarvis/jarvis_tools/ask_user.py +2 -2
- jarvis/jarvis_tools/base.py +4 -4
- jarvis/jarvis_tools/chdir.py +8 -8
- jarvis/jarvis_tools/code_review.py +6 -6
- jarvis/jarvis_tools/create_code_agent.py +4 -4
- jarvis/jarvis_tools/create_sub_agent.py +7 -7
- jarvis/jarvis_tools/execute_shell.py +54 -21
- jarvis/jarvis_tools/execute_shell_script.py +3 -3
- jarvis/jarvis_tools/file_operation.py +36 -8
- jarvis/jarvis_tools/git_commiter.py +16 -16
- jarvis/jarvis_tools/lsp_find_definition.py +7 -7
- jarvis/jarvis_tools/lsp_prepare_rename.py +7 -7
- jarvis/jarvis_tools/methodology.py +6 -6
- jarvis/jarvis_tools/rag.py +5 -5
- jarvis/jarvis_tools/read_webpage.py +2 -2
- jarvis/jarvis_tools/registry.py +139 -139
- jarvis/jarvis_tools/search_web.py +5 -5
- jarvis/jarvis_tools/select_code_files.py +3 -3
- jarvis/jarvis_tools/tool_generator.py +33 -34
- jarvis/jarvis_utils/methodology.py +5 -5
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/METADATA +31 -17
- jarvis_ai_assistant-0.1.126.dist-info/RECORD +74 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/WHEEL +1 -1
- jarvis/jarvis_tools/lsp_validate_edit.py +0 -141
- jarvis/jarvis_tools/read_code.py +0 -192
- jarvis_ai_assistant-0.1.125.dist-info/RECORD +0 -75
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/top_level.txt +0 -0
|
@@ -8,21 +8,21 @@ from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
|
8
8
|
|
|
9
9
|
class ToolGenerator:
|
|
10
10
|
name = "tool_generator"
|
|
11
|
-
description = "
|
|
11
|
+
description = "使用LLM自动生成与系统集成的新工具"
|
|
12
12
|
parameters = {
|
|
13
13
|
"type": "object",
|
|
14
14
|
"properties": {
|
|
15
15
|
"tool_name": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "新工具的名称"
|
|
18
18
|
},
|
|
19
19
|
"description": {
|
|
20
20
|
"type": "string",
|
|
21
|
-
"description": "
|
|
21
|
+
"description": "工具用途描述"
|
|
22
22
|
},
|
|
23
23
|
"input_spec": {
|
|
24
24
|
"type": "string",
|
|
25
|
-
"description": "
|
|
25
|
+
"description": "所需输入和功能的规范说明"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"required": ["tool_name", "description", "input_spec"]
|
|
@@ -81,7 +81,7 @@ class ToolGenerator:
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
def _create_prompt(self, tool_name: str, description: str, input_spec: str) -> str:
|
|
84
|
-
"""
|
|
84
|
+
"""创建用于工具生成的LLM提示"""
|
|
85
85
|
example_code = '''
|
|
86
86
|
<TOOL>
|
|
87
87
|
from typing import Dict, Any
|
|
@@ -89,24 +89,24 @@ from jarvis.utils import OutputType, PrettyOutput
|
|
|
89
89
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
90
90
|
|
|
91
91
|
class CustomTool:
|
|
92
|
-
name = "
|
|
93
|
-
description = "
|
|
94
|
-
parameters = { #
|
|
92
|
+
name = "工具名称" # 调用时使用的工具名称
|
|
93
|
+
description = "工具描述" # 工具用途
|
|
94
|
+
parameters = { # 参数JSON Schema
|
|
95
95
|
"type": "object",
|
|
96
96
|
"properties": {
|
|
97
97
|
"param1": {
|
|
98
98
|
"type": "string",
|
|
99
|
-
"description": "
|
|
99
|
+
"description": "参数描述"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"required": ["param1"]
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
|
|
106
|
-
"""
|
|
106
|
+
"""执行工具功能
|
|
107
107
|
|
|
108
108
|
Args:
|
|
109
|
-
args:
|
|
109
|
+
args: 传递给工具的参数
|
|
110
110
|
|
|
111
111
|
Returns:
|
|
112
112
|
{
|
|
@@ -116,12 +116,12 @@ class CustomTool:
|
|
|
116
116
|
}
|
|
117
117
|
"""
|
|
118
118
|
try:
|
|
119
|
-
#
|
|
120
|
-
#
|
|
119
|
+
# 在此实现工具逻辑
|
|
120
|
+
# 使用LLM
|
|
121
121
|
# model = PlatformRegistry.get_global_platform_registry().get_codegen_platform()
|
|
122
122
|
# result = model.chat_until_success(prompt)
|
|
123
123
|
|
|
124
|
-
result = "
|
|
124
|
+
result = "工具执行结果"
|
|
125
125
|
return {
|
|
126
126
|
"success": True,
|
|
127
127
|
"stdout": result,
|
|
@@ -136,29 +136,28 @@ class CustomTool:
|
|
|
136
136
|
</TOOL>
|
|
137
137
|
'''
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
10. Output the code in the following format:
|
|
139
|
+
return f'''创建一个与Jarvis系统集成的Python工具类。请遵循以下要求:
|
|
140
|
+
1. 类名: {tool_name.capitalize()}Tool
|
|
141
|
+
2. 描述: {description}
|
|
142
|
+
3. 输入规范: {input_spec}
|
|
143
|
+
4. 必须包含以下类属性:
|
|
144
|
+
- name: str (工具标识符)
|
|
145
|
+
- description: str (工具用途)
|
|
146
|
+
- parameters: dict (输入的JSON schema)
|
|
147
|
+
5. 必须实现 execute(self, args: Dict) -> Dict 方法
|
|
148
|
+
6. execute方法必须返回包含以下字段的字典:
|
|
149
|
+
- success: bool (指示操作是否成功)
|
|
150
|
+
- stdout: str (主要输出/结果)
|
|
151
|
+
- stderr: str (错误信息,如果有)
|
|
152
|
+
7. 必须优雅地处理错误
|
|
153
|
+
8. 仅返回Python实现代码
|
|
154
|
+
9. 代码应该是完整且可直接使用的
|
|
155
|
+
10. 按照以下格式输出代码:
|
|
157
156
|
<TOOL>
|
|
158
157
|
{example_code}
|
|
159
158
|
</TOOL>
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
示例:
|
|
162
161
|
{example_code}
|
|
163
162
|
'''
|
|
164
163
|
|
|
@@ -179,4 +178,4 @@ Example:
|
|
|
179
178
|
return False
|
|
180
179
|
|
|
181
180
|
# Check for required fields in return statement
|
|
182
|
-
return all(field in code for field in required_fields)
|
|
181
|
+
return all(field in code for field in required_fields)
|
|
@@ -42,17 +42,17 @@ def _create_methodology_embedding(embedding_model: Any, methodology_text: str) -
|
|
|
42
42
|
return np.zeros(1536, dtype=np.float32)
|
|
43
43
|
def make_methodology_prompt(data: Dict[str, str]) -> str:
|
|
44
44
|
"""
|
|
45
|
-
|
|
45
|
+
从方法论数据生成格式化提示
|
|
46
46
|
|
|
47
47
|
Args:
|
|
48
|
-
data:
|
|
48
|
+
data: 方法论数据字典
|
|
49
49
|
|
|
50
50
|
Returns:
|
|
51
|
-
str:
|
|
51
|
+
str: 格式化后的提示字符串
|
|
52
52
|
"""
|
|
53
|
-
ret = """
|
|
53
|
+
ret = """这是处理以往问题的标准方法论,如果当前任务类似,可以参考使用,如果不相关,请忽略:\n"""
|
|
54
54
|
for key, value in data.items():
|
|
55
|
-
ret += f"
|
|
55
|
+
ret += f"问题: {key}\n方法论: {value}\n"
|
|
56
56
|
return ret
|
|
57
57
|
def load_methodology(user_input: str) -> str:
|
|
58
58
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jarvis-ai-assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.126
|
|
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
|
|
@@ -74,22 +74,29 @@ Requires-Dist: mypy; extra == "dev"
|
|
|
74
74
|
<p align="center">
|
|
75
75
|
<img src="docs/images/jarvis-logo.png" alt="Jarvis Logo" width="200"/>
|
|
76
76
|
</p>
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
<div align="center">
|
|
78
|
+
|
|
79
|
+
[](https://www.python.org/downloads/)[](https://opensource.org/licenses/MIT)
|
|
80
|
+
|
|
79
81
|
*您的智能开发和系统交互助手*
|
|
80
|
-
|
|
81
|
-
[
|
|
82
|
-
[配置说明](
|
|
83
|
-
[工具说明](
|
|
84
|
-
[扩展开发](
|
|
85
|
-
[贡献指南](
|
|
82
|
+
|
|
83
|
+
[快速开始](#quick-start) •
|
|
84
|
+
[配置说明](#configuration) •
|
|
85
|
+
[工具说明](#tools) •
|
|
86
|
+
[扩展开发](#extensions) •
|
|
87
|
+
[贡献指南](#contributing) •
|
|
88
|
+
[许可证](#license) •
|
|
89
|
+
</div>
|
|
90
|
+
|
|
86
91
|
---
|
|
87
|
-
|
|
92
|
+
|
|
93
|
+
## 🚀 快速开始 <a id="quick-start"></a>
|
|
88
94
|
### 安装
|
|
89
95
|
```bash
|
|
90
96
|
pip install jarvis-ai-assistant # 安装jarvis-ai-assistant
|
|
91
97
|
playwright install # 安装playwright
|
|
92
98
|
```
|
|
99
|
+
|
|
93
100
|
### 最小化配置
|
|
94
101
|
```bash
|
|
95
102
|
JARVIS_PLATFORM=openai # 设置AI平台
|
|
@@ -97,6 +104,7 @@ JARVIS_MODEL=deepseek-chat # 设置AI模型
|
|
|
97
104
|
OPENAI_API_KEY=your_openai_api_key # 设置OpenAI API密钥
|
|
98
105
|
OPENAI_API_BASE=https://api.deepseek.com/v1 # 设置OpenAI API基础URL
|
|
99
106
|
```
|
|
107
|
+
|
|
100
108
|
以上配置编写到`~/.jarvis/env`文件中。
|
|
101
109
|
|
|
102
110
|
### 基本使用
|
|
@@ -125,9 +133,10 @@ jarvis-dev --help
|
|
|
125
133
|
# 使用git squash的功能
|
|
126
134
|
jarvis-git-squash --help
|
|
127
135
|
```
|
|
136
|
+
|
|
128
137
|
---
|
|
129
138
|
|
|
130
|
-
## ⚙️ 配置说明
|
|
139
|
+
## ⚙️ 配置说明 <a id="configuration"></a>
|
|
131
140
|
### 环境变量配置
|
|
132
141
|
| 分类 | 变量名称 | 默认值 | 说明 |
|
|
133
142
|
|------|----------|--------|------|
|
|
@@ -151,7 +160,7 @@ jarvis-git-squash --help
|
|
|
151
160
|
| 文本处理 | `JARVIS_MIN_PARAGRAPH_LENGTH` | 50 | 文本处理的最小段落长度 |
|
|
152
161
|
| 文本处理 | `JARVIS_MAX_PARAGRAPH_LENGTH` | 12800 | 文本处理的最大段落长度 |
|
|
153
162
|
---
|
|
154
|
-
## 🛠️ 工具说明
|
|
163
|
+
## 🛠️ 工具说明 <a id="tools"></a>
|
|
155
164
|
### 内置工具
|
|
156
165
|
| 工具名称 | 描述 |
|
|
157
166
|
|----------|------|
|
|
@@ -180,9 +189,9 @@ jarvis-git-squash --help
|
|
|
180
189
|
- 内置工具:`src/jarvis/tools/`
|
|
181
190
|
- 用户工具:`~/.jarvis/tools/`
|
|
182
191
|
---
|
|
183
|
-
## 🛠️ 扩展开发
|
|
192
|
+
## 🛠️ 扩展开发 <a id="extensions"></a>
|
|
184
193
|
### 添加新工具
|
|
185
|
-
在 `~/.jarvis/tools
|
|
194
|
+
在 `~/.jarvis/tools/》 中创建新的 Python 文件:
|
|
186
195
|
```python
|
|
187
196
|
from typing import Dict, Any
|
|
188
197
|
from jarvis.utils import OutputType, PrettyOutput
|
|
@@ -229,8 +238,9 @@ class CustomTool:
|
|
|
229
238
|
}
|
|
230
239
|
```
|
|
231
240
|
|
|
241
|
+
|
|
232
242
|
### 添加新大模型平台
|
|
233
|
-
在 `~/.jarvis/platforms
|
|
243
|
+
在 `~/.jarvis/platforms/》 中创建新的 Python 文件:
|
|
234
244
|
```python
|
|
235
245
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
236
246
|
class CustomPlatform(BasePlatform):
|
|
@@ -275,16 +285,20 @@ class CustomPlatform(BasePlatform):
|
|
|
275
285
|
pass
|
|
276
286
|
```
|
|
277
287
|
|
|
278
|
-
|
|
288
|
+
|
|
289
|
+
## 🤝 贡献指南 <a id="contributing"></a>
|
|
279
290
|
1. Fork 仓库
|
|
280
291
|
2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
|
|
281
292
|
3. 提交更改 (`git commit -m '添加某个很棒的特性'`)
|
|
282
293
|
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
|
283
294
|
5. 开启 Pull Request
|
|
295
|
+
|
|
284
296
|
---
|
|
285
|
-
|
|
297
|
+
|
|
298
|
+
## 📄 许可证 <a id="license"></a>
|
|
286
299
|
|
|
287
300
|
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
|
301
|
+
|
|
288
302
|
---
|
|
289
303
|
<div align="center">
|
|
290
304
|
由 Jarvis 团队用 ❤️ 制作
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
jarvis/__init__.py,sha256=R5EpDNRlO11OAaRP_zNCt96v69LCMfRX9dawMjZRJGo,51
|
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=ZgT9jFWh7lKvCEqxWe2oRQxLbdWTLqBQMHBJa5irL5M,21859
|
|
3
|
+
jarvis/jarvis_agent/output_handler.py,sha256=kJeFTjjSu0K_2p0wyhq2veSZuhRXoaFC_8wVaoBKX0w,401
|
|
4
|
+
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=9Y-VaZW_n_WmxKGZQGTBKQMA9mL2AkMboHQzvc4J-Fk,10554
|
|
6
|
+
jarvis/jarvis_code_agent/file_select.py,sha256=2nSy1FW-kK-wvtz0YbbgSbd4ZwXMlA7sBP0nC80FzLI,8160
|
|
7
|
+
jarvis/jarvis_code_agent/patch.py,sha256=fLZNnfhxe0lT5PMRJ7xGT84PKNaV0cRChrseW9OWnds,9252
|
|
8
|
+
jarvis/jarvis_code_agent/shell_input_handler.py,sha256=UqR8oPVTmsPc1RAaOET4jPgbTGpz1otLkxhcIqT0r1c,790
|
|
9
|
+
jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
jarvis/jarvis_codebase/main.py,sha256=UveaSk8L9o5h1ahm6eLhQgjWQ9h2nx3TbUM-8CFD3b0,39445
|
|
11
|
+
jarvis/jarvis_dev/main.py,sha256=miyXHIuIiUffLwnizoWMSUBkvVZeBGfWbx-9XwTFBB8,21241
|
|
12
|
+
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
jarvis/jarvis_git_squash/main.py,sha256=g4csaRDYH3n3MCHc8aZb2N4wWVCVZ-pIgd0oanXDnD8,2798
|
|
14
|
+
jarvis/jarvis_lsp/base.py,sha256=ceJBQoOU7JHsvQEAA3agUTedh7_ki_HgK0re7-V9rqg,4119
|
|
15
|
+
jarvis/jarvis_lsp/cpp.py,sha256=Fx2c57omtBQVWB2648TBXufAV2za-u9bF0oe4928pHU,4605
|
|
16
|
+
jarvis/jarvis_lsp/go.py,sha256=fgYBhZaiU2OQPAFQh4fBFOO--HKxkXcr8PEYyF_YlcE,4930
|
|
17
|
+
jarvis/jarvis_lsp/python.py,sha256=NYatk1rlah-bPnTKOn_BXwkYp0IsCUFYRGdLTVVYsCM,3708
|
|
18
|
+
jarvis/jarvis_lsp/registry.py,sha256=slD6p3FAMjL8pQx2id-RxX1pwMjP4FgyMsM3ZbckQJI,9884
|
|
19
|
+
jarvis/jarvis_lsp/rust.py,sha256=nV1EKtq5y57E47DbQlD2DsfvwFVE2JoUTs-9paxeyDo,5161
|
|
20
|
+
jarvis/jarvis_multi_agent/__init__.py,sha256=aTLtKa4vbjT-eZzF1eab79vmghyA48wi6m9WVRltCw4,5991
|
|
21
|
+
jarvis/jarvis_platform/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
|
|
22
|
+
jarvis/jarvis_platform/ai8.py,sha256=xjgoiF7QHx_5FHj-npTFVvZFYg8RBzkqTGAOQ-MJiL0,11972
|
|
23
|
+
jarvis/jarvis_platform/base.py,sha256=TNBvCm_rkQ6rLfxPS5VAc8ieKMMhQOHmmc_b4-Rwbys,3221
|
|
24
|
+
jarvis/jarvis_platform/kimi.py,sha256=Qwb81flbKPvj-qZyJAMS_u0lQatRFQztYxUGDbj1keM,15713
|
|
25
|
+
jarvis/jarvis_platform/ollama.py,sha256=NHQMJSpC91WtSFuHKJuwD8qO-z4yDTF9mZX6BzWTKRU,5658
|
|
26
|
+
jarvis/jarvis_platform/openai.py,sha256=GSxTB69WitXJS3pL0sxCoB2F0EVHmvhrwLBC_JT8s34,4470
|
|
27
|
+
jarvis/jarvis_platform/oyi.py,sha256=pa72TtBYlhs3KPpqO4Y78a1Jvx4mN0pojBklu8X3F-k,15024
|
|
28
|
+
jarvis/jarvis_platform/registry.py,sha256=DrL6ZoIX9ZKAvFgDadiWPpVnO9GdWJMcXM8dsoNR3ds,8559
|
|
29
|
+
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
jarvis/jarvis_platform_manager/main.py,sha256=l0bxxPrQ41OJc9GANgUYl0ecWNDXIIk3Zp94I_gOZz0,20943
|
|
31
|
+
jarvis/jarvis_platform_manager/openai_test.py,sha256=bkcVG6o2nNazj4zjkENgA4yOEzdTI9Qbm5dco-2MGYM,5190
|
|
32
|
+
jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
|
+
jarvis/jarvis_rag/main.py,sha256=O5qluUvp73q1-0kdtQtOK-fMOLgqbqPFF47iBfpdyeg,31848
|
|
34
|
+
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
+
jarvis/jarvis_smart_shell/main.py,sha256=dkIudGGfLQCGr4u5E5Q8jfjN361cZdyK0S3WV5lXqhs,4658
|
|
36
|
+
jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
+
jarvis/jarvis_tools/ask_codebase.py,sha256=YeRPCQJQiaaZ95QHEB04WqyvJOotEnV_pIvmdd_8Ado,3350
|
|
38
|
+
jarvis/jarvis_tools/ask_user.py,sha256=kU6BOhFz_mKfqABd0l_00TL7Mqp_dhV3r0qkKLy8yRM,1745
|
|
39
|
+
jarvis/jarvis_tools/base.py,sha256=8gIgIx9LJAKOxdpPu7zMDItWqwXmXVTWAGfUkpQonzw,1196
|
|
40
|
+
jarvis/jarvis_tools/chdir.py,sha256=_cXiF2ycWt8p5ePcZEhEXqAQrb-5WzCfcN3R4Lm3c8k,2881
|
|
41
|
+
jarvis/jarvis_tools/code_review.py,sha256=r4zs-nhTUtIdLzlim49UCD1rvQSZW7YTiWCCupiXeyY,9686
|
|
42
|
+
jarvis/jarvis_tools/create_code_agent.py,sha256=lVnTP1Kq4q8aWOJ97YTf8POds-Hb3qeYS6MNOiM0wF4,3768
|
|
43
|
+
jarvis/jarvis_tools/create_sub_agent.py,sha256=lPiTXU0F8RZ-mEBB0ec9fdZ1UUtrpUQ2WoV8g-M5lHg,2774
|
|
44
|
+
jarvis/jarvis_tools/execute_shell.py,sha256=VTp9Ax_vuYg7zenkroiVwAvvukEZxADN5qNhO_ZAyHg,4039
|
|
45
|
+
jarvis/jarvis_tools/execute_shell_script.py,sha256=JLs_4p3rXS_d0PdfS6lP_4ojFlD0SayAe0PNEGVfyzE,2030
|
|
46
|
+
jarvis/jarvis_tools/file_operation.py,sha256=uSrVo85ocxZYGaV03Tv-087R6Hd8Yt4SY78KQ0tn_gI,6800
|
|
47
|
+
jarvis/jarvis_tools/git_commiter.py,sha256=sRp-ymQlRW7ZQfm9K9TwC3hz2PyBMuGOk4Pn1WcB_Yo,5012
|
|
48
|
+
jarvis/jarvis_tools/lsp_find_definition.py,sha256=LqAOf6W4_WZR2GmtQXb7pMSduJzK_g3ysaOrgxu8CDE,4755
|
|
49
|
+
jarvis/jarvis_tools/lsp_find_references.py,sha256=IR1QcRi-p4zHS0YENb7vDNMUSuGQUTA4W9bPa9-VO-Y,4028
|
|
50
|
+
jarvis/jarvis_tools/lsp_get_diagnostics.py,sha256=_u2lsSFY7GkOlyKD2CFnvEpkZzAjNfEUMsM9dKGQz40,4754
|
|
51
|
+
jarvis/jarvis_tools/lsp_get_document_symbols.py,sha256=c7_9jP1toe_kepaTmZf1R1jn-JZVCwr6_0ox-KRd8bo,3065
|
|
52
|
+
jarvis/jarvis_tools/lsp_prepare_rename.py,sha256=HIeJjup8luIH25XuLqTVdejWDT5vOn-IWSo-TKDFjZ4,4821
|
|
53
|
+
jarvis/jarvis_tools/methodology.py,sha256=jLYFji3hP7Gff7WFRuR-_VmPHI8Rqq0EGDIgackhqtc,5787
|
|
54
|
+
jarvis/jarvis_tools/rag.py,sha256=WuTlyGV5rgZTRxts9eJPC3QABrsoNYKratdO8UzUFDw,5132
|
|
55
|
+
jarvis/jarvis_tools/read_webpage.py,sha256=yV7zSsMcAp55R7aKUiGqHTnnw6c_bmWSspGJuU2VQTQ,3060
|
|
56
|
+
jarvis/jarvis_tools/registry.py,sha256=f_kBiLDDJ3rdKya8mlDEpF8NVbZsqet7HjF43c6t2HM,14351
|
|
57
|
+
jarvis/jarvis_tools/search_web.py,sha256=qJHCCui7r4lhKEajFRpyvAyqKQBpkDdRBWCPBu9X_M4,11436
|
|
58
|
+
jarvis/jarvis_tools/select_code_files.py,sha256=xCqHTjIGju9Pb1Yh2C1Y7l6uT_3pfVB6ARU0VQmeRNI,1879
|
|
59
|
+
jarvis/jarvis_tools/tool_generator.py,sha256=w1P497YPfqESnInuhqJ_VcyM_28ann0mal4VDYr90Ss,6175
|
|
60
|
+
jarvis/jarvis_utils/__init__.py,sha256=YQ4ZUGGIrjQj2nrYAHJxmCPbakcH5g01RWf1zmhBE4Y,953
|
|
61
|
+
jarvis/jarvis_utils/config.py,sha256=KxjJhqOuBYwK28gHAKyJ3joEascwsl9SIFJxO14c2Dg,4472
|
|
62
|
+
jarvis/jarvis_utils/embedding.py,sha256=sZofBOwLCsa4MLv4jSpTZ0bI05FZoYQpWrZXKwIsqM8,6200
|
|
63
|
+
jarvis/jarvis_utils/git_utils.py,sha256=1w3Tgas5JTfB5IM4aGioMJIL9dSpDt9PTSi_2w78oT4,4565
|
|
64
|
+
jarvis/jarvis_utils/globals.py,sha256=tVR3Z1h1scfSGgyYpVvUXILVjCBiG97fZuy4Ac6DLOY,2348
|
|
65
|
+
jarvis/jarvis_utils/input.py,sha256=U6SRkdiZvkpSA2vfw0EocayQvyjUOjtkSI05dsqZuIE,5985
|
|
66
|
+
jarvis/jarvis_utils/methodology.py,sha256=xGXcxfvQAC1a822Rkdu-ZfXKJqlyH3XzSWT657KUnzs,5387
|
|
67
|
+
jarvis/jarvis_utils/output.py,sha256=ip6wC0tMgJysK4d7DiIqZVU93MlYeqGoRlC_wsxAJ0M,8542
|
|
68
|
+
jarvis/jarvis_utils/utils.py,sha256=NZwbJWVC4cd30DEoVvfV4bcau2cU9k9ID07rpEvxZ-I,5578
|
|
69
|
+
jarvis_ai_assistant-0.1.126.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
70
|
+
jarvis_ai_assistant-0.1.126.dist-info/METADATA,sha256=tmPors5GPxGp7-pd-tM5ckGDod0g8NDyPeR-Cak8gG8,10519
|
|
71
|
+
jarvis_ai_assistant-0.1.126.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
72
|
+
jarvis_ai_assistant-0.1.126.dist-info/entry_points.txt,sha256=1oZg_a7zwEjnsFkOTkcGWcYfhA2-1-XTcqS1VS6sXgQ,674
|
|
73
|
+
jarvis_ai_assistant-0.1.126.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
74
|
+
jarvis_ai_assistant-0.1.126.dist-info/RECORD,,
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from typing import Dict, Any
|
|
3
|
-
from jarvis.jarvis_lsp.registry import LSPRegistry
|
|
4
|
-
|
|
5
|
-
class LSPValidateEditTool:
|
|
6
|
-
"""Tool for validating code edits using LSP."""
|
|
7
|
-
|
|
8
|
-
name = "lsp_validate_edit"
|
|
9
|
-
description = "Validate if a proposed code edit is syntactically correct"
|
|
10
|
-
parameters = {
|
|
11
|
-
"file_path": "Path to the file to edit",
|
|
12
|
-
"start_line": "Starting line number (0-based) of the edit",
|
|
13
|
-
"start_character": "Starting character position in the start line",
|
|
14
|
-
"end_line": "Ending line number (0-based) of the edit",
|
|
15
|
-
"end_character": "Ending character position in the end line",
|
|
16
|
-
"new_text": "New text to insert",
|
|
17
|
-
"language": f"Programming language of the file ({', '.join(LSPRegistry.get_global_lsp_registry().get_supported_languages())})"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@staticmethod
|
|
21
|
-
def check() -> bool:
|
|
22
|
-
"""Check if any LSP server is available."""
|
|
23
|
-
registry = LSPRegistry.get_global_lsp_registry()
|
|
24
|
-
return len(registry.get_supported_languages()) > 0
|
|
25
|
-
|
|
26
|
-
def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
|
|
27
|
-
"""Execute the tool."""
|
|
28
|
-
file_path = args.get("file_path", "")
|
|
29
|
-
start_line = args.get("start_line", None)
|
|
30
|
-
start_character = args.get("start_character", None)
|
|
31
|
-
end_line = args.get("end_line", None)
|
|
32
|
-
end_character = args.get("end_character", None)
|
|
33
|
-
new_text = args.get("new_text", "")
|
|
34
|
-
language = args.get("language", "")
|
|
35
|
-
|
|
36
|
-
# Validate inputs
|
|
37
|
-
if not all([file_path, start_line is not None, start_character is not None,
|
|
38
|
-
end_line is not None, end_character is not None, language]):
|
|
39
|
-
return {
|
|
40
|
-
"success": False,
|
|
41
|
-
"stderr": "All parameters except new_text must be provided",
|
|
42
|
-
"stdout": ""
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
try:
|
|
46
|
-
start_line = int(start_line)
|
|
47
|
-
start_character = int(start_character)
|
|
48
|
-
end_line = int(end_line)
|
|
49
|
-
end_character = int(end_character)
|
|
50
|
-
except ValueError:
|
|
51
|
-
return {
|
|
52
|
-
"success": False,
|
|
53
|
-
"stderr": "Line and character positions must be integers",
|
|
54
|
-
"stdout": ""
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if not os.path.exists(file_path):
|
|
58
|
-
return {
|
|
59
|
-
"success": False,
|
|
60
|
-
"stderr": f"File not found: {file_path}",
|
|
61
|
-
"stdout": ""
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
# Get LSP instance
|
|
65
|
-
registry = LSPRegistry.get_global_lsp_registry()
|
|
66
|
-
lsp = registry.create_lsp(language)
|
|
67
|
-
|
|
68
|
-
if not lsp:
|
|
69
|
-
return {
|
|
70
|
-
"success": False,
|
|
71
|
-
"stderr": f"No LSP support for language: {language}",
|
|
72
|
-
"stdout": ""
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
try:
|
|
76
|
-
# Initialize LSP
|
|
77
|
-
if not lsp.initialize(os.path.abspath(os.getcwd())):
|
|
78
|
-
return {
|
|
79
|
-
"success": False,
|
|
80
|
-
"stderr": "LSP initialization failed",
|
|
81
|
-
"stdout": ""
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
# Prepare edit operation
|
|
85
|
-
edit = {
|
|
86
|
-
"range": {
|
|
87
|
-
"start": {"line": start_line, "character": start_character},
|
|
88
|
-
"end": {"line": end_line, "character": end_character}
|
|
89
|
-
},
|
|
90
|
-
"newText": new_text
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# Show the edit preview
|
|
94
|
-
output = ["Edit Preview:"]
|
|
95
|
-
|
|
96
|
-
# Show original code
|
|
97
|
-
try:
|
|
98
|
-
with open(file_path, 'r') as f:
|
|
99
|
-
lines = f.readlines()
|
|
100
|
-
context_start = max(0, start_line - 2)
|
|
101
|
-
context_end = min(len(lines), end_line + 3)
|
|
102
|
-
|
|
103
|
-
output.append("\nOriginal code:")
|
|
104
|
-
for i in range(context_start, context_end):
|
|
105
|
-
prefix = ">" if start_line <= i <= end_line else " "
|
|
106
|
-
output.append(f"{prefix} {i+1:4d} | {lines[i].rstrip()}")
|
|
107
|
-
except Exception:
|
|
108
|
-
pass
|
|
109
|
-
|
|
110
|
-
# Show new text
|
|
111
|
-
output.extend([
|
|
112
|
-
"\nNew text to insert:",
|
|
113
|
-
new_text,
|
|
114
|
-
"\nEdit range:",
|
|
115
|
-
f"From line {start_line + 1}, character {start_character}",
|
|
116
|
-
f"To line {end_line + 1}, character {end_character}"
|
|
117
|
-
])
|
|
118
|
-
|
|
119
|
-
# Validate edit
|
|
120
|
-
is_valid = lsp.validate_edit(file_path, edit)
|
|
121
|
-
|
|
122
|
-
if is_valid:
|
|
123
|
-
output.append("\nValidation Result: The edit is syntactically correct ✓")
|
|
124
|
-
else:
|
|
125
|
-
output.append("\nValidation Result: The edit would introduce syntax errors ✗")
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
"success": True,
|
|
129
|
-
"stdout": "\n".join(output),
|
|
130
|
-
"stderr": ""
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
except Exception as e:
|
|
134
|
-
return {
|
|
135
|
-
"success": False,
|
|
136
|
-
"stderr": f"Error validating edit: {str(e)}",
|
|
137
|
-
"stdout": ""
|
|
138
|
-
}
|
|
139
|
-
finally:
|
|
140
|
-
if lsp:
|
|
141
|
-
lsp.shutdown()
|