jarvis-ai-assistant 0.1.194__tar.gz → 0.1.196__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 (105) hide show
  1. {jarvis_ai_assistant-0.1.194/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.196}/PKG-INFO +62 -13
  2. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/README.md +61 -12
  3. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/pyproject.toml +1 -1
  4. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/setup.py +1 -1
  5. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_agent/__init__.py +63 -31
  7. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_agent/jarvis.py +3 -8
  8. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_agent/code_agent.py +8 -12
  9. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/loader.py +6 -20
  10. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/code_review.py +2 -1
  11. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_data/config_schema.json +5 -0
  12. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_git_utils/git_commiter.py +3 -2
  13. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_methodology/main.py +2 -4
  14. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/base.py +4 -6
  15. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/human.py +10 -0
  16. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/kimi.py +21 -9
  17. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/registry.py +4 -7
  18. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_smart_shell/main.py +0 -1
  19. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/create_code_agent.py +2 -4
  20. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/config.py +11 -5
  21. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/embedding.py +7 -5
  22. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/git_utils.py +30 -21
  23. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/input.py +2 -1
  24. jarvis_ai_assistant-0.1.196/src/jarvis/jarvis_utils/jarvis_history.py +96 -0
  25. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/methodology.py +3 -3
  26. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/output.py +5 -2
  27. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/utils.py +4 -6
  28. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196/src/jarvis_ai_assistant.egg-info}/PKG-INFO +62 -13
  29. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +1 -0
  30. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/LICENSE +0 -0
  31. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/MANIFEST.in +0 -0
  32. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/setup.cfg +0 -0
  33. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_agent/builtin_input_handler.py +0 -0
  34. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_agent/main.py +0 -0
  35. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_agent/output_handler.py +0 -0
  36. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_agent/shell_input_handler.py +0 -0
  37. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
  38. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_agent/lint.py +0 -0
  39. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/__init__.py +0 -0
  40. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/c_cpp.py +0 -0
  41. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/csharp.py +0 -0
  42. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/data_format.py +0 -0
  43. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/devops.py +0 -0
  44. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/docs.py +0 -0
  45. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/go.py +0 -0
  46. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/infrastructure.py +0 -0
  47. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/java.py +0 -0
  48. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/javascript.py +0 -0
  49. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/kotlin.py +0 -0
  50. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/php.py +0 -0
  51. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/python.py +0 -0
  52. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/ruby.py +0 -0
  53. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/rust.py +0 -0
  54. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/shell.py +0 -0
  55. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/sql.py +0 -0
  56. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/swift.py +0 -0
  57. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_code_analysis/checklists/web.py +0 -0
  58. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_data/huggingface.tar.gz +0 -0
  59. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_dev/main.py +0 -0
  60. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_git_details/__init__.py +0 -0
  61. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_git_details/main.py +0 -0
  62. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_git_squash/__init__.py +0 -0
  63. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_git_squash/main.py +0 -0
  64. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_mcp/__init__.py +0 -0
  65. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_mcp/sse_mcp_client.py +0 -0
  66. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_mcp/stdio_mcp_client.py +0 -0
  67. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_mcp/streamable_mcp_client.py +0 -0
  68. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_multi_agent/__init__.py +0 -0
  69. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_multi_agent/main.py +0 -0
  70. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/__init__.py +0 -0
  71. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/openai.py +0 -0
  72. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/tongyi.py +0 -0
  73. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform/yuanbao.py +0 -0
  74. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform_manager/__init__.py +0 -0
  75. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_platform_manager/main.py +0 -0
  76. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
  77. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/__init__.py +0 -0
  78. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/ask_user.py +0 -0
  79. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/base.py +0 -0
  80. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/chdir.py +0 -0
  81. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/cli/__init__.py +0 -0
  82. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/cli/main.py +0 -0
  83. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/code_plan.py +0 -0
  84. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/create_sub_agent.py +0 -0
  85. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/edit_file.py +0 -0
  86. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/execute_script.py +0 -0
  87. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/file_analyzer.py +0 -0
  88. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/file_operation.py +0 -0
  89. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/generate_new_tool.py +0 -0
  90. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/methodology.py +0 -0
  91. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/read_code.py +0 -0
  92. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/read_webpage.py +0 -0
  93. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/registry.py +0 -0
  94. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/rewrite_file.py +0 -0
  95. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/search_web.py +0 -0
  96. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_tools/virtual_tty.py +0 -0
  97. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/__init__.py +0 -0
  98. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/builtin_replace_map.py +0 -0
  99. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/file_processors.py +0 -0
  100. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/globals.py +0 -0
  101. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis/jarvis_utils/tag.py +0 -0
  102. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  103. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -0
  104. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/src/jarvis_ai_assistant.egg-info/requires.txt +0 -0
  105. {jarvis_ai_assistant-0.1.194 → jarvis_ai_assistant-0.1.196}/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.194
