@@ -20,7 +20,8 @@ export class Telemetry extends APIResource {
2020 * set; all frames carry JSON in the data: field. A keepalive comment frame is sent
2121 * every 15 seconds when no events arrive. Returns 404 if the browser session does
2222 * not exist. If telemetry was not enabled on the session, the stream opens but no
23- * events are delivered.
23+ * events are delivered. Fresh connections only see new events; pass replay=all to
24+ * start from the oldest retained event instead.
2425 *
2526 * @example
2627 * ```ts
@@ -34,8 +35,9 @@ export class Telemetry extends APIResource {
3435 params : TelemetryStreamParams | undefined = { } ,
3536 options ?: RequestOptions ,
3637 ) : APIPromise < Stream < TelemetryStreamResponse > > {
37- const { 'Last-Event-ID' : lastEventID } = params ?? { } ;
38+ const { 'Last-Event-ID' : lastEventID , ... query } = params ?? { } ;
3839 return this . _client . get ( path `/browsers/${ id } /telemetry/stream` , {
40+ query,
3941 ...options ,
4042 headers : buildHeaders ( [
4143 {
@@ -2001,8 +2003,16 @@ export interface TelemetryStreamResponse {
20012003
20022004export interface TelemetryStreamParams {
20032005 /**
2004- * Last event sequence number for SSE reconnection (sent by SSE clients on
2005- * reconnect)
2006+ * Query param: Pass `all` to start from the oldest retained event instead of only
2007+ * new events; any other value is treated as from-now. The buffer is bounded, so
2008+ * the first event id may be greater than 1 if older events were evicted.
2009+ */
2010+ replay ?: string ;
2011+
2012+ /**
2013+ * Header param: Last event sequence number for SSE reconnection (sent by SSE
2014+ * clients on reconnect). Takes precedence over replay when both are present, so
2015+ * reconnect resumes instead of re-replaying.
20062016 */
20072017 'Last-Event-ID' ?: string ;
20082018}
0 commit comments