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
const SessionCommand()SendMessageCommand
Send a user message into the session.
Constructor
const SendMessageCommand({required this.text, this.attachments = const []})Properties
| Property | Type | Description |
|---|---|---|
text | String | |
attachments | List<Attachment> |
InterruptCommand
Soft interrupt — let the current LLM call finish, but don't start another tool round.
Constructor
const InterruptCommand()CancelCommand
Hard cancel — kill any in-flight tool processes and abort the turn.
Constructor
const CancelCommand()ResolvePermissionCommand
Resolve a pending [PermissionRequestedEvent].
Constructor
const ResolvePermissionCommand({
required this.requestId,
required this.granted,
required this.scope,
})Properties
| Property | Type | Description |
|---|---|---|
requestId | PermissionRequestId | |
granted | bool | |
scope | PermissionScope |
ResolveDeviceCodeCommand
Resolve a pending [DeviceCodeRequestedEvent] — the surface tells the harness whether the user completed the OAuth flow in their browser.
Constructor
const ResolveDeviceCodeCommand({required this.userCompletedFlow})Properties
| Property | Type | Description |
|---|---|---|
userCompletedFlow | bool |
SwitchModelCommand
Switch the model used by this session for subsequent turns.
Constructor
const SwitchModelCommand({required this.model})Properties
| Property | Type | Description |
|---|---|---|
model | ModelRef |
RegenerateCommand
Rewind to the start of [fromTurn] and re-run from there.
Constructor
const RegenerateCommand({required this.fromTurn})Properties
| Property | Type | Description |
|---|---|---|
fromTurn | TurnId |