3
+ Version: 0.1.196
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
@@ -117,6 +117,63 @@ pip3 install jarvis-ai-assistant
117
117
  | `jarvis-git-details` | - | 使用git details功能 |
118
118
  | `jarvis-methodology` | - | 使用方法论功能 |
119
119
 
120
+ ### Jarvis功能 (jarvis)
121
+
122
+ `jarvis` 是Jarvis的通用代理工具,提供开箱即用的AI助手功能。
123
+
124
+ #### 1. 核心功能
125
+ - 任务分析与规划
126
+ - 代码分析与修改
127
+ - 系统交互与操作
128
+ - 方法论应用与优化
129
+ - 多代理协作
130
+
131
+ #### 2. 使用方式
132
+ ```bash
133
+ # 基本用法
134
+ jarvis
135
+
136
+ # 带参数使用
137
+ jarvis -p <平台> -m <模型> -t "初始任务"
138
+ ```
139
+
140
+ #### 3. 命令行参数
141
+ | 参数 | 描述 |
142
+ |------|------|
143
+ | `-p/--platform` | 指定AI平台 (yuanbao/kimi/tongyi/openai) |
144
+ | `-m/--model` | 指定模型名称 |
145
+ | `-t/--task` | 指定初始任务 |
146
+
147
+ #### 4. 工作流程
148
+ 1. 初始化环境
149
+ 2. 加载默认配置
150
+ 3. 创建代理实例
151
+ 4. 执行初始任务(如果指定)
152
+ 5. 进入交互式模式(如果没有初始任务)
153
+ 6. 根据用户输入执行任务
154
+
155
+ #### 5. 任务执行特点
156
+ - 自动应用最佳方法论
157
+ - 智能任务分解
158
+ - 多工具协同工作
159
+ - 实时进度反馈
160
+ - 自动生成任务总结
161
+
162
+ #### 6. 示例
163
+ ```bash
164
+ # 基本使用
165
+ jarvis
166
+
167
+ # 指定平台和模型
168
+ jarvis -p yuanbao -m deep_seek_v3
169
+
170
+ # 直接执行任务
171
+ jarvis -t "分析项目结构并生成架构图"
172
+
173
+ # 组合使用
174
+ jarvis -p kimi -m k1 -t "优化项目性能"
175
+ ```
176
+
120
177
  ### 代码代理功能 (jarvis-code-agent)
121
178
 
122
179
  `jarvis-code-agent` 是Jarvis的代码分析与修改工具,专注于代码工程任务。
@@ -153,16 +210,7 @@ jarvis-code-agent -p <平台> -m <模型> -r "需求描述"
153
210
  4. 自动处理git提交
154
211
  5. 显示修改结果
155
212
 
