Agent session lifecycle state: session pid, status, approvals.
Domain-only state (status, model, provider, session ID) lives in the
composed MingaAgent.RuntimeState struct at runtime. Presentation
state (spinner timer, buffer pid, session history) stays on this struct.
Lifecycle monitoring (Process.monitor) is handled exclusively by
MingaAgent.SessionManager, which broadcasts :agent_session_stopped
events via Minga.Events. The Editor subscribes to those events
instead of monitoring session PIDs directly.
UI state (scroll, prompt, focus, search, toasts) lives in UIState
on EditorState.agent_ui. This module holds only process-aware,
action-heavy fields that manage the agent session.
Summary
Functions
Returns all session pids (active + history), most recent first.
Returns true if the agent is actively working.
Clears the pending tool approval.
Clears the session reference and resets status to :idle. Lifecycle monitoring is handled by SessionManager.
Sets the agent buffer pid.
Sets the agent into an error state with a message.
Sets a pending tool approval.
Stores the session pid and sets status to :idle. Archives the previous session. Lifecycle monitoring is handled by SessionManager.
Sets the agent status (delegates to RuntimeState).
Starts the spinner timer if not already running.
Returns the agent lifecycle status from RuntimeState.
Stops the spinner timer if running.
Switches to a session from history, moving current to history. Lifecycle monitoring is handled by SessionManager.
Types
@type approval() :: MingaAgent.ToolApproval.t()
Pending tool approval data.
@type status() :: MingaAgent.RuntimeState.status()
Agent status (delegated from RuntimeState).
@type t() :: %MingaEditor.State.Agent{ buffer: pid() | nil, error: String.t() | nil, pending_approval: approval() | nil, runtime: MingaAgent.RuntimeState.t(), session: pid() | nil, session_history: [pid()], spinner_timer: {:ok, :timer.tref()} | nil }
Agent session state.
Functions
Returns all session pids (active + history), most recent first.
Returns true if the agent is actively working.
Clears the pending tool approval.
Clears the session reference and resets status to :idle. Lifecycle monitoring is handled by SessionManager.
Sets the agent buffer pid.
Sets the agent into an error state with a message.
Sets a pending tool approval.
Stores the session pid and sets status to :idle. Archives the previous session. Lifecycle monitoring is handled by SessionManager.
Sets the agent status (delegates to RuntimeState).
Starts the spinner timer if not already running.
Returns the agent lifecycle status from RuntimeState.
Stops the spinner timer if running.
Switches to a session from history, moving current to history. Lifecycle monitoring is handled by SessionManager.