Documentation
¶
Overview ¶
Package tui provides a terminal user interface for AWF workflows.
The TUI layer is an interface adapter in the hexagonal architecture, sitting at the same level as the CLI package. It translates Bubbletea v2 events and user keystrokes into application service calls and renders responses as styled terminal output via Lipgloss v2 and Glamour v2. No domain logic or infrastructure details reside here—only presentation, routing, and coordination between the domain model and the view.
Architecture Role ¶
In the hexagonal architecture:
- The TUI Model receives user input from Bubbletea key/mouse events
- The Bridge adapter translates between service interfaces and tea.Cmd factories
- Tab sub-models encapsulate per-tab state and rendering
- The Model delegates business operations to application service ports (WorkflowLister, WorkflowFacade, HistoryProvider)
The TUI depends on application service ports defined in bridge.go; it never imports infrastructure packages directly. Service implementations are injected via NewCommand and buildBridge at CLI startup. All workflow execution routes through the WorkflowFacade port (ports.WorkflowFacade) — the legacy WorkflowRunner port has been removed (F108 TUI-DC-001/002/003).
Bubbletea Model-Update-View Pattern ¶
The package follows the Elm architecture as implemented by Bubbletea:
- Init() returns an initial tea.Cmd (typically LoadWorkflows via Bridge)
- Update(msg) dispatches incoming messages to the appropriate handler, returns a new Model and an optional tea.Cmd for side effects
- View() renders the full screen string from current model state
All sub-models (tab types) follow the same convention: value receivers that return (TabType, tea.Cmd). The root Model delegates unhandled messages to the active tab's Update method.
Tab Architecture ¶
The Model hosts four tabs (Tab enum: TabWorkflows, TabMonitoring, TabHistory, TabExternalLogs; labels in tabLabels [4]string), each implemented as a standalone sub-model:
## Tab 1: Workflows (tab_workflows.go)
Filterable, keyboard-navigable list of available workflow definitions. Backed by a bubbles list.Model with a DefaultDelegate for two-line rows (workflow name + description and step count). Supports:
- Enter: launch selected workflow (emits LaunchWorkflowMsg)
- 'v': validate selected workflow via Bridge.ValidateWorkflow
- Esc: dismiss validation overlay or clear filter
- /: enter filter mode (delegated to list.Model)
## Tab 2: Monitoring (tab_monitoring.go)
Live execution dashboard with a two-panel layout:
- Left panel (40%): execution tree with step status icons (see tree.go)
- Right panel (60%): scrollable viewport showing selected step output
State is updated event-driven, not by polling: MonitoringTab.StartEventLoop spawns a goroutine that ranges over ports.RunSession.Events() and forwards each facade event into the Bubbletea update loop as a facadeEventMsg (terminal events also emit an ExecutionFinishedMsg). The earlier 200 ms tick loop that polled ExecutionContext.GetAllStepStates() has been removed. Navigation keys (up/k, down/j) move the tree selection; 'f' jumps to the bottom and re-enables auto-scroll. The tab auto-selects the first failed node to surface errors immediately.
## Tab 3: History (tab_history.go)
Filterable execution history list with a detail view:
- Text filter: substring match on workflow name (case-insensitive)
- Tab key: cycles status filter (all → success → failed → all)
- Enter: opens detail view for selected record
- Esc: returns to list view from detail
Statistics footer shows total, success, failed, cancelled counts and average duration in milliseconds.
Agent conversation turns are NOT a separate tab: they are surfaced inline by the Monitoring tab (tab_monitoring.go), which buffers agent_step events from the facade RunSession stream and renders them alongside step progress. An earlier design sketched a dedicated "Agent Conversations (tab_agent.go)" tab; it was never implemented and the responsibility folded into Monitoring.
## Tab 4: External Logs (tab_logs.go)
Tailed view of the AWF audit JSONL log file. An offset-based Tailer reads one line per poll interval from the AWF audit.jsonl file and emits LogLineMsg. Each entry shows the event type, workflow name, status, duration, and any error message. File rotation is detected automatically and surfaces a notice; the tab re-watches the path on each tick until the file reappears. Supports up to 1000 log entries (maxLogEntries) with auto-scroll; 'f' jumps to the bottom and re-enables auto-scroll after manual upward scroll.
Bridge Adapter Pattern ¶
Bridge (bridge.go) is the anti-corruption layer between the Bubbletea event loop and application service interfaces. It exposes factory methods that return tea.Cmd closures:
- Bridge.LoadWorkflows: fetches all workflow definitions → WorkflowsLoadedMsg
- Bridge.LoadHistory: fetches execution records and stats → HistoryLoadedMsg
- Bridge.RunWorkflowViaFacade: starts a workflow execution via facade → ExecutionStartedMsg
- Bridge.ValidateWorkflow: validates a workflow by name → ValidationResultMsg or ErrMsg
Bridge fields may be nil independently; a nil dependency returns ErrMsg with a descriptive error. This enables partial service wiring without panics.
When CommandConfig is nil or all fields are nil (bridgeless mode), the Model initializes without a Bridge. Init() returns a no-op WorkflowsLoadedMsg so the update loop starts cleanly. Bridgeless mode is suitable for read-only display of local state without live service calls.
All workflow execution is facade-driven. Bridge.RunWorkflowViaFacade (F108) is the sole execution entry point; the WorkflowRunner port and the legacy RunWorkflowAsync path have been removed. SetFacade must be called before any execution command is issued.
Message Flow ¶
Messages flow through the Update loop in this order:
- Global key messages (1–4 for tab switching, q/ctrl+c to quit) are handled by the root Model before delegation.
- tea.WindowSizeMsg is propagated to all four tab sub-models simultaneously so each can reflow its layout.
- Domain messages (WorkflowsLoadedMsg, ExecutionStartedMsg, etc.) are handled by the root Model and update the relevant tab's state fields.
- Unhandled messages are forwarded to the active tab via updateActiveTab.
- Tab sub-models return (NewTab, tea.Cmd); the root Model embeds the updated tab and schedules any returned command for the next event loop iteration.
Tree Rendering System ¶
tree.go provides BuildTree and RenderTree for visualizing workflow execution:
- BuildTree(steps, states): constructs a []*TreeNode hierarchy from ordered workflow steps and their current StepState snapshots
- RenderTree(roots): produces a UTF-8 tree string with box-drawing characters and status icons (✓ completed, ✗ failed, ⟳ running, ○ pending)
- TreeNode carries Name, Status, Depth, Output, and Children for recursive rendering and keyboard navigation in MonitoringTab
JSONL Tailer System ¶
tailer.go provides offset-based JSONL file tailing:
- NewTailer(path): creates a Tailer at the given path with offset=0
- Tailer.Next(): returns a tea.Cmd that reads exactly one new line per call; returns nil tea.Msg at EOF, logRotationMsg on file-not-found/OS errors
- parseLine: maps AWF audit JSONL keys (event, timestamp, workflow_name, execution_id, status, duration_ms, user, error) to LogEntry fields
The 1 MB scanner buffer (1024*1024 bytes) accommodates large single-line JSON objects from verbose agent outputs without truncation.
Key Bindings (keys.go) ¶
All key bindings are declared as package-level key.Binding variables in keys.go using bubbles/key. Update methods use key.Matches(msg, keyXxx) instead of raw msg.String() switch statements. This enables:
- Semantic key binding names (keyFollow, keyValidate) over string literals
- Composable multi-key bindings (keyUp matches both "up" and "k")
- Integration with bubbles/help for contextual help display
Global (handled by root Model):
- 1–4: switch to the corresponding tab (keyTab1–keyTab4)
- q: quit (keyQuit), ctrl+c: force quit (keyForceQuit)
- ?: toggle help bar (keyHelp)
Workflows tab:
- enter: launch selected workflow (keySelect)
- v: validate selected workflow (keyValidate)
- /: enter filter mode (keyFilter)
- esc: dismiss overlay or clear filter (keyBack)
Monitoring tab:
- ↑/k, ↓/j: navigate execution tree (keyUp, keyDown)
- f: jump to bottom and re-enable auto-scroll (keyFollow)
- PageUp/PageDown: scroll log viewport (delegated to viewport)
History tab (using bubbles/table for cursor and scroll management):
- ↑/↓: navigate record table (delegated to table.Model)
- tab: cycle status filter (keyCycleFilter)
- enter: open detail view (keySelect)
- esc: close detail view (keyBack)
- /: focus text filter (keyFilter)
Monitoring/Logs tabs (scrollable viewports):
- f: jump to bottom and re-enable auto-scroll (keyFollow)
- PageUp/PageDown, ↑/↓: scroll viewport (delegated to viewport)
Help System (bubbles/help) ¶
The root Model holds a help.Model that renders a contextual help bar at the bottom of the screen. Each tab provides its own help.KeyMap implementation (workflowsHelpKeys, monitoringHelpKeys, etc.) returned by activeHelpKeys(). Pressing "?" toggles between short and full help display.
Spinner Integration (bubbles/spinner) ¶
MonitoringTab and WorkflowsTab embed a spinner.Model for async operation feedback. The monitoring spinner is visible while waiting for the execution to begin emitting events; showSpinner is cleared once execution state arrives (ExecutionStartedMsg / ExecutionFinishedMsg on the event-driven path). The workflows spinner is visible during validation (validating=true between handleValidate and ValidationResultMsg).
Auto-Scroll Helper (viewportscroll.go) ¶
viewportAutoScroll(vp, &autoScroll, msg) wraps vp.Update(msg) and clears the autoScroll flag when the user scrolls away from the bottom. Used by MonitoringTab and LogsTab to eliminate duplicated scroll-tracking logic. The follow key (keyFollow) re-enables auto-scroll and jumps to bottom.
Design Principles ¶
- Thin adapter layer: all business logic in application/domain layers
- Bridgeless mode: TUI is functional without any service wiring
- Value receiver convention: all Update/View methods use value receivers following Bubbletea's immutable model pattern
- Zero infrastructure imports: Bridge wraps service interfaces; no direct repository, executor, or logger imports in this package
- Native Bubbles components: use key.Binding, help.Model, table.Model, spinner.Model, list.Model, viewport.Model, and textinput.Model from the Bubbles ecosystem rather than reimplementing their functionality
- Graceful degradation: nil bridge fields, missing files, and malformed JSON all produce informative messages rather than crashes
- Context propagation: all Bridge methods accept context.Context for cancellation and deadline support
Index ¶
- Variables
- func EmptyStateView(icon, title, subtitle string) string
- func HeaderBar(left, right string, width int) string
- func NewCommand() *cobra.Command
- func Panel(title, content string, width, height int, active bool) string
- func RenderEventsToTUIMsgs(events []ports.Event) []byte
- func RenderTree(nodes []*TreeNode) string
- func Separator(width int) string
- func StatusBadge(status workflow.ExecutionStatus) string
- func StatusBadgeFromString(status string) string
- func StatusBadgeIcon(status workflow.ExecutionStatus) string
- func StatusIcon(status workflow.ExecutionStatus) string
- type Bridge
- func (b *Bridge) LoadHistory(ctx context.Context) tea.Cmd
- func (b *Bridge) LoadWorkflows(ctx context.Context) tea.Cmd
- func (b *Bridge) RunWorkflowViaFacade(ctx context.Context, name string, inputs map[string]any) tea.Cmd
- func (b *Bridge) SetFacade(f ports.WorkflowFacade)
- func (b *Bridge) ValidateWorkflow(ctx context.Context, name string) tea.Cmd
- type ErrMsg
- type ExecutionFinishedMsg
- type ExecutionStartedMsg
- type HistoryLoadedMsg
- type HistoryProvider
- type HistoryTab
- type InputRequestedMsg
- type LaunchWorkflowMsg
- type LogBatchMsg
- type LogEntry
- type LogLineMsg
- type LogsTab
- type Model
- type MonitoringTab
- func (t MonitoringTab) Init() tea.Cmd
- func (t MonitoringTab) InputActive() bool
- func (t *MonitoringTab) SetInputReader(r *TUIInputReader)
- func (t *MonitoringTab) SetSender(send func(tea.Msg))
- func (t *MonitoringTab) SetStream(s *StreamBuffer)
- func (t *MonitoringTab) SetWorkflow(wf *workflow.Workflow)
- func (t *MonitoringTab) StartEventLoop(ctx context.Context, sess ports.RunSession)
- func (t MonitoringTab) Update(msg tea.Msg) (MonitoringTab, tea.Cmd)
- func (t MonitoringTab) View() string
- type MsgSender
- type StreamBuffer
- type TUIInputReader
- type Tab
- type Tailer
- type TreeNode
- type ValidationResultMsg
- type WorkflowLister
- type WorkflowsLoadedMsg
- type WorkflowsTab
Constants ¶
This section is empty.
Variables ¶
var ( ColorPrimary color.Color = lipgloss.Color("99") // Indigo — active tab, selection, titles ColorPrimaryLight color.Color = lipgloss.Color("141") // Lavender — active borders, secondary accents ColorSuccess color.Color = lipgloss.Color("78") // Green — completed, success ColorError color.Color = lipgloss.Color("204") // Rose red — failed, errors ColorWarning color.Color = lipgloss.Color("214") // Orange — cancelled, warnings ColorRunning color.Color = lipgloss.Color("81") // Cyan — running, spinners ColorMuted color.Color = lipgloss.Color("242") // Gray — secondary text, inactive borders ColorSurface color.Color = lipgloss.Color("236") // Dark gray — panel backgrounds ColorText color.Color = lipgloss.Color("252") // Off-white — primary text )
Color palette — indigo/violet accent, balanced density.
var ( StyleTabActive = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("255")). Background(ColorPrimary). Padding(0, 2) StyleTabInactive = lipgloss.NewStyle(). Foreground(ColorMuted). Padding(0, 2) StyleSelectedRow = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("255")). Background(ColorPrimary) StyleStatusBar = lipgloss.NewStyle(). Background(ColorSurface). Foreground(ColorText). Padding(0, 1) StyleEmptyState = lipgloss.NewStyle(). Foreground(ColorMuted). Padding(1, 2) StyleHeader = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimaryLight) StyleInputLabel = lipgloss.NewStyle(). Bold(true). Foreground(ColorText) StyleInputHint = lipgloss.NewStyle(). Foreground(ColorMuted) StyleErrorBanner = lipgloss.NewStyle(). Foreground(ColorError). Bold(true) )
Functions ¶
func EmptyStateView ¶
EmptyStateView renders a centered empty state with icon, title, and subtitle.
func NewCommand ¶
NewCommand returns the cobra.Command for `awf tui`.
func RenderEventsToTUIMsgs ¶
RenderEventsToTUIMsgs projects facade events to their TUI tea.Msg representation.
func RenderTree ¶
RenderTree produces a formatted string representing the execution tree. Each node is rendered with a status icon, its name, and optionally its duration. Parallel children are prefixed with "║" while sequential nodes use "│". Depth indentation is 2 spaces per level.
func StatusBadge ¶
func StatusBadge(status workflow.ExecutionStatus) string
StatusBadge renders a colored icon + label for an ExecutionStatus.
func StatusBadgeFromString ¶
StatusBadgeFromString renders a colored icon + label from a status string.
func StatusBadgeIcon ¶
func StatusBadgeIcon(status workflow.ExecutionStatus) string
StatusBadgeIcon returns a colored icon string for the given execution status using theme colors.
func StatusIcon ¶
func StatusIcon(status workflow.ExecutionStatus) string
StatusIcon returns the display icon for the given execution status.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge adapts application service interfaces to tea.Cmd factories consumed by Model.
Secret masking is handled at the infrastructure layer (ShellExecutor, Logger) via the existing convention of prefixing variable names with SECRET_, API_KEY, or PASSWORD. Bridge itself does not re-mask content because it only operates on metadata (IDs, names, structs) rather than raw command output.
func NewBridge ¶
func NewBridge(workflows WorkflowLister, history HistoryProvider) *Bridge
NewBridge creates a Bridge wiring the given service interface implementations. Any dependency may be nil; calling the corresponding method on a nil dependency returns ErrMsg wrapping a descriptive error. All workflow execution is routed through the facade (SetFacade / RunWorkflowViaFacade) — no legacy runner port.
func (*Bridge) LoadHistory ¶
LoadHistory returns a tea.Cmd that fetches execution history records together with summary statistics and emits HistoryLoadedMsg on success or ErrMsg on failure.
func (*Bridge) LoadWorkflows ¶
LoadWorkflows returns a tea.Cmd that fetches all available workflows and emits WorkflowsLoadedMsg. Individual workflow load failures are skipped so that one broken YAML file does not prevent the entire list from rendering.
func (*Bridge) RunWorkflowViaFacade ¶
func (b *Bridge) RunWorkflowViaFacade(ctx context.Context, name string, inputs map[string]any) tea.Cmd
RunWorkflowViaFacade returns a tea.Cmd that starts workflow execution through the WorkflowFacade. The resulting ExecutionStartedMsg includes a live RunSession whose Events() channel drives state updates in the monitoring tab (D27, FR-011).
This is the sole TUI execution path (F108): it does not supply an ExecCtx or Done channel. The monitoring tab's StartEventLoop goroutine becomes the sole reader of Session.Events(), and when it detects a terminal event (EventWorkflowCompleted or EventWorkflowFailed) it sends ExecutionFinishedMsg to stop the event loop.
func (*Bridge) SetFacade ¶
func (b *Bridge) SetFacade(f ports.WorkflowFacade)
SetFacade wires a WorkflowFacade into the Bridge so that RunWorkflowViaFacade can start event-driven executions via facade.Run. Safe to call after NewBridge; a nil facade is accepted and causes RunWorkflowViaFacade to return ErrMsg.
type ExecutionFinishedMsg ¶
type ExecutionFinishedMsg struct {
Err error
}
ExecutionFinishedMsg signals the workflow run has ended. Err is non-nil if execution failed.
type ExecutionStartedMsg ¶
type ExecutionStartedMsg struct {
ExecutionID string
Workflow *workflow.Workflow
Session ports.RunSession
}
ExecutionStartedMsg signals a workflow run has begun via the WorkflowFacade. Session carries the live RunSession whose Events() channel drives the monitoring tab: the model calls MonitoringTab.StartEventLoop to consume facade events (D27).
type HistoryLoadedMsg ¶
type HistoryLoadedMsg struct {
Records []*workflow.ExecutionRecord
Stats *workflow.HistoryStats
}
HistoryLoadedMsg carries execution history records and summary statistics.
type HistoryProvider ¶
type HistoryProvider interface {
List(ctx context.Context, filter *workflow.HistoryFilter) ([]*workflow.ExecutionRecord, error)
GetStats(ctx context.Context, filter *workflow.HistoryFilter) (*workflow.HistoryStats, error)
}
HistoryProvider is the driven port for querying execution history. It is satisfied by *application.HistoryService.
type HistoryTab ¶
type HistoryTab struct {
// contains filtered or unexported fields
}
HistoryTab is the Bubbletea sub-model for the History tab. It provides a filterable table of execution records with a detail view.
func (HistoryTab) Init ¶
func (t HistoryTab) Init() tea.Cmd
Init implements the Bubbletea sub-model convention.
func (HistoryTab) InputActive ¶
func (t HistoryTab) InputActive() bool
InputActive reports whether the filter text input is focused.
func (HistoryTab) Update ¶
func (t HistoryTab) Update(msg tea.Msg) (HistoryTab, tea.Cmd)
Update implements the Bubbletea sub-model convention.
type InputRequestedMsg ¶
type InputRequestedMsg struct{}
InputRequestedMsg signals that the execution goroutine is waiting for user input in a conversation step. The monitoring tab should display a text input and auto-select the running conversation step.
type LaunchWorkflowMsg ¶
LaunchWorkflowMsg requests that the Model launch the given workflow. It is emitted by WorkflowsTab when the user presses Enter on a selected item. The Model handles it by switching to TabMonitoring and calling Bridge.RunWorkflowViaFacade.
type LogBatchMsg ¶
type LogBatchMsg struct {
Entries []LogEntry
}
LogBatchMsg carries multiple entries from a batch read (initial tail or follow).
type LogEntry ¶
type LogEntry struct {
Timestamp string `json:"timestamp"`
Event string `json:"event"`
WorkflowName string `json:"workflow_name"`
ExecutionID string `json:"execution_id"`
Status string `json:"status"`
DurationMs float64 `json:"duration_ms"`
User string `json:"user"`
Error string `json:"error"`
Fields map[string]any `json:"-"`
}
LogEntry represents a single parsed line from the AWF audit JSONL log.
type LogLineMsg ¶
type LogLineMsg struct {
Entry LogEntry
}
LogLineMsg carries a newly-tailed log entry to the Update loop.
type LogsTab ¶
type LogsTab struct {
// contains filtered or unexported fields
}
LogsTab displays external JSONL log entries in the TUI. It polls the watched file at a fixed interval using an offset-based Tailer, and renders entries in a scrollable viewport.
func (LogsTab) Init ¶
Init implements the Bubbletea sub-model convention. It loads the tail of the log file and starts the self-sustaining tick loop.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubbletea model for the TUI. It holds all tab sub-models and delegates rendering and update to the active one.
func New ¶
func New() Model
New creates a Model with sensible zero-value defaults. bridge may be nil; Init will skip the fetch command if so.
func NewWithBridge ¶
NewWithBridge creates a Model wired to the given bridge and context. logsPath is the path to the AWF audit JSONL log file (may be empty).
func (Model) Init ¶
Init implements tea.Model. It returns batched commands that load workflows and history via the bridge. If no bridge is configured, emits empty messages.
type MonitoringTab ¶
type MonitoringTab struct {
// contains filtered or unexported fields
}
MonitoringTab displays live execution metrics and history for the TUI monitoring view. It renders a two-panel layout: execution tree (left) and a log viewport (right). State updates are event-driven: StartEventLoop consumes ports.RunSession.Events() and forwards each facade event into the update loop as a facadeEventMsg (the former 200 ms ExecutionContext polling loop has been removed, F108/D27).
func (MonitoringTab) Init ¶
func (t MonitoringTab) Init() tea.Cmd
Init implements the Bubbletea sub-model convention.
func (MonitoringTab) InputActive ¶
func (t MonitoringTab) InputActive() bool
InputActive reports whether the conversation text input is focused.
func (*MonitoringTab) SetInputReader ¶
func (t *MonitoringTab) SetInputReader(r *TUIInputReader)
SetInputReader wires the TUIInputReader so the tab can respond to conversation input requests and route user replies back to the blocked ReadInput call.
func (*MonitoringTab) SetSender ¶
func (t *MonitoringTab) SetSender(send func(tea.Msg))
SetSender wires the tea.Msg dispatcher so StartEventLoop can forward facade events into the Bubble Tea update loop. Call this after tea.NewProgram, passing p.Send.
func (*MonitoringTab) SetStream ¶
func (t *MonitoringTab) SetStream(s *StreamBuffer)
SetStream wires the streaming output buffer for live viewport display.
func (*MonitoringTab) SetWorkflow ¶
func (t *MonitoringTab) SetWorkflow(wf *workflow.Workflow)
SetWorkflow wires the running workflow so the monitoring tab can order steps and render the execution tree. State updates arrive via facadeEventMsg (StartEventLoop). Called by the Model when it receives ExecutionStartedMsg.
func (*MonitoringTab) StartEventLoop ¶
func (t *MonitoringTab) StartEventLoop(ctx context.Context, sess ports.RunSession)
StartEventLoop spawns a goroutine that ranges over sess.Events() and forwards each event to the Bubble Tea program as a facadeEventMsg, replacing the 200 ms tick loop (D27).
Terminal events (EventWorkflowCompleted, EventWorkflowFailed) are forwarded as facadeEventMsg first, then an ExecutionFinishedMsg is sent to finalize the monitoring tab (clears ticking/showSpinner and renders final state). This allows callers that use RunWorkflowViaFacade (which supplies no Done channel) to still receive the finished signal.
ctx must be the context derived from the Bubble Tea program's lifetime (or a parent that is cancelled when the TUI stops). When ctx is done the goroutine exits cleanly without calling p.Send, preventing panics or dropped messages after the program has halted.
func (MonitoringTab) Update ¶
func (t MonitoringTab) Update(msg tea.Msg) (MonitoringTab, tea.Cmd)
Update implements the Bubbletea sub-model convention.
type MsgSender ¶
MsgSender is a function that sends a tea.Msg to the Bubble Tea program. Typically bound to (*tea.Program).Send.
type StreamBuffer ¶
type StreamBuffer struct {
// contains filtered or unexported fields
}
StreamBuffer is a thread-safe byte buffer implementing io.Writer. It captures streaming output from step execution for real-time TUI display.
func (*StreamBuffer) Reset ¶
func (s *StreamBuffer) Reset()
Reset clears the buffer for a new execution.
func (*StreamBuffer) String ¶
func (s *StreamBuffer) String() string
String returns the accumulated content.
type TUIInputReader ¶
type TUIInputReader struct {
// contains filtered or unexported fields
}
TUIInputReader implements ports.UserInputReader for the TUI. It bridges the blocking ConversationManager goroutine with the Bubble Tea event loop via channels.
func NewTUIInputReader ¶
func NewTUIInputReader(sender MsgSender) *TUIInputReader
NewTUIInputReader creates a TUIInputReader. sender may be nil during tests; when non-nil it is called to notify the Bubble Tea program that input is needed.
func (*TUIInputReader) ReadInput ¶
func (r *TUIInputReader) ReadInput(ctx context.Context) (string, error)
ReadInput blocks until the user submits input via the TUI or the context is cancelled. It signals the Bubble Tea model that input is needed by sending InputRequestedMsg.
func (*TUIInputReader) RequestCh ¶
func (r *TUIInputReader) RequestCh() <-chan struct{}
RequestCh returns the channel that signals when input is requested. Used in tests; the TUI model uses InputRequestedMsg instead.
func (*TUIInputReader) Respond ¶
func (r *TUIInputReader) Respond(text string)
Respond sends user input back to the blocked ReadInput call.
func (*TUIInputReader) SetSender ¶
func (r *TUIInputReader) SetSender(sender MsgSender)
SetSender sets the tea.Msg sender (typically (*tea.Program).Send). Called after the program is created but before any execution starts.
type Tab ¶
type Tab int
Tab identifies which tab panel is currently active.
const ( // TabWorkflows is the workflow list and selector tab (key "1"). TabWorkflows Tab = iota // TabMonitoring is the live execution metrics tab (key "2"). TabMonitoring // TabHistory is the execution history tab (key "3"). TabHistory // TabExternalLogs is the tailed external JSONL log tab (key "4"). TabExternalLogs )
type Tailer ¶
type Tailer struct {
// contains filtered or unexported fields
}
Tailer implements a tail-follow pattern on a JSONL file:
- First call (Tail): reads the last N lines from end-of-file
- Subsequent calls (Follow): reads all new lines since last offset
func (*Tailer) Follow ¶
Follow returns a tea.Cmd that reads all new lines appended since last read. Returns nil when no new data is available.
type TreeNode ¶
type TreeNode struct {
Name string
Status workflow.ExecutionStatus
Duration time.Duration
Depth int
Children []*TreeNode
IsParallel bool
}
TreeNode represents a single node in the execution tree view.
func BuildTree ¶
BuildTree constructs a slice of TreeNodes from an ordered step slice and a states map. Steps are processed in the order provided by the caller. Parallel steps produce a parent node (IsParallel=true) with each branch name added as a child node. Missing states default to StatusPending.
type ValidationResultMsg ¶
ValidationResultMsg carries the result of a workflow validation request. Success is true when validation passed; otherwise Error contains the message.
type WorkflowLister ¶
type WorkflowLister interface {
ListAllWorkflows(ctx context.Context) ([]workflow.WorkflowEntry, error)
GetWorkflow(ctx context.Context, name string) (*workflow.Workflow, error)
ValidateWorkflow(ctx context.Context, name string) error
}
WorkflowLister is the driven port for listing and loading workflow definitions. It is satisfied by *application.WorkflowService.
type WorkflowsLoadedMsg ¶
type WorkflowsLoadedMsg struct {
Workflows []*workflow.Workflow
Entries []workflow.WorkflowEntry
}
WorkflowsLoadedMsg carries the list of available workflows after discovery.
type WorkflowsTab ¶
type WorkflowsTab struct {
// contains filtered or unexported fields
}
WorkflowsTab is the Bubbletea sub-model for the Workflows tab.
func (WorkflowsTab) Init ¶
func (t WorkflowsTab) Init() tea.Cmd
func (WorkflowsTab) InputActive ¶
func (t WorkflowsTab) InputActive() bool
InputActive reports whether any text input is focused (filter or input form).
func (WorkflowsTab) Update ¶
func (t WorkflowsTab) Update(msg tea.Msg) (WorkflowsTab, tea.Cmd)
func (WorkflowsTab) View ¶
func (t WorkflowsTab) View() string