app

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package app is lp's top-level tea.Model — the low-profile root. It stays thin: a focus stack, layout math, and message dispatch live here; the transcript, overlays, and slash panel are reused from pkg/ui/bubbletea/components re-themed black + gold, while the status line, input, and panels are lp's own. There is deliberately no banner and no thinking sprite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTodosCompleted

func AllTodosCompleted(store *todo.TodoStore) bool

AllTodosCompleted reports whether the store holds at least one todo and every one is completed — the trigger for the auto-fold snapshot. Inlined here so lp doesn't import the bubbletea todos strip at all.

func RenderDaemons

func RenderDaemons(ds *daemon.DaemonState, _ int, th *theme.Theme) string

RenderDaemons renders a one-line summary of the active background daemons (subagents, bash tasks, monitors, lsp), grouped by kind. Returns "" when none are running or the state is nil. Terminal daemons (EndedAt set) are omitted — they're about to be evicted.

func RenderTasksDoneSnapshot

func RenderTasksDoneSnapshot(store *todo.TodoStore, width int, th *theme.Theme) string

RenderTasksDoneSnapshot is the synthetic transcript block appended when every todo completes (just before the store is cleared): a sage header and the finished list, so the scrollback keeps a record of what was done.

func RenderTodos

func RenderTodos(store *todo.TodoStore, width int, th *theme.Theme) string

RenderTodos renders lp's compact task panel: a gold "tasks" header and one row per todo with lp's own restrained glyphs (· pending, ▸ active, ✓ done). Returns "" when empty. lp owns this rather than reusing the bubbletea todos strip so its glyphs stay gold/sage instead of falling back to the theme's (nil) private glyph map.

Types

type App

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

App is lp's root model.

func New

func New(evvaHome string, th *theme.Theme) *App

New builds a fresh App with the given (black + gold) theme. The program reference is wired afterwards via SetProgram.

func (*App) Attach

func (a *App) Attach(c ui.Controller)

Attach hands the model the agent controller and primes the status line.

func (*App) Init

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

Init animates the cursor and the status-line spinner from the first frame.

func (*App) SetProgram

func (a *App) SetProgram(p *tea.Program)

SetProgram hands the model the program reference used by run goroutines to dispatch RunDoneMsg back to the main loop.

func (*App) Update

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

Update routes incoming messages.

func (*App) View

func (a *App) View() string

View composes the frame top→bottom (each chrome layer is fixed height; the transcript flexes; panels/overlay collapse when empty):

status line
─ rule ─
transcript viewport
todos panel        (when tracked)
daemon line        (when running)
overlay | slash    (when open / typing "/")
─ rule ─
input
hint

type FocusStack

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

FocusStack is the ordered modal stack. The topmost Focusable consumes key events; lower ones are visible but inert.

func NewFocusStack

func NewFocusStack() *FocusStack

NewFocusStack returns an empty stack.

func (*FocusStack) Clear

func (f *FocusStack) Clear()

Clear pops every overlay.

func (*FocusStack) Len

func (f *FocusStack) Len() int

Len reports the stack depth.

func (*FocusStack) Pop

func (f *FocusStack) Pop() Focusable

Pop removes and returns the top, or nil if empty.

func (*FocusStack) Push

func (f *FocusStack) Push(x Focusable)

Push installs x as the new top. Nil is a no-op.

func (*FocusStack) Top

func (f *FocusStack) Top() Focusable

Top returns the topmost Focusable without popping, or nil when empty.

type Focusable

type Focusable interface {
	Update(msg tea.Msg) (close bool, cmd tea.Cmd)
	View(width int, th *theme.Theme) string
	Key() string
	Modal() bool
	Hint() string
}

Focusable is the contract every modal overlay implements. lp pushes one onto FocusStack when the user opens a panel and pops when Update reports close==true.

The method set matches the bubbletea overlays exactly (same imported theme.Theme type), so lp reuses those overlays — they satisfy this interface structurally without any adapter.

type Input

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

Input is a thin bubbles/textarea wrapper owning lp's command-line look: a gold ❯ prompt, a gold cursor, a single slim row, and prompt history. The underline frame is applied by the theme's InputBorder at View time.

func NewInput

func NewInput(th *theme.Theme) *Input

NewInput builds the input. Gold is read off the theme (UserPrompt's foreground) so the palette stays in one place — lp/theme.go.

func (*Input) BlinkCmd

func (i *Input) BlinkCmd() tea.Cmd

BlinkCmd re-exposes the cursor blink command for the App's initial batch.

func (*Input) Reset

func (i *Input) Reset()

Reset clears the textarea and history-nav state.

func (*Input) SetValue

func (i *Input) SetValue(s string)

SetValue replaces the textarea content (used by history nav).

func (*Input) SetWidth

func (i *Input) SetWidth(w int)

SetWidth updates the textarea's visible column count, reserving columns for the underline frame's padding.

func (*Input) Update

func (i *Input) Update(msg tea.Msg) tea.Cmd

Update routes a tea.Msg through the input. Enter submits, Ctrl+J inserts a newline, Up/Down walk prompt history; everything else falls through to the textarea.

func (*Input) Value

func (i *Input) Value() string

Value returns the current raw text.

func (*Input) View

func (i *Input) View() string

View renders the textarea wrapped in the theme's underline frame.

type StatusLine

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

StatusLine is lp's slim top instrument line: brand · state · model · cwd on the left, tokens · context · mode on the right, padded to width. It reuses the bubbletea run-state machine (status.State) and the public spinner frames, but renders its own low-profile gold layout — no diamonds, no bottom HUD. Accent colors are read off the theme's exported style fields so the palette stays in lp/theme.go.

func NewStatusLine

func NewStatusLine(state *status.State) *StatusLine

NewStatusLine binds the line to lp's run-state machine and captures the working directory once at construction.

func (*StatusLine) Render

func (s *StatusLine) Render(width int, th *theme.Theme) string

Render composes the one-line HUD, padded to width. When the terminal is too narrow for the right cluster, only the left cluster is shown.

func (*StatusLine) SetContext

func (s *StatusLine) SetContext(used, limit int)

func (*StatusLine) SetEffort

func (s *StatusLine) SetEffort(e string)

func (*StatusLine) SetModel

func (s *StatusLine) SetModel(m string)

func (*StatusLine) SetPermissionMode

func (s *StatusLine) SetPermissionMode(m string)

func (*StatusLine) SetUsage

func (s *StatusLine) SetUsage(u llm.Usage)

type SubmitMsg

type SubmitMsg struct {
	ForAgent string
	ForView  string
}

SubmitMsg is dispatched when the user presses Enter on non-empty input. lp keeps a single text form (no paste-chip compaction in v1), so ForAgent and ForView are identical — the two-field shape mirrors the bubbletea input so the root handler reads the same.

Jump to

Keyboard shortcuts

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