jarvis-ai-assistant 0.1.180__tar.gz → 0.1.182__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 (107) hide show
  1. {jarvis_ai_assistant-0.1.180/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.182}/PKG-INFO +4 -5
  2. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/README.md +2 -4
  3. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/pyproject.toml +2 -3
  4. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/setup.py +2 -3
  5. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_agent/__init__.py +13 -3
  7. jarvis_ai_assistant-0.1.182/src/jarvis/jarvis_agent/file_input_handler.py +112 -0
  8. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_agent/code_agent.py +36 -106
  9. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_data/config_schema.json +28 -58
  10. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_dev/main.py +66 -112
  11. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/base.py +4 -2
  12. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/yuanbao.py +0 -1
  13. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/code_plan.py +1 -3
  14. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/edit_file.py +12 -0
  15. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/execute_script.py +31 -8
  16. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/file_operation.py +13 -3
  17. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/read_code.py +12 -2
  18. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/builtin_replace_map.py +0 -48
  19. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/config.py +8 -8
  20. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/git_utils.py +61 -1
  21. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/utils.py +32 -3
  22. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182/src/jarvis_ai_assistant.egg-info}/PKG-INFO +4 -5
  23. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +1 -2
  24. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -2
  25. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis_ai_assistant.egg-info/requires.txt +1 -0
  26. jarvis_ai_assistant-0.1.180/src/jarvis/jarvis_tools/ask_codebase.py +0 -294
  27. jarvis_ai_assistant-0.1.180/src/jarvis/jarvis_tools/find_methodology.py +0 -73
  28. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/LICENSE +0 -0
  29. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/MANIFEST.in +0 -0
  30. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/setup.cfg +0 -0
  31. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_agent/builtin_input_handler.py +0 -0
  32. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_agent/jarvis.py +0 -0
  33. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_agent/main.py +0 -0
  34. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_agent/output_handler.py +0 -0
  35. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_agent/shell_input_handler.py +0 -0
  36. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
  37. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_agent/lint.py +0 -0
  38. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/__init__.py +0 -0
  39. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/c_cpp.py +0 -0
  40. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/csharp.py +0 -0
  41. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/data_format.py +0 -0
  42. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/devops.py +0 -0
  43. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/docs.py +0 -0
  44. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/go.py +0 -0
  45. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/infrastructure.py +0 -0
  46. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/java.py +0 -0
  47. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/javascript.py +0 -0
  48. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/kotlin.py +0 -0
  49. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/loader.py +0 -0
  50. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/php.py +0 -0
  51. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/python.py +0 -0
  52. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/ruby.py +0 -0
  53. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/rust.py +0 -0
  54. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/shell.py +0 -0
  55. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/sql.py +0 -0
  56. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/swift.py +0 -0
  57. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/checklists/web.py +0 -0
  58. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_code_analysis/code_review.py +0 -0
  59. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_data/huggingface.tar.gz +0 -0
  60. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_event/__init__.py +0 -0
  61. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_git_details/__init__.py +0 -0
  62. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_git_details/main.py +0 -0
  63. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_git_squash/__init__.py +0 -0
  64. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_git_squash/main.py +0 -0
  65. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_git_utils/git_commiter.py +0 -0
  66. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_mcp/__init__.py +0 -0
  67. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_mcp/sse_mcp_client.py +0 -0
  68. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_mcp/stdio_mcp_client.py +0 -0
  69. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_mcp/streamable_mcp_client.py +0 -0
  70. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_methodology/main.py +0 -0
  71. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_multi_agent/__init__.py +0 -0
  72. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_multi_agent/main.py +0 -0
  73. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/__init__.py +0 -0
  74. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/human.py +0 -0
  75. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/kimi.py +0 -0
  76. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/openai.py +0 -0
  77. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform/registry.py +0 -0
  78. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform_manager/__init__.py +0 -0
  79. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_platform_manager/main.py +0 -0
  80. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
  81. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_smart_shell/main.py +0 -0
  82. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/__init__.py +0 -0
  83. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/ask_user.py +0 -0
  84. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/base.py +0 -0
  85. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/chdir.py +0 -0
  86. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/cli/__init__.py +0 -0
  87. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/cli/main.py +0 -0
  88. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/create_code_agent.py +0 -0
  89. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/create_sub_agent.py +0 -0
  90. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/file_analyzer.py +0 -0
  91. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/generate_new_tool.py +0 -0
  92. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/methodology.py +0 -0
  93. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/read_webpage.py +0 -0
  94. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/registry.py +0 -0
  95. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/rewrite_file.py +0 -0
  96. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/search_web.py +0 -0
  97. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_tools/virtual_tty.py +0 -0
  98. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/__init__.py +0 -0
  99. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/embedding.py +0 -0
  100. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/file_processors.py +0 -0
  101. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/globals.py +0 -0
  102. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/input.py +0 -0
  103. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/methodology.py +0 -0
  104. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/output.py +0 -0
  105. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis/jarvis_utils/tag.py +0 -0
  106. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  107. {jarvis_ai_assistant-0.1.180 → jarvis_ai_assistant-0.1.182}/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.180
