Help us shape the future of Go! Take the 2026 Go Developer Survey

execution

package
v0.44.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StoredPreview

func StoredPreview(st *store.Store, driver *tmux.Driver, sessID string) (string, error)

storedPreview serves a session's saved pane snapshot, which is what the preview shows for any session with no window left to capture, however it lost it. It backfills from a still-live tmux window for sessions archived before snapshots existed.

Types

type AgentStats

type AgentStats struct {
	Count    int
	CPU, RAM float64
	RSS      uint64
}

type Dependencies

type Dependencies struct {
	Store  *store.Store
	TMux   *tmux.Driver
	Engine *status.Engine
	Hooks  *hooks.Manager
	Git    *git.Driver
	Inbox  sessioncmd.InboxMaintenance
	Notify func(notify.Event)
	// ShowCommand shows a notify command the user has not seen run yet.
	ShowCommand func(command string)
	TakeFocus   func() (string, bool)
}

type Options

type Options struct {
	StatusSources map[string]string
	SessionStores map[string]string
	MCPStyles     map[string]string
	ReportStyles  map[string]string
	ShellTools    map[string]bool
	Binaries      ToolBinaries
	Interval      time.Duration
}

func OptionsFromConfig

func OptionsFromConfig(cfg config.Config) Options

type Result

type Result struct {
	Snapshot Snapshot
	Err      error
}

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner drives the session polling loop in its own goroutine, so status updates keep landing in the store even while the TUI is suspended inside a tmux attach. Consumers receive typed Result observations.

func New

func New(deps Dependencies, opts Options) *Runner

func (*Runner) ReflowSessions

func (p *Runner) ReflowSessions(ids []string, reflow func()) error

reflowSessions drops activity-region hashes for ids and runs reflow while the Runner is paused (runMu held). A poll must not capture mid- resize against a pre-resize hash: that comparison treats reflow as streaming and flashes every session as working for one tick.

func (*Runner) RequestRefresh

func (p *Runner) RequestRefresh()

func (*Runner) Run

func (p *Runner) Run(ctx context.Context) <-chan Result

Run keeps the newest snapshot while its subscriber is suspended. The first unread error takes priority over later results. Cancellation is observed between steps; tmux calls already in flight finish first, except the deep quote capture, which ctx cuts short.

func (*Runner) SetInput

func (p *Runner) SetInput(includeArchived bool, selectedID string)

func (*Runner) Step

func (p *Runner) Step() Result

refreshOnce polls every live session's pane, derives and stores status, and samples system stats. Liveness and pane pids come from one tmux call, and every process tree from one ps pass with a second scoped to the pane children, so the poll cost stays flat as sessions are added. runMu serializes the loop with one-off refreshes issued as tea commands.

func (*Runner) TypeForkKeys

func (p *Runner) TypeForkKeys(sess store.Session, keys string) error

typeForkKeys types a tool's fork keys under the gate a queued message waits for, and refuses rather than waits: the user is watching for the fork now.

type SessionSummary

type SessionSummary struct {
	ID       string
	Name     string
	Tool     string
	Group    string
	Status   string
	Archived bool
	ParentID string
}

type Snapshot

type Snapshot struct {
	Sessions                   []store.Session
	ListedAt                   time.Time
	Groups                     []string
	GroupPaths, GroupWorktrees map[string]string
	GroupBases                 map[string]string
	ArchivedGroups             map[string]bool
	Snap                       sysstat.Snapshot
	SnapOK                     bool
	Proc                       sysstat.ProcStat
	ProcFor, Preview           string
	Agents                     AgentStats
	QueuedMessages             map[string]int
	PaneLines, PanePrompts     map[string]string
	Panes                      map[string]tmux.Pane
	TmuxSocket                 string
	LeadingManager             bool
	FocusID                    string
	// TurnsEnded are the sessions whose archive or kill asked for after
	// their turn is due: this pass read each at rest after the request.
	TurnsEnded []string
	// FollowWarning reports a session whose conversation the pass could not
	// follow, the first time it fails that way.
	FollowWarning string
}

type ToolBinaries

type ToolBinaries map[string]string

Shells and blocks without a command hold no binary: a terminal row is a shell whatever gets typed into it.

func NewToolBinaries

func NewToolBinaries(cfg config.Config) ToolBinaries

type View

type View struct {
	// contains filtered or unexported fields
}

func ReadOnly

func ReadOnly(snapshot Snapshot) View

func (View) Agents

func (v View) Agents() AgentStats

func (View) ListedAt

func (v View) ListedAt() time.Time

func (View) Queued

func (v View) Queued(sessionID string) int

func (View) Sessions

func (v View) Sessions() iter.Seq[SessionSummary]

Jump to

Keyboard shortcuts

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