code

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func New

func New(ctx context.Context, agent *coder.Agent, sessionID string) *App

New constructs the App. sessionID may be empty when the caller plans to create a new session after wiring the App as the agent's UI (so the new session's tool list includes ask_user); use App.SetSessionID to attach the freshly-minted id before App.Run.

func (*App) Ask

func (a *App) Ask(ctx context.Context, question string) (string, error)

Ask implements code.UI. Invoked from a tool-execution goroutine (ask_user); blocks until the user types an answer and submits, or the context is cancelled.

func (*App) Confirm

func (a *App) Confirm(ctx context.Context, message string) (bool, error)

Confirm implements code.UI. Invoked from a tool-execution goroutine (e.g. shell.Tools for dangerous commands); blocks until the user answers y/n in the input area or the context is cancelled.

func (*App) Run

func (a *App) Run() error

func (*App) SetSessionID

func (a *App) SetSessionID(id string)

SetSessionID binds the active session id once it's known. Call once, before App.Run, after the agent has created or loaded the session.

type AppPhase

type AppPhase int
const (
	PhaseIdle AppPhase = iota
	PhasePreparing
	PhaseThinking
	PhaseStreaming
	PhaseToolRunning
)
type Modal string
const (
	ModalNone        Modal = ""
	ModalPicker      Modal = "picker"
	ModalFilePicker  Modal = "file-picker"
	ModalDiff        Modal = "diff"
	ModalDiagnostics Modal = "diagnostics"
)

type Mode

type Mode int
const (
	ModeAgent Mode = iota
	ModePlan
)

type PhaseConfig

type PhaseConfig struct {
	Message string
	Color   string
}

func GetPhaseConfig

func GetPhaseConfig(phase AppPhase) PhaseConfig

type PickerItem

type PickerItem struct {
	ID   string
	Text string
}

type Spinner

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

func NewSpinner

func NewSpinner(app *tview.Application, view *tview.TextView) *Spinner

func (*Spinner) Start

func (s *Spinner) Start(phase AppPhase)

Must be called from the UI goroutine (e.g. inside QueueUpdateDraw).

func (*Spinner) Stop

func (s *Spinner) Stop()

Must be called from the UI goroutine (e.g. inside QueueUpdateDraw).

Jump to

Keyboard shortcuts

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