ofw-mcp 2.27.4 → 2.27.5
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/dist/bundle.js +697 -615
- package/dist/sync.js +26 -7
- package/dist/tools/_shared.js +29 -0
- package/dist/tools/draft-freshness.js +11 -5
- package/dist/tools/lifecycle.js +4 -1
- package/dist/tools/messages.js +51 -15
- package/dist/tools/project.js +40 -0
- package/dist/tools/reply-source.js +28 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/skills/ofw/SKILL.md +15 -0
package/dist/bundle.js
CHANGED
|
@@ -25,9 +25,9 @@ var __export = (target, all) => {
|
|
|
25
25
|
};
|
|
26
26
|
var __copyProps = (to, from, except, desc) => {
|
|
27
27
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
-
for (let
|
|
29
|
-
if (!__hasOwnProp.call(to,
|
|
30
|
-
__defProp(to,
|
|
28
|
+
for (let key3 of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key3) && key3 !== except)
|
|
30
|
+
__defProp(to, key3, { get: () => from[key3], enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable });
|
|
31
31
|
}
|
|
32
32
|
return to;
|
|
33
33
|
};
|
|
@@ -373,44 +373,44 @@ var require_permessage_deflate = __commonJS({
|
|
|
373
373
|
*/
|
|
374
374
|
normalizeParams(configurations) {
|
|
375
375
|
configurations.forEach((params) => {
|
|
376
|
-
Object.keys(params).forEach((
|
|
377
|
-
let value = params[
|
|
376
|
+
Object.keys(params).forEach((key3) => {
|
|
377
|
+
let value = params[key3];
|
|
378
378
|
if (value.length > 1) {
|
|
379
|
-
throw new Error(`Parameter "${
|
|
379
|
+
throw new Error(`Parameter "${key3}" must have only a single value`);
|
|
380
380
|
}
|
|
381
381
|
value = value[0];
|
|
382
|
-
if (
|
|
382
|
+
if (key3 === "client_max_window_bits") {
|
|
383
383
|
if (value !== true) {
|
|
384
384
|
const num = +value;
|
|
385
385
|
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
386
386
|
throw new TypeError(
|
|
387
|
-
`Invalid value for parameter "${
|
|
387
|
+
`Invalid value for parameter "${key3}": ${value}`
|
|
388
388
|
);
|
|
389
389
|
}
|
|
390
390
|
value = num;
|
|
391
391
|
} else if (!this._isServer) {
|
|
392
392
|
throw new TypeError(
|
|
393
|
-
`Invalid value for parameter "${
|
|
393
|
+
`Invalid value for parameter "${key3}": ${value}`
|
|
394
394
|
);
|
|
395
395
|
}
|
|
396
|
-
} else if (
|
|
396
|
+
} else if (key3 === "server_max_window_bits") {
|
|
397
397
|
const num = +value;
|
|
398
398
|
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
399
399
|
throw new TypeError(
|
|
400
|
-
`Invalid value for parameter "${
|
|
400
|
+
`Invalid value for parameter "${key3}": ${value}`
|
|
401
401
|
);
|
|
402
402
|
}
|
|
403
403
|
value = num;
|
|
404
|
-
} else if (
|
|
404
|
+
} else if (key3 === "client_no_context_takeover" || key3 === "server_no_context_takeover") {
|
|
405
405
|
if (value !== true) {
|
|
406
406
|
throw new TypeError(
|
|
407
|
-
`Invalid value for parameter "${
|
|
407
|
+
`Invalid value for parameter "${key3}": ${value}`
|
|
408
408
|
);
|
|
409
409
|
}
|
|
410
410
|
} else {
|
|
411
|
-
throw new Error(`Unknown parameter "${
|
|
411
|
+
throw new Error(`Unknown parameter "${key3}"`);
|
|
412
412
|
}
|
|
413
|
-
params[
|
|
413
|
+
params[key3] = value;
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
return configurations;
|
|
@@ -458,8 +458,8 @@ var require_permessage_deflate = __commonJS({
|
|
|
458
458
|
_decompress(data, fin, callback) {
|
|
459
459
|
const endpoint = this._isServer ? "client" : "server";
|
|
460
460
|
if (!this._inflate) {
|
|
461
|
-
const
|
|
462
|
-
const windowBits = typeof this.params[
|
|
461
|
+
const key3 = `${endpoint}_max_window_bits`;
|
|
462
|
+
const windowBits = typeof this.params[key3] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key3];
|
|
463
463
|
this._inflate = zlib.createInflateRaw({
|
|
464
464
|
...this._options.zlibInflateOptions,
|
|
465
465
|
windowBits
|
|
@@ -509,8 +509,8 @@ var require_permessage_deflate = __commonJS({
|
|
|
509
509
|
_compress(data, fin, callback) {
|
|
510
510
|
const endpoint = this._isServer ? "server" : "client";
|
|
511
511
|
if (!this._deflate) {
|
|
512
|
-
const
|
|
513
|
-
const windowBits = typeof this.params[
|
|
512
|
+
const key3 = `${endpoint}_max_window_bits`;
|
|
513
|
+
const windowBits = typeof this.params[key3] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key3];
|
|
514
514
|
this._deflate = zlib.createDeflateRaw({
|
|
515
515
|
...this._options.zlibDeflateOptions,
|
|
516
516
|
windowBits
|
|
@@ -2279,7 +2279,7 @@ var require_websocket = __commonJS({
|
|
|
2279
2279
|
var http = __require("http");
|
|
2280
2280
|
var net = __require("net");
|
|
2281
2281
|
var tls = __require("tls");
|
|
2282
|
-
var { randomBytes: randomBytes7, createHash:
|
|
2282
|
+
var { randomBytes: randomBytes7, createHash: createHash8 } = __require("crypto");
|
|
2283
2283
|
var { Duplex, Readable } = __require("stream");
|
|
2284
2284
|
var { URL: URL2 } = __require("url");
|
|
2285
2285
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -2830,7 +2830,7 @@ var require_websocket = __commonJS({
|
|
|
2830
2830
|
}
|
|
2831
2831
|
}
|
|
2832
2832
|
const defaultPort = isSecure ? 443 : 80;
|
|
2833
|
-
const
|
|
2833
|
+
const key3 = randomBytes7(16).toString("base64");
|
|
2834
2834
|
const request = isSecure ? https.request : http.request;
|
|
2835
2835
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
2836
2836
|
let perMessageDeflate;
|
|
@@ -2841,7 +2841,7 @@ var require_websocket = __commonJS({
|
|
|
2841
2841
|
opts.headers = {
|
|
2842
2842
|
...opts.headers,
|
|
2843
2843
|
"Sec-WebSocket-Version": opts.protocolVersion,
|
|
2844
|
-
"Sec-WebSocket-Key":
|
|
2844
|
+
"Sec-WebSocket-Key": key3,
|
|
2845
2845
|
Connection: "Upgrade",
|
|
2846
2846
|
Upgrade: "websocket"
|
|
2847
2847
|
};
|
|
@@ -2892,8 +2892,8 @@ var require_websocket = __commonJS({
|
|
|
2892
2892
|
const headers = options && options.headers;
|
|
2893
2893
|
options = { ...options, headers: {} };
|
|
2894
2894
|
if (headers) {
|
|
2895
|
-
for (const [
|
|
2896
|
-
options.headers[
|
|
2895
|
+
for (const [key4, value] of Object.entries(headers)) {
|
|
2896
|
+
options.headers[key4.toLowerCase()] = value;
|
|
2897
2897
|
}
|
|
2898
2898
|
}
|
|
2899
2899
|
} else if (websocket.listenerCount("redirect") === 0) {
|
|
@@ -2960,7 +2960,7 @@ var require_websocket = __commonJS({
|
|
|
2960
2960
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
2961
2961
|
return;
|
|
2962
2962
|
}
|
|
2963
|
-
const digest =
|
|
2963
|
+
const digest = createHash8("sha1").update(key3 + GUID).digest("base64");
|
|
2964
2964
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
2965
2965
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
2966
2966
|
return;
|
|
@@ -3329,7 +3329,7 @@ var require_websocket_server = __commonJS({
|
|
|
3329
3329
|
var EventEmitter = __require("events");
|
|
3330
3330
|
var http = __require("http");
|
|
3331
3331
|
var { Duplex } = __require("stream");
|
|
3332
|
-
var { createHash:
|
|
3332
|
+
var { createHash: createHash8 } = __require("crypto");
|
|
3333
3333
|
var extension2 = require_extension();
|
|
3334
3334
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
3335
3335
|
var subprotocol2 = require_subprotocol();
|
|
@@ -3528,7 +3528,7 @@ var require_websocket_server = __commonJS({
|
|
|
3528
3528
|
*/
|
|
3529
3529
|
handleUpgrade(req, socket, head, cb) {
|
|
3530
3530
|
socket.on("error", socketOnError);
|
|
3531
|
-
const
|
|
3531
|
+
const key3 = req.headers["sec-websocket-key"];
|
|
3532
3532
|
const upgrade = req.headers.upgrade;
|
|
3533
3533
|
const version2 = +req.headers["sec-websocket-version"];
|
|
3534
3534
|
if (req.method !== "GET") {
|
|
@@ -3541,7 +3541,7 @@ var require_websocket_server = __commonJS({
|
|
|
3541
3541
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3542
3542
|
return;
|
|
3543
3543
|
}
|
|
3544
|
-
if (
|
|
3544
|
+
if (key3 === void 0 || !keyRegex.test(key3)) {
|
|
3545
3545
|
const message = "Missing or invalid Sec-WebSocket-Key header";
|
|
3546
3546
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3547
3547
|
return;
|
|
@@ -3601,7 +3601,7 @@ var require_websocket_server = __commonJS({
|
|
|
3601
3601
|
}
|
|
3602
3602
|
this.completeUpgrade(
|
|
3603
3603
|
extensions,
|
|
3604
|
-
|
|
3604
|
+
key3,
|
|
3605
3605
|
protocols,
|
|
3606
3606
|
req,
|
|
3607
3607
|
socket,
|
|
@@ -3613,7 +3613,7 @@ var require_websocket_server = __commonJS({
|
|
|
3613
3613
|
}
|
|
3614
3614
|
if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
|
|
3615
3615
|
}
|
|
3616
|
-
this.completeUpgrade(extensions,
|
|
3616
|
+
this.completeUpgrade(extensions, key3, protocols, req, socket, head, cb);
|
|
3617
3617
|
}
|
|
3618
3618
|
/**
|
|
3619
3619
|
* Upgrade the connection to WebSocket.
|
|
@@ -3628,7 +3628,7 @@ var require_websocket_server = __commonJS({
|
|
|
3628
3628
|
* @throws {Error} If called more than once with the same socket
|
|
3629
3629
|
* @private
|
|
3630
3630
|
*/
|
|
3631
|
-
completeUpgrade(extensions,
|
|
3631
|
+
completeUpgrade(extensions, key3, protocols, req, socket, head, cb) {
|
|
3632
3632
|
if (!socket.readable || !socket.writable) return socket.destroy();
|
|
3633
3633
|
if (socket[kWebSocket]) {
|
|
3634
3634
|
throw new Error(
|
|
@@ -3636,7 +3636,7 @@ var require_websocket_server = __commonJS({
|
|
|
3636
3636
|
);
|
|
3637
3637
|
}
|
|
3638
3638
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
3639
|
-
const digest =
|
|
3639
|
+
const digest = createHash8("sha1").update(key3 + GUID).digest("base64");
|
|
3640
3640
|
const headers = [
|
|
3641
3641
|
"HTTP/1.1 101 Switching Protocols",
|
|
3642
3642
|
"Upgrade: websocket",
|
|
@@ -3798,12 +3798,12 @@ var __exportAll = (all, symbols) => {
|
|
|
3798
3798
|
};
|
|
3799
3799
|
var __copyProps2 = (to, from, except, desc) => {
|
|
3800
3800
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
3801
|
-
for (var keys = __getOwnPropNames2(from), i = 0, n = keys.length,
|
|
3802
|
-
|
|
3803
|
-
if (!__hasOwnProp2.call(to,
|
|
3804
|
-
__defProp2(to,
|
|
3805
|
-
get: ((k) => from[k]).bind(null,
|
|
3806
|
-
enumerable: !(desc = __getOwnPropDesc2(from,
|
|
3801
|
+
for (var keys = __getOwnPropNames2(from), i = 0, n = keys.length, key3; i < n; i++) {
|
|
3802
|
+
key3 = keys[i];
|
|
3803
|
+
if (!__hasOwnProp2.call(to, key3) && key3 !== except) {
|
|
3804
|
+
__defProp2(to, key3, {
|
|
3805
|
+
get: ((k) => from[k]).bind(null, key3),
|
|
3806
|
+
enumerable: !(desc = __getOwnPropDesc2(from, key3)) || desc.enumerable
|
|
3807
3807
|
});
|
|
3808
3808
|
}
|
|
3809
3809
|
}
|
|
@@ -4555,9 +4555,9 @@ function floatSafeRemainder(val, step) {
|
|
|
4555
4555
|
return ratio - roundedRatio;
|
|
4556
4556
|
}
|
|
4557
4557
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
4558
|
-
function defineLazy(object2,
|
|
4558
|
+
function defineLazy(object2, key3, getter) {
|
|
4559
4559
|
let value = void 0;
|
|
4560
|
-
Object.defineProperty(object2,
|
|
4560
|
+
Object.defineProperty(object2, key3, {
|
|
4561
4561
|
get() {
|
|
4562
4562
|
if (value === EVALUATING) {
|
|
4563
4563
|
return void 0;
|
|
@@ -4569,7 +4569,7 @@ function defineLazy(object2, key2, getter) {
|
|
|
4569
4569
|
return value;
|
|
4570
4570
|
},
|
|
4571
4571
|
set(v) {
|
|
4572
|
-
Object.defineProperty(object2,
|
|
4572
|
+
Object.defineProperty(object2, key3, {
|
|
4573
4573
|
value: v
|
|
4574
4574
|
// configurable: true,
|
|
4575
4575
|
});
|
|
@@ -4595,47 +4595,47 @@ function rawShape(def) {
|
|
|
4595
4595
|
function sourceShape(schema) {
|
|
4596
4596
|
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
4597
4597
|
}
|
|
4598
|
-
function deferProp(target,
|
|
4599
|
-
Object.defineProperty(target,
|
|
4598
|
+
function deferProp(target, key3, getter) {
|
|
4599
|
+
Object.defineProperty(target, key3, {
|
|
4600
4600
|
get() {
|
|
4601
4601
|
const value = getter();
|
|
4602
|
-
assignProp(this,
|
|
4602
|
+
assignProp(this, key3, value);
|
|
4603
4603
|
return value;
|
|
4604
4604
|
},
|
|
4605
4605
|
enumerable: true,
|
|
4606
4606
|
configurable: true
|
|
4607
4607
|
});
|
|
4608
4608
|
}
|
|
4609
|
-
function putProp(target,
|
|
4610
|
-
if (
|
|
4611
|
-
assignProp(target,
|
|
4609
|
+
function putProp(target, key3, value) {
|
|
4610
|
+
if (key3 in target)
|
|
4611
|
+
assignProp(target, key3, value);
|
|
4612
4612
|
else
|
|
4613
|
-
target[
|
|
4613
|
+
target[key3] = value;
|
|
4614
4614
|
}
|
|
4615
4615
|
function mirrorShape(target, source, keys, wrap) {
|
|
4616
4616
|
const raw = sourceShape(source);
|
|
4617
|
-
for (const
|
|
4618
|
-
const desc = Object.getOwnPropertyDescriptor(raw,
|
|
4617
|
+
for (const key3 of keys) {
|
|
4618
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key3);
|
|
4619
4619
|
if (!desc.enumerable)
|
|
4620
4620
|
continue;
|
|
4621
4621
|
if (desc.get) {
|
|
4622
|
-
deferProp(target,
|
|
4623
|
-
const value = source._zod.def.shape[
|
|
4624
|
-
return wrap ? wrap(value,
|
|
4622
|
+
deferProp(target, key3, () => {
|
|
4623
|
+
const value = source._zod.def.shape[key3];
|
|
4624
|
+
return wrap ? wrap(value, key3) : value;
|
|
4625
4625
|
});
|
|
4626
4626
|
} else
|
|
4627
|
-
putProp(target,
|
|
4627
|
+
putProp(target, key3, wrap ? wrap(desc.value, key3) : desc.value);
|
|
4628
4628
|
}
|
|
4629
4629
|
}
|
|
4630
4630
|
function mirrorProps(target, source) {
|
|
4631
|
-
for (const
|
|
4632
|
-
const desc = Object.getOwnPropertyDescriptor(source,
|
|
4631
|
+
for (const key3 of Reflect.ownKeys(source)) {
|
|
4632
|
+
const desc = Object.getOwnPropertyDescriptor(source, key3);
|
|
4633
4633
|
if (!desc.enumerable)
|
|
4634
4634
|
continue;
|
|
4635
4635
|
if (desc.get)
|
|
4636
|
-
deferProp(target,
|
|
4636
|
+
deferProp(target, key3, () => source[key3]);
|
|
4637
4637
|
else
|
|
4638
|
-
putProp(target,
|
|
4638
|
+
putProp(target, key3, desc.value);
|
|
4639
4639
|
}
|
|
4640
4640
|
}
|
|
4641
4641
|
function mergeDefs(...defs) {
|
|
@@ -4652,11 +4652,11 @@ function cloneDef(schema) {
|
|
|
4652
4652
|
function getElementAtPath(obj, path) {
|
|
4653
4653
|
if (!path)
|
|
4654
4654
|
return obj;
|
|
4655
|
-
return path.reduce((acc,
|
|
4655
|
+
return path.reduce((acc, key3) => acc?.[key3], obj);
|
|
4656
4656
|
}
|
|
4657
4657
|
function promiseAllObject(promisesObj) {
|
|
4658
4658
|
const keys = Object.keys(promisesObj);
|
|
4659
|
-
const promises = keys.map((
|
|
4659
|
+
const promises = keys.map((key3) => promisesObj[key3]);
|
|
4660
4660
|
return Promise.all(promises).then((results) => {
|
|
4661
4661
|
const resolvedObj = {};
|
|
4662
4662
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -4728,8 +4728,8 @@ function shallowClone(o) {
|
|
|
4728
4728
|
}
|
|
4729
4729
|
function numKeys(data) {
|
|
4730
4730
|
let keyCount = 0;
|
|
4731
|
-
for (const
|
|
4732
|
-
if (Object.prototype.hasOwnProperty.call(data,
|
|
4731
|
+
for (const key3 in data) {
|
|
4732
|
+
if (Object.prototype.hasOwnProperty.call(data, key3)) {
|
|
4733
4733
|
keyCount++;
|
|
4734
4734
|
}
|
|
4735
4735
|
}
|
|
@@ -4883,12 +4883,12 @@ function pick(schema, mask) {
|
|
|
4883
4883
|
function maskedKeys(schema, mask) {
|
|
4884
4884
|
const raw = sourceShape(schema);
|
|
4885
4885
|
const keys = [];
|
|
4886
|
-
for (const
|
|
4887
|
-
if (!Object.getOwnPropertyDescriptor(raw,
|
|
4888
|
-
throw new Error(`Unrecognized key: "${String(
|
|
4886
|
+
for (const key3 of Reflect.ownKeys(mask)) {
|
|
4887
|
+
if (!Object.getOwnPropertyDescriptor(raw, key3)?.enumerable) {
|
|
4888
|
+
throw new Error(`Unrecognized key: "${String(key3)}"`);
|
|
4889
4889
|
}
|
|
4890
|
-
if (mask[
|
|
4891
|
-
keys.push(
|
|
4890
|
+
if (mask[key3])
|
|
4891
|
+
keys.push(key3);
|
|
4892
4892
|
}
|
|
4893
4893
|
return keys;
|
|
4894
4894
|
}
|
|
@@ -4901,7 +4901,7 @@ function omit(schema, mask) {
|
|
|
4901
4901
|
}
|
|
4902
4902
|
const omitted = new Set(maskedKeys(schema, mask));
|
|
4903
4903
|
const newShape = {};
|
|
4904
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((
|
|
4904
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key3) => !omitted.has(key3)));
|
|
4905
4905
|
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
4906
4906
|
}
|
|
4907
4907
|
function extend(schema, shape) {
|
|
@@ -4912,8 +4912,8 @@ function extend(schema, shape) {
|
|
|
4912
4912
|
const hasChecks = checks && checks.length > 0;
|
|
4913
4913
|
if (hasChecks) {
|
|
4914
4914
|
const existingShape = sourceShape(schema);
|
|
4915
|
-
for (const
|
|
4916
|
-
if (Object.getOwnPropertyDescriptor(existingShape,
|
|
4915
|
+
for (const key3 of Reflect.ownKeys(shape)) {
|
|
4916
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key3) !== void 0) {
|
|
4917
4917
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
4918
4918
|
}
|
|
4919
4919
|
}
|
|
@@ -4960,15 +4960,15 @@ function partial(Class2, schema, mask, name = "partial") {
|
|
|
4960
4960
|
}
|
|
4961
4961
|
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
4962
4962
|
const newShape = {};
|
|
4963
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value,
|
|
4963
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key3) => selected && !selected.has(key3) ? value : new Class2({ type: "optional", innerType: value })));
|
|
4964
4964
|
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
|
|
4965
4965
|
}
|
|
4966
4966
|
function required(Class2, schema, mask) {
|
|
4967
4967
|
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
4968
4968
|
const newShape = {};
|
|
4969
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value,
|
|
4969
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key3) => (
|
|
4970
4970
|
// overwrite with non-optional
|
|
4971
|
-
selected && !selected.has(
|
|
4971
|
+
selected && !selected.has(key3) ? value : new Class2({ type: "nonoptional", innerType: value })
|
|
4972
4972
|
));
|
|
4973
4973
|
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
4974
4974
|
}
|
|
@@ -5155,46 +5155,46 @@ var Class = class {
|
|
|
5155
5155
|
}
|
|
5156
5156
|
};
|
|
5157
5157
|
function members(proto, table) {
|
|
5158
|
-
for (const
|
|
5159
|
-
const desc = Object.getOwnPropertyDescriptor(table,
|
|
5158
|
+
for (const key3 in table) {
|
|
5159
|
+
const desc = Object.getOwnPropertyDescriptor(table, key3);
|
|
5160
5160
|
if (desc.get)
|
|
5161
|
-
Object.defineProperty(proto,
|
|
5161
|
+
Object.defineProperty(proto, key3, { ...desc, enumerable: false });
|
|
5162
5162
|
else
|
|
5163
|
-
defineBound(proto,
|
|
5163
|
+
defineBound(proto, key3, desc.value);
|
|
5164
5164
|
}
|
|
5165
5165
|
}
|
|
5166
|
-
function own(inst,
|
|
5167
|
-
Object.defineProperty(inst,
|
|
5166
|
+
function own(inst, key3, value, enumerable = true) {
|
|
5167
|
+
Object.defineProperty(inst, key3, { configurable: true, writable: true, enumerable, value });
|
|
5168
5168
|
return value;
|
|
5169
5169
|
}
|
|
5170
|
-
function hide(inst,
|
|
5171
|
-
return own(inst,
|
|
5170
|
+
function hide(inst, key3, value) {
|
|
5171
|
+
return own(inst, key3, value, false);
|
|
5172
5172
|
}
|
|
5173
5173
|
// @__NO_SIDE_EFFECTS__
|
|
5174
5174
|
function derived(computes, table) {
|
|
5175
|
-
for (const
|
|
5176
|
-
const compute = computes[
|
|
5177
|
-
Object.defineProperty(table,
|
|
5175
|
+
for (const key3 in computes) {
|
|
5176
|
+
const compute = computes[key3];
|
|
5177
|
+
Object.defineProperty(table, key3, {
|
|
5178
5178
|
configurable: true,
|
|
5179
5179
|
enumerable: true,
|
|
5180
5180
|
get() {
|
|
5181
|
-
return own(this,
|
|
5181
|
+
return own(this, key3, compute(this));
|
|
5182
5182
|
},
|
|
5183
5183
|
set(value) {
|
|
5184
|
-
own(this,
|
|
5184
|
+
own(this, key3, value);
|
|
5185
5185
|
}
|
|
5186
5186
|
});
|
|
5187
5187
|
}
|
|
5188
5188
|
return table;
|
|
5189
5189
|
}
|
|
5190
|
-
function defineBound(proto,
|
|
5191
|
-
Object.defineProperty(proto,
|
|
5190
|
+
function defineBound(proto, key3, fn) {
|
|
5191
|
+
Object.defineProperty(proto, key3, {
|
|
5192
5192
|
configurable: true,
|
|
5193
5193
|
get() {
|
|
5194
|
-
return this == null ? fn : own(this,
|
|
5194
|
+
return this == null ? fn : own(this, key3, fn.bind(this));
|
|
5195
5195
|
},
|
|
5196
5196
|
set(value) {
|
|
5197
|
-
own(this,
|
|
5197
|
+
own(this, key3, value);
|
|
5198
5198
|
}
|
|
5199
5199
|
});
|
|
5200
5200
|
}
|
|
@@ -5211,53 +5211,53 @@ var breaker = {
|
|
|
5211
5211
|
return void 0;
|
|
5212
5212
|
}
|
|
5213
5213
|
};
|
|
5214
|
-
function defineLazyInternal(inst,
|
|
5214
|
+
function defineLazyInternal(inst, key3, compute) {
|
|
5215
5215
|
const proto = Object.getPrototypeOf(inst._zod);
|
|
5216
|
-
if (
|
|
5216
|
+
if (key3 in proto && installing !== inst._zod) {
|
|
5217
5217
|
installing = void 0;
|
|
5218
5218
|
return;
|
|
5219
5219
|
}
|
|
5220
5220
|
installing = inst._zod;
|
|
5221
|
-
Object.defineProperty(proto,
|
|
5221
|
+
Object.defineProperty(proto, key3, {
|
|
5222
5222
|
configurable: true,
|
|
5223
5223
|
get() {
|
|
5224
|
-
Object.defineProperty(this,
|
|
5224
|
+
Object.defineProperty(this, key3, breaker);
|
|
5225
5225
|
const outer = broke;
|
|
5226
5226
|
broke = false;
|
|
5227
5227
|
try {
|
|
5228
5228
|
const value = compute(this);
|
|
5229
5229
|
if (broke)
|
|
5230
|
-
delete this[
|
|
5230
|
+
delete this[key3];
|
|
5231
5231
|
else
|
|
5232
|
-
Object.defineProperty(this,
|
|
5232
|
+
Object.defineProperty(this, key3, { configurable: true, writable: true, value });
|
|
5233
5233
|
broke = broke || outer;
|
|
5234
5234
|
return value;
|
|
5235
5235
|
} catch (err) {
|
|
5236
|
-
delete this[
|
|
5236
|
+
delete this[key3];
|
|
5237
5237
|
broke = broke || outer;
|
|
5238
5238
|
throw err;
|
|
5239
5239
|
}
|
|
5240
5240
|
},
|
|
5241
5241
|
set(value) {
|
|
5242
|
-
Object.defineProperty(this,
|
|
5242
|
+
Object.defineProperty(this, key3, { configurable: true, writable: true, value });
|
|
5243
5243
|
}
|
|
5244
5244
|
});
|
|
5245
5245
|
}
|
|
5246
|
-
function installLazyProp(inst,
|
|
5247
|
-
const proto = claim(inst,
|
|
5246
|
+
function installLazyProp(inst, key3, make, enumerable) {
|
|
5247
|
+
const proto = claim(inst, key3);
|
|
5248
5248
|
if (!proto)
|
|
5249
5249
|
return;
|
|
5250
|
-
Object.defineProperty(proto,
|
|
5250
|
+
Object.defineProperty(proto, key3, {
|
|
5251
5251
|
configurable: true,
|
|
5252
5252
|
get() {
|
|
5253
5253
|
const desc = { configurable: true, writable: true, enumerable, value: void 0 };
|
|
5254
|
-
Object.defineProperty(this,
|
|
5254
|
+
Object.defineProperty(this, key3, desc);
|
|
5255
5255
|
desc.value = make(this);
|
|
5256
|
-
Object.defineProperty(this,
|
|
5256
|
+
Object.defineProperty(this, key3, desc);
|
|
5257
5257
|
return desc.value;
|
|
5258
5258
|
},
|
|
5259
5259
|
set(value) {
|
|
5260
|
-
Object.defineProperty(this,
|
|
5260
|
+
Object.defineProperty(this, key3, { configurable: true, writable: true, enumerable, value });
|
|
5261
5261
|
}
|
|
5262
5262
|
});
|
|
5263
5263
|
}
|
|
@@ -5434,15 +5434,15 @@ var $ZodError = $constructor("$ZodError", initializer);
|
|
|
5434
5434
|
var $ZodRealError = $constructor("$ZodError", initializer, void 0, {
|
|
5435
5435
|
Parent: Error
|
|
5436
5436
|
});
|
|
5437
|
-
function node(obj,
|
|
5438
|
-
if (!Object.prototype.hasOwnProperty.call(obj,
|
|
5439
|
-
if (
|
|
5440
|
-
Object.defineProperty(obj,
|
|
5437
|
+
function node(obj, key3, make) {
|
|
5438
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key3)) {
|
|
5439
|
+
if (key3 === "__proto__") {
|
|
5440
|
+
Object.defineProperty(obj, key3, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
5441
5441
|
} else {
|
|
5442
|
-
obj[
|
|
5442
|
+
obj[key3] = make();
|
|
5443
5443
|
}
|
|
5444
5444
|
}
|
|
5445
|
-
return obj[
|
|
5445
|
+
return obj[key3];
|
|
5446
5446
|
}
|
|
5447
5447
|
function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
5448
5448
|
const fieldErrors = {};
|
|
@@ -6351,16 +6351,16 @@ var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (i
|
|
|
6351
6351
|
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
6352
6352
|
return void 0;
|
|
6353
6353
|
}
|
|
6354
|
-
entries ?? (entries = Reflect.ownKeys(def.shape).map((
|
|
6354
|
+
entries ?? (entries = Reflect.ownKeys(def.shape).map((key3) => [key3, def.shape[key3]]));
|
|
6355
6355
|
const input2 = payload.value;
|
|
6356
6356
|
let proms;
|
|
6357
|
-
for (const [
|
|
6358
|
-
const result = schema._zod.run({ value: input2[
|
|
6357
|
+
for (const [key3, schema] of entries) {
|
|
6358
|
+
const result = schema._zod.run({ value: input2[key3], issues: [] }, {});
|
|
6359
6359
|
if (result instanceof Promise) {
|
|
6360
6360
|
proms ?? (proms = []);
|
|
6361
|
-
proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload,
|
|
6361
|
+
proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key3)));
|
|
6362
6362
|
} else {
|
|
6363
|
-
handleCheckPropertyResult(result, payload,
|
|
6363
|
+
handleCheckPropertyResult(result, payload, key3);
|
|
6364
6364
|
}
|
|
6365
6365
|
}
|
|
6366
6366
|
if (proms)
|
|
@@ -7261,8 +7261,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
7261
7261
|
};
|
|
7262
7262
|
capSize(inst, arraySize);
|
|
7263
7263
|
});
|
|
7264
|
-
function handlePropertyResult(result, final,
|
|
7265
|
-
const isPresent =
|
|
7264
|
+
function handlePropertyResult(result, final, key3, input2, optin, optout) {
|
|
7265
|
+
const isPresent = key3 in input2;
|
|
7266
7266
|
const isOptionalOut = optout === "optional";
|
|
7267
7267
|
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
7268
7268
|
return;
|
|
@@ -7271,7 +7271,7 @@ function handlePropertyResult(result, final, key2, input2, optin, optout) {
|
|
|
7271
7271
|
if (optin !== void 0 && isOptionalOut && !isPresent) {
|
|
7272
7272
|
return;
|
|
7273
7273
|
}
|
|
7274
|
-
final.issues.push(...prefixIssues(
|
|
7274
|
+
final.issues.push(...prefixIssues(key3, result.issues));
|
|
7275
7275
|
}
|
|
7276
7276
|
if (!isPresent && optin === void 0) {
|
|
7277
7277
|
if (!result.issues.length) {
|
|
@@ -7279,17 +7279,17 @@ function handlePropertyResult(result, final, key2, input2, optin, optout) {
|
|
|
7279
7279
|
code: "invalid_type",
|
|
7280
7280
|
expected: "nonoptional",
|
|
7281
7281
|
input: void 0,
|
|
7282
|
-
path: [
|
|
7282
|
+
path: [key3]
|
|
7283
7283
|
});
|
|
7284
7284
|
}
|
|
7285
7285
|
return;
|
|
7286
7286
|
}
|
|
7287
7287
|
if (result.value === void 0) {
|
|
7288
7288
|
if (isPresent || optin === "defaulted" && !isOptionalOut) {
|
|
7289
|
-
final.value[
|
|
7289
|
+
final.value[key3] = void 0;
|
|
7290
7290
|
}
|
|
7291
7291
|
} else {
|
|
7292
|
-
final.value[
|
|
7292
|
+
final.value[key3] = result.value;
|
|
7293
7293
|
}
|
|
7294
7294
|
}
|
|
7295
7295
|
var NO_SYMBOL_KEYS = [];
|
|
@@ -7322,28 +7322,28 @@ function handleCatchall(proms, input2, payload, ctx, def, inst, abortEarly) {
|
|
|
7322
7322
|
const optin = _catchall.optin;
|
|
7323
7323
|
const optout = _catchall.optout;
|
|
7324
7324
|
let seen = 0;
|
|
7325
|
-
for (const
|
|
7325
|
+
for (const key3 in input2) {
|
|
7326
7326
|
if (abortEarly && payload.issues.length !== seen) {
|
|
7327
7327
|
if (aborted(payload, seen))
|
|
7328
7328
|
break;
|
|
7329
7329
|
seen = payload.issues.length;
|
|
7330
7330
|
}
|
|
7331
|
-
if (keySet.has(
|
|
7331
|
+
if (keySet.has(key3))
|
|
7332
7332
|
continue;
|
|
7333
|
-
if (
|
|
7333
|
+
if (key3 === "__proto__") {
|
|
7334
7334
|
if (t === "never")
|
|
7335
|
-
unrecognized.push(
|
|
7335
|
+
unrecognized.push(key3);
|
|
7336
7336
|
continue;
|
|
7337
7337
|
}
|
|
7338
7338
|
if (t === "never") {
|
|
7339
|
-
unrecognized.push(
|
|
7339
|
+
unrecognized.push(key3);
|
|
7340
7340
|
continue;
|
|
7341
7341
|
}
|
|
7342
|
-
const r = _catchall.run({ value: input2[
|
|
7342
|
+
const r = _catchall.run({ value: input2[key3], issues: [] }, ctx);
|
|
7343
7343
|
if (r instanceof Promise) {
|
|
7344
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload,
|
|
7344
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key3, input2, optin, optout)));
|
|
7345
7345
|
} else {
|
|
7346
|
-
handlePropertyResult(r, payload,
|
|
7346
|
+
handlePropertyResult(r, payload, key3, input2, optin, optout);
|
|
7347
7347
|
}
|
|
7348
7348
|
}
|
|
7349
7349
|
if (unrecognized.length) {
|
|
@@ -7380,16 +7380,16 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
7380
7380
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
7381
7381
|
const shape = zod.def.shape;
|
|
7382
7382
|
const propValues = {};
|
|
7383
|
-
for (const
|
|
7384
|
-
const field = shape[
|
|
7383
|
+
for (const key3 in shape) {
|
|
7384
|
+
const field = shape[key3]._zod;
|
|
7385
7385
|
if (field.values) {
|
|
7386
|
-
if (!Object.prototype.hasOwnProperty.call(propValues,
|
|
7387
|
-
assignProp(propValues,
|
|
7386
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key3)) {
|
|
7387
|
+
assignProp(propValues, key3, /* @__PURE__ */ new Set());
|
|
7388
7388
|
}
|
|
7389
7389
|
for (const v of field.values)
|
|
7390
|
-
propValues[
|
|
7390
|
+
propValues[key3].add(v);
|
|
7391
7391
|
if (field.optin !== void 0)
|
|
7392
|
-
propValues[
|
|
7392
|
+
propValues[key3].add(void 0);
|
|
7393
7393
|
}
|
|
7394
7394
|
}
|
|
7395
7395
|
return propValues;
|
|
@@ -7416,22 +7416,22 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
7416
7416
|
const shape = value.shape;
|
|
7417
7417
|
const abortEarly = ctx?.abortEarly;
|
|
7418
7418
|
let seen = payload.issues.length;
|
|
7419
|
-
for (const
|
|
7419
|
+
for (const key3 of value.allKeys) {
|
|
7420
7420
|
if (abortEarly && payload.issues.length !== seen) {
|
|
7421
7421
|
if (aborted(payload, seen))
|
|
7422
7422
|
break;
|
|
7423
7423
|
seen = payload.issues.length;
|
|
7424
7424
|
}
|
|
7425
|
-
if (
|
|
7425
|
+
if (key3 === "__proto__")
|
|
7426
7426
|
continue;
|
|
7427
|
-
const el = shape[
|
|
7427
|
+
const el = shape[key3];
|
|
7428
7428
|
const optin = el._zod.optin;
|
|
7429
7429
|
const optout = el._zod.optout;
|
|
7430
|
-
const r = el._zod.run({ value: input2[
|
|
7430
|
+
const r = el._zod.run({ value: input2[key3], issues: [] }, ctx);
|
|
7431
7431
|
if (r instanceof Promise) {
|
|
7432
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload,
|
|
7432
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key3, input2, optin, optout)));
|
|
7433
7433
|
} else {
|
|
7434
|
-
handlePropertyResult(r, payload,
|
|
7434
|
+
handlePropertyResult(r, payload, key3, input2, optin, optout);
|
|
7435
7435
|
}
|
|
7436
7436
|
}
|
|
7437
7437
|
if (!catchall) {
|
|
@@ -7465,17 +7465,17 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7465
7465
|
doc.write(`const input = payload.value;`);
|
|
7466
7466
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
7467
7467
|
let counter = 0;
|
|
7468
|
-
for (const
|
|
7469
|
-
ids[
|
|
7468
|
+
for (const key3 of normalized.allKeys) {
|
|
7469
|
+
ids[key3] = `key_${counter++}`;
|
|
7470
7470
|
}
|
|
7471
7471
|
doc.write(memo3 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
7472
|
-
for (const
|
|
7473
|
-
if (
|
|
7472
|
+
for (const key3 of normalized.allKeys) {
|
|
7473
|
+
if (key3 === "__proto__")
|
|
7474
7474
|
continue;
|
|
7475
|
-
const id2 = ids[
|
|
7476
|
-
const k = typeof
|
|
7475
|
+
const id2 = ids[key3];
|
|
7476
|
+
const k = typeof key3 === "symbol" ? `syms[${syms.indexOf(key3)}]` : esc(key3);
|
|
7477
7477
|
const isPresent = `${k} in input`;
|
|
7478
|
-
const schema = shape[
|
|
7478
|
+
const schema = shape[key3];
|
|
7479
7479
|
const optin = schema?._zod?.optin;
|
|
7480
7480
|
const isOptionalIn = optin !== void 0;
|
|
7481
7481
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
@@ -7809,21 +7809,21 @@ function mergeValues(a, b) {
|
|
|
7809
7809
|
}
|
|
7810
7810
|
if (isPlainObject(a) && isPlainObject(b)) {
|
|
7811
7811
|
const bKeys = Object.keys(b);
|
|
7812
|
-
const sharedKeys = Object.keys(a).filter((
|
|
7812
|
+
const sharedKeys = Object.keys(a).filter((key3) => bKeys.indexOf(key3) !== -1);
|
|
7813
7813
|
const newObj = { ...a, ...b };
|
|
7814
7814
|
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
7815
7815
|
delete newObj.__proto__;
|
|
7816
|
-
for (const
|
|
7817
|
-
if (
|
|
7816
|
+
for (const key3 of sharedKeys) {
|
|
7817
|
+
if (key3 === "__proto__")
|
|
7818
7818
|
continue;
|
|
7819
|
-
const sharedValue = mergeValues(a[
|
|
7819
|
+
const sharedValue = mergeValues(a[key3], b[key3]);
|
|
7820
7820
|
if (!sharedValue.valid) {
|
|
7821
7821
|
return {
|
|
7822
7822
|
valid: false,
|
|
7823
|
-
mergeErrorPath: [
|
|
7823
|
+
mergeErrorPath: [key3, ...sharedValue.mergeErrorPath]
|
|
7824
7824
|
};
|
|
7825
7825
|
}
|
|
7826
|
-
newObj[
|
|
7826
|
+
newObj[key3] = sharedValue.data;
|
|
7827
7827
|
}
|
|
7828
7828
|
return { valid: true, data: newObj };
|
|
7829
7829
|
}
|
|
@@ -7982,9 +7982,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7982
7982
|
return handleTupleResults(itemResults, payload, items, input2, optoutStart);
|
|
7983
7983
|
};
|
|
7984
7984
|
});
|
|
7985
|
-
function getTupleOptStart(items,
|
|
7985
|
+
function getTupleOptStart(items, key3) {
|
|
7986
7986
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
7987
|
-
const omittable =
|
|
7987
|
+
const omittable = key3 === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional";
|
|
7988
7988
|
if (!omittable)
|
|
7989
7989
|
return i + 1;
|
|
7990
7990
|
}
|
|
@@ -8042,12 +8042,12 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8042
8042
|
if (values && !def.partial) {
|
|
8043
8043
|
payload.value = memo3 ? memo3.alloc(inst, payload, {}, ctx) : {};
|
|
8044
8044
|
const recordKeys = /* @__PURE__ */ new Set();
|
|
8045
|
-
for (const
|
|
8046
|
-
if (typeof
|
|
8047
|
-
recordKeys.add(typeof
|
|
8048
|
-
if (
|
|
8045
|
+
for (const key3 of values) {
|
|
8046
|
+
if (typeof key3 === "string" || typeof key3 === "number" || typeof key3 === "symbol") {
|
|
8047
|
+
recordKeys.add(typeof key3 === "number" ? key3.toString() : key3);
|
|
8048
|
+
if (key3 === "__proto__")
|
|
8049
8049
|
continue;
|
|
8050
|
-
const keyResult = def.keyType._zod.run({ value:
|
|
8050
|
+
const keyResult = def.keyType._zod.run({ value: key3, issues: [] }, ctx);
|
|
8051
8051
|
if (keyResult instanceof Promise) {
|
|
8052
8052
|
throw new Error("Async schemas not supported in object keys currently");
|
|
8053
8053
|
}
|
|
@@ -8056,8 +8056,8 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8056
8056
|
code: "invalid_key",
|
|
8057
8057
|
origin: "record",
|
|
8058
8058
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
8059
|
-
input:
|
|
8060
|
-
path: [
|
|
8059
|
+
input: key3,
|
|
8060
|
+
path: [key3],
|
|
8061
8061
|
inst
|
|
8062
8062
|
});
|
|
8063
8063
|
continue;
|
|
@@ -8065,32 +8065,32 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8065
8065
|
const outKey = keyResult.value;
|
|
8066
8066
|
if (outKey === "__proto__")
|
|
8067
8067
|
continue;
|
|
8068
|
-
const result = def.valueType._zod.run({ value: input2[
|
|
8068
|
+
const result = def.valueType._zod.run({ value: input2[key3], issues: [] }, ctx);
|
|
8069
8069
|
if (result instanceof Promise) {
|
|
8070
8070
|
proms.push(result.then((result2) => {
|
|
8071
8071
|
if (result2.issues.length) {
|
|
8072
|
-
payload.issues.push(...prefixIssues(
|
|
8072
|
+
payload.issues.push(...prefixIssues(key3, result2.issues));
|
|
8073
8073
|
}
|
|
8074
8074
|
payload.value[outKey] = result2.value;
|
|
8075
8075
|
}));
|
|
8076
8076
|
} else {
|
|
8077
8077
|
if (result.issues.length) {
|
|
8078
|
-
payload.issues.push(...prefixIssues(
|
|
8078
|
+
payload.issues.push(...prefixIssues(key3, result.issues));
|
|
8079
8079
|
}
|
|
8080
8080
|
payload.value[outKey] = result.value;
|
|
8081
8081
|
}
|
|
8082
8082
|
}
|
|
8083
8083
|
}
|
|
8084
8084
|
let unrecognized;
|
|
8085
|
-
for (const
|
|
8086
|
-
if (!recordKeys.has(
|
|
8085
|
+
for (const key3 in input2) {
|
|
8086
|
+
if (!recordKeys.has(key3)) {
|
|
8087
8087
|
if (def.mode === "loose") {
|
|
8088
|
-
if (
|
|
8088
|
+
if (key3 === "__proto__")
|
|
8089
8089
|
continue;
|
|
8090
|
-
payload.value[
|
|
8090
|
+
payload.value[key3] = input2[key3];
|
|
8091
8091
|
} else {
|
|
8092
8092
|
unrecognized = unrecognized ?? [];
|
|
8093
|
-
unrecognized.push(
|
|
8093
|
+
unrecognized.push(key3);
|
|
8094
8094
|
}
|
|
8095
8095
|
}
|
|
8096
8096
|
}
|
|
@@ -8106,18 +8106,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8106
8106
|
} else {
|
|
8107
8107
|
payload.value = memo3 ? memo3.alloc(inst, payload, {}, ctx) : {};
|
|
8108
8108
|
let unrecognized;
|
|
8109
|
-
for (const
|
|
8110
|
-
if (
|
|
8109
|
+
for (const key3 of Reflect.ownKeys(input2)) {
|
|
8110
|
+
if (key3 === "__proto__")
|
|
8111
8111
|
continue;
|
|
8112
|
-
if (!Object.prototype.propertyIsEnumerable.call(input2,
|
|
8112
|
+
if (!Object.prototype.propertyIsEnumerable.call(input2, key3))
|
|
8113
8113
|
continue;
|
|
8114
|
-
let keyResult = def.keyType._zod.run({ value:
|
|
8114
|
+
let keyResult = def.keyType._zod.run({ value: key3, issues: [] }, ctx);
|
|
8115
8115
|
if (keyResult instanceof Promise) {
|
|
8116
8116
|
throw new Error("Async schemas not supported in object keys currently");
|
|
8117
8117
|
}
|
|
8118
|
-
const checkNumericKey = typeof
|
|
8118
|
+
const checkNumericKey = typeof key3 === "string" && number.test(key3) && keyResult.issues.length;
|
|
8119
8119
|
if (checkNumericKey) {
|
|
8120
|
-
const retryResult = def.keyType._zod.run({ value: Number(
|
|
8120
|
+
const retryResult = def.keyType._zod.run({ value: Number(key3), issues: [] }, ctx);
|
|
8121
8121
|
if (retryResult instanceof Promise) {
|
|
8122
8122
|
throw new Error("Async schemas not supported in object keys currently");
|
|
8123
8123
|
}
|
|
@@ -8127,17 +8127,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8127
8127
|
}
|
|
8128
8128
|
if (keyResult.issues.length) {
|
|
8129
8129
|
if (def.mode === "loose") {
|
|
8130
|
-
payload.value[
|
|
8130
|
+
payload.value[key3] = input2[key3];
|
|
8131
8131
|
} else if (values) {
|
|
8132
8132
|
unrecognized = unrecognized ?? [];
|
|
8133
|
-
unrecognized.push(
|
|
8133
|
+
unrecognized.push(key3);
|
|
8134
8134
|
} else {
|
|
8135
8135
|
payload.issues.push({
|
|
8136
8136
|
code: "invalid_key",
|
|
8137
8137
|
origin: "record",
|
|
8138
8138
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
8139
|
-
input:
|
|
8140
|
-
path: [
|
|
8139
|
+
input: key3,
|
|
8140
|
+
path: [key3],
|
|
8141
8141
|
inst
|
|
8142
8142
|
});
|
|
8143
8143
|
}
|
|
@@ -8146,17 +8146,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
8146
8146
|
const outKey = keyResult.value;
|
|
8147
8147
|
if (outKey === "__proto__")
|
|
8148
8148
|
continue;
|
|
8149
|
-
const result = def.valueType._zod.run({ value: input2[
|
|
8149
|
+
const result = def.valueType._zod.run({ value: input2[key3], issues: [] }, ctx);
|
|
8150
8150
|
if (result instanceof Promise) {
|
|
8151
8151
|
proms.push(result.then((result2) => {
|
|
8152
8152
|
if (result2.issues.length) {
|
|
8153
|
-
payload.issues.push(...prefixIssues(
|
|
8153
|
+
payload.issues.push(...prefixIssues(key3, result2.issues));
|
|
8154
8154
|
}
|
|
8155
8155
|
payload.value[outKey] = result2.value;
|
|
8156
8156
|
}));
|
|
8157
8157
|
} else {
|
|
8158
8158
|
if (result.issues.length) {
|
|
8159
|
-
payload.issues.push(...prefixIssues(
|
|
8159
|
+
payload.issues.push(...prefixIssues(key3, result.issues));
|
|
8160
8160
|
}
|
|
8161
8161
|
payload.value[outKey] = result.value;
|
|
8162
8162
|
}
|
|
@@ -8196,20 +8196,20 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
8196
8196
|
payload.value = memo3 ? memo3.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map();
|
|
8197
8197
|
const abortEarly = ctx?.abortEarly;
|
|
8198
8198
|
let seen = payload.issues.length;
|
|
8199
|
-
for (const [
|
|
8199
|
+
for (const [key3, value] of input2) {
|
|
8200
8200
|
if (abortEarly && payload.issues.length !== seen) {
|
|
8201
8201
|
if (aborted(payload, seen))
|
|
8202
8202
|
break;
|
|
8203
8203
|
seen = payload.issues.length;
|
|
8204
8204
|
}
|
|
8205
|
-
const keyResult = def.keyType._zod.run({ value:
|
|
8205
|
+
const keyResult = def.keyType._zod.run({ value: key3, issues: [] }, ctx);
|
|
8206
8206
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
8207
8207
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
8208
8208
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
8209
|
-
handleMapResult(keyResult2, valueResult2, payload,
|
|
8209
|
+
handleMapResult(keyResult2, valueResult2, payload, key3, input2, inst, ctx);
|
|
8210
8210
|
}));
|
|
8211
8211
|
} else {
|
|
8212
|
-
handleMapResult(keyResult, valueResult, payload,
|
|
8212
|
+
handleMapResult(keyResult, valueResult, payload, key3, input2, inst, ctx);
|
|
8213
8213
|
}
|
|
8214
8214
|
}
|
|
8215
8215
|
if (proms.length)
|
|
@@ -8218,10 +8218,10 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
8218
8218
|
};
|
|
8219
8219
|
capSize(inst, mapSize);
|
|
8220
8220
|
});
|
|
8221
|
-
function handleMapResult(keyResult, valueResult, final,
|
|
8221
|
+
function handleMapResult(keyResult, valueResult, final, key3, input2, inst, ctx) {
|
|
8222
8222
|
if (keyResult.issues.length) {
|
|
8223
|
-
if (propertyKeyTypes.has(typeof
|
|
8224
|
-
final.issues.push(...prefixIssues(
|
|
8223
|
+
if (propertyKeyTypes.has(typeof key3)) {
|
|
8224
|
+
final.issues.push(...prefixIssues(key3, keyResult.issues));
|
|
8225
8225
|
} else {
|
|
8226
8226
|
final.issues.push({
|
|
8227
8227
|
code: "invalid_key",
|
|
@@ -8233,15 +8233,15 @@ function handleMapResult(keyResult, valueResult, final, key2, input2, inst, ctx)
|
|
|
8233
8233
|
}
|
|
8234
8234
|
}
|
|
8235
8235
|
if (valueResult.issues.length) {
|
|
8236
|
-
if (propertyKeyTypes.has(typeof
|
|
8237
|
-
final.issues.push(...prefixIssues(
|
|
8236
|
+
if (propertyKeyTypes.has(typeof key3)) {
|
|
8237
|
+
final.issues.push(...prefixIssues(key3, valueResult.issues));
|
|
8238
8238
|
} else {
|
|
8239
8239
|
final.issues.push({
|
|
8240
8240
|
origin: "map",
|
|
8241
8241
|
code: "invalid_element",
|
|
8242
8242
|
input: input2,
|
|
8243
8243
|
inst,
|
|
8244
|
-
key:
|
|
8244
|
+
key: key3,
|
|
8245
8245
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
8246
8246
|
});
|
|
8247
8247
|
}
|
|
@@ -8916,8 +8916,8 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
8916
8916
|
};
|
|
8917
8917
|
const shape = (sh, spread) => {
|
|
8918
8918
|
let answer = NONE;
|
|
8919
|
-
for (const
|
|
8920
|
-
const desc = Object.getOwnPropertyDescriptor(sh,
|
|
8919
|
+
for (const key3 of Reflect.ownKeys(sh)) {
|
|
8920
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key3);
|
|
8921
8921
|
if (spread && !desc.enumerable)
|
|
8922
8922
|
continue;
|
|
8923
8923
|
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve8) : NONE;
|
|
@@ -9013,8 +9013,8 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
9013
9013
|
break;
|
|
9014
9014
|
default: {
|
|
9015
9015
|
kind;
|
|
9016
|
-
for (const
|
|
9017
|
-
const desc = Object.getOwnPropertyDescriptor(def,
|
|
9016
|
+
for (const key3 in def) {
|
|
9017
|
+
const desc = Object.getOwnPropertyDescriptor(def, key3);
|
|
9018
9018
|
if (!desc || desc.get)
|
|
9019
9019
|
continue;
|
|
9020
9020
|
const value = desc.value;
|
|
@@ -17147,11 +17147,11 @@ function generatePropertiesChecks(doc, ctx, def, accessor) {
|
|
|
17147
17147
|
}
|
|
17148
17148
|
doc.write(`if (${accessor} == null) return INVALID;`);
|
|
17149
17149
|
const shape = def.shape;
|
|
17150
|
-
for (const
|
|
17151
|
-
const keyExpr = typeof
|
|
17150
|
+
for (const key3 of Reflect.ownKeys(shape)) {
|
|
17151
|
+
const keyExpr = typeof key3 === "symbol" ? addConstant(ctx, key3) : esc(key3);
|
|
17152
17152
|
const inputVar = newVar(ctx);
|
|
17153
17153
|
doc.write(`const ${inputVar} = ${accessor}[${keyExpr}];`);
|
|
17154
|
-
compileChild(doc, ctx, shape[
|
|
17154
|
+
compileChild(doc, ctx, shape[key3], inputVar, false);
|
|
17155
17155
|
}
|
|
17156
17156
|
}
|
|
17157
17157
|
function generatePropertyCheck(doc, ctx, def, accessor) {
|
|
@@ -17544,9 +17544,9 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
17544
17544
|
throw new ZodCompileUnsupportedError('object shape key "__proto__"');
|
|
17545
17545
|
}
|
|
17546
17546
|
const propOutputs = /* @__PURE__ */ new Map();
|
|
17547
|
-
for (const
|
|
17548
|
-
const propSchema = propShape[
|
|
17549
|
-
const kx = keyExpr(
|
|
17547
|
+
for (const key3 of allKeys) {
|
|
17548
|
+
const propSchema = propShape[key3];
|
|
17549
|
+
const kx = keyExpr(key3);
|
|
17550
17550
|
const inputVar = newVar(ctx);
|
|
17551
17551
|
doc.write(`const ${inputVar} = ${accessor}[${kx}];`);
|
|
17552
17552
|
if (propSchema._zod.optin !== void 0) {
|
|
@@ -17567,14 +17567,14 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
17567
17567
|
} else {
|
|
17568
17568
|
doc.write(`if (${outputVar2} === INVALID) return INVALID;`);
|
|
17569
17569
|
}
|
|
17570
|
-
propOutputs.set(
|
|
17570
|
+
propOutputs.set(key3, outputVar2);
|
|
17571
17571
|
} else {
|
|
17572
17572
|
if (requiresPresenceCheck(propSchema)) {
|
|
17573
17573
|
doc.write(`if (!(${kx} in ${accessor})) return INVALID;`);
|
|
17574
17574
|
}
|
|
17575
17575
|
const outputAccessor = compileChild(doc, ctx, propSchema, inputVar, buildsValue);
|
|
17576
17576
|
if (outputAccessor !== null)
|
|
17577
|
-
propOutputs.set(
|
|
17577
|
+
propOutputs.set(key3, outputAccessor);
|
|
17578
17578
|
}
|
|
17579
17579
|
}
|
|
17580
17580
|
const catchall = def.catchall;
|
|
@@ -17995,9 +17995,9 @@ function generateTupleCheck(doc, ctx, schema, accessor) {
|
|
|
17995
17995
|
}
|
|
17996
17996
|
return outputVar;
|
|
17997
17997
|
}
|
|
17998
|
-
function getTupleOptStart2(items,
|
|
17998
|
+
function getTupleOptStart2(items, key3) {
|
|
17999
17999
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
18000
|
-
const omittable =
|
|
18000
|
+
const omittable = key3 === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional";
|
|
18001
18001
|
if (!omittable)
|
|
18002
18002
|
return i + 1;
|
|
18003
18003
|
}
|
|
@@ -18127,16 +18127,16 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
|
|
|
18127
18127
|
const keyValues = recordDef.partial ? void 0 : def.keyType._zod.values;
|
|
18128
18128
|
if (keyValues) {
|
|
18129
18129
|
const inputKeys = [];
|
|
18130
|
-
for (const
|
|
18131
|
-
if (!(typeof
|
|
18132
|
-
throw new ZodCompileUnsupportedError(`record key value ${String(
|
|
18130
|
+
for (const key3 of keyValues) {
|
|
18131
|
+
if (!(typeof key3 === "string" || typeof key3 === "number" || typeof key3 === "symbol")) {
|
|
18132
|
+
throw new ZodCompileUnsupportedError(`record key value ${String(key3)}`);
|
|
18133
18133
|
}
|
|
18134
|
-
const inputKey = typeof
|
|
18134
|
+
const inputKey = typeof key3 === "number" ? key3.toString() : key3;
|
|
18135
18135
|
if (inputKey === "__proto__") {
|
|
18136
18136
|
throw new ZodCompileUnsupportedError('record key "__proto__"');
|
|
18137
18137
|
}
|
|
18138
18138
|
inputKeys.push(inputKey);
|
|
18139
|
-
const keyConst = addConstant(ctx,
|
|
18139
|
+
const keyConst = addConstant(ctx, key3);
|
|
18140
18140
|
const outKey = generateCheck(doc, ctx, def.keyType, keyConst);
|
|
18141
18141
|
const valueVar = newVar(ctx);
|
|
18142
18142
|
doc.write(`const ${valueVar} = ${accessor}[${literalPropertyKey(ctx, inputKey)}];`);
|
|
@@ -18214,10 +18214,10 @@ function emitOwnKeys(doc, ctx, accessor, kVar, body, onSymbol) {
|
|
|
18214
18214
|
});
|
|
18215
18215
|
doc.write(`}`);
|
|
18216
18216
|
}
|
|
18217
|
-
function literalPropertyKey(ctx,
|
|
18218
|
-
if (typeof
|
|
18219
|
-
return esc(
|
|
18220
|
-
return addConstant(ctx,
|
|
18217
|
+
function literalPropertyKey(ctx, key3) {
|
|
18218
|
+
if (typeof key3 === "string")
|
|
18219
|
+
return esc(key3);
|
|
18220
|
+
return addConstant(ctx, key3);
|
|
18221
18221
|
}
|
|
18222
18222
|
function generateMapCheck(doc, ctx, schema, accessor) {
|
|
18223
18223
|
const def = schema._zod.def;
|
|
@@ -19446,9 +19446,9 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
19446
19446
|
// node_modules/zod/v4/core/to-json-schema.js
|
|
19447
19447
|
function assignProps(target, ...sources) {
|
|
19448
19448
|
for (const source of sources) {
|
|
19449
|
-
for (const
|
|
19450
|
-
if (Object.prototype.propertyIsEnumerable.call(source,
|
|
19451
|
-
assignProp(target,
|
|
19449
|
+
for (const key3 of Reflect.ownKeys(source)) {
|
|
19450
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key3)) {
|
|
19451
|
+
assignProp(target, key3, source[key3]);
|
|
19452
19452
|
}
|
|
19453
19453
|
}
|
|
19454
19454
|
}
|
|
@@ -19594,8 +19594,8 @@ function extractDefs(ctx, schema) {
|
|
|
19594
19594
|
if (defId)
|
|
19595
19595
|
seen.defId = defId;
|
|
19596
19596
|
const schema2 = seen.schema;
|
|
19597
|
-
for (const
|
|
19598
|
-
delete schema2[
|
|
19597
|
+
for (const key3 in schema2) {
|
|
19598
|
+
delete schema2[key3];
|
|
19599
19599
|
}
|
|
19600
19600
|
schema2.$ref = ref;
|
|
19601
19601
|
};
|
|
@@ -19676,8 +19676,8 @@ function foldObjects(members2) {
|
|
|
19676
19676
|
for (const member of members2) {
|
|
19677
19677
|
if (typeof member !== "object" || member.type !== "object")
|
|
19678
19678
|
return null;
|
|
19679
|
-
for (const
|
|
19680
|
-
if (!FOLDABLE_KEYS.has(
|
|
19679
|
+
for (const key3 in member) {
|
|
19680
|
+
if (!FOLDABLE_KEYS.has(key3))
|
|
19681
19681
|
return null;
|
|
19682
19682
|
}
|
|
19683
19683
|
objects.push(member);
|
|
@@ -19685,22 +19685,22 @@ function foldObjects(members2) {
|
|
|
19685
19685
|
const properties = {};
|
|
19686
19686
|
const required2 = /* @__PURE__ */ new Set();
|
|
19687
19687
|
for (const object2 of objects) {
|
|
19688
|
-
for (const
|
|
19689
|
-
if (Object.prototype.hasOwnProperty.call(properties,
|
|
19688
|
+
for (const key3 in object2.properties) {
|
|
19689
|
+
if (Object.prototype.hasOwnProperty.call(properties, key3))
|
|
19690
19690
|
continue;
|
|
19691
19691
|
const parts = [];
|
|
19692
19692
|
for (const other of objects) {
|
|
19693
|
-
const part = other.properties?.[
|
|
19693
|
+
const part = other.properties?.[key3] ?? undeclaredConstraint(other);
|
|
19694
19694
|
if (part === null || part === void 0)
|
|
19695
19695
|
continue;
|
|
19696
19696
|
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part)))
|
|
19697
19697
|
parts.push(part);
|
|
19698
19698
|
}
|
|
19699
19699
|
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
19700
|
-
assignProp(properties,
|
|
19700
|
+
assignProp(properties, key3, merged);
|
|
19701
19701
|
}
|
|
19702
|
-
for (const
|
|
19703
|
-
required2.add(
|
|
19702
|
+
for (const key3 of object2.required ?? [])
|
|
19703
|
+
required2.add(key3);
|
|
19704
19704
|
}
|
|
19705
19705
|
const folded = { type: "object", properties };
|
|
19706
19706
|
if (required2.size)
|
|
@@ -19725,8 +19725,8 @@ function foldIntersection(json2) {
|
|
|
19725
19725
|
const allOf = json2.allOf;
|
|
19726
19726
|
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
19727
19727
|
return;
|
|
19728
|
-
for (const
|
|
19729
|
-
if (
|
|
19728
|
+
for (const key3 of FOLDABLE_KEYS)
|
|
19729
|
+
if (key3 in json2)
|
|
19730
19730
|
return;
|
|
19731
19731
|
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
19732
19732
|
let folded = null;
|
|
@@ -19773,20 +19773,20 @@ function finalize(ctx, schema) {
|
|
|
19773
19773
|
assignProps(schema2, _cached);
|
|
19774
19774
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
19775
19775
|
if (isParentRef) {
|
|
19776
|
-
for (const
|
|
19777
|
-
if (
|
|
19776
|
+
for (const key3 in schema2) {
|
|
19777
|
+
if (key3 === "$ref" || key3 === "allOf")
|
|
19778
19778
|
continue;
|
|
19779
|
-
if (!(
|
|
19780
|
-
delete schema2[
|
|
19779
|
+
if (!(key3 in _cached)) {
|
|
19780
|
+
delete schema2[key3];
|
|
19781
19781
|
}
|
|
19782
19782
|
}
|
|
19783
19783
|
}
|
|
19784
19784
|
if (refSchema.$ref && refSeen.def) {
|
|
19785
|
-
for (const
|
|
19786
|
-
if (
|
|
19785
|
+
for (const key3 in schema2) {
|
|
19786
|
+
if (key3 === "$ref" || key3 === "allOf")
|
|
19787
19787
|
continue;
|
|
19788
|
-
if (
|
|
19789
|
-
delete schema2[
|
|
19788
|
+
if (key3 in refSeen.def && JSON.stringify(schema2[key3]) === JSON.stringify(refSeen.def[key3])) {
|
|
19789
|
+
delete schema2[key3];
|
|
19790
19790
|
}
|
|
19791
19791
|
}
|
|
19792
19792
|
}
|
|
@@ -19798,11 +19798,11 @@ function finalize(ctx, schema) {
|
|
|
19798
19798
|
if (parentSeen?.schema.$ref) {
|
|
19799
19799
|
schema2.$ref = parentSeen.schema.$ref;
|
|
19800
19800
|
if (parentSeen.def) {
|
|
19801
|
-
for (const
|
|
19802
|
-
if (
|
|
19801
|
+
for (const key3 in schema2) {
|
|
19802
|
+
if (key3 === "$ref" || key3 === "allOf")
|
|
19803
19803
|
continue;
|
|
19804
|
-
if (
|
|
19805
|
-
delete schema2[
|
|
19804
|
+
if (key3 in parentSeen.def && JSON.stringify(schema2[key3]) === JSON.stringify(parentSeen.def[key3])) {
|
|
19805
|
+
delete schema2[key3];
|
|
19806
19806
|
}
|
|
19807
19807
|
}
|
|
19808
19808
|
}
|
|
@@ -19935,8 +19935,8 @@ function isTransforming(_schema, _ctx) {
|
|
|
19935
19935
|
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
19936
19936
|
}
|
|
19937
19937
|
if (def.type === "object") {
|
|
19938
|
-
for (const
|
|
19939
|
-
if (isTransforming(def.shape[
|
|
19938
|
+
for (const key3 in def.shape) {
|
|
19939
|
+
if (isTransforming(def.shape[key3], ctx))
|
|
19940
19940
|
return true;
|
|
19941
19941
|
}
|
|
19942
19942
|
return false;
|
|
@@ -19974,13 +19974,13 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
|
|
|
19974
19974
|
};
|
|
19975
19975
|
|
|
19976
19976
|
// node_modules/zod/v4/core/json-schema-processors.js
|
|
19977
|
-
var narrowMin = (agg,
|
|
19978
|
-
if (agg[
|
|
19979
|
-
agg[
|
|
19977
|
+
var narrowMin = (agg, key3, value) => {
|
|
19978
|
+
if (agg[key3] === void 0 || value > agg[key3])
|
|
19979
|
+
agg[key3] = value;
|
|
19980
19980
|
};
|
|
19981
|
-
var narrowMax = (agg,
|
|
19982
|
-
if (agg[
|
|
19983
|
-
agg[
|
|
19981
|
+
var narrowMax = (agg, key3, value) => {
|
|
19982
|
+
if (agg[key3] === void 0 || value < agg[key3])
|
|
19983
|
+
agg[key3] = value;
|
|
19984
19984
|
};
|
|
19985
19985
|
var narrowBoth = (agg, value) => {
|
|
19986
19986
|
narrowMin(agg, "minimum", value);
|
|
@@ -20318,17 +20318,17 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
20318
20318
|
}
|
|
20319
20319
|
json2.type = "object";
|
|
20320
20320
|
json2.properties = {};
|
|
20321
|
-
for (const
|
|
20322
|
-
assignProp(json2.properties,
|
|
20321
|
+
for (const key3 in shape) {
|
|
20322
|
+
assignProp(json2.properties, key3, processSchema(shape[key3], ctx, {
|
|
20323
20323
|
...params,
|
|
20324
|
-
path: [...params.path, "properties",
|
|
20324
|
+
path: [...params.path, "properties", key3]
|
|
20325
20325
|
}));
|
|
20326
20326
|
}
|
|
20327
20327
|
const requiredKeys = [];
|
|
20328
|
-
for (const
|
|
20329
|
-
const field = def.shape[
|
|
20328
|
+
for (const key3 of Object.keys(shape)) {
|
|
20329
|
+
const field = def.shape[key3];
|
|
20330
20330
|
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
|
|
20331
|
-
requiredKeys.push(
|
|
20331
|
+
requiredKeys.push(key3);
|
|
20332
20332
|
}
|
|
20333
20333
|
}
|
|
20334
20334
|
if (requiredKeys.length > 0) {
|
|
@@ -20703,9 +20703,9 @@ function toJSONSchema(input2, params) {
|
|
|
20703
20703
|
};
|
|
20704
20704
|
ctx2.external = external;
|
|
20705
20705
|
for (const entry of registry2._idmap.entries()) {
|
|
20706
|
-
const [
|
|
20706
|
+
const [key3, schema] = entry;
|
|
20707
20707
|
extractDefs(ctx2, schema);
|
|
20708
|
-
assignProp(schemas,
|
|
20708
|
+
assignProp(schemas, key3, finalize(ctx2, schema));
|
|
20709
20709
|
}
|
|
20710
20710
|
if (Object.keys(defs).length > 0) {
|
|
20711
20711
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -21020,17 +21020,17 @@ __export(checks_exports2, {
|
|
|
21020
21020
|
|
|
21021
21021
|
// node_modules/zod/v4/classic/errors.js
|
|
21022
21022
|
var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
21023
|
-
function _lazyMethod(proto,
|
|
21024
|
-
Object.defineProperty(proto,
|
|
21023
|
+
function _lazyMethod(proto, key3, make) {
|
|
21024
|
+
Object.defineProperty(proto, key3, {
|
|
21025
21025
|
configurable: true,
|
|
21026
21026
|
enumerable: false,
|
|
21027
21027
|
get() {
|
|
21028
21028
|
const value = make(this);
|
|
21029
|
-
Object.defineProperty(this,
|
|
21029
|
+
Object.defineProperty(this, key3, { value, configurable: true, writable: true });
|
|
21030
21030
|
return value;
|
|
21031
21031
|
},
|
|
21032
21032
|
set(value) {
|
|
21033
|
-
Object.defineProperty(this,
|
|
21033
|
+
Object.defineProperty(this, key3, { value, configurable: true, writable: true });
|
|
21034
21034
|
}
|
|
21035
21035
|
});
|
|
21036
21036
|
}
|
|
@@ -22700,11 +22700,11 @@ function resolveRef(ref, ctx) {
|
|
|
22700
22700
|
}
|
|
22701
22701
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
22702
22702
|
if (path[0] === defsKey) {
|
|
22703
|
-
const
|
|
22704
|
-
if (!
|
|
22703
|
+
const key3 = path[1] === void 0 ? void 0 : decodeJSONPointerSegment(path[1]);
|
|
22704
|
+
if (!key3 || !ctx.defs[key3]) {
|
|
22705
22705
|
throw new Error(`Reference not found: ${ref}`);
|
|
22706
22706
|
}
|
|
22707
|
-
return ctx.defs[
|
|
22707
|
+
return ctx.defs[key3];
|
|
22708
22708
|
}
|
|
22709
22709
|
throw new Error(`Reference not found: ${ref}`);
|
|
22710
22710
|
}
|
|
@@ -22739,16 +22739,16 @@ function checkObjectGuards(objectSchema, guards) {
|
|
|
22739
22739
|
});
|
|
22740
22740
|
}
|
|
22741
22741
|
if (guards.keySchema) {
|
|
22742
|
-
for (const
|
|
22743
|
-
const result = guards.keySchema.safeParse(
|
|
22742
|
+
for (const key3 of keys) {
|
|
22743
|
+
const result = guards.keySchema.safeParse(key3);
|
|
22744
22744
|
if (result.success)
|
|
22745
22745
|
continue;
|
|
22746
22746
|
payload.issues.push({
|
|
22747
22747
|
code: "invalid_key",
|
|
22748
22748
|
origin: "record",
|
|
22749
22749
|
issues: result.error.issues,
|
|
22750
|
-
input:
|
|
22751
|
-
path: [
|
|
22750
|
+
input: key3,
|
|
22751
|
+
path: [key3],
|
|
22752
22752
|
continue: true
|
|
22753
22753
|
});
|
|
22754
22754
|
}
|
|
@@ -22773,20 +22773,20 @@ function canonicalKey(value, seen) {
|
|
|
22773
22773
|
if (Array.isArray(value)) {
|
|
22774
22774
|
const parts2 = [];
|
|
22775
22775
|
for (const item of value) {
|
|
22776
|
-
const
|
|
22777
|
-
if (
|
|
22776
|
+
const key3 = canonicalKey(item, seen);
|
|
22777
|
+
if (key3 === null)
|
|
22778
22778
|
return null;
|
|
22779
|
-
parts2.push(
|
|
22779
|
+
parts2.push(key3);
|
|
22780
22780
|
}
|
|
22781
22781
|
return `a${parts2.length}:[${parts2.join(",")}]`;
|
|
22782
22782
|
}
|
|
22783
22783
|
const keys = Object.keys(value).sort();
|
|
22784
22784
|
const parts = [];
|
|
22785
22785
|
for (const k of keys) {
|
|
22786
|
-
const
|
|
22787
|
-
if (
|
|
22786
|
+
const key3 = canonicalKey(value[k], seen);
|
|
22787
|
+
if (key3 === null)
|
|
22788
22788
|
return null;
|
|
22789
|
-
parts.push(`${k.length}:${k}=${
|
|
22789
|
+
parts.push(`${k.length}:${k}=${key3}`);
|
|
22790
22790
|
}
|
|
22791
22791
|
return `o${parts.length}:{${parts.join(",")}}`;
|
|
22792
22792
|
} finally {
|
|
@@ -22826,10 +22826,10 @@ function containsRef(value) {
|
|
|
22826
22826
|
return value.some(containsRef);
|
|
22827
22827
|
if (typeof value.$ref === "string")
|
|
22828
22828
|
return true;
|
|
22829
|
-
return Object.entries(value).some(([
|
|
22830
|
-
if (SCHEMA_KEYWORDS.has(
|
|
22829
|
+
return Object.entries(value).some(([key3, sub]) => {
|
|
22830
|
+
if (SCHEMA_KEYWORDS.has(key3))
|
|
22831
22831
|
return containsRef(sub);
|
|
22832
|
-
if (!SCHEMA_MAP_KEYWORDS.has(
|
|
22832
|
+
if (!SCHEMA_MAP_KEYWORDS.has(key3) || typeof sub !== "object" || sub === null)
|
|
22833
22833
|
return false;
|
|
22834
22834
|
return Object.values(sub).some(containsRef);
|
|
22835
22835
|
});
|
|
@@ -22845,12 +22845,12 @@ function checkArrayGuards(arraySchema, guards) {
|
|
|
22845
22845
|
if (guards.uniqueItems === true) {
|
|
22846
22846
|
const firstSeen = /* @__PURE__ */ new Map();
|
|
22847
22847
|
for (let i = 0; i < items.length; i++) {
|
|
22848
|
-
const
|
|
22849
|
-
if (
|
|
22848
|
+
const key3 = canonicalKey(items[i], /* @__PURE__ */ new Set());
|
|
22849
|
+
if (key3 === null)
|
|
22850
22850
|
continue;
|
|
22851
|
-
const first = firstSeen.get(
|
|
22851
|
+
const first = firstSeen.get(key3);
|
|
22852
22852
|
if (first === void 0) {
|
|
22853
|
-
firstSeen.set(
|
|
22853
|
+
firstSeen.set(key3, i);
|
|
22854
22854
|
continue;
|
|
22855
22855
|
}
|
|
22856
22856
|
payload.issues.push({
|
|
@@ -23089,9 +23089,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
23089
23089
|
const properties = schema.properties || {};
|
|
23090
23090
|
const requiredSet = new Set(schema.required || []);
|
|
23091
23091
|
const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : void 0;
|
|
23092
|
-
for (const [
|
|
23092
|
+
for (const [key3, propSchema] of Object.entries(properties)) {
|
|
23093
23093
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
23094
|
-
assignProp(shape,
|
|
23094
|
+
assignProp(shape, key3, requiredSet.has(key3) ? propZodSchema : propZodSchema.optional());
|
|
23095
23095
|
}
|
|
23096
23096
|
if (schema.patternProperties) {
|
|
23097
23097
|
const patternProps = schema.patternProperties;
|
|
@@ -23126,12 +23126,12 @@ function convertBaseSchema(schema, ctx) {
|
|
|
23126
23126
|
if (!isPlainObject(payload.value))
|
|
23127
23127
|
return;
|
|
23128
23128
|
const unrecognized = [];
|
|
23129
|
-
for (const
|
|
23130
|
-
if (propertyKeys.includes(
|
|
23129
|
+
for (const key3 of Object.keys(payload.value)) {
|
|
23130
|
+
if (propertyKeys.includes(key3))
|
|
23131
23131
|
continue;
|
|
23132
|
-
if (patterns.some((regex) => regex.test(
|
|
23132
|
+
if (patterns.some((regex) => regex.test(key3)))
|
|
23133
23133
|
continue;
|
|
23134
|
-
unrecognized.push(
|
|
23134
|
+
unrecognized.push(key3);
|
|
23135
23135
|
}
|
|
23136
23136
|
if (unrecognized.length) {
|
|
23137
23137
|
payload.issues.push({
|
|
@@ -23262,38 +23262,38 @@ function convertSchema(schema, ctx) {
|
|
|
23262
23262
|
}
|
|
23263
23263
|
const extraMeta = {};
|
|
23264
23264
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
23265
|
-
for (const
|
|
23266
|
-
if (
|
|
23267
|
-
extraMeta[
|
|
23265
|
+
for (const key3 of coreMetadataKeys) {
|
|
23266
|
+
if (key3 in schema) {
|
|
23267
|
+
extraMeta[key3] = schema[key3];
|
|
23268
23268
|
}
|
|
23269
23269
|
}
|
|
23270
23270
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
23271
|
-
for (const
|
|
23272
|
-
if (
|
|
23273
|
-
extraMeta[
|
|
23271
|
+
for (const key3 of contentMetadataKeys) {
|
|
23272
|
+
if (key3 in schema) {
|
|
23273
|
+
extraMeta[key3] = schema[key3];
|
|
23274
23274
|
}
|
|
23275
23275
|
}
|
|
23276
23276
|
if (schema.type === "object" && schema.$ref === void 0) {
|
|
23277
23277
|
if (schema.propertyNames !== void 0 && !containsRef(schema.propertyNames)) {
|
|
23278
23278
|
extraMeta.propertyNames = schema.propertyNames;
|
|
23279
23279
|
}
|
|
23280
|
-
for (const
|
|
23281
|
-
if (schema[
|
|
23282
|
-
extraMeta[
|
|
23280
|
+
for (const key3 of ["minProperties", "maxProperties"]) {
|
|
23281
|
+
if (schema[key3] !== void 0)
|
|
23282
|
+
extraMeta[key3] = schema[key3];
|
|
23283
23283
|
}
|
|
23284
23284
|
}
|
|
23285
23285
|
if (schema.type === "array" && schema.$ref === void 0) {
|
|
23286
23286
|
if (schema.contains !== void 0 && !containsRef(schema.contains)) {
|
|
23287
23287
|
extraMeta.contains = schema.contains;
|
|
23288
23288
|
}
|
|
23289
|
-
for (const
|
|
23290
|
-
if (schema[
|
|
23291
|
-
extraMeta[
|
|
23289
|
+
for (const key3 of ["uniqueItems", "minContains", "maxContains"]) {
|
|
23290
|
+
if (schema[key3] !== void 0)
|
|
23291
|
+
extraMeta[key3] = schema[key3];
|
|
23292
23292
|
}
|
|
23293
23293
|
}
|
|
23294
|
-
for (const
|
|
23295
|
-
if (!RECOGNIZED_KEYS.has(
|
|
23296
|
-
assignProp(extraMeta,
|
|
23294
|
+
for (const key3 of Object.keys(schema)) {
|
|
23295
|
+
if (!RECOGNIZED_KEYS.has(key3)) {
|
|
23296
|
+
assignProp(extraMeta, key3, schema[key3]);
|
|
23297
23297
|
}
|
|
23298
23298
|
}
|
|
23299
23299
|
if (Object.keys(extraMeta).length > 0) {
|
|
@@ -24711,7 +24711,7 @@ var TOOL_RESULT_FOREIGN_FAMILY_KEYS = [
|
|
|
24711
24711
|
"requestState"
|
|
24712
24712
|
];
|
|
24713
24713
|
function normalizeContentlessToolResult(value) {
|
|
24714
|
-
if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== void 0 || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((
|
|
24714
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== void 0 || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((key3) => key3 in value)) return value;
|
|
24715
24715
|
return {
|
|
24716
24716
|
...value,
|
|
24717
24717
|
content: []
|
|
@@ -25581,10 +25581,10 @@ function build$1() {
|
|
|
25581
25581
|
]),
|
|
25582
25582
|
CallToolResultWireSchema: unknown().superRefine((value, ctx) => {
|
|
25583
25583
|
if (typeof value !== "object" || value === null || Array.isArray(value) || value.content !== void 0) return;
|
|
25584
|
-
for (const
|
|
25584
|
+
for (const key3 of TOOL_RESULT_FOREIGN_FAMILY_KEYS) if (key3 in value) {
|
|
25585
25585
|
ctx.addIssue({
|
|
25586
25586
|
code: "custom",
|
|
25587
|
-
message: `content is required when the body carries '${
|
|
25587
|
+
message: `content is required when the body carries '${key3}' \u2014 another result family cannot default into an empty tools/call success`
|
|
25588
25588
|
});
|
|
25589
25589
|
return;
|
|
25590
25590
|
}
|
|
@@ -27122,17 +27122,17 @@ var rev2026Codec = {
|
|
|
27122
27122
|
},
|
|
27123
27123
|
validateEnvelopeMeta(meta3) {
|
|
27124
27124
|
const issues = [];
|
|
27125
|
-
for (const
|
|
27126
|
-
key:
|
|
27125
|
+
for (const key3 of REQUIRED_ENVELOPE_KEYS) if (!(key3 in meta3)) issues.push({
|
|
27126
|
+
key: key3,
|
|
27127
27127
|
problem: "missing"
|
|
27128
27128
|
});
|
|
27129
27129
|
const parsed = buildSchemas2026().RequestMetaEnvelopeSchema.safeParse(meta3);
|
|
27130
27130
|
if (!parsed.success) for (const issue2 of parsed.error.issues) {
|
|
27131
27131
|
const path = issue2.path.map(String);
|
|
27132
|
-
const
|
|
27133
|
-
if (path.length === 1 && issues.some((existing) => existing.key ===
|
|
27132
|
+
const key3 = path.length > 0 ? path.join(".") : "_meta";
|
|
27133
|
+
if (path.length === 1 && issues.some((existing) => existing.key === key3 && existing.problem === "missing")) continue;
|
|
27134
27134
|
issues.push({
|
|
27135
|
-
key:
|
|
27135
|
+
key: key3,
|
|
27136
27136
|
problem: issue2.message
|
|
27137
27137
|
});
|
|
27138
27138
|
}
|
|
@@ -27482,8 +27482,8 @@ function scanXMcpHeaderDeclarations(inputSchema) {
|
|
|
27482
27482
|
});
|
|
27483
27483
|
}
|
|
27484
27484
|
const properties = schema.properties;
|
|
27485
|
-
if (properties !== null && typeof properties === "object") for (const [
|
|
27486
|
-
const fault$1 = visit2(child, [...path,
|
|
27485
|
+
if (properties !== null && typeof properties === "object") for (const [key3, child] of Object.entries(properties)) {
|
|
27486
|
+
const fault$1 = visit2(child, [...path, key3], reachable);
|
|
27487
27487
|
if (fault$1 !== void 0) return fault$1;
|
|
27488
27488
|
}
|
|
27489
27489
|
for (const k of NON_REACHABLE_SUBSCHEMA_KEYWORDS) {
|
|
@@ -27713,12 +27713,12 @@ function isProvablyObjectShapedRoot(schema, root = schema) {
|
|
|
27713
27713
|
if ("properties" in schema || "patternProperties" in schema || "additionalProperties" in schema || "required" in schema) return true;
|
|
27714
27714
|
const ref = typeof schema.$ref === "string" && LOCAL_DEFINITION_REF.exec(schema.$ref);
|
|
27715
27715
|
if (ref && root[ref[1]]?.[ref[2]]?.type === "object") return true;
|
|
27716
|
-
for (const
|
|
27716
|
+
for (const key3 of [
|
|
27717
27717
|
"oneOf",
|
|
27718
27718
|
"anyOf",
|
|
27719
27719
|
"allOf"
|
|
27720
27720
|
]) {
|
|
27721
|
-
const members2 = schema[
|
|
27721
|
+
const members2 = schema[key3];
|
|
27722
27722
|
if (Array.isArray(members2) && members2.length > 0) return members2.every((m) => m !== null && typeof m === "object" && (m.type === "object" || isProvablyObjectShapedRoot(m, "$id" in m ? {} : root)));
|
|
27723
27723
|
}
|
|
27724
27724
|
return false;
|
|
@@ -27812,8 +27812,8 @@ var ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
27812
27812
|
"title",
|
|
27813
27813
|
"writeOnly"
|
|
27814
27814
|
]);
|
|
27815
|
-
function isAnnotationOnlyJsonSchemaKeyword(
|
|
27816
|
-
return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(
|
|
27815
|
+
function isAnnotationOnlyJsonSchemaKeyword(key3) {
|
|
27816
|
+
return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(key3) || key3.startsWith("x-");
|
|
27817
27817
|
}
|
|
27818
27818
|
var ROOT_KEYS = /* @__PURE__ */ new Set(["$schema", ...Object.keys(ElicitRequestFormParamsSchema.shape.requestedSchema.shape)]);
|
|
27819
27819
|
var PROPERTY_KEYS_BY_TYPE = {
|
|
@@ -27834,19 +27834,19 @@ function walkProperty(node2, path, vendor, unsupported) {
|
|
|
27834
27834
|
const allowedKeys = typeof node2.type === "string" && Object.hasOwn(PROPERTY_KEYS_BY_TYPE, node2.type) ? PROPERTY_KEYS_BY_TYPE[node2.type] : void 0;
|
|
27835
27835
|
if (allowedKeys === void 0) return node2;
|
|
27836
27836
|
const pruned = {};
|
|
27837
|
-
for (const [
|
|
27838
|
-
else if (
|
|
27839
|
-
if (!SUPPORTED_STRING_FORMATS.has(node2.format)) pruned[
|
|
27840
|
-
else if (typeof value !== "string" || !isLibraryFormatPattern(node2.format, value, vendor)) unsupported.push(`${path}.${
|
|
27841
|
-
} else unsupported.push(`${path}.${
|
|
27837
|
+
for (const [key3, value] of Object.entries(node2)) if (allowedKeys.has(key3) || isAnnotationOnlyJsonSchemaKeyword(key3)) pruned[key3] = value;
|
|
27838
|
+
else if (key3 === "pattern" && node2.type === "string" && typeof node2.format === "string") {
|
|
27839
|
+
if (!SUPPORTED_STRING_FORMATS.has(node2.format)) pruned[key3] = value;
|
|
27840
|
+
else if (typeof value !== "string" || !isLibraryFormatPattern(node2.format, value, vendor)) unsupported.push(`${path}.${key3}`);
|
|
27841
|
+
} else unsupported.push(`${path}.${key3}`);
|
|
27842
27842
|
return pruned;
|
|
27843
27843
|
}
|
|
27844
27844
|
function walkRequestedSchema(converted, vendor) {
|
|
27845
27845
|
const pruned = {};
|
|
27846
27846
|
const unsupported = [];
|
|
27847
|
-
for (const [
|
|
27848
|
-
else if (ROOT_KEYS.has(
|
|
27849
|
-
else if (!isAnnotationOnlyJsonSchemaKeyword(
|
|
27847
|
+
for (const [key3, value] of Object.entries(converted)) if (key3 === "properties" && isJsonObject(value)) pruned[key3] = Object.fromEntries(Object.entries(value).map(([name, node2]) => [name, walkProperty(node2, `properties.${name}`, vendor, unsupported)]));
|
|
27848
|
+
else if (ROOT_KEYS.has(key3)) pruned[key3] = value;
|
|
27849
|
+
else if (!isAnnotationOnlyJsonSchemaKeyword(key3)) unsupported.push(key3);
|
|
27850
27850
|
if (unsupported.length > 0) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${unsupported.join(", ")}`);
|
|
27851
27851
|
return pruned;
|
|
27852
27852
|
}
|
|
@@ -27858,10 +27858,10 @@ function describeUnsupportedProperties(pruned, fallback) {
|
|
|
27858
27858
|
function findDroppedConstraintPaths(original, parsed, path = "") {
|
|
27859
27859
|
if (Array.isArray(original) && Array.isArray(parsed)) return original.flatMap((item, index) => findDroppedConstraintPaths(item, parsed[index], `${path}[${index}]`));
|
|
27860
27860
|
if (!isJsonObject(original) || !isJsonObject(parsed)) return [];
|
|
27861
|
-
return Object.entries(original).flatMap(([
|
|
27862
|
-
const childPath = path ? `${path}.${
|
|
27863
|
-
if (!Object.prototype.hasOwnProperty.call(parsed,
|
|
27864
|
-
return findDroppedConstraintPaths(value, parsed[
|
|
27861
|
+
return Object.entries(original).flatMap(([key3, value]) => {
|
|
27862
|
+
const childPath = path ? `${path}.${key3}` : key3;
|
|
27863
|
+
if (!Object.prototype.hasOwnProperty.call(parsed, key3)) return isAnnotationOnlyJsonSchemaKeyword(key3) ? [] : [childPath];
|
|
27864
|
+
return findDroppedConstraintPaths(value, parsed[key3], childPath);
|
|
27865
27865
|
});
|
|
27866
27866
|
}
|
|
27867
27867
|
function normalizeElicitInputParams(input2) {
|
|
@@ -27876,7 +27876,7 @@ function normalizeElicitInputParams(input2) {
|
|
|
27876
27876
|
if (!parsed.success) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${describeUnsupportedProperties(pruned, parsed.error.message)}`);
|
|
27877
27877
|
const droppedConstraints = findDroppedConstraintPaths(pruned, parsed.data);
|
|
27878
27878
|
if (droppedConstraints.length > 0) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${droppedConstraints.join(", ")}`);
|
|
27879
|
-
const danglingRequired = (parsed.data.required ?? []).filter((
|
|
27879
|
+
const danglingRequired = (parsed.data.required ?? []).filter((key3) => !Object.prototype.hasOwnProperty.call(parsed.data.properties, key3));
|
|
27880
27880
|
if (danglingRequired.length > 0) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema lists required properties that are not defined in properties: ${danglingRequired.join(", ")}`);
|
|
27881
27881
|
return {
|
|
27882
27882
|
...input2,
|
|
@@ -27924,17 +27924,17 @@ var inputRequired = Object.assign(buildInputRequired, {
|
|
|
27924
27924
|
return { method: "roots/list" };
|
|
27925
27925
|
}
|
|
27926
27926
|
});
|
|
27927
|
-
function acceptedContent(responses,
|
|
27928
|
-
const view = inputResponse(responses,
|
|
27927
|
+
function acceptedContent(responses, key3, schema) {
|
|
27928
|
+
const view = inputResponse(responses, key3);
|
|
27929
27929
|
if (view.kind !== "elicit" || view.action !== "accept" || view.content === void 0) return void 0;
|
|
27930
27930
|
if (schema === void 0) return view.content;
|
|
27931
27931
|
const outcome = schema["~standard"].validate(view.content);
|
|
27932
27932
|
if (outcome instanceof Promise) throw new TypeError("acceptedContent(responses, key, schema) requires a synchronously-validating schema");
|
|
27933
27933
|
return outcome.issues === void 0 ? outcome.value : void 0;
|
|
27934
27934
|
}
|
|
27935
|
-
function inputResponse(responses,
|
|
27935
|
+
function inputResponse(responses, key3) {
|
|
27936
27936
|
if (responses === void 0 || typeof responses !== "object" || responses === null) return { kind: "missing" };
|
|
27937
|
-
const entry = responses[
|
|
27937
|
+
const entry = responses[key3];
|
|
27938
27938
|
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return { kind: "missing" };
|
|
27939
27939
|
const candidate = entry;
|
|
27940
27940
|
if (candidate["action"] === "accept" || candidate["action"] === "decline" || candidate["action"] === "cancel") {
|
|
@@ -28166,13 +28166,13 @@ var authSchemas = {
|
|
|
28166
28166
|
};
|
|
28167
28167
|
var _specTypeSchemas = {};
|
|
28168
28168
|
var _isSpecType = {};
|
|
28169
|
-
function register(
|
|
28170
|
-
const name =
|
|
28169
|
+
function register(key3, schema) {
|
|
28170
|
+
const name = key3.slice(0, -6);
|
|
28171
28171
|
_specTypeSchemas[name] = schema;
|
|
28172
28172
|
_isSpecType[name] = (v) => schema.safeParse(v).success;
|
|
28173
28173
|
}
|
|
28174
|
-
for (const
|
|
28175
|
-
for (const [
|
|
28174
|
+
for (const key3 of SPEC_SCHEMA_KEYS) register(key3, schemas_exports3[key3]);
|
|
28175
|
+
for (const [key3, schema] of Object.entries(authSchemas)) register(key3, schema);
|
|
28176
28176
|
var specTypeSchemas = Object.freeze(_specTypeSchemas);
|
|
28177
28177
|
var isSpecType = Object.freeze(_isSpecType);
|
|
28178
28178
|
function bootstrapOutboundCodec(method) {
|
|
@@ -28201,8 +28201,8 @@ function liftWireOnlyMaterial(message, kind) {
|
|
|
28201
28201
|
lifted: {}
|
|
28202
28202
|
};
|
|
28203
28203
|
const meta3 = params._meta;
|
|
28204
|
-
const envelopeKeys = isPlainObject$1(meta3) ? RESERVED_ENVELOPE_META_KEYS.filter((
|
|
28205
|
-
const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((
|
|
28204
|
+
const envelopeKeys = isPlainObject$1(meta3) ? RESERVED_ENVELOPE_META_KEYS.filter((key3) => key3 in meta3) : [];
|
|
28205
|
+
const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((key3) => key3 in params) : [];
|
|
28206
28206
|
if (envelopeKeys.length === 0 && retryKeys.length === 0) return {
|
|
28207
28207
|
message,
|
|
28208
28208
|
lifted: {}
|
|
@@ -28212,18 +28212,18 @@ function liftWireOnlyMaterial(message, kind) {
|
|
|
28212
28212
|
if (envelopeKeys.length > 0 && isPlainObject$1(meta3)) {
|
|
28213
28213
|
const envelope = {};
|
|
28214
28214
|
const nextMeta = { ...meta3 };
|
|
28215
|
-
for (const
|
|
28216
|
-
envelope[
|
|
28217
|
-
delete nextMeta[
|
|
28215
|
+
for (const key3 of envelopeKeys) {
|
|
28216
|
+
envelope[key3] = meta3[key3];
|
|
28217
|
+
delete nextMeta[key3];
|
|
28218
28218
|
}
|
|
28219
28219
|
lifted.envelope = envelope;
|
|
28220
28220
|
if (Object.keys(nextMeta).length > 0) nextParams._meta = nextMeta;
|
|
28221
28221
|
else delete nextParams._meta;
|
|
28222
28222
|
}
|
|
28223
|
-
for (const
|
|
28224
|
-
if (
|
|
28225
|
-
if (
|
|
28226
|
-
delete nextParams[
|
|
28223
|
+
for (const key3 of retryKeys) {
|
|
28224
|
+
if (key3 === "inputResponses") lifted.inputResponses = nextParams[key3];
|
|
28225
|
+
if (key3 === "requestState") lifted.requestState = nextParams[key3];
|
|
28226
|
+
delete nextParams[key3];
|
|
28227
28227
|
}
|
|
28228
28228
|
return {
|
|
28229
28229
|
message: {
|
|
@@ -29004,8 +29004,8 @@ function isPlainObject$1(value) {
|
|
|
29004
29004
|
}
|
|
29005
29005
|
function mergeCapabilities(base, additional) {
|
|
29006
29006
|
const result = { ...base };
|
|
29007
|
-
for (const
|
|
29008
|
-
const k =
|
|
29007
|
+
for (const key3 in additional) {
|
|
29008
|
+
const k = key3;
|
|
29009
29009
|
const addValue = additional[k];
|
|
29010
29010
|
if (addValue === void 0) continue;
|
|
29011
29011
|
const baseValue = result[k];
|
|
@@ -29026,12 +29026,12 @@ function partitionInputResponses(inputResponses) {
|
|
|
29026
29026
|
accepted,
|
|
29027
29027
|
droppedKeys
|
|
29028
29028
|
};
|
|
29029
|
-
for (const [
|
|
29029
|
+
for (const [key3, entry] of Object.entries(inputResponses)) {
|
|
29030
29030
|
if (!isPlainObject2(entry) || "method" in entry || "result" in entry) {
|
|
29031
|
-
droppedKeys.push(
|
|
29031
|
+
droppedKeys.push(key3);
|
|
29032
29032
|
continue;
|
|
29033
29033
|
}
|
|
29034
|
-
accepted[
|
|
29034
|
+
accepted[key3] = entry;
|
|
29035
29035
|
}
|
|
29036
29036
|
return {
|
|
29037
29037
|
accepted,
|
|
@@ -29060,20 +29060,20 @@ var require_content_type = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29060
29060
|
if (!TYPE_REGEXP.test(type)) throw new TypeError("invalid media type");
|
|
29061
29061
|
var obj = new ContentType(type.toLowerCase());
|
|
29062
29062
|
if (index !== -1) {
|
|
29063
|
-
var
|
|
29063
|
+
var key3;
|
|
29064
29064
|
var match;
|
|
29065
29065
|
var value;
|
|
29066
29066
|
PARAM_REGEXP.lastIndex = index;
|
|
29067
29067
|
while (match = PARAM_REGEXP.exec(header)) {
|
|
29068
29068
|
if (match.index !== index) throw new TypeError("invalid parameter format");
|
|
29069
29069
|
index += match[0].length;
|
|
29070
|
-
|
|
29070
|
+
key3 = match[1].toLowerCase();
|
|
29071
29071
|
value = match[2];
|
|
29072
29072
|
if (value.charCodeAt(0) === 34) {
|
|
29073
29073
|
value = value.slice(1, -1);
|
|
29074
29074
|
if (value.indexOf("\\") !== -1) value = value.replace(QESC_REGEXP, "$1");
|
|
29075
29075
|
}
|
|
29076
|
-
obj.parameters[
|
|
29076
|
+
obj.parameters[key3] = value;
|
|
29077
29077
|
}
|
|
29078
29078
|
if (index !== header.length) throw new TypeError("invalid parameter format");
|
|
29079
29079
|
}
|
|
@@ -29315,13 +29315,13 @@ var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29315
29315
|
return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
29316
29316
|
}
|
|
29317
29317
|
exports.safeStringify = safeStringify;
|
|
29318
|
-
function getProperty(
|
|
29319
|
-
return typeof
|
|
29318
|
+
function getProperty(key3) {
|
|
29319
|
+
return typeof key3 == "string" && exports.IDENTIFIER.test(key3) ? new _Code(`.${key3}`) : _`[${key3}]`;
|
|
29320
29320
|
}
|
|
29321
29321
|
exports.getProperty = getProperty;
|
|
29322
|
-
function getEsmExportName(
|
|
29323
|
-
if (typeof
|
|
29324
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
29322
|
+
function getEsmExportName(key3) {
|
|
29323
|
+
if (typeof key3 == "string" && exports.IDENTIFIER.test(key3)) return new _Code(`${key3}`);
|
|
29324
|
+
throw new Error(`CodeGen: invalid export name: ${key3}, use explicit $id name mapping`);
|
|
29325
29325
|
}
|
|
29326
29326
|
exports.getEsmExportName = getEsmExportName;
|
|
29327
29327
|
function regexpCode(rx) {
|
|
@@ -29932,10 +29932,10 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29932
29932
|
}
|
|
29933
29933
|
object(...keyValues) {
|
|
29934
29934
|
const code2 = ["{"];
|
|
29935
|
-
for (const [
|
|
29935
|
+
for (const [key3, value] of keyValues) {
|
|
29936
29936
|
if (code2.length > 1) code2.push(",");
|
|
29937
|
-
code2.push(
|
|
29938
|
-
if (
|
|
29937
|
+
code2.push(key3);
|
|
29938
|
+
if (key3 !== value || this.opts.es5) {
|
|
29939
29939
|
code2.push(":");
|
|
29940
29940
|
(0, code_1.addCodeArg)(code2, value);
|
|
29941
29941
|
}
|
|
@@ -30157,18 +30157,18 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
30157
30157
|
if (!opts.strictSchema) return;
|
|
30158
30158
|
if (typeof schema === "boolean") return;
|
|
30159
30159
|
const rules = self.RULES.keywords;
|
|
30160
|
-
for (const
|
|
30160
|
+
for (const key3 in schema) if (!rules[key3]) checkStrictMode(it, `unknown keyword: "${key3}"`);
|
|
30161
30161
|
}
|
|
30162
30162
|
exports.checkUnknownRules = checkUnknownRules;
|
|
30163
30163
|
function schemaHasRules(schema, rules) {
|
|
30164
30164
|
if (typeof schema == "boolean") return !schema;
|
|
30165
|
-
for (const
|
|
30165
|
+
for (const key3 in schema) if (rules[key3]) return true;
|
|
30166
30166
|
return false;
|
|
30167
30167
|
}
|
|
30168
30168
|
exports.schemaHasRules = schemaHasRules;
|
|
30169
30169
|
function schemaHasRulesButRef(schema, RULES) {
|
|
30170
30170
|
if (typeof schema == "boolean") return !schema;
|
|
30171
|
-
for (const
|
|
30171
|
+
for (const key3 in schema) if (key3 !== "$ref" && RULES.all[key3]) return true;
|
|
30172
30172
|
return false;
|
|
30173
30173
|
}
|
|
30174
30174
|
exports.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
@@ -30675,7 +30675,7 @@ var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
30675
30675
|
const util_1 = require_util();
|
|
30676
30676
|
function assignDefaults(it, ty) {
|
|
30677
30677
|
const { properties, items } = it.schema;
|
|
30678
|
-
if (ty === "object" && properties) for (const
|
|
30678
|
+
if (ty === "object" && properties) for (const key3 in properties) assignDefault(it, key3, properties[key3].default);
|
|
30679
30679
|
else if (ty === "array" && Array.isArray(items)) items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
30680
30680
|
}
|
|
30681
30681
|
exports.assignDefaults = assignDefaults;
|
|
@@ -31001,8 +31001,8 @@ var require_fast_deep_equal = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
31001
31001
|
if (length !== Object.keys(b).length) return false;
|
|
31002
31002
|
for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
31003
31003
|
for (i = length; i-- !== 0; ) {
|
|
31004
|
-
var
|
|
31005
|
-
if (!equal(a[
|
|
31004
|
+
var key3 = keys[i];
|
|
31005
|
+
if (!equal(a[key3], b[key3])) return false;
|
|
31006
31006
|
}
|
|
31007
31007
|
return true;
|
|
31008
31008
|
}
|
|
@@ -31069,13 +31069,13 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin(((exports, modu
|
|
|
31069
31069
|
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
31070
31070
|
if (schema && typeof schema == "object" && !Array.isArray(schema)) {
|
|
31071
31071
|
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
31072
|
-
for (var
|
|
31073
|
-
var sch = schema[
|
|
31072
|
+
for (var key3 in schema) {
|
|
31073
|
+
var sch = schema[key3];
|
|
31074
31074
|
if (Array.isArray(sch)) {
|
|
31075
|
-
if (
|
|
31076
|
-
} else if (
|
|
31077
|
-
if (sch && typeof sch == "object") for (var prop in sch) _traverse(opts, pre, post, sch[prop], jsonPtr + "/" +
|
|
31078
|
-
} else if (
|
|
31075
|
+
if (key3 in traverse.arrayKeywords) for (var i = 0; i < sch.length; i++) _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key3 + "/" + i, rootSchema, jsonPtr, key3, schema, i);
|
|
31076
|
+
} else if (key3 in traverse.propsKeywords) {
|
|
31077
|
+
if (sch && typeof sch == "object") for (var prop in sch) _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key3 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key3, schema, prop);
|
|
31078
|
+
} else if (key3 in traverse.keywords || opts.allKeys && !(key3 in traverse.skipKeywords)) _traverse(opts, pre, post, sch, jsonPtr + "/" + key3, rootSchema, jsonPtr, key3, schema);
|
|
31079
31079
|
}
|
|
31080
31080
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
31081
31081
|
}
|
|
@@ -31123,9 +31123,9 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31123
31123
|
"$dynamicAnchor"
|
|
31124
31124
|
]);
|
|
31125
31125
|
function hasRef(schema) {
|
|
31126
|
-
for (const
|
|
31127
|
-
if (REF_KEYWORDS.has(
|
|
31128
|
-
const sch = schema[
|
|
31126
|
+
for (const key3 in schema) {
|
|
31127
|
+
if (REF_KEYWORDS.has(key3)) return true;
|
|
31128
|
+
const sch = schema[key3];
|
|
31129
31129
|
if (Array.isArray(sch) && sch.some(hasRef)) return true;
|
|
31130
31130
|
if (typeof sch == "object" && hasRef(sch)) return true;
|
|
31131
31131
|
}
|
|
@@ -31133,11 +31133,11 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31133
31133
|
}
|
|
31134
31134
|
function countKeys(schema) {
|
|
31135
31135
|
let count = 0;
|
|
31136
|
-
for (const
|
|
31137
|
-
if (
|
|
31136
|
+
for (const key3 in schema) {
|
|
31137
|
+
if (key3 === "$ref") return Infinity;
|
|
31138
31138
|
count++;
|
|
31139
|
-
if (SIMPLE_INLINED.has(
|
|
31140
|
-
if (typeof schema[
|
|
31139
|
+
if (SIMPLE_INLINED.has(key3)) continue;
|
|
31140
|
+
if (typeof schema[key3] == "object") (0, util_1.eachItem)(schema[key3], (sch) => count += countKeys(sch));
|
|
31141
31141
|
if (count === Infinity) return Infinity;
|
|
31142
31142
|
}
|
|
31143
31143
|
return count;
|
|
@@ -31295,7 +31295,7 @@ var require_validate = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31295
31295
|
}
|
|
31296
31296
|
function schemaCxtHasRules({ schema, self }) {
|
|
31297
31297
|
if (typeof schema == "boolean") return !schema;
|
|
31298
|
-
for (const
|
|
31298
|
+
for (const key3 in schema) if (self.RULES.all[key3]) return true;
|
|
31299
31299
|
return false;
|
|
31300
31300
|
}
|
|
31301
31301
|
function isSchemaObj(it) {
|
|
@@ -33028,7 +33028,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
33028
33028
|
}
|
|
33029
33029
|
}
|
|
33030
33030
|
}
|
|
33031
|
-
addSchema(schema,
|
|
33031
|
+
addSchema(schema, key3, _meta, _validateSchema = this.opts.validateSchema) {
|
|
33032
33032
|
if (Array.isArray(schema)) {
|
|
33033
33033
|
for (const sch of schema) this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
33034
33034
|
return this;
|
|
@@ -33039,13 +33039,13 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
33039
33039
|
id2 = schema[schemaId];
|
|
33040
33040
|
if (id2 !== void 0 && typeof id2 != "string") throw new Error(`schema ${schemaId} must be string`);
|
|
33041
33041
|
}
|
|
33042
|
-
|
|
33043
|
-
this._checkUnique(
|
|
33044
|
-
this.schemas[
|
|
33042
|
+
key3 = (0, resolve_1.normalizeId)(key3 || id2);
|
|
33043
|
+
this._checkUnique(key3);
|
|
33044
|
+
this.schemas[key3] = this._addSchema(schema, _meta, key3, _validateSchema, true);
|
|
33045
33045
|
return this;
|
|
33046
33046
|
}
|
|
33047
|
-
addMetaSchema(schema,
|
|
33048
|
-
this.addSchema(schema,
|
|
33047
|
+
addMetaSchema(schema, key3, _validateSchema = this.opts.validateSchema) {
|
|
33048
|
+
this.addSchema(schema, key3, true, _validateSchema);
|
|
33049
33049
|
return this;
|
|
33050
33050
|
}
|
|
33051
33051
|
validateSchema(schema, throwOrLogError) {
|
|
@@ -33177,12 +33177,12 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
33177
33177
|
const segments = jsonPointer.split("/").slice(1);
|
|
33178
33178
|
let keywords = metaSchema;
|
|
33179
33179
|
for (const seg of segments) keywords = keywords[seg];
|
|
33180
|
-
for (const
|
|
33181
|
-
const rule = rules[
|
|
33180
|
+
for (const key3 in rules) {
|
|
33181
|
+
const rule = rules[key3];
|
|
33182
33182
|
if (typeof rule != "object") continue;
|
|
33183
33183
|
const { $data } = rule.definition;
|
|
33184
|
-
const schema = keywords[
|
|
33185
|
-
if ($data && schema) keywords[
|
|
33184
|
+
const schema = keywords[key3];
|
|
33185
|
+
if ($data && schema) keywords[key3] = schemaOrData(schema);
|
|
33186
33186
|
}
|
|
33187
33187
|
}
|
|
33188
33188
|
return metaSchema;
|
|
@@ -33247,9 +33247,9 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
33247
33247
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
33248
33248
|
exports.default = Ajv2;
|
|
33249
33249
|
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
33250
|
-
for (const
|
|
33251
|
-
const opt =
|
|
33252
|
-
if (opt in options) this.logger[log](`${msg}: option ${
|
|
33250
|
+
for (const key3 in checkOpts) {
|
|
33251
|
+
const opt = key3;
|
|
33252
|
+
if (opt in options) this.logger[log](`${msg}: option ${key3}. ${checkOpts[opt]}`);
|
|
33253
33253
|
}
|
|
33254
33254
|
}
|
|
33255
33255
|
function getSchEnv(keyRef) {
|
|
@@ -33260,7 +33260,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
33260
33260
|
const optsSchemas = this.opts.schemas;
|
|
33261
33261
|
if (!optsSchemas) return;
|
|
33262
33262
|
if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas);
|
|
33263
|
-
else for (const
|
|
33263
|
+
else for (const key3 in optsSchemas) this.addSchema(optsSchemas[key3], key3);
|
|
33264
33264
|
}
|
|
33265
33265
|
function addInitialFormats() {
|
|
33266
33266
|
for (const name in this.opts.formats) {
|
|
@@ -34150,10 +34150,10 @@ var require_dependencies = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34150
34150
|
function splitDependencies({ schema }) {
|
|
34151
34151
|
const propertyDeps = {};
|
|
34152
34152
|
const schemaDeps = {};
|
|
34153
|
-
for (const
|
|
34154
|
-
if (
|
|
34155
|
-
const deps = Array.isArray(schema[
|
|
34156
|
-
deps[
|
|
34153
|
+
for (const key3 in schema) {
|
|
34154
|
+
if (key3 === "__proto__") continue;
|
|
34155
|
+
const deps = Array.isArray(schema[key3]) ? propertyDeps : schemaDeps;
|
|
34156
|
+
deps[key3] = schema[key3];
|
|
34157
34157
|
}
|
|
34158
34158
|
return [propertyDeps, schemaDeps];
|
|
34159
34159
|
}
|
|
@@ -34215,13 +34215,13 @@ var require_propertyNames = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34215
34215
|
const { gen, schema, data, it } = cxt;
|
|
34216
34216
|
if ((0, util_1.alwaysValidSchema)(it, schema)) return;
|
|
34217
34217
|
const valid = gen.name("valid");
|
|
34218
|
-
gen.forIn("key", data, (
|
|
34219
|
-
cxt.setParams({ propertyName:
|
|
34218
|
+
gen.forIn("key", data, (key3) => {
|
|
34219
|
+
cxt.setParams({ propertyName: key3 });
|
|
34220
34220
|
cxt.subschema({
|
|
34221
34221
|
keyword: "propertyNames",
|
|
34222
|
-
data:
|
|
34222
|
+
data: key3,
|
|
34223
34223
|
dataTypes: ["string"],
|
|
34224
|
-
propertyName:
|
|
34224
|
+
propertyName: key3,
|
|
34225
34225
|
compositeRule: true
|
|
34226
34226
|
}, valid);
|
|
34227
34227
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
@@ -34261,31 +34261,31 @@ var require_additionalProperties = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34261
34261
|
checkAdditionalProperties();
|
|
34262
34262
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
34263
34263
|
function checkAdditionalProperties() {
|
|
34264
|
-
gen.forIn("key", data, (
|
|
34265
|
-
if (!props.length && !patProps.length) additionalPropertyCode(
|
|
34266
|
-
else gen.if(isAdditional(
|
|
34264
|
+
gen.forIn("key", data, (key3) => {
|
|
34265
|
+
if (!props.length && !patProps.length) additionalPropertyCode(key3);
|
|
34266
|
+
else gen.if(isAdditional(key3), () => additionalPropertyCode(key3));
|
|
34267
34267
|
});
|
|
34268
34268
|
}
|
|
34269
|
-
function isAdditional(
|
|
34269
|
+
function isAdditional(key3) {
|
|
34270
34270
|
let definedProp;
|
|
34271
34271
|
if (props.length > 8) {
|
|
34272
34272
|
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
|
|
34273
|
-
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema,
|
|
34274
|
-
} else if (props.length) definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${
|
|
34273
|
+
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key3);
|
|
34274
|
+
} else if (props.length) definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key3} === ${p}`));
|
|
34275
34275
|
else definedProp = codegen_1.nil;
|
|
34276
|
-
if (patProps.length) definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${
|
|
34276
|
+
if (patProps.length) definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key3})`));
|
|
34277
34277
|
return (0, codegen_1.not)(definedProp);
|
|
34278
34278
|
}
|
|
34279
|
-
function deleteAdditional(
|
|
34280
|
-
gen.code((0, codegen_1._)`delete ${data}[${
|
|
34279
|
+
function deleteAdditional(key3) {
|
|
34280
|
+
gen.code((0, codegen_1._)`delete ${data}[${key3}]`);
|
|
34281
34281
|
}
|
|
34282
|
-
function additionalPropertyCode(
|
|
34282
|
+
function additionalPropertyCode(key3) {
|
|
34283
34283
|
if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
|
|
34284
|
-
deleteAdditional(
|
|
34284
|
+
deleteAdditional(key3);
|
|
34285
34285
|
return;
|
|
34286
34286
|
}
|
|
34287
34287
|
if (schema === false) {
|
|
34288
|
-
cxt.setParams({ additionalProperty:
|
|
34288
|
+
cxt.setParams({ additionalProperty: key3 });
|
|
34289
34289
|
cxt.error();
|
|
34290
34290
|
if (!allErrors) gen.break();
|
|
34291
34291
|
return;
|
|
@@ -34293,21 +34293,21 @@ var require_additionalProperties = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34293
34293
|
if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
34294
34294
|
const valid = gen.name("valid");
|
|
34295
34295
|
if (opts.removeAdditional === "failing") {
|
|
34296
|
-
applyAdditionalSchema(
|
|
34296
|
+
applyAdditionalSchema(key3, valid, false);
|
|
34297
34297
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
34298
34298
|
cxt.reset();
|
|
34299
|
-
deleteAdditional(
|
|
34299
|
+
deleteAdditional(key3);
|
|
34300
34300
|
});
|
|
34301
34301
|
} else {
|
|
34302
|
-
applyAdditionalSchema(
|
|
34302
|
+
applyAdditionalSchema(key3, valid);
|
|
34303
34303
|
if (!allErrors) gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
34304
34304
|
}
|
|
34305
34305
|
}
|
|
34306
34306
|
}
|
|
34307
|
-
function applyAdditionalSchema(
|
|
34307
|
+
function applyAdditionalSchema(key3, valid, errors) {
|
|
34308
34308
|
const subschema = {
|
|
34309
34309
|
keyword: "additionalProperties",
|
|
34310
|
-
dataProp:
|
|
34310
|
+
dataProp: key3,
|
|
34311
34311
|
dataPropType: util_1.Type.Str
|
|
34312
34312
|
};
|
|
34313
34313
|
if (errors === false) Object.assign(subschema, {
|
|
@@ -34401,16 +34401,16 @@ var require_patternProperties = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34401
34401
|
for (const prop in checkProperties) if (new RegExp(pat).test(prop)) (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
|
|
34402
34402
|
}
|
|
34403
34403
|
function validateProperties(pat) {
|
|
34404
|
-
gen.forIn("key", data, (
|
|
34405
|
-
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${
|
|
34404
|
+
gen.forIn("key", data, (key3) => {
|
|
34405
|
+
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key3})`, () => {
|
|
34406
34406
|
const alwaysValid = alwaysValidPatterns.includes(pat);
|
|
34407
34407
|
if (!alwaysValid) cxt.subschema({
|
|
34408
34408
|
keyword: "patternProperties",
|
|
34409
34409
|
schemaProp: pat,
|
|
34410
|
-
dataProp:
|
|
34410
|
+
dataProp: key3,
|
|
34411
34411
|
dataPropType: util_2.Type.Str
|
|
34412
34412
|
}, valid);
|
|
34413
|
-
if (it.opts.unevaluated && props !== true) gen.assign((0, codegen_1._)`${props}[${
|
|
34413
|
+
if (it.opts.unevaluated && props !== true) gen.assign((0, codegen_1._)`${props}[${key3}]`, true);
|
|
34414
34414
|
else if (!alwaysValid && !it.allErrors) gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
34415
34415
|
});
|
|
34416
34416
|
});
|
|
@@ -35261,13 +35261,13 @@ var require_unevaluatedProperties = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
35261
35261
|
const { gen, schema, data, errsCount, it } = cxt;
|
|
35262
35262
|
if (!errsCount) throw new Error("ajv implementation error");
|
|
35263
35263
|
const { allErrors, props } = it;
|
|
35264
|
-
if (props instanceof codegen_1.Name) gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (
|
|
35265
|
-
else if (props !== true) gen.forIn("key", data, (
|
|
35264
|
+
if (props instanceof codegen_1.Name) gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key3) => gen.if(unevaluatedDynamic(props, key3), () => unevaluatedPropCode(key3))));
|
|
35265
|
+
else if (props !== true) gen.forIn("key", data, (key3) => props === void 0 ? unevaluatedPropCode(key3) : gen.if(unevaluatedStatic(props, key3), () => unevaluatedPropCode(key3)));
|
|
35266
35266
|
it.props = true;
|
|
35267
35267
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
35268
|
-
function unevaluatedPropCode(
|
|
35268
|
+
function unevaluatedPropCode(key3) {
|
|
35269
35269
|
if (schema === false) {
|
|
35270
|
-
cxt.setParams({ unevaluatedProperty:
|
|
35270
|
+
cxt.setParams({ unevaluatedProperty: key3 });
|
|
35271
35271
|
cxt.error();
|
|
35272
35272
|
if (!allErrors) gen.break();
|
|
35273
35273
|
return;
|
|
@@ -35276,18 +35276,18 @@ var require_unevaluatedProperties = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
35276
35276
|
const valid = gen.name("valid");
|
|
35277
35277
|
cxt.subschema({
|
|
35278
35278
|
keyword: "unevaluatedProperties",
|
|
35279
|
-
dataProp:
|
|
35279
|
+
dataProp: key3,
|
|
35280
35280
|
dataPropType: util_1.Type.Str
|
|
35281
35281
|
}, valid);
|
|
35282
35282
|
if (!allErrors) gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
35283
35283
|
}
|
|
35284
35284
|
}
|
|
35285
|
-
function unevaluatedDynamic(evaluatedProps,
|
|
35286
|
-
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${
|
|
35285
|
+
function unevaluatedDynamic(evaluatedProps, key3) {
|
|
35286
|
+
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key3}]`;
|
|
35287
35287
|
}
|
|
35288
|
-
function unevaluatedStatic(evaluatedProps,
|
|
35288
|
+
function unevaluatedStatic(evaluatedProps, key3) {
|
|
35289
35289
|
const ps = [];
|
|
35290
|
-
for (const p in evaluatedProps) if (evaluatedProps[p] === true) ps.push((0, codegen_1._)`${
|
|
35290
|
+
for (const p in evaluatedProps) if (evaluatedProps[p] === true) ps.push((0, codegen_1._)`${key3} !== ${p}`);
|
|
35291
35291
|
return (0, codegen_1.and)(...ps);
|
|
35292
35292
|
}
|
|
35293
35293
|
}
|
|
@@ -36812,11 +36812,11 @@ function resolveLegacyShimOptions(options) {
|
|
|
36812
36812
|
legacyShim: options?.legacyShim ?? true
|
|
36813
36813
|
};
|
|
36814
36814
|
}
|
|
36815
|
-
function coerceEmbeddedInputRequest(method,
|
|
36816
|
-
if (entry === null || typeof entry !== "object" || typeof entry.method !== "string") throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an invalid input request '${
|
|
36815
|
+
function coerceEmbeddedInputRequest(method, key3, entry) {
|
|
36816
|
+
if (entry === null || typeof entry !== "object" || typeof entry.method !== "string") throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an invalid input request '${key3}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);
|
|
36817
36817
|
const embedded = entry;
|
|
36818
36818
|
const required2 = requiredClientCapabilitiesForInputRequest(embedded);
|
|
36819
|
-
if (required2 === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${
|
|
36819
|
+
if (required2 === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key3}' of kind '${embedded.method}', which is not an embedded request the 2026-07-28 revision defines`);
|
|
36820
36820
|
return {
|
|
36821
36821
|
embedded,
|
|
36822
36822
|
required: required2
|
|
@@ -36862,11 +36862,11 @@ var LegacyInputRequiredShim = class {
|
|
|
36862
36862
|
if (hasInputRequests) {
|
|
36863
36863
|
const declared = this._host.resolvedClientCapabilities(ctx);
|
|
36864
36864
|
const coerced = [];
|
|
36865
|
-
for (const [
|
|
36866
|
-
const { embedded, required: required2 } = coerceEmbeddedInputRequest(method,
|
|
36867
|
-
if (embedded.method !== "roots/list" && embedded.params === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${
|
|
36868
|
-
if (missingClientCapabilities(required2, declared) !== void 0) return legacyShimFailure(method, `Cannot request input '${
|
|
36869
|
-
coerced.push([
|
|
36865
|
+
for (const [key3, entry] of Object.entries(inputRequests)) {
|
|
36866
|
+
const { embedded, required: required2 } = coerceEmbeddedInputRequest(method, key3, entry);
|
|
36867
|
+
if (embedded.method !== "roots/list" && embedded.params === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key3}' of kind '${embedded.method}' without params`);
|
|
36868
|
+
if (missingClientCapabilities(required2, declared) !== void 0) return legacyShimFailure(method, `Cannot request input '${key3}' (${embedded.method}): the client on this 2025-era connection did not declare the required capability${declared === void 0 ? " (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)" : ""}`);
|
|
36869
|
+
coerced.push([key3, embedded]);
|
|
36870
36870
|
}
|
|
36871
36871
|
const roundAbort = linkedRoundAbort(outerSignal);
|
|
36872
36872
|
try {
|
|
@@ -36878,9 +36878,9 @@ var LegacyInputRequiredShim = class {
|
|
|
36878
36878
|
},
|
|
36879
36879
|
signal: roundAbort.signal
|
|
36880
36880
|
};
|
|
36881
|
-
const fulfilled = await Promise.all(coerced.map(async ([
|
|
36881
|
+
const fulfilled = await Promise.all(coerced.map(async ([key3, embedded]) => {
|
|
36882
36882
|
try {
|
|
36883
|
-
return [
|
|
36883
|
+
return [key3, await this._dispatchLeg(embedded, legOptions)];
|
|
36884
36884
|
} catch (error62) {
|
|
36885
36885
|
roundAbort.abort(error62);
|
|
36886
36886
|
throw error62;
|
|
@@ -37187,10 +37187,10 @@ var Server = class extends Protocol {
|
|
|
37187
37187
|
if (!hasInputRequests && !hasRequestState) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);
|
|
37188
37188
|
if (hasInputRequests) {
|
|
37189
37189
|
const declared = this._inputRequestCapabilityView(ctx);
|
|
37190
|
-
for (const [
|
|
37191
|
-
const { embedded, required: required2 } = coerceEmbeddedInputRequest(method,
|
|
37190
|
+
for (const [key3, entry] of Object.entries(inputRequests)) {
|
|
37191
|
+
const { embedded, required: required2 } = coerceEmbeddedInputRequest(method, key3, entry);
|
|
37192
37192
|
const missing = missingClientCapabilities(required2, declared);
|
|
37193
|
-
if (missing !== void 0) throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${
|
|
37193
|
+
if (missing !== void 0) throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${key3}' (${embedded.method}): the request's client capabilities do not declare the required capability`);
|
|
37194
37194
|
}
|
|
37195
37195
|
}
|
|
37196
37196
|
return result;
|
|
@@ -37580,10 +37580,10 @@ function toolInputElementCount(value, max) {
|
|
|
37580
37580
|
if (++count > max) return count;
|
|
37581
37581
|
if (child !== null && typeof child === "object") stack.push(child);
|
|
37582
37582
|
}
|
|
37583
|
-
else for (const
|
|
37584
|
-
if (!Object.prototype.hasOwnProperty.call(node2,
|
|
37583
|
+
else for (const key3 in node2) {
|
|
37584
|
+
if (!Object.prototype.hasOwnProperty.call(node2, key3)) continue;
|
|
37585
37585
|
if (++count > max) return count;
|
|
37586
|
-
const child = node2[
|
|
37586
|
+
const child = node2[key3];
|
|
37587
37587
|
if (child !== null && typeof child === "object") stack.push(child);
|
|
37588
37588
|
}
|
|
37589
37589
|
}
|
|
@@ -39027,8 +39027,8 @@ var DQ_STRING_RE = /"((?:[^"\\]|\\.)*)"/g;
|
|
|
39027
39027
|
var SQ_STRING_RE = /'((?:[^'\\]|\\.)*)'/g;
|
|
39028
39028
|
function redactJsonCookie(quote) {
|
|
39029
39029
|
const stringRe = quote === '"' ? DQ_STRING_RE : SQ_STRING_RE;
|
|
39030
|
-
return (_m, prefix,
|
|
39031
|
-
const setCookie =
|
|
39030
|
+
return (_m, prefix, key3, value) => {
|
|
39031
|
+
const setCookie = key3.toLowerCase() === "set-cookie";
|
|
39032
39032
|
const redacted = value.replace(stringRe, (_s, body) => {
|
|
39033
39033
|
const out = setCookie ? body.replace(/^(\s*[^=;]+)=[^;]*/, "$1=[REDACTED]") : body.replace(/=[^;]*/g, "=[REDACTED]");
|
|
39034
39034
|
return `${quote}${out}${quote}`;
|
|
@@ -39164,9 +39164,9 @@ function errorResult(message) {
|
|
|
39164
39164
|
}
|
|
39165
39165
|
function pruneUndefined(obj) {
|
|
39166
39166
|
const out = {};
|
|
39167
|
-
for (const
|
|
39168
|
-
if (obj[
|
|
39169
|
-
out[
|
|
39167
|
+
for (const key3 of Object.keys(obj)) {
|
|
39168
|
+
if (obj[key3] !== void 0)
|
|
39169
|
+
out[key3] = obj[key3];
|
|
39170
39170
|
}
|
|
39171
39171
|
return out;
|
|
39172
39172
|
}
|
|
@@ -39212,8 +39212,8 @@ function canonicalJson(value) {
|
|
|
39212
39212
|
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
39213
39213
|
return `{${entries.map(([k, v]) => `${JSON.stringify(escapeKey(k))}:${canonicalJson(v)}`).join(",")}}`;
|
|
39214
39214
|
}
|
|
39215
|
-
function escapeKey(
|
|
39216
|
-
return
|
|
39215
|
+
function escapeKey(key3) {
|
|
39216
|
+
return key3.startsWith("$") ? `$${key3}` : key3;
|
|
39217
39217
|
}
|
|
39218
39218
|
|
|
39219
39219
|
// node_modules/@chrischall/mcp-utils/dist/server/confirmation.js
|
|
@@ -39226,22 +39226,22 @@ function bindingKey(binding) {
|
|
|
39226
39226
|
if (binding.ttlSeconds !== void 0 && !(Number.isFinite(binding.ttlSeconds) && binding.ttlSeconds > 0)) {
|
|
39227
39227
|
throw new RangeError("requireConfirmation: binding.ttlSeconds must be a finite number greater than 0.");
|
|
39228
39228
|
}
|
|
39229
|
-
const
|
|
39230
|
-
if (
|
|
39229
|
+
const key3 = typeof binding.key === "string" ? Buffer.from(binding.key, "utf8") : Buffer.from(binding.key);
|
|
39230
|
+
if (key3.length < 32) {
|
|
39231
39231
|
throw new RangeError("requireConfirmation: binding.key must be at least 32 bytes.");
|
|
39232
39232
|
}
|
|
39233
|
-
return
|
|
39233
|
+
return key3;
|
|
39234
39234
|
}
|
|
39235
39235
|
function commitment(action, args) {
|
|
39236
39236
|
return createHash("sha256").update(`${action}\0${canonicalJson(args)}`).digest("base64url");
|
|
39237
39237
|
}
|
|
39238
|
-
function mintState(
|
|
39238
|
+
function mintState(key3, action, binding) {
|
|
39239
39239
|
const exp = Math.floor(Date.now() / 1e3) + (binding.ttlSeconds ?? 600);
|
|
39240
39240
|
const body = Buffer.from(JSON.stringify({ c: commitment(action, binding.args), exp })).toString("base64url");
|
|
39241
|
-
const mac3 = createHmac("sha256",
|
|
39241
|
+
const mac3 = createHmac("sha256", key3).update(`${STATE_PREFIX}${body}`).digest("base64url");
|
|
39242
39242
|
return `${STATE_PREFIX}${body}.${mac3}`;
|
|
39243
39243
|
}
|
|
39244
|
-
function verifyState(
|
|
39244
|
+
function verifyState(key3, action, binding, state) {
|
|
39245
39245
|
if (typeof state !== "string" || !state.startsWith(STATE_PREFIX))
|
|
39246
39246
|
return false;
|
|
39247
39247
|
const rest = state.slice(STATE_PREFIX.length);
|
|
@@ -39250,7 +39250,7 @@ function verifyState(key2, action, binding, state) {
|
|
|
39250
39250
|
return false;
|
|
39251
39251
|
const body = rest.slice(0, dot);
|
|
39252
39252
|
const mac3 = Buffer.from(rest.slice(dot + 1), "base64url");
|
|
39253
|
-
const expected = createHmac("sha256",
|
|
39253
|
+
const expected = createHmac("sha256", key3).update(`${STATE_PREFIX}${body}`).digest();
|
|
39254
39254
|
if (mac3.length !== expected.length || !timingSafeEqual(mac3, expected))
|
|
39255
39255
|
return false;
|
|
39256
39256
|
let payload;
|
|
@@ -39271,7 +39271,7 @@ function echoedState(ctx) {
|
|
|
39271
39271
|
}
|
|
39272
39272
|
function requireConfirmation(ctx, options) {
|
|
39273
39273
|
const requestKey = options.requestKey ?? DEFAULT_REQUEST_KEY;
|
|
39274
|
-
const
|
|
39274
|
+
const key3 = options.binding ? bindingKey(options.binding) : void 0;
|
|
39275
39275
|
const confirmationSchema = external_exports.object({
|
|
39276
39276
|
confirmed: external_exports.boolean().describe(options.confirmationLabel ?? DEFAULT_CONFIRMATION_LABEL)
|
|
39277
39277
|
});
|
|
@@ -39288,7 +39288,7 @@ ${JSON.stringify(preview, null, 2)}`,
|
|
|
39288
39288
|
requestedSchema: confirmationSchema
|
|
39289
39289
|
})
|
|
39290
39290
|
},
|
|
39291
|
-
...
|
|
39291
|
+
...key3 && options.binding ? { requestState: mintState(key3, options.action, options.binding) } : {}
|
|
39292
39292
|
});
|
|
39293
39293
|
};
|
|
39294
39294
|
const response = inputResponse(ctx.mcpReq.inputResponses, requestKey);
|
|
@@ -39315,12 +39315,12 @@ ${JSON.stringify(preview, null, 2)}`,
|
|
|
39315
39315
|
return ask();
|
|
39316
39316
|
}
|
|
39317
39317
|
if (response.kind === "elicit" && response.action === "accept" && accepted?.confirmed === true) {
|
|
39318
|
-
if (
|
|
39318
|
+
if (key3 && options.binding) {
|
|
39319
39319
|
const state = echoedState(ctx);
|
|
39320
39320
|
if (state === void 0 || state === null) {
|
|
39321
39321
|
return errorResult(`Confirmation for ${options.action} was accepted, but the retry carried no requestState, so it cannot be checked against the prompt that was shown. Nothing was done. The likely cause is that the MCP client or host does not round-trip requestState (it must echo the requestState from the input_required result back on the retry); asking again would loop.`);
|
|
39322
39322
|
}
|
|
39323
|
-
if (!verifyState(
|
|
39323
|
+
if (!verifyState(key3, options.action, options.binding, state))
|
|
39324
39324
|
return ask();
|
|
39325
39325
|
}
|
|
39326
39326
|
return void 0;
|
|
@@ -39455,8 +39455,8 @@ function createSpentTokenStore() {
|
|
|
39455
39455
|
var PROCESS_SPENT = createSpentTokenStore();
|
|
39456
39456
|
var PREFIX = "mcpu.token.v1.";
|
|
39457
39457
|
var DEFAULT_TTL_SECONDS = 600;
|
|
39458
|
-
function tokenKey(
|
|
39459
|
-
const bytes = typeof
|
|
39458
|
+
function tokenKey(key3) {
|
|
39459
|
+
const bytes = typeof key3 === "string" ? Buffer.from(key3, "utf8") : Buffer.from(key3);
|
|
39460
39460
|
if (bytes.length < 32)
|
|
39461
39461
|
throw new RangeError("confirm token: key must be at least 32 bytes.");
|
|
39462
39462
|
return bytes;
|
|
@@ -39469,14 +39469,14 @@ function ttlOf(ttlSeconds) {
|
|
|
39469
39469
|
}
|
|
39470
39470
|
return ttlSeconds;
|
|
39471
39471
|
}
|
|
39472
|
-
function sign(
|
|
39473
|
-
return createHmac2("sha256",
|
|
39472
|
+
function sign(key3, body) {
|
|
39473
|
+
return createHmac2("sha256", key3).update(`${PREFIX}${body}`).digest();
|
|
39474
39474
|
}
|
|
39475
39475
|
function hashConfirmPayload(payload) {
|
|
39476
39476
|
return createHash2("sha256").update(canonicalJson(payload)).digest("base64url");
|
|
39477
39477
|
}
|
|
39478
|
-
function issueConfirmToken(
|
|
39479
|
-
const k = tokenKey(
|
|
39478
|
+
function issueConfirmToken(key3, binding, options = {}) {
|
|
39479
|
+
const k = tokenKey(key3);
|
|
39480
39480
|
const now = options.now ?? Date.now();
|
|
39481
39481
|
const exp = now + ttlOf(options.ttlSeconds) * 1e3;
|
|
39482
39482
|
const claims = {
|
|
@@ -39499,8 +39499,8 @@ function parseClaims(body) {
|
|
|
39499
39499
|
return void 0;
|
|
39500
39500
|
}
|
|
39501
39501
|
}
|
|
39502
|
-
function verifyConfirmToken(
|
|
39503
|
-
const k = tokenKey(
|
|
39502
|
+
function verifyConfirmToken(key3, token, binding, options = {}) {
|
|
39503
|
+
const k = tokenKey(key3);
|
|
39504
39504
|
const now = options.now ?? Date.now();
|
|
39505
39505
|
const spent = options.spent ?? PROCESS_SPENT;
|
|
39506
39506
|
spent.prune(now);
|
|
@@ -39614,9 +39614,9 @@ import { isAbsolute as isAbsolute2, join as join3 } from "node:path";
|
|
|
39614
39614
|
import { homedir } from "node:os";
|
|
39615
39615
|
import { isAbsolute, join, resolve } from "node:path";
|
|
39616
39616
|
var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
|
|
39617
|
-
function readEnvVar(
|
|
39617
|
+
function readEnvVar(key3, opts = {}) {
|
|
39618
39618
|
const env = opts.env ?? process.env;
|
|
39619
|
-
const raw = env[
|
|
39619
|
+
const raw = env[key3];
|
|
39620
39620
|
if (typeof raw === "string") {
|
|
39621
39621
|
const trimmed = raw.trim();
|
|
39622
39622
|
if (trimmed.length > 0 && trimmed !== "undefined" && trimmed !== "null" && !PLACEHOLDER_RE.test(trimmed)) {
|
|
@@ -39627,9 +39627,9 @@ function readEnvVar(key2, opts = {}) {
|
|
|
39627
39627
|
}
|
|
39628
39628
|
var TRUE_TOKENS = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
39629
39629
|
var FALSE_TOKENS = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
39630
|
-
function parseBoolEnv(
|
|
39630
|
+
function parseBoolEnv(key3, opts = {}) {
|
|
39631
39631
|
const fallback = opts.default ?? false;
|
|
39632
|
-
const raw = readEnvVar(
|
|
39632
|
+
const raw = readEnvVar(key3, { env: opts.env });
|
|
39633
39633
|
if (raw === void 0)
|
|
39634
39634
|
return fallback;
|
|
39635
39635
|
const token = raw.toLowerCase();
|
|
@@ -39768,9 +39768,9 @@ function readConfirmElicitation(env = process.env) {
|
|
|
39768
39768
|
return "on";
|
|
39769
39769
|
if (raw === "off")
|
|
39770
39770
|
return "off";
|
|
39771
|
-
const
|
|
39772
|
-
if (!warned.has(
|
|
39773
|
-
warned.add(
|
|
39771
|
+
const key3 = `elicitation:${raw}`;
|
|
39772
|
+
if (!warned.has(key3)) {
|
|
39773
|
+
warned.add(key3);
|
|
39774
39774
|
process.stderr.write(`MCP_CONFIRM_ELICITATION="${raw}" is not one of on, off; treating it as on.
|
|
39775
39775
|
`);
|
|
39776
39776
|
}
|
|
@@ -39782,9 +39782,9 @@ function readConfirmTtl(env) {
|
|
|
39782
39782
|
return DEFAULT_TTL_SECONDS2;
|
|
39783
39783
|
if (/^[1-9]\d*$/.test(raw))
|
|
39784
39784
|
return Number(raw);
|
|
39785
|
-
const
|
|
39786
|
-
if (!warned.has(
|
|
39787
|
-
warned.add(
|
|
39785
|
+
const key3 = `ttl:${raw}`;
|
|
39786
|
+
if (!warned.has(key3)) {
|
|
39787
|
+
warned.add(key3);
|
|
39788
39788
|
process.stderr.write(`MCP_CONFIRM_TTL_SECONDS="${raw}" is not a positive whole number of seconds; gated writes will refuse on clients that cannot show a confirmation prompt until it is fixed.
|
|
39789
39789
|
`);
|
|
39790
39790
|
}
|
|
@@ -40654,8 +40654,8 @@ function headerOf(headers, name) {
|
|
|
40654
40654
|
if (typeof headers.get === "function")
|
|
40655
40655
|
return headers.get(name) ?? void 0;
|
|
40656
40656
|
const wanted = name.toLowerCase();
|
|
40657
|
-
for (const [
|
|
40658
|
-
if (
|
|
40657
|
+
for (const [key3, value] of Object.entries(headers)) {
|
|
40658
|
+
if (key3.toLowerCase() === wanted)
|
|
40659
40659
|
return value;
|
|
40660
40660
|
}
|
|
40661
40661
|
return void 0;
|
|
@@ -41371,8 +41371,8 @@ import { fileURLToPath } from "url";
|
|
|
41371
41371
|
|
|
41372
41372
|
// node_modules/@fetchproxy/protocol/dist/crypto.js
|
|
41373
41373
|
var subtle = globalThis.crypto.subtle;
|
|
41374
|
-
async function exportRaw(
|
|
41375
|
-
const buf = await subtle.exportKey(format,
|
|
41374
|
+
async function exportRaw(key3, format) {
|
|
41375
|
+
const buf = await subtle.exportKey(format, key3);
|
|
41376
41376
|
return new Uint8Array(buf);
|
|
41377
41377
|
}
|
|
41378
41378
|
async function generateX25519() {
|
|
@@ -41475,15 +41475,15 @@ async function hkdfSha256(ikm, salt, info, lenBytes) {
|
|
|
41475
41475
|
}, baseKey, lenBytes * 8);
|
|
41476
41476
|
return new Uint8Array(bits);
|
|
41477
41477
|
}
|
|
41478
|
-
async function aesGcmSeal(
|
|
41479
|
-
const k = await subtle.importKey("raw",
|
|
41478
|
+
async function aesGcmSeal(key3, iv, plaintext, aad) {
|
|
41479
|
+
const k = await subtle.importKey("raw", key3, { name: "AES-GCM" }, false, [
|
|
41480
41480
|
"encrypt"
|
|
41481
41481
|
]);
|
|
41482
41482
|
const ct = await subtle.encrypt({ name: "AES-GCM", iv, additionalData: aad }, k, plaintext);
|
|
41483
41483
|
return new Uint8Array(ct);
|
|
41484
41484
|
}
|
|
41485
|
-
async function aesGcmOpen(
|
|
41486
|
-
const k = await subtle.importKey("raw",
|
|
41485
|
+
async function aesGcmOpen(key3, iv, ciphertext, aad) {
|
|
41486
|
+
const k = await subtle.importKey("raw", key3, { name: "AES-GCM" }, false, [
|
|
41487
41487
|
"decrypt"
|
|
41488
41488
|
]);
|
|
41489
41489
|
const pt = await subtle.decrypt({ name: "AES-GCM", iv, additionalData: aad }, k, ciphertext);
|
|
@@ -41987,11 +41987,11 @@ function assertCaptureHeadersArray(value, label) {
|
|
|
41987
41987
|
throw new ProtocolError3(`${label}[${i}].headerName: invalid name ${JSON.stringify(entry.headerName)}`);
|
|
41988
41988
|
}
|
|
41989
41989
|
const normalizedPath = entry.path ?? "/*";
|
|
41990
|
-
const
|
|
41991
|
-
if (seen.has(
|
|
41990
|
+
const key3 = `${entry.host}\0${normalizedPath}\0${entry.headerName}`;
|
|
41991
|
+
if (seen.has(key3)) {
|
|
41992
41992
|
throw new ProtocolError3(`${label}: duplicate ${JSON.stringify({ host: entry.host, path: normalizedPath, headerName: entry.headerName })}`);
|
|
41993
41993
|
}
|
|
41994
|
-
seen.add(
|
|
41994
|
+
seen.add(key3);
|
|
41995
41995
|
for (const k of Object.keys(entry)) {
|
|
41996
41996
|
if (k !== "host" && k !== "path" && k !== "headerName") {
|
|
41997
41997
|
throw new ProtocolError3(`${label}[${i}]: unexpected field ${JSON.stringify(k)}`);
|
|
@@ -44410,10 +44410,10 @@ async function startHost(opts) {
|
|
|
44410
44410
|
const extPub = fromB64(frame.extensionSessionPub);
|
|
44411
44411
|
const shared = await ecdhX25519(held.priv, extPub);
|
|
44412
44412
|
const salt = await transcriptHash(held.nonce, extNonce, held.pub, extPub);
|
|
44413
|
-
const
|
|
44413
|
+
const key3 = await hkdfSha256(shared, salt, enc5.encode(HKDF_SESSION_INFO), 32);
|
|
44414
44414
|
if (extensionWs !== ws)
|
|
44415
44415
|
return;
|
|
44416
|
-
ownSession = new SessionState(
|
|
44416
|
+
ownSession = new SessionState(key3);
|
|
44417
44417
|
ownSessionInfo = sessionInfoFromHello(verifiedHello);
|
|
44418
44418
|
ownDecryptFailures = 0;
|
|
44419
44419
|
ownPendingPairCode = null;
|
|
@@ -46978,8 +46978,8 @@ var FetchproxyServer = class {
|
|
|
46978
46978
|
return { ...opts, expectStatus: [...DEFAULT_JSON_OK_STATUSES] };
|
|
46979
46979
|
}
|
|
46980
46980
|
hasContentType(headers) {
|
|
46981
|
-
for (const
|
|
46982
|
-
if (
|
|
46981
|
+
for (const key3 of Object.keys(headers)) {
|
|
46982
|
+
if (key3.toLowerCase() === "content-type")
|
|
46983
46983
|
return true;
|
|
46984
46984
|
}
|
|
46985
46985
|
return false;
|
|
@@ -47852,7 +47852,7 @@ function describeTokenlessLogin(record2) {
|
|
|
47852
47852
|
|
|
47853
47853
|
// src/version.ts
|
|
47854
47854
|
var SERVER_NAME = "ofw-mcp";
|
|
47855
|
-
var VERSION = "2.27.
|
|
47855
|
+
var VERSION = "2.27.5";
|
|
47856
47856
|
|
|
47857
47857
|
// src/auth.ts
|
|
47858
47858
|
function fetchproxyDisabled() {
|
|
@@ -48356,7 +48356,7 @@ function isRealCalendarDate(p) {
|
|
|
48356
48356
|
const utc = new Date(Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second));
|
|
48357
48357
|
return utc.getUTCFullYear() === p.year && utc.getUTCMonth() === p.month - 1 && utc.getUTCDate() === p.day && utc.getUTCHours() === p.hour && utc.getUTCMinutes() === p.minute && utc.getUTCSeconds() === p.second;
|
|
48358
48358
|
}
|
|
48359
|
-
function parseTimestampValue(
|
|
48359
|
+
function parseTimestampValue(key3, value, assumeNaiveIn) {
|
|
48360
48360
|
if (typeof value !== "string") return null;
|
|
48361
48361
|
const raw = value.trim();
|
|
48362
48362
|
if (raw === "" || DATE_ONLY.test(raw)) return null;
|
|
@@ -48425,18 +48425,18 @@ function walk(node2, tz) {
|
|
|
48425
48425
|
}
|
|
48426
48426
|
if (node2 === null || typeof node2 !== "object") return node2;
|
|
48427
48427
|
const obj = node2;
|
|
48428
|
-
for (const
|
|
48429
|
-
const value = obj[
|
|
48428
|
+
for (const key3 of Object.keys(obj)) {
|
|
48429
|
+
const value = obj[key3];
|
|
48430
48430
|
if (value !== null && typeof value === "object") {
|
|
48431
48431
|
walk(value, tz);
|
|
48432
48432
|
continue;
|
|
48433
48433
|
}
|
|
48434
|
-
if (ZONE_NAME_KEYS.has(
|
|
48435
|
-
const instant = parseTimestampValue(
|
|
48434
|
+
if (ZONE_NAME_KEYS.has(key3) || !TIMESTAMP_KEYS.has(key3)) continue;
|
|
48435
|
+
const instant = parseTimestampValue(key3, value, tz);
|
|
48436
48436
|
if (!instant) continue;
|
|
48437
48437
|
const { iso, display } = formatInstant(instant, tz);
|
|
48438
|
-
obj[
|
|
48439
|
-
obj[`${
|
|
48438
|
+
obj[key3] = iso;
|
|
48439
|
+
obj[`${key3}Display`] = display;
|
|
48440
48440
|
}
|
|
48441
48441
|
return obj;
|
|
48442
48442
|
}
|
|
@@ -48490,6 +48490,16 @@ function hasRealView(recipients) {
|
|
|
48490
48490
|
function threadedReplyTo(detail) {
|
|
48491
48491
|
return detail.replyToId ?? detail.inReplyTo ?? null;
|
|
48492
48492
|
}
|
|
48493
|
+
function draftReplyTarget(echoes, fallback) {
|
|
48494
|
+
for (const echo of echoes) {
|
|
48495
|
+
const target = threadedReplyTo(echo);
|
|
48496
|
+
if (target !== null) return { replyToId: target, replyToSource: "server" };
|
|
48497
|
+
}
|
|
48498
|
+
if (fallback !== null && !echoes.some(reportsUnthreaded)) {
|
|
48499
|
+
return { replyToId: fallback, replyToSource: "cache" };
|
|
48500
|
+
}
|
|
48501
|
+
return { replyToId: null, replyToSource: null };
|
|
48502
|
+
}
|
|
48493
48503
|
function reportsThreaded(detail) {
|
|
48494
48504
|
return threadedReplyTo(detail) !== null || detail.showContext === true;
|
|
48495
48505
|
}
|
|
@@ -48714,7 +48724,22 @@ async function heldFilesFor(cache, draftIds) {
|
|
|
48714
48724
|
}
|
|
48715
48725
|
var HELD_NOTE = "OurFamilyWizard drafts do not store attachments, so these files are held with this draft by this server and attached when you send it with ofw_send_message (draftId). They are not visible on the draft in the OurFamilyWizard web app.";
|
|
48716
48726
|
|
|
48727
|
+
// src/tools/reply-source.ts
|
|
48728
|
+
var key2 = (draftId) => `draft_reply_source:${draftId}`;
|
|
48729
|
+
async function setReplyToSource(cache, draftId, source) {
|
|
48730
|
+
await cache.setMeta(key2(draftId), source ?? "");
|
|
48731
|
+
}
|
|
48732
|
+
async function getReplyToSource(cache, draftId, replyToId) {
|
|
48733
|
+
if (replyToId === null) return null;
|
|
48734
|
+
return await cache.getMeta(key2(draftId)) === "cache" ? "cache" : "server";
|
|
48735
|
+
}
|
|
48736
|
+
async function replyToSourceField(cache, draftId, replyToId) {
|
|
48737
|
+
const source = await getReplyToSource(cache, draftId, replyToId);
|
|
48738
|
+
return source === null ? {} : { replyToSource: source };
|
|
48739
|
+
}
|
|
48740
|
+
|
|
48717
48741
|
// src/tools/project.ts
|
|
48742
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
48718
48743
|
var MESSAGE_VIEWS = ["compact", "full"];
|
|
48719
48744
|
var LABEL = "ofw-mcp";
|
|
48720
48745
|
function asRecord(value) {
|
|
@@ -48775,7 +48800,7 @@ var MESSAGE_ROW_KEYS = /* @__PURE__ */ new Set([
|
|
|
48775
48800
|
var DRAFT_ROW_KEYS = /* @__PURE__ */ new Set(["id", "subject", "recipients", "replyToId", "modifiedAt", "body"]);
|
|
48776
48801
|
function omitKnown(rest, own2) {
|
|
48777
48802
|
const out = {};
|
|
48778
|
-
for (const [
|
|
48803
|
+
for (const [key3, value] of Object.entries(rest)) if (!own2.has(key3)) out[key3] = value;
|
|
48779
48804
|
return out;
|
|
48780
48805
|
}
|
|
48781
48806
|
function compactDraft(row) {
|
|
@@ -48790,6 +48815,32 @@ function compactDraft(row) {
|
|
|
48790
48815
|
...omitKnown(rest, DRAFT_ROW_KEYS)
|
|
48791
48816
|
});
|
|
48792
48817
|
}
|
|
48818
|
+
function bodyDigest(body) {
|
|
48819
|
+
if (body === null) return { bodyLength: null, bodySha256: null };
|
|
48820
|
+
return { bodyLength: body.length, bodySha256: createHash5("sha256").update(body).digest("hex").slice(0, 16) };
|
|
48821
|
+
}
|
|
48822
|
+
function compactWrittenDraft(row) {
|
|
48823
|
+
return {
|
|
48824
|
+
id: row.id,
|
|
48825
|
+
subject: row.subject,
|
|
48826
|
+
...bodyDigest(row.body),
|
|
48827
|
+
recipients: row.recipients,
|
|
48828
|
+
replyToId: row.replyToId,
|
|
48829
|
+
modifiedAt: row.modifiedAt
|
|
48830
|
+
};
|
|
48831
|
+
}
|
|
48832
|
+
function compactSentMessage(row) {
|
|
48833
|
+
return {
|
|
48834
|
+
id: row.id,
|
|
48835
|
+
folder: row.folder,
|
|
48836
|
+
subject: row.subject,
|
|
48837
|
+
...bodyDigest(row.body),
|
|
48838
|
+
sentAt: row.sentAt,
|
|
48839
|
+
recipients: row.recipients,
|
|
48840
|
+
replyToId: row.replyToId,
|
|
48841
|
+
chainRootId: row.chainRootId
|
|
48842
|
+
};
|
|
48843
|
+
}
|
|
48793
48844
|
function viewMessages(view, rows) {
|
|
48794
48845
|
if (view !== "compact") return rows;
|
|
48795
48846
|
return projectOrRaw(rows, (rs) => rs.map((r) => compactMessage(r)), {
|
|
@@ -49232,7 +49283,15 @@ var DraftListItemSchema = external_exports.looseObject({
|
|
|
49232
49283
|
var DraftListResponseSchema = external_exports.looseObject({ data: external_exports.array(DraftListItemSchema).optional() });
|
|
49233
49284
|
var DraftDetailSchema = external_exports.looseObject({
|
|
49234
49285
|
body: external_exports.string().optional(),
|
|
49235
|
-
subject: external_exports.string().optional()
|
|
49286
|
+
subject: external_exports.string().optional(),
|
|
49287
|
+
// The reply linkage and recipients are read from the DETAIL, not the list
|
|
49288
|
+
// item: the drafts list carries no replyToId/inReplyTo/showContext key at all
|
|
49289
|
+
// (verified live 2026-11-08), so a row built from it hashed to a different
|
|
49290
|
+
// revision than the save echo and lost the reply target.
|
|
49291
|
+
replyToId: external_exports.number().nullable().optional(),
|
|
49292
|
+
inReplyTo: external_exports.number().nullable().optional(),
|
|
49293
|
+
showContext: external_exports.boolean().optional(),
|
|
49294
|
+
recipients: external_exports.array(ApiRecipientSchema).optional()
|
|
49236
49295
|
});
|
|
49237
49296
|
var DRAFTS_CACHE_STATUS_KEY = "drafts_cache_status";
|
|
49238
49297
|
async function getDraftsCacheStatus(store) {
|
|
@@ -49254,15 +49313,15 @@ async function inferReplacedDraftLineage(store, vanishedIds, newRows) {
|
|
|
49254
49313
|
if (vanishedIds.length === 0 || newRows.length === 0) return;
|
|
49255
49314
|
for (const goneId of vanishedIds) {
|
|
49256
49315
|
const gone = await store.getDraft(goneId);
|
|
49257
|
-
const
|
|
49316
|
+
const key3 = (await store.getDraftLineageById(goneId))?.draftKey;
|
|
49258
49317
|
const held = await getHeldFiles(store, goneId);
|
|
49259
|
-
if (!
|
|
49318
|
+
if (!key3 && held.length === 0) continue;
|
|
49260
49319
|
const matches = newRows.filter((r) => r.subject === gone.subject && r.body === gone.body && r.replyToId === gone.replyToId);
|
|
49261
49320
|
if (matches.length !== 1) continue;
|
|
49262
49321
|
const target = matches[0];
|
|
49263
49322
|
if (await store.getDraftLineageById(target.id)) continue;
|
|
49264
|
-
if (
|
|
49265
|
-
await store.recordDraftLineage({ id: target.id, draftKey:
|
|
49323
|
+
if (key3) {
|
|
49324
|
+
await store.recordDraftLineage({ id: target.id, draftKey: key3, previousId: goneId, recordedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
49266
49325
|
await store.setMeta(`draft_key_inferred:${target.id}`, "1");
|
|
49267
49326
|
}
|
|
49268
49327
|
if (held.length > 0) {
|
|
@@ -49297,7 +49356,10 @@ async function syncDrafts(client2, draftsFolderId, store, budget) {
|
|
|
49297
49356
|
if (pageItems.length < 50) break;
|
|
49298
49357
|
page++;
|
|
49299
49358
|
}
|
|
49359
|
+
const ids = items.map((it) => it.id);
|
|
49360
|
+
const existingById = new Map((await store.getDrafts(ids)).map((d) => [d.id, d]));
|
|
49300
49361
|
const rows = [];
|
|
49362
|
+
const replySources = [];
|
|
49301
49363
|
for (const item of items) {
|
|
49302
49364
|
if (!b.take()) return defer();
|
|
49303
49365
|
const detail = parseLenient(
|
|
@@ -49305,19 +49367,20 @@ async function syncDrafts(client2, draftsFolderId, store, budget) {
|
|
|
49305
49367
|
await client2.request("GET", `/pub/v3/messages/${item.id}`),
|
|
49306
49368
|
{ label: "ofw-mcp", context: "GET /pub/v3/messages/{id} (drafts sync)" }
|
|
49307
49369
|
);
|
|
49370
|
+
const reply = draftReplyTarget([detail, item], existingById.get(item.id)?.replyToId ?? null);
|
|
49308
49371
|
rows.push({
|
|
49309
49372
|
id: item.id,
|
|
49310
49373
|
subject: detail.subject ?? item.subject ?? "(no subject)",
|
|
49311
49374
|
body: detail.body ?? "",
|
|
49312
|
-
recipients: mapRecipients(item.recipients),
|
|
49313
|
-
replyToId:
|
|
49375
|
+
recipients: mapRecipients(detail.recipients ?? item.recipients),
|
|
49376
|
+
replyToId: reply.replyToId,
|
|
49314
49377
|
modifiedAt: item.date?.dateTime ?? nowNaiveWallClock(),
|
|
49315
49378
|
listData: item
|
|
49316
49379
|
});
|
|
49380
|
+
replySources.push(reply.replyToSource);
|
|
49317
49381
|
}
|
|
49318
|
-
const ids = items.map((it) => it.id);
|
|
49319
|
-
const existingById = new Map((await store.getDrafts(ids)).map((d) => [d.id, d]));
|
|
49320
49382
|
await store.upsertDrafts(rows);
|
|
49383
|
+
for (const [i, row] of rows.entries()) await setReplyToSource(store, row.id, replySources[i]);
|
|
49321
49384
|
for (const stale of await store.getMessages(ids)) {
|
|
49322
49385
|
await store.deleteMessage(stale.id);
|
|
49323
49386
|
}
|
|
@@ -49466,7 +49529,7 @@ async function syncAll(client2, opts, store) {
|
|
|
49466
49529
|
}
|
|
49467
49530
|
|
|
49468
49531
|
// src/config.ts
|
|
49469
|
-
import { createHash as
|
|
49532
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
49470
49533
|
import { homedir as homedir4 } from "node:os";
|
|
49471
49534
|
import { join as join10 } from "node:path";
|
|
49472
49535
|
function readCacheIdentity() {
|
|
@@ -49477,7 +49540,7 @@ function getCacheDir() {
|
|
|
49477
49540
|
}
|
|
49478
49541
|
function getCacheDbPath() {
|
|
49479
49542
|
const identity = readCacheIdentity();
|
|
49480
|
-
const hash2 =
|
|
49543
|
+
const hash2 = createHash6("sha256").update(identity).digest("hex").slice(0, 16);
|
|
49481
49544
|
return join10(getCacheDir(), `${hash2}.db`);
|
|
49482
49545
|
}
|
|
49483
49546
|
function getAttachmentsDir() {
|
|
@@ -49713,6 +49776,7 @@ var ServerDraftSchema = external_exports.looseObject({
|
|
|
49713
49776
|
// that disagreed about the same draft.
|
|
49714
49777
|
replyToId: external_exports.number().nullable().optional(),
|
|
49715
49778
|
inReplyTo: external_exports.number().nullable().optional(),
|
|
49779
|
+
showContext: external_exports.boolean().optional(),
|
|
49716
49780
|
recipients: external_exports.array(ApiRecipientSchema).optional(),
|
|
49717
49781
|
// Attachment fileIds — read so send-by-draft carries the draft's
|
|
49718
49782
|
// attachments onto the sent message (see DraftContent.files).
|
|
@@ -49739,7 +49803,7 @@ var ServerDraftSchema = external_exports.looseObject({
|
|
|
49739
49803
|
function isNotFound(e) {
|
|
49740
49804
|
return e instanceof Error && /OFW API error: 404\b/.test(e.message);
|
|
49741
49805
|
}
|
|
49742
|
-
async function fetchMessageSnapshot(client2, id2) {
|
|
49806
|
+
async function fetchMessageSnapshot(client2, id2, fallbackReplyTo = null) {
|
|
49743
49807
|
let raw;
|
|
49744
49808
|
try {
|
|
49745
49809
|
raw = await client2.request("GET", `/pub/v3/messages/${id2}`);
|
|
@@ -49755,21 +49819,23 @@ async function fetchMessageSnapshot(client2, id2) {
|
|
|
49755
49819
|
context: "GET /pub/v3/messages/{id} (draft freshness check)",
|
|
49756
49820
|
mode: "strict"
|
|
49757
49821
|
});
|
|
49822
|
+
const reply = draftReplyTarget([detail], fallbackReplyTo);
|
|
49758
49823
|
return {
|
|
49759
49824
|
content: {
|
|
49760
49825
|
subject: detail.subject ?? "",
|
|
49761
49826
|
body: detail.body ?? "",
|
|
49762
|
-
replyToId:
|
|
49827
|
+
replyToId: reply.replyToId,
|
|
49763
49828
|
recipients: mapRecipients(detail.recipients),
|
|
49764
49829
|
...detail.files !== void 0 ? { files: detail.files } : {}
|
|
49765
49830
|
},
|
|
49766
49831
|
folderId: detail.folder?.id === void 0 ? null : String(detail.folder.id),
|
|
49767
49832
|
folderName: detail.folder?.name ?? null,
|
|
49768
|
-
dateTime: detail.date?.dateTime ?? null
|
|
49833
|
+
dateTime: detail.date?.dateTime ?? null,
|
|
49834
|
+
replyToSource: reply.replyToSource
|
|
49769
49835
|
};
|
|
49770
49836
|
}
|
|
49771
|
-
async function fetchServerDraft(client2, id2) {
|
|
49772
|
-
return (await fetchMessageSnapshot(client2, id2))?.content ?? null;
|
|
49837
|
+
async function fetchServerDraft(client2, id2, fallbackReplyTo = null) {
|
|
49838
|
+
return (await fetchMessageSnapshot(client2, id2, fallbackReplyTo))?.content ?? null;
|
|
49773
49839
|
}
|
|
49774
49840
|
var SUBSTANTIVE_FIELDS = ["subject", "body", "recipients"];
|
|
49775
49841
|
function substantiveChanges(changed) {
|
|
@@ -49973,7 +50039,7 @@ async function probeOne(client2, prepared, map2, draftKey, heldFiles) {
|
|
|
49973
50039
|
const { id: id2, cachedDraft } = prepared;
|
|
49974
50040
|
let snapshot;
|
|
49975
50041
|
try {
|
|
49976
|
-
snapshot = await fetchMessageSnapshot(client2, id2);
|
|
50042
|
+
snapshot = await fetchMessageSnapshot(client2, id2, cachedDraft?.replyToId ?? null);
|
|
49977
50043
|
} catch (e) {
|
|
49978
50044
|
return {
|
|
49979
50045
|
requests: 1,
|
|
@@ -50245,12 +50311,12 @@ function parseBase(baseUrl) {
|
|
|
50245
50311
|
function badInput(message) {
|
|
50246
50312
|
return new McpToolError(message, { kind: "unknown" });
|
|
50247
50313
|
}
|
|
50248
|
-
function encodeKey(
|
|
50249
|
-
if (typeof
|
|
50314
|
+
function encodeKey(key3) {
|
|
50315
|
+
if (typeof key3 !== "string" || key3.length === 0)
|
|
50250
50316
|
throw badInput("Blob key must be a non-empty string.");
|
|
50251
|
-
if (
|
|
50317
|
+
if (key3.length > MAX_KEY_LENGTH)
|
|
50252
50318
|
throw badInput(`Blob key is longer than ${MAX_KEY_LENGTH} characters.`);
|
|
50253
|
-
const segments =
|
|
50319
|
+
const segments = key3.split("/");
|
|
50254
50320
|
for (const seg of segments) {
|
|
50255
50321
|
if (seg === "" || seg === "." || seg === ".." || !SAFE_SEGMENT.test(seg)) {
|
|
50256
50322
|
throw badInput('Blob key must be relative, slash-separated segments of [A-Za-z0-9._~-] with no empty, "." or ".." segment.');
|
|
@@ -50281,20 +50347,20 @@ function createBlobStore(opts) {
|
|
|
50281
50347
|
const signingKey = opts.signingKey;
|
|
50282
50348
|
const sign2 = (payload) => createHmac4("sha256", signingKey).update(payload).digest("base64url");
|
|
50283
50349
|
const link2 = (encodedKey, exp, sig) => `${base}/${encodedKey}?exp=${exp}&sig=${encodeURIComponent(sig)}`;
|
|
50284
|
-
const signGetUrl = (
|
|
50285
|
-
const encoded = encodeKey(
|
|
50350
|
+
const signGetUrl = (key3, o) => {
|
|
50351
|
+
const encoded = encodeKey(key3);
|
|
50286
50352
|
const exp = expiry(o);
|
|
50287
|
-
return { url: link2(encoded, exp, sign2(`${prefix}/${
|
|
50353
|
+
return { url: link2(encoded, exp, sign2(`${prefix}/${key3}
|
|
50288
50354
|
${exp}`)), expiresAtMs: exp };
|
|
50289
50355
|
};
|
|
50290
|
-
const signPutUrl = (
|
|
50291
|
-
const encoded = encodeKey(
|
|
50356
|
+
const signPutUrl = (key3, contentType, o) => {
|
|
50357
|
+
const encoded = encodeKey(key3);
|
|
50292
50358
|
checkContentType(contentType);
|
|
50293
50359
|
const exp = expiry(o);
|
|
50294
|
-
return { url: link2(encoded, exp, sign2(`put\0${prefix}/${
|
|
50360
|
+
return { url: link2(encoded, exp, sign2(`put\0${prefix}/${key3}\0${contentType}\0${exp}`)), expiresAtMs: exp };
|
|
50295
50361
|
};
|
|
50296
|
-
const put = async (
|
|
50297
|
-
const { url: url2 } = signPutUrl(
|
|
50362
|
+
const put = async (key3, body, contentType, o = {}) => {
|
|
50363
|
+
const { url: url2 } = signPutUrl(key3, contentType, o);
|
|
50298
50364
|
const bytes = typeof body === "string" ? new TextEncoder().encode(body) : body;
|
|
50299
50365
|
const doFetch = o.fetchImpl ?? fetch;
|
|
50300
50366
|
let res;
|
|
@@ -50308,22 +50374,22 @@ ${exp}`)), expiresAtMs: exp };
|
|
|
50308
50374
|
} catch (cause) {
|
|
50309
50375
|
if (o.signal?.aborted)
|
|
50310
50376
|
throw cause;
|
|
50311
|
-
throw new McpToolError(`Blob store upload of ${
|
|
50377
|
+
throw new McpToolError(`Blob store upload of ${key3} did not complete (network error).`, {
|
|
50312
50378
|
kind: "transport"
|
|
50313
50379
|
});
|
|
50314
50380
|
}
|
|
50315
50381
|
if (!res.ok) {
|
|
50316
|
-
throw new McpToolError(`Blob store upload of ${
|
|
50382
|
+
throw new McpToolError(`Blob store upload of ${key3} failed (HTTP ${res.status}).`, {
|
|
50317
50383
|
kind: "http",
|
|
50318
50384
|
status: res.status
|
|
50319
50385
|
});
|
|
50320
50386
|
}
|
|
50321
|
-
return { key:
|
|
50387
|
+
return { key: key3, bytes: bytes.byteLength };
|
|
50322
50388
|
};
|
|
50323
|
-
const signDeleteUrl = (
|
|
50324
|
-
const encoded = encodeKey(
|
|
50389
|
+
const signDeleteUrl = (key3, o) => {
|
|
50390
|
+
const encoded = encodeKey(key3);
|
|
50325
50391
|
const exp = expiry(o);
|
|
50326
|
-
return { url: link2(encoded, exp, sign2(`del\0${prefix}/${
|
|
50392
|
+
return { url: link2(encoded, exp, sign2(`del\0${prefix}/${key3}\0${exp}`)), expiresAtMs: exp };
|
|
50327
50393
|
};
|
|
50328
50394
|
const exchange = async (what, url2, method, read, o) => {
|
|
50329
50395
|
try {
|
|
@@ -50340,34 +50406,34 @@ ${exp}`)), expiresAtMs: exp };
|
|
|
50340
50406
|
throw new McpToolError(`Blob store ${what} did not complete (network error).`, { kind: "transport" });
|
|
50341
50407
|
}
|
|
50342
50408
|
};
|
|
50343
|
-
const get = async (
|
|
50344
|
-
const { url: url2 } = signGetUrl(
|
|
50345
|
-
const res = await exchange(`read of ${
|
|
50409
|
+
const get = async (key3, o = {}) => {
|
|
50410
|
+
const { url: url2 } = signGetUrl(key3, o);
|
|
50411
|
+
const res = await exchange(`read of ${key3}`, url2, "GET", "bytes", o);
|
|
50346
50412
|
if (!res.ok) {
|
|
50347
50413
|
const why = res.status === 404 ? " \u2014 not found (never uploaded, expired, or already consumed)" : "";
|
|
50348
|
-
throw new McpToolError(`Blob store read of ${
|
|
50414
|
+
throw new McpToolError(`Blob store read of ${key3} failed (HTTP ${res.status})${why}.`, {
|
|
50349
50415
|
kind: "http",
|
|
50350
50416
|
status: res.status
|
|
50351
50417
|
});
|
|
50352
50418
|
}
|
|
50353
50419
|
const contentType = res.headers.get("content-type") ?? void 0;
|
|
50354
|
-
return { key:
|
|
50420
|
+
return { key: key3, bytes: res.body, ...contentType !== void 0 ? { contentType } : {} };
|
|
50355
50421
|
};
|
|
50356
|
-
const del = async (
|
|
50357
|
-
const { url: url2 } = signDeleteUrl(
|
|
50358
|
-
const res = await exchange(`delete of ${
|
|
50422
|
+
const del = async (key3, o = {}) => {
|
|
50423
|
+
const { url: url2 } = signDeleteUrl(key3, o);
|
|
50424
|
+
const res = await exchange(`delete of ${key3}`, url2, "DELETE", "none", o);
|
|
50359
50425
|
if (!res.ok) {
|
|
50360
|
-
throw new McpToolError(`Blob store delete of ${
|
|
50426
|
+
throw new McpToolError(`Blob store delete of ${key3} failed (HTTP ${res.status}).`, {
|
|
50361
50427
|
kind: "http",
|
|
50362
50428
|
status: res.status
|
|
50363
50429
|
});
|
|
50364
50430
|
}
|
|
50365
50431
|
};
|
|
50366
|
-
const consume = async (
|
|
50367
|
-
const object2 = await get(
|
|
50432
|
+
const consume = async (key3, use, o = {}) => {
|
|
50433
|
+
const object2 = await get(key3, o);
|
|
50368
50434
|
const result = await use(object2);
|
|
50369
50435
|
try {
|
|
50370
|
-
await del(
|
|
50436
|
+
await del(key3, o);
|
|
50371
50437
|
return { result, deleted: true };
|
|
50372
50438
|
} catch (e) {
|
|
50373
50439
|
return { result, deleted: false, deleteError: e instanceof Error ? e.message : String(e) };
|
|
@@ -50535,13 +50601,13 @@ function mintUploadSlot(store, req, opts = {}) {
|
|
|
50535
50601
|
};
|
|
50536
50602
|
}
|
|
50537
50603
|
var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
50538
|
-
function uploadFileNameFromKey(
|
|
50604
|
+
function uploadFileNameFromKey(key3, opts = {}) {
|
|
50539
50605
|
const prefix = opts.prefix ?? UPLOAD_KEY_PREFIX;
|
|
50540
50606
|
checkPrefix(prefix);
|
|
50541
50607
|
const escaped = prefix.replace(/[.~-]/g, "\\$&");
|
|
50542
|
-
const match = new RegExp(`^${escaped}/${UUID}/([A-Za-z0-9_-]+)$`).exec(
|
|
50608
|
+
const match = new RegExp(`^${escaped}/${UUID}/([A-Za-z0-9_-]+)$`).exec(key3);
|
|
50543
50609
|
if (!match) {
|
|
50544
|
-
throw new Error(`blobKey ${JSON.stringify(
|
|
50610
|
+
throw new Error(`blobKey ${JSON.stringify(key3)} is not an upload key. Pass the blobKey exactly as the upload slot returned it.`);
|
|
50545
50611
|
}
|
|
50546
50612
|
return sanitizeUploadFilename(Buffer.from(match[1], "base64url").toString("utf8"));
|
|
50547
50613
|
}
|
|
@@ -50551,7 +50617,7 @@ var INLINE_DELIVERY_MAX_BYTES = 10 * 1024 * 1024;
|
|
|
50551
50617
|
var DELIVERY_LINK_DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
50552
50618
|
|
|
50553
50619
|
// src/tools/uploads.ts
|
|
50554
|
-
import { createHash as
|
|
50620
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
50555
50621
|
var MAX_FILES_PER_CALL = MAX_UPLOAD_FILES;
|
|
50556
50622
|
var UPLOAD_SLOT_TTL_MS = UPLOAD_SLOT_DEFAULT_TTL_MS;
|
|
50557
50623
|
var UPLOAD_BLOB_PREFIX = UPLOAD_KEY_PREFIX;
|
|
@@ -50568,21 +50634,21 @@ function resolveInlineUpload(file2) {
|
|
|
50568
50634
|
const bytes = decodeBase64Content(file2.contentBase64, fileName);
|
|
50569
50635
|
return { blob: new Blob([new Uint8Array(bytes)], { type: mimeType }), fileName, mimeType, sizeBytes: bytes.length };
|
|
50570
50636
|
}
|
|
50571
|
-
function fileNameFromBlobKey(
|
|
50637
|
+
function fileNameFromBlobKey(key3) {
|
|
50572
50638
|
try {
|
|
50573
|
-
return uploadFileNameFromKey(
|
|
50639
|
+
return uploadFileNameFromKey(key3, { prefix: UPLOAD_BLOB_PREFIX });
|
|
50574
50640
|
} catch (e) {
|
|
50575
50641
|
const message = e.message;
|
|
50576
50642
|
if (!message.includes("is not an upload key")) throw e;
|
|
50577
|
-
throw new Error(`blobKey ${JSON.stringify(
|
|
50643
|
+
throw new Error(`blobKey ${JSON.stringify(key3)} is not an upload key. Pass the blobKey exactly as ofw_upload_attachment's uploadSlots returned it.`);
|
|
50578
50644
|
}
|
|
50579
50645
|
}
|
|
50580
50646
|
function mintUploadSlot2(store, req) {
|
|
50581
50647
|
const { expiresAtMs, ...slot } = mintUploadSlot(store, req, { prefix: UPLOAD_BLOB_PREFIX, ttlMs: UPLOAD_SLOT_TTL_MS });
|
|
50582
50648
|
return { ...slot, expiresAt: formatInstant(new Date(expiresAtMs)).iso };
|
|
50583
50649
|
}
|
|
50584
|
-
function blobObjectToUpload(
|
|
50585
|
-
const fileName = fileNameFromBlobKey(
|
|
50650
|
+
function blobObjectToUpload(key3, object2) {
|
|
50651
|
+
const fileName = fileNameFromBlobKey(key3);
|
|
50586
50652
|
checkUploadSize2(fileName, object2.bytes.length);
|
|
50587
50653
|
const mimeType = normalizeMimeType(object2.contentType ?? mimeFromName(fileName));
|
|
50588
50654
|
return {
|
|
@@ -50631,7 +50697,7 @@ async function uploadToMyFiles(client2, cache, upload, opts) {
|
|
|
50631
50697
|
return { fileId: meta3.fileId, ...stored, bytes: sizeBytes, shareClass: meta3.shareClass ?? opts.shareClass };
|
|
50632
50698
|
}
|
|
50633
50699
|
async function sha256Hex(blob) {
|
|
50634
|
-
return
|
|
50700
|
+
return createHash7("sha256").update(new Uint8Array(await blob.arrayBuffer())).digest("hex");
|
|
50635
50701
|
}
|
|
50636
50702
|
function checkFileCount(count, what) {
|
|
50637
50703
|
if (count > MAX_FILES_PER_CALL) {
|
|
@@ -51732,6 +51798,7 @@ function withPaginationFirst(input2) {
|
|
|
51732
51798
|
}
|
|
51733
51799
|
|
|
51734
51800
|
// src/tools/messages.ts
|
|
51801
|
+
var WRITE_VIEW_NOTE = 'compact omits OurFamilyWizard\'s raw `listData` echo (which repeats the body, subject, recipients and a date block) and replaces the body you just wrote with `bodyLength` + `bodySha256` (the first 16 hex characters of its SHA-256) to confirm what landed. Pass "full" for both.';
|
|
51735
51802
|
var DRAFT_KEY_NULL_REASON = "No draftKey: this draft was not saved through this server's cache \u2014 it may have been created in the OurFamilyWizard web app or replaced from another session \u2014 so its lineage is unknown. The next ofw_save_draft on it starts a new key.";
|
|
51736
51803
|
async function describeDraftKey(cache, id2) {
|
|
51737
51804
|
const row = await cache.getDraftLineageById(id2);
|
|
@@ -52037,20 +52104,20 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52037
52104
|
});
|
|
52038
52105
|
}
|
|
52039
52106
|
const bounds = {};
|
|
52040
|
-
for (const
|
|
52041
|
-
const value2 = args[
|
|
52107
|
+
for (const key3 of ["since", "until"]) {
|
|
52108
|
+
const value2 = args[key3];
|
|
52042
52109
|
if (value2 === void 0) continue;
|
|
52043
52110
|
const converted = toNaiveWallClock(value2);
|
|
52044
52111
|
if (converted === null) {
|
|
52045
52112
|
return jsonErrorResponse({
|
|
52046
52113
|
result: "INVALID_DATE",
|
|
52047
|
-
reason: `${
|
|
52048
|
-
remedy: `Re-call with ${
|
|
52114
|
+
reason: `${key3} must be an ISO date (YYYY-MM-DD) or datetime, optionally with an offset or Z (got ${JSON.stringify(value2)}).`,
|
|
52115
|
+
remedy: `Re-call with ${key3} as e.g. "2026-07-27" or "2026-07-27T22:00:00-04:00".`,
|
|
52049
52116
|
complete: false,
|
|
52050
52117
|
note: 'No lookup was performed. This says NOTHING about what is in the cache \u2014 do not read it as "no messages".'
|
|
52051
52118
|
});
|
|
52052
52119
|
}
|
|
52053
|
-
bounds[
|
|
52120
|
+
bounds[key3] = converted;
|
|
52054
52121
|
}
|
|
52055
52122
|
const cache = cacheProvider();
|
|
52056
52123
|
const folders = folder === void 0 ? ["inbox", "sent"] : [folder];
|
|
@@ -52179,6 +52246,9 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52179
52246
|
// ofw_delete_draft / ofw_send_message to assert you are acting on
|
|
52180
52247
|
// THIS version.
|
|
52181
52248
|
revision: draftRevision(draftRow, held),
|
|
52249
|
+
// Whether the reply target is OFW's own echo or this server's record of
|
|
52250
|
+
// it (OFW's payload omitted the linkage) — see reply-source.ts.
|
|
52251
|
+
...await replyToSourceField(cache, draftRow.id, draftRow.replyToId),
|
|
52182
52252
|
cacheStatus,
|
|
52183
52253
|
// False = this draft's existence and unsent status are remembered from
|
|
52184
52254
|
// a cache, not confirmed on OFW. Call ofw_check_freshness before
|
|
@@ -52297,7 +52367,8 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52297
52367
|
myFileIDs: external_exports.array(external_exports.number()).describe("Attachment file ids (from ofw_upload_attachment) to attach to the message. When sending by draftId, omit it to carry the server draft's own attachments over; passing it overrides them.").optional(),
|
|
52298
52368
|
inlineAttachments: inlineAttachmentsParam,
|
|
52299
52369
|
blobKeys: blobKeysParam,
|
|
52300
|
-
confirmToken: confirmTokenParam
|
|
52370
|
+
confirmToken: confirmTokenParam,
|
|
52371
|
+
view: viewParam(MESSAGE_VIEWS, { note: WRITE_VIEW_NOTE })
|
|
52301
52372
|
})
|
|
52302
52373
|
}, async (args, ctx) => {
|
|
52303
52374
|
if (args.messageId !== void 0 && args.draftId !== void 0 && args.messageId !== args.draftId) {
|
|
@@ -52517,12 +52588,12 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52517
52588
|
if (draftRef !== void 0) {
|
|
52518
52589
|
const prior = await cache.getDraftLineageById(draftRef);
|
|
52519
52590
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
52520
|
-
const
|
|
52591
|
+
const key3 = prior?.draftKey ?? newDraftKey();
|
|
52521
52592
|
if (prior === null) {
|
|
52522
|
-
await cache.recordDraftLineage({ id: draftRef, draftKey:
|
|
52593
|
+
await cache.recordDraftLineage({ id: draftRef, draftKey: key3, previousId: null, recordedAt: now });
|
|
52523
52594
|
}
|
|
52524
|
-
await cache.recordDraftLineage({ id: newId, draftKey:
|
|
52525
|
-
sentDraftKey =
|
|
52595
|
+
await cache.recordDraftLineage({ id: newId, draftKey: key3, previousId: draftRef, recordedAt: now });
|
|
52596
|
+
sentDraftKey = key3;
|
|
52526
52597
|
}
|
|
52527
52598
|
for (const fileId of myFileIDs) {
|
|
52528
52599
|
const existing = await cache.getAttachment(fileId);
|
|
@@ -52571,7 +52642,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52571
52642
|
...draftDeleted ? {} : { draftRetained: true, draftRetainedReason },
|
|
52572
52643
|
previousId: draftRef
|
|
52573
52644
|
} : {},
|
|
52574
|
-
...persisted,
|
|
52645
|
+
...resolveView(args.view, MESSAGE_VIEWS) === "full" ? persisted : compactSentMessage(persisted),
|
|
52575
52646
|
...attachmentCheck !== null ? { attachments: attachmentCheck } : {},
|
|
52576
52647
|
...newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {},
|
|
52577
52648
|
...uploadWarnings.length > 0 ? { warnings: uploadWarnings } : {}
|
|
@@ -52594,7 +52665,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52594
52665
|
};
|
|
52595
52666
|
let server2;
|
|
52596
52667
|
try {
|
|
52597
|
-
server2 = await fetchServerDraft(client2, draftId);
|
|
52668
|
+
server2 = await fetchServerDraft(client2, draftId, cachedRow?.replyToId ?? null);
|
|
52598
52669
|
} catch (e) {
|
|
52599
52670
|
const reason = e.message;
|
|
52600
52671
|
if (force) {
|
|
@@ -52687,8 +52758,9 @@ ${jsonText(
|
|
|
52687
52758
|
);
|
|
52688
52759
|
const held = await heldFilesFor(cache, rows.map((d) => d.id));
|
|
52689
52760
|
const inferred = await inferredDraftKeys(cache, rows.map((d) => d.id));
|
|
52690
|
-
const drafts2 = rows.map((d) => ({
|
|
52761
|
+
const drafts2 = await Promise.all(rows.map(async (d) => ({
|
|
52691
52762
|
...d,
|
|
52763
|
+
...await replyToSourceField(cache, d.id, d.replyToId),
|
|
52692
52764
|
revision: draftRevision(d, held.get(d.id)),
|
|
52693
52765
|
...held.get(d.id).length > 0 ? { heldFiles: held.get(d.id) } : {},
|
|
52694
52766
|
draftKey: keyById.get(d.id) ?? null,
|
|
@@ -52696,7 +52768,7 @@ ${jsonText(
|
|
|
52696
52768
|
cacheStatus,
|
|
52697
52769
|
serverConfirmed: serverConfirmed2,
|
|
52698
52770
|
asOf: freshness2.asOf
|
|
52699
|
-
}));
|
|
52771
|
+
})));
|
|
52700
52772
|
return { drafts: drafts2, total: total2, freshness: freshness2, serverConfirmed: serverConfirmed2 };
|
|
52701
52773
|
}
|
|
52702
52774
|
});
|
|
@@ -52746,7 +52818,7 @@ ${jsonText(
|
|
|
52746
52818
|
});
|
|
52747
52819
|
if (allowDrafts) server.registerTool("ofw_save_draft", {
|
|
52748
52820
|
_meta: familyMeta("change"),
|
|
52749
|
-
description: "Save a message as a draft in OurFamilyWizard. RECIPIENTS: OurFamilyWizard has not reliably kept recipients on drafts (when the saved draft comes back with none it is noted once, not warned about) \u2014 supply recipientIds at send time as well. ATTACHMENTS: OurFamilyWizard does not store files on drafts, so myFileIDs / inlineAttachments / blobKeys are HELD with the draft by this server (carried across edits, de-duplicated; removeFileIDs drops one), shown under attachments.held, folded into `revision`, and attached when the draft is sent with ofw_send_message(draftId). They are not visible on the draft in the OurFamilyWizard web app. IDENTITY: the response leads with `draftKey`, the stable identity that survives editing \u2014 key off it, because the `id` changes on EVERY edit (replacing a draft creates a NEW draft and deletes the old one; OFW's update-in-place endpoint silently no-ops, so we never use it). Pass messageId to replace an existing draft; the response.id will be the NEW id, and a transparency NOTE documents the swap and which fields were carried over. THREADING: if replyToId is provided, the cache may rewrite it to the latest reply in the thread (note included). The threading verdict is read from OFW's full echo (replyToId/inReplyTo/showContext) \u2014 a warning appears ONLY when the reply linkage was genuinely dropped or re-targeted, and the
|
|
52821
|
+
description: "Save a message as a draft in OurFamilyWizard. RECIPIENTS: OurFamilyWizard has not reliably kept recipients on drafts (when the saved draft comes back with none it is noted once, not warned about) \u2014 supply recipientIds at send time as well. ATTACHMENTS: OurFamilyWizard does not store files on drafts, so myFileIDs / inlineAttachments / blobKeys are HELD with the draft by this server (carried across edits, de-duplicated; removeFileIDs drops one), shown under attachments.held, folded into `revision`, and attached when the draft is sent with ofw_send_message(draftId). They are not visible on the draft in the OurFamilyWizard web app. IDENTITY: the response leads with `draftKey`, the stable identity that survives editing \u2014 key off it, because the `id` changes on EVERY edit (replacing a draft creates a NEW draft and deletes the old one; OFW's update-in-place endpoint silently no-ops, so we never use it). Pass messageId to replace an existing draft; the response.id will be the NEW id, and a transparency NOTE documents the swap and which fields were carried over. THREADING: if replyToId is provided, the cache may rewrite it to the latest reply in the thread (note included). The threading verdict is read from OFW's full echo (replyToId/inReplyTo/showContext) \u2014 a warning appears ONLY when the reply linkage was genuinely dropped or re-targeted. When OFW's echo omits the linkage entirely, the posted target is kept and marked replyToSource:\"cache\". Replacing a draft (messageId) without replyToId keeps the draft's own reply target. RESPONSE: compact by default \u2014 no listData echo, and the body you wrote is returned as bodyLength + bodySha256; view:\"full\" returns both. After saving, the tool re-fetches the draft from OFW, and the returned `revision` reflects that authoritative state (so it will match on your next edit). SAFETY: because replacing DESTROYS the old draft rather than merging, passing messageId first re-reads that draft from OFW and REFUSES the write if its subject/body/recipients changed since you read it (drafts edited in the OFW web app do not bump any timestamp, so the local cache can be silently behind). A pure replyToId normalization by OFW is NOT treated as a conflict. The refusal returns the current server body under serverBody \u2014 merge your edit into it and retry with expectedRevision.",
|
|
52750
52822
|
// Destructive: with messageId, saving REPLACES the draft by creating a new
|
|
52751
52823
|
// one and deleting the old (OFW has no draft update), so the old draft's
|
|
52752
52824
|
// server content is gone. Not idempotent: every call mints a new draft id.
|
|
@@ -52762,10 +52834,12 @@ ${jsonText(
|
|
|
52762
52834
|
inlineAttachments: inlineAttachmentsParam,
|
|
52763
52835
|
blobKeys: blobKeysParam,
|
|
52764
52836
|
expectedRevision: external_exports.string().describe('With messageId: the `revision` you got from ofw_list_drafts/ofw_get_message for that draft. Asserts you are replacing THAT version. If the draft changed on OFW since, the write is refused and the current server body is returned. Omit and the tool compares the server against the local cache instead \u2014 omitting never means "overwrite anyway".').optional(),
|
|
52765
|
-
force: external_exports.boolean().describe("Default false. Overwrite even when the draft changed on OurFamilyWizard since you read it. The discarded server version is echoed back in the response. Only use after showing the user the conflict.").optional()
|
|
52837
|
+
force: external_exports.boolean().describe("Default false. Overwrite even when the draft changed on OurFamilyWizard since you read it. The discarded server version is echoed back in the response. Only use after showing the user the conflict.").optional(),
|
|
52838
|
+
view: viewParam(MESSAGE_VIEWS, { note: WRITE_VIEW_NOTE })
|
|
52766
52839
|
})
|
|
52767
52840
|
}, async (args) => {
|
|
52768
52841
|
const cache = cacheProvider();
|
|
52842
|
+
const view = resolveView(args.view, MESSAGE_VIEWS);
|
|
52769
52843
|
const blobStore = args.blobKeys?.length ? blobStoreFromEnv() : void 0;
|
|
52770
52844
|
const pending = await planAttachments(
|
|
52771
52845
|
{ inline: args.inlineAttachments, blobKeys: args.blobKeys },
|
|
@@ -52775,6 +52849,7 @@ ${jsonText(
|
|
|
52775
52849
|
let serverFiles;
|
|
52776
52850
|
let priorHeld = [];
|
|
52777
52851
|
let serverRecipientIds;
|
|
52852
|
+
let serverReplyTo = null;
|
|
52778
52853
|
if (args.messageId !== void 0) {
|
|
52779
52854
|
const guard = await guardDestructiveDraftOp({
|
|
52780
52855
|
cache,
|
|
@@ -52789,8 +52864,9 @@ ${jsonText(
|
|
|
52789
52864
|
priorHeld = guard.heldFiles;
|
|
52790
52865
|
const kept = (guard.server?.recipients ?? []).map((r) => r.userId).filter((id2) => id2 !== 0);
|
|
52791
52866
|
if (kept.length > 0) serverRecipientIds = [...new Set(kept)];
|
|
52867
|
+
serverReplyTo = guard.server?.replyToId ?? null;
|
|
52792
52868
|
}
|
|
52793
|
-
const requestedReplyTo = args.replyToId ??
|
|
52869
|
+
const requestedReplyTo = args.replyToId ?? serverReplyTo;
|
|
52794
52870
|
let resolvedReplyTo = requestedReplyTo;
|
|
52795
52871
|
let rewriteNote = null;
|
|
52796
52872
|
if (requestedReplyTo !== null) {
|
|
@@ -52833,13 +52909,16 @@ ${jsonText(
|
|
|
52833
52909
|
let verifyNote = null;
|
|
52834
52910
|
let recipientsNote = null;
|
|
52835
52911
|
let newRevision = null;
|
|
52912
|
+
let replyToSource = null;
|
|
52836
52913
|
let onDraft = [];
|
|
52837
52914
|
let held = [];
|
|
52838
52915
|
let draftKey = null;
|
|
52839
52916
|
const warnings = [...uploadWarnings];
|
|
52840
52917
|
if (newId !== null) {
|
|
52841
52918
|
verifyNote = verifyWriteLanded("draft", { subject: args.subject, body: args.body }, detail);
|
|
52842
|
-
const
|
|
52919
|
+
const reply = draftReplyTarget([detail], resolvedReplyTo);
|
|
52920
|
+
const effectiveReplyTo = reply.replyToId;
|
|
52921
|
+
replyToSource = reply.replyToSource;
|
|
52843
52922
|
const storedRecipients = mapRecipients(detail.recipients);
|
|
52844
52923
|
persisted = {
|
|
52845
52924
|
id: newId,
|
|
@@ -52851,6 +52930,7 @@ ${jsonText(
|
|
|
52851
52930
|
listData: detail
|
|
52852
52931
|
};
|
|
52853
52932
|
await cache.upsertDraft(persisted);
|
|
52933
|
+
await setReplyToSource(cache, newId, replyToSource);
|
|
52854
52934
|
onDraft = Array.isArray(detail.files) ? detail.files : [];
|
|
52855
52935
|
held = myFileIDs.filter((id2) => !onDraft.includes(id2));
|
|
52856
52936
|
await setHeldFiles(cache, newId, held);
|
|
@@ -52914,8 +52994,9 @@ ${jsonText(
|
|
|
52914
52994
|
const responseObj = persisted !== null ? {
|
|
52915
52995
|
draftKey,
|
|
52916
52996
|
revision: newRevision,
|
|
52917
|
-
...persisted,
|
|
52997
|
+
...view === "full" ? persisted : compactWrittenDraft(persisted),
|
|
52918
52998
|
inReplyTo: persisted.replyToId,
|
|
52999
|
+
...replyToSource !== null ? { replyToSource } : {},
|
|
52919
53000
|
previousId: args.messageId ?? null,
|
|
52920
53001
|
cacheStatus: "fresh",
|
|
52921
53002
|
serverConfirmed: true,
|
|
@@ -53137,10 +53218,10 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
|
|
|
53137
53218
|
results.push({ index, ok: true, ...await uploadToMyFiles(client2, cache, upload, opts) });
|
|
53138
53219
|
continue;
|
|
53139
53220
|
}
|
|
53140
|
-
const
|
|
53141
|
-
fileNameFromBlobKey(
|
|
53142
|
-
const out = await store.consume(
|
|
53143
|
-
const upload = blobObjectToUpload(
|
|
53221
|
+
const key3 = args.blobKeys[index];
|
|
53222
|
+
fileNameFromBlobKey(key3);
|
|
53223
|
+
const out = await store.consume(key3, async (object2) => {
|
|
53224
|
+
const upload = blobObjectToUpload(key3, object2);
|
|
53144
53225
|
const gate = await shareGate(ctx, args, upload, opts, confirmToken);
|
|
53145
53226
|
if (gate) throw new GateHalt(gate);
|
|
53146
53227
|
return uploadToMyFiles(client2, cache, upload, opts);
|
|
@@ -53221,9 +53302,9 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
|
|
|
53221
53302
|
}
|
|
53222
53303
|
const linkDelivery = async (bytes, fileName2, mimeType2, note) => {
|
|
53223
53304
|
const keyName = `${fileId}-${basename3(fileName2)}`.replace(/[^A-Za-z0-9._~-]/g, "_").replace(/^\.+/, "_");
|
|
53224
|
-
const
|
|
53225
|
-
await store.put(
|
|
53226
|
-
const signed = store.signGetUrl(
|
|
53305
|
+
const key3 = `attachments/${randomUUID3()}/${keyName}`;
|
|
53306
|
+
await store.put(key3, new Uint8Array(bytes), mimeType2);
|
|
53307
|
+
const signed = store.signGetUrl(key3, { ttlMs: (args.linkMinutes ?? 60) * 6e4 });
|
|
53227
53308
|
return jsonResponse({
|
|
53228
53309
|
fileId,
|
|
53229
53310
|
deliveredVia: "link",
|
|
@@ -53503,7 +53584,7 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
|
|
|
53503
53584
|
);
|
|
53504
53585
|
const held = await heldFilesFor(cache, rows.map((d) => d.id));
|
|
53505
53586
|
const inferred = await inferredDraftKeys(cache, rows.map((d) => d.id));
|
|
53506
|
-
drafts = rows.map((d) => ({
|
|
53587
|
+
drafts = await Promise.all(rows.map(async (d) => ({
|
|
53507
53588
|
id: d.id,
|
|
53508
53589
|
draftKey: keyById.get(d.id) ?? null,
|
|
53509
53590
|
...inferred.has(d.id) ? { draftKeyInferred: true } : {},
|
|
@@ -53513,8 +53594,9 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
|
|
|
53513
53594
|
modifiedAt: d.modifiedAt,
|
|
53514
53595
|
recipients: d.recipients,
|
|
53515
53596
|
replyToId: d.replyToId,
|
|
53597
|
+
...await replyToSourceField(cache, d.id, d.replyToId),
|
|
53516
53598
|
cacheStatus
|
|
53517
|
-
}));
|
|
53599
|
+
})));
|
|
53518
53600
|
if (!inventoryComplete) {
|
|
53519
53601
|
incomplete.push("the drafts folder was not fully verified against OurFamilyWizard on this call (the request budget paused the walk), so this inventory may be missing or misreporting drafts");
|
|
53520
53602
|
}
|
|
@@ -53998,9 +54080,9 @@ function registerCalendarTools(server, client2, attachmentIO = new NodeAttachmen
|
|
|
53998
54080
|
const fileName = `ofw-calendar-${args.startDate}_${args.endDate}-${now.toISOString().replace(/[-:]/g, "").slice(0, 15)}Z.ics`;
|
|
53999
54081
|
const blob = blobStoreFromEnv();
|
|
54000
54082
|
if (blob) {
|
|
54001
|
-
const
|
|
54002
|
-
await blob.put(
|
|
54003
|
-
const link2 = blob.signGetUrl(
|
|
54083
|
+
const key3 = `calendar/${randomUUID4()}/${fileName}`;
|
|
54084
|
+
await blob.put(key3, built.ics, "text/calendar");
|
|
54085
|
+
const link2 = blob.signGetUrl(key3, { ttlMs: (args.linkMinutes ?? 60) * 6e4 });
|
|
54004
54086
|
return jsonResponse({
|
|
54005
54087
|
delivered: "link",
|
|
54006
54088
|
url: link2.url,
|
|
@@ -54480,10 +54562,10 @@ var ARG_FOR = {
|
|
|
54480
54562
|
};
|
|
54481
54563
|
var isRecord3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
54482
54564
|
var positiveInt = (v) => typeof v === "number" && Number.isInteger(v) && v > 0 ? v : void 0;
|
|
54483
|
-
var refId = (v,
|
|
54484
|
-
var idList = (v,
|
|
54565
|
+
var refId = (v, key3) => positiveInt(v) ?? (isRecord3(v) ? positiveInt(v[key3]) ?? positiveInt(v.id) : void 0);
|
|
54566
|
+
var idList = (v, key3) => {
|
|
54485
54567
|
if (!Array.isArray(v)) return void 0;
|
|
54486
|
-
const ids = v.map((x) => refId(x,
|
|
54568
|
+
const ids = v.map((x) => refId(x, key3));
|
|
54487
54569
|
return ids.every((id2) => id2 !== void 0) ? ids : void 0;
|
|
54488
54570
|
};
|
|
54489
54571
|
function readExpenseState(raw) {
|
|
@@ -54507,9 +54589,9 @@ function readExpenseState(raw) {
|
|
|
54507
54589
|
if (d.description === null || d.description === "") out.description = null;
|
|
54508
54590
|
else if (typeof d.description === "string") out.description = d.description;
|
|
54509
54591
|
}
|
|
54510
|
-
for (const
|
|
54511
|
-
if (!(
|
|
54512
|
-
const ids = d[
|
|
54592
|
+
for (const key3 of ["fileIds", "files"]) {
|
|
54593
|
+
if (!(key3 in d)) continue;
|
|
54594
|
+
const ids = d[key3] === null ? [] : idList(d[key3], "fileId");
|
|
54513
54595
|
if (ids !== void 0) out.fileIds = ids;
|
|
54514
54596
|
break;
|
|
54515
54597
|
}
|
|
@@ -55298,14 +55380,14 @@ var OFWCacheCore = class {
|
|
|
55298
55380
|
[folder, state.lastSyncAt, nullish3(state.newestId), nullish3(state.resumePage)]
|
|
55299
55381
|
);
|
|
55300
55382
|
}
|
|
55301
|
-
getMeta(
|
|
55302
|
-
const r = this.db.get("SELECT value FROM meta WHERE key = ?", [
|
|
55383
|
+
getMeta(key3) {
|
|
55384
|
+
const r = this.db.get("SELECT value FROM meta WHERE key = ?", [key3]);
|
|
55303
55385
|
return r ? r.value : null;
|
|
55304
55386
|
}
|
|
55305
|
-
setMeta(
|
|
55387
|
+
setMeta(key3, value) {
|
|
55306
55388
|
this.db.run(
|
|
55307
55389
|
"INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value",
|
|
55308
|
-
[
|
|
55390
|
+
[key3, value]
|
|
55309
55391
|
);
|
|
55310
55392
|
}
|
|
55311
55393
|
findLatestReplyTip(replyToId) {
|
|
@@ -55445,11 +55527,11 @@ var LocalCacheStore = class {
|
|
|
55445
55527
|
async setSyncState(folder, state) {
|
|
55446
55528
|
this.core.setSyncState(folder, state);
|
|
55447
55529
|
}
|
|
55448
|
-
async getMeta(
|
|
55449
|
-
return this.core.getMeta(
|
|
55530
|
+
async getMeta(key3) {
|
|
55531
|
+
return this.core.getMeta(key3);
|
|
55450
55532
|
}
|
|
55451
|
-
async setMeta(
|
|
55452
|
-
this.core.setMeta(
|
|
55533
|
+
async setMeta(key3, value) {
|
|
55534
|
+
this.core.setMeta(key3, value);
|
|
55453
55535
|
}
|
|
55454
55536
|
async findLatestReplyTip(replyToId) {
|
|
55455
55537
|
return this.core.findLatestReplyTip(replyToId);
|