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>
This commit is contained in:
AirPlan
2026-06-12 15:56:44 +08:00
commit 6130478c96
73 changed files with 10622 additions and 0 deletions

99
lib/air_runtime/paths.py Executable file
View File

@@ -0,0 +1,99 @@
"""
路径约定 — V2 统一所有子模块的 AirPlan 目录结构。
"""
from __future__ import annotations
from pathlib import Path
def airplan_root(project_root: Path) -> Path:
return project_root / "AirPlan"
def state_root(project_root: Path) -> Path:
return airplan_root(project_root) / "state"
def todo_path(project_root: Path) -> Path:
return airplan_root(project_root) / "todo.md"
def plan_path(project_root: Path) -> Path:
return airplan_root(project_root) / "plan.md"
def agents_path(project_root: Path) -> Path:
return airplan_root(project_root) / "AGENTS.md"
def docs_root(project_root: Path) -> Path:
return airplan_root(project_root) / "docs"
# --- 子模块状态路径 ---
def engine_state_path(project_root: Path) -> Path:
return state_root(project_root) / "aireng" / "state.json"
def worker_state_path(project_root: Path, task_id: str) -> Path:
return state_root(project_root) / "airdo" / "tasks" / task_id / "worker-state.json"
def arc_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airarc" / "state.json"
def dbg_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airdbg" / "state.json"
def xdb_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airxdb" / "state.json"
def sdb_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airsdb" / "state.json"
def ndb_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airndb" / "state.json"
def ctx_state_path(project_root: Path) -> Path:
return state_root(project_root) / "aircontext" / "state.json"
def dep_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airdep" / "state.json"
def tst_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airtst" / "state.json"
def sec_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airsec" / "state.json"
def rvr_state_path(project_root: Path) -> Path:
return state_root(project_root) / "airrvr" / "state.json"
def event_log_path(project_root: Path) -> Path:
return state_root(project_root) / "events.jsonl"
def task_graph_state_path(project_root: Path) -> Path:
return state_root(project_root) / "task-graph.json"
def required_project_artifacts() -> list[str]:
return [
"AirPlan/AGENTS.md",
"AirPlan/plan.md",
"AirPlan/todo.md",
"AirPlan/docs/architecture/adr/",
"AirPlan/docs/architecture/c4/module.md",
]