jarvis-ai-assistant 0.1.223__tar.gz → 0.1.225__tar.gz

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 (117) hide show
  1. {jarvis_ai_assistant-0.1.223/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.225}/PKG-INFO +3 -2
  2. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/README.md +1 -0
  3. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/pyproject.toml +6 -2
  4. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/setup.py +2 -2
  5. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/__init__.py +30 -7
  7. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/builtin_input_handler.py +1 -4
  8. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/jarvis.py +81 -32
  9. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/main.py +6 -2
  10. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_agent/code_agent.py +5 -3
  11. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/loader.py +20 -6
  12. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_data/config_schema.json +37 -1
  13. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform_manager/main.py +18 -6
  14. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/cli.py +1 -1
  15. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/llm_interface.py +1 -3
  16. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_smart_shell/main.py +18 -12
  17. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/ask_user.py +1 -0
  18. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/registry.py +39 -19
  19. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/search_web.py +19 -9
  20. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/builtin_replace_map.py +0 -1
  21. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/config.py +10 -1
  22. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/git_utils.py +13 -14
  23. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/utils.py +1 -0
  24. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225/src/jarvis_ai_assistant.egg-info}/PKG-INFO +3 -2
  25. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis_ai_assistant.egg-info/requires.txt +1 -1
  26. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/LICENSE +0 -0
  27. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/MANIFEST.in +0 -0
  28. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/setup.cfg +0 -0
  29. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/edit_file_handler.py +0 -0
  30. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/output_handler.py +0 -0
  31. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/prompt_builder.py +0 -0
  32. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/prompts.py +0 -0
  33. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/protocols.py +0 -0
  34. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/session_manager.py +0 -0
  35. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/shell_input_handler.py +0 -0
  36. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_agent/tool_executor.py +0 -0
  37. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
  38. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_agent/lint.py +0 -0
  39. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/__init__.py +0 -0
  40. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/c_cpp.py +0 -0
  41. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/csharp.py +0 -0
  42. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/data_format.py +0 -0
  43. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/devops.py +0 -0
  44. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/docs.py +0 -0
  45. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/go.py +0 -0
  46. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/infrastructure.py +0 -0
  47. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/java.py +0 -0
  48. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/javascript.py +0 -0
  49. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/kotlin.py +0 -0
  50. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/php.py +0 -0
  51. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/python.py +0 -0
  52. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/ruby.py +0 -0
  53. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/rust.py +0 -0
  54. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/shell.py +0 -0
  55. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/sql.py +0 -0
  56. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/swift.py +0 -0
  57. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/checklists/web.py +0 -0
  58. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_code_analysis/code_review.py +0 -0
  59. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_data/tiktoken/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +0 -0
  60. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_git_details/__init__.py +0 -0
  61. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_git_details/main.py +0 -0
  62. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_git_squash/__init__.py +0 -0
  63. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_git_squash/main.py +0 -0
  64. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_git_utils/git_commiter.py +0 -0
  65. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_mcp/__init__.py +0 -0
  66. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_mcp/sse_mcp_client.py +0 -0
  67. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_mcp/stdio_mcp_client.py +0 -0
  68. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_mcp/streamable_mcp_client.py +0 -0
  69. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_methodology/main.py +0 -0
  70. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_multi_agent/__init__.py +0 -0
  71. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_multi_agent/main.py +0 -0
  72. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/__init__.py +0 -0
  73. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/ai8.py +0 -0
  74. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/base.py +0 -0
  75. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/human.py +0 -0
  76. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/kimi.py +0 -0
  77. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/openai.py +0 -0
  78. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/oyi.py +0 -0
  79. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/registry.py +0 -0
  80. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/tongyi.py +0 -0
  81. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform/yuanbao.py +0 -0
  82. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform_manager/__init__.py +0 -0
  83. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_platform_manager/service.py +0 -0
  84. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/__init__.py +0 -0
  85. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/cache.py +0 -0
  86. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/embedding_manager.py +0 -0
  87. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/query_rewriter.py +0 -0
  88. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/rag_pipeline.py +0 -0
  89. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/reranker.py +0 -0
  90. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_rag/retriever.py +0 -0
  91. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
  92. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/__init__.py +0 -0
  93. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/base.py +0 -0
  94. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/cli/__init__.py +0 -0
  95. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/cli/main.py +0 -0
  96. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/edit_file.py +0 -0
  97. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/execute_script.py +0 -0
  98. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/file_analyzer.py +0 -0
  99. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/generate_new_tool.py +0 -0
  100. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/methodology.py +0 -0
  101. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/read_code.py +0 -0
  102. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/read_webpage.py +0 -0
  103. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/rewrite_file.py +0 -0
  104. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_tools/virtual_tty.py +0 -0
  105. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/__init__.py +0 -0
  106. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/embedding.py +0 -0
  107. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/file_processors.py +0 -0
  108. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/globals.py +0 -0
  109. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/http.py +0 -0
  110. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/input.py +0 -0
  111. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/methodology.py +0 -0
  112. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/output.py +0 -0
  113. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis/jarvis_utils/tag.py +0 -0
  114. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +0 -0
  115. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  116. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -0
  117. {jarvis_ai_assistant-0.1.223 → jarvis_ai_assistant-0.1.225}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.223
