1{
2    "domain": "Replay",
3    "description": "Controls web replay, and manages recording sessions and segments.",
4    "types": [
5        {
6            "id": "SessionIdentifier", "description": "Unique replay session identifier.",
7            "type": "integer"
8        },
9        {
10            "id": "SegmentIdentifier", "description": "Unique session segment identifier.",
11            "type": "integer"
12        },
13        {
14            "id": "ReplayPosition",
15            "type": "object",
16            "properties": [
17               { "name": "segmentOffset", "type": "integer", "description": "Offset for a segment within the currently-loaded replay session." },
18               { "name": "inputOffset", "type": "integer", "description": "Offset for an event loop input within the specified session segment." }
19            ]
20        },
21        {
22            "id": "ReplayInput",
23            "type": "object",
24            "properties": [
25                { "name": "type", "type": "string", "description": "Input type." },
26                { "name": "offset", "type": "integer", "description": "Offset of this input in its respective queue."},
27                { "name": "timestamp", "type": "number", "optional": true, "description": "The timestamp of this input." },
28                { "name": "data", "type": "object", "description": "Per-input payload." }
29            ]
30        },
31        {
32            "id": "ReplayInputQueue",
33            "type": "object",
34            "properties": [
35                { "name": "type", "type": "string", "description": "Queue type" },
36                { "name": "inputs", "type": "array", "items": { "$ref": "ReplayInput"}, "description": "Inputs belonging to this queue." }
37            ]
38        },
39        {
40            "id": "SessionSegment", "description": "A standalone segment of a replay session that corresponds to a single main frame navigation and execution.",
41            "type": "object",
42            "properties": [
43                { "name": "id", "$ref": "SegmentIdentifier", "description": "Unique session segment identifier." },
44                { "name": "timestamp", "type": "number", "description": "Start time of the segment, in milliseconds since the epoch." },
45                { "name": "queues", "type": "array", "items": { "$ref": "ReplayInputQueue"} }
46            ]
47        },
48        {
49            "id": "ReplaySession", "description": "An ordered collection of replay session segments.",
50            "type": "object",
51            "properties": [
52                { "name": "id", "$ref": "SessionIdentifier", "description": "Unique replay session identifier." },
53                { "name": "timestamp", "type": "number", "description": "Creation time of session, in milliseconds since the epoch." },
54                { "name": "segments", "type": "array", "items": { "$ref": "SegmentIdentifier" }, "description": "An ordered list identifiers for the segments that comprise this replay session." }
55            ]
56        }
57    ],
58    "commands": [
59        {
60            "name": "startCapturing",
61            "description": "Starts capture of a new replay session."
62        },
63        {
64            "name": "stopCapturing",
65            "description": "Stops capture of the currently recording replay session."
66        },
67        {
68            "name": "replayToPosition",
69            "description": "Seek execution to a specific position within the replay session.",
70            "parameters": [
71                { "name": "position", "$ref": "ReplayPosition" },
72                { "name": "shouldFastForward", "type": "boolean" }
73            ]
74        },
75        {
76            "name": "replayToCompletion",
77            "description": "Replay all session segments completely.",
78            "parameters": [
79                { "name": "shouldFastForward", "type": "boolean" }
80            ]
81        },
82        {
83            "name": "pausePlayback",
84            "description": "Pauses playback in the current segment. Can be resumed by using a replay command."
85        },
86        {
87            "name": "cancelPlayback",
88            "description": "Cancels playback of the current segment. Further replaying will start from the beginning of the current segment."
89        },
90        {
91            "name": "switchSession",
92            "description": "Unloads the current replay session and loads the specified session",
93            "parameters": [
94                { "name": "sessionIdentifier", "$ref": "SessionIdentifier" }
95            ]
96        },
97        {
98            "name": "insertSessionSegment",
99            "description": "Splices the specified session segment into the session at the specified index.",
100            "parameters": [
101                { "name": "sessionIdentifier", "$ref": "SessionIdentifier" },
102                { "name": "segmentIdentifier", "$ref": "SegmentIdentifier" },
103                { "name": "segmentIndex", "type": "integer" }
104            ]
105        },
106        {
107            "name": "removeSessionSegment",
108            "description": "Removes the session segment at the specified position from the session.",
109            "parameters": [
110                { "name": "sessionIdentifier", "$ref": "SessionIdentifier" },
111                { "name": "segmentIndex", "type": "integer" }
112            ]
113        },
114        {
115            "name": "getAvailableSessions",
116            "description": "Returns identifiers of all available sessions.",
117            "returns": [
118                { "name": "ids", "type": "array", "items": { "$ref": "SessionIdentifier" } }
119            ]
120        },
121        {
122            "name": "getSerializedSession",
123            "description": "Returns the specified session serialized to a JSON object.",
124            "parameters": [
125                { "name": "sessionIdentifier", "$ref": "SessionIdentifier" }
126            ],
127            "returns": [
128                { "name": "session", "$ref": "ReplaySession", "optional": true, "description": "The requested serialized replay session." }
129            ]
130        },
131        {
132            "name": "getSerializedSegment",
133            "description": "Returns the session segment serialized to a JSON object.",
134            "parameters": [
135                { "name": "id", "$ref": "SegmentIdentifier" }
136            ],
137            "returns": [
138                { "name": "segment", "$ref": "SessionSegment",  "optional": true, "description": "The requested serialized session segment." }
139            ]
140        }
141    ],
142    "events": [
143        {
144            "name": "captureStarted",
145            "description": "Fired when capture has started."
146        },
147        {
148            "name": "captureStopped",
149            "description": "Fired when capture has stopped."
150        },
151        {
152            "name": "playbackHitPosition",
153            "description": "A position was reached during playback of the session.",
154            "parameters": [
155                { "name": "position", "$ref": "ReplayPosition", "description": "The playback position that was hit." },
156                { "name": "timestamp", "type": "number", "description": "A timestamp for the event." }
157            ]
158        },
159        {
160            "name": "playbackStarted",
161            "description": "Fired when session playback has started."
162        },
163        {
164            "name": "playbackPaused",
165            "description": "Fired when session playback has paused, but not finished.",
166            "parameters": [
167                { "name": "position", "$ref": "ReplayPosition", "description": "The playback position immediately prior to where playback is paused." }
168            ]
169        },
170        {
171            "name": "playbackFinished",
172            "description": "Fired when session playback has stopped."
173        },
174        {
175            "name": "inputSuppressionChanged",
176            "description": "Fired when the replay controller starts or stops suppressing user inputs.",
177            "parameters": [
178                { "name": "willSuppress", "type": "boolean", "description": "Whether user inputs will be suppressed during playback." }
179            ]
180        },
181        {
182            "name": "sessionCreated",
183            "description": "Fired when a new replay session is created",
184            "parameters": [
185                { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the created session." }
186            ]
187        },
188        {
189            "name": "sessionModified",
190            "description": "Fired when a session's segments have changed.",
191            "parameters": [
192                { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the session the segment was added to." }
193            ]
194        },
195        {
196            "name": "sessionRemoved",
197            "description": "Fired when a replay session is removed and can no longer be loaded.",
198            "parameters": [
199                { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the removed session." }
200            ]
201        },
202        {
203            "name": "sessionLoaded",
204            "description": "Fired when a replay session is loaded.",
205            "parameters": [
206                { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the loaded session." }
207            ]
208        },
209        {
210            "name": "segmentCreated",
211            "description": "Fired when a new session segment is created.",
212            "parameters": [
213                { "name": "id", "$ref": "SegmentIdentifier", "description": "Identifier for the created session segment." }
214            ]
215        },
216        {
217            "name": "segmentRemoved",
218            "description": "Fired when a session segment is removed and can no longer be replayed as part of a session.",
219            "parameters": [
220                { "name": "id", "$ref": "SegmentIdentifier", "description": "Identifier for the removed session segment." }
221            ]
222        },
223        {
224            "name": "segmentCompleted",
225            "description": "Fired when a session segment is completed and can no longer have inputs added to it.",
226            "parameters": [
227                { "name": "id", "$ref": "SegmentIdentifier", "description": "Identifier for the completed session segment." }
228            ]
229        },
230        {
231            "name": "segmentLoaded",
232            "description": "Fired when a segment is loaded.",
233            "parameters": [
234                { "name": "segmentIdentifier", "$ref": "SegmentIdentifier", "description": "Id for the loaded segment." }
235            ]
236        },
237        {
238            "name": "segmentUnloaded",
239            "description": "Fired when a segment is unloaded."
240        }
241    ]
242}
243