history

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package history reads the sofia call log and surfaces invocation history. Three views are supported:

  • recent (default): chronological list of last N calls.
  • --stats: per-tool aggregates (count, errors, duration percentiles, output bytes/tokens, top inputs).
  • --histogram=hour|day: distribution of calls by time bucket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

NewCommand returns the `sf history` Cobra command.

Types

type AdoptionRow

type AdoptionRow struct {
	Tag       string  `json:"tag"`
	Source    string  `json:"source"`
	Calls     int     `json:"calls"`
	Sessions  int     `json:"sessions"` // distinct non-empty session ids
	Errors    int     `json:"errors"`
	FailedPct float64 `json:"failed_pct"`
	Tokens    int64   `json:"out_tokens"`
}

AdoptionRow aggregates one project×source cell: how much that project's agent/manual traffic actually exercises sf, and how reliably.

type Aggregate

type Aggregate struct {
	Tool        string `json:"tool"`
	Calls       int    `json:"calls"`
	Errors      int    `json:"errors"`
	TotalMs     int64  `json:"total_ms"`
	MeanMs      int64  `json:"mean_ms"`
	P50Ms       int64  `json:"p50_ms"`
	P95Ms       int64  `json:"p95_ms"`
	MaxMs       int64  `json:"max_ms"`
	TotalBytes  int64  `json:"total_out_bytes"`
	TotalTokens int64  `json:"total_out_tokens"`
	First       string `json:"first"`
	Last        string `json:"last"`
}

Aggregate is one row of the per-tool stats view.

type Filter

type Filter struct {
	Tool       string
	Since      time.Time
	Source     string // "", "agent", "manual", "test" — empty = all
	Session    string // prefix-match on the session id (sid); empty = all
	Tag        string // exact project tag; empty = all
	FailedOnly bool   // keep only entries that ended in error (ExitCode != 0)
}

type HistogramBucket

type HistogramBucket int

HistogramBucket identifies how entries are grouped.

const (
	HistogramHour HistogramBucket = iota
	HistogramDay
)

type HistogramRow

type HistogramRow struct {
	Bucket      string `json:"bucket"`
	Count       int    `json:"count"`
	TotalMs     int64  `json:"total_ms"`
	TotalBytes  int64  `json:"total_out_bytes"`
	TotalTokens int64  `json:"total_out_tokens"`
}

HistogramRow is one bucket: a label plus the totals for the entries that fell into it.

type InputCount

type InputCount struct {
	Tool  string `json:"tool"`
	Input string `json:"input"`
	Count int    `json:"count"`
}

Jump to

Keyboard shortcuts

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