tui

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FocusPane

func FocusPane(paneID string) error

FocusPane focuses an existing tmux pane.

func InTmux

func InTmux() bool

InTmux reports whether the process is running inside a tmux session.

func OpenJobInPane

func OpenJobInPane(jobID string) (string, error)

OpenJobInPane opens the given job in a new horizontal tmux split. Returns the pane ID of the newly created pane.

func PaneAlive

func PaneAlive(paneID string) bool

PaneAlive reports whether the given tmux pane still exists.

func PopScreen

func PopScreen() tea.Msg

PopScreen is a tea.Msg that pops the top screen from the navigation stack.

func PushScreen

func PushScreen(s Screen) tea.Cmd

PushScreen returns a tea.Cmd that pushes a screen onto the navigation stack.

Types

type App

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

App is the top-level bubbletea model with a screen stack.

func NewApp

func NewApp(c *client.Client, tmuxEnabled bool) *App

NewApp creates a new TUI application model.

func (*App) Init

func (m *App) Init() tea.Cmd

func (*App) Update

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

func (*App) View

func (m *App) View() string

type ButtonModel

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

ButtonModel is a simple focusable button component following the bubbles Init/Update/View pattern.

func NewButton

func NewButton(label string) ButtonModel

NewButton returns a ButtonModel with the given label.

func (*ButtonModel) Blur

func (b *ButtonModel) Blur()

Blur removes focus from the button.

func (*ButtonModel) Focus

func (b *ButtonModel) Focus() tea.Cmd

Focus marks the button as focused.

func (ButtonModel) Focused

func (b ButtonModel) Focused() bool

Focused reports whether the button currently has focus.

func (ButtonModel) Update

func (b ButtonModel) Update(msg tea.Msg) (ButtonModel, tea.Cmd)

Update processes a tea.Msg. When focused and Enter is pressed, a ButtonPressedMsg is dispatched. All other input is ignored.

func (ButtonModel) View

func (b ButtonModel) View() string

View renders the button. Focused buttons are highlighted with styleCursor.

type ButtonPressedMsg

type ButtonPressedMsg struct {
	Label string
}

ButtonPressedMsg is dispatched when a focused ButtonModel receives Enter.

type CheckboxModel

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

CheckboxModel is a boolean toggle UI component.

func NewCheckbox

func NewCheckbox(label string) CheckboxModel

NewCheckbox returns a CheckboxModel with the given label.

func (*CheckboxModel) Blur

func (c *CheckboxModel) Blur()

Blur removes focus from the checkbox.

func (*CheckboxModel) Focus

func (c *CheckboxModel) Focus() tea.Cmd

Focus marks the checkbox as focused.

func (CheckboxModel) Focused

func (c CheckboxModel) Focused() bool

Focused reports whether the checkbox has focus.

func (*CheckboxModel) SetValue

func (c *CheckboxModel) SetValue(v bool)

SetValue sets the boolean value.

func (CheckboxModel) Update

func (c CheckboxModel) Update(msg tea.Msg) (CheckboxModel, tea.Cmd)

Update processes a tea.Msg. Enter or Space toggles the checkbox.

func (CheckboxModel) Value

func (c CheckboxModel) Value() bool

Value returns the current boolean value.

func (CheckboxModel) View

func (c CheckboxModel) View() string

View renders the checkbox. Format: " label: ▸ [x]" (focused) or " label: [ ]" (unfocused).

type CheckboxToggledMsg

type CheckboxToggledMsg struct {
	Label   string
	Checked bool
}

CheckboxToggledMsg is dispatched when a CheckboxModel is toggled.

type DescriptionScreen

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

DescriptionScreen is an edit-only screen for the task description. It opens directly in edit mode with the textarea focused. ctrl+enter or Tab→Save saves; esc or Cancel pops back to the tab view.

func NewDescriptionScreen

func NewDescriptionScreen(c *client.Client, task *orchestrator.Task) *DescriptionScreen

