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

supervisor

package
v1.151.0 Latest Latest
Warning

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

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

Documentation

Overview

Package supervisor manages agent sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionRunner

type SessionRunner struct {
	ID         string
	App        *app.App
	WorkingDir string
	State      *tabstate.State
	Scope      *messages.RouteScope
	// contains filtered or unexported fields
}

SessionRunner represents a running session.

type SessionSpawner

type SessionSpawner func(ctx context.Context, workingDir string) (*app.App, *session.Session, func(), error)

SessionSpawner is a function that creates new sessions. It takes a working directory and returns the app, session, and cleanup function.

type Supervisor

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

Supervisor manages agent sessions.

func New

func New(spawner SessionSpawner) *Supervisor

New creates a new supervisor.

func (*Supervisor) ActiveID

func (s *Supervisor) ActiveID() string

ActiveID returns the ID of the currently active session.

func (*Supervisor) ActiveRunner

func (s *Supervisor) ActiveRunner() *SessionRunner

ActiveRunner returns the currently active session runner.

func (*Supervisor) AddSession

func (s *Supervisor) AddSession(ctx context.Context, a *app.App, sess *session.Session, workingDir string, cleanup func()) string

AddSession adds an existing session to the supervisor.

func (*Supervisor) CloseSession

func (s *Supervisor) CloseSession(sessionID string) string

CloseSession closes a session and removes it from the supervisor.

func (*Supervisor) Count

func (s *Supervisor) Count() int

Count returns the number of sessions.

func (*Supervisor) GetRunner

func (s *Supervisor) GetRunner(sessionID string) *SessionRunner

GetRunner returns the runner for the given session ID, or nil if not found.

func (*Supervisor) GetTabs

func (s *Supervisor) GetTabs() ([]messages.TabInfo, int)

GetTabs returns the current tab info.

func (*Supervisor) ReorderTab

func (s *Supervisor) ReorderTab(fromIdx, toIdx int)

ReorderTab moves the tab at fromIdx to toIdx, shifting others accordingly.

func (*Supervisor) ReplaceRunnerApp

func (s *Supervisor) ReplaceRunnerApp(ctx context.Context, sessionID string, newApp *app.App, workingDir string, cleanup func())

ReplaceRunnerApp replaces the app, working directory, and cleanup function for an existing runner. The old app's context is cancelled and its cleanup is run asynchronously. A new subscription goroutine is started for the new app. This is used when restoring a session whose working directory differs from the runner's current one, requiring a fresh runtime.

func (*Supervisor) RetirePage added in v1.140.0

func (s *Supervisor) RetirePage(tabID string)

RetirePage invalidates runtime deliveries already queued for the previous page.

func (*Supervisor) SetProgram

func (s *Supervisor) SetProgram(p *tea.Program)

SetProgram sets the Bubble Tea program for sending messages.

func (*Supervisor) SetRunnerTitle

func (s *Supervisor) SetRunnerTitle(sessionID, title string)

SetRunnerTitle updates the title of the runner for the given session ID. It also triggers a tab update notification.

func (*Supervisor) Shutdown

func (s *Supervisor) Shutdown()

Shutdown closes all sessions.

func (*Supervisor) SpawnSession

func (s *Supervisor) SpawnSession(ctx context.Context, workingDir string) (string, error)

SpawnSession creates and adds a new session.

func (*Supervisor) Spawner

func (s *Supervisor) Spawner() SessionSpawner

Spawner returns the session spawner function, or nil if none is configured.

func (*Supervisor) SwitchTo

func (s *Supervisor) SwitchTo(sessionID string) *SessionRunner

SwitchTo switches to a different session.

Jump to

Keyboard shortcuts

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