mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 04:10:44 +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
35
runtime/plan_agent_v2/switch.py
Normal file
35
runtime/plan_agent_v2/switch.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
|
||||
def _is_truthy(raw: str | None) -> bool:
|
||||
return str(raw or "").strip().lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
def v2_feature_enabled(*, store: Any | None = None) -> bool:
|
||||
# Default off for shadow path safety.
|
||||
raw = ""
|
||||
try:
|
||||
if store is not None:
|
||||
raw = str(store.get_setting("AIA_EXPERT_PLAN_AGENT_V2_ENABLED") or "").strip()
|
||||
except Exception:
|
||||
raw = ""
|
||||
if not raw:
|
||||
raw = str(os.getenv("AIA_EXPERT_PLAN_AGENT_V2_ENABLED") or "").strip()
|
||||
if not raw:
|
||||
return False
|
||||
return _is_truthy(raw)
|
||||
|
||||
|
||||
def should_route_to_v2(*, store: Any | None, interaction_mode: str, force_flag: bool = False) -> bool:
|
||||
if str(interaction_mode or "").strip().lower() != "expert":
|
||||
return False
|
||||
if force_flag:
|
||||
return True
|
||||
return v2_feature_enabled(store=store)
|
||||
|
||||
|
||||
__all__ = ["should_route_to_v2", "v2_feature_enabled"]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue