@codeforbreakfast/commy-mcp 0.24.1 → 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 +175 -89
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;
|
|
@@ -57535,7 +57627,7 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57535
57627
|
})).pipe(exports_Effect.asVoid),
|
|
57536
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({
|
|
57537
57629
|
onNone: () => exports_Effect.succeed(exports_Option.none()),
|
|
57538
|
-
onSome: (match23) => toIdentity(match23).pipe(exports_Effect.
|
|
57630
|
+
onSome: (match23) => toIdentity(match23).pipe(exports_Effect.asSome)
|
|
57539
57631
|
}))), exports_Effect.mapError((cause3) => new IdentityError({ operation: "resolve", cause: cause3 })))
|
|
57540
57632
|
};
|
|
57541
57633
|
const directory = {
|
|
@@ -57600,14 +57692,14 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57600
57692
|
const lookupChannel = (name) => exports_Ref.get(knownStreamsRef).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
57601
57693
|
onNone: () => refreshKnownStreams(),
|
|
57602
57694
|
onSome: exports_Effect.succeed
|
|
57603
|
-
})), exports_Effect.
|
|
57695
|
+
})), exports_Effect.filterOrElse((map32) => map32.has(name), () => refreshKnownStreams()), exports_Effect.map((map32) => exports_Option.fromNullable(map32.get(name))));
|
|
57604
57696
|
const resolvePublishChannel = (requested) => lookupChannel(requested).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
57605
57697
|
onNone: () => exports_Effect.fail(new UnknownChannel({ channel: requested, substrate: "zulip" })),
|
|
57606
57698
|
onSome: exports_Effect.succeed
|
|
57607
57699
|
})));
|
|
57608
57700
|
const fetchChannelDescription = (channel) => minterHttp.get(`/streams/${encodeURIComponent(channel.id)}`, streamResponseSchema).pipe(exports_Effect.flatMap((res) => exports_Option.match(fromWireDescription(res.stream.description), {
|
|
57609
57701
|
onNone: () => exports_Effect.succeed(exports_Option.none()),
|
|
57610
|
-
onSome: (raw3) => decodeChannelDescription(raw3).pipe(exports_Effect.
|
|
57702
|
+
onSome: (raw3) => decodeChannelDescription(raw3).pipe(exports_Effect.asSome)
|
|
57611
57703
|
})));
|
|
57612
57704
|
const setChannelDescription = (channel, description) => resolvePublishChannel(channel).pipe(exports_Effect.flatMap((channelRef) => exports_Option.match(exports_Option.flatMap(description, (text3) => rejectionFor(channelRef.name, text3)), {
|
|
57613
57705
|
onSome: (rejection) => exports_Effect.fail(rejection),
|
|
@@ -57625,7 +57717,7 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57625
57717
|
apply_markdown: false
|
|
57626
57718
|
}).pipe(exports_Effect.flatMap((res) => exports_Array.last(res.messages).pipe(exports_Option.match({
|
|
57627
57719
|
onNone: () => exports_Effect.succeed(exports_Option.none()),
|
|
57628
|
-
onSome: (m) => decodeMessageId(String(m.id)).pipe(exports_Effect.
|
|
57720
|
+
onSome: (m) => decodeMessageId(String(m.id)).pipe(exports_Effect.asSome)
|
|
57629
57721
|
}))));
|
|
57630
57722
|
const setThreadResolved = (channel, thread, resolved) => {
|
|
57631
57723
|
const operation = resolved ? "resolveThread" : "unresolveThread";
|
|
@@ -57834,7 +57926,7 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
|
|
|
57834
57926
|
{ operator: "channel", operand: channel },
|
|
57835
57927
|
{ operator: "topic", operand: topic }
|
|
57836
57928
|
]);
|
|
57837
|
-
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 })));
|
|
57838
57930
|
},
|
|
57839
57931
|
recentThreads: (sender, opts) => {
|
|
57840
57932
|
const limit = opts?.limit ?? RECENT_THREADS_DEFAULT_LIMIT;
|
|
@@ -57903,7 +57995,7 @@ var buildQueueStateHooks = (deps) => {
|
|
|
57903
57995
|
queueIdleTimeoutSecs: idleTimeoutSecs,
|
|
57904
57996
|
onQueueRegister: (queue) => withSession((id3) => exports_Deferred.poll(resumeOutcome).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
57905
57997
|
onSome: () => store.write(id3, queue),
|
|
57906
|
-
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))
|
|
57907
57999
|
})), exports_Effect.catchAllCause(() => exports_Effect.void))),
|
|
57908
58000
|
onQueueAdvance: (lastEventId) => withSession((id3) => store.advance(id3, lastEventId).pipe(exports_Effect.catchAllCause(() => exports_Effect.void))),
|
|
57909
58001
|
resumeQueue: () => exports_Deferred.poll(session).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
@@ -57925,7 +58017,7 @@ var QueueStateFileSchema = exports_Schema.parseJson(exports_Schema.Struct({ queu
|
|
|
57925
58017
|
var decodeQueueStateFile = exports_Schema.decodeUnknown(QueueStateFileSchema);
|
|
57926
58018
|
var encodeQueueStateFile = exports_Schema.encode(QueueStateFileSchema);
|
|
57927
58019
|
var isNotFound = (error2) => error2._tag === "SystemError" && error2.reason === "NotFound";
|
|
57928
|
-
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())));
|
|
57929
58021
|
var createFileQueueStateStore = (deps) => {
|
|
57930
58022
|
const { dir, fs } = deps;
|
|
57931
58023
|
const pathFor = (id3) => join7(dir, stateFilename(id3));
|
|
@@ -58204,7 +58296,7 @@ var basename2 = (path) => {
|
|
|
58204
58296
|
};
|
|
58205
58297
|
var deriveProject = (deps) => {
|
|
58206
58298
|
if (deps.project !== undefined) {
|
|
58207
|
-
return exports_Effect.
|
|
58299
|
+
return exports_Effect.succeedSome(deps.project);
|
|
58208
58300
|
}
|
|
58209
58301
|
return exports_Effect.map(deps.readGitContext(deps.cwd), (context9) => matchGitContext(context9, {
|
|
58210
58302
|
NotInRepo: () => exports_Option.none(),
|
|
@@ -58214,7 +58306,7 @@ var deriveProject = (deps) => {
|
|
|
58214
58306
|
})
|
|
58215
58307
|
}));
|
|
58216
58308
|
};
|
|
58217
|
-
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(() => ""));
|
|
58218
58310
|
var readGitContext = (cwd) => exports_Effect.gen(function* () {
|
|
58219
58311
|
const gitRoot = yield* gitStdout(cwd, ["rev-parse", "--show-toplevel"]);
|
|
58220
58312
|
if (gitRoot.length === 0)
|
|
@@ -58602,7 +58694,7 @@ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_Synchron
|
|
|
58602
58694
|
releaseAllBound: () => releaseBoundSlot
|
|
58603
58695
|
};
|
|
58604
58696
|
});
|
|
58605
|
-
// 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
|
|
58606
58698
|
function isZ4Schema(s) {
|
|
58607
58699
|
const schema = s;
|
|
58608
58700
|
return !!schema._zod;
|
|
@@ -58665,7 +58757,7 @@ function getLiteralValue(schema) {
|
|
|
58665
58757
|
return;
|
|
58666
58758
|
}
|
|
58667
58759
|
|
|
58668
|
-
// 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
|
|
58669
58761
|
function isTerminal(status3) {
|
|
58670
58762
|
return status3 === "completed" || status3 === "failed" || status3 === "cancelled";
|
|
58671
58763
|
}
|
|
@@ -58674,7 +58766,7 @@ function isTerminal(status3) {
|
|
|
58674
58766
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
58675
58767
|
// node_modules/.bun/zod-to-json-schema@3.25.2+68a1e3a0c4588df3/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
58676
58768
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
58677
|
-
// 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
|
|
58678
58770
|
function getMethodLiteral(schema) {
|
|
58679
58771
|
const shape = getObjectShape(schema);
|
|
58680
58772
|
const methodSchema = shape?.method;
|
|
@@ -58695,7 +58787,7 @@ function parseWithCompat(schema, data) {
|
|
|
58695
58787
|
return result.data;
|
|
58696
58788
|
}
|
|
58697
58789
|
|
|
58698
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
58790
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
58699
58791
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
58700
58792
|
|
|
58701
58793
|
class Protocol {
|
|
@@ -59536,7 +59628,7 @@ function mergeCapabilities(base, additional) {
|
|
|
59536
59628
|
return result;
|
|
59537
59629
|
}
|
|
59538
59630
|
|
|
59539
|
-
// 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
|
|
59540
59632
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
59541
59633
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
59542
59634
|
function createDefaultAjvInstance() {
|
|
@@ -59576,7 +59668,7 @@ class AjvJsonSchemaValidator {
|
|
|
59576
59668
|
}
|
|
59577
59669
|
}
|
|
59578
59670
|
|
|
59579
|
-
// 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
|
|
59580
59672
|
class ExperimentalServerTasks {
|
|
59581
59673
|
constructor(_server) {
|
|
59582
59674
|
this._server = _server;
|
|
@@ -59654,7 +59746,7 @@ class ExperimentalServerTasks {
|
|
|
59654
59746
|
}
|
|
59655
59747
|
}
|
|
59656
59748
|
|
|
59657
|
-
// 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
|
|
59658
59750
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
59659
59751
|
if (!requests) {
|
|
59660
59752
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -59689,7 +59781,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
59689
59781
|
}
|
|
59690
59782
|
}
|
|
59691
59783
|
|
|
59692
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
59784
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
59693
59785
|
class Server extends Protocol {
|
|
59694
59786
|
constructor(_serverInfo, options5) {
|
|
59695
59787
|
super(options5);
|
|
@@ -59737,16 +59829,7 @@ class Server extends Protocol {
|
|
|
59737
59829
|
if (!methodSchema) {
|
|
59738
59830
|
throw new Error("Schema is missing a method literal");
|
|
59739
59831
|
}
|
|
59740
|
-
|
|
59741
|
-
if (isZ4Schema(methodSchema)) {
|
|
59742
|
-
const v4Schema = methodSchema;
|
|
59743
|
-
const v4Def = v4Schema._zod?.def;
|
|
59744
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
59745
|
-
} else {
|
|
59746
|
-
const v3Schema = methodSchema;
|
|
59747
|
-
const legacyDef = v3Schema._def;
|
|
59748
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
59749
|
-
}
|
|
59832
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
59750
59833
|
if (typeof methodValue !== "string") {
|
|
59751
59834
|
throw new Error("Schema method literal must be a string");
|
|
59752
59835
|
}
|
|
@@ -60023,7 +60106,7 @@ class Server extends Protocol {
|
|
|
60023
60106
|
}
|
|
60024
60107
|
|
|
60025
60108
|
// packages/mcp/mcp-server.ts
|
|
60026
|
-
var PLUGIN_VERSION = "0.24.
|
|
60109
|
+
var PLUGIN_VERSION = "0.24.2";
|
|
60027
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.
|
|
60028
60111
|
|
|
60029
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.
|
|
@@ -60177,7 +60260,7 @@ var subscriptionFilename = (id3) => {
|
|
|
60177
60260
|
return `${safe}.json`;
|
|
60178
60261
|
};
|
|
60179
60262
|
var isNotFound3 = (error2) => error2._tag === "SystemError" && error2.reason === "NotFound";
|
|
60180
|
-
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())));
|
|
60181
60264
|
var createFileSubscriptionStore = (deps) => {
|
|
60182
60265
|
const { dir, fs, session } = deps;
|
|
60183
60266
|
const pathFor = (id3) => join9(dir, subscriptionFilename(id3));
|
|
@@ -60368,7 +60451,7 @@ var DownloadFileArgs = exports_Schema.Struct({ url_path: exports_Schema.String }
|
|
|
60368
60451
|
var UploadFileArgs = exports_Schema.Struct({ path: exports_Schema.String });
|
|
60369
60452
|
var buildToolDefs = (deps, cache) => {
|
|
60370
60453
|
const { adapter: adapter4, identityCache, narrowSet } = deps;
|
|
60371
|
-
const projectForCwd = deps.projectForCwd ?? (() => exports_Effect.
|
|
60454
|
+
const projectForCwd = deps.projectForCwd ?? (() => exports_Effect.succeedNone);
|
|
60372
60455
|
const hostSuppliedSessionId = ["session_id"];
|
|
60373
60456
|
const cwdField = {
|
|
60374
60457
|
type: "string",
|
|
@@ -60383,7 +60466,10 @@ var buildToolDefs = (deps, cache) => {
|
|
|
60383
60466
|
const projectForArgs = (args2) => projectForCwd(readCwd(args2));
|
|
60384
60467
|
const runFor = (args2) => (effect4) => {
|
|
60385
60468
|
const sessionId = readSessionId(args2);
|
|
60386
|
-
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
|
+
}))))));
|
|
60387
60473
|
};
|
|
60388
60474
|
const stickyThreadEngagement = async (run6, channel, threadName3) => {
|
|
60389
60475
|
if (exports_Option.isNone(threadName3))
|
|
@@ -60666,7 +60752,7 @@ var buildToolDefs = (deps, cache) => {
|
|
|
60666
60752
|
const intent = yield* parseSubscribeTarget(raw3);
|
|
60667
60753
|
const sessionId = readSessionId(args2);
|
|
60668
60754
|
if (sessionId !== undefined && deps.ensureSessionSubscriptions !== undefined) {
|
|
60669
|
-
yield* deps.ensureSessionSubscriptions(sessionId, yield* projectForArgs(args2));
|
|
60755
|
+
yield* deps.ensureSessionSubscriptions(sessionId, exports_Option.getOrUndefined(yield* projectForArgs(args2)));
|
|
60670
60756
|
}
|
|
60671
60757
|
yield* exports_Effect.sync(() => narrowSet.add(intent)).pipe(exports_Effect.andThen(adapter4.inbox.subscribe(intentToTarget(intent))));
|
|
60672
60758
|
if (deps.persistSessionSubscriptions !== undefined) {
|
|
@@ -60699,7 +60785,7 @@ var buildToolDefs = (deps, cache) => {
|
|
|
60699
60785
|
const intent = yield* parseSubscribeTarget(raw3);
|
|
60700
60786
|
const sessionId = readSessionId(args2);
|
|
60701
60787
|
if (sessionId !== undefined && deps.ensureSessionSubscriptions !== undefined) {
|
|
60702
|
-
yield* deps.ensureSessionSubscriptions(sessionId, yield* projectForArgs(args2));
|
|
60788
|
+
yield* deps.ensureSessionSubscriptions(sessionId, exports_Option.getOrUndefined(yield* projectForArgs(args2)));
|
|
60703
60789
|
}
|
|
60704
60790
|
yield* exports_Effect.sync(() => narrowSet.remove(intent)).pipe(exports_Effect.andThen(adapter4.inbox.unsubscribe(intentToTarget(intent))));
|
|
60705
60791
|
if (deps.persistSessionSubscriptions !== undefined) {
|
|
@@ -61068,7 +61154,7 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61068
61154
|
}));
|
|
61069
61155
|
const reportNothingToResume = parsed.botName !== undefined ? exports_Effect.void : exports_Deferred.poll(sessionIdDeferred).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
61070
61156
|
onNone: () => exports_Effect.void,
|
|
61071
|
-
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)))
|
|
61072
61158
|
})));
|
|
61073
61159
|
yield* reportNothingToResume;
|
|
61074
61160
|
const feedSessionId = (sessionId) => exports_Deferred.succeed(sessionIdDeferred, sessionId).pipe(exports_Effect.asVoid);
|
|
@@ -61089,10 +61175,10 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61089
61175
|
const logSettingsFailure = (label) => (cause3) => exports_Effect.logWarning(`commy plugin: ${label} failed: ${exports_Cause.pretty(cause3)}`);
|
|
61090
61176
|
const projectForCwd = (cwd) => {
|
|
61091
61177
|
if (parsed.project !== undefined)
|
|
61092
|
-
return exports_Effect.
|
|
61178
|
+
return exports_Effect.succeedSome(parsed.project);
|
|
61093
61179
|
if (cwd === undefined)
|
|
61094
|
-
return exports_Effect.
|
|
61095
|
-
return
|
|
61180
|
+
return exports_Effect.succeedNone;
|
|
61181
|
+
return deriveProject({ cwd, readGitContext: readGitContext2 });
|
|
61096
61182
|
};
|
|
61097
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))));
|
|
61098
61184
|
const narrowSet = createNarrowSet();
|
|
@@ -61100,12 +61186,12 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
|
|
|
61100
61186
|
const notifier = params.notifier ?? channelNotifier(mcp);
|
|
61101
61187
|
const registerType2Defaults = parsed.botName === undefined ? createType2DefaultsOnAcquire(narrowSet, adapter4.inbox) : undefined;
|
|
61102
61188
|
const persistedTopicIntents = parsed.botName === undefined ? subscriptionStore.read() : exports_Effect.succeedNone;
|
|
61103
|
-
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({
|
|
61104
61190
|
persisted: persistedTopicIntents,
|
|
61105
61191
|
isBound: () => identityCache.boundIdentityIds().size > 0,
|
|
61106
61192
|
narrowSet,
|
|
61107
61193
|
inbox: adapter4.inbox
|
|
61108
|
-
}), { 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));
|
|
61109
61195
|
const seedDefaults = (project3) => registerType2Defaults !== undefined ? registerType2Defaults(project3) : exports_Effect.void;
|
|
61110
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));
|
|
61111
61197
|
const ensureSessionSubscriptions = (sessionId, project3) => seedIfFresh(sessionId, project3);
|