MingaEditor.Window.Content (Minga v0.1.0)

Copy Markdown View Source

Polymorphic content reference for window panes.

A window can host any content type: a file buffer, an agent chat session, a terminal, etc. This module defines the authoritative tagged union for window content identity.

Why a tagged tuple instead of a protocol?

Window content references are stored in the window tree, serialized for tab save/restore, and pattern-matched in the render pipeline. A simple tagged tuple ({:buffer, pid}, {:agent, session_ref}) is easier to serialize, pattern-match, and debug than a protocol struct. This module handles only identity/reference polymorphism.

Content types

TagReferenceEditable?
:bufferpid() (Buffer.Process)Yes
:agent_chat:semanticNo
:empty:semanticNo

:empty is the zero-buffers launchpad surface (#2689): the window stays open with no backing buffer, and the frontends render the semantic launchpad frame natively. Only these tags are implemented today. Add future content types when they ship.

Summary

Types

t()

A content reference identifying what a window pane displays.

Functions

Creates a semantic agent chat content reference.

Returns true if this content reference is an agent chat.

Creates a buffer content reference.

Returns true if this content reference is a file buffer.

Returns the buffer pid if this is a buffer content reference, nil otherwise.

Returns true if the content is editable (supports insert mode).

Creates a semantic empty-state (launchpad) content reference.

Returns true if this content reference is the empty-state launchpad.

Returns the underlying pid for any content type.

Types

t()

@type t() :: {:buffer, pid()} | {:agent_chat, :semantic} | {:empty, :semantic}

A content reference identifying what a window pane displays.

Functions

agent_chat()

@spec agent_chat() :: t()

Creates a semantic agent chat content reference.

agent_chat?(arg1)

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

Returns true if this content reference is an agent chat.

buffer(pid)

@spec buffer(pid()) :: t()

Creates a buffer content reference.

buffer?(arg1)

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

Returns true if this content reference is a file buffer.

buffer_pid(arg1)

@spec buffer_pid(t()) :: pid() | nil

Returns the buffer pid if this is a buffer content reference, nil otherwise.

editable?(arg1)

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

Returns true if the content is editable (supports insert mode).

empty()

@spec empty() :: t()

Creates a semantic empty-state (launchpad) content reference.

empty?(arg1)

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

Returns true if this content reference is the empty-state launchpad.

pid(arg1)

@spec pid(t()) :: pid() | nil

Returns the underlying pid for any content type.

For :buffer, this is the Buffer.Process pid. Semantic panes (agent chat, empty state) have no underlying buffer pid.