mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-13 03:30:46 +08:00
feat: plan agent v2, global chat mode, and user-mode v2 flag sync
- 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>
This commit is contained in:
parent
ae44cbcad5
commit
37522f492a
49 changed files with 4146 additions and 238 deletions
45
runtime/plan_agent_v2/compat.py
Normal file
45
runtime/plan_agent_v2/compat.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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"]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue