Agent rendering cache: status, error, pending approval, spinner timer, and the agent buffer pid.
This struct is not the source of truth for the active agent session.
The session pid lives on the active Tab (Traditional shell) or the
zoomed Card (Board shell). MingaEditor.State.AgentAccess.session/1
reads it through the Shell.active_session/1 callback.
After a tab switch, MingaEditor.State.rebuild_agent_from_session/2
repopulates the cache fields below from the incoming tab's session
process via MingaAgent.Session.editor_snapshot/1.
Domain-only state (status, model, provider, session ID) lives in the
composed MingaAgent.RuntimeState struct at runtime. Lifecycle
monitoring (Process.monitor) is handled exclusively by
MingaAgent.SessionManager, which broadcasts :agent_session_stopped
events via Minga.Events.
UI state (scroll, prompt, focus, search, toasts) lives in UIState
on EditorState.workspace.agent_ui.
Summary
Types
Pending tool approval data.
Agent status (delegated from RuntimeState).
Agent rendering cache.
Functions
Returns true if the agent is actively working.
Clears the pending tool approval.
Resets the rendering cache to idle defaults.
Sets the agent buffer pid.
Sets the agent into an error state with a message.
Sets a pending tool approval.
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.
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(), spinner_timer: {:ok, :timer.tref()} | nil }
Agent rendering cache.
Functions
Returns true if the agent is actively working.
Clears the pending tool approval.
Resets the rendering cache to idle defaults.
Called when the active tab/card no longer has a session, or when its
session has been torn down. The session pid itself lives on the tab
or card, not on this struct, so callers must clear that separately
via EditorState.set_tab_session/3 (Traditional) or by clearing the
card's :session field (Board).
Sets the agent buffer pid.
Sets the agent into an error state with a message.
Sets a pending tool approval.
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.