Pure semantic transcript projection for agent chat.
The visible transcript is carried in Minga.RenderModel.UI.AgentChat.resident_messages and transported by gui_agent_transcript (0x86); gui_agent_chat (0x78) carries only chrome state. This module computes the transcript metadata that commands still need: displayed message windows, stable message ids, line-to-message lookup, code-block line classification, and provenance anchors.
Summary
Types
Line offset: {message_index, start_line, line_count}
Line type for transcript-line-to-message mapping.
Functions
Builds displayed semantic transcript metadata from raw session messages.
Builds a per-line index mapping transcript lines to message indices and line types.
Returns the semantic transcript line where a message starts.
Converts transcript messages to plain markdown text and line offsets.
Resolves the stable message id that should anchor a provenance jump for a tool call.
Types
@type display_result() :: %{ line_index: [{non_neg_integer(), line_type()}], display_messages: [term()], display_message_pairs: [{pos_integer(), term()}], markdown: String.t(), line_offsets: [line_offset()] }
@type empty_state() :: :credentials_missing | :no_model | nil
@type line_offset() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
Line offset: {message_index, start_line, line_count}
@type line_type() :: :text | :code | :tool | :thinking | :usage | :system | :empty
Line type for transcript-line-to-message mapping.
Functions
@spec display( [term()], keyword() ) :: display_result()
Builds displayed semantic transcript metadata from raw session messages.
@spec line_message_index([term()]) :: [{non_neg_integer(), line_type()}]
Builds a per-line index mapping transcript lines to message indices and line types.
@spec message_start_line([term()], non_neg_integer()) :: non_neg_integer() | nil
Returns the semantic transcript line where a message starts.
@spec messages_to_markdown_with_offsets([term()]) :: {String.t(), [line_offset()]}
Converts transcript messages to plain markdown text and line offsets.
@spec turn_anchor_id([{pos_integer(), term()}], String.t()) :: pos_integer() | nil
Resolves the stable message id that should anchor a provenance jump for a tool call.