3
+ Version: 0.1.182
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
@@ -55,6 +55,7 @@ Requires-Dist: python-Levenshtein==0.25.1
55
55
  Requires-Dist: pillow==10.2.0
56
56
  Requires-Dist: openai==1.78.1
57
57
  Requires-Dist: tabulate==0.9.0
58
+ Requires-Dist: pyte==0.8.2
58
59
  Provides-Extra: dev
59
60
  Requires-Dist: pytest; extra == "dev"
60
61
  Requires-Dist: black; extra == "dev"
@@ -212,8 +213,8 @@ OPENAI_API_BASE: https://api.openai.com/v1 # 可选,默认为官方API地址
212
213
  | `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
213
214
  | `JARVIS_GIT_COMMIT_PROMPT` | "" | 自定义git提交信息生成提示模板 |
214
215
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
215
- | `JARVIS_USE_METHODOLOGY` | false | 是否启用方法论功能 |
216
- | `JARVIS_USE_ANALYSIS` | false | 是否启用任务分析功能 |
216
+ | `JARVIS_USE_METHODOLOGY` | true | 是否启用方法论功能 |
217
+ | `JARVIS_USE_ANALYSIS` | true | 是否启用任务分析功能 |
217
218
  | `JARVIS_DATA_PATH` | ~/.jarvis | Jarvis数据存储目录路径 |
218
219
 
219
220
  所有配置编写到`~/.jarvis/config.yaml`文件中即可生效。
@@ -232,7 +233,6 @@ ENV:
232
233
  ### 内置工具
233
234
  | 工具名称 | 描述 |
234
235
  |----------|------|
235
- | ask_codebase | 智能代码库查询和分析,用于定位功能所在文件和理解单点实现,适合查询特定功能位置和实现原理 |
236
236
  | ask_user | 交互式用户输入收集 |
237
237
  | chdir | 更改当前工作目录 |
238
238
  | rewrite_file | 文件重写工具,用于完全重写或创建文件,提供完整的文件内容替换 |
@@ -243,7 +243,6 @@ ENV:
243
243
  | execute_script | 执行脚本并返回结果,支持任意解释器。 |
244
244
  | file_analyzer | 分析文件内容并提取关键信息。支持的文件:文本文件、word文档、pdf文件、图片 |
245
245
  | file_operation | 文件批量操作工具,可批量读写多个文件,支持文本文件,适用于需要同时处理多个文件的场景(读取配置文件、保存生成内容等) |
246
- | find_methodology | 方法论查找工具,用于在执行过程中查看历史方法论辅助决策 |
247
246
  | methodology | 方法论管理工具,支持添加、更新和删除操作 |
248
247
  | read_code | 代码阅读与分析工具,用于读取源代码文件并添加行号,针对代码文件优化,提供更好的格式化输出和行号显示,适用于代码分析、审查和理解代码实现的场景 |
249
248
  | read_webpage | 读取网页内容并分析 |
@@ -143,8 +143,8 @@ OPENAI_API_BASE: https://api.openai.com/v1 # 可选,默认为官方API地址
143
143
  | `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
144
144
  | `JARVIS_GIT_COMMIT_PROMPT` | "" | 自定义git提交信息生成提示模板 |
145
145
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
146
- | `JARVIS_USE_METHODOLOGY` | false | 是否启用方法论功能 |
147
- | `JARVIS_USE_ANALYSIS` | false | 是否启用任务分析功能 |
146
+ | `JARVIS_USE_METHODOLOGY` | true | 是否启用方法论功能 |
147
+ | `JARVIS_USE_ANALYSIS` | true | 是否启用任务分析功能 |
148
148
  | `JARVIS_DATA_PATH` | ~/.jarvis | Jarvis数据存储目录路径 |
