sessionstate

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 2 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 sessionstate folds a session's events into what a person asks about: is a run going, what is queued, how did the last one end, which pull requests exist, what waits for a person. It is pure; the commands feed it events from the API or the stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompt

type Prompt struct {
	ID, Author, Text, Mode string
}

Prompt is a queued prompt.

type Run

type Run struct {
	ID    string
	Mode  string
	Stage string // starting, working, verifying, reviewing, waiting
}

Run is the run in progress.

type State

type State struct {
	LastSeq   int
	Stage     string // chat or working, from session.created / session.working
	Sandbox   string
	Active    *Run
	Queued    []Prompt
	Last      *api.OutcomeStatus
	PRs       []api.PRStatus
	Approvals []api.ApprovalStatus
	Runs      int // run.completed seen
	PRsOpened int // pr.opened seen
	Archived  bool
	Proposal  string            // an open "work in a sandbox?" proposal id
	RunOf     map[string]string // prompt id to the run it started
	Outcomes  map[string]*api.OutcomeStatus
	Cancelled map[string]bool
	// contains filtered or unexported fields
}

State is the fold of the events applied so far.

func New

func New() *State

New returns an empty state.

func (*State) Apply

func (s *State) Apply(ev api.Event)

Apply folds one event in. Unknown event types are ignored.

func (*State) Idle

func (s *State) Idle() bool

Idle is true when nothing is running and nothing is queued.

func (*State) Status

func (s *State) Status() *api.Status

Status renders the state as the status answer, the shape of GET /status.

Jump to

Keyboard shortcuts

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