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

sessionapi

package
v0.68.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 8 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)

	// 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) 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) 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) StatusAvailable

func (l *Local) StatusAvailable() bool

Jump to

Keyboard shortcuts

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