@atxp/client 0.3.0 → 0.4.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/index.cjs +745 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +745 -142
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +369 -99
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +18 -18
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js +162 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +86 -14
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +47 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +64 -5
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -1
- package/dist/node_modules/eventsource-parser/dist/index.js +1 -1
- package/dist/node_modules/eventsource-parser/dist/index.js.map +1 -1
- package/dist/node_modules/zod/{dist/esm/v3 → v3}/ZodError.js +3 -2
- package/dist/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/zod/{dist/esm/v3 → v3}/locales/en.js +2 -0
- package/dist/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/zod/{dist/esm/v3 → v3}/types.js +5 -2
- package/dist/node_modules/zod/v3/types.js.map +1 -0
- package/package.json +2 -2
- package/dist/node_modules/zod/dist/esm/v3/ZodError.js.map +0 -1
- package/dist/node_modules/zod/dist/esm/v3/errors.js.map +0 -1
- package/dist/node_modules/zod/dist/esm/v3/helpers/errorUtil.js.map +0 -1
- package/dist/node_modules/zod/dist/esm/v3/helpers/parseUtil.js.map +0 -1
- package/dist/node_modules/zod/dist/esm/v3/helpers/util.js.map +0 -1
- package/dist/node_modules/zod/dist/esm/v3/locales/en.js.map +0 -1
- package/dist/node_modules/zod/dist/esm/v3/types.js.map +0 -1
- /package/dist/node_modules/zod/{dist/esm/v3 → v3}/errors.js +0 -0
- /package/dist/node_modules/zod/{dist/esm/v3 → v3}/helpers/errorUtil.js +0 -0
- /package/dist/node_modules/zod/{dist/esm/v3 → v3}/helpers/parseUtil.js +0 -0
- /package/dist/node_modules/zod/{dist/esm/v3 → v3}/helpers/util.js +0 -0
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
import { object as objectType, boolean as booleanType, array as arrayType,
|
|
1
|
+
import { string as stringType, NEVER, object as objectType, boolean as booleanType, array as arrayType, number as numberType, any as anyType } from '../../../../../zod/v3/types.js';
|
|
2
|
+
import { ZodIssueCode } from '../../../../../zod/v3/ZodError.js';
|
|
2
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Reusable URL validation that disallows javascript: scheme
|
|
6
|
+
*/
|
|
7
|
+
const SafeUrlSchema = stringType().url()
|
|
8
|
+
.superRefine((val, ctx) => {
|
|
9
|
+
if (!URL.canParse(val)) {
|
|
10
|
+
ctx.addIssue({
|
|
11
|
+
code: ZodIssueCode.custom,
|
|
12
|
+
message: "URL must be parseable",
|
|
13
|
+
fatal: true,
|
|
14
|
+
});
|
|
15
|
+
return NEVER;
|
|
16
|
+
}
|
|
17
|
+
}).refine((url) => {
|
|
18
|
+
const u = new URL(url);
|
|
19
|
+
return u.protocol !== 'javascript:' && u.protocol !== 'data:' && u.protocol !== 'vbscript:';
|
|
20
|
+
}, { message: "URL cannot use javascript:, data:, or vbscript: scheme" });
|
|
3
21
|
/**
|
|
4
22
|
* RFC 9728 OAuth Protected Resource Metadata
|
|
5
23
|
*/
|
|
6
24
|
const OAuthProtectedResourceMetadataSchema = objectType({
|
|
7
25
|
resource: stringType().url(),
|
|
8
|
-
authorization_servers: arrayType(
|
|
26
|
+
authorization_servers: arrayType(SafeUrlSchema).optional(),
|
|
9
27
|
jwks_uri: stringType().url().optional(),
|
|
10
28
|
scopes_supported: arrayType(stringType()).optional(),
|
|
11
29
|
bearer_methods_supported: arrayType(stringType()).optional(),
|
|
@@ -25,9 +43,9 @@ const OAuthProtectedResourceMetadataSchema = objectType({
|
|
|
25
43
|
*/
|
|
26
44
|
const OAuthMetadataSchema = objectType({
|
|
27
45
|
issuer: stringType(),
|
|
28
|
-
authorization_endpoint:
|
|
29
|
-
token_endpoint:
|
|
30
|
-
registration_endpoint:
|
|
46
|
+
authorization_endpoint: SafeUrlSchema,
|
|
47
|
+
token_endpoint: SafeUrlSchema,
|
|
48
|
+
registration_endpoint: SafeUrlSchema.optional(),
|
|
31
49
|
scopes_supported: arrayType(stringType()).optional(),
|
|
32
50
|
response_types_supported: arrayType(stringType()),
|
|
33
51
|
response_modes_supported: arrayType(stringType()).optional(),
|
|
@@ -35,8 +53,8 @@ const OAuthMetadataSchema = objectType({
|
|
|
35
53
|
token_endpoint_auth_methods_supported: arrayType(stringType()).optional(),
|
|
36
54
|
token_endpoint_auth_signing_alg_values_supported: arrayType(stringType())
|
|
37
55
|
.optional(),
|
|
38
|
-
service_documentation:
|
|
39
|
-
revocation_endpoint:
|
|
56
|
+
service_documentation: SafeUrlSchema.optional(),
|
|
57
|
+
revocation_endpoint: SafeUrlSchema.optional(),
|
|
40
58
|
revocation_endpoint_auth_methods_supported: arrayType(stringType()).optional(),
|
|
41
59
|
revocation_endpoint_auth_signing_alg_values_supported: arrayType(stringType())
|
|
42
60
|
.optional(),
|
|
@@ -48,11 +66,65 @@ const OAuthMetadataSchema = objectType({
|
|
|
48
66
|
code_challenge_methods_supported: arrayType(stringType()).optional(),
|
|
49
67
|
})
|
|
50
68
|
.passthrough();
|
|
69
|
+
/**
|
|
70
|
+
* OpenID Connect Discovery 1.0 Provider Metadata
|
|
71
|
+
* see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
|
|
72
|
+
*/
|
|
73
|
+
const OpenIdProviderMetadataSchema = objectType({
|
|
74
|
+
issuer: stringType(),
|
|
75
|
+
authorization_endpoint: SafeUrlSchema,
|
|
76
|
+
token_endpoint: SafeUrlSchema,
|
|
77
|
+
userinfo_endpoint: SafeUrlSchema.optional(),
|
|
78
|
+
jwks_uri: SafeUrlSchema,
|
|
79
|
+
registration_endpoint: SafeUrlSchema.optional(),
|
|
80
|
+
scopes_supported: arrayType(stringType()).optional(),
|
|
81
|
+
response_types_supported: arrayType(stringType()),
|
|
82
|
+
response_modes_supported: arrayType(stringType()).optional(),
|
|
83
|
+
grant_types_supported: arrayType(stringType()).optional(),
|
|
84
|
+
acr_values_supported: arrayType(stringType()).optional(),
|
|
85
|
+
subject_types_supported: arrayType(stringType()),
|
|
86
|
+
id_token_signing_alg_values_supported: arrayType(stringType()),
|
|
87
|
+
id_token_encryption_alg_values_supported: arrayType(stringType()).optional(),
|
|
88
|
+
id_token_encryption_enc_values_supported: arrayType(stringType()).optional(),
|
|
89
|
+
userinfo_signing_alg_values_supported: arrayType(stringType()).optional(),
|
|
90
|
+
userinfo_encryption_alg_values_supported: arrayType(stringType()).optional(),
|
|
91
|
+
userinfo_encryption_enc_values_supported: arrayType(stringType()).optional(),
|
|
92
|
+
request_object_signing_alg_values_supported: arrayType(stringType()).optional(),
|
|
93
|
+
request_object_encryption_alg_values_supported: arrayType(stringType())
|
|
94
|
+
.optional(),
|
|
95
|
+
request_object_encryption_enc_values_supported: arrayType(stringType())
|
|
96
|
+
.optional(),
|
|
97
|
+
token_endpoint_auth_methods_supported: arrayType(stringType()).optional(),
|
|
98
|
+
token_endpoint_auth_signing_alg_values_supported: arrayType(stringType())
|
|
99
|
+
.optional(),
|
|
100
|
+
display_values_supported: arrayType(stringType()).optional(),
|
|
101
|
+
claim_types_supported: arrayType(stringType()).optional(),
|
|
102
|
+
claims_supported: arrayType(stringType()).optional(),
|
|
103
|
+
service_documentation: stringType().optional(),
|
|
104
|
+
claims_locales_supported: arrayType(stringType()).optional(),
|
|
105
|
+
ui_locales_supported: arrayType(stringType()).optional(),
|
|
106
|
+
claims_parameter_supported: booleanType().optional(),
|
|
107
|
+
request_parameter_supported: booleanType().optional(),
|
|
108
|
+
request_uri_parameter_supported: booleanType().optional(),
|
|
109
|
+
require_request_uri_registration: booleanType().optional(),
|
|
110
|
+
op_policy_uri: SafeUrlSchema.optional(),
|
|
111
|
+
op_tos_uri: SafeUrlSchema.optional(),
|
|
112
|
+
})
|
|
113
|
+
.passthrough();
|
|
114
|
+
/**
|
|
115
|
+
* OpenID Connect Discovery metadata that may include OAuth 2.0 fields
|
|
116
|
+
* This schema represents the real-world scenario where OIDC providers
|
|
117
|
+
* return a mix of OpenID Connect and OAuth 2.0 metadata fields
|
|
118
|
+
*/
|
|
119
|
+
const OpenIdProviderDiscoveryMetadataSchema = OpenIdProviderMetadataSchema.merge(OAuthMetadataSchema.pick({
|
|
120
|
+
code_challenge_methods_supported: true,
|
|
121
|
+
}));
|
|
51
122
|
/**
|
|
52
123
|
* OAuth 2.1 token response
|
|
53
124
|
*/
|
|
54
125
|
const OAuthTokensSchema = objectType({
|
|
55
126
|
access_token: stringType(),
|
|
127
|
+
id_token: stringType().optional(), // Optional for OAuth 2.1, but necessary in OpenID Connect
|
|
56
128
|
token_type: stringType(),
|
|
57
129
|
expires_in: numberType().optional(),
|
|
58
130
|
scope: stringType().optional(),
|
|
@@ -62,7 +134,7 @@ const OAuthTokensSchema = objectType({
|
|
|
62
134
|
/**
|
|
63
135
|
* OAuth 2.1 error response
|
|
64
136
|
*/
|
|
65
|
-
objectType({
|
|
137
|
+
const OAuthErrorResponseSchema = objectType({
|
|
66
138
|
error: stringType(),
|
|
67
139
|
error_description: stringType().optional(),
|
|
68
140
|
error_uri: stringType().optional(),
|
|
@@ -71,18 +143,18 @@ objectType({
|
|
|
71
143
|
* RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
|
|
72
144
|
*/
|
|
73
145
|
const OAuthClientMetadataSchema = objectType({
|
|
74
|
-
redirect_uris: arrayType(
|
|
146
|
+
redirect_uris: arrayType(SafeUrlSchema),
|
|
75
147
|
token_endpoint_auth_method: stringType().optional(),
|
|
76
148
|
grant_types: arrayType(stringType()).optional(),
|
|
77
149
|
response_types: arrayType(stringType()).optional(),
|
|
78
150
|
client_name: stringType().optional(),
|
|
79
|
-
client_uri:
|
|
80
|
-
logo_uri:
|
|
151
|
+
client_uri: SafeUrlSchema.optional(),
|
|
152
|
+
logo_uri: SafeUrlSchema.optional(),
|
|
81
153
|
scope: stringType().optional(),
|
|
82
154
|
contacts: arrayType(stringType()).optional(),
|
|
83
|
-
tos_uri:
|
|
155
|
+
tos_uri: SafeUrlSchema.optional(),
|
|
84
156
|
policy_uri: stringType().optional(),
|
|
85
|
-
jwks_uri:
|
|
157
|
+
jwks_uri: SafeUrlSchema.optional(),
|
|
86
158
|
jwks: anyType().optional(),
|
|
87
159
|
software_id: stringType().optional(),
|
|
88
160
|
software_version: stringType().optional(),
|
|
@@ -116,5 +188,5 @@ objectType({
|
|
|
116
188
|
token_type_hint: stringType().optional(),
|
|
117
189
|
}).strip();
|
|
118
190
|
|
|
119
|
-
export { OAuthClientInformationFullSchema, OAuthClientInformationSchema, OAuthClientMetadataSchema, OAuthMetadataSchema, OAuthProtectedResourceMetadataSchema, OAuthTokensSchema };
|
|
191
|
+
export { OAuthClientInformationFullSchema, OAuthClientInformationSchema, OAuthClientMetadataSchema, OAuthErrorResponseSchema, OAuthMetadataSchema, OAuthProtectedResourceMetadataSchema, OAuthTokensSchema, OpenIdProviderDiscoveryMetadataSchema, OpenIdProviderMetadataSchema, SafeUrlSchema };
|
|
120
192
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../../../../../../../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"],"sourcesContent":["import { z } from \"zod\";\n/**\n * RFC 9728 OAuth Protected Resource Metadata\n */\nexport const OAuthProtectedResourceMetadataSchema = z\n .object({\n resource: z.string().url(),\n authorization_servers: z.array(z.string().url()).optional(),\n jwks_uri: z.string().url().optional(),\n scopes_supported: z.array(z.string()).optional(),\n bearer_methods_supported: z.array(z.string()).optional(),\n resource_signing_alg_values_supported: z.array(z.string()).optional(),\n resource_name: z.string().optional(),\n resource_documentation: z.string().optional(),\n resource_policy_uri: z.string().url().optional(),\n resource_tos_uri: z.string().url().optional(),\n tls_client_certificate_bound_access_tokens: z.boolean().optional(),\n authorization_details_types_supported: z.array(z.string()).optional(),\n dpop_signing_alg_values_supported: z.array(z.string()).optional(),\n dpop_bound_access_tokens_required: z.boolean().optional(),\n})\n .passthrough();\n/**\n * RFC 8414 OAuth 2.0 Authorization Server Metadata\n */\nexport const OAuthMetadataSchema = z\n .object({\n issuer: z.string(),\n authorization_endpoint: z.string(),\n token_endpoint: z.string(),\n registration_endpoint: z.string().optional(),\n scopes_supported: z.array(z.string()).optional(),\n response_types_supported: z.array(z.string()),\n response_modes_supported: z.array(z.string()).optional(),\n grant_types_supported: z.array(z.string()).optional(),\n token_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n token_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n service_documentation: z.string().optional(),\n revocation_endpoint: z.string().optional(),\n revocation_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n revocation_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n introspection_endpoint: z.string().optional(),\n introspection_endpoint_auth_methods_supported: z\n .array(z.string())\n .optional(),\n introspection_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n code_challenge_methods_supported: z.array(z.string()).optional(),\n})\n .passthrough();\n/**\n * OAuth 2.1 token response\n */\nexport const OAuthTokensSchema = z\n .object({\n access_token: z.string(),\n token_type: z.string(),\n expires_in: z.number().optional(),\n scope: z.string().optional(),\n refresh_token: z.string().optional(),\n})\n .strip();\n/**\n * OAuth 2.1 error response\n */\nexport const OAuthErrorResponseSchema = z\n .object({\n error: z.string(),\n error_description: z.string().optional(),\n error_uri: z.string().optional(),\n});\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata\n */\nexport const OAuthClientMetadataSchema = z.object({\n redirect_uris: z.array(z.string()).refine((uris) => uris.every((uri) => URL.canParse(uri)), { message: \"redirect_uris must contain valid URLs\" }),\n token_endpoint_auth_method: z.string().optional(),\n grant_types: z.array(z.string()).optional(),\n response_types: z.array(z.string()).optional(),\n client_name: z.string().optional(),\n client_uri: z.string().optional(),\n logo_uri: z.string().optional(),\n scope: z.string().optional(),\n contacts: z.array(z.string()).optional(),\n tos_uri: z.string().optional(),\n policy_uri: z.string().optional(),\n jwks_uri: z.string().optional(),\n jwks: z.any().optional(),\n software_id: z.string().optional(),\n software_version: z.string().optional(),\n software_statement: z.string().optional(),\n}).strip();\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration client information\n */\nexport const OAuthClientInformationSchema = z.object({\n client_id: z.string(),\n client_secret: z.string().optional(),\n client_id_issued_at: z.number().optional(),\n client_secret_expires_at: z.number().optional(),\n}).strip();\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)\n */\nexport const OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration error response\n */\nexport const OAuthClientRegistrationErrorSchema = z.object({\n error: z.string(),\n error_description: z.string().optional(),\n}).strip();\n/**\n * RFC 7009 OAuth 2.0 Token Revocation request\n */\nexport const OAuthTokenRevocationRequestSchema = z.object({\n token: z.string(),\n token_type_hint: z.string().optional(),\n}).strip();\n//# sourceMappingURL=auth.js.map"],"names":["z\n .object","z.string","z.array","z.boolean","z\n .array","z.number","z.object","z.any"],"mappings":";;AACA;AACA;AACA;AACY,MAAC,oCAAoC,GAAGA,UACzC,CAAC;AACZ,IAAI,QAAQ,EAAEC,UAAQ,EAAE,CAAC,GAAG,EAAE;AAC9B,IAAI,qBAAqB,EAAEC,SAAO,CAACD,UAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;AAC/D,IAAI,QAAQ,EAAEA,UAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;AACzC,IAAI,gBAAgB,EAAEC,SAAO,CAACD,UAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;AACpD,IAAI,wBAAwB,EAAEC,SAAO,CAACD,UAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;AAC5D,IAAI,qCAAqC,EAAEC,SAAO,CAACD,UAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;AACzE,IAAI,aAAa,EAAEA,UAAQ,EAAE,CAAC,QAAQ,EAAE;AACxC,IAAI,sBAAsB,EAAEA,UAAQ,EAAE,CAAC,QAAQ,EAAE;AACjD,IAAI,mBAAmB,EAAEA,UAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;AACpD,IAAI,gBAAgB,EAAEA,UAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;AACjD,IAAI,0CAA0C,EAAEE,WAAS,EAAE,CAAC,QAAQ,EAAE;AACtE,IAAI,qCAAqC,EAAED,SAAO,CAACD,UAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;AACzE,IAAI,iCAAiC,EAAEC,SAAO,CAACD,UAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;AACrE,IAAI,iCAAiC,EAAEE,WAAS,EAAE,CAAC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AC;AAC1D,IAAI,KAAK,EAAEL,UAAQ,EAAE;AACrB,IAAI,eAAe,EAAEA,UAAQ,EAAE,CAAC,QAAQ,EAAE;AAC1C,CAAC,CAAC,CAAC,KAAK;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../../../../../../../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"],"sourcesContent":["import { z } from \"zod\";\n/**\n * Reusable URL validation that disallows javascript: scheme\n */\nexport const SafeUrlSchema = z.string().url()\n .superRefine((val, ctx) => {\n if (!URL.canParse(val)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"URL must be parseable\",\n fatal: true,\n });\n return z.NEVER;\n }\n}).refine((url) => {\n const u = new URL(url);\n return u.protocol !== 'javascript:' && u.protocol !== 'data:' && u.protocol !== 'vbscript:';\n}, { message: \"URL cannot use javascript:, data:, or vbscript: scheme\" });\n/**\n * RFC 9728 OAuth Protected Resource Metadata\n */\nexport const OAuthProtectedResourceMetadataSchema = z\n .object({\n resource: z.string().url(),\n authorization_servers: z.array(SafeUrlSchema).optional(),\n jwks_uri: z.string().url().optional(),\n scopes_supported: z.array(z.string()).optional(),\n bearer_methods_supported: z.array(z.string()).optional(),\n resource_signing_alg_values_supported: z.array(z.string()).optional(),\n resource_name: z.string().optional(),\n resource_documentation: z.string().optional(),\n resource_policy_uri: z.string().url().optional(),\n resource_tos_uri: z.string().url().optional(),\n tls_client_certificate_bound_access_tokens: z.boolean().optional(),\n authorization_details_types_supported: z.array(z.string()).optional(),\n dpop_signing_alg_values_supported: z.array(z.string()).optional(),\n dpop_bound_access_tokens_required: z.boolean().optional(),\n})\n .passthrough();\n/**\n * RFC 8414 OAuth 2.0 Authorization Server Metadata\n */\nexport const OAuthMetadataSchema = z\n .object({\n issuer: z.string(),\n authorization_endpoint: SafeUrlSchema,\n token_endpoint: SafeUrlSchema,\n registration_endpoint: SafeUrlSchema.optional(),\n scopes_supported: z.array(z.string()).optional(),\n response_types_supported: z.array(z.string()),\n response_modes_supported: z.array(z.string()).optional(),\n grant_types_supported: z.array(z.string()).optional(),\n token_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n token_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n service_documentation: SafeUrlSchema.optional(),\n revocation_endpoint: SafeUrlSchema.optional(),\n revocation_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n revocation_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n introspection_endpoint: z.string().optional(),\n introspection_endpoint_auth_methods_supported: z\n .array(z.string())\n .optional(),\n introspection_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n code_challenge_methods_supported: z.array(z.string()).optional(),\n})\n .passthrough();\n/**\n * OpenID Connect Discovery 1.0 Provider Metadata\n * see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\n */\nexport const OpenIdProviderMetadataSchema = z\n .object({\n issuer: z.string(),\n authorization_endpoint: SafeUrlSchema,\n token_endpoint: SafeUrlSchema,\n userinfo_endpoint: SafeUrlSchema.optional(),\n jwks_uri: SafeUrlSchema,\n registration_endpoint: SafeUrlSchema.optional(),\n scopes_supported: z.array(z.string()).optional(),\n response_types_supported: z.array(z.string()),\n response_modes_supported: z.array(z.string()).optional(),\n grant_types_supported: z.array(z.string()).optional(),\n acr_values_supported: z.array(z.string()).optional(),\n subject_types_supported: z.array(z.string()),\n id_token_signing_alg_values_supported: z.array(z.string()),\n id_token_encryption_alg_values_supported: z.array(z.string()).optional(),\n id_token_encryption_enc_values_supported: z.array(z.string()).optional(),\n userinfo_signing_alg_values_supported: z.array(z.string()).optional(),\n userinfo_encryption_alg_values_supported: z.array(z.string()).optional(),\n userinfo_encryption_enc_values_supported: z.array(z.string()).optional(),\n request_object_signing_alg_values_supported: z.array(z.string()).optional(),\n request_object_encryption_alg_values_supported: z\n .array(z.string())\n .optional(),\n request_object_encryption_enc_values_supported: z\n .array(z.string())\n .optional(),\n token_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n token_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n display_values_supported: z.array(z.string()).optional(),\n claim_types_supported: z.array(z.string()).optional(),\n claims_supported: z.array(z.string()).optional(),\n service_documentation: z.string().optional(),\n claims_locales_supported: z.array(z.string()).optional(),\n ui_locales_supported: z.array(z.string()).optional(),\n claims_parameter_supported: z.boolean().optional(),\n request_parameter_supported: z.boolean().optional(),\n request_uri_parameter_supported: z.boolean().optional(),\n require_request_uri_registration: z.boolean().optional(),\n op_policy_uri: SafeUrlSchema.optional(),\n op_tos_uri: SafeUrlSchema.optional(),\n})\n .passthrough();\n/**\n * OpenID Connect Discovery metadata that may include OAuth 2.0 fields\n * This schema represents the real-world scenario where OIDC providers\n * return a mix of OpenID Connect and OAuth 2.0 metadata fields\n */\nexport const OpenIdProviderDiscoveryMetadataSchema = OpenIdProviderMetadataSchema.merge(OAuthMetadataSchema.pick({\n code_challenge_methods_supported: true,\n}));\n/**\n * OAuth 2.1 token response\n */\nexport const OAuthTokensSchema = z\n .object({\n access_token: z.string(),\n id_token: z.string().optional(), // Optional for OAuth 2.1, but necessary in OpenID Connect\n token_type: z.string(),\n expires_in: z.number().optional(),\n scope: z.string().optional(),\n refresh_token: z.string().optional(),\n})\n .strip();\n/**\n * OAuth 2.1 error response\n */\nexport const OAuthErrorResponseSchema = z\n .object({\n error: z.string(),\n error_description: z.string().optional(),\n error_uri: z.string().optional(),\n});\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata\n */\nexport const OAuthClientMetadataSchema = z.object({\n redirect_uris: z.array(SafeUrlSchema),\n token_endpoint_auth_method: z.string().optional(),\n grant_types: z.array(z.string()).optional(),\n response_types: z.array(z.string()).optional(),\n client_name: z.string().optional(),\n client_uri: SafeUrlSchema.optional(),\n logo_uri: SafeUrlSchema.optional(),\n scope: z.string().optional(),\n contacts: z.array(z.string()).optional(),\n tos_uri: SafeUrlSchema.optional(),\n policy_uri: z.string().optional(),\n jwks_uri: SafeUrlSchema.optional(),\n jwks: z.any().optional(),\n software_id: z.string().optional(),\n software_version: z.string().optional(),\n software_statement: z.string().optional(),\n}).strip();\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration client information\n */\nexport const OAuthClientInformationSchema = z.object({\n client_id: z.string(),\n client_secret: z.string().optional(),\n client_id_issued_at: z.number().optional(),\n client_secret_expires_at: z.number().optional(),\n}).strip();\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)\n */\nexport const OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration error response\n */\nexport const OAuthClientRegistrationErrorSchema = z.object({\n error: z.string(),\n error_description: z.string().optional(),\n}).strip();\n/**\n * RFC 7009 OAuth 2.0 Token Revocation request\n */\nexport const OAuthTokenRevocationRequestSchema = z.object({\n token: z.string(),\n token_type_hint: z.string().optional(),\n}).strip();\n//# sourceMappingURL=auth.js.map"],"names":["z.string","z.ZodIssueCode","z.NEVER","z\n .object","z.array","z.boolean","z\n .array","z.number","z.object","z.any"],"mappings":";;;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAGA,UAAQ,EAAE,CAAC,GAAG;AAC3C,KAAK,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK;AAC/B,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC5B,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACrB,YAAY,IAAI,EAAEC,YAAc,CAAC,MAAM;AACvC,YAAY,OAAO,EAAE,uBAAuB;AAC5C,YAAY,KAAK,EAAE,IAAI;AACvB,SAAS,CAAC;AACV,QAAQ,OAAOC,KAAO;AACtB,IAAI;AACJ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK;AACnB,IAAI,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAA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UAAQ,EAAE,CAAC,QAAQ,EAAE;AAC1C,CAAC,CAAC,CAAC,KAAK;;;;","x_google_ignoreList":[0]}
|
|
@@ -18,6 +18,7 @@ class Protocol {
|
|
|
18
18
|
this._responseHandlers = new Map();
|
|
19
19
|
this._progressHandlers = new Map();
|
|
20
20
|
this._timeoutInfo = new Map();
|
|
21
|
+
this._pendingDebouncedNotifications = new Set();
|
|
21
22
|
this.setNotificationHandler(CancelledNotificationSchema, (notification) => {
|
|
22
23
|
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
|
23
24
|
controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);
|
|
@@ -100,6 +101,7 @@ class Protocol {
|
|
|
100
101
|
const responseHandlers = this._responseHandlers;
|
|
101
102
|
this._responseHandlers = new Map();
|
|
102
103
|
this._progressHandlers.clear();
|
|
104
|
+
this._pendingDebouncedNotifications.clear();
|
|
103
105
|
this._transport = undefined;
|
|
104
106
|
(_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
105
107
|
const error = new McpError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
@@ -124,10 +126,12 @@ class Protocol {
|
|
|
124
126
|
.catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
|
|
125
127
|
}
|
|
126
128
|
_onrequest(request, extra) {
|
|
127
|
-
var _a, _b
|
|
129
|
+
var _a, _b;
|
|
128
130
|
const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;
|
|
131
|
+
// Capture the current transport at request time to ensure responses go to the correct client
|
|
132
|
+
const capturedTransport = this._transport;
|
|
129
133
|
if (handler === undefined) {
|
|
130
|
-
|
|
134
|
+
capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
|
|
131
135
|
jsonrpc: "2.0",
|
|
132
136
|
id: request.id,
|
|
133
137
|
error: {
|
|
@@ -141,8 +145,8 @@ class Protocol {
|
|
|
141
145
|
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
142
146
|
const fullExtra = {
|
|
143
147
|
signal: abortController.signal,
|
|
144
|
-
sessionId:
|
|
145
|
-
_meta: (
|
|
148
|
+
sessionId: capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId,
|
|
149
|
+
_meta: (_b = request.params) === null || _b === void 0 ? void 0 : _b._meta,
|
|
146
150
|
sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),
|
|
147
151
|
sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
|
|
148
152
|
authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,
|
|
@@ -153,28 +157,27 @@ class Protocol {
|
|
|
153
157
|
Promise.resolve()
|
|
154
158
|
.then(() => handler(request, fullExtra))
|
|
155
159
|
.then((result) => {
|
|
156
|
-
var _a;
|
|
157
160
|
if (abortController.signal.aborted) {
|
|
158
161
|
return;
|
|
159
162
|
}
|
|
160
|
-
return
|
|
163
|
+
return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
|
|
161
164
|
result,
|
|
162
165
|
jsonrpc: "2.0",
|
|
163
166
|
id: request.id,
|
|
164
167
|
});
|
|
165
168
|
}, (error) => {
|
|
166
|
-
var _a
|
|
169
|
+
var _a;
|
|
167
170
|
if (abortController.signal.aborted) {
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
170
|
-
return
|
|
173
|
+
return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
|
|
171
174
|
jsonrpc: "2.0",
|
|
172
175
|
id: request.id,
|
|
173
176
|
error: {
|
|
174
177
|
code: Number.isSafeInteger(error["code"])
|
|
175
178
|
? error["code"]
|
|
176
179
|
: ErrorCode.InternalError,
|
|
177
|
-
message: (
|
|
180
|
+
message: (_a = error.message) !== null && _a !== void 0 ? _a : "Internal error",
|
|
178
181
|
},
|
|
179
182
|
});
|
|
180
183
|
})
|
|
@@ -313,10 +316,45 @@ class Protocol {
|
|
|
313
316
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
314
317
|
*/
|
|
315
318
|
async notification(notification, options) {
|
|
319
|
+
var _a, _b;
|
|
316
320
|
if (!this._transport) {
|
|
317
321
|
throw new Error("Not connected");
|
|
318
322
|
}
|
|
319
323
|
this.assertNotificationCapability(notification.method);
|
|
324
|
+
const debouncedMethods = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.debouncedNotificationMethods) !== null && _b !== void 0 ? _b : [];
|
|
325
|
+
// A notification can only be debounced if it's in the list AND it's "simple"
|
|
326
|
+
// (i.e., has no parameters and no related request ID that could be lost).
|
|
327
|
+
const canDebounce = debouncedMethods.includes(notification.method)
|
|
328
|
+
&& !notification.params
|
|
329
|
+
&& !(options === null || options === void 0 ? void 0 : options.relatedRequestId);
|
|
330
|
+
if (canDebounce) {
|
|
331
|
+
// If a notification of this type is already scheduled, do nothing.
|
|
332
|
+
if (this._pendingDebouncedNotifications.has(notification.method)) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
// Mark this notification type as pending.
|
|
336
|
+
this._pendingDebouncedNotifications.add(notification.method);
|
|
337
|
+
// Schedule the actual send to happen in the next microtask.
|
|
338
|
+
// This allows all synchronous calls in the current event loop tick to be coalesced.
|
|
339
|
+
Promise.resolve().then(() => {
|
|
340
|
+
var _a;
|
|
341
|
+
// Un-mark the notification so the next one can be scheduled.
|
|
342
|
+
this._pendingDebouncedNotifications.delete(notification.method);
|
|
343
|
+
// SAFETY CHECK: If the connection was closed while this was pending, abort.
|
|
344
|
+
if (!this._transport) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const jsonrpcNotification = {
|
|
348
|
+
...notification,
|
|
349
|
+
jsonrpc: "2.0",
|
|
350
|
+
};
|
|
351
|
+
// Send the notification, but don't await it here to avoid blocking.
|
|
352
|
+
// Handle potential errors with a .catch().
|
|
353
|
+
(_a = this._transport) === null || _a === void 0 ? void 0 : _a.send(jsonrpcNotification, options).catch(error => this._onerror(error));
|
|
354
|
+
});
|
|
355
|
+
// Return immediately.
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
320
358
|
const jsonrpcNotification = {
|
|
321
359
|
...notification,
|
|
322
360
|
jsonrpc: "2.0",
|
|
@@ -1 +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,4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IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACjK,IAAI;AACJ;AACA;AACA;AACA,IAAI,yBAAyB,CAAC,MAAM,EAAE;AACtC,QAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC;AACjD,IAAI;AACJ;AACO,SAAS,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE;AACpD,IAAI,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AACpE,QAAQ,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAChD,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK;AACnE,QAAQ;AACR,aAAa;AACb,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAC5B,QAAQ;AACR,QAAQ,OAAO,GAAG;AAClB,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;AACnB;;;;","x_google_ignoreList":[0]}
|
|
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._pendingDebouncedNotifications = new Set();\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._pendingDebouncedNotifications.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;\n const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;\n // Capture the current transport at request time to ensure responses go to the correct client\n const capturedTransport = this._transport;\n if (handler === undefined) {\n capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.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: capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId,\n _meta: (_b = request.params) === null || _b === void 0 ? void 0 : _b._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 if (abortController.signal.aborted) {\n return;\n }\n return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({\n result,\n jsonrpc: \"2.0\",\n id: request.id,\n });\n }, (error) => {\n var _a;\n if (abortController.signal.aborted) {\n return;\n }\n return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.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: (_a = error.message) !== null && _a !== void 0 ? _a : \"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 var _a, _b;\n if (!this._transport) {\n throw new Error(\"Not connected\");\n }\n this.assertNotificationCapability(notification.method);\n const debouncedMethods = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.debouncedNotificationMethods) !== null && _b !== void 0 ? _b : [];\n // A notification can only be debounced if it's in the list AND it's \"simple\"\n // (i.e., has no parameters and no related request ID that could be lost).\n const canDebounce = debouncedMethods.includes(notification.method)\n && !notification.params\n && !(options === null || options === void 0 ? void 0 : options.relatedRequestId);\n if (canDebounce) {\n // If a notification of this type is already scheduled, do nothing.\n if (this._pendingDebouncedNotifications.has(notification.method)) {\n return;\n }\n // Mark this notification type as pending.\n this._pendingDebouncedNotifications.add(notification.method);\n // Schedule the actual send to happen in the next microtask.\n // This allows all synchronous calls in the current event loop tick to be coalesced.\n Promise.resolve().then(() => {\n var _a;\n // Un-mark the notification so the next one can be scheduled.\n this._pendingDebouncedNotifications.delete(notification.method);\n // SAFETY CHECK: If the connection was closed while this was pending, abort.\n if (!this._transport) {\n return;\n }\n const jsonrpcNotification = {\n ...notification,\n jsonrpc: \"2.0\",\n };\n // Send the notification, but don't await it here to avoid blocking.\n // Handle potential errors with a .catch().\n (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send(jsonrpcNotification, options).catch(error => this._onerror(error));\n });\n // Return immediately.\n return;\n }\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,QAAQ,IAAI,CAAC,+BAA+B,GAAG,IAAI,GAAG,EAAE;AACxD,QAAQ,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE;AAC9C,QAAQ,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE;AAC1C,QAAQ,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE;AAC1C,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE;AACrC,QAAQ,IAAI,CAAC,8BAA8B,GAAG,IAAI,GAAG,EAAE;AACvD,QAAQ,IAAI,CAAC,sBAAsB,CAAC,2BAA2B,EAAE,CAAC,YAAY,KAAK;AACnF,YAAY,MAAM,UAAU,GAAG,IAAI,CAAC,+BAA+B,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC;AACtG,YAAY,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,MAAM,GAAG,MAAM,GAAG,UAAU,C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