mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:23:23 +08:00
- Add SQLAlchemy Core repos, pg adapter/compat, assistant_store factory, Alembic bootstrap and migration/cutover scripts. - Harden chat_message writes (NUL scrub for PG), turn_uuid on attempt failure, WS turn_runner fallbacks and gateway executed_turn_uuid init. - start_gateway: log paths, PS7 stderr handling via cmd, background stdout/stderr redirect; runtime assistant_runtime_log_dir export. - Ops: clear_all_chat_sessions with PG-only --postgresql and env-gated wipe; clear_postgres_chat_sessions.ps1. - Tests: SA repos, pg compat, persist fallback, smoke env isolation; CI and docs touch-ups. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from .adapter import PlanAgentV2Decision
|
|
from 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,
|
|
"turn_uuid": "",
|
|
}
|
|
|
|
|
|
__all__ = ["build_shadow_gateway_result", "legacy_gateway_result_keys"]
|
|
|