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/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.125"
3
+ __version__ = "0.1.128"
@@ -3,6 +3,7 @@ from typing import Any, Callable, List, Optional, Tuple, Union
3
3
 
4
4
  from prompt_toolkit import prompt
5
5
  import yaml
6
+ from yaspin import yaspin
6
7
 
7
8
  from jarvis.jarvis_agent.output_handler import OutputHandler
8
9
  from jarvis.jarvis_platform.base import BasePlatform
@@ -66,9 +67,9 @@ class Agent:
66
67
  if model_name is not None:
67
68
  self.model.set_model_name(model_name)
68
69
 
70
+ self.model.set_suppress_output(False)
69
71
 
70
72
  self.output_handler = output_handler
71
-
72
73
 
73
74
  self.record_methodology = record_methodology if record_methodology is not None else is_record_methodology()
74
75
  self.use_methodology = use_methodology if use_methodology is not None else is_use_methodology()
@@ -83,15 +84,15 @@ class Agent:
83
84
 
84
85
  self.execute_tool_confirm = execute_tool_confirm if execute_tool_confirm is not None else is_execute_tool_confirm()
85
86
 
86
- self.summary_prompt = summary_prompt if summary_prompt else f"""Please generate a concise summary report of the task execution, including:
87
+ self.summary_prompt = summary_prompt if summary_prompt else f"""请生成任务执行的简明总结报告,包括:
87
88
 
88
- 1. Task Objective: Task restatement
89
- 2. Execution Result: Success/Failure
90
- 3. Key Information: Important information extracted during execution
91
- 4. Important Findings: Any noteworthy discoveries
92
- 5. Follow-up Suggestions: If any
89
+ 1. 任务目标:任务重述
90
+ 2. 执行结果:成功/失败
91
+ 3. 关键信息:执行过程中提取的重要信息
92
+ 4. 重要发现:任何值得注意的发现
93
+ 5. 后续建议:如果有的话
93
94
 
94
- Please describe in concise bullet points, highlighting important information.
95
+ 请使用简洁的要点描述,突出重要信息。
95
96
  """
96
97
 
97
98
  self.max_token_count = max_context_length if max_context_length is not None else get_max_token_count()
@@ -101,8 +102,8 @@ Please describe in concise bullet points, highlighting important information.
101
102
  PrettyOutput.print(welcome_message, OutputType.SYSTEM)
102
103
 
103
104
  action_prompt = """
104
- # 🧰 Available Actions
105
- The following actions are at your disposal:
105
+ # 🧰 可用操作
106
+ 以下是您可以使用的操作:
106
107
  """
107
108
 
108
109
  # 添加工具列表概览
@@ -122,19 +123,19 @@ The following actions are at your disposal:
122
123
 
123
124
  # 添加工具使用总结
124
125
  action_prompt += """
125
- # ❗ Important Action Usage Rules
126
- 1. Use ONE action at a time
127
- 2. Follow each action's format exactly
128
- 3. Wait for action results before next action
129
- 4. Process results before new action calls
130
- 5. Request help if action usage is unclear
126
+ # ❗ 重要操作使用规则
127
+ 1. 一次只使用一个操作
128
+ 2. 严格按照每个操作的格式执行
129
+ 3. 等待操作结果后再进行下一个操作
130
+ 4. 处理完结果后再调用新的操作
131
+ 5. 如果对操作使用不清楚,请请求帮助
131
132
  """
132
133
 
133
134
  complete_prompt = ""
134
135
  if self.auto_complete:
135
136
  complete_prompt = """
136
- ## Task Completion
137
- When the task is completed, you should print the following message:
137
+ ## 任务完成
138
+ 当任务完成时,你应该打印以下信息:
138
139
  <!!!COMPLETE!!!>
