@@ -87,17 +87,20 @@ export type RequestOptions = {
8787 * May be used to indicate to the transport which incoming request to associate this outgoing request with.
8888 */
8989 relatedRequestId ?: RequestId ;
90+
9091 /**
91- * The last event ID to associate with the request.
92- * Used to resume long-running requests that were interrupted when creating a new client instance.
92+ * The resumption token used to continue long-running requests that were interrupted.
93+ *
94+ * This allows clients to reconnect and continue from where they left off, if supported by the transport.
9395 */
94- lastEventId ?: string ;
96+ resumptionToken ?: string ;
9597
9698 /**
97- * A callback that is invoked when the last event ID is updated.
98- * This is used to notify the client that the last event ID has changed, so the client can update its state accordingly.
99+ * A callback that is invoked when the resumption token changes, if supported by the transport.
100+ *
101+ * This allows clients to persist the latest token for potential reconnection.
99102 */
100- onLastEventIdUpdate ?: ( event : string ) => void ;
103+ onresumptiontoken ?: ( token : string ) => void ;
101104} ;
102105
103106/**
@@ -512,7 +515,7 @@ export abstract class Protocol<
512515 resultSchema : T ,
513516 options ?: RequestOptions ,
514517 ) : Promise < z . infer < T > > {
515- const { relatedRequestId, lastEventId , onLastEventIdUpdate } = options ?? { } ;
518+ const { relatedRequestId, resumptionToken , onresumptiontoken } = options ?? { } ;
516519
517520 return new Promise ( ( resolve , reject ) => {
518521 if ( ! this . _transport ) {
@@ -554,7 +557,7 @@ export abstract class Protocol<
554557 requestId : messageId ,
555558 reason : String ( reason ) ,
556559 } ,
557- } , { relatedRequestId, lastEventId , onLastEventIdUpdate } )
560+ } , { relatedRequestId, resumptionToken , onresumptiontoken } )
558561 . catch ( ( error ) =>
559562 this . _onerror ( new Error ( `Failed to send cancellation: ${ error } ` ) ) ,
560563 ) ;
@@ -592,7 +595,7 @@ export abstract class Protocol<
592595
593596 this . _setupTimeout ( messageId , timeout , options ?. maxTotalTimeout , timeoutHandler , options ?. resetTimeoutOnProgress ?? false ) ;
594597
595- this . _transport . send ( jsonrpcRequest , { relatedRequestId, lastEventId , onLastEventIdUpdate } ) . catch ( ( error ) => {
598+ this . _transport . send ( jsonrpcRequest , { relatedRequestId, resumptionToken , onresumptiontoken } ) . catch ( ( error ) => {
596599 this . _cleanupTimeout ( messageId ) ;
597600 reject ( error ) ;
598601 } ) ;
0 commit comments