jarvis-ai-assistant 0.1.125__py3-none-any.whl → 0.1.128__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.

Files changed (49) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +205 -187
  3. jarvis/jarvis_code_agent/code_agent.py +116 -109
  4. jarvis/jarvis_code_agent/patch.py +157 -138
  5. jarvis/jarvis_code_agent/shell_input_handler.py +22 -0
  6. jarvis/jarvis_codebase/main.py +314 -288
  7. jarvis/jarvis_dev/main.py +695 -716
  8. jarvis/jarvis_lsp/base.py +0 -12
  9. jarvis/jarvis_lsp/cpp.py +0 -9
  10. jarvis/jarvis_lsp/go.py +0 -9
  11. jarvis/jarvis_lsp/python.py +0 -28
  12. jarvis/jarvis_lsp/registry.py +0 -1
  13. jarvis/jarvis_lsp/rust.py +0 -9
  14. jarvis/jarvis_multi_agent/__init__.py +52 -52
  15. jarvis/jarvis_platform/base.py +6 -5
  16. jarvis/jarvis_platform_manager/main.py +1 -1
  17. jarvis/jarvis_rag/main.py +250 -186
  18. jarvis/jarvis_smart_shell/main.py +0 -1
  19. jarvis/jarvis_tools/ask_codebase.py +10 -9
  20. jarvis/jarvis_tools/ask_user.py +2 -2
  21. jarvis/jarvis_tools/base.py +4 -4
  22. jarvis/jarvis_tools/chdir.py +28 -28
  23. jarvis/jarvis_tools/code_review.py +44 -39
  24. jarvis/jarvis_tools/create_code_agent.py +4 -4
  25. jarvis/jarvis_tools/create_sub_agent.py +7 -7
  26. jarvis/jarvis_tools/execute_shell.py +53 -23
  27. jarvis/jarvis_tools/execute_shell_script.py +3 -3
  28. jarvis/jarvis_tools/file_operation.py +70 -41
  29. jarvis/jarvis_tools/git_commiter.py +61 -51
  30. jarvis/jarvis_tools/lsp_find_definition.py +7 -7
  31. jarvis/jarvis_tools/lsp_prepare_rename.py +7 -7
  32. jarvis/jarvis_tools/methodology.py +6 -6
  33. jarvis/jarvis_tools/rag.py +5 -5
  34. jarvis/jarvis_tools/read_webpage.py +52 -32
  35. jarvis/jarvis_tools/registry.py +167 -180
  36. jarvis/jarvis_tools/search_web.py +66 -41
  37. jarvis/jarvis_tools/select_code_files.py +3 -3
  38. jarvis/jarvis_tools/tool_generator.py +68 -55
  39. jarvis/jarvis_utils/methodology.py +77 -59
  40. jarvis/jarvis_utils/output.py +1 -0
  41. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/METADATA +31 -17
  42. jarvis_ai_assistant-0.1.128.dist-info/RECORD +74 -0
  43. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/WHEEL +1 -1
  44. jarvis/jarvis_tools/lsp_validate_edit.py +0 -141
  45. jarvis/jarvis_tools/read_code.py +0 -192
  46. jarvis_ai_assistant-0.1.125.dist-info/RECORD +0 -75
  47. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/LICENSE +0 -0
  48. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/entry_points.txt +0 -0
  49. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.125
