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
| Tag | Reference | Editable? |
|---|---|---|
:buffer | pid() (Buffer.Process) | Yes |
:agent_chat | :semantic | No |
:empty | :semantic | No |
: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
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
@type t() :: {:buffer, pid()} | {:agent_chat, :semantic} | {:empty, :semantic}
A content reference identifying what a window pane displays.
Functions
@spec agent_chat() :: t()
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).
@spec empty() :: t()
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.
For :buffer, this is the Buffer.Process pid. Semantic panes (agent
chat, empty state) have no underlying buffer pid.