Skip to content

SessionCommand ​

Category: Core

Source: session_command.dart

Sealed command hierarchy dispatched from a surface into a session.

Status: proposed (PR 2 of harness-layers plan). Not yet wired to consumers — see docs/plans/2026-04-29-harness-layers.md.

The full surface→harness contract is two stream types: a [Stream] of [SessionEvent]s out, a stream of [SessionCommand]s in. ACP can implement it as one JSON-RPC method. Tests can replay command logs.

Classes ​

sealed SessionCommand ​

Base type for all surface→harness commands.

Constructor ​

dart
const SessionCommand()

SendMessageCommand ​

Send a user message into the session.

Constructor ​

dart
const SendMessageCommand({required this.text, this.attachments = const []})

Properties ​

PropertyTypeDescription
textString
attachmentsList<Attachment>

InterruptCommand ​

Soft interrupt — let the current LLM call finish, but don't start another tool round.

Constructor ​

dart
const InterruptCommand()

CancelCommand ​

Hard cancel — kill any in-flight tool processes and abort the turn.

Constructor ​

dart
const CancelCommand()

ResolvePermissionCommand ​

Resolve a pending [PermissionRequestedEvent].

Constructor ​

dart
const ResolvePermissionCommand({
    required this.requestId,
    required this.granted,
    required this.scope,
  })

Properties ​

PropertyTypeDescription
requestIdPermissionRequestId
grantedbool
scopePermissionScope

ResolveDeviceCodeCommand ​

Resolve a pending [DeviceCodeRequestedEvent] — the surface tells the harness whether the user completed the OAuth flow in their browser.

Constructor ​

dart
const ResolveDeviceCodeCommand({required this.userCompletedFlow})

Properties ​

PropertyTypeDescription
userCompletedFlowbool

SwitchModelCommand ​

Switch the model used by this session for subsequent turns.

Constructor ​

dart
const SwitchModelCommand({required this.model})

Properties ​

PropertyTypeDescription
modelModelRef

RegenerateCommand ​

Rewind to the start of [fromTurn] and re-run from there.

Constructor ​

dart
const RegenerateCommand({required this.fromTurn})

Properties ​

PropertyTypeDescription
fromTurnTurnId

Released under the MIT License.