A single tab in the tab bar.
Each tab has a unique id, a kind (:file or :agent), a display label,
and a context map that stores snapshotted per-tab state when the tab is
inactive. The active tab's context is "live" on EditorState; inactive
tabs carry a frozen snapshot that gets restored when you switch to them.
Context format
The canonical context is a flat map with workspace fields (buffers, windows,
editing state, viewport, etc.) stored directly. Restore reads only fields that exist on MingaEditor.Workspace.State; unknown legacy fields are ignored.
Summary
Types
Agent tab status (nil for file tabs).
Snapshotted per-tab state.
Workspace group id. 0 = manual/ungrouped workspace.
Unique tab identifier.
Tab kind.
A tab.
Functions
Returns true if this is an agent tab.
Returns true if this is a file tab.
Creates a new agent tab.
Creates a new file tab.
Sets the agent status on a tab (for tab bar rendering).
Sets the attention flag (agent needs user input).
Stores a context snapshot into the tab.
Sets the workspace group id.
Updates the tab's label.
Sets the session pid for an agent tab.
Types
@type agent_status() :: :idle | :thinking | :tool_executing | :error | nil
Agent tab status (nil for file tabs).
@type context() :: %{ optional(:keymap_scope) => atom(), optional(:buffers) => term(), optional(:windows) => term(), optional(:file_tree) => term(), optional(:viewport) => term(), optional(:mouse) => term(), optional(:highlight) => term(), optional(:lsp_pending) => term(), optional(:injection_ranges) => term(), optional(:search) => term(), optional(:editing) => MingaEditor.VimState.t(), optional(:document_highlights) => term(), optional(:agent_ui) => term() }
Snapshotted per-tab state.
Stores per-tab fields directly as a flat map (buffers, windows, editing, etc.). Empty context means a brand-new tab.
@type group_id() :: non_neg_integer()
Workspace group id. 0 = manual/ungrouped workspace.
@type id() :: pos_integer()
Unique tab identifier.
@type kind() :: :file | :agent
Tab kind.
@type t() :: %MingaEditor.State.Tab{ agent_status: agent_status(), attention: boolean(), context: context(), group_id: group_id(), id: id(), kind: kind(), label: String.t(), session: pid() | nil }
A tab.
Functions
Returns true if this is an agent tab.
Returns true if this is a file tab.
Creates a new agent tab.
Creates a new file tab.
@spec set_agent_status(t(), agent_status()) :: t()
Sets the agent status on a tab (for tab bar rendering).
Sets the attention flag (agent needs user input).
Stores a context snapshot into the tab.
Sets the workspace group id.
Updates the tab's label.
Sets the session pid for an agent tab.