transcripts

package
v0.175.0-rc.118 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 17 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 transcripts collects, redacts, indexes and searches session transcripts across harnesses (claude, agy, codex, omp) and execution hosts.

Index

Constants

View Source
const (
	RoleUser      = "user"
	RoleAssistant = "assistant"
	RoleTool      = "tool"
)

Roles of stored transcript turns.

Variables

This section is empty.

Functions

func Allowed

func Allowed(caller Caller, meta Meta, grants []state.TranscriptGrant, now time.Time) bool

Allowed reports whether caller may read or search meta at now.

func ExtractRefs

func ExtractRefs(text string) []string

ExtractRefs extracts canonical "owner/repo#n" references from text.

func GrantAppliesTo

func GrantAppliesTo(g state.TranscriptGrant, caller Caller) bool

GrantAppliesTo reports whether grant g was issued to caller.

func NormalizeRef

func NormalizeRef(s string) string

NormalizeRef converts a GitHub issue/PR URL or owner/repo#n string into canonical "owner/repo#n" form; returns "" when s is neither.

func RepoOfRef

func RepoOfRef(ref string) string

RepoOfRef returns the "owner/repo" prefix of a normalized ref ("owner/repo#n").

func SafeKey

func SafeKey(harness, host, id string) string

SafeKey builds a flat filename-safe key for a session transcript.

Types

type Caller

type Caller struct {
	Party      state.Party
	RosterName string
	Execution  string
	Role       string // "guide", "worker", or ""
	Repo       string // worker's repository (owner/repo)
	IsGuide    bool   // true when caller holds the guide role or is an unmanaged operator CLI call
}

Caller describes the session or operator requesting transcript access.

type Meta

type Meta struct {
	Key          string    `json:"key"`
	ID           string    `json:"id,omitempty"`
	HostSession  string    `json:"hostSession,omitempty"`
	Execution    string    `json:"execution,omitempty"`
	Name         string    `json:"name,omitempty"`
	RosterName   string    `json:"rosterName,omitempty"`
	Role         string    `json:"role,omitempty"`
	Repo         string    `json:"repo,omitempty"`
	Ref          string    `json:"ref,omitempty"`
	Refs         []string  `json:"refs,omitempty"`
	Harness      string    `json:"harness"`
	Host         string    `json:"host"`
	Cwd          string    `json:"cwd,omitempty"`
	Model        string    `json:"model,omitempty"`
	Running      bool      `json:"running,omitempty"`
	StartedAt    time.Time `json:"startedAt,omitzero"`
	LastActive   time.Time `json:"lastActive,omitzero"`
	EndedAt      time.Time `json:"endedAt,omitzero"`
	Turns        int       `json:"turns"`
	Bytes        int64     `json:"bytes"`
	SourcePath   string    `json:"sourcePath,omitempty"`
	SourceMod    time.Time `json:"sourceMod,omitzero"`
	SourceSize   int64     `json:"sourceSize,omitempty"`
	RemoteCursor string    `json:"remoteCursor,omitempty"`
}

Meta is the persisted metadata of one session's transcript in the store. It survives the session ending or leaving the roster.

func Filter

func Filter(metas []Meta, caller Caller, grants []state.TranscriptGrant, now time.Time) []Meta

Filter returns the subset of metas that caller is allowed to read or search at now.

func Resolve

func Resolve(metas []Meta, query string) (Meta, error)

Resolve finds the transcript matching query among metas (which should already be filtered for caller access and sorted most-recent first).

func (Meta) DisplayName

func (m Meta) DisplayName() string

DisplayName is the most descriptive human-readable name for the session.

func (Meta) ExactMatch

func (m Meta) ExactMatch(q string) bool

ExactMatch reports whether q equals one of m's identifiers or names.

func (Meta) Matches

func (m Meta) Matches(q string) bool

Matches reports whether q (a session name, roster name, id, execution id, key or issue/pull-request reference) identifies m.

type Parsed

type Parsed struct {
	SessionID  string
	Title      string
	Cwd        string
	Model      string
	Repo       string
	Refs       []string
	StartedAt  time.Time
	LastActive time.Time
	Turns      []Turn
}

Parsed holds the turns and metadata extracted from a harness transcript file or remote execution stream.

func ParseFile

func ParseFile(harness, path string) (Parsed, error)

ParseFile parses a transcript file at path according to harness ("claude", "agy", "codex", "omp").

func ParseRemoteStream

func ParseRemoteStream(harness string, raw []byte, prompts []Turn) Parsed

ParseRemoteStream parses a remote execution log stream (along with any initial/delivered prompt turns from the coordinator's ExecutionRecord).

type ReadOptions

type ReadOptions struct {
	Last    int
	Tools   bool
	Results bool
}

ReadOptions controls which turns ReadTurns returns.

type SearchHit

type SearchHit struct {
	Meta      Meta   `json:"meta"`
	TurnIndex int    `json:"turnIndex"`
	Turn      Turn   `json:"turn"`
	Snippet   string `json:"snippet"`
}

SearchHit is one matching turn from Search.

type SearchOptions

type SearchOptions struct {
	Repo    string
	Harness string
	Host    string
	Ref     string
	Session string
	Since   time.Time
	Tools   bool
	Results bool
	Limit   int
}

SearchOptions filters and bounds a transcript search.

type Store

type Store struct {
	Root   string
	Redact func(string) string
}

Store manages the coordinator's transcript directory (<stateDir>/transcripts).

func (Store) AppendRemoteLog

func (s Store) AppendRemoteLog(meta Meta, chunk []byte, nextCursor string, prompts []Turn) (Meta, error)

AppendRemoteLog appends a page of an SSH execution's stream log (after redacting secret values), reparses the accumulated stream with any prompt turns from the execution record, and updates the stored transcript. The chunk ends at a record boundary: redaction matches whole records only, so a secret split across two chunks would reach the raw stream unmasked.

func (Store) IngestFile

func (s Store) IngestFile(meta Meta, path string) (Meta, bool, error)

IngestFile parses a local harness transcript at path and saves it into the store. If path's size and modification time match what is already stored for meta.Key, only changed metadata fields are updated.

func (Store) List

func (s Store) List() ([]Meta, error)

List returns all stored transcript metadata entries, most recently active first.

func (Store) ReadMeta

func (s Store) ReadMeta(key string) (Meta, bool, error)

ReadMeta reads the stored Meta for key; found is false when absent.

func (Store) ReadTurns

func (s Store) ReadTurns(key string, opts ReadOptions) ([]Turn, error)

ReadTurns reads the stored turns of key according to opts.

func (Store) Save

func (s Store) Save(meta Meta, turns []Turn) (Meta, error)

Save redacts turns, merges metadata with any prior record for meta.Key, and atomically writes both <key>.jsonl and <key>.json.

func (Store) Search

func (s Store) Search(metas []Meta, query string, opts SearchOptions) ([]SearchHit, error)

Search searches accessible transcripts (metas) for query.

func (Store) UpdateMeta

func (s Store) UpdateMeta(meta Meta) (Meta, error)

UpdateMeta updates stored metadata for meta.Key without rewriting its turns.

type Turn

type Turn struct {
	At     time.Time `json:"at,omitzero"`
	Role   string    `json:"role"`
	Tool   string    `json:"tool,omitempty"`
	Text   string    `json:"text"`
	Result string    `json:"result,omitempty"`
	// Phase is a Codex assistant message's phase ("commentary",
	// "final_answer"), empty where the harness names none.
	Phase string `json:"phase,omitempty"`
}

Turn is one conversational or tool turn in a stored transcript.

Jump to

Keyboard shortcuts

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