transcript

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package transcript renders one beam session's ordered record — user turns, streamed assistant prose, thought traces, tool-call cards, mission reports and lifecycle cards, shell output and turn notices — as frame data. Settled content is appended once to real scrollback and never repainted (never laid out against a width, so it never re-flows on resize); only the bounded live region redraws. A line settles when it can no longer change: a streamed source line on its newline, a tool card on terminal status, a complete-on-arrival event (report, echo, notice) immediately.

Index

Constants

View Source
const (
	ASCIIDone   = "+" // completed — style.GlyphSet.Check
	ASCIIFailed = "x" // failed — style.GlyphSet.Cross
	ASCIIUser   = ">" // the user-turn sigil — style.GlyphSet.Collapsed
)

The ASCII glyphs this component draws, exported so testkit's parity test can pin them against the style package's GlyphSet: components may not import style, so the two ASCII vocabularies are held together only by a test that sees both.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transcript

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

Transcript is the transcript state machine. The zero value is not usable; call New. It is not safe for concurrent use — the app loop owns it, in the same goroutine that drains the bridge.

func New

func New() *Transcript

New returns an empty transcript.

func (*Transcript) Apply

func (t *Transcript) Apply(ev enginebridge.Event)

Apply folds one bridge event into the transcript state; events that are not transcript facts are ignored, so a caller may hand it the whole stream. It never renders and never depends on width. Every string is run through sanitize at arrival, not at render, so no unit downstream can forget to: sanitize.Lines where structure survives, sanitize.Line where it becomes a single span.

func (*Transcript) EndReplay

func (t *Transcript) EndReplay()

EndReplay settles everything a history replay left open. A session/load replay ends with no TurnEnded, so the last replayed message and any mid-flight tool call would otherwise dangle in the live region forever. Must be called after the replayed events are applied; a live turn afterwards opens a new message as usual.

func (*Transcript) HasOpenWork

func (t *Transcript) HasOpenWork() bool

HasOpenWork reports whether the transcript is waiting on the agent: a message is streaming, or a tool call has not reached a terminal status. A shell tail does not count, or a lingering shell prompt would pin an indicator on forever.

func (*Transcript) Live

func (t *Transcript) Live(width int, ascii bool, spinnerGlyph string) []frame.Line

Live renders the in-progress tail: the streaming message's unflushed line, the shell's unflushed line, and one collapsed line per open tool call. spinnerGlyph marks calls actually running; empty falls back to the static pending glyph. Rebuilt every call, so it re-wraps on resize for free; row-addressed rows are truncated rather than soft-wrapped, the opposite of TakeAppends. Returns nil when nothing is in progress.

func (*Transcript) TakeAppends

func (t *Transcript) TakeAppends(width int, ascii bool) []frame.Line

TakeAppends renders and hands over every line that settled since the last call, in arrival order, draining the queue; width and ascii are final for those lines. Returns nil when nothing settled. width never wraps prose — one source line stays one output line, letting the terminal soft-wrap it — but still governs what truncates (a tool card) and notice chrome.

Jump to

Keyboard shortcuts

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