156
- #### 5. 使用规范
157
- 代码代理遵循以下规范进行代码修改:
158
- 1. 每次响应仅执行一步操作,先分析再修改,避免一步多改
159
- 2. 充分利用工具理解用户需求和现有代码,禁止凭空假设
160
- 3. 如果不清楚要修改的文件,必须先分析并找出需要修改的文件
161
- 4. 代码编辑任务优先使用 edit_file 工具,确保搜索文本在目标文件中有且仅有一次精确匹配
162
- 5. 如需大范围重写,才可使用 rewrite_file 工具
163
- 6. 如遇信息不明,优先调用工具补充分析,不要主观臆断
164
-
165
- #### 6. 示例
213
+ #### 5. 示例
166
214
  ```bash
167
215
  # 使用默认平台分析代码
168
216
  jca
@@ -221,7 +269,7 @@ jarvis-git-commit --root-dir <目录> --prefix "前缀" --suffix "后缀"
221
269
  - `test`: 测试相关
222
270
  - `chore`: 其他修改
223
271
 
224
- 格式规则:
272
+ 默认格式规则(可配置):
225
273
  1. 类型必须使用上述预定义类型
226
274
  2. 范围表示变更的模块或组件(例如:auth, database, ui)
227
275
  3. 主题行不超过72个字符,不以句号结尾,使用祈使语气
@@ -250,7 +298,7 @@ jgc --prefix "[紧急修复]"
250
298
  jgc --suffix "相关issue: #123"
251
299
  ```
252
300
 
253
- ### 通用代理功能 (jarvis-agent)
301
+ ### 自定义代理功能 (jarvis-agent)
254
302
 
255
303
  `jarvis-agent` 是Jarvis的核心代理工具,提供通用的AI助手功能,支持自定义配置和任务执行。
256
304
 
@@ -490,6 +538,7 @@ OPENAI_API_BASE: https://api.openai.com/v1
490
538
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
491
539
  | `JARVIS_USE_METHODOLOGY` | true | 是否启用方法论功能 |
492
540
  | `JARVIS_USE_ANALYSIS` | true | 是否启用任务分析功能 |
541
+ | `JARVIS_USE_HISTORY` | false | 是否启用历史记录功能 |
493
542
  | `JARVIS_DATA_PATH` | ~/.jarvis | Jarvis数据存储目录路径 |
494
543
 
495
544
  ## 🛠️ 工具说明 <a id="tools"></a>
@@ -47,6 +47,63 @@ pip3 install jarvis-ai-assistant
47
47
  | `jarvis-git-details` | - | 使用git details功能 |
48
48
  | `jarvis-methodology` | - | 使用方法论功能 |
49
49
 
50
+ ### Jarvis功能 (jarvis)
51
+
52
+ `jarvis` 是Jarvis的通用代理工具,提供开箱即用的AI助手功能。
53
+
54
+ #### 1. 核心功能
55
+ - 任务分析与规划
56
+ - 代码分析与修改
57
+ - 系统交互与操作
58
+ - 方法论应用与优化
59
+ - 多代理协作
60
+
61
+ #### 2. 使用方式
62
+ ```bash
63
+ # 基本用法
64
+ jarvis
65
+
66
+ # 带参数使用
67
+ jarvis -p <平台> -m <模型> -t "初始任务"
68
+ ```
69
+
70
+ #### 3. 命令行参数
71
+ | 参数 | 描述 |
72
+ |------|------|
73
+ | `-p/--platform` | 指定AI平台 (yuanbao/kimi/tongyi/openai) |
74
+ | `-m/--model` | 指定模型名称 |
75
+ | `-t/--task` | 指定初始任务 |
76
+
77
+ #### 4. 工作流程
78
+ 1. 初始化环境
79
+ 2. 加载默认配置
80
+ 3. 创建代理实例
81
+ 4. 执行初始任务(如果指定)
82
+ 5. 进入交互式模式(如果没有初始任务)
83
+ 6. 根据用户输入执行任务
84
+
85
+ #### 5. 任务执行特点
86
+ - 自动应用最佳方法论
87
+ - 智能任务分解
88
+ - 多工具协同工作
89
+ - 实时进度反馈
90
+ - 自动生成任务总结
91
+
92
+ #### 6. 示例
93
+ ```bash
94
+ # 基本使用
95
+ jarvis
96
+
97
+ # 指定平台和模型
98
+ jarvis -p yuanbao -m deep_seek_v3
99
+
100
+ # 直接执行任务
101
+ jarvis -t "分析项目结构并生成架构图"
102
+
103
+ # 组合使用
104
+ jarvis -p kimi -m k1 -t "优化项目性能"
105
+ ```
106
+
50
107
  ### 代码代理功能 (jarvis-code-agent)
