jarvis-ai-assistant 0.3.30__py3-none-any.whl → 0.7.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +458 -152
  3. jarvis/jarvis_agent/agent_manager.py +17 -13
  4. jarvis/jarvis_agent/builtin_input_handler.py +2 -6
  5. jarvis/jarvis_agent/config_editor.py +2 -7
  6. jarvis/jarvis_agent/event_bus.py +82 -12
  7. jarvis/jarvis_agent/file_context_handler.py +329 -0
  8. jarvis/jarvis_agent/file_methodology_manager.py +3 -4
  9. jarvis/jarvis_agent/jarvis.py +628 -55
  10. jarvis/jarvis_agent/language_extractors/__init__.py +57 -0
  11. jarvis/jarvis_agent/language_extractors/c_extractor.py +21 -0
  12. jarvis/jarvis_agent/language_extractors/cpp_extractor.py +21 -0
  13. jarvis/jarvis_agent/language_extractors/go_extractor.py +21 -0
  14. jarvis/jarvis_agent/language_extractors/java_extractor.py +84 -0
  15. jarvis/jarvis_agent/language_extractors/javascript_extractor.py +79 -0
  16. jarvis/jarvis_agent/language_extractors/python_extractor.py +21 -0
  17. jarvis/jarvis_agent/language_extractors/rust_extractor.py +21 -0
  18. jarvis/jarvis_agent/language_extractors/typescript_extractor.py +84 -0
  19. jarvis/jarvis_agent/language_support_info.py +486 -0
  20. jarvis/jarvis_agent/main.py +34 -10
  21. jarvis/jarvis_agent/memory_manager.py +7 -16
  22. jarvis/jarvis_agent/methodology_share_manager.py +10 -16
  23. jarvis/jarvis_agent/prompt_manager.py +1 -1
  24. jarvis/jarvis_agent/prompts.py +193 -171
  25. jarvis/jarvis_agent/protocols.py +8 -12
  26. jarvis/jarvis_agent/run_loop.py +105 -9
  27. jarvis/jarvis_agent/session_manager.py +2 -3
  28. jarvis/jarvis_agent/share_manager.py +20 -22
  29. jarvis/jarvis_agent/shell_input_handler.py +1 -2
  30. jarvis/jarvis_agent/stdio_redirect.py +295 -0
  31. jarvis/jarvis_agent/task_analyzer.py +31 -6
  32. jarvis/jarvis_agent/task_manager.py +11 -27
  33. jarvis/jarvis_agent/tool_executor.py +2 -3
  34. jarvis/jarvis_agent/tool_share_manager.py +12 -24
  35. jarvis/jarvis_agent/utils.py +5 -1
  36. jarvis/jarvis_agent/web_bridge.py +189 -0
  37. jarvis/jarvis_agent/web_output_sink.py +53 -0
  38. jarvis/jarvis_agent/web_server.py +786 -0
  39. jarvis/jarvis_c2rust/__init__.py +26 -0
  40. jarvis/jarvis_c2rust/cli.py +575 -0
  41. jarvis/jarvis_c2rust/collector.py +250 -0
  42. jarvis/jarvis_c2rust/constants.py +26 -0
  43. jarvis/jarvis_c2rust/library_replacer.py +1254 -0
  44. jarvis/jarvis_c2rust/llm_module_agent.py +1272 -0
  45. jarvis/jarvis_c2rust/loaders.py +207 -0
  46. jarvis/jarvis_c2rust/models.py +28 -0
  47. jarvis/jarvis_c2rust/optimizer.py +2157 -0
  48. jarvis/jarvis_c2rust/scanner.py +1681 -0
  49. jarvis/jarvis_c2rust/transpiler.py +2983 -0
  50. jarvis/jarvis_c2rust/utils.py +385 -0
  51. jarvis/jarvis_code_agent/build_validation_config.py +132 -0
  52. jarvis/jarvis_code_agent/code_agent.py +1371 -220
  53. jarvis/jarvis_code_agent/code_analyzer/__init__.py +65 -0
  54. jarvis/jarvis_code_agent/code_analyzer/base_language.py +74 -0
  55. jarvis/jarvis_code_agent/code_analyzer/build_validator/__init__.py +44 -0
  56. jarvis/jarvis_code_agent/code_analyzer/build_validator/base.py +106 -0
  57. jarvis/jarvis_code_agent/code_analyzer/build_validator/cmake.py +74 -0
  58. jarvis/jarvis_code_agent/code_analyzer/build_validator/detector.py +125 -0
  59. jarvis/jarvis_code_agent/code_analyzer/build_validator/fallback.py +72 -0
  60. jarvis/jarvis_code_agent/code_analyzer/build_validator/go.py +70 -0
  61. jarvis/jarvis_code_agent/code_analyzer/build_validator/java_gradle.py +53 -0
  62. jarvis/jarvis_code_agent/code_analyzer/build_validator/java_maven.py +47 -0
  63. jarvis/jarvis_code_agent/code_analyzer/build_validator/makefile.py +61 -0
  64. jarvis/jarvis_code_agent/code_analyzer/build_validator/nodejs.py +110 -0
  65. jarvis/jarvis_code_agent/code_analyzer/build_validator/python.py +154 -0
  66. jarvis/jarvis_code_agent/code_analyzer/build_validator/rust.py +110 -0
  67. jarvis/jarvis_code_agent/code_analyzer/build_validator/validator.py +153 -0
  68. jarvis/jarvis_code_agent/code_analyzer/build_validator.py +43 -0
  69. jarvis/jarvis_code_agent/code_analyzer/context_manager.py +648 -0
  70. jarvis/jarvis_code_agent/code_analyzer/context_recommender.py +18 -0
  71. jarvis/jarvis_code_agent/code_analyzer/dependency_analyzer.py +132 -0
  72. jarvis/jarvis_code_agent/code_analyzer/file_ignore.py +330 -0
  73. jarvis/jarvis_code_agent/code_analyzer/impact_analyzer.py +781 -0
  74. jarvis/jarvis_code_agent/code_analyzer/language_registry.py +185 -0
  75. jarvis/jarvis_code_agent/code_analyzer/language_support.py +110 -0
  76. jarvis/jarvis_code_agent/code_analyzer/languages/__init__.py +49 -0
  77. jarvis/jarvis_code_agent/code_analyzer/languages/c_cpp_language.py +299 -0
  78. jarvis/jarvis_code_agent/code_analyzer/languages/go_language.py +215 -0
  79. jarvis/jarvis_code_agent/code_analyzer/languages/java_language.py +212 -0
  80. jarvis/jarvis_code_agent/code_analyzer/languages/javascript_language.py +254 -0
  81. jarvis/jarvis_code_agent/code_analyzer/languages/python_language.py +269 -0
  82. jarvis/jarvis_code_agent/code_analyzer/languages/rust_language.py +281 -0
  83. jarvis/jarvis_code_agent/code_analyzer/languages/typescript_language.py +280 -0
  84. jarvis/jarvis_code_agent/code_analyzer/llm_context_recommender.py +605 -0
  85. jarvis/jarvis_code_agent/code_analyzer/structured_code.py +556 -0
  86. jarvis/jarvis_code_agent/code_analyzer/symbol_extractor.py +252 -0
  87. jarvis/jarvis_code_agent/code_analyzer/tree_sitter_extractor.py +58 -0
  88. jarvis/jarvis_code_agent/lint.py +501 -8
  89. jarvis/jarvis_code_agent/utils.py +141 -0
  90. jarvis/jarvis_code_analysis/code_review.py +493 -584
  91. jarvis/jarvis_data/config_schema.json +128 -12
  92. jarvis/jarvis_git_squash/main.py +4 -5
  93. jarvis/jarvis_git_utils/git_commiter.py +82 -75
  94. jarvis/jarvis_mcp/sse_mcp_client.py +22 -29
  95. jarvis/jarvis_mcp/stdio_mcp_client.py +12 -13
  96. jarvis/jarvis_mcp/streamable_mcp_client.py +15 -14
  97. jarvis/jarvis_memory_organizer/memory_organizer.py +55 -74
  98. jarvis/jarvis_methodology/main.py +32 -48
  99. jarvis/jarvis_multi_agent/__init__.py +287 -55
  100. jarvis/jarvis_multi_agent/main.py +36 -4
  101. jarvis/jarvis_platform/base.py +524 -202
  102. jarvis/jarvis_platform/human.py +7 -8
  103. jarvis/jarvis_platform/kimi.py +30 -36
  104. jarvis/jarvis_platform/openai.py +88 -25
  105. jarvis/jarvis_platform/registry.py +26 -10
  106. jarvis/jarvis_platform/tongyi.py +24 -25
  107. jarvis/jarvis_platform/yuanbao.py +32 -43
  108. jarvis/jarvis_platform_manager/main.py +66 -77
  109. jarvis/jarvis_platform_manager/service.py +8 -13
  110. jarvis/jarvis_rag/cli.py +53 -55
  111. jarvis/jarvis_rag/embedding_manager.py +13 -18
  112. jarvis/jarvis_rag/llm_interface.py +8 -9
  113. jarvis/jarvis_rag/query_rewriter.py +10 -21
  114. jarvis/jarvis_rag/rag_pipeline.py +24 -27
  115. jarvis/jarvis_rag/reranker.py +4 -5
  116. jarvis/jarvis_rag/retriever.py +28 -30
  117. jarvis/jarvis_sec/__init__.py +305 -0
  118. jarvis/jarvis_sec/agents.py +143 -0
  119. jarvis/jarvis_sec/analysis.py +276 -0
  120. jarvis/jarvis_sec/checkers/__init__.py +32 -0
  121. jarvis/jarvis_sec/checkers/c_checker.py +2680 -0
  122. jarvis/jarvis_sec/checkers/rust_checker.py +1108 -0
  123. jarvis/jarvis_sec/cli.py +139 -0
  124. jarvis/jarvis_sec/clustering.py +1439 -0
  125. jarvis/jarvis_sec/file_manager.py +427 -0
  126. jarvis/jarvis_sec/parsers.py +73 -0
  127. jarvis/jarvis_sec/prompts.py +268 -0
  128. jarvis/jarvis_sec/report.py +336 -0
  129. jarvis/jarvis_sec/review.py +453 -0
  130. jarvis/jarvis_sec/status.py +264 -0
  131. jarvis/jarvis_sec/types.py +20 -0
  132. jarvis/jarvis_sec/utils.py +499 -0
  133. jarvis/jarvis_sec/verification.py +848 -0
  134. jarvis/jarvis_sec/workflow.py +226 -0
  135. jarvis/jarvis_smart_shell/main.py +38 -87
  136. jarvis/jarvis_stats/cli.py +2 -2
  137. jarvis/jarvis_stats/stats.py +8 -8
  138. jarvis/jarvis_stats/storage.py +15 -21
  139. jarvis/jarvis_stats/visualizer.py +1 -1
  140. jarvis/jarvis_tools/clear_memory.py +3 -20
  141. jarvis/jarvis_tools/cli/main.py +21 -23
  142. jarvis/jarvis_tools/edit_file.py +1019 -132
  143. jarvis/jarvis_tools/execute_script.py +83 -25
  144. jarvis/jarvis_tools/file_analyzer.py +6 -9
  145. jarvis/jarvis_tools/generate_new_tool.py +14 -21
  146. jarvis/jarvis_tools/lsp_client.py +1552 -0
  147. jarvis/jarvis_tools/methodology.py +2 -3
  148. jarvis/jarvis_tools/read_code.py +1736 -35
  149. jarvis/jarvis_tools/read_symbols.py +140 -0
  150. jarvis/jarvis_tools/read_webpage.py +12 -13
  151. jarvis/jarvis_tools/registry.py +427 -200
  152. jarvis/jarvis_tools/retrieve_memory.py +20 -19
  153. jarvis/jarvis_tools/rewrite_file.py +72 -158
  154. jarvis/jarvis_tools/save_memory.py +3 -15
  155. jarvis/jarvis_tools/search_web.py +18 -18
  156. jarvis/jarvis_tools/sub_agent.py +36 -43
  157. jarvis/jarvis_tools/sub_code_agent.py +25 -26
  158. jarvis/jarvis_tools/virtual_tty.py +55 -33
  159. jarvis/jarvis_utils/clipboard.py +7 -10
  160. jarvis/jarvis_utils/config.py +232 -45
  161. jarvis/jarvis_utils/embedding.py +8 -5
  162. jarvis/jarvis_utils/fzf.py +8 -8
  163. jarvis/jarvis_utils/git_utils.py +225 -36
  164. jarvis/jarvis_utils/globals.py +3 -3
  165. jarvis/jarvis_utils/http.py +1 -1
  166. jarvis/jarvis_utils/input.py +99 -48
  167. jarvis/jarvis_utils/jsonnet_compat.py +465 -0
  168. jarvis/jarvis_utils/methodology.py +52 -48
  169. jarvis/jarvis_utils/utils.py +819 -491
  170. jarvis_ai_assistant-0.7.6.dist-info/METADATA +600 -0
  171. jarvis_ai_assistant-0.7.6.dist-info/RECORD +218 -0
  172. {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/entry_points.txt +4 -0
  173. jarvis/jarvis_agent/config.py +0 -92
  174. jarvis/jarvis_agent/edit_file_handler.py +0 -296
  175. jarvis/jarvis_platform/ai8.py +0 -332
  176. jarvis/jarvis_tools/ask_user.py +0 -54
  177. jarvis_ai_assistant-0.3.30.dist-info/METADATA +0 -381
  178. jarvis_ai_assistant-0.3.30.dist-info/RECORD +0 -137
  179. {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/WHEEL +0 -0
  180. {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/licenses/LICENSE +0 -0
  181. {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/top_level.txt +0 -0
@@ -7,6 +7,7 @@
7
7
  "JARVIS_MCP": {
8
8
  "type": "array",
9
9
  "description": "MCP工具配置列表",
10
+ "default": [],
10
11
  "items": {
11
12
  "type": "object",
12
13
  "oneOf": [
@@ -119,12 +120,32 @@
119
120
  "JARVIS_PLATFORM": {
120
121
  "type": "string",
121
122
  "description": "常规操作平台名称",
122
- "default": "yuanbao"
123
+ "default": "openai"
123
124
  },
124
125
  "JARVIS_MODEL": {
125
126
  "type": "string",
126
127
  "description": "常规操作模型名称",
127
- "default": "deep_seek_v3"
128
+ "default": "gpt-5"
129
+ },
130
+ "JARVIS_CHEAP_PLATFORM": {
131
+ "type": "string",
132
+ "description": "廉价操作的平台名称。如未配置,则使用 JARVIS_PLATFORM 的值",
133
+ "default": ""
134
+ },
135
+ "JARVIS_CHEAP_MODEL": {
136
+ "type": "string",
137
+ "description": "廉价操作的模型名称。如未配置,则使用 JARVIS_MODEL 的值",
138
+ "default": ""
139
+ },
140
+ "JARVIS_SMART_PLATFORM": {
141
+ "type": "string",
142
+ "description": "智能操作的平台名称。如未配置,则使用 JARVIS_PLATFORM 的值",
143
+ "default": ""
144
+ },
145
+ "JARVIS_SMART_MODEL": {
146
+ "type": "string",
147
+ "description": "智能操作的模型名称。如未配置,则使用 JARVIS_MODEL 的值",
148
+ "default": ""
128
149
  },
129
150
  "JARVIS_WEB_SEARCH_PLATFORM": {
130
151
  "type": "string",
@@ -152,16 +173,32 @@
152
173
  "properties": {
153
174
  "JARVIS_PLATFORM": {
154
175
  "type": "string",
155
- "default": "yuanbao"
176
+ "default": "openai"
156
177
  },
157
178
  "JARVIS_MODEL": {
158
179
  "type": "string",
159
- "default": "deep_seek_v3"
180
+ "default": "gpt-5"
160
181
  },
161
182
  "JARVIS_MAX_INPUT_TOKEN_COUNT": {
162
183
  "type": "number",
163
184
  "default": 32000
164
185
  },
186
+ "JARVIS_CHEAP_PLATFORM": {
187
+ "type": "string",
188
+ "description": "廉价操作的平台名称。如未配置,则使用 JARVIS_PLATFORM 的值"
189
+ },
190
+ "JARVIS_CHEAP_MODEL": {
191
+ "type": "string",
192
+ "description": "廉价操作的模型名称。如未配置,则使用 JARVIS_MODEL 的值"
193
+ },
194
+ "JARVIS_SMART_PLATFORM": {
195
+ "type": "string",
196
+ "description": "智能操作的平台名称。如未配置,则使用 JARVIS_PLATFORM 的值"
197
+ },
198
+ "JARVIS_SMART_MODEL": {
199
+ "type": "string",
200
+ "description": "智能操作的模型名称。如未配置,则使用 JARVIS_MODEL 的值"
201
+ },
165
202
  "ENV": {
166
203
  "type": "object",
167
204
  "description": "该模型组特定的环境变量,会覆盖全局 ENV 配置",
@@ -182,6 +219,16 @@
182
219
  "description": "执行工具前是否需要确认",
183
220
  "default": false
184
221
  },
222
+ "JARVIS_TOOL_FILTER_THRESHOLD": {
223
+ "type": "number",
224
+ "description": "AI工具筛选阈值:当可用工具数量超过此值时触发AI筛选",
225
+ "default": 30
226
+ },
227
+ "JARVIS_SCRIPT_EXECUTION_TIMEOUT": {
228
+ "type": "number",
229
+ "description": "脚本执行的超时时间(秒),仅在非交互模式下生效。",
230
+ "default": 300
231
+ },
185
232
  "JARVIS_CONFIRM_BEFORE_APPLY_PATCH": {
186
233
  "type": "boolean",
187
234
  "description": "应用补丁前是否需要确认",
@@ -195,7 +242,7 @@
195
242
  "JARVIS_PRETTY_OUTPUT": {
196
243
  "type": "boolean",
197
244
  "description": "是否启用美化输出",
198
- "default": false
245
+ "default": true
199
246
  },
200
247
  "JARVIS_USE_METHODOLOGY": {
201
248
  "type": "boolean",
@@ -257,12 +304,12 @@
257
304
  },
258
305
  "JARVIS_CENTRAL_METHODOLOGY_REPO": {
259
306
  "type": "string",
260
- "description": "中心方法论Git仓库地址,该仓库会自动添加到方法论加载路径中",
307
+ "description": "中心方法论仓库路径或Git仓库地址。支持本地目录(含git子路径):若为本地目录将直接加入方法论加载路径;若为Git URL则会克隆到数据目录后加载。",
261
308
  "default": ""
262
309
  },
263
310
  "JARVIS_CENTRAL_TOOL_REPO": {
264
311
  "type": "string",
265
- "description": "中心工具库Git仓库地址,该仓库会自动克隆到数据目录并加载其中的工具",
312
+ "description": "中心工具仓库路径或Git仓库地址。支持本地目录(含git子路径):若为本地目录将直接加载其中的工具;若为Git URL则会克隆到数据目录并加载。",
266
313
  "default": ""
267
314
  },
268
315
  "JARVIS_PRINT_PROMPT": {
@@ -270,31 +317,76 @@
270
317
  "description": "是否打印提示",
271
318
  "default": false
272
319
  },
320
+ "JARVIS_PRINT_ERROR_TRACEBACK": {
321
+ "type": "boolean",
322
+ "description": "是否在错误输出时打印回溯调用链",
323
+ "default": false
324
+ },
273
325
  "JARVIS_ENABLE_STATIC_ANALYSIS": {
274
326
  "type": "boolean",
275
327
  "description": "是否启用静态代码分析",
276
328
  "default": true
277
329
  },
330
+ "JARVIS_ENABLE_BUILD_VALIDATION": {
331
+ "type": "boolean",
332
+ "description": "是否启用构建验证。在代码编辑后自动验证代码能否成功编译/构建,确保编辑不会破坏项目构建。",
333
+ "default": true
334
+ },
335
+ "JARVIS_BUILD_VALIDATION_TIMEOUT": {
336
+ "type": "number",
337
+ "description": "构建验证的超时时间(秒)。当构建验证执行时间超过此值时,将终止验证并报告超时。",
338
+ "default": 600
339
+ },
340
+ "JARVIS_ENABLE_IMPACT_ANALYSIS": {
341
+ "type": "boolean",
342
+ "description": "是否启用编辑影响范围分析。分析代码编辑的影响范围,识别可能受影响的文件、函数、测试等,帮助评估编辑风险。",
343
+ "default": true
344
+ },
278
345
  "JARVIS_FORCE_SAVE_MEMORY": {
279
346
  "type": "boolean",
280
347
  "description": "是否强制保存记忆",
281
- "default": true
348
+ "default": false
282
349
  },
283
350
  "JARVIS_ENABLE_GIT_JCA_SWITCH": {
284
351
  "type": "boolean",
285
352
  "description": "在初始化环境前检测Git仓库并提示可切换到代码开发模式(jca)",
286
- "default": false
353
+ "default": true
287
354
  },
288
355
  "JARVIS_ENABLE_STARTUP_CONFIG_SELECTOR": {
289
356
  "type": "boolean",
290
357
  "description": "在进入默认通用代理前,列出可用配置(agent/multi_agent/roles)供选择",
291
- "default": false
358
+ "default": true
292
359
  },
293
360
  "JARVIS_IMMEDIATE_ABORT": {
294
361
  "type": "boolean",
295
362
  "description": "是否启用立即中断:在对话迭代中检测到中断信号时立即返回",
296
363
  "default": false
297
364
  },
365
+ "JARVIS_SAVE_SESSION_HISTORY": {
366
+ "type": "boolean",
367
+ "description": "是否保存会话记录",
368
+ "default": false
369
+ },
370
+ "JARVIS_SKIP_PREDEFINED_TASKS": {
371
+ "type": "boolean",
372
+ "description": "是否跳过预定义任务加载(不读取 pre-command 列表)",
373
+ "default": false
374
+ },
375
+ "JARVIS_ADDON_PROMPT_THRESHOLD": {
376
+ "type": "number",
377
+ "description": "附加提示的触发阈值(字符数)。当消息长度超过此值时,会自动添加默认的附加提示",
378
+ "default": 1024
379
+ },
380
+ "JARVIS_ENABLE_INTENT_RECOGNITION": {
381
+ "type": "boolean",
382
+ "description": "是否启用意图识别功能。用于智能上下文推荐中的LLM意图提取和语义分析",
383
+ "default": true
384
+ },
385
+ "JARVIS_ENABLE_MEMORY_ORGANIZER": {
386
+ "type": "boolean",
387
+ "description": "是否启用自动记忆整理功能。在任务完成后自动检测记忆库状态,当记忆数量超过200条且存在重叠时提示用户整理",
388
+ "default": false
389
+ },
298
390
  "JARVIS_GIT_CHECK_MODE": {
299
391
  "type": "string",
300
392
  "enum": ["strict", "warn"],
@@ -341,7 +433,23 @@
341
433
  "JARVIS_RAG_GROUPS": {
342
434
  "type": "array",
343
435
  "description": "预定义的RAG配置组",
344
- "default": [],
436
+ "default": [
437
+ {
438
+ "text": {
439
+ "embedding_model": "BAAI/bge-m3",
440
+ "rerank_model": "BAAI/bge-reranker-v2-m3",
441
+ "use_bm25": true,
442
+ "use_rerank": true
443
+ }
444
+ },
445
+ {
446
+ "code": {
447
+ "embedding_model": "Qodo/Qodo-Embed-1-1.5B",
448
+ "use_bm25": false,
449
+ "use_rerank": false
450
+ }
451
+ }
452
+ ],
345
453
  "items": {
346
454
  "type": "object",
347
455
  "additionalProperties": {
@@ -421,7 +529,8 @@
421
529
  "required": [
422
530
  "template"
423
531
  ]
424
- }
532
+ },
533
+ "default": {}
425
534
  },
426
535
  "OPENAI_API_KEY": {
427
536
  "type": "string",
@@ -451,6 +560,13 @@
451
560
  "type": "string",
452
561
  "description": "系统Shell路径,用于获取当前使用的shell类型",
453
562
  "default": "/bin/bash"
563
+ },
564
+ "JARVIS_CONVERSATION_TURN_THRESHOLD": {
565
+ "type": "number",
566
+ "description": "对话轮次阈值,用于触发总结。当对话轮次超过此值时,系统会自动触发对话总结",
567
+ "default": 50,
568
+ "minimum": 1,
569
+ "maximum": 1000
454
570
  }
455
571
  },
456
572
  "additionalProperties": true
@@ -5,7 +5,6 @@ from typing import Dict
5
5
  import typer
6
6
 
7
7
  from jarvis.jarvis_git_utils.git_commiter import GitCommitTool
8
- from jarvis.jarvis_utils.output import OutputType, PrettyOutput
9
8
  from jarvis.jarvis_utils.utils import init_env
10
9
  from jarvis.jarvis_utils.input import user_confirm
11
10
  from jarvis.jarvis_utils.globals import get_agent, current_agent_name
@@ -38,11 +37,11 @@ class GitSquashTool:
38
37
  """Execute the squash operation"""
39
38
  try:
40
39
  if not self._confirm_squash():
41
- PrettyOutput.print("操作已取消", OutputType.WARNING)
40
+ print("⚠️ 操作已取消")
42
41
  return
43
42
 
44
43
  if not self._reset_to_commit(args["commit_hash"]):
45
- PrettyOutput.print("重置到指定提交失败", OutputType.WARNING)
44
+ print("⚠️ 重置到指定提交失败")
46
45
  return
47
46
 
48
47
  # Use existing GitCommitTool for new commit
@@ -53,7 +52,7 @@ class GitSquashTool:
53
52
  exec_args["agent"] = agent
54
53
  commit_tool.execute(exec_args)
55
54
  except Exception as e:
56
- PrettyOutput.print(f"压缩提交失败: {str(e)}", OutputType.WARNING)
55
+ print(f"⚠️ 压缩提交失败: {str(e)}")
57
56
 
58
57
 
59
58
  @app.command()
@@ -61,7 +60,7 @@ def cli(
61
60
  commit_hash: str = typer.Argument(..., help="要压缩的基础提交哈希"),
62
61
  lang: str = typer.Option("Chinese", "--lang", help="提交信息的语言"),
63
62
  ):
64
- init_env("欢迎使用 Jarvis-GitSquash,您的Git压缩助手已准备就绪!")
63
+ init_env()
65
64
  tool = GitSquashTool()
66
65
  tool.execute({"commit_hash": commit_hash, "lang": lang})
67
66
 
@@ -75,7 +75,7 @@ class GitCommitTool:
75
75
  os.chdir(root_dir)
76
76
  find_git_root_and_cd()
77
77
  if not has_uncommitted_changes():
78
- PrettyOutput.print("没有未提交的更改", OutputType.SUCCESS)
78
+ print("没有未提交的更改")
79
79
  return None
80
80
  return original_dir
81
81
 
@@ -129,42 +129,7 @@ class GitCommitTool:
129
129
 
130
130
  try:
131
131
  temp_diff_file_path = None
132
- # 生成提交信息
133
- PrettyOutput.print("正在生成提交消息...", OutputType.INFO)
134
-
135
- # 准备提示信息
136
- custom_prompt = get_git_commit_prompt()
137
- base_prompt = (
138
- custom_prompt
139
- if custom_prompt
140
- else """根据代码差异生成提交信息:
141
- 提交信息应使用中文书写
142
- # 格式模板
143
- 必须使用以下格式:
144
-
145
- <类型>(<范围>): <主题>
146
-
147
- [可选] 详细描述变更内容和原因
148
-
149
- # 格式规则
150
- 1. 类型: fix(修复bug), feat(新功能), docs(文档), style(格式), refactor(重构), test(测试), chore(其他)
151
- 2. 范围表示变更的模块或组件 (例如: auth, database, ui)
152
- 3. 主题行不超过72个字符,不以句号结尾,使用祈使语气
153
- 4. 如有详细描述,使用空行分隔主题和详细描述
154
- 5. 详细描述部分应解释"是什么"和"为什么",而非"如何"
155
- 6. 仅输出提交信息,不要输出其他内容
156
- """
157
- )
158
- base_prompt += f"""
159
- # 输出格式
160
- {ot("COMMIT_MESSAGE")}
161
- commit信息
162
- {ct("COMMIT_MESSAGE")}
163
- """
164
-
165
- # 优先从调用方传入的 agent 获取平台与模型
166
- agent_from_args = args.get("agent")
167
-
132
+
168
133
  # Get model_group from args
169
134
  model_group = args.get("model_group")
170
135
 
@@ -177,30 +142,36 @@ commit信息
177
142
  platform_name = None
178
143
  model_name = None
179
144
 
180
- if (
181
- agent_from_args
182
- and hasattr(agent_from_args, "model")
183
- and getattr(agent_from_args, "model", None)
184
- ):
185
- try:
186
- platform_name = agent_from_args.model.platform_name()
187
- model_name = agent_from_args.model.name()
188
- if not model_group and hasattr(
189
- agent_from_args.model, "model_group"
190
- ):
191
- model_group = agent_from_args.model.model_group
192
- except Exception:
193
- # 安全回退到后续逻辑
194
- platform_name = None
195
- model_name = None
196
-
197
- # 如果未能从agent获取到,再根据 model_group 获取
198
- if not platform_name:
145
+ # 优先根据 model_group 获取(确保配置一致性)
146
+ # 如果 model_group 存在,强制使用它来解析,避免使用 agent.model 中可能不一致的值
147
+ if model_group:
199
148
  platform_name = get_normal_platform_name(model_group)
200
- if not model_name:
201
149
  model_name = get_normal_model_name(model_group)
202
-
203
- # If no explicit parameters, try to get from existing global agent
150
+ else:
151
+ # 如果没有提供 model_group,尝试从传入的 agent 获取
152
+ agent_from_args = args.get("agent")
153
+ if (
154
+ agent_from_args
155
+ and hasattr(agent_from_args, "model")
156
+ and getattr(agent_from_args, "model", None)
157
+ ):
158
+ try:
159
+ platform_name = agent_from_args.model.platform_name()
160
+ model_name = agent_from_args.model.name()
161
+ if hasattr(agent_from_args.model, "model_group"):
162
+ model_group = agent_from_args.model.model_group
163
+ except Exception:
164
+ # 安全回退到后续逻辑
165
+ platform_name = None
166
+ model_name = None
167
+
168
+ # 如果仍未获取到,使用配置文件中的默认值(传入 None 会读取默认配置)
169
+ if not platform_name:
170
+ platform_name = get_normal_platform_name(None)
171
+ if not model_name:
172
+ model_name = get_normal_model_name(None)
173
+
174
+ # 最后的回退:尝试从全局 agent 获取(仅当仍未获取到时)
204
175
  if not platform_name:
205
176
  agent = get_agent(current_agent_name)
206
177
  if (
@@ -208,10 +179,17 @@ commit信息
208
179
  and hasattr(agent, "model")
209
180
  and getattr(agent, "model", None)
210
181
  ):
211
- platform_name = agent.model.platform_name()
212
- model_name = agent.model.name()
213
- if not model_group and hasattr(agent.model, "model_group"):
214
- model_group = agent.model.model_group
182
+ try:
183
+ platform_name = agent.model.platform_name()
184
+ model_name = agent.model.name()
185
+ if not model_group and hasattr(agent.model, "model_group"):
186
+ model_group = agent.model.model_group
187
+ except Exception:
188
+ # 如果全局 agent 也无法获取,使用配置文件默认值
189
+ if not platform_name:
190
+ platform_name = get_normal_platform_name(None)
191
+ if not model_name:
192
+ model_name = get_normal_model_name(None)
215
193
 
216
194
  # Create a new platform instance
217
195
  if platform_name:
@@ -227,6 +205,40 @@ commit信息
227
205
  else:
228
206
  platform = PlatformRegistry().get_normal_platform()
229
207
 
208
+ # 生成提交信息
209
+ model_display_name = model_name or (platform.name() if platform else "AI")
210
+ print(f"ℹ️ 正在使用{model_display_name}生成提交消息...")
211
+
212
+ # 准备提示信息
213
+ custom_prompt = get_git_commit_prompt()
214
+ base_prompt = (
215
+ custom_prompt
216
+ if custom_prompt
217
+ else """根据代码差异生成提交信息:
218
+ 提交信息应使用中文书写
219
+ # 格式模板
220
+ 必须使用以下格式:
221
+
222
+ <类型>(<范围>): <主题>
223
+
224
+ [可选] 详细描述变更内容和原因
225
+
226
+ # 格式规则
227
+ 1. 类型: fix(修复bug), feat(新功能), docs(文档), style(格式), refactor(重构), test(测试), chore(其他)
228
+ 2. 范围表示变更的模块或组件 (例如: auth, database, ui)
229
+ 3. 主题行不超过72个字符,不以句号结尾,使用祈使语气
230
+ 4. 如有详细描述,使用空行分隔主题和详细描述
231
+ 5. 详细描述部分应解释"是什么"和"为什么",而非"如何"
232
+ 6. 仅输出提交信息,不要输出其他内容
233
+ """
234
+ )
235
+ base_prompt += f"""
236
+ # 输出格式
237
+ {ot("COMMIT_MESSAGE")}
238
+ commit信息
239
+ {ct("COMMIT_MESSAGE")}
240
+ """
241
+
230
242
  # 跳过模型可用性校验:
231
243
  # 为避免某些平台/代理不支持 get_model_list 接口导致的噪音日志(如 404),
232
244
  # 这里默认不调用 platform.get_model_list() 进行模型可用性校验。
@@ -244,11 +256,11 @@ commit信息
244
256
  upload_success = False
245
257
 
246
258
  # Check if content is too large
247
- is_large_content = is_context_overflow(diff, model_group)
259
+ is_large_content = is_context_overflow(diff, model_group, platform)
248
260
 
249
261
  if is_large_content:
250
262
  if not platform.support_upload_files():
251
- PrettyOutput.print("差异文件太大,无法处理", OutputType.ERROR)
263
+ print("差异文件太大,无法处理")
252
264
  return {
253
265
  "success": False,
254
266
  "stdout": "",
@@ -267,7 +279,7 @@ commit信息
267
279
  if upload_success:
268
280
  pass
269
281
  else:
270
- PrettyOutput.print("上传代码差异文件失败", OutputType.ERROR)
282
+ print("上传代码差异文件失败")
271
283
  return {
272
284
  "success": False,
273
285
  "stdout": "",
@@ -366,14 +378,9 @@ commit信息
366
378
  try:
367
379
  os.unlink(temp_diff_file_path)
368
380
  except Exception as e:
369
- PrettyOutput.print(
370
- f"无法删除临时文件: {str(e)}", OutputType.WARNING
371
- )
381
+ print(f"⚠️ 无法删除临时文件: {str(e)}")
372
382
 
373
- PrettyOutput.print(
374
- f"提交哈希: {commit_hash}\n提交消息: {commit_message}",
375
- OutputType.SUCCESS,
376
- )
383
+ PrettyOutput.print(f"提交哈希: {commit_hash}\n提交消息: {commit_message}", OutputType.SUCCESS)
377
384
 
378
385
  return {
379
386
  "success": True,
@@ -384,7 +391,7 @@ commit信息
384
391
  "stderr": "",
385
392
  }
386
393
  except Exception as e:
387
- PrettyOutput.print(f"提交失败: {str(e)}", OutputType.ERROR)
394
+ print(f"提交失败: {str(e)}")
388
395
  return {
389
396
  "success": False,
390
397
  "stdout": "",
@@ -413,7 +420,7 @@ def cli(
413
420
  None, "-g", "--llm-group", help="使用的模型组,覆盖配置文件中的设置"
414
421
  ),
415
422
  ):
416
- init_env("欢迎使用 Jarvis-GitCommitTool,您的Git提交助手已准备就绪!")
423
+ init_env()
417
424
  tool = GitCommitTool()
418
425
  tool.execute(
419
426
  {
@@ -5,10 +5,9 @@ import time
5
5
  from typing import Any, Callable, Dict, List, Optional
6
6
  from urllib.parse import parse_qs, urlencode, urljoin
7
7
 
8
- import requests
8
+ import requests # type: ignore[import-untyped]
9
9
 
10
10
  from jarvis.jarvis_mcp import McpClient
11
- from jarvis.jarvis_utils.output import OutputType, PrettyOutput
12
11
 
13
12
 
14
13
  class SSEMcpClient(McpClient):
@@ -78,13 +77,10 @@ class SSEMcpClient(McpClient):
78
77
 
79
78
  if not self.messages_endpoint:
80
79
  self.messages_endpoint = "/messages" # 默认端点
81
- PrettyOutput.print(
82
- f"未获取到消息端点,使用默认值: {self.messages_endpoint}",
83
- OutputType.WARNING,
84
- )
80
+ print(f"⚠️ 未获取到消息端点,使用默认值: {self.messages_endpoint}")
85
81
 
86
82
  if not self.session_id:
87
- PrettyOutput.print("未获取到会话ID", OutputType.WARNING)
83
+ print("⚠️ 未获取到会话ID")
88
84
 
89
85
  # 发送初始化请求
90
86
  response = self._send_request(
@@ -107,7 +103,7 @@ class SSEMcpClient(McpClient):
107
103
  self._send_notification("notifications/initialized", {})
108
104
 
109
105
  except Exception as e:
110
- PrettyOutput.print(f"MCP初始化失败: {str(e)}", OutputType.ERROR)
106
+ print(f"MCP初始化失败: {str(e)}")
111
107
  raise
112
108
 
113
109
  def _start_sse_connection(self) -> None:
@@ -138,7 +134,7 @@ class SSEMcpClient(McpClient):
138
134
  self.sse_thread.start()
139
135
 
140
136
  except Exception as e:
141
- PrettyOutput.print(f"SSE连接失败: {str(e)}", OutputType.ERROR)
137
+ print(f"SSE连接失败: {str(e)}")
142
138
  raise
143
139
 
144
140
  def _process_sse_events(self) -> None:
@@ -166,9 +162,7 @@ class SSEMcpClient(McpClient):
166
162
  if "session_id" in query_params:
167
163
  self.session_id = query_params["session_id"][0]
168
164
  except Exception as e:
169
- PrettyOutput.print(
170
- f"解析消息端点或会话ID失败: {e}", OutputType.WARNING
171
- )
165
+ print(f"⚠️ 解析消息端点或会话ID失败: {e}")
172
166
  else:
173
167
  buffer += data
174
168
  elif line.startswith(":"): # 忽略注释行
@@ -184,10 +178,10 @@ class SSEMcpClient(McpClient):
184
178
  try:
185
179
  self._handle_sse_event(buffer)
186
180
  except Exception as e:
187
- PrettyOutput.print(f"处理SSE事件出错: {e}", OutputType.ERROR)
181
+ print(f"处理SSE事件出错: {e}")
188
182
  buffer = ""
189
183
 
190
- PrettyOutput.print("SSE连接已关闭", OutputType.WARNING)
184
+ print("⚠️ SSE连接已关闭")
191
185
 
192
186
  def _handle_sse_event(self, data: str) -> None:
193
187
  """处理单个SSE事件数据"""
@@ -217,11 +211,10 @@ class SSEMcpClient(McpClient):
217
211
  except Exception as e:
218
212
  error_lines.append(f"处理通知时出错 ({method}): {e}")
219
213
  if error_lines:
220
- PrettyOutput.print("\n".join(error_lines), OutputType.ERROR)
221
- except json.JSONDecodeError:
222
- PrettyOutput.print(f"无法解析SSE事件: {data}", OutputType.WARNING)
223
- except Exception as e:
224
- PrettyOutput.print(f"处理SSE事件时出错: {e}", OutputType.ERROR)
214
+ joined_errors = '\n'.join(error_lines)
215
+ print(f"❌ {joined_errors}")
216
+ except Exception:
217
+ print(f"⚠️ 无法解析SSE事件: {data}")
225
218
 
226
219
  def register_notification_handler(self, method: str, handler: Callable) -> None:
227
220
  """注册通知处理器
@@ -341,7 +334,7 @@ class SSEMcpClient(McpClient):
341
334
  self.pending_requests.pop(req_id, None)
342
335
  self.request_results.pop(req_id, None)
343
336
 
344
- PrettyOutput.print(f"发送请求失败: {str(e)}", OutputType.ERROR)
337
+ print(f"发送请求失败: {str(e)}")
345
338
  raise
346
339
 
347
340
  def _send_notification(self, method: str, params: Dict[str, Any]) -> None:
@@ -396,7 +389,7 @@ class SSEMcpClient(McpClient):
396
389
  post_response.raise_for_status()
397
390
 
398
391
  except Exception as e:
399
- PrettyOutput.print(f"发送通知失败: {str(e)}", OutputType.ERROR)
392
+ print(f"发送通知失败: {str(e)}")
400
393
  raise
401
394
 
402
395
  def get_tool_list(self) -> List[Dict[str, Any]]:
@@ -439,10 +432,10 @@ class SSEMcpClient(McpClient):
439
432
  else:
440
433
  error_msg += ": 未知错误"
441
434
 
442
- PrettyOutput.print(error_msg, OutputType.ERROR)
435
+ print(f"❌ {error_msg}")
443
436
  return []
444
437
  except Exception as e:
445
- PrettyOutput.print(f"获取工具列表失败: {str(e)}", OutputType.ERROR)
438
+ print(f"获取工具列表失败: {str(e)}")
446
439
  return []
447
440
 
448
441
  def execute(self, tool_name: str, arguments: Dict[str, Any]) -> Dict[str, Any]:
@@ -481,7 +474,7 @@ class SSEMcpClient(McpClient):
481
474
  "stderr": response.get("error", "Unknown error"),
482
475
  }
483
476
  except Exception as e:
484
- PrettyOutput.print(f"执行工具失败: {str(e)}", OutputType.ERROR)
477
+ print(f"执行工具失败: {str(e)}")
485
478
  return {"success": False, "stdout": "", "stderr": str(e)}
486
479
 
487
480
  def get_resource_list(self) -> List[Dict[str, Any]]:
@@ -504,10 +497,10 @@ class SSEMcpClient(McpClient):
504
497
  error_msg += f": {response['error']}"
505
498
  else:
506
499
  error_msg += ": 未知错误"
507
- PrettyOutput.print(error_msg, OutputType.ERROR)
500
+ print(f"❌ {error_msg}")
508
501
  return []
509
502
  except Exception as e:
510
- PrettyOutput.print(f"获取资源列表失败: {str(e)}", OutputType.ERROR)
503
+ print(f"获取资源列表失败: {str(e)}")
511
504
  return []
512
505
 
513
506
  def get_resource(self, uri: str) -> Dict[str, Any]:
@@ -548,11 +541,11 @@ class SSEMcpClient(McpClient):
548
541
  error_msg += f": {response['error']}"
549
542
  else:
550
543
  error_msg += ": 未知错误"
551
- PrettyOutput.print(error_msg, OutputType.ERROR)
544
+ print(f"❌ {error_msg}")
552
545
  return {"success": False, "stdout": "", "stderr": error_msg}
553
546
  except Exception as e:
554
547
  error_msg = f"获取资源内容失败: {str(e)}"
555
- PrettyOutput.print(error_msg, OutputType.ERROR)
548
+ print(f"❌ {error_msg}")
556
549
  return {"success": False, "stdout": "", "stderr": error_msg}
557
550
 
558
551
  def __del__(self):
@@ -568,7 +561,7 @@ class SSEMcpClient(McpClient):
568
561
  if self.sse_response:
569
562
  try:
570
563
  self.sse_response.close()
571
- except:
564
+ except Exception:
572
565
  pass
573
566
 
574
567
  # 关闭HTTP会话