32 lines
904 B
Python
32 lines
904 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
from uuid import uuid4
|
|
|
|
from app.agents.isolation.strategy_selector import IsolationDecision
|
|
|
|
|
|
def prepare_session_isolation(
|
|
*,
|
|
state: dict[str, Any],
|
|
decision: IsolationDecision,
|
|
role_value: str,
|
|
sub_commander: str,
|
|
) -> dict[str, Any]:
|
|
isolation_id = f"session-{uuid4().hex[:8]}"
|
|
return {
|
|
"mode": "session",
|
|
"isolation_id": isolation_id,
|
|
"workspace_path": None,
|
|
"parent_conversation_id": str(state.get("conversation_id") or "") or None,
|
|
"metadata": {
|
|
**dict(decision.metadata or {}),
|
|
"reason": decision.reason,
|
|
"role": role_value,
|
|
"sub_commander": sub_commander,
|
|
"tool_names": list(decision.tool_names),
|
|
"capability_ids": list(decision.capability_ids),
|
|
"status": "active",
|
|
},
|
|
}
|