# SessionHistoryEntry
Source: https://docs.maelstrom-ai.co/dev/reference/protocol/type-aliases/sessionhistoryentry/
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.

> **SessionHistoryEntry** = { `assistantMessage?`: `string`; `id`: [`MessageId`](https://docs.maelstrom-ai.co/dev/reference/protocol/type-aliases/messageid/); `kind`: `"turn"`; `sessionId`: [`SessionId`](https://docs.maelstrom-ai.co/dev/reference/protocol/type-aliases/sessionid/); `timestamp`: `number`; `userIntent`: `string`; } | { `content`: `string`; `id`: [`MessageId`](https://docs.maelstrom-ai.co/dev/reference/protocol/type-aliases/messageid/); `kind`: `"injection"`; `sessionId`: [`SessionId`](https://docs.maelstrom-ai.co/dev/reference/protocol/type-aliases/sessionid/); `timestamp`: `number`; }

Defined in: [packages/protocol/src/lib/session-history-entry.ts:44](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/protocol/src/lib/session-history-entry.ts#L44)

Wire-format projection of a single recorded history entry, returned by `Engine.getHistory` and surfaced to clients through the connector and orchestrator layers.

Intentionally smaller than the engine’s internal storage record: the engine persists the full `ChartRequestMessage` (vessel definitions, instances, prior layout) and `ChartResponseOutput` (execution plan, full layout grid) to support cache replay and prompt assembly. Clients resuming a conversation only need enough to render the chat — the user’s intent and the assistant’s reply — so the wire DTO carries those directly and lets the engine evolve its internal storage shape without breaking the contract.

`kind` discriminates a chart\_request round-trip (`turn`) from a developer-supplied assistant message (`injection`).

-   `turn`: `userIntent` is the user-facing text the engine derived from the originating request’s `user_intent` UpdateReasons. May be `''` when the turn carried no user-intent reasons (e.g. a layout-only update from a resize) — empty is a legal value with semantic meaning (“no user input on this turn”). `assistantMessage` is the assistant’s reply, absent when the turn shipped without one.
-   `injection`: `content` is the injected assistant text verbatim.

The exact derivation of `userIntent` is the engine’s choice — the reference engine concatenates every `user_intent` UpdateReason with a single-space separator. Other engines may project differently; clients SHOULD treat the field as opaque text suitable for direct rendering.

`id`, `sessionId`, and `timestamp` come straight from the originating envelope — `id` is the engine-input MessageId so callers can dedupe against locally-known requests, and `timestamp` is the wall-clock the client originally stamped (guaranteed finite by the wire schema).
