MingaAgent.RuntimeState (Minga v0.1.0)

Copy Markdown View Source

Domain-only agent session state, independent of any UI.

Tracks the active session identity, lifecycle status, and model/provider info. This struct lives in Layer 1 and can be consumed by both the Editor (Layer 2) and headless runtime clients without pulling in presentation concerns.

Presentation state (spinner timers, buffer PIDs, session history) lives in MingaEditor.State.Agent, which composes this struct.

Summary

Types

Agent lifecycle status.

t()

Domain-only agent runtime state.

Functions

Returns true if the agent is actively working.

Clears the active tool name.

Records the active tool name while a tool is executing.

Sets the model name.

Sets the provider name.

Sets the active session ID.

Sets the agent lifecycle status.

Types

status()

@type status() :: :idle | :plan | :thinking | :tool_executing | :error | nil

Agent lifecycle status.

t()

@type t() :: %MingaAgent.RuntimeState{
  active_session_id: String.t() | nil,
  active_tool_name: String.t() | nil,
  model_name: String.t() | nil,
  provider_name: String.t() | nil,
  status: status()
}

Domain-only agent runtime state.

Functions

busy?(runtime_state)

@spec busy?(t()) :: boolean()

Returns true if the agent is actively working.

clear_active_tool_name(rt)

@spec clear_active_tool_name(t()) :: t()

Clears the active tool name.

set_active_tool_name(rt, name)

@spec set_active_tool_name(t(), String.t() | nil) :: t()

Records the active tool name while a tool is executing.

set_model(rt, name)

@spec set_model(t(), String.t() | nil) :: t()

Sets the model name.

set_provider(rt, name)

@spec set_provider(t(), String.t() | nil) :: t()

Sets the provider name.

set_session_id(rt, id)

@spec set_session_id(t(), String.t() | nil) :: t()

Sets the active session ID.

set_status(rt, status)

@spec set_status(t(), status()) :: t()

Sets the agent lifecycle status.