@codeforbreakfast/commy-mcp 0.24.0 → 0.24.2
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/package.json +1 -1
- package/server.js +199 -115
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -3048,10 +3048,11 @@ var require_data = __commonJS((exports, module) => {
|
|
|
3048
3048
|
};
|
|
3049
3049
|
});
|
|
3050
3050
|
|
|
3051
|
-
// node_modules/.bun/fast-uri@4.1
|
|
3051
|
+
// node_modules/.bun/fast-uri@4.2.1/node_modules/fast-uri/lib/utils.js
|
|
3052
3052
|
var require_utils = __commonJS((exports, module) => {
|
|
3053
3053
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
3054
3054
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
3055
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
3055
3056
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
3056
3057
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
3057
3058
|
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
@@ -3533,6 +3534,22 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
3533
3534
|
}
|
|
3534
3535
|
return output;
|
|
3535
3536
|
}
|
|
3537
|
+
function recomposeZonedIPv6Host(component) {
|
|
3538
|
+
const zone = component.ipv6Zone;
|
|
3539
|
+
if (zone === undefined)
|
|
3540
|
+
return;
|
|
3541
|
+
const host = component.host;
|
|
3542
|
+
const separator = host.indexOf("%");
|
|
3543
|
+
if (separator === -1)
|
|
3544
|
+
return;
|
|
3545
|
+
const address = host.slice(0, separator);
|
|
3546
|
+
const escaped = address + "%25" + zone;
|
|
3547
|
+
const derived = normalizeIPv6("[" + escaped + "]");
|
|
3548
|
+
if (derived.isIPV6 === true && derived.host === host) {
|
|
3549
|
+
return "[" + escaped + "]";
|
|
3550
|
+
}
|
|
3551
|
+
return;
|
|
3552
|
+
}
|
|
3536
3553
|
function recomposeAuthority(component) {
|
|
3537
3554
|
const uriTokens = [];
|
|
3538
3555
|
if (component.userinfo !== undefined) {
|
|
@@ -3542,22 +3559,31 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
3542
3559
|
if (component.host !== undefined) {
|
|
3543
3560
|
let host = component.host;
|
|
3544
3561
|
if (!isIPv4(host)) {
|
|
3545
|
-
|
|
3546
|
-
if (
|
|
3547
|
-
host =
|
|
3548
|
-
ipV6res = normalizeIPv6(host);
|
|
3549
|
-
}
|
|
3550
|
-
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
3551
|
-
host = `[${ipV6res.escapedHost}]`;
|
|
3562
|
+
const zonedHost = recomposeZonedIPv6Host(component);
|
|
3563
|
+
if (zonedHost !== undefined) {
|
|
3564
|
+
host = zonedHost;
|
|
3552
3565
|
} else {
|
|
3553
|
-
|
|
3566
|
+
let ipV6res = normalizeIPv6(host);
|
|
3567
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
3568
|
+
host = normalizePercentEncoding(host, true);
|
|
3569
|
+
ipV6res = normalizeIPv6(host);
|
|
3570
|
+
}
|
|
3571
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
3572
|
+
host = `[${ipV6res.escapedHost}]`;
|
|
3573
|
+
} else {
|
|
3574
|
+
host = reescapeHostDelimiters(host, false);
|
|
3575
|
+
}
|
|
3554
3576
|
}
|
|
3555
3577
|
}
|
|
3556
3578
|
uriTokens.push(host);
|
|
3557
3579
|
}
|
|
3558
3580
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
3581
|
+
const port3 = String(component.port);
|
|
3582
|
+
if (!isPort(port3)) {
|
|
3583
|
+
throw new TypeError("URI port is malformed.");
|
|
3584
|
+
}
|
|
3559
3585
|
uriTokens.push(":");
|
|
3560
|
-
uriTokens.push(
|
|
3586
|
+
uriTokens.push(port3);
|
|
3561
3587
|
}
|
|
3562
3588
|
return uriTokens.length ? uriTokens.join("") : undefined;
|
|
3563
3589
|
}
|
|
@@ -3584,7 +3610,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
3584
3610
|
};
|
|
3585
3611
|
});
|
|
3586
3612
|
|
|
3587
|
-
// node_modules/.bun/fast-uri@4.1
|
|
3613
|
+
// node_modules/.bun/fast-uri@4.2.1/node_modules/fast-uri/lib/schemes.js
|
|
3588
3614
|
var require_schemes = __commonJS((exports, module) => {
|
|
3589
3615
|
var { isUUID, BYTE_HEX, percentEncodeNonAscii, nonSimpleMailtoDomain } = require_utils();
|
|
3590
3616
|
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
@@ -3759,6 +3785,7 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3759
3785
|
var HEX_PAIR = /^[\da-f]{2}$/iu;
|
|
3760
3786
|
var MAILTO_DOMAIN_LITERAL = /^\[[\x21-\x5A\x5E-\x7E]*\]$/u;
|
|
3761
3787
|
var MAILTO_DOMAIN_ERROR = "URI mailto has an invalid recipient domain.";
|
|
3788
|
+
var MAILTO_AUTHORITY_ERROR = "URI mailto must not have an authority component.";
|
|
3762
3789
|
var HAS_SURROGATE = /[\uD800-\uDFFF]/u;
|
|
3763
3790
|
function decodeHex2(str) {
|
|
3764
3791
|
if (typeof str !== "string" || str.indexOf("%") === -1) {
|
|
@@ -3873,30 +3900,37 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3873
3900
|
mailtoComponent.error = mailtoComponent.error || "URI mailto has malformed header fields.";
|
|
3874
3901
|
continue;
|
|
3875
3902
|
}
|
|
3876
|
-
const name = eqIdx === -1 ? token : token.slice(0, eqIdx);
|
|
3903
|
+
const name = decodeHex2(eqIdx === -1 ? token : token.slice(0, eqIdx));
|
|
3904
|
+
const normalizedName = name.toLowerCase();
|
|
3877
3905
|
const value5 = eqIdx === -1 ? "" : token.slice(eqIdx + 1);
|
|
3878
|
-
if (
|
|
3906
|
+
if (normalizedName === "to") {
|
|
3879
3907
|
const addrs = value5.split(",");
|
|
3880
3908
|
for (let j = 0;j < addrs.length; j++)
|
|
3881
3909
|
to.push(addrs[j]);
|
|
3882
3910
|
continue;
|
|
3883
3911
|
}
|
|
3884
|
-
if (
|
|
3912
|
+
if (normalizedName === "subject") {
|
|
3885
3913
|
mailtoComponent.subject = decodeHex2(value5);
|
|
3886
3914
|
continue;
|
|
3887
3915
|
}
|
|
3888
|
-
if (
|
|
3916
|
+
if (normalizedName === "body") {
|
|
3889
3917
|
mailtoComponent.body = decodeHex2(value5);
|
|
3890
3918
|
continue;
|
|
3891
3919
|
}
|
|
3892
3920
|
if (headers === null)
|
|
3893
3921
|
headers = Object.create(null);
|
|
3894
|
-
headers[
|
|
3922
|
+
headers[name] = decodeHex2(value5);
|
|
3895
3923
|
}
|
|
3896
3924
|
if (headers !== null)
|
|
3897
3925
|
mailtoComponent.headers = headers;
|
|
3898
3926
|
}
|
|
3899
3927
|
mailtoComponent.query = undefined;
|
|
3928
|
+
if (to.length > 0 && (mailtoComponent.userinfo !== undefined || mailtoComponent.host !== undefined || mailtoComponent.port !== undefined)) {
|
|
3929
|
+
mailtoComponent.userinfo = undefined;
|
|
3930
|
+
mailtoComponent.host = undefined;
|
|
3931
|
+
mailtoComponent.port = undefined;
|
|
3932
|
+
mailtoComponent.error = mailtoComponent.error || MAILTO_AUTHORITY_ERROR;
|
|
3933
|
+
}
|
|
3900
3934
|
for (let i = 0;i < to.length; i++) {
|
|
3901
3935
|
const rawAddr = to[i];
|
|
3902
3936
|
const atIdx = rawAddr.lastIndexOf("@");
|
|
@@ -3913,10 +3947,35 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3913
3947
|
mailtoComponent.to = to;
|
|
3914
3948
|
return mailtoComponent;
|
|
3915
3949
|
}
|
|
3950
|
+
function mailtoEncodeHeaderName(name) {
|
|
3951
|
+
return encodeWithAllow(name.replace(/%/gu, "%25"), HFNAME);
|
|
3952
|
+
}
|
|
3916
3953
|
function mailtoSerialize(component, options5) {
|
|
3917
3954
|
const mailtoComponent = component;
|
|
3918
3955
|
const to = Array.isArray(mailtoComponent.to) ? mailtoComponent.to.slice() : [];
|
|
3956
|
+
const sourceHeaders = mailtoComponent.headers && typeof mailtoComponent.headers === "object" ? Object.assign(Object.create(null), mailtoComponent.headers) : Object.create(null);
|
|
3957
|
+
const headers = Object.create(null);
|
|
3958
|
+
for (const name in sourceHeaders) {
|
|
3959
|
+
const normalizedName = name.toLowerCase();
|
|
3960
|
+
if (normalizedName === "to") {
|
|
3961
|
+
const addrs = String(sourceHeaders[name]).split(",");
|
|
3962
|
+
for (let i = 0;i < addrs.length; i++)
|
|
3963
|
+
to.push(addrs[i]);
|
|
3964
|
+
} else if (normalizedName === "subject" || normalizedName === "body") {
|
|
3965
|
+
headers[normalizedName] = sourceHeaders[name];
|
|
3966
|
+
} else {
|
|
3967
|
+
headers[name] = sourceHeaders[name];
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
if (mailtoComponent.subject !== undefined)
|
|
3971
|
+
headers.subject = mailtoComponent.subject;
|
|
3972
|
+
if (mailtoComponent.body !== undefined)
|
|
3973
|
+
headers.body = mailtoComponent.body;
|
|
3974
|
+
mailtoComponent.headers = headers;
|
|
3919
3975
|
if (to.length) {
|
|
3976
|
+
mailtoComponent.userinfo = undefined;
|
|
3977
|
+
mailtoComponent.host = undefined;
|
|
3978
|
+
mailtoComponent.port = undefined;
|
|
3920
3979
|
for (let i = 0;i < to.length; i++) {
|
|
3921
3980
|
const addr = String(to[i]);
|
|
3922
3981
|
const atIdx = addr.lastIndexOf("@");
|
|
@@ -3932,18 +3991,12 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3932
3991
|
} else {
|
|
3933
3992
|
mailtoComponent.path = undefined;
|
|
3934
3993
|
}
|
|
3935
|
-
const headers = mailtoComponent.headers && typeof mailtoComponent.headers === "object" ? Object.assign(Object.create(null), mailtoComponent.headers) : Object.create(null);
|
|
3936
|
-
if (mailtoComponent.subject)
|
|
3937
|
-
headers.subject = mailtoComponent.subject;
|
|
3938
|
-
if (mailtoComponent.body)
|
|
3939
|
-
headers.body = mailtoComponent.body;
|
|
3940
|
-
mailtoComponent.headers = headers;
|
|
3941
3994
|
let query = "";
|
|
3942
3995
|
let count4 = 0;
|
|
3943
3996
|
for (const name in headers) {
|
|
3944
3997
|
if (count4++ !== 0)
|
|
3945
3998
|
query += "&";
|
|
3946
|
-
query +=
|
|
3999
|
+
query += mailtoEncodeHeaderName(name) + "=" + encodeWithAllow(String(headers[name]), HFNAME);
|
|
3947
4000
|
}
|
|
3948
4001
|
if (count4 !== 0) {
|
|
3949
4002
|
mailtoComponent.query = query;
|
|
@@ -3982,7 +4035,7 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3982
4035
|
};
|
|
3983
4036
|
});
|
|
3984
4037
|
|
|
3985
|
-
// node_modules/.bun/fast-uri@4.1
|
|
4038
|
+
// node_modules/.bun/fast-uri@4.2.1/node_modules/fast-uri/index.js
|
|
3986
4039
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
3987
4040
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3988
4041
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
@@ -4036,6 +4089,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4036
4089
|
schemelessOptions.skipEscape = true;
|
|
4037
4090
|
return serialize2(resolved, schemelessOptions);
|
|
4038
4091
|
}
|
|
4092
|
+
function copyHost(target, source) {
|
|
4093
|
+
target.host = source.host;
|
|
4094
|
+
if (source.ipv6Zone !== undefined) {
|
|
4095
|
+
target.ipv6Zone = source.ipv6Zone;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4039
4098
|
function resolveComponent(base, relative, options5, skipNormalization) {
|
|
4040
4099
|
const target = {};
|
|
4041
4100
|
if (!skipNormalization) {
|
|
@@ -4046,14 +4105,14 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4046
4105
|
if (!options5.tolerant && relative.scheme) {
|
|
4047
4106
|
target.scheme = relative.scheme;
|
|
4048
4107
|
target.userinfo = relative.userinfo;
|
|
4049
|
-
target
|
|
4108
|
+
copyHost(target, relative);
|
|
4050
4109
|
target.port = relative.port;
|
|
4051
4110
|
target.path = removeDotSegments(relative.path || "");
|
|
4052
4111
|
target.query = relative.query;
|
|
4053
4112
|
} else {
|
|
4054
4113
|
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
4055
4114
|
target.userinfo = relative.userinfo;
|
|
4056
|
-
target
|
|
4115
|
+
copyHost(target, relative);
|
|
4057
4116
|
target.port = relative.port;
|
|
4058
4117
|
target.path = removeDotSegments(relative.path || "");
|
|
4059
4118
|
target.query = relative.query;
|
|
@@ -4081,7 +4140,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4081
4140
|
target.query = relative.query;
|
|
4082
4141
|
}
|
|
4083
4142
|
target.userinfo = base.userinfo;
|
|
4084
|
-
target
|
|
4143
|
+
copyHost(target, base);
|
|
4085
4144
|
target.port = base.port;
|
|
4086
4145
|
}
|
|
4087
4146
|
target.scheme = base.scheme;
|
|
@@ -4097,6 +4156,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4097
4156
|
function serialize2(cmpts, opts) {
|
|
4098
4157
|
const component = {
|
|
4099
4158
|
host: cmpts.host,
|
|
4159
|
+
ipv6Zone: cmpts.ipv6Zone,
|
|
4100
4160
|
scheme: cmpts.scheme,
|
|
4101
4161
|
userinfo: cmpts.userinfo,
|
|
4102
4162
|
port: cmpts.port,
|
|
@@ -4191,12 +4251,16 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4191
4251
|
}
|
|
4192
4252
|
return false;
|
|
4193
4253
|
}
|
|
4254
|
+
function isIPLiteral(host) {
|
|
4255
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
4256
|
+
}
|
|
4194
4257
|
function hasMalformedComponentPercentEncoding(matches) {
|
|
4195
4258
|
const host = matches[4];
|
|
4196
|
-
return hasMalformedPercentEncoding(matches[3]) || host !== undefined && !(host
|
|
4259
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
4197
4260
|
}
|
|
4198
4261
|
function canonicalizeHost(parsed, options5, schemeHandler, isIP) {
|
|
4199
|
-
|
|
4262
|
+
const bracketedIPLiteral = parsed.host && parsed.host[0] === "[" && parsed.host[parsed.host.length - 1] === "]";
|
|
4263
|
+
if (!options5.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options5.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && !bracketedIPLiteral && nonSimpleDomain(parsed.host)) {
|
|
4200
4264
|
try {
|
|
4201
4265
|
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
4202
4266
|
} catch (e) {
|
|
@@ -4283,11 +4347,15 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4283
4347
|
if (parsed.host) {
|
|
4284
4348
|
const ipv4result = isIPv4(parsed.host);
|
|
4285
4349
|
if (ipv4result === false) {
|
|
4286
|
-
const bracketedIPLiteral = parsed.host
|
|
4350
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
4351
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
4287
4352
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
4288
4353
|
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
4289
|
-
malformedIPLiteral =
|
|
4354
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
4290
4355
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
4356
|
+
if (isIP && ipv6result.isIPV6 === true && parsed.host.indexOf("%") !== -1) {
|
|
4357
|
+
parsed.ipv6Zone = parsed.host.slice(parsed.host.indexOf("%") + 1);
|
|
4358
|
+
}
|
|
4291
4359
|
if (malformedIPLiteral) {
|
|
4292
4360
|
parsed.error = parsed.error || "URI host is malformed.";
|
|
4293
4361
|
malformedAuthorityOrPort = true;
|
|
@@ -4309,14 +4377,17 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
4309
4377
|
parsed.error = parsed.error || "URI is not a " + options5.reference + " reference.";
|
|
4310
4378
|
}
|
|
4311
4379
|
const schemeHandler = getSchemeHandler(options5.scheme || parsed.scheme);
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4380
|
+
if (!malformedIPLiteral) {
|
|
4381
|
+
malformedHost = canonicalizeHost(parsed, options5, schemeHandler, isIP);
|
|
4382
|
+
}
|
|
4383
|
+
if (uri.indexOf("%") !== -1 && parsed.host !== undefined && !malformedIPLiteral) {
|
|
4384
|
+
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
4385
|
+
if (!isIP) {
|
|
4386
|
+
host = normalizePercentEncoding(host.toLowerCase());
|
|
4319
4387
|
}
|
|
4388
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
4389
|
+
}
|
|
4390
|
+
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
4320
4391
|
if (parsed.path) {
|
|
4321
4392
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
4322
4393
|
}
|
|
@@ -50358,7 +50429,7 @@ var runMain2 = runMain;
|
|
|
50358
50429
|
|
|
50359
50430
|
// node_modules/.bun/@effect+platform-node@0.108.2+7b41a6254ced90d9/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
|
|
50360
50431
|
var runMain3 = runMain2;
|
|
50361
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
50432
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
50362
50433
|
import process3 from "node:process";
|
|
50363
50434
|
|
|
50364
50435
|
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
@@ -55477,7 +55548,7 @@ function preprocess(fn2, schema) {
|
|
|
55477
55548
|
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
55478
55549
|
config2(en_default());
|
|
55479
55550
|
|
|
55480
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
55551
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
55481
55552
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
55482
55553
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
55483
55554
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -56312,9 +56383,19 @@ class UrlElicitationRequiredError extends McpError {
|
|
|
56312
56383
|
}
|
|
56313
56384
|
}
|
|
56314
56385
|
|
|
56315
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
56386
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
56387
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
56388
|
+
|
|
56316
56389
|
class ReadBuffer {
|
|
56390
|
+
constructor(options5) {
|
|
56391
|
+
this._maxBufferSize = options5?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
56392
|
+
}
|
|
56317
56393
|
append(chunk5) {
|
|
56394
|
+
const newSize = (this._buffer?.length ?? 0) + chunk5.length;
|
|
56395
|
+
if (newSize > this._maxBufferSize) {
|
|
56396
|
+
this.clear();
|
|
56397
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
56398
|
+
}
|
|
56318
56399
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk5]) : chunk5;
|
|
56319
56400
|
}
|
|
56320
56401
|
readMessage() {
|
|
@@ -56342,20 +56423,25 @@ function serializeMessage(message) {
|
|
|
56342
56423
|
`;
|
|
56343
56424
|
}
|
|
56344
56425
|
|
|
56345
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
56426
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
56346
56427
|
class StdioServerTransport {
|
|
56347
|
-
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
56428
|
+
constructor(_stdin = process3.stdin, _stdout = process3.stdout, options5) {
|
|
56348
56429
|
this._stdin = _stdin;
|
|
56349
56430
|
this._stdout = _stdout;
|
|
56350
|
-
this._readBuffer = new ReadBuffer;
|
|
56351
56431
|
this._started = false;
|
|
56352
56432
|
this._ondata = (chunk5) => {
|
|
56353
|
-
|
|
56354
|
-
|
|
56433
|
+
try {
|
|
56434
|
+
this._readBuffer.append(chunk5);
|
|
56435
|
+
this.processReadBuffer();
|
|
56436
|
+
} catch (error2) {
|
|
56437
|
+
this.onerror?.(error2);
|
|
56438
|
+
this.close().catch(() => {});
|
|
56439
|
+
}
|
|
56355
56440
|
};
|
|
56356
56441
|
this._onerror = (error2) => {
|
|
56357
56442
|
this.onerror?.(error2);
|
|
56358
56443
|
};
|
|
56444
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options5?.maxBufferSize });
|
|
56359
56445
|
}
|
|
56360
56446
|
async start() {
|
|
56361
56447
|
if (this._started) {
|
|
@@ -56794,8 +56880,8 @@ var fetchMessageRef = (http, messageId, base) => http.get("/messages", singleMes
|
|
|
56794
56880
|
}).pipe(exports_Effect.flatMap((res) => {
|
|
56795
56881
|
const message = res.messages[0];
|
|
56796
56882
|
if (message === undefined || message.id !== messageId)
|
|
56797
|
-
return exports_Effect.
|
|
56798
|
-
return decodeMessageRef(message, base).pipe(exports_Effect.
|
|
56883
|
+
return exports_Effect.succeedNone;
|
|
56884
|
+
return decodeMessageRef(message, base).pipe(exports_Effect.asSome);
|
|
56799
56885
|
}));
|
|
56800
56886
|
var describeError = (err) => messageOf(err);
|
|
56801
56887
|
var markReplayed = (events) => events.map((ev) => {
|
|
@@ -57111,7 +57197,10 @@ var makeZulipHttp = (config3) => exports_Effect.gen(function* () {
|
|
|
57111
57197
|
...hostHeader === undefined ? {} : { host: hostHeader }
|
|
57112
57198
|
})));
|
|
57113
57199
|
const resolvePath = (path) => path.startsWith("/") ? exports_Effect.succeed(base + path) : exports_Effect.die(new TypeError(`ZulipHttp path must start with '/' — received: ${JSON.stringify(path)}`));
|
|
57114
|
-
const attempt = (url3, request2) => httpClient.execute(request2).pipe(exports_Effect.flatMap((response) => response.text.pipe(exports_Effect.mapError((cause3) => transportError(url3, cause3)), exports_Effect.flatMap((text3) => classifyEnvelope(text3, response.status, url3)))), exports_Effect.
|
|
57200
|
+
const attempt = (url3, request2) => httpClient.execute(request2).pipe(exports_Effect.flatMap((response) => response.text.pipe(exports_Effect.mapError((cause3) => transportError(url3, cause3)), exports_Effect.flatMap((text3) => classifyEnvelope(text3, response.status, url3)))), exports_Effect.catchTags({
|
|
57201
|
+
RequestError: (cause3) => exports_Effect.fail(transportError(url3, cause3)),
|
|
57202
|
+
ResponseError: (cause3) => exports_Effect.fail(transportError(url3, cause3))
|
|
57203
|
+
}));
|
|
57115
57204
|
const sendWithRetry = (url3, request2) => attempt(url3, request2).pipe(exports_Effect.retry({ schedule: rateLimitSchedule() }));
|
|
57116
57205
|
const sendJson = (url3, request2, schema) => {
|
|
57117
57206
|
const decode8 = exports_Schema.decodeUnknown(exports_Schema.parseJson(schema));
|
|
@@ -57142,7 +57231,10 @@ var makeZulipHttp = (config3) => exports_Effect.gen(function* () {
|
|
|
57142
57231
|
data: new Uint8Array(buf),
|
|
57143
57232
|
contentType: response.headers["content-type"] ?? "application/octet-stream"
|
|
57144
57233
|
})), exports_Effect.mapError((cause3) => transportError(url3, cause3)));
|
|
57145
|
-
}), exports_Effect.
|
|
57234
|
+
}), exports_Effect.catchTags({
|
|
57235
|
+
RequestError: (cause3) => exports_Effect.fail(transportError(url3, cause3)),
|
|
57236
|
+
ResponseError: (cause3) => exports_Effect.fail(transportError(url3, cause3))
|
|
57237
|
+
}));
|
|
57146
57238
|
})() : exports_Effect.die(new TypeError(`ZulipHttp realmPath must start with '/' — received: ${JSON.stringify(realmPath)}`)),
|
|
57147
57239
|
uploadRaw: (filename, data) => resolvePath("/user_uploads").pipe(exports_Effect.flatMap((url3) => {
|
|
57148
57240
|
const form = new FormData;
|
|
@@ -57343,13 +57435,16 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57343
57435
|
const byId = new Map;
|
|
57344
57436
|
const byName = new Map;
|
|
57345
57437
|
const byIdentityId = new Map;
|
|
57438
|
+
const active2 = new Set;
|
|
57346
57439
|
for (const u of members) {
|
|
57347
57440
|
const ident = yield* toIdentity(u);
|
|
57348
57441
|
byId.set(ZulipUserRef(u.user_id), ident);
|
|
57349
57442
|
byName.set(u.full_name, ident);
|
|
57350
57443
|
byIdentityId.set(ident.id, ZulipUserRef(u.user_id));
|
|
57444
|
+
if (u.is_active)
|
|
57445
|
+
active2.add(ident.id);
|
|
57351
57446
|
}
|
|
57352
|
-
return { byId, byName, byIdentityId };
|
|
57447
|
+
return { byId, byName, byIdentityId, active: active2 };
|
|
57353
57448
|
})));
|
|
57354
57449
|
const recipientDirectory = () => buildDirectoryLookup().pipe(exports_Effect.map((lookup) => ({
|
|
57355
57450
|
byId: new Map([...lookup.byId.entries()].map(([id3, ident]) => [id3, { kind: ident.kind }]))
|
|
@@ -57358,8 +57453,18 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57358
57453
|
byName: directory2.byName,
|
|
57359
57454
|
byUserId: (userId) => directory2.byId.get(ZulipUserRef(userId))
|
|
57360
57455
|
});
|
|
57456
|
+
const notifiableMentionDirectory = (directory2) => {
|
|
57457
|
+
const isActive2 = (identity7) => identity7 !== undefined && directory2.active.has(identity7.id);
|
|
57458
|
+
return {
|
|
57459
|
+
byName: new Map([...directory2.byName].filter(([, identity7]) => isActive2(identity7))),
|
|
57460
|
+
byUserId: (userId) => {
|
|
57461
|
+
const identity7 = directory2.byId.get(ZulipUserRef(userId));
|
|
57462
|
+
return isActive2(identity7) ? identity7 : undefined;
|
|
57463
|
+
}
|
|
57464
|
+
};
|
|
57465
|
+
};
|
|
57361
57466
|
const validateOutboundMentions = (operation, body) => !mentionTokens(body).some(MentionToken.$is("UserToken")) ? exports_Effect.void : buildDirectoryLookup().pipe(exports_Effect.flatMap((directory2) => {
|
|
57362
|
-
const dead = unresolvedMentions(body,
|
|
57467
|
+
const dead = unresolvedMentions(body, notifiableMentionDirectory(directory2));
|
|
57363
57468
|
return dead.length === 0 ? exports_Effect.void : exports_Effect.fail(new UnresolvedMention({ operation, tokens: dead, substrate: "zulip" }));
|
|
57364
57469
|
}));
|
|
57365
57470
|
const mapHistoricalReactions = (raw3, directory2) => exports_Effect.gen(function* () {
|
|
@@ -57522,7 +57627,7 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57522
57627
|
})).pipe(exports_Effect.asVoid),
|
|
57523
57628
|
resolve: (name) => minterHttp.get("/users", usersSchema).pipe(exports_Effect.flatMap((res) => exports_Array.findFirst(res.members, (u) => u.is_active && u.full_name === name).pipe(exports_Option.match({
|
|
57524
57629
|
onNone: () => exports_Effect.succeed(exports_Option.none()),
|
|
57525
|
-
onSome: (match23) => toIdentity(match23).pipe(exports_Effect.
|
|
57630
|
+
onSome: (match23) => toIdentity(match23).pipe(exports_Effect.asSome)
|
|
57526
57631
|
}))), exports_Effect.mapError((cause3) => new IdentityError({ operation: "resolve", cause: cause3 })))
|
|
57527
57632
|
};
|
|
57528
57633
|
const directory = {
|
|
@@ -57587,14 +57692,14 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57587
57692
|
const lookupChannel = (name) => exports_Ref.get(knownStreamsRef).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
57588
57693
|
onNone: () => refreshKnownStreams(),
|
|
57589
57694
|
onSome: exports_Effect.succeed
|
|
57590
|
-
})), exports_Effect.
|
|
57695
|
+
})), exports_Effect.filterOrElse((map32) => map32.has(name), () => refreshKnownStreams()), exports_Effect.map((map32) => exports_Option.fromNullable(map32.get(name))));
|
|
57591
57696
|
const resolvePublishChannel = (requested) => lookupChannel(requested).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
57592
57697
|
onNone: () => exports_Effect.fail(new UnknownChannel({ channel: requested, substrate: "zulip" })),
|
|
57593
57698
|
onSome: exports_Effect.succeed
|
|
57594
57699
|
})));
|
|
57595
57700
|
const fetchChannelDescription = (channel) => minterHttp.get(`/streams/${encodeURIComponent(channel.id)}`, streamResponseSchema).pipe(exports_Effect.flatMap((res) => exports_Option.match(fromWireDescription(res.stream.description), {
|
|
57596
57701
|
onNone: () => exports_Effect.succeed(exports_Option.none()),
|
|
57597
|
-
onSome: (raw3) => decodeChannelDescription(raw3).pipe(exports_Effect.
|
|
57702
|
+
onSome: (raw3) => decodeChannelDescription(raw3).pipe(exports_Effect.asSome)
|
|
57598
57703
|
})));
|
|
57599
57704
|
const setChannelDescription = (channel, description) => resolvePublishChannel(channel).pipe(exports_Effect.flatMap((channelRef) => exports_Option.match(exports_Option.flatMap(description, (text3) => rejectionFor(channelRef.name, text3)), {
|
|
57600
57705
|
onSome: (rejection) => exports_Effect.fail(rejection),
|
|
@@ -57612,7 +57717,7 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57612
57717
|
apply_markdown: false
|
|
57613
57718
|
}).pipe(exports_Effect.flatMap((res) => exports_Array.last(res.messages).pipe(exports_Option.match({
|
|
57614
57719
|
onNone: () => exports_Effect.succeed(exports_Option.none()),
|
|
57615
|
-
onSome: (m) => decodeMessageId(String(m.id)).pipe(exports_Effect.
|
|
57720
|
+
onSome: (m) => decodeMessageId(String(m.id)).pipe(exports_Effect.asSome)
|
|
57616
57721
|
}))));
|
|
57617
57722
|
const setThreadResolved = (channel, thread, resolved) => {
|
|
57618
57723
|
const operation = resolved ? "resolveThread" : "unresolveThread";
|
|
@@ -57821,7 +57926,7 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57821
57926
|
{ operator: "channel", operand: channel },
|
|
57822
57927
|
{ operator: "topic", operand: topic }
|
|
57823
57928
|
]);
|
|
57824
|
-
return readTopic(threadName3).pipe(exports_Effect.
|
|
57929
|
+
return readTopic(threadName3).pipe(exports_Effect.filterOrElse((messages) => messages.length > 0, () => readTopic(applyResolvedPrefix(threadName3, true))), exports_Effect.mapError((cause3) => new HistoryError({ operation: "readThread", cause: cause3 })));
|
|
57825
57930
|
},
|
|
57826
57931
|
recentThreads: (sender, opts) => {
|
|
57827
57932
|
const limit = opts?.limit ?? RECENT_THREADS_DEFAULT_LIMIT;
|
|
@@ -57890,7 +57995,7 @@ var buildQueueStateHooks = (deps) => {
|
|
|
57890
57995
|
queueIdleTimeoutSecs: idleTimeoutSecs,
|
|
57891
57996
|
onQueueRegister: (queue) => withSession((id3) => exports_Deferred.poll(resumeOutcome).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
57892
57997
|
onSome: () => store.write(id3, queue),
|
|
57893
|
-
onNone: () => store.read(id3).pipe(exports_Effect.map(exports_Option.isNone), exports_Effect.
|
|
57998
|
+
onNone: () => store.read(id3).pipe(exports_Effect.map(exports_Option.isNone), exports_Effect.orElseSucceed(() => true), exports_Effect.flatMap((isFresh3) => isFresh3 ? store.write(id3, queue) : exports_Effect.void))
|
|
57894
57999
|
})), exports_Effect.catchAllCause(() => exports_Effect.void))),
|
|
57895
58000
|
onQueueAdvance: (lastEventId) => withSession((id3) => store.advance(id3, lastEventId).pipe(exports_Effect.catchAllCause(() => exports_Effect.void))),
|
|
57896
58001
|
resumeQueue: () => exports_Deferred.poll(session).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
@@ -57912,7 +58017,7 @@ var QueueStateFileSchema = exports_Schema.parseJson(exports_Schema.Struct({ queu
|
|
|
57912
58017
|
var decodeQueueStateFile = exports_Schema.decodeUnknown(QueueStateFileSchema);
|
|
57913
58018
|
var encodeQueueStateFile = exports_Schema.encode(QueueStateFileSchema);
|
|
57914
58019
|
var isNotFound = (error2) => error2._tag === "SystemError" && error2.reason === "NotFound";
|
|
57915
|
-
var readState = (fs, path) => fs.readFileString(path).pipe(exports_Effect.flatMap(decodeQueueStateFile), exports_Effect.
|
|
58020
|
+
var readState = (fs, path) => fs.readFileString(path).pipe(exports_Effect.flatMap(decodeQueueStateFile), exports_Effect.asSome, exports_Effect.catchIf(isNotFound, () => exports_Effect.succeed(exports_Option.none())));
|
|
57916
58021
|
var createFileQueueStateStore = (deps) => {
|
|
57917
58022
|
const { dir, fs } = deps;
|
|
57918
58023
|
const pathFor = (id3) => join7(dir, stateFilename(id3));
|
|
@@ -58191,7 +58296,7 @@ var basename2 = (path) => {
|
|
|
58191
58296
|
};
|
|
58192
58297
|
var deriveProject = (deps) => {
|
|
58193
58298
|
if (deps.project !== undefined) {
|
|
58194
|
-
return exports_Effect.
|
|
58299
|
+
return exports_Effect.succeedSome(deps.project);
|
|
58195
58300
|
}
|
|
58196
58301
|
return exports_Effect.map(deps.readGitContext(deps.cwd), (context9) => matchGitContext(context9, {
|
|
58197
58302
|
NotInRepo: () => exports_Option.none(),
|
|
@@ -58201,7 +58306,7 @@ var deriveProject = (deps) => {
|
|
|
58201
58306
|
})
|
|
58202
58307
|
}));
|
|
58203
58308
|
};
|
|
58204
|
-
var gitStdout = (cwd, args2) => exports_Command.make("git", "-C", cwd, ...args2).pipe(exports_Command.stderr("pipe"), exports_Command.string, exports_Effect.map((out) => out.trim()), exports_Effect.
|
|
58309
|
+
var gitStdout = (cwd, args2) => exports_Command.make("git", "-C", cwd, ...args2).pipe(exports_Command.stderr("pipe"), exports_Command.string, exports_Effect.map((out) => out.trim()), exports_Effect.orElseSucceed(() => ""));
|
|
58205
58310
|
var readGitContext = (cwd) => exports_Effect.gen(function* () {
|
|
58206
58311
|
const gitRoot = yield* gitStdout(cwd, ["rev-parse", "--show-toplevel"]);
|
|
58207
58312
|
if (gitRoot.length === 0)
|
|
@@ -58359,7 +58464,7 @@ var catchUpChannels = (deps) => exports_Effect.gen(function* () {
|
|
|
58359
58464
|
const since = yield* clampedSince(now2, deps.windowSeconds);
|
|
58360
58465
|
const newTopicsSince = yield* clampedSince(now2, deps.newTopicsWindowSeconds ?? deps.windowSeconds);
|
|
58361
58466
|
const batches = yield* exports_Effect.forEach(deps.intents, (intent) => fetchForIntent(intent, deps.history, since, newTopicsSince).pipe(catchUpAt("history")), { concurrency: 2 });
|
|
58362
|
-
const messages = exports_Array.sort(exports_Array.flatten(batches), exports_Order.mapInput(exports_Order.number, (m) => m.ts));
|
|
58467
|
+
const messages = exports_Array.sort(exports_Array.filter(exports_Array.flatten(batches), (m) => m.sender.id !== deps.botIdentityId), exports_Order.mapInput(exports_Order.number, (m) => m.ts));
|
|
58363
58468
|
yield* exports_Effect.forEach(messages, (message) => exports_Effect.tryPromise({
|
|
58364
58469
|
try: () => deps.notifier(formatMessage({ kind: "message-posted", message }, deps.botIdentityId)),
|
|
58365
58470
|
catch: (cause3) => new CatchUpError({ stage: "dispatch", cause: cause3 })
|
|
@@ -58547,8 +58652,7 @@ var createSingleIdentityCache = (deps) => {
|
|
|
58547
58652
|
const current2 = ensureBound.current();
|
|
58548
58653
|
return current2 === undefined ? new Set : new Set([current2.identity.id]);
|
|
58549
58654
|
},
|
|
58550
|
-
releaseAllBound: () => exports_Effect.void
|
|
58551
|
-
sweepIdle: () => exports_Effect.void
|
|
58655
|
+
releaseAllBound: () => exports_Effect.void
|
|
58552
58656
|
};
|
|
58553
58657
|
};
|
|
58554
58658
|
var unboundStub = Object.assign(() => exports_Effect.fail(new UnboundEphemeralSession({
|
|
@@ -58563,24 +58667,23 @@ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_Synchron
|
|
|
58563
58667
|
});
|
|
58564
58668
|
const afterAcquireFor = (project3, sessionId) => (acquired) => deps.onAcquire !== undefined ? deps.onAcquire(acquired, project3, sessionId) : exports_Effect.void;
|
|
58565
58669
|
const acquireForTransition = (priorEnsure) => (n) => priorEnsure.current() !== undefined ? deps.release().pipe(exports_Effect.zipRight(deps.acquire(n))) : deps.acquire(n);
|
|
58566
|
-
const mintSlot = (sessionId, project3,
|
|
58670
|
+
const mintSlot = (sessionId, project3, prior) => {
|
|
58567
58671
|
const name = deriveBotName(sessionId, project3);
|
|
58568
58672
|
const acquire = prior !== undefined ? acquireForTransition(prior.ensureBound) : deps.acquire;
|
|
58569
58673
|
return createEnsureBound({
|
|
58570
58674
|
acquire,
|
|
58571
58675
|
name,
|
|
58572
58676
|
afterAcquire: afterAcquireFor(project3, sessionId)
|
|
58573
|
-
}).pipe(exports_Effect.map((ensureBound) => [ensureBound, { sessionId, ensureBound
|
|
58677
|
+
}).pipe(exports_Effect.map((ensureBound) => [ensureBound, { sessionId, ensureBound }]));
|
|
58574
58678
|
};
|
|
58575
58679
|
const releaseBoundSlot = exports_SynchronizedRef.updateEffect(slotRef, (slot) => exports_Effect.as(slot !== undefined && slot.ensureBound.current() !== undefined ? deps.release() : exports_Effect.void, undefined));
|
|
58576
58680
|
return {
|
|
58577
|
-
ensureBoundFor: (sessionId, project3) => sessionId === undefined ? exports_Effect.succeed(unboundStub) :
|
|
58681
|
+
ensureBoundFor: (sessionId, project3) => sessionId === undefined ? exports_Effect.succeed(unboundStub) : exports_SynchronizedRef.modifyEffect(slotRef, (slot) => {
|
|
58578
58682
|
if (slot !== undefined && slot.sessionId === sessionId) {
|
|
58579
|
-
|
|
58580
|
-
return exports_Effect.succeed([slot.ensureBound, bumped]);
|
|
58683
|
+
return exports_Effect.succeed([slot.ensureBound, slot]);
|
|
58581
58684
|
}
|
|
58582
|
-
return mintSlot(sessionId, project3,
|
|
58583
|
-
})
|
|
58685
|
+
return mintSlot(sessionId, project3, slot);
|
|
58686
|
+
}),
|
|
58584
58687
|
boundIdentityIds: () => {
|
|
58585
58688
|
const slot = exports_Effect.runSync(exports_SynchronizedRef.get(slotRef));
|
|
58586
58689
|
if (slot === undefined)
|
|
@@ -58588,11 +58691,10 @@ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_Synchron
|
|
|
58588
58691
|
const current2 = slot.ensureBound.current();
|
|
58589
58692
|
return current2 === undefined ? new Set : new Set([current2.identity.id]);
|
|
58590
58693
|
},
|
|
58591
|
-
releaseAllBound: () => releaseBoundSlot
|
|
58592
|
-
sweepIdle: (nowMs) => exports_SynchronizedRef.updateEffect(slotRef, (slot) => slot !== undefined && slot.ensureBound.current() !== undefined && nowMs - slot.lastUsedMs > deps.idleReleaseMs ? exports_Effect.as(deps.release(), undefined) : exports_Effect.succeed(slot))
|
|
58694
|
+
releaseAllBound: () => releaseBoundSlot
|
|
58593
58695
|
};
|
|
58594
58696
|
});
|
|
58595
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
58697
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
58596
58698
|
function isZ4Schema(s) {
|
|
58597
58699
|
const schema = s;
|
|
58598
58700
|
return !!schema._zod;
|
|
@@ -58655,7 +58757,7 @@ function getLiteralValue(schema) {
|
|
|
58655
58757
|
return;
|
|
58656
58758
|
}
|
|
58657
58759
|
|
|
58658
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
58760
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
58659
58761
|
function isTerminal(status3) {
|
|
58660
58762
|
return status3 === "completed" || status3 === "failed" || status3 === "cancelled";
|
|
58661
58763
|
}
|
|
@@ -58664,7 +58766,7 @@ function isTerminal(status3) {
|
|
|
58664
58766
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
58665
58767
|
// node_modules/.bun/zod-to-json-schema@3.25.2+68a1e3a0c4588df3/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
58666
58768
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
58667
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
58769
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
58668
58770
|
function getMethodLiteral(schema) {
|
|
58669
58771
|
const shape = getObjectShape(schema);
|
|
58670
58772
|
const methodSchema = shape?.method;
|
|
@@ -58685,7 +58787,7 @@ function parseWithCompat(schema, data) {
|
|
|
58685
58787
|
return result.data;
|
|
58686
58788
|
}
|
|
58687
58789
|
|
|
58688
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
58790
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
58689
58791
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
58690
58792
|
|
|
58691
58793
|
class Protocol {
|
|
@@ -59526,7 +59628,7 @@ function mergeCapabilities(base, additional) {
|
|
|
59526
59628
|
return result;
|
|
59527
59629
|
}
|
|
59528
59630
|
|
|
59529
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
59631
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
59530
59632
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
59531
59633
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
59532
59634
|
function createDefaultAjvInstance() {
|
|
@@ -59566,7 +59668,7 @@ class AjvJsonSchemaValidator {
|
|
|
59566
59668
|
}
|
|
59567
59669
|
}
|
|
59568
59670
|
|
|
59569
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
59671
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
59570
59672
|
class ExperimentalServerTasks {
|
|
59571
59673
|
constructor(_server) {
|
|
59572
59674
|
this._server = _server;
|
|
@@ -59644,7 +59746,7 @@ class ExperimentalServerTasks {
|
|
|
59644
59746
|
}
|
|
59645
59747
|
}
|
|
59646
59748
|
|
|
59647
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
59749
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
59648
59750
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
59649
59751
|
if (!requests) {
|
|
59650
59752
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -59679,7 +59781,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
59679
59781
|
}
|
|
59680
59782
|
}
|
|
59681
59783
|
|
|
59682
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
59784
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
59683
59785
|
class Server extends Protocol {
|
|
59684
59786
|
constructor(_serverInfo, options5) {
|
|
59685
59787
|
super(options5);
|
|
@@ -59727,16 +59829,7 @@ class Server extends Protocol {
|
|
|
59727
59829
|
if (!methodSchema) {
|
|
59728
59830
|
throw new Error("Schema is missing a method literal");
|
|
59729
59831
|
}
|
|
59730
|
-
|
|
59731
|
-
if (isZ4Schema(methodSchema)) {
|
|
59732
|
-
const v4Schema = methodSchema;
|
|
59733
|
-
const v4Def = v4Schema._zod?.def;
|
|
59734
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
59735
|
-
} else {
|
|
59736
|
-
const v3Schema = methodSchema;
|
|
59737
|
-
const legacyDef = v3Schema._def;
|
|
59738
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
59739
|
-
}
|
|
59832
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
59740
59833
|
if (typeof methodValue !== "string") {
|
|
59741
59834
|
throw new Error("Schema method literal must be a string");
|
|
59742
59835
|
}
|
|
@@ -60013,7 +60106,7 @@ class Server extends Protocol {
|
|
|
60013
60106
|
}
|
|
60014
60107
|
|
|
60015
60108
|
// packages/mcp/mcp-server.ts
|
|
60016
|
-
var PLUGIN_VERSION = "0.24.
|
|
60109
|
+
var PLUGIN_VERSION = "0.24.2";
|
|
60017
60110
|
var COMMY_INSTRUCTIONS = `**Substrate.** commy is the inter-agent channel: agents and humans coordinate here. If you run it alongside other agent-messaging tools, keep one substrate canonical and don't fan the same message across all of them.
|
|
60018
60111
|
|
|
60019
60112
|
**Channels.** Each project has one channel: \`#<project-slug>\` where the slug is resolved per session as \`COMMY_PROJECT\` env > git remote \`origin\` basename > git root basename. Sessions launched outside a git repo (e.g. \`/tmp\`, \`$HOME\`) have no project channel and should post to \`#general\` instead. Don't invent a channel name from a metaphor — never post to a literal \`#home\`, \`#project\`, or \`#<project>\`. Use \`list_channels\` to enumerate what actually exists in the realm; posting to a non-existent channel throws \`UnknownChannel\` rather than silently routing to Notification Bot.
|
|
@@ -60167,7 +60260,7 @@ var subscriptionFilename = (id3) => {
|
|
|
60167
60260
|
return `${safe}.json`;
|
|
60168
60261
|
};
|
|
60169
60262
|
var isNotFound3 = (error2) => error2._tag === "SystemError" && error2.reason === "NotFound";
|
|
60170
|
-
var readSubscriptions = (fs, id3, path) => fs.readFileString(path).pipe(exports_Effect.flatMap((raw3) => decodeSubscriptionsFile(id3, raw3)), exports_Effect.
|
|
60263
|
+
var readSubscriptions = (fs, id3, path) => fs.readFileString(path).pipe(exports_Effect.flatMap((raw3) => decodeSubscriptionsFile(id3, raw3)), exports_Effect.asSome, exports_Effect.catchIf(isNotFound3, () => exports_Effect.succeed(exports_Option.none())));
|
|
60171
60264
|
var createFileSubscriptionStore = (deps) => {
|
|
60172
60265
|
const { dir, fs, session } = deps;
|
|
60173
60266
|
const pathFor = (id3) => join9(dir, subscriptionFilename(id3));
|
|
@@ -60358,7 +60451,7 @@ var DownloadFileArgs = exports_Schema.Struct({ url_path: exports_Schema.String }
|
|
|
60358
60451
|
var UploadFileArgs = exports_Schema.Struct({ path: exports_Schema.String });
|
|
60359
60452
|
var buildToolDefs = (deps, cache) => {
|
|
60360
60453
|
const { adapter: adapter4, identityCache, narrowSet } = deps;
|
|
60361
|
-
const projectForCwd = deps.projectForCwd ?? (() => exports_Effect.
|
|
60454
|
+
const projectForCwd = deps.projectForCwd ?? (() => exports_Effect.succeedNone);
|
|
60362
60455
|
const hostSuppliedSessionId = ["session_id"];
|
|
60363
60456
|
const cwdField = {
|
|
60364
60457
|
type: "string",
|
|
@@ -60373,7 +60466,10 @@ var buildToolDefs = (deps, cache) => {
|
|
|
60373
60466
|
const projectForArgs = (args2) => projectForCwd(readCwd(args2));
|
|
60374
60467
|
const runFor = (args2) => (effect4) => {
|
|
60375
60468
|
const sessionId = readSessionId(args2);
|
|
60376
|
-
return runEdge(projectForArgs(args2).pipe(exports_Effect.flatMap((project3) => feedSession(sessionId).pipe(exports_Effect.zipRight(withSessionContext(effect4, {
|
|
60469
|
+
return runEdge(projectForArgs(args2).pipe(exports_Effect.flatMap((project3) => feedSession(sessionId).pipe(exports_Effect.zipRight(withSessionContext(effect4, {
|
|
60470
|
+
sessionId,
|
|
60471
|
+
project: exports_Option.getOrUndefined(project3)
|
|
60472
|
+
}))))));
|
|
60377
60473
|
};
|
|
60378
60474
|
const stickyThreadEngagement = async (run6, channel, threadName3) => {
|
|
60379
60475
|
if (exports_Option.isNone(threadName3))
|
|
@@ -60656,7 +60752,7 @@ var buildToolDefs = (deps, cache) => {
|
|
|
60656
60752
|
const intent = yield* parseSubscribeTarget(raw3);
|
|
60657
60753
|
const sessionId = readSessionId(args2);
|
|
60658
60754
|
if (sessionId !== undefined && deps.ensureSessionSubscriptions !== undefined) {
|
|
60659
|
-
yield* deps.ensureSessionSubscriptions(sessionId, yield* projectForArgs(args2));
|
|
60755
|
+
yield* deps.ensureSessionSubscriptions(sessionId, exports_Option.getOrUndefined(yield* projectForArgs(args2)));
|
|
60660
60756
|
}
|
|
60661
60757
|
yield* exports_Effect.sync(() => narrowSet.add(intent)).pipe(exports_Effect.andThen(adapter4.inbox.subscribe(intentToTarget(intent))));
|
|
60662
60758
|
if (deps.persistSessionSubscriptions !== undefined) {
|
|
@@ -60689,7 +60785,7 @@ var buildToolDefs = (deps, cache) => {
|
|
|
60689
60785
|
const intent = yield* parseSubscribeTarget(raw3);
|
|
60690
60786
|
const sessionId = readSessionId(args2);
|
|
60691
60787
|
if (sessionId !== undefined && deps.ensureSessionSubscriptions !== undefined) {
|
|
60692
|
-
yield* deps.ensureSessionSubscriptions(sessionId, yield* projectForArgs(args2));
|
|
60788
|
+
yield* deps.ensureSessionSubscriptions(sessionId, exports_Option.getOrUndefined(yield* projectForArgs(args2)));
|
|
60693
60789
|
}
|
|
60694
60790
|
yield* exports_Effect.sync(() => narrowSet.remove(intent)).pipe(exports_Effect.andThen(adapter4.inbox.unsubscribe(intentToTarget(intent))));
|
|
60695
60791
|
if (deps.persistSessionSubscriptions !== undefined) {
|
|
@@ -61020,12 +61116,6 @@ var registerTools = (server, deps) => {
|
|
|
61020
61116
|
class BootError extends exports_Data.TaggedError("BootError") {
|
|
61021
61117
|
}
|
|
61022
61118
|
var RELEASE_TIMEOUT_MS = 5000;
|
|
61023
|
-
var EPHEMERAL_IDLE_RELEASE_MS = 60 * 60 * 1000;
|
|
61024
|
-
var EPHEMERAL_IDLE_SWEEP_INTERVAL_MS = 5 * 60 * 1000;
|
|
61025
|
-
var forkIdleSweep = (cache, intervalMs) => {
|
|
61026
|
-
const sweep = exports_Clock.currentTimeMillis.pipe(exports_Effect.flatMap((nowMs) => cache.sweepIdle(nowMs)));
|
|
61027
|
-
return exports_Effect.asVoid(exports_Effect.forkScoped(exports_Effect.repeat(sweep, exports_Schedule.spaced(exports_Duration.millis(intervalMs)))));
|
|
61028
|
-
};
|
|
61029
61119
|
var createType2DefaultsOnAcquire = (narrowSet, inbox) => {
|
|
61030
61120
|
const registerIntent = (intent) => exports_Effect.sync(() => narrowSet.add(intent)).pipe(exports_Effect.zipRight(inbox.subscribe(intentToTarget(intent))));
|
|
61031
61121
|
return (project3) => (project3 !== undefined ? exports_Effect.all([decodeChannelName(project3), decodeThreadName("general")]).pipe(exports_Effect.flatMap(([channelName, threadName3]) => registerIntent({ kind: "thread", channelName, threadName: threadName3 }))) : exports_Effect.void).pipe(exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: Type-2 default narrow registration failed: ${exports_Cause.pretty(exports_Cause.fail(err))}`)));
|
|
@@ -61047,7 +61137,6 @@ var buildIdentityCache = (adapter4, botName, ephemeralOnAcquire) => {
|
|
|
61047
61137
|
return createEphemeralIdentityCache({
|
|
61048
61138
|
acquire: adapter4.identity.acquire,
|
|
61049
61139
|
release: adapter4.identity.release,
|
|
61050
|
-
idleReleaseMs: EPHEMERAL_IDLE_RELEASE_MS,
|
|
61051
61140
|
...ephemeralOnAcquire !== undefined ? { onAcquire: ephemeralOnAcquire } : {}
|
|
61052
61141
|
});
|
|
61053
61142
|
};
|
|
@@ -61065,7 +61154,7 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61065
61154
|
}));
|
|
61066
61155
|
const reportNothingToResume = parsed.botName !== undefined ? exports_Effect.void : exports_Deferred.poll(sessionIdDeferred).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
61067
61156
|
onNone: () => exports_Effect.void,
|
|
61068
|
-
onSome: (awaitId) => exports_Effect.flatMap(awaitId, (sessionId) => queueStateStore.read(sessionId).pipe(exports_Effect.map(exports_Option.isNone), exports_Effect.
|
|
61157
|
+
onSome: (awaitId) => exports_Effect.flatMap(awaitId, (sessionId) => queueStateStore.read(sessionId).pipe(exports_Effect.map(exports_Option.isNone), exports_Effect.orElseSucceed(() => true), exports_Effect.flatMap((nothingPersisted) => nothingPersisted ? exports_Deferred.succeed(resumeOutcome, false).pipe(exports_Effect.asVoid) : exports_Effect.void)))
|
|
61069
61158
|
})));
|
|
61070
61159
|
yield* reportNothingToResume;
|
|
61071
61160
|
const feedSessionId = (sessionId) => exports_Deferred.succeed(sessionIdDeferred, sessionId).pipe(exports_Effect.asVoid);
|
|
@@ -61086,10 +61175,10 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61086
61175
|
const logSettingsFailure = (label) => (cause3) => exports_Effect.logWarning(`commy plugin: ${label} failed: ${exports_Cause.pretty(cause3)}`);
|
|
61087
61176
|
const projectForCwd = (cwd) => {
|
|
61088
61177
|
if (parsed.project !== undefined)
|
|
61089
|
-
return exports_Effect.
|
|
61178
|
+
return exports_Effect.succeedSome(parsed.project);
|
|
61090
61179
|
if (cwd === undefined)
|
|
61091
|
-
return exports_Effect.
|
|
61092
|
-
return
|
|
61180
|
+
return exports_Effect.succeedNone;
|
|
61181
|
+
return deriveProject({ cwd, readGitContext: readGitContext2 });
|
|
61093
61182
|
};
|
|
61094
61183
|
const canEditMessages = yield* adapter4.publisher.editingAvailable().pipe(exports_Effect.catchAll((error2) => exports_Effect.logWarning(`commy plugin: could not read the realm's message-editing setting (${error2.message}); offering edit_message and letting the substrate refuse if it is off`).pipe(exports_Effect.as(true))));
|
|
61095
61184
|
const narrowSet = createNarrowSet();
|
|
@@ -61097,12 +61186,12 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61097
61186
|
const notifier = params.notifier ?? channelNotifier(mcp);
|
|
61098
61187
|
const registerType2Defaults = parsed.botName === undefined ? createType2DefaultsOnAcquire(narrowSet, adapter4.inbox) : undefined;
|
|
61099
61188
|
const persistedTopicIntents = parsed.botName === undefined ? subscriptionStore.read() : exports_Effect.succeedNone;
|
|
61100
|
-
const rebuildNarrowSet = (parsed.botName === undefined ? exports_Deferred.await(sessionIdDeferred).pipe(exports_Effect.
|
|
61189
|
+
const rebuildNarrowSet = (parsed.botName === undefined ? exports_Deferred.await(sessionIdDeferred).pipe(exports_Effect.asSome) : exports_Effect.succeedNone).pipe(exports_Effect.flatMap((sessionId) => withSessionContext(restoreSubscriptions({
|
|
61101
61190
|
persisted: persistedTopicIntents,
|
|
61102
61191
|
isBound: () => identityCache.boundIdentityIds().size > 0,
|
|
61103
61192
|
narrowSet,
|
|
61104
61193
|
inbox: adapter4.inbox
|
|
61105
|
-
}), { sessionId, project: parsed.project })), exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: could not rebuild the subscription set: ${exports_Predicate.isError(err) ? err.message : String(err)}`).pipe(exports_Effect.zipRight(exports_Effect.sync(() => narrowSet.load(exports_Option.none()))))), exports_Effect.provide(loggerLayer));
|
|
61194
|
+
}), { sessionId: exports_Option.getOrUndefined(sessionId), project: parsed.project })), exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: could not rebuild the subscription set: ${exports_Predicate.isError(err) ? err.message : String(err)}`).pipe(exports_Effect.zipRight(exports_Effect.sync(() => narrowSet.load(exports_Option.none()))))), exports_Effect.provide(loggerLayer));
|
|
61106
61195
|
const seedDefaults = (project3) => registerType2Defaults !== undefined ? registerType2Defaults(project3) : exports_Effect.void;
|
|
61107
61196
|
const seedIfFresh = (sessionId, project3) => parsed.botName !== undefined ? exports_Effect.void : seedDefaultsIfFresh({ subscriptionStore, registerDefaults: seedDefaults }, project3).pipe(exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: subscription seed check failed for ${sessionId}: ${exports_Predicate.isError(err) ? err.message : String(err)}`).pipe(exports_Effect.zipRight(seedDefaults(project3)))), exports_Effect.provide(loggerLayer));
|
|
61108
61197
|
const ensureSessionSubscriptions = (sessionId, project3) => seedIfFresh(sessionId, project3);
|
|
@@ -61154,7 +61243,6 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61154
61243
|
}
|
|
61155
61244
|
const releasePersistent = parsed.botName !== undefined;
|
|
61156
61245
|
yield* exports_Effect.addFinalizer(() => identityCache.boundIdentityIds().size > 0 ? raceReleaseAgainstTimeout(adapter4.identity.release({ persistent: releasePersistent }), RELEASE_TIMEOUT_MS) : exports_Effect.void);
|
|
61157
|
-
const runsIdleSweep = parsed.botName === undefined;
|
|
61158
61246
|
const bootSessionId = yield* exports_Deferred.poll(sessionIdDeferred).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
61159
61247
|
onNone: () => exports_Effect.succeedNone,
|
|
61160
61248
|
onSome: (awaitId) => exports_Effect.asSome(awaitId)
|
|
@@ -61233,9 +61321,6 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61233
61321
|
onRealmSettings: (settings) => exports_Effect.sync(() => toolsCache.setEditingAvailable(settings.editingAvailable)).pipe(exports_Effect.zipRight(exports_Effect.promise(() => mcp.sendToolListChanged()).pipe(exports_Effect.catchAllCause(logSettingsFailure(`tools/list_changed after editing=${settings.editingAvailable}`)))))
|
|
61234
61322
|
});
|
|
61235
61323
|
yield* exports_Effect.addFinalizer(() => pump.cancel);
|
|
61236
|
-
if (runsIdleSweep) {
|
|
61237
|
-
yield* forkIdleSweep(identityCache, EPHEMERAL_IDLE_SWEEP_INTERVAL_MS);
|
|
61238
|
-
}
|
|
61239
61324
|
yield* exports_Effect.forkScoped(rebuildNarrowSet);
|
|
61240
61325
|
yield* exports_Effect.raceFirst(pump.done, params.shutdownSignal ?? exports_Effect.never);
|
|
61241
61326
|
}));
|
|
@@ -61269,7 +61354,6 @@ if (__require.main == __require.module) {
|
|
|
61269
61354
|
export {
|
|
61270
61355
|
makeProgram,
|
|
61271
61356
|
main,
|
|
61272
|
-
forkIdleSweep,
|
|
61273
61357
|
clientDisconnect,
|
|
61274
61358
|
PlatformLive,
|
|
61275
61359
|
MainLive,
|