jarvis-ai-assistant 0.1.162__py3-none-any.whl → 0.1.164__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 +23 -4
- jarvis/jarvis_agent/output_handler.py +27 -3
- jarvis/jarvis_code_agent/code_agent.py +123 -160
- jarvis/jarvis_dev/main.py +6 -0
- jarvis/jarvis_git_details/main.py +2 -1
- jarvis/jarvis_multi_agent/__init__.py +2 -3
- jarvis/jarvis_platform/base.py +0 -2
- jarvis/jarvis_platform/yuanbao.py +1 -0
- jarvis/jarvis_tools/edit_file.py +236 -526
- jarvis/jarvis_tools/file_operation.py +0 -2
- jarvis/jarvis_tools/read_code.py +0 -2
- jarvis/jarvis_tools/rewrite_file.py +183 -0
- jarvis/jarvis_utils/git_utils.py +144 -0
- jarvis/jarvis_utils/globals.py +0 -29
- jarvis/jarvis_utils/methodology.py +15 -9
- {jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/METADATA +13 -2
- {jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/RECORD +22 -21
- {jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/WHEEL +1 -1
- {jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,6 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
from yaspin import yaspin # type: ignore
|
|
6
6
|
|
|
7
|
-
from jarvis.jarvis_utils.globals import add_read_file_record
|
|
8
7
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
9
8
|
# 导入文件处理器
|
|
10
9
|
from jarvis.jarvis_utils.file_processors import (
|
|
@@ -57,7 +56,6 @@ class FileOperationTool:
|
|
|
57
56
|
"""Handle operations for a single file"""
|
|
58
57
|
try:
|
|
59
58
|
abs_path = os.path.abspath(filepath)
|
|
60
|
-
add_read_file_record(abs_path)
|
|
61
59
|
|
|
62
60
|
if operation == "read":
|
|
63
61
|
with yaspin(text=f"正在读取文件: {abs_path}...", color="cyan") as spinner:
|
jarvis/jarvis_tools/read_code.py
CHANGED
|
@@ -3,7 +3,6 @@ import os
|
|
|
3
3
|
|
|
4
4
|
from yaspin import yaspin
|
|
5
5
|
|
|
6
|
-
from jarvis.jarvis_utils.globals import add_read_file_record
|
|
7
6
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
8
7
|
|
|
9
8
|
class ReadCodeTool:
|
|
@@ -43,7 +42,6 @@ class ReadCodeTool:
|
|
|
43
42
|
"""
|
|
44
43
|
try:
|
|
45
44
|
abs_path = os.path.abspath(filepath)
|
|
46
|
-
add_read_file_record(abs_path)
|
|
47
45
|
with yaspin(text=f"正在读取文件: {abs_path}...", color="cyan") as spinner:
|
|
48
46
|
# 文件存在性检查
|
|
49
47
|
if not os.path.exists(abs_path):
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""
|
|
2
|
+
文件重写工具类
|
|
3
|
+
|
|
4
|
+
功能概述:
|
|
5
|
+
1. 提供完整的文件重写功能
|
|
6
|
+
2. 支持创建新文件或完全重写现有文件
|
|
7
|
+
3. 实现原子操作:所有修改要么全部成功,要么全部回滚
|
|
8
|
+
4. 自动创建所需目录结构
|
|
9
|
+
|
|
10
|
+
核心特性:
|
|
11
|
+
- 支持不存在的文件和空文件处理
|
|
12
|
+
- 自动创建所需目录结构
|
|
13
|
+
- 完善的错误处理和回滚机制
|
|
14
|
+
- 保持文件格式和编码
|
|
15
|
+
"""
|
|
16
|
+
from typing import Any, Dict
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class FileRewriteTool:
|
|
20
|
+
name = "rewrite_file"
|
|
21
|
+
description = """文件重写工具,用于完全重写或创建文件
|
|
22
|
+
|
|
23
|
+
# 文件重写规范
|
|
24
|
+
|
|
25
|
+
## 重要提示
|
|
26
|
+
此工具用于完全重写文件内容或创建新文件。与edit_file不同,此工具会替换文件的全部内容。
|
|
27
|
+
|
|
28
|
+
## 基本使用
|
|
29
|
+
1. 指定需要重写的文件路径
|
|
30
|
+
2. 提供新的文件内容
|
|
31
|
+
3. 所有操作要么全部成功,要么全部失败并回滚
|
|
32
|
+
|
|
33
|
+
## 核心原则
|
|
34
|
+
1. **完整重写**:提供完整的文件内容,将替换原文件的所有内容
|
|
35
|
+
2. **格式保持**:
|
|
36
|
+
- 保持原始代码的缩进方式(空格或制表符)
|
|
37
|
+
- 保持原始代码的空行数量和位置
|
|
38
|
+
- 保持原始代码的行尾空格处理方式
|
|
39
|
+
- 不改变原始代码的换行风格
|
|
40
|
+
|
|
41
|
+
## 最佳实践
|
|
42
|
+
1. 确保提供格式良好的完整文件内容
|
|
43
|
+
2. 创建新文件时提供完整、格式良好的内容
|
|
44
|
+
3. 不要出现未实现的代码,如:TODO
|
|
45
|
+
"""
|
|
46
|
+
parameters = {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"properties": {
|
|
49
|
+
"file": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "需要重写的文件路径"
|
|
52
|
+
},
|
|
53
|
+
"content": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "新的文件内容,将完全替换原文件内容"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": ["file", "content"]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
def __init__(self):
|
|
62
|
+
"""初始化文件重写工具"""
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
def execute(self, args: Dict) -> Dict[str, Any]:
|
|
66
|
+
"""
|
|
67
|
+
执行文件重写操作,完全替换文件内容
|
|
68
|
+
|
|
69
|
+
参数:
|
|
70
|
+
file (str): 文件路径
|
|
71
|
+
content (str): 新的文件内容
|
|
72
|
+
|
|
73
|
+
返回:
|
|
74
|
+
dict: 包含执行结果的字典
|
|
75
|
+
{
|
|
76
|
+
"success": bool, # 是否成功完成重写
|
|
77
|
+
"stdout": str, # 标准输出信息
|
|
78
|
+
"stderr": str # 错误信息
|
|
79
|
+
}
|
|
80
|
+
"""
|
|
81
|
+
import os
|
|
82
|
+
from jarvis.jarvis_utils.output import PrettyOutput, OutputType
|
|
83
|
+
|
|
84
|
+
stdout_messages = []
|
|
85
|
+
stderr_messages = []
|
|
86
|
+
success = True
|
|
87
|
+
|
|
88
|
+
file_path = args["file"]
|
|
89
|
+
new_content = args["content"]
|
|
90
|
+
|
|
91
|
+
# 创建已处理文件变量,用于失败时回滚
|
|
92
|
+
original_content = None
|
|
93
|
+
processed = False
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
file_exists = os.path.exists(file_path)
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
# 如果文件存在,则读取原内容用于回滚
|
|
100
|
+
if file_exists:
|
|
101
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
102
|
+
original_content = f.read()
|
|
103
|
+
|
|
104
|
+
# 确保目录存在
|
|
105
|
+
os.makedirs(os.path.dirname(os.path.abspath(file_path)), exist_ok=True)
|
|
106
|
+
|
|
107
|
+
# 写入新内容
|
|
108
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
|
109
|
+
f.write(new_content)
|
|
110
|
+
|
|
111
|
+
processed = True
|
|
112
|
+
|
|
113
|
+
action = "创建并写入" if not file_exists else "成功重写"
|
|
114
|
+
stdout_message = f"文件 {file_path} {action}"
|
|
115
|
+
stdout_messages.append(stdout_message)
|
|
116
|
+
PrettyOutput.print(stdout_message, OutputType.SUCCESS)
|
|
117
|
+
|
|
118
|
+
except Exception as e:
|
|
119
|
+
stderr_message = f"处理文件 {file_path} 时出错: {str(e)}"
|
|
120
|
+
stderr_messages.append(stderr_message)
|
|
121
|
+
PrettyOutput.print(stderr_message, OutputType.WARNING)
|
|
122
|
+
success = False
|
|
123
|
+
|
|
124
|
+
# 如果操作失败,回滚已修改的文件
|
|
125
|
+
if not success and processed:
|
|
126
|
+
rollback_message = "操作失败,正在回滚修改..."
|
|
127
|
+
stderr_messages.append(rollback_message)
|
|
128
|
+
PrettyOutput.print(rollback_message, OutputType.WARNING)
|
|
129
|
+
|
|
130
|
+
try:
|
|
131
|
+
if original_content is None:
|
|
132
|
+
# 如果是新创建的文件,则删除
|
|
133
|
+
if os.path.exists(file_path):
|
|
134
|
+
os.remove(file_path)
|
|
135
|
+
rollback_file_message = f"已删除新创建的文件: {file_path}"
|
|
136
|
+
else:
|
|
137
|
+
# 如果是修改的文件,则恢复原内容
|
|
138
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
|
139
|
+
f.write(original_content)
|
|
140
|
+
rollback_file_message = f"已回滚文件: {file_path}"
|
|
141
|
+
|
|
142
|
+
stderr_messages.append(rollback_file_message)
|
|
143
|
+
PrettyOutput.print(rollback_file_message, OutputType.INFO)
|
|
144
|
+
except Exception as e:
|
|
145
|
+
rollback_error = f"回滚文件 {file_path} 失败: {str(e)}"
|
|
146
|
+
stderr_messages.append(rollback_error)
|
|
147
|
+
PrettyOutput.print(rollback_error, OutputType.WARNING)
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
"success": success,
|
|
151
|
+
"stdout": "\n".join(stdout_messages),
|
|
152
|
+
"stderr": "\n".join(stderr_messages)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
except Exception as e:
|
|
156
|
+
error_msg = f"文件重写操作失败: {str(e)}"
|
|
157
|
+
PrettyOutput.print(error_msg, OutputType.WARNING)
|
|
158
|
+
|
|
159
|
+
# 如果有已修改的文件,尝试回滚
|
|
160
|
+
if processed:
|
|
161
|
+
rollback_message = "操作失败,正在回滚修改..."
|
|
162
|
+
stderr_messages.append(rollback_message)
|
|
163
|
+
PrettyOutput.print(rollback_message, OutputType.WARNING)
|
|
164
|
+
|
|
165
|
+
try:
|
|
166
|
+
if original_content is None:
|
|
167
|
+
# 如果是新创建的文件,则删除
|
|
168
|
+
if os.path.exists(file_path):
|
|
169
|
+
os.remove(file_path)
|
|
170
|
+
stderr_messages.append(f"已删除新创建的文件: {file_path}")
|
|
171
|
+
else:
|
|
172
|
+
# 如果是修改的文件,则恢复原内容
|
|
173
|
+
with open(file_path, 'w', encoding='utf-8') as f:
|
|
174
|
+
f.write(original_content)
|
|
175
|
+
stderr_messages.append(f"已回滚文件: {file_path}")
|
|
176
|
+
except:
|
|
177
|
+
stderr_messages.append(f"回滚文件失败: {file_path}")
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
"success": False,
|
|
181
|
+
"stdout": "",
|
|
182
|
+
"stderr": error_msg + "\n" + "\n".join(stderr_messages)
|
|
183
|
+
}
|
jarvis/jarvis_utils/git_utils.py
CHANGED
|
@@ -12,7 +12,9 @@ import os
|
|
|
12
12
|
import re
|
|
13
13
|
import subprocess
|
|
14
14
|
from typing import List, Tuple, Dict
|
|
15
|
+
from jarvis.jarvis_utils.config import is_confirm_before_apply_patch
|
|
15
16
|
from jarvis.jarvis_utils.output import PrettyOutput, OutputType
|
|
17
|
+
from jarvis.jarvis_utils.utils import user_confirm
|
|
16
18
|
def find_git_root(start_dir: str = ".") -> str:
|
|
17
19
|
"""
|
|
18
20
|
切换到给定路径的Git根目录,如果不是Git仓库则初始化。
|
|
@@ -92,6 +94,130 @@ def get_commits_between(start_hash: str, end_hash: str) -> List[Tuple[str, str]]
|
|
|
92
94
|
except Exception as e:
|
|
93
95
|
PrettyOutput.print(f"获取commit历史异常: {str(e)}", OutputType.ERROR)
|
|
94
96
|
return []
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# 修改后的获取差异函数
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def get_diff() -> str:
|
|
103
|
+
"""使用git获取暂存区差异"""
|
|
104
|
+
import subprocess
|
|
105
|
+
|
|
106
|
+
# 初始化状态
|
|
107
|
+
need_reset = False
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
# 暂存所有修改
|
|
111
|
+
subprocess.run(['git', 'add', '.'], check=True)
|
|
112
|
+
need_reset = True
|
|
113
|
+
|
|
114
|
+
# 获取差异
|
|
115
|
+
result = subprocess.run(
|
|
116
|
+
['git', 'diff', '--cached'],
|
|
117
|
+
capture_output=True,
|
|
118
|
+
text=False,
|
|
119
|
+
check=True
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# 解码输出
|
|
123
|
+
try:
|
|
124
|
+
ret = result.stdout.decode('utf-8')
|
|
125
|
+
except UnicodeDecodeError:
|
|
126
|
+
ret = result.stdout.decode('utf-8', errors='replace')
|
|
127
|
+
|
|
128
|
+
# 重置暂存区
|
|
129
|
+
subprocess.run(['git', "reset", "--mixed"], check=False)
|
|
130
|
+
return ret
|
|
131
|
+
|
|
132
|
+
except subprocess.CalledProcessError as e:
|
|
133
|
+
if need_reset:
|
|
134
|
+
subprocess.run(['git', "reset", "--mixed"], check=False)
|
|
135
|
+
return f"获取差异失败: {str(e)}"
|
|
136
|
+
except Exception as e:
|
|
137
|
+
if need_reset:
|
|
138
|
+
subprocess.run(['git', "reset", "--mixed"], check=False)
|
|
139
|
+
return f"发生意外错误: {str(e)}"
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def revert_file(filepath: str):
|
|
146
|
+
"""增强版git恢复,处理新文件"""
|
|
147
|
+
import subprocess
|
|
148
|
+
try:
|
|
149
|
+
# 检查文件是否在版本控制中
|
|
150
|
+
result = subprocess.run(
|
|
151
|
+
['git', 'ls-files', '--error-unmatch', filepath],
|
|
152
|
+
stderr=subprocess.PIPE,
|
|
153
|
+
text=False # 禁用自动文本解码
|
|
154
|
+
)
|
|
155
|
+
if result.returncode == 0:
|
|
156
|
+
subprocess.run(['git', 'checkout', 'HEAD',
|
|
157
|
+
'--', filepath], check=True)
|
|
158
|
+
else:
|
|
159
|
+
if os.path.exists(filepath):
|
|
160
|
+
os.remove(filepath)
|
|
161
|
+
subprocess.run(['git', 'clean', '-f', '--', filepath], check=True)
|
|
162
|
+
except subprocess.CalledProcessError as e:
|
|
163
|
+
error_msg = e.stderr.decode('utf-8', errors='replace') if e.stderr else str(e)
|
|
164
|
+
PrettyOutput.print(f"恢复文件失败: {error_msg}", OutputType.ERROR)
|
|
165
|
+
# 修改后的恢复函数
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def revert_change():
|
|
169
|
+
"""恢复所有未提交的修改到HEAD状态"""
|
|
170
|
+
import subprocess
|
|
171
|
+
try:
|
|
172
|
+
# 检查是否为空仓库
|
|
173
|
+
head_check = subprocess.run(
|
|
174
|
+
['git', 'rev-parse', '--verify', 'HEAD'],
|
|
175
|
+
stderr=subprocess.PIPE,
|
|
176
|
+
stdout=subprocess.PIPE
|
|
177
|
+
)
|
|
178
|
+
if head_check.returncode == 0:
|
|
179
|
+
subprocess.run(['git', 'reset', '--hard', 'HEAD'], check=True)
|
|
180
|
+
subprocess.run(['git', 'clean', '-fd'], check=True)
|
|
181
|
+
except subprocess.CalledProcessError as e:
|
|
182
|
+
return f"恢复更改失败: {str(e)}"
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def handle_commit_workflow() -> bool:
|
|
186
|
+
"""Handle the git commit workflow and return the commit details.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
bool: 提交是否成功
|
|
190
|
+
"""
|
|
191
|
+
if is_confirm_before_apply_patch() and not user_confirm("是否要提交代码?", default=True):
|
|
192
|
+
revert_change()
|
|
193
|
+
return False
|
|
194
|
+
|
|
195
|
+
import subprocess
|
|
196
|
+
try:
|
|
197
|
+
# 获取当前分支的提交总数
|
|
198
|
+
commit_count = subprocess.run(
|
|
199
|
+
['git', 'rev-list', '--count', 'HEAD'],
|
|
200
|
+
capture_output=True,
|
|
201
|
+
text=True
|
|
202
|
+
)
|
|
203
|
+
if commit_count.returncode != 0:
|
|
204
|
+
return False
|
|
205
|
+
|
|
206
|
+
commit_count = int(commit_count.stdout.strip())
|
|
207
|
+
|
|
208
|
+
# 暂存所有修改
|
|
209
|
+
subprocess.run(['git', 'add', '.'], check=True)
|
|
210
|
+
|
|
211
|
+
# 提交变更
|
|
212
|
+
subprocess.run(
|
|
213
|
+
['git', 'commit', '-m', f'CheckPoint #{commit_count + 1}'],
|
|
214
|
+
check=True
|
|
215
|
+
)
|
|
216
|
+
return True
|
|
217
|
+
except subprocess.CalledProcessError as e:
|
|
218
|
+
return False
|
|
219
|
+
|
|
220
|
+
|
|
95
221
|
def get_latest_commit_hash() -> str:
|
|
96
222
|
"""获取当前Git仓库的最新提交哈希值
|
|
97
223
|
|
|
@@ -149,3 +275,21 @@ def get_modified_line_ranges() -> Dict[str, Tuple[int, int]]:
|
|
|
149
275
|
result[current_file] = (start_line, end_line)
|
|
150
276
|
|
|
151
277
|
return result
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def is_file_in_git_repo(filepath: str) -> bool:
|
|
282
|
+
"""检查文件是否在当前Git仓库中"""
|
|
283
|
+
import subprocess
|
|
284
|
+
try:
|
|
285
|
+
# 获取Git仓库根目录
|
|
286
|
+
repo_root = subprocess.run(
|
|
287
|
+
['git', 'rev-parse', '--show-toplevel'],
|
|
288
|
+
capture_output=True,
|
|
289
|
+
text=True
|
|
290
|
+
).stdout.strip()
|
|
291
|
+
|
|
292
|
+
# 检查文件路径是否在仓库根目录下
|
|
293
|
+
return os.path.abspath(filepath).startswith(os.path.abspath(repo_root))
|
|
294
|
+
except:
|
|
295
|
+
return False
|
jarvis/jarvis_utils/globals.py
CHANGED
|
@@ -17,7 +17,6 @@ colorama.init()
|
|
|
17
17
|
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
18
18
|
# 全局代理管理
|
|
19
19
|
global_agents: Set[str] = set()
|
|
20
|
-
global_read_files: Dict[str, Dict[str, int]] = {}
|
|
21
20
|
current_agent_name: str = ""
|
|
22
21
|
# 使用自定义主题配置rich控制台
|
|
23
22
|
custom_theme = Theme({
|
|
@@ -81,31 +80,3 @@ def delete_agent(agent_name: str) -> None:
|
|
|
81
80
|
global_agents.remove(agent_name)
|
|
82
81
|
global current_agent_name
|
|
83
82
|
current_agent_name = ""
|
|
84
|
-
|
|
85
|
-
def add_read_file_record(file_path: str):
|
|
86
|
-
if current_agent_name not in global_read_files:
|
|
87
|
-
global_read_files[current_agent_name] = {}
|
|
88
|
-
global_read_files[current_agent_name][file_path] = 10 # 初始计数设为10
|
|
89
|
-
|
|
90
|
-
def has_read_file(file_path: str) -> bool:
|
|
91
|
-
return not os.path.exists(file_path) or (
|
|
92
|
-
current_agent_name in global_read_files
|
|
93
|
-
and file_path in global_read_files[current_agent_name]
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
def clear_read_file_record():
|
|
97
|
-
global_read_files.pop(current_agent_name, None)
|
|
98
|
-
|
|
99
|
-
def decrease_read_file_counts():
|
|
100
|
-
"""减少当前agent的所有文件读取计数,删除计数为0的记录"""
|
|
101
|
-
if current_agent_name in global_read_files:
|
|
102
|
-
to_delete = []
|
|
103
|
-
for file_path, count in global_read_files[current_agent_name].items():
|
|
104
|
-
count -= 1
|
|
105
|
-
if count <= 0:
|
|
106
|
-
to_delete.append(file_path)
|
|
107
|
-
else:
|
|
108
|
-
global_read_files[current_agent_name][file_path] = count
|
|
109
|
-
|
|
110
|
-
for file_path in to_delete:
|
|
111
|
-
global_read_files[current_agent_name].pop(file_path, None)
|
|
@@ -135,14 +135,16 @@ def load_methodology(user_input: str) -> str:
|
|
|
135
135
|
|
|
136
136
|
# 添加用户输入和输出要求
|
|
137
137
|
full_content += f"""
|
|
138
|
-
|
|
138
|
+
请根据以上方法论内容,规划/总结出以下用户需求的执行步骤: {user_input}
|
|
139
139
|
|
|
140
140
|
请按以下格式回复:
|
|
141
141
|
### 与该任务/需求相关的方法论
|
|
142
142
|
1. [方法论名字]
|
|
143
143
|
2. [方法论名字]
|
|
144
|
-
###
|
|
145
|
-
[
|
|
144
|
+
### 根据以上方法论,规划/总结出执行步骤
|
|
145
|
+
1. [步骤1]
|
|
146
|
+
2. [步骤2]
|
|
147
|
+
3. [步骤3]
|
|
146
148
|
|
|
147
149
|
如果没有匹配的方法论,请输出:没有历史方法论可参考
|
|
148
150
|
除以上要求外,不要输出任何内容
|
|
@@ -172,14 +174,16 @@ def load_methodology(user_input: str) -> str:
|
|
|
172
174
|
if upload_success:
|
|
173
175
|
# 使用上传的文件生成摘要
|
|
174
176
|
return platform.chat_until_success(base_prompt + f"""
|
|
175
|
-
|
|
177
|
+
请根据已上传的方法论文件内容,规划/总结出以下用户需求的执行步骤: {user_input}
|
|
176
178
|
|
|
177
179
|
请按以下格式回复:
|
|
178
180
|
### 与该任务/需求相关的方法论
|
|
179
181
|
1. [方法论名字]
|
|
180
182
|
2. [方法论名字]
|
|
181
|
-
###
|
|
182
|
-
[
|
|
183
|
+
### 根据以上方法论,规划/总结出执行步骤
|
|
184
|
+
1. [步骤1]
|
|
185
|
+
2. [步骤2]
|
|
186
|
+
3. [步骤3]
|
|
183
187
|
|
|
184
188
|
如果没有匹配的方法论,请输出:没有历史方法论可参考
|
|
185
189
|
除以上要求外,不要输出任何内容
|
|
@@ -187,14 +191,16 @@ def load_methodology(user_input: str) -> str:
|
|
|
187
191
|
elif hasattr(platform, 'chat_big_content'):
|
|
188
192
|
# 如果上传失败但支持大内容处理,使用chat_big_content
|
|
189
193
|
return platform.chat_big_content(full_content, base_prompt + f"""
|
|
190
|
-
|
|
194
|
+
请根据以上方法论内容,规划/总结出以下用户需求的执行步骤: {user_input}
|
|
191
195
|
|
|
192
196
|
请按以下格式回复:
|
|
193
197
|
### 与该任务/需求相关的方法论
|
|
194
198
|
1. [方法论名字]
|
|
195
199
|
2. [方法论名字]
|
|
196
|
-
###
|
|
197
|
-
[
|
|
200
|
+
### 根据以上方法论,规划/总结出执行步骤
|
|
201
|
+
1. [步骤1]
|
|
202
|
+
2. [步骤2]
|
|
203
|
+
3. [步骤3]
|
|
198
204
|
|
|
199
205
|
如果没有匹配的方法论,请输出:没有历史方法论可参考
|
|
200
206
|
除以上要求外,不要输出任何内容
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jarvis-ai-assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.164
|
|
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
|
|
@@ -77,6 +77,7 @@ Dynamic: requires-python
|
|
|
77
77
|
|
|
78
78
|
*您的智能开发和系统交互助手*
|
|
79
79
|
|
|
80
|
+
[核心特色](#core-features) •
|
|
80
81
|
[视频介绍](#video-introduction) •
|
|
81
82
|
[快速开始](#quick-start) •
|
|
82
83
|
[配置说明](#configuration) •
|
|
@@ -89,6 +90,15 @@ Dynamic: requires-python
|
|
|
89
90
|
|
|
90
91
|
---
|
|
91
92
|
|
|
93
|
+
## 🌟 核心特色 <a id="core-features"></a>
|
|
94
|
+
|
|
95
|
+
- 🆓 零成本接入:无缝集成元宝、Kimi等优质模型,无需支付API费用,同时保留强大的文件处理、搜索和推理能力
|
|
96
|
+
- 🛠️ 工具驱动:内置丰富工具集,涵盖脚本执行、代码开发、网页搜索、终端操作等核心功能
|
|
97
|
+
- 👥 人机协作:支持实时交互,用户可随时介入指导,确保AI行为符合预期
|
|
98
|
+
- 🔌 高度可扩展:支持自定义工具和平台,轻松集成MCP协议
|
|
99
|
+
- 📈 智能进化:内置方法论系统,持续学习优化,越用越智能
|
|
100
|
+
|
|
101
|
+
|
|
92
102
|
## 📺 视频介绍<a id="video-introduction"></a>
|
|
93
103
|
|
|
94
104
|
[](https://player.bilibili.com/player.html?isOutside=true&aid=114306578382907&bvid=BV1x2dAYeEpM&cid=29314583629&p=1)
|
|
@@ -205,7 +215,6 @@ jarvis-methodology --help
|
|
|
205
215
|
| `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
|
|
206
216
|
| `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | true | 应用补丁前是否需要确认 |
|
|
207
217
|
| `JARVIS_MAX_TOOL_CALL_COUNT` | 20 | 最大连续工具调用次数 |
|
|
208
|
-
| `JARVIS_CODE_EMBEDDING_MODEL_SIZE` | small | 代码嵌入模型大小,可选值:small、large |
|
|
209
218
|
|
|
210
219
|
|
|
211
220
|
---
|
|
@@ -216,6 +225,8 @@ jarvis-methodology --help
|
|
|
216
225
|
| ask_codebase | 智能代码库查询和分析,用于定位功能所在文件和理解单点实现,适合查询特定功能位置和实现原理 |
|
|
217
226
|
| ask_user | 交互式用户输入收集 |
|
|
218
227
|
| chdir | 更改当前工作目录 |
|
|
228
|
+
| rewrite_file | 文件重写工具,用于完全重写或创建文件,提供完整的文件内容替换 |
|
|
229
|
+
| edit_file | 代码编辑工具,用于精确修改文件内容,支持搜索替换方式编辑 |
|
|
219
230
|
| code_plan | 理解需求并制定详细的代码修改计划,在修改前获取用户确认 |
|
|
220
231
|
| create_code_agent | 代码开发工具,当需要修改代码时使用 |
|
|
221
232
|
| create_sub_agent | 创建子代理以处理特定任务,子代理将生成任务总结报告 |
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=NsIgLwBHooDskUwUxLuK7qUm_qq1H_1XF4B7deh5fEA,50
|
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=7rNz-HE8vDZMifWXgCiOLGwUQ4LIgC7If6Axl9UKUvM,25343
|
|
3
3
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=3rRA-7v_VUSFG1s7tTKhriq9vv0nsa3t69ReV0xH5gs,1505
|
|
4
4
|
jarvis/jarvis_agent/file_input_handler.py,sha256=88VqJLe3oO9GtIRsqyx3KwZl10Apob2ddFMH3HQ2RMg,3413
|
|
5
5
|
jarvis/jarvis_agent/jarvis.py,sha256=EQDK7CEfoJXg-KkZ7DGDi0lALauFR4tPRvW2O-CxJAQ,5795
|
|
6
6
|
jarvis/jarvis_agent/main.py,sha256=Jlw_Tofh2C-sMVnkeOZBrwWJOWNH3IhsKDUn-WBlgU8,2602
|
|
7
|
-
jarvis/jarvis_agent/output_handler.py,sha256=
|
|
7
|
+
jarvis/jarvis_agent/output_handler.py,sha256=VwU_RNDpdKw2Fwz7UTXlVvBdphJrVF9fO_LNeJncDro,1195
|
|
8
8
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=9IoGQCe6FF4HA2V5S11q63AtnWDZFpNeRd3hcqCAlBw,1237
|
|
9
9
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
|
10
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=V8DTvmno0OqQoX9P1NwkQT2q8Fis0i7xOKkdiXLxXG4,18007
|
|
11
11
|
jarvis/jarvis_code_analysis/code_review.py,sha256=gB9Xo0-FT6zciDzZb3jF6zxxWA_Aj8QU5008Tmu_Tr4,30192
|
|
12
12
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=PCjlyxLa939613cAzS7pfEPgP57setO-1RvcdzzPivw,54
|
|
13
13
|
jarvis/jarvis_code_analysis/checklists/c_cpp.py,sha256=8lfWmhImAxeTBdHPOgVXDjMllaq280Qki1ZOOSDBnvk,1293
|
|
@@ -29,9 +29,9 @@ jarvis/jarvis_code_analysis/checklists/shell.py,sha256=UBtGhi3d5sIhyUSGmDckYOXwp
|
|
|
29
29
|
jarvis/jarvis_code_analysis/checklists/sql.py,sha256=-bGfYhaFJyHrbcJrUMbkMyPCNVbk8UljNqebqVJJKxM,2331
|
|
30
30
|
jarvis/jarvis_code_analysis/checklists/swift.py,sha256=d-zPPbM_J1G8fgZ2M2-ASQbIxEocsdL1owL4Z2PCnOc,2542
|
|
31
31
|
jarvis/jarvis_code_analysis/checklists/web.py,sha256=phdvLGqRHNijA0OyEwVtgHgz1Hi4ldtJJscOhEQvbSQ,3919
|
|
32
|
-
jarvis/jarvis_dev/main.py,sha256=
|
|
32
|
+
jarvis/jarvis_dev/main.py,sha256=n3FAE08MKulZQFBSFmPIgRMBrpVtjAPGn6kqDf7kLTU,42928
|
|
33
33
|
jarvis/jarvis_git_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
jarvis/jarvis_git_details/main.py,sha256=
|
|
34
|
+
jarvis/jarvis_git_details/main.py,sha256=r-fbLt-k_-2MtnDDETsj7XIKUALtj9jvQtTq7UsKFqs,6152
|
|
35
35
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
36
|
jarvis/jarvis_git_squash/main.py,sha256=xBNkAl7_8_pQC-C6RcUImA1mEU4KTqhjtA57rG_mMJ8,2179
|
|
37
37
|
jarvis/jarvis_git_utils/git_commiter.py,sha256=T94R496xYx17sjh4P3RtLqVYZkjB3xz8so8Q1aaei64,11963
|
|
@@ -45,14 +45,14 @@ jarvis/jarvis_mcp/__init__.py,sha256=gi74_Yz5nsEFhrAyCg1Ovxsj-hLweLjMGoOaceL2yx4
|
|
|
45
45
|
jarvis/jarvis_mcp/sse_mcp_client.py,sha256=Qd09ymgZmxQvaFUzz8I3AI46v6AqmMbGaF0iBbExAGY,23459
|
|
46
46
|
jarvis/jarvis_mcp/stdio_mcp_client.py,sha256=DtRO4dqBoxI8W0H0rVR5zxZLR0theKxRAQ-qzQE9qPg,11806
|
|
47
47
|
jarvis/jarvis_methodology/main.py,sha256=JrUqWKN0gQeiO_tY2Tn14pnT_jClqlNgpbBfoc-q8SM,11812
|
|
48
|
-
jarvis/jarvis_multi_agent/__init__.py,sha256=
|
|
48
|
+
jarvis/jarvis_multi_agent/__init__.py,sha256=NUhIadyIveGY95oaqG2VnWdY8WcWbFwGJ86jv7W0YKM,4319
|
|
49
49
|
jarvis/jarvis_multi_agent/main.py,sha256=aGuUC3YQmahabqwDwZXJjfQLYsZ3KIZdf8DZDlVNMe4,1543
|
|
50
50
|
jarvis/jarvis_platform/__init__.py,sha256=oD9i4ugZ2q6Hys3noLOvzPUUHqE2PJ_Je1r2dLLTscw,80
|
|
51
|
-
jarvis/jarvis_platform/base.py,sha256=
|
|
51
|
+
jarvis/jarvis_platform/base.py,sha256=SAWRl-WDjaBfcisvug3QHuTFRXe41iWRs0aoBe4QU_I,3989
|
|
52
52
|
jarvis/jarvis_platform/human.py,sha256=WCzvBtQUMN7ys4rQl6UT7Zdp4x5RaGv1U4vBx7ROxfo,2438
|
|
53
53
|
jarvis/jarvis_platform/kimi.py,sha256=Wno9PFZ92v9fjBHS29sFUwoc6gk6akD7yelVaWOpp-Q,16667
|
|
54
54
|
jarvis/jarvis_platform/registry.py,sha256=wvXTKXqAoW6GPaLKCPYhRB9QhVe1xfoVbVPBZAxl_uA,7716
|
|
55
|
-
jarvis/jarvis_platform/yuanbao.py,sha256=
|
|
55
|
+
jarvis/jarvis_platform/yuanbao.py,sha256=GVc5opeblu4CrPdxP0dnDr7v5ZtIaUHulaCMJnvQYrs,21812
|
|
56
56
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
jarvis/jarvis_platform_manager/main.py,sha256=xJM86DQFyYDysMyQEJDAwB2oSYcWg_zi1mFld0zyquM,22572
|
|
58
58
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -65,16 +65,17 @@ jarvis/jarvis_tools/chdir.py,sha256=do_OdtabiH3lZcT_ynjSAX66XgH2gPl9mYiS7dMMDa8,
|
|
|
65
65
|
jarvis/jarvis_tools/code_plan.py,sha256=jNa2rs4J3Fam8Q_RHE2_QvVch21TPp-Zfv-W6iQ3D_0,7729
|
|
66
66
|
jarvis/jarvis_tools/create_code_agent.py,sha256=SRiQXZf57ViIDh6YSEmJkcoSKft0-y3iDfWF8f1bvZU,3387
|
|
67
67
|
jarvis/jarvis_tools/create_sub_agent.py,sha256=wGiHukvi58wb1AKW5beP7R8VvApOn8TOeGmtXsmcETE,3001
|
|
68
|
-
jarvis/jarvis_tools/edit_file.py,sha256=
|
|
68
|
+
jarvis/jarvis_tools/edit_file.py,sha256=0r2E1wUJLdrS9sEAvCRA8_I96tQjkX-4Y8mKuGfZV8w,12429
|
|
69
69
|
jarvis/jarvis_tools/execute_script.py,sha256=AeuC3yZIg-nBq_LTIyqxu-lG_uLG63lvwO28A6dRDYA,5715
|
|
70
70
|
jarvis/jarvis_tools/file_analyzer.py,sha256=EVl7WqGgZoaQXqEX8vLynpqZDE3aug1hVBJbycT7YiY,4844
|
|
71
|
-
jarvis/jarvis_tools/file_operation.py,sha256=
|
|
71
|
+
jarvis/jarvis_tools/file_operation.py,sha256=G2hTp569O-IYX_LEz7BCNlJ6QPK58Ofut5Zjg9ThPmE,9020
|
|
72
72
|
jarvis/jarvis_tools/find_methodology.py,sha256=TIUrezAql6wY3-wqnOPfGrO0tqS5N_-eU6YimCzaepM,2268
|
|
73
73
|
jarvis/jarvis_tools/lsp_get_diagnostics.py,sha256=IYqv8jQwSK71sZpDBRolSDnYii8t0M7fzLthhMYTeGk,5322
|
|
74
74
|
jarvis/jarvis_tools/methodology.py,sha256=gnlJojY4Dg5v9AAB5xcpKqpPIHs0tOYVtzTHkwOrWk0,5214
|
|
75
|
-
jarvis/jarvis_tools/read_code.py,sha256=
|
|
75
|
+
jarvis/jarvis_tools/read_code.py,sha256=ePlvWs9Xn6QR2wJcB0t2c5RrE1xwFUEd8cP1nwS_Zdk,5937
|
|
76
76
|
jarvis/jarvis_tools/read_webpage.py,sha256=ECcMnPnUpIeiSA1IRdUf7uLWMe34Ian9pExSxekwpcg,2025
|
|
77
77
|
jarvis/jarvis_tools/registry.py,sha256=6md5Fm-Uv0dhTHj0qubHRj0VQkNIcNn0A1cshBOQY5o,27109
|
|
78
|
+
jarvis/jarvis_tools/rewrite_file.py,sha256=FXp70QrEEA08c3wZySu7TGGNnmYAQnjuxy703b-YKfI,6979
|
|
78
79
|
jarvis/jarvis_tools/search_web.py,sha256=p1oahjSmSeBO9ZzgWkxIHsfcAGah22ju0xipXmuqnzg,759
|
|
79
80
|
jarvis/jarvis_tools/virtual_tty.py,sha256=Rpn9VXUG17LQsY87F_O6UCjN_opXB05mpwozxYf-xVI,16372
|
|
80
81
|
jarvis/jarvis_utils/__init__.py,sha256=KMg-KY5rZIhGTeOD5e2Xo5CU7DX1DUz4ULWAaTQ-ZNw,825
|
|
@@ -82,16 +83,16 @@ jarvis/jarvis_utils/builtin_replace_map.py,sha256=Dt8YL4Sk5uALTMPT_n-lhshRWvFWPR
|
|
|
82
83
|
jarvis/jarvis_utils/config.py,sha256=iKlaVzwkSltjtFNGDrANt1PETYED6pDKrDphh3yD1eE,4059
|
|
83
84
|
jarvis/jarvis_utils/embedding.py,sha256=_Q-VurYHQZSsyISClTFjadDaNqNPBMqJe58lMM6bsVs,6991
|
|
84
85
|
jarvis/jarvis_utils/file_processors.py,sha256=oNtVlz2JHcQ60NS6sgI-VsvYXOnsQgFUEVenznCXHC4,2952
|
|
85
|
-
jarvis/jarvis_utils/git_utils.py,sha256=
|
|
86
|
-
jarvis/jarvis_utils/globals.py,sha256=
|
|
86
|
+
jarvis/jarvis_utils/git_utils.py,sha256=YOvtxZbM1DAsOoFIj06aEaAFG-npqg5yr1dHzOS3lX0,9956
|
|
87
|
+
jarvis/jarvis_utils/globals.py,sha256=JZFhOUae33_IGTQ3MHB5Fu3PT3dVXk0uHFm7QAzC4X0,2251
|
|
87
88
|
jarvis/jarvis_utils/input.py,sha256=3mQO_Ys1DGQQWCrw_zD9hnTF4Xd6vyQUrer8IastzvQ,7408
|
|
88
|
-
jarvis/jarvis_utils/methodology.py,sha256=
|
|
89
|
+
jarvis/jarvis_utils/methodology.py,sha256=SiCHhv9n23njOwznMIpesdsbTPfUbWsoWDTta-ga5GI,7795
|
|
89
90
|
jarvis/jarvis_utils/output.py,sha256=BmWdB1bmizv0xfU4Z___9p_xQodorriIcEgADVq9fk0,8416
|
|
90
91
|
jarvis/jarvis_utils/tag.py,sha256=YtXBYuZWy8j8YbeQX2qRrHRQl6Gp2Vt7W4p-2yjo0a4,405
|
|
91
92
|
jarvis/jarvis_utils/utils.py,sha256=neokG_C9Djw6shwLcBxpQmRF5KFp9P6v52bMJMEFozg,4487
|
|
92
|
-
jarvis_ai_assistant-0.1.
|
|
93
|
-
jarvis_ai_assistant-0.1.
|
|
94
|
-
jarvis_ai_assistant-0.1.
|
|
95
|
-
jarvis_ai_assistant-0.1.
|
|
96
|
-
jarvis_ai_assistant-0.1.
|
|
97
|
-
jarvis_ai_assistant-0.1.
|
|
93
|
+
jarvis_ai_assistant-0.1.164.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
94
|
+
jarvis_ai_assistant-0.1.164.dist-info/METADATA,sha256=Z8NihnQOL_xq8Xre6AoyJm7sdCiowvZj25dqCiwnG6I,13405
|
|
95
|
+
jarvis_ai_assistant-0.1.164.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
|
96
|
+
jarvis_ai_assistant-0.1.164.dist-info/entry_points.txt,sha256=cKz_9SEpOvElTubKPMZMAdskD4GHz-NyKWRNssIVAWE,973
|
|
97
|
+
jarvis_ai_assistant-0.1.164.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
98
|
+
jarvis_ai_assistant-0.1.164.dist-info/RECORD,,
|
{jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{jarvis_ai_assistant-0.1.162.dist-info → jarvis_ai_assistant-0.1.164.dist-info}/top_level.txt
RENAMED
|
File without changes
|