3
+ Version: 0.1.225
4
4
  Summary: Jarvis: An AI assistant that uses tools to interact with the system
5
5
  Home-page: https://github.com/skyfireitdiy/Jarvis
6
6
  Author: skyfire
@@ -57,8 +57,8 @@ Requires-Dist: pyte==0.8.2
57
57
  Requires-Dist: httpx>=0.28.1
58
58
  Requires-Dist: pyyaml>=5.3.1
59
59
  Requires-Dist: ddgs==9.0.2
60
- Requires-Dist: beautifulsoup4==4.13.4
61
60
  Requires-Dist: lxml==6.0.0
61
+ Requires-Dist: markdownify>=1.1.0
62
62
  Provides-Extra: dev
63
63
  Requires-Dist: pytest; extra == "dev"
64
64
  Requires-Dist: black; extra == "dev"
@@ -158,6 +158,7 @@ jarvis --llm_type thinking -t "初始任务"
158
158
  | `-t/--task` | 直接从命令行输入任务内容 |
159
159
  | `-f/--config` | 自定义配置文件的路径 |
160
160
  | `--restore-session` | 从 .jarvis/saved_session.json 恢复会话 |
161
+ | `-e/--edit` | 编辑配置文件 |
161
162
 
162
163
  #### 4. 工作流程
163
164
  1. 初始化环境
@@ -74,6 +74,7 @@ jarvis --llm_type thinking -t "初始任务"
74
74
  | `-t/--task` | 直接从命令行输入任务内容 |
75
75
  | `-f/--config` | 自定义配置文件的路径 |
76
76
  | `--restore-session` | 从 .jarvis/saved_session.json 恢复会话 |
77
+ | `-e/--edit` | 编辑配置文件 |
77
78
 
78
79
  #### 4. 工作流程
79
80
  1. 初始化环境
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jarvis-ai-assistant"
7
- version = "0.1.223"
7
+ version = "0.1.225"
8
8
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "skyfire", email = "skyfireitdiy@hotmail.com" }]
@@ -39,8 +39,8 @@ dependencies = [
39
39
  "httpx>=0.28.1",
40
40
  "pyyaml>=5.3.1",
41
41
  "ddgs==9.0.2",
42
- "beautifulsoup4==4.13.4",
43
42
  "lxml==6.0.0",
43
+ "markdownify>=1.1.0",
44
44
  ]
45
45
  requires-python = ">=3.9"
46
46
 
@@ -89,3 +89,7 @@ jarvis-methodology = "jarvis.jarvis_methodology.main:main"
89
89
  jm = "jarvis.jarvis_methodology.main:main"
90
90
  jarvis-rag = "jarvis.jarvis_rag.cli:main"
91
91
  jrg = "jarvis.jarvis_rag.cli:main"
92
+
93
+ [[tool.uv.index]]
94
+ url = "https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/simple"
95
+ default = true
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages # type: ignore
3
3
 
