Files
AirPlan-V2/lib/air_runtime/modes/dep_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

40 lines
1.4 KiB
Python
Executable File

"""AirDep mode — V2 部署器。"""
from pathlib import Path
from air_runtime.deploy_runtime import deploy, DeployTarget
from air_runtime.io import safe_json_load
from air_runtime.paths import airplan_root, event_log_path
from air_runtime.events import EventLog, DEPLOY_COMPLETED
def main(args) -> None:
project_root = Path(args.project).expanduser().resolve()
tid = args.task_id
sub = args.sub or "deploy"
if sub == "deploy" and args.host:
target = DeployTarget(host=args.host)
binary = Path(args.binary).expanduser().resolve() if args.binary else Path(".")
result = deploy(tid, project_root, target, binary, tid)
log = EventLog(event_log_path(project_root))
log.emit(DEPLOY_COMPLETED, {
"taskId": tid,
"success": result.success,
"host": args.host,
"binaryMd5": result.binary_md5,
"serviceStatus": result.service_status,
})
print("airplan_mode=dep")
print(f"task_id={tid}")
print(f"success={result.success}")
print(f"md5={result.binary_md5}")
print(f"service_status={result.service_status}")
if result.error:
print(f"error={result.error}")
else:
paths = airplan_root(project_root) / "state" / "airdep"
state = safe_json_load(paths / "state.json") or {}
print(f"airplan_mode=dep\nenabled={state.get('enabled', False)}")