# VesselActionDefinition
Source: https://docs.maelstrom-ai.co/dev/reference/protocol/interfaces/vesselactiondefinition/
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.

Defined in: [packages/protocol/src/lib/vessel.ts:272](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L272)

Author-facing shape for a [VesselAction](https://docs.maelstrom-ai.co/dev/reference/protocol/type-aliases/vesselaction/). See [VesselDefinition](https://docs.maelstrom-ai.co/dev/reference/protocol/interfaces/vesseldefinition/).

## Properties

### description

> `readonly` **description**: `string`

Defined in: [packages/protocol/src/lib/vessel.ts:276](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L276)

What the Action does, written for the Planner that chooses it.

* * *

### effect?

> `readonly` `optional` **effect?**: `"any"` | `"none"` | `"idempotent"`

Defined in: [packages/protocol/src/lib/vessel.ts:308](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L308)

What running this Action does beyond its `transitionsTo`. Defaults to `'any'`.

-   `'none'`: no application effect. The framework only switches the Variant, so a handler is optional. Declare it only for a view switch that needs nothing from the application, such as showing a week view. It must declare `transitionsTo` and no parameters, and it is safe to run again. Engine-planned Actions still need a registered runner for the Instance, and an empty `useActions(id, {})` is enough.
-   `'idempotent'`: a handler is required, and running the Action again with the same parameters leaves the Vessel where one run would, such as opening an item that may already be open.
-   `'any'`: a handler is required, and the Action may append, remove or otherwise accumulate, so it is not safe to run again.

An Action without a handler that is not declared `'none'` is skipped and changes no Variant, so a missing handler never reports success. The client’s `ActionRunner` type requires those handlers at compile time.

The Engine may re-emit an Action on a turn triggered by nothing but a chart resize, and it cannot see Vessel contents to tell a first run from a repeat. Such a turn admits only Actions declared `'none'` or `'idempotent'` that the model invoked with no parameters, since a parameter value there could only have come from an earlier turn.

* * *

### idempotent?

> `readonly` `optional` **idempotent?**: `undefined`

Defined in: [packages/protocol/src/lib/vessel.ts:315](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L315)

Removed. Declare [VesselActionDefinition.effect](https://docs.maelstrom-ai.co/dev/reference/protocol/interfaces/vesselactiondefinition/#effect) instead: `idempotent: true` becomes `effect: 'idempotent'`, and `idempotent: false` is the default `effect: 'any'`. A definition that still sets it fails to compile and fails [validateVessel](https://docs.maelstrom-ai.co/dev/reference/protocol/functions/validatevessel/).

* * *

### name

> `readonly` **name**: `string`

Defined in: [packages/protocol/src/lib/vessel.ts:274](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L274)

Action name, unique within its Variant.

* * *

### parameters?

> `readonly` `optional` **parameters?**: readonly `object`\[\]

Defined in: [packages/protocol/src/lib/vessel.ts:278](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L278)

Parameters the Action’s handler receives. Omit for none.

* * *

### transitionsTo?

> `readonly` `optional` **transitionsTo?**: `string`

Defined in: [packages/protocol/src/lib/vessel.ts:280](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/vessel.ts#L280)

The Variant the Instance moves to once the Action has run.