149
149
 
150
150
  所有配置编写到`~/.jarvis/config.yaml`文件中即可生效。
@@ -163,7 +163,6 @@ ENV:
163
163
  ### 内置工具
164
164
  | 工具名称 | 描述 |
165
165
  |----------|------|
166
- | ask_codebase | 智能代码库查询和分析,用于定位功能所在文件和理解单点实现,适合查询特定功能位置和实现原理 |
167
166
  | ask_user | 交互式用户输入收集 |
168
167
  | chdir | 更改当前工作目录 |
169
168
  | rewrite_file | 文件重写工具,用于完全重写或创建文件,提供完整的文件内容替换 |
@@ -174,7 +173,6 @@ ENV:
174
173
  | execute_script | 执行脚本并返回结果,支持任意解释器。 |
175
174
  | file_analyzer | 分析文件内容并提取关键信息。支持的文件:文本文件、word文档、pdf文件、图片 |
176
175
  | file_operation | 文件批量操作工具,可批量读写多个文件,支持文本文件,适用于需要同时处理多个文件的场景(读取配置文件、保存生成内容等) |
177
- | find_methodology | 方法论查找工具,用于在执行过程中查看历史方法论辅助决策 |
178
176
  | methodology | 方法论管理工具,支持添加、更新和删除操作 |
179
177
  | read_code | 代码阅读与分析工具,用于读取源代码文件并添加行号,针对代码文件优化,提供更好的格式化输出和行号显示,适用于代码分析、审查和理解代码实现的场景 |
180
178
  | read_webpage | 读取网页内容并分析 |
@@ -8,7 +8,7 @@ default = true
8
8
 
9
9
  [project]
10
10
  name = "jarvis-ai-assistant"
11
- version = "0.1.180"
11
+ version = "0.1.182"
12
12
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
13
13
  readme = "README.md"
14
14
  authors = [{ name = "skyfire", email = "skyfireitdiy@hotmail.com" }]
@@ -41,6 +41,7 @@ dependencies = [
41
41
  "pillow==10.2.0",
42
42
  "openai==1.78.1",
43
43
  "tabulate==0.9.0",
44
+ "pyte==0.8.2",
44
45
  ]
45
46
  requires-python = ">=3.8"
46
47
 
@@ -65,7 +66,5 @@ jarvis-git-squash = "jarvis.jarvis_git_squash.main:main"
65
66
  jarvis-multi-agent = "jarvis.jarvis_multi_agent.main:main"
66
67
  jarvis-agent = "jarvis.jarvis_agent.main:main"
67
68
  jarvis-tool = "jarvis.jarvis_tools.cli.main:main"
68
- jarvis-ask-codebase = "jarvis.jarvis_tools.ask_codebase:main"
69
- jac = "jarvis.jarvis_tools.ask_codebase:main"
70
69
  jarvis-git-details = "jarvis.jarvis_git_details.main:main"
71
70
  jarvis-methodology = "jarvis.jarvis_methodology.main:main"
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name="jarvis-ai-assistant",
6
- version="0.1.180",
6
+ version="0.1.182",
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",
@@ -35,6 +35,7 @@ setup(
35
35
  "pillow==10.2.0",
36
36
  "openai==1.78.1",
37
37
  "tabulate==0.9.0",
38
+ "pyte==0.8.2",
38
39
  ],
