"""The checkpointed state of one Execution. Plain, JSON-compatible data only.""" from __future__ import annotations import operator from typing import Annotated, Any, TypedDict class ExecutionState(TypedDict, total=False): execution_id: str session_id: str workflow_request: str pre_approved: bool allow_cloud_read: bool | None ledger: dict[str, Any] # Ledger.to_dict() deliverables: dict[str, dict[str, Any]] # kind -> {content, attachments} conversation: list[dict[str, str]] # {"from": "user" | "orchestrator", "text"} notes: list[str] # facts for the Orchestrator's next turn pending_questions: list[dict[str, Any]] # {kind, questions} not yet asked awaiting_questions: list[dict[str, Any]] # {kind, questions} asked, not answered answers: dict[str, list[dict[str, Any]]] # kind -> [{questions, reply}] pending_permission: dict[str, Any] | None # {tier, requested_by} prompt: dict[str, Any] | None # what the user is being asked # Specialist outcomes, appended concurrently by parallel Specialist tasks and # applied to the Ledger by the next Orchestrator turn. outcomes: Annotated[list[dict[str, Any]], operator.add] outcomes_applied: int events_recorded: int turns: int status: str # running | completed | completed_with_warnings warnings: list[str] scripted_answers: list[list[str]] # [regex, answer], pre-approved runs only