jarvis-ai-assistant 0.1.125__py3-none-any.whl → 0.1.128__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 (49) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +205 -187
  3. jarvis/jarvis_code_agent/code_agent.py +116 -109
  4. jarvis/jarvis_code_agent/patch.py +157 -138
  5. jarvis/jarvis_code_agent/shell_input_handler.py +22 -0
  6. jarvis/jarvis_codebase/main.py +314 -288
  7. jarvis/jarvis_dev/main.py +695 -716
  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_platform/base.py +6 -5
  16. jarvis/jarvis_platform_manager/main.py +1 -1
  17. jarvis/jarvis_rag/main.py +250 -186
  18. jarvis/jarvis_smart_shell/main.py +0 -1
  19. jarvis/jarvis_tools/ask_codebase.py +10 -9
  20. jarvis/jarvis_tools/ask_user.py +2 -2
  21. jarvis/jarvis_tools/base.py +4 -4
  22. jarvis/jarvis_tools/chdir.py +28 -28
  23. jarvis/jarvis_tools/code_review.py +44 -39
  24. jarvis/jarvis_tools/create_code_agent.py +4 -4
  25. jarvis/jarvis_tools/create_sub_agent.py +7 -7
  26. jarvis/jarvis_tools/execute_shell.py +53 -23
  27. jarvis/jarvis_tools/execute_shell_script.py +3 -3
  28. jarvis/jarvis_tools/file_operation.py +70 -41
  29. jarvis/jarvis_tools/git_commiter.py +61 -51
  30. jarvis/jarvis_tools/lsp_find_definition.py +7 -7
  31. jarvis/jarvis_tools/lsp_prepare_rename.py +7 -7
  32. jarvis/jarvis_tools/methodology.py +6 -6
  33. jarvis/jarvis_tools/rag.py +5 -5
  34. jarvis/jarvis_tools/read_webpage.py +52 -32
  35. jarvis/jarvis_tools/registry.py +167 -180
  36. jarvis/jarvis_tools/search_web.py +66 -41
  37. jarvis/jarvis_tools/select_code_files.py +3 -3
  38. jarvis/jarvis_tools/tool_generator.py +68 -55
  39. jarvis/jarvis_utils/methodology.py +77 -59
  40. jarvis/jarvis_utils/output.py +1 -0
  41. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/METADATA +31 -17
  42. jarvis_ai_assistant-0.1.128.dist-info/RECORD +74 -0
  43. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/WHEEL +1 -1
  44. jarvis/jarvis_tools/lsp_validate_edit.py +0 -141
  45. jarvis/jarvis_tools/read_code.py +0 -192
  46. jarvis_ai_assistant-0.1.125.dist-info/RECORD +0 -75
  47. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/LICENSE +0 -0
  48. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/entry_points.txt +0 -0
  49. {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/top_level.txt +0 -0
jarvis/jarvis_lsp/base.py CHANGED
@@ -125,18 +125,6 @@ class BaseLSP(ABC):
125
125
  """
126
126
  return None
127
127
 
128
- @abstractmethod
129
- def validate_edit(self, file_path: str, edit: Dict[str, Any]) -> bool:
130
- """Validate if proposed edit is syntactically correct.
131
-
132
- Args:
133
- file_path: Path to the file
134
- edit: Edit operation in LSP format
135
-
136
- Returns:
137
- bool: True if edit is valid
138
- """
139
- return False
140
128
 
141
129
  def shutdown(self):
142
130
  """Shutdown LSP server cleanly."""
jarvis/jarvis_lsp/cpp.py CHANGED
@@ -114,15 +114,6 @@ class CPPLSP(BaseLSP):
114
114
  })
115
115
  return result
116
116
 
117
- def validate_edit(self, file_path: str, edit: Dict[str, Any]) -> bool:
118
- # Send workspace/willRenameFiles request to check validity
119
- result = self._send_request("workspace/willRenameFiles", {
120
- "files": [{
121
- "oldUri": f"file://{file_path}",
122
- "newUri": f"file://{file_path}.tmp"
123
- }]
124
- })
125
- return bool(result)
126
117
 
127
118
  def shutdown(self):
128
119
  if self.clangd_process:
jarvis/jarvis_lsp/go.py CHANGED
@@ -120,15 +120,6 @@ class GoLSP(BaseLSP):
120
120
  })
121
121
  return result
122
122
 
123
- def validate_edit(self, file_path: str, edit: Dict[str, Any]) -> bool:
124
- # Send workspace/willRenameFiles request to check validity
125
- result = self._send_request("workspace/willRenameFiles", {
126
- "files": [{
127
- "oldUri": f"file://{file_path}",
128
- "newUri": f"file://{file_path}.tmp"
129
- }]
130
- })
131
- return bool(result)
132
123
 
133
124
  def shutdown(self):
134
125
  if self.gopls_process:
@@ -100,34 +100,6 @@ class PythonLSP(BaseLSP):
100
100
  return None
101
101
  return None
102
102
 
103
- def validate_edit(self, file_path: str, edit: Dict[str, Any]) -> bool:
104
- try:
105
- # Simple syntax check of the edited content
106
- content = ""
107
- with open(file_path, 'r') as f:
108
- content = f.read()
109
-
110
- # Apply edit
111
- start = edit["range"]["start"]
112
- end = edit["range"]["end"]
113
- new_text = edit["newText"]
114
-
115
- lines = content.splitlines(True)
116
- before = "".join(lines[:start["line"]])
117
- after = "".join(lines[end["line"] + 1:])
118
- current_line = lines[start["line"]]
119
-
120
- edited_line = (current_line[:start["character"]] +
121
- new_text +
122
- current_line[end["character"]:])
123
-
124
- new_content = before + edited_line + after
125
-
126
- # Check if new content is valid Python
127
- jedi.Script(code=new_content)
128
- return True
129
- except Exception:
130
- return False
131
103
 
132
104
  def shutdown(self):
133
105
  self.script_cache.clear()
@@ -14,7 +14,6 @@ REQUIRED_METHODS = [
14
14
  ('get_document_symbols', ['file_path']),
15
15
  ('get_diagnostics', ['file_path']),
16
16
  ('prepare_rename', ['file_path', 'position']),
17
- ('validate_edit', ['file_path', 'edit']),
18
17
  ('shutdown', [])
19
18
  ]
20
19
 
jarvis/jarvis_lsp/rust.py CHANGED
@@ -122,15 +122,6 @@ class RustLSP(BaseLSP):
122
122
  })
123
123
  return result
124
124
 
125
- def validate_edit(self, file_path: str, edit: Dict[str, Any]) -> bool:
126
- # Send workspace/willRenameFiles request to check validity
127
- result = self._send_request("workspace/willRenameFiles", {
128
- "files": [{
129
- "oldUri": f"file://{file_path}",
130
- "newUri": f"file://{file_path}.tmp"
131
- }]
132
- })
133
- return bool(result)
134
125
 
135
126
  def shutdown(self):
136
127
  if self.analyzer_process:
@@ -32,65 +32,65 @@ class MultiAgent(OutputHandler):
32
32
 
33
33
  def prompt(self) -> str:
34
34
  return f"""
35
- # 🤖 Message Handling System
36
- You are part of a multi-agent system that communicates through structured messages.
37
-
38
- # 🎯 Core Rules
39
- ## Critical Action Rules
40
- - Execute ONLY ONE action per turn:
41
- - Either use ONE tool (file_operation, ask_user, etc.)
42
- - OR send ONE message to another agent
43
- - NEVER combine both in same turn
44
-
45
- ## Message Flow Control
46
- - Wait for response after sending message
47
- - Process response before next action
48
- - Never send multiple messages at once
49
- - Never combine messages with tool calls
50
-
51
- # 📝 Message Format
35
+ # 🤖 多智能体消息处理系统
36
+ 您是多智能体系统的一部分,通过结构化消息进行通信。
37
+
38
+ # 🎯 核心规则
39
+ ## 关键操作规则
40
+ - 每轮只能执行一个操作:
41
+ - 要么使用一个工具(文件操作、询问用户等)
42
+ - 要么发送一条消息给其他智能体
43
+ - 切勿在同一轮中同时进行这两种操作
44
+
45
+ ## 消息流控制
46
+ - 发送消息后等待响应
47
+ - 处理响应后再进行下一步操作
48
+ - 切勿同时发送多条消息
49
+ - 切勿将消息与工具调用混合使用
50
+
51
+ # 📝 消息格式
52
52
  ```
53
53
  <SEND_MESSAGE>
54
- to: agent_name # Target agent name
54
+ to: 智能体名称 # 目标智能体名称
55
55
  content: |
56
- message_content # Message content
57
- use multiple lines # If needed
58
- with proper indentation
56
+ 消息内容 # 消息内容
57
+ 可使用多行 # 如果需要
58
+ 保持正确的缩进
59
59
  </SEND_MESSAGE>
60
60
  ```
61
61
 
62
- # 🔄 Action Sequence
63
- 1. Choose Most Important Action
64
- - Evaluate priority
65
- - Select ONE action
66
- - Execute action
62
+ # 🔄 操作顺序
63
+ 1. 选择最重要的操作
64
+ - 评估优先级
65
+ - 选择一个操作
66
+ - 执行该操作
67
67
 
68
- 2. Wait for Response
69
- - Process result/response
70
- - Plan next action
71
- - Wait for next turn
68
+ 2. 等待响应
69
+ - 处理结果/响应
70
+ - 计划下一步操作
71
+ - 等待下一轮
72
72
 
73
- 3. Handle Responses
74
- - Process incoming messages
75
- - Reply to sender when needed
76
- - Continue task based on response
73
+ 3. 处理响应
74
+ - 处理收到的消息
75
+ - 需要时回复发送者
76
+ - 根据响应继续任务
77
77
 
78
- # 👥 Available Agents
78
+ # 👥 可用智能体
79
79
  {chr(10).join([f"- {c.name}: {c.description}" for c in self.agents_config])}
80
80
 
81
- # ❗ Important Rules
82
- 1. ONE action per turn only
83
- 2. Wait for responses
84
- 3. Process before next action
85
- 4. Reply to messages
86
- 5. Forward task if needed
87
-
88
- # 💡 Tips
89
- - First action will be executed
90
- - Additional actions will be ignored
91
- - Always process responses first
92
- - Send message to continue task if needed
93
- - Handle and reply to received messages
81
+ # ❗ 重要规则
82
+ 1. 每轮只能执行一个操作
83
+ 2. 等待响应
84
+ 3. 处理后再进行下一步
85
+ 4. 回复消息
86
+ 5. 需要时转发任务
87
+
88
+ # 💡 提示
89
+ - 第一个操作将被执行
90
+ - 额外的操作将被忽略
91
+ - 总是先处理响应
92
+ - 需要时发送消息以继续任务
93
+ - 处理并回复收到的消息
94
94
  """
95
95
 
96
96
  def can_handle(self, response: str) -> bool:
@@ -161,10 +161,10 @@ from: {last_agent}
161
161
  content: {msg['content']}
162
162
  """
163
163
  if msg['to'] not in self.agents:
164
- PrettyOutput.print(f"没有找到{msg['to']},重试...", OutputType.WARNING)
165
- msg = self.agents[last_agent].run(f"The agent {msg['to']} is not found, agent list: {self.agents.keys()}")
164
+ PrettyOutput.print(f"未找到智能体 {msg['to']},正在重试...", OutputType.WARNING)
165
+ msg = self.agents[last_agent].run(f"未找到智能体 {msg['to']},可用智能体列表: {self.agents.keys()}")
166
166
  continue
167
- PrettyOutput.print(f"{last_agent} 发送消息给 {msg['to']}...", OutputType.INFO)
167
+ PrettyOutput.print(f"{last_agent} 正在向 {msg['to']} 发送消息...", OutputType.INFO)
168
168
  last_agent = self.agents[msg['to']].name
169
169
  msg = self.agents[msg['to']].run(prompt)
170
- return ""
170
+ return ""
@@ -10,7 +10,7 @@ class BasePlatform(ABC):
10
10
 
11
11
  def __init__(self):
12
12
  """Initialize model"""
13
- self.suppress_output = False # 添加输出控制标志
13
+ self.suppress_output = True # 添加输出控制标志
14
14
 
15
15
  def __del__(self):
16
16
  """Destroy model"""
@@ -46,10 +46,11 @@ class BasePlatform(ABC):
46
46
  tokens_per_second = 0
47
47
 
48
48
  # Print statistics
49
- PrettyOutput.print(
50
- f"对话完成 - 耗时: {duration:.2f}秒, 输出字符数: {char_count}, 输出Token数量: {token_count}, 每秒Token数量: {tokens_per_second:.2f}",
51
- OutputType.INFO,
52
- )
49
+ if not self.suppress_output:
50
+ PrettyOutput.print(
51
+ f"对话完成 - 耗时: {duration:.2f}秒, 输出字符数: {char_count}, 输出Token数量: {token_count}, 每秒Token数量: {tokens_per_second:.2f}",
52
+ OutputType.INFO,
53
+ )
53
54
 
54
55
  # Keep original think tag handling
55
56
  response = re.sub(r'<think>.*?</think>', '', response, flags=re.DOTALL)
@@ -59,6 +59,7 @@ def chat_with_model(platform_name: str, model_name: str):
59
59
  try:
60
60
  # Set model
61
61
  platform.set_model_name(model_name)
62
+ platform.set_suppress_output(False)
62
63
  PrettyOutput.print(f"连接到 {platform_name} 平台 {model_name} 模型", OutputType.SUCCESS)
63
64
 
64
65
  # Start conversation loop
@@ -209,7 +210,6 @@ def service_command(args):
209
210
  raise HTTPException(status_code=400, detail=f"Platform {platform_name} not found")
210
211
 
211
212
  platform.set_model_name(model_name)
212
- platform.set_suppress_output(True) # Suppress console output in server mode
213
213
  platform_instances[key] = platform
214
214
 
215
215
  return platform_instances[key]