39
40
  extras_require={
40
41
  "dev": ["pytest", "black", "isort", "mypy", "build", "twine"]
@@ -55,8 +56,6 @@ setup(
55
56
  "jarvis-multi-agent=jarvis.jarvis_multi_agent.main:main",
56
57
  "jarvis-agent=jarvis.jarvis_agent.main:main",
57
58
  "jarvis-tool=jarvis.jarvis_tools.cli.main:main",
58
- "jarvis-ask-codebase=jarvis.jarvis_tools.ask_codebase:main",
59
- "jac=jarvis.jarvis_tools.ask_codebase:main",
60
59
  "jarvis-git-details=jarvis.jarvis_git_details.main:main",
61
60
  "jarvis-methodology=jarvis.jarvis_methodology.main:main",
62
61
  ],
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Jarvis AI Assistant"""
3
3
 
4
- __version__ = "0.1.180"
4
+ __version__ = "0.1.182"
@@ -2,7 +2,7 @@
2
2
  # 标准库导入
3
3
  import datetime
4
4
  import platform
5
- from typing import Any, Callable, List, Optional, Protocol, Tuple, Union
5
+ from typing import Any, Callable, Dict, List, Optional, Protocol, Tuple, Union
6
6
 
7
7
  # 第三方库导入
8
8
  from yaspin import yaspin # type: ignore
@@ -205,6 +205,8 @@ class Agent:
205
205
  if model_name is not None:
206
206
  self.model.set_model_name(model_name)
207
207
 
208
+ self.user_data: Dict[str, Any] = {}
209
+
208
210
  self.model.set_suppress_output(False)
209
211
 
210
212
  from jarvis.jarvis_tools.registry import ToolRegistry
@@ -319,6 +321,14 @@ class Agent:
319
321
  )
320
322
  self.first = True
321
323
 
324
+ def set_user_data(self, key: str, value: Any):
325
+ """设置用户数据"""
326
+ self.user_data[key] = value
327
+
328
+ def get_user_data(self, key: str) -> Optional[Any]:
329
+ """获取用户数据"""
330
+ return self.user_data.get(key, None)
331
+
322
332
  def set_use_tools(self, use_tools):
323
333
  """设置要使用的工具列表"""
324
334
  from jarvis.jarvis_tools.registry import ToolRegistry
@@ -372,7 +382,7 @@ class Agent:
372
382
  )
373
383
 
374
384
  addon_prompt = f"""
375
- [系统提示开始]
385
+ <system_prompt>
376
386
  请判断是否已经完成任务,如果已经完成:
377
387
  - 直接输出完成原因,不需要再有新的操作,不要输出{ot("TOOL_CALL")}标签
378
388
  {complete_prompt}
@@ -381,7 +391,7 @@ class Agent:
381
391
  - 如果信息不明确,请请求用户补充
382
392
  - 如果执行过程中连续失败5次,请使用ask_user询问用户操作
383
393
  - 操作列表:{action_handlers}
384
- [系统提示结束]
394
+ </system_prompt>
385
395
 
386
396
  请继续。
387
397
  """
@@ -0,0 +1,112 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ import os
5
+ import re
6
+ from typing import Any, Tuple
7
+
8
+ from yaspin import yaspin
9
+
10
+ from jarvis.jarvis_tools.file_operation import FileOperationTool
11
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
12
+ from jarvis.jarvis_utils.utils import is_context_overflow
13
+
14
+
15
+ def file_input_handler(user_input: str, agent: Any) -> Tuple[str, bool]:
16
+ """Process user input containing file references and read file contents.
17
+
18
+ Args:
19
+ user_input: Input string that may contain file references in format:
20
+ - 'file_path' (whole file)
21
+ - 'file_path:start_line,end_line' (line range)
22
+ - 'file_path:start_line:end_line' (alternative range format)
23
+ agent: Agent object for further processing (currently unused)
24
+
25
+ Returns:
26
+ Tuple[str, bool]:
27
+ - Processed prompt string with file contents prepended
28
+ - Boolean indicating if context overflow occurred
29
+ """
30
+ prompt = user_input
31
+ files = []
32
+
33
+ file_refs = re.findall(r"'([^']+)'", user_input)
34
+ for ref in file_refs:
35
+ # Handle file:start,end or file:start:end format
36
+ if ':' in ref:
37
+ file_path, line_range = ref.split(':', 1)
38
+ # Initialize with default values
39
+ start_line = 1 # 1-based
40
+ end_line = -1
41
+
42
+ # Process line range if specified
43
+ if ',' in line_range or ':' in line_range:
44
+ try:
45
+ raw_start, raw_end = map(int, re.split(r'[,:]', line_range))
46
+
47
+ # Handle special values and Python-style negative indices
48
+ try:
49
+ with open(file_path, 'r', encoding='utf-8', errors="ignore") as f:
50
+ total_lines = len(f.readlines())
51
+ except FileNotFoundError:
52
+ PrettyOutput.print(f"文件不存在: {file_path}", OutputType.WARNING)
53
+ continue
54
+ # Process start line (0 means whole file, negative means from end)
55
+ if raw_start == 0: # 0表示整个文件
56
+ start_line = 1
57
+ end_line = total_lines
58
+ else:
59
+ start_line = raw_start if raw_start > 0 else total_lines + raw_start + 1
60
+
61
+ # Process end line
62
+ if raw_end == 0: # 0表示整个文件(如果start也是0)
63
+ end_line = total_lines
64
+ else:
65
+ end_line = raw_end if raw_end > 0 else total_lines + raw_end + 1
66
+
67
+ # Auto-correct ranges
68
+ start_line = max(1, min(start_line, total_lines))
69
+ end_line = max(start_line, min(end_line, total_lines))
70
+
71
+ # Final validation
72
+ if start_line < 1 or end_line > total_lines or start_line > end_line:
73
+ raise ValueError
74
+
75
+ except:
76
+ continue
77
+
78
+ # Add file if it exists
79
+ if os.path.isfile(file_path):
80
+ files.append({
81
+ "path": file_path,
82
+ "start_line": start_line,
83
+ "end_line": end_line
84
+ })
85
+ else:
86
+ # Handle simple file path
87
+ if os.path.isfile(ref):
88
+ files.append({
89
+ "path": ref,
90
+ "start_line": 1, # 1-based
91
+ "end_line": -1
92
+ })
93
+
94
+ # Read and process files if any were found
95
+ if files:
96
+ with yaspin(text="正在读取文件...", color="cyan") as spinner:
97
+ old_prompt = prompt
98
+ result = FileOperationTool().execute({"operation":"read","files": files})
99
+ if result["success"]:
100
+ spinner.text = "文件读取完成"
101
+ spinner.ok("✅")
102
+ # Prepend file contents to prompt and check for overflow
103
+ prompt = f"""{prompt}
104
+
105
+ <file_context>
106
+ {result["stdout"]}
107
+ </file_context>"""
108
+ if is_context_overflow(prompt):
109
+ return old_prompt, False
110
+
111
+ return prompt, False
112
+
@@ -8,13 +8,14 @@ import argparse
8
8
  import os
9
9
  import subprocess
10
10
  import sys
11
- from typing import Any, Dict, List, Optional, Tuple
11
+ from typing import List, Optional, Tuple
12
12
 
13
13
  from yaspin import yaspin # type: ignore
14
14
 
15
15
  from jarvis import __version__
16
16
  from jarvis.jarvis_agent import Agent
17
17
  from jarvis.jarvis_agent.builtin_input_handler import builtin_input_handler
18
+ from jarvis.jarvis_agent.file_input_handler import file_input_handler
18
19
  from jarvis.jarvis_agent.shell_input_handler import shell_input_handler
19
20
  # 忽略yaspin的类型检查
20
21
  from jarvis.jarvis_code_agent.lint import get_lint_tools
@@ -24,12 +25,12 @@ from jarvis.jarvis_tools.registry import ToolRegistry
24
25
  from jarvis.jarvis_utils.config import is_confirm_before_apply_patch
25
26
  from jarvis.jarvis_utils.git_utils import (find_git_root, get_commits_between,
26
27
  get_diff, get_diff_file_list,
27
- get_latest_commit_hash,
28
+ get_latest_commit_hash, get_recent_commits_with_files,
28
29
  handle_commit_workflow,
29
30
  has_uncommitted_changes)
30
31
  from jarvis.jarvis_utils.input import get_multiline_input
31
32
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
32
- from jarvis.jarvis_utils.utils import init_env, user_confirm
33
+ from jarvis.jarvis_utils.utils import get_loc_stats, init_env, user_confirm
33
34
 
34
35
 
35
36
  class CodeAgent:
@@ -47,11 +48,9 @@ class CodeAgent:
47
48
  "execute_script",
48
49
  "search_web",
49
50
  "ask_user",
50
- "ask_codebase",
51
51
  "read_code",
52
52
  "methodology",
53
53
  "chdir",
54
- "find_methodology",
55
54
  "edit_file",
56
55
  "rewrite_file"
57
56
  ])
@@ -75,6 +74,12 @@ class CodeAgent:
75
74
  1. **项目分析**:分析项目结构,确定需修改的文件
76
75
  2. **需求分析**:理解需求意图,选择影响最小的实现方案
77
76
  3. **代码分析**:详细分析目标文件,禁止虚构现有代码
77
+ - 结构分析:优先使用 fd 命令或 find 工具快速定位文件和目录结构
78
+ - 内容搜索:优先使用 rg(ripgrep)进行函数、类、变量等内容的全文搜索,避免遗漏
79
+ - 依赖关系:如需分析依赖、调用关系,可结合 grep、ctags、pyan3 等工具辅助
80
+ - 代码阅读:使用 read_code 工具获取目标文件的完整内容或指定范围内容,禁止凭空假设代码
81
+ - 变更影响:如需分析变更影响范围,可结合 git diff、git log 等命令辅助判断
82
+ - 工具优先级:优先使用自动化工具,减少人工推断,确保分析结果准确
78
83
  4. **方案设计**:确定最小变更方案,保持代码结构
79
84
  5. **实施修改**:遵循"先读后写"原则,保持代码风格一致性
80
85
 
@@ -90,7 +95,6 @@ class CodeAgent:
90
95
  - 对于简单的修改,可以使用execute_script工具执行shell命令完成
91
96
  </code_engineer_guide>
92
97
  """
93
- # Dynamically add ask_codebase based on task complexity if really needed
94
98
  # 处理platform参数
95
99
  platform_instance = (PlatformRegistry().create_platform(platform) # type: ignore
96
100
  if platform
@@ -105,19 +109,12 @@ class CodeAgent:
105
109
  output_handler=[tool_registry],
106
110
  platform=platform_instance,
107
111
  input_handler=[
112
+ file_input_handler,
108
113
  shell_input_handler,
109
114
  builtin_input_handler
110
115
  ],
111
116
  need_summary=need_summary
112
117
  )
113
- self.agent.set_addon_prompt(
114
- "请使用工具充分理解用户需求,然后根据需求一步步执行代码修改/开发,"
115
- "如果不清楚要修改那些文件,可以使用ask_codebase工具,"
116
- "以:xxxx功能在哪个文件中实现?类似句式提问。"
117
- "所有代码修改任务都应优先使用edit_file工具,而非edit_file工具。"
118
- "edit_file工具通过精确的搜索和替换实现代码编辑,"
119
- "搜索文本需在目标文件中有且仅有一次精确匹配,确保修改的准确性。"
120
- )
121
118
 
122
119
  self.agent.set_after_tool_call_cb(self.after_tool_call_cb)
123
120
 
@@ -129,82 +126,8 @@ class CodeAgent:
129
126
  """
130
127
  return self.root_dir
131
128
 
132
- def get_loc_stats(self) -> str:
133
- """使用loc命令获取当前目录的代码统计信息
134
-
135
- 返回:
136
- str: loc命令输出的原始字符串,失败时返回空字符串
137
- """
138
- try:
139
- result = subprocess.run(
140
- ['loc'],
141
- cwd=self.root_dir,
142
- capture_output=True,
143
- text=True
144
- )
145
- return result.stdout if result.returncode == 0 else ""
146
- except FileNotFoundError:
147
- return ""
148
-
149
- def get_recent_commits_with_files(self) -> List[Dict[str, Any]]:
150
- """获取最近5次提交的commit信息和文件清单
151
-
152
- 返回:
153
- List[Dict[str, Any]]: 包含commit信息和文件清单的字典列表,格式为:
154
- [
155
- {
156
- 'hash': 提交hash,
157
- 'message': 提交信息,
158
- 'author': 作者,
159
- 'date': 提交日期,
160
- 'files': [修改的文件列表] (最多20个文件)
161
- },
162
- ...
163
- ]
164
- 失败时返回空列表
165
- """
166
- try:
167
- # 获取最近5次提交的基本信息
168
- result = subprocess.run(
169
- ['git', 'log', '-5', '--pretty=format:%H%n%s%n%an%n%ad'],
170
- cwd=self.root_dir,
171
- capture_output=True,
172
- text=True
173
- )
174
- if result.returncode != 0:
175
- return []
176
-
177
- # 解析提交信息
178
- commits = []
179
- lines = result.stdout.splitlines()
180
- for i in range(0, len(lines), 4):
181
- if i + 3 >= len(lines):
182
- break
183
- commit = {
184
- 'hash': lines[i],
185
- 'message': lines[i+1],
186
- 'author': lines[i+2],
187
- 'date': lines[i+3],
188
- 'files': []
189
- }
190
- commits.append(commit)
191
-
192
- # 获取每个提交的文件修改清单
193
- for commit in commits:
194
- files_result = subprocess.run(
195
- ['git', 'show', '--name-only', '--pretty=format:', commit['hash']],
196
- cwd=self.root_dir,
197
- capture_output=True,
198
- text=True
199
- )
200
- if files_result.returncode == 0:
201
- files = list(set(filter(None, files_result.stdout.splitlines())))
202
- commit['files'] = files[:20] # 限制最多20个文件
203
129
 
204
- return commits
205
130
 
206
- except subprocess.CalledProcessError:
207
- return []
208
131
 
209
132
  def _init_env(self) -> None:
210
133
  """初始化环境,包括:
@@ -317,8 +240,8 @@ class CodeAgent:
317
240
  start_commit = get_latest_commit_hash()
318
241
 
319
242
  # 获取项目统计信息并附加到用户输入
320
- loc_stats = self.get_loc_stats()
321
- commits_info = self.get_recent_commits_with_files()
243
+ loc_stats = get_loc_stats()
244
+ commits_info = get_recent_commits_with_files()
322
245
 
323
246
  project_info = []
324
247
  if loc_stats:
@@ -331,8 +254,20 @@ class CodeAgent:
331
254
  for i, commit in enumerate(commits_info)
332
255
  )
