runtime

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package runtime runs looprig TUI entry points. It owns the process-level plumbing that every entry point repeats — structured logging to ~/.looprig/looprig.log, signal-driven shutdown, stdout/stderr capture so third-party libraries don't corrupt the managed TUI frame, building and running the Bubble Tea program, and bounded teardown — parameterized by an agent constructor and a startup banner. Product entry points stay thin: they select an agent and call Run; all runtime behavior lives here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, newAgent func(context.Context) (tui.Agent, error), banner Banner, options ...tui.Option) int

Run opens the structured log, installs signal-driven shutdown, constructs the agent via newAgent, captures stdout/stderr so third-party libraries land in the log instead of the managed TUI frame, builds and runs the Bubble Tea TUI (with newAgent as the /clear reopen thunk), tears the agent down within a bounded timeout, promotes any terminal handoff error retained by the final TUI model, and returns a process exit code. It never calls os.Exit — the caller does — so it stays the single exit point and Run is testable.

ctx is the caller's root context; Run derives a signal-aware context from it so SIGINT/SIGTERM trigger a clean TUI teardown. newAgent constructs the agent (and is reused as the TUI's /clear thunk); banner is the startup notice metadata.

Types

type Banner struct {
	Name        string
	Description string
}

Banner is the static startup metadata shown in the TUI's session-ready notice: the agent's user-facing display Name and optional one-line Description. The TUI obtains the dynamic session identity from the opened agent. Entry points construct Banner and pass it to Run, which maps it onto tui.AgentBanner.

Jump to

Keyboard shortcuts

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