components

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 34 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

armin.go (pi: components/armin.ts) — "Armin says hi!" easter egg with animated half-block XBM art and 7 random effects.

Concurrency adaptation (declared): pi uses setInterval on the JS event loop; pig runs a ticker goroutine with panic containment (docs/feat/PANIC-RESILIENCE.md). The animation self-stops when its effect completes (pi: stopAnimation from the interval callback); Dispose is idempotent and optional.

assistant_message.go (pi: components/assistant-message.ts) — component that renders a complete assistant message.

auth_url.go (pi: components/auth-url.ts, ced72c2f0) — a sign-in URL with a click hint and a copy hint. Hosts call Copy() when `app.message.copy` is pressed, since a long URL wraps and often cannot be selected or clicked as a whole (SSH, tmux).

bash_execution.go (pi: src/modes/interactive/components/bash-execution.ts) — the component for user `!` bash command execution with streaming output.

bordered_loader.go (pi: components/bordered-loader.ts) — loader wrapped with borders for extension UI.

branch_summary_message.go (pi: components/branch-summary-message.ts) — renders a branch summary message with collapsed/expanded state. Uses the same accent styling as custom messages for visual consistency.

compaction_summary_message.go (pi: components/compaction-summary-message.ts) — renders a compaction message with collapsed/expanded state. Uses the same accent styling as custom messages for visual consistency.

countdown_timer.go (pi: components/countdown-timer.ts) — reusable countdown timer for dialog components.

Concurrency adaptation (declared): pi uses setInterval on the JS event loop; pig runs a ticker goroutine. onTick/onExpire fire on the timer goroutine (pi fires on the event loop); callbacks must be safe for that.

custom_editor.go (pi: components/custom-editor.ts) — custom editor that handles app-level keybindings for coding-agent.

custom_entry.go (pi: components/custom-entry.ts) — renders a custom session entry from extensions. The host owns transcript spacing; renderer output should provide only its content.

custom_message.go (pi: components/custom-message.ts) — renders a custom message entry from extensions. Uses distinct styling to differentiate from user messages.

daxnuts.go (pi: components/daxnuts.ts) — "POWERED BY DAXNUTS" easter egg for OpenCode + Kimi K2.5: a heartfelt tribute to dax (@thdxr) for providing free Kimi K2.5 access via OpenCode.

Concurrency adaptation (declared): pi drives the reveal with setInterval on the JS event loop; pig runs an 80ms ticker goroutine with panic containment (docs/feat/PANIC-RESILIENCE.md), guarded by a mutex like ArminComponent. The scanline/text colors use raw truecolor ANSI (pi: rgb()/RESET) — not theme tokens — while the text lines use theme colors, mirroring pi exactly.

dynamic_border.go (pi: components/dynamic-border.ts) — a border component that adjusts to the viewport width.

earendil_announcement.go (pi: components/earendil-announcement.ts) — the "/dementedelves" easter-egg announcement.

Declared gap: pi adds a Kitty-terminal Image child (clankolas.png) when the bundled asset loads; pig's Image component (terminal-image) lands with Phase 8 (photon/wazero), so the image child is omitted here and the component always renders the text-only fallback (pi's no-image path).

extension_editor.go (pi: components/extension-editor.ts) — multi-line editor component for extensions. Supports Ctrl+G for external editor.

extension_input.go (pi: components/extension-input.ts) — simple text input component for extensions.

extension_selector.go (pi: components/extension-selector.ts) — generic selector component for extensions. Displays a list of string options with keyboard navigation.

first_time_setup.go (pi: components/first-time-setup.ts) — first-time setup dialog: theme choice and analytics opt-in.

footer.go (pi: components/footer.ts) — footer component showing pwd, token stats, and context usage. Computes token/context stats from the session; git branch and extension statuses come from the provider. When the pig-only showResourceStats setting is on, the stats line also shows process resource stats ("| MEM22MB·!G387…": memory always on, joined by "·"; the CPU item ("!CPU") and G/FD surface only on anomaly — see resource_stats.go).

Declared deviation: pi reads session.sessionManager/session.state directly on the concrete AgentSession; pig routes the accesses through function fields (newFooterSessionView defaults them to the real session) so tests can stub the view (Go has no structural duck typing on a concrete struct).

frame_body.go — pig-only: the body of the corner-framed block (docs/feat/BUILTIN-THEME-PALETTES.md §BLOCK-BORDERS). Renders a block's content one column narrower so it stays flush with the corner rules (┌───┐ / └───┘) and leaves the last column free for the chat viewport's transient scrollbar.

login_dialog.go (pi: components/login-dialog.ts) — the login dialog that replaces the editor during OAuth/API-key login flows: shows auth URLs (OSC 8 hyperlinks), device codes, prompts, progress, and collects manual input.

pig concurrency notes (deviations declared here once):

  • pi's AbortController → context.Context+cancel (repo rule); the showPrompt/showManualInput Promises resolve over buffered channels, single-send guarded by a mutex.
  • pi mutates containers on the single event loop; pig's login flow runs on a separate goroutine, so the wiring injects Mutator (InteractiveMode.mutateUI) and every Show* mutation is funneled through it. The blocking wait happens outside the mutation.

Package components (pi: src/modes/interactive/components/) — the transcript/UI components for interactive mode.

Ported in T5a-1 (this batch): markdown-transform, keybinding-hints, dynamic-border, visual-truncate, countdown-timer, bordered-loader, status-indicator, user-message, assistant-message, branch-summary-message, compaction-summary-message, skill-invocation-message, custom-message, custom-entry.

Deferred to T5a-2 (they drag the per-tool renderer layer, pi-side ≈2k lines): tool-execution.ts, bash-execution.ts, diff.ts (needs the jsdiff diffWords port for renderIntraLineDiff), and the per-tool renderCall/renderResult implementations in core/tools.

pi's components/index.ts re-exports are not ported (Go has no re-export; consumers import the defining package directly).

mcp_panel.go — the /mcp servers panel (pig-only; pi has no native MCP). Panel semantics follow the pi-mcp-adapter panel (github.com/nicobailon/pi-mcp-adapter): server rows with status suffixes, expandable tool rows, a live filter line, reconnect / enable-disable / copy-error actions. The differences are deliberate: no directTools mode, no OAuth actions, no metadata cache (expanding lists tools live, which connects lazy servers), and enable/disable persists straight into the server's winning mcp.json file instead of an overlay state file.

Ported from pi packages/coding-agent/src/modes/interactive/components/mermaid.ts as part of T5b-4. Transformer that replaces top-level Mermaid code blocks with Unicode terminal diagrams.

model_search.go (pi: modes/interactive/model-search.ts) — model search text ranking helpers shared by the /model autocomplete and selector.

pig placement note: pi keeps this in modes/interactive; pig's /model selector lives in components and cannot import the interactive package, so the canonical implementation lives here and interactive re-exports it (declared deviation).

model_selector.go (pi: components/model-selector.ts) — the /model selector: searchable model list with all/scoped scope toggle, current + default badges, background catalog refresh, and Ctrl+S set-as-default.

