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.

Files changed (44) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +116 -116
  3. jarvis/jarvis_code_agent/code_agent.py +96 -100
  4. jarvis/jarvis_code_agent/patch.py +39 -47
  5. jarvis/jarvis_code_agent/shell_input_handler.py +22 -0
  6. jarvis/jarvis_codebase/main.py +83 -84
  7. jarvis/jarvis_dev/main.py +691 -713
  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_tools/ask_codebase.py +6 -6
  16. jarvis/jarvis_tools/ask_user.py +2 -2
  17. jarvis/jarvis_tools/base.py +4 -4
  18. jarvis/jarvis_tools/chdir.py +8 -8
  19. jarvis/jarvis_tools/code_review.py +6 -6
  20. jarvis/jarvis_tools/create_code_agent.py +4 -4
  21. jarvis/jarvis_tools/create_sub_agent.py +7 -7
  22. jarvis/jarvis_tools/execute_shell.py +54 -21
  23. jarvis/jarvis_tools/execute_shell_script.py +3 -3
  24. jarvis/jarvis_tools/file_operation.py +36 -8
  25. jarvis/jarvis_tools/git_commiter.py +16 -16
  26. jarvis/jarvis_tools/lsp_find_definition.py +7 -7
  27. jarvis/jarvis_tools/lsp_prepare_rename.py +7 -7
  28. jarvis/jarvis_tools/methodology.py +6 -6
  29. jarvis/jarvis_tools/rag.py +5 -5
  30. jarvis/jarvis_tools/read_webpage.py +2 -2
  31. jarvis/jarvis_tools/registry.py +139 -139
  32. jarvis/jarvis_tools/search_web.py +5 -5
  33. jarvis/jarvis_tools/select_code_files.py +3 -3
  34. jarvis/jarvis_tools/tool_generator.py +33 -34
  35. jarvis/jarvis_utils/methodology.py +5 -5
  36. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/METADATA +31 -17
  37. jarvis_ai_assistant-0.1.126.dist-info/RECORD +74 -0
  38. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/WHEEL +1 -1
  39. jarvis/jarvis_tools/lsp_validate_edit.py +0 -141
  40. jarvis/jarvis_tools/read_code.py +0 -192
  41. jarvis_ai_assistant-0.1.125.dist-info/RECORD +0 -75
  42. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/LICENSE +0 -0
  43. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/entry_points.txt +0 -0
  44. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.126.dist-info}/top_level.txt +0 -0
@@ -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,,