NewDescriptionScreen creates a DescriptionScreen pre-filled with the task's description and immediately focused for editing.

func (*DescriptionScreen) Init

func (s *DescriptionScreen) Init() tea.Cmd

Init sends the focus command so the textarea cursor blinks from the start.

func (*DescriptionScreen) ShortHelp

func (s *DescriptionScreen) ShortHelp() string

func (*DescriptionScreen) Update

func (s *DescriptionScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*DescriptionScreen) View

func (s *DescriptionScreen) View(width, height int) string

type InstructionsRoleEditScreen

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

InstructionsRoleEditScreen lets the user edit a single instruction role as YAML. The role itself acts as the key in the API's role-wise partial update: submit sends `{role: <parsed instruction>}` via the Instructions field of UpdateTaskRequest. Leaving the editor empty sends `{role: null}`, which the server treats as a deletion of that role.

func NewInstructionsRoleEditScreen

func NewInstructionsRoleEditScreen(c *client.Client, task *orchestrator.Task, role string) *InstructionsRoleEditScreen

NewInstructionsRoleEditScreen seeds the editor with the active instruction's YAML representation. The role parameter is preserved as a label only; the editor always targets the active (most-recent) entry.

func (*InstructionsRoleEditScreen) Init

func (*InstructionsRoleEditScreen) ShortHelp

func (s *InstructionsRoleEditScreen) ShortHelp() string

func (*InstructionsRoleEditScreen) Update

func (s *InstructionsRoleEditScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*InstructionsRoleEditScreen) View

func (s *InstructionsRoleEditScreen) View(width, height int) string

type JobDetailScreen

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

JobDetailScreen shows full details and scrollable output for a single job.

func NewJobDetailScreen

func NewJobDetailScreen(shared *SharedState, job *api.Job) *JobDetailScreen

NewJobDetailScreen creates a new JobDetailScreen for the given job.

func (*JobDetailScreen) Init

func (s *JobDetailScreen) Init() tea.Cmd

func (*JobDetailScreen) ShortHelp

func (s *JobDetailScreen) ShortHelp() string

func (*JobDetailScreen) Update

func (s *JobDetailScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*JobDetailScreen) View

func (s *JobDetailScreen) View(width, height int) string

type PayloadSectionEditScreen

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

PayloadSectionEditScreen allows editing a single top-level section of the task payload as YAML.

func NewPayloadSectionEditScreen

func NewPayloadSectionEditScreen(c *client.Client, task *orchestrator.Task, sectionKey string) *PayloadSectionEditScreen

NewPayloadSectionEditScreen creates a new edit screen pre-filled with the section's current YAML.

func (*PayloadSectionEditScreen) Init

func (s *PayloadSectionEditScreen) Init() tea.Cmd

func (*PayloadSectionEditScreen) ShortHelp

func (s *PayloadSectionEditScreen) ShortHelp() string

func (*PayloadSectionEditScreen) Update

func (s *PayloadSectionEditScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*PayloadSectionEditScreen) View

func (s *PayloadSectionEditScreen) View(width, height int) string

type Screen

type Screen interface {
	Init() tea.Cmd
	Update(msg tea.Msg) (Screen, tea.Cmd)
	View(width, height int) string
	ShortHelp() string // footer key-binding summary
}

Screen represents a single screen in the navigation stack.

type SelectChangedMsg

type SelectChangedMsg struct {
	Value string
}

SelectChangedMsg is dispatched when the selected value changes.

type SelectModel

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

SelectModel is a reusable dropdown select component that follows the bubbles/textinput API pattern (Init/Update/View, Focus/Blur).

func NewSelect

func NewSelect() SelectModel

NewSelect returns a SelectModel with no selection.

func (*SelectModel) Blur

func (m *SelectModel) Blur()

Blur removes focus from the component.

func (*SelectModel) ClearOptions

func (m *SelectModel) ClearOptions()

