Documentation
¶
Overview ¶
Package tui presents the Coding Runtime as a terminal-first chat interface.
Index ¶
- func Run(ctx context.Context, options Options) (returnErr error)
- type AltScreenPolicy
- type Bootstrap
- type BuildStamp
- type Controller
- type ExitHandler
- type ExitInfo
- type ImageClipboard
- type ImageIngress
- type Model
- type Options
- type ScreenMode
- type StatusLineSaver
- type TextKind
- type TextSaveRequest
- type TextSaver
- type ThemeSaver
- type TrustError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AltScreenPolicy ¶ added in v0.1.6
type AltScreenPolicy uint8
AltScreenPolicy selects the terminal buffer independently of the layout.
const ( // AltScreenAuto uses the alternate screen unless the environment is known to // limit it. AltScreenAuto AltScreenPolicy = iota // AltScreenAlways forces the alternate screen. AltScreenAlways // AltScreenNever draws the layout inline in the main buffer. AltScreenNever )
type Bootstrap ¶
type Bootstrap func(context.Context, bool) (Controller, error)
Bootstrap loads configuration and opens the first Runtime. trustProject is the user's explicit Workspace trust decision.
type BuildStamp ¶ added in v0.1.7
Options contain the CLI-owned resources used by one TUI Program. BuildStamp is the build identity the TUI reports, so a display surface never has to import the CLI that stamped the binary.
type Controller ¶
type Controller interface {
Prompt(context.Context, ...ai.Message) iter.Seq2[coding.Event, error]
Continue(context.Context) iter.Seq2[coding.Event, error]
Resolve(context.Context, approval.Resolution) iter.Seq2[coding.Event, error]
ResolveQuestion(context.Context, question.Resolution) iter.Seq2[coding.Event, error]
RejectQuestion(context.Context, string, string) iter.Seq2[coding.Event, error]
Tree(context.Context) (coding.SessionTree, error)
PreviewCompaction(context.Context) (coding.CompactionPreview, error)
Compact(context.Context, coding.CompactionRequest) iter.Seq2[coding.Event, error]
Steer(...ai.Message) error
FollowUp(...ai.Message) error
Cancel() error
Reload(context.Context) error
ListWorkspaceFiles(context.Context) (attachment.Snapshot, error)
ResolveWorkspaceFile(context.Context, attachment.Reference) (attachment.Resolved, error)
Snapshot() coding.State
SessionID() string
History(context.Context, coding.HistoryRequest) (coding.HistoryPage, error)
Model() runtimecontrol.ModelState
Capabilities() ai.Capabilities
Mode() runtimecontrol.ModeState
SetMode(context.Context, coding.OperatingMode) error
Permissions() runtimecontrol.PermissionState
NewFullAccessConfirmation(context.Context, runtimecontrol.PermissionUpdate) (*runtimecontrol.FullAccessConfirmation, error)
SetPermissions(context.Context, runtimecontrol.PermissionUpdate, ...*runtimecontrol.FullAccessConfirmation) error
WorkspaceStatus(context.Context) (changes.WorktreeStatus, error)
Models() []modelcatalog.Entry
Config() config.Config
Detached() bool
ListSessions(context.Context) ([]session.Metadata, error)
ListAllSessions(context.Context) (session.MetadataListing, error)
ListSessionSummaries(context.Context) ([]runtimecontrol.SessionSummary, error)
ListSubagents(context.Context) ([]subagent.Summary, error)
InspectSubagent(context.Context, string) (subagent.Detail, error)
InspectSubagentState(context.Context, string) (coding.State, error)
GenerateTeamProposal(context.Context, coding.TeamProposalPrompt) (coding.TeamProposal, error)
ReviseTeamProposal(context.Context, string, string) (coding.TeamProposal, error)
DeclineTeam(context.Context, string) error
ConfirmTeam(context.Context, coding.TeamConfirmation) (coding.TeamReference, error)
ReadTeam(context.Context, coding.TeamReadRequest) (coding.TeamView, error)
SubmitTeamControl(context.Context, coding.TeamControlRequest) (coding.TeamControlReference, error)
ResolveTeamWorkerApproval(
context.Context,
coding.TeamWorkerTarget,
approval.Resolution,
) (coding.TeamControlReference, error)
ResolveTeamWorkerQuestion(
context.Context,
coding.TeamWorkerTarget,
question.Resolution,
) (coding.TeamControlReference, error)
RejectTeamWorkerQuestion(
context.Context,
coding.TeamWorkerTarget,
string,
string,
) (coding.TeamControlReference, error)
ObserveTeamWorker(context.Context, coding.TeamWorkerTarget) (coding.EventObservation, error)
InspectTeamWorkerState(context.Context, coding.TeamWorkerTarget) (coding.State, error)
DiscoverTeamRecovery(context.Context) ([]coding.TeamRecoveryCandidate, error)
ResumeTeam(
context.Context,
team.ID,
coding.TeamResumeDecision,
) (coding.TeamReference, error)
PrepareTeamIntegration(
context.Context,
coding.TeamIntegrationRequest,
) (coding.TeamIntegrationPreview, error)
ApplyTeamIntegration(
context.Context,
coding.TeamIntegrationApproval,
) (coding.TeamIntegrationResult, error)
RejectTeamIntegration(context.Context, coding.TeamIntegrationApproval) error
TeamIntegrationRecoveries(context.Context) ([]coding.TeamIntegrationRecovery, error)
RecoverTeamIntegration(
context.Context,
coding.TeamIntegrationRecoveryRequest,
) (coding.TeamIntegrationResult, error)
CleanupTeam(context.Context, coding.TeamCleanupRequest) (coding.TeamCleanupResult, error)
Skills(context.Context) (coding.SkillSnapshot, error)
MCP(context.Context) (coding.MCPSnapshot, error)
SetSkillEnabled(context.Context, coding.SkillID, bool) error
WaitSubagent(context.Context, string) (subagent.Result, error)
CancelSubagent(context.Context, string) error
NewSession(context.Context) error
ResumeSession(context.Context, string) error
ForkSession(context.Context, string) error
SwitchModel(context.Context, modelcatalog.Selection) error
Close(context.Context) error
}
Controller is the application control surface consumed by the TUI.
type ExitHandler ¶
ExitHandler runs after terminal restoration and Controller release.
type ImageClipboard ¶
ImageClipboard is the one-method clipboard boundary consumed by the TUI.
type ImageIngress ¶
type ImageIngress interface {
Receive(context.Context) (attachment.Image, error)
}
ImageIngress receives validated immutable images from an application-owned bridge such as one remote SSH session.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea state machine.
type Options ¶
type Options struct {
Input io.Reader
Output io.Writer
Environment []string
Workspace string
// SessionsDirectory is the store root the Usage page's projection sidecar
// lives under. An empty value keeps the projection unavailable.
SessionsDirectory string
ThemeDirectory string
Trusted bool
NoColor bool
// Screen selects the interactive render layout.
Screen ScreenMode
// AltScreen selects the terminal buffer independently of the layout, so a
// fullscreen layout can still be drawn inline in the main buffer.
AltScreen AltScreenPolicy
// MouseReporting enables mouse capture. Cell-motion reporting is used under a
// multiplexer and all-motion elsewhere.
MouseReporting bool
// ExitOutput selects what a normal exit leaves on the main screen:
// config.ExitOutputTranscript writes the conversation, ExitOutputResumeHint
// leaves only the resume hint. It is authoritative only with
// PinPresentation; otherwise the persisted [tui] exit_output decides.
ExitOutput string
// PinPresentation makes Screen, AltScreen and MouseReporting authoritative
// instead of deriving them from the persisted [tui] configuration. The CLI
// leaves this false so configuration decides; tests and embedded callers set
// it so a specific presentation can be asserted.
PinPresentation bool
Bootstrap Bootstrap
Clipboard ImageClipboard
ImageIngress ImageIngress
OnExit ExitHandler
Build BuildStamp
StatusLine []statusline.Item
SaveStatusLine StatusLineSaver
SaveTheme ThemeSaver
// SaveText persists Ctrl+X, /copy and /export output. A nil saver keeps the
// clipboard path and reports that no file fallback is available.
SaveText TextSaver
}
type ScreenMode ¶ added in v0.1.6
type ScreenMode uint8
ScreenMode selects the interactive render layout.
The render layout (transcript viewport vs. native-history tail) and the terminal buffer (alternate screen vs. main screen) are independent decisions: a full layout drawn inline in the main buffer is a supported combination, not a fallback.
const ( // ScreenInline keeps the terminal's own scrollback and the mutable tail. ScreenInline ScreenMode = iota // ScreenFullscreen owns a fixed-height layout and its own scrolling. ScreenFullscreen )
type StatusLineSaver ¶
type StatusLineSaver func(context.Context, []statusline.Item) error
StatusLineSaver atomically persists one complete ordered field selection.
type TextKind ¶ added in v0.1.6
type TextKind string
TextKind names the destination policy for operator-requested text, so one saver can serve both the copy fallback and an export.
type TextSaveRequest ¶ added in v0.1.6
TextSaveRequest is one operator-requested text write. An empty Path asks the saver for its default destination for Kind.
type TextSaver ¶ added in v0.1.6
type TextSaver func(context.Context, TextSaveRequest) (string, error)
TextSaver persists operator-requested text and returns the path it wrote. The TUI never owns destination policy: it hands over the requested path and reports back whatever the saver resolved.
type ThemeSaver ¶
ThemeSaver persists only the requested theme ID in the active config file.
type TrustError ¶
type TrustError struct {
Err error
}
TrustError means persisting an explicit Workspace trust decision failed and the Trust Overlay should remain available for retry.
func (*TrustError) Error ¶
func (e *TrustError) Error() string
func (*TrustError) Unwrap ¶
func (e *TrustError) Unwrap() error
Unwrap returns the persistence failure.
Source Files
¶
- action.go
- activity.go
- agents_overlay.go
- banner.go
- bridge.go
- clipboard.go
- command_picker.go
- composer.go
- composer_submission.go
- control.go
- copy.go
- direct_agent.go
- document.go
- file_picker.go
- goal.go
- history.go
- hit.go
- image_ingress.go
- layout.go
- markdown.go
- markdown_live.go
- model.go
- model_usage.go
- mouse.go
- mouse_selection.go
- patch_preview.go
- permissions_picker.go
- picker.go
- plan_review.go
- presentation.go
- presentation_env.go
- print.go
- projection_cache.go
- prompt.go
- route.go
- route_list_hit.go
- route_mcp.go
- route_search.go
- route_skills.go
- route_status.go
- route_team.go
- route_team_integration.go
- route_team_presentation.go
- route_team_worker.go
- route_tree.go
- run.go
- scrollback.go
- search.go
- selection.go
- session_picker.go
- skill_picker.go
- status_cost.go
- status_models.go
- status_report.go
- status_stats.go
- statusline_picker.go
- streaming.go
- subagent_interaction.go
- surface_helpers.go
- team_interaction.go
- team_panel.go
- team_projection.go
- theme.go
- theme_picker.go
- theme_registry.go
- theme_runtime.go
- thinking_live.go
- timeline.go
- tool_activity.go
- tool_detail.go
- tool_detail_json.go
- tool_detail_rows.go
- tool_projection.go
- transcript.go
- transcript_mode.go
- usage_projection.go
- workspace_changes.go