mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 07:20:44 +08:00
- Add runtime/plan_agent_v2 package and shims; gateway/direct_loop/WS wiring - Admin chat: interaction mode and specialist only in user menu; session API stores memory_mode and execution_mode only - POST /admin/api/chat/user-mode mirrors plan_agent_version to AIA_EXPERT_PLAN_AGENT_V2_ENABLED (v2 to 1, v1 to 0) - Composer cleanup (hidden mode select, no reasoning toggle in meta bar); tests and _local/system.env.example Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from .adapter import PlanAgentV2Decision
|
|
from oclaw.runtime.gateway import OclawGatewayResult
|
|
|
|
|
|
def legacy_gateway_result_keys() -> set[str]:
|
|
return set(OclawGatewayResult.__dataclass_fields__.keys())
|
|
|
|
|
|
def build_shadow_gateway_result(
|
|
*,
|
|
decision: PlanAgentV2Decision,
|
|
run_id: str,
|
|
trace_id: str,
|
|
elapsed_ms: int,
|
|
requested_specialist: str,
|
|
) -> dict[str, Any]:
|
|
return {
|
|
"run_id": str(run_id),
|
|
"reply_text": str(decision.reply_text or ""),
|
|
"trace_id": str(trace_id),
|
|
"elapsed_ms": int(elapsed_ms),
|
|
"mode": "sync_direct",
|
|
"task_id": None,
|
|
"selected_specialist": str((decision.plan_state or {}).get("owner_specialist") or requested_specialist or "generalist"),
|
|
"interaction_mode": "expert",
|
|
"dispatch_reason": f"plan_agent_v2:{decision.action}",
|
|
"manager_selected_specialist": str((decision.plan_state or {}).get("owner_specialist") or requested_specialist or "generalist"),
|
|
"requested_specialist": str(requested_specialist or "generalist"),
|
|
"dynamic_agent_used": False,
|
|
"dynamic_agent_name": "",
|
|
"relay_pointer_count": 0,
|
|
"relay_envelope_present": False,
|
|
"relay_envelope_pointer_count": 0,
|
|
"relay_ttl_turn_count": 0,
|
|
"relay_ttl_session_count": 0,
|
|
"relay_ttl_keep_count": 0,
|
|
}
|
|
|
|
|
|
__all__ = ["build_shadow_gateway_result", "legacy_gateway_result_keys"]
|
|
|