@agentcomms/resend 0.17.0 → 0.18.1
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/THIRD_PARTY_LICENSES +9 -9
- package/dist/cli.mjs +13 -5
- package/dist/{dist-COPefvtq-COGS2a-K.mjs → dist-C7DG2LdL-l0mj9_dH.mjs} +55 -33
- package/dist/index.d.mts +141 -33
- package/dist/index.mjs +2 -2
- package/dist/{mcp-DXXb3Vv3-kCxsVLO4.mjs → mcp-DIH4cS6P-CIWWZQbz.mjs} +181 -68
- package/dist/{send-DEor7f1N.mjs → send-BOMCKvLT.mjs} +1264 -228
- package/dist/{server-xhrQV9qo.mjs → server-CbcJL9CZ.mjs} +6 -6
- package/dist/{src-D_zzAWoS-BhK0GFdq-oo-8IJem.mjs → src-WCy6ifGf-DXrNj-15-D0oRtifb.mjs} +75 -41
- package/dist/{stdio-q4c3585j.mjs → stdio-B8UXEGiG.mjs} +28 -3
- package/dist/{stdio-CHZ2WRcx-B2_wGdA5.mjs → stdio-CyjIgrch-59zcjSEt.mjs} +9 -3
- package/dist/{stdio-entry-BKyy2XRF.mjs → stdio-entry-BfcIk24a.mjs} +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as checkForUpdates, A as removeAccountChange, B as strictToolArguments, D as policyChange, E as policyApprovalRefusal, F as CHANGE_POLICIES, G as SEND_LOOKUP, H as CommsError, Ht as VERSION, I as MODES, L as SEND_POLICIES, M as showAccount, Mt as waitCallOptions, Nt as waitForApproval, O as policyReport, Ot as toCommsError, P as ResendContext, Q as changeToolResult, _ as showSentEmail, _t as refuseUnclaimedApproval, c as downloadReceived, d as listReceived, f as listScheduled, g as showReceived, i as prepareSend, jt as updateToolGate, k as policyWanted, l as getMetrics, m as listSuppressions, n as executeSend, o as sendStatus, ot as gatedChange, p as listSentEmails, s as cancelScheduledChange, u as listDomains, w as listAccounts, x as runDoctor } from "./send-
|
|
1
|
+
import { $ as checkForUpdates, A as removeAccountChange, B as strictToolArguments, D as policyChange, E as policyApprovalRefusal, F as CHANGE_POLICIES, G as SEND_LOOKUP, H as CommsError, Ht as VERSION, I as MODES, L as SEND_POLICIES, M as showAccount, Mt as waitCallOptions, Nt as waitForApproval, O as policyReport, Ot as toCommsError, P as ResendContext, Q as changeToolResult, _ as showSentEmail, _t as refuseUnclaimedApproval, c as downloadReceived, d as listReceived, f as listScheduled, g as showReceived, i as prepareSend, jt as updateToolGate, k as policyWanted, l as getMetrics, m as listSuppressions, n as executeSend, o as sendStatus, ot as gatedChange, p as listSentEmails, s as cancelScheduledChange, u as listDomains, w as listAccounts, x as runDoctor } from "./send-BOMCKvLT.mjs";
|
|
2
2
|
import { S as union, c as boolean, g as object, h as number, s as array, x as string } from "./iso-USuVU_sk.mjs";
|
|
3
|
-
import { t as McpServer } from "./mcp-
|
|
3
|
+
import { t as McpServer } from "./mcp-DIH4cS6P-CIWWZQbz.mjs";
|
|
4
4
|
//#region src/mcp/server.ts
|
|
5
5
|
const MAX_LISTED = 8;
|
|
6
6
|
function listOf(names) {
|
|
@@ -342,7 +342,7 @@ async function createResendMcpServer(options = {}) {
|
|
|
342
342
|
}));
|
|
343
343
|
server.registerTool("resend_send_execute", {
|
|
344
344
|
title: "Send a prepared email",
|
|
345
|
-
description: "Send
|
|
345
|
+
description: "Send by approval id the email bound by resend_send_prepare, once, after the person approved its preview. Under `confirm` the person must first run the approve command `resend_send_prepare` gave, at their own terminal — you cannot approve it yourself. Pass the approval id; legacy callers may also pass expect, which must still match exactly. Never call it again for an email whose outcome is unknown: use resend_send_status.",
|
|
346
346
|
inputSchema: {
|
|
347
347
|
...accountArg,
|
|
348
348
|
approvalId: string().describe("the approval `resend_send_prepare` returned"),
|
|
@@ -351,7 +351,7 @@ async function createResendMcpServer(options = {}) {
|
|
|
351
351
|
cc: array(string()),
|
|
352
352
|
bcc: array(string()),
|
|
353
353
|
subject: string()
|
|
354
|
-
}).describe("
|
|
354
|
+
}).optional().describe("legacy exact check for recipients and subject; otherwise read from the approval")
|
|
355
355
|
},
|
|
356
356
|
annotations: {
|
|
357
357
|
readOnlyHint: false,
|
|
@@ -363,7 +363,7 @@ async function createResendMcpServer(options = {}) {
|
|
|
363
363
|
const name = await resolve(args.account);
|
|
364
364
|
return executeSend(context, name, {
|
|
365
365
|
approvalId: args.approvalId,
|
|
366
|
-
expect: args.expect
|
|
366
|
+
...args.expect === void 0 ? {} : { expect: args.expect }
|
|
367
367
|
});
|
|
368
368
|
}));
|
|
369
369
|
server.registerTool("resend_send_status", {
|
|
@@ -425,7 +425,7 @@ async function createResendMcpServer(options = {}) {
|
|
|
425
425
|
return {
|
|
426
426
|
server,
|
|
427
427
|
async connectStdio() {
|
|
428
|
-
const { StdioServerTransport } = await import("./stdio-
|
|
428
|
+
const { StdioServerTransport } = await import("./stdio-B8UXEGiG.mjs");
|
|
429
429
|
const transport = new StdioServerTransport();
|
|
430
430
|
const closed = new Promise((settle) => {
|
|
431
431
|
transport.onclose = () => settle();
|
|
@@ -1489,7 +1489,8 @@ const OAuthMetadataSchema = looseObject({
|
|
|
1489
1489
|
introspection_endpoint_auth_signing_alg_values_supported: array(string()).optional(),
|
|
1490
1490
|
code_challenge_methods_supported: array(string()).optional(),
|
|
1491
1491
|
client_id_metadata_document_supported: boolean().optional(),
|
|
1492
|
-
authorization_response_iss_parameter_supported: boolean().optional().catch(void 0)
|
|
1492
|
+
authorization_response_iss_parameter_supported: boolean().optional().catch(void 0),
|
|
1493
|
+
dpop_signing_alg_values_supported: array(string()).optional()
|
|
1493
1494
|
});
|
|
1494
1495
|
/**
|
|
1495
1496
|
* OpenID Connect Discovery 1.0 Provider Metadata
|
|
@@ -1553,7 +1554,8 @@ const OAuthTokensSchema = object({
|
|
|
1553
1554
|
token_type: string(),
|
|
1554
1555
|
expires_in: number$1().optional(),
|
|
1555
1556
|
scope: string().optional(),
|
|
1556
|
-
refresh_token: string().optional()
|
|
1557
|
+
refresh_token: string().optional(),
|
|
1558
|
+
issuer: string().optional().catch(void 0)
|
|
1557
1559
|
}).strip();
|
|
1558
1560
|
/**
|
|
1559
1561
|
* RFC 8693 §2.2.1 Token Exchange response for ID-JAG tokens.
|
|
@@ -1610,7 +1612,8 @@ const OAuthClientInformationSchema = object({
|
|
|
1610
1612
|
client_id: string(),
|
|
1611
1613
|
client_secret: string().optional(),
|
|
1612
1614
|
client_id_issued_at: number().optional(),
|
|
1613
|
-
client_secret_expires_at: number().optional()
|
|
1615
|
+
client_secret_expires_at: number().optional(),
|
|
1616
|
+
issuer: string().optional().catch(void 0)
|
|
1614
1617
|
}).strip();
|
|
1615
1618
|
/**
|
|
1616
1619
|
* RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
|
|
@@ -1631,7 +1634,7 @@ const OAuthTokenRevocationRequestSchema = object({
|
|
|
1631
1634
|
token_type_hint: string().optional()
|
|
1632
1635
|
}).strip();
|
|
1633
1636
|
//#endregion
|
|
1634
|
-
//#region ../core/dist/src-
|
|
1637
|
+
//#region ../core/dist/src-WCy6ifGf-DXrNj-15.mjs
|
|
1635
1638
|
var __create = Object.create;
|
|
1636
1639
|
var __defProp = Object.defineProperty;
|
|
1637
1640
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1955,8 +1958,18 @@ var SdkError = class extends Error {
|
|
|
1955
1958
|
if (typeof this !== "function") throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");
|
|
1956
1959
|
return brandedHasInstance(this, value);
|
|
1957
1960
|
}
|
|
1958
|
-
|
|
1959
|
-
|
|
1961
|
+
/**
|
|
1962
|
+
* @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
|
|
1963
|
+
* @param message - Human-readable description.
|
|
1964
|
+
* @param data - Optional structured payload (for example the HTTP status carried by
|
|
1965
|
+
* {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
|
|
1966
|
+
* promoted to `Error.cause`.
|
|
1967
|
+
* @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
|
|
1968
|
+
* failure as `{ cause }` so it is reachable through the `Error.cause` chain that
|
|
1969
|
+
* loggers and error trackers walk.
|
|
1970
|
+
*/
|
|
1971
|
+
constructor(code, message, data, options) {
|
|
1972
|
+
super(message, options);
|
|
1960
1973
|
this.code = code;
|
|
1961
1974
|
this.data = data;
|
|
1962
1975
|
this.name = "SdkError";
|
|
@@ -1983,8 +1996,11 @@ var SdkHttpError = class extends SdkError {
|
|
|
1983
1996
|
static {
|
|
1984
1997
|
Object.defineProperty(this, "mcpBrand", { value: "mcp.SdkHttpError" });
|
|
1985
1998
|
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1999
|
+
/**
|
|
2000
|
+
* @param options - Standard `ErrorOptions`, forwarded to `Error` (see {@linkcode SdkError}).
|
|
2001
|
+
*/
|
|
2002
|
+
constructor(code, message, data, options) {
|
|
2003
|
+
super(code, message, data, options);
|
|
1988
2004
|
this.name = "SdkHttpError";
|
|
1989
2005
|
}
|
|
1990
2006
|
get status() {
|
|
@@ -3745,7 +3761,7 @@ function getNotificationSchema(method) {
|
|
|
3745
3761
|
}
|
|
3746
3762
|
Object.keys(requestMethodKeys$1);
|
|
3747
3763
|
Object.keys(notificationMethodKeys$1);
|
|
3748
|
-
function isPlainObject$
|
|
3764
|
+
function isPlainObject$5(value) {
|
|
3749
3765
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3750
3766
|
}
|
|
3751
3767
|
/** Tri-state wrap of an optional Zod schema lookup (the function-only contract). */
|
|
@@ -3770,7 +3786,7 @@ const NOT_IN_ERA$1 = {
|
|
|
3770
3786
|
};
|
|
3771
3787
|
/** Whether a `tools/list` entry advertises a non-object `outputSchema` root that needs the SEP-2106 legacy wrap. */
|
|
3772
3788
|
function toolNeedsLegacyWrap(t) {
|
|
3773
|
-
return isPlainObject$
|
|
3789
|
+
return isPlainObject$5(t) && isPlainObject$5(t["outputSchema"]) && isNonObjectJsonSchemaRoot(t["outputSchema"]);
|
|
3774
3790
|
}
|
|
3775
3791
|
/** The wire→neutral trust boundary: a decoded 2025-era wire result is adopted as the neutral `Result` here (the module's single deliberate assertion). */
|
|
3776
3792
|
function toNeutralResult(value) {
|
|
@@ -3805,7 +3821,7 @@ const rev2025Codec = {
|
|
|
3805
3821
|
};
|
|
3806
3822
|
},
|
|
3807
3823
|
decodeResult(_method, raw) {
|
|
3808
|
-
if (isPlainObject$
|
|
3824
|
+
if (isPlainObject$5(raw) && "resultType" in raw) {
|
|
3809
3825
|
const stripped = { ...raw };
|
|
3810
3826
|
delete stripped["resultType"];
|
|
3811
3827
|
return {
|
|
@@ -4569,7 +4585,7 @@ function build() {
|
|
|
4569
4585
|
const subscriptionsListenParamsShape = { notifications: SubscriptionFilterSchema$1 };
|
|
4570
4586
|
const SubscriptionsListenRequestSchema$1 = wireRequest("subscriptions/listen", subscriptionsListenParamsShape);
|
|
4571
4587
|
/**
|
|
4572
|
-
* Anchor
|
|
4588
|
+
* Anchor SubscriptionsListenResultMetaObject — required subscriptionId stamp on
|
|
4573
4589
|
* the graceful-close result. Extends `ResultMetaObject` since spec PR
|
|
4574
4590
|
* #3002 (composed, so the serverInfo key and its leniency stay single-sourced).
|
|
4575
4591
|
*/
|
|
@@ -4842,7 +4858,8 @@ function build() {
|
|
|
4842
4858
|
ListResourceTemplatesResultResponseSchema: wireResultResponse(ListResourceTemplatesResultSchema$1),
|
|
4843
4859
|
ReadResourceResultResponseSchema: wireResultResponse(union([ReadResourceResultSchema$1, InputRequiredResultSchema])),
|
|
4844
4860
|
CompleteResultResponseSchema: wireResultResponse(CompleteResultSchema$1),
|
|
4845
|
-
DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1)
|
|
4861
|
+
DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1),
|
|
4862
|
+
SubscriptionsListenResultResponseSchema: wireResultResponse(SubscriptionsListenResultSchema$1)
|
|
4846
4863
|
};
|
|
4847
4864
|
}
|
|
4848
4865
|
let memo;
|
|
@@ -5165,7 +5182,7 @@ function fillCacheFields(method, result) {
|
|
|
5165
5182
|
delete filled[RESULT_CACHE_HINT_FALLBACK];
|
|
5166
5183
|
return filled;
|
|
5167
5184
|
}
|
|
5168
|
-
function isPlainObject$
|
|
5185
|
+
function isPlainObject$4(value) {
|
|
5169
5186
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5170
5187
|
}
|
|
5171
5188
|
/**
|
|
@@ -5193,7 +5210,7 @@ function stampServerInfoMeta(result, serverInfo) {
|
|
|
5193
5210
|
...result,
|
|
5194
5211
|
_meta: { [SERVER_INFO_META_KEY]: serverInfo }
|
|
5195
5212
|
};
|
|
5196
|
-
if (!isPlainObject$
|
|
5213
|
+
if (!isPlainObject$4(meta)) return result;
|
|
5197
5214
|
if (meta["io.modelcontextprotocol/serverInfo"] !== void 0) return result;
|
|
5198
5215
|
return {
|
|
5199
5216
|
...result,
|
|
@@ -5321,7 +5338,7 @@ function getNotificationSchema2026(method) {
|
|
|
5321
5338
|
}
|
|
5322
5339
|
Object.keys(requestMethodKeys);
|
|
5323
5340
|
Object.keys(notificationMethodKeys);
|
|
5324
|
-
function isPlainObject$
|
|
5341
|
+
function isPlainObject$3(value) {
|
|
5325
5342
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5326
5343
|
}
|
|
5327
5344
|
/** Tri-state wrap of an optional Zod schema lookup (the function-only contract). */
|
|
@@ -5363,14 +5380,14 @@ function enforceDeletedFields(method, result) {
|
|
|
5363
5380
|
return next;
|
|
5364
5381
|
};
|
|
5365
5382
|
const tools = result.tools;
|
|
5366
|
-
if (method === "tools/list" && Array.isArray(tools) && tools.some((tool) => isPlainObject$
|
|
5367
|
-
if (!isPlainObject$
|
|
5383
|
+
if (method === "tools/list" && Array.isArray(tools) && tools.some((tool) => isPlainObject$3(tool) && "execution" in tool)) copy().tools = tools.map((tool) => {
|
|
5384
|
+
if (!isPlainObject$3(tool) || !("execution" in tool)) return tool;
|
|
5368
5385
|
const rest = { ...tool };
|
|
5369
5386
|
delete rest["execution"];
|
|
5370
5387
|
return rest;
|
|
5371
5388
|
});
|
|
5372
5389
|
const capabilities = result.capabilities;
|
|
5373
|
-
if (isPlainObject$
|
|
5390
|
+
if (isPlainObject$3(capabilities) && "tasks" in capabilities) {
|
|
5374
5391
|
const rest = { ...capabilities };
|
|
5375
5392
|
delete rest["tasks"];
|
|
5376
5393
|
copy().capabilities = rest;
|
|
@@ -5417,7 +5434,7 @@ const rev2026Codec = {
|
|
|
5417
5434
|
projectCallToolResult: (result) => appendTextFallbackForNonObject(result),
|
|
5418
5435
|
inputRequestSchema: getInputRequestSchema2026,
|
|
5419
5436
|
decodeResult(method, raw) {
|
|
5420
|
-
if (!isPlainObject$
|
|
5437
|
+
if (!isPlainObject$3(raw)) return {
|
|
5421
5438
|
kind: "invalid",
|
|
5422
5439
|
error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: not an object`, { method })
|
|
5423
5440
|
};
|
|
@@ -5438,8 +5455,10 @@ const rev2026Codec = {
|
|
|
5438
5455
|
};
|
|
5439
5456
|
if (rawResultType === "input_required") {
|
|
5440
5457
|
const rawInputRequests = raw["inputRequests"];
|
|
5441
|
-
const inputRequests = isPlainObject$
|
|
5458
|
+
const inputRequests = isPlainObject$3(rawInputRequests) ? rawInputRequests : {};
|
|
5442
5459
|
const requestState = raw["requestState"];
|
|
5460
|
+
const metaParse = raw["_meta"] === void 0 ? void 0 : buildSchemas2026().ResultMetaSchema.safeParse(raw["_meta"]);
|
|
5461
|
+
const meta = metaParse?.success ? metaParse.data : void 0;
|
|
5443
5462
|
if (Object.keys(inputRequests).length === 0 && typeof requestState !== "string") return {
|
|
5444
5463
|
kind: "invalid",
|
|
5445
5464
|
error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`, {
|
|
@@ -5450,7 +5469,8 @@ const rev2026Codec = {
|
|
|
5450
5469
|
return {
|
|
5451
5470
|
kind: "input_required",
|
|
5452
5471
|
inputRequests,
|
|
5453
|
-
...typeof requestState === "string" && { requestState }
|
|
5472
|
+
...typeof requestState === "string" && { requestState },
|
|
5473
|
+
...meta !== void 0 && { _meta: meta }
|
|
5454
5474
|
};
|
|
5455
5475
|
}
|
|
5456
5476
|
if (rawResultType !== "complete") return {
|
|
@@ -5548,6 +5568,10 @@ function isSpecRequestMethod(method) {
|
|
|
5548
5568
|
function isSpecNotificationMethod(method) {
|
|
5549
5569
|
return ALL_CODECS.some((codec) => codec.hasNotificationMethod(method));
|
|
5550
5570
|
}
|
|
5571
|
+
/** The names SEP-2663 re-defines for the Tasks extension on the era that removed them from core. */
|
|
5572
|
+
function isExtensionReusedRequestMethod(method) {
|
|
5573
|
+
return method === "tasks/get" || method === "tasks/cancel";
|
|
5574
|
+
}
|
|
5551
5575
|
const ALL_CODECS = [rev2025Codec, rev2026Codec];
|
|
5552
5576
|
var schemas_exports = /* @__PURE__ */ __exportAll({
|
|
5553
5577
|
AnnotationsSchema: () => AnnotationsSchema,
|
|
@@ -6766,6 +6790,8 @@ var Protocol = class {
|
|
|
6766
6790
|
_transport;
|
|
6767
6791
|
_requestMessageId = 0;
|
|
6768
6792
|
_requestHandlers = /* @__PURE__ */ new Map();
|
|
6793
|
+
/** Methods registered with an explicit schema; the era gate in `_onrequest` reads it for the Tasks extension names. */
|
|
6794
|
+
_customSchemaRequestMethods = /* @__PURE__ */ new Set();
|
|
6769
6795
|
_requestHandlerAbortControllers = /* @__PURE__ */ new Map();
|
|
6770
6796
|
_notificationHandlers = /* @__PURE__ */ new Map();
|
|
6771
6797
|
_responseHandlers = /* @__PURE__ */ new Map();
|
|
@@ -6896,7 +6922,7 @@ var Protocol = class {
|
|
|
6896
6922
|
return this._requestHandlers.get(method);
|
|
6897
6923
|
}
|
|
6898
6924
|
async _oncancel(notification) {
|
|
6899
|
-
if (
|
|
6925
|
+
if (notification.params.requestId === void 0) return;
|
|
6900
6926
|
this._requestHandlerAbortControllers.get(notification.params.requestId)?.abort(notification.params.reason);
|
|
6901
6927
|
}
|
|
6902
6928
|
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
@@ -7043,7 +7069,7 @@ var Protocol = class {
|
|
|
7043
7069
|
return;
|
|
7044
7070
|
}
|
|
7045
7071
|
}
|
|
7046
|
-
if (isSpecRequestMethod(request.method) && !codec.hasRequestMethod(request.method)) {
|
|
7072
|
+
if (isSpecRequestMethod(request.method) && !codec.hasRequestMethod(request.method) && !(isExtensionReusedRequestMethod(request.method) && this._customSchemaRequestMethods.has(request.method))) {
|
|
7047
7073
|
sendErrorResponse(ProtocolErrorCode.MethodNotFound, "Method not found");
|
|
7048
7074
|
return;
|
|
7049
7075
|
}
|
|
@@ -7176,8 +7202,11 @@ var Protocol = class {
|
|
|
7176
7202
|
}
|
|
7177
7203
|
request(request, schemaOrOptions, maybeOptions) {
|
|
7178
7204
|
const codec = this._resolveOutboundCodec(request.method);
|
|
7205
|
+
if (isStandardSchema(schemaOrOptions)) {
|
|
7206
|
+
if (!isExtensionReusedRequestMethod(request.method)) this._assertOutboundRequestInEra(codec, request.method);
|
|
7207
|
+
return this._requestWithSchemaViaCodec(codec, request, schemaOrOptions, maybeOptions);
|
|
7208
|
+
}
|
|
7179
7209
|
this._assertOutboundRequestInEra(codec, request.method);
|
|
7180
|
-
if (isStandardSchema(schemaOrOptions)) return this._requestWithSchemaViaCodec(codec, request, schemaOrOptions, maybeOptions);
|
|
7181
7210
|
const validate = codecResultValidator(codec, request.method);
|
|
7182
7211
|
if (validate === void 0) throw new TypeError(`'${request.method}' is not a spec method; pass a result schema as the second argument to request().`);
|
|
7183
7212
|
return this._requestWithSchemaViaCodec(codec, request, validate, schemaOrOptions);
|
|
@@ -7295,19 +7324,20 @@ var Protocol = class {
|
|
|
7295
7324
|
const cancel = (reason) => {
|
|
7296
7325
|
if (responseReceived) return;
|
|
7297
7326
|
this._progressHandlers.delete(messageId);
|
|
7298
|
-
if (requestAbort === void 0)
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7327
|
+
if (requestAbort === void 0) {
|
|
7328
|
+
if (request.method !== "initialize") this._transport?.send(this._envelopeOutbound({
|
|
7329
|
+
jsonrpc: "2.0",
|
|
7330
|
+
method: "notifications/cancelled",
|
|
7331
|
+
params: {
|
|
7332
|
+
requestId: messageId,
|
|
7333
|
+
reason: String(reason)
|
|
7334
|
+
}
|
|
7335
|
+
}), {
|
|
7336
|
+
relatedRequestId,
|
|
7337
|
+
resumptionToken,
|
|
7338
|
+
onresumptiontoken
|
|
7339
|
+
}).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error}`)));
|
|
7340
|
+
} else requestAbort.abort();
|
|
7311
7341
|
reject(reason instanceof SdkError ? reason : new SdkError(SdkErrorCode.RequestTimeout, String(reason)));
|
|
7312
7342
|
};
|
|
7313
7343
|
this._responseHandlers.set(messageId, (response) => {
|
|
@@ -7369,7 +7399,7 @@ var Protocol = class {
|
|
|
7369
7399
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
7370
7400
|
*/
|
|
7371
7401
|
async notification(notification, options) {
|
|
7372
|
-
return this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
|
|
7402
|
+
return await this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
|
|
7373
7403
|
}
|
|
7374
7404
|
/**
|
|
7375
7405
|
* The notification funnel proper, keyed by the resolved era codec —
|
|
@@ -7387,7 +7417,7 @@ var Protocol = class {
|
|
|
7387
7417
|
jsonrpc: "2.0",
|
|
7388
7418
|
...notification
|
|
7389
7419
|
});
|
|
7390
|
-
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params &&
|
|
7420
|
+
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && options?.relatedRequestId === void 0) {
|
|
7391
7421
|
if (this._pendingDebouncedNotifications.has(notification.method)) return;
|
|
7392
7422
|
this._pendingDebouncedNotifications.add(notification.method);
|
|
7393
7423
|
Promise.resolve().then(() => {
|
|
@@ -7420,6 +7450,8 @@ var Protocol = class {
|
|
|
7420
7450
|
return maybeHandler(parsed.data, ctx);
|
|
7421
7451
|
};
|
|
7422
7452
|
else throw new TypeError("setRequestHandler: handler is required");
|
|
7453
|
+
if (typeof schemasOrHandler === "function") this._customSchemaRequestMethods.delete(method);
|
|
7454
|
+
else this._customSchemaRequestMethods.add(method);
|
|
7423
7455
|
this._requestHandlers.set(method, this._wrapHandler(method, stored));
|
|
7424
7456
|
}
|
|
7425
7457
|
/**
|
|
@@ -7448,6 +7480,7 @@ var Protocol = class {
|
|
|
7448
7480
|
*/
|
|
7449
7481
|
removeRequestHandler(method) {
|
|
7450
7482
|
this._requestHandlers.delete(method);
|
|
7483
|
+
this._customSchemaRequestMethods.delete(method);
|
|
7451
7484
|
}
|
|
7452
7485
|
/**
|
|
7453
7486
|
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
@@ -7663,7 +7696,8 @@ function manualInputRequiredValue(decoded) {
|
|
|
7663
7696
|
return {
|
|
7664
7697
|
resultType: "input_required",
|
|
7665
7698
|
inputRequests: decoded.inputRequests,
|
|
7666
|
-
...decoded.requestState !== void 0 && { requestState: decoded.requestState }
|
|
7699
|
+
...decoded.requestState !== void 0 && { requestState: decoded.requestState },
|
|
7700
|
+
...decoded._meta !== void 0 && { _meta: decoded._meta }
|
|
7667
7701
|
};
|
|
7668
7702
|
}
|
|
7669
7703
|
/*!
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
import { i as serializeMessage, n as process, r as ReadBuffer } from "./mcp-
|
|
2
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.
|
|
1
|
+
import { i as serializeMessage, n as process, r as ReadBuffer } from "./mcp-DIH4cS6P-CIWWZQbz.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/stdio.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Marks a stdout `'error'` listener that a closed transport left attached purely to
|
|
5
|
+
* swallow late write failures (see {@link StdioServerTransport.close}). A fresh
|
|
6
|
+
* transport taking over the same stream removes listeners carrying this tag in
|
|
7
|
+
* `start()`, so repeated create→close cycles on the process-global `process.stdout`
|
|
8
|
+
* don't accumulate listeners.
|
|
9
|
+
*/
|
|
10
|
+
const swallowsErrorsAfterClose = Symbol("swallowsErrorsAfterClose");
|
|
3
11
|
/**
|
|
4
12
|
* Server transport for stdio: this communicates with an MCP client by reading from the current process' `stdin` and writing to `stdout`.
|
|
5
13
|
*
|
|
6
14
|
* This transport is only available in Node.js environments.
|
|
7
15
|
*
|
|
16
|
+
* When the client closes its end of the pipe (stdin reaches end-of-file), the transport
|
|
17
|
+
* closes itself and fires `onclose`, per the MCP stdio binding's guidance that servers
|
|
18
|
+
* should exit promptly when their standard input is closed. A server that holds no other
|
|
19
|
+
* keep-alive handles will then exit naturally. Requests still in flight when stdin ends are
|
|
20
|
+
* aborted and not answered; a client that expects responses keeps stdin open until it has
|
|
21
|
+
* read them.
|
|
22
|
+
*
|
|
8
23
|
* @example
|
|
9
24
|
* ```ts source="./stdio.examples.ts#StdioServerTransport_basicUsage"
|
|
10
25
|
* const server = new McpServer({ name: 'my-server', version: '1.0.0' });
|
|
@@ -37,17 +52,25 @@ var StdioServerTransport = class {
|
|
|
37
52
|
this.onerror?.(error);
|
|
38
53
|
};
|
|
39
54
|
_onstdouterror = (error) => {
|
|
55
|
+
if (this._closed) return;
|
|
40
56
|
this.onerror?.(error);
|
|
41
57
|
this.close().catch(() => {});
|
|
42
58
|
};
|
|
59
|
+
_onstdinclose = () => {
|
|
60
|
+
this.close().catch(() => {});
|
|
61
|
+
};
|
|
43
62
|
/**
|
|
44
63
|
* Starts listening for messages on `stdin`.
|
|
45
64
|
*/
|
|
46
65
|
async start() {
|
|
47
66
|
if (this._started) throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
|
|
48
67
|
this._started = true;
|
|
68
|
+
for (const listener of this._stdout.listeners("error")) if (listener[swallowsErrorsAfterClose]) this._stdout.off("error", listener);
|
|
69
|
+
if (this._stdin.readableEnded || this._stdin.destroyed) setImmediate(this._onstdinclose);
|
|
49
70
|
this._stdin.on("data", this._ondata);
|
|
50
71
|
this._stdin.on("error", this._onerror);
|
|
72
|
+
this._stdin.on("end", this._onstdinclose);
|
|
73
|
+
this._stdin.on("close", this._onstdinclose);
|
|
51
74
|
this._stdout.on("error", this._onstdouterror);
|
|
52
75
|
}
|
|
53
76
|
processReadBuffer() {
|
|
@@ -64,7 +87,9 @@ var StdioServerTransport = class {
|
|
|
64
87
|
this._closed = true;
|
|
65
88
|
this._stdin.off("data", this._ondata);
|
|
66
89
|
this._stdin.off("error", this._onerror);
|
|
67
|
-
this.
|
|
90
|
+
this._stdin.off("end", this._onstdinclose);
|
|
91
|
+
this._stdin.off("close", this._onstdinclose);
|
|
92
|
+
this._onstdouterror[swallowsErrorsAfterClose] = true;
|
|
68
93
|
if (this._stdin.listenerCount("data") === 0) this._stdin.pause();
|
|
69
94
|
this._readBuffer.clear();
|
|
70
95
|
this.onclose?.();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ReadBuffer, c as SdkErrorCode, k as serializeMessage, s as SdkError } from "./src-
|
|
1
|
+
import { a as ReadBuffer, c as SdkErrorCode, k as serializeMessage, s as SdkError } from "./src-WCy6ifGf-DXrNj-15-D0oRtifb.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import process$1 from "node:process";
|
|
4
4
|
import { PassThrough } from "node:stream";
|
|
5
|
-
//#region ../core/dist/stdio-
|
|
5
|
+
//#region ../core/dist/stdio-CyjIgrch.mjs
|
|
6
6
|
var __create = Object.create;
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -406,17 +406,23 @@ var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(
|
|
|
406
406
|
*/
|
|
407
407
|
const DEFAULT_INHERITED_ENV_VARS = process$1.platform === "win32" ? [
|
|
408
408
|
"APPDATA",
|
|
409
|
+
"COMSPEC",
|
|
409
410
|
"HOMEDRIVE",
|
|
410
411
|
"HOMEPATH",
|
|
411
412
|
"LOCALAPPDATA",
|
|
412
413
|
"PATH",
|
|
414
|
+
"PATHEXT",
|
|
413
415
|
"PROCESSOR_ARCHITECTURE",
|
|
416
|
+
"PROGRAMDATA",
|
|
417
|
+
"PROGRAMFILES",
|
|
418
|
+
"PROGRAMFILES(X86)",
|
|
419
|
+
"PROGRAMW6432",
|
|
414
420
|
"SYSTEMDRIVE",
|
|
415
421
|
"SYSTEMROOT",
|
|
416
422
|
"TEMP",
|
|
417
423
|
"USERNAME",
|
|
418
424
|
"USERPROFILE",
|
|
419
|
-
"
|
|
425
|
+
"WINDIR"
|
|
420
426
|
] : [
|
|
421
427
|
"HOME",
|
|
422
428
|
"LOGNAME",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createResendMcpServer } from "./server-
|
|
1
|
+
import { t as createResendMcpServer } from "./server-CbcJL9CZ.mjs";
|
|
2
2
|
//#region src/mcp/stdio-entry.ts
|
|
3
3
|
/**
|
|
4
4
|
* Starting the stdio server. On stdio, **stdout is the protocol**: one stray `console.log` corrupts the stream, so
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentcomms/resend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Resend for coding agents: read domains, sent and received mail, metrics and suppressions, and send mail that nothing sends without a person's approval of exactly what goes out.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"THIRD_PARTY_LICENSES"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@agentcomms/core": "0.
|
|
34
|
+
"@agentcomms/core": "0.18.1"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
37
|
"@napi-rs/keyring": "2.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@modelcontextprotocol/client": "2.
|
|
41
|
-
"@modelcontextprotocol/server": "^2.
|
|
40
|
+
"@modelcontextprotocol/client": "2.3.1",
|
|
41
|
+
"@modelcontextprotocol/server": "^2.3.1",
|
|
42
42
|
"commander": "^15.0.0",
|
|
43
43
|
"zod": "^4.6.5"
|
|
44
44
|
},
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"typecheck": "tsc -p tsconfig.json",
|
|
108
108
|
"test": "node --experimental-strip-types --test --test-timeout=600000 \"test/**/*.test.ts\""
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "fc398edc67287e411f8c5cb821f434220cb83aa5"
|
|
111
111
|
}
|