333
256
  project_info.append(f"最近提交:\n{commits_str}")
334
-
335
- enhanced_input = f"{user_input}\n\n项目概况:\n" + "\n\n".join(project_info) if project_info else user_input
257
+
258
+ first_tip = """请严格遵循以下规范进行代码修改任务:
259
+ 1. 每次响应仅执行一步操作,先分析再修改,避免一步多改。
260
+ 2. 充分利用工具理解用户需求和现有代码,禁止凭空假设。
261
+ 3. 如果不清楚要修改的文件,必须先分析并找出需要修改的文件,明确目标后再进行编辑。
262
+ 4. 代码编辑任务优先使用 edit_file 工具,确保搜索文本在目标文件中有且仅有一次精确匹配,保证修改的准确性和安全性。
263
+ 5. 如需大范围重写,才可使用 rewrite_file 工具。
264
+ 6. 如遇信息不明,优先调用工具补充分析,不要主观臆断。
265
+ """
266
+
267
+ if project_info:
268
+ enhanced_input = f"项目概况:\n" + "\n\n".join(project_info) + "\n\n" + first_tip + "\n\n任务描述:\n" + user_input
269
+ else:
270
+ enhanced_input = first_tip + "\n\n任务描述:\n" + user_input
336
271
 
337
272
  try:
