transcriptstore

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package transcriptstore persists an agent run's conversation and reads it back: one gzipped-JSONL ConfigMap per run, owned by the run that produced it. The owner reference is the whole retention mechanism: a run is owned by its Finding, so a Finding deleted on TTL cascades to the run and then to its transcript, and this package needs no expiry logic.

It is separate from internal/transcript because that package (the vocabulary and the wire format) runs inside the agent pod, which holds no Kubernetes credential and must not link a client. This package is the controller and status-server half.

Index

Constants

View Source
const DataKey = "turns.jsonl.gz"

DataKey holds the gzipped JSONL turns in the ConfigMap's binaryData. binaryData rather than data: agent output is arbitrary text, and gzip also buys roughly an order of magnitude of headroom under the 1 MiB object cap.

Variables

This section is empty.

Functions

func ConfigMap

func ConfigMap(namespace string, labels map[string]string, owner client.Object,
	gvk metav1.TypeMeta, turns []transcript.Turn) (*corev1.ConfigMap, error)

ConfigMap builds the transcript object for a run child.

func FromConfigMap

func FromConfigMap(cm *corev1.ConfigMap) ([]transcript.Turn, error)

FromConfigMap reads the turns out of a transcript object. A missing key yields no turns and no error, so an object written by a different version of this package degrades to an empty conversation rather than an error.

func Load

func Load(ctx context.Context, r client.Reader, namespace, name string) ([]transcript.Turn, error)

Load reads a persisted transcript. A missing object yields no turns and no error: playback of an absent transcript is an empty conversation, not a failure.

func Marshal

func Marshal(turns []transcript.Turn) ([]byte, error)

Marshal renders turns as gzipped JSONL.

func NameFor

func NameFor(child string) string

NameFor returns the transcript ConfigMap name for a run child.

func Persist

func Persist(ctx context.Context, c client.Client, namespace string, labels map[string]string,
	owner client.Object, gvk metav1.TypeMeta, turns []transcript.Turn) (*v1alpha1.TranscriptRef, error)

Persist writes a run's transcript and returns the reference to record on the run's status. No turns means no object and a nil reference: a harness that cannot transcribe, or a run that died before speaking, is not an error.

The live stream carries far more than a ConfigMap can hold, so the turns are first compacted to the store bounds (transcript.Compact). The stored record is a bounded summary (head, tail, and an elision notice) whatever the run streamed.

The write is idempotent: a re-collected run overwrites its own transcript rather than failing on the object it already wrote.

func Unmarshal

func Unmarshal(raw []byte) ([]transcript.Turn, error)

Unmarshal recovers turns from gzipped JSONL. Malformed trailing data ends the read without failing: a transcript is evidence, and a partial one is worth more than an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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