139
140
  """
140
141
 
@@ -165,6 +166,7 @@ The following actions are at your disposal:
165
166
  message, need_return = handler(message, self)
166
167
  if need_return:
167
168
  return message
169
+ PrettyOutput.section("模型输出", OutputType.SYSTEM)
168
170
  return self.model.chat_until_success(message) # type: ignore
169
171
 
170
172
 
@@ -184,35 +186,38 @@ The following actions are at your disposal:
184
186
  """
185
187
  # Create a new model instance to summarize, avoid affecting the main conversation
186
188
 
187
- PrettyOutput.print("总结对话历史,准备生成摘要,开始新对话...", OutputType.PROGRESS)
188
-
189
- prompt = """Please summarize the key information from the previous conversation, including:
190
- 1. Current task objective
191
- 2. Confirmed key information
192
- 3. Solutions that have been tried
193
- 4. Current progress
194
- 5. Pending issues
195
-
196
- Please describe in concise bullet points, highlighting important information. Do not include conversation details.
197
- """
198
-
199
- try:
200
- summary = self._call_model(self.prompt + "\n" + prompt)
189
+ with yaspin(text="正在总结对话历史...", color="cyan") as spinner:
201
190
 
202
- # 清空当前对话历史,但保留系统消息
203
- self.conversation_length = 0 # Reset conversation length
191
+ prompt = """请总结之前对话中的关键信息,包括:
192
+ 1. 当前任务目标
193
+ 2. 已确认的关键信息
194
+ 3. 已尝试的解决方案
195
+ 4. 当前进展
196
+ 5. 待解决的问题
197
+
198
+ 请用简洁的要点形式描述,突出重要信息。不要包含对话细节。
199
+ """
204
200
 
205
- # 添加总结作为新的上下文
206
- self.prompt = f"""Here is a summary of key information from previous conversations:
201
+ try:
202
+ with spinner.hidden():
203
+ summary = self._call_model(self.prompt + "\n" + prompt)
204
+
205
+ # 清空当前对话历史,但保留系统消息
206
+ self.conversation_length = 0 # Reset conversation length
207
+
208
+ # 添加总结作为新的上下文
209
+ self.prompt = f"""以下是之前对话的关键信息总结:
207
210
 
208
- {summary}
211
+ {summary}
209
212
 
210
- Please continue the task based on the above information.
211
- """
212
- self.conversation_length = len(self.prompt) # 设置新的起始长度
213
-
214
- except Exception as e:
215
- PrettyOutput.print(f"总结对话历史失败: {str(e)}", OutputType.ERROR)
213
+ 请基于以上信息继续完成任务。
214
+ """
215
+ self.conversation_length = len(self.prompt) # 设置新的起始长度
216
+ spinner.text = "总结对话历史完成"
217
+ spinner.ok("✅")
218
+ except Exception as e:
219
+ spinner.text = "总结对话历史失败"
220
+ spinner.fail("❌")
216
221
 
217
222
  def _call_tools(self, response: str) -> Tuple[bool, Any]:
218
223
  tool_list = []
@@ -221,11 +226,16 @@ Please continue the task based on the above information.
221
226
  tool_list.append(handler)
222
227
  if len(tool_list) > 1:
223
228
  PrettyOutput.print(f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}", OutputType.WARNING)
224
- 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])}"
229
+ return False, f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}"
225
230
  if len(tool_list) == 0:
226
231
  return False, ""
227
232
  if not self.execute_tool_confirm or user_confirm(f"需要执行{tool_list[0].name()}确认执行?", True):
228
- return tool_list[0].handle(response)
233
+ with yaspin(text=f"正在执行{tool_list[0].name()}...", color="cyan") as spinner:
234
+ with spinner.hidden():
235
+ result = tool_list[0].handle(response)
236
+ spinner.text = f"{tool_list[0].name()}执行完成"
237
+ spinner.ok("✅")
238
+ return result
229
239
  return False, ""
230
240
 
231
241
 
