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
- func ConfigMap(namespace string, labels map[string]string, owner client.Object, ...) (*corev1.ConfigMap, error)
- func FromConfigMap(cm *corev1.ConfigMap) ([]transcript.Turn, error)
- func Load(ctx context.Context, r client.Reader, namespace, name string) ([]transcript.Turn, error)
- func Marshal(turns []transcript.Turn) ([]byte, error)
- func NameFor(child string) string
- func Persist(ctx context.Context, c client.Client, namespace string, ...) (*v1alpha1.TranscriptRef, error)
- func Unmarshal(raw []byte) ([]transcript.Turn, error)
Constants ¶
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 ¶
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 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.
Types ¶
This section is empty.