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.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +458 -152
- jarvis/jarvis_agent/agent_manager.py +17 -13
- jarvis/jarvis_agent/builtin_input_handler.py +2 -6
- jarvis/jarvis_agent/config_editor.py +2 -7
- jarvis/jarvis_agent/event_bus.py +82 -12
- jarvis/jarvis_agent/file_context_handler.py +329 -0
- jarvis/jarvis_agent/file_methodology_manager.py +3 -4
- jarvis/jarvis_agent/jarvis.py +628 -55
- jarvis/jarvis_agent/language_extractors/__init__.py +57 -0
- jarvis/jarvis_agent/language_extractors/c_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/cpp_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/go_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/java_extractor.py +84 -0
- jarvis/jarvis_agent/language_extractors/javascript_extractor.py +79 -0
- jarvis/jarvis_agent/language_extractors/python_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/rust_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/typescript_extractor.py +84 -0
- jarvis/jarvis_agent/language_support_info.py +486 -0
- jarvis/jarvis_agent/main.py +34 -10
- jarvis/jarvis_agent/memory_manager.py +7 -16
- jarvis/jarvis_agent/methodology_share_manager.py +10 -16
- jarvis/jarvis_agent/prompt_manager.py +1 -1
- jarvis/jarvis_agent/prompts.py +193 -171
- jarvis/jarvis_agent/protocols.py +8 -12
- jarvis/jarvis_agent/run_loop.py +105 -9
- jarvis/jarvis_agent/session_manager.py +2 -3
- jarvis/jarvis_agent/share_manager.py +20 -22
- jarvis/jarvis_agent/shell_input_handler.py +1 -2
- jarvis/jarvis_agent/stdio_redirect.py +295 -0
- jarvis/jarvis_agent/task_analyzer.py +31 -6
- jarvis/jarvis_agent/task_manager.py +11 -27
- jarvis/jarvis_agent/tool_executor.py +2 -3
- jarvis/jarvis_agent/tool_share_manager.py +12 -24
- jarvis/jarvis_agent/utils.py +5 -1
- jarvis/jarvis_agent/web_bridge.py +189 -0
- jarvis/jarvis_agent/web_output_sink.py +53 -0
- jarvis/jarvis_agent/web_server.py +786 -0
- jarvis/jarvis_c2rust/__init__.py +26 -0
- jarvis/jarvis_c2rust/cli.py +575 -0
- jarvis/jarvis_c2rust/collector.py +250 -0
- jarvis/jarvis_c2rust/constants.py +26 -0
- jarvis/jarvis_c2rust/library_replacer.py +1254 -0
- jarvis/jarvis_c2rust/llm_module_agent.py +1272 -0
- jarvis/jarvis_c2rust/loaders.py +207 -0
- jarvis/jarvis_c2rust/models.py +28 -0
- jarvis/jarvis_c2rust/optimizer.py +2157 -0
- jarvis/jarvis_c2rust/scanner.py +1681 -0
- jarvis/jarvis_c2rust/transpiler.py +2983 -0
- jarvis/jarvis_c2rust/utils.py +385 -0
- jarvis/jarvis_code_agent/build_validation_config.py +132 -0
- jarvis/jarvis_code_agent/code_agent.py +1371 -220
- jarvis/jarvis_code_agent/code_analyzer/__init__.py +65 -0
- jarvis/jarvis_code_agent/code_analyzer/base_language.py +74 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/__init__.py +44 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/base.py +106 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/cmake.py +74 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/detector.py +125 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/fallback.py +72 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/go.py +70 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/java_gradle.py +53 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/java_maven.py +47 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/makefile.py +61 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/nodejs.py +110 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/python.py +154 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/rust.py +110 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/validator.py +153 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator.py +43 -0
- jarvis/jarvis_code_agent/code_analyzer/context_manager.py +648 -0
- jarvis/jarvis_code_agent/code_analyzer/context_recommender.py +18 -0
- jarvis/jarvis_code_agent/code_analyzer/dependency_analyzer.py +132 -0
- jarvis/jarvis_code_agent/code_analyzer/file_ignore.py +330 -0
- jarvis/jarvis_code_agent/code_analyzer/impact_analyzer.py +781 -0
- jarvis/jarvis_code_agent/code_analyzer/language_registry.py +185 -0
- jarvis/jarvis_code_agent/code_analyzer/language_support.py +110 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/__init__.py +49 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/c_cpp_language.py +299 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/go_language.py +215 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/java_language.py +212 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/javascript_language.py +254 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/python_language.py +269 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/rust_language.py +281 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/typescript_language.py +280 -0
- jarvis/jarvis_code_agent/code_analyzer/llm_context_recommender.py +605 -0
- jarvis/jarvis_code_agent/code_analyzer/structured_code.py +556 -0
- jarvis/jarvis_code_agent/code_analyzer/symbol_extractor.py +252 -0
- jarvis/jarvis_code_agent/code_analyzer/tree_sitter_extractor.py +58 -0
- jarvis/jarvis_code_agent/lint.py +501 -8
- jarvis/jarvis_code_agent/utils.py +141 -0
- jarvis/jarvis_code_analysis/code_review.py +493 -584
- jarvis/jarvis_data/config_schema.json +128 -12
- jarvis/jarvis_git_squash/main.py +4 -5
- jarvis/jarvis_git_utils/git_commiter.py +82 -75
- jarvis/jarvis_mcp/sse_mcp_client.py +22 -29
- jarvis/jarvis_mcp/stdio_mcp_client.py +12 -13
- jarvis/jarvis_mcp/streamable_mcp_client.py +15 -14
- jarvis/jarvis_memory_organizer/memory_organizer.py +55 -74
- jarvis/jarvis_methodology/main.py +32 -48
- jarvis/jarvis_multi_agent/__init__.py +287 -55
- jarvis/jarvis_multi_agent/main.py +36 -4
- jarvis/jarvis_platform/base.py +524 -202
- jarvis/jarvis_platform/human.py +7 -8
- jarvis/jarvis_platform/kimi.py +30 -36
- jarvis/jarvis_platform/openai.py +88 -25
- jarvis/jarvis_platform/registry.py +26 -10
- jarvis/jarvis_platform/tongyi.py +24 -25
- jarvis/jarvis_platform/yuanbao.py +32 -43
- jarvis/jarvis_platform_manager/main.py +66 -77
- jarvis/jarvis_platform_manager/service.py +8 -13
- jarvis/jarvis_rag/cli.py +53 -55
- jarvis/jarvis_rag/embedding_manager.py +13 -18
- jarvis/jarvis_rag/llm_interface.py +8 -9
- jarvis/jarvis_rag/query_rewriter.py +10 -21
- jarvis/jarvis_rag/rag_pipeline.py +24 -27
- jarvis/jarvis_rag/reranker.py +4 -5
- jarvis/jarvis_rag/retriever.py +28 -30
- jarvis/jarvis_sec/__init__.py +305 -0
- jarvis/jarvis_sec/agents.py +143 -0
- jarvis/jarvis_sec/analysis.py +276 -0
- jarvis/jarvis_sec/checkers/__init__.py +32 -0
- jarvis/jarvis_sec/checkers/c_checker.py +2680 -0
- jarvis/jarvis_sec/checkers/rust_checker.py +1108 -0
- jarvis/jarvis_sec/cli.py +139 -0
- jarvis/jarvis_sec/clustering.py +1439 -0
- jarvis/jarvis_sec/file_manager.py +427 -0
- jarvis/jarvis_sec/parsers.py +73 -0
- jarvis/jarvis_sec/prompts.py +268 -0
- jarvis/jarvis_sec/report.py +336 -0
- jarvis/jarvis_sec/review.py +453 -0
- jarvis/jarvis_sec/status.py +264 -0
- jarvis/jarvis_sec/types.py +20 -0
- jarvis/jarvis_sec/utils.py +499 -0
- jarvis/jarvis_sec/verification.py +848 -0
- jarvis/jarvis_sec/workflow.py +226 -0
- jarvis/jarvis_smart_shell/main.py +38 -87
- jarvis/jarvis_stats/cli.py +2 -2
- jarvis/jarvis_stats/stats.py +8 -8
- jarvis/jarvis_stats/storage.py +15 -21
- jarvis/jarvis_stats/visualizer.py +1 -1
- jarvis/jarvis_tools/clear_memory.py +3 -20
- jarvis/jarvis_tools/cli/main.py +21 -23
- jarvis/jarvis_tools/edit_file.py +1019 -132
- jarvis/jarvis_tools/execute_script.py +83 -25
- jarvis/jarvis_tools/file_analyzer.py +6 -9
- jarvis/jarvis_tools/generate_new_tool.py +14 -21
- jarvis/jarvis_tools/lsp_client.py +1552 -0
- jarvis/jarvis_tools/methodology.py +2 -3
- jarvis/jarvis_tools/read_code.py +1736 -35
- jarvis/jarvis_tools/read_symbols.py +140 -0
- jarvis/jarvis_tools/read_webpage.py +12 -13
- jarvis/jarvis_tools/registry.py +427 -200
- jarvis/jarvis_tools/retrieve_memory.py +20 -19
- jarvis/jarvis_tools/rewrite_file.py +72 -158
- jarvis/jarvis_tools/save_memory.py +3 -15
- jarvis/jarvis_tools/search_web.py +18 -18
- jarvis/jarvis_tools/sub_agent.py +36 -43
- jarvis/jarvis_tools/sub_code_agent.py +25 -26
- jarvis/jarvis_tools/virtual_tty.py +55 -33
- jarvis/jarvis_utils/clipboard.py +7 -10
- jarvis/jarvis_utils/config.py +232 -45
- jarvis/jarvis_utils/embedding.py +8 -5
- jarvis/jarvis_utils/fzf.py +8 -8
- jarvis/jarvis_utils/git_utils.py +225 -36
- jarvis/jarvis_utils/globals.py +3 -3
- jarvis/jarvis_utils/http.py +1 -1
- jarvis/jarvis_utils/input.py +99 -48
- jarvis/jarvis_utils/jsonnet_compat.py +465 -0
- jarvis/jarvis_utils/methodology.py +52 -48
- jarvis/jarvis_utils/utils.py +819 -491
- jarvis_ai_assistant-0.7.6.dist-info/METADATA +600 -0
- jarvis_ai_assistant-0.7.6.dist-info/RECORD +218 -0
- {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/entry_points.txt +4 -0
- jarvis/jarvis_agent/config.py +0 -92
- jarvis/jarvis_agent/edit_file_handler.py +0 -296
- jarvis/jarvis_platform/ai8.py +0 -332
- jarvis/jarvis_tools/ask_user.py +0 -54
- jarvis_ai_assistant-0.3.30.dist-info/METADATA +0 -381
- jarvis_ai_assistant-0.3.30.dist-info/RECORD +0 -137
- {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.3.30.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,6 @@ from pathlib import Path
|
|
|
4
4
|
from typing import Any, Dict, List, Optional
|
|
5
5
|
|
|
6
6
|
from jarvis.jarvis_utils.config import get_data_dir
|
|
7
|
-
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
8
7
|
from jarvis.jarvis_utils.globals import (
|
|
9
8
|
clear_short_term_memories,
|
|
10
9
|
short_term_memories,
|
|
@@ -15,21 +14,7 @@ class ClearMemoryTool:
|
|
|
15
14
|
"""清除记忆工具,用于批量清除指定的记忆"""
|
|
16
15
|
|
|
17
16
|
name = "clear_memory"
|
|
18
|
-
description = ""
|
|
19
|
-
|
|
20
|
-
支持的清除方式:
|
|
21
|
-
1. 按记忆类型清除所有记忆
|
|
22
|
-
2. 按标签清除特定记忆
|
|
23
|
-
3. 按记忆ID清除单个记忆
|
|
24
|
-
|
|
25
|
-
支持的记忆类型:
|
|
26
|
-
- project_long_term: 项目长期记忆
|
|
27
|
-
- global_long_term: 全局长期记忆
|
|
28
|
-
- short_term: 短期记忆
|
|
29
|
-
- all: 所有类型的记忆
|
|
30
|
-
|
|
31
|
-
注意:清除操作不可恢复,请谨慎使用
|
|
32
|
-
"""
|
|
17
|
+
description = "批量清除指定的记忆。支持按类型、标签或ID清除。记忆类型:project_long_term/global_long_term/short_term/all。注意:清除操作不可恢复。"
|
|
33
18
|
|
|
34
19
|
parameters = {
|
|
35
20
|
"type": "object",
|
|
@@ -160,9 +145,7 @@ class ClearMemoryTool:
|
|
|
160
145
|
removed_count += 1
|
|
161
146
|
|
|
162
147
|
except Exception as e:
|
|
163
|
-
|
|
164
|
-
f"处理记忆文件 {memory_file} 时出错: {str(e)}", OutputType.WARNING
|
|
165
|
-
)
|
|
148
|
+
print(f"⚠️ 处理记忆文件 {memory_file} 时出错: {str(e)}")
|
|
166
149
|
|
|
167
150
|
# 如果目录为空,可以删除目录
|
|
168
151
|
if not any(memory_dir.iterdir()) and memory_dir != self.project_memory_dir:
|
|
@@ -235,5 +218,5 @@ class ClearMemoryTool:
|
|
|
235
218
|
|
|
236
219
|
except Exception as e:
|
|
237
220
|
error_msg = f"清除记忆失败: {str(e)}"
|
|
238
|
-
|
|
221
|
+
print(f"❌ {error_msg}")
|
|
239
222
|
return {"success": False, "stdout": "", "stderr": error_msg}
|
jarvis/jarvis_tools/cli/main.py
CHANGED
|
@@ -11,6 +11,7 @@ from jarvis.jarvis_utils.utils import init_env
|
|
|
11
11
|
app = typer.Typer(help="Jarvis 工具系统命令行界面")
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
|
|
14
15
|
@app.command("list")
|
|
15
16
|
def list_tools(
|
|
16
17
|
as_json: bool = typer.Option(False, "--json", help="以JSON格式输出"),
|
|
@@ -37,7 +38,7 @@ def list_tools(
|
|
|
37
38
|
lang="json",
|
|
38
39
|
)
|
|
39
40
|
else:
|
|
40
|
-
|
|
41
|
+
print("📋 可用工具列表")
|
|
41
42
|
# 为避免 PrettyOutput 对每行加框造成信息稀疏,先拼接字符串再统一打印
|
|
42
43
|
lines = []
|
|
43
44
|
import json as _json # local import to ensure available
|
|
@@ -53,7 +54,7 @@ def list_tools(
|
|
|
53
54
|
except Exception:
|
|
54
55
|
lines.append(str(tool.get("parameters")))
|
|
55
56
|
lines.append("```")
|
|
56
|
-
PrettyOutput.print("\n".join(lines), OutputType.
|
|
57
|
+
PrettyOutput.print("\n".join(lines), OutputType.CODE, lang="markdown")
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
@app.command("stat")
|
|
@@ -89,7 +90,7 @@ def stat_tools(
|
|
|
89
90
|
)
|
|
90
91
|
else:
|
|
91
92
|
time_desc = f"最近{last_days}天" if last_days else "所有历史"
|
|
92
|
-
|
|
93
|
+
print(f"📊 工具调用统计 ({time_desc})")
|
|
93
94
|
if table_data:
|
|
94
95
|
PrettyOutput.print(
|
|
95
96
|
tabulate(
|
|
@@ -98,15 +99,12 @@ def stat_tools(
|
|
|
98
99
|
OutputType.CODE,
|
|
99
100
|
lang="text",
|
|
100
101
|
)
|
|
101
|
-
|
|
102
|
-
f"\n总计: {len(table_data)} 个工具被使用,共 {sum(x[1] for x in table_data)} 次调用",
|
|
103
|
-
OutputType.INFO,
|
|
104
|
-
)
|
|
102
|
+
print(f"ℹ️ 总计: {len(table_data)} 个工具被使用,共 {sum(x[1] for x in table_data)} 次调用")
|
|
105
103
|
else:
|
|
106
|
-
|
|
104
|
+
print("ℹ️ 暂无工具调用记录")
|
|
107
105
|
else:
|
|
108
106
|
# 使用 stats 系统的高级功能
|
|
109
|
-
|
|
107
|
+
print("📊 工具组统计")
|
|
110
108
|
# 显示所有标记为 tool 组的指标
|
|
111
109
|
metrics = StatsManager.list_metrics()
|
|
112
110
|
tool_metrics = []
|
|
@@ -165,7 +163,7 @@ def stat_tools(
|
|
|
165
163
|
tags={"group": "tool"},
|
|
166
164
|
)
|
|
167
165
|
else:
|
|
168
|
-
|
|
166
|
+
print("ℹ️ 暂无工具调用记录")
|
|
169
167
|
|
|
170
168
|
|
|
171
169
|
@app.command("call")
|
|
@@ -181,24 +179,24 @@ def call_tool(
|
|
|
181
179
|
tool_obj = registry.get_tool(tool_name)
|
|
182
180
|
|
|
183
181
|
if not tool_obj:
|
|
184
|
-
|
|
182
|
+
print(f"❌ 错误: 工具 '{tool_name}' 不存在")
|
|
185
183
|
available_tools = ", ".join([t["name"] for t in registry.get_all_tools()])
|
|
186
|
-
|
|
184
|
+
print(f"ℹ️ 可用工具: {available_tools}")
|
|
187
185
|
raise typer.Exit(code=1)
|
|
188
186
|
|
|
189
187
|
tool_args = {}
|
|
190
188
|
if args:
|
|
191
189
|
try:
|
|
192
190
|
tool_args = json.loads(args)
|
|
193
|
-
except
|
|
194
|
-
|
|
191
|
+
except Exception:
|
|
192
|
+
print("❌ 错误: 参数必须是有效的JSON格式")
|
|
195
193
|
raise typer.Exit(code=1)
|
|
196
194
|
elif args_file:
|
|
197
195
|
try:
|
|
198
196
|
with open(args_file, "r", encoding="utf-8") as f:
|
|
199
197
|
tool_args = json.load(f)
|
|
200
|
-
except (
|
|
201
|
-
|
|
198
|
+
except (Exception, FileNotFoundError) as e:
|
|
199
|
+
print(f"❌ 错误: 无法从文件加载参数: {str(e)}")
|
|
202
200
|
raise typer.Exit(code=1)
|
|
203
201
|
|
|
204
202
|
required_params = tool_obj.parameters.get("required", [])
|
|
@@ -216,23 +214,23 @@ def call_tool(
|
|
|
216
214
|
param_info = params.get(param_name, {})
|
|
217
215
|
desc = param_info.get("description", "无描述")
|
|
218
216
|
lines.append(f" - {param_name}: {desc}")
|
|
219
|
-
|
|
217
|
+
print("❌ " + "\n❌ ".join(lines))
|
|
220
218
|
raise typer.Exit(code=1)
|
|
221
219
|
|
|
222
220
|
result = registry.execute_tool(tool_name, tool_args)
|
|
223
221
|
|
|
224
222
|
if result["success"]:
|
|
225
|
-
|
|
223
|
+
print(f"✅ 工具 {tool_name} 执行成功")
|
|
226
224
|
else:
|
|
227
|
-
|
|
225
|
+
print(f"❌ 工具 {tool_name} 执行失败")
|
|
228
226
|
|
|
229
227
|
if result.get("stdout"):
|
|
230
|
-
|
|
228
|
+
print("\n📤 输出:")
|
|
231
229
|
PrettyOutput.print(result["stdout"], OutputType.CODE, lang="text")
|
|
232
230
|
|
|
233
231
|
if result.get("stderr"):
|
|
234
|
-
|
|
235
|
-
PrettyOutput.print(result["stderr"], OutputType.
|
|
232
|
+
print("\n❌ 错误:")
|
|
233
|
+
PrettyOutput.print(result["stderr"], OutputType.CODE, lang="text")
|
|
236
234
|
|
|
237
235
|
if not result["success"]:
|
|
238
236
|
raise typer.Exit(code=1)
|
|
@@ -240,7 +238,7 @@ def call_tool(
|
|
|
240
238
|
|
|
241
239
|
def cli():
|
|
242
240
|
"""Typer application entry point"""
|
|
243
|
-
init_env(
|
|
241
|
+
init_env()
|
|
244
242
|
app()
|
|
245
243
|
|
|
246
244
|
|