51
108
 
52
109
  `jarvis-code-agent` 是Jarvis的代码分析与修改工具,专注于代码工程任务。
@@ -83,16 +140,7 @@ jarvis-code-agent -p <平台> -m <模型> -r "需求描述"
83
140
  4. 自动处理git提交
84
141
  5. 显示修改结果
85
142
 
86
- #### 5. 使用规范
87
- 代码代理遵循以下规范进行代码修改:
88
- 1. 每次响应仅执行一步操作,先分析再修改,避免一步多改
89
- 2. 充分利用工具理解用户需求和现有代码,禁止凭空假设
90
- 3. 如果不清楚要修改的文件,必须先分析并找出需要修改的文件
91
- 4. 代码编辑任务优先使用 edit_file 工具,确保搜索文本在目标文件中有且仅有一次精确匹配
92
- 5. 如需大范围重写,才可使用 rewrite_file 工具
93
- 6. 如遇信息不明,优先调用工具补充分析,不要主观臆断
94
-
95
- #### 6. 示例
143
+ #### 5. 示例
96
144
  ```bash
97
145
  # 使用默认平台分析代码
98
146
  jca
@@ -151,7 +199,7 @@ jarvis-git-commit --root-dir <目录> --prefix "前缀" --suffix "后缀"
151
199
  - `test`: 测试相关
152
200
  - `chore`: 其他修改
153
201
 
154
- 格式规则:
202
+ 默认格式规则(可配置):
155
203
  1. 类型必须使用上述预定义类型
156
204
  2. 范围表示变更的模块或组件(例如:auth, database, ui)
157
205
  3. 主题行不超过72个字符,不以句号结尾,使用祈使语气
@@ -180,7 +228,7 @@ jgc --prefix "[紧急修复]"
180
228
  jgc --suffix "相关issue: #123"
181
229
  ```
182
230
 
183
- ### 通用代理功能 (jarvis-agent)
231
+ ### 自定义代理功能 (jarvis-agent)
184
232
 
185
233
  `jarvis-agent` 是Jarvis的核心代理工具,提供通用的AI助手功能,支持自定义配置和任务执行。
186
234
 
@@ -420,6 +468,7 @@ OPENAI_API_BASE: https://api.openai.com/v1
420
468
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
421
469
  | `JARVIS_USE_METHODOLOGY` | true | 是否启用方法论功能 |
422
470
  | `JARVIS_USE_ANALYSIS` | true | 是否启用任务分析功能 |
471
+ | `JARVIS_USE_HISTORY` | false | 是否启用历史记录功能 |
423
472
  | `JARVIS_DATA_PATH` | ~/.jarvis | Jarvis数据存储目录路径 |
424
473
 
425
474
  ## 🛠️ 工具说明 <a id="tools"></a>
@@ -8,7 +8,7 @@ default = true
8
8
 
9
9
  [project]
10
10
  name = "jarvis-ai-assistant"