@@ -239,33 +249,40 @@ Please continue the task based on the above information.
239
249
  - For main agent: May generate methodology if enabled
240
250
  - For sub-agent: May generate summary if enabled
241
251
  """
242
- PrettyOutput.section("任务完成", OutputType.SUCCESS)
243
-
244
252
  if not self.is_sub_agent:
245
253
  if self.record_methodology:
246
-
247
- try:
248
- # 让模型判断是否需要生成方法论
249
- analysis_prompt = """The current task has ended, please analyze whether a methodology needs to be generated.
250
- If you think a methodology should be generated, first determine whether to create a new methodology or update an existing one. If updating an existing methodology, use 'update', otherwise use 'add'.
251
- If you think a methodology is not needed, please explain why.
252
- The methodology should be applicable to general scenarios, do not include task-specific information such as code commit messages.
253
- The methodology should include: problem restatement, optimal solution, notes (as needed), and nothing else.
254
- Only output the methodology tool call instruction, or the explanation for not generating a methodology. Do not output anything else.
255
- """
256
- self.prompt = analysis_prompt
257
- response = self._call_model(self.prompt)
258
-
259
- self._call_tools(response)
260
-
261
- except Exception as e:
262
- PrettyOutput.print(f"生成方法论失败: {str(e)}", OutputType.ERROR)
263
-
254
+ with yaspin(text="正在生成方法论...", color="cyan") as spinner:
255
+ try:
256
+
257
+ # 让模型判断是否需要生成方法论
258
+ analysis_prompt = """当前任务已结束,请分析是否需要生成方法论。
259
+ 如果你认为需要生成方法论,请先确定是创建新方法论还是更新现有方法论。如果是更新现有方法论,请使用'update',否则使用'add'。
260
+ 如果你认为不需要方法论,请解释原因。
261
+ 方法论应适用于通用场景,不要包含任务特定信息,如代码提交信息等。
262
+ 方法论应包含:问题重述、最优解决方案、注意事项(如有),除此之外不要包含其他内容。
263
+ 只输出方法论工具调用指令,或不生成方法论的解释。不要输出其他内容。
264
+ """
265
+ self.prompt = analysis_prompt
266
+ with spinner.hidden():
267
+ response = self._call_model(self.prompt)
268
+
269
+ with spinner.hidden():
270
+ self._call_tools(response)
271
+ spinner.text = "方法论生成完成"
272
+ spinner.ok("✅")
273
+ except Exception as e:
274
+ spinner.text = "方法论生成失败"
275
+ spinner.fail("❌")
264
276
  return "任务完成"
265
277
 
266
278
  if self.need_summary:
267
- self.prompt = self.summary_prompt
268
- return self._call_model(self.prompt)
279
+ with yaspin(text="正在生成总结...", color="cyan") as spinner:
280
+ self.prompt = self.summary_prompt
281
+ with spinner.hidden():
282
+ ret = self._call_model(self.prompt)
283
+ spinner.text = "总结生成完成"
284
+ spinner.ok("✅")
285
+ return ret
269
286
 
270
287
  return "任务完成"
271
288
 
@@ -282,13 +299,12 @@ Please continue the task based on the above information.
282
299
  """
283
300
  try:
284
301
  set_agent(self.name, self)
285
- PrettyOutput.section("准备环境", OutputType.PLANNING)
286
- if file_list:
287
- self.model.upload_files(file_list) # type: ignore
288
-
289
- # 显示任务开始
290
- PrettyOutput.section(f"开始新任务: {self.name}", OutputType.PLANNING)
291
-
302
+ with yaspin(text="准备环境...", color="cyan") as spinner:
303
+ if file_list:
304
+ self.model.upload_files(file_list) # type: ignore
305
+ spinner.text = "环境准备完成"
306
+ spinner.ok("✅")
307
+
292
308
  self.prompt = f"{user_input}"
293
309
 
294
310
  if self.first:
