session

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package session records what each agent session is currently doing.

This is scratch state, stored per working tree and never committed: it changes every few minutes and would swamp the history of a repository whose whole point is readable diffs. The consequence, stated plainly, is that a teammate on their own clone cannot see your session — there is no sync channel for it, by design.

Index

Constants

View Source
const StaleAfter = 20 * time.Minute

StaleAfter is how long a session may go without a checkpoint before the board dims it. Sessions are never deleted automatically: a crashed session's last known focus is useful information, not garbage.

Variables

This section is empty.

Functions

func ClaimProcessAlive added in v0.5.7

func ClaimProcessAlive(ticketID, sessionID string) bool

ClaimProcessAlive reports whether the process recorded for ticketID belongs to sessionID and is still running on this machine. A recorded process name that no longer matches means the id was reused by something else.

func DefaultID

func DefaultID() string

DefaultID prefers an identifier supplied by the harness, falling back to something stable for the shell so repeated calls update one record rather than littering the directory.

func ForgetClaimProcess added in v0.5.7

func ForgetClaimProcess(ticketID string) error

ForgetClaimProcess removes the note for ticketID, if there is one.

func Path

func Path(s *ticket.Store, id string) string

Path is where a session's state lives.

func RecordClaimProcess added in v0.5.7

func RecordClaimProcess(ticketID, sessionID string) error

RecordClaimProcess notes that sessionID's agent process holds ticketID. With no agent process to name it removes any older note instead, so a claim taken from a plain shell never inherits the liveness of an earlier one.

func Remove

func Remove(s *ticket.Store, id string) error

Remove deletes a session record.

func Save

func Save(s *ticket.Store, sess Session) error

Save writes a session record.

Types

type Session

type Session struct {
	ID        string `json:"id"`
	TicketID  string `json:"ticket_id,omitempty"`
	Focus     string `json:"focus"`
	Reasoning string `json:"reasoning,omitempty"`
	Model     string `json:"model,omitempty"`
	Host      string `json:"host,omitempty"`
	PID       int    `json:"pid,omitempty"`
	UpdatedAt string `json:"updated_at"`
}

Session is one agent session's current focus.

func Load

func Load(s *ticket.Store) ([]Session, error)

Load reads every session file for this working tree.

func Read

func Read(s *ticket.Store, id string) Session

Read loads one session, returning a zero value when absent.

func (Session) Age

func (s Session) Age() time.Duration

Age is how long since the last checkpoint.

func (Session) Stale

func (s Session) Stale() bool

Stale reports whether a session has gone quiet.

Jump to

Keyboard shortcuts

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