jarvis-ai-assistant 0.1.176__py3-none-any.whl → 0.1.178__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 +33 -62
- jarvis/jarvis_agent/jarvis.py +10 -10
- jarvis/jarvis_agent/main.py +6 -6
- jarvis/jarvis_code_agent/code_agent.py +10 -6
- jarvis/jarvis_code_analysis/code_review.py +1 -1
- jarvis/jarvis_dev/main.py +1 -1
- jarvis/jarvis_event/__init__.py +0 -0
- jarvis/jarvis_git_details/main.py +1 -1
- jarvis/jarvis_git_squash/main.py +1 -1
- jarvis/jarvis_git_utils/git_commiter.py +1 -1
- jarvis/jarvis_multi_agent/main.py +1 -1
- jarvis/jarvis_platform/base.py +6 -3
- jarvis/jarvis_platform/openai.py +66 -10
- jarvis/jarvis_platform/yuanbao.py +1 -1
- jarvis/jarvis_platform_manager/main.py +1 -1
- jarvis/jarvis_smart_shell/main.py +4 -2
- jarvis/jarvis_tools/ask_codebase.py +3 -2
- jarvis/jarvis_tools/cli/main.py +28 -1
- jarvis/jarvis_tools/edit_file.py +186 -118
- jarvis/jarvis_tools/read_code.py +0 -2
- jarvis/jarvis_tools/registry.py +31 -1
- jarvis/jarvis_utils/config.py +13 -4
- jarvis/jarvis_utils/output.py +36 -7
- jarvis/jarvis_utils/utils.py +19 -1
- {jarvis_ai_assistant-0.1.176.dist-info → jarvis_ai_assistant-0.1.178.dist-info}/METADATA +4 -4
- {jarvis_ai_assistant-0.1.176.dist-info → jarvis_ai_assistant-0.1.178.dist-info}/RECORD +31 -37
- {jarvis_ai_assistant-0.1.176.dist-info → jarvis_ai_assistant-0.1.178.dist-info}/WHEEL +1 -1
- jarvis/jarvis_lsp/base.py +0 -66
- jarvis/jarvis_lsp/cpp.py +0 -99
- jarvis/jarvis_lsp/go.py +0 -104
- jarvis/jarvis_lsp/python.py +0 -58
- jarvis/jarvis_lsp/registry.py +0 -169
- jarvis/jarvis_lsp/rust.py +0 -107
- jarvis/jarvis_tools/lsp_get_diagnostics.py +0 -147
- {jarvis_ai_assistant-0.1.176.dist-info → jarvis_ai_assistant-0.1.178.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.176.dist-info → jarvis_ai_assistant-0.1.178.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.176.dist-info → jarvis_ai_assistant-0.1.178.dist-info}/top_level.txt +0 -0
jarvis/jarvis_utils/output.py
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"""
|
|
11
11
|
from enum import Enum
|
|
12
12
|
from datetime import datetime
|
|
13
|
-
from typing import Optional
|
|
13
|
+
from typing import Optional, Tuple
|
|
14
14
|
from rich.panel import Panel
|
|
15
15
|
from rich.text import Text
|
|
16
16
|
from rich.syntax import Syntax
|
|
@@ -19,7 +19,7 @@ from pygments.lexers import guess_lexer
|
|
|
19
19
|
from pygments.util import ClassNotFound
|
|
20
20
|
from jarvis.jarvis_utils.config import get_pretty_output
|
|
21
21
|
from jarvis.jarvis_utils.globals import console, get_agent_list
|
|
22
|
-
|
|
22
|
+
from rich.box import SIMPLE
|
|
23
23
|
class OutputType(Enum):
|
|
24
24
|
"""
|
|
25
25
|
输出类型枚举,用于分类和样式化不同类型的消息。
|
|
@@ -139,7 +139,7 @@ class PrettyOutput:
|
|
|
139
139
|
Text: 格式化后的rich Text对象
|
|
140
140
|
"""
|
|
141
141
|
icon = PrettyOutput._ICONS.get(output_type, "")
|
|
142
|
-
formatted = f"{icon}
|
|
142
|
+
formatted = f"{icon} "
|
|
143
143
|
if timestamp:
|
|
144
144
|
formatted+=f"[{datetime.now().strftime('%H:%M:%S')}][{output_type.value}]"
|
|
145
145
|
agent_info = get_agent_list()
|
|
@@ -190,7 +190,7 @@ class PrettyOutput:
|
|
|
190
190
|
|
|
191
191
|
lang = lang if lang is not None else PrettyOutput._detect_language(text, default_lang='markdown')
|
|
192
192
|
header = Text(PrettyOutput._format(output_type, timestamp), style=header_styles[output_type])
|
|
193
|
-
content = Syntax(text, lang, theme="
|
|
193
|
+
content = Syntax(text, lang, theme="monokai", word_wrap=True, background_color=styles[output_type]["bgcolor"])
|
|
194
194
|
panel = Panel(
|
|
195
195
|
content,
|
|
196
196
|
border_style=header_styles[output_type],
|
|
@@ -202,8 +202,11 @@ class PrettyOutput:
|
|
|
202
202
|
if get_pretty_output():
|
|
203
203
|
console.print(panel)
|
|
204
204
|
else:
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
if len(text.strip().splitlines()) > 1:
|
|
206
|
+
console.print(header)
|
|
207
|
+
console.print(content)
|
|
208
|
+
else:
|
|
209
|
+
console.print(header, content)
|
|
207
210
|
if traceback:
|
|
208
211
|
console.print_exception()
|
|
209
212
|
@staticmethod
|
|
@@ -224,4 +227,30 @@ class PrettyOutput:
|
|
|
224
227
|
console.print(panel)
|
|
225
228
|
else:
|
|
226
229
|
console.print(text)
|
|
227
|
-
|
|
230
|
+
|
|
231
|
+
@staticmethod
|
|
232
|
+
def print_gradient_text(text: str, start_color: Tuple[int, int, int], end_color: Tuple[int, int, int]) -> None:
|
|
233
|
+
"""打印带有渐变色彩的文本。
|
|
234
|
+
|
|
235
|
+
Args:
|
|
236
|
+
text: 要打印的文本
|
|
237
|
+
start_color: 起始RGB颜色元组 (r, g, b)
|
|
238
|
+
end_color: 结束RGB颜色元组 (r, g, b)
|
|
239
|
+
"""
|
|
240
|
+
lines = text.strip('\n').split('\n')
|
|
241
|
+
total_lines = len(lines)
|
|
242
|
+
colored_lines = []
|
|
243
|
+
for i, line in enumerate(lines):
|
|
244
|
+
# 计算当前行的渐变颜色
|
|
245
|
+
r = int(start_color[0] + (end_color[0] - start_color[0]) * i / (total_lines - 1))
|
|
246
|
+
g = int(start_color[1] + (end_color[1] - start_color[1]) * i / (total_lines - 1))
|
|
247
|
+
b = int(start_color[2] + (end_color[2] - start_color[2]) * i / (total_lines - 1))
|
|
248
|
+
|
|
249
|
+
# 使用ANSI转义序列设置颜色
|
|
250
|
+
colored_lines.append(f"\033[38;2;{r};{g};{b}m{line}\033[0m")
|
|
251
|
+
colored_text = Text('\n'.join(colored_lines), style=OutputType.TOOL.value, justify="center")
|
|
252
|
+
panel = Panel(
|
|
253
|
+
colored_text,
|
|
254
|
+
box=SIMPLE
|
|
255
|
+
)
|
|
256
|
+
console.print(panel)
|
jarvis/jarvis_utils/utils.py
CHANGED
|
@@ -5,11 +5,13 @@ import hashlib
|
|
|
5
5
|
import tarfile
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Any, Callable
|
|
8
|
+
|
|
9
|
+
from jarvis import __version__
|
|
8
10
|
from jarvis.jarvis_utils.config import get_max_big_content_size, get_data_dir
|
|
9
11
|
from jarvis.jarvis_utils.embedding import get_context_token_count
|
|
10
12
|
from jarvis.jarvis_utils.input import get_single_line_input
|
|
11
13
|
from jarvis.jarvis_utils.output import PrettyOutput, OutputType
|
|
12
|
-
def init_env() -> None:
|
|
14
|
+
def init_env(welcome_str: str) -> None:
|
|
13
15
|
"""初始化环境变量从jarvis_data/env文件
|
|
14
16
|
|
|
15
17
|
功能:
|
|
@@ -18,6 +20,22 @@ def init_env() -> None:
|
|
|
18
20
|
3. 处理文件读取异常
|
|
19
21
|
4. 检查git仓库状态并在落后时更新
|
|
20
22
|
"""
|
|
23
|
+
|
|
24
|
+
jarvis_ascii_art = f"""
|
|
25
|
+
██╗ █████╗ ██████╗ ██╗ ██╗██╗███████╗
|
|
26
|
+
██║██╔══██╗██╔══██╗██║ ██║██║██╔════╝
|
|
27
|
+
██║███████║██████╔╝██║ ██║██║███████╗
|
|
28
|
+
██╗██║██╔══██║██╔══██╗╚██╗ ██╔╝██║╚════██║
|
|
29
|
+
╚████║██║ ██║██║ ██║ ╚████╔╝ ██║███████║
|
|
30
|
+
╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚══════╝
|
|
31
|
+
{welcome_str}
|
|
32
|
+
|
|
33
|
+
https://github.com/skyfireitdiy/Jarvis
|
|
34
|
+
v{__version__}
|
|
35
|
+
"""
|
|
36
|
+
if welcome_str:
|
|
37
|
+
PrettyOutput.print_gradient_text(jarvis_ascii_art, (0, 120, 255), (0, 255, 200))
|
|
38
|
+
|
|
21
39
|
jarvis_dir = Path(get_data_dir())
|
|
22
40
|
env_file = jarvis_dir / "env"
|
|
23
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jarvis-ai-assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.178
|
|
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
|
|
@@ -201,7 +201,7 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
|
|
|
201
201
|
### 环境变量配置
|
|
202
202
|
| 变量名称 | 默认值 | 说明 |
|
|
203
203
|
|----------|--------|------|
|
|
204
|
-
| `JARVIS_MAX_TOKEN_COUNT` |
|
|
204
|
+
| `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 |
|
|
205
205
|
| `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 |
|
|
206
206
|
| `JARVIS_AUTO_COMPLETE` | false | 是否启用自动完成功能(任务判定完成的时候会自动终止) |
|
|
207
207
|
| `JARVIS_SHELL_NAME` | bash | 系统shell名称 |
|
|
@@ -211,9 +211,9 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
|
|
|
211
211
|
| `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 |
|
|
212
212
|
| `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
|
|
213
213
|
| `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | true | 应用补丁前是否需要确认 |
|
|
214
|
-
| `JARVIS_MAX_TOOL_CALL_COUNT` | 20 |
|
|
214
|
+
| `JARVIS_MAX_TOOL_CALL_COUNT` | 20 | 最大连续工具调用次数,如果是0表示无限制 |
|
|
215
215
|
| `JARVIS_AUTO_UPDATE` | true | 是否自动更新Jarvis(仅在以git仓库方式安装时有效) |
|
|
216
|
-
| `JARVIS_MAX_BIG_CONTENT_SIZE` |
|
|
216
|
+
| `JARVIS_MAX_BIG_CONTENT_SIZE` | 1024000 | 最大大内容大小 |
|
|
217
217
|
| `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
|
|
218
218
|
|
|
219
219
|
所有配置编写到`~/.jarvis/env`文件中即可生效。
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=kLQzda4dAK6qGRaBAGgx8rj1Q_kKFSU7nENMKSCFnzk,74
|
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=Mmk69MP64n6XLmWoFbTBVs4DUZBnSiAKKEQF1P9CcpU,29201
|
|
3
3
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=KhvlV_QdB3P-M0TCkWvdxidNie1jU7KoMOqTIXCpwwA,1529
|
|
4
|
-
jarvis/jarvis_agent/jarvis.py,sha256=
|
|
5
|
-
jarvis/jarvis_agent/main.py,sha256=
|
|
4
|
+
jarvis/jarvis_agent/jarvis.py,sha256=h3-FsL9Y4GtbNPk6qWYs2t6VB8CKabY7_UNe58tzucE,6142
|
|
5
|
+
jarvis/jarvis_agent/main.py,sha256=jvxnBmm4BM13quaCip2PC1-DkAX0MAU25b8nhHIQ5xM,2667
|
|
6
6
|
jarvis/jarvis_agent/output_handler.py,sha256=7qori-RGrQmdiFepoEe3oPPKJIvRt90l_JDmvCoa4zA,1219
|
|
7
7
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=pi3AtPKrkKc6K9e99S1djKXQ_XrxtP6FrSWebQmRT6E,1261
|
|
8
8
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
|
10
|
-
jarvis/jarvis_code_analysis/code_review.py,sha256=
|
|
9
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=9SBMlLWNGR6lqVD7xZaLjokka-yoNGb-OxpHtJjCf_k,17166
|
|
10
|
+
jarvis/jarvis_code_analysis/code_review.py,sha256=9zfVY_u_WSRIKQ69lXeW-pOunh5lYYyQe9i_zEO3m2k,30212
|
|
11
11
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=cKQ_FOGy5TQgM-YkRCqORo-mUOZaPAJ9VDmZoFX58us,78
|
|
12
12
|
jarvis/jarvis_code_analysis/checklists/c_cpp.py,sha256=SXPpYCNeCtU1PpKdKPiYDuOybfY9vaL0ejDn4imxDwA,1317
|
|
13
13
|
jarvis/jarvis_code_analysis/checklists/csharp.py,sha256=vS-cu6RCGg5SyK9MJ3RE381gt3xYl-yea3Bj2UQEcwQ,2420
|
|
@@ -29,74 +29,68 @@ jarvis/jarvis_code_analysis/checklists/sql.py,sha256=ecKKT6wJAibn8R0NxGZDNlm4teY
|
|
|
29
29
|
jarvis/jarvis_code_analysis/checklists/swift.py,sha256=YcsYFxAitHqOtBZjG-RV9-KNM7X5lIcl6zlEI9XfmfM,2566
|
|
30
30
|
jarvis/jarvis_code_analysis/checklists/web.py,sha256=-Pnj1FQTsGVZUQK7-4ptDsGd7a22Cs0585jRAPT2SdQ,3943
|
|
31
31
|
jarvis/jarvis_data/huggingface.tar.gz,sha256=dWKnc_tvyx-I_ZkXo91O0b38KxDmLW1ZbmJ3E6fCl_k,1120205
|
|
32
|
-
jarvis/jarvis_dev/main.py,sha256=
|
|
32
|
+
jarvis/jarvis_dev/main.py,sha256=kyCLm2Ta-iMK20m62O7_rB-Biy_bGxpqrLrLtMOkT5c,43022
|
|
33
|
+
jarvis/jarvis_event/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
34
|
jarvis/jarvis_git_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
jarvis/jarvis_git_details/main.py,sha256=
|
|
35
|
+
jarvis/jarvis_git_details/main.py,sha256=lYx2tSaV1cKCvs3iRf-gHwotg-sljvxC4iPeODpBnbA,9007
|
|
35
36
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
jarvis/jarvis_git_squash/main.py,sha256=
|
|
37
|
-
jarvis/jarvis_git_utils/git_commiter.py,sha256=
|
|
38
|
-
jarvis/jarvis_lsp/base.py,sha256=ZngrQ4NUy9iPrXORcw4QR-tWZi2G79nsfqeqqkaxSZ0,2054
|
|
39
|
-
jarvis/jarvis_lsp/cpp.py,sha256=WL7rItrwFkYRSZzQHnoOoQ-EDho7Jd6BOaCn1UgsQ3A,3165
|
|
40
|
-
jarvis/jarvis_lsp/go.py,sha256=FkBJAeJex8jamn44o_cpYCygSTGMnsykJGrnkVFlTww,3482
|
|
41
|
-
jarvis/jarvis_lsp/python.py,sha256=bTvo4i4tzoYFOag9lzDEIBb6-oNHGIrHFz1SQQ2w5qM,1867
|
|
42
|
-
jarvis/jarvis_lsp/registry.py,sha256=4qvwpsRhBLfYmsU1N2qn3mF_K-P66J69Oupt0et33xk,6515
|
|
43
|
-
jarvis/jarvis_lsp/rust.py,sha256=Z2KmvTsIcn5SLM4iaLG4Mael1h6zlZQIiOopbDpurag,3710
|
|
37
|
+
jarvis/jarvis_git_squash/main.py,sha256=nGygczZlRbczKAU8LEFLHQVjpgCkbGx7GQQcwo57cSo,2276
|
|
38
|
+
jarvis/jarvis_git_utils/git_commiter.py,sha256=58ZhxwDdYzMH9-uvVe2dazQfq8uNcZTJQq7SMJEFsic,13020
|
|
44
39
|
jarvis/jarvis_mcp/__init__.py,sha256=NF_vqRxaNyz8ColcpRh0bOkinV90YLAKHEN--jkP-B8,2114
|
|
45
40
|
jarvis/jarvis_mcp/sse_mcp_client.py,sha256=FOVzroTw-pifmnF0qdsoQ6KweDCQ0Gxs6d6jl4VopiQ,23483
|
|
46
41
|
jarvis/jarvis_mcp/stdio_mcp_client.py,sha256=KO0ewJuLBZLNqG4EGJcBOtn-8VJIipkq84ENvSwgQAo,11830
|
|
47
42
|
jarvis/jarvis_methodology/main.py,sha256=QJUMIb9o8JO-l207X5UIbazZKJYKG3F4iuUKtkm0dmg,11840
|
|
48
43
|
jarvis/jarvis_multi_agent/__init__.py,sha256=Xab5sFltJmX_9MoXqanmZs6FqKfUb2v_pG29Vk8ZXaw,4311
|
|
49
|
-
jarvis/jarvis_multi_agent/main.py,sha256=
|
|
44
|
+
jarvis/jarvis_multi_agent/main.py,sha256=Ax3Oe0mjcW567VhFYPt3H5MwqLS1VdxKCeiNgXltmXk,1644
|
|
50
45
|
jarvis/jarvis_platform/__init__.py,sha256=0YnsUoM4JkIBOtImFdjfuDbrqQZT3dEaAwSJ62DrpCc,104
|
|
51
|
-
jarvis/jarvis_platform/base.py,sha256=
|
|
46
|
+
jarvis/jarvis_platform/base.py,sha256=ioIEtuEVuXCdLpPofR9c-lqvADM-pCz5XOMQVKq8xeI,6740
|
|
52
47
|
jarvis/jarvis_platform/human.py,sha256=1Jh9xigQaU78WVvsIMaVH0i6QRhaSA1oaErv9BdntF8,2565
|
|
53
48
|
jarvis/jarvis_platform/kimi.py,sha256=p18Ydb_0rgnK3-WZXKUtTBQTh7Da33O277PKWOMqBhA,13106
|
|
54
|
-
jarvis/jarvis_platform/openai.py,sha256=
|
|
49
|
+
jarvis/jarvis_platform/openai.py,sha256=NIoquWLf0_kCqPk-y6wGq30RwJPojaS3MwC7sL7UPL8,5585
|
|
55
50
|
jarvis/jarvis_platform/registry.py,sha256=UjCdPT9WIRxU-F0uuPpKmKRRCcNNxjr-bRTEPgRSNx4,7740
|
|
56
|
-
jarvis/jarvis_platform/yuanbao.py,sha256=
|
|
51
|
+
jarvis/jarvis_platform/yuanbao.py,sha256=Vi8D3lhTOwg2-PmMj7HHRXKg-dViI2ghtJcxm3tf8nc,21669
|
|
57
52
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
|
-
jarvis/jarvis_platform_manager/main.py,sha256=
|
|
53
|
+
jarvis/jarvis_platform_manager/main.py,sha256=cpnqYWjb2fU2uhrTtYyyrKpe6rta2NniYjZE6BjLG8k,25675
|
|
59
54
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
|
-
jarvis/jarvis_smart_shell/main.py,sha256=
|
|
55
|
+
jarvis/jarvis_smart_shell/main.py,sha256=v3DXutU-lBYABxB1tURHPcdTJuoT3gthdXl8O5tOGJw,5208
|
|
61
56
|
jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
|
-
jarvis/jarvis_tools/ask_codebase.py,sha256=
|
|
57
|
+
jarvis/jarvis_tools/ask_codebase.py,sha256=HOEx_e7Po0tnKCTX5ZgzARxwYO_6e6ZNJacjMDQb-zw,10144
|
|
63
58
|
jarvis/jarvis_tools/ask_user.py,sha256=cWSLG33b79IbIZEWsSNV5RHvGX6eo3nTM8TUhOMnGh8,2167
|
|
64
59
|
jarvis/jarvis_tools/base.py,sha256=SR4dmrgYj3lNmtVDhHtItPvptTqCfw5SGRhgPT3I6ss,1189
|
|
65
60
|
jarvis/jarvis_tools/chdir.py,sha256=wYVBqWF5kaUkKqH3cUAOKUsACzYsFtCCJJyd8UJsp4o,2706
|
|
66
61
|
jarvis/jarvis_tools/code_plan.py,sha256=EzLdbJnVCkJ7lL8XIQyuDJdxU1i3CFiBpqyNG-GdJw8,7753
|
|
67
62
|
jarvis/jarvis_tools/create_code_agent.py,sha256=cxYkjr4rhI2EWpK78psZSRB9mxiP1IUT0SEfFIqCJzY,3411
|
|
68
63
|
jarvis/jarvis_tools/create_sub_agent.py,sha256=ppTOFRd0ygSJUFr3oQ8IrCLOqbZ7vwnbdadfTDjpDgs,3025
|
|
69
|
-
jarvis/jarvis_tools/edit_file.py,sha256=
|
|
64
|
+
jarvis/jarvis_tools/edit_file.py,sha256=zwRRfO17VeyZn1b1p7223LJX_nYvBzsjUbfbzNgn4Lk,16266
|
|
70
65
|
jarvis/jarvis_tools/execute_script.py,sha256=cc0NlPwhkZinEexqT63d1ofEkzQddVWGsZOCVL1v_60,5739
|
|
71
66
|
jarvis/jarvis_tools/file_analyzer.py,sha256=tzU1cPKyDa54hVZewP0bDzdsjvdjGQ1BRt5k8N4li3s,4868
|
|
72
67
|
jarvis/jarvis_tools/file_operation.py,sha256=lP8EpsnSdA3FW8ofSAdoA8qPGMAG3UhYd6LFEzOFUVY,9044
|
|
73
68
|
jarvis/jarvis_tools/find_methodology.py,sha256=FwGKSV4fHNkiAnaVUwP8GkqXl8PEqMPZBxAyvTSPFGA,2438
|
|
74
69
|
jarvis/jarvis_tools/generate_new_tool.py,sha256=ctpkHBihsHhO6sLpF5lJue244EFJtdEQMuxR-_oV9r4,10282
|
|
75
|
-
jarvis/jarvis_tools/lsp_get_diagnostics.py,sha256=paz1CVZ2Y8nk0U74n1QiG01oDINiZqpVlPc2f4_B150,5346
|
|
76
70
|
jarvis/jarvis_tools/methodology.py,sha256=Md8W2et0xUiuTjUSRCdnlwEPYqah2dCAAkxW_95BXBY,5238
|
|
77
|
-
jarvis/jarvis_tools/read_code.py,sha256=
|
|
71
|
+
jarvis/jarvis_tools/read_code.py,sha256=dOG7bafutOhjLiU7NH-o7E_o6pJrXH98SAGRJ36Yj9Q,5897
|
|
78
72
|
jarvis/jarvis_tools/read_webpage.py,sha256=LLvAOvaQJodaeNJKQ6dU9MYEE227NMdHyLs7esluUQ4,2217
|
|
79
|
-
jarvis/jarvis_tools/registry.py,sha256=
|
|
73
|
+
jarvis/jarvis_tools/registry.py,sha256=nza8W0S0UBKt18SO1Y8UH1R0PhAzN3T4WLp0evFhjmk,23819
|
|
80
74
|
jarvis/jarvis_tools/rewrite_file.py,sha256=rEPPSNU7uF1iKfEW9npEpZJ2LSoQXjt2OC-_troBToE,7003
|
|
81
75
|
jarvis/jarvis_tools/search_web.py,sha256=-h1WYOqTcYC_8fdkm-4RfwKpbtLTVxOfRROul51NgO0,951
|
|
82
76
|
jarvis/jarvis_tools/virtual_tty.py,sha256=AKAaKY5KcPxifNQoXjzHaL4U6EUVA7irHLwVvz2wLVs,16396
|
|
83
77
|
jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
|
-
jarvis/jarvis_tools/cli/main.py,sha256=
|
|
78
|
+
jarvis/jarvis_tools/cli/main.py,sha256=FkBUh7TgvZu6CZfQAKdu0zYm27fSfA6OK4H_m8h_4Mw,6354
|
|
85
79
|
jarvis/jarvis_utils/__init__.py,sha256=l-fsyQ-KzyqAhrJYur8eZAqsgaifGzSm24R2qtRGJ0g,849
|
|
86
80
|
jarvis/jarvis_utils/builtin_replace_map.py,sha256=A-cJ8deht2vDl2iKRhoZ7qECyJ6sboVH5Zx-L9vIBUs,4314
|
|
87
|
-
jarvis/jarvis_utils/config.py,sha256=
|
|
81
|
+
jarvis/jarvis_utils/config.py,sha256=WXjBopB9K4V1Y4oRT-wKoDnHAMMknWieS6j7galr9Uc,4987
|
|
88
82
|
jarvis/jarvis_utils/embedding.py,sha256=s7ze8-talEED9VXZm1QK5tPdfyj6sXJLP031tDkXeI4,3831
|
|
89
83
|
jarvis/jarvis_utils/file_processors.py,sha256=tSZSMJ4qCJ_lXI0dyLgJ0j5qEh6CDXDSVI7vQiFmcuQ,2976
|
|
90
84
|
jarvis/jarvis_utils/git_utils.py,sha256=MxhUcQ_gFUFyBxBiorEJ1wUk9a2TerFdq3-Z11FB-AE,11324
|
|
91
85
|
jarvis/jarvis_utils/globals.py,sha256=Zs0chxA_giYiolYvawFFpcnTWgCUnn6GEusAh42jbz8,2275
|
|
92
86
|
jarvis/jarvis_utils/input.py,sha256=qGf2q-yWhgT-OX-j_WYi7aZ11jYmuFNiMz2_W1nUOiM,7432
|
|
93
87
|
jarvis/jarvis_utils/methodology.py,sha256=9dmtj6Ei2CRUdQP9TA_xToqZPYcm5_DQovwnRkEShsA,8626
|
|
94
|
-
jarvis/jarvis_utils/output.py,sha256=
|
|
88
|
+
jarvis/jarvis_utils/output.py,sha256=jrZMPl4RGaw8i-IFN4JwkH3wB9QDl002Car5eENDE9c,9657
|
|
95
89
|
jarvis/jarvis_utils/tag.py,sha256=YJHmuedLb7_AiqvKQetHr4R1FxyzIh7HN0RRkWMmYbU,429
|
|
96
|
-
jarvis/jarvis_utils/utils.py,sha256=
|
|
97
|
-
jarvis_ai_assistant-0.1.
|
|
98
|
-
jarvis_ai_assistant-0.1.
|
|
99
|
-
jarvis_ai_assistant-0.1.
|
|
100
|
-
jarvis_ai_assistant-0.1.
|
|
101
|
-
jarvis_ai_assistant-0.1.
|
|
102
|
-
jarvis_ai_assistant-0.1.
|
|
90
|
+
jarvis/jarvis_utils/utils.py,sha256=yXSSQwgwho3MpQWvJN1uRvRPsFvkKqhvQrbDz3ZyyxU,5390
|
|
91
|
+
jarvis_ai_assistant-0.1.178.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
92
|
+
jarvis_ai_assistant-0.1.178.dist-info/METADATA,sha256=GbQKDI_cLEPQef7UGEZriP5xuv1JxnsY7OMDge1BGTY,14629
|
|
93
|
+
jarvis_ai_assistant-0.1.178.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
94
|
+
jarvis_ai_assistant-0.1.178.dist-info/entry_points.txt,sha256=rjj61tZ7ahLi1R-JkJmX-IzIPPHD8mnwDZap1CnMe2s,973
|
|
95
|
+
jarvis_ai_assistant-0.1.178.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
96
|
+
jarvis_ai_assistant-0.1.178.dist-info/RECORD,,
|
jarvis/jarvis_lsp/base.py
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from abc import ABC, abstractmethod
|
|
3
|
-
from typing import List, Dict, Any, Union
|
|
4
|
-
|
|
5
|
-
class BaseLSP(ABC):
|
|
6
|
-
"""Base class for Language Server Protocol integration.
|
|
7
|
-
|
|
8
|
-
Core LSP features needed for LLM-based code editing:
|
|
9
|
-
1. Code navigation and analysis
|
|
10
|
-
2. Code modification validation
|
|
11
|
-
3. Diagnostic information
|
|
12
|
-
4. Symbol analysis
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
language: Union[str, List[str]] = "" # Language identifier, should be overridden by subclasses
|
|
16
|
-
|
|
17
|
-
@abstractmethod
|
|
18
|
-
def initialize(self, workspace_path: str) -> bool:
|
|
19
|
-
"""Initialize LSP server for the workspace.
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
workspace_path: Root path of the workspace
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
bool: True if initialization successful
|
|
26
|
-
"""
|
|
27
|
-
return False
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@abstractmethod
|
|
31
|
-
def get_diagnostics(self, file_path: str) -> List[Dict[str, Any]]:
|
|
32
|
-
"""Get diagnostics (errors, warnings) for file.
|
|
33
|
-
|
|
34
|
-
Args:
|
|
35
|
-
file_path: Path to the file
|
|
36
|
-
|
|
37
|
-
Returns:
|
|
38
|
-
List of diagnostic items:
|
|
39
|
-
[
|
|
40
|
-
{
|
|
41
|
-
"range": {
|
|
42
|
-
"start": {"line": int, "character": int},
|
|
43
|
-
"end": {"line": int, "character": int}
|
|
44
|
-
},
|
|
45
|
-
"severity": 1 | 2 | 3 | 4, # Error=1, Warning=2, Info=3, Hint=4
|
|
46
|
-
"code": str, # Error code if any
|
|
47
|
-
"source": str, # Source of diagnostic (e.g. "pylint")
|
|
48
|
-
"message": str, # Diagnostic message
|
|
49
|
-
"relatedInformation": [ # Optional related info
|
|
50
|
-
{
|
|
51
|
-
"location": {
|
|
52
|
-
"uri": str,
|
|
53
|
-
"range": {...}
|
|
54
|
-
},
|
|
55
|
-
"message": str
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
"""
|
|
61
|
-
return []
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def shutdown(self):
|
|
65
|
-
"""Shutdown LSP server cleanly."""
|
|
66
|
-
pass
|
jarvis/jarvis_lsp/cpp.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
import os
|
|
3
|
-
import shutil
|
|
4
|
-
import subprocess
|
|
5
|
-
from typing import List, Dict, Optional, Any
|
|
6
|
-
import json
|
|
7
|
-
from jarvis.jarvis_lsp.base import BaseLSP
|
|
8
|
-
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
9
|
-
|
|
10
|
-
class CPPLSP(BaseLSP):
|
|
11
|
-
"""C++ LSP implementation using clangd."""
|
|
12
|
-
|
|
13
|
-
language = ["cpp", "c"]
|
|
14
|
-
|
|
15
|
-
@staticmethod
|
|
16
|
-
def check() -> bool:
|
|
17
|
-
"""Check if clangd is installed."""
|
|
18
|
-
return shutil.which("clangd") is not None
|
|
19
|
-
|
|
20
|
-
def __init__(self):
|
|
21
|
-
self.workspace_path = ""
|
|
22
|
-
self.clangd_process = None
|
|
23
|
-
self.request_id = 0
|
|
24
|
-
|
|
25
|
-
def initialize(self, workspace_path: str) -> bool:
|
|
26
|
-
try:
|
|
27
|
-
self.workspace_path = workspace_path
|
|
28
|
-
# Start clangd process
|
|
29
|
-
self.clangd_process = subprocess.Popen(
|
|
30
|
-
["clangd", "--background-index"],
|
|
31
|
-
stdin=subprocess.PIPE,
|
|
32
|
-
stdout=subprocess.PIPE,
|
|
33
|
-
stderr=subprocess.PIPE
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
# Send initialize request
|
|
37
|
-
self._send_request("initialize", {
|
|
38
|
-
"processId": os.getpid(),
|
|
39
|
-
"rootUri": f"file://{workspace_path}",
|
|
40
|
-
"capabilities": {}
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
return True
|
|
44
|
-
except Exception as e:
|
|
45
|
-
PrettyOutput.print(f"C++ LSP 初始化失败: {str(e)}", OutputType.ERROR)
|
|
46
|
-
return False
|
|
47
|
-
|
|
48
|
-
def _send_request(self, method: str, params: Dict) -> Optional[Dict]:
|
|
49
|
-
"""Send JSON-RPC request to clangd."""
|
|
50
|
-
if not self.clangd_process:
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
try:
|
|
54
|
-
self.request_id += 1
|
|
55
|
-
request = {
|
|
56
|
-
"jsonrpc": "2.0",
|
|
57
|
-
"id": self.request_id,
|
|
58
|
-
"method": method,
|
|
59
|
-
"params": params
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
self.clangd_process.stdin.write(json.dumps(request).encode() + b"\n") # type: ignore
|
|
63
|
-
self.clangd_process.stdin.flush() # type: ignore
|
|
64
|
-
|
|
65
|
-
response = json.loads(self.clangd_process.stdout.readline().decode()) # type: ignore
|
|
66
|
-
return response.get("result")
|
|
67
|
-
except Exception:
|
|
68
|
-
return None
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def get_diagnostics(self, file_path: str) -> List[Dict[str, Any]]:
|
|
72
|
-
# Send didOpen notification to trigger diagnostics
|
|
73
|
-
self._send_request("textDocument/didOpen", {
|
|
74
|
-
"textDocument": {
|
|
75
|
-
"uri": f"file://{file_path}",
|
|
76
|
-
"languageId": "cpp",
|
|
77
|
-
"version": 1,
|
|
78
|
-
"text": open(file_path).read()
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
# Wait for diagnostic notification
|
|
83
|
-
try:
|
|
84
|
-
response = json.loads(self.clangd_process.stdout.readline().decode()) # type: ignore
|
|
85
|
-
if response.get("method") == "textDocument/publishDiagnostics":
|
|
86
|
-
return response.get("params", {}).get("diagnostics", [])
|
|
87
|
-
except Exception:
|
|
88
|
-
pass
|
|
89
|
-
return []
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def shutdown(self):
|
|
93
|
-
if self.clangd_process:
|
|
94
|
-
try:
|
|
95
|
-
self._send_request("shutdown", {})
|
|
96
|
-
self.clangd_process.terminate()
|
|
97
|
-
self.clangd_process = None
|
|
98
|
-
except Exception:
|
|
99
|
-
pass
|
jarvis/jarvis_lsp/go.py
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
import os
|
|
3
|
-
import shutil
|
|
4
|
-
import subprocess
|
|
5
|
-
from typing import List, Dict, Optional, Any
|
|
6
|
-
import json
|
|
7
|
-
from jarvis.jarvis_lsp.base import BaseLSP
|
|
8
|
-
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
9
|
-
|
|
10
|
-
class GoLSP(BaseLSP):
|
|
11
|
-
"""Go LSP implementation using gopls."""
|
|
12
|
-
|
|
13
|
-
language = "go"
|
|
14
|
-
|
|
15
|
-
@staticmethod
|
|
16
|
-
def check() -> bool:
|
|
17
|
-
"""Check if gopls is installed."""
|
|
18
|
-
return shutil.which("gopls") is not None
|
|
19
|
-
|
|
20
|
-
def __init__(self):
|
|
21
|
-
self.workspace_path = ""
|
|
22
|
-
self.gopls_process = None
|
|
23
|
-
self.request_id = 0
|
|
24
|
-
|
|
25
|
-
def initialize(self, workspace_path: str) -> bool:
|
|
26
|
-
try:
|
|
27
|
-
self.workspace_path = workspace_path
|
|
28
|
-
# Start gopls process
|
|
29
|
-
self.gopls_process = subprocess.Popen(
|
|
30
|
-
["gopls", "serve"],
|
|
31
|
-
stdin=subprocess.PIPE,
|
|
32
|
-
stdout=subprocess.PIPE,
|
|
33
|
-
stderr=subprocess.PIPE
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
# Send initialize request
|
|
37
|
-
self._send_request("initialize", {
|
|
38
|
-
"processId": os.getpid(),
|
|
39
|
-
"rootUri": f"file://{workspace_path}",
|
|
40
|
-
"capabilities": {
|
|
41
|
-
"textDocument": {
|
|
42
|
-
"hover": {"contentFormat": ["markdown", "plaintext"]},
|
|
43
|
-
"completion": {"completionItem": {"snippetSupport": True}},
|
|
44
|
-
"signatureHelp": {"signatureInformation": {"documentationFormat": ["markdown", "plaintext"]}},
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
return True
|
|
50
|
-
except Exception as e:
|
|
51
|
-
PrettyOutput.print(f"Go LSP 初始化失败: {str(e)}", OutputType.ERROR)
|
|
52
|
-
return False
|
|
53
|
-
|
|
54
|
-
def _send_request(self, method: str, params: Dict) -> Optional[Dict]:
|
|
55
|
-
"""Send JSON-RPC request to gopls."""
|
|
56
|
-
if not self.gopls_process:
|
|
57
|
-
return None
|
|
58
|
-
|
|
59
|
-
try:
|
|
60
|
-
self.request_id += 1
|
|
61
|
-
request = {
|
|
62
|
-
"jsonrpc": "2.0",
|
|
63
|
-
"id": self.request_id,
|
|
64
|
-
"method": method,
|
|
65
|
-
"params": params
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
self.gopls_process.stdin.write(json.dumps(request).encode() + b"\n") # type: ignore
|
|
69
|
-
self.gopls_process.stdin.flush() # type: ignore
|
|
70
|
-
|
|
71
|
-
response = json.loads(self.gopls_process.stdout.readline().decode()) # type: ignore
|
|
72
|
-
return response.get("result")
|
|
73
|
-
except Exception:
|
|
74
|
-
return None
|
|
75
|
-
|
|
76
|
-
def get_diagnostics(self, file_path: str) -> List[Dict[str, Any]]:
|
|
77
|
-
# Send didOpen notification to trigger diagnostics
|
|
78
|
-
self._send_request("textDocument/didOpen", {
|
|
79
|
-
"textDocument": {
|
|
80
|
-
"uri": f"file://{file_path}",
|
|
81
|
-
"languageId": "go",
|
|
82
|
-
"version": 1,
|
|
83
|
-
"text": open(file_path).read()
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
# Wait for diagnostic notification
|
|
88
|
-
try:
|
|
89
|
-
response = json.loads(self.gopls_process.stdout.readline().decode()) # type: ignore
|
|
90
|
-
if response.get("method") == "textDocument/publishDiagnostics":
|
|
91
|
-
return response.get("params", {}).get("diagnostics", [])
|
|
92
|
-
except Exception:
|
|
93
|
-
pass
|
|
94
|
-
return []
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def shutdown(self):
|
|
98
|
-
if self.gopls_process:
|
|
99
|
-
try:
|
|
100
|
-
self._send_request("shutdown", {})
|
|
101
|
-
self.gopls_process.terminate()
|
|
102
|
-
self.gopls_process = None
|
|
103
|
-
except Exception:
|
|
104
|
-
pass
|
jarvis/jarvis_lsp/python.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from typing import List, Dict, Any
|
|
3
|
-
import jedi
|
|
4
|
-
from jarvis.jarvis_lsp.base import BaseLSP
|
|
5
|
-
|
|
6
|
-
class PythonLSP(BaseLSP):
|
|
7
|
-
"""Python LSP implementation using jedi."""
|
|
8
|
-
|
|
9
|
-
language = "python"
|
|
10
|
-
|
|
11
|
-
def __init__(self):
|
|
12
|
-
self.workspace_path = ""
|
|
13
|
-
self.script_cache = {}
|
|
14
|
-
|
|
15
|
-
def initialize(self, workspace_path: str) -> bool:
|
|
16
|
-
self.workspace_path = workspace_path
|
|
17
|
-
return True
|
|
18
|
-
|
|
19
|
-
def _get_script(self, file_path: str):
|
|
20
|
-
if file_path not in self.script_cache:
|
|
21
|
-
try:
|
|
22
|
-
with open(file_path, 'r', errors="ignore") as f:
|
|
23
|
-
content = f.read()
|
|
24
|
-
self.script_cache[file_path] = jedi.Script(code=content, path=file_path)
|
|
25
|
-
except Exception:
|
|
26
|
-
return None
|
|
27
|
-
return self.script_cache[file_path]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _location_to_dict(self, location) -> Dict[str, Any]:
|
|
31
|
-
return {
|
|
32
|
-
"uri": location.module_path,
|
|
33
|
-
"range": {
|
|
34
|
-
"start": {"line": location.line - 1, "character": location.column},
|
|
35
|
-
"end": {"line": location.line - 1, "character": location.column + len(location.name)}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
def get_diagnostics(self, file_path: str) -> List[Dict[str, Any]]:
|
|
40
|
-
script = self._get_script(file_path)
|
|
41
|
-
if not script:
|
|
42
|
-
return []
|
|
43
|
-
try:
|
|
44
|
-
errors = script.get_syntax_errors()
|
|
45
|
-
return [{
|
|
46
|
-
"range": {
|
|
47
|
-
"start": {"line": e.line - 1, "character": e.column},
|
|
48
|
-
"end": {"line": e.line - 1, "character": e.column + 1}
|
|
49
|
-
},
|
|
50
|
-
"severity": 1, # Error
|
|
51
|
-
"source": "jedi",
|
|
52
|
-
"message": str(e)
|
|
53
|
-
} for e in errors]
|
|
54
|
-
except Exception:
|
|
55
|
-
return []
|
|
56
|
-
|
|
57
|
-
def shutdown(self):
|
|
58
|
-
self.script_cache.clear()
|