ClearOptions removes all options and resets the selection.

func (SelectModel) Expanded

func (m SelectModel) Expanded() bool

Expanded reports whether the dropdown list is currently visible.

func (*SelectModel) Focus

func (m *SelectModel) Focus() tea.Cmd

Focus marks the component as focused. Implements the bubbles focus pattern.

func (SelectModel) Focused

func (m SelectModel) Focused() bool

Focused reports whether the component currently has focus.

func (*SelectModel) ResetSelection

func (m *SelectModel) ResetSelection()

ResetSelection clears the current selection (sets selected to -1).

func (SelectModel) SelectedLabel

func (m SelectModel) SelectedLabel() string

SelectedLabel returns the Label field of the selected option, or "".

func (*SelectModel) SetLabel

func (m *SelectModel) SetLabel(label string)

SetLabel sets the label displayed before the selector.

func (*SelectModel) SetOptions

func (m *SelectModel) SetOptions(opts []SelectOption)

SetOptions replaces the available options.

func (*SelectModel) SetPlaceholder

func (m *SelectModel) SetPlaceholder(placeholder string)

SetPlaceholder sets the text shown when nothing is selected.

func (SelectModel) Update

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

Update processes a tea.Msg and returns the updated model plus an optional command. When the selected value changes, a SelectChangedMsg is dispatched. Key input is ignored when the component is not focused.

func (SelectModel) Value

func (m SelectModel) Value() string

Value returns the Value field of the selected option, or "" if none.

func (SelectModel) View

func (m SelectModel) View() string

View renders the component as a single line (plus inline option list when expanded). The format mirrors the existing viewSelectField layout.

type SelectOption

type SelectOption struct {
	Value string
	Label string
}

SelectOption is a single item in a SelectModel dropdown.

type SharedState

type SharedState struct {
	Client      *client.Client
	TmuxEnabled bool
	Panes       map[string]string // jobID -> paneID
	BlinkOn     bool              // 全スクリーン共有のブリンク状態。App が単一タイマーで管理する。
}

SharedState holds state shared across all screens.

type TaskAnswerScreen

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

TaskAnswerScreen lets the user answer an agent question while the task is awaiting. In read-only mode (answer already submitted) it shows the question and the pending answer.

func NewTaskAnswerScreen

func NewTaskAnswerScreen(c *client.Client, task *orchestrator.Task, ap orchestrator.AwaitingPayload) *TaskAnswerScreen

NewTaskAnswerScreen builds the answer screen from an AwaitingPayload. When pendingAnswer is non-empty the screen opens in read-only mode.

func (*TaskAnswerScreen) Init

func (s *TaskAnswerScreen) Init() tea.Cmd

func (*TaskAnswerScreen) ShortHelp

func (s *TaskAnswerScreen) ShortHelp() string

func (*TaskAnswerScreen) Update

func (s *TaskAnswerScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*TaskAnswerScreen) View

func (s *TaskAnswerScreen) View(width, height int) string

type TaskDetailScreen

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

func NewTaskDetailScreen

func NewTaskDetailScreen(shared *SharedState, taskID, projectName string) *TaskDetailScreen

func (*TaskDetailScreen) Init

func (s *TaskDetailScreen) Init() tea.Cmd

func (*TaskDetailScreen) ShortHelp

func (s *TaskDetailScreen) ShortHelp() string

func (*TaskDetailScreen) Update

func (s *TaskDetailScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*TaskDetailScreen) View

func (s *TaskDetailScreen) View(width, height int) string

type TaskFormScreen

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

func NewTaskFormScreen

func NewTaskFormScreen(shared *SharedState) *TaskFormScreen

func (*TaskFormScreen) Init

func (s *TaskFormScreen) Init() tea.Cmd

func (*TaskFormScreen) ShortHelp

func (s *TaskFormScreen) ShortHelp() string

func (*TaskFormScreen) Update

func (s *TaskFormScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*TaskFormScreen) View