4
4
  setup(
5
5
  name="jarvis-ai-assistant",
6
- version="0.1.223",
6
+ version="0.1.225",
7
7
  author="skyfire",
8
8
  author_email="skyfireitdiy@hotmail.com",
9
9
  description="An AI assistant that uses various tools to interact with the system",
@@ -34,8 +34,8 @@ setup(
34
34
  "httpx>=0.28.1",
35
35
  "pyyaml>=5.3.1",
36
36
  "ddgs==9.0.2",
37
- "beautifulsoup4==4.13.4",
38
37
  "lxml==6.0.0",
38
+ "markdownify>=1.1.0",
39
39
  ],
40
40
  extras_require={
41
41
  "dev": ["pytest", "black", "isort", "mypy", "build", "twine"],
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Jarvis AI Assistant"""
3
3
 
4
- __version__ = "0.1.223"
4
+ __version__ = "0.1.225"
@@ -92,6 +92,10 @@ class Agent:
92
92
  # 只有在记录启动时才停止记录
93
93
  delete_agent(self.name)
94
94
 
95
+ def get_tool_usage_prompt(self) -> str:
96
+ """获取工具使用提示"""
97
+ return build_action_prompt(self.output_handler) # type: ignore
98
+
95
99
  def __init__(
96
100
  self,
97
101
  system_prompt: str,
@@ -199,7 +203,7 @@ class Agent:
199
203
 
200
204
  PrettyOutput.print(welcome_message, OutputType.SYSTEM)
201
205
 
202
- action_prompt = build_action_prompt(self.output_handler) # type: ignore
206
+ action_prompt = self.get_tool_usage_prompt()
203
207
 
204
208
  self.model.set_system_prompt(
205
209
  f"""
@@ -209,6 +213,7 @@ class Agent:
209
213
  """
210
214
  )
211
215
  self.first = True
216
+ self.run_input_handlers_next_turn = False
212
217
 
213
218
  def set_user_data(self, key: str, value: Any):
214
219
  """Sets user data in the session."""
@@ -232,6 +237,10 @@ class Agent:
232
237
  """Sets the addon prompt in the session."""
233
238
  self.session.set_addon_prompt(addon_prompt)
234
239
 
240
+ def set_run_input_handlers_next_turn(self, value: bool):
241
+ """Sets the flag to run input handlers on the next turn."""
242
+ self.run_input_handlers_next_turn = value
243
+
235
244
  def set_after_tool_call_cb(self, cb: Callable[[Any], None]): # type: ignore
236
245
  """设置工具调用后回调函数。
237
246
 
@@ -260,7 +269,9 @@ class Agent:
260
269
  return handler
261
270
  return None
262
271
 
263
- def _call_model(self, message: str, need_complete: bool = False) -> str:
272
+ def _call_model(
273
+ self, message: str, need_complete: bool = False, run_input_handlers: bool = True
274
+ ) -> str:
264
275
  """调用AI模型并实现重试逻辑
265
276
 
266
277
  参数:
@@ -276,10 +287,11 @@ class Agent:
276
287
  3. 会自动添加附加提示
277
288
  4. 会检查并处理上下文长度限制
278
289
  """
279
- for handler in self.input_handler:
280
- message, need_return = handler(message, self)
281
- if need_return:
282
- return message
290
+ if run_input_handlers:
291
+ for handler in self.input_handler:
292
+ message, need_return = handler(message, self)
293
+ if need_return:
294
+ return message
283
295
 
284
296
  if self.session.addon_prompt:
285
297
  message += f"\n\n{self.session.addon_prompt}"
@@ -474,12 +486,20 @@ class Agent:
474
486
  try:
475
487
  set_agent(self.name, self)
476
488
 
489
+ run_input_handlers = True
477
490
  while True:
491
+ if self.run_input_handlers_next_turn:
492
+ run_input_handlers = True
493
+ self.run_input_handlers_next_turn = False
494
+
478
495
  if self.first:
479
496
  self._first_run()
480
497
  try:
481
- current_response = self._call_model(self.session.prompt, True)
498
+ current_response = self._call_model(
499
+ self.session.prompt, True, run_input_handlers
500
+ )
482
501
  self.session.prompt = ""
502
+ run_input_handlers = False
483
503
 
484
504
  if get_interrupt():
485
505
  set_interrupt(False)
@@ -487,6 +507,7 @@ class Agent:
487
507
  f"模型交互期间被中断,请输入用户干预信息:"
488
508
  )
489
509
  if user_input:
510
+ run_input_handlers = True
490
511
  # 如果有工具调用且用户确认继续,则将干预信息和工具执行结果拼接为prompt
491
512
  if any(
492
513
  handler.can_handle(current_response)
@@ -498,6 +519,7 @@ class Agent:
498
519
  self.session.prompt = (
499
520
  f"{user_input}\n\n{current_response}"
500
521
  )
522
+ run_input_handlers = False
501
523
  continue
502
524
  self.session.prompt += f"{user_input}"
503
525
  continue
@@ -525,6 +547,7 @@ class Agent:
525
547
 
526
548
  if user_input:
527
549
  self.session.prompt = user_input
550
+ run_input_handlers = True
528
551
  continue
529
552
 
530
553
  if not user_input:
@@ -38,10 +38,7 @@ def builtin_input_handler(user_input: str, agent_: Any) -> Tuple[str, bool]:
38
38
  agent.clear()
39
39
  return "", True
40
40
  elif tag == "ToolUsage":
41
- from jarvis.jarvis_tools.registry import ToolRegistry
42
- from jarvis.jarvis_agent.prompt_builder import build_action_prompt
43
- action_prompt = build_action_prompt(agent.output_handler) # type: ignore
44
- agent.set_addon_prompt(action_prompt)
41
+ agent.set_addon_prompt(agent.get_tool_usage_prompt())
45
42
  return "", False
46
43
  elif tag == "ReloadConfig":
47
44
  from jarvis.jarvis_utils.utils import load_config
@@ -1,8 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import argparse
3
3
  import os
4
+ import shutil
5
+ import subprocess
4
6
  import sys
5
- from typing import Dict
7
+ from pathlib import Path
8
+ from typing import Dict, Optional
6
9
 
7
10
  import yaml # type: ignore
8
11
  from prompt_toolkit import prompt # type: ignore
@@ -106,8 +109,8 @@ def _select_task(tasks: Dict[str, str]) -> str:
106
109
  PrettyOutput.print(f"选择任务失败: {str(val_err)}", OutputType.ERROR)
107
110
 
108
111
 
109
- def main() -> None:
110
-
112
+ def _parse_args() -> argparse.Namespace:
113
+ """Parse command line arguments."""
111
114
  parser = argparse.ArgumentParser(description="Jarvis AI assistant")
112
115
  parser.add_argument(
113
116
  "--llm_type",
@@ -129,44 +132,90 @@ def main() -> None:
129
132
  help="Restore session from .jarvis/saved_session.json",
130
133
  default=False,
131
134
  )
132
- args = parser.parse_args()
133
- init_env(
134
- "欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config
135
+ parser.add_argument(
136
+ "-e", "--edit", action="store_true", help="Edit the configuration file"
135
137
  )
138
+ return parser.parse_args()
136
139
 
137
- try:
138
- agent = Agent(
139
- system_prompt=origin_agent_system_prompt,
140
- llm_type=args.llm_type,
141
- input_handler=[shell_input_handler, builtin_input_handler],
142
- output_handler=[ToolRegistry()],
143
- need_summary=False,
144
- )
145
140
 
146
- # 尝试恢复会话
147
- if args.restore_session:
148
- if agent.restore_session():
149
- PrettyOutput.print("会话已成功恢复。", OutputType.SUCCESS)
150
- else:
151
- PrettyOutput.print("无法恢复会话。", OutputType.WARNING)
141
+ def _handle_edit_mode(args: argparse.Namespace) -> None:
142
+ """If edit flag is set, open config file in editor and exit."""
143
+ if not args.edit:
144
+ return
152
145
 
153
- # 优先处理命令行直接传入的任务
154
- if args.task:
155
- agent.run(args.task)
146
+ config_file_path = (
147
+ Path(args.config)
148
+ if args.config
149
+ else Path(os.path.expanduser("~/.jarvis/config.yaml"))
150
+ )
151
+ editors = ["nvim", "vim", "vi"]
152
+ editor = next((e for e in editors if shutil.which(e)), None)
153
+
154
+ if editor:
155
+ try:
156
+ subprocess.run([editor, str(config_file_path)], check=True)
156
157
  sys.exit(0)
158
+ except (subprocess.CalledProcessError, FileNotFoundError) as e:
159
+ PrettyOutput.print(f"Failed to open editor: {e}", OutputType.ERROR)
160
+ sys.exit(1)
161
+ else:
162
+ PrettyOutput.print(
163
+ "No suitable editor found (nvim, vim, vi).", OutputType.ERROR
164
+ )
165
+ sys.exit(1)
166
+
157
167
 
158
- if agent.first:
159
- tasks = _load_tasks()
160
- if tasks and (selected_task := _select_task(tasks)):
161
- PrettyOutput.print(f"开始执行任务: \n{selected_task}", OutputType.INFO)
162
- agent.run(selected_task)
163
- sys.exit(0)
168
+ def _initialize_agent(args: argparse.Namespace) -> Agent:
169
+ """Initialize the agent and restore session if requested."""
170
+ agent = Agent(
171
+ system_prompt=origin_agent_system_prompt,
172
+ llm_type=args.llm_type,
173
+ input_handler=[shell_input_handler, builtin_input_handler],
174
+ output_handler=[ToolRegistry()], # type: ignore
175
+ need_summary=False,
176
+ )
164
177
 
165
- user_input = get_multiline_input("请输入你的任务(输入空行退出):")
166
- if user_input:
167
- agent.run(user_input)
178
+ # 尝试恢复会话
179
+ if args.restore_session:
180
+ if agent.restore_session():
181
+ PrettyOutput.print("会话已成功恢复。", OutputType.SUCCESS)
182
+ else:
183
+ PrettyOutput.print("无法恢复会话。", OutputType.WARNING)
184
+ return agent
185
+
186
+
187
+ def _get_and_run_task(agent: Agent, task_content: Optional[str] = None) -> None:
188
+ """Get task from various sources and run it."""
189
+ # 优先处理命令行直接传入的任务
190
+ if task_content:
191
+ agent.run(task_content)
168
192
  sys.exit(0)
169
193
 
194
+ if agent.first:
195
+ tasks = _load_tasks()
196
+ if tasks and (selected_task := _select_task(tasks)):
197
+ PrettyOutput.print(f"开始执行任务: \n{selected_task}", OutputType.INFO)
198
+ agent.run(selected_task)
199
+ sys.exit(0)
200
+
201
+ user_input = get_multiline_input("请输入你的任务(输入空行退出):")
202
+ if user_input:
203
+ agent.run(user_input)
204
+ sys.exit(0)
205
+
206
+
207
+ def main() -> None:
208
+ """Main function for Jarvis AI assistant."""
209
+ args = _parse_args()
210
+ _handle_edit_mode(args)
211
+
212
+ init_env(
213
+ "欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config
214
+ )
215
+
216
+ try:
217
+ agent = _initialize_agent(args)
218
+ _get_and_run_task(agent, args.task)
170
219
  except Exception as err: # pylint: disable=broad-except
171
220
  PrettyOutput.print(f"初始化错误: {str(err)}", OutputType.ERROR)
172
221
  sys.exit(1)
@@ -20,7 +20,9 @@ def load_config(config_path: str) -> dict:
20
20
  dict: 配置字典
21
21
  """
22
22
  if not os.path.exists(config_path):
23
- PrettyOutput.print(f"配置文件 {config_path} 不存在,使用默认配置", OutputType.WARNING)
23
+ PrettyOutput.print(
24
+ f"配置文件 {config_path} 不存在,使用默认配置", OutputType.WARNING
25
+ )
24
26
  return {}
25
27
 
26
28
  with open(config_path, "r", encoding="utf-8", errors="ignore") as f:
@@ -53,7 +55,9 @@ def main():
53
55
  args = parser.parse_args()
54
56
 
55
57
  # Initialize environment
56
- init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config)
58
+ init_env(
59
+ "欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config
60
+ )
57
61
 
58
62
  # Load configuration
59
63
  config = load_config(args.agent_definition) if args.agent_definition else {}
@@ -18,7 +18,10 @@ from jarvis.jarvis_code_agent.lint import get_lint_tools
18
18
  from jarvis.jarvis_git_utils.git_commiter import GitCommitTool
19
19
  from jarvis.jarvis_platform.registry import PlatformRegistry
20
20
  from jarvis.jarvis_tools.registry import ToolRegistry
21
- from jarvis.jarvis_utils.config import is_confirm_before_apply_patch, is_enable_static_analysis
21
+ from jarvis.jarvis_utils.config import (
22
+ is_confirm_before_apply_patch,
23
+ is_enable_static_analysis,
24
+ )
22
25
  from jarvis.jarvis_utils.git_utils import (
23
26
  confirm_add_new_files,
24
27
  find_git_root_and_cd,
@@ -54,7 +57,6 @@ class CodeAgent:
54
57
  "search_web",
55
58
  "ask_user",
56
59
  "read_code",
57
- "methodology",
58
60
  "rewrite_file",
59
61
  ]
60
62
  )
@@ -116,7 +118,7 @@ class CodeAgent:
116
118
  system_prompt=code_system_prompt,
117
119
  name="CodeAgent",
118
120
  auto_complete=False,
119
- output_handler=[tool_registry, EditFileHandler()],
121
+ output_handler=[tool_registry, EditFileHandler()], # type: ignore
120
122
  llm_type=llm_type,
121
123
  input_handler=[shell_input_handler, builtin_input_handler],
122
124
  need_summary=need_summary,
@@ -5,12 +5,26 @@ Utility module for loading language-specific code review checklists.
5
5
  from typing import Dict, Optional
6
6
 
7
7
  # Import checklist modules
8
- from jarvis.jarvis_code_analysis.checklists import (c_cpp, csharp, data_format,
9
- devops, docs, go,
10
- infrastructure, java,
11
- javascript, kotlin, php,
12
- python, ruby, rust, shell,
13
- sql, swift, web)
8
+ from jarvis.jarvis_code_analysis.checklists import (
9
+ c_cpp,
10
+ csharp,
11
+ data_format,
12
+ devops,
13
+ docs,
14
+ go,
15
+ infrastructure,
16
+ java,
17
+ javascript,
18
+ kotlin,
19
+ php,
20
+ python,
21
+ ruby,
22
+ rust,
23
+ shell,
24
+ sql,
25
+ swift,
26
+ web,
27
+ )
14
28
 
15
29
  # Map of language identifiers to their checklist content
16
30
  CHECKLIST_MAP = {
@@ -176,6 +176,14 @@
176
176
  "description": "是否启用任务分析",
177
177
  "default": true
178
178
  },
179
+ "JARVIS_TOOL_LOAD_DIRS": {
180
+ "type": "array",
181
+ "description": "自定义工具加载目录",
182
+ "items": {
183
+ "type": "string"
184
+ },
185
+ "default": []
186
+ },
179
187
  "JARVIS_PRINT_PROMPT": {
180
188
  "type": "boolean",
181
189
  "description": "是否打印提示",
@@ -229,7 +237,35 @@
229
237
  "template"
230
238
  ]
231
239
  }
240
+ },
241
+ "OPENAI_API_KEY": {
242
+ "type": "string",
243
+ "description": "OpenAI API Key"
244
+ },
245
+ "OPENAI_API_BASE": {
246
+ "type": "string",
247
+ "description": "OpenAI API Base URL"
248
+ },
249
+ "KIMI_API_KEY": {
250
+ "type": "string",
251
+ "description": "Kimi API Key"
252
+ },
253
+ "TONGYI_COOKIES": {
254
+ "type": "string",
255
+ "description": "Tongyi Cookies"
256
+ },
257
+ "YUANBAO_COOKIES": {
258
+ "type": "string",
259
+ "description": "Yuanbao Cookies"
260
+ },
261
+ "AI8_API_KEY": {
262
+ "type": "string",
263
+ "description": "AI8 API Key"
264
+ },
265
+ "OYI_API_KEY": {
266
+ "type": "string",
267
+ "description": "Oyi API Key"
232
268
  }
233
269
  },
234
- "additionalProperties": false
270
+ "additionalProperties": true
235
271
  }
@@ -188,9 +188,13 @@ def chat_with_model(platform_name: str, model_name: str, system_prompt: str) ->
188
188
  for entry in conversation_history:
189
189
  file_obj.write(f"{entry['role']}: {entry['content']}\n\n")
190
190
 
191
- PrettyOutput.print(f"所有对话已保存到 {file_path}", OutputType.SUCCESS)
191
+ PrettyOutput.print(
192
+ f"所有对话已保存到 {file_path}", OutputType.SUCCESS
193
+ )
192
194
  except Exception as exc:
193
- PrettyOutput.print(f"保存所有对话失败: {str(exc)}", OutputType.ERROR)
195
+ PrettyOutput.print(
196
+ f"保存所有对话失败: {str(exc)}", OutputType.ERROR
197
+ )
194
198
  continue
195
199
 
196
200
  # Check if it is a save_session command
@@ -211,7 +215,9 @@ def chat_with_model(platform_name: str, model_name: str, system_prompt: str) ->
211
215
  file_path = file_path[1:-1]
212
216
 
213
217
  if platform.save(file_path):
214
- PrettyOutput.print(f"会话已保存到 {file_path}", OutputType.SUCCESS)
218
+ PrettyOutput.print(
219
+ f"会话已保存到 {file_path}", OutputType.SUCCESS
220
+ )
215
221
  else:
216
222
  PrettyOutput.print("保存会话失败", OutputType.ERROR)
217
223
  except Exception as exc:
@@ -237,7 +243,9 @@ def chat_with_model(platform_name: str, model_name: str, system_prompt: str) ->
237
243
 
238
244
  if platform.restore(file_path):
239
245
  conversation_history = [] # Clear local history after loading
240
- PrettyOutput.print(f"会话已从 {file_path} 加载", OutputType.SUCCESS)
246
+ PrettyOutput.print(
247
+ f"会话已从 {file_path} 加载", OutputType.SUCCESS
248
+ )
241
249
  else:
242
250
  PrettyOutput.print("加载会话失败", OutputType.ERROR)
243
251
  except Exception as exc:
@@ -433,8 +441,12 @@ def main() -> None:
433
441
  service_parser.add_argument(
434
442
  "--port", type=int, default=8000, help="服务端口 (默认: 8000)"
435
443
  )
436
- service_parser.add_argument("--platform", "-p", help="指定默认平台,当客户端未指定平台时使用")
437
- service_parser.add_argument("--model", "-m", help="指定默认模型,当客户端未指定平台时使用")
444
+ service_parser.add_argument(
445
+ "--platform", "-p", help="指定默认平台,当客户端未指定平台时使用"
446
+ )
447
+ service_parser.add_argument(
448
+ "--model", "-m", help="指定默认模型,当客户端未指定平台时使用"
449
+ )
438
450
  service_parser.set_defaults(func=service_command)
439
451
 
440
452
  # role subcommand
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
  from typing import Optional, List, Literal, cast
5
5
  import mimetypes
6
6
 
7
- import pathspec
7
+ import pathspec # type: ignore
8
8
  import typer
9
9
  from langchain.docstore.document import Document
10
10
  from langchain_community.document_loaders import (
@@ -101,9 +101,7 @@ class JarvisPlatform_LLM(LLMInterface):
101
101
  try:
102
102
  self.registry = PlatformRegistry.get_global_platform_registry()
103
103
  self.platform: BasePlatform = self.registry.get_normal_platform()
104
- self.platform.set_suppress_output(
105
- False
106
- ) # 确保模型没有控制台输出
104
+ self.platform.set_suppress_output(False) # 确保模型没有控制台输出
107
105
  print(f"🚀 已初始化 Jarvis 平台 LLM,模型: {self.platform.name()}")
108
106
  except Exception as e:
109
107
  print(f"❌ 初始化 Jarvis 平台 LLM 失败: {e}")
@@ -20,34 +20,37 @@ def execute_command(command: str, should_run: bool) -> None:
20
20
 
21
21
  def _check_fish_shell() -> bool:
22
22
  """Check if current shell is fish
23
-
23
+
24
24
  Returns:
25
25
  bool: True if fish shell, False otherwise
26
26
  """
27
27
  return get_shell_name() == "fish"
28
28
 
29
+
29
30
  def _get_config_file() -> str:
30
31
  """Get fish config file path
31
-
32
+
32
33
  Returns:
33
34
  str: Path to fish config file
34
35
  """
35
36
  return os.path.expanduser("~/.config/fish/config.fish")
36
37
 
38
+
37
39
  def _get_markers() -> Tuple[str, str]:
38
40
  """Get start and end markers for JSS completion
39
-
41
+
40
42
  Returns:
41
43
  Tuple[str, str]: (start_marker, end_marker)
42
44
  """
43
45
  return (
44
46
  "# ===== JARVIS JSS FISH COMPLETION START =====",
45
- "# ===== JARVIS JSS FISH COMPLETION END ====="
47
+ "# ===== JARVIS JSS FISH COMPLETION END =====",
46
48
  )
47
49
 
50
+
48
51
  def install_jss_completion() -> int:
49
52
  """Install JSS fish shell command completion
50
-
53
+
51
54
  Returns:
52
55
  int: 0 if success, 1 if failed
53
56
  """
@@ -70,7 +73,8 @@ def install_jss_completion() -> int:
70
73
  return 0
71
74
 
72
75
  with open(config_file, "a") as f:
73
- f.write(f"""
76
+ f.write(
77
+ f"""
74
78
  {start_marker}
75
79
  function fish_command_not_found
76
80
  if test (string length "$argv") -lt 10
@@ -83,13 +87,15 @@ function __fish_command_not_found_handler --on-event fish_command_not_found
83
87
  fish_command_not_found "$argv"
84
88
  end
85
89
  {end_marker}
86
- """)
90
+ """
91
+ )
87
92
  print("JSS fish completion已安装,请执行: source ~/.config/fish/config.fish")
88
93
  return 0
89
94
 
95
+
90
96
  def uninstall_jss_completion() -> int:
91
97
  """Uninstall JSS fish shell command completion
92
-
98
+
93
99
  Returns:
94
100
  int: 0 if success, 1 if failed
95
101
  """
@@ -112,10 +118,10 @@ def uninstall_jss_completion() -> int:
112
118
  return 0
113
119
 
114
120
  new_content = content.split(start_marker)[0] + content.split(end_marker)[-1]
115
-
121
+
116
122
  with open(config_file, "w") as f:
117
123
  f.write(new_content)
118
-
124
+
119
125
  print("JSS fish completion已卸载,请执行: source ~/.config/fish/config.fish")
120
126
  return 0
121
127
 
@@ -205,7 +211,7 @@ Example:
205
211
  install_parser.add_argument(
206
212
  "--shell", choices=["fish"], default="fish", help="指定shell类型(仅支持fish)"
207
213
  )
208
-
214
+
209
215
  # 添加uninstall子命令
210
216
  uninstall_parser = subparsers.add_parser(
211
217
  "uninstall", help="卸载JSS fish shell命令补全功能"
@@ -232,7 +238,7 @@ Example:
232
238
  print(f"错误: 不支持的shell类型: {args.shell}, 仅支持fish")
233
239
  return 1
234
240
  return uninstall_jss_completion()
235
-
241
+
236
242
  # 处理request命令
237
243
  if not args.request:
238
244
  # 检查是否在交互式终端中运行