Documentation
¶
Overview ¶
Package transcript is the agent conversation contract: the harness-neutral turn vocabulary every agent CLI's stream is projected onto, the prefixed JSONL line format that carries turns out of the agent pod on stdout, and the gzipped ConfigMap the owning controller persists them into.
Turns ride the same stdout as the envelope's stage results but under their own prefix, so the two streams stay disjoint: a run emits hundreds of turns and one result, and the controller's result path must not have to walk the former to find the latter.
The in-pod recorder and the status server both round-trip through this package, so the capture and playback shapes cannot drift.
Index ¶
Constants ¶
const ( DefaultMaxTurnBytes = 2048 DefaultMaxTurns = 500 DefaultMaxTotalBytes = 512 << 10 )
Recording bounds. A transcript is persisted in a ConfigMap, so the total is sized to leave headroom under the 1 MiB object cap even before gzip; the per-turn cap keeps one runaway tool result from consuming the whole budget.
const Prefix = "PATCHY-TURN: "
Prefix marks a turn line on the agent-runner's stdout. It is deliberately distinct from envelope.Prefix: the controller's result path scans for stage results, and a run's few hundred turns must not ride that slice.
const Redacted = "«redacted»"
Redacted replaces any credential value found in captured text.
const Version = 1
Version is the current turn schema version.
Variables ¶
This section is empty.
Functions ¶
func HasPrefix ¶
HasPrefix reports whether a log line is a turn line. Callers scanning for some other prefix use it to skip turns cheaply, without a full decode.
func Truncate ¶
Truncate caps s at limit bytes on a rune boundary (the API server rejects invalid UTF-8, and a turn is stored in a ConfigMap). It reports whether it cut anything.
Types ¶
type Limits ¶
Limits bounds one recording. A zero field takes the package default; a negative field disables that bound.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder normalises, bounds, redacts, and sequences the turns of one run. It is the single gate every captured turn passes through, so the live stream and the persisted transcript can never disagree.
Recorder is safe for concurrent use, though the runner's line observer calls it from one goroutine.
func NewRecorder ¶
NewRecorder returns a recorder that hands each admitted turn to emit. secrets are literal credential values scrubbed from every captured field: the pod holds the model API key and a tool result can echo the environment.
func (*Recorder) Notice ¶
Notice emits a recorder-voiced turn — a budget abort, a stage banner. It is bounded like any other turn but is never itself the cause of truncation.
func (*Recorder) Record ¶
Record admits one turn: it stamps the sequence and time, redacts, caps the text, and emits. Turns arriving after a bound is hit are dropped, and the first drop emits a closing notice so the reader knows the record is partial.
type Turn ¶
type Turn struct {
V int `json:"v"`
Seq int `json:"seq"`
At string `json:"at,omitempty"`
Role Role `json:"role"`
Kind Kind `json:"kind"`
Tool string `json:"tool,omitempty"`
Text string `json:"text,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
Turn is one entry in an agent's conversation, normalised across harnesses. Text carries the message body, the tool invocation's rendered input, or the tool result's excerpt depending on Kind; Truncated reports that the recorder capped it.