MingaEditor.Shell.Board.Card (Minga v0.1.0)

Copy Markdown View Source

A card on The Board representing an agent session or manual workspace.

Each card carries a workspace snapshot (buffers, editing state) that gets restored when the user zooms in and captured when they zoom out. This is the same pattern as tab context snapshots in Shell.Traditional.

The "You" card has session: nil and provides the traditional editing experience without an agent.

Status lifecycle

:idle  :working  :iterating  :done
                       
        :needs_you   :errored

:working means the agent is actively generating. :iterating means it's running tests or linter feedback loops. :needs_you means it hit a wall and needs human input (approval, clarifying question).

Summary

Functions

Attaches an agent session PID to the card.

Clears the stored workspace snapshot.

Creates a new card with the given attributes.

Updates the list of recently touched files.

Transitions the card to a new status.

Stores a workspace snapshot on the card.

Returns true if this is the 'You' card (manual editing).

Types

id()

@type id() :: pos_integer()

status()

@type status() :: :idle | :working | :iterating | :needs_you | :done | :errored

t()

@type t() :: %MingaEditor.Shell.Board.Card{
  created_at: DateTime.t(),
  id: id(),
  kind: :you | :agent,
  model: String.t() | nil,
  recent_files: [String.t()],
  session: pid() | nil,
  sparkline: [float()],
  status: status(),
  task: String.t(),
  workspace: map() | nil
}

Functions

attach_session(card, pid)

@spec attach_session(t(), pid()) :: t()

Attaches an agent session PID to the card.

clear_workspace(card)

@spec clear_workspace(t()) :: t()

Clears the stored workspace snapshot.

new(id, attrs \\ [])

@spec new(
  id(),
  keyword()
) :: t()

Creates a new card with the given attributes.

set_recent_files(card, files)

@spec set_recent_files(t(), [String.t()]) :: t()

Updates the list of recently touched files.

set_status(card, status)

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

Transitions the card to a new status.

store_workspace(card, workspace)

@spec store_workspace(t(), map()) :: t()

Stores a workspace snapshot on the card.

you_card?(card)

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

Returns true if this is the 'You' card (manual editing).