picker

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package picker provides interactive session selection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecentDirs added in v0.3.10

func RecentDirs(store *state.Store, limit int) []string

RecentDirs returns unique session working directories, most-recent first, capped at limit. It is derived entirely from existing manifests — no filesystem scanning — so the picker can offer a jump-list of the places you actually start sessions. Directories that no longer exist are skipped.

Types

type AgentOptions

type AgentOptions struct {
	Available      []string
	DefaultPrimary string
}

AgentOptions configures the agent selectors shown in the create form.

type CreateForm

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

CreateForm handles the new-session creation UI within the picker.

func NewCreateForm

func NewCreateForm(master bool, initialDir string, agentOptions ...AgentOptions) (CreateForm, tea.Cmd)

NewCreateForm creates a form for new session creation. initialDir pre-fills the directory input when available.

func (CreateForm) Update

func (f CreateForm) Update(msg tea.Msg) (CreateForm, tea.Cmd)

Update handles input for the create form.

func (CreateForm) View

func (f CreateForm) View(width, height int) string

View renders the create form.

type CreateStartOptions

type CreateStartOptions struct {
	Master       bool
	Primary      string
	DisplayColor string
	Prompt       string
	// QuestID is the active quest to attach on spawn ("" = a free session).
	QuestID string
}

CreateStartOptions captures the role selections from the create form.

type DeleteFunc

type DeleteFunc func(ctx context.Context, sessionID string) error

DeleteFunc deletes a session by ID (typically session.Service.Delete).

type Entry

type Entry struct {
	SessionID    string
	Status       string // "active", "* current", "master (N)", "worker", "worker (orphan)", "resumable"
	Title        string
	Cwd          string
	SessionType  string
	PrimaryAgent string

	// Slow-moving metadata the always-on tracker omits but the on-demand
	// picker can afford to show.
	CreatedAt     string // manifest CreatedAt (RFC3339); rendered as the creation date
	LastStartedAt string // when the session last started; basis for uptime (live only)
	Live          bool   // true for running sessions; gates the uptime display

	IsSep bool // separator line between active and resumable
}

Entry represents a single row in the picker display.

func BuildEntries

func BuildEntries(ctx context.Context, store *state.Store, client *tmux.Client) ([]Entry, error)

BuildEntries constructs picker rows from discovery and tmux state. Rows are grouped as standalone sessions, masters with workers, orphans, then stale sessions.

type Model

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

Model is the Bubble Tea model for the interactive session picker.

func NewModel

func NewModel(ctx context.Context, entries []Entry, store *state.Store, client *tmux.Client, deleteFn DeleteFunc, startFn StartFunc, agentOpts AgentOptions, questChoices []QuestChoice) Model

NewModel creates a picker model with the given entries. questChoices are the active quests offered in the create form (nil for none).

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Selected

func (m Model) Selected() string

Selected returns the chosen session ID, or empty if cancelled.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type QuestChoice added in v0.3.12

type QuestChoice struct {
	ID    string
	Title string
}

QuestChoice is an attachable (active) quest offered in the create form. The caller supplies only active quests — wip and done are excluded upstream.

type StartFunc

type StartFunc func(ctx context.Context, title, cwd string, opts CreateStartOptions) (string, error)

StartFunc creates a questmaster session and returns its ID.

Jump to

Keyboard shortcuts

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