func (s *TaskFormScreen) View(width, height int) string

type TaskListScreen

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

func NewTaskListScreen

func NewTaskListScreen(shared *SharedState) *TaskListScreen

func (*TaskListScreen) Init

func (s *TaskListScreen) Init() tea.Cmd

func (*TaskListScreen) ShortHelp

func (s *TaskListScreen) ShortHelp() string

func (*TaskListScreen) Update

func (s *TaskListScreen) Update(msg tea.Msg) (Screen, tea.Cmd)

func (*TaskListScreen) View

func (s *TaskListScreen) View(width, height int) string

type TextAreaModel

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

TextAreaModel is a reusable multi-line text input component that follows the same API pattern as SelectModel (Focus/Blur/Focused/Update/View/Value).

func NewTextArea

func NewTextArea() TextAreaModel

NewTextArea returns a TextAreaModel with default settings.

func (*TextAreaModel) Blur

func (m *TextAreaModel) Blur()

Blur removes focus from the component.

func (*TextAreaModel) Focus

func (m *TextAreaModel) Focus() tea.Cmd

Focus marks the component as focused.

func (TextAreaModel) Focused

func (m TextAreaModel) Focused() bool

Focused reports whether the component currently has focus.

func (*TextAreaModel) SetHeight

func (m *TextAreaModel) SetHeight(h int)

SetHeight sets the visible height of the textarea.

func (*TextAreaModel) SetLabel

func (m *TextAreaModel) SetLabel(label string)

SetLabel sets the label displayed before the textarea.

func (*TextAreaModel) SetPlaceholder

func (m *TextAreaModel) SetPlaceholder(placeholder string)

SetPlaceholder sets the placeholder text shown when the field is empty.

func (*TextAreaModel) SetValue

func (m *TextAreaModel) SetValue(v string)

SetValue sets the current text value.

func (*TextAreaModel) SetWidth

func (m *TextAreaModel) SetWidth(w int)

SetWidth sets the visible width of the textarea.

func (TextAreaModel) Update

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

Update processes a tea.Msg and delegates key input to the inner textarea. Input is ignored when the component is not focused.

func (TextAreaModel) Value

func (m TextAreaModel) Value() string

Value returns the current text value.

func (TextAreaModel) View

func (m TextAreaModel) View() string

View renders the label line followed by the textarea. Format: " %-10s [cursor]\n[textarea.View()]\n"

type TextFieldModel

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

TextFieldModel is a reusable single-line text input component that follows the same API pattern as SelectModel (Focus/Blur/Focused/Update/View/Value).

func NewTextField

func NewTextField() TextFieldModel

NewTextField returns a TextFieldModel with default settings.

func (*TextFieldModel) Blur

func (m *TextFieldModel) Blur()

Blur removes focus from the component.

func (*TextFieldModel) Focus

func (m *TextFieldModel) Focus() tea.Cmd

Focus marks the component as focused.

func (TextFieldModel) Focused

func (m TextFieldModel) Focused() bool

Focused reports whether the component currently has focus.

func (*TextFieldModel) SetLabel

func (m *TextFieldModel) SetLabel(label string)

SetLabel sets the label displayed before the input field.

func (*TextFieldModel) SetPlaceholder

func (m *TextFieldModel) SetPlaceholder(placeholder string)

SetPlaceholder sets the placeholder text shown when the field is empty.

func (*TextFieldModel) SetValue

func (m *TextFieldModel) SetValue(v string)

SetValue sets the current text value.

func (TextFieldModel) Update

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

Update processes a tea.Msg and delegates key input to the inner textinput. Input is ignored when the component is not focused.

func (TextFieldModel) Value

func (m TextFieldModel) Value() string

Value returns the current text value.

func (TextFieldModel) View

func (m TextFieldModel) View() string

View renders the component as a single line. Format: " %-10s [cursor] [textinput.View()]\n"

Jump to

Keyboard shortcuts

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