@vite-hub/source 0.0.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +267 -96
  2. package/dist/client.d.ts +27 -10
  3. package/dist/client.js +99 -15
  4. package/dist/collection-B8sgxw5-.d.ts +290 -0
  5. package/dist/collection-C0Rvrx3p.js +297 -0
  6. package/dist/collection-route-BplWPxHR.js +10 -0
  7. package/dist/drizzle.d.ts +48 -0
  8. package/dist/drizzle.js +87 -0
  9. package/dist/error-diagnostics-ClQKdi7c.js +194 -0
  10. package/dist/github-D5S0dEZe.js +1312 -0
  11. package/dist/{glob.js → glob-DmdMVqjx.js} +154 -57
  12. package/dist/index.d.ts +284 -62
  13. package/dist/index.js +583 -29
  14. package/dist/invariant-DolT9EEx.js +22 -0
  15. package/dist/mcp.d.ts +3 -4
  16. package/dist/mcp.js +184 -5917
  17. package/dist/object-CtSHeGQO.js +17 -0
  18. package/dist/{path-CUhvUREm.js → path-DFlSryRA.js} +90 -40
  19. package/dist/root-DJNmqCEW.js +11 -0
  20. package/dist/server.d.ts +24 -11
  21. package/dist/server.js +97 -26
  22. package/dist/types-Ln-FxVFn.d.ts +98 -0
  23. package/dist/vite.d.ts +202 -14
  24. package/dist/vite.js +1683 -122
  25. package/package.json +55 -58
  26. package/dist/auth-Ddw55OUG.js +0 -1261
  27. package/dist/client-CDfTmtQu.js +0 -7903
  28. package/dist/collection-B8pXGM2d.js +0 -141
  29. package/dist/collection-CF2ON__k.d.ts +0 -92
  30. package/dist/collection-route-Dw7QLFyx.js +0 -6
  31. package/dist/content/client.d.ts +0 -3
  32. package/dist/content/client.js +0 -2
  33. package/dist/content.d.ts +0 -44
  34. package/dist/content.js +0 -157
  35. package/dist/file-BSWQg9Qv.js +0 -503
  36. package/dist/file-EQ3AjVM6.d.ts +0 -20
  37. package/dist/file.d.ts +0 -2
  38. package/dist/file.js +0 -2
  39. package/dist/github.d.ts +0 -17
  40. package/dist/github.js +0 -1033
  41. package/dist/glob.d.ts +0 -15
  42. package/dist/markdown.d.ts +0 -7
  43. package/dist/markdown.js +0 -10
  44. package/dist/path-BzmU4Eni.js +0 -36
  45. package/dist/registry-C8skfCSV.js +0 -120
  46. package/dist/sse-CE9Q2JqM.js +0 -407
  47. package/dist/streamableHttp-BszaXLmg.js +0 -491
  48. package/dist/types-AIBmt_m6.js +0 -6275
  49. package/dist/types-Bu3WvNX9.d.ts +0 -71
  50. package/tsconfig.vite.json +0 -6
  51. package/types/source/fallback.d.ts +0 -1
  52. package/types/source/index.d.ts +0 -1