11
- version = "0.1.194"
11
+ version = "0.1.196"
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" }]
@@ -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.194",
6
+ version="0.1.196",
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",
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Jarvis AI Assistant"""
3
3
 
4
- __version__ = "0.1.194"
4
+ __version__ = "0.1.196"
@@ -1,6 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # 标准库导入
3
3
  import datetime
4
+ import os
5
+ from pathlib import Path
4
6
  import platform
5
7
  from typing import Any, Callable, Dict, List, Optional, Protocol, Tuple, Union
6
8
 
@@ -12,26 +14,20 @@ from yaspin import yaspin # type: ignore
12
14
  # jarvis_platform 相关
13
15
  from jarvis.jarvis_platform.base import BasePlatform
14
16
  from jarvis.jarvis_platform.registry import PlatformRegistry
15
-
16
17
  # jarvis_utils 相关
17
- from jarvis.jarvis_utils.config import (
18
- get_max_token_count,
19
- get_max_tool_call_count,
20
- is_auto_complete,
21
- is_execute_tool_confirm,
22
- is_use_analysis,
23
- is_use_methodology,
24
- )
18
+ from jarvis.jarvis_utils.config import (get_data_dir, get_max_token_count,
19
+ get_max_tool_call_count,
20
+ is_auto_complete,
21
+ is_execute_tool_confirm,
22
+ is_use_analysis, get_history_count, is_use_methodology)
25
23
  from jarvis.jarvis_utils.embedding import get_context_token_count
26
- from jarvis.jarvis_utils.globals import (
27
- delete_agent,
28
- get_interrupt,
29
- make_agent_name,
30
- set_agent,
31
- set_interrupt,
32
- )
24
+ from jarvis.jarvis_utils.globals import (delete_agent, get_interrupt,
25
+ make_agent_name, set_agent,
26
+ set_interrupt)
33
27
  from jarvis.jarvis_utils.input import get_multiline_input
34
- from jarvis.jarvis_utils.methodology import load_methodology, upload_methodology
28
+ from jarvis.jarvis_utils.jarvis_history import JarvisHistory
29
+ from jarvis.jarvis_utils.methodology import (load_methodology,
30
+ upload_methodology)
35
31
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
36
32
  from jarvis.jarvis_utils.tag import ct, ot
37
33
  from jarvis.jarvis_utils.utils import user_confirm
@@ -143,6 +139,7 @@ class Agent:
143
139
  self.prompt = ""
144
140
 
145
141
  def __del__(self):
142
+ self.history.stop_record()
146
143
  delete_agent(self.name)
147
144
 
148
145
  def __init__(
@@ -163,6 +160,7 @@ class Agent:
163
160
  use_methodology: Optional[bool] = None,
164
161
  use_analysis: Optional[bool] = None,
165
162
  files: List[str] = [],
163
+ history_count: Optional[int] = None,
166
164
  ):
167
165
  self.files = files
168
166
  """初始化Jarvis Agent实例
@@ -241,6 +239,13 @@ class Agent:
241
239
  self.max_tool_call_count = get_max_tool_call_count()
242
240
  self.after_tool_call_cb: Optional[Callable[[Agent], None]] = None
243
241
 
