@atxp/client 0.2.21 → 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.
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/ajv.js +8 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/cache.js +4 -0
- package/dist/_virtual/cache.js.map +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/uri.all.js +4 -0
- package/dist/_virtual/uri.all.js.map +1 -0
- package/dist/atxpAccount.js +4 -2
- package/dist/atxpAccount.js.map +1 -1
- package/dist/atxpClient.js +12 -10
- package/dist/atxpClient.js.map +1 -1
- package/dist/atxpFetcher.js +10 -8
- package/dist/atxpFetcher.js.map +1 -1
- package/dist/baseAccount.js +5 -3
- package/dist/baseAccount.js.map +1 -1
- package/dist/baseConstants.js +4 -0
- package/dist/baseConstants.js.map +1 -0
- package/dist/basePaymentMaker.js +15 -12
- package/dist/basePaymentMaker.js.map +1 -1
- package/dist/index.cjs +15595 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +250 -10
- package/dist/index.js +15558 -10
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +398 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +273 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +378 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js +46 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +120 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +380 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1254 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/ajv/lib/ajv.js +531 -0
- package/dist/node_modules/ajv/lib/ajv.js.map +1 -0
- package/dist/node_modules/ajv/lib/cache.js +37 -0
- package/dist/node_modules/ajv/lib/cache.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/async.js +102 -0
- package/dist/node_modules/ajv/lib/compile/async.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/error_classes.js +46 -0
- package/dist/node_modules/ajv/lib/compile/error_classes.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/formats.js +154 -0
- package/dist/node_modules/ajv/lib/compile/formats.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/index.js +404 -0
- package/dist/node_modules/ajv/lib/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/resolve.js +286 -0
- package/dist/node_modules/ajv/lib/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/rules.js +79 -0
- package/dist/node_modules/ajv/lib/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/schema_obj.js +21 -0
- package/dist/node_modules/ajv/lib/compile/schema_obj.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/ucs2length.js +30 -0
- package/dist/node_modules/ajv/lib/compile/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/util.js +252 -0
- package/dist/node_modules/ajv/lib/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/lib/data.js +59 -0
- package/dist/node_modules/ajv/lib/data.js.map +1 -0
- package/dist/node_modules/ajv/lib/definition_schema.js +49 -0
- package/dist/node_modules/ajv/lib/definition_schema.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limit.js +173 -0
- package/dist/node_modules/ajv/lib/dotjs/_limit.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitItems.js +90 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitItems.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitLength.js +95 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitLength.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js +90 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/allOf.js +52 -0
- package/dist/node_modules/ajv/lib/dotjs/allOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/anyOf.js +83 -0
- package/dist/node_modules/ajv/lib/dotjs/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/comment.js +24 -0
- package/dist/node_modules/ajv/lib/dotjs/comment.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/const.js +62 -0
- package/dist/node_modules/ajv/lib/dotjs/const.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/contains.js +91 -0
- package/dist/node_modules/ajv/lib/dotjs/contains.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/custom.js +238 -0
- package/dist/node_modules/ajv/lib/dotjs/custom.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/dependencies.js +178 -0
- package/dist/node_modules/ajv/lib/dotjs/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/enum.js +72 -0
- package/dist/node_modules/ajv/lib/dotjs/enum.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/format.js +160 -0
- package/dist/node_modules/ajv/lib/dotjs/format.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/if.js +113 -0
- package/dist/node_modules/ajv/lib/dotjs/if.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/index.js +68 -0
- package/dist/node_modules/ajv/lib/dotjs/index.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/items.js +150 -0
- package/dist/node_modules/ajv/lib/dotjs/items.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/multipleOf.js +90 -0
- package/dist/node_modules/ajv/lib/dotjs/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/not.js +94 -0
- package/dist/node_modules/ajv/lib/dotjs/not.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/oneOf.js +83 -0
- package/dist/node_modules/ajv/lib/dotjs/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/pattern.js +85 -0
- package/dist/node_modules/ajv/lib/dotjs/pattern.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/properties.js +345 -0
- package/dist/node_modules/ajv/lib/dotjs/properties.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/propertyNames.js +91 -0
- package/dist/node_modules/ajv/lib/dotjs/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/ref.js +134 -0
- package/dist/node_modules/ajv/lib/dotjs/ref.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/required.js +276 -0
- package/dist/node_modules/ajv/lib/dotjs/required.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js +96 -0
- package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/validate.js +492 -0
- package/dist/node_modules/ajv/lib/dotjs/validate.js.map +1 -0
- package/dist/node_modules/ajv/lib/keyword.js +159 -0
- package/dist/node_modules/ajv/lib/keyword.js.map +1 -0
- package/dist/node_modules/ajv/lib/refs/data.json.js +33 -0
- package/dist/node_modules/ajv/lib/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js +254 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/eventsource-parser/dist/index.js +104 -0
- package/dist/node_modules/eventsource-parser/dist/index.js.map +1 -0
- package/dist/node_modules/eventsource-parser/dist/stream.js +28 -0
- package/dist/node_modules/eventsource-parser/dist/stream.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +56 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-json-stable-stringify/index.js +69 -0
- package/dist/node_modules/fast-json-stable-stringify/index.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +100 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/pkce-challenge/dist/index.browser.js +66 -0
- package/dist/node_modules/pkce-challenge/dist/index.browser.js.map +1 -0
- package/dist/node_modules/uri-js/dist/es5/uri.all.js +1418 -0
- package/dist/node_modules/uri-js/dist/es5/uri.all.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/ZodError.js +132 -0
- package/dist/node_modules/zod/dist/esm/v3/ZodError.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/errors.js +9 -0
- package/dist/node_modules/zod/dist/esm/v3/errors.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/errorUtil.js +9 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/parseUtil.js +112 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/util.js +136 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/locales/en.js +110 -0
- package/dist/node_modules/zod/dist/esm/v3/locales/en.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/types.js +3488 -0
- package/dist/node_modules/zod/dist/esm/v3/types.js.map +1 -0
- package/dist/oAuth.js +7 -6
- package/dist/oAuth.js.map +1 -1
- package/dist/solanaAccount.js +7 -4
- package/dist/solanaAccount.js.map +1 -1
- package/dist/solanaPaymentMaker.js +15 -12
- package/dist/solanaPaymentMaker.js.map +1 -1
- package/dist/types.js +5 -3
- package/dist/types.js.map +1 -1
- package/package.json +26 -10
- package/dist/atxpAccount.d.ts +0 -13
- package/dist/atxpAccount.d.ts.map +0 -1
- package/dist/atxpClient.d.ts +0 -14
- package/dist/atxpClient.d.ts.map +0 -1
- package/dist/atxpFetcher.d.ts +0 -72
- package/dist/atxpFetcher.d.ts.map +0 -1
- package/dist/baseAccount.d.ts +0 -10
- package/dist/baseAccount.d.ts.map +0 -1
- package/dist/basePaymentMaker.d.ts +0 -16
- package/dist/basePaymentMaker.d.ts.map +0 -1
- package/dist/clientTestHelpers.d.ts +0 -6
- package/dist/clientTestHelpers.d.ts.map +0 -1
- package/dist/clientTestHelpers.js +0 -94
- package/dist/clientTestHelpers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/oAuth.d.ts +0 -44
- package/dist/oAuth.d.ts.map +0 -1
- package/dist/setup.expo.d.ts +0 -2
- package/dist/setup.expo.d.ts.map +0 -1
- package/dist/setup.expo.js +0 -30
- package/dist/setup.expo.js.map +0 -1
- package/dist/solanaAccount.d.ts +0 -9
- package/dist/solanaAccount.d.ts.map +0 -1
- package/dist/solanaPaymentMaker.d.ts +0 -18
- package/dist/solanaPaymentMaker.d.ts.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { CancelledNotificationSchema, ProgressNotificationSchema, PingRequestSchema, McpError, ErrorCode, isJSONRPCResponse, isJSONRPCError, isJSONRPCRequest, isJSONRPCNotification } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The default request timeout, in miliseconds.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
7
|
+
/**
|
|
8
|
+
* Implements MCP protocol framing on top of a pluggable transport, including
|
|
9
|
+
* features like request/response linking, notifications, and progress.
|
|
10
|
+
*/
|
|
11
|
+
class Protocol {
|
|
12
|
+
constructor(_options) {
|
|
13
|
+
this._options = _options;
|
|
14
|
+
this._requestMessageId = 0;
|
|
15
|
+
this._requestHandlers = new Map();
|
|
16
|
+
this._requestHandlerAbortControllers = new Map();
|
|
17
|
+
this._notificationHandlers = new Map();
|
|
18
|
+
this._responseHandlers = new Map();
|
|
19
|
+
this._progressHandlers = new Map();
|
|
20
|
+
this._timeoutInfo = new Map();
|
|
21
|
+
this.setNotificationHandler(CancelledNotificationSchema, (notification) => {
|
|
22
|
+
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
|
23
|
+
controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);
|
|
24
|
+
});
|
|
25
|
+
this.setNotificationHandler(ProgressNotificationSchema, (notification) => {
|
|
26
|
+
this._onprogress(notification);
|
|
27
|
+
});
|
|
28
|
+
this.setRequestHandler(PingRequestSchema,
|
|
29
|
+
// Automatic pong by default.
|
|
30
|
+
(_request) => ({}));
|
|
31
|
+
}
|
|
32
|
+
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
33
|
+
this._timeoutInfo.set(messageId, {
|
|
34
|
+
timeoutId: setTimeout(onTimeout, timeout),
|
|
35
|
+
startTime: Date.now(),
|
|
36
|
+
timeout,
|
|
37
|
+
maxTotalTimeout,
|
|
38
|
+
resetTimeoutOnProgress,
|
|
39
|
+
onTimeout
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
_resetTimeout(messageId) {
|
|
43
|
+
const info = this._timeoutInfo.get(messageId);
|
|
44
|
+
if (!info)
|
|
45
|
+
return false;
|
|
46
|
+
const totalElapsed = Date.now() - info.startTime;
|
|
47
|
+
if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
|
|
48
|
+
this._timeoutInfo.delete(messageId);
|
|
49
|
+
throw new McpError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", { maxTotalTimeout: info.maxTotalTimeout, totalElapsed });
|
|
50
|
+
}
|
|
51
|
+
clearTimeout(info.timeoutId);
|
|
52
|
+
info.timeoutId = setTimeout(info.onTimeout, info.timeout);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
_cleanupTimeout(messageId) {
|
|
56
|
+
const info = this._timeoutInfo.get(messageId);
|
|
57
|
+
if (info) {
|
|
58
|
+
clearTimeout(info.timeoutId);
|
|
59
|
+
this._timeoutInfo.delete(messageId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Attaches to the given transport, starts it, and starts listening for messages.
|
|
64
|
+
*
|
|
65
|
+
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
66
|
+
*/
|
|
67
|
+
async connect(transport) {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
this._transport = transport;
|
|
70
|
+
const _onclose = (_a = this.transport) === null || _a === void 0 ? void 0 : _a.onclose;
|
|
71
|
+
this._transport.onclose = () => {
|
|
72
|
+
_onclose === null || _onclose === void 0 ? void 0 : _onclose();
|
|
73
|
+
this._onclose();
|
|
74
|
+
};
|
|
75
|
+
const _onerror = (_b = this.transport) === null || _b === void 0 ? void 0 : _b.onerror;
|
|
76
|
+
this._transport.onerror = (error) => {
|
|
77
|
+
_onerror === null || _onerror === void 0 ? void 0 : _onerror(error);
|
|
78
|
+
this._onerror(error);
|
|
79
|
+
};
|
|
80
|
+
const _onmessage = (_c = this._transport) === null || _c === void 0 ? void 0 : _c.onmessage;
|
|
81
|
+
this._transport.onmessage = (message, extra) => {
|
|
82
|
+
_onmessage === null || _onmessage === void 0 ? void 0 : _onmessage(message, extra);
|
|
83
|
+
if (isJSONRPCResponse(message) || isJSONRPCError(message)) {
|
|
84
|
+
this._onresponse(message);
|
|
85
|
+
}
|
|
86
|
+
else if (isJSONRPCRequest(message)) {
|
|
87
|
+
this._onrequest(message, extra);
|
|
88
|
+
}
|
|
89
|
+
else if (isJSONRPCNotification(message)) {
|
|
90
|
+
this._onnotification(message);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
await this._transport.start();
|
|
97
|
+
}
|
|
98
|
+
_onclose() {
|
|
99
|
+
var _a;
|
|
100
|
+
const responseHandlers = this._responseHandlers;
|
|
101
|
+
this._responseHandlers = new Map();
|
|
102
|
+
this._progressHandlers.clear();
|
|
103
|
+
this._transport = undefined;
|
|
104
|
+
(_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
105
|
+
const error = new McpError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
106
|
+
for (const handler of responseHandlers.values()) {
|
|
107
|
+
handler(error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
_onerror(error) {
|
|
111
|
+
var _a;
|
|
112
|
+
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
113
|
+
}
|
|
114
|
+
_onnotification(notification) {
|
|
115
|
+
var _a;
|
|
116
|
+
const handler = (_a = this._notificationHandlers.get(notification.method)) !== null && _a !== void 0 ? _a : this.fallbackNotificationHandler;
|
|
117
|
+
// Ignore notifications not being subscribed to.
|
|
118
|
+
if (handler === undefined) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
|
122
|
+
Promise.resolve()
|
|
123
|
+
.then(() => handler(notification))
|
|
124
|
+
.catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
|
|
125
|
+
}
|
|
126
|
+
_onrequest(request, extra) {
|
|
127
|
+
var _a, _b, _c, _d;
|
|
128
|
+
const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;
|
|
129
|
+
if (handler === undefined) {
|
|
130
|
+
(_b = this._transport) === null || _b === void 0 ? void 0 : _b.send({
|
|
131
|
+
jsonrpc: "2.0",
|
|
132
|
+
id: request.id,
|
|
133
|
+
error: {
|
|
134
|
+
code: ErrorCode.MethodNotFound,
|
|
135
|
+
message: "Method not found",
|
|
136
|
+
},
|
|
137
|
+
}).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const abortController = new AbortController();
|
|
141
|
+
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
142
|
+
const fullExtra = {
|
|
143
|
+
signal: abortController.signal,
|
|
144
|
+
sessionId: (_c = this._transport) === null || _c === void 0 ? void 0 : _c.sessionId,
|
|
145
|
+
_meta: (_d = request.params) === null || _d === void 0 ? void 0 : _d._meta,
|
|
146
|
+
sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),
|
|
147
|
+
sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
|
|
148
|
+
authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,
|
|
149
|
+
requestId: request.id,
|
|
150
|
+
requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo
|
|
151
|
+
};
|
|
152
|
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
|
153
|
+
Promise.resolve()
|
|
154
|
+
.then(() => handler(request, fullExtra))
|
|
155
|
+
.then((result) => {
|
|
156
|
+
var _a;
|
|
157
|
+
if (abortController.signal.aborted) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
return (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
161
|
+
result,
|
|
162
|
+
jsonrpc: "2.0",
|
|
163
|
+
id: request.id,
|
|
164
|
+
});
|
|
165
|
+
}, (error) => {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
if (abortController.signal.aborted) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
return (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
171
|
+
jsonrpc: "2.0",
|
|
172
|
+
id: request.id,
|
|
173
|
+
error: {
|
|
174
|
+
code: Number.isSafeInteger(error["code"])
|
|
175
|
+
? error["code"]
|
|
176
|
+
: ErrorCode.InternalError,
|
|
177
|
+
message: (_b = error.message) !== null && _b !== void 0 ? _b : "Internal error",
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
})
|
|
181
|
+
.catch((error) => this._onerror(new Error(`Failed to send response: ${error}`)))
|
|
182
|
+
.finally(() => {
|
|
183
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
_onprogress(notification) {
|
|
187
|
+
const { progressToken, ...params } = notification.params;
|
|
188
|
+
const messageId = Number(progressToken);
|
|
189
|
+
const handler = this._progressHandlers.get(messageId);
|
|
190
|
+
if (!handler) {
|
|
191
|
+
this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const responseHandler = this._responseHandlers.get(messageId);
|
|
195
|
+
const timeoutInfo = this._timeoutInfo.get(messageId);
|
|
196
|
+
if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
|
|
197
|
+
try {
|
|
198
|
+
this._resetTimeout(messageId);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
responseHandler(error);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
handler(params);
|
|
206
|
+
}
|
|
207
|
+
_onresponse(response) {
|
|
208
|
+
const messageId = Number(response.id);
|
|
209
|
+
const handler = this._responseHandlers.get(messageId);
|
|
210
|
+
if (handler === undefined) {
|
|
211
|
+
this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
this._responseHandlers.delete(messageId);
|
|
215
|
+
this._progressHandlers.delete(messageId);
|
|
216
|
+
this._cleanupTimeout(messageId);
|
|
217
|
+
if (isJSONRPCResponse(response)) {
|
|
218
|
+
handler(response);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const error = new McpError(response.error.code, response.error.message, response.error.data);
|
|
222
|
+
handler(error);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
get transport() {
|
|
226
|
+
return this._transport;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Closes the connection.
|
|
230
|
+
*/
|
|
231
|
+
async close() {
|
|
232
|
+
var _a;
|
|
233
|
+
await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.close());
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Sends a request and wait for a response.
|
|
237
|
+
*
|
|
238
|
+
* Do not use this method to emit notifications! Use notification() instead.
|
|
239
|
+
*/
|
|
240
|
+
request(request, resultSchema, options) {
|
|
241
|
+
const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== void 0 ? options : {};
|
|
242
|
+
return new Promise((resolve, reject) => {
|
|
243
|
+
var _a, _b, _c, _d, _e, _f;
|
|
244
|
+
if (!this._transport) {
|
|
245
|
+
reject(new Error("Not connected"));
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.enforceStrictCapabilities) === true) {
|
|
249
|
+
this.assertCapabilityForMethod(request.method);
|
|
250
|
+
}
|
|
251
|
+
(_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
252
|
+
const messageId = this._requestMessageId++;
|
|
253
|
+
const jsonrpcRequest = {
|
|
254
|
+
...request,
|
|
255
|
+
jsonrpc: "2.0",
|
|
256
|
+
id: messageId,
|
|
257
|
+
};
|
|
258
|
+
if (options === null || options === void 0 ? void 0 : options.onprogress) {
|
|
259
|
+
this._progressHandlers.set(messageId, options.onprogress);
|
|
260
|
+
jsonrpcRequest.params = {
|
|
261
|
+
...request.params,
|
|
262
|
+
_meta: {
|
|
263
|
+
...(((_c = request.params) === null || _c === void 0 ? void 0 : _c._meta) || {}),
|
|
264
|
+
progressToken: messageId
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const cancel = (reason) => {
|
|
269
|
+
var _a;
|
|
270
|
+
this._responseHandlers.delete(messageId);
|
|
271
|
+
this._progressHandlers.delete(messageId);
|
|
272
|
+
this._cleanupTimeout(messageId);
|
|
273
|
+
(_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
274
|
+
jsonrpc: "2.0",
|
|
275
|
+
method: "notifications/cancelled",
|
|
276
|
+
params: {
|
|
277
|
+
requestId: messageId,
|
|
278
|
+
reason: String(reason),
|
|
279
|
+
},
|
|
280
|
+
}, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
|
|
281
|
+
reject(reason);
|
|
282
|
+
};
|
|
283
|
+
this._responseHandlers.set(messageId, (response) => {
|
|
284
|
+
var _a;
|
|
285
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (response instanceof Error) {
|
|
289
|
+
return reject(response);
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const result = resultSchema.parse(response.result);
|
|
293
|
+
resolve(result);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
reject(error);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
(_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.addEventListener("abort", () => {
|
|
300
|
+
var _a;
|
|
301
|
+
cancel((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.reason);
|
|
302
|
+
});
|
|
303
|
+
const timeout = (_e = options === null || options === void 0 ? void 0 : options.timeout) !== null && _e !== void 0 ? _e : DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
304
|
+
const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
|
|
305
|
+
this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _f !== void 0 ? _f : false);
|
|
306
|
+
this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => {
|
|
307
|
+
this._cleanupTimeout(messageId);
|
|
308
|
+
reject(error);
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Emits a notification, which is a one-way message that does not expect a response.
|
|
314
|
+
*/
|
|
315
|
+
async notification(notification, options) {
|
|
316
|
+
if (!this._transport) {
|
|
317
|
+
throw new Error("Not connected");
|
|
318
|
+
}
|
|
319
|
+
this.assertNotificationCapability(notification.method);
|
|
320
|
+
const jsonrpcNotification = {
|
|
321
|
+
...notification,
|
|
322
|
+
jsonrpc: "2.0",
|
|
323
|
+
};
|
|
324
|
+
await this._transport.send(jsonrpcNotification, options);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Registers a handler to invoke when this protocol object receives a request with the given method.
|
|
328
|
+
*
|
|
329
|
+
* Note that this will replace any previous request handler for the same method.
|
|
330
|
+
*/
|
|
331
|
+
setRequestHandler(requestSchema, handler) {
|
|
332
|
+
const method = requestSchema.shape.method.value;
|
|
333
|
+
this.assertRequestHandlerCapability(method);
|
|
334
|
+
this._requestHandlers.set(method, (request, extra) => {
|
|
335
|
+
return Promise.resolve(handler(requestSchema.parse(request), extra));
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Removes the request handler for the given method.
|
|
340
|
+
*/
|
|
341
|
+
removeRequestHandler(method) {
|
|
342
|
+
this._requestHandlers.delete(method);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
346
|
+
*/
|
|
347
|
+
assertCanSetRequestHandler(method) {
|
|
348
|
+
if (this._requestHandlers.has(method)) {
|
|
349
|
+
throw new Error(`A request handler for ${method} already exists, which would be overridden`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
|
354
|
+
*
|
|
355
|
+
* Note that this will replace any previous notification handler for the same method.
|
|
356
|
+
*/
|
|
357
|
+
setNotificationHandler(notificationSchema, handler) {
|
|
358
|
+
this._notificationHandlers.set(notificationSchema.shape.method.value, (notification) => Promise.resolve(handler(notificationSchema.parse(notification))));
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Removes the notification handler for the given method.
|
|
362
|
+
*/
|
|
363
|
+
removeNotificationHandler(method) {
|
|
364
|
+
this._notificationHandlers.delete(method);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function mergeCapabilities(base, additional) {
|
|
368
|
+
return Object.entries(additional).reduce((acc, [key, value]) => {
|
|
369
|
+
if (value && typeof value === "object") {
|
|
370
|
+
acc[key] = acc[key] ? { ...acc[key], ...value } : value;
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
acc[key] = value;
|
|
374
|
+
}
|
|
375
|
+
return acc;
|
|
376
|
+
}, { ...base });
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export { DEFAULT_REQUEST_TIMEOUT_MSEC, Protocol, mergeCapabilities };
|
|
380
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sources":["../../../../../../../../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"],"sourcesContent":["import { CancelledNotificationSchema, ErrorCode, isJSONRPCError, isJSONRPCRequest, isJSONRPCResponse, isJSONRPCNotification, McpError, PingRequestSchema, ProgressNotificationSchema, } from \"../types.js\";\n/**\n * The default request timeout, in miliseconds.\n */\nexport const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;\n/**\n * Implements MCP protocol framing on top of a pluggable transport, including\n * features like request/response linking, notifications, and progress.\n */\nexport class Protocol {\n constructor(_options) {\n this._options = _options;\n this._requestMessageId = 0;\n this._requestHandlers = new Map();\n this._requestHandlerAbortControllers = new Map();\n this._notificationHandlers = new Map();\n this._responseHandlers = new Map();\n this._progressHandlers = new Map();\n this._timeoutInfo = new Map();\n this.setNotificationHandler(CancelledNotificationSchema, (notification) => {\n const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);\n controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);\n });\n this.setNotificationHandler(ProgressNotificationSchema, (notification) => {\n this._onprogress(notification);\n });\n this.setRequestHandler(PingRequestSchema, \n // Automatic pong by default.\n (_request) => ({}));\n }\n _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {\n this._timeoutInfo.set(messageId, {\n timeoutId: setTimeout(onTimeout, timeout),\n startTime: Date.now(),\n timeout,\n maxTotalTimeout,\n resetTimeoutOnProgress,\n onTimeout\n });\n }\n _resetTimeout(messageId) {\n const info = this._timeoutInfo.get(messageId);\n if (!info)\n return false;\n const totalElapsed = Date.now() - info.startTime;\n if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {\n this._timeoutInfo.delete(messageId);\n throw new McpError(ErrorCode.RequestTimeout, \"Maximum total timeout exceeded\", { maxTotalTimeout: info.maxTotalTimeout, totalElapsed });\n }\n clearTimeout(info.timeoutId);\n info.timeoutId = setTimeout(info.onTimeout, info.timeout);\n return true;\n }\n _cleanupTimeout(messageId) {\n const info = this._timeoutInfo.get(messageId);\n if (info) {\n clearTimeout(info.timeoutId);\n this._timeoutInfo.delete(messageId);\n }\n }\n /**\n * Attaches to the given transport, starts it, and starts listening for messages.\n *\n * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.\n */\n async connect(transport) {\n var _a, _b, _c;\n this._transport = transport;\n const _onclose = (_a = this.transport) === null || _a === void 0 ? void 0 : _a.onclose;\n this._transport.onclose = () => {\n _onclose === null || _onclose === void 0 ? void 0 : _onclose();\n this._onclose();\n };\n const _onerror = (_b = this.transport) === null || _b === void 0 ? void 0 : _b.onerror;\n this._transport.onerror = (error) => {\n _onerror === null || _onerror === void 0 ? void 0 : _onerror(error);\n this._onerror(error);\n };\n const _onmessage = (_c = this._transport) === null || _c === void 0 ? void 0 : _c.onmessage;\n this._transport.onmessage = (message, extra) => {\n _onmessage === null || _onmessage === void 0 ? void 0 : _onmessage(message, extra);\n if (isJSONRPCResponse(message) || isJSONRPCError(message)) {\n this._onresponse(message);\n }\n else if (isJSONRPCRequest(message)) {\n this._onrequest(message, extra);\n }\n else if (isJSONRPCNotification(message)) {\n this._onnotification(message);\n }\n else {\n this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));\n }\n };\n await this._transport.start();\n }\n _onclose() {\n var _a;\n const responseHandlers = this._responseHandlers;\n this._responseHandlers = new Map();\n this._progressHandlers.clear();\n this._transport = undefined;\n (_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);\n const error = new McpError(ErrorCode.ConnectionClosed, \"Connection closed\");\n for (const handler of responseHandlers.values()) {\n handler(error);\n }\n }\n _onerror(error) {\n var _a;\n (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);\n }\n _onnotification(notification) {\n var _a;\n const handler = (_a = this._notificationHandlers.get(notification.method)) !== null && _a !== void 0 ? _a : this.fallbackNotificationHandler;\n // Ignore notifications not being subscribed to.\n if (handler === undefined) {\n return;\n }\n // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n Promise.resolve()\n .then(() => handler(notification))\n .catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));\n }\n _onrequest(request, extra) {\n var _a, _b, _c, _d;\n const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;\n if (handler === undefined) {\n (_b = this._transport) === null || _b === void 0 ? void 0 : _b.send({\n jsonrpc: \"2.0\",\n id: request.id,\n error: {\n code: ErrorCode.MethodNotFound,\n message: \"Method not found\",\n },\n }).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));\n return;\n }\n const abortController = new AbortController();\n this._requestHandlerAbortControllers.set(request.id, abortController);\n const fullExtra = {\n signal: abortController.signal,\n sessionId: (_c = this._transport) === null || _c === void 0 ? void 0 : _c.sessionId,\n _meta: (_d = request.params) === null || _d === void 0 ? void 0 : _d._meta,\n sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),\n sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),\n authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,\n requestId: request.id,\n requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo\n };\n // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n Promise.resolve()\n .then(() => handler(request, fullExtra))\n .then((result) => {\n var _a;\n if (abortController.signal.aborted) {\n return;\n }\n return (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({\n result,\n jsonrpc: \"2.0\",\n id: request.id,\n });\n }, (error) => {\n var _a, _b;\n if (abortController.signal.aborted) {\n return;\n }\n return (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({\n jsonrpc: \"2.0\",\n id: request.id,\n error: {\n code: Number.isSafeInteger(error[\"code\"])\n ? error[\"code\"]\n : ErrorCode.InternalError,\n message: (_b = error.message) !== null && _b !== void 0 ? _b : \"Internal error\",\n },\n });\n })\n .catch((error) => this._onerror(new Error(`Failed to send response: ${error}`)))\n .finally(() => {\n this._requestHandlerAbortControllers.delete(request.id);\n });\n }\n _onprogress(notification) {\n const { progressToken, ...params } = notification.params;\n const messageId = Number(progressToken);\n const handler = this._progressHandlers.get(messageId);\n if (!handler) {\n this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));\n return;\n }\n const responseHandler = this._responseHandlers.get(messageId);\n const timeoutInfo = this._timeoutInfo.get(messageId);\n if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {\n try {\n this._resetTimeout(messageId);\n }\n catch (error) {\n responseHandler(error);\n return;\n }\n }\n handler(params);\n }\n _onresponse(response) {\n const messageId = Number(response.id);\n const handler = this._responseHandlers.get(messageId);\n if (handler === undefined) {\n this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));\n return;\n }\n this._responseHandlers.delete(messageId);\n this._progressHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n if (isJSONRPCResponse(response)) {\n handler(response);\n }\n else {\n const error = new McpError(response.error.code, response.error.message, response.error.data);\n handler(error);\n }\n }\n get transport() {\n return this._transport;\n }\n /**\n * Closes the connection.\n */\n async close() {\n var _a;\n await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.close());\n }\n /**\n * Sends a request and wait for a response.\n *\n * Do not use this method to emit notifications! Use notification() instead.\n */\n request(request, resultSchema, options) {\n const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== void 0 ? options : {};\n return new Promise((resolve, reject) => {\n var _a, _b, _c, _d, _e, _f;\n if (!this._transport) {\n reject(new Error(\"Not connected\"));\n return;\n }\n if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.enforceStrictCapabilities) === true) {\n this.assertCapabilityForMethod(request.method);\n }\n (_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();\n const messageId = this._requestMessageId++;\n const jsonrpcRequest = {\n ...request,\n jsonrpc: \"2.0\",\n id: messageId,\n };\n if (options === null || options === void 0 ? void 0 : options.onprogress) {\n this._progressHandlers.set(messageId, options.onprogress);\n jsonrpcRequest.params = {\n ...request.params,\n _meta: {\n ...(((_c = request.params) === null || _c === void 0 ? void 0 : _c._meta) || {}),\n progressToken: messageId\n },\n };\n }\n const cancel = (reason) => {\n var _a;\n this._responseHandlers.delete(messageId);\n this._progressHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({\n jsonrpc: \"2.0\",\n method: \"notifications/cancelled\",\n params: {\n requestId: messageId,\n reason: String(reason),\n },\n }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));\n reject(reason);\n };\n this._responseHandlers.set(messageId, (response) => {\n var _a;\n if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n return;\n }\n if (response instanceof Error) {\n return reject(response);\n }\n try {\n const result = resultSchema.parse(response.result);\n resolve(result);\n }\n catch (error) {\n reject(error);\n }\n });\n (_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.addEventListener(\"abort\", () => {\n var _a;\n cancel((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.reason);\n });\n const timeout = (_e = options === null || options === void 0 ? void 0 : options.timeout) !== null && _e !== void 0 ? _e : DEFAULT_REQUEST_TIMEOUT_MSEC;\n const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, \"Request timed out\", { timeout }));\n this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _f !== void 0 ? _f : false);\n this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => {\n this._cleanupTimeout(messageId);\n reject(error);\n });\n });\n }\n /**\n * Emits a notification, which is a one-way message that does not expect a response.\n */\n async notification(notification, options) {\n if (!this._transport) {\n throw new Error(\"Not connected\");\n }\n this.assertNotificationCapability(notification.method);\n const jsonrpcNotification = {\n ...notification,\n jsonrpc: \"2.0\",\n };\n await this._transport.send(jsonrpcNotification, options);\n }\n /**\n * Registers a handler to invoke when this protocol object receives a request with the given method.\n *\n * Note that this will replace any previous request handler for the same method.\n */\n setRequestHandler(requestSchema, handler) {\n const method = requestSchema.shape.method.value;\n this.assertRequestHandlerCapability(method);\n this._requestHandlers.set(method, (request, extra) => {\n return Promise.resolve(handler(requestSchema.parse(request), extra));\n });\n }\n /**\n * Removes the request handler for the given method.\n */\n removeRequestHandler(method) {\n this._requestHandlers.delete(method);\n }\n /**\n * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.\n */\n assertCanSetRequestHandler(method) {\n if (this._requestHandlers.has(method)) {\n throw new Error(`A request handler for ${method} already exists, which would be overridden`);\n }\n }\n /**\n * Registers a handler to invoke when this protocol object receives a notification with the given method.\n *\n * Note that this will replace any previous notification handler for the same method.\n */\n setNotificationHandler(notificationSchema, handler) {\n this._notificationHandlers.set(notificationSchema.shape.method.value, (notification) => Promise.resolve(handler(notificationSchema.parse(notification))));\n }\n /**\n * Removes the notification handler for the given method.\n */\n removeNotificationHandler(method) {\n this._notificationHandlers.delete(method);\n }\n}\nexport function mergeCapabilities(base, additional) {\n return Object.entries(additional).reduce((acc, [key, value]) => {\n if (value && typeof value === \"object\") {\n acc[key] = acc[key] ? { ...acc[key], ...value } : value;\n }\n else {\n acc[key] = value;\n }\n return acc;\n }, { ...base });\n}\n//# sourceMappingURL=protocol.js.map"],"names":[],"mappings":";;AACA;AACA;AACA;AACY,MAAC,4BAA4B,GAAG;AAC5C;AACA;AACA;AACA;AACO,MAAM,QAAQ,CAAC;AACtB,IAAI,WAAW,CAAC,QAAQ,EAAE;AAC1B,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ;AAChC,QAAQ,IAAI,CAAC,iBAAiB,GAAG,CAAC;AAClC,QAAQ,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE;AACzC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