tui

package
v0.7.39-dev.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tui is the terminal chat for an interactive run: one full-screen conversation over a session.Session — transcript pane, input line, status line, and the slash commands /add, /yes, /no, /finish, /quit, /caps. It is a view: every message goes through Session.Send, every file through Session.AddInput, and the engine's budgets end the session whatever the terminal does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TaskLine added in v0.6.999

func TaskLine(text string) string

TaskLine is the one line a chat shows for a turn a persistent agent's heartbeat sent: the task's name, from the turn's "Task: <name>" line, and that it ran on its own.

func UpkeepLine added in v0.6.1003

func UpkeepLine(text string) string

UpkeepLine is the one line a chat shows for a persistent agent's upkeep turn, told apart by the message it was sent with: a compaction that saves the conversation to the agent's memory, one that only writes a handoff, or the memory's own tidy.

Types

type Options

type Options struct {
	// Ref is namespace/name@version.
	Ref string
	// Model is the provider/model string.
	Model string
	// Caps are the enforced capability lines shown by /caps.
	Caps []string
	// Budgets are the session caps; MaxTurns and MaxCostUSD the run's.
	Budgets    spec.SessionBudgets
	MaxTurns   int
	MaxCostUSD float64
	// PlanRun says the run is paid by the person's own plan (a model
	// sign-in): the status line shows no dollars.
	PlanRun bool
	// Opening is the manifest's opening line, shown when the session
	// starts without a task.
	Opening string
	// HasTask says a task text was given (it arrives as the first user turn).
	HasTask bool
}

Options describe the run to the status line and /caps.

type Outcome

type Outcome struct {
	// Finish asks the agent for its final result before teardown.
	Finish bool
	// Reason is set when the engine ended the session, not the user.
	Reason session.EndReason
}

Outcome is how the user left the chat.

func Run

func Run(ctx context.Context, s session.Session, opts Options, in io.Reader, out io.Writer) (Outcome, error)

Run shows the chat until the user ends it or the session ends, then returns how. It never calls End: the caller does, so the envelope and receipts are written after the screen is restored.

Jump to

Keyboard shortcuts

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