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
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
进度状态管理模块
|
|
4
|
+
|
|
5
|
+
提供结构化的进度状态文件,准确反映当前所处的阶段和进度。
|
|
6
|
+
状态文件格式:JSON,包含当前阶段、进度百分比、已完成/总数等信息。
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Dict, Optional, Any
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class StatusManager:
|
|
16
|
+
"""进度状态管理器"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, entry_path: str):
|
|
19
|
+
"""
|
|
20
|
+
初始化状态管理器
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
entry_path: 待分析的根目录路径(可以是项目根目录或 .jarvis/sec 目录)
|
|
24
|
+
"""
|
|
25
|
+
self.entry_path = Path(entry_path)
|
|
26
|
+
# 检查 entry_path 是否已经是 .jarvis/sec 目录
|
|
27
|
+
if self.entry_path.name == "sec" and self.entry_path.parent.name == ".jarvis":
|
|
28
|
+
sec_dir = self.entry_path
|
|
29
|
+
else:
|
|
30
|
+
sec_dir = self.entry_path / ".jarvis" / "sec"
|
|
31
|
+
self.status_path = sec_dir / "status.json"
|
|
32
|
+
self._ensure_dir()
|
|
33
|
+
|
|
34
|
+
def _ensure_dir(self):
|
|
35
|
+
"""确保状态文件目录存在"""
|
|
36
|
+
self.status_path.parent.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
|
|
38
|
+
def _read_status(self) -> Dict[str, Any]:
|
|
39
|
+
"""读取当前状态"""
|
|
40
|
+
if not self.status_path.exists():
|
|
41
|
+
return {}
|
|
42
|
+
try:
|
|
43
|
+
with self.status_path.open("r", encoding="utf-8") as f:
|
|
44
|
+
return json.load(f)
|
|
45
|
+
except Exception:
|
|
46
|
+
return {}
|
|
47
|
+
|
|
48
|
+
def _write_status(self, status: Dict[str, Any]):
|
|
49
|
+
"""写入状态文件"""
|
|
50
|
+
try:
|
|
51
|
+
status["last_updated"] = datetime.utcnow().isoformat() + "Z"
|
|
52
|
+
with self.status_path.open("w", encoding="utf-8") as f:
|
|
53
|
+
json.dump(status, f, ensure_ascii=False, indent=2)
|
|
54
|
+
except Exception:
|
|
55
|
+
# 状态文件写入失败不影响主流程
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
def update_stage(
|
|
59
|
+
self,
|
|
60
|
+
stage: str,
|
|
61
|
+
progress: Optional[float] = None,
|
|
62
|
+
current: Optional[int] = None,
|
|
63
|
+
total: Optional[int] = None,
|
|
64
|
+
message: Optional[str] = None,
|
|
65
|
+
details: Optional[Dict[str, Any]] = None,
|
|
66
|
+
):
|
|
67
|
+
"""
|
|
68
|
+
更新当前阶段和进度
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
stage: 阶段名称(pre_scan, clustering, verification, completed, error)
|
|
72
|
+
progress: 进度百分比(0-100),如果为None则根据current/total计算
|
|
73
|
+
current: 当前已完成数量
|
|
74
|
+
total: 总数量
|
|
75
|
+
message: 状态消息
|
|
76
|
+
details: 额外的详细信息
|
|
77
|
+
"""
|
|
78
|
+
status = self._read_status()
|
|
79
|
+
|
|
80
|
+
# 计算进度百分比
|
|
81
|
+
if progress is None and current is not None and total is not None and total > 0:
|
|
82
|
+
progress = (current / total) * 100
|
|
83
|
+
|
|
84
|
+
# 更新状态
|
|
85
|
+
status["stage"] = stage
|
|
86
|
+
if progress is not None:
|
|
87
|
+
status["progress"] = round(progress, 2)
|
|
88
|
+
if current is not None:
|
|
89
|
+
status["current"] = current
|
|
90
|
+
if total is not None:
|
|
91
|
+
status["total"] = total
|
|
92
|
+
if message:
|
|
93
|
+
status["message"] = message
|
|
94
|
+
if details:
|
|
95
|
+
status["details"] = details
|
|
96
|
+
|
|
97
|
+
# 设置阶段开始时间(如果是新阶段)
|
|
98
|
+
if "stage_history" not in status:
|
|
99
|
+
status["stage_history"] = []
|
|
100
|
+
|
|
101
|
+
# 检查是否是阶段切换
|
|
102
|
+
last_stage = status.get("stage")
|
|
103
|
+
if last_stage != stage:
|
|
104
|
+
status["stage_history"].append({
|
|
105
|
+
"stage": stage,
|
|
106
|
+
"started_at": datetime.utcnow().isoformat() + "Z"
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
self._write_status(status)
|
|
110
|
+
|
|
111
|
+
def update_pre_scan(
|
|
112
|
+
self,
|
|
113
|
+
current_files: Optional[int] = None,
|
|
114
|
+
total_files: Optional[int] = None,
|
|
115
|
+
issues_found: Optional[int] = None,
|
|
116
|
+
message: Optional[str] = None,
|
|
117
|
+
):
|
|
118
|
+
"""更新启发式扫描阶段状态"""
|
|
119
|
+
details = {}
|
|
120
|
+
if issues_found is not None:
|
|
121
|
+
details["issues_found"] = issues_found
|
|
122
|
+
|
|
123
|
+
progress = None
|
|
124
|
+
if current_files is not None and total_files is not None and total_files > 0:
|
|
125
|
+
progress = (current_files / total_files) * 100
|
|
126
|
+
|
|
127
|
+
self.update_stage(
|
|
128
|
+
stage="pre_scan",
|
|
129
|
+
progress=progress,
|
|
130
|
+
current=current_files,
|
|
131
|
+
total=total_files,
|
|
132
|
+
message=message or "正在进行启发式扫描...",
|
|
133
|
+
details=details,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def update_clustering(
|
|
137
|
+
self,
|
|
138
|
+
current_file: Optional[int] = None,
|
|
139
|
+
total_files: Optional[int] = None,
|
|
140
|
+
current_batch: Optional[int] = None,
|
|
141
|
+
total_batches: Optional[int] = None,
|
|
142
|
+
file_name: Optional[str] = None,
|
|
143
|
+
message: Optional[str] = None,
|
|
144
|
+
):
|
|
145
|
+
"""更新聚类阶段状态"""
|
|
146
|
+
details = {}
|
|
147
|
+
if file_name:
|
|
148
|
+
details["current_file"] = file_name
|
|
149
|
+
if current_batch is not None:
|
|
150
|
+
details["current_batch"] = current_batch
|
|
151
|
+
if total_batches is not None:
|
|
152
|
+
details["total_batches"] = total_batches
|
|
153
|
+
|
|
154
|
+
# 计算总体进度(文件级别)
|
|
155
|
+
progress = None
|
|
156
|
+
if current_file is not None and total_files is not None and total_files > 0:
|
|
157
|
+
progress = (current_file / total_files) * 100
|
|
158
|
+
|
|
159
|
+
self.update_stage(
|
|
160
|
+
stage="clustering",
|
|
161
|
+
progress=progress,
|
|
162
|
+
current=current_file,
|
|
163
|
+
total=total_files,
|
|
164
|
+
message=message or "正在进行聚类分析...",
|
|
165
|
+
details=details,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
def update_review(
|
|
169
|
+
self,
|
|
170
|
+
current_review: Optional[int] = None,
|
|
171
|
+
total_reviews: Optional[int] = None,
|
|
172
|
+
message: Optional[str] = None,
|
|
173
|
+
):
|
|
174
|
+
"""更新复核阶段状态"""
|
|
175
|
+
details = {}
|
|
176
|
+
|
|
177
|
+
# 计算总体进度
|
|
178
|
+
progress = None
|
|
179
|
+
if current_review is not None and total_reviews is not None and total_reviews > 0:
|
|
180
|
+
progress = (current_review / total_reviews) * 100
|
|
181
|
+
|
|
182
|
+
self.update_stage(
|
|
183
|
+
stage="review",
|
|
184
|
+
progress=progress,
|
|
185
|
+
current=current_review,
|
|
186
|
+
total=total_reviews,
|
|
187
|
+
message=message or "正在进行无效聚类复核...",
|
|
188
|
+
details=details,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
def update_verification(
|
|
192
|
+
self,
|
|
193
|
+
current_batch: Optional[int] = None,
|
|
194
|
+
total_batches: Optional[int] = None,
|
|
195
|
+
current_task: Optional[int] = None,
|
|
196
|
+
total_tasks: Optional[int] = None,
|
|
197
|
+
batch_id: Optional[str] = None,
|
|
198
|
+
file_name: Optional[str] = None,
|
|
199
|
+
issues_found: Optional[int] = None,
|
|
200
|
+
message: Optional[str] = None,
|
|
201
|
+
):
|
|
202
|
+
"""更新验证阶段状态"""
|
|
203
|
+
details = {}
|
|
204
|
+
if batch_id:
|
|
205
|
+
details["batch_id"] = batch_id
|
|
206
|
+
if file_name:
|
|
207
|
+
details["file"] = file_name
|
|
208
|
+
if issues_found is not None:
|
|
209
|
+
details["issues_found"] = issues_found
|
|
210
|
+
|
|
211
|
+
# 计算总体进度(批次级别)
|
|
212
|
+
progress = None
|
|
213
|
+
if current_batch is not None and total_batches is not None and total_batches > 0:
|
|
214
|
+
progress = (current_batch / total_batches) * 100
|
|
215
|
+
|
|
216
|
+
self.update_stage(
|
|
217
|
+
stage="verification",
|
|
218
|
+
progress=progress,
|
|
219
|
+
current=current_batch,
|
|
220
|
+
total=total_batches,
|
|
221
|
+
message=message or "正在进行安全验证...",
|
|
222
|
+
details=details,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
def mark_completed(
|
|
226
|
+
self,
|
|
227
|
+
total_issues: Optional[int] = None,
|
|
228
|
+
message: Optional[str] = None,
|
|
229
|
+
):
|
|
230
|
+
"""标记分析完成"""
|
|
231
|
+
details = {}
|
|
232
|
+
if total_issues is not None:
|
|
233
|
+
details["total_issues"] = total_issues
|
|
234
|
+
|
|
235
|
+
self.update_stage(
|
|
236
|
+
stage="completed",
|
|
237
|
+
progress=100.0,
|
|
238
|
+
message=message or "安全分析已完成",
|
|
239
|
+
details=details,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
def mark_error(
|
|
243
|
+
self,
|
|
244
|
+
error_message: str,
|
|
245
|
+
error_type: Optional[str] = None,
|
|
246
|
+
):
|
|
247
|
+
"""标记错误状态"""
|
|
248
|
+
details = {"error_message": error_message}
|
|
249
|
+
if error_type:
|
|
250
|
+
details["error_type"] = error_type
|
|
251
|
+
|
|
252
|
+
self.update_stage(
|
|
253
|
+
stage="error",
|
|
254
|
+
message=f"发生错误: {error_message}",
|
|
255
|
+
details=details,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
def get_status(self) -> Dict[str, Any]:
|
|
259
|
+
"""获取当前状态"""
|
|
260
|
+
return self._read_status()
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
__all__ = ["StatusManager"]
|
|
264
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Shared types for jarvis.jarvis_sec to avoid circular imports.
|
|
4
|
+
"""
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class Issue:
|
|
9
|
+
language: str
|
|
10
|
+
category: str
|
|
11
|
+
pattern: str
|
|
12
|
+
file: str
|
|
13
|
+
line: int
|
|
14
|
+
evidence: str
|
|
15
|
+
description: str
|
|
16
|
+
suggestion: str
|
|
17
|
+
confidence: float
|
|
18
|
+
severity: str = "medium"
|
|
19
|
+
|
|
20
|
+
__all__ = ["Issue"]
|