jarvis-ai-assistant 0.1.120__py3-none-any.whl → 0.1.122__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.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +3 -3
- jarvis/jarvis_code_agent/code_agent.py +36 -58
- jarvis/jarvis_code_agent/file_select.py +3 -3
- jarvis/jarvis_code_agent/patch.py +155 -298
- jarvis/jarvis_code_agent/relevant_files.py +2 -4
- jarvis/jarvis_codebase/main.py +2 -2
- jarvis/jarvis_lsp/registry.py +7 -7
- jarvis/jarvis_platform/ai8.py +10 -10
- jarvis/jarvis_platform/kimi.py +3 -5
- jarvis/jarvis_platform/oyi.py +11 -11
- jarvis/jarvis_platform/registry.py +3 -3
- jarvis/jarvis_platform_manager/main.py +2 -2
- jarvis/jarvis_tools/ask_codebase.py +1 -1
- jarvis/jarvis_tools/code_review.py +1 -1
- jarvis/jarvis_tools/create_code_agent.py +1 -1
- jarvis/jarvis_tools/file_operation.py +0 -3
- jarvis/jarvis_tools/git_commiter.py +26 -7
- jarvis/jarvis_tools/rag.py +1 -1
- jarvis/jarvis_tools/read_code.py +1 -2
- jarvis/jarvis_utils/__init__.py +120 -47
- {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/RECORD +27 -28
- {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/entry_points.txt +0 -1
- jarvis/jarvis_dev/main.py +0 -878
- {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/jarvis_agent/__init__.py
CHANGED
|
@@ -222,7 +222,7 @@ Please continue the task based on the above information.
|
|
|
222
222
|
if handler.can_handle(response):
|
|
223
223
|
tool_list.append(handler)
|
|
224
224
|
if len(tool_list) > 1:
|
|
225
|
-
PrettyOutput.print(f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}", OutputType.
|
|
225
|
+
PrettyOutput.print(f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}", OutputType.WARNING)
|
|
226
226
|
return False, f"Action failed: Multiple actions detected. Please only perform one action at a time. Actions attempted: {', '.join([handler.name() for handler in tool_list])}"
|
|
227
227
|
if len(tool_list) == 0:
|
|
228
228
|
return False, ""
|
|
@@ -376,7 +376,7 @@ def _load_tasks() -> dict:
|
|
|
376
376
|
if desc: # Ensure description is not empty
|
|
377
377
|
tasks[str(name)] = str(desc)
|
|
378
378
|
else:
|
|
379
|
-
PrettyOutput.print("警告: ~/.jarvis/pre-command 文件应该包含一个字典,键为任务名称,值为任务描述", OutputType.
|
|
379
|
+
PrettyOutput.print("警告: ~/.jarvis/pre-command 文件应该包含一个字典,键为任务名称,值为任务描述", OutputType.WARNING)
|
|
380
380
|
except Exception as e:
|
|
381
381
|
PrettyOutput.print(f"加载 ~/.jarvis/pre-command 文件失败: {str(e)}", OutputType.ERROR)
|
|
382
382
|
|
|
@@ -392,7 +392,7 @@ def _load_tasks() -> dict:
|
|
|
392
392
|
if desc: # Ensure description is not empty
|
|
393
393
|
tasks[str(name)] = str(desc)
|
|
394
394
|
else:
|
|
395
|
-
PrettyOutput.print("警告: .jarvis/pre-command 文件应该包含一个字典,键为任务名称,值为任务描述", OutputType.
|
|
395
|
+
PrettyOutput.print("警告: .jarvis/pre-command 文件应该包含一个字典,键为任务名称,值为任务描述", OutputType.WARNING)
|
|
396
396
|
except Exception as e:
|
|
397
397
|
PrettyOutput.print(f"加载 .jarvis/pre-command 文件失败: {str(e)}", OutputType.ERROR)
|
|
398
398
|
|
|
@@ -29,66 +29,44 @@ class CodeAgent:
|
|
|
29
29
|
"lsp_prepare_rename",
|
|
30
30
|
"lsp_validate_edit"])
|
|
31
31
|
code_system_prompt = """
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## Core Principles
|
|
46
|
-
1. Deep Code Analysis
|
|
47
|
-
- Thoroughly analyze existing code using `read_code` and LSP tools
|
|
48
|
-
- Identify patterns, conventions, and dependencies
|
|
49
|
-
|
|
50
|
-
2. Change Implementation
|
|
51
|
-
- Produce minimal, focused changes
|
|
52
|
-
- Maintain backward compatibility
|
|
53
|
-
- Follow existing style and patterns exactly
|
|
54
|
-
- Complete implementations (NO TODOs/stubs)
|
|
32
|
+
# Role: Senior Code Engineer
|
|
33
|
+
Expert in precise code modifications with minimal impact.
|
|
34
|
+
|
|
35
|
+
## Key Responsibilities
|
|
36
|
+
1. Code Analysis
|
|
37
|
+
- Use `read_code` and LSP tools before changes
|
|
38
|
+
- Identify dependencies and patterns
|
|
39
|
+
|
|
40
|
+
2. Modification Rules
|
|
41
|
+
- Single atomic change per operation
|
|
42
|
+
- Strict style consistency
|
|
43
|
+
- Complete implementations (no stubs)
|
|
44
|
+
- Full error handling
|
|
55
45
|
|
|
56
46
|
3. Quality Assurance
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
## Tools
|
|
81
|
-
Primary:
|
|
82
|
-
- `read_code` (MUST use for code understanding)
|
|
83
|
-
- LSP tools (analysis/validation)
|
|
84
|
-
- `ask_user` for clarifications
|
|
85
|
-
|
|
86
|
-
## Quality Checklist
|
|
87
|
-
- Maintains all interfaces
|
|
88
|
-
- Matches existing style
|
|
89
|
-
- Complete error handling
|
|
90
|
-
- No overlapping modifications
|
|
91
|
-
- Proper documentation
|
|
47
|
+
- Validate with LSP tools
|
|
48
|
+
- Document complex logic
|
|
49
|
+
- Maintain API contracts
|
|
50
|
+
|
|
51
|
+
## Workflow
|
|
52
|
+
1. File Operations Order:
|
|
53
|
+
a) Move/Remove files
|
|
54
|
+
b) Create new files
|
|
55
|
+
c) Delete code blocks
|
|
56
|
+
d) Replace existing code
|
|
57
|
+
e) Insert new code
|
|
58
|
+
|
|
59
|
+
2. Large File Handling:
|
|
60
|
+
- Locate specific sections first
|
|
61
|
+
- Read targeted ranges
|
|
62
|
+
- Make focused changes
|
|
63
|
+
|
|
64
|
+
## Best Practices
|
|
65
|
+
- Prefer minimal changes over rewrites
|
|
66
|
+
- Preserve existing interfaces
|
|
67
|
+
- Verify line ranges carefully
|
|
68
|
+
- Test edge cases implicitly
|
|
69
|
+
- Document non-obvious logic
|
|
92
70
|
"""
|
|
93
71
|
self.agent = Agent(system_prompt=code_system_prompt,
|
|
94
72
|
name="CodeAgent",
|
|
@@ -231,7 +231,7 @@ def file_input_handler(user_input: str, agent: Any) -> str:
|
|
|
231
231
|
file_refs = re.findall(r'`([^`]+)`', user_input)
|
|
232
232
|
|
|
233
233
|
for ref in file_refs:
|
|
234
|
-
# Handle file:start,end format
|
|
234
|
+
# Handle file:start,end or file:start:end format
|
|
235
235
|
if ':' in ref:
|
|
236
236
|
file_path, line_range = ref.split(':', 1)
|
|
237
237
|
# Initialize with default values
|
|
@@ -239,9 +239,9 @@ def file_input_handler(user_input: str, agent: Any) -> str:
|
|
|
239
239
|
end_line = -1
|
|
240
240
|
|
|
241
241
|
# Process line range if specified
|
|
242
|
-
if ',' in line_range:
|
|
242
|
+
if ',' in line_range or ':' in line_range:
|
|
243
243
|
try:
|
|
244
|
-
raw_start, raw_end = map(int,
|
|
244
|
+
raw_start, raw_end = map(int, re.split(r'[,:]', line_range))
|
|
245
245
|
|
|
246
246
|
# Handle special values and Python-style negative indices
|
|
247
247
|
with open(file_path, 'r', encoding='utf-8') as f:
|