App
Category: Core
Source: app.dart
Enums
AppMode
Top-level application mode.
Classes
sealed AppEvent
Events that flow through the application event bus.
UserSubmit
Constructor
UserSubmit(this.text)Properties
| Property | Type | Description |
|---|---|---|
text | String |
UserCancel
UserScroll
Constructor
UserScroll(this.delta)Properties
| Property | Type | Description |
|---|---|---|
delta | int |
UserResize
Constructor
UserResize(this.cols, this.rows)Properties
| Property | Type | Description |
|---|---|---|
cols | int | |
rows | int |
App
The main application controller.
Ties the terminal, layout, line editor, and agent together using an event-driven architecture. Two independent streams (terminal input and agent output) are merged into a single render cycle so the UI is never blocked.
Constructor
App({
required this.terminal,
required this.layout,
required this.editor,
required this.agent,
required this._modelId,
this._manager,
McpClientPool? mcpPool,
this._llmFactory,
GlueConfig? config,
this._systemPrompt,
Set<String>? extraTrustedTools,
SessionStore? sessionStore,
CommandExecutor? executor,
this._runtimeClose,
this._runtimeDiff,
this._runtimeInfo,
ShellJobManager? jobManager,
this._startupContinue = false,
this._startupPrompt,
this._printMode = false,
this._jsonMode = false,
this._resumeSessionId,
Observability? obs,
this._debugController,
SkillRuntime? skillRuntime,
Environment? environment,
})Properties
| Property | Type | Description |
|---|---|---|
terminal | Terminal | |
layout | Layout | |
editor | TextAreaEditor | |
agent | AgentCore | |
hasSelection | bool get | Whether a non-empty selection is currently held. |
hasSelection | bool get | Whether a non-empty selection is currently held. |
Methods
`static Future<App> create({
String? model,
String? prompt,
bool printMode = false,
bool jsonMode = false,
String? resumeSessionId,
bool startupContinue = false,
bool debug = false,
})`
Convenience factory that creates a fully wired [App] with real LLM provider and subagent system.
static String buildPrintPrompt({String? prompt, String? stdinContent})
Builds the prompt for print mode by combining stdin content and the user-supplied prompt string. Exposed as a static method for testing.
void requestExit()
Request a clean exit. Can be called from signal handlers.
Future<void> run()
Run the application event loop.
void shutdown()
Cleanly shut down the application.
Future<void> copySelectionToClipboard()
Copy the current selection to the clipboard. Used by both the mouse-release path and the Ctrl+Shift+C keyboard shortcut. The selection itself stays highlighted (Esc or a new drag clears it).
Confirmation surfaces through [_toast] — a transient top-right chip painted directly into the output viewport — so the permanent transcript stays free of "Copied …" noise.