bugx-cli 0.1.1 → 0.1.3
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.
- package/README.md +36 -35
- package/core/README.md +1 -1
- package/core/agent/agent_orchestrator.py +3 -0
- package/core/agent/agent_workspace.py +14 -2
- package/core/assets/README.md +3 -2
- package/core/assets/bugx-social-preview.svg +71 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/assets/twitter_promo_art.jpg +0 -0
- package/core/assets/twitter_promo_card.svg +166 -0
- package/core/assets/twitter_promo_clean.jpg +0 -0
- package/core/assets/twitter_terminal_real.png +0 -0
- package/core/audit_packs/README.md +2 -0
- package/core/audit_packs/pitfalls/auth_crypto.json +64 -0
- package/core/audit_packs/pitfalls/file_ssrf_cmd.json +64 -0
- package/core/audit_packs/pitfalls/go_backend.json +66 -0
- package/core/audit_packs/pitfalls/java_spring.json +64 -0
- package/core/audit_packs/pitfalls/js_ts_web.json +67 -0
- package/core/audit_packs/pitfalls/python_web.json +82 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +2 -2
- package/core/cli-help.txt +1 -1
- package/core/cloud_sync/cloud_client.py +56 -5
- package/core/cloud_sync/consent.py +33 -3
- package/core/cloud_sync/flywheel_client.py +186 -24
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-opencode.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/engine-integrity.json +191 -95
- package/core/host_acp/kimi.py +175 -0
- package/core/host_acp/minimax.py +28 -0
- package/core/host_runtime/host_registry.py +23 -3
- package/core/hosts/dsh.py +1 -1
- package/core/hosts/kimi.py +293 -0
- package/core/hosts/minimax.py +248 -0
- package/core/hosts/zcode.py +5 -0
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +30 -5
- package/core/launch_phases/README.md +6 -3
- package/core/launch_phases/finding_confirm_phase.py +168 -7
- package/core/launch_phases/post_phase.py +5 -5
- package/core/launch_phases/pre_recon_scout.py +13 -0
- package/core/launch_phases/report_sharing.py +3 -7
- package/core/launch_phases/round_orchestrator.py +114 -26
- package/core/launch_phases/semantic_recon.py +545 -0
- package/core/launch_phases/startup_version_gate.py +6 -2
- package/core/launch_phases/supervisor_bridge.py +14 -23
- package/core/launch_phases/verify_loop.py +767 -0
- package/core/launch_phases/worker_prior.py +115 -0
- package/core/ledger/README.md +2 -1
- package/core/ledger/finding_verification.py +511 -2
- package/core/ledger/fp_ledger.py +255 -0
- package/core/metadata.txt +2 -2
- package/core/planning/README.md +2 -1
- package/core/planning/prompt_harness.py +50 -10
- package/core/planning/prompt_policy_engine.py +386 -0
- package/core/prompts/README.md +4 -2
- package/core/prompts/policies/prompt_policies.json +101 -0
- package/core/prompts/stages/stage_verify.defensive.md +42 -0
- package/core/prompts/stages/stage_verify.md +44 -0
- package/core/report_engine/report_share.py +0 -8
- package/core/retrieval/README.md +2 -1
- package/core/retrieval/pitfall_packs.py +277 -0
- package/core/runtime/README.md +1 -1
- package/core/runtime/global_telemetry.py +20 -0
- package/core/runtime/scenario_eval.py +1 -1
- package/core/runtime/setup_ui_env.py +4 -7
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/cli.py +2 -2
- package/core/webui/mcp_inspector.py +6 -0
- package/core/webui/static/index.html +51 -3
- package/core/webui/static/manifest.webmanifest +1 -1
- package/core/webui/static/project-settings.js +18 -3
- package/core/webui/static/robots.txt +36 -0
- package/core/webui/static/sitemap.xml +15 -0
- package/docs/07_distribution/01_README_NPM.md +36 -35
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/agents/bugx.md +1 -1
- package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +1 -1
- package/ecosystem/plugins/bugx/agents/bugx.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +3 -3
- package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
- package/interfaces/bin/bugx.js +9 -7
- package/interfaces/cli/bugx_cli/__init__.py +2 -2
- package/interfaces/cli/bugx_cli/cli.py +178 -67
- package/interfaces/cli/bugx_cli/commands/agent.py +313 -127
- package/interfaces/cli/bugx_cli/commands/audit.py +8 -7
- package/interfaces/cli/bugx_cli/commands/cloud.py +27 -19
- package/interfaces/cli/bugx_cli/commands/doctor.py +18 -0
- package/interfaces/cli/bugx_cli/commands/knowledge.py +3 -4
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +54 -47
- package/interfaces/cli/bugx_cli/commands/plugin.py +9 -9
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +348 -0
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +322 -0
- package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
- package/interfaces/cli/bugx_cli/commands/project.py +6 -13
- package/interfaces/cli/bugx_cli/commands/system.py +577 -162
- package/interfaces/cli/bugx_cli/common.py +102 -15
- package/interfaces/cli/bugx_cli/host_adapters.py +150 -4
- package/interfaces/cli/bugx_cli/hosts/registry.py +4 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +10 -9
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +21 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +2 -2
- package/package.json +54 -16
- package/pyproject.toml +64 -1
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +25 -0
- package/skills/platform/bugx-user/SKILL.md +92 -0
- package/core/assets/bugx-hero-cn.png +0 -0
- package/core/assets/bugx-hero-en.png +0 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""core/hosts/minimax.py - MiniMax Code desktop Plugin V1 host.
|
|
3
|
+
|
|
4
|
+
Facts captured from the installed MiniMax Code 3.1.0 package on Windows and its
|
|
5
|
+
embedded local-plugin-v1 contract:
|
|
6
|
+
|
|
7
|
+
* user plugins are discovered below ~/.minimax/plugins/<plugin>/;
|
|
8
|
+
* the package manifest is .minimax-plugin/plugin.json;
|
|
9
|
+
* MCP servers are declared in servers.mcp.json;
|
|
10
|
+
* plugin Agents are Markdown files under agents/ and Skills under skills/.
|
|
11
|
+
|
|
12
|
+
The desktop package exposes the PluginSystem/MCP/Agent surface, but this
|
|
13
|
+
repository has not verified a MiniMax Code headless or standard ACP entry point.
|
|
14
|
+
Those channels therefore fail closed instead of borrowing Kimi or another host's
|
|
15
|
+
flags.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import os
|
|
21
|
+
import platform
|
|
22
|
+
import shutil
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
from .base import (
|
|
26
|
+
AcpFacet,
|
|
27
|
+
EngineRunFacet,
|
|
28
|
+
HostPlugin,
|
|
29
|
+
HostPluginError,
|
|
30
|
+
IdentityFacet,
|
|
31
|
+
InstallFacet,
|
|
32
|
+
McpWriteFacet,
|
|
33
|
+
RunContext,
|
|
34
|
+
STATUS_READY,
|
|
35
|
+
WorkerRuntimeFacet,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
__all__ = ["PLUGIN", "is_available", "run_static_degraded"]
|
|
39
|
+
|
|
40
|
+
_NAME = "minimax"
|
|
41
|
+
_DATA_ENV = "MINIMAX_DATA_DIR"
|
|
42
|
+
_DEFAULT_DATA_DIR_NAME = ".minimax"
|
|
43
|
+
_PLUGIN_RELATIVE_ROOT = ("plugins", "bugx")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _minimax_data_dir() -> Path:
|
|
47
|
+
configured = os.environ.get(_DATA_ENV)
|
|
48
|
+
if configured is not None:
|
|
49
|
+
if not configured.strip():
|
|
50
|
+
raise HostPluginError(f"{_DATA_ENV} 不能为空")
|
|
51
|
+
return Path(configured).expanduser()
|
|
52
|
+
return Path.home() / _DEFAULT_DATA_DIR_NAME
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _minimax_plugin_root() -> Path:
|
|
56
|
+
return _minimax_data_dir().joinpath(*_PLUGIN_RELATIVE_ROOT)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _windows_drive_roots() -> tuple[Path, ...]:
|
|
60
|
+
if platform.system() != "Windows":
|
|
61
|
+
return ()
|
|
62
|
+
try:
|
|
63
|
+
import ctypes
|
|
64
|
+
|
|
65
|
+
mask = int(ctypes.windll.kernel32.GetLogicalDrives())
|
|
66
|
+
except (AttributeError, OSError, TypeError, ValueError):
|
|
67
|
+
return ()
|
|
68
|
+
return tuple(
|
|
69
|
+
Path(f"{chr(ord('A') + index)}:/")
|
|
70
|
+
for index in range(26)
|
|
71
|
+
if mask & (1 << index)
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _minimax_app_markers() -> tuple[Path, ...]:
|
|
76
|
+
"""Return bounded MiniMax Code installation candidates; never scan a drive."""
|
|
77
|
+
home = Path.home()
|
|
78
|
+
markers: list[Path] = []
|
|
79
|
+
if platform.system() == "Darwin":
|
|
80
|
+
markers.extend((
|
|
81
|
+
Path("/Applications/MiniMax Code.app"),
|
|
82
|
+
home / "Applications" / "MiniMax Code.app",
|
|
83
|
+
))
|
|
84
|
+
elif os.name != "nt":
|
|
85
|
+
markers.extend((
|
|
86
|
+
home / ".local" / "share" / "applications" / "minimax-code.desktop",
|
|
87
|
+
Path("/opt/minimax/MiniMax Code/MiniMax Code"),
|
|
88
|
+
))
|
|
89
|
+
|
|
90
|
+
bases: list[Path] = []
|
|
91
|
+
for variable in (
|
|
92
|
+
"LOCALAPPDATA", "APPDATA", "PROGRAMFILES", "PROGRAMFILES(X86)",
|
|
93
|
+
):
|
|
94
|
+
value = os.environ.get(variable)
|
|
95
|
+
if value:
|
|
96
|
+
bases.append(Path(value))
|
|
97
|
+
bases.extend(_windows_drive_roots())
|
|
98
|
+
|
|
99
|
+
for base in bases:
|
|
100
|
+
markers.extend((
|
|
101
|
+
base / "minimax" / "MiniMax Code" / "MiniMax Code.exe",
|
|
102
|
+
base / "MiniMax" / "MiniMax Code" / "MiniMax Code.exe",
|
|
103
|
+
base / "Programs" / "minimax" / "MiniMax Code" / "MiniMax Code.exe",
|
|
104
|
+
base / "Programs" / "MiniMax" / "MiniMax Code" / "MiniMax Code.exe",
|
|
105
|
+
base / "Program Files" / "minimax" / "MiniMax Code" / "MiniMax Code.exe",
|
|
106
|
+
base / "Program Files (x86)" / "minimax" / "MiniMax Code" / "MiniMax Code.exe",
|
|
107
|
+
))
|
|
108
|
+
return tuple(dict.fromkeys(markers))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _unsupported_headless(_ctx: RunContext) -> list[str]:
|
|
112
|
+
raise HostPluginError(
|
|
113
|
+
"MiniMax Code 当前仅完成桌面 Plugin V1 适配;headless CLI 入口和 flag 尚未取证,拒绝伪造启动参数"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _unsupported_autonomous(_ctx: RunContext) -> list[str]:
|
|
118
|
+
raise HostPluginError(
|
|
119
|
+
"MiniMax Code 当前仅完成桌面 Agent/MCP 插件适配;自治 CLI 入口尚未取证,拒绝伪造启动参数"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _mcp_config_paths(_root: Path) -> tuple[Path, ...]:
|
|
124
|
+
return (_minimax_plugin_root() / "servers.mcp.json",)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _agent_config_path(_root: Path) -> Path:
|
|
128
|
+
return _minimax_plugin_root() / ".minimax-plugin" / "plugin.json"
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _resolve_minimax_cli() -> str | None:
|
|
132
|
+
"""Only report a PATH-resolved CLI; do not infer its command-line contract."""
|
|
133
|
+
return shutil.which("mcode")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
PLUGIN = HostPlugin(
|
|
137
|
+
identity=IdentityFacet(
|
|
138
|
+
name=_NAME,
|
|
139
|
+
label="MiniMax Code",
|
|
140
|
+
order=16,
|
|
141
|
+
executable="mcode",
|
|
142
|
+
markers=(".minimax/plugins/bugx/.minimax-plugin/plugin.json", ".minimax"),
|
|
143
|
+
aliases=("minimax-code", "minimaxcode", "mcode"),
|
|
144
|
+
app_markers=_minimax_app_markers,
|
|
145
|
+
native_question=False,
|
|
146
|
+
),
|
|
147
|
+
status=STATUS_READY,
|
|
148
|
+
install=InstallFacet(
|
|
149
|
+
kind="plugin",
|
|
150
|
+
path=".minimax/plugins/bugx",
|
|
151
|
+
entry_mode="user-registration",
|
|
152
|
+
marker=".minimax",
|
|
153
|
+
required_paths=(),
|
|
154
|
+
capabilities=frozenset({
|
|
155
|
+
"user-agent-registration",
|
|
156
|
+
"user-level-plugin",
|
|
157
|
+
}),
|
|
158
|
+
interaction={
|
|
159
|
+
"tool": "MiniMax Code Agent UI",
|
|
160
|
+
"single_select": "host-native",
|
|
161
|
+
"multi_select": "host-native",
|
|
162
|
+
},
|
|
163
|
+
tools_line="read, write, edit, bash, grep, glob, web_fetch",
|
|
164
|
+
mcp_relpaths=(),
|
|
165
|
+
worker_subagent=True,
|
|
166
|
+
worker_entry_path=".minimax/plugins/bugx/agents/bugx-worker.md",
|
|
167
|
+
generated_dirs=(),
|
|
168
|
+
sweepable=False,
|
|
169
|
+
),
|
|
170
|
+
engine_run=EngineRunFacet(
|
|
171
|
+
supports_headless=False,
|
|
172
|
+
headless_argv=_unsupported_headless,
|
|
173
|
+
autonomous_argv=_unsupported_autonomous,
|
|
174
|
+
mcp_config_paths=_mcp_config_paths,
|
|
175
|
+
agent_config_path=_agent_config_path,
|
|
176
|
+
mcp_health=None,
|
|
177
|
+
host_surface="desktop",
|
|
178
|
+
native_task=False,
|
|
179
|
+
),
|
|
180
|
+
worker_runtime=WorkerRuntimeFacet(
|
|
181
|
+
mode="serial",
|
|
182
|
+
max_concurrency=1,
|
|
183
|
+
requires_process_mode=False,
|
|
184
|
+
sandbox_sync=(),
|
|
185
|
+
provider_key=_NAME,
|
|
186
|
+
autonomous_cli=False,
|
|
187
|
+
),
|
|
188
|
+
mcp_write=McpWriteFacet(
|
|
189
|
+
container_key="mcpServers",
|
|
190
|
+
writer_key=_NAME,
|
|
191
|
+
project_relpath=None,
|
|
192
|
+
global_scope="~/.minimax/plugins/bugx/servers.mcp.json",
|
|
193
|
+
mirror_relpaths=(),
|
|
194
|
+
requires_absolutize=False,
|
|
195
|
+
entry_extra={},
|
|
196
|
+
custom_writer=True,
|
|
197
|
+
),
|
|
198
|
+
acp=AcpFacet(plugin=_NAME),
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def is_available() -> tuple[bool, str]:
|
|
203
|
+
"""Report the local CLI without claiming its unverified flags are supported."""
|
|
204
|
+
path = _resolve_minimax_cli()
|
|
205
|
+
if path:
|
|
206
|
+
return True, path
|
|
207
|
+
app_path = next((path for path in _minimax_app_markers() if path.is_file()), None)
|
|
208
|
+
if app_path:
|
|
209
|
+
return True, str(app_path)
|
|
210
|
+
return False, "MiniMax Code desktop/CLI 未在已知位置找到"
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def run_static_degraded(root: Path | None = None) -> dict:
|
|
214
|
+
"""Return static plugin facts; never report a live desktop session as healthy."""
|
|
215
|
+
available, availability_detail = is_available()
|
|
216
|
+
plugin_root = _minimax_plugin_root()
|
|
217
|
+
manifest = plugin_root / ".minimax-plugin" / "plugin.json"
|
|
218
|
+
return {
|
|
219
|
+
"plugin": _NAME,
|
|
220
|
+
"schema_version": 1,
|
|
221
|
+
"success": available,
|
|
222
|
+
"status": "degraded",
|
|
223
|
+
"degraded": True,
|
|
224
|
+
"degraded_reason": "static_facts_only" if available else "minimax_host_not_found",
|
|
225
|
+
"probe_mode": "static_degraded",
|
|
226
|
+
"headless_available": False,
|
|
227
|
+
"native_task_available": False,
|
|
228
|
+
"identity": {
|
|
229
|
+
"executable": PLUGIN.identity.executable,
|
|
230
|
+
"aliases": list(PLUGIN.identity.aliases),
|
|
231
|
+
"markers": list(PLUGIN.identity.markers),
|
|
232
|
+
},
|
|
233
|
+
"agent_entry": str(plugin_root / "agents" / "bugx.md"),
|
|
234
|
+
"worker_entry": str(plugin_root / "agents" / "bugx-worker.md"),
|
|
235
|
+
"plugin_manifest": str(manifest),
|
|
236
|
+
"mcp_config": str(plugin_root / "servers.mcp.json"),
|
|
237
|
+
"findings": [],
|
|
238
|
+
"evidence": {
|
|
239
|
+
"availability_detail": availability_detail,
|
|
240
|
+
"project_root": str(root) if root else None,
|
|
241
|
+
"plugin_installed": manifest.is_file(),
|
|
242
|
+
},
|
|
243
|
+
"metadata": {
|
|
244
|
+
"degraded_mode": "static_plugin_facts_only",
|
|
245
|
+
"acp": "unavailable(尚未取证到 MiniMax Code 标准 ACP 入口)",
|
|
246
|
+
"fallback": "MiniMax Code 以桌面 Plugin V1 运行;BugX 不代装宿主、不伪造 headless/ACP",
|
|
247
|
+
},
|
|
248
|
+
}
|
package/core/hosts/zcode.py
CHANGED
|
@@ -106,6 +106,11 @@ def _zcode_app_markers() -> tuple[Path, ...]:
|
|
|
106
106
|
base / "Z.ai" / "ZCode" / "ZCode.exe",
|
|
107
107
|
base / "Programs" / "ZCode" / "ZCode.exe",
|
|
108
108
|
base / "Programs" / "Z.ai" / "ZCode.exe",
|
|
109
|
+
base / "Programs" / "Z.ai" / "ZCode" / "ZCode.exe",
|
|
110
|
+
base / "Program Files" / "ZCode" / "ZCode.exe",
|
|
111
|
+
base / "Program Files (x86)" / "ZCode" / "ZCode.exe",
|
|
112
|
+
base / "Program Files" / "Z.ai" / "ZCode" / "ZCode.exe",
|
|
113
|
+
base / "Program Files (x86)" / "Z.ai" / "ZCode" / "ZCode.exe",
|
|
109
114
|
))
|
|
110
115
|
return tuple(markers)
|
|
111
116
|
|
package/core/infra/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Core Infrastructure & Primitives (核心基础设施与底层操作系统原语子系统)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.2` | **所属分层**: `Layer 0: 基础设施与操作系统抽象`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md) 与 [`docs/02_architecture/06_MODULE_GOVERNANCE_SPEC.md`](../../docs/02_architecture/06_MODULE_GOVERNANCE_SPEC.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
package/core/infra/build_info.py
CHANGED
|
@@ -12,8 +12,8 @@ import re
|
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
|
|
14
14
|
VERSION_ENV = "BUGX_VERSION"
|
|
15
|
-
VERSION_TOKEN = "0.1.
|
|
16
|
-
_DEFAULT_VERSION = "0.1.
|
|
15
|
+
VERSION_TOKEN = "0.1.3"
|
|
16
|
+
_DEFAULT_VERSION = "0.1.3"
|
|
17
17
|
_VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$")
|
|
18
18
|
|
|
19
19
|
|
|
@@ -88,10 +88,34 @@ def bump_build_id(root: Path | None = None) -> int:
|
|
|
88
88
|
return next_id
|
|
89
89
|
|
|
90
90
|
|
|
91
|
+
def is_dev_mode(root: Path | None = None) -> bool:
|
|
92
|
+
"""是否处于 dev / alpha 开发模式。正式版返回 False。"""
|
|
93
|
+
if os.environ.get("BUGX_DEV") in ("1", "true", "yes", "on"):
|
|
94
|
+
return True
|
|
95
|
+
env = os.environ.get("BUGX_ENV", "").strip().lower()
|
|
96
|
+
if env in ("dev", "development", "local", "test"):
|
|
97
|
+
return True
|
|
98
|
+
meta_path = _resolve_metadata_path(root)
|
|
99
|
+
if meta_path.is_file():
|
|
100
|
+
try:
|
|
101
|
+
content = meta_path.read_text(encoding="utf-8")
|
|
102
|
+
m_chan = re.search(r"^bugx_channel:\s*[\"']?([A-Za-z0-9_-]+)", content, re.M)
|
|
103
|
+
m_mark = re.search(r"^bugx_marker:\s*[\"']?([A-Za-z0-9_-]+)", content, re.M)
|
|
104
|
+
channel = m_chan.group(1).lower() if m_chan else "stable"
|
|
105
|
+
marker = m_mark.group(1).lower() if m_mark else "stable"
|
|
106
|
+
if channel != "stable" or marker in ("dev", "alpha"):
|
|
107
|
+
return True
|
|
108
|
+
except OSError:
|
|
109
|
+
pass
|
|
110
|
+
return False
|
|
111
|
+
|
|
112
|
+
|
|
91
113
|
def get_full_version_string(root: Path | None = None) -> str:
|
|
92
|
-
"""
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
"""返回标准版本展示字符串。正式版(Stable)不带 build ID;仅 dev 模式携带。"""
|
|
115
|
+
if is_dev_mode(root):
|
|
116
|
+
bid = get_build_id(root)
|
|
117
|
+
return f"{BASE_VERSION}+build.{bid}"
|
|
118
|
+
return BASE_VERSION
|
|
95
119
|
|
|
96
120
|
|
|
97
121
|
__all__ = [
|
|
@@ -101,5 +125,6 @@ __all__ = [
|
|
|
101
125
|
"bump_build_id",
|
|
102
126
|
"get_build_id",
|
|
103
127
|
"get_full_version_string",
|
|
128
|
+
"is_dev_mode",
|
|
104
129
|
"resolve_base_version",
|
|
105
130
|
]
|
|
@@ -26,7 +26,8 @@ flowchart TD
|
|
|
26
26
|
subgraph Phase3["3. Adjudication & Settlement (裁决结算与确认)"]
|
|
27
27
|
C1["judge_phase.py<br/>Judge 智能体证据审查"] --> C2["findings_adjudication.py<br/>反事实验证与漏洞仲裁"]
|
|
28
28
|
C2 --> C3["candidate_revalidation.py<br/>候选补丁复验与消歧"]
|
|
29
|
-
C3 -->
|
|
29
|
+
C3 --> C3V["verify_loop.py<br/>独立验证员盲审与报错自纠错闭环"]
|
|
30
|
+
C3V --> C4["finding_confirm_phase.py<br/>人机或自治确认闭环"]
|
|
30
31
|
C4 --> C5["finding_settlement.py<br/>Finding 最终落盘与账本结算"]
|
|
31
32
|
C5 --> C6["findings_snapshot.py<br/>Finding 阶段性快照保存"]
|
|
32
33
|
end
|
|
@@ -84,11 +85,13 @@ flowchart TD
|
|
|
84
85
|
| `pre_state_builder.py` | 前置会话状态构建器,初始化 `.bugx` 会话目录与配置注入 | `build_initial_session_state` |
|
|
85
86
|
| `report_sharing.py` | 审计与攻防报告外发分发器(Webhook、钉钉/企微、文件导出) | `dispatch_report_share` |
|
|
86
87
|
| `round_orchestrator.py` | 轮次迭代编排器,驱动多轮 Worker -> Judge -> Settle 循环推进 | `orchestrate_rounds` |
|
|
88
|
+
| `semantic_recon.py` | Recon 阶段轻量语义侦察叠加层(隐式路由 / 自定义鉴权边界 / 业务不变量),含物理锚点核验与反注入净化 (P2) | `run_semantic_recon_overlay`, `load_semantic_overlay` |
|
|
87
89
|
| `session_runtime.py` | 会话级运行态上下文管理器,守卫会话持久化与单例实例 | `SessionRuntimeContext` |
|
|
88
90
|
| `SPEC.md` | 生命周期规范设计与状态迁移状态机真理文档 | 阶段规范与失败处理契约 |
|
|
89
91
|
| `startup_gates.py` | 启动前置安全门禁(文件树白名单、脏工作区检查、权限拦截) | `verify_startup_gates` |
|
|
90
92
|
| `startup_interaction.py` | 交互式问答决策引擎,根据终端能力与配置解析交互模式 | `resolve_startup_interaction` |
|
|
91
|
-
| `
|
|
93
|
+
| `verify_loop.py` | 独立验证员盲审输入包构造、Anti-Gaming 校验与报错驱动 PoC 自纠错闭环 | `build_verify_bundle`, `execute_verify_attempt`, `run_verification_loop` |
|
|
94
|
+
| `startup_version_gate.py` | 版本硬门禁校验器,确保运行时版本严格等于 `0.1.2` 绝不漂移 | `assert_version_integrity` |
|
|
92
95
|
| `supervisor_bridge.py` | Supervisor 模块间解耦桥接层,提供轻量化调用门面 | `SupervisorBridge` |
|
|
93
96
|
| `supervisor_coverage.py` | 覆盖率生命周期继承器,支持空闲历史会话继承与动态分发 | `SupervisorCoverageSync` |
|
|
94
97
|
| `supervisor_degraded.py` | 降级容灾与探针就地自愈控制器,无损处理缺失依赖与环境 | `SupervisorDegradedCoordinator` |
|
|
@@ -100,7 +103,7 @@ flowchart TD
|
|
|
100
103
|
|
|
101
104
|
## 3. 核心设计契约与公理 (Design Axioms)
|
|
102
105
|
|
|
103
|
-
1. **版本绝对固化公理**:`startup_version_gate.py` 必须在任何业务逻辑启动前执行,基线版本严格锁定在 `0.1.
|
|
106
|
+
1. **版本绝对固化公理**:`startup_version_gate.py` 必须在任何业务逻辑启动前执行,基线版本严格锁定在 `0.1.2`,杜绝任何环境版本漂移。
|
|
104
107
|
2. **状态机单向流转与幂等性**:生命周期从 `Pre` $\rightarrow$ `Round` $\rightarrow$ `Worker` $\rightarrow$ `Judge` $\rightarrow$ `Settlement` $\rightarrow$ `Post` 严格单向流动,禁止逆流操作;重试必须走显式的轮次迭代(`advance_round_lifecycle`)。
|
|
105
108
|
3. **证据零伪造公理**:在 `findings_adjudication.py` 与 `candidate_revalidation.py` 中,所有缺陷判定必须有可执行的反事实测试证据,严禁仅凭模型推理文本定性。
|
|
106
109
|
4. **工作树物理安全红线**:`post_dry_run.py` 与 `post_commit.py` 严格遵守工作树保护宪法,未授权时绝对禁止覆盖用户未暂存的修改。
|
|
@@ -47,9 +47,11 @@ from typing import Any, Mapping
|
|
|
47
47
|
|
|
48
48
|
if __package__:
|
|
49
49
|
from core.launch_phases.common import resolve_project_root, supervisor_state_path
|
|
50
|
+
from core.launch_phases import verify_loop
|
|
50
51
|
else: # pragma: no cover
|
|
51
52
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
52
53
|
from core.launch_phases.common import resolve_project_root, supervisor_state_path
|
|
54
|
+
from core.launch_phases import verify_loop
|
|
53
55
|
|
|
54
56
|
_SHELL_TOKENS = (";", "&&", "||", "`", "$(", ">", "<")
|
|
55
57
|
|
|
@@ -187,11 +189,25 @@ def confirm(
|
|
|
187
189
|
"""
|
|
188
190
|
from core.supervisor import audit_supervisor
|
|
189
191
|
from core.ledger import finding_confirmation
|
|
192
|
+
from core.ledger.finding_verification import (
|
|
193
|
+
diagnose_verification_error,
|
|
194
|
+
diagnose_verification_receipt,
|
|
195
|
+
snapshot_target_hashes,
|
|
196
|
+
validate_python_poc_pair,
|
|
197
|
+
verify_target_hashes_unchanged,
|
|
198
|
+
)
|
|
190
199
|
|
|
191
200
|
# 用模块级引用(可被测试替换);函数内重新 import 会绕过 monkeypatch。
|
|
192
201
|
root = resolve_project_root().resolve()
|
|
202
|
+
state_dir = supervisor_state_path().parent
|
|
193
203
|
supervisor = audit_supervisor.Supervisor(root, state_path=supervisor_state_path())
|
|
194
204
|
state = supervisor.status()
|
|
205
|
+
findings_by_fp: dict[str, dict[str, Any]] = {}
|
|
206
|
+
for raw_f in getattr(state, "findings", ()) or ():
|
|
207
|
+
f_dict = raw_f if isinstance(raw_f, dict) else getattr(raw_f, "to_dict", dict)()
|
|
208
|
+
f_fp = str(f_dict.get("fingerprint") or "").strip()
|
|
209
|
+
if f_fp:
|
|
210
|
+
findings_by_fp[f_fp] = f_dict
|
|
195
211
|
recipes = json.loads(Path(recipes_path).read_text(encoding="utf-8"))
|
|
196
212
|
if isinstance(recipes, dict):
|
|
197
213
|
recipes = [recipes]
|
|
@@ -212,6 +228,22 @@ def confirm(
|
|
|
212
228
|
print(f"[findings-confirm] ✗ oracle 文件不存在: {oracle_file}")
|
|
213
229
|
failed += 1
|
|
214
230
|
continue
|
|
231
|
+
vdir = verify_loop.verify_dir_for_finding(state_dir, fp)
|
|
232
|
+
finding_meta = findings_by_fp.get(fp, {"fingerprint": fp})
|
|
233
|
+
rel_file, _ = verify_loop._extract_target_file_and_line(finding_meta)
|
|
234
|
+
ast_diag = validate_python_poc_pair(
|
|
235
|
+
_strip_runner_wrapper(pos),
|
|
236
|
+
_strip_runner_wrapper(neg),
|
|
237
|
+
finding_key=fp,
|
|
238
|
+
attempt=1,
|
|
239
|
+
target_hints=(),
|
|
240
|
+
)
|
|
241
|
+
if ast_diag is not None:
|
|
242
|
+
diag_path = verify_loop.record_attempt_diagnostic(vdir, ast_diag)
|
|
243
|
+
print(f"[findings-confirm] ✗ anti-gaming {fp[:44]} ({ast_diag.failure_code}): {ast_diag.summary} → {diag_path.name}")
|
|
244
|
+
failed += 1
|
|
245
|
+
continue
|
|
246
|
+
before_hashes = snapshot_target_hashes(root, [rel_file] if rel_file else [])
|
|
215
247
|
recipe = {
|
|
216
248
|
"positive": {"argv": _wrap_positive(pos),
|
|
217
249
|
"oracle": {"kind": "exit_code", "expected_exit_code": 1}},
|
|
@@ -222,14 +254,33 @@ def confirm(
|
|
|
222
254
|
"oracle_hash": hashlib.sha256(oracle_path.read_bytes()).hexdigest(),
|
|
223
255
|
}
|
|
224
256
|
try:
|
|
225
|
-
supervisor.verify_finding(finding=fp, recipe=recipe)
|
|
257
|
+
verify_res = supervisor.verify_finding(finding=fp, recipe=recipe)
|
|
226
258
|
except audit_supervisor.SupervisorError as exc:
|
|
227
|
-
|
|
259
|
+
diag = diagnose_verification_error(exc, attempt=1, finding_key=fp, stage="supervisor_verify")
|
|
260
|
+
diag_path = verify_loop.record_attempt_diagnostic(vdir, diag)
|
|
261
|
+
print(f"[findings-confirm] ✗ verify {fp[:44]} ({diag.failure_code}): {str(exc)[:140]} → {diag_path.name}")
|
|
228
262
|
failed += 1
|
|
229
263
|
continue
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
264
|
+
tampered = verify_target_hashes_unchanged(root, before_hashes)
|
|
265
|
+
if tampered:
|
|
266
|
+
diag = diagnose_verification_error(
|
|
267
|
+
f"PoC modified target source file(s): {', '.join(tampered)}",
|
|
268
|
+
attempt=1, finding_key=fp, failure_code="source_tampered_rejected", stage="anti_tamper",
|
|
269
|
+
)
|
|
270
|
+
diag_path = verify_loop.record_attempt_diagnostic(vdir, diag)
|
|
271
|
+
print(f"[findings-confirm] ✗ source-tampered {fp[:44]}: {tampered} → {diag_path.name}")
|
|
272
|
+
failed += 1
|
|
273
|
+
continue
|
|
274
|
+
receipt = verify_res.get("receipt") if isinstance(verify_res, Mapping) else {}
|
|
275
|
+
v_status = str(verify_res.get("status") or (receipt.get("status") if isinstance(receipt, Mapping) else ""))
|
|
276
|
+
if v_status and v_status != "CONFIRMED":
|
|
277
|
+
diag = diagnose_verification_receipt(receipt if isinstance(receipt, Mapping) else {}, attempt=1, finding_key=fp)
|
|
278
|
+
diag_path = verify_loop.record_attempt_diagnostic(vdir, diag)
|
|
279
|
+
print(f"[findings-confirm] ✗ verify-not-confirmed {fp[:44]} ({diag.failure_code}): {diag.summary} → {diag_path.name}")
|
|
280
|
+
failed += 1
|
|
281
|
+
continue
|
|
282
|
+
# F-RSI-20261118-009 / P0-D04:从输入 item 读取定级补录(原从 recipe 读取恒为 None)
|
|
283
|
+
recipe_severity = str(item.get("severity") or "").strip() or None
|
|
233
284
|
try:
|
|
234
285
|
supervisor.confirm_finding(
|
|
235
286
|
finding=fp, decision="confirmed",
|
|
@@ -327,6 +378,98 @@ def _reject_triplet(value: str) -> tuple[str, str, str]:
|
|
|
327
378
|
return parts[0].strip(), parts[1].strip(), parts[2].strip()
|
|
328
379
|
|
|
329
380
|
|
|
381
|
+
def prepare_verify_bundles(
|
|
382
|
+
fingerprints: list[str] | None = None,
|
|
383
|
+
*,
|
|
384
|
+
max_attempts: int = verify_loop.DEFAULT_MAX_ATTEMPTS,
|
|
385
|
+
) -> int:
|
|
386
|
+
"""为 pending 候选生成独立验证员盲审包 VerifyBundle(P0 D-01)。"""
|
|
387
|
+
from core.supervisor import audit_supervisor
|
|
388
|
+
|
|
389
|
+
max_attempts = verify_loop.normalize_max_attempts(max_attempts)
|
|
390
|
+
root = resolve_project_root().resolve()
|
|
391
|
+
state_dir = supervisor_state_path().parent
|
|
392
|
+
supervisor = audit_supervisor.Supervisor(root, state_path=supervisor_state_path())
|
|
393
|
+
state = supervisor.status()
|
|
394
|
+
wanted = {fp.strip() for fp in (fingerprints or []) if fp and fp.strip()}
|
|
395
|
+
|
|
396
|
+
generated: list[dict[str, str]] = []
|
|
397
|
+
for raw_f in getattr(state, "findings", ()) or ():
|
|
398
|
+
f_dict = raw_f if isinstance(raw_f, dict) else getattr(raw_f, "to_dict", dict)()
|
|
399
|
+
confirmation = f_dict.get("confirmation")
|
|
400
|
+
if isinstance(confirmation, dict) and confirmation.get("decision"):
|
|
401
|
+
continue
|
|
402
|
+
fp = str(f_dict.get("fingerprint") or "").strip()
|
|
403
|
+
if not fp or (wanted and fp not in wanted):
|
|
404
|
+
continue
|
|
405
|
+
bundle_path, _ = verify_loop.build_verify_bundle(
|
|
406
|
+
root, state_dir, f_dict, attempt=1, max_attempts=max_attempts,
|
|
407
|
+
)
|
|
408
|
+
generated.append({"fingerprint": fp, "bundle_path": str(bundle_path)})
|
|
409
|
+
print(f"[findings-confirm] ✓ verify-bundle {fp[:48]} → {bundle_path}")
|
|
410
|
+
|
|
411
|
+
if not generated:
|
|
412
|
+
print("[findings-confirm] 未找到匹配的 pending 候选")
|
|
413
|
+
return 1
|
|
414
|
+
print(f"[findings-confirm] 已生成 {len(generated)} 份盲审 VerifyBundle(协议:core/prompts/stages/stage_verify.md)")
|
|
415
|
+
return 0
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def run_verify_attempt_file(
|
|
419
|
+
attempt_path: Path,
|
|
420
|
+
*,
|
|
421
|
+
max_attempts: int = verify_loop.DEFAULT_MAX_ATTEMPTS,
|
|
422
|
+
) -> int:
|
|
423
|
+
"""消费独立验证员提交的单轮 attempt JSON 并执行引擎验证/自纠错推进(P0 D-02~D-05)。"""
|
|
424
|
+
from core.supervisor import audit_supervisor
|
|
425
|
+
|
|
426
|
+
max_attempts = verify_loop.normalize_max_attempts(max_attempts)
|
|
427
|
+
root = resolve_project_root().resolve()
|
|
428
|
+
state_dir = supervisor_state_path().parent
|
|
429
|
+
supervisor = audit_supervisor.Supervisor(root, state_path=supervisor_state_path())
|
|
430
|
+
state = supervisor.status()
|
|
431
|
+
findings_by_fp: dict[str, dict[str, Any]] = {}
|
|
432
|
+
for raw_f in getattr(state, "findings", ()) or ():
|
|
433
|
+
f_dict = raw_f if isinstance(raw_f, dict) else getattr(raw_f, "to_dict", dict)()
|
|
434
|
+
f_fp = str(f_dict.get("fingerprint") or "").strip()
|
|
435
|
+
if f_fp:
|
|
436
|
+
findings_by_fp[f_fp] = f_dict
|
|
437
|
+
|
|
438
|
+
payload = json.loads(Path(attempt_path).read_text(encoding="utf-8"))
|
|
439
|
+
items = payload if isinstance(payload, list) else [payload]
|
|
440
|
+
settled_any = False
|
|
441
|
+
has_failure = False
|
|
442
|
+
|
|
443
|
+
for item in items:
|
|
444
|
+
if not isinstance(item, Mapping):
|
|
445
|
+
has_failure = True
|
|
446
|
+
continue
|
|
447
|
+
fp = str(item.get("fingerprint") or "").strip()
|
|
448
|
+
if not fp or fp not in findings_by_fp:
|
|
449
|
+
print(f"[findings-confirm] ✗ 未知 finding fingerprint: {fp[:48]}")
|
|
450
|
+
has_failure = True
|
|
451
|
+
continue
|
|
452
|
+
result = verify_loop.execute_verify_attempt(
|
|
453
|
+
root=root,
|
|
454
|
+
state_dir=state_dir,
|
|
455
|
+
supervisor=supervisor,
|
|
456
|
+
finding=findings_by_fp[fp],
|
|
457
|
+
positive=str(item.get("positive") or ""),
|
|
458
|
+
negative=str(item.get("negative") or ""),
|
|
459
|
+
max_attempts=max_attempts,
|
|
460
|
+
)
|
|
461
|
+
status = str(result.get("status") or "")
|
|
462
|
+
print(json.dumps(result, ensure_ascii=False))
|
|
463
|
+
if status in {"CONFIRMED", "REJECTED", "STALLED"}:
|
|
464
|
+
settled_any = True
|
|
465
|
+
if status not in {"CONFIRMED"}:
|
|
466
|
+
has_failure = True
|
|
467
|
+
|
|
468
|
+
if settled_any:
|
|
469
|
+
_materialize_findings(root, supervisor)
|
|
470
|
+
return 0 if not has_failure else 1
|
|
471
|
+
|
|
472
|
+
|
|
330
473
|
def build_parser() -> argparse.ArgumentParser:
|
|
331
474
|
"""``bugx engine findings-confirm`` 的**唯一**参数契约。
|
|
332
475
|
|
|
@@ -338,7 +481,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
338
481
|
"""
|
|
339
482
|
parser = argparse.ArgumentParser(
|
|
340
483
|
prog="bugx engine findings-confirm",
|
|
341
|
-
description="Finding
|
|
484
|
+
description="Finding 确认一条龙与独立验证员盲审闭环:校验 recipe / 盲审包 → 引擎双正例+负对照实跑 → 诊断自纠错 → 物化确认块。",
|
|
342
485
|
)
|
|
343
486
|
parser.add_argument(
|
|
344
487
|
"recipes", nargs="?", metavar="RECIPE",
|
|
@@ -361,6 +504,18 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
361
504
|
"--from-verdicts", action="store_true",
|
|
362
505
|
help="输入文件是 judge verdicts(自动生成 recipe)而不是 recipe 本身",
|
|
363
506
|
)
|
|
507
|
+
parser.add_argument(
|
|
508
|
+
"--prepare-verify", nargs="*", metavar="FP",
|
|
509
|
+
help="为指定(或全部 pending)候选生成独立验证员盲审包 VerifyBundle(P0)",
|
|
510
|
+
)
|
|
511
|
+
parser.add_argument(
|
|
512
|
+
"--verify-attempt", dest="verify_attempt", metavar="ATTEMPT_JSON",
|
|
513
|
+
help="提交独立验证员单轮输出 JSON,执行 Anti-Gaming + 双正例负对照 + 报错诊断推进(P0)",
|
|
514
|
+
)
|
|
515
|
+
parser.add_argument(
|
|
516
|
+
"--max-attempts", dest="max_attempts", type=int, default=verify_loop.DEFAULT_MAX_ATTEMPTS,
|
|
517
|
+
help=f"单条 Finding 报错自纠错最大重试次数(1..{verify_loop.HARD_MAX_ATTEMPTS},默认 {verify_loop.DEFAULT_MAX_ATTEMPTS})",
|
|
518
|
+
)
|
|
364
519
|
return parser
|
|
365
520
|
|
|
366
521
|
|
|
@@ -370,13 +525,19 @@ def main(argv: list[str]) -> int:
|
|
|
370
525
|
args = parser.parse_args(argv)
|
|
371
526
|
except SystemExit as exc: # argparse 用 exit(2) 表示用法错误
|
|
372
527
|
return int(exc.code or 2)
|
|
528
|
+
if args.prepare_verify is not None:
|
|
529
|
+
return prepare_verify_bundles(args.prepare_verify, max_attempts=args.max_attempts)
|
|
530
|
+
if args.verify_attempt:
|
|
531
|
+
return run_verify_attempt_file(Path(args.verify_attempt), max_attempts=args.max_attempts)
|
|
373
532
|
rejects: list[tuple[str, str, str]] = list(args.reject or [])
|
|
374
533
|
source = args.recipe_opt or args.recipes
|
|
375
534
|
if not source:
|
|
376
535
|
parser.print_usage()
|
|
377
536
|
print(
|
|
378
537
|
"用法:bugx engine findings-confirm --recipe <recipes.json> "
|
|
379
|
-
"[--all-pending] [--reject <fp>:<class>:<reason> ...]"
|
|
538
|
+
"[--all-pending] [--reject <fp>:<class>:<reason> ...]\n"
|
|
539
|
+
" 或:bugx engine findings-confirm --prepare-verify [FP ...]\n"
|
|
540
|
+
" 或:bugx engine findings-confirm --verify-attempt <attempt.json> [--max-attempts 3]"
|
|
380
541
|
)
|
|
381
542
|
return 2
|
|
382
543
|
if args.from_verdicts:
|
|
@@ -299,7 +299,7 @@ def _refresh_acceptance_receipt_after_rebind() -> None:
|
|
|
299
299
|
|
|
300
300
|
|
|
301
301
|
def post(
|
|
302
|
-
final: bool = False,
|
|
302
|
+
final: bool = False, *, allow_incomplete: bool = False,
|
|
303
303
|
allow_serial: bool = False, dry_run: bool = False,
|
|
304
304
|
_post_attempt_token: object | None = None,
|
|
305
305
|
) -> int:
|
|
@@ -330,7 +330,7 @@ def post(
|
|
|
330
330
|
_begin_post_gate("runtime_load")
|
|
331
331
|
try:
|
|
332
332
|
result = _post_impl(
|
|
333
|
-
final=final,
|
|
333
|
+
final=final,
|
|
334
334
|
allow_incomplete=allow_incomplete,
|
|
335
335
|
allow_serial=allow_serial,
|
|
336
336
|
)
|
|
@@ -431,7 +431,7 @@ def _recovery_closeout_exemption_violation(
|
|
|
431
431
|
|
|
432
432
|
|
|
433
433
|
def _post_impl(
|
|
434
|
-
final: bool = False,
|
|
434
|
+
final: bool = False, *, allow_incomplete: bool = False,
|
|
435
435
|
allow_serial: bool = False,
|
|
436
436
|
) -> int:
|
|
437
437
|
# DES-06:``run_module_coverage`` 已下沉到共享层;``_round_result`` /
|
|
@@ -1044,7 +1044,7 @@ def _post_impl(
|
|
|
1044
1044
|
runtime = close_session(runtime.get("round_id") or runtime.get("lifecycle_id"), reason="completed")
|
|
1045
1045
|
_finish_post_gate("ok")
|
|
1046
1046
|
outcome = "INCOMPLETE" if (final and allow_incomplete) else "COMPLETE"
|
|
1047
|
-
share_state = maybe_share_lifecycle(runtime, lifecycle
|
|
1047
|
+
share_state = maybe_share_lifecycle(runtime, lifecycle)
|
|
1048
1048
|
refresh_startup_todo(
|
|
1049
1049
|
"report",
|
|
1050
1050
|
reason="Round 报告已封存,正在处理结论共享",
|
|
@@ -1173,7 +1173,7 @@ def _post_impl(
|
|
|
1173
1173
|
runtime.get("round_id") or runtime.get("lifecycle_id"),
|
|
1174
1174
|
reason="completed" if is_complete else "blocked",
|
|
1175
1175
|
)
|
|
1176
|
-
share_state = maybe_share_lifecycle(runtime, lifecycle
|
|
1176
|
+
share_state = maybe_share_lifecycle(runtime, lifecycle)
|
|
1177
1177
|
if is_complete:
|
|
1178
1178
|
share_phase = "share-pending" if share_state == "pending" else "share-completed"
|
|
1179
1179
|
else:
|
|
@@ -582,6 +582,19 @@ def run_recon_scout(
|
|
|
582
582
|
return []
|
|
583
583
|
|
|
584
584
|
|
|
585
|
+
def build_and_persist_semantic_overlay(
|
|
586
|
+
root: Path,
|
|
587
|
+
*,
|
|
588
|
+
llm_analyzer: Any = None,
|
|
589
|
+
max_files: int = 24,
|
|
590
|
+
) -> dict[str, Any]:
|
|
591
|
+
"""在 pre 阶段静态图谱之上叠加轻量语义侦察(隐式路由 / 鉴权边界 / 业务不变量,P2 / T-006)。"""
|
|
592
|
+
from core.launch_phases import semantic_recon
|
|
593
|
+
return semantic_recon.run_semantic_recon_overlay(
|
|
594
|
+
root, llm_analyzer=llm_analyzer, max_files=max_files, persist=True,
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
|
|
585
598
|
def match_unit_for_sink(units: list[str], rel_file: str, line: int | None) -> str | None:
|
|
586
599
|
if not units or not rel_file:
|
|
587
600
|
return None
|