# CommandProcessingState
Source: https://docs.maelstrom-ai.co/dev/reference/client/type-aliases/commandprocessingstate/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

> **CommandProcessingState** = `object`

Defined in: [packages/client/src/lib/command-processor/command-processor.state.ts:14](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/client/src/lib/command-processor/command-processor.state.ts#L14)

Observable command state; failures preserve the last applied layout and Instances.

## Properties

### instances

> **instances**: `Map`<`InstanceId`, [`VesselInstance`](https://docs.maelstrom-ai.co/dev/reference/client/interfaces/vesselinstance/)\>

Defined in: [packages/client/src/lib/command-processor/command-processor.state.ts:18](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/client/src/lib/command-processor/command-processor.state.ts#L18)

Reconciled by `set_layout`; omitted Instances are removed.

* * *

### lastError

> **lastError**: `Error` | `null`

Defined in: [packages/client/src/lib/command-processor/command-processor.state.ts:29](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/client/src/lib/command-processor/command-processor.state.ts#L29)

Last thrown command error. Individual Action failures emit `action_error`; this field clears when the next command starts. `waitForIdle()` is the supported way to observe a failure after the fact; it does not read this field.

* * *

### layout

> **layout**: `GridLayout` | `TilingLayout` | `null`

Defined in: [packages/client/src/lib/command-processor/command-processor.state.ts:20](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/client/src/lib/command-processor/command-processor.state.ts#L20)

Last successfully applied layout; Action and failed layout commands leave it unchanged.

* * *

### layoutMode

> **layoutMode**: `LayoutMode`

Defined in: [packages/client/src/lib/command-processor/command-processor.state.ts:22](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/client/src/lib/command-processor/command-processor.state.ts#L22)

Initial-state metadata that [CommandProcessor](https://docs.maelstrom-ai.co/dev/reference/client/classes/commandprocessor/) does not read or update.

* * *

### status

> **status**: [`CommandProcessingStatus`](https://docs.maelstrom-ai.co/dev/reference/client/type-aliases/commandprocessingstatus/)

Defined in: [packages/client/src/lib/command-processor/command-processor.state.ts:16](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/client/src/lib/command-processor/command-processor.state.ts#L16)

Returns to `idle` after the queue drains, including after a command error.