3
+ Version: 0.1.128
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
- [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
78
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77
+ <div align="center">
78
+
79
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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/` 中创建新的 Python 文件:
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/` 中创建新的 Python 文件:
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=L8k8m9rzO09xkbiWM9WsgDo2WhYnz77jf-96COi8UyQ,51
2
+ jarvis/jarvis_agent/__init__.py,sha256=oyWOOGP8vYEG9ycRWRVNOL_Zfya9fC5Yvs6kk15rdD4,22942
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=IiIunonLsrHIunH96-1Q-B0WMXErVoi-aMzMglO8bF0,11026
6
+ jarvis/jarvis_code_agent/file_select.py,sha256=2nSy1FW-kK-wvtz0YbbgSbd4ZwXMlA7sBP0nC80FzLI,8160
7
+ jarvis/jarvis_code_agent/patch.py,sha256=prYc3DkIOJMn-qkv4plusCiyZog7cN9W7E9o8Rgersw,10998
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=KSNf2RoPDn_jnfjUA5Sry7sh7iJ9Q267Z8k4dsQANRM,41325
11
+ jarvis/jarvis_dev/main.py,sha256=tDdv28nbcYlsy9wz1RbMNEModOdicNg4JfnBOYl4JnU,21414
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=2chHt0pMx4rr0OFTeDpZcVqFUxF_q4YslUt30E5Augk,3277
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=84j3voQDOVhvCqWxf-SGpdrYQPcf0pA5qUKe7b5oPUE,20898
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=yEvzQQZ4YQoOovQvH9MqQDbdnFw11bC_fyrNFo3QRq8,35873
34
+ jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ jarvis/jarvis_smart_shell/main.py,sha256=5gyBKgxuaTrDToE7Xy4DhsJPDOEviPi7ktm1vOZoIno,4618
36
+ jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ jarvis/jarvis_tools/ask_codebase.py,sha256=DyqOsVgVPefhGKC5L2bQqKj8KMFZE-PDgfdoHQ9ajH4,3300
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=GLbH2fOKESUn3XYhNg0uOI5axTO2csC0B9HUL0bMZ5U,2790
41
+ jarvis/jarvis_tools/code_review.py,sha256=4TMsTehbIq3W-K-LvHjMwbaGtt66sbSM6nij30YsxlU,10039
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=5LWWae8LKX4Qe3DIkSiLpcEvkCcF1ruvY0gbAIrT1Nw,3914
45
+ jarvis/jarvis_tools/execute_shell_script.py,sha256=JLs_4p3rXS_d0PdfS6lP_4ojFlD0SayAe0PNEGVfyzE,2030
46
+ jarvis/jarvis_tools/file_operation.py,sha256=3dcbugrzSaXHV7m98k1E_CpEIK2v4DYqZNZQim-fuxM,6973
47
+ jarvis/jarvis_tools/git_commiter.py,sha256=mjGturix6uP6HmqzqX8APJuofaLWGQ4-D6DOk8jj7WI,5533
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=TkVNgirvcjns8-MHaDXOmliOKWCYcq3WzcbVXBi0IxY,4173
56
+ jarvis/jarvis_tools/registry.py,sha256=q5-U_Pt7ACKG1jVFq14VU2fPEbJcBkWWrRrX1-5rR8s,14005
57
+ jarvis/jarvis_tools/search_web.py,sha256=yzu2EP63It2but0LFUR0x1hlCkyTyr1AwY4APvxmniE,12903
58
+ jarvis/jarvis_tools/select_code_files.py,sha256=xCqHTjIGju9Pb1Yh2C1Y7l6uT_3pfVB6ARU0VQmeRNI,1879
59
+ jarvis/jarvis_tools/tool_generator.py,sha256=LlNFIc-qWjDQULR2Vw95qf-KbuO8FtRNINcGjr4q7pQ,6992
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=qr7SHLusqc5BkDy6TcOj4rMKT2je_8DFTimXp11DXag,6418
67
+ jarvis/jarvis_utils/output.py,sha256=-7sRJjAJRSrbVeMO9HEDgKVvHNWxD56RLsbA8Xnf-Xk,8566
68
+ jarvis/jarvis_utils/utils.py,sha256=NZwbJWVC4cd30DEoVvfV4bcau2cU9k9ID07rpEvxZ-I,5578
69
+ jarvis_ai_assistant-0.1.128.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
70
+ jarvis_ai_assistant-0.1.128.dist-info/METADATA,sha256=soyyoOLcJqo7VOOgb-CSdKA1btnwx2ojiokmPUYdvNk,10519
71
+ jarvis_ai_assistant-0.1.128.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
72
+ jarvis_ai_assistant-0.1.128.dist-info/entry_points.txt,sha256=1oZg_a7zwEjnsFkOTkcGWcYfhA2-1-XTcqS1VS6sXgQ,674
73
+ jarvis_ai_assistant-0.1.128.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
74
+ jarvis_ai_assistant-0.1.128.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.3.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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()
@@ -1,192 +0,0 @@
1
- from typing import Dict, Any
2
- import os
3
-
4
- from jarvis.jarvis_utils.output import OutputType, PrettyOutput
5
-
6
-
7
- class ReadCodeTool:
8
- """Read multiple code files with line numbers"""
9
-
10
- name = "read_code"
11
- description = "Read multiple code files with line numbers"
12
- parameters = {
13
- "type": "object",
14
- "properties": {
15
- "files": {
16
- "type": "array",
17
- "items": {
18
- "type": "object",
19
- "properties": {
20
- "path": {
21
- "type": "string",
22
- "description": "Path to the file"
23
- },
24
- "start_line": {
25
- "type": "integer",
26
- "description": "Start line number (1-based, inclusive)",
27
- "default": 1
28
- },
29
- "end_line": {
30
- "type": "integer",
31
- "description": "End line number (1-based, inclusive). -1 means read to end",
32
- "default": -1
33
- }
34
- },
35
- "required": ["path"]
36
- },
37
- "description": "List of files to read"
38
- }
39
- },
40
- "required": ["files"]
41
- }
42
-
43
- def _read_single_file(self, filepath: str, start_line: int = 1, end_line: int = -1) -> Dict[str, Any]:
44
- """Read a single code file with line numbers
45
-
46
- Args:
47
- filepath: Path to the file
48
- start_line: Start line number (1-based, inclusive)
49
- end_line: End line number (1-based, inclusive). -1 means read to end
50
-
51
- Returns:
52
- Dict containing operation result
53
- """
54
- try:
55
- abs_path = os.path.abspath(filepath.strip())
56
- PrettyOutput.print(f"正在读取代码文件:{abs_path} [范围: [{start_line},{end_line}]]", OutputType.INFO)
57
-
58
- if not os.path.exists(abs_path):
59
- PrettyOutput.print(f"文件不存在: {abs_path}", OutputType.WARNING)
60
- return {
61
- "success": False,
62
- "stdout": "",
63
- "stderr": f"File does not exist: {abs_path}"
64
- }
65
-
66
- if os.path.getsize(abs_path) > 10 * 1024 * 1024: # 10MB
67
- PrettyOutput.print(f"文件太大: {abs_path}", OutputType.WARNING)
68
- return {
69
- "success": False,
70
- "stdout": "",
71
- "stderr": "File too large (>10MB)"
72
- }
73
-
74
- try:
75
- with open(abs_path, 'r', encoding='utf-8') as f:
76
- lines = f.readlines()
77
- except UnicodeDecodeError:
78
- PrettyOutput.print(f"文件解码失败: {abs_path}", OutputType.WARNING)
79
- return {
80
- "success": False,
81
- "stdout": "",
82
- "stderr": "Failed to decode file with UTF-8 encoding"
83
- }
84
- except Exception as e:
85
- PrettyOutput.print(f"读取文件失败: {abs_path}", OutputType.WARNING)
86
- return {
87
- "success": False,
88
- "stdout": "",
89
- "stderr": f"Failed to read file: {str(e)}"
90
- }
91
-
92
- total_lines = len(lines)
93
-
94
- # 处理特殊行号值
95
- # 转换负数索引 (Python风格)
96
- start_line = start_line if start_line >= 0 else total_lines + start_line + 1
97
- end_line = end_line if end_line >= 0 else total_lines + end_line + 1
98
-
99
- # 自动修正范围
100
- start_line = max(1, min(start_line, total_lines))
101
- end_line = max(1, min(end_line, total_lines))
102
-
103
- # 处理-1表示到末尾的情况
104
- if end_line == -1:
105
- end_line = total_lines
106
-
107
- # 最终验证
108
- if start_line > end_line:
109
- error_msg = f"无效的行范围 [{start_line}, {end_line}] (文件总行数: {total_lines})"
110
- PrettyOutput.print(error_msg, OutputType.WARNING)
111
- return {
112
- "success": False,
113
- "stdout": "",
114
- "stderr": error_msg
115
- }
116
-
117
- formatted_lines = []
118
- for i, line in enumerate(lines[start_line - 1:end_line]):
119
- line_num = start_line + i
120
- formatted_lines.append(f"{line_num:>5}:{line}")
121
-
122
- content = "".join(formatted_lines)
123
- output = f"\n\nFile: {filepath}\nLines: [{start_line}, {end_line}]\n{content} \n\n" + "="*80 + "\n\n"
124
- return {
125
- "success": True,
126
- "stdout": output,
127
- "stderr": ""
128
- }
129
-
130
- except Exception as e:
131
- PrettyOutput.print(f"读取代码失败: {filepath}", OutputType.WARNING)
132
- return {
133
- "success": False,
134
- "stdout": "",
135
- "stderr": f"Failed to read code: {str(e)}"
136
- }
137
-
138
- def execute(self, args: Dict) -> Dict[str, Any]:
139
- """Execute code reading for multiple files
140
-
141
- Args:
142
- args: Dictionary containing:
143
- - files: List of file info with path and optional line range
144
-
145
- Returns:
146
- Dict containing:
147
- - success: Boolean indicating overall success
148
- - stdout: Combined output of all files as string
149
- - stderr: Error message if any
150
- """
151
- try:
152
- if "files" not in args or not isinstance(args["files"], list):
153
- return {
154
- "success": False,
155
- "stdout": "",
156
- "stderr": "files parameter is required and must be a list"
157
- }
158
-
159
- all_outputs = []
160
- success = True
161
-
162
- for file_info in args["files"]:
163
- if not isinstance(file_info, dict) or "path" not in file_info:
164
- continue
165
-
166
- result = self._read_single_file(
167
- file_info["path"],
168
- file_info.get("start_line", 1),
169
- file_info.get("end_line", -1)
170
- )
171
-
172
- if result["success"]:
173
- all_outputs.append(result["stdout"])
174
- else:
175
- all_outputs.append(f"Error reading {file_info['path']}: {result['stderr']}")
176
- success = success and result["success"]
177
-
178
- # Combine all outputs with separators
179
- combined_output = "\n\n" + "="*80 + "\n\n".join(all_outputs)
180
-
181
- return {
182
- "success": success,
183
- "stdout": combined_output,
184
- "stderr": ""
185
- }
186
-
187
- except Exception as e:
188
- return {
189
- "success": False,
190
- "stdout": "",
191
- "stderr": f"Failed to read code files: {str(e)}"
192
- }
@@ -1,75 +0,0 @@
1
- jarvis/__init__.py,sha256=nM3s8LT3EVl_KWqahK0IFoim64f56d68wGfIeRjDdNw,51
2
- jarvis/jarvis_agent/__init__.py,sha256=1kH2A4Ni_4NNZaDyes687tq8Jma9Nj5QQIAsX7B_n9g,22432
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=x9uc_B903f9IzjGAd4f59TxhCSPGafaTBD19p6R_t0o,11038
6
- jarvis/jarvis_code_agent/file_select.py,sha256=2nSy1FW-kK-wvtz0YbbgSbd4ZwXMlA7sBP0nC80FzLI,8160
7
- jarvis/jarvis_code_agent/patch.py,sha256=eqfnSiuixEvN9h_OcNNFKmWoH4EiamD1BhkQTMDA5ZY,9628
8
- jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- jarvis/jarvis_codebase/main.py,sha256=0g02p5AUcoIKVJ7X2BV_2gl27q4EG_21lS6vPNWx224,39913
10
- jarvis/jarvis_dev/main.py,sha256=V1c4sXijLnyeBoBHre2eAHOLZofQmPiPFhKGjdP6C8k,24326
11
- jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- jarvis/jarvis_git_squash/main.py,sha256=g4csaRDYH3n3MCHc8aZb2N4wWVCVZ-pIgd0oanXDnD8,2798
13
- jarvis/jarvis_lsp/base.py,sha256=_7pdbMKjdtYBW0DsRbjIodDHM3J7df-YgXHejN_WIrU,4490
14
- jarvis/jarvis_lsp/cpp.py,sha256=9eyQPi6vAMQaVTdz5Y-Erm_9XMs57zoQLjuhuthZTNs,4993
15
- jarvis/jarvis_lsp/go.py,sha256=8sQGzVzsAKBt9LR78RehOvUrOXm7dalQg0OiGjPzHw8,5318
16
- jarvis/jarvis_lsp/python.py,sha256=_Vo2pPwVh_vAsyS0XowXMbT4Syd78naPEZj586bi004,4747
17
- jarvis/jarvis_lsp/registry.py,sha256=RJSxdG1eX70Lp6Sexu1zNC0O948oXweMbIekgeBUDrE,9930
18
- jarvis/jarvis_lsp/rust.py,sha256=tzBYFKjJk8Bl3aXc7SkmOEF5XpYDufyP01IZ1fk2y-4,5549
19
- jarvis/jarvis_multi_agent/__init__.py,sha256=dZiItTOf1BAlhosigiZxZromwqBbVg5HhDSXFQxgjmQ,6018
20
- jarvis/jarvis_platform/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
21
- jarvis/jarvis_platform/ai8.py,sha256=xjgoiF7QHx_5FHj-npTFVvZFYg8RBzkqTGAOQ-MJiL0,11972
22
- jarvis/jarvis_platform/base.py,sha256=TNBvCm_rkQ6rLfxPS5VAc8ieKMMhQOHmmc_b4-Rwbys,3221
23
- jarvis/jarvis_platform/kimi.py,sha256=Qwb81flbKPvj-qZyJAMS_u0lQatRFQztYxUGDbj1keM,15713
24
- jarvis/jarvis_platform/ollama.py,sha256=NHQMJSpC91WtSFuHKJuwD8qO-z4yDTF9mZX6BzWTKRU,5658
25
- jarvis/jarvis_platform/openai.py,sha256=GSxTB69WitXJS3pL0sxCoB2F0EVHmvhrwLBC_JT8s34,4470
26
- jarvis/jarvis_platform/oyi.py,sha256=pa72TtBYlhs3KPpqO4Y78a1Jvx4mN0pojBklu8X3F-k,15024
27
- jarvis/jarvis_platform/registry.py,sha256=DrL6ZoIX9ZKAvFgDadiWPpVnO9GdWJMcXM8dsoNR3ds,8559
28
- jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- jarvis/jarvis_platform_manager/main.py,sha256=l0bxxPrQ41OJc9GANgUYl0ecWNDXIIk3Zp94I_gOZz0,20943
30
- jarvis/jarvis_platform_manager/openai_test.py,sha256=bkcVG6o2nNazj4zjkENgA4yOEzdTI9Qbm5dco-2MGYM,5190
31
- jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- jarvis/jarvis_rag/main.py,sha256=O5qluUvp73q1-0kdtQtOK-fMOLgqbqPFF47iBfpdyeg,31848
33
- jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- jarvis/jarvis_smart_shell/main.py,sha256=dkIudGGfLQCGr4u5E5Q8jfjN361cZdyK0S3WV5lXqhs,4658
35
- jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- jarvis/jarvis_tools/ask_codebase.py,sha256=zchDyz55azX1IW1cz0HAAUG6EyQDZL-8EgZbFQMqpv0,3401
37
- jarvis/jarvis_tools/ask_user.py,sha256=TIy8-AQhsBbDCBhEKXHlbTfivIwWoGkd9zDX_Id6Ra0,1830
38
- jarvis/jarvis_tools/base.py,sha256=ej7-LUSzfB1pf-yjr2OuMYCGHEER1YhuXoMP9WU14YY,1194
39
- jarvis/jarvis_tools/chdir.py,sha256=yd_cEMGx6rQtmKhZD0uq8P8afa8ksNWRBHquoDLsnGg,2924
40
- jarvis/jarvis_tools/code_review.py,sha256=kxLfwuixeGqSKOusJFBIv1dDNdZc_zCE-ls7Q_CB5o8,9699
41
- jarvis/jarvis_tools/create_code_agent.py,sha256=EgiwiEmKax6qLy55U-MIrN_iR4_e248tKfSf3KxDueo,3815
42
- jarvis/jarvis_tools/create_sub_agent.py,sha256=6UXJuE8V73GVkFdIm0Gf5EkdR87hzJQUdFFhWaBlPeI,2823
43
- jarvis/jarvis_tools/execute_shell.py,sha256=WVaQup3z3C2CrTLn7aQokH4lVFJR6oWLCv7MdKh96Yw,2575
44
- jarvis/jarvis_tools/execute_shell_script.py,sha256=i3uGWnO4sE2S0JyhJgdaVzGg1w_phXupuL06Ip2YeRY,2049
45
- jarvis/jarvis_tools/file_operation.py,sha256=0XIfQgukUHmwF1CEEmzX7nNqaKZ9p9SdK5Pf7fyhPXg,5496
46
- jarvis/jarvis_tools/git_commiter.py,sha256=UNYq6i5rtVlemFW0DJq8xmoPuX5qRL57JEqGiz5s_TA,5063
47
- jarvis/jarvis_tools/lsp_find_definition.py,sha256=K0vTmwKOcgMsuoIEv1Iz330B1rHJrvhvW3gLiEbu9N0,4785
48
- jarvis/jarvis_tools/lsp_find_references.py,sha256=IR1QcRi-p4zHS0YENb7vDNMUSuGQUTA4W9bPa9-VO-Y,4028
49
- jarvis/jarvis_tools/lsp_get_diagnostics.py,sha256=_u2lsSFY7GkOlyKD2CFnvEpkZzAjNfEUMsM9dKGQz40,4754
50
- jarvis/jarvis_tools/lsp_get_document_symbols.py,sha256=c7_9jP1toe_kepaTmZf1R1jn-JZVCwr6_0ox-KRd8bo,3065
51
- jarvis/jarvis_tools/lsp_prepare_rename.py,sha256=O-H2_sUNGyv5ZfL2Vqn2a7AUJbVCC6olZ8LJD494YAY,4817
52
- jarvis/jarvis_tools/lsp_validate_edit.py,sha256=RlkX_V3OaOsFUQKYTcODqGmLiKvkpPALg4i5dCPGf_I,5232
53
- jarvis/jarvis_tools/methodology.py,sha256=ASnoXXj0s6OUo5WpRahSOW2lWnAOzXrM9as3Tmed-eU,5805
54
- jarvis/jarvis_tools/rag.py,sha256=Ixfnq0zyEjyWaLTrAIQlME6YyJisOc1v3YNgjLUdp6k,5178
55
- jarvis/jarvis_tools/read_code.py,sha256=Hf15PneTVN1qRAA8F8xWRN1cXwt_Q6UbQjMkSAWP3qw,7315
56
- jarvis/jarvis_tools/read_webpage.py,sha256=V1r8kqXkzUTPWATBUcQF0PDbDXI0AT7KKruEQPp01f4,3071
57
- jarvis/jarvis_tools/registry.py,sha256=Da4Bmz7ouSb31-auBLf3rc_cIGFC58rkQfuQRveQrmw,14923
58
- jarvis/jarvis_tools/search_web.py,sha256=x62Tvn53ledmcnxZrDSU_kxj25f4-fcIy2v-1WmUfkE,11490
59
- jarvis/jarvis_tools/select_code_files.py,sha256=EWBc57fJIL_C-6SDPLCSIHrWYd9759l-f1YJLOqbi9Q,1909
60
- jarvis/jarvis_tools/tool_generator.py,sha256=jdniHyKcEyF9KyouudrCoZBH3czZmQXc3ns0_trZ3yU,6332
61
- jarvis/jarvis_utils/__init__.py,sha256=YQ4ZUGGIrjQj2nrYAHJxmCPbakcH5g01RWf1zmhBE4Y,953
62
- jarvis/jarvis_utils/config.py,sha256=KxjJhqOuBYwK28gHAKyJ3joEascwsl9SIFJxO14c2Dg,4472
63
- jarvis/jarvis_utils/embedding.py,sha256=sZofBOwLCsa4MLv4jSpTZ0bI05FZoYQpWrZXKwIsqM8,6200
64
- jarvis/jarvis_utils/git_utils.py,sha256=1w3Tgas5JTfB5IM4aGioMJIL9dSpDt9PTSi_2w78oT4,4565
65
- jarvis/jarvis_utils/globals.py,sha256=tVR3Z1h1scfSGgyYpVvUXILVjCBiG97fZuy4Ac6DLOY,2348
66
- jarvis/jarvis_utils/input.py,sha256=U6SRkdiZvkpSA2vfw0EocayQvyjUOjtkSI05dsqZuIE,5985
67
- jarvis/jarvis_utils/methodology.py,sha256=cy_wjzw94t5vjNbk8W09kSKO956QLgNYM0wdJmrh2Do,5420
68
- jarvis/jarvis_utils/output.py,sha256=ip6wC0tMgJysK4d7DiIqZVU93MlYeqGoRlC_wsxAJ0M,8542
69
- jarvis/jarvis_utils/utils.py,sha256=NZwbJWVC4cd30DEoVvfV4bcau2cU9k9ID07rpEvxZ-I,5578
70
- jarvis_ai_assistant-0.1.125.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
71
- jarvis_ai_assistant-0.1.125.dist-info/METADATA,sha256=mC1zjj6fs5CRg5DjZFvVTpqP2LgdHJpExgrDFZjvITI,10352
72
- jarvis_ai_assistant-0.1.125.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
73
- jarvis_ai_assistant-0.1.125.dist-info/entry_points.txt,sha256=1oZg_a7zwEjnsFkOTkcGWcYfhA2-1-XTcqS1VS6sXgQ,674
74
- jarvis_ai_assistant-0.1.125.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
75
- jarvis_ai_assistant-0.1.125.dist-info/RECORD,,