Skip to main content

Module transcript_view

Module transcript_view 

Source
Expand description

Transport-agnostic transcript rendering.

This is the shared render layer behind unification (“only the transport differs”): both the local interactive TUI (driven by in-process AgentEvents) and the remote client (driven by wire RemoteEvents) build their transcript from the same pi-tui components — an AssistantMessageComponent per assistant message, a ToolExecutionComponent per tool call, a BashExecutionComponent per bash run, and user bubbles. Each side maps its native event stream into the provider-free UiEvent enum and feeds it to TranscriptView; the view holds the live component maps and updates them in place.

Keeping this provider-free (only pi-tui + serde_json::Value) is what lets the local host and the remote client share it without dragging rpi_agent types into the client.

Structs§

TranscriptView
The retained transcript: the same component maps the local TuiState holds, so a streaming assistant message and each tool/bash panel are updated in place rather than rebuilt per event.
UiToolCall
A tool call visible in an assistant message snapshot, normalized to plain data so both the local (rpi_ai::Content::ToolCall) and the wire ({"type":"toolCall",…}) shapes map onto it.

Enums§

UiEvent
A normalized transcript event. Both the local AgentEvent stream and the remote RemoteEvent stream are projected into this enum before rendering.

Functions§

assistant_blocks_from_value
Map a wire/local assistant message’s content blocks into the provider-free AssistantBlock list the shared component renders (text + thinking + decoded image blocks, in document order).
skill_tool_name
The skill name when tool_name is a read of a SKILL.md file (the SKILL.md parent directory’s basename), else None. A skill read renders as upstream’s [skill] <name> box.
tool_calls_from_value
Extract the finalized tool calls (type: "toolCall") from an assistant message value, in document order.
tool_result_requests_markdown
Whether a tool result opts into markdown rendering of its body (details.markdown = true).
tool_result_text
Text out of a wire tool-result payload ({content:[{type:"text",text}]}).

Type Aliases§

MarkdownTransformer
A sync Fn(&str) -> String applied to raw assistant markdown. Kept as a trait object so this crate stays free of any plugin types.