242
+ self.history = JarvisHistory()
243
+ self.history_dir = str(Path(get_data_dir())/"history")
244
+ self.history.start_record(self.history_dir)
245
+
246
+ self.history_count = history_count if history_count is not None else get_history_count()
247
+
248
+
244
249
  self.execute_tool_confirm = (
245
250
  execute_tool_confirm
246
251
  if execute_tool_confirm is not None
@@ -402,8 +407,10 @@ class Agent:
402
407
  if self.conversation_length > self.max_token_count:
403
408
  message = self._summarize_and_clear_history() + "\n\n" + message
404
409
  self.conversation_length += get_context_token_count(message)
410
+ self.history.append_msg("user", message)
405
411
  response = self.model.chat_until_success(message) # type: ignore
406
412
  self.conversation_length += get_context_token_count(response)
413
+ self.history.append_msg("assistant", response)
407
414
  return response
408
415
 
409
416
  def generate_summary(self) -> str:
@@ -781,21 +788,9 @@ arguments:
781
788
  set_agent(self.name, self)
782
789
 
783
790
  while True:
791
+ history_md = ""
784
792
  if self.first:
785
- # 如果有上传文件,先上传文件
786
- if self.files and self.model and self.model.support_upload_files():
787
- self.model.upload_files(self.files)
788
-
789
- # 如果启用方法论且没有上传文件,上传方法论
790
- elif self.use_methodology:
791
- if not self.model or not upload_methodology(self.model):
792
- # 上传失败则回退到本地加载
793
- msg = self.prompt
794
- for handler in self.input_handler:
795
- msg, _ = handler(msg, self)
796
- self.prompt = f"{self.prompt}\n\n以下是历史类似问题的执行经验,可参考:\n{load_methodology(msg, self.get_tool_registry())}"
797
-
798
- self.first = False
793
+ history_md = self._first_run()
799
794
  try:
800
795
  current_response = self._call_model(self.prompt, True)
801
796
  self.prompt = ""
@@ -838,6 +833,8 @@ arguments:
838
833
  return self._complete_task()
839
834
 
840
835
  except Exception as e:
836
+ if history_md:
837
+ os.remove(history_md)
841
838
  PrettyOutput.print(f"任务失败: {str(e)}", OutputType.ERROR)
842
839
  return f"Task failed: {str(e)}"
843
840
 
@@ -845,6 +842,41 @@ arguments:
845
842
  PrettyOutput.print(f"任务失败: {str(e)}", OutputType.ERROR)
846
843
  return f"Task failed: {str(e)}"
847
844
 
845
+ def _first_run(self):
846
+ history_md = ""
847
+ if self.history_count > 0 and self.model and self.model.support_upload_files():
848
+ import tempfile
849
+ timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
850
+ history_md = str(Path(tempfile.gettempdir())/f"{self.name}_history_{timestamp}.md")
851
+ self.history.export_history_to_markdown(tempfile.gettempdir(), history_md, max_files=self.history_count)
852
+ self.files.append(history_md)
853
+
854
+ # 如果有上传文件,先上传文件
855
+ if self.model and self.model.support_upload_files():
856
+ if self.use_methodology:
857
+ if not upload_methodology(self.model, other_files=self.files):
858
+ if self.files:
859
+ PrettyOutput.print("文件上传失败,将忽略文件列表", OutputType.WARNING)
860
+ # 上传失败则回退到本地加载
861
+ msg = self.prompt
862
+ for handler in self.input_handler:
863
+ msg, _ = handler(msg, self)
864
+ self.prompt = f"{self.prompt}\n\n以下是历史类似问题的执行经验,可参考:\n{load_methodology(msg, self.get_tool_registry())}"
865
+ elif self.files:
866
+ if not self.model.upload_files(self.files):
867
+ PrettyOutput.print("文件上传失败,将忽略文件列表", OutputType.WARNING)
868
+ else:
869
+ if self.files:
870
+ PrettyOutput.print("不支持上传文件,将忽略文件列表", OutputType.WARNING)
871
+ if self.use_methodology:
872
+ msg = self.prompt
873
+ for handler in self.input_handler:
874
+ msg, _ = handler(msg, self)
875
+ self.prompt = f"{self.prompt}\n\n以下是历史类似问题的执行经验,可参考:\n{load_methodology(msg, self.get_tool_registry())}"
876
+
877
+ self.first = False
878
+ return history_md
879
+
848
880
  def clear_history(self):
849
881
  """清空对话历史但保留系统提示
850
882
 
@@ -8,14 +8,9 @@ import yaml
8
8
  from prompt_toolkit import prompt
9
9
  from yaspin import yaspin
10
10
 
11
- from jarvis.jarvis_agent import (
12
- Agent,
13
- OutputType,
14
- PrettyOutput,
15
- get_multiline_input,
16
- origin_agent_system_prompt,
17
- user_confirm,
18
- )
11
+ from jarvis.jarvis_agent import (Agent, OutputType, PrettyOutput,
12
+ get_multiline_input,
13
+ origin_agent_system_prompt, user_confirm)
19
14
  from jarvis.jarvis_agent.builtin_input_handler import builtin_input_handler
20
15
  from jarvis.jarvis_agent.shell_input_handler import shell_input_handler
21
16
  from jarvis.jarvis_tools.registry import ToolRegistry
@@ -10,30 +10,26 @@ import subprocess
10
10
  import sys
11
11
  from typing import List, Optional, Tuple
12
12
 
13
+ from yaspin import yaspin # type: ignore
14
+
13
15
  from jarvis.jarvis_agent import Agent
14
16
  from jarvis.jarvis_agent.builtin_input_handler import builtin_input_handler
15
17
  from jarvis.jarvis_agent.shell_input_handler import shell_input_handler
16
-
17
18
  # 忽略yaspin的类型检查
18
19
  from jarvis.jarvis_code_agent.lint import get_lint_tools
19
20
  from jarvis.jarvis_git_utils.git_commiter import GitCommitTool
20
21
  from jarvis.jarvis_platform.registry import PlatformRegistry
21
22
  from jarvis.jarvis_tools.registry import ToolRegistry
22
23
  from jarvis.jarvis_utils.config import is_confirm_before_apply_patch
23
- from jarvis.jarvis_utils.git_utils import (
24
- find_git_root,
25
- get_commits_between,
26
- get_diff,
27
- get_diff_file_list,
28
- get_latest_commit_hash,
29
- get_recent_commits_with_files,
30
- handle_commit_workflow,
31
- has_uncommitted_changes,
32
- )
24
+ from jarvis.jarvis_utils.git_utils import (find_git_root, get_commits_between,
25
+ get_diff, get_diff_file_list,
26
+ get_latest_commit_hash,
27
+ get_recent_commits_with_files,
28
+ handle_commit_workflow,
29
+ has_uncommitted_changes)
33
30
  from jarvis.jarvis_utils.input import get_multiline_input
34
31
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
35
32
  from jarvis.jarvis_utils.utils import get_loc_stats, init_env, user_confirm
36
- from yaspin import yaspin # type: ignore
37
33
 
38
34
 
39
35
  class CodeAgent:
@@ -5,26 +5,12 @@ 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 (
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
- )
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)
28
14
 
29
15
  # Map of language identifiers to their checklist content
30
16
  CHECKLIST_MAP = {
@@ -8,7 +8,8 @@ from typing import Any, Dict, List
8
8
  from yaspin import yaspin
9
9
 
10
10
  from jarvis.jarvis_agent import Agent
11
- from jarvis.jarvis_code_analysis.checklists.loader import get_language_checklist
11
+ from jarvis.jarvis_code_analysis.checklists.loader import \
12
+ get_language_checklist
12
13
  from jarvis.jarvis_platform.registry import PlatformRegistry
13
14
  from jarvis.jarvis_tools.read_code import ReadCodeTool
14
15
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
@@ -201,6 +201,11 @@
201
201
  "description": "是否打印提示",
202
202
  "default": false
203
203
  },
204
+ "JARVIS_USE_HISTORY_COUNT": {
205
+ "type": "number",
206
+ "description": "使用的历史记录数量",
207
+ "default": 0
208
+ },
204
209
  "JARVIS_REPLACE_MAP": {
205
210
  "type": "object",
206
211
  "description": "自定义替换映射表配置",
@@ -12,7 +12,8 @@ from yaspin import yaspin
12
12
 
13
13
  from jarvis.jarvis_platform.registry import PlatformRegistry
14
14
  from jarvis.jarvis_utils.config import get_git_commit_prompt
15
- from jarvis.jarvis_utils.git_utils import find_git_root, has_uncommitted_changes
15
+ from jarvis.jarvis_utils.git_utils import (find_git_root,
16
+ has_uncommitted_changes)
16
17
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
17
18
  from jarvis.jarvis_utils.tag import ct, ot
18
19
  from jarvis.jarvis_utils.utils import init_env, is_context_overflow
@@ -117,7 +118,7 @@ class GitCommitTool:
117
118
  stdout=subprocess.PIPE,
118
119
  stderr=subprocess.PIPE,
119
120
  )
120
- diff = process.communicate()[0].decode()
121
+ diff = process.communicate()[0].decode(errors="ignore")
121
122
  spinner.write(f"✅ 获取差异 ({file_count} 个文件)")
122
123
  try:
123
124
  temp_diff_file_path = None
@@ -17,10 +17,8 @@ import yaml # type: ignore
17
17
  from yaspin import yaspin # type: ignore
18
18
 
19
19
  from jarvis.jarvis_platform.registry import PlatformRegistry
20
- from jarvis.jarvis_utils.methodology import (
21
- _get_methodology_directory,
22
- _load_all_methodologies,
23
- )
20
+ from jarvis.jarvis_utils.methodology import (_get_methodology_directory,
21
+ _load_all_methodologies)
24
22
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
25
23
 
26
24
 
@@ -9,16 +9,14 @@ from rich.panel import Panel
9
9
  from rich.text import Text
10
10
  from yaspin import yaspin
11
11
 
12
- from jarvis.jarvis_utils.config import (
13
- get_max_input_token_count,
14
- get_pretty_output,
15
- is_print_prompt,
16
- )
12
+ from jarvis.jarvis_utils.config import (get_max_input_token_count,
13
+ get_pretty_output, is_print_prompt)
17
14
  from jarvis.jarvis_utils.embedding import split_text_into_chunks
18
15
  from jarvis.jarvis_utils.globals import set_in_chat
19
16
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
20
17
  from jarvis.jarvis_utils.tag import ct, ot
21
- from jarvis.jarvis_utils.utils import get_context_token_count, while_success, while_true
18
+ from jarvis.jarvis_utils.utils import (get_context_token_count, while_success,
19
+ while_true)
22
20
 
23
21
 
24
22
  class BasePlatform(ABC):
@@ -1,4 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
+
3
+ # 人类交互平台实现模块
4
+
5
+ # 提供与真实人类交互的模拟接口
6
+
2
7
  import random
3
8
  import string
4
9
  from typing import Generator, List, Tuple
@@ -72,4 +77,9 @@ class HumanPlatform(BasePlatform):
72
77
  return self.model_name
73
78
 
74
79
  def support_web(self) -> bool:
80
+ """是否支持网页浏览功能"""
81
+ return False
82
+
83
+ def support_upload_files(self) -> bool:
84
+ """是否支持文件上传功能"""
75
85
  return False
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # Kimi 平台实现模块
3
+ # 提供与 Moonshot AI 的 Kimi 大模型交互功能
2
4
  import json
3
5
  import mimetypes
4
6
  import os
@@ -13,7 +15,12 @@ from jarvis.jarvis_utils.utils import while_success
13
15
 
14
16
 
15
17
  class KimiModel(BasePlatform):
16
- """Kimi model implementation"""
18
+ """Kimi 大模型平台实现类
19
+ 封装了与 Kimi 大模型交互的所有功能,包括:
20
+ - 会话管理
21
+ - 文件上传
22
+ - 消息收发
23
+ """
17
24
 
18
25
  platform_name = "kimi"
19
26
 
@@ -29,16 +36,16 @@ class KimiModel(BasePlatform):
29
36
  Initialize Kimi model
30
37
  """
31
38
  super().__init__()
32
- self.chat_id = ""
33
- self.api_key = os.getenv("KIMI_API_KEY")
39
+ self.chat_id = "" # 当前会话ID
40
+ self.api_key = os.getenv("KIMI_API_KEY") # 从环境变量获取API密钥
34
41
  if not self.api_key:
35
42
  PrettyOutput.print("KIMI_API_KEY 未设置", OutputType.WARNING)
36
- self.auth_header = f"Bearer {self.api_key}"
43
+ self.auth_header = f"Bearer {self.api_key}" # 认证头信息
37
44
  self.uploaded_files = [] # 存储已上传文件的信息
38
- self.chat_id = ""
39
- self.first_chat = True # 添加标记,用于判断是否是第一次对话
40
- self.system_message = ""
41
- self.model_name = "kimi"
45
+ self.chat_id = "" # 当前会话ID
46
+ self.first_chat = True # 标记是否是第一次对话
47
+ self.system_message = "" # 系统提示消息
48
+ self.model_name = "kimi" # 默认模型名称
42
49
 
43
50
  def set_system_prompt(self, message: str):
44
51
  """Set system message"""
@@ -246,7 +253,12 @@ class KimiModel(BasePlatform):
246
253
  return True
247
254
 
248
255
  def chat(self, message: str) -> Generator[str, None, None]:
249
- """Send message and get response"""
256
+ """发送消息并获取响应流
257
+ 参数:
258
+ message: 要发送的消息内容
259
+ 返回:
260
+ 生成器,逐块返回模型响应
261
+ """
250
262
  if not self.chat_id:
251
263
  if not self._create_chat():
252
264
  raise Exception("Failed to create chat session")