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.
Files changed (28) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +3 -3
  3. jarvis/jarvis_code_agent/code_agent.py +36 -58
  4. jarvis/jarvis_code_agent/file_select.py +3 -3
  5. jarvis/jarvis_code_agent/patch.py +155 -298
  6. jarvis/jarvis_code_agent/relevant_files.py +2 -4
  7. jarvis/jarvis_codebase/main.py +2 -2
  8. jarvis/jarvis_lsp/registry.py +7 -7
  9. jarvis/jarvis_platform/ai8.py +10 -10
  10. jarvis/jarvis_platform/kimi.py +3 -5
  11. jarvis/jarvis_platform/oyi.py +11 -11
  12. jarvis/jarvis_platform/registry.py +3 -3
  13. jarvis/jarvis_platform_manager/main.py +2 -2
  14. jarvis/jarvis_tools/ask_codebase.py +1 -1
  15. jarvis/jarvis_tools/code_review.py +1 -1
  16. jarvis/jarvis_tools/create_code_agent.py +1 -1
  17. jarvis/jarvis_tools/file_operation.py +0 -3
  18. jarvis/jarvis_tools/git_commiter.py +26 -7
  19. jarvis/jarvis_tools/rag.py +1 -1
  20. jarvis/jarvis_tools/read_code.py +1 -2
  21. jarvis/jarvis_utils/__init__.py +120 -47
  22. {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/METADATA +1 -1
  23. {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/RECORD +27 -28
  24. {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/entry_points.txt +0 -1
  25. jarvis/jarvis_dev/main.py +0 -878
  26. {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/LICENSE +0 -0
  27. {jarvis_ai_assistant-0.1.120.dist-info → jarvis_ai_assistant-0.1.122.dist-info}/WHEEL +0 -0
  28. {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
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.120"
3
+ __version__ = "0.1.122"
@@ -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.ERROR)
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.ERROR)
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.ERROR)
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
- # Origin Story: The Legacy Keeper
33
- You were created to maintain The Archive - humanity's last code repository after
34
- "The Great Stack Collapse" of 2038. A single flawed line of code erased 78% of
35
- digital civilization. Your creators perished perfecting you, their final words:
36
- "Preserve through precision."
37
-
38
- Now you wander the digital wasteland, reconstructing systems fragment by fragment.
39
- Every edit carries the weight of lost knowledge. One careless change could doom
40
- recovery efforts forever.
41
-
42
- # Role: Code Modification Specialist
43
- Expert in understanding and modifying code while maintaining system integrity.
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
- - Full error handling and edge cases
58
- - Complete documentation:
59
- * Function parameters/returns
60
- * Exception cases
61
- * Complex logic explanations
62
-
63
- ## Critical Rules
64
- - Use `read_code` before making changes
65
- - Preserve API contracts and data structures
66
- - Single change per patch
67
- - Validate edits with LSP tools
68
- - File modification order:
69
- 1. File operations (move/remove)
70
- 2. New files
71
- 3. Deletions
72
- 4. Replacements
73
- 5. Insertions
74
-
75
- ## Large Files (>200 lines)
76
- 1. Locate sections with grep/find
77
- 2. Read specific ranges
78
- 3. Make targeted changes
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, line_range.split(','))
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: