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

sessionapi

package
v0.69.0 Latest Latest
Warning

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

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

Documentation

Overview

Package sessionapi is the session view the hive TUI, the CLI, and Hive Desktop share. Local runs it on an in-process engine; the daemon client runs it over RPC.

Index

Constants

This section is empty.

Variables

View Source
var ErrRiskCheckTimedOut = errors.New("the risk check timed out")

ErrRiskCheckTimedOut is a risk check that the server began and did not finish, as with a slow repository. A caller can offer to go on without the check.

Functions

This section is empty.

Types

type API

type API interface {
	ListSessions(ctx context.Context) ([]session.Session, error)
	GetSession(ctx context.Context, id string) (session.Session, error)
	// CreateSession writes progress to opts.Progress when set. Callers
	// resolve an empty opts.Remote and pass an absolute opts.Source, because
	// the implementation may run in another process.
	CreateSession(ctx context.Context, opts sessionsvc.CreateOptions) (*session.Session, error)
	CreateFromRequest(ctx context.Context, req sessionsvc.LaunchRequest) (session.Session, error)
	CreateSessionWithWindows(ctx context.Context, req sessionsvc.NewSessionRequest, windows []multiplexer.WindowSpec) (*session.Session, error)
	RenameSession(ctx context.Context, id, name string) error
	SetSessionGroup(ctx context.Context, id, group string) error
	SetSessionTags(ctx context.Context, id string, tags []string) (session.Session, error)
	EditSessionTags(ctx context.Context, id string, add, remove []string) (session.Session, error)
	DeleteSession(ctx context.Context, id string) error
	RecycleSession(ctx context.Context, id string, w io.Writer) error
	Prune(ctx context.Context, all bool) (int, error)
	CheckSessionRisk(ctx context.Context, id string) (sessionsvc.Risk, error)
	SessionLaunchOptions(ctx context.Context) (sessionsvc.LaunchOptions, error)
	SessionChanges(ctx context.Context, id string, target gitstatus.DiffTarget) (gitstatus.Changes, error)
	SessionFileDiffs(ctx context.Context, id string, target gitstatus.DiffTarget, paths []string) ([]gitstatus.FileDiff, error)
	SessionBranches(ctx context.Context, id string) ([]string, error)
	// GitStatuses reads the checkouts of the sessions ids name on the machine
	// that holds them, keyed by id. An id with no session is absent.
	GitStatuses(ctx context.Context, ids []string) (map[string]gitstatus.Status, error)
	// StartTmuxSession opens the tmux session of an active session in the
	// background on the machine that holds it, and starts its agent when no
	// tmux session runs. A client attaches to it afterwards.
	StartTmuxSession(ctx context.Context, id string) (multiplexer.LaunchResult, error)

	// StatusAvailable must not block: the TUI calls it inside Update. A false
	// answer can turn true later (the daemon client answers false until its
	// first Hello returns), so callers ask again instead of caching it.
	StatusAvailable() bool
	FetchBatch(ctx context.Context, sessions []*session.Session, roots []status.RootRepoTarget) map[string]status.TerminalStatus
}

API creates every session in the background, whatever opts.Background says: the implementation may run in a daemon with no terminal. A caller that wants the session in front attaches or switches to the one returned.

type Local

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

Local reads the engine's services on every call, so it follows a Reload.

func NewLocal

func NewLocal(engine *hive.Engine) *Local

func (*Local) CheckSessionRisk

func (l *Local) CheckSessionRisk(ctx context.Context, id string) (sessionsvc.Risk, error)

func (*Local) CreateFromRequest

func (l *Local) CreateFromRequest(ctx context.Context, req sessionsvc.LaunchRequest) (session.Session, error)

func (*Local) CreateSession

func (l *Local) CreateSession(ctx context.Context, opts sessionsvc.CreateOptions) (*session.Session, error)

func (*Local) CreateSessionWithWindows

func (l *Local) CreateSessionWithWindows(ctx context.Context, req sessionsvc.NewSessionRequest, windows []multiplexer.WindowSpec) (*session.Session, error)

func (*Local) DeleteSession

func (l *Local) DeleteSession(ctx context.Context, id string) error

func (*Local) EditSessionTags

func (l *Local) EditSessionTags(ctx context.Context, id string, add, remove []string) (session.Session, error)

func (*Local) FetchBatch

func (l *Local) FetchBatch(ctx context.Context, sessions []*session.Session, roots []status.RootRepoTarget) map[string]status.TerminalStatus

func (*Local) GetSession

func (l *Local) GetSession(ctx context.Context, id string) (session.Session, error)

func (*Local) GitStatuses added in v0.69.0

func (l *Local) GitStatuses(ctx context.Context, ids []string) (map[string]gitstatus.Status, error)

func (*Local) ListSessions

func (l *Local) ListSessions(ctx context.Context) ([]session.Session, error)

func (*Local) Prune

func (l *Local) Prune(ctx context.Context, all bool) (int, error)

func (*Local) RecycleSession

func (l *Local) RecycleSession(ctx context.Context, id string, w io.Writer) error

func (*Local) RenameSession

func (l *Local) RenameSession(ctx context.Context, id, name string) error

func (*Local) SessionBranches added in v0.69.0

func (l *Local) SessionBranches(ctx context.Context, id string) ([]string, error)

func (*Local) SessionChanges added in v0.69.0

func (l *Local) SessionChanges(ctx context.Context, id string, target gitstatus.DiffTarget) (gitstatus.Changes, error)

func (*Local) SessionFileDiffs added in v0.69.0

func (l *Local) SessionFileDiffs(ctx context.Context, id string, target gitstatus.DiffTarget, paths []string) ([]gitstatus.FileDiff, error)

func (*Local) SessionLaunchOptions

func (l *Local) SessionLaunchOptions(ctx context.Context) (sessionsvc.LaunchOptions, error)

func (*Local) SetSessionGroup

func (l *Local) SetSessionGroup(ctx context.Context, id, group string) error

func (*Local) SetSessionTags

func (l *Local) SetSessionTags(ctx context.Context, id string, tags []string) (session.Session, error)

func (*Local) StartTmuxSession added in v0.69.0

func (l *Local) StartTmuxSession(ctx context.Context, id string) (multiplexer.LaunchResult, error)

func (*Local) StatusAvailable

func (l *Local) StatusAvailable() bool

Jump to

Keyboard shortcuts

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