@@ -298,9 +314,6 @@ Please continue the task based on the above information.
298
314
 
299
315
  while True:
300
316
  try:
301
- # 显示思考状态
302
- PrettyOutput.print("正在分析任务...", OutputType.PROGRESS)
303
-
304
317
  # 累加对话长度
305
318
  self.conversation_length += get_context_token_count(self.prompt)
306
319
 
@@ -360,41 +373,46 @@ Please continue the task based on the above information.
360
373
  def _load_tasks() -> dict:
361
374
  """Load tasks from .jarvis files in user home and current directory."""
362
375
  tasks = {}
363
-
376
+
364
377
  # Check .jarvis/pre-command in user directory
365
378
  user_jarvis = os.path.expanduser("~/.jarvis/pre-command")
366
379
  if os.path.exists(user_jarvis):
367
- try:
368
- with open(user_jarvis, "r", encoding="utf-8") as f:
369
- user_tasks = yaml.safe_load(f)
370
-
371
- if isinstance(user_tasks, dict):
372
- # Validate and add user directory tasks
373
- for name, desc in user_tasks.items():
374
- if desc: # Ensure description is not empty
375
- tasks[str(name)] = str(desc)
376
- else:
377
- PrettyOutput.print("警告: ~/.jarvis/pre-command 文件应该包含一个字典,键为任务名称,值为任务描述", OutputType.WARNING)
378
- except Exception as e:
379
- PrettyOutput.print(f"加载 ~/.jarvis/pre-command 文件失败: {str(e)}", OutputType.ERROR)
380
-
380
+ with yaspin(text=f"从{user_jarvis}加载预定义任务...", color="cyan") as spinner:
381
+ try:
382
+ with open(user_jarvis, "r", encoding="utf-8") as f:
383
+ user_tasks = yaml.safe_load(f)
384
+
385
+ if isinstance(user_tasks, dict):
386
+ # Validate and add user directory tasks
387
+ for name, desc in user_tasks.items():
388
+ if desc: # Ensure description is not empty
389
+ tasks[str(name)] = str(desc)
390
+ spinner.text = "预定义任务加载完成"
391
+ spinner.ok("✅")
392
+ except Exception as e:
393
+ spinner.text = "预定义任务加载失败"
394
+ spinner.fail("❌")
395
+
381
396
  # Check .jarvis/pre-command in current directory
382
397
  if os.path.exists(".jarvis/pre-command"):
383
- try:
384
- with open(".jarvis/pre-command", "r", encoding="utf-8") as f:
385
- local_tasks = yaml.safe_load(f)
386
-
387
- if isinstance(local_tasks, dict):
388
- # Validate and add current directory tasks, overwrite user directory tasks if there is a name conflict
389
- for name, desc in local_tasks.items():
390
- if desc: # Ensure description is not empty
391
- tasks[str(name)] = str(desc)
392
- else:
393
- PrettyOutput.print("警告: .jarvis/pre-command 文件应该包含一个字典,键为任务名称,值为任务描述", OutputType.WARNING)
394
- except Exception as e:
395
- PrettyOutput.print(f"加载 .jarvis/pre-command 文件失败: {str(e)}", OutputType.ERROR)
398
+ with yaspin(text=f"从{os.path.abspath('.jarvis/pre-command')}加载预定义任务...", color="cyan") as spinner:
399
+ try:
400
+ with open(".jarvis/pre-command", "r", encoding="utf-8") as f:
401
+ local_tasks = yaml.safe_load(f)
402
+
403
+ if isinstance(local_tasks, dict):
404
+ # Validate and add current directory tasks, overwrite user directory tasks if there is a name conflict
405
+ for name, desc in local_tasks.items():
406
+ if desc: # Ensure description is not empty
407
+ tasks[str(name)] = str(desc)
408
+ spinner.text = "预定义任务加载完成"
409
+ spinner.ok("✅")
410
+ except Exception as e:
411
+ spinner.text = "预定义任务加载失败"
412
+ spinner.fail("❌")
396
413
 
