> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# InMemoryChannelLedger

Deterministic ledger test double; production wiring must provide persistent storage.

**Constructors**
**Constructor**

> **new InMemoryChannelLedger**(`options?`): `InMemoryChannelLedger`

**Parameters**

| Parameter | Type |
| - | - |
| `options?` | [`InMemoryChannelLedgerOptions`](/docs/agent-sdk/harness-sdk/channels/in-memory-ledger#inmemorychannelledgeroptions) |

**Returns**
`InMemoryChannelLedger`

**Methods**
**acceptInbound()**

> **acceptInbound**(`channel`, `externalMessageId`, `conversationId`, `accept`): `Promise`\<`Readonly`\<\{ `duplicate`: `boolean`; `runId`: `string`; }>>

Atomically claims an inbound provider message and persists its run mapping
as one recovery unit. Persistent implementations must share this claim across
router processes and must not release a claim after `accept` succeeds.

**Parameters**

| Parameter | Type |
| - | - |
| `channel` | `string` |
| `externalMessageId` | `string` |
| `conversationId` | `string` |
| `accept` | () => `Promise`\<`string`> |

**Returns**
`Promise`\<`Readonly`\<\{ `duplicate`: `boolean`; `runId`: `string`; }>>

**Implementation of**
[`ChannelLedger`](/docs/agent-sdk/harness-sdk/channels/router#channelledger).[`acceptInbound`](/docs/agent-sdk/harness-sdk/channels/router#channelledger)

**findOutbound()**

> **findOutbound**(`channel`, `providerRequestId`): `Promise`\<`string` | `undefined`>

**Parameters**

| Parameter | Type |
| - | - |
| `channel` | `string` |
| `providerRequestId` | `string` |

**Returns**
`Promise`\<`string` | `undefined`>

**Implementation of**
[`ChannelLedger`](/docs/agent-sdk/harness-sdk/channels/router#channelledger).[`findOutbound`](/docs/agent-sdk/harness-sdk/channels/router#channelledger)

**findRun()**

> **findRun**(`runId`): `Promise`\<`Readonly`\<\{ `channel`: `string`; `conversationId`: `string`; }> | `undefined`>

**Parameters**

| Parameter | Type |
| - | - |
| `runId` | `string` |

**Returns**
`Promise`\<`Readonly`\<\{ `channel`: `string`; `conversationId`: `string`; }> | `undefined`>

**Implementation of**
[`ChannelLedger`](/docs/agent-sdk/harness-sdk/channels/router#channelledger).[`findRun`](/docs/agent-sdk/harness-sdk/channels/router#channelledger)

**recoverOutbound()**

> **recoverOutbound**(`channel`, `runId`, `idempotencyKey`): `Promise`\<\{ `providerRequestId`: `string`; } | `undefined`>

Reconciles a previous provider success without authorizing or sending again.

**Parameters**

| Parameter | Type |
| - | - |
| `channel` | `string` |
| `runId` | `string` |
| `idempotencyKey` | `string` |

**Returns**
`Promise`\<\{ `providerRequestId`: `string`; } | `undefined`>

**Implementation of**
[`ChannelLedger`](/docs/agent-sdk/harness-sdk/channels/router#channelledger).[`recoverOutbound`](/docs/agent-sdk/harness-sdk/channels/router#channelledger)

**sendOutbound()**

> **sendOutbound**(`channel`, `runId`, `idempotencyKey`, `send`): `Promise`\<\{ `providerRequestId`: `string`; }>

Reserves and completes one correlated outbound attempt. Implementations
must retain the stable idempotency key through retries/recovery so a
provider never observes an unkeyed resend after persistence uncertainty.

**Parameters**

| Parameter | Type |
| - | - |
| `channel` | `string` |
| `runId` | `string` |
| `idempotencyKey` | `string` |
| `send` | (`idempotencyKey`) => `Promise`\<\{ `providerRequestId`: `string`; }> |

**Returns**
`Promise`\<\{ `providerRequestId`: `string`; }>

**Implementation of**
[`ChannelLedger`](/docs/agent-sdk/harness-sdk/channels/router#channelledger).[`sendOutbound`](/docs/agent-sdk/harness-sdk/channels/router#channelledger)

## InMemoryChannelLedgerOptions

**Properties**
**failAfterInboundAcceptOnce?**

> `readonly` `optional` **failAfterInboundAcceptOnce?**: `boolean`

Test-only fault injection for recovery-path verification.

**failAfterOutboundSendOnce?**

> `readonly` `optional` **failAfterOutboundSendOnce?**: `boolean`

Test-only fault injection for recovery-path verification.
