@hanhnd/agent-kit 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -208
- package/dist/kit-server.js +1062 -307
- package/dist/memory/__tests__/chunker.test.d.ts +1 -0
- package/dist/memory/__tests__/chunker.test.js +105 -0
- package/dist/memory/__tests__/indexer.test.d.ts +1 -0
- package/dist/memory/__tests__/indexer.test.js +332 -0
- package/dist/memory/__tests__/store.test.d.ts +1 -0
- package/dist/memory/__tests__/store.test.js +133 -0
- package/dist/memory/chunker.d.ts +4 -0
- package/dist/memory/chunker.js +147 -0
- package/dist/memory/embedder.d.ts +13 -0
- package/dist/memory/embedder.js +68 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +4 -0
- package/dist/memory/indexer.d.ts +20 -0
- package/dist/memory/indexer.js +222 -0
- package/dist/memory/store.d.ts +29 -0
- package/dist/memory/store.js +268 -0
- package/dist/memory/types.d.ts +30 -0
- package/dist/memory/types.js +9 -0
- package/dist/tools/__tests__/memory.test.d.ts +1 -0
- package/dist/tools/__tests__/memory.test.js +185 -0
- package/dist/tools/config.d.ts +7 -0
- package/dist/tools/config.js +15 -0
- package/dist/tools/memory.d.ts +16 -0
- package/dist/tools/memory.js +75 -0
- package/dist/utils/utils.js +3 -1
- package/package.json +14 -9
package/dist/kit-server.js
CHANGED
|
@@ -6,7 +6,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
10
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
17
|
};
|
|
12
18
|
var __export = (target, all) => {
|
|
@@ -30,9 +36,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
36
|
mod
|
|
31
37
|
));
|
|
32
38
|
|
|
33
|
-
//
|
|
39
|
+
// ../node_modules/ajv/dist/compile/codegen/code.js
|
|
34
40
|
var require_code = __commonJS({
|
|
35
|
-
"
|
|
41
|
+
"../node_modules/ajv/dist/compile/codegen/code.js"(exports) {
|
|
36
42
|
"use strict";
|
|
37
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
44
|
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;
|
|
@@ -184,9 +190,9 @@ var require_code = __commonJS({
|
|
|
184
190
|
}
|
|
185
191
|
});
|
|
186
192
|
|
|
187
|
-
//
|
|
193
|
+
// ../node_modules/ajv/dist/compile/codegen/scope.js
|
|
188
194
|
var require_scope = __commonJS({
|
|
189
|
-
"
|
|
195
|
+
"../node_modules/ajv/dist/compile/codegen/scope.js"(exports) {
|
|
190
196
|
"use strict";
|
|
191
197
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
192
198
|
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
|
@@ -329,9 +335,9 @@ var require_scope = __commonJS({
|
|
|
329
335
|
}
|
|
330
336
|
});
|
|
331
337
|
|
|
332
|
-
//
|
|
338
|
+
// ../node_modules/ajv/dist/compile/codegen/index.js
|
|
333
339
|
var require_codegen = __commonJS({
|
|
334
|
-
"
|
|
340
|
+
"../node_modules/ajv/dist/compile/codegen/index.js"(exports) {
|
|
335
341
|
"use strict";
|
|
336
342
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
337
343
|
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;
|
|
@@ -1049,9 +1055,9 @@ var require_codegen = __commonJS({
|
|
|
1049
1055
|
}
|
|
1050
1056
|
});
|
|
1051
1057
|
|
|
1052
|
-
//
|
|
1058
|
+
// ../node_modules/ajv/dist/compile/util.js
|
|
1053
1059
|
var require_util = __commonJS({
|
|
1054
|
-
"
|
|
1060
|
+
"../node_modules/ajv/dist/compile/util.js"(exports) {
|
|
1055
1061
|
"use strict";
|
|
1056
1062
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1057
1063
|
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;
|
|
@@ -1216,9 +1222,9 @@ var require_util = __commonJS({
|
|
|
1216
1222
|
}
|
|
1217
1223
|
});
|
|
1218
1224
|
|
|
1219
|
-
//
|
|
1225
|
+
// ../node_modules/ajv/dist/compile/names.js
|
|
1220
1226
|
var require_names = __commonJS({
|
|
1221
|
-
"
|
|
1227
|
+
"../node_modules/ajv/dist/compile/names.js"(exports) {
|
|
1222
1228
|
"use strict";
|
|
1223
1229
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1224
1230
|
var codegen_1 = require_codegen();
|
|
@@ -1255,9 +1261,9 @@ var require_names = __commonJS({
|
|
|
1255
1261
|
}
|
|
1256
1262
|
});
|
|
1257
1263
|
|
|
1258
|
-
//
|
|
1264
|
+
// ../node_modules/ajv/dist/compile/errors.js
|
|
1259
1265
|
var require_errors = __commonJS({
|
|
1260
|
-
"
|
|
1266
|
+
"../node_modules/ajv/dist/compile/errors.js"(exports) {
|
|
1261
1267
|
"use strict";
|
|
1262
1268
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1263
1269
|
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
|
|
@@ -1377,9 +1383,9 @@ var require_errors = __commonJS({
|
|
|
1377
1383
|
}
|
|
1378
1384
|
});
|
|
1379
1385
|
|
|
1380
|
-
//
|
|
1386
|
+
// ../node_modules/ajv/dist/compile/validate/boolSchema.js
|
|
1381
1387
|
var require_boolSchema = __commonJS({
|
|
1382
|
-
"
|
|
1388
|
+
"../node_modules/ajv/dist/compile/validate/boolSchema.js"(exports) {
|
|
1383
1389
|
"use strict";
|
|
1384
1390
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1385
1391
|
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
|
|
@@ -1428,9 +1434,9 @@ var require_boolSchema = __commonJS({
|
|
|
1428
1434
|
}
|
|
1429
1435
|
});
|
|
1430
1436
|
|
|
1431
|
-
//
|
|
1437
|
+
// ../node_modules/ajv/dist/compile/rules.js
|
|
1432
1438
|
var require_rules = __commonJS({
|
|
1433
|
-
"
|
|
1439
|
+
"../node_modules/ajv/dist/compile/rules.js"(exports) {
|
|
1434
1440
|
"use strict";
|
|
1435
1441
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1436
1442
|
exports.getRules = exports.isJSONType = void 0;
|
|
@@ -1459,9 +1465,9 @@ var require_rules = __commonJS({
|
|
|
1459
1465
|
}
|
|
1460
1466
|
});
|
|
1461
1467
|
|
|
1462
|
-
//
|
|
1468
|
+
// ../node_modules/ajv/dist/compile/validate/applicability.js
|
|
1463
1469
|
var require_applicability = __commonJS({
|
|
1464
|
-
"
|
|
1470
|
+
"../node_modules/ajv/dist/compile/validate/applicability.js"(exports) {
|
|
1465
1471
|
"use strict";
|
|
1466
1472
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1467
1473
|
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
|
@@ -1482,9 +1488,9 @@ var require_applicability = __commonJS({
|
|
|
1482
1488
|
}
|
|
1483
1489
|
});
|
|
1484
1490
|
|
|
1485
|
-
//
|
|
1491
|
+
// ../node_modules/ajv/dist/compile/validate/dataType.js
|
|
1486
1492
|
var require_dataType = __commonJS({
|
|
1487
|
-
"
|
|
1493
|
+
"../node_modules/ajv/dist/compile/validate/dataType.js"(exports) {
|
|
1488
1494
|
"use strict";
|
|
1489
1495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1490
1496
|
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
|
|
@@ -1666,9 +1672,9 @@ var require_dataType = __commonJS({
|
|
|
1666
1672
|
}
|
|
1667
1673
|
});
|
|
1668
1674
|
|
|
1669
|
-
//
|
|
1675
|
+
// ../node_modules/ajv/dist/compile/validate/defaults.js
|
|
1670
1676
|
var require_defaults = __commonJS({
|
|
1671
|
-
"
|
|
1677
|
+
"../node_modules/ajv/dist/compile/validate/defaults.js"(exports) {
|
|
1672
1678
|
"use strict";
|
|
1673
1679
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1674
1680
|
exports.assignDefaults = void 0;
|
|
@@ -1703,9 +1709,9 @@ var require_defaults = __commonJS({
|
|
|
1703
1709
|
}
|
|
1704
1710
|
});
|
|
1705
1711
|
|
|
1706
|
-
//
|
|
1712
|
+
// ../node_modules/ajv/dist/vocabularies/code.js
|
|
1707
1713
|
var require_code2 = __commonJS({
|
|
1708
|
-
"
|
|
1714
|
+
"../node_modules/ajv/dist/vocabularies/code.js"(exports) {
|
|
1709
1715
|
"use strict";
|
|
1710
1716
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1711
1717
|
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;
|
|
@@ -1836,9 +1842,9 @@ var require_code2 = __commonJS({
|
|
|
1836
1842
|
}
|
|
1837
1843
|
});
|
|
1838
1844
|
|
|
1839
|
-
//
|
|
1845
|
+
// ../node_modules/ajv/dist/compile/validate/keyword.js
|
|
1840
1846
|
var require_keyword = __commonJS({
|
|
1841
|
-
"
|
|
1847
|
+
"../node_modules/ajv/dist/compile/validate/keyword.js"(exports) {
|
|
1842
1848
|
"use strict";
|
|
1843
1849
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1844
1850
|
exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;
|
|
@@ -1954,9 +1960,9 @@ var require_keyword = __commonJS({
|
|
|
1954
1960
|
}
|
|
1955
1961
|
});
|
|
1956
1962
|
|
|
1957
|
-
//
|
|
1963
|
+
// ../node_modules/ajv/dist/compile/validate/subschema.js
|
|
1958
1964
|
var require_subschema = __commonJS({
|
|
1959
|
-
"
|
|
1965
|
+
"../node_modules/ajv/dist/compile/validate/subschema.js"(exports) {
|
|
1960
1966
|
"use strict";
|
|
1961
1967
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1962
1968
|
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
|
|
@@ -2037,9 +2043,9 @@ var require_subschema = __commonJS({
|
|
|
2037
2043
|
}
|
|
2038
2044
|
});
|
|
2039
2045
|
|
|
2040
|
-
//
|
|
2046
|
+
// ../node_modules/fast-deep-equal/index.js
|
|
2041
2047
|
var require_fast_deep_equal = __commonJS({
|
|
2042
|
-
"
|
|
2048
|
+
"../node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
2043
2049
|
"use strict";
|
|
2044
2050
|
module.exports = function equal(a, b) {
|
|
2045
2051
|
if (a === b) return true;
|
|
@@ -2072,9 +2078,9 @@ var require_fast_deep_equal = __commonJS({
|
|
|
2072
2078
|
}
|
|
2073
2079
|
});
|
|
2074
2080
|
|
|
2075
|
-
//
|
|
2081
|
+
// ../node_modules/json-schema-traverse/index.js
|
|
2076
2082
|
var require_json_schema_traverse = __commonJS({
|
|
2077
|
-
"
|
|
2083
|
+
"../node_modules/json-schema-traverse/index.js"(exports, module) {
|
|
2078
2084
|
"use strict";
|
|
2079
2085
|
var traverse = module.exports = function(schema, opts, cb) {
|
|
2080
2086
|
if (typeof opts == "function") {
|
|
@@ -2160,9 +2166,9 @@ var require_json_schema_traverse = __commonJS({
|
|
|
2160
2166
|
}
|
|
2161
2167
|
});
|
|
2162
2168
|
|
|
2163
|
-
//
|
|
2169
|
+
// ../node_modules/ajv/dist/compile/resolve.js
|
|
2164
2170
|
var require_resolve = __commonJS({
|
|
2165
|
-
"
|
|
2171
|
+
"../node_modules/ajv/dist/compile/resolve.js"(exports) {
|
|
2166
2172
|
"use strict";
|
|
2167
2173
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2168
2174
|
exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0;
|
|
@@ -2316,9 +2322,9 @@ var require_resolve = __commonJS({
|
|
|
2316
2322
|
}
|
|
2317
2323
|
});
|
|
2318
2324
|
|
|
2319
|
-
//
|
|
2325
|
+
// ../node_modules/ajv/dist/compile/validate/index.js
|
|
2320
2326
|
var require_validate = __commonJS({
|
|
2321
|
-
"
|
|
2327
|
+
"../node_modules/ajv/dist/compile/validate/index.js"(exports) {
|
|
2322
2328
|
"use strict";
|
|
2323
2329
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2324
2330
|
exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;
|
|
@@ -2824,9 +2830,9 @@ var require_validate = __commonJS({
|
|
|
2824
2830
|
}
|
|
2825
2831
|
});
|
|
2826
2832
|
|
|
2827
|
-
//
|
|
2833
|
+
// ../node_modules/ajv/dist/runtime/validation_error.js
|
|
2828
2834
|
var require_validation_error = __commonJS({
|
|
2829
|
-
"
|
|
2835
|
+
"../node_modules/ajv/dist/runtime/validation_error.js"(exports) {
|
|
2830
2836
|
"use strict";
|
|
2831
2837
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2832
2838
|
var ValidationError = class extends Error {
|
|
@@ -2840,9 +2846,9 @@ var require_validation_error = __commonJS({
|
|
|
2840
2846
|
}
|
|
2841
2847
|
});
|
|
2842
2848
|
|
|
2843
|
-
//
|
|
2849
|
+
// ../node_modules/ajv/dist/compile/ref_error.js
|
|
2844
2850
|
var require_ref_error = __commonJS({
|
|
2845
|
-
"
|
|
2851
|
+
"../node_modules/ajv/dist/compile/ref_error.js"(exports) {
|
|
2846
2852
|
"use strict";
|
|
2847
2853
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2848
2854
|
var resolve_1 = require_resolve();
|
|
@@ -2857,9 +2863,9 @@ var require_ref_error = __commonJS({
|
|
|
2857
2863
|
}
|
|
2858
2864
|
});
|
|
2859
2865
|
|
|
2860
|
-
//
|
|
2866
|
+
// ../node_modules/ajv/dist/compile/index.js
|
|
2861
2867
|
var require_compile = __commonJS({
|
|
2862
|
-
"
|
|
2868
|
+
"../node_modules/ajv/dist/compile/index.js"(exports) {
|
|
2863
2869
|
"use strict";
|
|
2864
2870
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2865
2871
|
exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;
|
|
@@ -3081,9 +3087,9 @@ var require_compile = __commonJS({
|
|
|
3081
3087
|
}
|
|
3082
3088
|
});
|
|
3083
3089
|
|
|
3084
|
-
//
|
|
3090
|
+
// ../node_modules/ajv/dist/refs/data.json
|
|
3085
3091
|
var require_data = __commonJS({
|
|
3086
|
-
"
|
|
3092
|
+
"../node_modules/ajv/dist/refs/data.json"(exports, module) {
|
|
3087
3093
|
module.exports = {
|
|
3088
3094
|
$id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
|
3089
3095
|
description: "Meta-schema for $data reference (JSON AnySchema extension proposal)",
|
|
@@ -3100,9 +3106,9 @@ var require_data = __commonJS({
|
|
|
3100
3106
|
}
|
|
3101
3107
|
});
|
|
3102
3108
|
|
|
3103
|
-
//
|
|
3109
|
+
// ../node_modules/fast-uri/lib/utils.js
|
|
3104
3110
|
var require_utils = __commonJS({
|
|
3105
|
-
"
|
|
3111
|
+
"../node_modules/fast-uri/lib/utils.js"(exports, module) {
|
|
3106
3112
|
"use strict";
|
|
3107
3113
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
3108
3114
|
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);
|
|
@@ -3223,8 +3229,8 @@ var require_utils = __commonJS({
|
|
|
3223
3229
|
}
|
|
3224
3230
|
return ind;
|
|
3225
3231
|
}
|
|
3226
|
-
function removeDotSegments(
|
|
3227
|
-
let input =
|
|
3232
|
+
function removeDotSegments(path11) {
|
|
3233
|
+
let input = path11;
|
|
3228
3234
|
const output = [];
|
|
3229
3235
|
let nextSlash = -1;
|
|
3230
3236
|
let len = 0;
|
|
@@ -3357,9 +3363,9 @@ var require_utils = __commonJS({
|
|
|
3357
3363
|
}
|
|
3358
3364
|
});
|
|
3359
3365
|
|
|
3360
|
-
//
|
|
3366
|
+
// ../node_modules/fast-uri/lib/schemes.js
|
|
3361
3367
|
var require_schemes = __commonJS({
|
|
3362
|
-
"
|
|
3368
|
+
"../node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
3363
3369
|
"use strict";
|
|
3364
3370
|
var { isUUID } = require_utils();
|
|
3365
3371
|
var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
@@ -3423,8 +3429,8 @@ var require_schemes = __commonJS({
|
|
|
3423
3429
|
wsComponent.secure = void 0;
|
|
3424
3430
|
}
|
|
3425
3431
|
if (wsComponent.resourceName) {
|
|
3426
|
-
const [
|
|
3427
|
-
wsComponent.path =
|
|
3432
|
+
const [path11, query] = wsComponent.resourceName.split("?");
|
|
3433
|
+
wsComponent.path = path11 && path11 !== "/" ? path11 : void 0;
|
|
3428
3434
|
wsComponent.query = query;
|
|
3429
3435
|
wsComponent.resourceName = void 0;
|
|
3430
3436
|
}
|
|
@@ -3567,9 +3573,9 @@ var require_schemes = __commonJS({
|
|
|
3567
3573
|
}
|
|
3568
3574
|
});
|
|
3569
3575
|
|
|
3570
|
-
//
|
|
3576
|
+
// ../node_modules/fast-uri/index.js
|
|
3571
3577
|
var require_fast_uri = __commonJS({
|
|
3572
|
-
"
|
|
3578
|
+
"../node_modules/fast-uri/index.js"(exports, module) {
|
|
3573
3579
|
"use strict";
|
|
3574
3580
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
|
|
3575
3581
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
@@ -3589,49 +3595,49 @@ var require_fast_uri = __commonJS({
|
|
|
3589
3595
|
schemelessOptions.skipEscape = true;
|
|
3590
3596
|
return serialize(resolved, schemelessOptions);
|
|
3591
3597
|
}
|
|
3592
|
-
function resolveComponent(base,
|
|
3598
|
+
function resolveComponent(base, relative3, options, skipNormalization) {
|
|
3593
3599
|
const target = {};
|
|
3594
3600
|
if (!skipNormalization) {
|
|
3595
3601
|
base = parse3(serialize(base, options), options);
|
|
3596
|
-
|
|
3602
|
+
relative3 = parse3(serialize(relative3, options), options);
|
|
3597
3603
|
}
|
|
3598
3604
|
options = options || {};
|
|
3599
|
-
if (!options.tolerant &&
|
|
3600
|
-
target.scheme =
|
|
3601
|
-
target.userinfo =
|
|
3602
|
-
target.host =
|
|
3603
|
-
target.port =
|
|
3604
|
-
target.path = removeDotSegments(
|
|
3605
|
-
target.query =
|
|
3605
|
+
if (!options.tolerant && relative3.scheme) {
|
|
3606
|
+
target.scheme = relative3.scheme;
|
|
3607
|
+
target.userinfo = relative3.userinfo;
|
|
3608
|
+
target.host = relative3.host;
|
|
3609
|
+
target.port = relative3.port;
|
|
3610
|
+
target.path = removeDotSegments(relative3.path || "");
|
|
3611
|
+
target.query = relative3.query;
|
|
3606
3612
|
} else {
|
|
3607
|
-
if (
|
|
3608
|
-
target.userinfo =
|
|
3609
|
-
target.host =
|
|
3610
|
-
target.port =
|
|
3611
|
-
target.path = removeDotSegments(
|
|
3612
|
-
target.query =
|
|
3613
|
+
if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
|
|
3614
|
+
target.userinfo = relative3.userinfo;
|
|
3615
|
+
target.host = relative3.host;
|
|
3616
|
+
target.port = relative3.port;
|
|
3617
|
+
target.path = removeDotSegments(relative3.path || "");
|
|
3618
|
+
target.query = relative3.query;
|
|
3613
3619
|
} else {
|
|
3614
|
-
if (!
|
|
3620
|
+
if (!relative3.path) {
|
|
3615
3621
|
target.path = base.path;
|
|
3616
|
-
if (
|
|
3617
|
-
target.query =
|
|
3622
|
+
if (relative3.query !== void 0) {
|
|
3623
|
+
target.query = relative3.query;
|
|
3618
3624
|
} else {
|
|
3619
3625
|
target.query = base.query;
|
|
3620
3626
|
}
|
|
3621
3627
|
} else {
|
|
3622
|
-
if (
|
|
3623
|
-
target.path = removeDotSegments(
|
|
3628
|
+
if (relative3.path[0] === "/") {
|
|
3629
|
+
target.path = removeDotSegments(relative3.path);
|
|
3624
3630
|
} else {
|
|
3625
3631
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
3626
|
-
target.path = "/" +
|
|
3632
|
+
target.path = "/" + relative3.path;
|
|
3627
3633
|
} else if (!base.path) {
|
|
3628
|
-
target.path =
|
|
3634
|
+
target.path = relative3.path;
|
|
3629
3635
|
} else {
|
|
3630
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
3636
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
|
|
3631
3637
|
}
|
|
3632
3638
|
target.path = removeDotSegments(target.path);
|
|
3633
3639
|
}
|
|
3634
|
-
target.query =
|
|
3640
|
+
target.query = relative3.query;
|
|
3635
3641
|
}
|
|
3636
3642
|
target.userinfo = base.userinfo;
|
|
3637
3643
|
target.host = base.host;
|
|
@@ -3639,7 +3645,7 @@ var require_fast_uri = __commonJS({
|
|
|
3639
3645
|
}
|
|
3640
3646
|
target.scheme = base.scheme;
|
|
3641
3647
|
}
|
|
3642
|
-
target.fragment =
|
|
3648
|
+
target.fragment = relative3.fragment;
|
|
3643
3649
|
return target;
|
|
3644
3650
|
}
|
|
3645
3651
|
function equal(uriA, uriB, options) {
|
|
@@ -3822,9 +3828,9 @@ var require_fast_uri = __commonJS({
|
|
|
3822
3828
|
}
|
|
3823
3829
|
});
|
|
3824
3830
|
|
|
3825
|
-
//
|
|
3831
|
+
// ../node_modules/ajv/dist/runtime/uri.js
|
|
3826
3832
|
var require_uri = __commonJS({
|
|
3827
|
-
"
|
|
3833
|
+
"../node_modules/ajv/dist/runtime/uri.js"(exports) {
|
|
3828
3834
|
"use strict";
|
|
3829
3835
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3830
3836
|
var uri = require_fast_uri();
|
|
@@ -3833,9 +3839,9 @@ var require_uri = __commonJS({
|
|
|
3833
3839
|
}
|
|
3834
3840
|
});
|
|
3835
3841
|
|
|
3836
|
-
//
|
|
3842
|
+
// ../node_modules/ajv/dist/core.js
|
|
3837
3843
|
var require_core = __commonJS({
|
|
3838
|
-
"
|
|
3844
|
+
"../node_modules/ajv/dist/core.js"(exports) {
|
|
3839
3845
|
"use strict";
|
|
3840
3846
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3841
3847
|
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
@@ -4444,9 +4450,9 @@ var require_core = __commonJS({
|
|
|
4444
4450
|
}
|
|
4445
4451
|
});
|
|
4446
4452
|
|
|
4447
|
-
//
|
|
4453
|
+
// ../node_modules/ajv/dist/vocabularies/core/id.js
|
|
4448
4454
|
var require_id = __commonJS({
|
|
4449
|
-
"
|
|
4455
|
+
"../node_modules/ajv/dist/vocabularies/core/id.js"(exports) {
|
|
4450
4456
|
"use strict";
|
|
4451
4457
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4452
4458
|
var def = {
|
|
@@ -4459,9 +4465,9 @@ var require_id = __commonJS({
|
|
|
4459
4465
|
}
|
|
4460
4466
|
});
|
|
4461
4467
|
|
|
4462
|
-
//
|
|
4468
|
+
// ../node_modules/ajv/dist/vocabularies/core/ref.js
|
|
4463
4469
|
var require_ref = __commonJS({
|
|
4464
|
-
"
|
|
4470
|
+
"../node_modules/ajv/dist/vocabularies/core/ref.js"(exports) {
|
|
4465
4471
|
"use strict";
|
|
4466
4472
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4467
4473
|
exports.callRef = exports.getValidate = void 0;
|
|
@@ -4581,9 +4587,9 @@ var require_ref = __commonJS({
|
|
|
4581
4587
|
}
|
|
4582
4588
|
});
|
|
4583
4589
|
|
|
4584
|
-
//
|
|
4590
|
+
// ../node_modules/ajv/dist/vocabularies/core/index.js
|
|
4585
4591
|
var require_core2 = __commonJS({
|
|
4586
|
-
"
|
|
4592
|
+
"../node_modules/ajv/dist/vocabularies/core/index.js"(exports) {
|
|
4587
4593
|
"use strict";
|
|
4588
4594
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4589
4595
|
var id_1 = require_id();
|
|
@@ -4602,9 +4608,9 @@ var require_core2 = __commonJS({
|
|
|
4602
4608
|
}
|
|
4603
4609
|
});
|
|
4604
4610
|
|
|
4605
|
-
//
|
|
4611
|
+
// ../node_modules/ajv/dist/vocabularies/validation/limitNumber.js
|
|
4606
4612
|
var require_limitNumber = __commonJS({
|
|
4607
|
-
"
|
|
4613
|
+
"../node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports) {
|
|
4608
4614
|
"use strict";
|
|
4609
4615
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4610
4616
|
var codegen_1 = require_codegen();
|
|
@@ -4634,9 +4640,9 @@ var require_limitNumber = __commonJS({
|
|
|
4634
4640
|
}
|
|
4635
4641
|
});
|
|
4636
4642
|
|
|
4637
|
-
//
|
|
4643
|
+
// ../node_modules/ajv/dist/vocabularies/validation/multipleOf.js
|
|
4638
4644
|
var require_multipleOf = __commonJS({
|
|
4639
|
-
"
|
|
4645
|
+
"../node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports) {
|
|
4640
4646
|
"use strict";
|
|
4641
4647
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4642
4648
|
var codegen_1 = require_codegen();
|
|
@@ -4662,9 +4668,9 @@ var require_multipleOf = __commonJS({
|
|
|
4662
4668
|
}
|
|
4663
4669
|
});
|
|
4664
4670
|
|
|
4665
|
-
//
|
|
4671
|
+
// ../node_modules/ajv/dist/runtime/ucs2length.js
|
|
4666
4672
|
var require_ucs2length = __commonJS({
|
|
4667
|
-
"
|
|
4673
|
+
"../node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
|
|
4668
4674
|
"use strict";
|
|
4669
4675
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4670
4676
|
function ucs2length(str) {
|
|
@@ -4688,9 +4694,9 @@ var require_ucs2length = __commonJS({
|
|
|
4688
4694
|
}
|
|
4689
4695
|
});
|
|
4690
4696
|
|
|
4691
|
-
//
|
|
4697
|
+
// ../node_modules/ajv/dist/vocabularies/validation/limitLength.js
|
|
4692
4698
|
var require_limitLength = __commonJS({
|
|
4693
|
-
"
|
|
4699
|
+
"../node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports) {
|
|
4694
4700
|
"use strict";
|
|
4695
4701
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4696
4702
|
var codegen_1 = require_codegen();
|
|
@@ -4720,9 +4726,9 @@ var require_limitLength = __commonJS({
|
|
|
4720
4726
|
}
|
|
4721
4727
|
});
|
|
4722
4728
|
|
|
4723
|
-
//
|
|
4729
|
+
// ../node_modules/ajv/dist/vocabularies/validation/pattern.js
|
|
4724
4730
|
var require_pattern = __commonJS({
|
|
4725
|
-
"
|
|
4731
|
+
"../node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) {
|
|
4726
4732
|
"use strict";
|
|
4727
4733
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4728
4734
|
var code_1 = require_code2();
|
|
@@ -4757,9 +4763,9 @@ var require_pattern = __commonJS({
|
|
|
4757
4763
|
}
|
|
4758
4764
|
});
|
|
4759
4765
|
|
|
4760
|
-
//
|
|
4766
|
+
// ../node_modules/ajv/dist/vocabularies/validation/limitProperties.js
|
|
4761
4767
|
var require_limitProperties = __commonJS({
|
|
4762
|
-
"
|
|
4768
|
+
"../node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports) {
|
|
4763
4769
|
"use strict";
|
|
4764
4770
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4765
4771
|
var codegen_1 = require_codegen();
|
|
@@ -4786,9 +4792,9 @@ var require_limitProperties = __commonJS({
|
|
|
4786
4792
|
}
|
|
4787
4793
|
});
|
|
4788
4794
|
|
|
4789
|
-
//
|
|
4795
|
+
// ../node_modules/ajv/dist/vocabularies/validation/required.js
|
|
4790
4796
|
var require_required = __commonJS({
|
|
4791
|
-
"
|
|
4797
|
+
"../node_modules/ajv/dist/vocabularies/validation/required.js"(exports) {
|
|
4792
4798
|
"use strict";
|
|
4793
4799
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4794
4800
|
var code_1 = require_code2();
|
|
@@ -4868,9 +4874,9 @@ var require_required = __commonJS({
|
|
|
4868
4874
|
}
|
|
4869
4875
|
});
|
|
4870
4876
|
|
|
4871
|
-
//
|
|
4877
|
+
// ../node_modules/ajv/dist/vocabularies/validation/limitItems.js
|
|
4872
4878
|
var require_limitItems = __commonJS({
|
|
4873
|
-
"
|
|
4879
|
+
"../node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports) {
|
|
4874
4880
|
"use strict";
|
|
4875
4881
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4876
4882
|
var codegen_1 = require_codegen();
|
|
@@ -4897,9 +4903,9 @@ var require_limitItems = __commonJS({
|
|
|
4897
4903
|
}
|
|
4898
4904
|
});
|
|
4899
4905
|
|
|
4900
|
-
//
|
|
4906
|
+
// ../node_modules/ajv/dist/runtime/equal.js
|
|
4901
4907
|
var require_equal = __commonJS({
|
|
4902
|
-
"
|
|
4908
|
+
"../node_modules/ajv/dist/runtime/equal.js"(exports) {
|
|
4903
4909
|
"use strict";
|
|
4904
4910
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4905
4911
|
var equal = require_fast_deep_equal();
|
|
@@ -4908,9 +4914,9 @@ var require_equal = __commonJS({
|
|
|
4908
4914
|
}
|
|
4909
4915
|
});
|
|
4910
4916
|
|
|
4911
|
-
//
|
|
4917
|
+
// ../node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
|
|
4912
4918
|
var require_uniqueItems = __commonJS({
|
|
4913
|
-
"
|
|
4919
|
+
"../node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports) {
|
|
4914
4920
|
"use strict";
|
|
4915
4921
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4916
4922
|
var dataType_1 = require_dataType();
|
|
@@ -4975,9 +4981,9 @@ var require_uniqueItems = __commonJS({
|
|
|
4975
4981
|
}
|
|
4976
4982
|
});
|
|
4977
4983
|
|
|
4978
|
-
//
|
|
4984
|
+
// ../node_modules/ajv/dist/vocabularies/validation/const.js
|
|
4979
4985
|
var require_const = __commonJS({
|
|
4980
|
-
"
|
|
4986
|
+
"../node_modules/ajv/dist/vocabularies/validation/const.js"(exports) {
|
|
4981
4987
|
"use strict";
|
|
4982
4988
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4983
4989
|
var codegen_1 = require_codegen();
|
|
@@ -5004,9 +5010,9 @@ var require_const = __commonJS({
|
|
|
5004
5010
|
}
|
|
5005
5011
|
});
|
|
5006
5012
|
|
|
5007
|
-
//
|
|
5013
|
+
// ../node_modules/ajv/dist/vocabularies/validation/enum.js
|
|
5008
5014
|
var require_enum = __commonJS({
|
|
5009
|
-
"
|
|
5015
|
+
"../node_modules/ajv/dist/vocabularies/validation/enum.js"(exports) {
|
|
5010
5016
|
"use strict";
|
|
5011
5017
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5012
5018
|
var codegen_1 = require_codegen();
|
|
@@ -5053,9 +5059,9 @@ var require_enum = __commonJS({
|
|
|
5053
5059
|
}
|
|
5054
5060
|
});
|
|
5055
5061
|
|
|
5056
|
-
//
|
|
5062
|
+
// ../node_modules/ajv/dist/vocabularies/validation/index.js
|
|
5057
5063
|
var require_validation = __commonJS({
|
|
5058
|
-
"
|
|
5064
|
+
"../node_modules/ajv/dist/vocabularies/validation/index.js"(exports) {
|
|
5059
5065
|
"use strict";
|
|
5060
5066
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5061
5067
|
var limitNumber_1 = require_limitNumber();
|
|
@@ -5091,9 +5097,9 @@ var require_validation = __commonJS({
|
|
|
5091
5097
|
}
|
|
5092
5098
|
});
|
|
5093
5099
|
|
|
5094
|
-
//
|
|
5100
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
|
|
5095
5101
|
var require_additionalItems = __commonJS({
|
|
5096
|
-
"
|
|
5102
|
+
"../node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports) {
|
|
5097
5103
|
"use strict";
|
|
5098
5104
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5099
5105
|
exports.validateAdditionalItems = void 0;
|
|
@@ -5144,9 +5150,9 @@ var require_additionalItems = __commonJS({
|
|
|
5144
5150
|
}
|
|
5145
5151
|
});
|
|
5146
5152
|
|
|
5147
|
-
//
|
|
5153
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/items.js
|
|
5148
5154
|
var require_items = __commonJS({
|
|
5149
|
-
"
|
|
5155
|
+
"../node_modules/ajv/dist/vocabularies/applicator/items.js"(exports) {
|
|
5150
5156
|
"use strict";
|
|
5151
5157
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5152
5158
|
exports.validateTuple = void 0;
|
|
@@ -5201,9 +5207,9 @@ var require_items = __commonJS({
|
|
|
5201
5207
|
}
|
|
5202
5208
|
});
|
|
5203
5209
|
|
|
5204
|
-
//
|
|
5210
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
|
|
5205
5211
|
var require_prefixItems = __commonJS({
|
|
5206
|
-
"
|
|
5212
|
+
"../node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports) {
|
|
5207
5213
|
"use strict";
|
|
5208
5214
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5209
5215
|
var items_1 = require_items();
|
|
@@ -5218,9 +5224,9 @@ var require_prefixItems = __commonJS({
|
|
|
5218
5224
|
}
|
|
5219
5225
|
});
|
|
5220
5226
|
|
|
5221
|
-
//
|
|
5227
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/items2020.js
|
|
5222
5228
|
var require_items2020 = __commonJS({
|
|
5223
|
-
"
|
|
5229
|
+
"../node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports) {
|
|
5224
5230
|
"use strict";
|
|
5225
5231
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5226
5232
|
var codegen_1 = require_codegen();
|
|
@@ -5253,9 +5259,9 @@ var require_items2020 = __commonJS({
|
|
|
5253
5259
|
}
|
|
5254
5260
|
});
|
|
5255
5261
|
|
|
5256
|
-
//
|
|
5262
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/contains.js
|
|
5257
5263
|
var require_contains = __commonJS({
|
|
5258
|
-
"
|
|
5264
|
+
"../node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports) {
|
|
5259
5265
|
"use strict";
|
|
5260
5266
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5261
5267
|
var codegen_1 = require_codegen();
|
|
@@ -5347,9 +5353,9 @@ var require_contains = __commonJS({
|
|
|
5347
5353
|
}
|
|
5348
5354
|
});
|
|
5349
5355
|
|
|
5350
|
-
//
|
|
5356
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/dependencies.js
|
|
5351
5357
|
var require_dependencies = __commonJS({
|
|
5352
|
-
"
|
|
5358
|
+
"../node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports) {
|
|
5353
5359
|
"use strict";
|
|
5354
5360
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5355
5361
|
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
|
|
@@ -5441,9 +5447,9 @@ var require_dependencies = __commonJS({
|
|
|
5441
5447
|
}
|
|
5442
5448
|
});
|
|
5443
5449
|
|
|
5444
|
-
//
|
|
5450
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
|
|
5445
5451
|
var require_propertyNames = __commonJS({
|
|
5446
|
-
"
|
|
5452
|
+
"../node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports) {
|
|
5447
5453
|
"use strict";
|
|
5448
5454
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5449
5455
|
var codegen_1 = require_codegen();
|
|
@@ -5484,9 +5490,9 @@ var require_propertyNames = __commonJS({
|
|
|
5484
5490
|
}
|
|
5485
5491
|
});
|
|
5486
5492
|
|
|
5487
|
-
//
|
|
5493
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
|
|
5488
5494
|
var require_additionalProperties = __commonJS({
|
|
5489
|
-
"
|
|
5495
|
+
"../node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports) {
|
|
5490
5496
|
"use strict";
|
|
5491
5497
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5492
5498
|
var code_1 = require_code2();
|
|
@@ -5590,9 +5596,9 @@ var require_additionalProperties = __commonJS({
|
|
|
5590
5596
|
}
|
|
5591
5597
|
});
|
|
5592
5598
|
|
|
5593
|
-
//
|
|
5599
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/properties.js
|
|
5594
5600
|
var require_properties = __commonJS({
|
|
5595
|
-
"
|
|
5601
|
+
"../node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports) {
|
|
5596
5602
|
"use strict";
|
|
5597
5603
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5598
5604
|
var validate_1 = require_validate();
|
|
@@ -5648,9 +5654,9 @@ var require_properties = __commonJS({
|
|
|
5648
5654
|
}
|
|
5649
5655
|
});
|
|
5650
5656
|
|
|
5651
|
-
//
|
|
5657
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
|
|
5652
5658
|
var require_patternProperties = __commonJS({
|
|
5653
|
-
"
|
|
5659
|
+
"../node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports) {
|
|
5654
5660
|
"use strict";
|
|
5655
5661
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5656
5662
|
var code_1 = require_code2();
|
|
@@ -5722,9 +5728,9 @@ var require_patternProperties = __commonJS({
|
|
|
5722
5728
|
}
|
|
5723
5729
|
});
|
|
5724
5730
|
|
|
5725
|
-
//
|
|
5731
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/not.js
|
|
5726
5732
|
var require_not = __commonJS({
|
|
5727
|
-
"
|
|
5733
|
+
"../node_modules/ajv/dist/vocabularies/applicator/not.js"(exports) {
|
|
5728
5734
|
"use strict";
|
|
5729
5735
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5730
5736
|
var util_1 = require_util();
|
|
@@ -5753,9 +5759,9 @@ var require_not = __commonJS({
|
|
|
5753
5759
|
}
|
|
5754
5760
|
});
|
|
5755
5761
|
|
|
5756
|
-
//
|
|
5762
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/anyOf.js
|
|
5757
5763
|
var require_anyOf = __commonJS({
|
|
5758
|
-
"
|
|
5764
|
+
"../node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports) {
|
|
5759
5765
|
"use strict";
|
|
5760
5766
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5761
5767
|
var code_1 = require_code2();
|
|
@@ -5770,9 +5776,9 @@ var require_anyOf = __commonJS({
|
|
|
5770
5776
|
}
|
|
5771
5777
|
});
|
|
5772
5778
|
|
|
5773
|
-
//
|
|
5779
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/oneOf.js
|
|
5774
5780
|
var require_oneOf = __commonJS({
|
|
5775
|
-
"
|
|
5781
|
+
"../node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports) {
|
|
5776
5782
|
"use strict";
|
|
5777
5783
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5778
5784
|
var codegen_1 = require_codegen();
|
|
@@ -5828,9 +5834,9 @@ var require_oneOf = __commonJS({
|
|
|
5828
5834
|
}
|
|
5829
5835
|
});
|
|
5830
5836
|
|
|
5831
|
-
//
|
|
5837
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/allOf.js
|
|
5832
5838
|
var require_allOf = __commonJS({
|
|
5833
|
-
"
|
|
5839
|
+
"../node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports) {
|
|
5834
5840
|
"use strict";
|
|
5835
5841
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5836
5842
|
var util_1 = require_util();
|
|
@@ -5855,9 +5861,9 @@ var require_allOf = __commonJS({
|
|
|
5855
5861
|
}
|
|
5856
5862
|
});
|
|
5857
5863
|
|
|
5858
|
-
//
|
|
5864
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/if.js
|
|
5859
5865
|
var require_if = __commonJS({
|
|
5860
|
-
"
|
|
5866
|
+
"../node_modules/ajv/dist/vocabularies/applicator/if.js"(exports) {
|
|
5861
5867
|
"use strict";
|
|
5862
5868
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5863
5869
|
var codegen_1 = require_codegen();
|
|
@@ -5924,9 +5930,9 @@ var require_if = __commonJS({
|
|
|
5924
5930
|
}
|
|
5925
5931
|
});
|
|
5926
5932
|
|
|
5927
|
-
//
|
|
5933
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/thenElse.js
|
|
5928
5934
|
var require_thenElse = __commonJS({
|
|
5929
|
-
"
|
|
5935
|
+
"../node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports) {
|
|
5930
5936
|
"use strict";
|
|
5931
5937
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5932
5938
|
var util_1 = require_util();
|
|
@@ -5942,9 +5948,9 @@ var require_thenElse = __commonJS({
|
|
|
5942
5948
|
}
|
|
5943
5949
|
});
|
|
5944
5950
|
|
|
5945
|
-
//
|
|
5951
|
+
// ../node_modules/ajv/dist/vocabularies/applicator/index.js
|
|
5946
5952
|
var require_applicator = __commonJS({
|
|
5947
|
-
"
|
|
5953
|
+
"../node_modules/ajv/dist/vocabularies/applicator/index.js"(exports) {
|
|
5948
5954
|
"use strict";
|
|
5949
5955
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5950
5956
|
var additionalItems_1 = require_additionalItems();
|
|
@@ -5990,9 +5996,9 @@ var require_applicator = __commonJS({
|
|
|
5990
5996
|
}
|
|
5991
5997
|
});
|
|
5992
5998
|
|
|
5993
|
-
//
|
|
5999
|
+
// ../node_modules/ajv/dist/vocabularies/format/format.js
|
|
5994
6000
|
var require_format = __commonJS({
|
|
5995
|
-
"
|
|
6001
|
+
"../node_modules/ajv/dist/vocabularies/format/format.js"(exports) {
|
|
5996
6002
|
"use strict";
|
|
5997
6003
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5998
6004
|
var codegen_1 = require_codegen();
|
|
@@ -6080,9 +6086,9 @@ var require_format = __commonJS({
|
|
|
6080
6086
|
}
|
|
6081
6087
|
});
|
|
6082
6088
|
|
|
6083
|
-
//
|
|
6089
|
+
// ../node_modules/ajv/dist/vocabularies/format/index.js
|
|
6084
6090
|
var require_format2 = __commonJS({
|
|
6085
|
-
"
|
|
6091
|
+
"../node_modules/ajv/dist/vocabularies/format/index.js"(exports) {
|
|
6086
6092
|
"use strict";
|
|
6087
6093
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6088
6094
|
var format_1 = require_format();
|
|
@@ -6091,9 +6097,9 @@ var require_format2 = __commonJS({
|
|
|
6091
6097
|
}
|
|
6092
6098
|
});
|
|
6093
6099
|
|
|
6094
|
-
//
|
|
6100
|
+
// ../node_modules/ajv/dist/vocabularies/metadata.js
|
|
6095
6101
|
var require_metadata = __commonJS({
|
|
6096
|
-
"
|
|
6102
|
+
"../node_modules/ajv/dist/vocabularies/metadata.js"(exports) {
|
|
6097
6103
|
"use strict";
|
|
6098
6104
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6099
6105
|
exports.contentVocabulary = exports.metadataVocabulary = void 0;
|
|
@@ -6114,9 +6120,9 @@ var require_metadata = __commonJS({
|
|
|
6114
6120
|
}
|
|
6115
6121
|
});
|
|
6116
6122
|
|
|
6117
|
-
//
|
|
6123
|
+
// ../node_modules/ajv/dist/vocabularies/draft7.js
|
|
6118
6124
|
var require_draft7 = __commonJS({
|
|
6119
|
-
"
|
|
6125
|
+
"../node_modules/ajv/dist/vocabularies/draft7.js"(exports) {
|
|
6120
6126
|
"use strict";
|
|
6121
6127
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6122
6128
|
var core_1 = require_core2();
|
|
@@ -6136,9 +6142,9 @@ var require_draft7 = __commonJS({
|
|
|
6136
6142
|
}
|
|
6137
6143
|
});
|
|
6138
6144
|
|
|
6139
|
-
//
|
|
6145
|
+
// ../node_modules/ajv/dist/vocabularies/discriminator/types.js
|
|
6140
6146
|
var require_types = __commonJS({
|
|
6141
|
-
"
|
|
6147
|
+
"../node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports) {
|
|
6142
6148
|
"use strict";
|
|
6143
6149
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6144
6150
|
exports.DiscrError = void 0;
|
|
@@ -6150,9 +6156,9 @@ var require_types = __commonJS({
|
|
|
6150
6156
|
}
|
|
6151
6157
|
});
|
|
6152
6158
|
|
|
6153
|
-
//
|
|
6159
|
+
// ../node_modules/ajv/dist/vocabularies/discriminator/index.js
|
|
6154
6160
|
var require_discriminator = __commonJS({
|
|
6155
|
-
"
|
|
6161
|
+
"../node_modules/ajv/dist/vocabularies/discriminator/index.js"(exports) {
|
|
6156
6162
|
"use strict";
|
|
6157
6163
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6158
6164
|
var codegen_1 = require_codegen();
|
|
@@ -6255,9 +6261,9 @@ var require_discriminator = __commonJS({
|
|
|
6255
6261
|
}
|
|
6256
6262
|
});
|
|
6257
6263
|
|
|
6258
|
-
//
|
|
6264
|
+
// ../node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
6259
6265
|
var require_json_schema_draft_07 = __commonJS({
|
|
6260
|
-
"
|
|
6266
|
+
"../node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports, module) {
|
|
6261
6267
|
module.exports = {
|
|
6262
6268
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
6263
6269
|
$id: "http://json-schema.org/draft-07/schema#",
|
|
@@ -6412,9 +6418,9 @@ var require_json_schema_draft_07 = __commonJS({
|
|
|
6412
6418
|
}
|
|
6413
6419
|
});
|
|
6414
6420
|
|
|
6415
|
-
//
|
|
6421
|
+
// ../node_modules/ajv/dist/ajv.js
|
|
6416
6422
|
var require_ajv = __commonJS({
|
|
6417
|
-
"
|
|
6423
|
+
"../node_modules/ajv/dist/ajv.js"(exports, module) {
|
|
6418
6424
|
"use strict";
|
|
6419
6425
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6420
6426
|
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
|
|
@@ -6482,9 +6488,9 @@ var require_ajv = __commonJS({
|
|
|
6482
6488
|
}
|
|
6483
6489
|
});
|
|
6484
6490
|
|
|
6485
|
-
//
|
|
6491
|
+
// ../node_modules/ajv-formats/dist/formats.js
|
|
6486
6492
|
var require_formats = __commonJS({
|
|
6487
|
-
"
|
|
6493
|
+
"../node_modules/ajv-formats/dist/formats.js"(exports) {
|
|
6488
6494
|
"use strict";
|
|
6489
6495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6490
6496
|
exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
|
|
@@ -6685,9 +6691,9 @@ var require_formats = __commonJS({
|
|
|
6685
6691
|
}
|
|
6686
6692
|
});
|
|
6687
6693
|
|
|
6688
|
-
//
|
|
6694
|
+
// ../node_modules/ajv-formats/dist/limit.js
|
|
6689
6695
|
var require_limit = __commonJS({
|
|
6690
|
-
"
|
|
6696
|
+
"../node_modules/ajv-formats/dist/limit.js"(exports) {
|
|
6691
6697
|
"use strict";
|
|
6692
6698
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6693
6699
|
exports.formatLimitDefinition = void 0;
|
|
@@ -6757,9 +6763,9 @@ var require_limit = __commonJS({
|
|
|
6757
6763
|
}
|
|
6758
6764
|
});
|
|
6759
6765
|
|
|
6760
|
-
//
|
|
6766
|
+
// ../node_modules/ajv-formats/dist/index.js
|
|
6761
6767
|
var require_dist = __commonJS({
|
|
6762
|
-
"
|
|
6768
|
+
"../node_modules/ajv-formats/dist/index.js"(exports, module) {
|
|
6763
6769
|
"use strict";
|
|
6764
6770
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6765
6771
|
var formats_1 = require_formats();
|
|
@@ -6786,12 +6792,12 @@ var require_dist = __commonJS({
|
|
|
6786
6792
|
throw new Error(`Unknown format "${name}"`);
|
|
6787
6793
|
return f;
|
|
6788
6794
|
};
|
|
6789
|
-
function addFormats(ajv, list,
|
|
6795
|
+
function addFormats(ajv, list, fs7, exportName) {
|
|
6790
6796
|
var _a;
|
|
6791
6797
|
var _b;
|
|
6792
6798
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6793
6799
|
for (const f of list)
|
|
6794
|
-
ajv.addFormat(f,
|
|
6800
|
+
ajv.addFormat(f, fs7[f]);
|
|
6795
6801
|
}
|
|
6796
6802
|
module.exports = exports = formatsPlugin;
|
|
6797
6803
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6799,7 +6805,7 @@ var require_dist = __commonJS({
|
|
|
6799
6805
|
}
|
|
6800
6806
|
});
|
|
6801
6807
|
|
|
6802
|
-
//
|
|
6808
|
+
// ../node_modules/zod/v3/external.js
|
|
6803
6809
|
var external_exports = {};
|
|
6804
6810
|
__export(external_exports, {
|
|
6805
6811
|
BRAND: () => BRAND,
|
|
@@ -6911,7 +6917,7 @@ __export(external_exports, {
|
|
|
6911
6917
|
void: () => voidType
|
|
6912
6918
|
});
|
|
6913
6919
|
|
|
6914
|
-
//
|
|
6920
|
+
// ../node_modules/zod/v3/helpers/util.js
|
|
6915
6921
|
var util;
|
|
6916
6922
|
(function(util2) {
|
|
6917
6923
|
util2.assertEqual = (_) => {
|
|
@@ -7045,7 +7051,7 @@ var getParsedType = (data) => {
|
|
|
7045
7051
|
}
|
|
7046
7052
|
};
|
|
7047
7053
|
|
|
7048
|
-
//
|
|
7054
|
+
// ../node_modules/zod/v3/ZodError.js
|
|
7049
7055
|
var ZodIssueCode = util.arrayToEnum([
|
|
7050
7056
|
"invalid_type",
|
|
7051
7057
|
"invalid_literal",
|
|
@@ -7163,7 +7169,7 @@ ZodError.create = (issues) => {
|
|
|
7163
7169
|
return error2;
|
|
7164
7170
|
};
|
|
7165
7171
|
|
|
7166
|
-
//
|
|
7172
|
+
// ../node_modules/zod/v3/locales/en.js
|
|
7167
7173
|
var errorMap = (issue2, _ctx) => {
|
|
7168
7174
|
let message;
|
|
7169
7175
|
switch (issue2.code) {
|
|
@@ -7266,7 +7272,7 @@ var errorMap = (issue2, _ctx) => {
|
|
|
7266
7272
|
};
|
|
7267
7273
|
var en_default = errorMap;
|
|
7268
7274
|
|
|
7269
|
-
//
|
|
7275
|
+
// ../node_modules/zod/v3/errors.js
|
|
7270
7276
|
var overrideErrorMap = en_default;
|
|
7271
7277
|
function setErrorMap(map) {
|
|
7272
7278
|
overrideErrorMap = map;
|
|
@@ -7275,10 +7281,10 @@ function getErrorMap() {
|
|
|
7275
7281
|
return overrideErrorMap;
|
|
7276
7282
|
}
|
|
7277
7283
|
|
|
7278
|
-
//
|
|
7284
|
+
// ../node_modules/zod/v3/helpers/parseUtil.js
|
|
7279
7285
|
var makeIssue = (params) => {
|
|
7280
|
-
const { data, path:
|
|
7281
|
-
const fullPath = [...
|
|
7286
|
+
const { data, path: path11, errorMaps, issueData } = params;
|
|
7287
|
+
const fullPath = [...path11, ...issueData.path || []];
|
|
7282
7288
|
const fullIssue = {
|
|
7283
7289
|
...issueData,
|
|
7284
7290
|
path: fullPath
|
|
@@ -7385,20 +7391,20 @@ var isDirty = (x) => x.status === "dirty";
|
|
|
7385
7391
|
var isValid = (x) => x.status === "valid";
|
|
7386
7392
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
7387
7393
|
|
|
7388
|
-
//
|
|
7394
|
+
// ../node_modules/zod/v3/helpers/errorUtil.js
|
|
7389
7395
|
var errorUtil;
|
|
7390
7396
|
(function(errorUtil2) {
|
|
7391
7397
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
7392
7398
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
7393
7399
|
})(errorUtil || (errorUtil = {}));
|
|
7394
7400
|
|
|
7395
|
-
//
|
|
7401
|
+
// ../node_modules/zod/v3/types.js
|
|
7396
7402
|
var ParseInputLazyPath = class {
|
|
7397
|
-
constructor(parent, value,
|
|
7403
|
+
constructor(parent, value, path11, key) {
|
|
7398
7404
|
this._cachedPath = [];
|
|
7399
7405
|
this.parent = parent;
|
|
7400
7406
|
this.data = value;
|
|
7401
|
-
this._path =
|
|
7407
|
+
this._path = path11;
|
|
7402
7408
|
this._key = key;
|
|
7403
7409
|
}
|
|
7404
7410
|
get path() {
|
|
@@ -10840,7 +10846,7 @@ var coerce = {
|
|
|
10840
10846
|
};
|
|
10841
10847
|
var NEVER = INVALID;
|
|
10842
10848
|
|
|
10843
|
-
//
|
|
10849
|
+
// ../node_modules/zod/v4/core/core.js
|
|
10844
10850
|
var NEVER2 = Object.freeze({
|
|
10845
10851
|
status: "aborted"
|
|
10846
10852
|
});
|
|
@@ -10900,7 +10906,7 @@ function config(newConfig) {
|
|
|
10900
10906
|
return globalConfig;
|
|
10901
10907
|
}
|
|
10902
10908
|
|
|
10903
|
-
//
|
|
10909
|
+
// ../node_modules/zod/v4/core/util.js
|
|
10904
10910
|
var util_exports = {};
|
|
10905
10911
|
__export(util_exports, {
|
|
10906
10912
|
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
|
|
@@ -11036,10 +11042,10 @@ function assignProp(target, prop, value) {
|
|
|
11036
11042
|
configurable: true
|
|
11037
11043
|
});
|
|
11038
11044
|
}
|
|
11039
|
-
function getElementAtPath(obj,
|
|
11040
|
-
if (!
|
|
11045
|
+
function getElementAtPath(obj, path11) {
|
|
11046
|
+
if (!path11)
|
|
11041
11047
|
return obj;
|
|
11042
|
-
return
|
|
11048
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
11043
11049
|
}
|
|
11044
11050
|
function promiseAllObject(promisesObj) {
|
|
11045
11051
|
const keys = Object.keys(promisesObj);
|
|
@@ -11359,11 +11365,11 @@ function aborted(x, startIndex = 0) {
|
|
|
11359
11365
|
}
|
|
11360
11366
|
return false;
|
|
11361
11367
|
}
|
|
11362
|
-
function prefixIssues(
|
|
11368
|
+
function prefixIssues(path11, issues) {
|
|
11363
11369
|
return issues.map((iss) => {
|
|
11364
11370
|
var _a;
|
|
11365
11371
|
(_a = iss).path ?? (_a.path = []);
|
|
11366
|
-
iss.path.unshift(
|
|
11372
|
+
iss.path.unshift(path11);
|
|
11367
11373
|
return iss;
|
|
11368
11374
|
});
|
|
11369
11375
|
}
|
|
@@ -11421,7 +11427,7 @@ var Class = class {
|
|
|
11421
11427
|
}
|
|
11422
11428
|
};
|
|
11423
11429
|
|
|
11424
|
-
//
|
|
11430
|
+
// ../node_modules/zod/v4/core/errors.js
|
|
11425
11431
|
var initializer = (inst, def) => {
|
|
11426
11432
|
inst.name = "$ZodError";
|
|
11427
11433
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -11496,7 +11502,7 @@ function formatError(error2, _mapper) {
|
|
|
11496
11502
|
return fieldErrors;
|
|
11497
11503
|
}
|
|
11498
11504
|
|
|
11499
|
-
//
|
|
11505
|
+
// ../node_modules/zod/v4/core/parse.js
|
|
11500
11506
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
11501
11507
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
11502
11508
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -11548,7 +11554,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
11548
11554
|
};
|
|
11549
11555
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
11550
11556
|
|
|
11551
|
-
//
|
|
11557
|
+
// ../node_modules/zod/v4/core/regexes.js
|
|
11552
11558
|
var cuid = /^[cC][^\s-]{8,}$/;
|
|
11553
11559
|
var cuid2 = /^[0-9a-z]+$/;
|
|
11554
11560
|
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -11606,7 +11612,7 @@ var _null = /null/i;
|
|
|
11606
11612
|
var lowercase = /^[^A-Z]*$/;
|
|
11607
11613
|
var uppercase = /^[^a-z]*$/;
|
|
11608
11614
|
|
|
11609
|
-
//
|
|
11615
|
+
// ../node_modules/zod/v4/core/checks.js
|
|
11610
11616
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
11611
11617
|
var _a;
|
|
11612
11618
|
inst._zod ?? (inst._zod = {});
|
|
@@ -11991,7 +11997,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
11991
11997
|
};
|
|
11992
11998
|
});
|
|
11993
11999
|
|
|
11994
|
-
//
|
|
12000
|
+
// ../node_modules/zod/v4/core/doc.js
|
|
11995
12001
|
var Doc = class {
|
|
11996
12002
|
constructor(args = []) {
|
|
11997
12003
|
this.content = [];
|
|
@@ -12027,14 +12033,14 @@ var Doc = class {
|
|
|
12027
12033
|
}
|
|
12028
12034
|
};
|
|
12029
12035
|
|
|
12030
|
-
//
|
|
12036
|
+
// ../node_modules/zod/v4/core/versions.js
|
|
12031
12037
|
var version = {
|
|
12032
12038
|
major: 4,
|
|
12033
12039
|
minor: 0,
|
|
12034
12040
|
patch: 0
|
|
12035
12041
|
};
|
|
12036
12042
|
|
|
12037
|
-
//
|
|
12043
|
+
// ../node_modules/zod/v4/core/schemas.js
|
|
12038
12044
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
12039
12045
|
var _a;
|
|
12040
12046
|
inst ?? (inst = {});
|
|
@@ -13272,7 +13278,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
13272
13278
|
}
|
|
13273
13279
|
}
|
|
13274
13280
|
|
|
13275
|
-
//
|
|
13281
|
+
// ../node_modules/zod/v4/locales/en.js
|
|
13276
13282
|
var parsedType = (data) => {
|
|
13277
13283
|
const t = typeof data;
|
|
13278
13284
|
switch (t) {
|
|
@@ -13390,7 +13396,7 @@ function en_default2() {
|
|
|
13390
13396
|
};
|
|
13391
13397
|
}
|
|
13392
13398
|
|
|
13393
|
-
//
|
|
13399
|
+
// ../node_modules/zod/v4/core/registries.js
|
|
13394
13400
|
var $output = Symbol("ZodOutput");
|
|
13395
13401
|
var $input = Symbol("ZodInput");
|
|
13396
13402
|
var $ZodRegistry = class {
|
|
@@ -13440,7 +13446,7 @@ function registry() {
|
|
|
13440
13446
|
}
|
|
13441
13447
|
var globalRegistry = /* @__PURE__ */ registry();
|
|
13442
13448
|
|
|
13443
|
-
//
|
|
13449
|
+
// ../node_modules/zod/v4/core/api.js
|
|
13444
13450
|
function _string(Class2, params) {
|
|
13445
13451
|
return new Class2({
|
|
13446
13452
|
type: "string",
|
|
@@ -13879,7 +13885,7 @@ function _refine(Class2, fn, _params) {
|
|
|
13879
13885
|
return schema;
|
|
13880
13886
|
}
|
|
13881
13887
|
|
|
13882
|
-
//
|
|
13888
|
+
// ../node_modules/zod/v4/core/to-json-schema.js
|
|
13883
13889
|
var JSONSchemaGenerator = class {
|
|
13884
13890
|
constructor(params) {
|
|
13885
13891
|
this.counter = 0;
|
|
@@ -14646,7 +14652,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
14646
14652
|
throw new Error(`Unknown schema type: ${def.type}`);
|
|
14647
14653
|
}
|
|
14648
14654
|
|
|
14649
|
-
//
|
|
14655
|
+
// ../node_modules/zod/v4/mini/schemas.js
|
|
14650
14656
|
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
14651
14657
|
if (!inst._zod)
|
|
14652
14658
|
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
@@ -14692,7 +14698,7 @@ function object(shape, params) {
|
|
|
14692
14698
|
return new ZodMiniObject(def);
|
|
14693
14699
|
}
|
|
14694
14700
|
|
|
14695
|
-
//
|
|
14701
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
14696
14702
|
function isZ4Schema(s) {
|
|
14697
14703
|
const schema = s;
|
|
14698
14704
|
return !!schema._zod;
|
|
@@ -14836,7 +14842,7 @@ function getLiteralValue(schema) {
|
|
|
14836
14842
|
return void 0;
|
|
14837
14843
|
}
|
|
14838
14844
|
|
|
14839
|
-
//
|
|
14845
|
+
// ../node_modules/zod/v4/classic/iso.js
|
|
14840
14846
|
var iso_exports2 = {};
|
|
14841
14847
|
__export(iso_exports2, {
|
|
14842
14848
|
ZodISODate: () => ZodISODate,
|
|
@@ -14877,7 +14883,7 @@ function duration2(params) {
|
|
|
14877
14883
|
return _isoDuration(ZodISODuration, params);
|
|
14878
14884
|
}
|
|
14879
14885
|
|
|
14880
|
-
//
|
|
14886
|
+
// ../node_modules/zod/v4/classic/errors.js
|
|
14881
14887
|
var initializer2 = (inst, issues) => {
|
|
14882
14888
|
$ZodError.init(inst, issues);
|
|
14883
14889
|
inst.name = "ZodError";
|
|
@@ -14911,13 +14917,13 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
14911
14917
|
Parent: Error
|
|
14912
14918
|
});
|
|
14913
14919
|
|
|
14914
|
-
//
|
|
14920
|
+
// ../node_modules/zod/v4/classic/parse.js
|
|
14915
14921
|
var parse2 = /* @__PURE__ */ _parse(ZodRealError);
|
|
14916
14922
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
14917
14923
|
var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
14918
14924
|
var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
14919
14925
|
|
|
14920
|
-
//
|
|
14926
|
+
// ../node_modules/zod/v4/classic/schemas.js
|
|
14921
14927
|
var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
14922
14928
|
$ZodType.init(inst, def);
|
|
14923
14929
|
inst.def = def;
|
|
@@ -15528,10 +15534,10 @@ function preprocess(fn, schema) {
|
|
|
15528
15534
|
return pipe(transform(fn), schema);
|
|
15529
15535
|
}
|
|
15530
15536
|
|
|
15531
|
-
//
|
|
15537
|
+
// ../node_modules/zod/v4/classic/external.js
|
|
15532
15538
|
config(en_default2());
|
|
15533
15539
|
|
|
15534
|
-
//
|
|
15540
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
15535
15541
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
15536
15542
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
15537
15543
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -17049,12 +17055,12 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
17049
17055
|
}
|
|
17050
17056
|
};
|
|
17051
17057
|
|
|
17052
|
-
//
|
|
17058
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
17053
17059
|
function isTerminal(status) {
|
|
17054
17060
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
17055
17061
|
}
|
|
17056
17062
|
|
|
17057
|
-
//
|
|
17063
|
+
// ../node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
17058
17064
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
17059
17065
|
var defaultOptions = {
|
|
17060
17066
|
name: void 0,
|
|
@@ -17088,7 +17094,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
17088
17094
|
...options
|
|
17089
17095
|
};
|
|
17090
17096
|
|
|
17091
|
-
//
|
|
17097
|
+
// ../node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
17092
17098
|
var getRefs = (options) => {
|
|
17093
17099
|
const _options = getDefaultOptions(options);
|
|
17094
17100
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -17109,7 +17115,7 @@ var getRefs = (options) => {
|
|
|
17109
17115
|
};
|
|
17110
17116
|
};
|
|
17111
17117
|
|
|
17112
|
-
//
|
|
17118
|
+
// ../node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
17113
17119
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
17114
17120
|
if (!refs?.errorMessages)
|
|
17115
17121
|
return;
|
|
@@ -17125,7 +17131,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
17125
17131
|
addErrorMessage(res, key, errorMessage, refs);
|
|
17126
17132
|
}
|
|
17127
17133
|
|
|
17128
|
-
//
|
|
17134
|
+
// ../node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
17129
17135
|
var getRelativePath = (pathA, pathB) => {
|
|
17130
17136
|
let i = 0;
|
|
17131
17137
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
@@ -17135,7 +17141,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
17135
17141
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
17136
17142
|
};
|
|
17137
17143
|
|
|
17138
|
-
//
|
|
17144
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
17139
17145
|
function parseAnyDef(refs) {
|
|
17140
17146
|
if (refs.target !== "openAi") {
|
|
17141
17147
|
return {};
|
|
@@ -17151,7 +17157,7 @@ function parseAnyDef(refs) {
|
|
|
17151
17157
|
};
|
|
17152
17158
|
}
|
|
17153
17159
|
|
|
17154
|
-
//
|
|
17160
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
17155
17161
|
function parseArrayDef(def, refs) {
|
|
17156
17162
|
const res = {
|
|
17157
17163
|
type: "array"
|
|
@@ -17175,7 +17181,7 @@ function parseArrayDef(def, refs) {
|
|
|
17175
17181
|
return res;
|
|
17176
17182
|
}
|
|
17177
17183
|
|
|
17178
|
-
//
|
|
17184
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
17179
17185
|
function parseBigintDef(def, refs) {
|
|
17180
17186
|
const res = {
|
|
17181
17187
|
type: "integer",
|
|
@@ -17221,24 +17227,24 @@ function parseBigintDef(def, refs) {
|
|
|
17221
17227
|
return res;
|
|
17222
17228
|
}
|
|
17223
17229
|
|
|
17224
|
-
//
|
|
17230
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
17225
17231
|
function parseBooleanDef() {
|
|
17226
17232
|
return {
|
|
17227
17233
|
type: "boolean"
|
|
17228
17234
|
};
|
|
17229
17235
|
}
|
|
17230
17236
|
|
|
17231
|
-
//
|
|
17237
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
17232
17238
|
function parseBrandedDef(_def, refs) {
|
|
17233
17239
|
return parseDef(_def.type._def, refs);
|
|
17234
17240
|
}
|
|
17235
17241
|
|
|
17236
|
-
//
|
|
17242
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
17237
17243
|
var parseCatchDef = (def, refs) => {
|
|
17238
17244
|
return parseDef(def.innerType._def, refs);
|
|
17239
17245
|
};
|
|
17240
17246
|
|
|
17241
|
-
//
|
|
17247
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
17242
17248
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
17243
17249
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
17244
17250
|
if (Array.isArray(strategy)) {
|
|
@@ -17297,7 +17303,7 @@ var integerDateParser = (def, refs) => {
|
|
|
17297
17303
|
return res;
|
|
17298
17304
|
};
|
|
17299
17305
|
|
|
17300
|
-
//
|
|
17306
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
17301
17307
|
function parseDefaultDef(_def, refs) {
|
|
17302
17308
|
return {
|
|
17303
17309
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -17305,12 +17311,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
17305
17311
|
};
|
|
17306
17312
|
}
|
|
17307
17313
|
|
|
17308
|
-
//
|
|
17314
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
17309
17315
|
function parseEffectsDef(_def, refs) {
|
|
17310
17316
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
17311
17317
|
}
|
|
17312
17318
|
|
|
17313
|
-
//
|
|
17319
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
17314
17320
|
function parseEnumDef(def) {
|
|
17315
17321
|
return {
|
|
17316
17322
|
type: "string",
|
|
@@ -17318,7 +17324,7 @@ function parseEnumDef(def) {
|
|
|
17318
17324
|
};
|
|
17319
17325
|
}
|
|
17320
17326
|
|
|
17321
|
-
//
|
|
17327
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
17322
17328
|
var isJsonSchema7AllOfType = (type) => {
|
|
17323
17329
|
if ("type" in type && type.type === "string")
|
|
17324
17330
|
return false;
|
|
@@ -17360,7 +17366,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
17360
17366
|
} : void 0;
|
|
17361
17367
|
}
|
|
17362
17368
|
|
|
17363
|
-
//
|
|
17369
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
17364
17370
|
function parseLiteralDef(def, refs) {
|
|
17365
17371
|
const parsedType2 = typeof def.value;
|
|
17366
17372
|
if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
|
|
@@ -17380,7 +17386,7 @@ function parseLiteralDef(def, refs) {
|
|
|
17380
17386
|
};
|
|
17381
17387
|
}
|
|
17382
17388
|
|
|
17383
|
-
//
|
|
17389
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
17384
17390
|
var emojiRegex2 = void 0;
|
|
17385
17391
|
var zodPatterns = {
|
|
17386
17392
|
/**
|
|
@@ -17705,7 +17711,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
17705
17711
|
return pattern;
|
|
17706
17712
|
}
|
|
17707
17713
|
|
|
17708
|
-
//
|
|
17714
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
17709
17715
|
function parseRecordDef(def, refs) {
|
|
17710
17716
|
if (refs.target === "openAi") {
|
|
17711
17717
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -17757,7 +17763,7 @@ function parseRecordDef(def, refs) {
|
|
|
17757
17763
|
return schema;
|
|
17758
17764
|
}
|
|
17759
17765
|
|
|
17760
|
-
//
|
|
17766
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
17761
17767
|
function parseMapDef(def, refs) {
|
|
17762
17768
|
if (refs.mapStrategy === "record") {
|
|
17763
17769
|
return parseRecordDef(def, refs);
|
|
@@ -17782,7 +17788,7 @@ function parseMapDef(def, refs) {
|
|
|
17782
17788
|
};
|
|
17783
17789
|
}
|
|
17784
17790
|
|
|
17785
|
-
//
|
|
17791
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
17786
17792
|
function parseNativeEnumDef(def) {
|
|
17787
17793
|
const object3 = def.values;
|
|
17788
17794
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -17796,7 +17802,7 @@ function parseNativeEnumDef(def) {
|
|
|
17796
17802
|
};
|
|
17797
17803
|
}
|
|
17798
17804
|
|
|
17799
|
-
//
|
|
17805
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
17800
17806
|
function parseNeverDef(refs) {
|
|
17801
17807
|
return refs.target === "openAi" ? void 0 : {
|
|
17802
17808
|
not: parseAnyDef({
|
|
@@ -17806,7 +17812,7 @@ function parseNeverDef(refs) {
|
|
|
17806
17812
|
};
|
|
17807
17813
|
}
|
|
17808
17814
|
|
|
17809
|
-
//
|
|
17815
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
17810
17816
|
function parseNullDef(refs) {
|
|
17811
17817
|
return refs.target === "openApi3" ? {
|
|
17812
17818
|
enum: ["null"],
|
|
@@ -17816,7 +17822,7 @@ function parseNullDef(refs) {
|
|
|
17816
17822
|
};
|
|
17817
17823
|
}
|
|
17818
17824
|
|
|
17819
|
-
//
|
|
17825
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
17820
17826
|
var primitiveMappings = {
|
|
17821
17827
|
ZodString: "string",
|
|
17822
17828
|
ZodNumber: "number",
|
|
@@ -17884,7 +17890,7 @@ var asAnyOf = (def, refs) => {
|
|
|
17884
17890
|
return anyOf.length ? { anyOf } : void 0;
|
|
17885
17891
|
};
|
|
17886
17892
|
|
|
17887
|
-
//
|
|
17893
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
17888
17894
|
function parseNullableDef(def, refs) {
|
|
17889
17895
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
17890
17896
|
if (refs.target === "openApi3") {
|
|
@@ -17916,7 +17922,7 @@ function parseNullableDef(def, refs) {
|
|
|
17916
17922
|
return base && { anyOf: [base, { type: "null" }] };
|
|
17917
17923
|
}
|
|
17918
17924
|
|
|
17919
|
-
//
|
|
17925
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
17920
17926
|
function parseNumberDef(def, refs) {
|
|
17921
17927
|
const res = {
|
|
17922
17928
|
type: "number"
|
|
@@ -17965,7 +17971,7 @@ function parseNumberDef(def, refs) {
|
|
|
17965
17971
|
return res;
|
|
17966
17972
|
}
|
|
17967
17973
|
|
|
17968
|
-
//
|
|
17974
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
17969
17975
|
function parseObjectDef(def, refs) {
|
|
17970
17976
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
17971
17977
|
const result = {
|
|
@@ -18035,7 +18041,7 @@ function safeIsOptional(schema) {
|
|
|
18035
18041
|
}
|
|
18036
18042
|
}
|
|
18037
18043
|
|
|
18038
|
-
//
|
|
18044
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
18039
18045
|
var parseOptionalDef = (def, refs) => {
|
|
18040
18046
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
18041
18047
|
return parseDef(def.innerType._def, refs);
|
|
@@ -18054,7 +18060,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
18054
18060
|
} : parseAnyDef(refs);
|
|
18055
18061
|
};
|
|
18056
18062
|
|
|
18057
|
-
//
|
|
18063
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
18058
18064
|
var parsePipelineDef = (def, refs) => {
|
|
18059
18065
|
if (refs.pipeStrategy === "input") {
|
|
18060
18066
|
return parseDef(def.in._def, refs);
|
|
@@ -18074,12 +18080,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
18074
18080
|
};
|
|
18075
18081
|
};
|
|
18076
18082
|
|
|
18077
|
-
//
|
|
18083
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
18078
18084
|
function parsePromiseDef(def, refs) {
|
|
18079
18085
|
return parseDef(def.type._def, refs);
|
|
18080
18086
|
}
|
|
18081
18087
|
|
|
18082
|
-
//
|
|
18088
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
18083
18089
|
function parseSetDef(def, refs) {
|
|
18084
18090
|
const items = parseDef(def.valueType._def, {
|
|
18085
18091
|
...refs,
|
|
@@ -18099,7 +18105,7 @@ function parseSetDef(def, refs) {
|
|
|
18099
18105
|
return schema;
|
|
18100
18106
|
}
|
|
18101
18107
|
|
|
18102
|
-
//
|
|
18108
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
18103
18109
|
function parseTupleDef(def, refs) {
|
|
18104
18110
|
if (def.rest) {
|
|
18105
18111
|
return {
|
|
@@ -18127,24 +18133,24 @@ function parseTupleDef(def, refs) {
|
|
|
18127
18133
|
}
|
|
18128
18134
|
}
|
|
18129
18135
|
|
|
18130
|
-
//
|
|
18136
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
18131
18137
|
function parseUndefinedDef(refs) {
|
|
18132
18138
|
return {
|
|
18133
18139
|
not: parseAnyDef(refs)
|
|
18134
18140
|
};
|
|
18135
18141
|
}
|
|
18136
18142
|
|
|
18137
|
-
//
|
|
18143
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
18138
18144
|
function parseUnknownDef(refs) {
|
|
18139
18145
|
return parseAnyDef(refs);
|
|
18140
18146
|
}
|
|
18141
18147
|
|
|
18142
|
-
//
|
|
18148
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
18143
18149
|
var parseReadonlyDef = (def, refs) => {
|
|
18144
18150
|
return parseDef(def.innerType._def, refs);
|
|
18145
18151
|
};
|
|
18146
18152
|
|
|
18147
|
-
//
|
|
18153
|
+
// ../node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
18148
18154
|
var selectParser = (def, typeName, refs) => {
|
|
18149
18155
|
switch (typeName) {
|
|
18150
18156
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -18220,7 +18226,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
18220
18226
|
}
|
|
18221
18227
|
};
|
|
18222
18228
|
|
|
18223
|
-
//
|
|
18229
|
+
// ../node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
18224
18230
|
function parseDef(def, refs, forceResolution = false) {
|
|
18225
18231
|
const seenItem = refs.seen.get(def);
|
|
18226
18232
|
if (refs.override) {
|
|
@@ -18276,7 +18282,7 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
18276
18282
|
return jsonSchema;
|
|
18277
18283
|
};
|
|
18278
18284
|
|
|
18279
|
-
//
|
|
18285
|
+
// ../node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
18280
18286
|
var zodToJsonSchema = (schema, options) => {
|
|
18281
18287
|
const refs = getRefs(options);
|
|
18282
18288
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
@@ -18338,7 +18344,7 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
18338
18344
|
return combined;
|
|
18339
18345
|
};
|
|
18340
18346
|
|
|
18341
|
-
//
|
|
18347
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
18342
18348
|
function mapMiniTarget(t) {
|
|
18343
18349
|
if (!t)
|
|
18344
18350
|
return "draft-7";
|
|
@@ -18380,7 +18386,7 @@ function parseWithCompat(schema, data) {
|
|
|
18380
18386
|
return result.data;
|
|
18381
18387
|
}
|
|
18382
18388
|
|
|
18383
|
-
//
|
|
18389
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
18384
18390
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
18385
18391
|
var Protocol = class {
|
|
18386
18392
|
constructor(_options) {
|
|
@@ -19328,7 +19334,7 @@ function mergeCapabilities(base, additional) {
|
|
|
19328
19334
|
return result;
|
|
19329
19335
|
}
|
|
19330
19336
|
|
|
19331
|
-
//
|
|
19337
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
19332
19338
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
19333
19339
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
19334
19340
|
function createDefaultAjvInstance() {
|
|
@@ -19396,7 +19402,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
19396
19402
|
}
|
|
19397
19403
|
};
|
|
19398
19404
|
|
|
19399
|
-
//
|
|
19405
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
19400
19406
|
var ExperimentalServerTasks = class {
|
|
19401
19407
|
constructor(_server) {
|
|
19402
19408
|
this._server = _server;
|
|
@@ -19609,7 +19615,7 @@ var ExperimentalServerTasks = class {
|
|
|
19609
19615
|
}
|
|
19610
19616
|
};
|
|
19611
19617
|
|
|
19612
|
-
//
|
|
19618
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
19613
19619
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
19614
19620
|
if (!requests) {
|
|
19615
19621
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -19644,7 +19650,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
19644
19650
|
}
|
|
19645
19651
|
}
|
|
19646
19652
|
|
|
19647
|
-
//
|
|
19653
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
19648
19654
|
var Server = class extends Protocol {
|
|
19649
19655
|
/**
|
|
19650
19656
|
* Initializes this server with the given name and version information.
|
|
@@ -20024,7 +20030,7 @@ var Server = class extends Protocol {
|
|
|
20024
20030
|
}
|
|
20025
20031
|
};
|
|
20026
20032
|
|
|
20027
|
-
//
|
|
20033
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
20028
20034
|
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
20029
20035
|
function isCompletable(schema) {
|
|
20030
20036
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
@@ -20038,7 +20044,7 @@ var McpZodTypeKind;
|
|
|
20038
20044
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
20039
20045
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
20040
20046
|
|
|
20041
|
-
//
|
|
20047
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
20042
20048
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
20043
20049
|
function validateToolName(name) {
|
|
20044
20050
|
const warnings = [];
|
|
@@ -20096,7 +20102,7 @@ function validateAndWarnToolName(name) {
|
|
|
20096
20102
|
return result.isValid;
|
|
20097
20103
|
}
|
|
20098
20104
|
|
|
20099
|
-
//
|
|
20105
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
20100
20106
|
var ExperimentalMcpServerTasks = class {
|
|
20101
20107
|
constructor(_mcpServer) {
|
|
20102
20108
|
this._mcpServer = _mcpServer;
|
|
@@ -20111,7 +20117,7 @@ var ExperimentalMcpServerTasks = class {
|
|
|
20111
20117
|
}
|
|
20112
20118
|
};
|
|
20113
20119
|
|
|
20114
|
-
//
|
|
20120
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
20115
20121
|
var McpServer = class {
|
|
20116
20122
|
constructor(serverInfo, options) {
|
|
20117
20123
|
this._registeredResources = {};
|
|
@@ -20897,10 +20903,10 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
20897
20903
|
}
|
|
20898
20904
|
};
|
|
20899
20905
|
|
|
20900
|
-
//
|
|
20906
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
20901
20907
|
import process2 from "node:process";
|
|
20902
20908
|
|
|
20903
|
-
//
|
|
20909
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
20904
20910
|
var ReadBuffer = class {
|
|
20905
20911
|
append(chunk) {
|
|
20906
20912
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
@@ -20928,7 +20934,7 @@ function serializeMessage(message) {
|
|
|
20928
20934
|
return JSON.stringify(message) + "\n";
|
|
20929
20935
|
}
|
|
20930
20936
|
|
|
20931
|
-
//
|
|
20937
|
+
// ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
20932
20938
|
var StdioServerTransport = class {
|
|
20933
20939
|
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
20934
20940
|
this._stdin = _stdin;
|
|
@@ -20990,12 +20996,12 @@ var StdioServerTransport = class {
|
|
|
20990
20996
|
};
|
|
20991
20997
|
|
|
20992
20998
|
// src/tools/core.ts
|
|
20993
|
-
import * as
|
|
20994
|
-
import * as
|
|
20999
|
+
import * as fs2 from "fs";
|
|
21000
|
+
import * as path3 from "path";
|
|
20995
21001
|
|
|
20996
21002
|
// src/utils/utils.ts
|
|
20997
21003
|
function getWorkspaceRoot() {
|
|
20998
|
-
return process.env.WORKSPACE_DIR || process.env.
|
|
21004
|
+
return process.env.WORKSPACE_DIR || process.env.CLAUDE_PROJECT_DIR || process.env.CODEX_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.CLAUDE_WORKSPACE || process.env.CODEX_WORKSPACE || process.env.GEMINI_WORKSPACE || process.env.INIT_CWD || process.env.PWD || process.cwd();
|
|
20999
21005
|
}
|
|
21000
21006
|
function mcpText(text) {
|
|
21001
21007
|
return { content: [{ type: "text", text }] };
|
|
@@ -21005,6 +21011,41 @@ function mcpJson(obj) {
|
|
|
21005
21011
|
}
|
|
21006
21012
|
|
|
21007
21013
|
// src/tools/config.ts
|
|
21014
|
+
import * as fs from "fs";
|
|
21015
|
+
import * as path from "path";
|
|
21016
|
+
|
|
21017
|
+
// src/memory/types.ts
|
|
21018
|
+
var DEFAULT_MEMORY_CONFIG = {
|
|
21019
|
+
enabled: false,
|
|
21020
|
+
wikiDir: "",
|
|
21021
|
+
topK: 5,
|
|
21022
|
+
chunkSize: 1500,
|
|
21023
|
+
overlapLines: 2,
|
|
21024
|
+
embeddingModel: "Xenova/bge-small-en-v1.5",
|
|
21025
|
+
vectorDimension: 384
|
|
21026
|
+
};
|
|
21027
|
+
|
|
21028
|
+
// src/tools/config.ts
|
|
21029
|
+
function resolveMemoryConfig(settings2, workspaceRoot2) {
|
|
21030
|
+
const override = settings2.memory ?? {};
|
|
21031
|
+
return {
|
|
21032
|
+
...DEFAULT_MEMORY_CONFIG,
|
|
21033
|
+
...override,
|
|
21034
|
+
enabled: override.enabled ?? DEFAULT_MEMORY_CONFIG.enabled,
|
|
21035
|
+
wikiDir: typeof override.wikiDir === "string" && override.wikiDir.length > 0 ? override.wikiDir : path.join(workspaceRoot2, ".agent-kit", "wiki")
|
|
21036
|
+
};
|
|
21037
|
+
}
|
|
21038
|
+
function loadProjectSettings(projectDir) {
|
|
21039
|
+
const settingsPath = path.join(projectDir, ".agent-kit", "settings.json");
|
|
21040
|
+
if (fs.existsSync(settingsPath)) {
|
|
21041
|
+
try {
|
|
21042
|
+
return JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
|
|
21043
|
+
} catch (error2) {
|
|
21044
|
+
console.error(`[agent-kit] Warning: Failed to parse ${settingsPath}:`, error2);
|
|
21045
|
+
}
|
|
21046
|
+
}
|
|
21047
|
+
return {};
|
|
21048
|
+
}
|
|
21008
21049
|
var FORBIDDEN_FILES = [
|
|
21009
21050
|
".env",
|
|
21010
21051
|
".bashrc",
|
|
@@ -21046,7 +21087,7 @@ var FORBIDDEN_DIRS = [
|
|
|
21046
21087
|
];
|
|
21047
21088
|
|
|
21048
21089
|
// src/tools/handoffs.ts
|
|
21049
|
-
import * as
|
|
21090
|
+
import * as path2 from "path";
|
|
21050
21091
|
var HANDOFF_TYPES = [
|
|
21051
21092
|
"brainstorm",
|
|
21052
21093
|
"clarification",
|
|
@@ -21089,11 +21130,11 @@ function resolveHandoffPath(input) {
|
|
|
21089
21130
|
content: input.content,
|
|
21090
21131
|
type: canonicalType
|
|
21091
21132
|
});
|
|
21092
|
-
const relativePath =
|
|
21133
|
+
const relativePath = path2.join(".agent-kit", "handoffs", featureSlug, `${canonicalType}.md`);
|
|
21093
21134
|
return {
|
|
21094
21135
|
featureSlug,
|
|
21095
21136
|
canonicalType,
|
|
21096
|
-
filePath:
|
|
21137
|
+
filePath: path2.join(input.workspaceRoot, relativePath),
|
|
21097
21138
|
relativePath
|
|
21098
21139
|
};
|
|
21099
21140
|
}
|
|
@@ -21118,11 +21159,11 @@ function registerCoreTools(server2) {
|
|
|
21118
21159
|
slug,
|
|
21119
21160
|
content
|
|
21120
21161
|
});
|
|
21121
|
-
const handoffDir =
|
|
21122
|
-
if (!
|
|
21123
|
-
|
|
21162
|
+
const handoffDir = path3.dirname(location.filePath);
|
|
21163
|
+
if (!fs2.existsSync(handoffDir)) {
|
|
21164
|
+
fs2.mkdirSync(handoffDir, { recursive: true });
|
|
21124
21165
|
}
|
|
21125
|
-
|
|
21166
|
+
fs2.writeFileSync(location.filePath, content, "utf8");
|
|
21126
21167
|
return mcpText(`\u2705 Saved to: ${location.filePath}`);
|
|
21127
21168
|
} catch (error2) {
|
|
21128
21169
|
return mcpText(`Error saving handoff: ${error2}`);
|
|
@@ -21134,28 +21175,28 @@ function registerCoreTools(server2) {
|
|
|
21134
21175
|
// src/tools/agent.ts
|
|
21135
21176
|
import { spawn } from "child_process";
|
|
21136
21177
|
import { randomUUID } from "crypto";
|
|
21137
|
-
import * as
|
|
21138
|
-
import * as
|
|
21178
|
+
import * as fs3 from "fs";
|
|
21179
|
+
import * as path5 from "path";
|
|
21139
21180
|
|
|
21140
21181
|
// src/tools/security.ts
|
|
21141
21182
|
import { execFileSync } from "child_process";
|
|
21142
|
-
import * as
|
|
21183
|
+
import * as path4 from "path";
|
|
21143
21184
|
function sanitize(input) {
|
|
21144
21185
|
return String(input).replace(/[;&|`$<>\\]/g, "").trim().slice(0, 500);
|
|
21145
21186
|
}
|
|
21146
21187
|
function validatePath(filePath, baseDir = process.cwd()) {
|
|
21147
|
-
const resolved =
|
|
21148
|
-
const root =
|
|
21149
|
-
if (resolved !== root && !resolved.startsWith(root +
|
|
21188
|
+
const resolved = path4.resolve(baseDir, filePath);
|
|
21189
|
+
const root = path4.resolve(baseDir);
|
|
21190
|
+
if (resolved !== root && !resolved.startsWith(root + path4.sep)) {
|
|
21150
21191
|
throw new Error(`Path traversal detected: ${filePath}`);
|
|
21151
21192
|
}
|
|
21152
|
-
const segments = resolved.split(
|
|
21193
|
+
const segments = resolved.split(path4.sep);
|
|
21153
21194
|
for (const segment of segments) {
|
|
21154
21195
|
if (FORBIDDEN_DIRS.some((d) => segment.toLowerCase() === d.toLowerCase())) {
|
|
21155
21196
|
throw new Error(`Access to sensitive directory is FORBIDDEN: ${segment}`);
|
|
21156
21197
|
}
|
|
21157
21198
|
}
|
|
21158
|
-
const fileName =
|
|
21199
|
+
const fileName = path4.basename(resolved);
|
|
21159
21200
|
const isExactForbidden = FORBIDDEN_FILES.some((f) => fileName.toLowerCase() === f.toLowerCase());
|
|
21160
21201
|
const isPatternForbidden = FORBIDDEN_PATTERNS.some((re) => re.test(fileName));
|
|
21161
21202
|
if (isExactForbidden || isPatternForbidden) {
|
|
@@ -21206,7 +21247,7 @@ var INSTALL_HINTS = {
|
|
|
21206
21247
|
claude: "Install Claude CLI: npm install -g @anthropic-ai/claude-code",
|
|
21207
21248
|
codex: "Install Codex CLI: npm install -g @openai/codex"
|
|
21208
21249
|
};
|
|
21209
|
-
function agentArgs(agent, prompt,
|
|
21250
|
+
function agentArgs(agent, prompt, workspaceRoot2) {
|
|
21210
21251
|
switch (agent) {
|
|
21211
21252
|
case "gemini":
|
|
21212
21253
|
return ["-y", "-p", prompt];
|
|
@@ -21219,7 +21260,7 @@ function agentArgs(agent, prompt, workspaceRoot) {
|
|
|
21219
21260
|
"--sandbox",
|
|
21220
21261
|
"workspace-write",
|
|
21221
21262
|
"--cd",
|
|
21222
|
-
|
|
21263
|
+
workspaceRoot2,
|
|
21223
21264
|
"exec",
|
|
21224
21265
|
prompt
|
|
21225
21266
|
];
|
|
@@ -21228,21 +21269,21 @@ function agentArgs(agent, prompt, workspaceRoot) {
|
|
|
21228
21269
|
function taskSlug(task) {
|
|
21229
21270
|
return task.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 6).join("-").slice(0, 48);
|
|
21230
21271
|
}
|
|
21231
|
-
function initAgentLog(
|
|
21232
|
-
const logsDir =
|
|
21233
|
-
|
|
21272
|
+
function initAgentLog(workspaceRoot2, slug, agent) {
|
|
21273
|
+
const logsDir = path5.join(workspaceRoot2, ".agent-kit", "logs", "agents");
|
|
21274
|
+
fs3.mkdirSync(logsDir, { recursive: true });
|
|
21234
21275
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
21235
|
-
const logFile =
|
|
21276
|
+
const logFile = path5.join(logsDir, `delegate-${now}-${slug}.log`);
|
|
21236
21277
|
const header = `Agent: ${agent}
|
|
21237
21278
|
Date: ${now}
|
|
21238
21279
|
${"\u2500".repeat(60)}
|
|
21239
21280
|
|
|
21240
21281
|
`;
|
|
21241
|
-
|
|
21242
|
-
const logStream =
|
|
21282
|
+
fs3.writeFileSync(logFile, header, "utf-8");
|
|
21283
|
+
const logStream = fs3.createWriteStream(logFile, { flags: "a" });
|
|
21243
21284
|
logStream.on("error", () => {
|
|
21244
21285
|
});
|
|
21245
|
-
return { logPath:
|
|
21286
|
+
return { logPath: path5.relative(workspaceRoot2, logFile), logStream };
|
|
21246
21287
|
}
|
|
21247
21288
|
function registerAgentTools(server2) {
|
|
21248
21289
|
server2.tool(
|
|
@@ -21255,17 +21296,17 @@ function registerAgentTools(server2) {
|
|
|
21255
21296
|
)
|
|
21256
21297
|
},
|
|
21257
21298
|
async ({ agent, task }, extra) => {
|
|
21258
|
-
const
|
|
21299
|
+
const workspaceRoot2 = getWorkspaceRoot();
|
|
21259
21300
|
let job;
|
|
21260
21301
|
let logPath;
|
|
21261
21302
|
let killChild;
|
|
21262
21303
|
try {
|
|
21263
21304
|
let prompt = task;
|
|
21264
|
-
const resolvedTask =
|
|
21265
|
-
if (
|
|
21305
|
+
const resolvedTask = path5.resolve(workspaceRoot2, task);
|
|
21306
|
+
if (fs3.existsSync(resolvedTask) && fs3.statSync(resolvedTask).isFile()) {
|
|
21266
21307
|
try {
|
|
21267
|
-
validatePath(task,
|
|
21268
|
-
prompt =
|
|
21308
|
+
validatePath(task, workspaceRoot2);
|
|
21309
|
+
prompt = fs3.readFileSync(resolvedTask, "utf-8");
|
|
21269
21310
|
} catch (err) {
|
|
21270
21311
|
return mcpText(`Error reading task file: ${err}`);
|
|
21271
21312
|
}
|
|
@@ -21278,17 +21319,17 @@ function registerAgentTools(server2) {
|
|
|
21278
21319
|
error: `${agent} CLI is not installed. ${INSTALL_HINTS[agent]}`
|
|
21279
21320
|
});
|
|
21280
21321
|
}
|
|
21281
|
-
const args = agentArgs(agent, prompt,
|
|
21282
|
-
const { logPath: lp, logStream } = initAgentLog(
|
|
21322
|
+
const args = agentArgs(agent, prompt, workspaceRoot2);
|
|
21323
|
+
const { logPath: lp, logStream } = initAgentLog(workspaceRoot2, taskSlug(task), agent);
|
|
21283
21324
|
logPath = lp;
|
|
21284
21325
|
const jobId = randomUUID();
|
|
21285
21326
|
const child = spawn(agent, args, {
|
|
21286
|
-
cwd:
|
|
21327
|
+
cwd: workspaceRoot2,
|
|
21287
21328
|
env: {
|
|
21288
21329
|
...process.env,
|
|
21289
|
-
CODEX_PROJECT_DIR:
|
|
21290
|
-
CODEX_WORKSPACE:
|
|
21291
|
-
GEMINI_WORKSPACE:
|
|
21330
|
+
CODEX_PROJECT_DIR: workspaceRoot2,
|
|
21331
|
+
CODEX_WORKSPACE: workspaceRoot2,
|
|
21332
|
+
GEMINI_WORKSPACE: workspaceRoot2
|
|
21292
21333
|
},
|
|
21293
21334
|
detached: process.platform !== "win32"
|
|
21294
21335
|
});
|
|
@@ -21366,10 +21407,10 @@ function registerAgentTools(server2) {
|
|
|
21366
21407
|
import { writeFileSync as writeFileSync3 } from "fs";
|
|
21367
21408
|
|
|
21368
21409
|
// src/utils/credentials.ts
|
|
21369
|
-
import * as
|
|
21410
|
+
import * as fs4 from "fs";
|
|
21370
21411
|
import * as os from "os";
|
|
21371
|
-
import * as
|
|
21372
|
-
var CREDENTIALS_FILE =
|
|
21412
|
+
import * as path6 from "path";
|
|
21413
|
+
var CREDENTIALS_FILE = path6.join(os.homedir(), ".claude", "credentials");
|
|
21373
21414
|
var cachedCredentials = null;
|
|
21374
21415
|
function parseIni(content) {
|
|
21375
21416
|
const result = {};
|
|
@@ -21394,12 +21435,12 @@ function parseIni(content) {
|
|
|
21394
21435
|
}
|
|
21395
21436
|
function loadCredentials() {
|
|
21396
21437
|
if (cachedCredentials !== null) return cachedCredentials;
|
|
21397
|
-
if (!
|
|
21438
|
+
if (!fs4.existsSync(CREDENTIALS_FILE)) {
|
|
21398
21439
|
cachedCredentials = {};
|
|
21399
21440
|
return cachedCredentials;
|
|
21400
21441
|
}
|
|
21401
21442
|
try {
|
|
21402
|
-
const stat =
|
|
21443
|
+
const stat = fs4.statSync(CREDENTIALS_FILE);
|
|
21403
21444
|
const mode = stat.mode & 511;
|
|
21404
21445
|
if (mode !== 384) {
|
|
21405
21446
|
process.stderr.write(
|
|
@@ -21409,7 +21450,7 @@ function loadCredentials() {
|
|
|
21409
21450
|
}
|
|
21410
21451
|
} catch {
|
|
21411
21452
|
}
|
|
21412
|
-
const content =
|
|
21453
|
+
const content = fs4.readFileSync(CREDENTIALS_FILE, "utf-8");
|
|
21413
21454
|
const ini = parseIni(content);
|
|
21414
21455
|
const profile = process.env.KIT_PROFILE ?? "default";
|
|
21415
21456
|
cachedCredentials = ini[profile] ?? {};
|
|
@@ -21742,6 +21783,714 @@ ${ticket.fields.labels?.join(", ") || "None"}`;
|
|
|
21742
21783
|
);
|
|
21743
21784
|
}
|
|
21744
21785
|
|
|
21786
|
+
// src/tools/memory.ts
|
|
21787
|
+
import * as path10 from "path";
|
|
21788
|
+
|
|
21789
|
+
// src/memory/embedder.ts
|
|
21790
|
+
import * as os2 from "os";
|
|
21791
|
+
import * as path7 from "path";
|
|
21792
|
+
var DEFAULT_CACHE_DIR = path7.join(os2.homedir(), ".cache", "fastembed");
|
|
21793
|
+
var EmbedderError = class extends Error {
|
|
21794
|
+
constructor(message, cause) {
|
|
21795
|
+
super(message);
|
|
21796
|
+
this.name = "EmbedderError";
|
|
21797
|
+
if (cause instanceof Error) this.cause = cause;
|
|
21798
|
+
}
|
|
21799
|
+
};
|
|
21800
|
+
var Embedder = class {
|
|
21801
|
+
modelName;
|
|
21802
|
+
pipeline = null;
|
|
21803
|
+
_dimension;
|
|
21804
|
+
constructor(modelName) {
|
|
21805
|
+
this.modelName = modelName;
|
|
21806
|
+
}
|
|
21807
|
+
async embed(texts) {
|
|
21808
|
+
if (texts.length === 0) return [];
|
|
21809
|
+
if (!this.pipeline) {
|
|
21810
|
+
await this.loadModel();
|
|
21811
|
+
}
|
|
21812
|
+
try {
|
|
21813
|
+
const results = await this.pipeline(texts);
|
|
21814
|
+
return results.map((vec) => {
|
|
21815
|
+
const arr = new Float32Array(vec);
|
|
21816
|
+
if (!this._dimension) this._dimension = arr.length;
|
|
21817
|
+
return arr;
|
|
21818
|
+
});
|
|
21819
|
+
} catch (cause) {
|
|
21820
|
+
throw new EmbedderError(`Embedding failed for batch of ${texts.length} texts`, cause);
|
|
21821
|
+
}
|
|
21822
|
+
}
|
|
21823
|
+
get dimension() {
|
|
21824
|
+
return this._dimension;
|
|
21825
|
+
}
|
|
21826
|
+
isReady() {
|
|
21827
|
+
return this.pipeline !== null;
|
|
21828
|
+
}
|
|
21829
|
+
async loadModel() {
|
|
21830
|
+
try {
|
|
21831
|
+
const { EmbeddingModel, FlagEmbedding } = await import("fastembed");
|
|
21832
|
+
const modelMap = {
|
|
21833
|
+
"Xenova/bge-small-en-v1.5": EmbeddingModel.BGESmallENV15,
|
|
21834
|
+
"Xenova/bge-base-en-v1.5": EmbeddingModel.BGEBaseENV15,
|
|
21835
|
+
"Xenova/all-MiniLM-L6-v2": EmbeddingModel.AllMiniLML6V2
|
|
21836
|
+
};
|
|
21837
|
+
const model = modelMap[this.modelName] ?? EmbeddingModel.BGESmallENV15;
|
|
21838
|
+
const embedder = await FlagEmbedding.init({ model, cacheDir: DEFAULT_CACHE_DIR, showDownloadProgress: false });
|
|
21839
|
+
this.pipeline = async (texts) => {
|
|
21840
|
+
const result = [];
|
|
21841
|
+
for await (const batch of embedder.embed(texts, texts.length)) {
|
|
21842
|
+
for (const vec of batch) {
|
|
21843
|
+
result.push(Array.from(vec));
|
|
21844
|
+
}
|
|
21845
|
+
}
|
|
21846
|
+
return result;
|
|
21847
|
+
};
|
|
21848
|
+
} catch (cause) {
|
|
21849
|
+
throw new EmbedderError(`Failed to load embedding model: ${this.modelName}`, cause);
|
|
21850
|
+
}
|
|
21851
|
+
}
|
|
21852
|
+
};
|
|
21853
|
+
|
|
21854
|
+
// src/memory/indexer.ts
|
|
21855
|
+
import * as fs5 from "fs";
|
|
21856
|
+
import * as path8 from "path";
|
|
21857
|
+
|
|
21858
|
+
// src/memory/chunker.ts
|
|
21859
|
+
import { createHash } from "crypto";
|
|
21860
|
+
function computeChunkId(content) {
|
|
21861
|
+
return createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
21862
|
+
}
|
|
21863
|
+
function cleanContentForEmbedding(text) {
|
|
21864
|
+
return text.replace(/<!--[\s\S]*?-->/g, "");
|
|
21865
|
+
}
|
|
21866
|
+
var HEADING_RE = /^(#{1,6}) (.+)$/;
|
|
21867
|
+
var SENTENCE_END_RE = /([.!?。!?])\s+(?![0-9])/g;
|
|
21868
|
+
var URL_RE = /https?:\/\/\S+/g;
|
|
21869
|
+
function splitAtParagraph(text, maxLen) {
|
|
21870
|
+
const paragraphs = text.split(/\n\n+/);
|
|
21871
|
+
const parts = [];
|
|
21872
|
+
let current = "";
|
|
21873
|
+
for (const para of paragraphs) {
|
|
21874
|
+
const candidate = current ? `${current}
|
|
21875
|
+
|
|
21876
|
+
${para}` : para;
|
|
21877
|
+
if (candidate.length <= maxLen) {
|
|
21878
|
+
current = candidate;
|
|
21879
|
+
} else {
|
|
21880
|
+
if (current) parts.push(current);
|
|
21881
|
+
current = para.length <= maxLen ? para : splitAtLine(para, maxLen).join("\n\n");
|
|
21882
|
+
}
|
|
21883
|
+
}
|
|
21884
|
+
if (current) parts.push(current);
|
|
21885
|
+
return parts.filter(Boolean);
|
|
21886
|
+
}
|
|
21887
|
+
function splitAtLine(text, maxLen) {
|
|
21888
|
+
const lines = text.split("\n");
|
|
21889
|
+
const parts = [];
|
|
21890
|
+
let current = "";
|
|
21891
|
+
for (const line of lines) {
|
|
21892
|
+
const candidate = current ? `${current}
|
|
21893
|
+
${line}` : line;
|
|
21894
|
+
if (candidate.length <= maxLen) {
|
|
21895
|
+
current = candidate;
|
|
21896
|
+
} else {
|
|
21897
|
+
if (current) parts.push(current);
|
|
21898
|
+
current = line.length <= maxLen ? line : splitAtSentence(line, maxLen).join(" ");
|
|
21899
|
+
}
|
|
21900
|
+
}
|
|
21901
|
+
if (current) parts.push(current);
|
|
21902
|
+
return parts.filter(Boolean);
|
|
21903
|
+
}
|
|
21904
|
+
function splitAtSentence(text, maxLen) {
|
|
21905
|
+
const sanitized = text.replace(URL_RE, "[URL]");
|
|
21906
|
+
const sentences = [];
|
|
21907
|
+
let lastIndex = 0;
|
|
21908
|
+
for (const match of sanitized.matchAll(SENTENCE_END_RE)) {
|
|
21909
|
+
const end = (match.index ?? 0) + match[0].length;
|
|
21910
|
+
sentences.push(text.slice(lastIndex, end).trim());
|
|
21911
|
+
lastIndex = end;
|
|
21912
|
+
}
|
|
21913
|
+
if (lastIndex < text.length) {
|
|
21914
|
+
sentences.push(text.slice(lastIndex).trim());
|
|
21915
|
+
}
|
|
21916
|
+
if (sentences.length === 0) return [text.slice(0, maxLen)];
|
|
21917
|
+
const parts = [];
|
|
21918
|
+
let current = "";
|
|
21919
|
+
for (const sentence of sentences) {
|
|
21920
|
+
const candidate = current ? `${current} ${sentence}` : sentence;
|
|
21921
|
+
if (candidate.length <= maxLen) {
|
|
21922
|
+
current = candidate;
|
|
21923
|
+
} else {
|
|
21924
|
+
if (current) parts.push(current);
|
|
21925
|
+
current = sentence.slice(0, maxLen);
|
|
21926
|
+
}
|
|
21927
|
+
}
|
|
21928
|
+
if (current) parts.push(current);
|
|
21929
|
+
return parts.filter(Boolean);
|
|
21930
|
+
}
|
|
21931
|
+
function splitSection(text, maxLen) {
|
|
21932
|
+
if (text.length <= maxLen) return [text];
|
|
21933
|
+
const byPara = splitAtParagraph(text, maxLen);
|
|
21934
|
+
if (byPara.every((p) => p.length <= maxLen)) return byPara;
|
|
21935
|
+
return byPara.flatMap((p) => p.length <= maxLen ? [p] : splitAtLine(p, maxLen));
|
|
21936
|
+
}
|
|
21937
|
+
function chunkMarkdown(text, source, config2) {
|
|
21938
|
+
if (!text || !text.trim()) return [];
|
|
21939
|
+
const { chunkSize, overlapLines } = config2;
|
|
21940
|
+
const lines = text.split("\n");
|
|
21941
|
+
const sections = [];
|
|
21942
|
+
let current = { heading: "", headingLevel: 0, lines: [] };
|
|
21943
|
+
for (let i = 0; i < lines.length; i++) {
|
|
21944
|
+
const line = lines[i];
|
|
21945
|
+
const headingMatch = line.match(HEADING_RE);
|
|
21946
|
+
if (headingMatch) {
|
|
21947
|
+
if (current.lines.length > 0) sections.push(current);
|
|
21948
|
+
current = {
|
|
21949
|
+
heading: headingMatch[2].trim(),
|
|
21950
|
+
headingLevel: headingMatch[1].length,
|
|
21951
|
+
lines: [{ text: line, lineNum: i + 1 }]
|
|
21952
|
+
};
|
|
21953
|
+
} else {
|
|
21954
|
+
current.lines.push({ text: line, lineNum: i + 1 });
|
|
21955
|
+
}
|
|
21956
|
+
}
|
|
21957
|
+
if (current.lines.length > 0) sections.push(current);
|
|
21958
|
+
const chunks = [];
|
|
21959
|
+
let prevOverlapLines = [];
|
|
21960
|
+
for (const section of sections) {
|
|
21961
|
+
const sectionText = section.lines.map((l) => l.text).join("\n");
|
|
21962
|
+
if (!sectionText.trim()) continue;
|
|
21963
|
+
const fullText = prevOverlapLines.length > 0 ? `${prevOverlapLines.join("\n")}
|
|
21964
|
+
${sectionText}` : sectionText;
|
|
21965
|
+
const parts = splitSection(fullText, chunkSize);
|
|
21966
|
+
for (let pi = 0; pi < parts.length; pi++) {
|
|
21967
|
+
const part = parts[pi];
|
|
21968
|
+
if (!part.trim()) continue;
|
|
21969
|
+
const partLines = part.split("\n");
|
|
21970
|
+
const firstLine = section.lines[0]?.lineNum ?? 1;
|
|
21971
|
+
const lastLine = section.lines[section.lines.length - 1]?.lineNum ?? firstLine;
|
|
21972
|
+
const content = cleanContentForEmbedding(part);
|
|
21973
|
+
chunks.push({
|
|
21974
|
+
id: computeChunkId(content),
|
|
21975
|
+
source,
|
|
21976
|
+
heading: section.heading,
|
|
21977
|
+
headingLevel: section.headingLevel,
|
|
21978
|
+
content,
|
|
21979
|
+
lineStart: firstLine,
|
|
21980
|
+
lineEnd: lastLine
|
|
21981
|
+
});
|
|
21982
|
+
if (pi === parts.length - 1) {
|
|
21983
|
+
prevOverlapLines = partLines.slice(-overlapLines);
|
|
21984
|
+
}
|
|
21985
|
+
}
|
|
21986
|
+
}
|
|
21987
|
+
return chunks;
|
|
21988
|
+
}
|
|
21989
|
+
|
|
21990
|
+
// src/memory/indexer.ts
|
|
21991
|
+
var LOCK_RETRY_MS = 50;
|
|
21992
|
+
var LOCK_TIMEOUT_MS = 500;
|
|
21993
|
+
async function acquireLock(lockPath) {
|
|
21994
|
+
const deadline = Date.now() + LOCK_TIMEOUT_MS;
|
|
21995
|
+
while (Date.now() < deadline) {
|
|
21996
|
+
try {
|
|
21997
|
+
fs5.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
21998
|
+
return true;
|
|
21999
|
+
} catch {
|
|
22000
|
+
await new Promise((r) => setTimeout(r, LOCK_RETRY_MS));
|
|
22001
|
+
}
|
|
22002
|
+
}
|
|
22003
|
+
return false;
|
|
22004
|
+
}
|
|
22005
|
+
function releaseLock(lockPath) {
|
|
22006
|
+
try {
|
|
22007
|
+
fs5.unlinkSync(lockPath);
|
|
22008
|
+
} catch {
|
|
22009
|
+
}
|
|
22010
|
+
}
|
|
22011
|
+
var MemoryIndexer = class {
|
|
22012
|
+
constructor(store, embedder, config2) {
|
|
22013
|
+
this.store = store;
|
|
22014
|
+
this.embedder = embedder;
|
|
22015
|
+
this.config = config2;
|
|
22016
|
+
}
|
|
22017
|
+
_ready = false;
|
|
22018
|
+
async indexFile(absolutePath) {
|
|
22019
|
+
return this.indexFileRelativeTo(absolutePath, this.config.wikiDir);
|
|
22020
|
+
}
|
|
22021
|
+
async indexFileRelativeTo(absolutePath, sourceRoot) {
|
|
22022
|
+
const source = path8.relative(sourceRoot, absolutePath);
|
|
22023
|
+
const existingHashes = this.store.hashesBySource(source);
|
|
22024
|
+
let text;
|
|
22025
|
+
try {
|
|
22026
|
+
text = fs5.readFileSync(absolutePath, "utf8");
|
|
22027
|
+
} catch (err) {
|
|
22028
|
+
console.warn(`[memory-indexer] Cannot read file ${absolutePath}:`, err);
|
|
22029
|
+
return { indexed: 0, deleted: 0, skipped: existingHashes.size };
|
|
22030
|
+
}
|
|
22031
|
+
const allChunks = chunkMarkdown(text, source, this.config);
|
|
22032
|
+
const newHashes = new Set(allChunks.map((c) => c.id));
|
|
22033
|
+
const toIndex = allChunks.filter((c) => !existingHashes.has(c.id));
|
|
22034
|
+
const toDelete = [...existingHashes].filter((h) => !newHashes.has(h));
|
|
22035
|
+
let embeddings = [];
|
|
22036
|
+
if (toIndex.length > 0) {
|
|
22037
|
+
try {
|
|
22038
|
+
embeddings = await this.embedder.embed(toIndex.map((c) => c.content));
|
|
22039
|
+
} catch (err) {
|
|
22040
|
+
console.warn(`[memory-indexer] Embedding failed for ${absolutePath}:`, err);
|
|
22041
|
+
return { indexed: 0, deleted: 0, skipped: existingHashes.size };
|
|
22042
|
+
}
|
|
22043
|
+
}
|
|
22044
|
+
if (toIndex.length > 0) {
|
|
22045
|
+
this.store.upsert(toIndex, embeddings);
|
|
22046
|
+
}
|
|
22047
|
+
if (toDelete.length > 0) {
|
|
22048
|
+
this.store.deleteByIds(toDelete);
|
|
22049
|
+
}
|
|
22050
|
+
return {
|
|
22051
|
+
indexed: toIndex.length,
|
|
22052
|
+
deleted: toDelete.length,
|
|
22053
|
+
skipped: allChunks.length - toIndex.length
|
|
22054
|
+
};
|
|
22055
|
+
}
|
|
22056
|
+
async indexDirectory(rootDir, opts = {}) {
|
|
22057
|
+
const totals = { indexed: 0, deleted: 0, skipped: 0 };
|
|
22058
|
+
if (!fs5.existsSync(rootDir)) return totals;
|
|
22059
|
+
const relativeBase = opts.relativeBase ?? this.config.wikiDir;
|
|
22060
|
+
const excludeFiles = new Set(opts.excludeFiles ?? []);
|
|
22061
|
+
const files = [];
|
|
22062
|
+
const walk = (dirPath) => {
|
|
22063
|
+
let entries;
|
|
22064
|
+
try {
|
|
22065
|
+
entries = fs5.readdirSync(dirPath, { withFileTypes: true });
|
|
22066
|
+
} catch (err) {
|
|
22067
|
+
console.warn(`[memory-indexer] Cannot scan directory ${dirPath}:`, err);
|
|
22068
|
+
return;
|
|
22069
|
+
}
|
|
22070
|
+
for (const entry of entries) {
|
|
22071
|
+
const entryPath = path8.join(dirPath, entry.name);
|
|
22072
|
+
if (entry.isDirectory()) {
|
|
22073
|
+
walk(entryPath);
|
|
22074
|
+
continue;
|
|
22075
|
+
}
|
|
22076
|
+
if (entry.isFile() && /\.md$/i.test(entry.name) && !excludeFiles.has(entry.name)) {
|
|
22077
|
+
files.push(entryPath);
|
|
22078
|
+
}
|
|
22079
|
+
}
|
|
22080
|
+
};
|
|
22081
|
+
walk(rootDir);
|
|
22082
|
+
const currentSources = new Set(
|
|
22083
|
+
files.map((file) => path8.relative(relativeBase, file))
|
|
22084
|
+
);
|
|
22085
|
+
for (const stale of this.store.indexedSources()) {
|
|
22086
|
+
if (!currentSources.has(stale)) {
|
|
22087
|
+
this.store.deleteBySource(stale);
|
|
22088
|
+
totals.deleted += 1;
|
|
22089
|
+
}
|
|
22090
|
+
}
|
|
22091
|
+
for (const file of files) {
|
|
22092
|
+
const stats = await this.indexFileRelativeTo(file, relativeBase);
|
|
22093
|
+
totals.indexed += stats.indexed;
|
|
22094
|
+
totals.deleted += stats.deleted;
|
|
22095
|
+
totals.skipped += stats.skipped;
|
|
22096
|
+
}
|
|
22097
|
+
return totals;
|
|
22098
|
+
}
|
|
22099
|
+
async search(query, topK) {
|
|
22100
|
+
const fetchLimit = topK * 2;
|
|
22101
|
+
let denseResults = [];
|
|
22102
|
+
if (this.store.vecAvailable) {
|
|
22103
|
+
try {
|
|
22104
|
+
const queryEmbedding = await this.embedder.embed([query]);
|
|
22105
|
+
denseResults = this.store.searchDense(queryEmbedding[0], fetchLimit);
|
|
22106
|
+
} catch (err) {
|
|
22107
|
+
console.warn("[memory-indexer] Dense search embedding failed:", err);
|
|
22108
|
+
}
|
|
22109
|
+
}
|
|
22110
|
+
const bm25Results = this.store.searchBm25(query, fetchLimit);
|
|
22111
|
+
const k = 60;
|
|
22112
|
+
const scoreMap = /* @__PURE__ */ new Map();
|
|
22113
|
+
denseResults.forEach((r, rank) => {
|
|
22114
|
+
scoreMap.set(r.id, { dense: 1 / (k + rank + 1), bm25: 0 });
|
|
22115
|
+
});
|
|
22116
|
+
bm25Results.forEach((r, rank) => {
|
|
22117
|
+
const existing = scoreMap.get(r.id);
|
|
22118
|
+
if (existing) {
|
|
22119
|
+
existing.bm25 = 1 / (k + rank + 1);
|
|
22120
|
+
} else {
|
|
22121
|
+
scoreMap.set(r.id, { dense: 0, bm25: 1 / (k + rank + 1) });
|
|
22122
|
+
}
|
|
22123
|
+
});
|
|
22124
|
+
const hasDense = this.store.vecAvailable && denseResults.length > 0;
|
|
22125
|
+
const numRetrievers = hasDense ? 2 : 1;
|
|
22126
|
+
const maxScore = numRetrievers / 61;
|
|
22127
|
+
const ranked = [...scoreMap.entries()].map(([id, scores]) => ({
|
|
22128
|
+
id,
|
|
22129
|
+
totalScore: scores.dense + scores.bm25,
|
|
22130
|
+
hasDense: scores.dense > 0,
|
|
22131
|
+
hasBm25: scores.bm25 > 0
|
|
22132
|
+
})).sort((a, b) => b.totalScore - a.totalScore);
|
|
22133
|
+
const chunks = this.store.getChunksByIds(ranked.map((r) => r.id));
|
|
22134
|
+
const chunkMap = new Map(chunks.map((c) => [c.id, c]));
|
|
22135
|
+
const results = [];
|
|
22136
|
+
const seenSources = /* @__PURE__ */ new Set();
|
|
22137
|
+
for (const r of ranked) {
|
|
22138
|
+
if (results.length >= topK) break;
|
|
22139
|
+
const chunk = chunkMap.get(r.id);
|
|
22140
|
+
if (!chunk) continue;
|
|
22141
|
+
if (seenSources.has(chunk.source)) continue;
|
|
22142
|
+
seenSources.add(chunk.source);
|
|
22143
|
+
const normalizedScore = maxScore > 0 ? r.totalScore / maxScore : 0;
|
|
22144
|
+
const retriever = r.hasDense && r.hasBm25 ? "both" : r.hasDense ? "dense" : "bm25";
|
|
22145
|
+
let contentSource = "file";
|
|
22146
|
+
try {
|
|
22147
|
+
chunk.content = fs5.readFileSync(path8.join(this.config.wikiDir, chunk.source), "utf8");
|
|
22148
|
+
} catch {
|
|
22149
|
+
contentSource = "fallback";
|
|
22150
|
+
}
|
|
22151
|
+
results.push({ chunk, score: normalizedScore, retriever, contentSource });
|
|
22152
|
+
}
|
|
22153
|
+
return results;
|
|
22154
|
+
}
|
|
22155
|
+
async save(content) {
|
|
22156
|
+
const datePart = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
22157
|
+
const rawDir = path8.join(this.config.wikiDir, "raw");
|
|
22158
|
+
const savePath = path8.join(rawDir, `conv_save_${datePart}.md`);
|
|
22159
|
+
const lockPath = `${savePath}.lock`;
|
|
22160
|
+
fs5.mkdirSync(rawDir, { recursive: true });
|
|
22161
|
+
const acquired = await acquireLock(lockPath);
|
|
22162
|
+
if (!acquired) {
|
|
22163
|
+
console.warn("[memory-indexer] Could not acquire write lock, writing anyway (fail-open)");
|
|
22164
|
+
}
|
|
22165
|
+
try {
|
|
22166
|
+
fs5.appendFileSync(savePath, `
|
|
22167
|
+
${content}
|
|
22168
|
+
`, "utf8");
|
|
22169
|
+
} finally {
|
|
22170
|
+
if (acquired) releaseLock(lockPath);
|
|
22171
|
+
}
|
|
22172
|
+
return { indexed: 0, deleted: 0, skipped: 0 };
|
|
22173
|
+
}
|
|
22174
|
+
async startupIndex() {
|
|
22175
|
+
try {
|
|
22176
|
+
await this.indexDirectory(path8.join(this.config.wikiDir, "compiled"), {
|
|
22177
|
+
relativeBase: this.config.wikiDir,
|
|
22178
|
+
excludeFiles: ["index.md", "log.md"]
|
|
22179
|
+
});
|
|
22180
|
+
} catch (err) {
|
|
22181
|
+
console.warn("[memory-indexer] Startup indexing failed:", err);
|
|
22182
|
+
} finally {
|
|
22183
|
+
this._ready = true;
|
|
22184
|
+
}
|
|
22185
|
+
}
|
|
22186
|
+
get ready() {
|
|
22187
|
+
return this._ready;
|
|
22188
|
+
}
|
|
22189
|
+
};
|
|
22190
|
+
|
|
22191
|
+
// src/memory/store.ts
|
|
22192
|
+
import Database from "better-sqlite3";
|
|
22193
|
+
import * as fs6 from "fs";
|
|
22194
|
+
import * as path9 from "path";
|
|
22195
|
+
var StoreError = class extends Error {
|
|
22196
|
+
constructor(message, cause) {
|
|
22197
|
+
super(message);
|
|
22198
|
+
this.name = "StoreError";
|
|
22199
|
+
if (cause instanceof Error) this.cause = cause;
|
|
22200
|
+
}
|
|
22201
|
+
};
|
|
22202
|
+
var MemoryStore = class {
|
|
22203
|
+
constructor(dbPath, config2) {
|
|
22204
|
+
this.config = config2;
|
|
22205
|
+
fs6.mkdirSync(path9.dirname(dbPath), { recursive: true });
|
|
22206
|
+
this.db = this.openDatabase(dbPath);
|
|
22207
|
+
}
|
|
22208
|
+
db;
|
|
22209
|
+
_vecAvailable = false;
|
|
22210
|
+
openDatabase(dbPath) {
|
|
22211
|
+
try {
|
|
22212
|
+
const db = new Database(dbPath);
|
|
22213
|
+
db.pragma("journal_mode = WAL");
|
|
22214
|
+
db.pragma("busy_timeout = 5000");
|
|
22215
|
+
this.loadVecExtension(db);
|
|
22216
|
+
this.createSchema(db);
|
|
22217
|
+
return db;
|
|
22218
|
+
} catch (err) {
|
|
22219
|
+
console.error("[memory-store] DB open failed, recreating:", err);
|
|
22220
|
+
try {
|
|
22221
|
+
fs6.unlinkSync(dbPath);
|
|
22222
|
+
} catch {
|
|
22223
|
+
}
|
|
22224
|
+
const db = new Database(dbPath);
|
|
22225
|
+
db.pragma("journal_mode = WAL");
|
|
22226
|
+
db.pragma("busy_timeout = 5000");
|
|
22227
|
+
this.loadVecExtension(db);
|
|
22228
|
+
this.createSchema(db);
|
|
22229
|
+
return db;
|
|
22230
|
+
}
|
|
22231
|
+
}
|
|
22232
|
+
loadVecExtension(db) {
|
|
22233
|
+
try {
|
|
22234
|
+
const sqliteVec = __require("sqlite-vec");
|
|
22235
|
+
sqliteVec.load(db);
|
|
22236
|
+
this._vecAvailable = true;
|
|
22237
|
+
} catch (err) {
|
|
22238
|
+
console.warn("[memory-store] sqlite-vec unavailable, degrading to FTS5-only:", err);
|
|
22239
|
+
this._vecAvailable = false;
|
|
22240
|
+
}
|
|
22241
|
+
}
|
|
22242
|
+
createSchema(db) {
|
|
22243
|
+
db.exec(`
|
|
22244
|
+
CREATE TABLE IF NOT EXISTS memory_chunks (
|
|
22245
|
+
rowid INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
22246
|
+
id TEXT NOT NULL UNIQUE,
|
|
22247
|
+
source TEXT NOT NULL,
|
|
22248
|
+
heading TEXT NOT NULL DEFAULT '',
|
|
22249
|
+
heading_level INTEGER NOT NULL DEFAULT 0,
|
|
22250
|
+
content TEXT NOT NULL,
|
|
22251
|
+
line_start INTEGER NOT NULL,
|
|
22252
|
+
line_end INTEGER NOT NULL,
|
|
22253
|
+
indexed_at INTEGER NOT NULL
|
|
22254
|
+
);
|
|
22255
|
+
|
|
22256
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(
|
|
22257
|
+
content,
|
|
22258
|
+
content='memory_chunks',
|
|
22259
|
+
content_rowid='rowid'
|
|
22260
|
+
);
|
|
22261
|
+
|
|
22262
|
+
CREATE TRIGGER IF NOT EXISTS memory_chunks_ai
|
|
22263
|
+
AFTER INSERT ON memory_chunks BEGIN
|
|
22264
|
+
INSERT INTO memory_fts(rowid, content) VALUES (new.rowid, new.content);
|
|
22265
|
+
END;
|
|
22266
|
+
|
|
22267
|
+
CREATE TRIGGER IF NOT EXISTS memory_chunks_ad
|
|
22268
|
+
AFTER DELETE ON memory_chunks BEGIN
|
|
22269
|
+
INSERT INTO memory_fts(memory_fts, rowid, content)
|
|
22270
|
+
VALUES ('delete', old.rowid, old.content);
|
|
22271
|
+
END;
|
|
22272
|
+
`);
|
|
22273
|
+
if (this._vecAvailable) {
|
|
22274
|
+
try {
|
|
22275
|
+
db.exec(`
|
|
22276
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS memory_vec USING vec0(
|
|
22277
|
+
embedding FLOAT[${this.config.vectorDimension}]
|
|
22278
|
+
);
|
|
22279
|
+
`);
|
|
22280
|
+
} catch (err) {
|
|
22281
|
+
console.warn("[memory-store] Failed to create memory_vec, disabling vector search:", err);
|
|
22282
|
+
this._vecAvailable = false;
|
|
22283
|
+
}
|
|
22284
|
+
}
|
|
22285
|
+
}
|
|
22286
|
+
upsert(chunks, embeddings) {
|
|
22287
|
+
const insertChunk = this.db.prepare(`
|
|
22288
|
+
INSERT OR REPLACE INTO memory_chunks
|
|
22289
|
+
(id, source, heading, heading_level, content, line_start, line_end, indexed_at)
|
|
22290
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
22291
|
+
`);
|
|
22292
|
+
let insertVec = null;
|
|
22293
|
+
if (this._vecAvailable) {
|
|
22294
|
+
insertVec = this.db.prepare(`INSERT OR REPLACE INTO memory_vec (rowid, embedding) VALUES (?, ?)`);
|
|
22295
|
+
}
|
|
22296
|
+
const upsertAll = this.db.transaction(() => {
|
|
22297
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
22298
|
+
const chunk = chunks[i];
|
|
22299
|
+
try {
|
|
22300
|
+
this.db.prepare(`DELETE FROM memory_chunks WHERE id = ?`).run(chunk.id);
|
|
22301
|
+
const info = insertChunk.run(
|
|
22302
|
+
chunk.id,
|
|
22303
|
+
chunk.source,
|
|
22304
|
+
chunk.heading,
|
|
22305
|
+
chunk.headingLevel,
|
|
22306
|
+
chunk.content,
|
|
22307
|
+
chunk.lineStart,
|
|
22308
|
+
chunk.lineEnd,
|
|
22309
|
+
Date.now()
|
|
22310
|
+
);
|
|
22311
|
+
if (insertVec && embeddings[i] && info.lastInsertRowid) {
|
|
22312
|
+
const rowid = Number(info.lastInsertRowid);
|
|
22313
|
+
const emb = embeddings[i];
|
|
22314
|
+
const buf = Buffer.from(emb.buffer, emb.byteOffset, emb.byteLength);
|
|
22315
|
+
insertVec.run(rowid, buf);
|
|
22316
|
+
}
|
|
22317
|
+
} catch (err) {
|
|
22318
|
+
console.warn(`[memory-store] Failed to upsert chunk ${chunk.id}:`, err);
|
|
22319
|
+
}
|
|
22320
|
+
}
|
|
22321
|
+
});
|
|
22322
|
+
try {
|
|
22323
|
+
upsertAll();
|
|
22324
|
+
} catch (err) {
|
|
22325
|
+
throw new StoreError("Full batch upsert failed", err);
|
|
22326
|
+
}
|
|
22327
|
+
}
|
|
22328
|
+
hashesBySource(source) {
|
|
22329
|
+
const rows = this.db.prepare(`SELECT id FROM memory_chunks WHERE source = ?`).all(source);
|
|
22330
|
+
return new Set(rows.map((r) => r.id));
|
|
22331
|
+
}
|
|
22332
|
+
indexedSources() {
|
|
22333
|
+
const rows = this.db.prepare(`SELECT DISTINCT source FROM memory_chunks`).all();
|
|
22334
|
+
return rows.map((r) => r.source);
|
|
22335
|
+
}
|
|
22336
|
+
deleteBySource(source) {
|
|
22337
|
+
const rows = this.db.prepare(`SELECT rowid FROM memory_chunks WHERE source = ?`).all(source);
|
|
22338
|
+
const deleteAll = this.db.transaction(() => {
|
|
22339
|
+
if (this._vecAvailable && rows.length > 0) {
|
|
22340
|
+
const placeholders = rows.map(() => "?").join(", ");
|
|
22341
|
+
this.db.prepare(`DELETE FROM memory_vec WHERE rowid IN (${placeholders})`).run(...rows.map((r) => r.rowid));
|
|
22342
|
+
}
|
|
22343
|
+
this.db.prepare(`DELETE FROM memory_chunks WHERE source = ?`).run(source);
|
|
22344
|
+
});
|
|
22345
|
+
deleteAll();
|
|
22346
|
+
}
|
|
22347
|
+
deleteByIds(ids) {
|
|
22348
|
+
if (ids.length === 0) return;
|
|
22349
|
+
const placeholders = ids.map(() => "?").join(", ");
|
|
22350
|
+
const rows = this.db.prepare(`SELECT rowid FROM memory_chunks WHERE id IN (${placeholders})`).all(...ids);
|
|
22351
|
+
const deleteAll = this.db.transaction(() => {
|
|
22352
|
+
if (this._vecAvailable && rows.length > 0) {
|
|
22353
|
+
const rPlaceholders = rows.map(() => "?").join(", ");
|
|
22354
|
+
this.db.prepare(`DELETE FROM memory_vec WHERE rowid IN (${rPlaceholders})`).run(...rows.map((r) => r.rowid));
|
|
22355
|
+
}
|
|
22356
|
+
this.db.prepare(`DELETE FROM memory_chunks WHERE id IN (${placeholders})`).run(...ids);
|
|
22357
|
+
});
|
|
22358
|
+
deleteAll();
|
|
22359
|
+
}
|
|
22360
|
+
searchDense(embedding, limit) {
|
|
22361
|
+
if (!this._vecAvailable) return [];
|
|
22362
|
+
try {
|
|
22363
|
+
const buf = Buffer.from(embedding.buffer);
|
|
22364
|
+
const rows = this.db.prepare(
|
|
22365
|
+
`SELECT mc.id, mv.distance
|
|
22366
|
+
FROM memory_vec mv
|
|
22367
|
+
JOIN memory_chunks mc ON mc.rowid = mv.rowid
|
|
22368
|
+
WHERE mv.embedding MATCH ? AND k = ?
|
|
22369
|
+
ORDER BY mv.distance`
|
|
22370
|
+
).all(buf, limit);
|
|
22371
|
+
return rows.map((r) => ({
|
|
22372
|
+
id: r.id,
|
|
22373
|
+
score: Math.max(0, 1 - r.distance)
|
|
22374
|
+
}));
|
|
22375
|
+
} catch (err) {
|
|
22376
|
+
console.warn("[memory-store] Dense search failed:", err);
|
|
22377
|
+
return [];
|
|
22378
|
+
}
|
|
22379
|
+
}
|
|
22380
|
+
searchBm25(query, limit) {
|
|
22381
|
+
if (!query.trim()) return [];
|
|
22382
|
+
const ftsQuery = query.trim().split(/\s+/).map((t) => t.replace(/['"*^():\-]/g, " ").trim()).filter(Boolean).join(" OR ");
|
|
22383
|
+
if (!ftsQuery) return [];
|
|
22384
|
+
try {
|
|
22385
|
+
const rows = this.db.prepare(
|
|
22386
|
+
`SELECT mc.id, rank
|
|
22387
|
+
FROM memory_fts
|
|
22388
|
+
JOIN memory_chunks mc ON mc.rowid = memory_fts.rowid
|
|
22389
|
+
WHERE memory_fts MATCH ?
|
|
22390
|
+
ORDER BY rank
|
|
22391
|
+
LIMIT ?`
|
|
22392
|
+
).all(ftsQuery, limit);
|
|
22393
|
+
if (rows.length === 0) return [];
|
|
22394
|
+
const ranks = rows.map((r) => r.rank);
|
|
22395
|
+
const minRank = Math.min(...ranks);
|
|
22396
|
+
const maxRank = Math.max(...ranks);
|
|
22397
|
+
const range = maxRank - minRank;
|
|
22398
|
+
return rows.map((r) => ({
|
|
22399
|
+
id: r.id,
|
|
22400
|
+
score: range > 0 ? (maxRank - r.rank) / range : 1
|
|
22401
|
+
}));
|
|
22402
|
+
} catch (err) {
|
|
22403
|
+
console.warn("[memory-store] BM25 search failed:", err);
|
|
22404
|
+
return [];
|
|
22405
|
+
}
|
|
22406
|
+
}
|
|
22407
|
+
getChunksByIds(ids) {
|
|
22408
|
+
if (ids.length === 0) return [];
|
|
22409
|
+
const placeholders = ids.map(() => "?").join(", ");
|
|
22410
|
+
const rows = this.db.prepare(
|
|
22411
|
+
`SELECT id, source, heading, heading_level, content, line_start, line_end
|
|
22412
|
+
FROM memory_chunks WHERE id IN (${placeholders})`
|
|
22413
|
+
).all(...ids);
|
|
22414
|
+
return rows.map((r) => ({
|
|
22415
|
+
id: r.id,
|
|
22416
|
+
source: r.source,
|
|
22417
|
+
heading: r.heading,
|
|
22418
|
+
headingLevel: r.heading_level,
|
|
22419
|
+
content: r.content,
|
|
22420
|
+
lineStart: r.line_start,
|
|
22421
|
+
lineEnd: r.line_end
|
|
22422
|
+
}));
|
|
22423
|
+
}
|
|
22424
|
+
get vecAvailable() {
|
|
22425
|
+
return this._vecAvailable;
|
|
22426
|
+
}
|
|
22427
|
+
close() {
|
|
22428
|
+
this.db.close();
|
|
22429
|
+
}
|
|
22430
|
+
};
|
|
22431
|
+
|
|
22432
|
+
// src/tools/memory.ts
|
|
22433
|
+
function registerMemoryToolHandlers(server2, indexer, store, config2) {
|
|
22434
|
+
server2.tool(
|
|
22435
|
+
"kit_memory_search",
|
|
22436
|
+
"Search persistent memory for context relevant to the current question. Returns semantically relevant results using hybrid dense+BM25+RRF search.",
|
|
22437
|
+
{
|
|
22438
|
+
query: external_exports.string().min(1).describe("Search query"),
|
|
22439
|
+
top_k: external_exports.number().int().positive().optional().describe("Number of results to return")
|
|
22440
|
+
},
|
|
22441
|
+
async ({ query, top_k }) => {
|
|
22442
|
+
try {
|
|
22443
|
+
const results = await indexer.search(query, top_k ?? config2.topK);
|
|
22444
|
+
if (results.length === 0) {
|
|
22445
|
+
const degradedNote2 = !store.vecAvailable ? "\u26A0\uFE0F Vector search unavailable \u2014 showing keyword-only results.\n\n" : "";
|
|
22446
|
+
return mcpText(`${degradedNote2}No memories found for query: "${query}"`);
|
|
22447
|
+
}
|
|
22448
|
+
const degradedNote = !store.vecAvailable ? "\u26A0\uFE0F Vector search unavailable \u2014 showing keyword-only results.\n\n" : "";
|
|
22449
|
+
const formatted = results.map((r) => {
|
|
22450
|
+
const displaySource = r.chunk.source.replace(/^compiled\//, "");
|
|
22451
|
+
const content = r.contentSource === "fallback" ? `\u26A0\uFE0F Source file unavailable \u2014 showing matched chunk only:
|
|
22452
|
+
${r.chunk.content}` : r.chunk.content;
|
|
22453
|
+
return `### ${displaySource} (score: ${r.score.toFixed(3)})
|
|
22454
|
+
${content}`;
|
|
22455
|
+
}).join("\n\n---\n\n");
|
|
22456
|
+
return mcpText(`${degradedNote}${formatted}`);
|
|
22457
|
+
} catch (err) {
|
|
22458
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
22459
|
+
return mcpText(`kit_memory_search failed: ${message}`);
|
|
22460
|
+
}
|
|
22461
|
+
}
|
|
22462
|
+
);
|
|
22463
|
+
server2.tool(
|
|
22464
|
+
"kit_memory_save",
|
|
22465
|
+
"Save content to wiki/raw for inclusion after the next /wiki compile.",
|
|
22466
|
+
{
|
|
22467
|
+
content: external_exports.string().min(1).describe("Content to save to memory")
|
|
22468
|
+
},
|
|
22469
|
+
async ({ content }) => {
|
|
22470
|
+
try {
|
|
22471
|
+
await indexer.save(content);
|
|
22472
|
+
return mcpJson({
|
|
22473
|
+
saved: true,
|
|
22474
|
+
queued_for_compile: true,
|
|
22475
|
+
message: "Saved to wiki/raw \u2014 will be indexed after next /wiki compile"
|
|
22476
|
+
});
|
|
22477
|
+
} catch (err) {
|
|
22478
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
22479
|
+
return mcpJson({ saved: false, error: message });
|
|
22480
|
+
}
|
|
22481
|
+
}
|
|
22482
|
+
);
|
|
22483
|
+
}
|
|
22484
|
+
function registerMemoryTools(server2, settings2, workspaceRoot2) {
|
|
22485
|
+
if (settings2.memory?.enabled !== true) return null;
|
|
22486
|
+
const config2 = resolveMemoryConfig(settings2, workspaceRoot2);
|
|
22487
|
+
const store = new MemoryStore(path10.join(config2.wikiDir, "index.db"), config2);
|
|
22488
|
+
const embedder = new Embedder(config2.embeddingModel);
|
|
22489
|
+
const indexer = new MemoryIndexer(store, embedder, config2);
|
|
22490
|
+
registerMemoryToolHandlers(server2, indexer, store, config2);
|
|
22491
|
+
return indexer;
|
|
22492
|
+
}
|
|
22493
|
+
|
|
21745
22494
|
// src/kit-server.ts
|
|
21746
22495
|
var server = new McpServer({
|
|
21747
22496
|
name: "kit-agents",
|
|
@@ -21750,5 +22499,11 @@ var server = new McpServer({
|
|
|
21750
22499
|
registerIntegrationTools(server);
|
|
21751
22500
|
registerCoreTools(server);
|
|
21752
22501
|
registerAgentTools(server);
|
|
22502
|
+
var workspaceRoot = getWorkspaceRoot();
|
|
22503
|
+
var settings = loadProjectSettings(workspaceRoot);
|
|
22504
|
+
var memoryIndexer = registerMemoryTools(server, settings, workspaceRoot);
|
|
21753
22505
|
var transport = new StdioServerTransport();
|
|
21754
22506
|
await server.connect(transport);
|
|
22507
|
+
if (memoryIndexer) {
|
|
22508
|
+
void memoryIndexer.startupIndex();
|
|
22509
|
+
}
|