open-mcp-app 0.0.13 → 0.0.15

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.
@@ -24,9 +24,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  mod
25
25
  ));
26
26
 
27
- // ../../node_modules/ajv/dist/compile/codegen/code.js
27
+ // node_modules/ajv/dist/compile/codegen/code.js
28
28
  var require_code = __commonJS({
29
- "../../node_modules/ajv/dist/compile/codegen/code.js"(exports) {
29
+ "node_modules/ajv/dist/compile/codegen/code.js"(exports) {
30
30
  "use strict";
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
@@ -178,9 +178,9 @@ var require_code = __commonJS({
178
178
  }
179
179
  });
180
180
 
181
- // ../../node_modules/ajv/dist/compile/codegen/scope.js
181
+ // node_modules/ajv/dist/compile/codegen/scope.js
182
182
  var require_scope = __commonJS({
183
- "../../node_modules/ajv/dist/compile/codegen/scope.js"(exports) {
183
+ "node_modules/ajv/dist/compile/codegen/scope.js"(exports) {
184
184
  "use strict";
185
185
  Object.defineProperty(exports, "__esModule", { value: true });
186
186
  exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
@@ -323,9 +323,9 @@ var require_scope = __commonJS({
323
323
  }
324
324
  });
325
325
 
326
- // ../../node_modules/ajv/dist/compile/codegen/index.js
326
+ // node_modules/ajv/dist/compile/codegen/index.js
327
327
  var require_codegen = __commonJS({
328
- "../../node_modules/ajv/dist/compile/codegen/index.js"(exports) {
328
+ "node_modules/ajv/dist/compile/codegen/index.js"(exports) {
329
329
  "use strict";
330
330
  Object.defineProperty(exports, "__esModule", { value: true });
331
331
  exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
@@ -1043,9 +1043,9 @@ var require_codegen = __commonJS({
1043
1043
  }
1044
1044
  });
1045
1045
 
1046
- // ../../node_modules/ajv/dist/compile/util.js
1046
+ // node_modules/ajv/dist/compile/util.js
1047
1047
  var require_util = __commonJS({
1048
- "../../node_modules/ajv/dist/compile/util.js"(exports) {
1048
+ "node_modules/ajv/dist/compile/util.js"(exports) {
1049
1049
  "use strict";
1050
1050
  Object.defineProperty(exports, "__esModule", { value: true });
1051
1051
  exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
@@ -1210,9 +1210,9 @@ var require_util = __commonJS({
1210
1210
  }
1211
1211
  });
1212
1212
 
1213
- // ../../node_modules/ajv/dist/compile/names.js
1213
+ // node_modules/ajv/dist/compile/names.js
1214
1214
  var require_names = __commonJS({
1215
- "../../node_modules/ajv/dist/compile/names.js"(exports) {
1215
+ "node_modules/ajv/dist/compile/names.js"(exports) {
1216
1216
  "use strict";
1217
1217
  Object.defineProperty(exports, "__esModule", { value: true });
1218
1218
  var codegen_1 = require_codegen();
@@ -1249,9 +1249,9 @@ var require_names = __commonJS({
1249
1249
  }
1250
1250
  });
1251
1251
 
1252
- // ../../node_modules/ajv/dist/compile/errors.js
1252
+ // node_modules/ajv/dist/compile/errors.js
1253
1253
  var require_errors = __commonJS({
1254
- "../../node_modules/ajv/dist/compile/errors.js"(exports) {
1254
+ "node_modules/ajv/dist/compile/errors.js"(exports) {
1255
1255
  "use strict";
1256
1256
  Object.defineProperty(exports, "__esModule", { value: true });
1257
1257
  exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
@@ -1371,9 +1371,9 @@ var require_errors = __commonJS({
1371
1371
  }
1372
1372
  });
1373
1373
 
1374
- // ../../node_modules/ajv/dist/compile/validate/boolSchema.js
1374
+ // node_modules/ajv/dist/compile/validate/boolSchema.js
1375
1375
  var require_boolSchema = __commonJS({
1376
- "../../node_modules/ajv/dist/compile/validate/boolSchema.js"(exports) {
1376
+ "node_modules/ajv/dist/compile/validate/boolSchema.js"(exports) {
1377
1377
  "use strict";
1378
1378
  Object.defineProperty(exports, "__esModule", { value: true });
1379
1379
  exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
@@ -1422,9 +1422,9 @@ var require_boolSchema = __commonJS({
1422
1422
  }
1423
1423
  });
1424
1424
 
1425
- // ../../node_modules/ajv/dist/compile/rules.js
1425
+ // node_modules/ajv/dist/compile/rules.js
1426
1426
  var require_rules = __commonJS({
1427
- "../../node_modules/ajv/dist/compile/rules.js"(exports) {
1427
+ "node_modules/ajv/dist/compile/rules.js"(exports) {
1428
1428
  "use strict";
1429
1429
  Object.defineProperty(exports, "__esModule", { value: true });
1430
1430
  exports.getRules = exports.isJSONType = void 0;
@@ -1453,9 +1453,9 @@ var require_rules = __commonJS({
1453
1453
  }
1454
1454
  });
1455
1455
 
1456
- // ../../node_modules/ajv/dist/compile/validate/applicability.js
1456
+ // node_modules/ajv/dist/compile/validate/applicability.js
1457
1457
  var require_applicability = __commonJS({
1458
- "../../node_modules/ajv/dist/compile/validate/applicability.js"(exports) {
1458
+ "node_modules/ajv/dist/compile/validate/applicability.js"(exports) {
1459
1459
  "use strict";
1460
1460
  Object.defineProperty(exports, "__esModule", { value: true });
1461
1461
  exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
@@ -1476,9 +1476,9 @@ var require_applicability = __commonJS({
1476
1476
  }
1477
1477
  });
1478
1478
 
1479
- // ../../node_modules/ajv/dist/compile/validate/dataType.js
1479
+ // node_modules/ajv/dist/compile/validate/dataType.js
1480
1480
  var require_dataType = __commonJS({
1481
- "../../node_modules/ajv/dist/compile/validate/dataType.js"(exports) {
1481
+ "node_modules/ajv/dist/compile/validate/dataType.js"(exports) {
1482
1482
  "use strict";
1483
1483
  Object.defineProperty(exports, "__esModule", { value: true });
1484
1484
  exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
@@ -1660,9 +1660,9 @@ var require_dataType = __commonJS({
1660
1660
  }
1661
1661
  });
1662
1662
 
1663
- // ../../node_modules/ajv/dist/compile/validate/defaults.js
1663
+ // node_modules/ajv/dist/compile/validate/defaults.js
1664
1664
  var require_defaults = __commonJS({
1665
- "../../node_modules/ajv/dist/compile/validate/defaults.js"(exports) {
1665
+ "node_modules/ajv/dist/compile/validate/defaults.js"(exports) {
1666
1666
  "use strict";
1667
1667
  Object.defineProperty(exports, "__esModule", { value: true });
1668
1668
  exports.assignDefaults = void 0;
@@ -1697,9 +1697,9 @@ var require_defaults = __commonJS({
1697
1697
  }
1698
1698
  });
1699
1699
 
1700
- // ../../node_modules/ajv/dist/vocabularies/code.js
1700
+ // node_modules/ajv/dist/vocabularies/code.js
1701
1701
  var require_code2 = __commonJS({
1702
- "../../node_modules/ajv/dist/vocabularies/code.js"(exports) {
1702
+ "node_modules/ajv/dist/vocabularies/code.js"(exports) {
1703
1703
  "use strict";
1704
1704
  Object.defineProperty(exports, "__esModule", { value: true });
1705
1705
  exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0;
@@ -1830,9 +1830,9 @@ var require_code2 = __commonJS({
1830
1830
  }
1831
1831
  });
1832
1832
 
1833
- // ../../node_modules/ajv/dist/compile/validate/keyword.js
1833
+ // node_modules/ajv/dist/compile/validate/keyword.js
1834
1834
  var require_keyword = __commonJS({
1835
- "../../node_modules/ajv/dist/compile/validate/keyword.js"(exports) {
1835
+ "node_modules/ajv/dist/compile/validate/keyword.js"(exports) {
1836
1836
  "use strict";
1837
1837
  Object.defineProperty(exports, "__esModule", { value: true });
1838
1838
  exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;
@@ -1948,9 +1948,9 @@ var require_keyword = __commonJS({
1948
1948
  }
1949
1949
  });
1950
1950
 
1951
- // ../../node_modules/ajv/dist/compile/validate/subschema.js
1951
+ // node_modules/ajv/dist/compile/validate/subschema.js
1952
1952
  var require_subschema = __commonJS({
1953
- "../../node_modules/ajv/dist/compile/validate/subschema.js"(exports) {
1953
+ "node_modules/ajv/dist/compile/validate/subschema.js"(exports) {
1954
1954
  "use strict";
1955
1955
  Object.defineProperty(exports, "__esModule", { value: true });
1956
1956
  exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
@@ -2031,9 +2031,9 @@ var require_subschema = __commonJS({
2031
2031
  }
2032
2032
  });
2033
2033
 
2034
- // ../../node_modules/fast-deep-equal/index.js
2034
+ // node_modules/fast-deep-equal/index.js
2035
2035
  var require_fast_deep_equal = __commonJS({
2036
- "../../node_modules/fast-deep-equal/index.js"(exports, module) {
2036
+ "node_modules/fast-deep-equal/index.js"(exports, module) {
2037
2037
  "use strict";
2038
2038
  module.exports = function equal(a, b) {
2039
2039
  if (a === b) return true;
@@ -2066,9 +2066,9 @@ var require_fast_deep_equal = __commonJS({
2066
2066
  }
2067
2067
  });
2068
2068
 
2069
- // ../../node_modules/json-schema-traverse/index.js
2069
+ // node_modules/json-schema-traverse/index.js
2070
2070
  var require_json_schema_traverse = __commonJS({
2071
- "../../node_modules/json-schema-traverse/index.js"(exports, module) {
2071
+ "node_modules/json-schema-traverse/index.js"(exports, module) {
2072
2072
  "use strict";
2073
2073
  var traverse = module.exports = function(schema, opts, cb) {
2074
2074
  if (typeof opts == "function") {
@@ -2154,9 +2154,9 @@ var require_json_schema_traverse = __commonJS({
2154
2154
  }
2155
2155
  });
2156
2156
 
2157
- // ../../node_modules/ajv/dist/compile/resolve.js
2157
+ // node_modules/ajv/dist/compile/resolve.js
2158
2158
  var require_resolve = __commonJS({
2159
- "../../node_modules/ajv/dist/compile/resolve.js"(exports) {
2159
+ "node_modules/ajv/dist/compile/resolve.js"(exports) {
2160
2160
  "use strict";
2161
2161
  Object.defineProperty(exports, "__esModule", { value: true });
2162
2162
  exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0;
@@ -2310,9 +2310,9 @@ var require_resolve = __commonJS({
2310
2310
  }
2311
2311
  });
2312
2312
 
2313
- // ../../node_modules/ajv/dist/compile/validate/index.js
2313
+ // node_modules/ajv/dist/compile/validate/index.js
2314
2314
  var require_validate = __commonJS({
2315
- "../../node_modules/ajv/dist/compile/validate/index.js"(exports) {
2315
+ "node_modules/ajv/dist/compile/validate/index.js"(exports) {
2316
2316
  "use strict";
2317
2317
  Object.defineProperty(exports, "__esModule", { value: true });
2318
2318
  exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;
@@ -2818,9 +2818,9 @@ var require_validate = __commonJS({
2818
2818
  }
2819
2819
  });
2820
2820
 
2821
- // ../../node_modules/ajv/dist/runtime/validation_error.js
2821
+ // node_modules/ajv/dist/runtime/validation_error.js
2822
2822
  var require_validation_error = __commonJS({
2823
- "../../node_modules/ajv/dist/runtime/validation_error.js"(exports) {
2823
+ "node_modules/ajv/dist/runtime/validation_error.js"(exports) {
2824
2824
  "use strict";
2825
2825
  Object.defineProperty(exports, "__esModule", { value: true });
2826
2826
  var ValidationError = class extends Error {
@@ -2834,9 +2834,9 @@ var require_validation_error = __commonJS({
2834
2834
  }
2835
2835
  });
2836
2836
 
2837
- // ../../node_modules/ajv/dist/compile/ref_error.js
2837
+ // node_modules/ajv/dist/compile/ref_error.js
2838
2838
  var require_ref_error = __commonJS({
2839
- "../../node_modules/ajv/dist/compile/ref_error.js"(exports) {
2839
+ "node_modules/ajv/dist/compile/ref_error.js"(exports) {
2840
2840
  "use strict";
2841
2841
  Object.defineProperty(exports, "__esModule", { value: true });
2842
2842
  var resolve_1 = require_resolve();
@@ -2851,9 +2851,9 @@ var require_ref_error = __commonJS({
2851
2851
  }
2852
2852
  });
2853
2853
 
2854
- // ../../node_modules/ajv/dist/compile/index.js
2854
+ // node_modules/ajv/dist/compile/index.js
2855
2855
  var require_compile = __commonJS({
2856
- "../../node_modules/ajv/dist/compile/index.js"(exports) {
2856
+ "node_modules/ajv/dist/compile/index.js"(exports) {
2857
2857
  "use strict";
2858
2858
  Object.defineProperty(exports, "__esModule", { value: true });
2859
2859
  exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;
@@ -3075,9 +3075,9 @@ var require_compile = __commonJS({
3075
3075
  }
3076
3076
  });
3077
3077
 
3078
- // ../../node_modules/ajv/dist/refs/data.json
3078
+ // node_modules/ajv/dist/refs/data.json
3079
3079
  var require_data = __commonJS({
3080
- "../../node_modules/ajv/dist/refs/data.json"(exports, module) {
3080
+ "node_modules/ajv/dist/refs/data.json"(exports, module) {
3081
3081
  module.exports = {
3082
3082
  $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
3083
3083
  description: "Meta-schema for $data reference (JSON AnySchema extension proposal)",
@@ -3094,9 +3094,9 @@ var require_data = __commonJS({
3094
3094
  }
3095
3095
  });
3096
3096
 
3097
- // ../../node_modules/fast-uri/lib/utils.js
3097
+ // node_modules/fast-uri/lib/utils.js
3098
3098
  var require_utils = __commonJS({
3099
- "../../node_modules/fast-uri/lib/utils.js"(exports, module) {
3099
+ "node_modules/fast-uri/lib/utils.js"(exports, module) {
3100
3100
  "use strict";
3101
3101
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3102
3102
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
@@ -3351,9 +3351,9 @@ var require_utils = __commonJS({
3351
3351
  }
3352
3352
  });
3353
3353
 
3354
- // ../../node_modules/fast-uri/lib/schemes.js
3354
+ // node_modules/fast-uri/lib/schemes.js
3355
3355
  var require_schemes = __commonJS({
3356
- "../../node_modules/fast-uri/lib/schemes.js"(exports, module) {
3356
+ "node_modules/fast-uri/lib/schemes.js"(exports, module) {
3357
3357
  "use strict";
3358
3358
  var { isUUID } = require_utils();
3359
3359
  var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
@@ -3561,9 +3561,9 @@ var require_schemes = __commonJS({
3561
3561
  }
3562
3562
  });
3563
3563
 
3564
- // ../../node_modules/fast-uri/index.js
3564
+ // node_modules/fast-uri/index.js
3565
3565
  var require_fast_uri = __commonJS({
3566
- "../../node_modules/fast-uri/index.js"(exports, module) {
3566
+ "node_modules/fast-uri/index.js"(exports, module) {
3567
3567
  "use strict";
3568
3568
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
3569
3569
  var { SCHEMES, getSchemeHandler } = require_schemes();
@@ -3816,9 +3816,9 @@ var require_fast_uri = __commonJS({
3816
3816
  }
3817
3817
  });
3818
3818
 
3819
- // ../../node_modules/ajv/dist/runtime/uri.js
3819
+ // node_modules/ajv/dist/runtime/uri.js
3820
3820
  var require_uri = __commonJS({
3821
- "../../node_modules/ajv/dist/runtime/uri.js"(exports) {
3821
+ "node_modules/ajv/dist/runtime/uri.js"(exports) {
3822
3822
  "use strict";
3823
3823
  Object.defineProperty(exports, "__esModule", { value: true });
3824
3824
  var uri = require_fast_uri();
@@ -3827,9 +3827,9 @@ var require_uri = __commonJS({
3827
3827
  }
3828
3828
  });
3829
3829
 
3830
- // ../../node_modules/ajv/dist/core.js
3830
+ // node_modules/ajv/dist/core.js
3831
3831
  var require_core = __commonJS({
3832
- "../../node_modules/ajv/dist/core.js"(exports) {
3832
+ "node_modules/ajv/dist/core.js"(exports) {
3833
3833
  "use strict";
3834
3834
  Object.defineProperty(exports, "__esModule", { value: true });
3835
3835
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
@@ -4438,9 +4438,9 @@ var require_core = __commonJS({
4438
4438
  }
4439
4439
  });
4440
4440
 
4441
- // ../../node_modules/ajv/dist/vocabularies/core/id.js
4441
+ // node_modules/ajv/dist/vocabularies/core/id.js
4442
4442
  var require_id = __commonJS({
4443
- "../../node_modules/ajv/dist/vocabularies/core/id.js"(exports) {
4443
+ "node_modules/ajv/dist/vocabularies/core/id.js"(exports) {
4444
4444
  "use strict";
4445
4445
  Object.defineProperty(exports, "__esModule", { value: true });
4446
4446
  var def = {
@@ -4453,9 +4453,9 @@ var require_id = __commonJS({
4453
4453
  }
4454
4454
  });
4455
4455
 
4456
- // ../../node_modules/ajv/dist/vocabularies/core/ref.js
4456
+ // node_modules/ajv/dist/vocabularies/core/ref.js
4457
4457
  var require_ref = __commonJS({
4458
- "../../node_modules/ajv/dist/vocabularies/core/ref.js"(exports) {
4458
+ "node_modules/ajv/dist/vocabularies/core/ref.js"(exports) {
4459
4459
  "use strict";
4460
4460
  Object.defineProperty(exports, "__esModule", { value: true });
4461
4461
  exports.callRef = exports.getValidate = void 0;
@@ -4575,9 +4575,9 @@ var require_ref = __commonJS({
4575
4575
  }
4576
4576
  });
4577
4577
 
4578
- // ../../node_modules/ajv/dist/vocabularies/core/index.js
4578
+ // node_modules/ajv/dist/vocabularies/core/index.js
4579
4579
  var require_core2 = __commonJS({
4580
- "../../node_modules/ajv/dist/vocabularies/core/index.js"(exports) {
4580
+ "node_modules/ajv/dist/vocabularies/core/index.js"(exports) {
4581
4581
  "use strict";
4582
4582
  Object.defineProperty(exports, "__esModule", { value: true });
4583
4583
  var id_1 = require_id();
@@ -4596,9 +4596,9 @@ var require_core2 = __commonJS({
4596
4596
  }
4597
4597
  });
4598
4598
 
4599
- // ../../node_modules/ajv/dist/vocabularies/validation/limitNumber.js
4599
+ // node_modules/ajv/dist/vocabularies/validation/limitNumber.js
4600
4600
  var require_limitNumber = __commonJS({
4601
- "../../node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports) {
4601
+ "node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports) {
4602
4602
  "use strict";
4603
4603
  Object.defineProperty(exports, "__esModule", { value: true });
4604
4604
  var codegen_1 = require_codegen();
@@ -4628,9 +4628,9 @@ var require_limitNumber = __commonJS({
4628
4628
  }
4629
4629
  });
4630
4630
 
4631
- // ../../node_modules/ajv/dist/vocabularies/validation/multipleOf.js
4631
+ // node_modules/ajv/dist/vocabularies/validation/multipleOf.js
4632
4632
  var require_multipleOf = __commonJS({
4633
- "../../node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports) {
4633
+ "node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports) {
4634
4634
  "use strict";
4635
4635
  Object.defineProperty(exports, "__esModule", { value: true });
4636
4636
  var codegen_1 = require_codegen();
@@ -4656,9 +4656,9 @@ var require_multipleOf = __commonJS({
4656
4656
  }
4657
4657
  });
4658
4658
 
4659
- // ../../node_modules/ajv/dist/runtime/ucs2length.js
4659
+ // node_modules/ajv/dist/runtime/ucs2length.js
4660
4660
  var require_ucs2length = __commonJS({
4661
- "../../node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
4661
+ "node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
4662
4662
  "use strict";
4663
4663
  Object.defineProperty(exports, "__esModule", { value: true });
4664
4664
  function ucs2length(str) {
@@ -4682,9 +4682,9 @@ var require_ucs2length = __commonJS({
4682
4682
  }
4683
4683
  });
4684
4684
 
4685
- // ../../node_modules/ajv/dist/vocabularies/validation/limitLength.js
4685
+ // node_modules/ajv/dist/vocabularies/validation/limitLength.js
4686
4686
  var require_limitLength = __commonJS({
4687
- "../../node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports) {
4687
+ "node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports) {
4688
4688
  "use strict";
4689
4689
  Object.defineProperty(exports, "__esModule", { value: true });
4690
4690
  var codegen_1 = require_codegen();
@@ -4714,12 +4714,13 @@ var require_limitLength = __commonJS({
4714
4714
  }
4715
4715
  });
4716
4716
 
4717
- // ../../node_modules/ajv/dist/vocabularies/validation/pattern.js
4717
+ // node_modules/ajv/dist/vocabularies/validation/pattern.js
4718
4718
  var require_pattern = __commonJS({
4719
- "../../node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) {
4719
+ "node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) {
4720
4720
  "use strict";
4721
4721
  Object.defineProperty(exports, "__esModule", { value: true });
4722
4722
  var code_1 = require_code2();
4723
+ var util_1 = require_util();
4723
4724
  var codegen_1 = require_codegen();
4724
4725
  var error = {
4725
4726
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -4732,19 +4733,27 @@ var require_pattern = __commonJS({
4732
4733
  $data: true,
4733
4734
  error,
4734
4735
  code(cxt) {
4735
- const { data, $data, schema, schemaCode, it } = cxt;
4736
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
4736
4737
  const u = it.opts.unicodeRegExp ? "u" : "";
4737
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
4738
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4738
+ if ($data) {
4739
+ const { regExp } = it.opts.code;
4740
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
4741
+ const valid = gen.let("valid");
4742
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
4743
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
4744
+ } else {
4745
+ const regExp = (0, code_1.usePattern)(cxt, schema);
4746
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4747
+ }
4739
4748
  }
4740
4749
  };
4741
4750
  exports.default = def;
4742
4751
  }
4743
4752
  });
4744
4753
 
4745
- // ../../node_modules/ajv/dist/vocabularies/validation/limitProperties.js
4754
+ // node_modules/ajv/dist/vocabularies/validation/limitProperties.js
4746
4755
  var require_limitProperties = __commonJS({
4747
- "../../node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports) {
4756
+ "node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports) {
4748
4757
  "use strict";
4749
4758
  Object.defineProperty(exports, "__esModule", { value: true });
4750
4759
  var codegen_1 = require_codegen();
@@ -4771,9 +4780,9 @@ var require_limitProperties = __commonJS({
4771
4780
  }
4772
4781
  });
4773
4782
 
4774
- // ../../node_modules/ajv/dist/vocabularies/validation/required.js
4783
+ // node_modules/ajv/dist/vocabularies/validation/required.js
4775
4784
  var require_required = __commonJS({
4776
- "../../node_modules/ajv/dist/vocabularies/validation/required.js"(exports) {
4785
+ "node_modules/ajv/dist/vocabularies/validation/required.js"(exports) {
4777
4786
  "use strict";
4778
4787
  Object.defineProperty(exports, "__esModule", { value: true });
4779
4788
  var code_1 = require_code2();
@@ -4853,9 +4862,9 @@ var require_required = __commonJS({
4853
4862
  }
4854
4863
  });
4855
4864
 
4856
- // ../../node_modules/ajv/dist/vocabularies/validation/limitItems.js
4865
+ // node_modules/ajv/dist/vocabularies/validation/limitItems.js
4857
4866
  var require_limitItems = __commonJS({
4858
- "../../node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports) {
4867
+ "node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports) {
4859
4868
  "use strict";
4860
4869
  Object.defineProperty(exports, "__esModule", { value: true });
4861
4870
  var codegen_1 = require_codegen();
@@ -4882,9 +4891,9 @@ var require_limitItems = __commonJS({
4882
4891
  }
4883
4892
  });
4884
4893
 
4885
- // ../../node_modules/ajv/dist/runtime/equal.js
4894
+ // node_modules/ajv/dist/runtime/equal.js
4886
4895
  var require_equal = __commonJS({
4887
- "../../node_modules/ajv/dist/runtime/equal.js"(exports) {
4896
+ "node_modules/ajv/dist/runtime/equal.js"(exports) {
4888
4897
  "use strict";
4889
4898
  Object.defineProperty(exports, "__esModule", { value: true });
4890
4899
  var equal = require_fast_deep_equal();
@@ -4893,9 +4902,9 @@ var require_equal = __commonJS({
4893
4902
  }
4894
4903
  });
4895
4904
 
4896
- // ../../node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
4905
+ // node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
4897
4906
  var require_uniqueItems = __commonJS({
4898
- "../../node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports) {
4907
+ "node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports) {
4899
4908
  "use strict";
4900
4909
  Object.defineProperty(exports, "__esModule", { value: true });
4901
4910
  var dataType_1 = require_dataType();
@@ -4960,9 +4969,9 @@ var require_uniqueItems = __commonJS({
4960
4969
  }
4961
4970
  });
4962
4971
 
4963
- // ../../node_modules/ajv/dist/vocabularies/validation/const.js
4972
+ // node_modules/ajv/dist/vocabularies/validation/const.js
4964
4973
  var require_const = __commonJS({
4965
- "../../node_modules/ajv/dist/vocabularies/validation/const.js"(exports) {
4974
+ "node_modules/ajv/dist/vocabularies/validation/const.js"(exports) {
4966
4975
  "use strict";
4967
4976
  Object.defineProperty(exports, "__esModule", { value: true });
4968
4977
  var codegen_1 = require_codegen();
@@ -4989,9 +4998,9 @@ var require_const = __commonJS({
4989
4998
  }
4990
4999
  });
4991
5000
 
4992
- // ../../node_modules/ajv/dist/vocabularies/validation/enum.js
5001
+ // node_modules/ajv/dist/vocabularies/validation/enum.js
4993
5002
  var require_enum = __commonJS({
4994
- "../../node_modules/ajv/dist/vocabularies/validation/enum.js"(exports) {
5003
+ "node_modules/ajv/dist/vocabularies/validation/enum.js"(exports) {
4995
5004
  "use strict";
4996
5005
  Object.defineProperty(exports, "__esModule", { value: true });
4997
5006
  var codegen_1 = require_codegen();
@@ -5038,9 +5047,9 @@ var require_enum = __commonJS({
5038
5047
  }
5039
5048
  });
5040
5049
 
5041
- // ../../node_modules/ajv/dist/vocabularies/validation/index.js
5050
+ // node_modules/ajv/dist/vocabularies/validation/index.js
5042
5051
  var require_validation = __commonJS({
5043
- "../../node_modules/ajv/dist/vocabularies/validation/index.js"(exports) {
5052
+ "node_modules/ajv/dist/vocabularies/validation/index.js"(exports) {
5044
5053
  "use strict";
5045
5054
  Object.defineProperty(exports, "__esModule", { value: true });
5046
5055
  var limitNumber_1 = require_limitNumber();
@@ -5076,9 +5085,9 @@ var require_validation = __commonJS({
5076
5085
  }
5077
5086
  });
5078
5087
 
5079
- // ../../node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
5088
+ // node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
5080
5089
  var require_additionalItems = __commonJS({
5081
- "../../node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports) {
5090
+ "node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports) {
5082
5091
  "use strict";
5083
5092
  Object.defineProperty(exports, "__esModule", { value: true });
5084
5093
  exports.validateAdditionalItems = void 0;
@@ -5129,9 +5138,9 @@ var require_additionalItems = __commonJS({
5129
5138
  }
5130
5139
  });
5131
5140
 
5132
- // ../../node_modules/ajv/dist/vocabularies/applicator/items.js
5141
+ // node_modules/ajv/dist/vocabularies/applicator/items.js
5133
5142
  var require_items = __commonJS({
5134
- "../../node_modules/ajv/dist/vocabularies/applicator/items.js"(exports) {
5143
+ "node_modules/ajv/dist/vocabularies/applicator/items.js"(exports) {
5135
5144
  "use strict";
5136
5145
  Object.defineProperty(exports, "__esModule", { value: true });
5137
5146
  exports.validateTuple = void 0;
@@ -5186,9 +5195,9 @@ var require_items = __commonJS({
5186
5195
  }
5187
5196
  });
5188
5197
 
5189
- // ../../node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
5198
+ // node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
5190
5199
  var require_prefixItems = __commonJS({
5191
- "../../node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports) {
5200
+ "node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports) {
5192
5201
  "use strict";
5193
5202
  Object.defineProperty(exports, "__esModule", { value: true });
5194
5203
  var items_1 = require_items();
@@ -5203,9 +5212,9 @@ var require_prefixItems = __commonJS({
5203
5212
  }
5204
5213
  });
5205
5214
 
5206
- // ../../node_modules/ajv/dist/vocabularies/applicator/items2020.js
5215
+ // node_modules/ajv/dist/vocabularies/applicator/items2020.js
5207
5216
  var require_items2020 = __commonJS({
5208
- "../../node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports) {
5217
+ "node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports) {
5209
5218
  "use strict";
5210
5219
  Object.defineProperty(exports, "__esModule", { value: true });
5211
5220
  var codegen_1 = require_codegen();
@@ -5238,9 +5247,9 @@ var require_items2020 = __commonJS({
5238
5247
  }
5239
5248
  });
5240
5249
 
5241
- // ../../node_modules/ajv/dist/vocabularies/applicator/contains.js
5250
+ // node_modules/ajv/dist/vocabularies/applicator/contains.js
5242
5251
  var require_contains = __commonJS({
5243
- "../../node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports) {
5252
+ "node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports) {
5244
5253
  "use strict";
5245
5254
  Object.defineProperty(exports, "__esModule", { value: true });
5246
5255
  var codegen_1 = require_codegen();
@@ -5332,9 +5341,9 @@ var require_contains = __commonJS({
5332
5341
  }
5333
5342
  });
5334
5343
 
5335
- // ../../node_modules/ajv/dist/vocabularies/applicator/dependencies.js
5344
+ // node_modules/ajv/dist/vocabularies/applicator/dependencies.js
5336
5345
  var require_dependencies = __commonJS({
5337
- "../../node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports) {
5346
+ "node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports) {
5338
5347
  "use strict";
5339
5348
  Object.defineProperty(exports, "__esModule", { value: true });
5340
5349
  exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
@@ -5426,9 +5435,9 @@ var require_dependencies = __commonJS({
5426
5435
  }
5427
5436
  });
5428
5437
 
5429
- // ../../node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
5438
+ // node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
5430
5439
  var require_propertyNames = __commonJS({
5431
- "../../node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports) {
5440
+ "node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports) {
5432
5441
  "use strict";
5433
5442
  Object.defineProperty(exports, "__esModule", { value: true });
5434
5443
  var codegen_1 = require_codegen();
@@ -5469,9 +5478,9 @@ var require_propertyNames = __commonJS({
5469
5478
  }
5470
5479
  });
5471
5480
 
5472
- // ../../node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
5481
+ // node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
5473
5482
  var require_additionalProperties = __commonJS({
5474
- "../../node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports) {
5483
+ "node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports) {
5475
5484
  "use strict";
5476
5485
  Object.defineProperty(exports, "__esModule", { value: true });
5477
5486
  var code_1 = require_code2();
@@ -5575,9 +5584,9 @@ var require_additionalProperties = __commonJS({
5575
5584
  }
5576
5585
  });
5577
5586
 
5578
- // ../../node_modules/ajv/dist/vocabularies/applicator/properties.js
5587
+ // node_modules/ajv/dist/vocabularies/applicator/properties.js
5579
5588
  var require_properties = __commonJS({
5580
- "../../node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports) {
5589
+ "node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports) {
5581
5590
  "use strict";
5582
5591
  Object.defineProperty(exports, "__esModule", { value: true });
5583
5592
  var validate_1 = require_validate();
@@ -5633,9 +5642,9 @@ var require_properties = __commonJS({
5633
5642
  }
5634
5643
  });
5635
5644
 
5636
- // ../../node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
5645
+ // node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
5637
5646
  var require_patternProperties = __commonJS({
5638
- "../../node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports) {
5647
+ "node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports) {
5639
5648
  "use strict";
5640
5649
  Object.defineProperty(exports, "__esModule", { value: true });
5641
5650
  var code_1 = require_code2();
@@ -5707,9 +5716,9 @@ var require_patternProperties = __commonJS({
5707
5716
  }
5708
5717
  });
5709
5718
 
5710
- // ../../node_modules/ajv/dist/vocabularies/applicator/not.js
5719
+ // node_modules/ajv/dist/vocabularies/applicator/not.js
5711
5720
  var require_not = __commonJS({
5712
- "../../node_modules/ajv/dist/vocabularies/applicator/not.js"(exports) {
5721
+ "node_modules/ajv/dist/vocabularies/applicator/not.js"(exports) {
5713
5722
  "use strict";
5714
5723
  Object.defineProperty(exports, "__esModule", { value: true });
5715
5724
  var util_1 = require_util();
@@ -5738,9 +5747,9 @@ var require_not = __commonJS({
5738
5747
  }
5739
5748
  });
5740
5749
 
5741
- // ../../node_modules/ajv/dist/vocabularies/applicator/anyOf.js
5750
+ // node_modules/ajv/dist/vocabularies/applicator/anyOf.js
5742
5751
  var require_anyOf = __commonJS({
5743
- "../../node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports) {
5752
+ "node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports) {
5744
5753
  "use strict";
5745
5754
  Object.defineProperty(exports, "__esModule", { value: true });
5746
5755
  var code_1 = require_code2();
@@ -5755,9 +5764,9 @@ var require_anyOf = __commonJS({
5755
5764
  }
5756
5765
  });
5757
5766
 
5758
- // ../../node_modules/ajv/dist/vocabularies/applicator/oneOf.js
5767
+ // node_modules/ajv/dist/vocabularies/applicator/oneOf.js
5759
5768
  var require_oneOf = __commonJS({
5760
- "../../node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports) {
5769
+ "node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports) {
5761
5770
  "use strict";
5762
5771
  Object.defineProperty(exports, "__esModule", { value: true });
5763
5772
  var codegen_1 = require_codegen();
@@ -5813,9 +5822,9 @@ var require_oneOf = __commonJS({
5813
5822
  }
5814
5823
  });
5815
5824
 
5816
- // ../../node_modules/ajv/dist/vocabularies/applicator/allOf.js
5825
+ // node_modules/ajv/dist/vocabularies/applicator/allOf.js
5817
5826
  var require_allOf = __commonJS({
5818
- "../../node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports) {
5827
+ "node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports) {
5819
5828
  "use strict";
5820
5829
  Object.defineProperty(exports, "__esModule", { value: true });
5821
5830
  var util_1 = require_util();
@@ -5840,9 +5849,9 @@ var require_allOf = __commonJS({
5840
5849
  }
5841
5850
  });
5842
5851
 
5843
- // ../../node_modules/ajv/dist/vocabularies/applicator/if.js
5852
+ // node_modules/ajv/dist/vocabularies/applicator/if.js
5844
5853
  var require_if = __commonJS({
5845
- "../../node_modules/ajv/dist/vocabularies/applicator/if.js"(exports) {
5854
+ "node_modules/ajv/dist/vocabularies/applicator/if.js"(exports) {
5846
5855
  "use strict";
5847
5856
  Object.defineProperty(exports, "__esModule", { value: true });
5848
5857
  var codegen_1 = require_codegen();
@@ -5909,9 +5918,9 @@ var require_if = __commonJS({
5909
5918
  }
5910
5919
  });
5911
5920
 
5912
- // ../../node_modules/ajv/dist/vocabularies/applicator/thenElse.js
5921
+ // node_modules/ajv/dist/vocabularies/applicator/thenElse.js
5913
5922
  var require_thenElse = __commonJS({
5914
- "../../node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports) {
5923
+ "node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports) {
5915
5924
  "use strict";
5916
5925
  Object.defineProperty(exports, "__esModule", { value: true });
5917
5926
  var util_1 = require_util();
@@ -5927,9 +5936,9 @@ var require_thenElse = __commonJS({
5927
5936
  }
5928
5937
  });
5929
5938
 
5930
- // ../../node_modules/ajv/dist/vocabularies/applicator/index.js
5939
+ // node_modules/ajv/dist/vocabularies/applicator/index.js
5931
5940
  var require_applicator = __commonJS({
5932
- "../../node_modules/ajv/dist/vocabularies/applicator/index.js"(exports) {
5941
+ "node_modules/ajv/dist/vocabularies/applicator/index.js"(exports) {
5933
5942
  "use strict";
5934
5943
  Object.defineProperty(exports, "__esModule", { value: true });
5935
5944
  var additionalItems_1 = require_additionalItems();
@@ -5975,9 +5984,9 @@ var require_applicator = __commonJS({
5975
5984
  }
5976
5985
  });
5977
5986
 
5978
- // ../../node_modules/ajv/dist/vocabularies/format/format.js
5987
+ // node_modules/ajv/dist/vocabularies/format/format.js
5979
5988
  var require_format = __commonJS({
5980
- "../../node_modules/ajv/dist/vocabularies/format/format.js"(exports) {
5989
+ "node_modules/ajv/dist/vocabularies/format/format.js"(exports) {
5981
5990
  "use strict";
5982
5991
  Object.defineProperty(exports, "__esModule", { value: true });
5983
5992
  var codegen_1 = require_codegen();
@@ -6065,9 +6074,9 @@ var require_format = __commonJS({
6065
6074
  }
6066
6075
  });
6067
6076
 
6068
- // ../../node_modules/ajv/dist/vocabularies/format/index.js
6077
+ // node_modules/ajv/dist/vocabularies/format/index.js
6069
6078
  var require_format2 = __commonJS({
6070
- "../../node_modules/ajv/dist/vocabularies/format/index.js"(exports) {
6079
+ "node_modules/ajv/dist/vocabularies/format/index.js"(exports) {
6071
6080
  "use strict";
6072
6081
  Object.defineProperty(exports, "__esModule", { value: true });
6073
6082
  var format_1 = require_format();
@@ -6076,9 +6085,9 @@ var require_format2 = __commonJS({
6076
6085
  }
6077
6086
  });
6078
6087
 
6079
- // ../../node_modules/ajv/dist/vocabularies/metadata.js
6088
+ // node_modules/ajv/dist/vocabularies/metadata.js
6080
6089
  var require_metadata = __commonJS({
6081
- "../../node_modules/ajv/dist/vocabularies/metadata.js"(exports) {
6090
+ "node_modules/ajv/dist/vocabularies/metadata.js"(exports) {
6082
6091
  "use strict";
6083
6092
  Object.defineProperty(exports, "__esModule", { value: true });
6084
6093
  exports.contentVocabulary = exports.metadataVocabulary = void 0;
@@ -6099,9 +6108,9 @@ var require_metadata = __commonJS({
6099
6108
  }
6100
6109
  });
6101
6110
 
6102
- // ../../node_modules/ajv/dist/vocabularies/draft7.js
6111
+ // node_modules/ajv/dist/vocabularies/draft7.js
6103
6112
  var require_draft7 = __commonJS({
6104
- "../../node_modules/ajv/dist/vocabularies/draft7.js"(exports) {
6113
+ "node_modules/ajv/dist/vocabularies/draft7.js"(exports) {
6105
6114
  "use strict";
6106
6115
  Object.defineProperty(exports, "__esModule", { value: true });
6107
6116
  var core_1 = require_core2();
@@ -6121,9 +6130,9 @@ var require_draft7 = __commonJS({
6121
6130
  }
6122
6131
  });
6123
6132
 
6124
- // ../../node_modules/ajv/dist/vocabularies/discriminator/types.js
6133
+ // node_modules/ajv/dist/vocabularies/discriminator/types.js
6125
6134
  var require_types = __commonJS({
6126
- "../../node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports) {
6135
+ "node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports) {
6127
6136
  "use strict";
6128
6137
  Object.defineProperty(exports, "__esModule", { value: true });
6129
6138
  exports.DiscrError = void 0;
@@ -6135,9 +6144,9 @@ var require_types = __commonJS({
6135
6144
  }
6136
6145
  });
6137
6146
 
6138
- // ../../node_modules/ajv/dist/vocabularies/discriminator/index.js
6147
+ // node_modules/ajv/dist/vocabularies/discriminator/index.js
6139
6148
  var require_discriminator = __commonJS({
6140
- "../../node_modules/ajv/dist/vocabularies/discriminator/index.js"(exports) {
6149
+ "node_modules/ajv/dist/vocabularies/discriminator/index.js"(exports) {
6141
6150
  "use strict";
6142
6151
  Object.defineProperty(exports, "__esModule", { value: true });
6143
6152
  var codegen_1 = require_codegen();
@@ -6240,9 +6249,9 @@ var require_discriminator = __commonJS({
6240
6249
  }
6241
6250
  });
6242
6251
 
6243
- // ../../node_modules/ajv/dist/refs/json-schema-draft-07.json
6252
+ // node_modules/ajv/dist/refs/json-schema-draft-07.json
6244
6253
  var require_json_schema_draft_07 = __commonJS({
6245
- "../../node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports, module) {
6254
+ "node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports, module) {
6246
6255
  module.exports = {
6247
6256
  $schema: "http://json-schema.org/draft-07/schema#",
6248
6257
  $id: "http://json-schema.org/draft-07/schema#",
@@ -6397,9 +6406,9 @@ var require_json_schema_draft_07 = __commonJS({
6397
6406
  }
6398
6407
  });
6399
6408
 
6400
- // ../../node_modules/ajv/dist/ajv.js
6409
+ // node_modules/ajv/dist/ajv.js
6401
6410
  var require_ajv = __commonJS({
6402
- "../../node_modules/ajv/dist/ajv.js"(exports, module) {
6411
+ "node_modules/ajv/dist/ajv.js"(exports, module) {
6403
6412
  "use strict";
6404
6413
  Object.defineProperty(exports, "__esModule", { value: true });
6405
6414
  exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
@@ -6467,9 +6476,9 @@ var require_ajv = __commonJS({
6467
6476
  }
6468
6477
  });
6469
6478
 
6470
- // ../../node_modules/ajv-formats/dist/formats.js
6479
+ // node_modules/ajv-formats/dist/formats.js
6471
6480
  var require_formats = __commonJS({
6472
- "../../node_modules/ajv-formats/dist/formats.js"(exports) {
6481
+ "node_modules/ajv-formats/dist/formats.js"(exports) {
6473
6482
  "use strict";
6474
6483
  Object.defineProperty(exports, "__esModule", { value: true });
6475
6484
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
@@ -6670,9 +6679,9 @@ var require_formats = __commonJS({
6670
6679
  }
6671
6680
  });
6672
6681
 
6673
- // ../../node_modules/ajv-formats/dist/limit.js
6682
+ // node_modules/ajv-formats/dist/limit.js
6674
6683
  var require_limit = __commonJS({
6675
- "../../node_modules/ajv-formats/dist/limit.js"(exports) {
6684
+ "node_modules/ajv-formats/dist/limit.js"(exports) {
6676
6685
  "use strict";
6677
6686
  Object.defineProperty(exports, "__esModule", { value: true });
6678
6687
  exports.formatLimitDefinition = void 0;
@@ -6742,9 +6751,9 @@ var require_limit = __commonJS({
6742
6751
  }
6743
6752
  });
6744
6753
 
6745
- // ../../node_modules/ajv-formats/dist/index.js
6754
+ // node_modules/ajv-formats/dist/index.js
6746
6755
  var require_dist = __commonJS({
6747
- "../../node_modules/ajv-formats/dist/index.js"(exports, module) {
6756
+ "node_modules/ajv-formats/dist/index.js"(exports, module) {
6748
6757
  "use strict";
6749
6758
  Object.defineProperty(exports, "__esModule", { value: true });
6750
6759
  var formats_1 = require_formats();
@@ -6787,9 +6796,11 @@ var require_dist = __commonJS({
6787
6796
  // src/server/app.ts
6788
6797
  import { randomUUID } from "crypto";
6789
6798
  import path2 from "path";
6799
+ import { Readable as Readable2 } from "stream";
6800
+ import { pipeline } from "stream/promises";
6790
6801
  import { fileURLToPath } from "url";
6791
6802
 
6792
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
6803
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
6793
6804
  import * as z3rt from "zod/v3";
6794
6805
  import * as z4mini from "zod/v4-mini";
6795
6806
  function isZ4Schema(s) {
@@ -6935,7 +6946,7 @@ function getLiteralValue(schema) {
6935
6946
  return void 0;
6936
6947
  }
6937
6948
 
6938
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
6949
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
6939
6950
  import * as z from "zod/v4";
6940
6951
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
6941
6952
  var DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
@@ -8456,15 +8467,15 @@ var UrlElicitationRequiredError = class extends McpError {
8456
8467
  }
8457
8468
  };
8458
8469
 
8459
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
8470
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
8460
8471
  function isTerminal(status) {
8461
8472
  return status === "completed" || status === "failed" || status === "cancelled";
8462
8473
  }
8463
8474
 
8464
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
8475
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
8465
8476
  import * as z4mini2 from "zod/v4-mini";
8466
8477
 
8467
- // ../../node_modules/zod-to-json-schema/dist/esm/Options.js
8478
+ // node_modules/zod-to-json-schema/dist/esm/Options.js
8468
8479
  var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
8469
8480
  var defaultOptions = {
8470
8481
  name: void 0,
@@ -8498,7 +8509,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
8498
8509
  ...options
8499
8510
  };
8500
8511
 
8501
- // ../../node_modules/zod-to-json-schema/dist/esm/Refs.js
8512
+ // node_modules/zod-to-json-schema/dist/esm/Refs.js
8502
8513
  var getRefs = (options) => {
8503
8514
  const _options = getDefaultOptions(options);
8504
8515
  const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
@@ -8519,7 +8530,7 @@ var getRefs = (options) => {
8519
8530
  };
8520
8531
  };
8521
8532
 
8522
- // ../../node_modules/zod-to-json-schema/dist/esm/errorMessages.js
8533
+ // node_modules/zod-to-json-schema/dist/esm/errorMessages.js
8523
8534
  function addErrorMessage(res, key, errorMessage, refs) {
8524
8535
  if (!refs?.errorMessages)
8525
8536
  return;
@@ -8535,7 +8546,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
8535
8546
  addErrorMessage(res, key, errorMessage, refs);
8536
8547
  }
8537
8548
 
8538
- // ../../node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
8549
+ // node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
8539
8550
  var getRelativePath = (pathA, pathB) => {
8540
8551
  let i = 0;
8541
8552
  for (; i < pathA.length && i < pathB.length; i++) {
@@ -8545,10 +8556,10 @@ var getRelativePath = (pathA, pathB) => {
8545
8556
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
8546
8557
  };
8547
8558
 
8548
- // ../../node_modules/zod-to-json-schema/dist/esm/selectParser.js
8559
+ // node_modules/zod-to-json-schema/dist/esm/selectParser.js
8549
8560
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
8550
8561
 
8551
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/any.js
8562
+ // node_modules/zod-to-json-schema/dist/esm/parsers/any.js
8552
8563
  function parseAnyDef(refs) {
8553
8564
  if (refs.target !== "openAi") {
8554
8565
  return {};
@@ -8564,7 +8575,7 @@ function parseAnyDef(refs) {
8564
8575
  };
8565
8576
  }
8566
8577
 
8567
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/array.js
8578
+ // node_modules/zod-to-json-schema/dist/esm/parsers/array.js
8568
8579
  import { ZodFirstPartyTypeKind } from "zod/v3";
8569
8580
  function parseArrayDef(def, refs) {
8570
8581
  const res = {
@@ -8589,7 +8600,7 @@ function parseArrayDef(def, refs) {
8589
8600
  return res;
8590
8601
  }
8591
8602
 
8592
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
8603
+ // node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
8593
8604
  function parseBigintDef(def, refs) {
8594
8605
  const res = {
8595
8606
  type: "integer",
@@ -8635,24 +8646,24 @@ function parseBigintDef(def, refs) {
8635
8646
  return res;
8636
8647
  }
8637
8648
 
8638
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
8649
+ // node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
8639
8650
  function parseBooleanDef() {
8640
8651
  return {
8641
8652
  type: "boolean"
8642
8653
  };
8643
8654
  }
8644
8655
 
8645
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
8656
+ // node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
8646
8657
  function parseBrandedDef(_def, refs) {
8647
8658
  return parseDef(_def.type._def, refs);
8648
8659
  }
8649
8660
 
8650
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
8661
+ // node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
8651
8662
  var parseCatchDef = (def, refs) => {
8652
8663
  return parseDef(def.innerType._def, refs);
8653
8664
  };
8654
8665
 
8655
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/date.js
8666
+ // node_modules/zod-to-json-schema/dist/esm/parsers/date.js
8656
8667
  function parseDateDef(def, refs, overrideDateStrategy) {
8657
8668
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
8658
8669
  if (Array.isArray(strategy)) {
@@ -8711,7 +8722,7 @@ var integerDateParser = (def, refs) => {
8711
8722
  return res;
8712
8723
  };
8713
8724
 
8714
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/default.js
8725
+ // node_modules/zod-to-json-schema/dist/esm/parsers/default.js
8715
8726
  function parseDefaultDef(_def, refs) {
8716
8727
  return {
8717
8728
  ...parseDef(_def.innerType._def, refs),
@@ -8719,12 +8730,12 @@ function parseDefaultDef(_def, refs) {
8719
8730
  };
8720
8731
  }
8721
8732
 
8722
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
8733
+ // node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
8723
8734
  function parseEffectsDef(_def, refs) {
8724
8735
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
8725
8736
  }
8726
8737
 
8727
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
8738
+ // node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
8728
8739
  function parseEnumDef(def) {
8729
8740
  return {
8730
8741
  type: "string",
@@ -8732,7 +8743,7 @@ function parseEnumDef(def) {
8732
8743
  };
8733
8744
  }
8734
8745
 
8735
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
8746
+ // node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
8736
8747
  var isJsonSchema7AllOfType = (type) => {
8737
8748
  if ("type" in type && type.type === "string")
8738
8749
  return false;
@@ -8774,7 +8785,7 @@ function parseIntersectionDef(def, refs) {
8774
8785
  } : void 0;
8775
8786
  }
8776
8787
 
8777
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
8788
+ // node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
8778
8789
  function parseLiteralDef(def, refs) {
8779
8790
  const parsedType = typeof def.value;
8780
8791
  if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
@@ -8794,10 +8805,10 @@ function parseLiteralDef(def, refs) {
8794
8805
  };
8795
8806
  }
8796
8807
 
8797
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/record.js
8808
+ // node_modules/zod-to-json-schema/dist/esm/parsers/record.js
8798
8809
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod/v3";
8799
8810
 
8800
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/string.js
8811
+ // node_modules/zod-to-json-schema/dist/esm/parsers/string.js
8801
8812
  var emojiRegex = void 0;
8802
8813
  var zodPatterns = {
8803
8814
  /**
@@ -9122,7 +9133,7 @@ function stringifyRegExpWithFlags(regex, refs) {
9122
9133
  return pattern;
9123
9134
  }
9124
9135
 
9125
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/record.js
9136
+ // node_modules/zod-to-json-schema/dist/esm/parsers/record.js
9126
9137
  function parseRecordDef(def, refs) {
9127
9138
  if (refs.target === "openAi") {
9128
9139
  console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
@@ -9174,7 +9185,7 @@ function parseRecordDef(def, refs) {
9174
9185
  return schema;
9175
9186
  }
9176
9187
 
9177
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/map.js
9188
+ // node_modules/zod-to-json-schema/dist/esm/parsers/map.js
9178
9189
  function parseMapDef(def, refs) {
9179
9190
  if (refs.mapStrategy === "record") {
9180
9191
  return parseRecordDef(def, refs);
@@ -9199,7 +9210,7 @@ function parseMapDef(def, refs) {
9199
9210
  };
9200
9211
  }
9201
9212
 
9202
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
9213
+ // node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
9203
9214
  function parseNativeEnumDef(def) {
9204
9215
  const object4 = def.values;
9205
9216
  const actualKeys = Object.keys(def.values).filter((key) => {
@@ -9213,7 +9224,7 @@ function parseNativeEnumDef(def) {
9213
9224
  };
9214
9225
  }
9215
9226
 
9216
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/never.js
9227
+ // node_modules/zod-to-json-schema/dist/esm/parsers/never.js
9217
9228
  function parseNeverDef(refs) {
9218
9229
  return refs.target === "openAi" ? void 0 : {
9219
9230
  not: parseAnyDef({
@@ -9223,7 +9234,7 @@ function parseNeverDef(refs) {
9223
9234
  };
9224
9235
  }
9225
9236
 
9226
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/null.js
9237
+ // node_modules/zod-to-json-schema/dist/esm/parsers/null.js
9227
9238
  function parseNullDef(refs) {
9228
9239
  return refs.target === "openApi3" ? {
9229
9240
  enum: ["null"],
@@ -9233,7 +9244,7 @@ function parseNullDef(refs) {
9233
9244
  };
9234
9245
  }
9235
9246
 
9236
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/union.js
9247
+ // node_modules/zod-to-json-schema/dist/esm/parsers/union.js
9237
9248
  var primitiveMappings = {
9238
9249
  ZodString: "string",
9239
9250
  ZodNumber: "number",
@@ -9301,7 +9312,7 @@ var asAnyOf = (def, refs) => {
9301
9312
  return anyOf.length ? { anyOf } : void 0;
9302
9313
  };
9303
9314
 
9304
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
9315
+ // node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
9305
9316
  function parseNullableDef(def, refs) {
9306
9317
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
9307
9318
  if (refs.target === "openApi3") {
@@ -9333,7 +9344,7 @@ function parseNullableDef(def, refs) {
9333
9344
  return base && { anyOf: [base, { type: "null" }] };
9334
9345
  }
9335
9346
 
9336
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/number.js
9347
+ // node_modules/zod-to-json-schema/dist/esm/parsers/number.js
9337
9348
  function parseNumberDef(def, refs) {
9338
9349
  const res = {
9339
9350
  type: "number"
@@ -9382,7 +9393,7 @@ function parseNumberDef(def, refs) {
9382
9393
  return res;
9383
9394
  }
9384
9395
 
9385
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/object.js
9396
+ // node_modules/zod-to-json-schema/dist/esm/parsers/object.js
9386
9397
  function parseObjectDef(def, refs) {
9387
9398
  const forceOptionalIntoNullable = refs.target === "openAi";
9388
9399
  const result = {
@@ -9452,7 +9463,7 @@ function safeIsOptional(schema) {
9452
9463
  }
9453
9464
  }
9454
9465
 
9455
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
9466
+ // node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
9456
9467
  var parseOptionalDef = (def, refs) => {
9457
9468
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
9458
9469
  return parseDef(def.innerType._def, refs);
@@ -9471,7 +9482,7 @@ var parseOptionalDef = (def, refs) => {
9471
9482
  } : parseAnyDef(refs);
9472
9483
  };
9473
9484
 
9474
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
9485
+ // node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
9475
9486
  var parsePipelineDef = (def, refs) => {
9476
9487
  if (refs.pipeStrategy === "input") {
9477
9488
  return parseDef(def.in._def, refs);
@@ -9491,12 +9502,12 @@ var parsePipelineDef = (def, refs) => {
9491
9502
  };
9492
9503
  };
9493
9504
 
9494
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
9505
+ // node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
9495
9506
  function parsePromiseDef(def, refs) {
9496
9507
  return parseDef(def.type._def, refs);
9497
9508
  }
9498
9509
 
9499
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/set.js
9510
+ // node_modules/zod-to-json-schema/dist/esm/parsers/set.js
9500
9511
  function parseSetDef(def, refs) {
9501
9512
  const items = parseDef(def.valueType._def, {
9502
9513
  ...refs,
@@ -9516,7 +9527,7 @@ function parseSetDef(def, refs) {
9516
9527
  return schema;
9517
9528
  }
9518
9529
 
9519
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
9530
+ // node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
9520
9531
  function parseTupleDef(def, refs) {
9521
9532
  if (def.rest) {
9522
9533
  return {
@@ -9544,24 +9555,24 @@ function parseTupleDef(def, refs) {
9544
9555
  }
9545
9556
  }
9546
9557
 
9547
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
9558
+ // node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
9548
9559
  function parseUndefinedDef(refs) {
9549
9560
  return {
9550
9561
  not: parseAnyDef(refs)
9551
9562
  };
9552
9563
  }
9553
9564
 
9554
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
9565
+ // node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
9555
9566
  function parseUnknownDef(refs) {
9556
9567
  return parseAnyDef(refs);
9557
9568
  }
9558
9569
 
9559
- // ../../node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
9570
+ // node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
9560
9571
  var parseReadonlyDef = (def, refs) => {
9561
9572
  return parseDef(def.innerType._def, refs);
9562
9573
  };
9563
9574
 
9564
- // ../../node_modules/zod-to-json-schema/dist/esm/selectParser.js
9575
+ // node_modules/zod-to-json-schema/dist/esm/selectParser.js
9565
9576
  var selectParser = (def, typeName, refs) => {
9566
9577
  switch (typeName) {
9567
9578
  case ZodFirstPartyTypeKind3.ZodString:
@@ -9637,7 +9648,7 @@ var selectParser = (def, typeName, refs) => {
9637
9648
  }
9638
9649
  };
9639
9650
 
9640
- // ../../node_modules/zod-to-json-schema/dist/esm/parseDef.js
9651
+ // node_modules/zod-to-json-schema/dist/esm/parseDef.js
9641
9652
  function parseDef(def, refs, forceResolution = false) {
9642
9653
  const seenItem = refs.seen.get(def);
9643
9654
  if (refs.override) {
@@ -9693,7 +9704,7 @@ var addMeta = (def, refs, jsonSchema) => {
9693
9704
  return jsonSchema;
9694
9705
  };
9695
9706
 
9696
- // ../../node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
9707
+ // node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
9697
9708
  var zodToJsonSchema = (schema, options) => {
9698
9709
  const refs = getRefs(options);
9699
9710
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
@@ -9755,7 +9766,7 @@ var zodToJsonSchema = (schema, options) => {
9755
9766
  return combined;
9756
9767
  };
9757
9768
 
9758
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
9769
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
9759
9770
  function mapMiniTarget(t) {
9760
9771
  if (!t)
9761
9772
  return "draft-7";
@@ -9797,7 +9808,7 @@ function parseWithCompat(schema, data) {
9797
9808
  return result.data;
9798
9809
  }
9799
9810
 
9800
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
9811
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
9801
9812
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
9802
9813
  var Protocol = class {
9803
9814
  constructor(_options) {
@@ -9974,6 +9985,9 @@ var Protocol = class {
9974
9985
  * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
9975
9986
  */
9976
9987
  async connect(transport) {
9988
+ if (this._transport) {
9989
+ throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
9990
+ }
9977
9991
  this._transport = transport;
9978
9992
  const _onclose = this.transport?.onclose;
9979
9993
  this._transport.onclose = () => {
@@ -10006,6 +10020,10 @@ var Protocol = class {
10006
10020
  this._progressHandlers.clear();
10007
10021
  this._taskProgressTokens.clear();
10008
10022
  this._pendingDebouncedNotifications.clear();
10023
+ for (const controller of this._requestHandlerAbortControllers.values()) {
10024
+ controller.abort();
10025
+ }
10026
+ this._requestHandlerAbortControllers.clear();
10009
10027
  const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
10010
10028
  this._transport = void 0;
10011
10029
  this.onclose?.();
@@ -10056,6 +10074,8 @@ var Protocol = class {
10056
10074
  sessionId: capturedTransport?.sessionId,
10057
10075
  _meta: request.params?._meta,
10058
10076
  sendNotification: async (notification) => {
10077
+ if (abortController.signal.aborted)
10078
+ return;
10059
10079
  const notificationOptions = { relatedRequestId: request.id };
10060
10080
  if (relatedTaskId) {
10061
10081
  notificationOptions.relatedTask = { taskId: relatedTaskId };
@@ -10063,6 +10083,9 @@ var Protocol = class {
10063
10083
  await this.notification(notification, notificationOptions);
10064
10084
  },
10065
10085
  sendRequest: async (r, resultSchema, options) => {
10086
+ if (abortController.signal.aborted) {
10087
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
10088
+ }
10066
10089
  const requestOptions = { ...options, relatedRequestId: request.id };
10067
10090
  if (relatedTaskId && !requestOptions.relatedTask) {
10068
10091
  requestOptions.relatedTask = { taskId: relatedTaskId };
@@ -10733,7 +10756,7 @@ function mergeCapabilities(base, additional) {
10733
10756
  return result;
10734
10757
  }
10735
10758
 
10736
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
10759
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
10737
10760
  var import_ajv = __toESM(require_ajv(), 1);
10738
10761
  var import_ajv_formats = __toESM(require_dist(), 1);
10739
10762
  function createDefaultAjvInstance() {
@@ -10801,7 +10824,7 @@ var AjvJsonSchemaValidator = class {
10801
10824
  }
10802
10825
  };
10803
10826
 
10804
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
10827
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
10805
10828
  var ExperimentalServerTasks = class {
10806
10829
  constructor(_server) {
10807
10830
  this._server = _server;
@@ -10823,6 +10846,147 @@ var ExperimentalServerTasks = class {
10823
10846
  requestStream(request, resultSchema, options) {
10824
10847
  return this._server.requestStream(request, resultSchema, options);
10825
10848
  }
10849
+ /**
10850
+ * Sends a sampling request and returns an AsyncGenerator that yields response messages.
10851
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
10852
+ *
10853
+ * For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
10854
+ * before the final result.
10855
+ *
10856
+ * @example
10857
+ * ```typescript
10858
+ * const stream = server.experimental.tasks.createMessageStream({
10859
+ * messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
10860
+ * maxTokens: 100
10861
+ * }, {
10862
+ * onprogress: (progress) => {
10863
+ * // Handle streaming tokens via progress notifications
10864
+ * console.log('Progress:', progress.message);
10865
+ * }
10866
+ * });
10867
+ *
10868
+ * for await (const message of stream) {
10869
+ * switch (message.type) {
10870
+ * case 'taskCreated':
10871
+ * console.log('Task created:', message.task.taskId);
10872
+ * break;
10873
+ * case 'taskStatus':
10874
+ * console.log('Task status:', message.task.status);
10875
+ * break;
10876
+ * case 'result':
10877
+ * console.log('Final result:', message.result);
10878
+ * break;
10879
+ * case 'error':
10880
+ * console.error('Error:', message.error);
10881
+ * break;
10882
+ * }
10883
+ * }
10884
+ * ```
10885
+ *
10886
+ * @param params - The sampling request parameters
10887
+ * @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
10888
+ * @returns AsyncGenerator that yields ResponseMessage objects
10889
+ *
10890
+ * @experimental
10891
+ */
10892
+ createMessageStream(params, options) {
10893
+ const clientCapabilities = this._server.getClientCapabilities();
10894
+ if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
10895
+ throw new Error("Client does not support sampling tools capability.");
10896
+ }
10897
+ if (params.messages.length > 0) {
10898
+ const lastMessage = params.messages[params.messages.length - 1];
10899
+ const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
10900
+ const hasToolResults = lastContent.some((c) => c.type === "tool_result");
10901
+ const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
10902
+ const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
10903
+ const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
10904
+ if (hasToolResults) {
10905
+ if (lastContent.some((c) => c.type !== "tool_result")) {
10906
+ throw new Error("The last message must contain only tool_result content if any is present");
10907
+ }
10908
+ if (!hasPreviousToolUse) {
10909
+ throw new Error("tool_result blocks are not matching any tool_use from the previous message");
10910
+ }
10911
+ }
10912
+ if (hasPreviousToolUse) {
10913
+ const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
10914
+ const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
10915
+ if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
10916
+ throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
10917
+ }
10918
+ }
10919
+ }
10920
+ return this.requestStream({
10921
+ method: "sampling/createMessage",
10922
+ params
10923
+ }, CreateMessageResultSchema, options);
10924
+ }
10925
+ /**
10926
+ * Sends an elicitation request and returns an AsyncGenerator that yields response messages.
10927
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
10928
+ *
10929
+ * For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
10930
+ * and 'taskStatus' messages before the final result.
10931
+ *
10932
+ * @example
10933
+ * ```typescript
10934
+ * const stream = server.experimental.tasks.elicitInputStream({
10935
+ * mode: 'url',
10936
+ * message: 'Please authenticate',
10937
+ * elicitationId: 'auth-123',
10938
+ * url: 'https://example.com/auth'
10939
+ * }, {
10940
+ * task: { ttl: 300000 } // Task-augmented for long-running auth flow
10941
+ * });
10942
+ *
10943
+ * for await (const message of stream) {
10944
+ * switch (message.type) {
10945
+ * case 'taskCreated':
10946
+ * console.log('Task created:', message.task.taskId);
10947
+ * break;
10948
+ * case 'taskStatus':
10949
+ * console.log('Task status:', message.task.status);
10950
+ * break;
10951
+ * case 'result':
10952
+ * console.log('User action:', message.result.action);
10953
+ * break;
10954
+ * case 'error':
10955
+ * console.error('Error:', message.error);
10956
+ * break;
10957
+ * }
10958
+ * }
10959
+ * ```
10960
+ *
10961
+ * @param params - The elicitation request parameters
10962
+ * @param options - Optional request options (timeout, signal, task creation params, etc.)
10963
+ * @returns AsyncGenerator that yields ResponseMessage objects
10964
+ *
10965
+ * @experimental
10966
+ */
10967
+ elicitInputStream(params, options) {
10968
+ const clientCapabilities = this._server.getClientCapabilities();
10969
+ const mode = params.mode ?? "form";
10970
+ switch (mode) {
10971
+ case "url": {
10972
+ if (!clientCapabilities?.elicitation?.url) {
10973
+ throw new Error("Client does not support url elicitation.");
10974
+ }
10975
+ break;
10976
+ }
10977
+ case "form": {
10978
+ if (!clientCapabilities?.elicitation?.form) {
10979
+ throw new Error("Client does not support form elicitation.");
10980
+ }
10981
+ break;
10982
+ }
10983
+ }
10984
+ const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
10985
+ return this.requestStream({
10986
+ method: "elicitation/create",
10987
+ params: normalizedParams
10988
+ }, ElicitResultSchema, options);
10989
+ }
10826
10990
  /**
10827
10991
  * Gets the current status of a task.
10828
10992
  *
@@ -10873,7 +11037,7 @@ var ExperimentalServerTasks = class {
10873
11037
  }
10874
11038
  };
10875
11039
 
10876
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
11040
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
10877
11041
  function assertToolsCallTaskCapability(requests, method, entityName) {
10878
11042
  if (!requests) {
10879
11043
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -10908,7 +11072,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
10908
11072
  }
10909
11073
  }
10910
11074
 
10911
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
11075
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
10912
11076
  var Server = class extends Protocol {
10913
11077
  /**
10914
11078
  * Initializes this server with the given name and version information.
@@ -11288,7 +11452,7 @@ var Server = class extends Protocol {
11288
11452
  }
11289
11453
  };
11290
11454
 
11291
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
11455
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
11292
11456
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
11293
11457
  function isCompletable(schema) {
11294
11458
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -11302,7 +11466,7 @@ var McpZodTypeKind;
11302
11466
  McpZodTypeKind2["Completable"] = "McpCompletable";
11303
11467
  })(McpZodTypeKind || (McpZodTypeKind = {}));
11304
11468
 
11305
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
11469
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
11306
11470
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
11307
11471
  function validateToolName(name) {
11308
11472
  const warnings = [];
@@ -11360,7 +11524,7 @@ function validateAndWarnToolName(name) {
11360
11524
  return result.isValid;
11361
11525
  }
11362
11526
 
11363
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
11527
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
11364
11528
  var ExperimentalMcpServerTasks = class {
11365
11529
  constructor(_mcpServer) {
11366
11530
  this._mcpServer = _mcpServer;
@@ -11375,7 +11539,7 @@ var ExperimentalMcpServerTasks = class {
11375
11539
  }
11376
11540
  };
11377
11541
 
11378
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
11542
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
11379
11543
  import { ZodOptional } from "zod";
11380
11544
  var McpServer = class {
11381
11545
  constructor(serverInfo, options) {
@@ -12162,7 +12326,7 @@ var EMPTY_COMPLETION_RESULT = {
12162
12326
  }
12163
12327
  };
12164
12328
 
12165
- // ../../node_modules/@hono/node-server/dist/index.mjs
12329
+ // node_modules/@hono/node-server/dist/index.mjs
12166
12330
  import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
12167
12331
  import { Http2ServerRequest } from "http2";
12168
12332
  import { Readable } from "stream";
@@ -12180,7 +12344,7 @@ var toRequestError = (e) => {
12180
12344
  return new RequestError(e.message, { cause: e });
12181
12345
  };
12182
12346
  var GlobalRequest = global.Request;
12183
- var Request = class extends GlobalRequest {
12347
+ var Request2 = class extends GlobalRequest {
12184
12348
  constructor(input, options) {
12185
12349
  if (typeof input === "object" && getRequestCache in input) {
12186
12350
  input = input[getRequestCache]();
@@ -12213,7 +12377,7 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
12213
12377
  };
12214
12378
  if (method === "TRACE") {
12215
12379
  init.method = "GET";
12216
- const req = new Request(url, init);
12380
+ const req = new Request2(url, init);
12217
12381
  Object.defineProperty(req, "method", {
12218
12382
  get() {
12219
12383
  return "TRACE";
@@ -12250,7 +12414,7 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
12250
12414
  init.body = Readable.toWeb(incoming);
12251
12415
  }
12252
12416
  }
12253
- return new Request(url, init);
12417
+ return new Request2(url, init);
12254
12418
  };
12255
12419
  var getRequestCache = /* @__PURE__ */ Symbol("getRequestCache");
12256
12420
  var requestCache = /* @__PURE__ */ Symbol("requestCache");
@@ -12311,7 +12475,7 @@ var requestPrototype = {
12311
12475
  }
12312
12476
  });
12313
12477
  });
12314
- Object.setPrototypeOf(requestPrototype, Request.prototype);
12478
+ Object.setPrototypeOf(requestPrototype, Request2.prototype);
12315
12479
  var newRequest = (incoming, defaultHostname) => {
12316
12480
  const req = Object.create(requestPrototype);
12317
12481
  req[incomingKey] = incoming;
@@ -12377,15 +12541,17 @@ var Response2 = class _Response {
12377
12541
  this.#init = init;
12378
12542
  }
12379
12543
  if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
12380
- headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
12381
- this[cacheKey] = [init?.status || 200, body, headers];
12544
+ ;
12545
+ this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
12382
12546
  }
12383
12547
  }
12384
12548
  get headers() {
12385
12549
  const cache = this[cacheKey];
12386
12550
  if (cache) {
12387
12551
  if (!(cache[2] instanceof Headers)) {
12388
- cache[2] = new Headers(cache[2]);
12552
+ cache[2] = new Headers(
12553
+ cache[2] || { "content-type": "text/plain; charset=UTF-8" }
12554
+ );
12389
12555
  }
12390
12556
  return cache[2];
12391
12557
  }
@@ -12510,15 +12676,32 @@ var flushHeaders = (outgoing) => {
12510
12676
  };
12511
12677
  var responseViaCache = async (res, outgoing) => {
12512
12678
  let [status, body, header] = res[cacheKey];
12513
- if (header instanceof Headers) {
12679
+ let hasContentLength = false;
12680
+ if (!header) {
12681
+ header = { "content-type": "text/plain; charset=UTF-8" };
12682
+ } else if (header instanceof Headers) {
12683
+ hasContentLength = header.has("content-length");
12514
12684
  header = buildOutgoingHttpHeaders(header);
12685
+ } else if (Array.isArray(header)) {
12686
+ const headerObj = new Headers(header);
12687
+ hasContentLength = headerObj.has("content-length");
12688
+ header = buildOutgoingHttpHeaders(headerObj);
12689
+ } else {
12690
+ for (const key in header) {
12691
+ if (key.length === 14 && key.toLowerCase() === "content-length") {
12692
+ hasContentLength = true;
12693
+ break;
12694
+ }
12695
+ }
12515
12696
  }
12516
- if (typeof body === "string") {
12517
- header["Content-Length"] = Buffer.byteLength(body);
12518
- } else if (body instanceof Uint8Array) {
12519
- header["Content-Length"] = body.byteLength;
12520
- } else if (body instanceof Blob) {
12521
- header["Content-Length"] = body.size;
12697
+ if (!hasContentLength) {
12698
+ if (typeof body === "string") {
12699
+ header["Content-Length"] = Buffer.byteLength(body);
12700
+ } else if (body instanceof Uint8Array) {
12701
+ header["Content-Length"] = body.byteLength;
12702
+ } else if (body instanceof Blob) {
12703
+ header["Content-Length"] = body.size;
12704
+ }
12522
12705
  }
12523
12706
  outgoing.writeHead(status, header);
12524
12707
  if (typeof body === "string" || body instanceof Uint8Array) {
@@ -12612,9 +12795,9 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
12612
12795
  };
12613
12796
  var getRequestListener = (fetchCallback, options = {}) => {
12614
12797
  const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
12615
- if (options.overrideGlobalObjects !== false && global.Request !== Request) {
12798
+ if (options.overrideGlobalObjects !== false && global.Request !== Request2) {
12616
12799
  Object.defineProperty(global, "Request", {
12617
- value: Request
12800
+ value: Request2
12618
12801
  });
12619
12802
  Object.defineProperty(global, "Response", {
12620
12803
  value: Response2
@@ -12694,10 +12877,11 @@ var getRequestListener = (fetchCallback, options = {}) => {
12694
12877
  };
12695
12878
  };
12696
12879
 
12697
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
12880
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
12698
12881
  var WebStandardStreamableHTTPServerTransport = class {
12699
12882
  constructor(options = {}) {
12700
12883
  this._started = false;
12884
+ this._hasHandledRequest = false;
12701
12885
  this._streamMapping = /* @__PURE__ */ new Map();
12702
12886
  this._requestToStreamMapping = /* @__PURE__ */ new Map();
12703
12887
  this._requestResponseMap = /* @__PURE__ */ new Map();
@@ -12775,6 +12959,10 @@ var WebStandardStreamableHTTPServerTransport = class {
12775
12959
  * Returns a Response object (Web Standard)
12776
12960
  */
12777
12961
  async handleRequest(req, options) {
12962
+ if (!this.sessionIdGenerator && this._hasHandledRequest) {
12963
+ throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");
12964
+ }
12965
+ this._hasHandledRequest = true;
12778
12966
  const validationError = this.validateRequestHeaders(req);
12779
12967
  if (validationError) {
12780
12968
  return validationError;
@@ -12822,6 +13010,7 @@ data:
12822
13010
  async handleGetRequest(req) {
12823
13011
  const acceptHeader = req.headers.get("accept");
12824
13012
  if (!acceptHeader?.includes("text/event-stream")) {
13013
+ this.onerror?.(new Error("Not Acceptable: Client must accept text/event-stream"));
12825
13014
  return this.createJsonErrorResponse(406, -32e3, "Not Acceptable: Client must accept text/event-stream");
12826
13015
  }
12827
13016
  const sessionError = this.validateSession(req);
@@ -12839,6 +13028,7 @@ data:
12839
13028
  }
12840
13029
  }
12841
13030
  if (this._streamMapping.get(this._standaloneSseStreamId) !== void 0) {
13031
+ this.onerror?.(new Error("Conflict: Only one SSE stream is allowed per session"));
12842
13032
  return this.createJsonErrorResponse(409, -32e3, "Conflict: Only one SSE stream is allowed per session");
12843
13033
  }
12844
13034
  const encoder = new TextEncoder();
@@ -12878,6 +13068,7 @@ data:
12878
13068
  */
12879
13069
  async replayEvents(lastEventId) {
12880
13070
  if (!this._eventStore) {
13071
+ this.onerror?.(new Error("Event store not configured"));
12881
13072
  return this.createJsonErrorResponse(400, -32e3, "Event store not configured");
12882
13073
  }
12883
13074
  try {
@@ -12885,9 +13076,11 @@ data:
12885
13076
  if (this._eventStore.getStreamIdForEventId) {
12886
13077
  streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
12887
13078
  if (!streamId) {
13079
+ this.onerror?.(new Error("Invalid event ID format"));
12888
13080
  return this.createJsonErrorResponse(400, -32e3, "Invalid event ID format");
12889
13081
  }
12890
13082
  if (this._streamMapping.get(streamId) !== void 0) {
13083
+ this.onerror?.(new Error("Conflict: Stream already has an active connection"));
12891
13084
  return this.createJsonErrorResponse(409, -32e3, "Conflict: Stream already has an active connection");
12892
13085
  }
12893
13086
  }
@@ -12953,7 +13146,8 @@ data:
12953
13146
  `;
12954
13147
  controller.enqueue(encoder.encode(eventData));
12955
13148
  return true;
12956
- } catch {
13149
+ } catch (error) {
13150
+ this.onerror?.(error);
12957
13151
  return false;
12958
13152
  }
12959
13153
  }
@@ -12961,6 +13155,7 @@ data:
12961
13155
  * Handles unsupported requests (PUT, PATCH, etc.)
12962
13156
  */
12963
13157
  handleUnsupportedRequest() {
13158
+ this.onerror?.(new Error("Method not allowed."));
12964
13159
  return new Response(JSON.stringify({
12965
13160
  jsonrpc: "2.0",
12966
13161
  error: {
@@ -12983,14 +13178,17 @@ data:
12983
13178
  try {
12984
13179
  const acceptHeader = req.headers.get("accept");
12985
13180
  if (!acceptHeader?.includes("application/json") || !acceptHeader.includes("text/event-stream")) {
13181
+ this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream"));
12986
13182
  return this.createJsonErrorResponse(406, -32e3, "Not Acceptable: Client must accept both application/json and text/event-stream");
12987
13183
  }
12988
13184
  const ct = req.headers.get("content-type");
12989
13185
  if (!ct || !ct.includes("application/json")) {
13186
+ this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
12990
13187
  return this.createJsonErrorResponse(415, -32e3, "Unsupported Media Type: Content-Type must be application/json");
12991
13188
  }
12992
13189
  const requestInfo = {
12993
- headers: Object.fromEntries(req.headers.entries())
13190
+ headers: Object.fromEntries(req.headers.entries()),
13191
+ url: new URL(req.url)
12994
13192
  };
12995
13193
  let rawMessage;
12996
13194
  if (options?.parsedBody !== void 0) {
@@ -12999,6 +13197,7 @@ data:
12999
13197
  try {
13000
13198
  rawMessage = await req.json();
13001
13199
  } catch {
13200
+ this.onerror?.(new Error("Parse error: Invalid JSON"));
13002
13201
  return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON");
13003
13202
  }
13004
13203
  }
@@ -13010,14 +13209,17 @@ data:
13010
13209
  messages = [JSONRPCMessageSchema.parse(rawMessage)];
13011
13210
  }
13012
13211
  } catch {
13212
+ this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
13013
13213
  return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
13014
13214
  }
13015
13215
  const isInitializationRequest = messages.some(isInitializeRequest);
13016
13216
  if (isInitializationRequest) {
13017
13217
  if (this._initialized && this.sessionId !== void 0) {
13218
+ this.onerror?.(new Error("Invalid Request: Server already initialized"));
13018
13219
  return this.createJsonErrorResponse(400, -32600, "Invalid Request: Server already initialized");
13019
13220
  }
13020
13221
  if (messages.length > 1) {
13222
+ this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed"));
13021
13223
  return this.createJsonErrorResponse(400, -32600, "Invalid Request: Only one initialization request is allowed");
13022
13224
  }
13023
13225
  this.sessionId = this.sessionIdGenerator?.();
@@ -13143,13 +13345,16 @@ data:
13143
13345
  return void 0;
13144
13346
  }
13145
13347
  if (!this._initialized) {
13348
+ this.onerror?.(new Error("Bad Request: Server not initialized"));
13146
13349
  return this.createJsonErrorResponse(400, -32e3, "Bad Request: Server not initialized");
13147
13350
  }
13148
13351
  const sessionId = req.headers.get("mcp-session-id");
13149
13352
  if (!sessionId) {
13353
+ this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required"));
13150
13354
  return this.createJsonErrorResponse(400, -32e3, "Bad Request: Mcp-Session-Id header is required");
13151
13355
  }
13152
13356
  if (sessionId !== this.sessionId) {
13357
+ this.onerror?.(new Error("Session not found"));
13153
13358
  return this.createJsonErrorResponse(404, -32001, "Session not found");
13154
13359
  }
13155
13360
  return void 0;
@@ -13170,6 +13375,7 @@ data:
13170
13375
  validateProtocolVersion(req) {
13171
13376
  const protocolVersion = req.headers.get("mcp-protocol-version");
13172
13377
  if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
13378
+ this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`));
13173
13379
  return this.createJsonErrorResponse(400, -32e3, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`);
13174
13380
  }
13175
13381
  return void 0;
@@ -13273,7 +13479,7 @@ data:
13273
13479
  }
13274
13480
  };
13275
13481
 
13276
- // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js
13482
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js
13277
13483
  var StreamableHTTPServerTransport = class {
13278
13484
  constructor(options = {}) {
13279
13485
  this._requestContext = /* @__PURE__ */ new WeakMap();
@@ -13377,7 +13583,7 @@ var StreamableHTTPServerTransport = class {
13377
13583
 
13378
13584
  // src/server/app.ts
13379
13585
  import express from "express";
13380
- import { z as z2 } from "zod";
13586
+ import { z as z3 } from "zod";
13381
13587
 
13382
13588
  // src/server/types.ts
13383
13589
  var MIME_TYPES = {
@@ -13617,15 +13823,153 @@ var WebSocketManager = class {
13617
13823
  };
13618
13824
 
13619
13825
  // src/server/storageRpc.ts
13826
+ import { z as z2 } from "zod";
13827
+ var STORAGE_METHODS = {
13828
+ KV_GET: "creature/storage/kv/get",
13829
+ KV_SET: "creature/storage/kv/set",
13830
+ KV_DELETE: "creature/storage/kv/delete",
13831
+ KV_LIST: "creature/storage/kv/list",
13832
+ KV_LIST_WITH_VALUES: "creature/storage/kv/listWithValues",
13833
+ KV_SEARCH: "creature/storage/kv/search",
13834
+ VECTOR_UPSERT: "creature/storage/vector/upsert",
13835
+ VECTOR_SEARCH: "creature/storage/vector/search",
13836
+ VECTOR_DELETE: "creature/storage/vector/delete",
13837
+ BLOB_PUT: "creature/storage/blob/put",
13838
+ BLOB_GET: "creature/storage/blob/get",
13839
+ BLOB_DELETE: "creature/storage/blob/delete",
13840
+ BLOB_LIST: "creature/storage/blob/list"
13841
+ };
13620
13842
  var currentServer = null;
13621
- var setCurrentServer = ({
13622
- server
13623
- }) => {
13843
+ var setCurrentServer = (server) => {
13624
13844
  currentServer = server;
13625
13845
  };
13626
13846
  var getCurrentServer = () => {
13627
13847
  return currentServer;
13628
13848
  };
13849
+ var isStorageRpcAvailable = () => {
13850
+ const isCreature = !!process.env.CREATURE_PROJECT_ID;
13851
+ return isCreature && currentServer !== null;
13852
+ };
13853
+ var GenericResultSchema = z2.record(z2.unknown());
13854
+ var sendStorageRequest = async (method, params) => {
13855
+ if (!currentServer) {
13856
+ throw new Error(
13857
+ "Storage RPC not available: no server connection. Make sure you're calling this from within a tool handler."
13858
+ );
13859
+ }
13860
+ try {
13861
+ const server = currentServer.server;
13862
+ const result = await server.request(
13863
+ { method, params },
13864
+ GenericResultSchema
13865
+ );
13866
+ return result;
13867
+ } catch (error) {
13868
+ const message = error instanceof Error ? error.message : String(error);
13869
+ throw new Error(`Storage RPC failed (${method}): ${message}`);
13870
+ }
13871
+ };
13872
+ var rpcKvGet = async (key) => {
13873
+ const result = await sendStorageRequest(
13874
+ STORAGE_METHODS.KV_GET,
13875
+ { key }
13876
+ );
13877
+ return result.value;
13878
+ };
13879
+ var rpcKvSet = async (key, value) => {
13880
+ const result = await sendStorageRequest(
13881
+ STORAGE_METHODS.KV_SET,
13882
+ { key, value }
13883
+ );
13884
+ return result.success;
13885
+ };
13886
+ var rpcKvDelete = async (key) => {
13887
+ const result = await sendStorageRequest(
13888
+ STORAGE_METHODS.KV_DELETE,
13889
+ { key }
13890
+ );
13891
+ return result.deleted;
13892
+ };
13893
+ var rpcKvList = async (prefix) => {
13894
+ const result = await sendStorageRequest(
13895
+ STORAGE_METHODS.KV_LIST,
13896
+ { prefix }
13897
+ );
13898
+ return result.keys;
13899
+ };
13900
+ var rpcKvListWithValues = async (prefix) => {
13901
+ const result = await sendStorageRequest(
13902
+ STORAGE_METHODS.KV_LIST_WITH_VALUES,
13903
+ { prefix }
13904
+ );
13905
+ return result.entries;
13906
+ };
13907
+ var rpcKvSearch = async (query, options) => {
13908
+ const result = await sendStorageRequest(
13909
+ STORAGE_METHODS.KV_SEARCH,
13910
+ { query, prefix: options?.prefix, limit: options?.limit }
13911
+ );
13912
+ return result.matches;
13913
+ };
13914
+ var rpcVectorUpsert = async (key, text, metadata) => {
13915
+ const result = await sendStorageRequest(
13916
+ STORAGE_METHODS.VECTOR_UPSERT,
13917
+ { key, text, metadata }
13918
+ );
13919
+ return result.success;
13920
+ };
13921
+ var rpcVectorSearch = async (query, options) => {
13922
+ const result = await sendStorageRequest(
13923
+ STORAGE_METHODS.VECTOR_SEARCH,
13924
+ { query, prefix: options?.prefix, limit: options?.limit }
13925
+ );
13926
+ return result.matches;
13927
+ };
13928
+ var rpcVectorDelete = async (key) => {
13929
+ const result = await sendStorageRequest(
13930
+ STORAGE_METHODS.VECTOR_DELETE,
13931
+ { key }
13932
+ );
13933
+ return result.deleted;
13934
+ };
13935
+ var rpcBlobPut = async (name, data, mimeType) => {
13936
+ const result = await sendStorageRequest(
13937
+ STORAGE_METHODS.BLOB_PUT,
13938
+ {
13939
+ name,
13940
+ data: Buffer.from(data).toString("base64"),
13941
+ mimeType
13942
+ }
13943
+ );
13944
+ return result;
13945
+ };
13946
+ var rpcBlobGet = async (name) => {
13947
+ const result = await sendStorageRequest(
13948
+ STORAGE_METHODS.BLOB_GET,
13949
+ { name }
13950
+ );
13951
+ if (result.data === null) {
13952
+ return null;
13953
+ }
13954
+ return {
13955
+ data: Buffer.from(result.data, "base64"),
13956
+ mimeType: result.mimeType
13957
+ };
13958
+ };
13959
+ var rpcBlobDelete = async (name) => {
13960
+ const result = await sendStorageRequest(
13961
+ STORAGE_METHODS.BLOB_DELETE,
13962
+ { name }
13963
+ );
13964
+ return result.deleted;
13965
+ };
13966
+ var rpcBlobList = async (prefix) => {
13967
+ const result = await sendStorageRequest(
13968
+ STORAGE_METHODS.BLOB_LIST,
13969
+ { prefix }
13970
+ );
13971
+ return result.names;
13972
+ };
13629
13973
 
13630
13974
  // src/server/app.ts
13631
13975
  function createHttpLogSink(endpoint, sourceName) {
@@ -13850,7 +14194,7 @@ var App = class {
13850
14194
  ws.close();
13851
14195
  this.instanceWebSockets.delete(instanceId);
13852
14196
  }
13853
- this.instanceState.delete(instanceId);
14197
+ this.deleteInstanceState(instanceId);
13854
14198
  console.log(`[MCP] Instance destroyed: ${instanceId}`);
13855
14199
  return true;
13856
14200
  }
@@ -13931,6 +14275,35 @@ var App = class {
13931
14275
  getResourceDefinitions() {
13932
14276
  return this.resources;
13933
14277
  }
14278
+ /**
14279
+ * Get the Express application for serverless wrapping (e.g. Lambda).
14280
+ * Does NOT start listening on a port.
14281
+ */
14282
+ toExpressApp(options) {
14283
+ return this.createExpressApp({ serverless: options });
14284
+ }
14285
+ toAwsLambda(options) {
14286
+ const serverlessOptions = {
14287
+ transportMode: "stateless",
14288
+ ...options
14289
+ };
14290
+ if (serverlessOptions.transportMode !== "stateless") {
14291
+ throw new Error("app.toAwsLambda() currently requires transportMode: 'stateless'");
14292
+ }
14293
+ const lambdaRuntime = globalThis.awslambda;
14294
+ if (!lambdaRuntime) {
14295
+ throw new Error("app.toAwsLambda() is only available inside the AWS Lambda runtime");
14296
+ }
14297
+ return lambdaRuntime.streamifyResponse(async (event, responseStream) => {
14298
+ const request = this.lambdaEventToRequest(event);
14299
+ const { response, cleanup } = await this.handleLambdaHttpRequest(request, serverlessOptions);
14300
+ try {
14301
+ await this.writeLambdaResponse(response, responseStream);
14302
+ } finally {
14303
+ await cleanup();
14304
+ }
14305
+ });
14306
+ }
13934
14307
  /**
13935
14308
  * Close a specific transport session.
13936
14309
  */
@@ -13955,6 +14328,97 @@ var App = class {
13955
14328
  getCallerDir() {
13956
14329
  return this.callerDir;
13957
14330
  }
14331
+ lambdaEventToRequest(event) {
14332
+ const headers = new Headers();
14333
+ for (const [key, value] of Object.entries(event.headers ?? {})) {
14334
+ if (value !== void 0) {
14335
+ headers.set(key, value);
14336
+ }
14337
+ }
14338
+ if (event.cookies?.length) {
14339
+ headers.set("cookie", event.cookies.join("; "));
14340
+ }
14341
+ const method = event.requestContext?.http?.method || "GET";
14342
+ const scheme = headers.get("x-forwarded-proto") || "https";
14343
+ const host = headers.get("host") || event.requestContext?.domainName || "localhost";
14344
+ const rawPath = event.rawPath || "/mcp";
14345
+ const query = event.rawQueryString ? `?${event.rawQueryString}` : "";
14346
+ const url = `${scheme}://${host}${rawPath}${query}`;
14347
+ const hasBody = event.body !== void 0 && event.body !== null && method !== "GET" && method !== "HEAD";
14348
+ const body = hasBody ? Buffer.from(event.body, event.isBase64Encoded ? "base64" : "utf8") : void 0;
14349
+ return new Request(url, {
14350
+ method,
14351
+ headers,
14352
+ body
14353
+ });
14354
+ }
14355
+ async handleLambdaHttpRequest(request, options) {
14356
+ const transport = new WebStandardStreamableHTTPServerTransport({
14357
+ sessionIdGenerator: void 0,
14358
+ enableJsonResponse: options.enableJsonResponse ?? false
14359
+ });
14360
+ const server = this.createMcpServer({ serverless: options });
14361
+ await server.connect(transport);
14362
+ setCurrentServer(server);
14363
+ return {
14364
+ response: await transport.handleRequest(request),
14365
+ cleanup: async () => {
14366
+ await server.close().catch(() => {
14367
+ });
14368
+ }
14369
+ };
14370
+ }
14371
+ async writeLambdaResponse(response, responseStream) {
14372
+ const headers = {};
14373
+ response.headers.forEach((value, key) => {
14374
+ if (key.toLowerCase() !== "set-cookie") {
14375
+ headers[key] = value;
14376
+ }
14377
+ });
14378
+ const getSetCookie = response.headers.getSetCookie;
14379
+ const cookies = typeof getSetCookie === "function" ? getSetCookie.call(response.headers) : void 0;
14380
+ const writable = awslambda.HttpResponseStream.from(responseStream, {
14381
+ statusCode: response.status,
14382
+ headers,
14383
+ ...cookies && cookies.length > 0 ? { cookies } : {}
14384
+ });
14385
+ if (!response.body) {
14386
+ writable.end();
14387
+ return;
14388
+ }
14389
+ await pipeline(Readable2.fromWeb(response.body), writable);
14390
+ }
14391
+ isStatelessTransport(options) {
14392
+ return options?.serverless?.transportMode === "stateless";
14393
+ }
14394
+ getStateAdapter(options) {
14395
+ return options?.serverless?.stateAdapter;
14396
+ }
14397
+ async loadInstanceState(instanceId, options) {
14398
+ const adapter = this.getStateAdapter(options);
14399
+ if (adapter) {
14400
+ return adapter.get(instanceId);
14401
+ }
14402
+ return this.instanceState.get(instanceId);
14403
+ }
14404
+ async persistInstanceState(instanceId, state, options) {
14405
+ const adapter = this.getStateAdapter(options);
14406
+ if (adapter) {
14407
+ await adapter.set(instanceId, state);
14408
+ return;
14409
+ }
14410
+ this.instanceState.set(instanceId, state);
14411
+ }
14412
+ deleteInstanceState(instanceId, options) {
14413
+ const adapter = this.getStateAdapter(options);
14414
+ if (adapter) {
14415
+ void adapter.delete(instanceId).catch((error) => {
14416
+ console.error(`[MCP] Failed to delete state for ${instanceId}:`, error);
14417
+ });
14418
+ return;
14419
+ }
14420
+ this.instanceState.delete(instanceId);
14421
+ }
13958
14422
  // ==========================================================================
13959
14423
  // Public API: MCP Request Handling (for testing)
13960
14424
  // ==========================================================================
@@ -13985,7 +14449,7 @@ var App = class {
13985
14449
  const toolMeta = this.buildToolMeta(config);
13986
14450
  tools.push({
13987
14451
  name,
13988
- description: this.buildToolDescription(config, config.input || z2.object({})),
14452
+ description: this.buildToolDescription(config, config.input || z3.object({})),
13989
14453
  inputSchema: config.input ? this.zodToJsonSchema(config.input) : { type: "object" },
13990
14454
  ...config.annotations && { annotations: config.annotations },
13991
14455
  ...Object.keys(toolMeta).length > 0 && { _meta: toolMeta }
@@ -14173,7 +14637,7 @@ var App = class {
14173
14637
  // ==========================================================================
14174
14638
  // Private: Express Server
14175
14639
  // ==========================================================================
14176
- createExpressApp() {
14640
+ createExpressApp(options) {
14177
14641
  const app = express();
14178
14642
  app.use(express.json({ limit: "50mb" }));
14179
14643
  if (this.config.cors !== false) {
@@ -14201,12 +14665,12 @@ var App = class {
14201
14665
  websockets: this.instanceWebSockets.size
14202
14666
  });
14203
14667
  });
14204
- app.post("/mcp", (req, res) => this.handleMcpPost(req, res));
14205
- app.get("/mcp", (req, res) => this.handleMcpGet(req, res));
14206
- app.delete("/mcp", (req, res) => this.handleMcpDelete(req, res));
14668
+ app.post("/mcp", (req, res) => this.handleMcpPost(req, res, options));
14669
+ app.get("/mcp", (req, res) => this.handleMcpGet(req, res, options));
14670
+ app.delete("/mcp", (req, res) => this.handleMcpDelete(req, res, options));
14207
14671
  return app;
14208
14672
  }
14209
- async handleMcpPost(req, res) {
14673
+ async handleMcpPost(req, res, options) {
14210
14674
  const transportSessionId = req.headers["mcp-session-id"];
14211
14675
  try {
14212
14676
  if (req.body?.method === "tools/list" && this.tools.size === 0) {
@@ -14218,6 +14682,14 @@ var App = class {
14218
14682
  return;
14219
14683
  }
14220
14684
  let transport;
14685
+ if (this.isStatelessTransport(options)) {
14686
+ transport = this.createTransport(options);
14687
+ const server = this.createMcpServer(options);
14688
+ await server.connect(transport);
14689
+ setCurrentServer(server);
14690
+ await transport.handleRequest(req, res, req.body);
14691
+ return;
14692
+ }
14221
14693
  if (transportSessionId && this.transports.has(transportSessionId)) {
14222
14694
  transport = this.transports.get(transportSessionId);
14223
14695
  } else if (!transportSessionId && isInitializeRequest2(req.body)) {
@@ -14232,11 +14704,11 @@ var App = class {
14232
14704
  this.clientType = "unknown";
14233
14705
  }
14234
14706
  console.log(`[MCP] Client: ${clientName}, type: ${this.clientType}`);
14235
- transport = this.createTransport();
14236
- const server = this.createMcpServer();
14707
+ transport = this.createTransport(options);
14708
+ const server = this.createMcpServer(options);
14237
14709
  await server.connect(transport);
14238
14710
  this.serverByTransport.set(transport, server);
14239
- setCurrentServer({ server });
14711
+ setCurrentServer(server);
14240
14712
  await transport.handleRequest(req, res, req.body);
14241
14713
  return;
14242
14714
  } else {
@@ -14259,8 +14731,16 @@ var App = class {
14259
14731
  }
14260
14732
  }
14261
14733
  }
14262
- async handleMcpGet(req, res) {
14734
+ async handleMcpGet(req, res, options) {
14263
14735
  const transportSessionId = req.headers["mcp-session-id"];
14736
+ if (this.isStatelessTransport(options)) {
14737
+ const transport2 = this.createTransport(options);
14738
+ const server = this.createMcpServer(options);
14739
+ await server.connect(transport2);
14740
+ setCurrentServer(server);
14741
+ await transport2.handleRequest(req, res);
14742
+ return;
14743
+ }
14264
14744
  if (!transportSessionId || !this.transports.has(transportSessionId)) {
14265
14745
  res.status(400).send("Invalid or missing transport session ID");
14266
14746
  return;
@@ -14268,8 +14748,16 @@ var App = class {
14268
14748
  const transport = this.transports.get(transportSessionId);
14269
14749
  await transport.handleRequest(req, res);
14270
14750
  }
14271
- async handleMcpDelete(req, res) {
14751
+ async handleMcpDelete(req, res, options) {
14272
14752
  const transportSessionId = req.headers["mcp-session-id"];
14753
+ if (this.isStatelessTransport(options)) {
14754
+ const transport2 = this.createTransport(options);
14755
+ const server = this.createMcpServer(options);
14756
+ await server.connect(transport2);
14757
+ setCurrentServer(server);
14758
+ await transport2.handleRequest(req, res);
14759
+ return;
14760
+ }
14273
14761
  if (!transportSessionId || !this.transports.has(transportSessionId)) {
14274
14762
  res.status(400).send("Invalid or missing transport session ID");
14275
14763
  return;
@@ -14280,10 +14768,12 @@ var App = class {
14280
14768
  // ==========================================================================
14281
14769
  // Private: MCP Server & Transport
14282
14770
  // ==========================================================================
14283
- createTransport() {
14771
+ createTransport(options) {
14772
+ const stateless = this.isStatelessTransport(options);
14284
14773
  const transport = new StreamableHTTPServerTransport({
14285
- sessionIdGenerator: () => randomUUID(),
14286
- onsessioninitialized: (newSessionId) => {
14774
+ sessionIdGenerator: stateless ? void 0 : (() => randomUUID()),
14775
+ enableJsonResponse: options?.serverless?.enableJsonResponse ?? false,
14776
+ onsessioninitialized: stateless ? void 0 : (newSessionId) => {
14287
14777
  this.transports.set(newSessionId, transport);
14288
14778
  console.log(`[MCP] Transport session created: ${newSessionId}`);
14289
14779
  this.config.onTransportSessionCreated?.({
@@ -14313,7 +14803,7 @@ var App = class {
14313
14803
  };
14314
14804
  return transport;
14315
14805
  }
14316
- createMcpServer() {
14806
+ createMcpServer(options) {
14317
14807
  const server = new McpServer(
14318
14808
  {
14319
14809
  name: this.config.name,
@@ -14323,7 +14813,7 @@ var App = class {
14323
14813
  { capabilities: { logging: {}, tools: {}, resources: {} } }
14324
14814
  );
14325
14815
  this.registerResources(server);
14326
- this.registerTools(server);
14816
+ this.registerTools(server, options);
14327
14817
  return server;
14328
14818
  }
14329
14819
  registerResources(server) {
@@ -14409,10 +14899,10 @@ var App = class {
14409
14899
  );
14410
14900
  }
14411
14901
  }
14412
- registerTools(server) {
14902
+ registerTools(server, options) {
14413
14903
  for (const [name, { config, handler }] of this.tools) {
14414
14904
  const toolMeta = this.buildToolMeta(config);
14415
- const baseSchema = config.input || z2.object({});
14905
+ const baseSchema = config.input || z3.object({});
14416
14906
  const inputSchema = "passthrough" in baseSchema && typeof baseSchema.passthrough === "function" ? baseSchema.passthrough() : baseSchema;
14417
14907
  const description = this.buildToolDescription(config, baseSchema);
14418
14908
  const hasUi = !!config.ui;
@@ -14426,9 +14916,10 @@ var App = class {
14426
14916
  },
14427
14917
  async (args) => {
14428
14918
  let startMs = Date.now();
14919
+ let instanceId;
14920
+ let stateDirty = false;
14429
14921
  try {
14430
14922
  const input = config.input ? config.input.parse(args) : args;
14431
- let instanceId;
14432
14923
  if (hasUi && config.ui) {
14433
14924
  instanceId = this.resolveInstanceId(args._instanceId);
14434
14925
  }
@@ -14436,15 +14927,21 @@ var App = class {
14436
14927
  const hasWebSocket = resource?.config.experimental?.websocket === true;
14437
14928
  let ws;
14438
14929
  let websocketUrl;
14439
- if (hasWebSocket && instanceId) {
14930
+ if (hasWebSocket && instanceId && !options?.serverless) {
14440
14931
  ws = this.getOrCreateWebSocket(instanceId);
14441
14932
  websocketUrl = ws?.websocketUrl;
14442
14933
  }
14934
+ let currentState = instanceId ? await this.loadInstanceState(instanceId, options) : void 0;
14935
+ if (instanceId && currentState !== void 0) {
14936
+ this.instanceState.set(instanceId, currentState);
14937
+ }
14443
14938
  const context = {
14444
14939
  instanceId: instanceId || "",
14445
- getState: () => instanceId ? this.instanceState.get(instanceId) : void 0,
14940
+ getState: () => currentState,
14446
14941
  setState: (state) => {
14447
14942
  if (instanceId) {
14943
+ currentState = state;
14944
+ stateDirty = true;
14448
14945
  this.instanceState.set(instanceId, state);
14449
14946
  }
14450
14947
  },
@@ -14475,6 +14972,9 @@ var App = class {
14475
14972
  startMs = Date.now();
14476
14973
  const result = await handler(input, context);
14477
14974
  const durationMs = Date.now() - startMs;
14975
+ if (instanceId && stateDirty) {
14976
+ await this.persistInstanceState(instanceId, currentState, options);
14977
+ }
14478
14978
  try {
14479
14979
  this.config.onAfterToolCall?.({ toolName: name, args, result, durationMs, isError: false });
14480
14980
  } catch {
@@ -14488,6 +14988,9 @@ var App = class {
14488
14988
  const durationMs = Date.now() - startMs;
14489
14989
  console.error(`[MCP] Tool "${name}" failed:`, err.message);
14490
14990
  this.config.onToolError?.(name, err, args);
14991
+ if (instanceId && stateDirty) {
14992
+ await this.persistInstanceState(instanceId, this.instanceState.get(instanceId), options);
14993
+ }
14491
14994
  try {
14492
14995
  this.config.onAfterToolCall?.({ toolName: name, args, durationMs, isError: true, error: err });
14493
14996
  } catch {
@@ -14733,7 +15236,7 @@ function wrapServer(server) {
14733
15236
  import fs2 from "fs";
14734
15237
  import fsPromises from "fs/promises";
14735
15238
  import path3 from "path";
14736
- import { z as z3 } from "zod";
15239
+ import { z as z4 } from "zod";
14737
15240
  var getStorageDir = () => {
14738
15241
  const dir = process.env.CREATURE_MCP_STORAGE_DIR;
14739
15242
  return dir && dir.length > 0 ? dir : null;
@@ -14831,6 +15334,235 @@ function experimental_rmdirSync(relativePath) {
14831
15334
  const safePath = resolveSafePath(relativePath);
14832
15335
  fs2.rmSync(safePath, { recursive: true, force: true });
14833
15336
  }
15337
+ var MAX_KEY_LENGTH = 256;
15338
+ var MAX_VECTOR_TEXT_LENGTH = 2e4;
15339
+ var sanitizeKey = (key) => {
15340
+ if (!key || key.length === 0) {
15341
+ throw new Error("Key cannot be empty");
15342
+ }
15343
+ if (key.length > MAX_KEY_LENGTH) {
15344
+ throw new Error(`Key exceeds maximum length of ${MAX_KEY_LENGTH}`);
15345
+ }
15346
+ if (key.includes("..")) {
15347
+ throw new Error("Key cannot contain '..'");
15348
+ }
15349
+ if (path3.isAbsolute(key)) {
15350
+ throw new Error("Key cannot be an absolute path");
15351
+ }
15352
+ if (!/^[a-zA-Z0-9_\-./:]+$/.test(key)) {
15353
+ throw new Error("Key contains invalid characters");
15354
+ }
15355
+ return key;
15356
+ };
15357
+ function experimental_kvIsAvailable() {
15358
+ return isStorageRpcAvailable() || getStorageDir() !== null;
15359
+ }
15360
+ async function experimental_kvGet(key) {
15361
+ const sanitizedKey = sanitizeKey(key);
15362
+ if (isStorageRpcAvailable()) {
15363
+ try {
15364
+ return await rpcKvGet(sanitizedKey);
15365
+ } catch (error) {
15366
+ console.error("[KV] RPC error in kvGet:", error);
15367
+ return null;
15368
+ }
15369
+ }
15370
+ return null;
15371
+ }
15372
+ function experimental_kvGetSync(key) {
15373
+ console.warn("[KV] experimental_kvGetSync is deprecated. Use experimental_kvGet for cross-platform support.");
15374
+ return null;
15375
+ }
15376
+ async function experimental_kvSet(key, value) {
15377
+ const sanitizedKey = sanitizeKey(key);
15378
+ if (isStorageRpcAvailable()) {
15379
+ try {
15380
+ return await rpcKvSet(sanitizedKey, value);
15381
+ } catch (error) {
15382
+ console.error("[KV] RPC error in kvSet:", error);
15383
+ return false;
15384
+ }
15385
+ }
15386
+ return false;
15387
+ }
15388
+ function experimental_kvSetSync(key, value) {
15389
+ console.warn("[KV] experimental_kvSetSync is deprecated. Use experimental_kvSet for cross-platform support.");
15390
+ return false;
15391
+ }
15392
+ async function experimental_kvDelete(key) {
15393
+ const sanitizedKey = sanitizeKey(key);
15394
+ if (isStorageRpcAvailable()) {
15395
+ try {
15396
+ return await rpcKvDelete(sanitizedKey);
15397
+ } catch (error) {
15398
+ console.error("[KV] RPC error in kvDelete:", error);
15399
+ return false;
15400
+ }
15401
+ }
15402
+ return false;
15403
+ }
15404
+ function experimental_kvDeleteSync(key) {
15405
+ console.warn("[KV] experimental_kvDeleteSync is deprecated. Use experimental_kvDelete for cross-platform support.");
15406
+ return false;
15407
+ }
15408
+ async function experimental_kvList(prefix) {
15409
+ const sanitizedPrefix = prefix ? sanitizeKey(prefix) : void 0;
15410
+ if (isStorageRpcAvailable()) {
15411
+ try {
15412
+ return await rpcKvList(sanitizedPrefix);
15413
+ } catch (error) {
15414
+ console.error("[KV] RPC error in kvList:", error);
15415
+ return null;
15416
+ }
15417
+ }
15418
+ return null;
15419
+ }
15420
+ async function experimental_kvListWithValues(prefix) {
15421
+ const sanitizedPrefix = prefix ? sanitizeKey(prefix) : void 0;
15422
+ if (isStorageRpcAvailable()) {
15423
+ try {
15424
+ return await rpcKvListWithValues(sanitizedPrefix);
15425
+ } catch (error) {
15426
+ console.error("[KV] RPC error in kvListWithValues:", error);
15427
+ return null;
15428
+ }
15429
+ }
15430
+ return null;
15431
+ }
15432
+ function experimental_kvListSync(prefix) {
15433
+ console.warn("[KV] experimental_kvListSync is deprecated. Use experimental_kvList for cross-platform support.");
15434
+ return null;
15435
+ }
15436
+ async function experimental_kvSearch(query, options) {
15437
+ if (!query || query.trim().length === 0) {
15438
+ throw new Error("Search query cannot be empty");
15439
+ }
15440
+ const sanitizedPrefix = options?.prefix ? sanitizeKey(options.prefix) : void 0;
15441
+ if (isStorageRpcAvailable()) {
15442
+ try {
15443
+ return await rpcKvSearch(query, {
15444
+ prefix: sanitizedPrefix,
15445
+ limit: options?.limit
15446
+ });
15447
+ } catch (error) {
15448
+ console.error("[KV] RPC error in kvSearch:", error);
15449
+ return null;
15450
+ }
15451
+ }
15452
+ return null;
15453
+ }
15454
+ function experimental_vectorIsAvailable() {
15455
+ return isStorageRpcAvailable();
15456
+ }
15457
+ async function experimental_vectorUpsert(key, text, metadata) {
15458
+ const sanitizedKey = sanitizeKey(key);
15459
+ const trimmed = text.trim();
15460
+ if (!trimmed) {
15461
+ throw new Error("Text cannot be empty");
15462
+ }
15463
+ if (trimmed.length > MAX_VECTOR_TEXT_LENGTH) {
15464
+ throw new Error(`Text exceeds maximum length of ${MAX_VECTOR_TEXT_LENGTH}`);
15465
+ }
15466
+ if (!isStorageRpcAvailable()) {
15467
+ return false;
15468
+ }
15469
+ return rpcVectorUpsert(sanitizedKey, trimmed, metadata);
15470
+ }
15471
+ async function experimental_vectorSearch(query, options) {
15472
+ const trimmed = query.trim();
15473
+ if (!trimmed) {
15474
+ throw new Error("Search query cannot be empty");
15475
+ }
15476
+ if (trimmed.length > MAX_VECTOR_TEXT_LENGTH) {
15477
+ throw new Error(`Text exceeds maximum length of ${MAX_VECTOR_TEXT_LENGTH}`);
15478
+ }
15479
+ const sanitizedPrefix = options?.prefix ? sanitizeKey(options.prefix) : void 0;
15480
+ if (!isStorageRpcAvailable()) {
15481
+ return null;
15482
+ }
15483
+ return rpcVectorSearch(trimmed, {
15484
+ prefix: sanitizedPrefix,
15485
+ limit: options?.limit
15486
+ });
15487
+ }
15488
+ async function experimental_vectorDelete(key) {
15489
+ const sanitizedKey = sanitizeKey(key);
15490
+ if (!isStorageRpcAvailable()) {
15491
+ return false;
15492
+ }
15493
+ return rpcVectorDelete(sanitizedKey);
15494
+ }
15495
+ var MAX_BLOB_SIZE = 10 * 1024 * 1024;
15496
+ function experimental_blobIsAvailable() {
15497
+ return isStorageRpcAvailable() || getStorageDir() !== null;
15498
+ }
15499
+ async function experimental_blobPut(name, data, mimeType) {
15500
+ const sanitizedName = sanitizeKey(name);
15501
+ if (data.length > MAX_BLOB_SIZE) {
15502
+ throw new Error(`Blob exceeds maximum size of ${MAX_BLOB_SIZE} bytes`);
15503
+ }
15504
+ if (isStorageRpcAvailable()) {
15505
+ try {
15506
+ return await rpcBlobPut(sanitizedName, data, mimeType);
15507
+ } catch (error) {
15508
+ console.error("[Blob] RPC error in blobPut:", error);
15509
+ return null;
15510
+ }
15511
+ }
15512
+ return null;
15513
+ }
15514
+ function experimental_blobPutSync(name, data, mimeType) {
15515
+ console.warn("[Blob] experimental_blobPutSync is deprecated. Use experimental_blobPut for cross-platform support.");
15516
+ return null;
15517
+ }
15518
+ async function experimental_blobGet(name) {
15519
+ const sanitizedName = sanitizeKey(name);
15520
+ if (isStorageRpcAvailable()) {
15521
+ try {
15522
+ return await rpcBlobGet(sanitizedName);
15523
+ } catch (error) {
15524
+ console.error("[Blob] RPC error in blobGet:", error);
15525
+ return null;
15526
+ }
15527
+ }
15528
+ return null;
15529
+ }
15530
+ function experimental_blobGetSync(name) {
15531
+ console.warn("[Blob] experimental_blobGetSync is deprecated. Use experimental_blobGet for cross-platform support.");
15532
+ return null;
15533
+ }
15534
+ async function experimental_blobDelete(name) {
15535
+ const sanitizedName = sanitizeKey(name);
15536
+ if (isStorageRpcAvailable()) {
15537
+ try {
15538
+ return await rpcBlobDelete(sanitizedName);
15539
+ } catch (error) {
15540
+ console.error("[Blob] RPC error in blobDelete:", error);
15541
+ return false;
15542
+ }
15543
+ }
15544
+ return false;
15545
+ }
15546
+ function experimental_blobDeleteSync(name) {
15547
+ console.warn("[Blob] experimental_blobDeleteSync is deprecated. Use experimental_blobDelete for cross-platform support.");
15548
+ return false;
15549
+ }
15550
+ async function experimental_blobList(prefix) {
15551
+ const sanitizedPrefix = prefix ? sanitizeKey(prefix) : void 0;
15552
+ if (isStorageRpcAvailable()) {
15553
+ try {
15554
+ return await rpcBlobList(sanitizedPrefix);
15555
+ } catch (error) {
15556
+ console.error("[Blob] RPC error in blobList:", error);
15557
+ return null;
15558
+ }
15559
+ }
15560
+ return null;
15561
+ }
15562
+ function experimental_blobListSync(prefix) {
15563
+ console.warn("[Blob] experimental_blobListSync is deprecated. Use experimental_blobList for cross-platform support.");
15564
+ return null;
15565
+ }
14834
15566
  async function experimental_sampleMessage(params) {
14835
15567
  const server = getCurrentServer();
14836
15568
  if (!server) {
@@ -14838,7 +15570,7 @@ async function experimental_sampleMessage(params) {
14838
15570
  }
14839
15571
  const rawResult = await server.server.request(
14840
15572
  { method: "sampling/createMessage", params },
14841
- z3.record(z3.unknown())
15573
+ z4.record(z4.unknown())
14842
15574
  );
14843
15575
  const result = rawResult;
14844
15576
  const content = result.content;
@@ -14883,6 +15615,40 @@ var exp = {
14883
15615
  mkdirSync: experimental_mkdirSync,
14884
15616
  readdirSync: experimental_readdirSync,
14885
15617
  rmdirSync: experimental_rmdirSync,
15618
+ // KV Store
15619
+ kvIsAvailable: experimental_kvIsAvailable,
15620
+ kvGet: experimental_kvGet,
15621
+ kvSet: experimental_kvSet,
15622
+ kvDelete: experimental_kvDelete,
15623
+ kvList: experimental_kvList,
15624
+ kvListWithValues: experimental_kvListWithValues,
15625
+ kvSearch: experimental_kvSearch,
15626
+ vectorIsAvailable: experimental_vectorIsAvailable,
15627
+ vectorUpsert: experimental_vectorUpsert,
15628
+ vectorSearch: experimental_vectorSearch,
15629
+ vectorDelete: experimental_vectorDelete,
15630
+ /** @deprecated Use kvGet instead */
15631
+ kvGetSync: experimental_kvGetSync,
15632
+ /** @deprecated Use kvSet instead */
15633
+ kvSetSync: experimental_kvSetSync,
15634
+ /** @deprecated Use kvDelete instead */
15635
+ kvDeleteSync: experimental_kvDeleteSync,
15636
+ /** @deprecated Use kvList instead */
15637
+ kvListSync: experimental_kvListSync,
15638
+ // Blob Store
15639
+ blobIsAvailable: experimental_blobIsAvailable,
15640
+ blobPut: experimental_blobPut,
15641
+ blobGet: experimental_blobGet,
15642
+ blobDelete: experimental_blobDelete,
15643
+ blobList: experimental_blobList,
15644
+ /** @deprecated Use blobPut instead */
15645
+ blobPutSync: experimental_blobPutSync,
15646
+ /** @deprecated Use blobGet instead */
15647
+ blobGetSync: experimental_blobGetSync,
15648
+ /** @deprecated Use blobDelete instead */
15649
+ blobDeleteSync: experimental_blobDeleteSync,
15650
+ /** @deprecated Use blobList instead */
15651
+ blobListSync: experimental_blobListSync,
14886
15652
  sampleMessage: experimental_sampleMessage
14887
15653
  };
14888
15654
  export {
@@ -14890,6 +15656,15 @@ export {
14890
15656
  MIME_TYPES,
14891
15657
  createApp,
14892
15658
  exp,
15659
+ experimental_blobDelete,
15660
+ experimental_blobDeleteSync,
15661
+ experimental_blobGet,
15662
+ experimental_blobGetSync,
15663
+ experimental_blobIsAvailable,
15664
+ experimental_blobList,
15665
+ experimental_blobListSync,
15666
+ experimental_blobPut,
15667
+ experimental_blobPutSync,
14893
15668
  experimental_deleteFile,
14894
15669
  experimental_deleteFileSync,
14895
15670
  experimental_exists,
@@ -14897,6 +15672,16 @@ export {
14897
15672
  experimental_getProjectId,
14898
15673
  experimental_getServerName,
14899
15674
  experimental_getWritableDirectory,
15675
+ experimental_kvDelete,
15676
+ experimental_kvDeleteSync,
15677
+ experimental_kvGet,
15678
+ experimental_kvGetSync,
15679
+ experimental_kvIsAvailable,
15680
+ experimental_kvList,
15681
+ experimental_kvListSync,
15682
+ experimental_kvSearch,
15683
+ experimental_kvSet,
15684
+ experimental_kvSetSync,
14900
15685
  experimental_mkdir,
14901
15686
  experimental_mkdirSync,
14902
15687
  experimental_readFile,
@@ -14906,6 +15691,10 @@ export {
14906
15691
  experimental_rmdir,
14907
15692
  experimental_rmdirSync,
14908
15693
  experimental_sampleMessage,
15694
+ experimental_vectorDelete,
15695
+ experimental_vectorIsAvailable,
15696
+ experimental_vectorSearch,
15697
+ experimental_vectorUpsert,
14909
15698
  experimental_writeFile,
14910
15699
  experimental_writeFileSync,
14911
15700
  htmlLoader,