> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# Replay

This page documents the `Replay` CDP domain supported by Lynx DevTool.



:::warning Experimental reference
This generated reference is still being completed.

- CDP events are not included yet.
- Some Lynx extensions are listed but do not yet have detailed documentation.
- Method descriptions are not automatically verified against the implementation and may be incomplete or inaccurate.

Verify behavior against the implementation and the linked upstream CDP reference before relying on it.
:::

## Overview

- Scope: `global-and-instance`
- CDP domain: Lynx-specific

## Lynx Extensions

### `Replay.end`

Ends TestBench replay by exposing a replay dump file as a stream.

- Origin: `lynx-extension`
- Source: `devtool/lynx_devtool/agent/domain_agent/inspector_testbench_replay_agent.cc`

###### Parameters

| Name     | Type     | Required | Description                                                                                         |
| -------- | -------- | -------- | --------------------------------------------------------------------------------------------------- |
| `params` | `string` | Yes      | File path for the replay dump file. The native handler reads the whole params value as this string. |

###### Returns

| Name     | Type     | Description                                                             |
| -------- | -------- | ----------------------------------------------------------------------- |
| `stream` | `string` | FileStream handle returned in the Replay.end message params on success. |

###### Events

- Replay.end

###### Notes

- Replay support must be enabled in the current runtime. If ReplayController::Enable() is false, the agent returns method not implemented.
- params is a raw string file path, not an object.
- On success, LynxGlobalDevToolMediator opens the file with FileStream::Open() and sends a Replay.end message whose params.stream is the stream handle.
- Read the returned stream handle with IO.read and close it with IO.close.
- If the file path cannot be opened, the method returns a CDP error with message file path doesn't exist.
- If ReplayController::Enable() becomes false inside the mediator task, the method returns a CDP error with message Replay doesn't enable.
- In the internal replay workflow, ReplayController::EndTest() saves collected replay dump data to this file path before notifying DevTool through the same Replay.end message shape.

###### Examples

**End replay and open the dump file**

Request:

```json
{
  "id": 2,
  "method": "Replay.end",
  "params": "/tmp/lynx-replay-dump.json"
}
```

Response:

```json
{
  "method": "Replay.end",
  "params": {
    "stream": "1"
  }
}
```

### `Replay.start`

Starts TestBench replay collection for the current Lynx page.

- Origin: `lynx-extension`
- Source: `devtool/lynx_devtool/agent/domain_agent/inspector_testbench_replay_agent.cc`

###### Parameters

No parameters.

###### Returns

No return fields.

###### Notes

- Replay support must be enabled in the current runtime. If ReplayController::Enable() is false, the agent returns method not implemented.
- Dispatches through LynxGlobalDevToolMediator and starts ReplayController::StartTest() on the UI task runner.
- Returns an empty result object on success.
- Returns a CDP error with message Cannot find ui task runner when no UI task runner is available.

###### Examples

**Start replay collection**

Request:

```json
{
  "id": 1,
  "method": "Replay.start"
}
```

Response:

```json
{
  "id": 1,
  "result": {}
}
```