Declared deviations (pig import direction — components cannot import the interactive package where pi's refreshModelCatalogs lives):

  • ModelSelectorRuntime is the slice of ModelRuntime the component reads.
  • The catalog refresh is injected as RefreshCatalogs (bound to interactive.RefreshModelCatalogs + the runtime at the callsite).
  • Multi-error refresh messages join provider ids in sorted order (pi iterates Map insertion order; pig map iteration is unordered).

oauth_selector.go (pi: components/oauth-selector.ts) — the /login and /logout provider selector: searchable provider list with auth-type labels and per-provider configuration status indicators.

resource_stats.go — process resource sampling for the footer resource segment (pig-only; pi has no counterpart).

The footer renders on every frame, so values must be sampled off-frame and cached: a syscall (let alone a fork/exec) per render would tax every keystroke. One background poller samples on a slow ticker into resourceStats (atomic fields; Render only reads) and derives the anomaly alert flags from the same stream. 0 = unsampled.

Platform split lives in resource_stats_linux.go (procfs), resource_stats_darwin.go (/usr/bin/footprint phys_footprint, ps RSS fallback, /dev/fd) and resource_stats_windows.go (psapi working set, GetProcessTimes); everything here is portable.

resource_stats_linux.go — Linux samplers for the footer resource segment (pig-only). See resource_stats.go for the shared poller.

resource_stats_unix.go — CPU sampling for POSIX platforms (Linux, darwin; Windows uses GetProcessTimes — see resource_stats_windows.go). Shared by the linux/darwin platform files; see resource_stats.go for the poller.

scoped_models_selector.go (pi: components/scoped-models-selector.ts) — the /scoped-models enable/disable multi-select for model cycling with reorder, provider-group toggle, filtered enable/clear, and Ctrl+S persist.

Declared deviation: updateModels/setRefreshStatus are called from the interactive-mode refresh goroutine; the callsite must wrap them in its mutateUI (pig concurrency note) — pi runs them on the event loop.

session_selector.go (pi: components/session-selector.ts) — the /resume session selector: threaded/recent/relevance session listing with search (tokens / "phrases" / re: regex), scope toggle (current folder / all), rename, path display toggle, delete confirmation (trash CLI with unlink fallback), and symlink-canonicalized parent threading.

Declared deviations (pig concurrency):

  • pi's SessionsLoader is an async function; pig's is a synchronous callback-shaped loader invoked on a goroutine. All post-load component mutations route through the Mutator hook (nil = run inline, tests).
  • pi's confirmRename is async; pig runs it inline (local-file IO only) before the refresh load goroutine starts.

session_selector_search.go (pi: components/session-selector-search.ts) — session search query parsing (tokens / quoted phrases / re: regex), matching, and sort/filter helpers shared by the /resume session selector.

settings_selector.go (pi: components/settings-selector.ts) — the /settings panel: SettingsSelectorComponent (a bordered SettingsList with value cycling, search, and nested submenus), the theme picker submenu (single/automatic mode), and the warnings submenu.

settings_submenu.go (pi: components/settings-submenu.ts) — the reusable submenu building blocks behind the settings selector: SelectSubmenu (single-step titled select list, optionally fuzzy-searchable) and SteppedSubmenu (generic N-step selector with a shared selection context).

show_images_selector.go (pi: components/show-images-selector.ts) — the image display toggle selector with borders.

skill_invocation_message.go (pi: components/skill-invocation-message.ts) — renders a skill invocation message with collapsed/expanded state. Uses the same accent styling as custom messages for visual consistency. Only renders the skill block itself - user message is rendered separately.

status_indicator.go (pi: components/status-indicator.ts) — the streaming status indicators.

theme_selector.go (pi: components/theme-selector.ts) — the theme picker list with live preview (extension export surface; interactive mode uses the settings ThemeSubmenu).

thinking_selector.go (pi: components/thinking-selector.ts) — the /thinking level picker with search filtering and Ctrl+S set-as-default.

tool_execution.go (pi: src/modes/interactive/components/tool-execution.ts) — the tool-execution component: call/result renderer dispatch, default and self render shells, fallback rendering, and the image half.

tree_selector.go (pi: components/tree-selector.ts) — the /tree session tree selector: flattened tree navigation, filter modes, incremental search, branch folding, label editing with timestamps, copy, and horizontally clipped rendering with a fixed gutter.

Declared deviations:

  • pi reads raw message shapes via casts; pig type-switches the typed message structs (types.UserMessage/AssistantMessage/ToolResultMessage, harness.BashExecutionMessage). untypedMessage payloads render via the generic "[role]" branch only (their content shape is unknown here).
  • pi's `setTimeout(() => onCancel(), 100)` on an empty tree maps to a time.AfterFunc goroutine.

trust_selector.go (pi: components/trust-selector.ts) — the /trust project trust prompt: a navigable list of trust options with the saved decision checkmark.

user_message.go (pi: components/user-message.ts) — component that renders a user message.

user_message_selector.go (pi: components/user-message-selector.ts) — the /fork user message picker: a custom scrolling list of past user messages with wrap-around navigation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthSelectorMethodName

func AuthSelectorMethodName(method any) string

AuthSelectorMethodName extracts pi's `method?.name ?? ""`.

func CreateMarkdownTransform

func CreateMarkdownTransform(
	messageType string,
	isStreaming bool,
	transformers []core.MarkdownTransformer,
) func(markdown string, availableWidth int) string

createMarkdownTransform returns a Markdown transform function applying the registered transformers in order (pi: createMarkdownTransform).

func CreateMermaidMarkdownTransformer

func CreateMermaidMarkdownTransformer(options MermaidTransformerOptions) core.MarkdownTransformer

CreateMermaidMarkdownTransformer creates a transformer that replaces top-level Mermaid code blocks with Unicode terminal diagrams.

func FilterAndSortSessions

func FilterAndSortSessions(sessions []core.SessionInfo, query string, sortMode SortMode, nameFilter NameFilter) []core.SessionInfo

FilterAndSortSessions filters and sorts sessions by query and sort mode (pi: filterAndSortSessions). nameFilter defaults to "all" (pi optional).

func FormatAuthSelectorProviderType

func FormatAuthSelectorProviderType(authType auth.AuthType) string

FormatAuthSelectorProviderType renders the auth-type label (pi: formatAuthSelectorProviderType).

func FormatCwdForFooter

func FormatCwdForFooter(cwd string, home string) string

FormatCwdForFooter replaces the home directory prefix with ~ (pi: formatCwdForFooter).

func FormatMemBytes

func FormatMemBytes(b int64) string

FormatMemBytes formats a byte count for the footer resource segment ("52.0MB", "8.4MB", "512KB", "1.2GB"). MB always carries one decimal place, matching Activity Monitor's Memory column (user request, 2026-09-16).

func FormatTokens

func FormatTokens(count int64) string

FormatTokens formats token counts for compact footer display.

func GetModelSearchText

func GetModelSearchText(item ModelSearchItem) string

GetModelSearchText builds the fuzzy search text for a model (pi: getModelSearchText).

func GetModelSelectorSearchText

func GetModelSelectorSearchText(item ModelSearchItem) string

GetModelSelectorSearchText ranks exact provider-prefixed queries before proxy-provider IDs like openrouter/openai/gpt-5 (pi: getModelSelectorSearchText).

func HasSessionName

func HasSessionName(session *core.SessionInfo) bool

HasSessionName reports whether the session has a non-blank display name (pi: hasSessionName).

Types

type ArminComponent

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

ArminComponent is the animated easter-egg art (pi: class ArminComponent).

func NewArminComponent

func NewArminComponent(ui tui.TUI) *ArminComponent

NewArminComponent builds the component and starts the animation (pi: constructor).

func (*ArminComponent) Dispose

func (a *ArminComponent) Dispose()

Dispose stops the animation (pi: dispose). Safe to call twice.

func (*ArminComponent) Invalidate

func (a *ArminComponent) Invalidate()

Invalidate clears the render cache (tui.Component).

func (*ArminComponent) Render

func (a *ArminComponent) Render(width int) []string

Render renders the current grid plus the message line (tui.Component).

type AssistantMessageComponent

type AssistantMessageComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

AssistantMessageComponent renders a complete assistant message (pi: class AssistantMessageComponent extends Container).

func NewAssistantMessageComponent

func NewAssistantMessageComponent(message *types.AssistantMessage, options *AssistantMessageOptions) *AssistantMessageComponent

func (*AssistantMessageComponent) Invalidate

func (c *AssistantMessageComponent) Invalidate()

Invalidate re-renders the last message (pi: invalidate override).

func (*AssistantMessageComponent) Render

func (c *AssistantMessageComponent) Render(width int) []string

Render wraps the output in shell-prompt OSC 133 zones (pi: render override).

func (*AssistantMessageComponent) SetHiddenThinkingLabel

func (c *AssistantMessageComponent) SetHiddenThinkingLabel(label string)

SetHiddenThinkingLabel updates the collapsed label text (pi: setHiddenThinkingLabel).

func (*AssistantMessageComponent) SetHideThinkingBlock

func (c *AssistantMessageComponent) SetHideThinkingBlock(hide bool)

SetHideThinkingBlock toggles the collapsed thinking label (pi: setHideThinkingBlock).

func (*AssistantMessageComponent) SetOutputPad

func (c *AssistantMessageComponent) SetOutputPad(padding int)

SetOutputPad updates the padding (pi: setOutputPad).

func (*AssistantMessageComponent) UpdateContent

func (c *AssistantMessageComponent) UpdateContent(message *types.AssistantMessage, isStreaming bool)

UpdateContent rebuilds the content container from the message (pi: updateContent).

type AssistantMessageOptions

type AssistantMessageOptions struct {
	// HideThinkingBlock (pi: hideThinkingBlock, default false).
	HideThinkingBlock bool
	// MarkdownTheme nil = getMarkdownTheme().
	MarkdownTheme *tui.MarkdownTheme
	// HiddenThinkingLabel "" = "Thinking...".
	HiddenThinkingLabel string
	// OutputPad 0 = default 1 (pi: outputPad = 1).
	OutputPad int
	// MarkdownTransformers (pi: markdownTransformers).
	MarkdownTransformers []core.MarkdownTransformer
}

AssistantMessageOptions carries the constructor's optional parameters (pi: default parameters; zero values mean defaults).

type AuthSelectorProvider

type AuthSelectorProvider struct {
	ID       string
	Name     string
	AuthType auth.AuthType // "oauth" | "api_key"
	Method   any
	Status   *auth.AuthCheck
}

AuthSelectorProvider is one selectable provider entry (pi: AuthSelectorProvider). Method is pi's `method?: ApiKeyAuth | OAuthAuth` — the concrete auth method (auth.ApiKeyAuth or auth.OAuthAuth), nil when unset; Status is pi's `status?: AuthCheck` — nil when unconfigured.

type AuthURLComponent added in v1.0.1

type AuthURLComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

AuthURLComponent shows the auth URL (OSC 8 hyperlink) plus the platform click hint and the copy key hint (pi: AuthUrlComponent).

func NewAuthURLComponent added in v1.0.1

func NewAuthURLComponent(tuiInstance tui.TUI, url string) *AuthURLComponent

NewAuthURLComponent builds the component and requests a render through the host TUI (pi: setHint calls tui.requestRender).

func (*AuthURLComponent) Copy added in v1.0.1

func (c *AuthURLComponent) Copy(tuiInstance tui.TUI)

Copy writes the URL to the clipboard and reflects the outcome in the hint (pi: copy).

type BashExecutionComponent

type BashExecutionComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

BashExecutionComponent renders one user bash execution (pi: class BashExecutionComponent extends Container).

func NewBashExecutionComponent

func NewBashExecutionComponent(command string, ui tui.TUI, excludeFromContext bool) *BashExecutionComponent

NewBashExecutionComponent builds the component (pi: constructor; excludeFromContext = the `!!` prefix case).

func (*BashExecutionComponent) AppendOutput

func (c *BashExecutionComponent) AppendOutput(chunk string)

AppendOutput appends a streaming output chunk (pi: appendOutput; binary data is sanitized upstream in executeBashCommand).

func (*BashExecutionComponent) GetCommand

func (c *BashExecutionComponent) GetCommand() string

GetCommand returns the executed command (pi: getCommand).

func (*BashExecutionComponent) GetOutput

func (c *BashExecutionComponent) GetOutput() string

GetOutput returns the raw output for BashExecutionMessage (pi: getOutput).

func (*BashExecutionComponent) Invalidate

func (c *BashExecutionComponent) Invalidate()

Invalidate invalidates and rebuilds (pi: invalidate override).

func (*BashExecutionComponent) SetComplete

func (c *BashExecutionComponent) SetComplete(exitCode *int, cancelled bool, truncationResult *harnessutils.TruncationResult, fullOutputPath string)

SetComplete finalizes the run (pi: setComplete).

func (*BashExecutionComponent) SetExpanded

func (c *BashExecutionComponent) SetExpanded(expanded bool)

SetExpanded toggles the full-output view (pi: setExpanded).

type BorderedLoader

type BorderedLoader struct {
	tui.Container
	// contains filtered or unexported fields
}

BorderedLoader wraps a (cancellable) loader between dynamic borders (pi: class BorderedLoader extends Container).

func NewBorderedLoader

func NewBorderedLoader(ui tui.TUI, theme *theme.Theme, message string, options *struct{ Cancellable bool }) *BorderedLoader

NewBorderedLoader builds the loader (pi: constructor; options nil = cancellable).

func (*BorderedLoader) Dispose

func (b *BorderedLoader) Dispose()

Dispose stops the loader animation (pi: dispose — dispose() ?? stop()).

func (*BorderedLoader) HandleInput

func (b *BorderedLoader) HandleInput(data string)

HandleInput forwards input to the cancellable loader (pi: handleInput).

func (*BorderedLoader) SetOnAbort

func (b *BorderedLoader) SetOnAbort(fn func())

SetOnAbort installs the abort callback (pi: set onAbort).

func (*BorderedLoader) Signal

func (b *BorderedLoader) Signal() context.Context

Signal returns the cancellation context (pi: get signal — AbortSignal → context per repo rules).

type BranchSummaryMessageComponent

type BranchSummaryMessageComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

BranchSummaryMessageComponent renders a branch summary (pi: class BranchSummaryMessageComponent extends Box; pig frames it with state-colored borders instead of the pi background fill — docs/feat/BUILTIN-THEME-PALETTES.md §BLOCK-BORDERS).

func NewBranchSummaryMessageComponent

func NewBranchSummaryMessageComponent(message *harness.BranchSummaryMessage, markdownTheme *tui.MarkdownTheme) *BranchSummaryMessageComponent

NewBranchSummaryMessageComponent builds the component (pi: constructor; markdownTheme nil = getMarkdownTheme()).

func (*BranchSummaryMessageComponent) Invalidate

func (c *BranchSummaryMessageComponent) Invalidate()

Invalidate re-renders (pi: invalidate override).

func (*BranchSummaryMessageComponent) SetExpanded

func (c *BranchSummaryMessageComponent) SetExpanded(expanded bool)

SetExpanded toggles the expanded state (pi: setExpanded).

type CompactionStatusReason

type CompactionStatusReason string

CompactionStatusReason is pi's CompactionStatusReason union.

const (
	CompactionReasonManual    CompactionStatusReason = "manual"
	CompactionReasonThreshold CompactionStatusReason = "threshold"
	CompactionReasonOverflow  CompactionStatusReason = "overflow"
)

type CompactionSummaryMessageComponent

type CompactionSummaryMessageComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

CompactionSummaryMessageComponent renders a compaction summary (pi: class CompactionSummaryMessageComponent extends Box; pig frames it with state-colored borders instead of the pi background fill — docs/feat/BUILTIN-THEME-PALETTES.md §BLOCK-BORDERS).

func NewCompactionSummaryMessageComponent

func NewCompactionSummaryMessageComponent(message *harness.CompactionSummaryMessage, markdownTheme *tui.MarkdownTheme) *CompactionSummaryMessageComponent

NewCompactionSummaryMessageComponent builds the component (pi: constructor; markdownTheme nil = getMarkdownTheme()).

func (*CompactionSummaryMessageComponent) Invalidate

func (c *CompactionSummaryMessageComponent) Invalidate()

Invalidate re-renders (pi: invalidate override).

func (*CompactionSummaryMessageComponent) SetExpanded

func (c *CompactionSummaryMessageComponent) SetExpanded(expanded bool)

SetExpanded toggles the expanded state (pi: setExpanded).

type CountdownTimer

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

CountdownTimer ticks once per second until expiry (pi: class CountdownTimer).

func NewCountdownTimer

func NewCountdownTimer(timeoutMs int, ui tui.TUI, onTick func(seconds int), onExpire func()) *CountdownTimer

NewCountdownTimer starts the countdown (pi: constructor). tui may be nil; onTick fires immediately with the initial remaining seconds.

func (*CountdownTimer) Dispose

func (c *CountdownTimer) Dispose()

Dispose stops the countdown (pi: dispose). Safe to call twice.

func (*CountdownTimer) RemainingSeconds

func (c *CountdownTimer) RemainingSeconds() int

RemainingSeconds returns the current countdown value.

type CustomEditor

type CustomEditor struct {
	*tui.Editor

	// EmbedWorkingStatus reports whether the working status is rendered in
	// the editor top border (pi: readonly embedWorkingStatus).
	EmbedWorkingStatus bool

	// Special handlers that can be dynamically replaced (pi: public fields).
	OnEscape func()
	OnCtrlD  func()
	// OnPasteImage handles the clipboard-paste keybinding.
	OnPasteImage func()
	// OnExtensionShortcut handles extension-registered shortcuts. Returns
	// true if handled.
	OnExtensionShortcut func(data string) bool

	// TextDecorator post-processes each rendered editor line (pig-only; pi
	// has no equivalent — added for clipboard image placeholder
	// colorization, see docs/feat/CLIPBOARD-IMAGE-PLACEHOLDER.md). Runs on
	// the fully-rendered line (fake-cursor span already embedded), so a
	// placeholder split by that span simply stays uncolored; the editor
	// buffer itself stays plain text.
	TextDecorator func(line string) string
	// contains filtered or unexported fields
}

CustomEditor embeds the tui Editor and intercepts app keybindings before editor handling (pi: class CustomEditor extends Editor).

func NewCustomEditor

func NewCustomEditor(tui_ tui.TUI, editorTheme tui.EditorTheme, keybindings *core.KeybindingsManager, options *CustomEditorOptions) *CustomEditor

NewCustomEditor builds the editor (pi: constructor).

func (*CustomEditor) CopyAppHandlersFrom

func (e *CustomEditor) CopyAppHandlersFrom(from *CustomEditor)

CopyAppHandlersFrom copies all action handlers from another editor (pig addition for setCustomEditorComponent: pi copies the actionHandlers map via duck typing, which needs the same package here).

func (*CustomEditor) HandleInput

func (e *CustomEditor) HandleInput(data string)

HandleInput processes keys: extension shortcuts, paste, app keybindings, then editor handling (pi: handleInput).

func (*CustomEditor) OnAction

func (e *CustomEditor) OnAction(action core.AppKeybinding, handler func())

OnAction registers a handler for an app action (pi: onAction).

func (*CustomEditor) Render

func (e *CustomEditor) Render(width int) []string

Render renders the editor with the pig-only text decorator applied per line (pi: CustomEditor has no Render override — pig adds the decorator seam; zero-width SGR output keeps all width math intact). nil decorator falls through to the embedded editor untouched.

func (*CustomEditor) SetWorkingStatusIndicator

func (e *CustomEditor) SetWorkingStatusIndicator(indicator StatusBorderRenderer)

SetWorkingStatusIndicator attaches the status indicator to embed in the top border (pi: setWorkingStatusIndicator; nil = none; v0.86.0 widens the type from WorkingStatusIndicator to StatusIndicator — working, compaction, summarization, and retry all embed).

type CustomEditorOptions

type CustomEditorOptions struct {
	tui.EditorOptions
	// EmbedWorkingStatus renders the streaming working status in the editor's
	// top border instead of a standalone row (pi: embedWorkingStatus).
	EmbedWorkingStatus bool
}

CustomEditorOptions carries the editor options plus the working-status embed flag (pi: CustomEditorOptions = EditorOptions & { embedWorkingStatus ?: boolean }, v0.85.1).

type CustomEntryComponent

type CustomEntryComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

CustomEntryComponent renders a custom session entry (pi: class CustomEntryComponent extends Container).

func NewCustomEntryComponent

func NewCustomEntryComponent(entry *core.CustomEntry, renderer core.EntryRenderer) *CustomEntryComponent

NewCustomEntryComponent builds the component (pi: constructor).

func (*CustomEntryComponent) HasContent

func (c *CustomEntryComponent) HasContent() bool

HasContent reports whether the renderer produced a component (pi: hasContent).

func (*CustomEntryComponent) Invalidate

func (c *CustomEntryComponent) Invalidate()

Invalidate re-renders (pi: invalidate override).

func (*CustomEntryComponent) SetExpanded

func (c *CustomEntryComponent) SetExpanded(expanded bool)

SetExpanded toggles the expanded state (pi: setExpanded).

type CustomMessageComponent

type CustomMessageComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

CustomMessageComponent renders a custom message (pi: class CustomMessageComponent extends Container).

func NewCustomMessageComponent

func NewCustomMessageComponent(message *harness.CustomMessage, customRenderer core.MessageRenderer, markdownTheme *tui.MarkdownTheme, outputPad int) *CustomMessageComponent

NewCustomMessageComponent builds the component (pi: constructor; markdownTheme nil = getMarkdownTheme(), outputPad 0 = default 1).

func (*CustomMessageComponent) Invalidate

func (c *CustomMessageComponent) Invalidate()

Invalidate re-renders (pi: invalidate override).

func (*CustomMessageComponent) SetExpanded

func (c *CustomMessageComponent) SetExpanded(expanded bool)

SetExpanded toggles the expanded state (pi: setExpanded).

func (*CustomMessageComponent) SetOutputPad

func (c *CustomMessageComponent) SetOutputPad(outputPad int)

SetOutputPad updates the padding (pi: setOutputPad).

type DaxnutsComponent added in v0.86.0

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

DaxnutsComponent is the animated daxnuts easter egg (pi: class DaxnutsComponent).

func NewDaxnutsComponent added in v0.86.0

func NewDaxnutsComponent(ui tui.TUI) *DaxnutsComponent

NewDaxnutsComponent builds the component and starts the reveal animation (pi: constructor).

func (*DaxnutsComponent) Dispose added in v0.86.0

func (d *DaxnutsComponent) Dispose()

Dispose stops the animation goroutine; idempotent (pi: dispose).

func (*DaxnutsComponent) Invalidate added in v0.86.0

func (d *DaxnutsComponent) Invalidate()

Invalidate clears the render cache (tui.Component).

func (*DaxnutsComponent) Render added in v0.86.0

func (d *DaxnutsComponent) Render(width int) []string

type DynamicBorder

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

DynamicBorder is a one-line horizontal rule (pi: class DynamicBorder).

Note (pi comment, preserved): when used from extensions loaded via jiti, the global `theme` may be undefined because jiti creates a separate module cache. Always pass an explicit color function when using DynamicBorder in components exported for extension use.

func NewDynamicBorder

func NewDynamicBorder(color func(string) string) *DynamicBorder

NewDynamicBorder builds a border with the given colorizer (nil = theme.fg("border", ...) — pi's default parameter).

func NewDynamicBorderCorner added in v1.0.1

func NewDynamicBorderCorner(color func(string) string, corner rune) *DynamicBorder

NewDynamicBorderCorner builds a rule with left corner glyphs (pig-only: the block frame's top/bottom rules — ┌───┐ / └───┘).

func (*DynamicBorder) Invalidate

func (d *DynamicBorder) Invalidate()

Invalidate has no cached state to clear (pi: invalidate).

func (*DynamicBorder) Render

func (d *DynamicBorder) Render(width int) []string

Render draws the border line (pi: render). The pig-only block-frame variants (corner set) render solid rules with both corners: ┌───┐ / └───┘, joined by the rail's dashed vertical bars. The frame leaves the last column free: the chat viewport's transient scrollbar paints over the right edge (pi overlays it on full-width content), and the frame's right corner must not compete with it.

type EarendilAnnouncementComponent

type EarendilAnnouncementComponent struct {
	tui.Container
}

EarendilAnnouncementComponent is the announcement card (pi: class EarendilAnnouncementComponent extends Container).

func NewEarendilAnnouncementComponent

func NewEarendilAnnouncementComponent() *EarendilAnnouncementComponent

NewEarendilAnnouncementComponent builds the card (pi: constructor).

type ExtensionEditorComponent

type ExtensionEditorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ExtensionEditorComponent is a multi-line editor dialog for extensions (pi: ExtensionEditorComponent implements Focusable via SetFocused).

func NewExtensionEditorComponent

func NewExtensionEditorComponent(
	tui_ tui.TUI,
	keybindings *core.KeybindingsManager,
	title string,
	prefill string,
	onSubmit func(value string),
	onCancel func(),
	options *ExtensionEditorOptions,
	externalEditorCommand string,
) *ExtensionEditorComponent

NewExtensionEditorComponent builds the editor (pi: constructor). prefill "" = pi's undefined; externalEditorCommand "" falls back to VISUAL/EDITOR or notepad/nano per platform.

func (*ExtensionEditorComponent) HandleInput

func (c *ExtensionEditorComponent) HandleInput(keyData string)

HandleInput processes keys: cancel, external editor, then editor handling (pi: handleInput).

func (*ExtensionEditorComponent) SetFocused

func (c *ExtensionEditorComponent) SetFocused(value bool)

SetFocused is called by the TUI when focus changes (pi: focused accessor).

type ExtensionEditorOptions added in v0.86.1

type ExtensionEditorOptions struct {
	*tui.EditorOptions
	Description string
}

ExtensionEditorOptions carries ExtensionEditorComponent-specific options (pi: ExtensionEditorOptions extends EditorOptions with description).

type ExtensionInputComponent

type ExtensionInputComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ExtensionInputComponent renders a one-line prompt with confirm/cancel.

func NewExtensionInputComponent

func NewExtensionInputComponent(
	title string,
	_ *string,
	onSubmit func(value string),
	onCancel func(),
	opts *ExtensionInputOptions,
) *ExtensionInputComponent

NewExtensionInputComponent builds the input (pi: constructor; the placeholder parameter is unused there too).

func (*ExtensionInputComponent) Dispose

func (c *ExtensionInputComponent) Dispose()

Dispose stops the countdown timer (pi: dispose).

func (*ExtensionInputComponent) GetFocused

func (c *ExtensionInputComponent) GetFocused() bool

GetFocused implements Focusable (propagates to the input for IME cursor positioning; pi: focused getter).

func (*ExtensionInputComponent) HandleInput

func (c *ExtensionInputComponent) HandleInput(keyData string)

HandleInput processes keys (pi: handleInput).

func (*ExtensionInputComponent) SetFocused

func (c *ExtensionInputComponent) SetFocused(focused bool)

SetFocused implements Focusable (pi: focused setter).

type ExtensionInputOptions

type ExtensionInputOptions struct {
	Tui     tui.TUI
	Timeout int
	// InitialValue pre-fills the input (pi v0.86.0: initialValue).
	InitialValue string
	// Description renders below the title (pi v0.86.0: description).
	Description string
}

ExtensionInputOptions configure the input (pi: ExtensionInputOptions).

type ExtensionSelectorComponent

type ExtensionSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ExtensionSelectorComponent renders an extension-provided option list.

func NewExtensionSelectorComponent

func NewExtensionSelectorComponent(
	title string,
	options []string,
	onSelect func(option string),
	onCancel func(),
	opts *ExtensionSelectorOptions,
) *ExtensionSelectorComponent

NewExtensionSelectorComponent builds the selector (pi: constructor).

func (*ExtensionSelectorComponent) Dispose

func (c *ExtensionSelectorComponent) Dispose()

Dispose stops the countdown timer (pi: dispose).

func (*ExtensionSelectorComponent) HandleInput

func (c *ExtensionSelectorComponent) HandleInput(keyData string)

HandleInput processes keys (pi: handleInput).

type ExtensionSelectorOptions

type ExtensionSelectorOptions struct {
	Tui                   tui.TUI
	Timeout               int
	OnToggleToolsExpanded func()
	// Description renders below the title (pi v0.86.0: description).
	Description string
}

ExtensionSelectorOptions configure the selector (pi: ExtensionSelectorOptions).

type FilterMode

type FilterMode string

FilterMode is the filter mode for the tree display (pi: FilterMode).

const (
	FilterModeDefault     FilterMode = "default"
	FilterModeNoTools     FilterMode = "no-tools"
	FilterModeUserOnly    FilterMode = "user-only"
	FilterModeLabeledOnly FilterMode = "labeled-only"
	FilterModeAll         FilterMode = "all"
)

type FirstTimeSetupComponent

type FirstTimeSetupComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

FirstTimeSetupComponent renders the setup dialog.

func NewFirstTimeSetupComponent

func NewFirstTimeSetupComponent(options FirstTimeSetupOptions) *FirstTimeSetupComponent

NewFirstTimeSetupComponent builds the dialog (pi: constructor).

func (*FirstTimeSetupComponent) HandleInput

func (c *FirstTimeSetupComponent) HandleInput(keyData string)

HandleInput processes keys (pi: handleInput).

func (*FirstTimeSetupComponent) Invalidate added in v1.0.0

func (c *FirstTimeSetupComponent) Invalidate()

Invalidate rebuilds the dialog on theme changes, e.g. when the system theme receives the terminal's colors (pi: invalidate override).

type FirstTimeSetupOptions

type FirstTimeSetupOptions struct {
	OnThemePreview func(themeName string)
	OnSubmit       func(result FirstTimeSetupResult)
	OnCancel       func()
}

FirstTimeSetupOptions wire the dialog (pi: FirstTimeSetupOptions). The detected-appearance display was removed with the system theme (pi #10067).

type FirstTimeSetupResult

type FirstTimeSetupResult struct {
	Theme          string
	ShareAnalytics bool
}

FirstTimeSetupResult carries the dialog outcome (pi: FirstTimeSetupResult).

type FooterComponent

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

FooterComponent is the footer line pair: pwd (branch, session name) and token/context stats with the right-aligned model name. When resource stats are enabled (pig-only), the stats line gains a "| CPU·MEM…" segment.

func NewFooterComponent

func NewFooterComponent(session *core.AgentSession, footerData *core.FooterDataProvider) *FooterComponent

NewFooterComponent builds the footer (pi: constructor).

func NewFooterComponentWithView

func NewFooterComponentWithView(session *core.AgentSession, view footerSessionView, footerData ReadonlyFooterDataProvider) *FooterComponent

NewFooterComponentWithView builds the footer with an explicit session view (pig test seam).

func (*FooterComponent) Dispose

func (f *FooterComponent) Dispose()

Dispose stops the resource poller if it is running; git watcher cleanup is handled by the provider (pi: dispose).

func (*FooterComponent) Invalidate

func (f *FooterComponent) Invalidate()

Invalidate is a no-op: git branch caching is handled by the provider (pi: invalidate — kept for call-site compatibility).

func (*FooterComponent) Render

func (f *FooterComponent) Render(width int) []string

func (*FooterComponent) SetAutoCompactEnabled

func (f *FooterComponent) SetAutoCompactEnabled(enabled bool)

SetAutoCompactEnabled toggles the "(auto)" context indicator (pi: setAutoCompactEnabled).

func (*FooterComponent) SetSession

func (f *FooterComponent) SetSession(session *core.AgentSession)

SetSession rebinds the footer to a session (pi: setSession).

pig deviation (2026-09-29): pi's render reads `this.session` directly, so swapping the field is enough there. pig's Render reads through the footerSessionView seam built once in the constructor, so the view must be rebuilt here too — otherwise a session replacement (`/resume`, `/new`, `/fork`, `/import`) left the footer bound to the previous session forever, showing its model / tokens / context window while the live session was a different one (user report: after /resume the footer kept the old model, even though model switches actually applied).

Callers that inject a stub view via NewFooterComponentWithView must not call this with a session (the stub would be replaced by a real view); no caller does.

func (*FooterComponent) SetShowResourceStats

func (f *FooterComponent) SetShowResourceStats(enabled bool)

SetShowResourceStats toggles the footer resource segment (pig-only; pi has no counterpart — the showResourceStats setting). The resource poller starts lazily on first enable and stops while hidden: sampling exists only to feed a visible segment.

func (*FooterComponent) SetTUI

func (f *FooterComponent) SetTUI(ui FooterTUI)

SetTUI injects the render loop handle (pig-only): the resource poller calls RequestRender after each sample so fresh values surface without user input.

type FooterTUI

type FooterTUI interface {
	RequestRender(force bool)
}

FooterTUI is the TUI surface the footer needs (pig addition — narrow interface per the ModelSelectorTUI precedent): the resource-stats poller must wake the render loop when a sample lands, otherwise fresh values surface only on the next keystroke (the TUI is event-driven and does not redraw while idle).

type FrameBody added in v1.0.1

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

FrameBody renders its child at width-1, matching the corner rules' span.

func NewFrameBody added in v1.0.1

func NewFrameBody(child tui.Component) *FrameBody

NewFrameBody wraps a block's content for the corner-frame shells.

func (*FrameBody) HandleMouse added in v1.0.1

func (r *FrameBody) HandleMouse(event *tui.TuiMouseEvent) *tui.TuiMouseEventResult

HandleMouse forwards to the child with the width clamped to the frame span.

func (*FrameBody) Invalidate added in v1.0.1

func (r *FrameBody) Invalidate()

Invalidate forwards to the child.

func (*FrameBody) Render added in v1.0.1

func (r *FrameBody) Render(width int) []string

Render draws the child one column narrower than the viewport width.

type GutterInfo

type GutterInfo struct {
	Position int // displayIndent level where the connector was shown
	Show     bool
}

GutterInfo is the vertical gutter info: Position (displayIndent level where the connector was) and whether to show │ (pi: GutterInfo).

type IdleStatus

type IdleStatus struct{}

IdleStatus renders two blank lines while idle (pi: class IdleStatus).

func (*IdleStatus) Invalidate

func (i *IdleStatus) Invalidate()

Invalidate has no cached state (pi: invalidate).

func (*IdleStatus) Render

func (i *IdleStatus) Render(width int) []string

Render draws the blank filler lines (pi: render).

type LoginDialogComponent

type LoginDialogComponent struct {
	tui.Container

	// Mutator serializes container mutations with the render pipeline (pig
	// addition — see file header). Nil = mutate inline.
	Mutator func(fn func())
	// contains filtered or unexported fields
}

LoginDialogComponent is the login dialog — replaces the editor during login flows (pi: LoginDialogComponent extends Container implements Focusable).

func NewLoginDialogComponent

func NewLoginDialogComponent(
	tuiInstance tui.TUI,
	providerID string,
	onComplete func(success bool, message string),
	providerNameOverride string,
	titleOverride string,
) *LoginDialogComponent

NewLoginDialogComponent builds the dialog (pi: constructor). The name and title overrides are pi's optional providerNameOverride/titleOverride — "" means unset.

func (*LoginDialogComponent) Context

func (d *LoginDialogComponent) Context() context.Context

Context returns the dialog's abort context (pi: get signal — the AbortSignal handed to the login flow; pig hands the context).

func (*LoginDialogComponent) GetFocused

func (d *LoginDialogComponent) GetFocused() bool

GetFocused implements Focusable.

func (*LoginDialogComponent) HandleInput

func (d *LoginDialogComponent) HandleInput(data string)

HandleInput implements InputHandler (pi: handleInput).

func (*LoginDialogComponent) SetFocused

func (d *LoginDialogComponent) SetFocused(value bool)

SetFocused implements Focusable.

func (*LoginDialogComponent) ShowAuth

func (d *LoginDialogComponent) ShowAuth(url string, instructions string)

ShowAuth shows the URL and optional instructions (pi: showAuth — called by the onAuth callback).

func (*LoginDialogComponent) ShowDetails

func (d *LoginDialogComponent) ShowDetails(lines []string)

ShowDetails shows informational text before another login step (pi: showDetails).

func (*LoginDialogComponent) ShowDeviceCode

func (d *LoginDialogComponent) ShowDeviceCode(info ai.OAuthDeviceCodeInfo)

ShowDeviceCode shows the URL and user code (pi: showDeviceCode — called by the onDeviceCode callback).

func (*LoginDialogComponent) ShowInfo

func (d *LoginDialogComponent) ShowInfo(message string, links []auth.AuthInfoLink, showCloseHint bool)

ShowInfo shows provider-owned information and links without starting an auth callback flow (pi: showInfo).

func (*LoginDialogComponent) ShowManualInput

func (d *LoginDialogComponent) ShowManualInput(prompt string) (string, error)

ShowManualInput collects a manual code/URL entry (pi: showManualInput — for callback server providers). Blocks until submit or cancel; the error is "Login cancelled" when aborted (pi: the rejected Promise).

func (*LoginDialogComponent) ShowProgress

func (d *LoginDialogComponent) ShowProgress(message string)

ShowProgress shows a progress message (pi: showProgress — called by the onProgress callback).

func (*LoginDialogComponent) ShowPrompt

func (d *LoginDialogComponent) ShowPrompt(message string, placeholder string) (string, error)

ShowPrompt shows a prompt and waits for input (pi: showPrompt — called by the onPrompt callback). Does NOT clear content, appends to existing (preserves the URL from ShowAuth). Blocks until submit or cancel.

func (*LoginDialogComponent) ShowWaiting

func (d *LoginDialogComponent) ShowWaiting(message string)

ShowWaiting shows a waiting message (pi: showWaiting — for polling flows like GitHub Copilot).

type MCPPanelComponent added in v1.0.0

type MCPPanelComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

MCPPanelComponent renders the /mcp panel (tui.Container + Focusable, like the other selectors).

func NewMCPPanelComponent added in v1.0.0

func NewMCPPanelComponent(opts MCPPanelOptions) *MCPPanelComponent

NewMCPPanelComponent builds the panel. Provider status is snapshotted immediately; a 2s ticker keeps rows fresh while the panel is open (mcp statuses change under the user's eyes: connects, reaps, reconnects).

func (*MCPPanelComponent) Dispose added in v1.0.0

func (p *MCPPanelComponent) Dispose()

Dispose stops the refresh ticker (selectorComponent.dispose hook; the panel is rebuilt on every /mcp open, so leaks would accumulate).

func (*MCPPanelComponent) GetFocused added in v1.0.0

func (p *MCPPanelComponent) GetFocused() bool

SetFocused implements Focusable — propagate to the search input for IME cursor positioning (thinking_selector precedent).

func (*MCPPanelComponent) HandleInput added in v1.0.0

func (p *MCPPanelComponent) HandleInput(keyData string)

HandleInput implements InputHandler: panel actions first (they must win over the select list), then navigation keys, then the filter input. The whole body runs inside p.mutate — in production the TUI lock is reentrant (HandleInput already holds it), and background goroutines serialize through the same hook.

func (*MCPPanelComponent) SetFocused added in v1.0.0

func (p *MCPPanelComponent) SetFocused(value bool)

type MCPPanelOptions added in v1.0.0

type MCPPanelOptions struct {
	Provider        MCPPanelProvider
	Mutate          func(fn func())
	RequestRender   func()
	CopyToClipboard func(text string) error
	OnCancel        func()
	OpenURL         func(url string)
	RefreshInterval time.Duration
}

MCPPanelOptions wires the panel into interactive mode. Mutate serializes UI mutation (interactive passes m.mutateUI: HandleInput reenters the TUI lock, ticker/async callbacks take it fresh); RequestRender wakes the render loop after background updates; CopyToClipboard is the interactive clipboard seam; OpenURL (optional, S12-4) opens the OAuth authorization URL in the browser. RefreshInterval overrides the 2s status refresh tick (tests pass -1 to run without the ticker goroutine; 0 = default).

type MCPPanelProvider added in v1.0.0

type MCPPanelProvider interface {
	Status() []pigmcp.ServerStatus
	ListServerTools(ctx context.Context, server string) ([]pigmcp.ToolInfo, error)
	Reconnect(ctx context.Context, server string) error
	SetServerDisabled(server string, disabled bool) error
	// SetServerDisabledInProject writes the toggle as a project override of a
	// global server (#10277; pi's "Enable/Disable in this project" item).
	SetServerDisabledInProject(server string, disabled bool) error
	// SignIn runs the interactive OAuth sign-in (S12-4; pi: signInWithUi).
	// The prompt shows the authorization URL and collects a pasted redirect
	// URL; openURL (optional) opens the browser.
	SignIn(ctx context.Context, server string, prompt pigmcp.SignInPrompt, openURL func(string)) error
	// SignOut removes stored OAuth credentials and disconnects (pi: signOut).
	SignOut(server string) (bool, error)
}

MCPPanelProvider is the data/action surface the panel needs. *pigmcp.Manager satisfies it; the interface keeps the component fake-able in tests (ReadonlyFooterDataProvider precedent).

type MatchResult

type MatchResult struct {
	Matches bool
	Score   float64
}

MatchResult is the outcome of matching one session against a parsed query (pi: MatchResult). Score is lower-is-better and only meaningful when Matches is true.

func MatchSession

func MatchSession(session *core.SessionInfo, parsed ParsedSearchQuery) MatchResult

MatchSession matches one session against a parsed query (pi: matchSession).

type MermaidTheme

type MermaidTheme interface {
	Fg(color string, text string) string
	Bold(text string) string
}

MermaidTheme is the theme surface the mermaid transformer needs (pig addition: pi passes the Theme object directly; Go needs an interface so the test can stub it — *theme.Theme satisfies it since ThemeColor is a string alias).

type MermaidTransformerOptions

type MermaidTransformerOptions struct {
	// GetMode returns the current mermaid rendering mode.
	GetMode func() core.MermaidRenderingMode
	// Theme resolves the active theme at transform time. pig: pi captures the
	// live global theme object; pig resolves lazily per the T5b-3 decision 11
	// precedent (the global can be replaced via SetTheme). Nil = plain output.
	Theme func() MermaidTheme
}

MermaidTransformerOptions carries the transformer configuration (pi: MermaidTransformerOptions).

type ModelItem

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

ModelItem is one selectable model entry (pi: ModelItem).

type ModelSearchItem

type ModelSearchItem struct {
	ID       string
	Provider string
	Name     string
}

ModelSearchItem is pi's ModelSearchItem (modes/interactive/model-search.ts).

type ModelSelectorComponent

type ModelSelectorComponent struct {
	tui.Container

	// RefreshCatalogs performs the all-catalog refresh (pig addition — see
	// file header).
	RefreshCatalogs func(ctx context.Context) (ai.ModelsRefreshResult, error)
	// contains filtered or unexported fields
}

ModelSelectorComponent renders a model selector with search (pi: ModelSelectorComponent extends Container implements Focusable).

func NewModelSelectorComponent

func NewModelSelectorComponent(
	tuiImpl ModelSelectorTUI,
	currentModel *ai.Model,
	modelRuntime ModelSelectorRuntime,
	scopedModels []core.ScopedModel,
	onSelect func(model ai.Model),
	onCancel func(),
	initialSearchInput string,
	onSelectAsDefault func(model ai.Model),
	defaultModel *ModelSelectorDefaultReference,
	refreshCatalogs func(ctx context.Context) (ai.ModelsRefreshResult, error),
	mutator func(func()),
) *ModelSelectorComponent

NewModelSelectorComponent builds the selector (pi: constructor; initialSearchInput "" = none, onSelectAsDefault nil = hidden, defaultModel nil = none).

func (*ModelSelectorComponent) Dispose

func (s *ModelSelectorComponent) Dispose()

Dispose cancels the background refresh (pi: dispose).

func (*ModelSelectorComponent) GetSearchInput

func (s *ModelSelectorComponent) GetSearchInput() *tui.Input

GetSearchInput exposes the search input (pi: getSearchInput).

func (*ModelSelectorComponent) HandleInput

func (s *ModelSelectorComponent) HandleInput(keyData string)

HandleInput implements InputHandler.

type ModelSelectorDefaultReference

type ModelSelectorDefaultReference struct {
	Provider string
	ID       string
}

ModelSelectorDefaultReference identifies the configured default model (pi: DefaultModelReference).

type ModelSelectorRuntime

type ModelSelectorRuntime interface {
	GetAvailableSnapshot() []ai.Model
	GetModel(providerID, modelID string) (ai.Model, bool)
	GetError() string
}

ModelSelectorRuntime is the runtime surface the selector reads (pig addition; *core.ModelRuntime satisfies it).

type ModelSelectorTUI

type ModelSelectorTUI interface {
	RequestRender(force bool)
}

ModelSelectorTUI is the TUI surface the selector needs (pig addition — pi takes the full TUI but only calls requestRender; the narrow interface keeps the component testable).

type NameFilter

type NameFilter string

NameFilter is the session name filter (pi: NameFilter).

const (
	NameFilterAll   NameFilter = "all"
	NameFilterNamed NameFilter = "named"
)

type OAuthSelectorComponent

type OAuthSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

OAuthSelectorComponent renders an auth provider selector (pi: OAuthSelectorComponent extends Container implements Focusable).

func NewOAuthSelectorComponent

func NewOAuthSelectorComponent(
	mode string,
	providers []AuthSelectorProvider,
	onSelect func(providerID string, authType auth.AuthType),
	onCancel func(),
	initialSearchInput string,
) *OAuthSelectorComponent

NewOAuthSelectorComponent builds the selector (pi: constructor). initialSearchInput optional — "" for none.

func (*OAuthSelectorComponent) GetFocused

func (s *OAuthSelectorComponent) GetFocused() bool

GetFocused implements Focusable.

func (*OAuthSelectorComponent) HandleInput

func (s *OAuthSelectorComponent) HandleInput(keyData string)

HandleInput implements InputHandler (pi: handleInput).

func (*OAuthSelectorComponent) SetFocused

func (s *OAuthSelectorComponent) SetFocused(value bool)

SetFocused implements Focusable.

type ParsedSearchQuery

type ParsedSearchQuery struct {
	Mode   string
	Tokens []SearchToken
	Regex  *regexp.Regexp
	Error  string
}

ParsedSearchQuery is the parsed form of a search query (pi: ParsedSearchQuery). Mode is "tokens" or "regex". Error is set when parsing failed and the query should be treated as non-matching.

func ParseSearchQuery

func ParseSearchQuery(query string) ParsedSearchQuery

ParseSearchQuery parses a search query into tokens or a regex (pi: parseSearchQuery). "re:<pattern>" switches to case-insensitive regex mode; quoted segments become phrase tokens; unbalanced quotes fall back to plain whitespace tokenization.

type ReadonlyFooterDataProvider

type ReadonlyFooterDataProvider interface {
	GetGitBranch() *string
	GetExtensionStatuses() map[string]string
	GetAvailableProviderCount() int
}

ReadonlyFooterDataProvider is the provider view the footer consumes (pi: ReadonlyFooterDataProvider pick type; *core.FooterDataProvider satisfies it).

type RetryStatusIndicator

type RetryStatusIndicator struct {
	StatusIndicator
	// contains filtered or unexported fields
}

RetryStatusIndicator counts down until the retry fires (pi: class RetryStatusIndicator).

func NewRetryStatusIndicator

func NewRetryStatusIndicator(ui tui.TUI, attempt int, maxAttempts int, delayMs int) *RetryStatusIndicator

NewRetryStatusIndicator builds the retry indicator (pi: constructor).

func (*RetryStatusIndicator) Dispose

func (r *RetryStatusIndicator) Dispose()

Dispose stops the countdown and the loader (pi: dispose override).

type ScopedModelsCallbacks

type ScopedModelsCallbacks struct {
	// OnChange fires whenever the enabled model set or order changes
	// (session-only, no persist; pi: onChange — async half dropped, pig
	// callback is sync).
	OnChange func(enabledModelIDs []string)
	// OnPersist fires when the user wants to persist the current selection
	// to settings (pi: onPersist).
	OnPersist func(enabledModelIDs []string)
	// OnCancel fires on escape / Ctrl+C with an empty search (pi: onCancel).
	OnCancel func()
}

ScopedModelsCallbacks carries the component callbacks (pi: ModelsCallbacks).

type ScopedModelsConfig

type ScopedModelsConfig struct {
	AllModels       []ai.Model
	EnabledModelIDs []string // nil = all enabled
	RefreshStatus   string
}

ScopedModelsConfig is the constructor config (pi: ModelsConfig).

type ScopedModelsSelectorComponent

type ScopedModelsSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ScopedModelsSelectorComponent is the model configuration component (pi: ScopedModelsSelectorComponent extends Container implements Focusable).

func NewScopedModelsSelectorComponent

func NewScopedModelsSelectorComponent(config ScopedModelsConfig, callbacks ScopedModelsCallbacks) *ScopedModelsSelectorComponent

NewScopedModelsSelectorComponent builds the selector (pi: constructor).

func (*ScopedModelsSelectorComponent) GetFocused

func (s *ScopedModelsSelectorComponent) GetFocused() bool

GetFocused/SetFocused implement Focusable - propagate to searchInput for IME cursor positioning.

func (*ScopedModelsSelectorComponent) GetSearchInput

func (s *ScopedModelsSelectorComponent) GetSearchInput() *tui.Input

GetSearchInput exposes the search input (pi: getSearchInput).

func (*ScopedModelsSelectorComponent) HandleInput

func (s *ScopedModelsSelectorComponent) HandleInput(data string)

HandleInput implements InputHandler.

func (*ScopedModelsSelectorComponent) SetFocused

func (s *ScopedModelsSelectorComponent) SetFocused(value bool)

func (*ScopedModelsSelectorComponent) SetRefreshStatus

func (s *ScopedModelsSelectorComponent) SetRefreshStatus(message string, kind string)

SetRefreshStatus updates the refresh status line (pi: setRefreshStatus).

func (*ScopedModelsSelectorComponent) UpdateModels

func (s *ScopedModelsSelectorComponent) UpdateModels(models []ai.Model, enabledModelIDs []string, applyEnabled bool)

UpdateModels refreshes the model set (pi: updateModels; enabledModelIDs nil + unset flag → pi uses undefined; pig passes applyEnabled=false).

type SearchToken

type SearchToken struct {
	Kind  SearchTokenKind
	Value string
}

SearchToken is one parsed search token (pi: tokens entry).

type SearchTokenKind

type SearchTokenKind string

SearchTokenKind discriminates fuzzy vs phrase tokens (pi: token.kind).

const (
	// TokenKindFuzzy is a plain fuzzy token (pi: "fuzzy").
	TokenKindFuzzy SearchTokenKind = "fuzzy"
	// TokenKindPhrase is a quoted phrase token (pi: "phrase").
	TokenKindPhrase SearchTokenKind = "phrase"
)

type SelectSubmenu

type SelectSubmenu struct {
	tui.Container
	// contains filtered or unexported fields
}

SelectSubmenu is a single-step submenu that shows a titled select list (pi: SelectSubmenu extends Container). With Searchable, typing filters the list using fuzzy matching.

func NewSelectSubmenu

func NewSelectSubmenu(
	title string,
	description string,
	options []tui.SelectItem,
	currentValue string,
	onSelect func(value string),
	onCancel func(),
	onSelectionChange func(value string),
	submenuOptions *SelectSubmenuOptions,
) *SelectSubmenu

NewSelectSubmenu builds the submenu (pi: constructor).

func (*SelectSubmenu) HandleInput

func (s *SelectSubmenu) HandleInput(data string)

HandleInput implements InputHandler (pi: handleInput).

type SelectSubmenuOptions

type SelectSubmenuOptions struct {
	// Searchable enables type-to-search fuzzy filtering.
	Searchable bool
	// Layout overrides the select list layout (column widths). Nil = default.
	Layout *tui.SelectListLayoutOptions
}

SelectSubmenuOptions configure a SelectSubmenu (pi: SelectSubmenuOptions).

type SessionSelectorComponent

type SessionSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

SessionSelectorComponent renders a session selector (pi: SessionSelectorComponent extends Container implements Focusable).

func NewSessionSelectorComponent

func NewSessionSelectorComponent(
	currentSessionsLoader sessionsLoader,
	allSessionsLoader sessionsLoader,
	onSelect func(sessionPath string),
	onCancel func(),
	onExit func(),
	requestRender func(),
	options *SessionSelectorOptions,
	currentSessionFilePath string,
	mutator func(func()),
) *SessionSelectorComponent

NewSessionSelectorComponent builds the selector (pi: constructor; currentSessionFilePath "" = undefined).

func (*SessionSelectorComponent) GetFocused

func (s *SessionSelectorComponent) GetFocused() bool

GetFocused/SetFocused implement Focusable - propagate to sessionList / renameInput for IME cursor positioning.

func (*SessionSelectorComponent) GetSessionList

func (s *SessionSelectorComponent) GetSessionList() *sessionList

GetSessionList exposes the inner list (pi: getSessionList).

func (*SessionSelectorComponent) HandleInput

func (s *SessionSelectorComponent) HandleInput(data string)

HandleInput implements InputHandler (pi: handleInput).

func (*SessionSelectorComponent) SetFocused

func (s *SessionSelectorComponent) SetFocused(value bool)

type SessionSelectorOptions

type SessionSelectorOptions struct {
	// RenameSession persists a session rename (pi: renameSession?; nil =
	// rename disabled).
	RenameSession func(sessionPath string, nextName string) error
	// ShowRenameHint forces the rename hint (pi: showRenameHint?; nil =
	// follow RenameSession presence).
	ShowRenameHint *bool
	// Keybindings is the coding-agent keybindings manager (pi: keybindings?;
	// nil = fresh defaults).
	Keybindings *core.KeybindingsManager
}

SessionSelectorOptions carries the optional constructor options (pi: options? parameter).

type SettingsCallbacks

type SettingsCallbacks struct {
	OnAutoCompactChange                func(enabled bool)
	OnShowImagesChange                 func(enabled bool)
	OnImageWidthCellsChange            func(width int64)
	OnAutoResizeImagesChange           func(enabled bool)
	OnBlockImagesChange                func(blocked bool)
	OnEnableSkillCommandsChange        func(enabled bool)
	OnSteeringModeChange               func(mode string)
	OnFollowUpModeChange               func(mode string)
	OnTransportChange                  func(transport ai.Transport)
	OnHTTPIdleTimeoutMsChange          func(timeoutMs int64)
	OnCacheWarmingModeChange           func(mode core.CacheWarmingMode)
	OnModelThinkingLevelChange         func(provider string, modelID string, level agent.ThinkingLevel)
	OnModelThinkingLevelRemove         func(provider string, modelID string)
	OnThemeChange                      func(themeSetting string)
	OnThemePreview                     func(themeName string)
	OnHideThinkingBlockChange          func(hidden bool)
	OnMermaidRenderingModeChange       func(mode core.MermaidRenderingMode)
	OnShowCacheMissNoticesChange       func(shown bool)
	OnCollapseChangelogChange          func(collapsed bool)
	OnEnableInstallTelemetryChange     func(enabled bool)
	OnDoubleEscapeActionChange         func(action string)
	OnTreeFilterModeChange             func(mode string)
	OnShowHardwareCursorChange         func(enabled bool)
	OnEditorPaddingXChange             func(padding int64)
	OnOutputPadChange                  func(padding int)
	OnAutocompleteMaxVisibleChange     func(maxVisible int64)
	OnQuietStartupChange               func(quiet core.QuietStartupMode)
	OnDefaultProjectTrustChange        func(defaultProjectTrust core.DefaultProjectTrust)
	OnClearOnShrinkChange              func(enabled bool)
	OnShowTerminalProgressChange       func(enabled bool)
	OnTuiModeChange                    func(mode core.TuiMode)
	OnFullscreenExitOutputChange       func(output core.FullscreenExitOutput)
	OnFullscreenScrollbarChange        func(mode core.ScrollViewScrollbar)
	OnFullscreenCopyOnSelectChange     func(enabled bool)
	OnFullscreenWheelScrollLinesChange func(lines int)
	OnWarningsChange                   func(warnings core.WarningSettings)
	OnCJKSegmenterChange               func(mode string)  // pig-only
	OnShowResourceStatsChange          func(enabled bool) // pig-only
	OnLogoStyleChange                  func(style string) // pig-only
	OnCancel                           func()
}

SettingsCallbacks carries the change handlers (pi: SettingsCallbacks). Optional members (pi: onThemePreview?) stay nil-able.

type SettingsConfig

type SettingsConfig struct {
	AutoCompact                bool
	DefaultModel               string
	CurrentModel               *ai.Model
	AvailableDefaultModels     []ai.Model
	ShowImages                 bool
	ImageWidthCells            int64
	AutoResizeImages           bool
	BlockImages                bool
	EnableSkillCommands        bool
	SteeringMode               string // "all" | "one-at-a-time"
	FollowUpMode               string // "all" | "one-at-a-time"
	Transport                  ai.Transport
	HTTPIdleTimeoutMs          int64
	CacheWarmingMode           core.CacheWarmingMode
	ThinkingLevel              agent.ThinkingLevel
	AvailableThinkingLevels    []agent.ThinkingLevel
	ModelThinkingLevels        map[string]agent.ThinkingLevel
	CurrentTheme               string
	TerminalTheme              theme.TerminalTheme
	AvailableThemes            []string
	HideThinkingBlock          bool
	MermaidRenderingMode       core.MermaidRenderingMode
	ShowCacheMissNotices       bool
	CollapseChangelog          bool
	EnableInstallTelemetry     bool
	DoubleEscapeAction         string // "fork" | "tree" | "none"
	TreeFilterMode             string // "default" | "no-tools" | "user-only" | "labeled-only" | "all"
	ShowHardwareCursor         bool
	EditorPaddingX             int64
	OutputPad                  int // 0 | 1
	AutocompleteMaxVisible     int64
	QuietStartup               core.QuietStartupMode
	DefaultProjectTrust        core.DefaultProjectTrust
	ClearOnShrink              bool
	ShowTerminalProgress       bool
	TuiMode                    core.TuiMode
	FullscreenExitOutput       core.FullscreenExitOutput
	FullscreenScrollbar        core.ScrollViewScrollbar
	FullscreenCopyOnSelect     bool
	FullscreenWheelScrollLines int
	Warnings                   core.WarningSettings
	CJKSegmenter               string // pig-only: "bigram" | "sst" | "gse"
	ShowResourceStats          bool   // pig-only: footer resource segment (MEM now, more later)
	LogoStyle                  string // pig-only: "plain" | "gradient" | "blocks" startup logo
}

SettingsConfig is the settings snapshot the selector renders (pi: SettingsConfig).

type SettingsSelectorComponent

type SettingsSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

SettingsSelectorComponent is the main settings selector component (pi: SettingsSelectorComponent extends Container).

func NewSettingsSelectorComponent

func NewSettingsSelectorComponent(config *SettingsConfig, callbacks *SettingsCallbacks) *SettingsSelectorComponent

NewSettingsSelectorComponent builds the settings panel (pi: constructor).

func (*SettingsSelectorComponent) GetSettingsList

func (s *SettingsSelectorComponent) GetSettingsList() *tui.SettingsList

GetSettingsList returns the underlying settings list (pi: getSettingsList).

type ShowImagesSelectorComponent

type ShowImagesSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ShowImagesSelectorComponent renders a show images selector with borders (pi: ShowImagesSelectorComponent extends Container).

func NewShowImagesSelectorComponent

func NewShowImagesSelectorComponent(currentValue bool, onSelect func(show bool), onCancel func()) *ShowImagesSelectorComponent

NewShowImagesSelectorComponent builds the selector (pi: constructor).

func (*ShowImagesSelectorComponent) GetSelectList

func (s *ShowImagesSelectorComponent) GetSelectList() *tui.SelectList

GetSelectList returns the underlying select list (pi: getSelectList).

type SkillInvocationMessageComponent

type SkillInvocationMessageComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

SkillInvocationMessageComponent renders a skill invocation (pi: class SkillInvocationMessageComponent extends Box; pig frames it with state-colored borders instead of the pi background fill — docs/feat/BUILTIN-THEME-PALETTES.md §BLOCK-BORDERS).

func NewSkillInvocationMessageComponent

func NewSkillInvocationMessageComponent(skillBlock *core.ParsedSkillBlock, markdownTheme *tui.MarkdownTheme) *SkillInvocationMessageComponent

NewSkillInvocationMessageComponent builds the component (pi: constructor; markdownTheme nil = getMarkdownTheme()).

func (*SkillInvocationMessageComponent) Invalidate

func (c *SkillInvocationMessageComponent) Invalidate()

Invalidate re-renders (pi: invalidate override).

func (*SkillInvocationMessageComponent) SetExpanded

func (c *SkillInvocationMessageComponent) SetExpanded(expanded bool)

SetExpanded toggles the expanded state (pi: setExpanded).

type SortMode

type SortMode string

SortMode is the session list sort mode (pi: SortMode).

const (
	SortModeThreaded  SortMode = "threaded"
	SortModeRecent    SortMode = "recent"
	SortModeRelevance SortMode = "relevance"
)

type StatusBorderRenderer added in v0.86.0

type StatusBorderRenderer interface {
	RenderInBorder(width int) string
	RenderSpinnerInBorder(width int) string
}

StatusBorderRenderer is the editor-top-border embed surface (pi v0.86.0: renderInBorder/renderSpinnerInBorder moved from WorkingStatusIndicator to StatusIndicator, so every indicator subtype embeds — see the new interactive-tui/status-indicator tests). pig surfaces the method set as an interface because Go subtypes are not assignable to the base pointer type.

type StatusIndicator

type StatusIndicator struct {
	*tui.Loader

	Kind StatusIndicatorKind
}

StatusIndicator is a Loader tagged with its kind (pi: class StatusIndicator extends Loader). The Loader is embedded by POINTER: NewLoader starts its animation goroutine in the constructor, so a by-value embed would leave the ticker mutating a discarded copy while the rendered instance froze on the first frame (the streaming-spinner freeze bug). pi's inheritance maps to the shared instance behind the pointer.

func NewBranchSummaryStatusIndicator

func NewBranchSummaryStatusIndicator(ui tui.TUI) *StatusIndicator

NewBranchSummaryStatusIndicator builds the branch-summary indicator (pi: class BranchSummaryStatusIndicator).

func NewCompactionStatusIndicator

func NewCompactionStatusIndicator(ui tui.TUI, reason CompactionStatusReason) *StatusIndicator

NewCompactionStatusIndicator builds the compaction indicator (pi: class CompactionStatusIndicator).

func NewStatusIndicator

func NewStatusIndicator(
	kind StatusIndicatorKind,
	ui tui.TUI,
	spinnerColorFn func(string) string,
	messageColorFn func(string) string,
	message string,
	indicator *core.WorkingIndicatorOptions,
) *StatusIndicator

NewStatusIndicator builds the indicator (pi: constructor).

func (*StatusIndicator) Dispose

func (s *StatusIndicator) Dispose()

Dispose stops the loader animation (pi: dispose).

func (*StatusIndicator) IndicatorKind

func (s *StatusIndicator) IndicatorKind() StatusIndicatorKind

IndicatorKind exposes the indicator kind through the interface the interactive shell consumes (pig addition; pi reads the `kind` property).

func (*StatusIndicator) RenderInBorder added in v0.86.0

func (s *StatusIndicator) RenderInBorder(width int) string

RenderInBorder renders the indicator line for embedding into an editor border of the given width (pi: renderInBorder, v0.86.0 on the base class). Strips the loader's leading blank line and trailing padding.

func (*StatusIndicator) RenderSpinnerInBorder added in v0.86.0

func (s *StatusIndicator) RenderSpinnerInBorder(width int) string

RenderSpinnerInBorder renders only the spinner frame, for the narrow fallback when the full message cannot fit (pi: renderSpinnerInBorder, v0.86.0 on the base class).

func (*StatusIndicator) SetIndicator

func (s *StatusIndicator) SetIndicator(indicator *core.WorkingIndicatorOptions)

SetIndicator replaces the animation options (pi: setIndicator override on WorkingStatusIndicator; nil restores the default spinner).

type StatusIndicatorKind

type StatusIndicatorKind string

StatusIndicatorKind is pi's StatusIndicatorKind union.

const (
	StatusKindWorking       StatusIndicatorKind = "working"
	StatusKindRetry         StatusIndicatorKind = "retry"
	StatusKindCompaction    StatusIndicatorKind = "compaction"
	StatusKindBranchSummary StatusIndicatorKind = "branchSummary"
)

type SteppedSubmenu

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

SteppedSubmenu is a generic N-step submenu built on top of SelectSubmenu (pi: SteppedSubmenu extends Container).

Each step's options can depend on prior selections via the shared context. Esc goes back one step; Esc at step 0 cancels. With Loop, completing the final step invokes onComplete then returns to step 0.

func NewSteppedSubmenu

func NewSteppedSubmenu(
	steps []SteppedSubmenuStep,
	onComplete func(context map[string]string),
	onCancel func(),
	opts *SteppedSubmenuOptions,
) *SteppedSubmenu

NewSteppedSubmenu builds the stepped submenu (pi: constructor; opts optional — pass nil for defaults).

func (*SteppedSubmenu) HandleInput

func (s *SteppedSubmenu) HandleInput(data string)

HandleInput implements InputHandler (pi: handleInput).

func (*SteppedSubmenu) Invalidate

func (s *SteppedSubmenu) Invalidate()

Invalidate implements Component (pi: invalidate).

func (*SteppedSubmenu) Render

func (s *SteppedSubmenu) Render(width int) []string

Render implements Component (pi: render delegates to activeComponent).

type SteppedSubmenuOptions

type SteppedSubmenuOptions struct {
	// StartAtStep starts at this step index (0-based), skipping earlier
	// steps. Requires InitialContext for skipped keys.
	StartAtStep int
	// InitialContext pre-fills selections for skipped steps.
	InitialContext map[string]string
	// Loop loops back to step 0 after completing the last step instead of
	// closing.
	Loop bool
}

SteppedSubmenuOptions carries pi's SteppedSubmenuOptions.

type SteppedSubmenuStep

type SteppedSubmenuStep struct {
	// Key is the unique key — the selected value is stored in the result
	// context under this key.
	Key string
	// Title is shown at the top of the step (pi: string variant).
	Title string
	// TitleFunc receives prior selections (pi: function variant).
	TitleFunc func(context map[string]string) string
	// Description is shown below the title (pi: string variant).
	Description string
	// DescriptionFunc receives prior selections (pi: function variant).
	DescriptionFunc func(context map[string]string) string
	// Options builds the option list for this step, fresh each time the step
	// is shown.
	Options func(context map[string]string) []tui.SelectItem
	// Preselect optionally pre-selects a value when entering this step
	// (pi: preselect?; nil/"" = none).
	Preselect func(context map[string]string) string
	// Searchable enables type-to-search fuzzy filtering for this step.
	Searchable bool
	// Layout overrides the select list layout (column widths) for this step.
	Layout *tui.SelectListLayoutOptions
}

SteppedSubmenuStep is one step in a SteppedSubmenu (pi: SteppedSubmenuStep). Title/Description are the string variants; the function variants (pi: `string | ((context) => string)`) go in TitleFunc / DescriptionFunc — exactly one of each pair must be set.

type ThemeSelectorComponent

type ThemeSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ThemeSelectorComponent renders a theme selector (pi: ThemeSelectorComponent extends Container).

func NewThemeSelectorComponent

func NewThemeSelectorComponent(
	currentTheme string,
	onSelect func(themeName string),
	onCancel func(),
	onPreview func(themeName string),
) *ThemeSelectorComponent

NewThemeSelectorComponent builds the selector (pi: constructor).

func (*ThemeSelectorComponent) GetSelectList

func (s *ThemeSelectorComponent) GetSelectList() *tui.SelectList

GetSelectList exposes the inner list (pi: getSelectList).

type ThemeSubmenu

type ThemeSubmenu struct {
	tui.Container
	// contains filtered or unexported fields
}

ThemeSubmenu is the theme picker submenu with single-theme and light/dark-automatic modes (pi: ThemeSubmenu extends Container).

func NewThemeSubmenu

func NewThemeSubmenu(
	currentThemeSetting string,
	terminalTheme theme.TerminalTheme,
	availableThemes []string,
	callbacks *SettingsCallbacks,
	onDone func(selectedValue string),
) *ThemeSubmenu

NewThemeSubmenu builds the theme submenu (pi: constructor). onDone receives the selected setting, or "" when cancelled (pi: onDone with undefined).

func (*ThemeSubmenu) HandleInput

func (t *ThemeSubmenu) HandleInput(data string)

HandleInput implements InputHandler (pi: handleInput).

type ThinkingSelectorComponent

type ThinkingSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ThinkingSelectorComponent renders a thinking level selector with borders (pi: ThinkingSelectorComponent extends Container implements Focusable).

func NewThinkingSelectorComponent

func NewThinkingSelectorComponent(
	currentLevel agent.ThinkingLevel,
	availableLevels []agent.ThinkingLevel,
	onSelect func(level agent.ThinkingLevel),
	onCancel func(),
	onSelectAsDefault func(level agent.ThinkingLevel),
	defaultThinkingLevel agent.ThinkingLevel,
) *ThinkingSelectorComponent

NewThinkingSelectorComponent builds the selector (pi: constructor; onSelectAsDefault/defaultThinkingLevel optional — nil/"").

func (*ThinkingSelectorComponent) GetFocused

func (s *ThinkingSelectorComponent) GetFocused() bool

GetFocused/SetFocused implement Focusable - propagate to searchInput for IME cursor positioning.

func (*ThinkingSelectorComponent) GetSelectList

func (s *ThinkingSelectorComponent) GetSelectList() *tui.SelectList

GetSelectList exposes the inner list (pi: getSelectList).

func (*ThinkingSelectorComponent) HandleInput

func (s *ThinkingSelectorComponent) HandleInput(keyData string)

HandleInput implements InputHandler.

func (*ThinkingSelectorComponent) SetFocused

func (s *ThinkingSelectorComponent) SetFocused(value bool)

type ToolExecutionComponent

type ToolExecutionComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

ToolExecutionComponent renders one tool execution row (pi: class ToolExecutionComponent extends Container). updateDisplay mutates the child tree while Render reads it, so the pi single-thread assumptions are guarded with a mutex (repo precedent: editor components).

func NewToolExecutionComponent

func NewToolExecutionComponent(
	toolName string,
	toolCallID string,
	args any,
	options ToolExecutionOptions,
	toolDefinition *tools.ToolDefinition,
	ui tui.TUI,
	cwd string,
) *ToolExecutionComponent

NewToolExecutionComponent builds the component (pi: constructor).

func (*ToolExecutionComponent) HandleMouse

HandleMouse routes mouse events in the self-render shell into the self-render container (pi: handleMouse override; the leading blank line is not part of the self-render content).

func (*ToolExecutionComponent) Invalidate

func (c *ToolExecutionComponent) Invalidate()

Invalidate invalidates the component and rebuilds it (pi: invalidate override).

func (*ToolExecutionComponent) MarkExecutionStarted

func (c *ToolExecutionComponent) MarkExecutionStarted()

MarkExecutionStarted flags the execution start (pi: markExecutionStarted).

func (*ToolExecutionComponent) Render

func (c *ToolExecutionComponent) Render(width int) []string

Render renders the component (pi: render override).

func (*ToolExecutionComponent) SetArgsComplete

func (c *ToolExecutionComponent) SetArgsComplete()

SetArgsComplete flags complete streamed args (pi: setArgsComplete).

func (*ToolExecutionComponent) SetExpanded

func (c *ToolExecutionComponent) SetExpanded(expanded bool)

SetExpanded toggles the full-output view (pi: setExpanded).

func (*ToolExecutionComponent) SetImageWidthCells

func (c *ToolExecutionComponent) SetImageWidthCells(width int)

SetImageWidthCells sets the image cell width (pi: setImageWidthCells).

func (*ToolExecutionComponent) SetShowImages

func (c *ToolExecutionComponent) SetShowImages(show bool)

SetShowImages toggles inline image rendering (pi: setShowImages).

func (*ToolExecutionComponent) UpdateArgs

func (c *ToolExecutionComponent) UpdateArgs(args any)

UpdateArgs replaces the streamed arguments (pi: updateArgs).

func (*ToolExecutionComponent) UpdateResult

func (c *ToolExecutionComponent) UpdateResult(result ToolExecutionResult, isPartial bool)

UpdateResult sets the (possibly partial) result (pi: updateResult).

type ToolExecutionOptions

type ToolExecutionOptions struct {
	ShowImages      *bool
	ImageWidthCells *int
}

ToolExecutionOptions carries the component options (pi: ToolExecutionOptions).

type ToolExecutionResult

type ToolExecutionResult struct {
	Content []types.Content
	Details any
	IsError bool
}

ToolExecutionResult is the updateResult argument shape (pi: the inline { content, details?, isError } object).

type TreeSelectorComponent

type TreeSelectorComponent struct {
	tui.Container

	// OnCopy is the copy callback; text "" = undefined (pi: public onCopy?).
	OnCopy func(text string)
	// contains filtered or unexported fields
}

TreeSelectorComponent renders a session tree selector for navigation (pi: TreeSelectorComponent extends Container implements Focusable).

func NewTreeSelectorComponent

func NewTreeSelectorComponent(
	tree []*core.SessionTreeNode,
	currentLeafID string,
	terminalHeight int,
	onSelect func(entryID string),
	onCancel func(),
	onLabelChange func(entryID string, label *string),
	initialSelectedID string,
	initialFilterMode FilterMode,
) *TreeSelectorComponent

NewTreeSelectorComponent builds the selector (pi: constructor). onLabelChange and initialSelectedID/initialFilterMode optional (nil/""/"").

func (*TreeSelectorComponent) GetFocused

func (s *TreeSelectorComponent) GetFocused() bool

GetFocused/SetFocused implement Focusable - propagate to labelInput when active for IME cursor positioning.

func (*TreeSelectorComponent) GetTreeList

func (s *TreeSelectorComponent) GetTreeList() *treeList

GetTreeList exposes the inner list (pi: getTreeList).

func (*TreeSelectorComponent) HandleInput

func (s *TreeSelectorComponent) HandleInput(keyData string)

HandleInput implements InputHandler.

func (*TreeSelectorComponent) SetFocused

func (s *TreeSelectorComponent) SetFocused(value bool)

type TrustSelection

type TrustSelection struct {
	Trusted bool
	Updates []core.ProjectTrustUpdate
}

TrustSelection is the user's trust decision (pi: TrustSelection = Pick<ProjectTrustOption, "trusted" | "updates">).

type TrustSelectorComponent

type TrustSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

TrustSelectorComponent renders the project trust selector (pi: TrustSelectorComponent extends Container).

func NewTrustSelectorComponent

func NewTrustSelectorComponent(options TrustSelectorOptions) *TrustSelectorComponent

NewTrustSelectorComponent builds the selector (pi: constructor).

func (*TrustSelectorComponent) HandleInput

func (t *TrustSelectorComponent) HandleInput(keyData string)

HandleInput implements InputHandler (pi: handleInput).

type TrustSelectorOptions

type TrustSelectorOptions struct {
	Cwd            string
	SavedDecision  *core.ProjectTrustStoreEntry
	ProjectTrusted bool
	OnSelect       func(selection TrustSelection)
	OnCancel       func()
}

TrustSelectorOptions configure the trust selector (pi: TrustSelectorOptions).

type UserMessageComponent

type UserMessageComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

UserMessageComponent renders a user message (pi: class UserMessageComponent extends Container).

func NewUserMessageComponent

func NewUserMessageComponent(text string, markdownTheme *tui.MarkdownTheme, outputPad int, markdownTransformers []core.MarkdownTransformer, ruleColor func(string) string) *UserMessageComponent

NewUserMessageComponent builds the component (pi: constructor; markdownTheme nil = getMarkdownTheme(), outputPad 0 = default 1, ruleColor nil = theme "border" — pig-only extension).

func (*UserMessageComponent) Render

func (c *UserMessageComponent) Render(width int) []string

Render wraps the output in shell-prompt OSC 133 zones (pi: render).

func (*UserMessageComponent) SetOutputPad

func (c *UserMessageComponent) SetOutputPad(padding int)

SetOutputPad updates the padding and re-renders (pi: setOutputPad).

type UserMessageItem

type UserMessageItem struct {
	// ID is the entry ID in the session.
	ID string
	// Text is the message text.
	Text string
	// Timestamp is optional (pi: timestamp?; currently unused by the
	// renderer, kept for shape fidelity).
	Timestamp string
}

UserMessageItem is one selectable user message (pi: UserMessageItem).

type UserMessageSelectorComponent

type UserMessageSelectorComponent struct {
	tui.Container
	// contains filtered or unexported fields
}

UserMessageSelectorComponent renders a user message selector for branching (pi: UserMessageSelectorComponent extends Container).

func NewUserMessageSelectorComponent

func NewUserMessageSelectorComponent(
	messages []UserMessageItem,
	onSelect func(entryID string),
	onCancel func(),
	initialSelectedID string,
) *UserMessageSelectorComponent

NewUserMessageSelectorComponent builds the selector (pi: constructor). initialSelectedID optional — "" for none.

func (*UserMessageSelectorComponent) GetMessageList

func (s *UserMessageSelectorComponent) GetMessageList() *userMessageList

GetMessageList returns the message list (pi: getMessageList).

type WarningSettingsSubmenu

type WarningSettingsSubmenu struct {
	tui.Container
	// contains filtered or unexported fields
}

WarningSettingsSubmenu is a submenu component for editing the warning toggles (pi: WarningSettingsSubmenu extends Container).

func NewWarningSettingsSubmenu

func NewWarningSettingsSubmenu(warnings core.WarningSettings, onChange func(warnings core.WarningSettings), onCancel func()) *WarningSettingsSubmenu

NewWarningSettingsSubmenu builds the warnings submenu (pi: constructor).

func (*WarningSettingsSubmenu) HandleInput

func (w *WarningSettingsSubmenu) HandleInput(data string)

HandleInput implements InputHandler (pi: handleInput).

type WorkingStatusIndicator

type WorkingStatusIndicator struct {
	StatusIndicator
}

WorkingStatusIndicator is the default streaming indicator (pi: class WorkingStatusIndicator). Value-embeds StatusIndicator: the Loader state lives behind the embedded pointer, so copies are safe (same reasoning as RetryStatusIndicator).

func NewWorkingStatusIndicator

func NewWorkingStatusIndicator(ui tui.TUI, message string, indicator *core.WorkingIndicatorOptions, colorFn func(string) string) *WorkingStatusIndicator

NewWorkingStatusIndicator builds the working indicator (pi: constructor; colorFn nil = default accent/muted coloring; when set it colors both the spinner and the message — used to match the editor border color when the indicator is embedded in the editor top border).

func (*WorkingStatusIndicator) SetIndicator

func (w *WorkingStatusIndicator) SetIndicator(indicator *core.WorkingIndicatorOptions)

SetIndicator replaces the animation options (pi: setIndicator override on WorkingStatusIndicator; nil restores the default spinner). pi v0.86.0 dropped this override and calls setIndicator on the base; pig keeps the WorkingIndicatorOptions → loader-options conversion here because only working indicators receive them.

Jump to

Keyboard shortcuts

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