Documentation
¶
Overview ¶
Package lab reads agent runs (a before tree, an after tree, a transcript and the inputs the agent was given) and serves them as JSON to the lab UI. An eval run folder is one source of runs, and docs/evals.md gives its format.
Index ¶
Constants ¶
const ( TranscriptFile = "transcript.jsonl" TimesFile = "transcript.times" DiffFile = "diff.patch" BeforeDir = "before" AfterDir = "after" InputsDir = "inputs" )
The run folder's layout. f10eval writes it, and lab and the report page read it.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
AtMS int64 `json:"at_ms"`
Event json.RawMessage `json:"event"`
}
An Event is one transcript event and its arrival in milliseconds since the run's first turn.
type File ¶
type File struct {
Path string `json:"path"`
Status Status `json:"status"`
Link bool `json:"link,omitempty"`
}
A File is one path of a run, slash-separated. Link is true when either side holds a symlink there, which the content is the target of.
type Line ¶
A Line is one transcript line as claude printed it, with its arrival in milliseconds since the run's first turn.
func ReadTranscript ¶
ReadTranscript is every line of dir's transcript, a bad one included, so a caller's index still matches the times file. A missing or short times file leaves the times at 0. A missing transcript is fs.ErrNotExist, because a run that failed before its first turn has none and each caller decides what that means.
type Matches ¶
Matches is a search's answer. Truncated says the limit cut it short.
type Run ¶
type Run interface {
Info() RunInfo
// Files is every path in either tree, sorted, with its status.
Files(ctx context.Context) ([]File, error)
// Content is a file as one side holds it, fs.ErrNotExist when that side
// has no such file.
Content(ctx context.Context, side Side, path string) ([]byte, error)
Transcript(ctx context.Context) ([]Event, error)
Inputs(ctx context.Context) ([]Input, error)
// Diff is the patch as the source wrote it, empty when it has none.
Diff(ctx context.Context) ([]byte, error)
}
A Run is one agent run: what the agent was handed, what it left, and how it got there.
type RunInfo ¶
type RunInfo struct {
ID string `json:"id"`
Title string `json:"title"`
Summary json.RawMessage `json:"summary,omitempty"`
}
RunInfo names a run. Summary is whatever the source keeps about the run as a whole, such as an eval report, passed to the UI as is.
type SetEntry ¶
type SetEntry struct {
File string
RunDir string
Summary json.RawMessage
}
A SetEntry is one report in a set folder. Summary is the report as written, because lab reads nothing in it but run_dir. RunDir is empty for a report from before run folders.
type Source ¶
type Source interface {
Runs(ctx context.Context) ([]RunInfo, error)
// Open returns fs.ErrNotExist for an id Runs does not list.
Open(ctx context.Context, id string) (Run, error)
}
A Source lists runs and opens them. An eval folder is one source. A task or a PR read from git will be another, so nothing here assumes a folder.