338
273
  self.agent.run(enhanced_input)
@@ -379,21 +314,16 @@ class CodeAgent:
379
314
  for file in modified_files
380
315
  if get_lint_tools(file)
381
316
  )
382
- addon_prompt = """
383
- 1. 请对以下修改的文件进行静态扫描:
384
- """ + "\n".join(f" - {file}" for file in modified_files) + (
385
- f"""
386
- 2. 建议使用以下lint工具进行检查:
387
- {lint_tools_info}""" if lint_tools_info else ""
388
- ) + """
389
- 3. 如果本次修改引入了警告和错误,请根据警告和错误信息修复代码
390
- 4. 在引入的警告和错误都被修复的前提下,如果用户的需求未完成,请继续修改代码,如果已经完成,请终止,不要实现任何超出用户需求外的内容
391
- 5. 如果有任何信息不明确,调用工具获取信息
392
- 6. 每次响应必须且只能包含一个操作
317
+ file_list = "\n".join(f" - {file}" for file in modified_files)
318
+ tool_info = f"建议使用以下lint工具进行检查:\n{lint_tools_info}" if lint_tools_info else ""
319
+ if lint_tools_info:
320
+ addon_prompt = f"""
321
+ 请对以下修改的文件进行静态扫描:
322
+ {file_list}
323
+ {tool_info}
324
+ 如果本次修改引入了警告和错误,请根据警告和错误信息修复代码
393
325
  """
394
-
395
- agent.set_addon_prompt(addon_prompt)
396
-
326
+ agent.set_addon_prompt(addon_prompt)
397
327
  else:
398
328
  final_ret += "✅ 补丁已应用(没有新的提交)"
399
329
  else:
@@ -112,23 +112,19 @@
112
112
  "default": ""
113
113
  },
114
114
  "JARVIS_MAX_TOKEN_COUNT": {
115
- "type": "string",
115
+ "type": "number",
116
116
  "description": "模型能处理的最大token数量",
117
- "default": "960000"
117
+ "default": 960000
118
118
  },
119
119
  "JARVIS_MAX_INPUT_TOKEN_COUNT": {
120
- "type": "string",
120
+ "type": "number",
121
121
  "description": "模型能处理的最大输入token数量",
122
- "default": "32000"
122
+ "default": 32000
123
123
  },
124
124
  "JARVIS_AUTO_COMPLETE": {
125
- "type": "string",
125
+ "type": "boolean",
126
126
  "description": "是否启用自动补全功能",
127
- "default": "false",
128
- "enum": [
129
- "true",
130
- "false"
131
- ]
127
+ "default": false
132
128
  },
133
129
  "SHELL": {
134
130
  "type": "string",
@@ -156,27 +152,19 @@
156
152
  "default": "deep_seek"
157
153
  },
158
154
  "JARVIS_EXECUTE_TOOL_CONFIRM": {
159
- "type": "string",
155
+ "type": "boolean",
160
156
  "description": "执行工具前是否需要确认",
161
- "default": "false",
162
- "enum": [
163
- "true",
164
- "false"
165
- ]
157
+ "default": false
166
158
  },
167
159
  "JARVIS_CONFIRM_BEFORE_APPLY_PATCH": {
168
- "type": "string",
160
+ "type": "boolean",
169
161
  "description": "应用补丁前是否需要确认",
170
- "default": "true",
171
- "enum": [
172
- "true",
173
- "false"
174
- ]
162
+ "default": true
175
163
  },
176
164
  "JARVIS_MAX_TOOL_CALL_COUNT": {
177
- "type": "string",
165
+ "type": "number",
178
166
  "description": "最大连续工具调用次数",
179
- "default": "20"
167
+ "default": 20
180
168
  },
181
169
  "JARVIS_DATA_PATH": {
182
170
  "type": "string",
@@ -184,54 +172,34 @@
184
172
  "default": "~/.jarvis"
185
173
  },
186
174
  "JARVIS_AUTO_UPDATE": {
187
- "type": "string",
175
+ "type": "boolean",
188
176
  "description": "是否自动更新git仓库",
189
- "default": "true",
190
- "enum": [
191
- "true",
192
- "false"
193
- ]
177
+ "default": true
194
178
  },
195
179
  "JARVIS_MAX_BIG_CONTENT_SIZE": {
196
- "type": "string",
180
+ "type": "number",
197
181
  "description": "最大大内容尺寸",
198
- "default": "1024000"
182
+ "default": 1024000
199
183
  },
200
184
  "JARVIS_PRETTY_OUTPUT": {
201
- "type": "string",
185
+ "type": "boolean",
202
186
  "description": "是否启用美化输出",
203
- "default": "false",
204
- "enum": [
205
- "true",
206
- "false"
207
- ]
187
+ "default": false
208
188
  },
209
189
  "JARVIS_USE_METHODOLOGY": {
210
- "type": "string",
190
+ "type": "boolean",
211
191
  "description": "是否启用方法论",
212
- "default": "false",
213
- "enum": [
214
- "true",
215
- "false"
216
- ]
192
+ "default": true
217
193
  },
218
194
  "JARVIS_USE_ANALYSIS": {
219
- "type": "string",
195
+ "type": "boolean",
220
196
  "description": "是否启用任务分析",
221
- "default": "false",
222
- "enum": [
223
- "true",
224
- "false"
225
- ]
197
+ "default": true
226
198
  },
227
199
  "JARVIS_PRINT_PROMPT": {
228
- "type": "string",
200
+ "type": "boolean",
229
201
  "description": "是否打印提示",
230
- "default": "false",
231
- "enum": [
232
- "true",
233
- "false"
234
- ]
202
+ "default": false
235
203
  },
236
204
  "JARVIS_REPLACE_MAP": {
237
205
  "type": "object",
@@ -252,9 +220,11 @@
252
220
  "description": "Description of the replacement"
253
221
  }
254
222
  },
255
- "required": ["template"]
223
+ "required": [
224
+ "template"
225
+ ]
256
226
  }
257
227
  }
258
228
  },
259
229
  "additionalProperties": false
260
- }
230
+ }