progress

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package progress projects each harness session into one session_progress row — the assignment, agent, phase, turn, queue depth, tool calls, commits ahead, changed files, model, last activity and last note — and folds the session's event log into the readable lines a tail follows. Both csf status and csf tail read this one projection: status renders the row as a table, tail renders the lines, and neither reads the log a second way.

A session here is a virtual session: one assignment the harness runs. It resolves to the real session — the executor conversation that carries the server-side prompt cache — through the router's table under <state>/routing, so two virtual sessions shown on one conversation are sharing that cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fold

func Fold(row Progress, record *session.Record) (Progress, []Line)

Fold applies one event log record to a row and returns the row with the lines the record adds. It is pure: a record folds to the same row and the same lines every time. The row's Agent names every line it yields, so a caller sets it from the run record before folding.

func ParseKinds

func ParseKinds(names string) (map[Kind]bool, error)

ParseKinds reads a comma-separated kind list into the set of kinds to show. An empty list means every kind.

func Work

func Work(ctx context.Context, launcher proc.ILauncher, row *Progress)

Work fills the fields of a row that need the session's working tree rather than its run directory: the commits its branch is ahead of its base and the files it has changed but not committed. A session with no worktree yet, or one whose git commands fail, keeps zero counts, so status shows a session it cannot read rather than failing.

Types

type Followed

type Followed struct {
	Row    Progress
	Lines  []Line
	Offset int64
}

Followed is one session's row after its event log is folded from an offset, the lines the fold added, and the offset to read from next.

func Follow

func Follow(files iofs.IFiles, assignment string, row Progress, offset int64) (Followed, error)

Follow reads one session's event log from offset, folds its complete records into row and returns the lines they add and the offset to read from next. A trailing line with no newline is still being written and is left for the next read, so a line is shown once and whole.

type Kind

type Kind string

Kind is the kind of one tail line.

const (
	// KindTurn is a turn starting, ending or a message sent to a session.
	KindTurn Kind = "turn"
	// KindTool is one tool call the session made.
	KindTool Kind = "tool"
	// KindGate is a session gate's decision.
	KindGate Kind = "gate"
	// KindMerge is a pull request moving: marked ready, a merge starting or a
	// merge landing.
	KindMerge Kind = "merge"
	// KindError is a failure a record reported.
	KindError Kind = "error"
)

The kinds a line carries, one per kind of thing a session does.

func Kinds

func Kinds() []Kind

Kinds is every line kind, in the order csf tail's -kinds accepts them.

func ParseKind

func ParseKind(name string) (Kind, error)

ParseKind reads one kind by its spelling.

type Line

type Line struct {
	Time  time.Time
	Agent string
	Kind  Kind
	Text  string
}

Line is one line of the tail: when it happened, the agent that wrote it, which kind it is and what it says. It renders as the brief's render line "{time} {agent} {kind} {text}".

func (Line) String

func (line Line) String() string

String renders the line for the terminal: readable, labelled by agent, and never JSON.

type Phase

type Phase string

Phase is a session's phase as this projection reads it from the state directory. The state directory records a run's whole event log and the end its runner wrote, so this reads a run between turns as open and a turn in flight as running; the phases only the running host holds — starting and canceling — are the host's to report, through csf list.

const (
	// PhaseRunning is a run between a turn's request and its finish.
	PhaseRunning Phase = "running"
	// PhaseOpen is a run with no turn in flight.
	PhaseOpen Phase = "open"
	// PhaseClosed is a run whose turn executor closed.
	PhaseClosed Phase = "closed"
	// PhaseCanceled is a run that was canceled.
	PhaseCanceled Phase = "canceled"
	// PhaseFailed is a run that failed.
	PhaseFailed Phase = "failed"
)

type Progress

type Progress struct {
	Assignment   string
	Agent        string
	Phase        Phase
	Turn         int
	Queued       int
	ToolCalls    int
	CommitsAhead int
	ChangedFiles int
	Model        string
	LastActivity time.Time
	LastNote     string
	// contains filtered or unexported fields
}

Progress is one row of the session_progress relation: what one session is doing, read from its run directory. It is the one projection both csf status and csf tail read.

func ReadAll

func ReadAll(files iofs.IFiles) ([]Progress, error)

ReadAll projects every session in the granted state directory into one row each, ordered by assignment. A directory that is not a session is skipped. It reads each log whole; Work fills the git fields, which need a process.

func Session

func Session(files iofs.IFiles, assignment string) (Progress, error)

Session reads a session's run record into the row it labels, and the depth of its queue, before its event log is folded. A directory with no run record is not a session and reads as the zero row.

type Projection

type Projection struct {
	Rows  []Progress
	Lines []Line
}

Projection is every session's row and every tail line the state directory folds to, in the order each verb reads them.

func ReadAllLines

func ReadAllLines(files iofs.IFiles) (Projection, error)

ReadAllLines projects every session in the granted state directory and collects every tail line it folds, ordered by time then assignment. It is the read csf tail makes; Work fills the rows' git fields, which need a process, and the lines' agents are already set.

Jump to

Keyboard shortcuts

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