Files
AirPlan-V2/lib/air_runtime/modes/xdb_mode.py
AirPlan 6130478c96 feat: AirPlan V2 — 全专家插件强制路由 + 事件系统规范化
P0-8 扩大: do_mode.py finish_worker 全专家插件强制路由
- GUI→XDB, network→NDB, C/C++→SDB, done→Rvr, blocked/failed→Dbg
- 证据去重: 已有 xdbSessions/ndbSessions/sdbReports/rvrReviewed 则跳过

P1-GAP17: 事件 emit 规范化
- 新增 7 个事件常量 (TASK_ENTERED, TASK_FINISHED, ENGINE_ENTERED 等)
- 全部 emit 调用替换字符串字面量为常量,零残留
- 30 个事件类型常量全部定义且唯一

P1-GAP18: 事件日志原子轮转
- emit 计数器每 128 次检查轮转,避免每次 emit 读文件
- 清除未使用的 _emit_with_completion/_pending_merge_complete
- 原子轮转: tempfile+os.replace 保证不损坏

eng 极端接管: 强制调用全部专家插件 (Dbg/XDB/NDB/SDB/Rvr)
commands/do.md: 更新为全专家插件路由文档

全量测试: 69 通过, 0 失败

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 15:56:44 +08:00

44 lines
1.3 KiB
Python
Executable File

"""AirXDB mode -- GUI verification via screenshot capture."""
from __future__ import annotations
from pathlib import Path
from air_runtime.xdb_capture import CaptureManager, CaptureResult
from air_runtime.events import EventLog, XDB_CAPTURED
from air_runtime.paths import event_log_path
def capture_screenshot(
project_root: Path,
output_name: str = "screenshot.png",
prefer: str = "auto",
) -> CaptureResult:
out_path = project_root / "AirPlan" / "state" / "airxdb" / "captures" / output_name
out_path.parent.mkdir(parents=True, exist_ok=True)
mgr = CaptureManager()
result = mgr.capture(out_path, prefer)
log = EventLog(event_log_path(project_root))
log.emit(XDB_CAPTURED, {
"outputName": output_name,
"success": result.success,
"method": result.method,
"outputPath": str(result.output_path),
})
return result
def main(args) -> None:
project_root = Path(args.project).expanduser().resolve()
prefer = getattr(args, "prefer", "auto")
output = getattr(args, "output", None) or "screenshot.png"
result = capture_screenshot(project_root, output, prefer)
print("airplan_mode=xdb")
print(f"success={result.success}")
print(f"method={result.method}")
print(f"output={result.output_path}")
if result.error:
print(f"error={result.error}")