transcript

package
v1.79.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package transcript provides an embeddable chat transcript: an ordered list of messages, each rendered by docker-agent's own message and tool components, stitched together with the same grouping rules as the full message list.

It is the reusable subset of pkg/tui/components/messages for hosts that bring their own scrolling, selection, and dialog framework (e.g. the Gordon assistant embedded in the Docker Sandboxes TUI): no scrollbar, no mouse selection, no inline edits, no session/service coupling — just the message store, the per-message views, and their lifecycle (streaming appends, tool status updates, theme rebuilds, animation cleanup).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transcript

type Transcript struct {
	// contains filtered or unexported fields
}

Transcript is the chat history. The zero value is not usable; create one with New. It is not safe for concurrent use: like every Bubble Tea model, it must only be touched from the program's update loop.

func New

New creates an empty transcript. The session state is consulted by the tool views for rendering preferences; embedders without one should pass a service.StaticSessionState.

func (*Transcript) AddOrUpdateToolCall

func (t *Transcript) AddOrUpdateToolCall(agentName string, toolCall tools.ToolCall, toolDef tools.Tool, status types.ToolStatus) tea.Cmd

AddOrUpdateToolCall surfaces a tool call: an existing entry with the same call ID has its status and streamed arguments updated, otherwise a new entry replaces any trailing waiting spinner. The same semantics as the message list's AddOrUpdateToolCall, without reasoning blocks.

func (*Transcript) Append

func (t *Transcript) Append(msg *types.Message) tea.Cmd

Append adds a message and returns the new view's Init command (spinner and running-tool views use it to start the animation tick stream).

func (*Transcript) AppendToLastMessage

func (t *Transcript) AppendToLastMessage(agentName, content string) tea.Cmd

AppendToLastMessage grows the most recent message with streamed reply text when it is an assistant message from the given agent, or appends a fresh assistant message otherwise (including into an empty transcript, where the full message list would drop the text instead). A trailing waiting spinner is replaced. The message view re-renders incrementally: its internal markdown renderer only re-parses the trailing block.

func (*Transcript) FinalizeToolCalls

func (t *Transcript) FinalizeToolCalls(status types.ToolStatus)

FinalizeToolCalls flips any tool entry still pending, running, or waiting for confirmation to the given terminal status. Defensive: a stream error (or a missed response event) must not leave an entry spinning forever.

func (*Transcript) LastIs

func (t *Transcript) LastIs(typ types.MessageType) bool

LastIs reports whether the most recent message has the given type.

func (*Transcript) Messages

func (t *Transcript) Messages() []*types.Message

Messages returns the transcript's messages, oldest first. The slice is the transcript's own backing store: callers must treat it as read-only (mutating entries would desync them from their rendered views). It gives embedders observability — host tests asserting on conversation structure, or persistence of the chat — without growing the mutation surface.

func (*Transcript) Rebuild

func (t *Transcript) Rebuild() tea.Cmd

Rebuild recreates every view from its message, dropping all cached rendered output. Use it on theme change: the views memoize rendered ANSI, so a style swap must start from scratch. Returns the new views' Init commands (re-arming spinner animations).

func (*Transcript) RemoveLast

func (t *Transcript) RemoveLast(typ types.MessageType)

RemoveLast drops the most recent message when it has the given type, stopping its animation subscription (mirrors the message list's RemoveSpinner contract: leaked subscriptions keep the tick stream alive).

func (*Transcript) Render

func (t *Transcript) Render(width int) string

Render renders the whole transcript at the given width, stitching the views together the way the message list does: each view contributes its lines, with one blank separator line between messages — except between consecutive tool calls, which group tightly.

func (*Transcript) SetToolStatus

func (t *Transcript) SetToolStatus(callID string, status types.ToolStatus) (tea.Cmd, bool)

SetToolStatus updates the status of the tool call with the given ID, reporting whether an entry was found. The view is recreated so no memoized rendering of the previous status can survive the update.

func (*Transcript) StopAnimations

func (t *Transcript) StopAnimations()

StopAnimations unregisters every view from the animation coordinator. Call it when the host view goes away (e.g. the embedding dialog closes) so abandoned spinners do not keep the tick stream alive; Rebuild re-arms them on the next open.

func (*Transcript) Update

func (t *Transcript) Update(msg tea.Msg) tea.Cmd

Update forwards a message (animation ticks) to all views.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL