snapshot

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 14 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 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

View Source
const Version = 1

Version is the version of the document.

View Source
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

func Encode

func Encode(w io.Writer, s Snapshot) error

Encode writes the document as indented JSON, the way `sitrep ls --json` prints it.

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.

func (Builder) Build

func (b Builder) Build(ctx context.Context, opt Options) Snapshot

Build reads the state folder and the registry once and returns the snapshot.

type Hidden

type Hidden struct {
	Ended         int `json:"ended"`
	StrandedItems int `json:"stranded_items"`
}

Hidden counts what a listing without ended sessions left out.

type Options

type Options struct {
	All bool
	Cap int
}

Options say what to include. Cap limits the items listed in each queue; below zero lists them all.

type Queue

type Queue struct {
	Count int             `json:"count"`
	Items []textsafe.Text `json:"items"`
}

Queue holds the true count and the items a cap allowed.

type Session

type Session struct {
	ID           state.ID      `json:"id"`
	Short        string        `json:"short"`
	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"`
	Snoozed      bool          `json:"snoozed"`
	PID          *int          `json:"pid"`
	Pinned       bool          `json:"pinned"`
	Highlight    bool          `json:"highlight"`
	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"`
}

Session is one session.

type Settings

type Settings struct {
	QueueItems       int    `json:"queue_items"`
	HighlightSeconds int    `json:"highlight_seconds"`
	HighlightSGR     string `json:"highlight_sgr"`
}

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.

Jump to

Keyboard shortcuts

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