Skip to content

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

dart
UserSubmit(this.text)

Properties

PropertyTypeDescription
textString

UserCancel

UserScroll

Constructor

dart
UserScroll(this.delta)

Properties

PropertyTypeDescription
deltaint

UserResize

Constructor

dart
UserResize(this.cols, this.rows)

Properties

PropertyTypeDescription
colsint
rowsint

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

dart
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

PropertyTypeDescription
terminalTerminal
layoutLayout
editorTextAreaEditor
agentAgentCore
hasSelectionbool getWhether a non-empty selection is currently held.
hasSelectionbool getWhether 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&lt;void&gt; run()

Run the application event loop.

void shutdown()

Cleanly shut down the application.

Future&lt;void&gt; 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.

Released under the MIT License.