Subtract dead agent husks and unify the gateway executor path.

Remove SpecialistAgentRunner, plan_agent_v2 re-export shims, empty runtime husks, and disconnected Admin knobs. Fold ops into build_gateway_executor, align AIA_ENABLE_PLUGIN_TOOLS with catalog, and allow ops on the default MCP specialist list.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-11 01:02:29 +08:00
parent e2fc72607e
commit 628a9dffd2
32 changed files with 127 additions and 870 deletions

View file

@ -63,6 +63,7 @@ def test_memory_wiki_plugin_registry_and_catalog_wiring(tmp_path: Path, monkeypa
assert {"wiki_status", "wiki_lint", "wiki_apply", "wiki_search", "wiki_get"} <= names
assert all(callable(t.get("handler")) for t in tools if str(t.get("name") or "").startswith("wiki_"))
monkeypatch.setenv("AIA_ENABLE_PLUGIN_TOOLS", "1")
monkeypatch.setenv("AIA_PLUGIN_TOOLS_ENABLED", "1")
monkeypatch.setenv("AIA_PLUGIN_TOOL_IDS", "memory-wiki")
specs = materialize_tool_specs()

View file

@ -1,80 +0,0 @@
from __future__ import annotations
from pathlib import Path
from svc.persistence.sqlite_store import SqliteStore
from runtime.plan_agent_v2_gateway_cutover import maybe_handle_expert_turn_v2_draft
from runtime.types import StandardMessage
def _msg(text: str) -> StandardMessage:
return StandardMessage(
session_id="cutover-s1",
tenant_id="t1",
user_id="u1",
role="user",
channel="chat",
text=text,
attachments=[],
metadata={},
)
def test_cutover_draft_off_by_default(tmp_path: Path) -> None:
store = SqliteStore(str(tmp_path / "ops.sqlite"))
out = maybe_handle_expert_turn_v2_draft(
store=store,
msg=_msg("hello"),
lang="zh",
interaction_mode="expert",
requested_specialist="generalist",
base_system_prompt="base",
force_flag=False,
)
assert out.handled is False
assert out.result is None
def test_cutover_draft_plan_reply_when_forced(tmp_path: Path) -> None:
store = SqliteStore(str(tmp_path / "ops.sqlite"))
store.set_setting("AIA_EXPERT_PLAN_FILE_DIR", str(tmp_path / "plans"))
out = maybe_handle_expert_turn_v2_draft(
store=store,
msg=_msg("我要做改造"),
lang="zh",
interaction_mode="expert",
requested_specialist="generalist",
base_system_prompt="base",
force_flag=True,
)
assert out.handled is False
assert out.result is None
assert out.decision_action == "run_agent"
assert "base" in str(out.system_prompt_override or "")
def test_cutover_draft_run_agent_returns_prompt_override(tmp_path: Path) -> None:
store = SqliteStore(str(tmp_path / "ops.sqlite"))
store.set_setting("AIA_EXPERT_PLAN_FILE_DIR", str(tmp_path / "plans"))
_ = maybe_handle_expert_turn_v2_draft(
store=store,
msg=_msg("先给个计划"),
lang="zh",
interaction_mode="expert",
requested_specialist="generalist",
base_system_prompt="base",
force_flag=True,
)
out = maybe_handle_expert_turn_v2_draft(
store=store,
msg=_msg("确认"),
lang="zh",
interaction_mode="expert",
requested_specialist="generalist",
base_system_prompt="base",
force_flag=True,
)
assert out.decision_action == "stay_plan"
assert out.handled is True
assert out.result is not None

View file

@ -3,17 +3,17 @@ from __future__ import annotations
from pathlib import Path
from svc.persistence.sqlite_store import SqliteStore
from runtime.plan_agent_v2_adapter import evaluate_for_expert_mode
from runtime.plan_agent_v2_compat import build_shadow_gateway_result, legacy_gateway_result_keys
from runtime.plan_agent_v2_gateway_adapter import evaluate_gateway_expert_turn_shadow
from runtime.plan_agent_v2_manager import PlanModeManagerV2
from runtime.plan_agent_v2_models import PLAN_MODE_PLAN, PlanAgentStateV2
from runtime.plan_agent_v2_prompt_injector import build_plan_mode_prefix
from runtime.plan_agent_v2_state_store import PlanAgentStateStoreV2
from runtime.plan_agent_v2_switch import should_route_to_v2, v2_feature_enabled
from runtime.plan_agent_v2_tool_specs import materialize_plan_mode_v2_tools
from runtime.plan_agent_v2_tool_policy import filter_tools_for_mode
from runtime.plan_agent_v2_trace import emit_plan_agent_v2_trace
from runtime.plan_agent_v2.adapter import evaluate_for_expert_mode
from runtime.plan_agent_v2.compat import build_shadow_gateway_result, legacy_gateway_result_keys
from runtime.plan_agent_v2.gateway_adapter import evaluate_gateway_expert_turn_shadow
from runtime.plan_agent_v2.manager import PlanModeManagerV2
from runtime.plan_agent_v2.models import PLAN_MODE_PLAN, PlanAgentStateV2
from runtime.plan_agent_v2.prompt_injector import build_plan_mode_prefix
from runtime.plan_agent_v2.state_store import PlanAgentStateStoreV2
from runtime.plan_agent_v2.switch import should_route_to_v2, v2_feature_enabled
from runtime.plan_agent_v2.tool_specs import materialize_plan_mode_v2_tools
from runtime.plan_agent_v2.tool_policy import filter_tools_for_mode
from runtime.plan_agent_v2.trace import emit_plan_agent_v2_trace
from runtime.plan_agent_v2 import should_route_to_v2 as should_route_to_v2_pkg
from runtime.gateway import OclawGatewayResult
from runtime.tools.base import ToolRegistry, ToolSpec