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 tagged union that replaces the
old buffer: pid() field on Window.t().
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. The
NavigableContent protocol handles the behavioral polymorphism; this
module handles the identity/reference polymorphism.
Content types
| Tag | Reference | NavigableContent? | Editable? |
|---|---|---|---|
:buffer | pid() (Buffer.Server) | Yes (via BufferSnapshot) | Yes |
:agent_chat | pid() (Agent.Session) | Yes | No |
:agent_prompt | pid() (Buffer.Server) | Yes (via BufferSnapshot) | Yes |
:terminal | pid() (future, #122) | Yes (future) | No |
:browser | reference() (future, #305) | Yes (future) | No |
Only :buffer is implemented today. Other tags are documented here to
show the design direction and will be added as their features land.
Summary
Functions
Creates an agent chat content reference. The pid is the agent's *Agent* Buffer.Server.
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).
Returns the underlying pid for any content type.
Types
Functions
Creates an agent chat content reference. The pid is the agent's *Agent* Buffer.Server.
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).
Returns the underlying pid for any content type.
For :buffer, this is the Buffer.Server pid. For :agent_chat, this
is the agent's *Agent* Buffer.Server pid (used for cursor/scroll).