picker

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package picker provides fzf-based interactive session selection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatPreview

func FormatPreview(pd *PreviewData) string

FormatPreview renders preview data into a styled terminal output matching sidebar aesthetics.

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, tmux 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
	Prompt  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", "tmux", "* current tmux"
	Title        string
	Cwd          string
	PrimaryAgent string
	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.

func BuildTmuxEntries

func BuildTmuxEntries(ctx context.Context, client *tmux.Client, currentSession string) ([]Entry, error)

BuildTmuxEntries returns picker entries for non-party tmux 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, tmuxEntries []Entry, store *state.Store, client *tmux.Client, deleteFn DeleteFunc, startFn StartFunc, tmuxStartFn TmuxStartFunc, agentOpts AgentOptions) Model

NewModel creates a picker model with the given entries.

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 PreviewData

type PreviewData struct {
	Status       string // "master", "active", "resumable", "tmux"
	WorkerCount  int
	Cwd          string
	Timestamp    string
	PrimaryAgent string
	Prompt       string
	ClaudeID     string
	CodexID      string
	PaneLines    []string // last lines from the primary pane
}

PreviewData holds the information rendered in the fzf preview pane.

func BuildPreview

func BuildPreview(ctx context.Context, sessionID string, store *state.Store, client *tmux.Client) (*PreviewData, error)

BuildPreview generates preview data for a single session. Returns nil for non-session tokens (e.g. separator rows from fzf).

type StartFunc

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

StartFunc creates a party session and returns its ID.

type TmuxStartFunc

type TmuxStartFunc func(ctx context.Context, name, cwd string) (string, error)

TmuxStartFunc creates a plain tmux session and returns its name.

Jump to

Keyboard shortcuts

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