tui

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: AGPL-3.0 Imports: 41 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentConsoleArgsForLine

func AgentConsoleArgsForLine(line string) ([]string, error)

func AgentStreamingEnabled

func AgentStreamingEnabled(_ *cfg.Option) bool

AgentStreamingEnabled keeps the agent/provider path event-streamed by default, matching the streamSimple-first model. Rendering decisions are separate: non-TTY stdout can stay buffered while subscribers still receive message_update events.

func RunAgentConsoleWithTerminal

func RunAgentConsoleWithTerminal(ctx context.Context, option *cfg.Option, appInfo AppInfo, session *agent.Agent, terminal *rlterm.Terminal, bus ...*eventbus.Bus[agent.Event]) error

func RunIOAContext

func RunIOAContext(ctx context.Context, client *ioaclient.Client, option *cfg.Option, args cfg.IOAClientArgs, stdout, stderr io.Writer) error

func RunIOAMessages

func RunIOAMessages(ctx context.Context, client *ioaclient.Client, option *cfg.Option, args cfg.IOAClientArgs, stdout, stderr io.Writer) error

func RunIOANodes

func RunIOANodes(ctx context.Context, client *ioaclient.Client, option *cfg.Option, args cfg.IOAClientArgs, stdout, stderr io.Writer) error

func RunIOASpaces

func RunIOASpaces(ctx context.Context, client *ioaclient.Client, option *cfg.Option, stdout, stderr io.Writer) error

func RunPrompt

func RunPrompt(s *Session, label, input string) error

RunPrompt expands skills and submits a prompt to the controller.

func RunRemoteAgentConsole

func RunRemoteAgentConsole(ctx context.Context, option *cfg.Option, appInfo AppInfo, session *agent.Agent, input io.Reader, output io.Writer, bus ...*eventbus.Bus[agent.Event]) error

RunRemoteAgentConsole runs the agent console over a byte-stream transport. The transport provides raw terminal input and receives terminal output.

func RunRemoteAgentConsoleWithControl

func RunRemoteAgentConsoleWithControl(ctx context.Context, option *cfg.Option, appInfo AppInfo, session *agent.Agent, input io.Reader, output io.Writer, control *rlterm.StreamControl, bus ...*eventbus.Bus[agent.Event]) error

Types

type AgentConsole

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

func NewAgentConsole

func NewAgentConsole(ctx context.Context, option *cfg.Option, appInfo AppInfo, session *agent.Agent, output *AgentOutput, bus ...*eventbus.Bus[agent.Event]) *AgentConsole

func NewAgentConsoleWithTerminal

func NewAgentConsoleWithTerminal(ctx context.Context, option *cfg.Option, appInfo AppInfo, session *agent.Agent, output *AgentOutput, t *rlterm.Terminal, bus ...*eventbus.Bus[agent.Event]) *AgentConsole

func (*AgentConsole) InterruptCurrentRun

func (r *AgentConsole) InterruptCurrentRun() bool

InterruptCurrentRun stops the current agent run or direct command.

func (*AgentConsole) Start

func (r *AgentConsole) Start() error

type AgentOutput

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

AgentOutput renders agent events and assistant content to the terminal. It is safe for concurrent use: a sync.Mutex serializes HandleEvent, streamDelta, and lifecycle methods so streaming tokens and bus events from different goroutines never interleave output.

func NewAgentOutput

func NewAgentOutput(option *cfg.Option) *AgentOutput

func NewAgentOutputWithWriters

func NewAgentOutputWithWriters(option *cfg.Option, stdout, stderr io.Writer, terminal bool) *AgentOutput

NewAgentOutputWithWriters constructs an AgentOutput for a terminal-like stream that is not necessarily backed by os.Stdout/os.Stderr.

func (*AgentOutput) AbortCurrentRun

func (o *AgentOutput) AbortCurrentRun()

func (*AgentOutput) Empty

func (o *AgentOutput) Empty()

func (*AgentOutput) EnsureStreamNewline

func (o *AgentOutput) EnsureStreamNewline()

EnsureStreamNewline closes any open streamed line (mid-line cursor) by emitting a newline. Thread-safe wrapper for the locked variant.

func (*AgentOutput) Error

func (o *AgentOutput) Error(err error)

func (*AgentOutput) Final

func (o *AgentOutput) Final(content string)

func (*AgentOutput) HandleEvent

func (o *AgentOutput) HandleEvent(event agent.Event)

func (*AgentOutput) Queued

func (o *AgentOutput) Queued(text string)

func (*AgentOutput) QueuedFollowUp

func (o *AgentOutput) QueuedFollowUp(text string)

func (*AgentOutput) Start

func (o *AgentOutput) Start(label, text string)

func (*AgentOutput) Stopped

func (o *AgentOutput) Stopped()

func (*AgentOutput) Stopping

func (o *AgentOutput) Stopping()

type AppInfo

type AppInfo struct {
	Provider          agent.Provider
	ProviderConfig    agent.ProviderConfig
	ProviderFallbacks []agent.ProviderEntry
	Commands          *commands.CommandRegistry
	Skills            *skills.Store
	OnProviderChange  func(agent.Provider, agent.ProviderConfig)
}

AppInfo holds the subset of runtime state that tui commands need.

type ArgSpec

type ArgSpec int
const (
	ArgsNone ArgSpec = iota
	ArgsExact1
	ArgsOptional
)

type Command

type Command struct {
	Name        string
	Aliases     []string
	Description string
	Args        ArgSpec
	Hidden      bool
	Run         func(ctx context.Context, s *Session, args []string) error
}

Command describes a REPL command independent of any UI framework.

func SkillCommands

func SkillCommands(s *Session) []Command

SkillCommands generates commands for each non-internal skill.

type Controller

type Controller interface {
	SubmitPrompt(label, displayText, prompt string) error
	Continue() error
	Stop() bool
	Running() bool
}

Controller is the async execution interface that tui implements.

type EvalSettings

type EvalSettings struct {
	Criteria string
	Model    string
	Provider agent.Provider
	Bus      *eventbus.Bus[agent.Event]
	Logger   telemetry.Logger
}

type ProviderInfo

type ProviderInfo struct {
	Name   string
	Model  string
	Active bool
}

StatusInfo collects current session state for display.

type RenderMode

type RenderMode int

RenderMode selects how aggressively the renderer decorates output.

const (
	// ModeInteractive: a human sits at a local TTY. Full firepower — truecolor
	// via lipgloss/glamour, single-line spinners, OSC 8 hyperlinks, and
	// synchronized-output flicker suppression.
	ModeInteractive RenderMode = iota
	// ModeForwarded: the PTY stream is consumed by a remote agent (aider).
	// Transient UI (spinners) is suppressed so the forwarded transcript stays a
	// clean line-oriented stream; OSC sequences degrade to no-ops in dumb
	// consumers and colors are kept (harmless — stripped or rendered downstream).
	ModeForwarded
)

type Session

type Session struct {
	Ctx          context.Context
	Option       *cfg.Option
	AppInfo      AppInfo
	Agent        *agent.Agent
	Controller   Controller
	EvalCriteria string
	OnEvalChange func(string)
}

Session holds the dependencies commands need to operate on.

type StatusInfo

type StatusInfo struct {
	Provider  string
	Model     string
	Providers []ProviderInfo
	Mode      string
	Task      string
	IOA       string
	History   string
	Skills    string
}

func CollectStatus

func CollectStatus(s *Session, mode, historyPath string) StatusInfo

Jump to

Keyboard shortcuts

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