Domain model for an editor workspace.
A workspace owns a task context. The manual workspace represents project-owned file work, while agent workspaces attach one optional agent session and later become the home for workspace files, agent UI, ProjectView, and review state.
Summary
Types
Agent status for workspace display.
Remote connection status for workspace-owned remote sessions.
Workspace icon identifier.
Workspace kind.
A workspace domain object.
Functions
Adds a file membership to the workspace, preserving existing membership order.
Auto-names an agent workspace from an agent prompt unless the user renamed it.
Clears queued remote catch-up events after they have been replayed.
Clears durable remote metadata. Use only when the workspace no longer represents a remote session.
Clears the live agent session pid and returns the workspace to idle lifecycle status. Durable remote identity is preserved.
Releases the workspace's owned ProjectView resources, if any.
Restores a workspace from persisted JSON data, ignoring unknown fields and using defaults for missing fields.
Returns true when the workspace already contains the file membership.
Returns true when the workspace represents the remote server/session pair.
Creates a new agent workspace with a unique id.
Creates the manual project workspace.
Returns true when the workspace still has a live ProjectView.
Sets durable remote metadata from its fields.
Rebinds the active file membership from one logical file ref to another.
Refreshes the workspace session pid after a managed restart.
Returns true when the workspace has durable remote metadata.
Returns true when the workspace belongs to the named remote server.
Removes a file membership from the workspace.
Renames the workspace and protects it from future auto-naming.
Retargets a file membership for a tab, preserving unrelated active file state.
Returns true when drafts or conflicts require user action before close.
Sets the active file membership for the workspace.
Sets the agent status on the workspace.
Sets the workspace-owned agent UI projection.
Sets the workspace icon.
Sets queued remote catch-up events waiting for the workspace to become active.
Sets the ProjectView owned by the workspace.
Updates durable remote connection status when the workspace has remote metadata.
Sets durable remote metadata on the workspace.
Sets review state through the owning workspace module.
Sets the session owned by the workspace.
Serializes the persisted workspace fields to a JSON-ready map.
Moves review state through a legal transition.
Returns a copy scoped to a project root for persistence.
Types
@type agent_status() ::
:idle
| :plan
| :thinking
| :tool_executing
| :error
| :stopped
| :needs_review
| :done
| nil
Agent status for workspace display.
@type connection_status() :: MingaEditor.State.Workspace.RemoteSession.connection_status()
Remote connection status for workspace-owned remote sessions.
@type icon() :: String.t()
Workspace icon identifier.
@type kind() :: :manual | :agent
Workspace kind.
@type t() :: %MingaEditor.State.Workspace{ active_file: Minga.Project.FileRef.t() | nil, agent_status: agent_status(), agent_ui: MingaEditor.Agent.UIState.t() | nil, color: non_neg_integer(), custom_name: String.t() | nil, files: [Minga.Project.FileRef.t()], icon: icon(), id: non_neg_integer(), kind: kind(), label: String.t(), pending_catchup_events: [MingaAgent.EventLog.EventRecord.t()], project_root: String.t() | nil, project_view: MingaAgent.ProjectView.t() | nil, remote_session: MingaEditor.State.Workspace.RemoteSession.t() | nil, review: MingaEditor.State.WorkspaceReview.t(), session: pid() | nil }
A workspace domain object.
Functions
@spec add_file(t(), Minga.Project.FileRef.t()) :: t()
Adds a file membership to the workspace, preserving existing membership order.
Auto-names an agent workspace from an agent prompt unless the user renamed it.
Clears queued remote catch-up events after they have been replayed.
Clears durable remote metadata. Use only when the workspace no longer represents a remote session.
Clears the live agent session pid and returns the workspace to idle lifecycle status. Durable remote identity is preserved.
Releases the workspace's owned ProjectView resources, if any.
Restores a workspace from persisted JSON data, ignoring unknown fields and using defaults for missing fields.
@spec has_file?(t(), Minga.Project.FileRef.t()) :: boolean()
Returns true when the workspace already contains the file membership.
Returns true when the workspace represents the remote server/session pair.
@spec new_agent(pos_integer(), String.t(), pid() | nil, String.t() | nil) :: t()
Creates a new agent workspace with a unique id.
Creates the manual project workspace.
Returns true when the workspace still has a live ProjectView.
@spec put_remote_session( t(), String.t(), String.t(), connection_status(), non_neg_integer() ) :: t()
Sets durable remote metadata from its fields.
@spec rebind_file(t(), Minga.Project.FileRef.t() | nil, Minga.Project.FileRef.t()) :: t()
Rebinds the active file membership from one logical file ref to another.
Refreshes the workspace session pid after a managed restart.
Returns true when the workspace has durable remote metadata.
Returns true when the workspace belongs to the named remote server.
@spec remove_file(t(), Minga.Project.FileRef.t()) :: t()
Removes a file membership from the workspace.
Renames the workspace and protects it from future auto-naming.
@spec retarget_file( t(), Minga.Project.FileRef.t() | nil, Minga.Project.FileRef.t(), boolean() ) :: t()
Retargets a file membership for a tab, preserving unrelated active file state.
Returns true when drafts or conflicts require user action before close.
@spec set_active_file(t(), Minga.Project.FileRef.t() | nil) :: t()
Sets the active file membership for the workspace.
@spec set_agent_status(t(), agent_status()) :: t()
Sets the agent status on the workspace.
@spec set_agent_ui(t(), MingaEditor.Agent.UIState.t() | nil) :: t()
Sets the workspace-owned agent UI projection.
Sets the workspace icon.
@spec set_pending_catchup_events(t(), [MingaAgent.EventLog.EventRecord.t()]) :: t()
Sets queued remote catch-up events waiting for the workspace to become active.
@spec set_project_view(t(), MingaAgent.ProjectView.t() | nil) :: t()
Sets the ProjectView owned by the workspace.
@spec set_remote_connection_status(t(), connection_status()) :: t()
Updates durable remote connection status when the workspace has remote metadata.
@spec set_remote_session(t(), MingaEditor.State.Workspace.RemoteSession.t() | nil) :: t()
Sets durable remote metadata on the workspace.
@spec set_review(t(), MingaEditor.State.WorkspaceReview.t()) :: t()
Sets review state through the owning workspace module.
Sets the session owned by the workspace.
Serializes the persisted workspace fields to a JSON-ready map.
@spec transition_review(t(), atom(), [Minga.Project.FileRef.t()] | nil | term()) :: {:ok, t()} | {:error, term()}
Moves review state through a legal transition.
Returns a copy scoped to a project root for persistence.