recap

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 16 Imported by: 1 module, 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 recap contains the server-backed data types and static renderer behind `entire recap`.

Index

Constants

View Source
const (
	DefaultWidth = 78
	AgentAll     = "all"
)

Variables

This section is empty.

Functions

func ClearTeam added in v0.13.2

func ClearTeam(r *MeRecapResponse)

ClearTeam removes the team side of a recap, so it renders as unavailable rather than as zeros. Used for a home-cell response when the repo's team data lives on another cell.

func MergeTeam added in v0.13.2

func MergeTeam(home, team *MeRecapResponse)

MergeTeam replaces home's team side with team's. home supplies the personal side and the window; team is the repo processing cell's answer for the same window. A nil team, or one without a team side (the caller is not a member there), leaves home with no team side.

Each cell folds custom agent names into "unknown" on its own, so with more than the server's custom-agent limit the two sides can name an agent differently; the union then shows both rows.

func RenderStaticRecap

func RenderStaticRecap(resp *MeRecapResponse, opts RenderOptions) string

RenderStaticRecap renders the server-backed static recap view.

Types

type AgentAggregate

type AgentAggregate struct {
	Sessions         int          `json:"sessions"`
	Checkpoints      int          `json:"checkpoints"`
	Tokens           int          `json:"tokens"`
	TranscriptTokens int          `json:"transcriptTokens"`
	FilesChanged     int          `json:"filesChanged"`
	Labels           []LabelCount `json:"labels"`
	Skills           []SkillCount `json:"skills"`
	MCPServers       []McpCount   `json:"mcpServers"`
	ToolMix          ToolMix      `json:"toolMix"`
}

type AgentEntry

type AgentEntry struct {
	AgentID      string          `json:"agentId"`
	AgentLabel   string          `json:"agentLabel"`
	Me           AgentAggregate  `json:"me"`
	Contributors *AgentAggregate `json:"contributors"`
}

type AnalysisStatus

type AnalysisStatus struct {
	Complete int `json:"complete"`
	Pending  int `json:"pending"`
	Failed   int `json:"failed"`
}

type ContribSummary

type ContribSummary struct {
	DistinctUsers    int `json:"distinctUsers"`
	TotalTokens      int `json:"totalTokens"`
	TotalCheckpoints int `json:"totalCheckpoints"`
}

type DailyCount

type DailyCount struct {
	Date  string `json:"date"`
	Count int    `json:"count"`
}

type LabelCount

type LabelCount struct {
	Label string `json:"label"`
	Count int    `json:"count"`
}

type McpCount

type McpCount struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type MeRecapResponse

type MeRecapResponse struct {
	Timeframe    string                `json:"timeframe"`
	Repo         *string               `json:"repo"`
	Repos        []string              `json:"repos"`
	Since        string                `json:"since"`
	Until        string                `json:"until"`
	Agents       map[string]AgentEntry `json:"agents"`
	Summary      Summary               `json:"summary"`
	Contributors *ContribSummary       `json:"contributors"`
	Daily        []DailyCount          `json:"daily"`
	UpdatedAt    string                `json:"updated_at"`
}

MeRecapResponse mirrors GET /api/v1/me/recap.

Repo/Repos contract: at most one of these scopes the recap.

  • When Repo is non-nil and non-empty, the recap is scoped to that single repo and Repos is ignored.
  • Otherwise Repos lists the repos contributing to a multi-repo recap, ordered by the server's "most active first" ranking (rendering code relies on that order when truncating to "+N more").

func FetchMeRecap

func FetchMeRecap(
	ctx context.Context,
	client *api.Client,
	since, until time.Time,
	repo string,
	limit int,
) (*MeRecapResponse, error)

FetchMeRecap fetches one server-backed recap window.

type RangeKey

type RangeKey string

RangeKey names the static recap windows supported by `entire recap`.

const (
	RangeDay   RangeKey = "day"
	RangeWeek  RangeKey = "week"
	RangeMonth RangeKey = "month"
	Range90d   RangeKey = "90d"
)

func (RangeKey) Bounds

func (r RangeKey) Bounds(now time.Time) (time.Time, time.Time)

Bounds returns a half-open [start, end) window in the user's local time.

func (RangeKey) Title

func (r RangeKey) Title() string

Title returns the panel title for a range.

type RenderOptions

type RenderOptions struct {
	Range RangeKey
	View  ViewMode
	Agent string
	Width int
	Color bool
	// RepoName is the human owner/repo name of the repo the recap is scoped to,
	// when the caller knows it. It is preferred over the response's repo field
	// for display: /me/recap identifies the scoped repo by its repo_id ULID
	// (echoed back verbatim), which is meaningless to show a user.
	RepoName string
	Location *time.Location
}

type SkillCount

type SkillCount struct {
	Skill string `json:"skill"`
	Count int    `json:"count"`
}

type Summary

type Summary struct {
	Me          SummaryTotals     `json:"me"`
	Team        *SummaryTotals    `json:"team"`
	RepoCount   int               `json:"repoCount"`
	ActiveDays  int               `json:"activeDays"`
	Analysis    AnalysisStatus    `json:"analysis"`
	Transcripts TranscriptSummary `json:"transcripts"`
}

Summary contains top-level counts intended for CLI rendering.

type SummaryTotals

type SummaryTotals struct {
	Sessions    int `json:"sessions"`
	Checkpoints int `json:"checkpoints"`
	Tokens      int `json:"tokens"`
}

type ToolMix

type ToolMix struct {
	Shell   int `json:"shell"`
	FileOps int `json:"fileOps"`
	Search  int `json:"search"`
	MCP     int `json:"mcp"`
	Agent   int `json:"agent"`
	Other   int `json:"other"`
}

type TranscriptStatus added in v0.6.2

type TranscriptStatus struct {
	Failed  int `json:"failed"`
	Pending int `json:"pending"`
	Empty   int `json:"empty"`
}

type TranscriptSummary added in v0.6.2

type TranscriptSummary struct {
	Me   TranscriptStatus  `json:"me"`
	Team *TranscriptStatus `json:"team"`
}

type ViewMode

type ViewMode string

ViewMode selects which columns render in the static agents panel.

const (
	ViewYou  ViewMode = "you"
	ViewTeam ViewMode = "team"
	ViewBoth ViewMode = "both"
)

func (ViewMode) Valid

func (m ViewMode) Valid() bool

Valid reports whether the mode is one of the supported static modes.

Jump to

Keyboard shortcuts

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