# `MingaEditor.Agent.Transcript`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/agent/transcript.ex#L1)

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.

# `display_result`

```elixir
@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()]
}
```

# `empty_state`

```elixir
@type empty_state() :: :credentials_missing | :no_model | nil
```

# `line_offset`

```elixir
@type line_offset() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
```

Line offset: {message_index, start_line, line_count}

# `line_type`

```elixir
@type line_type() :: :text | :code | :tool | :thinking | :usage | :system | :empty
```

Line type for transcript-line-to-message mapping.

# `display`

```elixir
@spec display(
  [term()],
  keyword()
) :: display_result()
```

Builds displayed semantic transcript metadata from raw session messages.

# `line_message_index`

```elixir
@spec line_message_index([term()]) :: [{non_neg_integer(), line_type()}]
```

Builds a per-line index mapping transcript lines to message indices and line types.

# `message_start_line`

```elixir
@spec message_start_line([term()], non_neg_integer()) :: non_neg_integer() | nil
```

Returns the semantic transcript line where a message starts.

# `messages_to_markdown_with_offsets`

```elixir
@spec messages_to_markdown_with_offsets([term()]) :: {String.t(), [line_offset()]}
```

Converts transcript messages to plain markdown text and line offsets.

# `turn_anchor_id`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
