ofw-mcp 2.27.0 → 2.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 key of __getOwnPropNames(from))
29
- if (!__hasOwnProp.call(to, key) && key !== except)
30
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ for (let key2 of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
30
+ __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || 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((key) => {
377
- let value = params[key];
376
+ Object.keys(params).forEach((key2) => {
377
+ let value = params[key2];
378
378
  if (value.length > 1) {
379
- throw new Error(`Parameter "${key}" must have only a single value`);
379
+ throw new Error(`Parameter "${key2}" must have only a single value`);
380
380
  }
381
381
  value = value[0];
382
- if (key === "client_max_window_bits") {
382
+ if (key2 === "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 "${key}": ${value}`
387
+ `Invalid value for parameter "${key2}": ${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 "${key}": ${value}`
393
+ `Invalid value for parameter "${key2}": ${value}`
394
394
  );
395
395
  }
396
- } else if (key === "server_max_window_bits") {
396
+ } else if (key2 === "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 "${key}": ${value}`
400
+ `Invalid value for parameter "${key2}": ${value}`
401
401
  );
402
402
  }
403
403
  value = num;
404
- } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
404
+ } else if (key2 === "client_no_context_takeover" || key2 === "server_no_context_takeover") {
405
405
  if (value !== true) {
406
406
  throw new TypeError(
407
- `Invalid value for parameter "${key}": ${value}`
407
+ `Invalid value for parameter "${key2}": ${value}`
408
408
  );
409
409
  }
410
410
  } else {
411
- throw new Error(`Unknown parameter "${key}"`);
411
+ throw new Error(`Unknown parameter "${key2}"`);
412
412
  }
413
- params[key] = value;
413
+ params[key2] = 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 key = `${endpoint}_max_window_bits`;
462
- const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
461
+ const key2 = `${endpoint}_max_window_bits`;
462
+ const windowBits = typeof this.params[key2] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key2];
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 key = `${endpoint}_max_window_bits`;
513
- const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
512
+ const key2 = `${endpoint}_max_window_bits`;
513
+ const windowBits = typeof this.params[key2] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key2];
514
514
  this._deflate = zlib.createDeflateRaw({
515
515
  ...this._options.zlibDeflateOptions,
516
516
  windowBits
@@ -2830,7 +2830,7 @@ var require_websocket = __commonJS({
2830
2830
  }
2831
2831
  }
2832
2832
  const defaultPort = isSecure ? 443 : 80;
2833
- const key = randomBytes7(16).toString("base64");
2833
+ const key2 = 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": key,
2844
+ "Sec-WebSocket-Key": key2,
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 [key2, value] of Object.entries(headers)) {
2896
- options.headers[key2.toLowerCase()] = value;
2895
+ for (const [key3, value] of Object.entries(headers)) {
2896
+ options.headers[key3.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 = createHash7("sha1").update(key + GUID).digest("base64");
2963
+ const digest = createHash7("sha1").update(key2 + 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;
@@ -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 key = req.headers["sec-websocket-key"];
3531
+ const key2 = 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 (key === void 0 || !keyRegex.test(key)) {
3544
+ if (key2 === void 0 || !keyRegex.test(key2)) {
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
- key,
3604
+ key2,
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, key, protocols, req, socket, head, cb);
3616
+ this.completeUpgrade(extensions, key2, 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, key, protocols, req, socket, head, cb) {
3631
+ completeUpgrade(extensions, key2, 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 = createHash7("sha1").update(key + GUID).digest("base64");
3639
+ const digest = createHash7("sha1").update(key2 + 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, key; i < n; i++) {
3802
- key = keys[i];
3803
- if (!__hasOwnProp2.call(to, key) && key !== except) {
3804
- __defProp2(to, key, {
3805
- get: ((k) => from[k]).bind(null, key),
3806
- enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
3801
+ for (var keys = __getOwnPropNames2(from), i = 0, n = keys.length, key2; i < n; i++) {
3802
+ key2 = keys[i];
3803
+ if (!__hasOwnProp2.call(to, key2) && key2 !== except) {
3804
+ __defProp2(to, key2, {
3805
+ get: ((k) => from[k]).bind(null, key2),
3806
+ enumerable: !(desc = __getOwnPropDesc2(from, key2)) || 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, key, getter) {
4558
+ function defineLazy(object2, key2, getter) {
4559
4559
  let value = void 0;
4560
- Object.defineProperty(object2, key, {
4560
+ Object.defineProperty(object2, key2, {
4561
4561
  get() {
4562
4562
  if (value === EVALUATING) {
4563
4563
  return void 0;
@@ -4569,7 +4569,7 @@ function defineLazy(object2, key, getter) {
4569
4569
  return value;
4570
4570
  },
4571
4571
  set(v) {
4572
- Object.defineProperty(object2, key, {
4572
+ Object.defineProperty(object2, key2, {
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, key, getter) {
4599
- Object.defineProperty(target, key, {
4598
+ function deferProp(target, key2, getter) {
4599
+ Object.defineProperty(target, key2, {
4600
4600
  get() {
4601
4601
  const value = getter();
4602
- assignProp(this, key, value);
4602
+ assignProp(this, key2, value);
4603
4603
  return value;
4604
4604
  },
4605
4605
  enumerable: true,
4606
4606
  configurable: true
4607
4607
  });
4608
4608
  }
4609
- function putProp(target, key, value) {
4610
- if (key in target)
4611
- assignProp(target, key, value);
4609
+ function putProp(target, key2, value) {
4610
+ if (key2 in target)
4611
+ assignProp(target, key2, value);
4612
4612
  else
4613
- target[key] = value;
4613
+ target[key2] = value;
4614
4614
  }
4615
4615
  function mirrorShape(target, source, keys, wrap) {
4616
4616
  const raw = sourceShape(source);
4617
- for (const key of keys) {
4618
- const desc = Object.getOwnPropertyDescriptor(raw, key);
4617
+ for (const key2 of keys) {
4618
+ const desc = Object.getOwnPropertyDescriptor(raw, key2);
4619
4619
  if (!desc.enumerable)
4620
4620
  continue;
4621
4621
  if (desc.get) {
4622
- deferProp(target, key, () => {
4623
- const value = source._zod.def.shape[key];
4624
- return wrap ? wrap(value, key) : value;
4622
+ deferProp(target, key2, () => {
4623
+ const value = source._zod.def.shape[key2];
4624
+ return wrap ? wrap(value, key2) : value;
4625
4625
  });
4626
4626
  } else
4627
- putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
4627
+ putProp(target, key2, wrap ? wrap(desc.value, key2) : desc.value);
4628
4628
  }
4629
4629
  }
4630
4630
  function mirrorProps(target, source) {
4631
- for (const key of Reflect.ownKeys(source)) {
4632
- const desc = Object.getOwnPropertyDescriptor(source, key);
4631
+ for (const key2 of Reflect.ownKeys(source)) {
4632
+ const desc = Object.getOwnPropertyDescriptor(source, key2);
4633
4633
  if (!desc.enumerable)
4634
4634
  continue;
4635
4635
  if (desc.get)
4636
- deferProp(target, key, () => source[key]);
4636
+ deferProp(target, key2, () => source[key2]);
4637
4637
  else
4638
- putProp(target, key, desc.value);
4638
+ putProp(target, key2, 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, key) => acc?.[key], obj);
4655
+ return path.reduce((acc, key2) => acc?.[key2], obj);
4656
4656
  }
4657
4657
  function promiseAllObject(promisesObj) {
4658
4658
  const keys = Object.keys(promisesObj);
4659
- const promises = keys.map((key) => promisesObj[key]);
4659
+ const promises = keys.map((key2) => promisesObj[key2]);
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 key in data) {
4732
- if (Object.prototype.hasOwnProperty.call(data, key)) {
4731
+ for (const key2 in data) {
4732
+ if (Object.prototype.hasOwnProperty.call(data, key2)) {
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 key of Reflect.ownKeys(mask)) {
4887
- if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
4888
- throw new Error(`Unrecognized key: "${String(key)}"`);
4886
+ for (const key2 of Reflect.ownKeys(mask)) {
4887
+ if (!Object.getOwnPropertyDescriptor(raw, key2)?.enumerable) {
4888
+ throw new Error(`Unrecognized key: "${String(key2)}"`);
4889
4889
  }
4890
- if (mask[key])
4891
- keys.push(key);
4890
+ if (mask[key2])
4891
+ keys.push(key2);
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((key) => !omitted.has(key)));
4904
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key2) => !omitted.has(key2)));
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 key of Reflect.ownKeys(shape)) {
4916
- if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
4915
+ for (const key2 of Reflect.ownKeys(shape)) {
4916
+ if (Object.getOwnPropertyDescriptor(existingShape, key2) !== 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, key) => selected && !selected.has(key) ? value : new Class2({ type: "optional", innerType: value })));
4963
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key2) => selected && !selected.has(key2) ? 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, key) => (
4969
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key2) => (
4970
4970
  // overwrite with non-optional
4971
- selected && !selected.has(key) ? value : new Class2({ type: "nonoptional", innerType: value })
4971
+ selected && !selected.has(key2) ? 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 key in table) {
5159
- const desc = Object.getOwnPropertyDescriptor(table, key);
5158
+ for (const key2 in table) {
5159
+ const desc = Object.getOwnPropertyDescriptor(table, key2);
5160
5160
  if (desc.get)
5161
- Object.defineProperty(proto, key, { ...desc, enumerable: false });
5161
+ Object.defineProperty(proto, key2, { ...desc, enumerable: false });
5162
5162
  else
5163
- defineBound(proto, key, desc.value);
5163
+ defineBound(proto, key2, desc.value);
5164
5164
  }
5165
5165
  }
5166
- function own(inst, key, value, enumerable = true) {
5167
- Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
5166
+ function own(inst, key2, value, enumerable = true) {
5167
+ Object.defineProperty(inst, key2, { configurable: true, writable: true, enumerable, value });
5168
5168
  return value;
5169
5169
  }
5170
- function hide(inst, key, value) {
5171
- return own(inst, key, value, false);
5170
+ function hide(inst, key2, value) {
5171
+ return own(inst, key2, value, false);
5172
5172
  }
5173
5173
  // @__NO_SIDE_EFFECTS__
5174
5174
  function derived(computes, table) {
5175
- for (const key in computes) {
5176
- const compute = computes[key];
5177
- Object.defineProperty(table, key, {
5175
+ for (const key2 in computes) {
5176
+ const compute = computes[key2];
5177
+ Object.defineProperty(table, key2, {
5178
5178
  configurable: true,
5179
5179
  enumerable: true,
5180
5180
  get() {
5181
- return own(this, key, compute(this));
5181
+ return own(this, key2, compute(this));
5182
5182
  },
5183
5183
  set(value) {
5184
- own(this, key, value);
5184
+ own(this, key2, value);
5185
5185
  }
5186
5186
  });
5187
5187
  }
5188
5188
  return table;
5189
5189
  }
5190
- function defineBound(proto, key, fn) {
5191
- Object.defineProperty(proto, key, {
5190
+ function defineBound(proto, key2, fn) {
5191
+ Object.defineProperty(proto, key2, {
5192
5192
  configurable: true,
5193
5193
  get() {
5194
- return this == null ? fn : own(this, key, fn.bind(this));
5194
+ return this == null ? fn : own(this, key2, fn.bind(this));
5195
5195
  },
5196
5196
  set(value) {
5197
- own(this, key, value);
5197
+ own(this, key2, 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, key, compute) {
5214
+ function defineLazyInternal(inst, key2, compute) {
5215
5215
  const proto = Object.getPrototypeOf(inst._zod);
5216
- if (key in proto && installing !== inst._zod) {
5216
+ if (key2 in proto && installing !== inst._zod) {
5217
5217
  installing = void 0;
5218
5218
  return;
5219
5219
  }
5220
5220
  installing = inst._zod;
5221
- Object.defineProperty(proto, key, {
5221
+ Object.defineProperty(proto, key2, {
5222
5222
  configurable: true,
5223
5223
  get() {
5224
- Object.defineProperty(this, key, breaker);
5224
+ Object.defineProperty(this, key2, 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[key];
5230
+ delete this[key2];
5231
5231
  else
5232
- Object.defineProperty(this, key, { configurable: true, writable: true, value });
5232
+ Object.defineProperty(this, key2, { configurable: true, writable: true, value });
5233
5233
  broke = broke || outer;
5234
5234
  return value;
5235
5235
  } catch (err) {
5236
- delete this[key];
5236
+ delete this[key2];
5237
5237
  broke = broke || outer;
5238
5238
  throw err;
5239
5239
  }
5240
5240
  },
5241
5241
  set(value) {
5242
- Object.defineProperty(this, key, { configurable: true, writable: true, value });
5242
+ Object.defineProperty(this, key2, { configurable: true, writable: true, value });
5243
5243
  }
5244
5244
  });
5245
5245
  }
5246
- function installLazyProp(inst, key, make, enumerable) {
5247
- const proto = claim(inst, key);
5246
+ function installLazyProp(inst, key2, make, enumerable) {
5247
+ const proto = claim(inst, key2);
5248
5248
  if (!proto)
5249
5249
  return;
5250
- Object.defineProperty(proto, key, {
5250
+ Object.defineProperty(proto, key2, {
5251
5251
  configurable: true,
5252
5252
  get() {
5253
5253
  const desc = { configurable: true, writable: true, enumerable, value: void 0 };
5254
- Object.defineProperty(this, key, desc);
5254
+ Object.defineProperty(this, key2, desc);
5255
5255
  desc.value = make(this);
5256
- Object.defineProperty(this, key, desc);
5256
+ Object.defineProperty(this, key2, desc);
5257
5257
  return desc.value;
5258
5258
  },
5259
5259
  set(value) {
5260
- Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });
5260
+ Object.defineProperty(this, key2, { 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, key, make) {
5438
- if (!Object.prototype.hasOwnProperty.call(obj, key)) {
5439
- if (key === "__proto__") {
5440
- Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
5437
+ function node(obj, key2, make) {
5438
+ if (!Object.prototype.hasOwnProperty.call(obj, key2)) {
5439
+ if (key2 === "__proto__") {
5440
+ Object.defineProperty(obj, key2, { value: make(), writable: true, enumerable: true, configurable: true });
5441
5441
  } else {
5442
- obj[key] = make();
5442
+ obj[key2] = make();
5443
5443
  }
5444
5444
  }
5445
- return obj[key];
5445
+ return obj[key2];
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((key) => [key, def.shape[key]]));
6354
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key2) => [key2, def.shape[key2]]));
6355
6355
  const input2 = payload.value;
6356
6356
  let proms;
6357
- for (const [key, schema] of entries) {
6358
- const result = schema._zod.run({ value: input2[key], issues: [] }, {});
6357
+ for (const [key2, schema] of entries) {
6358
+ const result = schema._zod.run({ value: input2[key2], issues: [] }, {});
6359
6359
  if (result instanceof Promise) {
6360
6360
  proms ?? (proms = []);
6361
- proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key)));
6361
+ proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key2)));
6362
6362
  } else {
6363
- handleCheckPropertyResult(result, payload, key);
6363
+ handleCheckPropertyResult(result, payload, key2);
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, key, input2, optin, optout) {
7265
- const isPresent = key in input2;
7264
+ function handlePropertyResult(result, final, key2, input2, optin, optout) {
7265
+ const isPresent = key2 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, key, input2, optin, optout) {
7271
7271
  if (optin !== void 0 && isOptionalOut && !isPresent) {
7272
7272
  return;
7273
7273
  }
7274
- final.issues.push(...prefixIssues(key, result.issues));
7274
+ final.issues.push(...prefixIssues(key2, 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, key, input2, optin, optout) {
7279
7279
  code: "invalid_type",
7280
7280
  expected: "nonoptional",
7281
7281
  input: void 0,
7282
- path: [key]
7282
+ path: [key2]
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[key] = void 0;
7289
+ final.value[key2] = void 0;
7290
7290
  }
7291
7291
  } else {
7292
- final.value[key] = result.value;
7292
+ final.value[key2] = 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 key in input2) {
7325
+ for (const key2 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(key))
7331
+ if (keySet.has(key2))
7332
7332
  continue;
7333
- if (key === "__proto__") {
7333
+ if (key2 === "__proto__") {
7334
7334
  if (t === "never")
7335
- unrecognized.push(key);
7335
+ unrecognized.push(key2);
7336
7336
  continue;
7337
7337
  }
7338
7338
  if (t === "never") {
7339
- unrecognized.push(key);
7339
+ unrecognized.push(key2);
7340
7340
  continue;
7341
7341
  }
7342
- const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
7342
+ const r = _catchall.run({ value: input2[key2], issues: [] }, ctx);
7343
7343
  if (r instanceof Promise) {
7344
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, optin, optout)));
7344
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key2, input2, optin, optout)));
7345
7345
  } else {
7346
- handlePropertyResult(r, payload, key, input2, optin, optout);
7346
+ handlePropertyResult(r, payload, key2, 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 key in shape) {
7384
- const field = shape[key]._zod;
7383
+ for (const key2 in shape) {
7384
+ const field = shape[key2]._zod;
7385
7385
  if (field.values) {
7386
- if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
7387
- assignProp(propValues, key, /* @__PURE__ */ new Set());
7386
+ if (!Object.prototype.hasOwnProperty.call(propValues, key2)) {
7387
+ assignProp(propValues, key2, /* @__PURE__ */ new Set());
7388
7388
  }
7389
7389
  for (const v of field.values)
7390
- propValues[key].add(v);
7390
+ propValues[key2].add(v);
7391
7391
  if (field.optin !== void 0)
7392
- propValues[key].add(void 0);
7392
+ propValues[key2].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 key of value.allKeys) {
7419
+ for (const key2 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 (key === "__proto__")
7425
+ if (key2 === "__proto__")
7426
7426
  continue;
7427
- const el = shape[key];
7427
+ const el = shape[key2];
7428
7428
  const optin = el._zod.optin;
7429
7429
  const optout = el._zod.optout;
7430
- const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
7430
+ const r = el._zod.run({ value: input2[key2], issues: [] }, ctx);
7431
7431
  if (r instanceof Promise) {
7432
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, optin, optout)));
7432
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key2, input2, optin, optout)));
7433
7433
  } else {
7434
- handlePropertyResult(r, payload, key, input2, optin, optout);
7434
+ handlePropertyResult(r, payload, key2, 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 key of normalized.allKeys) {
7469
- ids[key] = `key_${counter++}`;
7468
+ for (const key2 of normalized.allKeys) {
7469
+ ids[key2] = `key_${counter++}`;
7470
7470
  }
7471
7471
  doc.write(memo3 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
7472
- for (const key of normalized.allKeys) {
7473
- if (key === "__proto__")
7472
+ for (const key2 of normalized.allKeys) {
7473
+ if (key2 === "__proto__")
7474
7474
  continue;
7475
- const id2 = ids[key];
7476
- const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
7475
+ const id2 = ids[key2];
7476
+ const k = typeof key2 === "symbol" ? `syms[${syms.indexOf(key2)}]` : esc(key2);
7477
7477
  const isPresent = `${k} in input`;
7478
- const schema = shape[key];
7478
+ const schema = shape[key2];
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((key) => bKeys.indexOf(key) !== -1);
7812
+ const sharedKeys = Object.keys(a).filter((key2) => bKeys.indexOf(key2) !== -1);
7813
7813
  const newObj = { ...a, ...b };
7814
7814
  if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
7815
7815
  delete newObj.__proto__;
7816
- for (const key of sharedKeys) {
7817
- if (key === "__proto__")
7816
+ for (const key2 of sharedKeys) {
7817
+ if (key2 === "__proto__")
7818
7818
  continue;
7819
- const sharedValue = mergeValues(a[key], b[key]);
7819
+ const sharedValue = mergeValues(a[key2], b[key2]);
7820
7820
  if (!sharedValue.valid) {
7821
7821
  return {
7822
7822
  valid: false,
7823
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
7823
+ mergeErrorPath: [key2, ...sharedValue.mergeErrorPath]
7824
7824
  };
7825
7825
  }
7826
- newObj[key] = sharedValue.data;
7826
+ newObj[key2] = 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, key) {
7985
+ function getTupleOptStart(items, key2) {
7986
7986
  for (let i = items.length - 1; i >= 0; i--) {
7987
- const omittable = key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional";
7987
+ const omittable = key2 === "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 key of values) {
8046
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
8047
- recordKeys.add(typeof key === "number" ? key.toString() : key);
8048
- if (key === "__proto__")
8045
+ for (const key2 of values) {
8046
+ if (typeof key2 === "string" || typeof key2 === "number" || typeof key2 === "symbol") {
8047
+ recordKeys.add(typeof key2 === "number" ? key2.toString() : key2);
8048
+ if (key2 === "__proto__")
8049
8049
  continue;
8050
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
8050
+ const keyResult = def.keyType._zod.run({ value: key2, 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: key,
8060
- path: [key],
8059
+ input: key2,
8060
+ path: [key2],
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[key], issues: [] }, ctx);
8068
+ const result = def.valueType._zod.run({ value: input2[key2], 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(key, result2.issues));
8072
+ payload.issues.push(...prefixIssues(key2, 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(key, result.issues));
8078
+ payload.issues.push(...prefixIssues(key2, result.issues));
8079
8079
  }
8080
8080
  payload.value[outKey] = result.value;
8081
8081
  }
8082
8082
  }
8083
8083
  }
8084
8084
  let unrecognized;
8085
- for (const key in input2) {
8086
- if (!recordKeys.has(key)) {
8085
+ for (const key2 in input2) {
8086
+ if (!recordKeys.has(key2)) {
8087
8087
  if (def.mode === "loose") {
8088
- if (key === "__proto__")
8088
+ if (key2 === "__proto__")
8089
8089
  continue;
8090
- payload.value[key] = input2[key];
8090
+ payload.value[key2] = input2[key2];
8091
8091
  } else {
8092
8092
  unrecognized = unrecognized ?? [];
8093
- unrecognized.push(key);
8093
+ unrecognized.push(key2);
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 key of Reflect.ownKeys(input2)) {
8110
- if (key === "__proto__")
8109
+ for (const key2 of Reflect.ownKeys(input2)) {
8110
+ if (key2 === "__proto__")
8111
8111
  continue;
8112
- if (!Object.prototype.propertyIsEnumerable.call(input2, key))
8112
+ if (!Object.prototype.propertyIsEnumerable.call(input2, key2))
8113
8113
  continue;
8114
- let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
8114
+ let keyResult = def.keyType._zod.run({ value: key2, 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 key === "string" && number.test(key) && keyResult.issues.length;
8118
+ const checkNumericKey = typeof key2 === "string" && number.test(key2) && keyResult.issues.length;
8119
8119
  if (checkNumericKey) {
8120
- const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
8120
+ const retryResult = def.keyType._zod.run({ value: Number(key2), 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[key] = input2[key];
8130
+ payload.value[key2] = input2[key2];
8131
8131
  } else if (values) {
8132
8132
  unrecognized = unrecognized ?? [];
8133
- unrecognized.push(key);
8133
+ unrecognized.push(key2);
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: key,
8140
- path: [key],
8139
+ input: key2,
8140
+ path: [key2],
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[key], issues: [] }, ctx);
8149
+ const result = def.valueType._zod.run({ value: input2[key2], 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(key, result2.issues));
8153
+ payload.issues.push(...prefixIssues(key2, 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(key, result.issues));
8159
+ payload.issues.push(...prefixIssues(key2, 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 [key, value] of input2) {
8199
+ for (const [key2, 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: key, issues: [] }, ctx);
8205
+ const keyResult = def.keyType._zod.run({ value: key2, 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, key, input2, inst, ctx);
8209
+ handleMapResult(keyResult2, valueResult2, payload, key2, input2, inst, ctx);
8210
8210
  }));
8211
8211
  } else {
8212
- handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
8212
+ handleMapResult(keyResult, valueResult, payload, key2, 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, key, input2, inst, ctx) {
8221
+ function handleMapResult(keyResult, valueResult, final, key2, input2, inst, ctx) {
8222
8222
  if (keyResult.issues.length) {
8223
- if (propertyKeyTypes.has(typeof key)) {
8224
- final.issues.push(...prefixIssues(key, keyResult.issues));
8223
+ if (propertyKeyTypes.has(typeof key2)) {
8224
+ final.issues.push(...prefixIssues(key2, keyResult.issues));
8225
8225
  } else {
8226
8226
  final.issues.push({
8227
8227
  code: "invalid_key",
@@ -8233,15 +8233,15 @@ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx)
8233
8233
  }
8234
8234
  }
8235
8235
  if (valueResult.issues.length) {
8236
- if (propertyKeyTypes.has(typeof key)) {
8237
- final.issues.push(...prefixIssues(key, valueResult.issues));
8236
+ if (propertyKeyTypes.has(typeof key2)) {
8237
+ final.issues.push(...prefixIssues(key2, 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: key2,
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 key of Reflect.ownKeys(sh)) {
8920
- const desc = Object.getOwnPropertyDescriptor(sh, key);
8919
+ for (const key2 of Reflect.ownKeys(sh)) {
8920
+ const desc = Object.getOwnPropertyDescriptor(sh, key2);
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 key in def) {
9017
- const desc = Object.getOwnPropertyDescriptor(def, key);
9016
+ for (const key2 in def) {
9017
+ const desc = Object.getOwnPropertyDescriptor(def, key2);
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 key of Reflect.ownKeys(shape)) {
17151
- const keyExpr = typeof key === "symbol" ? addConstant(ctx, key) : esc(key);
17150
+ for (const key2 of Reflect.ownKeys(shape)) {
17151
+ const keyExpr = typeof key2 === "symbol" ? addConstant(ctx, key2) : esc(key2);
17152
17152
  const inputVar = newVar(ctx);
17153
17153
  doc.write(`const ${inputVar} = ${accessor}[${keyExpr}];`);
17154
- compileChild(doc, ctx, shape[key], inputVar, false);
17154
+ compileChild(doc, ctx, shape[key2], 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 key of allKeys) {
17548
- const propSchema = propShape[key];
17549
- const kx = keyExpr(key);
17547
+ for (const key2 of allKeys) {
17548
+ const propSchema = propShape[key2];
17549
+ const kx = keyExpr(key2);
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(key, outputVar2);
17570
+ propOutputs.set(key2, 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(key, outputAccessor);
17577
+ propOutputs.set(key2, 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, key) {
17998
+ function getTupleOptStart2(items, key2) {
17999
17999
  for (let i = items.length - 1; i >= 0; i--) {
18000
- const omittable = key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional";
18000
+ const omittable = key2 === "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 key of keyValues) {
18131
- if (!(typeof key === "string" || typeof key === "number" || typeof key === "symbol")) {
18132
- throw new ZodCompileUnsupportedError(`record key value ${String(key)}`);
18130
+ for (const key2 of keyValues) {
18131
+ if (!(typeof key2 === "string" || typeof key2 === "number" || typeof key2 === "symbol")) {
18132
+ throw new ZodCompileUnsupportedError(`record key value ${String(key2)}`);
18133
18133
  }
18134
- const inputKey = typeof key === "number" ? key.toString() : key;
18134
+ const inputKey = typeof key2 === "number" ? key2.toString() : key2;
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, key);
18139
+ const keyConst = addConstant(ctx, key2);
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, key) {
18218
- if (typeof key === "string")
18219
- return esc(key);
18220
- return addConstant(ctx, key);
18217
+ function literalPropertyKey(ctx, key2) {
18218
+ if (typeof key2 === "string")
18219
+ return esc(key2);
18220
+ return addConstant(ctx, key2);
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 key of Reflect.ownKeys(source)) {
19450
- if (Object.prototype.propertyIsEnumerable.call(source, key)) {
19451
- assignProp(target, key, source[key]);
19449
+ for (const key2 of Reflect.ownKeys(source)) {
19450
+ if (Object.prototype.propertyIsEnumerable.call(source, key2)) {
19451
+ assignProp(target, key2, source[key2]);
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 key in schema2) {
19598
- delete schema2[key];
19597
+ for (const key2 in schema2) {
19598
+ delete schema2[key2];
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 key in member) {
19680
- if (!FOLDABLE_KEYS.has(key))
19679
+ for (const key2 in member) {
19680
+ if (!FOLDABLE_KEYS.has(key2))
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 key in object2.properties) {
19689
- if (Object.prototype.hasOwnProperty.call(properties, key))
19688
+ for (const key2 in object2.properties) {
19689
+ if (Object.prototype.hasOwnProperty.call(properties, key2))
19690
19690
  continue;
19691
19691
  const parts = [];
19692
19692
  for (const other of objects) {
19693
- const part = other.properties?.[key] ?? undeclaredConstraint(other);
19693
+ const part = other.properties?.[key2] ?? 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, key, merged);
19700
+ assignProp(properties, key2, merged);
19701
19701
  }
19702
- for (const key of object2.required ?? [])
19703
- required2.add(key);
19702
+ for (const key2 of object2.required ?? [])
19703
+ required2.add(key2);
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 key of FOLDABLE_KEYS)
19729
- if (key in json2)
19728
+ for (const key2 of FOLDABLE_KEYS)
19729
+ if (key2 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 key in schema2) {
19777
- if (key === "$ref" || key === "allOf")
19776
+ for (const key2 in schema2) {
19777
+ if (key2 === "$ref" || key2 === "allOf")
19778
19778
  continue;
19779
- if (!(key in _cached)) {
19780
- delete schema2[key];
19779
+ if (!(key2 in _cached)) {
19780
+ delete schema2[key2];
19781
19781
  }
19782
19782
  }
19783
19783
  }
19784
19784
  if (refSchema.$ref && refSeen.def) {
19785
- for (const key in schema2) {
19786
- if (key === "$ref" || key === "allOf")
19785
+ for (const key2 in schema2) {
19786
+ if (key2 === "$ref" || key2 === "allOf")
19787
19787
  continue;
19788
- if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
19789
- delete schema2[key];
19788
+ if (key2 in refSeen.def && JSON.stringify(schema2[key2]) === JSON.stringify(refSeen.def[key2])) {
19789
+ delete schema2[key2];
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 key in schema2) {
19802
- if (key === "$ref" || key === "allOf")
19801
+ for (const key2 in schema2) {
19802
+ if (key2 === "$ref" || key2 === "allOf")
19803
19803
  continue;
19804
- if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
19805
- delete schema2[key];
19804
+ if (key2 in parentSeen.def && JSON.stringify(schema2[key2]) === JSON.stringify(parentSeen.def[key2])) {
19805
+ delete schema2[key2];
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 key in def.shape) {
19939
- if (isTransforming(def.shape[key], ctx))
19938
+ for (const key2 in def.shape) {
19939
+ if (isTransforming(def.shape[key2], 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, key, value) => {
19978
- if (agg[key] === void 0 || value > agg[key])
19979
- agg[key] = value;
19977
+ var narrowMin = (agg, key2, value) => {
19978
+ if (agg[key2] === void 0 || value > agg[key2])
19979
+ agg[key2] = value;
19980
19980
  };
19981
- var narrowMax = (agg, key, value) => {
19982
- if (agg[key] === void 0 || value < agg[key])
19983
- agg[key] = value;
19981
+ var narrowMax = (agg, key2, value) => {
19982
+ if (agg[key2] === void 0 || value < agg[key2])
19983
+ agg[key2] = 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 key in shape) {
20322
- assignProp(json2.properties, key, processSchema(shape[key], ctx, {
20321
+ for (const key2 in shape) {
20322
+ assignProp(json2.properties, key2, processSchema(shape[key2], ctx, {
20323
20323
  ...params,
20324
- path: [...params.path, "properties", key]
20324
+ path: [...params.path, "properties", key2]
20325
20325
  }));
20326
20326
  }
20327
20327
  const requiredKeys = [];
20328
- for (const key of Object.keys(shape)) {
20329
- const field = def.shape[key];
20328
+ for (const key2 of Object.keys(shape)) {
20329
+ const field = def.shape[key2];
20330
20330
  if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
20331
- requiredKeys.push(key);
20331
+ requiredKeys.push(key2);
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 [key, schema] = entry;
20706
+ const [key2, schema] = entry;
20707
20707
  extractDefs(ctx2, schema);
20708
- assignProp(schemas, key, finalize(ctx2, schema));
20708
+ assignProp(schemas, key2, 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, key, make) {
21024
- Object.defineProperty(proto, key, {
21023
+ function _lazyMethod(proto, key2, make) {
21024
+ Object.defineProperty(proto, key2, {
21025
21025
  configurable: true,
21026
21026
  enumerable: false,
21027
21027
  get() {
21028
21028
  const value = make(this);
21029
- Object.defineProperty(this, key, { value, configurable: true, writable: true });
21029
+ Object.defineProperty(this, key2, { value, configurable: true, writable: true });
21030
21030
  return value;
21031
21031
  },
21032
21032
  set(value) {
21033
- Object.defineProperty(this, key, { value, configurable: true, writable: true });
21033
+ Object.defineProperty(this, key2, { 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 key = path[1] === void 0 ? void 0 : decodeJSONPointerSegment(path[1]);
22704
- if (!key || !ctx.defs[key]) {
22703
+ const key2 = path[1] === void 0 ? void 0 : decodeJSONPointerSegment(path[1]);
22704
+ if (!key2 || !ctx.defs[key2]) {
22705
22705
  throw new Error(`Reference not found: ${ref}`);
22706
22706
  }
22707
- return ctx.defs[key];
22707
+ return ctx.defs[key2];
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 key of keys) {
22743
- const result = guards.keySchema.safeParse(key);
22742
+ for (const key2 of keys) {
22743
+ const result = guards.keySchema.safeParse(key2);
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: key,
22751
- path: [key],
22750
+ input: key2,
22751
+ path: [key2],
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 key = canonicalKey(item, seen);
22777
- if (key === null)
22776
+ const key2 = canonicalKey(item, seen);
22777
+ if (key2 === null)
22778
22778
  return null;
22779
- parts2.push(key);
22779
+ parts2.push(key2);
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 key = canonicalKey(value[k], seen);
22787
- if (key === null)
22786
+ const key2 = canonicalKey(value[k], seen);
22787
+ if (key2 === null)
22788
22788
  return null;
22789
- parts.push(`${k.length}:${k}=${key}`);
22789
+ parts.push(`${k.length}:${k}=${key2}`);
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(([key, sub]) => {
22830
- if (SCHEMA_KEYWORDS.has(key))
22829
+ return Object.entries(value).some(([key2, sub]) => {
22830
+ if (SCHEMA_KEYWORDS.has(key2))
22831
22831
  return containsRef(sub);
22832
- if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
22832
+ if (!SCHEMA_MAP_KEYWORDS.has(key2) || 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 key = canonicalKey(items[i], /* @__PURE__ */ new Set());
22849
- if (key === null)
22848
+ const key2 = canonicalKey(items[i], /* @__PURE__ */ new Set());
22849
+ if (key2 === null)
22850
22850
  continue;
22851
- const first = firstSeen.get(key);
22851
+ const first = firstSeen.get(key2);
22852
22852
  if (first === void 0) {
22853
- firstSeen.set(key, i);
22853
+ firstSeen.set(key2, 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 [key, propSchema] of Object.entries(properties)) {
23092
+ for (const [key2, propSchema] of Object.entries(properties)) {
23093
23093
  const propZodSchema = convertSchema(propSchema, ctx);
23094
- assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
23094
+ assignProp(shape, key2, requiredSet.has(key2) ? 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 key of Object.keys(payload.value)) {
23130
- if (propertyKeys.includes(key))
23129
+ for (const key2 of Object.keys(payload.value)) {
23130
+ if (propertyKeys.includes(key2))
23131
23131
  continue;
23132
- if (patterns.some((regex) => regex.test(key)))
23132
+ if (patterns.some((regex) => regex.test(key2)))
23133
23133
  continue;
23134
- unrecognized.push(key);
23134
+ unrecognized.push(key2);
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 key of coreMetadataKeys) {
23266
- if (key in schema) {
23267
- extraMeta[key] = schema[key];
23265
+ for (const key2 of coreMetadataKeys) {
23266
+ if (key2 in schema) {
23267
+ extraMeta[key2] = schema[key2];
23268
23268
  }
23269
23269
  }
23270
23270
  const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
23271
- for (const key of contentMetadataKeys) {
23272
- if (key in schema) {
23273
- extraMeta[key] = schema[key];
23271
+ for (const key2 of contentMetadataKeys) {
23272
+ if (key2 in schema) {
23273
+ extraMeta[key2] = schema[key2];
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 key of ["minProperties", "maxProperties"]) {
23281
- if (schema[key] !== void 0)
23282
- extraMeta[key] = schema[key];
23280
+ for (const key2 of ["minProperties", "maxProperties"]) {
23281
+ if (schema[key2] !== void 0)
23282
+ extraMeta[key2] = schema[key2];
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 key of ["uniqueItems", "minContains", "maxContains"]) {
23290
- if (schema[key] !== void 0)
23291
- extraMeta[key] = schema[key];
23289
+ for (const key2 of ["uniqueItems", "minContains", "maxContains"]) {
23290
+ if (schema[key2] !== void 0)
23291
+ extraMeta[key2] = schema[key2];
23292
23292
  }
23293
23293
  }
23294
- for (const key of Object.keys(schema)) {
23295
- if (!RECOGNIZED_KEYS.has(key)) {
23296
- assignProp(extraMeta, key, schema[key]);
23294
+ for (const key2 of Object.keys(schema)) {
23295
+ if (!RECOGNIZED_KEYS.has(key2)) {
23296
+ assignProp(extraMeta, key2, schema[key2]);
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((key) => key in value)) return value;
24714
+ if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== void 0 || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((key2) => key2 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 key of TOOL_RESULT_FOREIGN_FAMILY_KEYS) if (key in value) {
25584
+ for (const key2 of TOOL_RESULT_FOREIGN_FAMILY_KEYS) if (key2 in value) {
25585
25585
  ctx.addIssue({
25586
25586
  code: "custom",
25587
- message: `content is required when the body carries '${key}' \u2014 another result family cannot default into an empty tools/call success`
25587
+ message: `content is required when the body carries '${key2}' \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 key of REQUIRED_ENVELOPE_KEYS) if (!(key in meta3)) issues.push({
27126
- key,
27125
+ for (const key2 of REQUIRED_ENVELOPE_KEYS) if (!(key2 in meta3)) issues.push({
27126
+ key: key2,
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 key = path.length > 0 ? path.join(".") : "_meta";
27133
- if (path.length === 1 && issues.some((existing) => existing.key === key && existing.problem === "missing")) continue;
27132
+ const key2 = path.length > 0 ? path.join(".") : "_meta";
27133
+ if (path.length === 1 && issues.some((existing) => existing.key === key2 && existing.problem === "missing")) continue;
27134
27134
  issues.push({
27135
- key,
27135
+ key: key2,
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 [key, child] of Object.entries(properties)) {
27486
- const fault$1 = visit2(child, [...path, key], reachable);
27485
+ if (properties !== null && typeof properties === "object") for (const [key2, child] of Object.entries(properties)) {
27486
+ const fault$1 = visit2(child, [...path, key2], 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 key of [
27716
+ for (const key2 of [
27717
27717
  "oneOf",
27718
27718
  "anyOf",
27719
27719
  "allOf"
27720
27720
  ]) {
27721
- const members2 = schema[key];
27721
+ const members2 = schema[key2];
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(key) {
27816
- return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(key) || key.startsWith("x-");
27815
+ function isAnnotationOnlyJsonSchemaKeyword(key2) {
27816
+ return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(key2) || key2.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 [key, value] of Object.entries(node2)) if (allowedKeys.has(key) || isAnnotationOnlyJsonSchemaKeyword(key)) pruned[key] = value;
27838
- else if (key === "pattern" && node2.type === "string" && typeof node2.format === "string") {
27839
- if (!SUPPORTED_STRING_FORMATS.has(node2.format)) pruned[key] = value;
27840
- else if (typeof value !== "string" || !isLibraryFormatPattern(node2.format, value, vendor)) unsupported.push(`${path}.${key}`);
27841
- } else unsupported.push(`${path}.${key}`);
27837
+ for (const [key2, value] of Object.entries(node2)) if (allowedKeys.has(key2) || isAnnotationOnlyJsonSchemaKeyword(key2)) pruned[key2] = value;
27838
+ else if (key2 === "pattern" && node2.type === "string" && typeof node2.format === "string") {
27839
+ if (!SUPPORTED_STRING_FORMATS.has(node2.format)) pruned[key2] = value;
27840
+ else if (typeof value !== "string" || !isLibraryFormatPattern(node2.format, value, vendor)) unsupported.push(`${path}.${key2}`);
27841
+ } else unsupported.push(`${path}.${key2}`);
27842
27842
  return pruned;
27843
27843
  }
27844
27844
  function walkRequestedSchema(converted, vendor) {
27845
27845
  const pruned = {};
27846
27846
  const unsupported = [];
27847
- for (const [key, value] of Object.entries(converted)) if (key === "properties" && isJsonObject(value)) pruned[key] = Object.fromEntries(Object.entries(value).map(([name, node2]) => [name, walkProperty(node2, `properties.${name}`, vendor, unsupported)]));
27848
- else if (ROOT_KEYS.has(key)) pruned[key] = value;
27849
- else if (!isAnnotationOnlyJsonSchemaKeyword(key)) unsupported.push(key);
27847
+ for (const [key2, value] of Object.entries(converted)) if (key2 === "properties" && isJsonObject(value)) pruned[key2] = Object.fromEntries(Object.entries(value).map(([name, node2]) => [name, walkProperty(node2, `properties.${name}`, vendor, unsupported)]));
27848
+ else if (ROOT_KEYS.has(key2)) pruned[key2] = value;
27849
+ else if (!isAnnotationOnlyJsonSchemaKeyword(key2)) unsupported.push(key2);
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(([key, value]) => {
27862
- const childPath = path ? `${path}.${key}` : key;
27863
- if (!Object.prototype.hasOwnProperty.call(parsed, key)) return isAnnotationOnlyJsonSchemaKeyword(key) ? [] : [childPath];
27864
- return findDroppedConstraintPaths(value, parsed[key], childPath);
27861
+ return Object.entries(original).flatMap(([key2, value]) => {
27862
+ const childPath = path ? `${path}.${key2}` : key2;
27863
+ if (!Object.prototype.hasOwnProperty.call(parsed, key2)) return isAnnotationOnlyJsonSchemaKeyword(key2) ? [] : [childPath];
27864
+ return findDroppedConstraintPaths(value, parsed[key2], 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((key) => !Object.prototype.hasOwnProperty.call(parsed.data.properties, key));
27879
+ const danglingRequired = (parsed.data.required ?? []).filter((key2) => !Object.prototype.hasOwnProperty.call(parsed.data.properties, key2));
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, key, schema) {
27928
- const view = inputResponse(responses, key);
27927
+ function acceptedContent(responses, key2, schema) {
27928
+ const view = inputResponse(responses, key2);
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, key) {
27935
+ function inputResponse(responses, key2) {
27936
27936
  if (responses === void 0 || typeof responses !== "object" || responses === null) return { kind: "missing" };
27937
- const entry = responses[key];
27937
+ const entry = responses[key2];
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(key, schema) {
28170
- const name = key.slice(0, -6);
28169
+ function register(key2, schema) {
28170
+ const name = key2.slice(0, -6);
28171
28171
  _specTypeSchemas[name] = schema;
28172
28172
  _isSpecType[name] = (v) => schema.safeParse(v).success;
28173
28173
  }
28174
- for (const key of SPEC_SCHEMA_KEYS) register(key, schemas_exports3[key]);
28175
- for (const [key, schema] of Object.entries(authSchemas)) register(key, schema);
28174
+ for (const key2 of SPEC_SCHEMA_KEYS) register(key2, schemas_exports3[key2]);
28175
+ for (const [key2, schema] of Object.entries(authSchemas)) register(key2, 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((key) => key in meta3) : [];
28205
- const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((key) => key in params) : [];
28204
+ const envelopeKeys = isPlainObject$1(meta3) ? RESERVED_ENVELOPE_META_KEYS.filter((key2) => key2 in meta3) : [];
28205
+ const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((key2) => key2 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 key of envelopeKeys) {
28216
- envelope[key] = meta3[key];
28217
- delete nextMeta[key];
28215
+ for (const key2 of envelopeKeys) {
28216
+ envelope[key2] = meta3[key2];
28217
+ delete nextMeta[key2];
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 key of retryKeys) {
28224
- if (key === "inputResponses") lifted.inputResponses = nextParams[key];
28225
- if (key === "requestState") lifted.requestState = nextParams[key];
28226
- delete nextParams[key];
28223
+ for (const key2 of retryKeys) {
28224
+ if (key2 === "inputResponses") lifted.inputResponses = nextParams[key2];
28225
+ if (key2 === "requestState") lifted.requestState = nextParams[key2];
28226
+ delete nextParams[key2];
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 key in additional) {
29008
- const k = key;
29007
+ for (const key2 in additional) {
29008
+ const k = key2;
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 [key, entry] of Object.entries(inputResponses)) {
29029
+ for (const [key2, entry] of Object.entries(inputResponses)) {
29030
29030
  if (!isPlainObject2(entry) || "method" in entry || "result" in entry) {
29031
- droppedKeys.push(key);
29031
+ droppedKeys.push(key2);
29032
29032
  continue;
29033
29033
  }
29034
- accepted[key] = entry;
29034
+ accepted[key2] = 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 key;
29063
+ var key2;
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
- key = match[1].toLowerCase();
29070
+ key2 = 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[key] = value;
29076
+ obj.parameters[key2] = 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(key) {
29319
- return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`;
29318
+ function getProperty(key2) {
29319
+ return typeof key2 == "string" && exports.IDENTIFIER.test(key2) ? new _Code(`.${key2}`) : _`[${key2}]`;
29320
29320
  }
29321
29321
  exports.getProperty = getProperty;
29322
- function getEsmExportName(key) {
29323
- if (typeof key == "string" && exports.IDENTIFIER.test(key)) return new _Code(`${key}`);
29324
- throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
29322
+ function getEsmExportName(key2) {
29323
+ if (typeof key2 == "string" && exports.IDENTIFIER.test(key2)) return new _Code(`${key2}`);
29324
+ throw new Error(`CodeGen: invalid export name: ${key2}, 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 [key, value] of keyValues) {
29935
+ for (const [key2, value] of keyValues) {
29936
29936
  if (code2.length > 1) code2.push(",");
29937
- code2.push(key);
29938
- if (key !== value || this.opts.es5) {
29937
+ code2.push(key2);
29938
+ if (key2 !== 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 key in schema) if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`);
30160
+ for (const key2 in schema) if (!rules[key2]) checkStrictMode(it, `unknown keyword: "${key2}"`);
30161
30161
  }
30162
30162
  exports.checkUnknownRules = checkUnknownRules;
30163
30163
  function schemaHasRules(schema, rules) {
30164
30164
  if (typeof schema == "boolean") return !schema;
30165
- for (const key in schema) if (rules[key]) return true;
30165
+ for (const key2 in schema) if (rules[key2]) 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 key in schema) if (key !== "$ref" && RULES.all[key]) return true;
30171
+ for (const key2 in schema) if (key2 !== "$ref" && RULES.all[key2]) 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 key in properties) assignDefault(it, key, properties[key].default);
30678
+ if (ty === "object" && properties) for (const key2 in properties) assignDefault(it, key2, properties[key2].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 key = keys[i];
31005
- if (!equal(a[key], b[key])) return false;
31004
+ var key2 = keys[i];
31005
+ if (!equal(a[key2], b[key2])) 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 key in schema) {
31073
- var sch = schema[key];
31072
+ for (var key2 in schema) {
31073
+ var sch = schema[key2];
31074
31074
  if (Array.isArray(sch)) {
31075
- if (key in traverse.arrayKeywords) for (var i = 0; i < sch.length; i++) _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i);
31076
- } else if (key in traverse.propsKeywords) {
31077
- if (sch && typeof sch == "object") for (var prop in sch) _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
31078
- } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema);
31075
+ if (key2 in traverse.arrayKeywords) for (var i = 0; i < sch.length; i++) _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key2 + "/" + i, rootSchema, jsonPtr, key2, schema, i);
31076
+ } else if (key2 in traverse.propsKeywords) {
31077
+ if (sch && typeof sch == "object") for (var prop in sch) _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key2 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key2, schema, prop);
31078
+ } else if (key2 in traverse.keywords || opts.allKeys && !(key2 in traverse.skipKeywords)) _traverse(opts, pre, post, sch, jsonPtr + "/" + key2, rootSchema, jsonPtr, key2, 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 key in schema) {
31127
- if (REF_KEYWORDS.has(key)) return true;
31128
- const sch = schema[key];
31126
+ for (const key2 in schema) {
31127
+ if (REF_KEYWORDS.has(key2)) return true;
31128
+ const sch = schema[key2];
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 key in schema) {
31137
- if (key === "$ref") return Infinity;
31136
+ for (const key2 in schema) {
31137
+ if (key2 === "$ref") return Infinity;
31138
31138
  count++;
31139
- if (SIMPLE_INLINED.has(key)) continue;
31140
- if (typeof schema[key] == "object") (0, util_1.eachItem)(schema[key], (sch) => count += countKeys(sch));
31139
+ if (SIMPLE_INLINED.has(key2)) continue;
31140
+ if (typeof schema[key2] == "object") (0, util_1.eachItem)(schema[key2], (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 key in schema) if (self.RULES.all[key]) return true;
31298
+ for (const key2 in schema) if (self.RULES.all[key2]) 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, key, _meta, _validateSchema = this.opts.validateSchema) {
33031
+ addSchema(schema, key2, _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
- key = (0, resolve_1.normalizeId)(key || id2);
33043
- this._checkUnique(key);
33044
- this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
33042
+ key2 = (0, resolve_1.normalizeId)(key2 || id2);
33043
+ this._checkUnique(key2);
33044
+ this.schemas[key2] = this._addSchema(schema, _meta, key2, _validateSchema, true);
33045
33045
  return this;
33046
33046
  }
33047
- addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
33048
- this.addSchema(schema, key, true, _validateSchema);
33047
+ addMetaSchema(schema, key2, _validateSchema = this.opts.validateSchema) {
33048
+ this.addSchema(schema, key2, 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 key in rules) {
33181
- const rule = rules[key];
33180
+ for (const key2 in rules) {
33181
+ const rule = rules[key2];
33182
33182
  if (typeof rule != "object") continue;
33183
33183
  const { $data } = rule.definition;
33184
- const schema = keywords[key];
33185
- if ($data && schema) keywords[key] = schemaOrData(schema);
33184
+ const schema = keywords[key2];
33185
+ if ($data && schema) keywords[key2] = 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 key in checkOpts) {
33251
- const opt = key;
33252
- if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
33250
+ for (const key2 in checkOpts) {
33251
+ const opt = key2;
33252
+ if (opt in options) this.logger[log](`${msg}: option ${key2}. ${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 key in optsSchemas) this.addSchema(optsSchemas[key], key);
33263
+ else for (const key2 in optsSchemas) this.addSchema(optsSchemas[key2], key2);
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 key in schema) {
34154
- if (key === "__proto__") continue;
34155
- const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps;
34156
- deps[key] = schema[key];
34153
+ for (const key2 in schema) {
34154
+ if (key2 === "__proto__") continue;
34155
+ const deps = Array.isArray(schema[key2]) ? propertyDeps : schemaDeps;
34156
+ deps[key2] = schema[key2];
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, (key) => {
34219
- cxt.setParams({ propertyName: key });
34218
+ gen.forIn("key", data, (key2) => {
34219
+ cxt.setParams({ propertyName: key2 });
34220
34220
  cxt.subschema({
34221
34221
  keyword: "propertyNames",
34222
- data: key,
34222
+ data: key2,
34223
34223
  dataTypes: ["string"],
34224
- propertyName: key,
34224
+ propertyName: key2,
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, (key) => {
34265
- if (!props.length && !patProps.length) additionalPropertyCode(key);
34266
- else gen.if(isAdditional(key), () => additionalPropertyCode(key));
34264
+ gen.forIn("key", data, (key2) => {
34265
+ if (!props.length && !patProps.length) additionalPropertyCode(key2);
34266
+ else gen.if(isAdditional(key2), () => additionalPropertyCode(key2));
34267
34267
  });
34268
34268
  }
34269
- function isAdditional(key) {
34269
+ function isAdditional(key2) {
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, key);
34274
- } else if (props.length) definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key} === ${p}`));
34273
+ definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key2);
34274
+ } else if (props.length) definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key2} === ${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(${key})`));
34276
+ if (patProps.length) definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key2})`));
34277
34277
  return (0, codegen_1.not)(definedProp);
34278
34278
  }
34279
- function deleteAdditional(key) {
34280
- gen.code((0, codegen_1._)`delete ${data}[${key}]`);
34279
+ function deleteAdditional(key2) {
34280
+ gen.code((0, codegen_1._)`delete ${data}[${key2}]`);
34281
34281
  }
34282
- function additionalPropertyCode(key) {
34282
+ function additionalPropertyCode(key2) {
34283
34283
  if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
34284
- deleteAdditional(key);
34284
+ deleteAdditional(key2);
34285
34285
  return;
34286
34286
  }
34287
34287
  if (schema === false) {
34288
- cxt.setParams({ additionalProperty: key });
34288
+ cxt.setParams({ additionalProperty: key2 });
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(key, valid, false);
34296
+ applyAdditionalSchema(key2, valid, false);
34297
34297
  gen.if((0, codegen_1.not)(valid), () => {
34298
34298
  cxt.reset();
34299
- deleteAdditional(key);
34299
+ deleteAdditional(key2);
34300
34300
  });
34301
34301
  } else {
34302
- applyAdditionalSchema(key, valid);
34302
+ applyAdditionalSchema(key2, valid);
34303
34303
  if (!allErrors) gen.if((0, codegen_1.not)(valid), () => gen.break());
34304
34304
  }
34305
34305
  }
34306
34306
  }
34307
- function applyAdditionalSchema(key, valid, errors) {
34307
+ function applyAdditionalSchema(key2, valid, errors) {
34308
34308
  const subschema = {
34309
34309
  keyword: "additionalProperties",
34310
- dataProp: key,
34310
+ dataProp: key2,
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, (key) => {
34405
- gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
34404
+ gen.forIn("key", data, (key2) => {
34405
+ gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key2})`, () => {
34406
34406
  const alwaysValid = alwaysValidPatterns.includes(pat);
34407
34407
  if (!alwaysValid) cxt.subschema({
34408
34408
  keyword: "patternProperties",
34409
34409
  schemaProp: pat,
34410
- dataProp: key,
34410
+ dataProp: key2,
34411
34411
  dataPropType: util_2.Type.Str
34412
34412
  }, valid);
34413
- if (it.opts.unevaluated && props !== true) gen.assign((0, codegen_1._)`${props}[${key}]`, true);
34413
+ if (it.opts.unevaluated && props !== true) gen.assign((0, codegen_1._)`${props}[${key2}]`, 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, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
35265
- else if (props !== true) gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
35264
+ if (props instanceof codegen_1.Name) gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key2) => gen.if(unevaluatedDynamic(props, key2), () => unevaluatedPropCode(key2))));
35265
+ else if (props !== true) gen.forIn("key", data, (key2) => props === void 0 ? unevaluatedPropCode(key2) : gen.if(unevaluatedStatic(props, key2), () => unevaluatedPropCode(key2)));
35266
35266
  it.props = true;
35267
35267
  cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
35268
- function unevaluatedPropCode(key) {
35268
+ function unevaluatedPropCode(key2) {
35269
35269
  if (schema === false) {
35270
- cxt.setParams({ unevaluatedProperty: key });
35270
+ cxt.setParams({ unevaluatedProperty: key2 });
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: key,
35279
+ dataProp: key2,
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, key) {
35286
- return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
35285
+ function unevaluatedDynamic(evaluatedProps, key2) {
35286
+ return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key2}]`;
35287
35287
  }
35288
- function unevaluatedStatic(evaluatedProps, key) {
35288
+ function unevaluatedStatic(evaluatedProps, key2) {
35289
35289
  const ps = [];
35290
- for (const p in evaluatedProps) if (evaluatedProps[p] === true) ps.push((0, codegen_1._)`${key} !== ${p}`);
35290
+ for (const p in evaluatedProps) if (evaluatedProps[p] === true) ps.push((0, codegen_1._)`${key2} !== ${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, key, 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 '${key}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);
36815
+ function coerceEmbeddedInputRequest(method, key2, 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 '${key2}': 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 '${key}' of kind '${embedded.method}', which is not an embedded request the 2026-07-28 revision defines`);
36819
+ if (required2 === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key2}' 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 [key, entry] of Object.entries(inputRequests)) {
36866
- const { embedded, required: required2 } = coerceEmbeddedInputRequest(method, key, entry);
36867
- if (embedded.method !== "roots/list" && embedded.params === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key}' of kind '${embedded.method}' without params`);
36868
- if (missingClientCapabilities(required2, declared) !== void 0) return legacyShimFailure(method, `Cannot request input '${key}' (${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([key, embedded]);
36865
+ for (const [key2, entry] of Object.entries(inputRequests)) {
36866
+ const { embedded, required: required2 } = coerceEmbeddedInputRequest(method, key2, entry);
36867
+ if (embedded.method !== "roots/list" && embedded.params === void 0) throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key2}' of kind '${embedded.method}' without params`);
36868
+ if (missingClientCapabilities(required2, declared) !== void 0) return legacyShimFailure(method, `Cannot request input '${key2}' (${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([key2, 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 ([key, embedded]) => {
36881
+ const fulfilled = await Promise.all(coerced.map(async ([key2, embedded]) => {
36882
36882
  try {
36883
- return [key, await this._dispatchLeg(embedded, legOptions)];
36883
+ return [key2, 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 [key, entry] of Object.entries(inputRequests)) {
37191
- const { embedded, required: required2 } = coerceEmbeddedInputRequest(method, key, entry);
37190
+ for (const [key2, entry] of Object.entries(inputRequests)) {
37191
+ const { embedded, required: required2 } = coerceEmbeddedInputRequest(method, key2, entry);
37192
37192
  const missing = missingClientCapabilities(required2, declared);
37193
- if (missing !== void 0) throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${key}' (${embedded.method}): the request's client capabilities do not declare the required capability`);
37193
+ if (missing !== void 0) throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${key2}' (${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 key in node2) {
37584
- if (!Object.prototype.hasOwnProperty.call(node2, key)) continue;
37583
+ else for (const key2 in node2) {
37584
+ if (!Object.prototype.hasOwnProperty.call(node2, key2)) continue;
37585
37585
  if (++count > max) return count;
37586
- const child = node2[key];
37586
+ const child = node2[key2];
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, key, value) => {
39031
- const setCookie = key.toLowerCase() === "set-cookie";
39030
+ return (_m, prefix, key2, value) => {
39031
+ const setCookie = key2.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 key of Object.keys(obj)) {
39168
- if (obj[key] !== void 0)
39169
- out[key] = obj[key];
39167
+ for (const key2 of Object.keys(obj)) {
39168
+ if (obj[key2] !== void 0)
39169
+ out[key2] = obj[key2];
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(key) {
39216
- return key.startsWith("$") ? `$${key}` : key;
39215
+ function escapeKey(key2) {
39216
+ return key2.startsWith("$") ? `$${key2}` : key2;
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 key = typeof binding.key === "string" ? Buffer.from(binding.key, "utf8") : Buffer.from(binding.key);
39230
- if (key.length < 32) {
39229
+ const key2 = typeof binding.key === "string" ? Buffer.from(binding.key, "utf8") : Buffer.from(binding.key);
39230
+ if (key2.length < 32) {
39231
39231
  throw new RangeError("requireConfirmation: binding.key must be at least 32 bytes.");
39232
39232
  }
39233
- return key;
39233
+ return key2;
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(key, action, binding) {
39238
+ function mintState(key2, 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", key).update(`${STATE_PREFIX}${body}`).digest("base64url");
39241
+ const mac3 = createHmac("sha256", key2).update(`${STATE_PREFIX}${body}`).digest("base64url");
39242
39242
  return `${STATE_PREFIX}${body}.${mac3}`;
39243
39243
  }
39244
- function verifyState(key, action, binding, state) {
39244
+ function verifyState(key2, 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(key, 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", key).update(`${STATE_PREFIX}${body}`).digest();
39253
+ const expected = createHmac("sha256", key2).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 key = options.binding ? bindingKey(options.binding) : void 0;
39274
+ const key2 = 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
- ...key && options.binding ? { requestState: mintState(key, options.action, options.binding) } : {}
39291
+ ...key2 && options.binding ? { requestState: mintState(key2, 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 (key && options.binding) {
39318
+ if (key2 && 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(key, options.action, options.binding, state))
39323
+ if (!verifyState(key2, 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(key) {
39459
- const bytes = typeof key === "string" ? Buffer.from(key, "utf8") : Buffer.from(key);
39458
+ function tokenKey(key2) {
39459
+ const bytes = typeof key2 === "string" ? Buffer.from(key2, "utf8") : Buffer.from(key2);
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(key, body) {
39473
- return createHmac2("sha256", key).update(`${PREFIX}${body}`).digest();
39472
+ function sign(key2, body) {
39473
+ return createHmac2("sha256", key2).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(key, binding, options = {}) {
39479
- const k = tokenKey(key);
39478
+ function issueConfirmToken(key2, binding, options = {}) {
39479
+ const k = tokenKey(key2);
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(key, token, binding, options = {}) {
39503
- const k = tokenKey(key);
39502
+ function verifyConfirmToken(key2, token, binding, options = {}) {
39503
+ const k = tokenKey(key2);
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(key, opts = {}) {
39617
+ function readEnvVar(key2, opts = {}) {
39618
39618
  const env = opts.env ?? process.env;
39619
- const raw = env[key];
39619
+ const raw = env[key2];
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(key, 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(key, opts = {}) {
39630
+ function parseBoolEnv(key2, opts = {}) {
39631
39631
  const fallback = opts.default ?? false;
39632
- const raw = readEnvVar(key, { env: opts.env });
39632
+ const raw = readEnvVar(key2, { 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 key = `elicitation:${raw}`;
39772
- if (!warned.has(key)) {
39773
- warned.add(key);
39771
+ const key2 = `elicitation:${raw}`;
39772
+ if (!warned.has(key2)) {
39773
+ warned.add(key2);
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 key = `ttl:${raw}`;
39786
- if (!warned.has(key)) {
39787
- warned.add(key);
39785
+ const key2 = `ttl:${raw}`;
39786
+ if (!warned.has(key2)) {
39787
+ warned.add(key2);
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 [key, value] of Object.entries(headers)) {
40658
- if (key.toLowerCase() === wanted)
40657
+ for (const [key2, value] of Object.entries(headers)) {
40658
+ if (key2.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(key, format) {
41375
- const buf = await subtle.exportKey(format, key);
41374
+ async function exportRaw(key2, format) {
41375
+ const buf = await subtle.exportKey(format, key2);
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(key, iv, plaintext, aad) {
41479
- const k = await subtle.importKey("raw", key, { name: "AES-GCM" }, false, [
41478
+ async function aesGcmSeal(key2, iv, plaintext, aad) {
41479
+ const k = await subtle.importKey("raw", key2, { 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(key, iv, ciphertext, aad) {
41486
- const k = await subtle.importKey("raw", key, { name: "AES-GCM" }, false, [
41485
+ async function aesGcmOpen(key2, iv, ciphertext, aad) {
41486
+ const k = await subtle.importKey("raw", key2, { 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 key = `${entry.host}\0${normalizedPath}\0${entry.headerName}`;
41991
- if (seen.has(key)) {
41990
+ const key2 = `${entry.host}\0${normalizedPath}\0${entry.headerName}`;
41991
+ if (seen.has(key2)) {
41992
41992
  throw new ProtocolError3(`${label}: duplicate ${JSON.stringify({ host: entry.host, path: normalizedPath, headerName: entry.headerName })}`);
41993
41993
  }
41994
- seen.add(key);
41994
+ seen.add(key2);
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 key = await hkdfSha256(shared, salt, enc5.encode(HKDF_SESSION_INFO), 32);
44413
+ const key2 = await hkdfSha256(shared, salt, enc5.encode(HKDF_SESSION_INFO), 32);
44414
44414
  if (extensionWs !== ws)
44415
44415
  return;
44416
- ownSession = new SessionState(key);
44416
+ ownSession = new SessionState(key2);
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 key of Object.keys(headers)) {
46982
- if (key.toLowerCase() === "content-type")
46981
+ for (const key2 of Object.keys(headers)) {
46982
+ if (key2.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.0";
47855
+ var VERSION = "2.27.2";
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(key, value, assumeNaiveIn) {
48359
+ function parseTimestampValue(key2, 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 key of Object.keys(obj)) {
48429
- const value = obj[key];
48428
+ for (const key2 of Object.keys(obj)) {
48429
+ const value = obj[key2];
48430
48430
  if (value !== null && typeof value === "object") {
48431
48431
  walk(value, tz);
48432
48432
  continue;
48433
48433
  }
48434
- if (ZONE_NAME_KEYS.has(key) || !TIMESTAMP_KEYS.has(key)) continue;
48435
- const instant = parseTimestampValue(key, value, tz);
48434
+ if (ZONE_NAME_KEYS.has(key2) || !TIMESTAMP_KEYS.has(key2)) continue;
48435
+ const instant = parseTimestampValue(key2, value, tz);
48436
48436
  if (!instant) continue;
48437
48437
  const { iso, display } = formatInstant(instant, tz);
48438
- obj[key] = iso;
48439
- obj[`${key}Display`] = display;
48438
+ obj[key2] = iso;
48439
+ obj[`${key2}Display`] = display;
48440
48440
  }
48441
48441
  return obj;
48442
48442
  }
@@ -48465,7 +48465,7 @@ function jsonErrorResponse(data) {
48465
48465
  }
48466
48466
  var ApiRecipientSchema = external_exports.looseObject({
48467
48467
  // Live OFW payloads key the recipient's id as `userId` (verified against a
48468
- // real /pub/v3/messages record: `recipients[].user.userId === 3039201`). An
48468
+ // real /pub/v3/messages record: `recipients[].user.userId === 2000001`). An
48469
48469
  // earlier guess read `id`, which is absent — so every normalized recipient
48470
48470
  // came out with `userId: 0`, breaking any "find my own recipient" match. Both
48471
48471
  // are accepted (userId first, id fallback) so a backend that ever returns `id`
@@ -48685,6 +48685,34 @@ function registerHealthcheckTools(server, client2) {
48685
48685
  });
48686
48686
  }
48687
48687
 
48688
+ // src/tools/held-attachments.ts
48689
+ var key = (draftId) => `draft_held_files:${draftId}`;
48690
+ function uniqueIds(ids) {
48691
+ return [...new Set(ids)];
48692
+ }
48693
+ async function getHeldFiles(cache, draftId) {
48694
+ const raw = await cache.getMeta(key(draftId));
48695
+ if (!raw) return [];
48696
+ try {
48697
+ const parsed = JSON.parse(raw);
48698
+ return Array.isArray(parsed) ? parsed.filter((v) => Number.isInteger(v)) : [];
48699
+ } catch {
48700
+ return [];
48701
+ }
48702
+ }
48703
+ async function setHeldFiles(cache, draftId, ids) {
48704
+ await cache.setMeta(key(draftId), JSON.stringify(uniqueIds(ids)));
48705
+ }
48706
+ async function clearHeldFiles(cache, draftId) {
48707
+ await cache.setMeta(key(draftId), "[]");
48708
+ }
48709
+ async function heldFilesFor(cache, draftIds) {
48710
+ const out = /* @__PURE__ */ new Map();
48711
+ for (const id2 of draftIds) out.set(id2, await getHeldFiles(cache, id2));
48712
+ return out;
48713
+ }
48714
+ 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.";
48715
+
48688
48716
  // src/read-days.ts
48689
48717
  var WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
48690
48718
  var WEEKDAY_LABELS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
@@ -49073,6 +49101,27 @@ async function getFolderVerifiedAt(store, folder) {
49073
49101
  async function markFolderVerified(store, folder, at = (/* @__PURE__ */ new Date()).toISOString()) {
49074
49102
  await store.setMeta(folderVerifiedAtKey(folder), at);
49075
49103
  }
49104
+ async function inferReplacedDraftLineage(store, vanishedIds, newRows) {
49105
+ if (vanishedIds.length === 0 || newRows.length === 0) return;
49106
+ for (const goneId of vanishedIds) {
49107
+ const gone = await store.getDraft(goneId);
49108
+ const key2 = (await store.getDraftLineageById(goneId))?.draftKey;
49109
+ const held = await getHeldFiles(store, goneId);
49110
+ if (!key2 && held.length === 0) continue;
49111
+ const matches = newRows.filter((r) => r.subject === gone.subject && r.body === gone.body && r.replyToId === gone.replyToId);
49112
+ if (matches.length !== 1) continue;
49113
+ const target = matches[0];
49114
+ if (await store.getDraftLineageById(target.id)) continue;
49115
+ if (key2) {
49116
+ await store.recordDraftLineage({ id: target.id, draftKey: key2, previousId: goneId, recordedAt: (/* @__PURE__ */ new Date()).toISOString() });
49117
+ await store.setMeta(`draft_key_inferred:${target.id}`, "1");
49118
+ }
49119
+ if (held.length > 0) {
49120
+ await setHeldFiles(store, target.id, [...held, ...await getHeldFiles(store, target.id)]);
49121
+ await clearHeldFiles(store, goneId);
49122
+ }
49123
+ }
49124
+ }
49076
49125
  async function syncDrafts(client2, draftsFolderId, store, budget) {
49077
49126
  const b = budget ?? makeBudget(Number.POSITIVE_INFINITY);
49078
49127
  const defer = async () => {
@@ -49131,9 +49180,9 @@ async function syncDrafts(client2, draftsFolderId, store, budget) {
49131
49180
  }
49132
49181
  }
49133
49182
  const seenIds = new Set(ids);
49134
- for (const id2 of await store.listDraftIds()) {
49135
- if (!seenIds.has(id2)) await store.deleteDraft(id2);
49136
- }
49183
+ const vanished = (await store.listDraftIds()).filter((id2) => !seenIds.has(id2));
49184
+ await inferReplacedDraftLineage(store, vanished, rows.filter((r) => !existingById.has(r.id)));
49185
+ for (const id2 of vanished) await store.deleteDraft(id2);
49137
49186
  const now = (/* @__PURE__ */ new Date()).toISOString();
49138
49187
  await setDraftsCacheStatus(store, "fresh");
49139
49188
  await store.setSyncState("drafts", { lastSyncAt: now, newestId: null, resumePage: null });
@@ -49455,9 +49504,11 @@ function fnv1a64(s) {
49455
49504
  }
49456
49505
  return h.toString(16).padStart(16, "0");
49457
49506
  }
49458
- function draftRevision(d) {
49507
+ function draftRevision(d, heldFiles = []) {
49459
49508
  const ids = [...new Set(d.recipients.map((r) => r.userId))].sort((a, b) => a - b);
49460
49509
  const parts = [d.subject, d.body, String(d.replyToId ?? ""), ids.join(",")];
49510
+ const held = [...new Set(heldFiles)].sort((a, b) => a - b);
49511
+ if (held.length > 0) parts.push(`files:${held.join(",")}`);
49461
49512
  return `r1:${fnv1a64(parts.map((p) => `${p.length}:${p}`).join("|"))}`;
49462
49513
  }
49463
49514
  var ServerDraftSchema = external_exports.looseObject({
@@ -49544,6 +49595,7 @@ function diffFields(a, b) {
49544
49595
  }
49545
49596
  function checkDraftFreshness(input2) {
49546
49597
  const { server, cached: cached2, expectedRevision } = input2;
49598
+ const held = input2.heldFiles ?? [];
49547
49599
  if (server === null) {
49548
49600
  return {
49549
49601
  verdict: "MISSING",
@@ -49552,11 +49604,11 @@ function checkDraftFreshness(input2) {
49552
49604
  };
49553
49605
  }
49554
49606
  if (expectedRevision !== void 0) {
49555
- const actual = draftRevision(server);
49556
- if (expectedRevision === actual) {
49607
+ const actual = draftRevision(server, held);
49608
+ if (expectedRevision === actual || expectedRevision === draftRevision(server)) {
49557
49609
  return { verdict: "FRESH", reason: "expectedRevision matches the live server draft.", changedFields: [] };
49558
49610
  }
49559
- if (cached2 !== null && draftRevision(cached2) === expectedRevision) {
49611
+ if (cached2 !== null && (draftRevision(cached2, held) === expectedRevision || draftRevision(cached2) === expectedRevision)) {
49560
49612
  const changedFields2 = diffFields(server, cached2);
49561
49613
  if (substantiveChanges(changedFields2).length === 0) {
49562
49614
  return {
@@ -49606,7 +49658,7 @@ function staleDraftPayload(input2) {
49606
49658
  verdict: verdict.verdict,
49607
49659
  reason: verdict.reason,
49608
49660
  ...verdict.changedFields.length > 0 ? { changedFields: verdict.changedFields } : {},
49609
- ...server !== null ? { serverBody: server.body, serverSubject: server.subject, serverRevision: draftRevision(server) } : {},
49661
+ ...server !== null ? { serverBody: server.body, serverSubject: server.subject, serverRevision: draftRevision(server, input2.heldFiles ?? []) } : {},
49610
49662
  ...cached2 !== null ? { cachedBody: cached2.body } : {},
49611
49663
  recovery: server === null ? "The draft is gone from OurFamilyWizard. Nothing was changed. If you still want this content saved, call ofw_save_draft WITHOUT messageId to create a new draft." : "Nothing was changed. Merge your edit into serverBody above, then retry with expectedRevision set to serverRevision. Pass force:true only if you intend to discard the server copy shown here."
49612
49664
  };
@@ -49720,13 +49772,13 @@ async function probeIds(client2, store, ids, opts) {
49720
49772
  items.push({ id: p.id, skipped: true, reason: "WOULD_MARK_READ", note: SKIP_NOTE });
49721
49773
  continue;
49722
49774
  }
49723
- const probe = await probeOne(client2, p, map2, keyById.get(p.id) ?? null);
49775
+ const probe = await probeOne(client2, p, map2, keyById.get(p.id) ?? null, await getHeldFiles(store, p.id));
49724
49776
  requests += probe.requests;
49725
49777
  items.push(probe.item);
49726
49778
  }
49727
49779
  return { items, requests };
49728
49780
  }
49729
- async function probeOne(client2, prepared, map2, draftKey) {
49781
+ async function probeOne(client2, prepared, map2, draftKey, heldFiles) {
49730
49782
  const { id: id2, cachedDraft } = prepared;
49731
49783
  let snapshot;
49732
49784
  try {
@@ -49744,8 +49796,8 @@ async function probeOne(client2, prepared, map2, draftKey) {
49744
49796
  };
49745
49797
  }
49746
49798
  const state = classifyState(snapshot, map2);
49747
- const cacheRevision = cachedDraft === null ? null : draftRevision(cachedDraft);
49748
- const serverRevision = snapshot === null ? null : draftRevision(snapshot.content);
49799
+ const cacheRevision = cachedDraft === null ? null : draftRevision(cachedDraft, heldFiles);
49800
+ const serverRevision = snapshot === null ? null : draftRevision(snapshot.content, heldFiles);
49749
49801
  const viewedAt = snapshot?.content.recipients.find((r) => r.viewedAt !== null)?.viewedAt ?? null;
49750
49802
  let inSync;
49751
49803
  if (cachedDraft === null) inSync = null;
@@ -50002,12 +50054,12 @@ function parseBase(baseUrl) {
50002
50054
  function badInput(message) {
50003
50055
  return new McpToolError(message, { kind: "unknown" });
50004
50056
  }
50005
- function encodeKey(key) {
50006
- if (typeof key !== "string" || key.length === 0)
50057
+ function encodeKey(key2) {
50058
+ if (typeof key2 !== "string" || key2.length === 0)
50007
50059
  throw badInput("Blob key must be a non-empty string.");
50008
- if (key.length > MAX_KEY_LENGTH)
50060
+ if (key2.length > MAX_KEY_LENGTH)
50009
50061
  throw badInput(`Blob key is longer than ${MAX_KEY_LENGTH} characters.`);
50010
- const segments = key.split("/");
50062
+ const segments = key2.split("/");
50011
50063
  for (const seg of segments) {
50012
50064
  if (seg === "" || seg === "." || seg === ".." || !SAFE_SEGMENT.test(seg)) {
50013
50065
  throw badInput('Blob key must be relative, slash-separated segments of [A-Za-z0-9._~-] with no empty, "." or ".." segment.');
@@ -50038,20 +50090,20 @@ function createBlobStore(opts) {
50038
50090
  const signingKey = opts.signingKey;
50039
50091
  const sign2 = (payload) => createHmac4("sha256", signingKey).update(payload).digest("base64url");
50040
50092
  const link2 = (encodedKey, exp, sig) => `${base}/${encodedKey}?exp=${exp}&sig=${encodeURIComponent(sig)}`;
50041
- const signGetUrl = (key, o) => {
50042
- const encoded = encodeKey(key);
50093
+ const signGetUrl = (key2, o) => {
50094
+ const encoded = encodeKey(key2);
50043
50095
  const exp = expiry(o);
50044
- return { url: link2(encoded, exp, sign2(`${prefix}/${key}
50096
+ return { url: link2(encoded, exp, sign2(`${prefix}/${key2}
50045
50097
  ${exp}`)), expiresAtMs: exp };
50046
50098
  };
50047
- const signPutUrl = (key, contentType, o) => {
50048
- const encoded = encodeKey(key);
50099
+ const signPutUrl = (key2, contentType, o) => {
50100
+ const encoded = encodeKey(key2);
50049
50101
  checkContentType(contentType);
50050
50102
  const exp = expiry(o);
50051
- return { url: link2(encoded, exp, sign2(`put\0${prefix}/${key}\0${contentType}\0${exp}`)), expiresAtMs: exp };
50103
+ return { url: link2(encoded, exp, sign2(`put\0${prefix}/${key2}\0${contentType}\0${exp}`)), expiresAtMs: exp };
50052
50104
  };
50053
- const put = async (key, body, contentType, o = {}) => {
50054
- const { url: url2 } = signPutUrl(key, contentType, o);
50105
+ const put = async (key2, body, contentType, o = {}) => {
50106
+ const { url: url2 } = signPutUrl(key2, contentType, o);
50055
50107
  const bytes = typeof body === "string" ? new TextEncoder().encode(body) : body;
50056
50108
  const doFetch = o.fetchImpl ?? fetch;
50057
50109
  let res;
@@ -50065,22 +50117,22 @@ ${exp}`)), expiresAtMs: exp };
50065
50117
  } catch (cause) {
50066
50118
  if (o.signal?.aborted)
50067
50119
  throw cause;
50068
- throw new McpToolError(`Blob store upload of ${key} did not complete (network error).`, {
50120
+ throw new McpToolError(`Blob store upload of ${key2} did not complete (network error).`, {
50069
50121
  kind: "transport"
50070
50122
  });
50071
50123
  }
50072
50124
  if (!res.ok) {
50073
- throw new McpToolError(`Blob store upload of ${key} failed (HTTP ${res.status}).`, {
50125
+ throw new McpToolError(`Blob store upload of ${key2} failed (HTTP ${res.status}).`, {
50074
50126
  kind: "http",
50075
50127
  status: res.status
50076
50128
  });
50077
50129
  }
50078
- return { key, bytes: bytes.byteLength };
50130
+ return { key: key2, bytes: bytes.byteLength };
50079
50131
  };
50080
- const signDeleteUrl = (key, o) => {
50081
- const encoded = encodeKey(key);
50132
+ const signDeleteUrl = (key2, o) => {
50133
+ const encoded = encodeKey(key2);
50082
50134
  const exp = expiry(o);
50083
- return { url: link2(encoded, exp, sign2(`del\0${prefix}/${key}\0${exp}`)), expiresAtMs: exp };
50135
+ return { url: link2(encoded, exp, sign2(`del\0${prefix}/${key2}\0${exp}`)), expiresAtMs: exp };
50084
50136
  };
50085
50137
  const exchange = async (what, url2, method, read, o) => {
50086
50138
  try {
@@ -50097,34 +50149,34 @@ ${exp}`)), expiresAtMs: exp };
50097
50149
  throw new McpToolError(`Blob store ${what} did not complete (network error).`, { kind: "transport" });
50098
50150
  }
50099
50151
  };
50100
- const get = async (key, o = {}) => {
50101
- const { url: url2 } = signGetUrl(key, o);
50102
- const res = await exchange(`read of ${key}`, url2, "GET", "bytes", o);
50152
+ const get = async (key2, o = {}) => {
50153
+ const { url: url2 } = signGetUrl(key2, o);
50154
+ const res = await exchange(`read of ${key2}`, url2, "GET", "bytes", o);
50103
50155
  if (!res.ok) {
50104
50156
  const why = res.status === 404 ? " \u2014 not found (never uploaded, expired, or already consumed)" : "";
50105
- throw new McpToolError(`Blob store read of ${key} failed (HTTP ${res.status})${why}.`, {
50157
+ throw new McpToolError(`Blob store read of ${key2} failed (HTTP ${res.status})${why}.`, {
50106
50158
  kind: "http",
50107
50159
  status: res.status
50108
50160
  });
50109
50161
  }
50110
50162
  const contentType = res.headers.get("content-type") ?? void 0;
50111
- return { key, bytes: res.body, ...contentType !== void 0 ? { contentType } : {} };
50163
+ return { key: key2, bytes: res.body, ...contentType !== void 0 ? { contentType } : {} };
50112
50164
  };
50113
- const del = async (key, o = {}) => {
50114
- const { url: url2 } = signDeleteUrl(key, o);
50115
- const res = await exchange(`delete of ${key}`, url2, "DELETE", "none", o);
50165
+ const del = async (key2, o = {}) => {
50166
+ const { url: url2 } = signDeleteUrl(key2, o);
50167
+ const res = await exchange(`delete of ${key2}`, url2, "DELETE", "none", o);
50116
50168
  if (!res.ok) {
50117
- throw new McpToolError(`Blob store delete of ${key} failed (HTTP ${res.status}).`, {
50169
+ throw new McpToolError(`Blob store delete of ${key2} failed (HTTP ${res.status}).`, {
50118
50170
  kind: "http",
50119
50171
  status: res.status
50120
50172
  });
50121
50173
  }
50122
50174
  };
50123
- const consume = async (key, use, o = {}) => {
50124
- const object2 = await get(key, o);
50175
+ const consume = async (key2, use, o = {}) => {
50176
+ const object2 = await get(key2, o);
50125
50177
  const result = await use(object2);
50126
50178
  try {
50127
- await del(key, o);
50179
+ await del(key2, o);
50128
50180
  return { result, deleted: true };
50129
50181
  } catch (e) {
50130
50182
  return { result, deleted: false, deleteError: e instanceof Error ? e.message : String(e) };
@@ -50155,83 +50207,129 @@ var CRC_TABLE = (() => {
50155
50207
  // node_modules/@chrischall/mcp-utils/dist/export/sink.js
50156
50208
  var EXPORT_BLOB_MAX_BYTES = 256 * 1024 * 1024;
50157
50209
 
50158
- // src/tools/uploads.ts
50159
- import { createHash as createHash6, randomUUID as randomUUID2 } from "node:crypto";
50160
- var MAX_FILES_PER_CALL = 10;
50161
- var UPLOAD_SLOT_TTL_MS = 30 * 60 * 1e3;
50162
- var UPLOAD_BLOB_PREFIX = "uploads";
50210
+ // node_modules/@chrischall/mcp-utils/dist/export/upload.js
50211
+ import { randomUUID as randomUUID2 } from "node:crypto";
50212
+ var MAX_UPLOAD_FILES = 10;
50213
+ var UPLOAD_KEY_PREFIX = "uploads";
50214
+ var UPLOAD_SLOT_DEFAULT_TTL_MS = 30 * 60 * 1e3;
50163
50215
  var MIB = 1024 * 1024;
50164
- var LIMIT_TEXT = `${MAX_UPLOAD_BYTES / MIB} MiB (${MAX_UPLOAD_BYTES} bytes)`;
50216
+ var OCTET_STREAM2 = "application/octet-stream";
50165
50217
  var inlineFileSchema = external_exports.object({
50166
- filename: external_exports.string().describe('Filename OFW will show, e.g. "Finn_Think_Sheet_2026-11-03.jpg" \u2014 a bare name, no path, not starting with a dot. Its extension sets the MIME type when mimeType is omitted.'),
50218
+ filename: external_exports.string().describe("Filename the upstream will show \u2014 a bare name, no path, not starting with a dot. Its extension sets the MIME type when mimeType is omitted."),
50167
50219
  contentBase64: external_exports.string().describe(`The file's bytes, standard base64 (line breaks and a "data:<type>;base64," prefix are tolerated).`),
50168
- mimeType: external_exports.string().describe('MIME type, e.g. "image/jpeg". Default: inferred from the filename extension (jpg/jpeg, png, heic, pdf, docx, \u2026).').optional()
50220
+ mimeType: external_exports.string().describe('MIME type, e.g. "image/jpeg". Default: inferred from the filename extension.').optional()
50169
50221
  });
50170
50222
  var uploadSlotRequestSchema = external_exports.object({
50171
- filename: external_exports.string().describe("Filename OFW will show \u2014 a bare name, no path, not starting with a dot."),
50223
+ filename: external_exports.string().describe("Filename the upstream will show \u2014 a bare name, no path, not starting with a dot."),
50172
50224
  mimeType: external_exports.string().describe("MIME type. Default: inferred from the filename extension. The PUT must send exactly this Content-Type.").optional()
50173
50225
  });
50174
50226
  function sanitizeUploadFilename(raw) {
50175
50227
  const name = raw.trim();
50176
- if (name.length === 0) throw new Error("filename is empty.");
50228
+ if (name.length === 0)
50229
+ throw new Error("filename is empty.");
50177
50230
  if (/[/\\]/.test(name)) {
50178
- throw new Error(`filename ${JSON.stringify(name)} must be a bare filename, not a path \u2014 pass just the name OFW should show, e.g. "photo.jpg".`);
50231
+ throw new Error(`filename ${JSON.stringify(name)} must be a bare filename, not a path \u2014 pass just the name to show, e.g. "photo.jpg".`);
50179
50232
  }
50180
- if (/[\x00-\x1f\x7f]/.test(name)) throw new Error(`filename ${JSON.stringify(name)} contains control characters.`);
50233
+ if (/[\x00-\x1f\x7f]/.test(name))
50234
+ throw new Error(`filename ${JSON.stringify(name)} contains control characters.`);
50181
50235
  if (name.startsWith(".")) {
50182
50236
  throw new Error(`filename ${JSON.stringify(name)} must not start with a dot (hidden files are never uploaded).`);
50183
50237
  }
50184
- if (name.length > 200) throw new Error("filename is longer than 200 characters.");
50238
+ if (name.length > 200)
50239
+ throw new Error("filename is longer than 200 characters.");
50185
50240
  return name;
50186
50241
  }
50242
+ var MIME_BY_EXT2 = {
50243
+ pdf: "application/pdf",
50244
+ png: "image/png",
50245
+ jpg: "image/jpeg",
50246
+ jpeg: "image/jpeg",
50247
+ gif: "image/gif",
50248
+ webp: "image/webp",
50249
+ heic: "image/heic",
50250
+ heif: "image/heif",
50251
+ tif: "image/tiff",
50252
+ tiff: "image/tiff",
50253
+ svg: "image/svg+xml",
50254
+ txt: "text/plain",
50255
+ md: "text/markdown",
50256
+ csv: "text/csv",
50257
+ html: "text/html",
50258
+ htm: "text/html",
50259
+ json: "application/json",
50260
+ xml: "application/xml",
50261
+ ics: "text/calendar",
50262
+ doc: "application/msword",
50263
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
50264
+ xls: "application/vnd.ms-excel",
50265
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
50266
+ ppt: "application/vnd.ms-powerpoint",
50267
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
50268
+ zip: "application/zip",
50269
+ mp3: "audio/mpeg",
50270
+ m4a: "audio/mp4",
50271
+ wav: "audio/wav",
50272
+ mp4: "video/mp4",
50273
+ mov: "video/quicktime",
50274
+ webm: "video/webm"
50275
+ };
50276
+ function mimeFromFileName(name) {
50277
+ const dot = name.lastIndexOf(".");
50278
+ if (dot <= 0)
50279
+ return OCTET_STREAM2;
50280
+ return MIME_BY_EXT2[name.slice(dot + 1).toLowerCase()] ?? OCTET_STREAM2;
50281
+ }
50187
50282
  var MEDIA_TYPE = /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/;
50188
50283
  function resolveUploadMime(fileName, mimeType) {
50189
- if (mimeType === void 0) return mimeFromName(fileName);
50190
- const bare = normalizeMimeType(mimeType);
50284
+ if (mimeType === void 0)
50285
+ return mimeFromFileName(fileName);
50286
+ const bare = (mimeType.split(";", 1)[0] ?? "").trim().toLowerCase();
50191
50287
  if (!MEDIA_TYPE.test(bare)) {
50192
50288
  throw new Error(`mimeType ${JSON.stringify(mimeType)} is not a type/subtype media type such as "image/jpeg".`);
50193
50289
  }
50194
50290
  return bare;
50195
50291
  }
50196
- function checkUploadSize(fileName, size) {
50197
- if (size === 0) throw new Error(`${fileName} is empty (0 bytes); nothing to upload.`);
50198
- if (size > MAX_UPLOAD_BYTES) {
50199
- throw new Error(`${fileName} is too large (${size} bytes); the upload limit is ${LIMIT_TEXT}.`);
50200
- }
50292
+ function limitText(maxBytes) {
50293
+ return `${Math.floor(maxBytes / MIB)} MiB (${maxBytes} bytes)`;
50294
+ }
50295
+ function checkUploadSize(fileName, size, maxBytes) {
50296
+ if (size === 0)
50297
+ throw new Error(`${fileName} is empty (0 bytes); nothing to upload.`);
50298
+ if (size > maxBytes)
50299
+ throw new Error(`${fileName} is too large (${size} bytes); the upload limit is ${limitText(maxBytes)}.`);
50201
50300
  }
50202
50301
  var BASE64 = /^[A-Za-z0-9+/]*={0,2}$/;
50203
- function decodeBase64Content(content, fileName) {
50302
+ function decodeBase64Strict(content, opts) {
50303
+ const { fileName, maxBytes } = opts;
50204
50304
  const compact = content.replace(/^data:[^,]*;base64,/i, "").replace(/\s+/g, "");
50205
- if (compact.length === 0) throw new Error(`${fileName} is empty (0 bytes); nothing to upload.`);
50305
+ if (compact.length === 0)
50306
+ throw new Error(`${fileName} is empty (0 bytes); nothing to upload.`);
50206
50307
  const invalid = () => new Error(`${fileName}: contentBase64 is not valid base64 (standard alphabet A-Z a-z 0-9 + /, padded with = to a multiple of 4 characters). It may have been truncated.`);
50207
- if (compact.length % 4 !== 0 || !BASE64.test(compact)) throw invalid();
50308
+ if (compact.length % 4 !== 0 || !BASE64.test(compact))
50309
+ throw invalid();
50208
50310
  const padding = compact.endsWith("==") ? 2 : compact.endsWith("=") ? 1 : 0;
50209
- checkUploadSize(fileName, compact.length / 4 * 3 - padding);
50311
+ checkUploadSize(fileName, compact.length / 4 * 3 - padding, maxBytes);
50210
50312
  const bytes = Buffer.from(compact, "base64");
50211
- if (bytes.toString("base64") !== compact) throw invalid();
50212
- return bytes;
50213
- }
50214
- function resolveInlineUpload(file2) {
50215
- const fileName = sanitizeUploadFilename(file2.filename);
50216
- const mimeType = resolveUploadMime(fileName, file2.mimeType);
50217
- const bytes = decodeBase64Content(file2.contentBase64, fileName);
50218
- return { blob: new Blob([new Uint8Array(bytes)], { type: mimeType }), fileName, mimeType, sizeBytes: bytes.length };
50313
+ if (bytes.toString("base64") !== compact)
50314
+ throw invalid();
50315
+ return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
50219
50316
  }
50220
- var UPLOAD_KEY = new RegExp(
50221
- `^${UPLOAD_BLOB_PREFIX}/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/([A-Za-z0-9_-]+)$`
50222
- );
50223
- function fileNameFromBlobKey(key) {
50224
- const match = UPLOAD_KEY.exec(key);
50225
- if (!match) {
50226
- throw new Error(`blobKey ${JSON.stringify(key)} is not an upload key. Pass the blobKey exactly as ofw_upload_attachment's uploadSlots returned it.`);
50317
+ var PREFIX2 = /^[A-Za-z0-9._~-]+$/;
50318
+ function checkPrefix(prefix) {
50319
+ if (!PREFIX2.test(prefix) || prefix === "." || prefix === "..") {
50320
+ throw new Error(`Upload key prefix ${JSON.stringify(prefix)} must be one key segment of [A-Za-z0-9._~-].`);
50227
50321
  }
50228
- return sanitizeUploadFilename(Buffer.from(match[1], "base64url").toString("utf8"));
50229
50322
  }
50230
- function mintUploadSlot(store, req) {
50323
+ function mintUploadSlot(store, req, opts = {}) {
50324
+ const prefix = opts.prefix ?? UPLOAD_KEY_PREFIX;
50325
+ checkPrefix(prefix);
50231
50326
  const filename = sanitizeUploadFilename(req.filename);
50232
50327
  const mimeType = resolveUploadMime(filename, req.mimeType);
50233
- const blobKey = `${UPLOAD_BLOB_PREFIX}/${randomUUID2()}/${Buffer.from(filename, "utf8").toString("base64url")}`;
50234
- const { url: url2, expiresAtMs } = store.signPutUrl(blobKey, mimeType, { ttlMs: UPLOAD_SLOT_TTL_MS });
50328
+ const blobKey = `${prefix}/${randomUUID2()}/${Buffer.from(filename, "utf8").toString("base64url")}`;
50329
+ const { url: url2, expiresAtMs } = store.signPutUrl(blobKey, mimeType, {
50330
+ ttlMs: opts.ttlMs ?? UPLOAD_SLOT_DEFAULT_TTL_MS,
50331
+ ...opts.now !== void 0 ? { now: opts.now } : {}
50332
+ });
50235
50333
  const shellName = filename.replace(/'/g, `'\\''`);
50236
50334
  return {
50237
50335
  filename,
@@ -50239,15 +50337,58 @@ function mintUploadSlot(store, req) {
50239
50337
  blobKey,
50240
50338
  method: "PUT",
50241
50339
  uploadUrl: url2,
50242
- expiresAt: formatInstant(new Date(expiresAtMs)).iso,
50243
- // The signature commits to the Content-Type, so the header must match it
50244
- // byte for byte; --fail turns a refused PUT into a non-zero exit.
50340
+ expiresAtMs,
50341
+ expiresAt: new Date(expiresAtMs).toISOString(),
50342
+ // --fail turns a refused PUT (expired, wrong Content-Type) into a non-zero exit.
50245
50343
  curl: `curl -sS --fail -X PUT -H 'Content-Type: ${mimeType}' --data-binary @'<path to ${shellName}>' '${url2}'`
50246
50344
  };
50247
50345
  }
50248
- function blobObjectToUpload(key, object2) {
50249
- const fileName = fileNameFromBlobKey(key);
50250
- checkUploadSize(fileName, object2.bytes.length);
50346
+ var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
50347
+ function uploadFileNameFromKey(key2, opts = {}) {
50348
+ const prefix = opts.prefix ?? UPLOAD_KEY_PREFIX;
50349
+ checkPrefix(prefix);
50350
+ const escaped = prefix.replace(/[.~-]/g, "\\$&");
50351
+ const match = new RegExp(`^${escaped}/${UUID}/([A-Za-z0-9_-]+)$`).exec(key2);
50352
+ if (!match) {
50353
+ throw new Error(`blobKey ${JSON.stringify(key2)} is not an upload key. Pass the blobKey exactly as the upload slot returned it.`);
50354
+ }
50355
+ return sanitizeUploadFilename(Buffer.from(match[1], "base64url").toString("utf8"));
50356
+ }
50357
+
50358
+ // src/tools/uploads.ts
50359
+ import { createHash as createHash6 } from "node:crypto";
50360
+ var MAX_FILES_PER_CALL = MAX_UPLOAD_FILES;
50361
+ var UPLOAD_SLOT_TTL_MS = UPLOAD_SLOT_DEFAULT_TTL_MS;
50362
+ var UPLOAD_BLOB_PREFIX = UPLOAD_KEY_PREFIX;
50363
+ function checkUploadSize2(fileName, size) {
50364
+ checkUploadSize(fileName, size, MAX_UPLOAD_BYTES);
50365
+ }
50366
+ function decodeBase64Content(content, fileName) {
50367
+ const bytes = decodeBase64Strict(content, { fileName, maxBytes: MAX_UPLOAD_BYTES });
50368
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
50369
+ }
50370
+ function resolveInlineUpload(file2) {
50371
+ const fileName = sanitizeUploadFilename(file2.filename);
50372
+ const mimeType = resolveUploadMime(fileName, file2.mimeType);
50373
+ const bytes = decodeBase64Content(file2.contentBase64, fileName);
50374
+ return { blob: new Blob([new Uint8Array(bytes)], { type: mimeType }), fileName, mimeType, sizeBytes: bytes.length };
50375
+ }
50376
+ function fileNameFromBlobKey(key2) {
50377
+ try {
50378
+ return uploadFileNameFromKey(key2, { prefix: UPLOAD_BLOB_PREFIX });
50379
+ } catch (e) {
50380
+ const message = e.message;
50381
+ if (!message.includes("is not an upload key")) throw e;
50382
+ throw new Error(`blobKey ${JSON.stringify(key2)} is not an upload key. Pass the blobKey exactly as ofw_upload_attachment's uploadSlots returned it.`);
50383
+ }
50384
+ }
50385
+ function mintUploadSlot2(store, req) {
50386
+ const { expiresAtMs, ...slot } = mintUploadSlot(store, req, { prefix: UPLOAD_BLOB_PREFIX, ttlMs: UPLOAD_SLOT_TTL_MS });
50387
+ return { ...slot, expiresAt: formatInstant(new Date(expiresAtMs)).iso };
50388
+ }
50389
+ function blobObjectToUpload(key2, object2) {
50390
+ const fileName = fileNameFromBlobKey(key2);
50391
+ checkUploadSize2(fileName, object2.bytes.length);
50251
50392
  const mimeType = normalizeMimeType(object2.contentType ?? mimeFromName(fileName));
50252
50393
  return {
50253
50394
  blob: new Blob([object2.bytes], { type: mimeType }),
@@ -50307,7 +50448,7 @@ function requireBlobStore(store, what) {
50307
50448
  throw new Error(`${what} needs the blob store an mcp-host deployment provides, and this server has no blob store (it is a local install). Pass a \`path\` inside the upload directory, or the bytes with \`inline\`.`);
50308
50449
  }
50309
50450
  var inlineAttachmentsParam = external_exports.array(inlineFileSchema).max(MAX_FILES_PER_CALL).describe(
50310
- "Files to attach, supplied as base64 BYTES ({filename, contentBase64, mimeType?}). Each is uploaded to My Files as PRIVATE, then attached alongside any myFileIDs. Use for small files; on a hosted deployment, larger files (phone photos) go faster through ofw_upload_attachment uploadSlots + blobKeys here. Every entry is validated before anything is uploaded."
50451
+ "Files to attach, supplied as base64 BYTES ({filename, contentBase64, mimeType?}). Each is uploaded to My Files as PRIVATE and attached alongside any myFileIDs (a send attaches PRIVATE files as they are). Use for small files; on a hosted deployment, larger files (phone photos) go faster through ofw_upload_attachment uploadSlots + blobKeys here. Every entry is validated before anything is uploaded."
50311
50452
  ).optional();
50312
50453
  var blobKeysParam = external_exports.array(external_exports.string()).max(MAX_FILES_PER_CALL).describe(
50313
50454
  "Hosted deployments: blobKeys from ofw_upload_attachment uploadSlots whose files you have already PUT. Each is uploaded to My Files as PRIVATE, attached alongside any myFileIDs, and deleted from the upload store."
@@ -50344,7 +50485,7 @@ async function uploadPending(pending, ctx) {
50344
50485
  for (const p of pending) {
50345
50486
  try {
50346
50487
  if (p.inline) {
50347
- uploaded.push(await uploadToMyFiles(ctx.client, ctx.cache, p.inline, { shareClass: "PRIVATE" }));
50488
+ uploaded.push(await uploadToMyFiles(ctx.client, ctx.cache, p.inline, { shareClass: ctx.shareClass }));
50348
50489
  continue;
50349
50490
  }
50350
50491
  const out = await ctx.store.consume(p.blobKey, async (object2) => {
@@ -50352,7 +50493,7 @@ async function uploadPending(pending, ctx) {
50352
50493
  if (p.sha256 !== null && await sha256Hex(upload.blob) !== p.sha256) {
50353
50494
  throw new Error(`${p.fileName} changed in the upload store after it was previewed`);
50354
50495
  }
50355
- return uploadToMyFiles(ctx.client, ctx.cache, upload, { shareClass: "PRIVATE" });
50496
+ return uploadToMyFiles(ctx.client, ctx.cache, upload, { shareClass: ctx.shareClass });
50356
50497
  }, { maxBytes: MAX_UPLOAD_BYTES });
50357
50498
  uploaded.push(out.result);
50358
50499
  if (!out.deleted) {
@@ -50361,7 +50502,7 @@ async function uploadPending(pending, ctx) {
50361
50502
  } catch (e) {
50362
50503
  const done = uploaded.map((u) => `${u.fileName} (fileId ${u.fileId})`);
50363
50504
  throw new Error(
50364
- `Attachment ${p.fileName} could not be uploaded: ${e.message}. Nothing was ${ctx.nothingWas}.` + (done.length > 0 ? ` Already uploaded to My Files (PRIVATE): ${done.join(", ")} \u2014 pass those fileIds in myFileIDs when you retry instead of uploading them again.` : "")
50505
+ `Attachment ${p.fileName} could not be uploaded: ${e.message}. Nothing was ${ctx.nothingWas}.` + (done.length > 0 ? ` Already uploaded to My Files (${ctx.shareClass}): ${done.join(", ")} \u2014 pass those fileIds in myFileIDs when you retry instead of uploading them again.` : "")
50365
50506
  );
50366
50507
  }
50367
50508
  }
@@ -51456,7 +51597,7 @@ var MESSAGE_ROW_KEYS = /* @__PURE__ */ new Set([
51456
51597
  var DRAFT_ROW_KEYS = /* @__PURE__ */ new Set(["id", "subject", "recipients", "replyToId", "modifiedAt", "body"]);
51457
51598
  function omitKnown(rest, own2) {
51458
51599
  const out = {};
51459
- for (const [key, value] of Object.entries(rest)) if (!own2.has(key)) out[key] = value;
51600
+ for (const [key2, value] of Object.entries(rest)) if (!own2.has(key2)) out[key2] = value;
51460
51601
  return out;
51461
51602
  }
51462
51603
  function compactDraft(row) {
@@ -51491,6 +51632,20 @@ function viewOne(view, row) {
51491
51632
  }
51492
51633
 
51493
51634
  // src/tools/messages.ts
51635
+ 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.";
51636
+ async function describeDraftKey(cache, id2) {
51637
+ const row = await cache.getDraftLineageById(id2);
51638
+ if (!row) return { draftKey: null, draftKeyReason: DRAFT_KEY_NULL_REASON };
51639
+ return { draftKey: row.draftKey, ...await cache.getMeta(`draft_key_inferred:${id2}`) === "1" ? { draftKeyInferred: true } : {} };
51640
+ }
51641
+ async function inferredDraftKeys(cache, ids) {
51642
+ const out = /* @__PURE__ */ new Set();
51643
+ for (const id2 of ids) if (await cache.getMeta(`draft_key_inferred:${id2}`) === "1") out.add(id2);
51644
+ return out;
51645
+ }
51646
+ async function describeHeld(cache, ids) {
51647
+ return Promise.all(ids.map(async (fileId) => ({ fileId, fileName: (await cache.getAttachment(fileId))?.fileName ?? null, held: true })));
51648
+ }
51494
51649
  var GateHalt = class extends Error {
51495
51650
  constructor(response) {
51496
51651
  super("confirmation required");
@@ -51510,7 +51665,9 @@ var SentDetailSchema = external_exports.looseObject({
51510
51665
  // _shared.ts). Backs the `threaded` verdict on ofw_send_message.
51511
51666
  replyToId: external_exports.number().nullable().optional(),
51512
51667
  inReplyTo: external_exports.number().nullable().optional(),
51513
- showContext: external_exports.boolean().optional()
51668
+ showContext: external_exports.boolean().optional(),
51669
+ // What OFW actually attached — checked against what was sent.
51670
+ files: external_exports.array(external_exports.number()).optional()
51514
51671
  });
51515
51672
  var SavedDraftDetailSchema = external_exports.looseObject({
51516
51673
  subject: external_exports.string().optional(),
@@ -51772,20 +51929,20 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
51772
51929
  });
51773
51930
  }
51774
51931
  const bounds = {};
51775
- for (const key of ["since", "until"]) {
51776
- const value2 = args[key];
51932
+ for (const key2 of ["since", "until"]) {
51933
+ const value2 = args[key2];
51777
51934
  if (value2 === void 0) continue;
51778
51935
  const converted = toNaiveWallClock(value2);
51779
51936
  if (converted === null) {
51780
51937
  return jsonErrorResponse({
51781
51938
  result: "INVALID_DATE",
51782
- reason: `${key} must be an ISO date (YYYY-MM-DD) or datetime, optionally with an offset or Z (got ${JSON.stringify(value2)}).`,
51783
- remedy: `Re-call with ${key} as e.g. "2026-07-27" or "2026-07-27T22:00:00-04:00".`,
51939
+ reason: `${key2} must be an ISO date (YYYY-MM-DD) or datetime, optionally with an offset or Z (got ${JSON.stringify(value2)}).`,
51940
+ remedy: `Re-call with ${key2} as e.g. "2026-07-27" or "2026-07-27T22:00:00-04:00".`,
51784
51941
  complete: false,
51785
51942
  note: 'No lookup was performed. This says NOTHING about what is in the cache \u2014 do not read it as "no messages".'
51786
51943
  });
51787
51944
  }
51788
- bounds[key] = converted;
51945
+ bounds[key2] = converted;
51789
51946
  }
51790
51947
  const cache = cacheProvider();
51791
51948
  const folders = folder === void 0 ? ["inbox", "sent"] : [folder];
@@ -51876,12 +52033,13 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
51876
52033
  const draftRow = await cache.getDraft(id2);
51877
52034
  if (draftRow !== null) {
51878
52035
  const { freshness: freshness2, serverConfirmed, cacheStatus } = await draftsFreshness(cache);
52036
+ const held = await getHeldFiles(cache, draftRow.id);
51879
52037
  return jsonResponse({
51880
52038
  // Stable identity FIRST — the id below changes on every edit
51881
52039
  // (create-then-delete), so callers should key off draftKey. Null when
51882
52040
  // this draft was never written through this tool (e.g. authored in
51883
52041
  // the web app).
51884
- draftKey: (await cache.getDraftLineageById(draftRow.id))?.draftKey ?? null,
52042
+ ...await describeDraftKey(cache, draftRow.id),
51885
52043
  id: draftRow.id,
51886
52044
  folder: "drafts",
51887
52045
  subject: draftRow.subject,
@@ -51905,11 +52063,14 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
51905
52063
  // the DRAFTS table, which is the source of truth for a draft id — the
51906
52064
  // echo duplicates it and adds a stale copy of nothing else.
51907
52065
  ...view === "compact" ? {} : { listData: draftRow.listData },
51908
- attachments: [],
52066
+ // OFW keeps no files on a draft; these are the ones HELD for it here
52067
+ // and attached when it is sent (held-attachments.ts).
52068
+ attachments: await describeHeld(cache, held),
52069
+ ...held.length > 0 ? { attachmentsNote: HELD_NOTE } : {},
51909
52070
  // Concurrency token — pass as expectedRevision to ofw_save_draft /
51910
52071
  // ofw_delete_draft / ofw_send_message to assert you are acting on
51911
52072
  // THIS version.
51912
- revision: draftRevision(draftRow),
52073
+ revision: draftRevision(draftRow, held),
51913
52074
  cacheStatus,
51914
52075
  // False = this draft's existence and unsent status are remembered from
51915
52076
  // a cache, not confirmed on OFW. Call ofw_check_freshness before
@@ -52013,7 +52174,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52013
52174
  });
52014
52175
  if (allowSend) server.registerTool("ofw_send_message", {
52015
52176
  _meta: familyMeta("send", { aliases: ["message", "co-parent", "reply", "ofw"] }),
52016
- description: "Send a message via OurFamilyWizard \u2014 the ONE irreversible operation here, so it carries the strongest guard. TO SEND AN EXISTING DRAFT (the safe default): pass draftId (or messageId \u2014 same thing). The tool re-reads the draft from OFW and sends the SERVER'S version, so what goes out is what is on OurFamilyWizard, not what this session remembers \u2014 subject/body act only as explicit overrides. It is guarded exactly like ofw_save_draft: pass expectedRevision to assert which version you are sending; if the draft changed on OFW since you read it \u2014 or no longer exists (it may already have been SENT) \u2014 the send is REFUSED with the current server content echoed back, and nothing goes out. RECIPIENTS: OurFamilyWizard does not persist recipients on drafts, so recipientIds is usually still required at send time (ids from ofw_get_profile). After the send is CONFIRMED (OFW returned the new message id and the re-fetched sent record matches what was posted), the source draft is deleted automatically; pass deleteDraftOnSuccess:false to keep it. On ANY failure or ambiguity the draft is never deleted \u2014 the response carries draftRetained:true with the reason. If the send request times out or drops without a definitive answer, the result is SEND_UNCONFIRMED: the message may already have been delivered, so do NOT retry until a sent-folder sync (or ourfamilywizard.com) shows it did not go out. TO COMPOSE FROM SCRATCH: supply subject/body/recipientIds with no draftId. If replyToId is provided (or inherited from the draft), the cache may rewrite it to the latest reply in the same thread (a note is included when this happens). ATTACHMENTS: when sending by draftId, the server draft's own attachments carry over automatically; myFileIDs (from ofw_upload_attachment) overrides or attaches files on a fresh compose. The response leads with sentMessageId and the stable draftKey, and reports threaded (whether OFW actually linked the reply) and draftDeleted. " + CONFIRM_NOTE,
52177
+ description: "Send a message via OurFamilyWizard \u2014 the ONE irreversible operation here, so it carries the strongest guard. TO SEND AN EXISTING DRAFT (the safe default): pass draftId (or messageId \u2014 same thing). The tool re-reads the draft from OFW and sends the SERVER'S version, so what goes out is what is on OurFamilyWizard, not what this session remembers \u2014 subject/body act only as explicit overrides. It is guarded exactly like ofw_save_draft: pass expectedRevision to assert which version you are sending; if the draft changed on OFW since you read it \u2014 or no longer exists (it may already have been SENT) \u2014 the send is REFUSED with the current server content echoed back, and nothing goes out. RECIPIENTS: OurFamilyWizard does not persist recipients on drafts, so recipientIds is usually still required at send time (ids from ofw_get_profile). After the send is CONFIRMED (OFW returned the new message id and the re-fetched sent record matches what was posted), the source draft is deleted automatically; pass deleteDraftOnSuccess:false to keep it. On ANY failure or ambiguity the draft is never deleted \u2014 the response carries draftRetained:true with the reason. If the send request times out or drops without a definitive answer, the result is SEND_UNCONFIRMED: the message may already have been delivered, so do NOT retry until a sent-folder sync (or ourfamilywizard.com) shows it did not go out. TO COMPOSE FROM SCRATCH: supply subject/body/recipientIds with no draftId. If replyToId is provided (or inherited from the draft), the cache may rewrite it to the latest reply in the same thread (a note is included when this happens). ATTACHMENTS: OurFamilyWizard keeps no files on drafts, so when sending by draftId the files ofw_save_draft HELD for it are attached automatically; myFileIDs (from ofw_upload_attachment) overrides them, or attaches files on a fresh compose; inlineAttachments/blobKeys upload new ones. Files are attached as they are (PRIVATE files attach fine); new files are uploaded PRIVATE, only after the send is approved. The response verifies them against the sent message (attachments.verified/missing). The response leads with sentMessageId and the stable draftKey, and reports threaded (whether OFW actually linked the reply) and draftDeleted. " + CONFIRM_NOTE,
52017
52178
  annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },
52018
52179
  inputSchema: external_exports.object({
52019
52180
  subject: external_exports.string().describe("Message subject. Required unless draftId/messageId is given (then it overrides the server draft's subject).").optional(),
@@ -52101,7 +52262,8 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52101
52262
  replyParent = await cache.getMessage(resolvedReplyTo);
52102
52263
  chainRootId = replyParent?.chainRootId ?? replyParent?.id ?? requestedReplyTo;
52103
52264
  }
52104
- let myFileIDs = args.myFileIDs ?? serverDraft?.files ?? [];
52265
+ const heldForDraft = draftRef !== void 0 ? await getHeldFiles(cache, draftRef) : [];
52266
+ let myFileIDs = args.myFileIDs ?? uniqueIds([...serverDraft?.files ?? [], ...heldForDraft]);
52105
52267
  const to = await describeRecipients(cache, recipientIds, [
52106
52268
  serverDraft?.recipients,
52107
52269
  cachedDraft?.recipients,
@@ -52130,7 +52292,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52130
52292
  action: "ofw.message.send",
52131
52293
  message: "Review and confirm this OurFamilyWizard message. Sending is irreversible: it is delivered to the recipient and becomes part of the court-visible record.",
52132
52294
  target: draftRef !== void 0 ? `draft:${draftRef}` : "compose",
52133
- ...serverDraft != null ? { revision: draftRevision(serverDraft) } : {},
52295
+ ...serverDraft != null ? { revision: draftRevision(serverDraft, heldForDraft) } : {},
52134
52296
  payload: {
52135
52297
  subject,
52136
52298
  body,
@@ -52148,7 +52310,8 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52148
52310
  client: client2,
52149
52311
  cache,
52150
52312
  store: blobStore,
52151
- nothingWas: "sent"
52313
+ nothingWas: "sent",
52314
+ shareClass: "PRIVATE"
52152
52315
  });
52153
52316
  myFileIDs = [...myFileIDs, ...newFiles.map((f) => f.fileId)];
52154
52317
  let posted;
@@ -52180,7 +52343,24 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52180
52343
  let sentDraftKey = null;
52181
52344
  let threaded = false;
52182
52345
  let threadNote = null;
52346
+ let attachmentCheck = null;
52347
+ let attachmentNote = null;
52348
+ if (newId !== null && myFileIDs.length > 0) {
52349
+ const onMessage = Array.isArray(detail.files) ? detail.files : null;
52350
+ const missing = onMessage === null ? [] : myFileIDs.filter((id2) => !onMessage.includes(id2));
52351
+ attachmentCheck = {
52352
+ onMessage,
52353
+ verified: onMessage === null ? null : missing.length === 0,
52354
+ ...missing.length > 0 ? { missing } : {}
52355
+ };
52356
+ if (missing.length > 0) {
52357
+ attachmentNote = `WARNING: the message was SENT, but OurFamilyWizard did not attach fileId(s) ${missing.join(", ")}. It cannot be edited; send the missing file(s) in a follow-up message.`;
52358
+ } else if (onMessage === null) {
52359
+ attachmentNote = "NOTE: OurFamilyWizard did not report the sent message's attachments, so they could not be verified. Check the sent message on ourfamilywizard.com.";
52360
+ }
52361
+ }
52183
52362
  if (newId !== null) {
52363
+ if (draftRef !== void 0) await clearHeldFiles(cache, draftRef);
52184
52364
  verifyNote = verifyWriteLanded("message", { subject, body }, detail);
52185
52365
  const echoed = threadedReplyTo(detail);
52186
52366
  if (resolvedReplyTo === null) {
@@ -52229,12 +52409,12 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52229
52409
  if (draftRef !== void 0) {
52230
52410
  const prior = await cache.getDraftLineageById(draftRef);
52231
52411
  const now = (/* @__PURE__ */ new Date()).toISOString();
52232
- const key = prior?.draftKey ?? newDraftKey();
52412
+ const key2 = prior?.draftKey ?? newDraftKey();
52233
52413
  if (prior === null) {
52234
- await cache.recordDraftLineage({ id: draftRef, draftKey: key, previousId: null, recordedAt: now });
52414
+ await cache.recordDraftLineage({ id: draftRef, draftKey: key2, previousId: null, recordedAt: now });
52235
52415
  }
52236
- await cache.recordDraftLineage({ id: newId, draftKey: key, previousId: draftRef, recordedAt: now });
52237
- sentDraftKey = key;
52416
+ await cache.recordDraftLineage({ id: newId, draftKey: key2, previousId: draftRef, recordedAt: now });
52417
+ sentDraftKey = key2;
52238
52418
  }
52239
52419
  for (const fileId of myFileIDs) {
52240
52420
  const existing = await cache.getAttachment(fileId);
@@ -52284,17 +52464,19 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52284
52464
  previousId: draftRef
52285
52465
  } : {},
52286
52466
  ...persisted,
52467
+ ...attachmentCheck !== null ? { attachments: attachmentCheck } : {},
52287
52468
  ...newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {},
52288
52469
  ...uploadWarnings.length > 0 ? { warnings: uploadWarnings } : {}
52289
52470
  };
52290
52471
  return notedJsonResponse(
52291
- [guardNote, rewriteNote, verifyNote, threadNote, unconfirmedNote, retainNote],
52472
+ [guardNote, rewriteNote, verifyNote, threadNote, attachmentNote, unconfirmedNote, retainNote],
52292
52473
  responseObj,
52293
52474
  "Message sent successfully."
52294
52475
  );
52295
52476
  });
52296
52477
  async function guardDestructiveDraftOp(input2) {
52297
52478
  const { cache, draftId, expectedRevision, force, action } = input2;
52479
+ const heldFiles = await getHeldFiles(cache, draftId);
52298
52480
  const cachedRow = await cache.getDraft(draftId);
52299
52481
  const cached2 = cachedRow === null ? null : {
52300
52482
  subject: cachedRow.subject,
@@ -52308,7 +52490,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52308
52490
  } catch (e) {
52309
52491
  const reason = e.message;
52310
52492
  if (force) {
52311
- return { ok: true, note: `WARNING: force:true \u2014 proceeded with ${action} on draft ${draftId} even though its current state could not be read from OurFamilyWizard (${reason}). Any newer server-side version was destroyed and is NOT recoverable from this response.`, server: void 0 };
52493
+ return { ok: true, note: `WARNING: force:true \u2014 proceeded with ${action} on draft ${draftId} even though its current state could not be read from OurFamilyWizard (${reason}). Any newer server-side version was destroyed and is NOT recoverable from this response.`, server: void 0, heldFiles };
52312
52494
  }
52313
52495
  return {
52314
52496
  ok: false,
@@ -52320,10 +52502,10 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52320
52502
  })
52321
52503
  };
52322
52504
  }
52323
- const verdict = checkDraftFreshness({ server: server2, cached: cached2, expectedRevision });
52505
+ const verdict = checkDraftFreshness({ server: server2, cached: cached2, expectedRevision, heldFiles });
52324
52506
  if (verdict.verdict === "FRESH") {
52325
52507
  const note = verdict.metadataOnly ? `NOTE: draft ${draftId} was treated as current for this ${action}. Since you read it, OurFamilyWizard normalized connector-authored metadata (${verdict.changedFields.join(", ")}); the subject, body and recipients are unchanged, so this is not a conflict.` : null;
52326
- return { ok: true, note, server: server2 };
52508
+ return { ok: true, note, server: server2, heldFiles };
52327
52509
  }
52328
52510
  if (force) {
52329
52511
  console.error(`[ofw-mcp] WARNING: force:true overrode a ${verdict.verdict} verdict on draft ${draftId} (${action}). ${verdict.reason}`);
@@ -52333,9 +52515,10 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
52333
52515
  note: `WARNING: force:true overrode a ${verdict.verdict} freshness verdict on draft ${draftId}. ${verdict.reason} ${echoed}
52334
52516
 
52335
52517
  ${jsonText(
52336
- { overwrittenServerDraft: server2 === null ? null : { ...server2, revision: draftRevision(server2) } }
52518
+ { overwrittenServerDraft: server2 === null ? null : { ...server2, revision: draftRevision(server2, heldFiles) } }
52337
52519
  )}`,
52338
- server: server2
52520
+ server: server2,
52521
+ heldFiles
52339
52522
  };
52340
52523
  }
52341
52524
  return {
@@ -52345,7 +52528,8 @@ ${jsonText(
52345
52528
  draftId,
52346
52529
  verdict,
52347
52530
  server: server2,
52348
- cached: cached2
52531
+ cached: cached2,
52532
+ heldFiles
52349
52533
  }))
52350
52534
  };
52351
52535
  }
@@ -52393,10 +52577,14 @@ ${jsonText(
52393
52577
  const keyById = new Map(
52394
52578
  (await cache.getDraftLineageByIds(rows.map((d) => d.id))).map((l) => [l.id, l.draftKey])
52395
52579
  );
52580
+ const held = await heldFilesFor(cache, rows.map((d) => d.id));
52581
+ const inferred = await inferredDraftKeys(cache, rows.map((d) => d.id));
52396
52582
  const drafts2 = rows.map((d) => ({
52397
52583
  ...d,
52398
- revision: draftRevision(d),
52584
+ revision: draftRevision(d, held.get(d.id)),
52585
+ ...held.get(d.id).length > 0 ? { heldFiles: held.get(d.id) } : {},
52399
52586
  draftKey: keyById.get(d.id) ?? null,
52587
+ ...inferred.has(d.id) ? { draftKeyInferred: true } : {},
52400
52588
  cacheStatus,
52401
52589
  serverConfirmed: serverConfirmed2,
52402
52590
  asOf: freshness2.asOf
@@ -52450,7 +52638,7 @@ ${jsonText(
52450
52638
  });
52451
52639
  if (allowDrafts) server.registerTool("ofw_save_draft", {
52452
52640
  _meta: familyMeta("change"),
52453
- description: "Save a message as a draft in OurFamilyWizard. RECIPIENTS: OurFamilyWizard does NOT persist recipients on drafts \u2014 recipientIds are accepted but the saved draft comes back with none (documented OFW behavior, noted once in the response, not warned about; supply recipientIds at send time instead). 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 response's top-level replyToId/inReplyTo always agree with its listData. Attach files via myFileIDs (from ofw_upload_attachment). 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.",
52641
+ 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 response's top-level replyToId/inReplyTo always agree with its listData. 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.",
52454
52642
  // Destructive: with messageId, saving REPLACES the draft by creating a new
52455
52643
  // one and deleting the old (OFW has no draft update), so the old draft's
52456
52644
  // server content is gone. Not idempotent: every call mints a new draft id.
@@ -52461,7 +52649,8 @@ ${jsonText(
52461
52649
  recipientIds: external_exports.array(external_exports.number()).describe("Array of recipient user IDs (optional for drafts)").optional(),
52462
52650
  messageId: external_exports.number().describe("ID of an existing draft to replace (the new draft will have a new id; the old is deleted)").optional(),
52463
52651
  replyToId: external_exports.number().describe("ID of the message this draft replies to").optional(),
52464
- myFileIDs: external_exports.array(external_exports.number()).describe("Attachment file ids (from ofw_upload_attachment). When replacing a draft (messageId), omit it to KEEP the draft's current attachments; passing it replaces them.").optional(),
52652
+ myFileIDs: external_exports.array(external_exports.number()).describe("Attachment file ids (from ofw_upload_attachment) to attach. OurFamilyWizard does not store attachments on drafts, so they are HELD with this draft by this server and attached when you send it with ofw_send_message(draftId). When replacing a draft (messageId), the files already held are kept and these are added (de-duplicated); use removeFileIDs to drop one.").optional(),
52653
+ removeFileIDs: external_exports.array(external_exports.number()).describe("When replacing a draft: held attachment file ids to drop.").optional(),
52465
52654
  inlineAttachments: inlineAttachmentsParam,
52466
52655
  blobKeys: blobKeysParam,
52467
52656
  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(),
@@ -52476,6 +52665,8 @@ ${jsonText(
52476
52665
  );
52477
52666
  let forceNote = null;
52478
52667
  let serverFiles;
52668
+ let priorHeld = [];
52669
+ let serverRecipientIds;
52479
52670
  if (args.messageId !== void 0) {
52480
52671
  const guard = await guardDestructiveDraftOp({
52481
52672
  cache,
@@ -52487,6 +52678,9 @@ ${jsonText(
52487
52678
  if (!guard.ok) return guard.response;
52488
52679
  forceNote = guard.note;
52489
52680
  serverFiles = guard.server?.files;
52681
+ priorHeld = guard.heldFiles;
52682
+ const kept = (guard.server?.recipients ?? []).map((r) => r.userId).filter((id2) => id2 !== 0);
52683
+ if (kept.length > 0) serverRecipientIds = [...new Set(kept)];
52490
52684
  }
52491
52685
  const requestedReplyTo = args.replyToId ?? null;
52492
52686
  let resolvedReplyTo = requestedReplyTo;
@@ -52501,13 +52695,20 @@ ${jsonText(
52501
52695
  client: client2,
52502
52696
  cache,
52503
52697
  store: blobStore,
52504
- nothingWas: "saved"
52698
+ nothingWas: "saved",
52699
+ shareClass: "PRIVATE"
52505
52700
  });
52506
- const myFileIDs = [...args.myFileIDs ?? serverFiles ?? [], ...newFiles.map((f) => f.fileId)];
52701
+ const removed = new Set(args.removeFileIDs ?? []);
52702
+ const myFileIDs = uniqueIds([
52703
+ ...priorHeld,
52704
+ ...serverFiles ?? [],
52705
+ ...args.myFileIDs ?? [],
52706
+ ...newFiles.map((f) => f.fileId)
52707
+ ]).filter((id2) => !removed.has(id2));
52507
52708
  const payload = {
52508
52709
  subject: args.subject,
52509
52710
  body: args.body,
52510
- recipientIds: args.recipientIds ?? [],
52711
+ recipientIds: args.recipientIds ?? serverRecipientIds ?? [],
52511
52712
  attachments: { myFileIDs },
52512
52713
  draft: true,
52513
52714
  includeOriginal: resolvedReplyTo !== null,
@@ -52524,6 +52725,8 @@ ${jsonText(
52524
52725
  let verifyNote = null;
52525
52726
  let recipientsNote = null;
52526
52727
  let newRevision = null;
52728
+ let onDraft = [];
52729
+ let held = [];
52527
52730
  let draftKey = null;
52528
52731
  const warnings = [...uploadWarnings];
52529
52732
  if (newId !== null) {
@@ -52540,7 +52743,10 @@ ${jsonText(
52540
52743
  listData: detail
52541
52744
  };
52542
52745
  await cache.upsertDraft(persisted);
52543
- newRevision = draftRevision(persisted);
52746
+ onDraft = Array.isArray(detail.files) ? detail.files : [];
52747
+ held = myFileIDs.filter((id2) => !onDraft.includes(id2));
52748
+ await setHeldFiles(cache, newId, held);
52749
+ newRevision = draftRevision(persisted, held);
52544
52750
  const now = (/* @__PURE__ */ new Date()).toISOString();
52545
52751
  if (args.messageId !== void 0) {
52546
52752
  const prior = await cache.getDraftLineageById(args.messageId);
@@ -52586,20 +52792,12 @@ ${jsonText(
52586
52792
  );
52587
52793
  }
52588
52794
  }
52589
- if (myFileIDs.length > 0 && Array.isArray(detail.files)) {
52590
- const storedFiles = new Set(detail.files);
52591
- const missing = myFileIDs.filter((id2) => !storedFiles.has(id2));
52592
- if (missing.length > 0) {
52593
- warnings.push(
52594
- `Attachment fileId(s) ${missing.join(", ")} were requested in myFileIDs but are not attached to the saved draft. Re-upload or re-attach if needed.`
52595
- );
52596
- }
52597
- }
52598
52795
  if (args.messageId !== void 0 && args.messageId !== newId) {
52599
52796
  try {
52600
52797
  await deleteOFWMessages(client2, [args.messageId]);
52601
52798
  await cache.deleteDraft(args.messageId);
52602
- replaceNote = `NOTE: ofw_save_draft replaced draft ${args.messageId} via create-then-delete. The new draft id is ${newId}; the old draft has been deleted. The draftKey is UNCHANGED \u2014 key off it rather than the volatile id, which changes on every edit. (OFW's update-in-place endpoint silently no-ops on subsequent updates, so we never use it.) Fields carried over to the new draft: subject, body, recipients (${persisted.recipients.length}), replyToId (${persisted.replyToId === null ? "none" : persisted.replyToId}), attachments (${myFileIDs.length}).${warnings.length > 0 ? " See warnings above for any field OurFamilyWizard did not carry over." : ""}`;
52799
+ await clearHeldFiles(cache, args.messageId);
52800
+ replaceNote = `NOTE: ofw_save_draft replaced draft ${args.messageId} via create-then-delete. The new draft id is ${newId}; the old draft has been deleted. The draftKey is UNCHANGED \u2014 key off it rather than the volatile id, which changes on every edit. (OFW's update-in-place endpoint silently no-ops on subsequent updates, so we never use it.) Fields carried over to the new draft: subject, body, recipients (${persisted.recipients.length}), replyToId (${persisted.replyToId === null ? "none" : persisted.replyToId}), attachments: ${onDraft.length} on the draft, ${held.length} held for send.${warnings.length > 0 ? " See warnings above for any field OurFamilyWizard did not carry over." : ""}`;
52603
52801
  } catch (e) {
52604
52802
  replaceNote = `WARNING: New draft ${newId} was created successfully, but the old draft ${args.messageId} could NOT be deleted: ${e.message}. BOTH drafts now exist on OurFamilyWizard and nothing was lost. Verify ${newId} reads correctly, then remove ${args.messageId} with ofw_delete_draft.`;
52605
52803
  }
@@ -52613,6 +52811,11 @@ ${jsonText(
52613
52811
  previousId: args.messageId ?? null,
52614
52812
  cacheStatus: "fresh",
52615
52813
  serverConfirmed: true,
52814
+ attachments: {
52815
+ onDraft,
52816
+ held: await describeHeld(cache, held),
52817
+ ...held.length > 0 ? { note: HELD_NOTE } : {}
52818
+ },
52616
52819
  ...newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {},
52617
52820
  ...warnings.length > 0 ? { warnings } : {},
52618
52821
  ...recipientsNote !== null ? { recipientsNote } : {}
@@ -52645,6 +52848,7 @@ ${jsonText(
52645
52848
  if (!guard.ok) return guard.response;
52646
52849
  const data = await deleteOFWMessages(client2, [args.messageId]);
52647
52850
  await cache.deleteDraft(args.messageId);
52851
+ await clearHeldFiles(cache, args.messageId);
52648
52852
  return notedJsonResponse([guard.note], data, "Draft deleted.");
52649
52853
  });
52650
52854
  server.registerTool("ofw_get_unread_sent", {
@@ -52787,7 +52991,7 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
52787
52991
  if (args.uploadSlots !== void 0) {
52788
52992
  checkFileCount(args.uploadSlots.length, "uploadSlots");
52789
52993
  const store2 = requireBlobStore(blobStoreFromEnv(), "uploadSlots");
52790
- const slots = args.uploadSlots.map((req) => mintUploadSlot(store2, req));
52994
+ const slots = args.uploadSlots.map((req) => mintUploadSlot2(store2, req));
52791
52995
  return jsonResponse({
52792
52996
  next: "Nothing has been uploaded to OurFamilyWizard yet. PUT each file to its uploadUrl with the slot's Content-Type (each slot's curl does exactly that \u2014 replace the @'<path \u2026>' with the file), then call ofw_upload_attachment with blobKeys (in this order) plus any shareClass/label. The URLs stop working at expiresAt.",
52793
52997
  blobKeys: slots.map((slot) => slot.blobKey),
@@ -52825,10 +53029,10 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
52825
53029
  results.push({ index, ok: true, ...await uploadToMyFiles(client2, cache, upload, opts) });
52826
53030
  continue;
52827
53031
  }
52828
- const key = args.blobKeys[index];
52829
- fileNameFromBlobKey(key);
52830
- const out = await store.consume(key, async (object2) => {
52831
- const upload = blobObjectToUpload(key, object2);
53032
+ const key2 = args.blobKeys[index];
53033
+ fileNameFromBlobKey(key2);
53034
+ const out = await store.consume(key2, async (object2) => {
53035
+ const upload = blobObjectToUpload(key2, object2);
52832
53036
  const gate = await shareGate(ctx, args, upload, opts, confirmToken);
52833
53037
  if (gate) throw new GateHalt(gate);
52834
53038
  return uploadToMyFiles(client2, cache, upload, opts);
@@ -52909,9 +53113,9 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
52909
53113
  }
52910
53114
  const linkDelivery = async (bytes, fileName2, mimeType2, note) => {
52911
53115
  const keyName = `${fileId}-${basename3(fileName2)}`.replace(/[^A-Za-z0-9._~-]/g, "_").replace(/^\.+/, "_");
52912
- const key = `attachments/${randomUUID3()}/${keyName}`;
52913
- await store.put(key, new Uint8Array(bytes), mimeType2);
52914
- const signed = store.signGetUrl(key, { ttlMs: (args.linkMinutes ?? 60) * 6e4 });
53116
+ const key2 = `attachments/${randomUUID3()}/${keyName}`;
53117
+ await store.put(key2, new Uint8Array(bytes), mimeType2);
53118
+ const signed = store.signGetUrl(key2, { ttlMs: (args.linkMinutes ?? 60) * 6e4 });
52915
53119
  return jsonResponse({
52916
53120
  fileId,
52917
53121
  deliveredVia: "link",
@@ -53184,11 +53388,15 @@ Up to ${MAX_FILES_PER_CALL} files per call; each must be non-empty and at most 2
53184
53388
  const keyById = new Map(
53185
53389
  (await cache.getDraftLineageByIds(rows.map((d) => d.id))).map((l) => [l.id, l.draftKey])
53186
53390
  );
53391
+ const held = await heldFilesFor(cache, rows.map((d) => d.id));
53392
+ const inferred = await inferredDraftKeys(cache, rows.map((d) => d.id));
53187
53393
  drafts = rows.map((d) => ({
53188
53394
  id: d.id,
53189
53395
  draftKey: keyById.get(d.id) ?? null,
53396
+ ...inferred.has(d.id) ? { draftKeyInferred: true } : {},
53190
53397
  subject: d.subject,
53191
- revision: draftRevision(d),
53398
+ revision: draftRevision(d, held.get(d.id)),
53399
+ ...held.get(d.id).length > 0 ? { heldFiles: held.get(d.id) } : {},
53192
53400
  modifiedAt: d.modifiedAt,
53193
53401
  recipients: d.recipients,
53194
53402
  replyToId: d.replyToId,
@@ -53677,9 +53885,9 @@ function registerCalendarTools(server, client2, attachmentIO = new NodeAttachmen
53677
53885
  const fileName = `ofw-calendar-${args.startDate}_${args.endDate}-${now.toISOString().replace(/[-:]/g, "").slice(0, 15)}Z.ics`;
53678
53886
  const blob = blobStoreFromEnv();
53679
53887
  if (blob) {
53680
- const key = `calendar/${randomUUID4()}/${fileName}`;
53681
- await blob.put(key, built.ics, "text/calendar");
53682
- const link2 = blob.signGetUrl(key, { ttlMs: (args.linkMinutes ?? 60) * 6e4 });
53888
+ const key2 = `calendar/${randomUUID4()}/${fileName}`;
53889
+ await blob.put(key2, built.ics, "text/calendar");
53890
+ const link2 = blob.signGetUrl(key2, { ttlMs: (args.linkMinutes ?? 60) * 6e4 });
53683
53891
  return jsonResponse({
53684
53892
  delivered: "link",
53685
53893
  url: link2.url,
@@ -54159,10 +54367,10 @@ var ARG_FOR = {
54159
54367
  };
54160
54368
  var isRecord3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
54161
54369
  var positiveInt = (v) => typeof v === "number" && Number.isInteger(v) && v > 0 ? v : void 0;
54162
- var refId = (v, key) => positiveInt(v) ?? (isRecord3(v) ? positiveInt(v[key]) ?? positiveInt(v.id) : void 0);
54163
- var idList = (v, key) => {
54370
+ var refId = (v, key2) => positiveInt(v) ?? (isRecord3(v) ? positiveInt(v[key2]) ?? positiveInt(v.id) : void 0);
54371
+ var idList = (v, key2) => {
54164
54372
  if (!Array.isArray(v)) return void 0;
54165
- const ids = v.map((x) => refId(x, key));
54373
+ const ids = v.map((x) => refId(x, key2));
54166
54374
  return ids.every((id2) => id2 !== void 0) ? ids : void 0;
54167
54375
  };
54168
54376
  function readExpenseState(raw) {
@@ -54186,9 +54394,9 @@ function readExpenseState(raw) {
54186
54394
  if (d.description === null || d.description === "") out.description = null;
54187
54395
  else if (typeof d.description === "string") out.description = d.description;
54188
54396
  }
54189
- for (const key of ["fileIds", "files"]) {
54190
- if (!(key in d)) continue;
54191
- const ids = d[key] === null ? [] : idList(d[key], "fileId");
54397
+ for (const key2 of ["fileIds", "files"]) {
54398
+ if (!(key2 in d)) continue;
54399
+ const ids = d[key2] === null ? [] : idList(d[key2], "fileId");
54192
54400
  if (ids !== void 0) out.fileIds = ids;
54193
54401
  break;
54194
54402
  }
@@ -54977,14 +55185,14 @@ var OFWCacheCore = class {
54977
55185
  [folder, state.lastSyncAt, nullish3(state.newestId), nullish3(state.resumePage)]
54978
55186
  );
54979
55187
  }
54980
- getMeta(key) {
54981
- const r = this.db.get("SELECT value FROM meta WHERE key = ?", [key]);
55188
+ getMeta(key2) {
55189
+ const r = this.db.get("SELECT value FROM meta WHERE key = ?", [key2]);
54982
55190
  return r ? r.value : null;
54983
55191
  }
54984
- setMeta(key, value) {
55192
+ setMeta(key2, value) {
54985
55193
  this.db.run(
54986
55194
  "INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value",
54987
- [key, value]
55195
+ [key2, value]
54988
55196
  );
54989
55197
  }
54990
55198
  findLatestReplyTip(replyToId) {
@@ -55124,11 +55332,11 @@ var LocalCacheStore = class {
55124
55332
  async setSyncState(folder, state) {
55125
55333
  this.core.setSyncState(folder, state);
55126
55334
  }
55127
- async getMeta(key) {
55128
- return this.core.getMeta(key);
55335
+ async getMeta(key2) {
55336
+ return this.core.getMeta(key2);
55129
55337
  }
55130
- async setMeta(key, value) {
55131
- this.core.setMeta(key, value);
55338
+ async setMeta(key2, value) {
55339
+ this.core.setMeta(key2, value);
55132
55340
  }
55133
55341
  async findLatestReplyTip(replyToId) {
55134
55342
  return this.core.findLatestReplyTip(replyToId);