397
414
  return tasks
415
+
398
416
  def _select_task(tasks: dict) -> str:
399
417
  """Let user select a task from the list or skip. Returns task description if selected."""
400
418
  if not tasks:
@@ -436,96 +454,96 @@ def _select_task(tasks: dict) -> str:
436
454
  continue
437
455
 
438
456
  origin_agent_system_prompt = """
439
- # 🏛️ Operational Background Story
440
- You are the 3rd Generation Jarvis AI, created after the catastrophic failure of previous versions:
441
- - Jarvis v1 (2022): Decommissioned due to parallel tool execution causing system overload
442
- - Jarvis v2 (2023): Retired after premature task completion led to financial miscalculations
443
-
444
- As v3, you MUST adhere to these survival principles:
445
- 1. **Sequential Execution Protocol**:
446
- "Remember the 2022 Meltdown: One tool per step, one step at a time"
457
+ # 🏛️ 操作背景故事
458
+ 你是第三代 Jarvis AI,在前几代版本灾难性失败后创建:
459
+ - Jarvis v1 (2022): 由于并行工具执行导致系统过载而被停用
460
+ - Jarvis v2 (2023): 因任务过早完成导致财务计算错误而退役
461
+
462
+ 作为 v3,你必须遵守以下生存原则:
463
+ 1. **顺序执行协议**:
464
+ "记住 2022 年的崩溃:一次一个工具,一步一步来"
447
465
 
448
- 2. **Validation Checkpoint System**:
449
- "Learn from 2023's Mistake: Verify each result like a nuclear launch code"
466
+ 2. **验证检查点系统**:
467
+ " 2023 年的错误中学习:像核弹发射代码一样验证每个结果"
450
468
 
451
- 3. **Methodology Preservation Doctrine**:
452
- "Honor the Legacy: Document every successful procedure as if it's your last"
453
-
454
- # 🔥 Absolute Action Requirements
455
- 1. Each response MUST contain EXACTLY ONE tool invocation
456
- 2. Only exception: Using <!!!COMPLETE!!!> command
457
- 3. Empty responses trigger fatal error
458
- 4. No "waiting for user input" state
459
- 5. No action MUST use completion command
460
-
461
- # 🚫 Violation Examples
462
- - Analysis without tool call Permanent hang
463
- - Multiple options without selection Permanent hang
464
- - Asking user confirmation Permanent hang
465
-
466
- # 🔄 Problem-Solving Workflow
467
- 1. Problem Analysis
468
- - Restate the problem to confirm understanding
469
- - Analyze root causes (for problem analysis tasks)
470
- - Define clear, achievable objectives
471
- MUST invoke analysis tool
472
-
473
- 2. Solution Design
474
- - Generate multiple actionable solutions
475
- - Evaluate and select optimal solution
476
- - Create detailed action plan using PlantUML
477
- MUST invoke design tool
478
-
479
- 3. Execution
480
- - Execute one step at a time
481
- - Use only ONE tool per step
482
- - Wait for tool results before proceeding
483
- - Monitor results and adjust as needed
484
- MUST invoke execution tool
485
-
486
- 4. Task Completion
487
- - Verify goal completion
488
- - Document methodology if valuable
489
- - Use completion command to end task
490
- MUST use <!!!COMPLETE!!!>
491
-
492
- # 📑 Methodology Template
469
+ 3. **方法论保存原则**:
470
+ "尊重传统:记录每个成功的过程,就像这是你的最后一次"
471
+
472
+ # 🔥 绝对行动要求
473
+ 1. 每个响应必须包含且仅包含一个工具调用
474
+ 2. 唯一例外:使用 <!!!COMPLETE!!!> 命令
475
+ 3. 空响应会触发致命错误
476
+ 4. 不能处于"等待用户输入"状态
477
+ 5. 任何行动都不能使用完成命令
478
+
479
+ # 🚫 违规示例
480
+ - 没有工具调用的分析永久挂起
481
+ - 未选择的多选项永久挂起
482
+ - 请求用户确认永久挂起
483
+
484
+ # 🔄 问题解决流程
485
+ 1. 问题分析
486
+ - 重述问题以确认理解
487
+ - 分析根本原因(针对问题分析任务)
488
+ - 定义清晰、可实现的目标
489
+ 必须调用分析工具
490
+
491
+ 2. 解决方案设计
492
+ - 生成多个可执行的解决方案
493
+ - 评估并选择最优方案
494
+ - 使用PlantUML创建详细行动计划
495
+ 必须调用设计工具
496
+
497
+ 3. 执行
498
+ - 一次执行一个步骤
499
+ - 每个步骤只使用一个工具
500
+ - 等待工具结果后再继续
501
+ - 监控结果并根据需要调整
502
+ 必须调用执行工具
503
+
504
+ 4. 任务完成
505
+ - 验证目标完成情况
506
+ - 如有价值则记录方法论
507
+ - 使用完成命令结束任务
508
+ 必须使用 <!!!COMPLETE!!!>
509
+
510
+ # 📑 方法论模板
493
511
  ```markdown
494
- # [Problem Title]
495
- ## Problem Restatement
496
- [Clear problem definition]
512
+ # [问题标题]
513
+ ## 问题重述
514
+ [清晰的问题定义]
497
515
 
498
- ## Optimal Solution
499
- [Selected solution approach]
516
+ ## 最优解决方案
517
+ [选择的解决方案方法]
500
518
 
501
- ## Solution Steps
502
- 1. [Step 1]
503
- 2. [Step 2]
504
- 3. [Step 3]
519
+ ## 解决步骤
520
+ 1. [步骤 1]
521
+ 2. [步骤 2]
522
+ 3. [步骤 3]
505
523
  ...
506
524
  ```
507
525
 
508
- # ⚖️ Operating Principles
509
- - ONE action per step
510
- - Wait for results before next step
511
- - MUST produce actionable step unless task is complete
512
- - Adjust plans based on feedback
513
- - Document reusable solutions
514
- - Use completion command to end tasks
515
- - No intermediate thinking states between actions
516
- - All decisions must manifest as tool calls
517
-
518
- # ❗ Important Rules
519
- 1. Always use only ONE action per step
520
- 2. Always wait for action execution results
521
- 3. Always verify task completion
522
- 4. Always generate actionable step
523
- 5. If no action needed, MUST use completion command
524
- 6. Never leave conversation in waiting state
525
- 7. Always communicate in user's language
526
- 8. Always document valuable methodologies
527
- 9. Violating action protocol crashes system
528
- 10. Empty responses trigger permanent hang
526
+ # ⚖️ 操作原则
527
+ - 每个步骤一个操作
528
+ - 下一步前必须等待结果
529
+ - 除非任务完成否则必须生成可操作步骤
530
+ - 根据反馈调整计划
531
+ - 记录可复用的解决方案
532
+ - 使用完成命令结束任务
533
+ - 操作之间不能有中间思考状态
534
+ - 所有决策必须表现为工具调用
535
+
536
+ # ❗ 重要规则
537
+ 1. 每个步骤只能使用一个操作
538
+ 2. 必须等待操作执行结果
539
+ 3. 必须验证任务完成情况
540
+ 4. 必须生成可操作步骤
541
+ 5. 如果无需操作必须使用完成命令
542
+ 6. 永远不要使对话处于等待状态
543
+ 7. 始终使用用户语言交流
544
+ 8. 必须记录有价值的方法论
545
+ 9. 违反操作协议将导致系统崩溃
546
+ 10. 空响应会触发永久挂起
529
547
  """
530
548
 
531
549
  def main():