Documentation
¶
Overview ¶
Package snapshot is the one picture of everything sitrep knows: the sessions that ran in the last day, their notes and queues, and the inbox. `sitrep ls --json` is its encoding (version 1), and the dashboard reads it directly. Every string in it is a textsafe.Text, so no raw text reaches a consumer.
Index ¶
Constants ¶
const Version = 1
Version is the version of the document.
const Window = 86400
Window is how long ago a session may have changed and still be listed, in seconds.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
Store state.Store
ConfigDir string // Claude Code's folder, for transcripts and the registry
Conf conf.Conf
Reg live.Registry
Clock clock.Clock
}
Builder makes snapshots.
type Context ¶ added in v0.8.0
type Context struct {
UsedPercent float64 `json:"used_percent"`
Window int64 `json:"window"`
Tokens int64 `json:"tokens"`
At int64 `json:"at"` // when the status line last showed these numbers, in epoch seconds
}
Context is how full a session's context window is, as its status line last said.
type Options ¶
Options say what to include. Cap limits the items listed in each queue; below zero lists them all.
type Session ¶
type Session struct {
ID state.ID `json:"id"`
Short string `json:"short"`
Alias string `json:"alias"` // the name the user gave the session, or empty
Running bool `json:"running"`
State string `json:"state"`
StateLabel string `json:"state_label"`
Age int64 `json:"age"`
StateChanged int64 `json:"state_changed"`
QuietSecs *int64 `json:"quiet_secs"`
Idle bool `json:"idle"`
NeedsInput bool `json:"needs_input"`
Blocked string `json:"blocked,omitempty"` // "permission" while the session waits at a dialog; absent otherwise
Snoozed bool `json:"snoozed"`
PID *int `json:"pid"`
Pinned bool `json:"pinned"`
Highlight bool `json:"highlight"`
AttnFaded bool `json:"attn_faded,omitempty"`
Dir textsafe.Text `json:"dir"`
Cwd textsafe.Text `json:"cwd"`
Objective textsafe.Text `json:"objective"`
Progress textsafe.Text `json:"progress"`
Now textsafe.Text `json:"now"`
Queue Queue `json:"queue"`
Context *Context `json:"context"` // how full the context window was at the last status line, or null
}
Session is one session.
type Settings ¶
type Settings struct {
QueueItems int `json:"queue_items"`
HighlightSeconds int `json:"highlight_seconds"`
HighlightSGR string `json:"highlight_sgr"`
Theme string `json:"theme"` // SITREP_THEME, for the dashboard
Colors string `json:"colors"` // SITREP_COLORS, for the dashboard
}
Settings are the values a consumer needs to draw the same way as the plain listing.
type Snapshot ¶
type Snapshot struct {
Version int `json:"version"`
Generated int64 `json:"generated"`
Registry string `json:"registry"` // "ok", or "unavailable" when no live session could be read
Settings Settings `json:"settings"`
Hidden Hidden `json:"hidden"`
Inbox Queue `json:"inbox"`
Sessions []Session `json:"sessions"`
}
Snapshot is the document `sitrep ls --json` prints. The field order is the document's order.