@@ -1,491 +0,0 @@
1
- import { i as __toESM, r as __commonJSMin } from "./path-CUhvUREm.js";
2
- import { H as isJSONRPCResultResponse, R as isInitializedNotification, V as isJSONRPCRequest, y as JSONRPCMessageSchema } from "./types-AIBmt_m6.js";
3
- import { a as normalizeHeaders, i as createFetchWithInit, n as auth, o as createParser, r as extractWWWAuthenticateParams, t as UnauthorizedError } from "./auth-Ddw55OUG.js";
4
- /*!
5
- * content-type
6
- * Copyright(c) 2015 Douglas Christopher Wilson
7
- * MIT Licensed
8
- */
9
- //#endregion
10
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
11
- var import_content_type = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
12
- /**
13
- * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
14
- *
15
- * parameter = token "=" ( token / quoted-string )
16
- * token = 1*tchar
17
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
18
- * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
19
- * / DIGIT / ALPHA
20
- * ; any VCHAR, except delimiters
21
- * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
22
- * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
23
- * obs-text = %x80-FF
24
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
25
- */
26
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
27
- /**
28
- * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
29
- *
30
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
31
- * obs-text = %x80-FF
32
- */
33
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
34
- /**
35
- * RegExp to match type in RFC 7231 sec 3.1.1.1
36
- *
37
- * media-type = type "/" subtype
38
- * type = token
39
- * subtype = token
40
- */
41
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
42
- exports.parse = parse;
43
- /**
44
- * Parse media type to object.
45
- *
46
- * @param {string|object} string
47
- * @return {Object}
48
- * @public
49
- */
50
- function parse(string) {
51
- if (!string) throw new TypeError("argument string is required");
52
- var header = typeof string === "object" ? getcontenttype(string) : string;
53
- if (typeof header !== "string") throw new TypeError("argument string is required to be a string");
54
- var index = header.indexOf(";");
55
- var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
56
- if (!TYPE_REGEXP.test(type)) throw new TypeError("invalid media type");
57
- var obj = new ContentType(type.toLowerCase());
58
- if (index !== -1) {
59
- var key;
60
- var match;
61
- var value;
62
- PARAM_REGEXP.lastIndex = index;
63
- while (match = PARAM_REGEXP.exec(header)) {
64
- if (match.index !== index) throw new TypeError("invalid parameter format");
65
- index += match[0].length;
66
- key = match[1].toLowerCase();
67
- value = match[2];
68
- if (value.charCodeAt(0) === 34) {
69
- value = value.slice(1, -1);
70
- if (value.indexOf("\\") !== -1) value = value.replace(QESC_REGEXP, "$1");
71
- }
72
- obj.parameters[key] = value;
73
- }
74
- if (index !== header.length) throw new TypeError("invalid parameter format");
75
- }
76
- return obj;
77
- }
78
- /**
79
- * Get content-type from req/res objects.
80
- *
81
- * @param {object}
82
- * @return {Object}
83
- * @private
84
- */
85
- function getcontenttype(obj) {
86
- var header;
87
- if (typeof obj.getHeader === "function") header = obj.getHeader("content-type");
88
- else if (typeof obj.headers === "object") header = obj.headers && obj.headers["content-type"];
89
- if (typeof header !== "string") throw new TypeError("content-type header is missing from object");
90
- return header;
91
- }
92
- /**
93
- * Class to represent a content type.
94
- * @private
95
- */
96
- function ContentType(type) {
97
- this.parameters = Object.create(null);
98
- this.type = type;
99
- }
100
- })))(), 1);
101
- /**
102
- * Extracts the media type (the lowercased `type/subtype` pair, without
103
- * parameters) from a raw `Content-Type` header value, or `undefined` when the
104
- * header is missing or empty.
105
- *
106
- * Content-Type comparisons must use the parsed media type, never a substring
107
- * search of the raw header: a value like `text/plain; a=application/json`
108
- * contains the substring `application/json` but its media type is
109
- * `text/plain`, and case variants or parameters make naive string comparison
110
- * wrong in both directions.
111
- *
112
- * "Essence" is the WHATWG MIME Sniffing standard's term for the bare
113
- * `type/subtype` pair (https://mimesniff.spec.whatwg.org/#mime-type-essence);
114
- * the Fetch standard's request classification is defined against it
115
- * (https://fetch.spec.whatwg.org/#cors-safelisted-request-header).
116
- *
117
- * Parsing is RFC 9110 (`content-type` package) first. When the parameter
118
- * section is malformed (`application/json;`, `application/json; charset=`),
119
- * browsers and most HTTP stacks still derive the media type from the segment
120
- * before the first `;` — the fallback matches that widely-implemented
121
- * behavior, so a header whose media type is unambiguous is not rejected for
122
- * a sloppy parameter section.
123
- */
124
- function mediaTypeEssence(header) {
125
- if (!header) return;
126
- try {
127
- return import_content_type.parse(header).type;
128
- } catch {
129
- const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
130
- if (essence === "" || header.slice(essence.length).includes(",")) return;
131
- return essence;
132
- }
133
- }
134
- //#endregion
135
- //#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
136
- var EventSourceParserStream = class extends TransformStream {
137
- constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
138
- let parser;
139
- super({
140
- start(controller) {
141
- parser = createParser({
142
- onEvent: (event) => {
143
- controller.enqueue(event);
144
- },
145
- onError(error) {
146
- typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
147
- },
148
- onRetry,
149
- onComment,
150
- maxBufferSize
151
- });
152
- },
153
- transform(chunk) {
154
- parser.feed(chunk);
155
- }
156
- });
157
- }
158
- };
159
- //#endregion
160
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
161
- const DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
162
- initialReconnectionDelay: 1e3,
163
- maxReconnectionDelay: 3e4,
164
- reconnectionDelayGrowFactor: 1.5,
165
- maxRetries: 2
166
- };
167
- var StreamableHTTPError = class extends Error {
168
- constructor(code, message) {
169
- super(`Streamable HTTP error: ${message}`);
170
- this.code = code;
171
- }
172
- };
173
- /**
174
- * Client transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification.
175
- * It will connect to a server using HTTP POST for sending messages and HTTP GET with Server-Sent Events
176
- * for receiving messages.
177
- */
178
- var StreamableHTTPClientTransport = class {
179
- constructor(url, opts) {
180
- this._hasCompletedAuthFlow = false;
181
- this._url = url;
182
- this._resourceMetadataUrl = void 0;
183
- this._scope = void 0;
184
- this._requestInit = opts?.requestInit;
185
- this._authProvider = opts?.authProvider;
186
- this._fetch = opts?.fetch;
187
- this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
188
- this._sessionId = opts?.sessionId;
189
- this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
190
- }
191
- async _authThenStart() {
192
- if (!this._authProvider) throw new UnauthorizedError("No auth provider");
193
- let result;
194
- try {
195
- result = await auth(this._authProvider, {
196
- serverUrl: this._url,
197
- resourceMetadataUrl: this._resourceMetadataUrl,
198
- scope: this._scope,
199
- fetchFn: this._fetchWithInit
200
- });
201
- } catch (error) {
202
- this.onerror?.(error);
203
- throw error;
204
- }
205
- if (result !== "AUTHORIZED") throw new UnauthorizedError();
206
- return await this._startOrAuthSse({ resumptionToken: void 0 });
207
- }
208
- async _commonHeaders() {
209
- const headers = {};
210
- if (this._authProvider) {
211
- const tokens = await this._authProvider.tokens();
212
- if (tokens) headers["Authorization"] = `Bearer ${tokens.access_token}`;
213
- }
214
- if (this._sessionId) headers["mcp-session-id"] = this._sessionId;
215
- if (this._protocolVersion) headers["mcp-protocol-version"] = this._protocolVersion;
216
- const extraHeaders = normalizeHeaders(this._requestInit?.headers);
217
- return new Headers({
218
- ...headers,
219
- ...extraHeaders
220
- });
221
- }
222
- async _startOrAuthSse(options) {
223
- const { resumptionToken } = options;
224
- try {
225
- const headers = await this._commonHeaders();
226
- headers.set("Accept", "text/event-stream");
227
- if (resumptionToken) headers.set("last-event-id", resumptionToken);
228
- const response = await (this._fetch ?? fetch)(this._url, {
229
- method: "GET",
230
- headers,
231
- signal: this._abortController?.signal
232
- });
233
- if (!response.ok) {
234
- await response.body?.cancel();
235
- if (response.status === 401 && this._authProvider) return await this._authThenStart();
236
- if (response.status === 405) return;
237
- throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${response.statusText}`);
238
- }
239
- this._handleSseStream(response.body, options, true);
240
- } catch (error) {
241
- this.onerror?.(error);
242
- throw error;
243
- }
244
- }
245
- /**
246
- * Calculates the next reconnection delay using backoff algorithm
247
- *
248
- * @param attempt Current reconnection attempt count for the specific stream
249
- * @returns Time to wait in milliseconds before next reconnection attempt
250
- */
251
- _getNextReconnectionDelay(attempt) {
252
- if (this._serverRetryMs !== void 0) return this._serverRetryMs;
253
- const initialDelay = this._reconnectionOptions.initialReconnectionDelay;
254
- const growFactor = this._reconnectionOptions.reconnectionDelayGrowFactor;
255
- const maxDelay = this._reconnectionOptions.maxReconnectionDelay;
256
- return Math.min(initialDelay * Math.pow(growFactor, attempt), maxDelay);
257
- }
258
- /**
259
- * Schedule a reconnection attempt using server-provided retry interval or backoff
260
- *
261
- * @param lastEventId The ID of the last received event for resumability
262
- * @param attemptCount Current reconnection attempt count for this specific stream
263
- */
264
- _scheduleReconnection(options, attemptCount = 0) {
265
- const maxRetries = this._reconnectionOptions.maxRetries;
266
- if (attemptCount >= maxRetries) {
267
- this.onerror?.(/* @__PURE__ */ new Error(`Maximum reconnection attempts (${maxRetries}) exceeded.`));
268
- return;
269
- }
270
- const delay = this._getNextReconnectionDelay(attemptCount);
271
- this._reconnectionTimeout = setTimeout(() => {
272
- this._startOrAuthSse(options).catch((error) => {
273
- this.onerror?.(/* @__PURE__ */ new Error(`Failed to reconnect SSE stream: ${error instanceof Error ? error.message : String(error)}`));
274
- this._scheduleReconnection(options, attemptCount + 1);
275
- });
276
- }, delay);
277
- }
278
- _handleSseStream(stream, options, isReconnectable) {
279
- if (!stream) return;
280
- const { onresumptiontoken, replayMessageId } = options;
281
- let lastEventId;
282
- let hasPrimingEvent = false;
283
- let receivedResponse = false;
284
- const processStream = async () => {
285
- try {
286
- const reader = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({ onRetry: (retryMs) => {
287
- this._serverRetryMs = retryMs;
288
- } })).getReader();
289
- while (true) {
290
- const { value: event, done } = await reader.read();
291
- if (done) break;
292
- if (event.id) {
293
- lastEventId = event.id;
294
- hasPrimingEvent = true;
295
- onresumptiontoken?.(event.id);
296
- }
297
- if (!event.data) continue;
298
- if (!event.event || event.event === "message") try {
299
- const message = JSONRPCMessageSchema.parse(JSON.parse(event.data));
300
- if (isJSONRPCResultResponse(message)) {
301
- receivedResponse = true;
302
- if (replayMessageId !== void 0) message.id = replayMessageId;
303
- }
304
- this.onmessage?.(message);
305
- } catch (error) {
306
- this.onerror?.(error);
307
- }
308
- }
309
- if ((isReconnectable || hasPrimingEvent) && !receivedResponse && this._abortController && !this._abortController.signal.aborted) this._scheduleReconnection({
310
- resumptionToken: lastEventId,
311
- onresumptiontoken,
312
- replayMessageId
313
- }, 0);
314
- } catch (error) {
315
- this.onerror?.(/* @__PURE__ */ new Error(`SSE stream disconnected: ${error}`));
316
- if ((isReconnectable || hasPrimingEvent) && !receivedResponse && this._abortController && !this._abortController.signal.aborted) try {
317
- this._scheduleReconnection({
318
- resumptionToken: lastEventId,
319
- onresumptiontoken,
320
- replayMessageId
321
- }, 0);
322
- } catch (error) {
323
- this.onerror?.(/* @__PURE__ */ new Error(`Failed to reconnect: ${error instanceof Error ? error.message : String(error)}`));
324
- }
325
- }
326
- };
327
- processStream();
328
- }
329
- async start() {
330
- if (this._abortController) throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");
331
- this._abortController = new AbortController();
332
- }
333
- /**
334
- * Call this method after the user has finished authorizing via their user agent and is redirected back to the MCP client application. This will exchange the authorization code for an access token, enabling the next connection attempt to successfully auth.
335
- */
336
- async finishAuth(authorizationCode) {
337
- if (!this._authProvider) throw new UnauthorizedError("No auth provider");
338
- if (await auth(this._authProvider, {
339
- serverUrl: this._url,
340
- authorizationCode,
341
- resourceMetadataUrl: this._resourceMetadataUrl,
342
- scope: this._scope,
343
- fetchFn: this._fetchWithInit
344
- }) !== "AUTHORIZED") throw new UnauthorizedError("Failed to authorize");
345
- }
346
- async close() {
347
- if (this._reconnectionTimeout) {
348
- clearTimeout(this._reconnectionTimeout);
349
- this._reconnectionTimeout = void 0;
350
- }
351
- this._abortController?.abort();
352
- this.onclose?.();
353
- }
354
- async send(message, options) {
355
- try {
356
- const { resumptionToken, onresumptiontoken } = options || {};
357
- if (resumptionToken) {
358
- this._startOrAuthSse({
359
- resumptionToken,
360
- replayMessageId: isJSONRPCRequest(message) ? message.id : void 0
361
- }).catch((err) => this.onerror?.(err));
362
- return;
363
- }
364
- const headers = await this._commonHeaders();
365
- headers.set("content-type", "application/json");
366
- headers.set("accept", "application/json, text/event-stream");
367
- const init = {
368
- ...this._requestInit,
369
- method: "POST",
370
- headers,
371
- body: JSON.stringify(message),
372
- signal: this._abortController?.signal
373
- };
374
- const response = await (this._fetch ?? fetch)(this._url, init);
375
- const sessionId = response.headers.get("mcp-session-id");
376
- if (sessionId) this._sessionId = sessionId;
377
- if (!response.ok) {
378
- const text = await response.text().catch(() => null);
379
- if (response.status === 401 && this._authProvider) {
380
- if (this._hasCompletedAuthFlow) throw new StreamableHTTPError(401, "Server returned 401 after successful authentication");
381
- const { resourceMetadataUrl, scope } = extractWWWAuthenticateParams(response);
382
- this._resourceMetadataUrl = resourceMetadataUrl;
383
- this._scope = scope;
384
- if (await auth(this._authProvider, {
385
- serverUrl: this._url,
386
- resourceMetadataUrl: this._resourceMetadataUrl,
387
- scope: this._scope,
388
- fetchFn: this._fetchWithInit
389
- }) !== "AUTHORIZED") throw new UnauthorizedError();
390
- this._hasCompletedAuthFlow = true;
391
- return this.send(message);
392
- }
393
- if (response.status === 403 && this._authProvider) {
394
- const { resourceMetadataUrl, scope, error } = extractWWWAuthenticateParams(response);
395
- if (error === "insufficient_scope") {
396
- const wwwAuthHeader = response.headers.get("WWW-Authenticate");
397
- if (this._lastUpscopingHeader === wwwAuthHeader) throw new StreamableHTTPError(403, "Server returned 403 after trying upscoping");
398
- if (scope) this._scope = scope;
399
- if (resourceMetadataUrl) this._resourceMetadataUrl = resourceMetadataUrl;
400
- this._lastUpscopingHeader = wwwAuthHeader ?? void 0;
401
- if (await auth(this._authProvider, {
402
- serverUrl: this._url,
403
- resourceMetadataUrl: this._resourceMetadataUrl,
404
- scope: this._scope,
405
- fetchFn: this._fetch
406
- }) !== "AUTHORIZED") throw new UnauthorizedError();
407
- return this.send(message);
408
- }
409
- }
410
- throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
411
- }
412
- this._hasCompletedAuthFlow = false;
413
- this._lastUpscopingHeader = void 0;
414
- if (response.status === 202) {
415
- await response.body?.cancel();
416
- if (isInitializedNotification(message)) this._startOrAuthSse({ resumptionToken: void 0 }).catch((err) => this.onerror?.(err));
417
- return;
418
- }
419
- const hasRequests = (Array.isArray(message) ? message : [message]).filter((msg) => "method" in msg && "id" in msg && msg.id !== void 0).length > 0;
420
- const contentType = response.headers.get("content-type");
421
- const responseMediaType = mediaTypeEssence(contentType);
422
- if (hasRequests) if (responseMediaType === "text/event-stream") this._handleSseStream(response.body, { onresumptiontoken }, false);
423
- else if (responseMediaType === "application/json") {
424
- const data = await response.json();
425
- const responseMessages = Array.isArray(data) ? data.map((msg) => JSONRPCMessageSchema.parse(msg)) : [JSONRPCMessageSchema.parse(data)];
426
- for (const msg of responseMessages) this.onmessage?.(msg);
427
- } else {
428
- await response.body?.cancel();
429
- throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType}`);
430
- }
431
- else await response.body?.cancel();
432
- } catch (error) {
433
- this.onerror?.(error);
434
- throw error;
435
- }
436
- }
437
- get sessionId() {
438
- return this._sessionId;
439
- }
440
- /**
441
- * Terminates the current session by sending a DELETE request to the server.
442
- *
443
- * Clients that no longer need a particular session
444
- * (e.g., because the user is leaving the client application) SHOULD send an
445
- * HTTP DELETE to the MCP endpoint with the Mcp-Session-Id header to explicitly
446
- * terminate the session.
447
- *
448
- * The server MAY respond with HTTP 405 Method Not Allowed, indicating that
449
- * the server does not allow clients to terminate sessions.
450
- */
451
- async terminateSession() {
452
- if (!this._sessionId) return;
453
- try {
454
- const headers = await this._commonHeaders();
455
- const init = {
456
- ...this._requestInit,
457
- method: "DELETE",
458
- headers,
459
- signal: this._abortController?.signal
460
- };
461
- const response = await (this._fetch ?? fetch)(this._url, init);
462
- await response.body?.cancel();
463
- if (!response.ok && response.status !== 405) throw new StreamableHTTPError(response.status, `Failed to terminate session: ${response.statusText}`);
464
- this._sessionId = void 0;
465
- } catch (error) {
466
- this.onerror?.(error);
467
- throw error;
468
- }
469
- }
470
- setProtocolVersion(version) {
471
- this._protocolVersion = version;
472
- }
473
- get protocolVersion() {
474
- return this._protocolVersion;
475
- }
476
- /**
477
- * Resume an SSE stream from a previous event ID.
478
- * Opens a GET SSE connection with Last-Event-ID header to replay missed events.
479
- *
480
- * @param lastEventId The event ID to resume from
481
- * @param options Optional callback to receive new resumption tokens
482
- */
483
- async resumeStream(lastEventId, options) {
484
- await this._startOrAuthSse({
485
- resumptionToken: lastEventId,
486
- onresumptiontoken: options?.onresumptiontoken
487
- });
488
- }
489
- };
490
- //#endregion
491
- export { StreamableHTTPClientTransport };