@hasna/knowledge 0.2.3 → 0.2.4

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.
@@ -88,8 +88,8 @@ async function startMcpHttpServer(buildServer, options = {}) {
88
88
  transport.close();
89
89
  server.close();
90
90
  });
91
- } catch (error51) {
92
- console.error(`[${serviceName}-mcp] HTTP error:`, error51);
91
+ } catch (error48) {
92
+ console.error(`[${serviceName}-mcp] HTTP error:`, error48);
93
93
  if (!res.headersSent) {
94
94
  res.writeHead(500, { "Content-Type": "application/json" });
95
95
  res.end(JSON.stringify({
@@ -100,9 +100,9 @@ async function startMcpHttpServer(buildServer, options = {}) {
100
100
  }
101
101
  }
102
102
  });
103
- await new Promise((resolve, reject) => {
103
+ await new Promise((resolve2, reject) => {
104
104
  httpServer.once("error", reject);
105
- httpServer.listen(requestedPort, host, () => resolve());
105
+ httpServer.listen(requestedPort, host, () => resolve2());
106
106
  });
107
107
  const addr = httpServer.address();
108
108
  const port = typeof addr === "object" && addr ? addr.port : requestedPort;
@@ -110,8 +110,8 @@ async function startMcpHttpServer(buildServer, options = {}) {
110
110
  return {
111
111
  port,
112
112
  host,
113
- close: () => new Promise((resolve, reject) => {
114
- httpServer.close((err) => err ? reject(err) : resolve());
113
+ close: () => new Promise((resolve2, reject) => {
114
+ httpServer.close((err) => err ? reject(err) : resolve2());
115
115
  })
116
116
  };
117
117
  }
@@ -224,7 +224,6 @@ __export(exports_external, {
224
224
  iso: () => exports_iso,
225
225
  ipv6: () => ipv62,
226
226
  ipv4: () => ipv42,
227
- invertCodec: () => invertCodec,
228
227
  intersection: () => intersection,
229
228
  int64: () => int64,
230
229
  int32: () => int32,
@@ -303,7 +302,6 @@ __export(exports_external, {
303
302
  ZodRealError: () => ZodRealError,
304
303
  ZodReadonly: () => ZodReadonly,
305
304
  ZodPromise: () => ZodPromise,
306
- ZodPreprocess: () => ZodPreprocess,
307
305
  ZodPrefault: () => ZodPrefault,
308
306
  ZodPipe: () => ZodPipe,
309
307
  ZodOptional: () => ZodOptional,
@@ -564,7 +562,6 @@ __export(exports_core2, {
564
562
  $ZodRealError: () => $ZodRealError,
565
563
  $ZodReadonly: () => $ZodReadonly,
566
564
  $ZodPromise: () => $ZodPromise,
567
- $ZodPreprocess: () => $ZodPreprocess,
568
565
  $ZodPrefault: () => $ZodPrefault,
569
566
  $ZodPipe: () => $ZodPipe,
570
567
  $ZodOptional: () => $ZodOptional,
@@ -645,8 +642,7 @@ __export(exports_core2, {
645
642
  });
646
643
 
647
644
  // node_modules/zod/v4/core/core.js
648
- var _a;
649
- var NEVER = /* @__PURE__ */ Object.freeze({
645
+ var NEVER = Object.freeze({
650
646
  status: "aborted"
651
647
  });
652
648
  function $constructor(name, initializer, params) {
@@ -681,10 +677,10 @@ function $constructor(name, initializer, params) {
681
677
  }
682
678
  Object.defineProperty(Definition, "name", { value: name });
683
679
  function _(def) {
684
- var _a2;
680
+ var _a;
685
681
  const inst = params?.Parent ? new Definition : this;
686
682
  init(inst, def);
687
- (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
683
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
688
684
  for (const fn of inst._zod.deferred) {
689
685
  fn();
690
686
  }
@@ -715,8 +711,7 @@ class $ZodEncodeError extends Error {
715
711
  this.name = "ZodEncodeError";
716
712
  }
717
713
  }
718
- (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
719
- var globalConfig = globalThis.__zod_globalConfig;
714
+ var globalConfig = {};
720
715
  function config(newConfig) {
721
716
  if (newConfig)
722
717
  Object.assign(globalConfig, newConfig);
@@ -764,7 +759,6 @@ __export(exports_util, {
764
759
  floatSafeRemainder: () => floatSafeRemainder,
765
760
  finalizeIssue: () => finalizeIssue,
766
761
  extend: () => extend,
767
- explicitlyAborted: () => explicitlyAborted,
768
762
  escapeRegex: () => escapeRegex,
769
763
  esc: () => esc,
770
764
  defineLazy: () => defineLazy,
@@ -835,14 +829,21 @@ function cleanRegex(source) {
835
829
  return source.slice(start, end);
836
830
  }
837
831
  function floatSafeRemainder(val, step) {
838
- const ratio = val / step;
839
- const roundedRatio = Math.round(ratio);
840
- const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
841
- if (Math.abs(ratio - roundedRatio) < tolerance)
842
- return 0;
843
- return ratio - roundedRatio;
844
- }
845
- var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
832
+ const valDecCount = (val.toString().split(".")[1] || "").length;
833
+ const stepString = step.toString();
834
+ let stepDecCount = (stepString.split(".")[1] || "").length;
835
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
836
+ const match = stepString.match(/\d?e-(\d?)/);
837
+ if (match?.[1]) {
838
+ stepDecCount = Number.parseInt(match[1]);
839
+ }
840
+ }
841
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
842
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
843
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
844
+ return valInt % stepInt / 10 ** decCount;
845
+ }
846
+ var EVALUATING = Symbol("evaluating");
846
847
  function defineLazy(object, key, getter) {
847
848
  let value = undefined;
848
849
  Object.defineProperty(object, key, {
@@ -920,10 +921,7 @@ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace :
920
921
  function isObject(data) {
921
922
  return typeof data === "object" && data !== null && !Array.isArray(data);
922
923
  }
923
- var allowsEval = /* @__PURE__ */ cached(() => {
924
- if (globalConfig.jitless) {
925
- return false;
926
- }
924
+ var allowsEval = cached(() => {
927
925
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
928
926
  return false;
929
927
  }
@@ -956,10 +954,6 @@ function shallowClone(o) {
956
954
  return { ...o };
957
955
  if (Array.isArray(o))
958
956
  return [...o];
959
- if (o instanceof Map)
960
- return new Map(o);
961
- if (o instanceof Set)
962
- return new Set(o);
963
957
  return o;
964
958
  }
965
959
  function numKeys(data) {
@@ -1015,15 +1009,8 @@ var getParsedType = (data) => {
1015
1009
  throw new Error(`Unknown data type: ${t}`);
1016
1010
  }
1017
1011
  };
1018
- var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
1019
- var primitiveTypes = /* @__PURE__ */ new Set([
1020
- "string",
1021
- "number",
1022
- "bigint",
1023
- "boolean",
1024
- "symbol",
1025
- "undefined"
1026
- ]);
1012
+ var propertyKeyTypes = new Set(["string", "number", "symbol"]);
1013
+ var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
1027
1014
  function escapeRegex(str) {
1028
1015
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1029
1016
  }
@@ -1192,9 +1179,6 @@ function safeExtend(schema, shape) {
1192
1179
  return clone(schema, def);
1193
1180
  }
1194
1181
  function merge(a, b) {
1195
- if (a._zod.def.checks?.length) {
1196
- throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
1197
- }
1198
1182
  const def = mergeDefs(a._zod.def, {
1199
1183
  get shape() {
1200
1184
  const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
@@ -1204,7 +1188,7 @@ function merge(a, b) {
1204
1188
  get catchall() {
1205
1189
  return b._zod.def.catchall;
1206
1190
  },
1207
- checks: b._zod.def.checks ?? []
1191
+ checks: []
1208
1192
  });
1209
1193
  return clone(a, def);
1210
1194
  }
@@ -1287,20 +1271,10 @@ function aborted(x, startIndex = 0) {
1287
1271
  }
1288
1272
  return false;
1289
1273
  }
1290
- function explicitlyAborted(x, startIndex = 0) {
1291
- if (x.aborted === true)
1292
- return true;
1293
- for (let i = startIndex;i < x.issues.length; i++) {
1294
- if (x.issues[i]?.continue === false) {
1295
- return true;
1296
- }
1297
- }
1298
- return false;
1299
- }
1300
1274
  function prefixIssues(path, issues) {
1301
1275
  return issues.map((iss) => {
1302
- var _a2;
1303
- (_a2 = iss).path ?? (_a2.path = []);
1276
+ var _a;
1277
+ (_a = iss).path ?? (_a.path = []);
1304
1278
  iss.path.unshift(path);
1305
1279
  return iss;
1306
1280
  });
@@ -1309,14 +1283,17 @@ function unwrapMessage(message) {
1309
1283
  return typeof message === "string" ? message : message?.message;
1310
1284
  }
1311
1285
  function finalizeIssue(iss, ctx, config2) {
1312
- const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
1313
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
1314
- rest.path ?? (rest.path = []);
1315
- rest.message = message;
1316
- if (ctx?.reportInput) {
1317
- rest.input = _input;
1286
+ const full = { ...iss, path: iss.path ?? [] };
1287
+ if (!iss.message) {
1288
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
1289
+ full.message = message;
1290
+ }
1291
+ delete full.inst;
1292
+ delete full.continue;
1293
+ if (!ctx?.reportInput) {
1294
+ delete full.input;
1318
1295
  }
1319
- return rest;
1296
+ return full;
1320
1297
  }
1321
1298
  function getSizableOrigin(input) {
1322
1299
  if (input instanceof Set)
@@ -1448,33 +1425,30 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
1448
1425
  }
1449
1426
  function formatError(error, mapper = (issue2) => issue2.message) {
1450
1427
  const fieldErrors = { _errors: [] };
1451
- const processError = (error2, path = []) => {
1428
+ const processError = (error2) => {
1452
1429
  for (const issue2 of error2.issues) {
1453
1430
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1454
- issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
1431
+ issue2.errors.map((issues) => processError({ issues }));
1455
1432
  } else if (issue2.code === "invalid_key") {
1456
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
1433
+ processError({ issues: issue2.issues });
1457
1434
  } else if (issue2.code === "invalid_element") {
1458
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
1435
+ processError({ issues: issue2.issues });
1436
+ } else if (issue2.path.length === 0) {
1437
+ fieldErrors._errors.push(mapper(issue2));
1459
1438
  } else {
1460
- const fullpath = [...path, ...issue2.path];
1461
- if (fullpath.length === 0) {
1462
- fieldErrors._errors.push(mapper(issue2));
1463
- } else {
1464
- let curr = fieldErrors;
1465
- let i = 0;
1466
- while (i < fullpath.length) {
1467
- const el = fullpath[i];
1468
- const terminal = i === fullpath.length - 1;
1469
- if (!terminal) {
1470
- curr[el] = curr[el] || { _errors: [] };
1471
- } else {
1472
- curr[el] = curr[el] || { _errors: [] };
1473
- curr[el]._errors.push(mapper(issue2));
1474
- }
1475
- curr = curr[el];
1476
- i++;
1439
+ let curr = fieldErrors;
1440
+ let i = 0;
1441
+ while (i < issue2.path.length) {
1442
+ const el = issue2.path[i];
1443
+ const terminal = i === issue2.path.length - 1;
1444
+ if (!terminal) {
1445
+ curr[el] = curr[el] || { _errors: [] };
1446
+ } else {
1447
+ curr[el] = curr[el] || { _errors: [] };
1448
+ curr[el]._errors.push(mapper(issue2));
1477
1449
  }
1450
+ curr = curr[el];
1451
+ i++;
1478
1452
  }
1479
1453
  }
1480
1454
  }
@@ -1485,14 +1459,14 @@ function formatError(error, mapper = (issue2) => issue2.message) {
1485
1459
  function treeifyError(error, mapper = (issue2) => issue2.message) {
1486
1460
  const result = { errors: [] };
1487
1461
  const processError = (error2, path = []) => {
1488
- var _a2, _b;
1462
+ var _a, _b;
1489
1463
  for (const issue2 of error2.issues) {
1490
1464
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1491
- issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
1465
+ issue2.errors.map((issues) => processError({ issues }, issue2.path));
1492
1466
  } else if (issue2.code === "invalid_key") {
1493
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
1467
+ processError({ issues: issue2.issues }, issue2.path);
1494
1468
  } else if (issue2.code === "invalid_element") {
1495
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
1469
+ processError({ issues: issue2.issues }, issue2.path);
1496
1470
  } else {
1497
1471
  const fullpath = [...path, ...issue2.path];
1498
1472
  if (fullpath.length === 0) {
@@ -1506,7 +1480,7 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
1506
1480
  const terminal = i === fullpath.length - 1;
1507
1481
  if (typeof el === "string") {
1508
1482
  curr.properties ?? (curr.properties = {});
1509
- (_a2 = curr.properties)[el] ?? (_a2[el] = { errors: [] });
1483
+ (_a = curr.properties)[el] ?? (_a[el] = { errors: [] });
1510
1484
  curr = curr.properties[el];
1511
1485
  } else {
1512
1486
  curr.items ?? (curr.items = []);
@@ -1556,7 +1530,7 @@ function prettifyError(error) {
1556
1530
 
1557
1531
  // node_modules/zod/v4/core/parse.js
1558
1532
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
1559
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
1533
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
1560
1534
  const result = schema._zod.run({ value, issues: [] }, ctx);
1561
1535
  if (result instanceof Promise) {
1562
1536
  throw new $ZodAsyncError;
@@ -1570,7 +1544,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
1570
1544
  };
1571
1545
  var parse = /* @__PURE__ */ _parse($ZodRealError);
1572
1546
  var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
1573
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
1547
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
1574
1548
  let result = schema._zod.run({ value, issues: [] }, ctx);
1575
1549
  if (result instanceof Promise)
1576
1550
  result = await result;
@@ -1595,7 +1569,7 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
1595
1569
  };
1596
1570
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
1597
1571
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
1598
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
1572
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
1599
1573
  let result = schema._zod.run({ value, issues: [] }, ctx);
1600
1574
  if (result instanceof Promise)
1601
1575
  result = await result;
@@ -1606,7 +1580,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
1606
1580
  };
1607
1581
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
1608
1582
  var _encode = (_Err) => (schema, value, _ctx) => {
1609
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
1583
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
1610
1584
  return _parse(_Err)(schema, value, ctx);
1611
1585
  };
1612
1586
  var encode = /* @__PURE__ */ _encode($ZodRealError);
@@ -1615,7 +1589,7 @@ var _decode = (_Err) => (schema, value, _ctx) => {
1615
1589
  };
1616
1590
  var decode = /* @__PURE__ */ _decode($ZodRealError);
1617
1591
  var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
1618
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
1592
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
1619
1593
  return _parseAsync(_Err)(schema, value, ctx);
1620
1594
  };
1621
1595
  var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
@@ -1624,7 +1598,7 @@ var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
1624
1598
  };
1625
1599
  var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
1626
1600
  var _safeEncode = (_Err) => (schema, value, _ctx) => {
1627
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
1601
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
1628
1602
  return _safeParse(_Err)(schema, value, ctx);
1629
1603
  };
1630
1604
  var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
@@ -1633,7 +1607,7 @@ var _safeDecode = (_Err) => (schema, value, _ctx) => {
1633
1607
  };
1634
1608
  var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
1635
1609
  var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
1636
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
1610
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
1637
1611
  return _safeParseAsync(_Err)(schema, value, ctx);
1638
1612
  };
1639
1613
  var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
@@ -1681,7 +1655,6 @@ __export(exports_regexes, {
1681
1655
  ipv4: () => ipv4,
1682
1656
  integer: () => integer,
1683
1657
  idnEmail: () => idnEmail,
1684
- httpProtocol: () => httpProtocol,
1685
1658
  html5Email: () => html5Email,
1686
1659
  hostname: () => hostname,
1687
1660
  hex: () => hex,
@@ -1704,7 +1677,7 @@ __export(exports_regexes, {
1704
1677
  base64url: () => base64url,
1705
1678
  base64: () => base64
1706
1679
  });
1707
- var cuid = /^[cC][0-9a-z]{6,}$/;
1680
+ var cuid = /^[cC][^\s-]{8,}$/;
1708
1681
  var cuid2 = /^[0-9a-z]+$/;
1709
1682
  var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1710
1683
  var xid = /^[0-9a-vA-V]{20}$/;
@@ -1743,7 +1716,6 @@ var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/
1743
1716
  var base64url = /^[A-Za-z0-9_-]*$/;
1744
1717
  var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
1745
1718
  var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
1746
- var httpProtocol = /^https?$/;
1747
1719
  var e164 = /^\+[1-9]\d{6,14}$/;
1748
1720
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
1749
1721
  var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
@@ -1802,10 +1774,10 @@ var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
1802
1774
 
1803
1775
  // node_modules/zod/v4/core/checks.js
1804
1776
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
1805
- var _a2;
1777
+ var _a;
1806
1778
  inst._zod ?? (inst._zod = {});
1807
1779
  inst._zod.def = def;
1808
- (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
1780
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
1809
1781
  });
1810
1782
  var numericOriginMap = {
1811
1783
  number: "number",
@@ -1871,8 +1843,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
1871
1843
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1872
1844
  $ZodCheck.init(inst, def);
1873
1845
  inst._zod.onattach.push((inst2) => {
1874
- var _a2;
1875
- (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
1846
+ var _a;
1847
+ (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
1876
1848
  });
1877
1849
  inst._zod.check = (payload) => {
1878
1850
  if (typeof payload.value !== typeof def.value)
@@ -2005,9 +1977,9 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2005
1977
  };
2006
1978
  });
2007
1979
  var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
2008
- var _a2;
1980
+ var _a;
2009
1981
  $ZodCheck.init(inst, def);
2010
- (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1982
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
2011
1983
  const val = payload.value;
2012
1984
  return !nullish(val) && val.size !== undefined;
2013
1985
  });
@@ -2033,9 +2005,9 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2033
2005
  };
2034
2006
  });
2035
2007
  var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
2036
- var _a2;
2008
+ var _a;
2037
2009
  $ZodCheck.init(inst, def);
2038
- (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
2010
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
2039
2011
  const val = payload.value;
2040
2012
  return !nullish(val) && val.size !== undefined;
2041
2013
  });
@@ -2061,9 +2033,9 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2061
2033
  };
2062
2034
  });
2063
2035
  var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
2064
- var _a2;
2036
+ var _a;
2065
2037
  $ZodCheck.init(inst, def);
2066
- (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
2038
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
2067
2039
  const val = payload.value;
2068
2040
  return !nullish(val) && val.size !== undefined;
2069
2041
  });
@@ -2091,9 +2063,9 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2091
2063
  };
2092
2064
  });
2093
2065
  var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
2094
- var _a2;
2066
+ var _a;
2095
2067
  $ZodCheck.init(inst, def);
2096
- (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
2068
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
2097
2069
  const val = payload.value;
2098
2070
  return !nullish(val) && val.length !== undefined;
2099
2071
  });
@@ -2120,9 +2092,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2120
2092
  };
2121
2093
  });
2122
2094
  var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
2123
- var _a2;
2095
+ var _a;
2124
2096
  $ZodCheck.init(inst, def);
2125
- (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
2097
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
2126
2098
  const val = payload.value;
2127
2099
  return !nullish(val) && val.length !== undefined;
2128
2100
  });
@@ -2149,9 +2121,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2149
2121
  };
2150
2122
  });
2151
2123
  var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
2152
- var _a2;
2124
+ var _a;
2153
2125
  $ZodCheck.init(inst, def);
2154
- (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
2126
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
2155
2127
  const val = payload.value;
2156
2128
  return !nullish(val) && val.length !== undefined;
2157
2129
  });
@@ -2180,7 +2152,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2180
2152
  };
2181
2153
  });
2182
2154
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
2183
- var _a2, _b;
2155
+ var _a, _b;
2184
2156
  $ZodCheck.init(inst, def);
2185
2157
  inst._zod.onattach.push((inst2) => {
2186
2158
  const bag = inst2._zod.bag;
@@ -2191,7 +2163,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
2191
2163
  }
2192
2164
  });
2193
2165
  if (def.pattern)
2194
- (_a2 = inst._zod).check ?? (_a2.check = (payload) => {
2166
+ (_a = inst._zod).check ?? (_a.check = (payload) => {
2195
2167
  def.pattern.lastIndex = 0;
2196
2168
  if (def.pattern.test(payload.value))
2197
2169
  return;
@@ -2388,13 +2360,13 @@ class Doc {
2388
2360
  // node_modules/zod/v4/core/versions.js
2389
2361
  var version = {
2390
2362
  major: 4,
2391
- minor: 4,
2392
- patch: 3
2363
+ minor: 3,
2364
+ patch: 6
2393
2365
  };
2394
2366
 
2395
2367
  // node_modules/zod/v4/core/schemas.js
2396
2368
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2397
- var _a2;
2369
+ var _a;
2398
2370
  inst ?? (inst = {});
2399
2371
  inst._zod.def = def;
2400
2372
  inst._zod.bag = inst._zod.bag || {};
@@ -2409,7 +2381,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2409
2381
  }
2410
2382
  }
2411
2383
  if (checks.length === 0) {
2412
- (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
2384
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2413
2385
  inst._zod.deferred?.push(() => {
2414
2386
  inst._zod.run = inst._zod.parse;
2415
2387
  });
@@ -2419,8 +2391,6 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2419
2391
  let asyncResult;
2420
2392
  for (const ch of checks2) {
2421
2393
  if (ch._zod.def.when) {
2422
- if (explicitlyAborted(payload))
2423
- continue;
2424
2394
  const shouldRun = ch._zod.def.when(payload);
2425
2395
  if (!shouldRun)
2426
2396
  continue;
@@ -2560,19 +2530,6 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
2560
2530
  inst._zod.check = (payload) => {
2561
2531
  try {
2562
2532
  const trimmed = payload.value.trim();
2563
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
2564
- if (!/^https?:\/\//i.test(trimmed)) {
2565
- payload.issues.push({
2566
- code: "invalid_format",
2567
- format: "url",
2568
- note: "Invalid URL format",
2569
- input: payload.value,
2570
- inst,
2571
- continue: !def.abort
2572
- });
2573
- return;
2574
- }
2575
- }
2576
2533
  const url = new URL(trimmed);
2577
2534
  if (def.hostname) {
2578
2535
  def.hostname.lastIndex = 0;
@@ -2726,8 +2683,6 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
2726
2683
  function isValidBase64(data) {
2727
2684
  if (data === "")
2728
2685
  return true;
2729
- if (/\s/.test(data))
2730
- return false;
2731
2686
  if (data.length % 4 !== 0)
2732
2687
  return false;
2733
2688
  try {
@@ -2917,6 +2872,8 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
2917
2872
  $ZodType.init(inst, def);
2918
2873
  inst._zod.pattern = _undefined;
2919
2874
  inst._zod.values = new Set([undefined]);
2875
+ inst._zod.optin = "optional";
2876
+ inst._zod.optout = "optional";
2920
2877
  inst._zod.parse = (payload, _ctx) => {
2921
2878
  const input = payload.value;
2922
2879
  if (typeof input === "undefined")
@@ -3044,27 +3001,15 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3044
3001
  return payload;
3045
3002
  };
3046
3003
  });
3047
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
3048
- const isPresent = key in input;
3004
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
3049
3005
  if (result.issues.length) {
3050
- if (isOptionalIn && isOptionalOut && !isPresent) {
3006
+ if (isOptionalOut && !(key in input)) {
3051
3007
  return;
3052
3008
  }
3053
3009
  final.issues.push(...prefixIssues(key, result.issues));
3054
3010
  }
3055
- if (!isPresent && !isOptionalIn) {
3056
- if (!result.issues.length) {
3057
- final.issues.push({
3058
- code: "invalid_type",
3059
- expected: "nonoptional",
3060
- input: undefined,
3061
- path: [key]
3062
- });
3063
- }
3064
- return;
3065
- }
3066
3011
  if (result.value === undefined) {
3067
- if (isPresent) {
3012
+ if (key in input) {
3068
3013
  final.value[key] = undefined;
3069
3014
  }
3070
3015
  } else {
@@ -3092,11 +3037,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
3092
3037
  const keySet = def.keySet;
3093
3038
  const _catchall = def.catchall._zod;
3094
3039
  const t = _catchall.def.type;
3095
- const isOptionalIn = _catchall.optin === "optional";
3096
3040
  const isOptionalOut = _catchall.optout === "optional";
3097
3041
  for (const key in input) {
3098
- if (key === "__proto__")
3099
- continue;
3100
3042
  if (keySet.has(key))
3101
3043
  continue;
3102
3044
  if (t === "never") {
@@ -3105,9 +3047,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
3105
3047
  }
3106
3048
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
3107
3049
  if (r instanceof Promise) {
3108
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3050
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
3109
3051
  } else {
3110
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3052
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
3111
3053
  }
3112
3054
  }
3113
3055
  if (unrecognized.length) {
@@ -3173,13 +3115,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3173
3115
  const shape = value.shape;
3174
3116
  for (const key of value.keys) {
3175
3117
  const el = shape[key];
3176
- const isOptionalIn = el._zod.optin === "optional";
3177
3118
  const isOptionalOut = el._zod.optout === "optional";
3178
3119
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
3179
3120
  if (r instanceof Promise) {
3180
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3121
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
3181
3122
  } else {
3182
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3123
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
3183
3124
  }
3184
3125
  }
3185
3126
  if (!catchall) {
@@ -3210,10 +3151,9 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3210
3151
  const id = ids[key];
3211
3152
  const k = esc(key);
3212
3153
  const schema = shape[key];
3213
- const isOptionalIn = schema?._zod?.optin === "optional";
3214
3154
  const isOptionalOut = schema?._zod?.optout === "optional";
3215
3155
  doc.write(`const ${id} = ${parseStr(key)};`);
3216
- if (isOptionalIn && isOptionalOut) {
3156
+ if (isOptionalOut) {
3217
3157
  doc.write(`
3218
3158
  if (${id}.issues.length) {
3219
3159
  if (${k} in input) {
@@ -3232,33 +3172,6 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3232
3172
  newResult[${k}] = ${id}.value;
3233
3173
  }
3234
3174
 
3235
- `);
3236
- } else if (!isOptionalIn) {
3237
- doc.write(`
3238
- const ${id}_present = ${k} in input;
3239
- if (${id}.issues.length) {
3240
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3241
- ...iss,
3242
- path: iss.path ? [${k}, ...iss.path] : [${k}]
3243
- })));
3244
- }
3245
- if (!${id}_present && !${id}.issues.length) {
3246
- payload.issues.push({
3247
- code: "invalid_type",
3248
- expected: "nonoptional",
3249
- input: undefined,
3250
- path: [${k}]
3251
- });
3252
- }
3253
-
3254
- if (${id}_present) {
3255
- if (${id}.value === undefined) {
3256
- newResult[${k}] = undefined;
3257
- } else {
3258
- newResult[${k}] = ${id}.value;
3259
- }
3260
- }
3261
-
3262
3175
  `);
3263
3176
  } else {
3264
3177
  doc.write(`
@@ -3352,9 +3265,10 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
3352
3265
  }
3353
3266
  return;
3354
3267
  });
3355
- const first = def.options.length === 1 ? def.options[0]._zod.run : null;
3268
+ const single = def.options.length === 1;
3269
+ const first = def.options[0]._zod.run;
3356
3270
  inst._zod.parse = (payload, ctx) => {
3357
- if (first) {
3271
+ if (single) {
3358
3272
  return first(payload, ctx);
3359
3273
  }
3360
3274
  let async = false;
@@ -3407,9 +3321,10 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
3407
3321
  var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => {
3408
3322
  $ZodUnion.init(inst, def);
3409
3323
  def.inclusive = false;
3410
- const first = def.options.length === 1 ? def.options[0]._zod.run : null;
3324
+ const single = def.options.length === 1;
3325
+ const first = def.options[0]._zod.run;
3411
3326
  inst._zod.parse = (payload, ctx) => {
3412
- if (first) {
3327
+ if (single) {
3413
3328
  return first(payload, ctx);
3414
3329
  }
3415
3330
  let async = false;
@@ -3484,7 +3399,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3484
3399
  if (opt) {
3485
3400
  return opt._zod.run(payload, ctx);
3486
3401
  }
3487
- if (def.unionFallback || ctx.direction === "backward") {
3402
+ if (def.unionFallback) {
3488
3403
  return _super(payload, ctx);
3489
3404
  }
3490
3405
  payload.issues.push({
@@ -3492,7 +3407,6 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3492
3407
  errors: [],
3493
3408
  note: "No matching discriminator",
3494
3409
  discriminator: def.discriminator,
3495
- options: Array.from(disc.value.keys()),
3496
3410
  input,
3497
3411
  path: [def.discriminator],
3498
3412
  inst
@@ -3614,96 +3528,64 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3614
3528
  }
3615
3529
  payload.value = [];
3616
3530
  const proms = [];
3617
- const optinStart = getTupleOptStart(items, "optin");
3618
- const optoutStart = getTupleOptStart(items, "optout");
3531
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
3532
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
3619
3533
  if (!def.rest) {
3620
- if (input.length < optinStart) {
3534
+ const tooBig = input.length > items.length;
3535
+ const tooSmall = input.length < optStart - 1;
3536
+ if (tooBig || tooSmall) {
3621
3537
  payload.issues.push({
3622
- code: "too_small",
3623
- minimum: optinStart,
3624
- inclusive: true,
3538
+ ...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
3625
3539
  input,
3626
3540
  inst,
3627
3541
  origin: "array"
3628
3542
  });
3629
3543
  return payload;
3630
3544
  }
3631
- if (input.length > items.length) {
3632
- payload.issues.push({
3633
- code: "too_big",
3634
- maximum: items.length,
3635
- inclusive: true,
3636
- input,
3637
- inst,
3638
- origin: "array"
3639
- });
3640
- }
3641
3545
  }
3642
- const itemResults = new Array(items.length);
3643
- for (let i = 0;i < items.length; i++) {
3644
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
3645
- if (r instanceof Promise) {
3646
- proms.push(r.then((rr) => {
3647
- itemResults[i] = rr;
3648
- }));
3546
+ let i = -1;
3547
+ for (const item of items) {
3548
+ i++;
3549
+ if (i >= input.length) {
3550
+ if (i >= optStart)
3551
+ continue;
3552
+ }
3553
+ const result = item._zod.run({
3554
+ value: input[i],
3555
+ issues: []
3556
+ }, ctx);
3557
+ if (result instanceof Promise) {
3558
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
3649
3559
  } else {
3650
- itemResults[i] = r;
3560
+ handleTupleResult(result, payload, i);
3651
3561
  }
3652
3562
  }
3653
3563
  if (def.rest) {
3654
- let i = items.length - 1;
3655
3564
  const rest = input.slice(items.length);
3656
3565
  for (const el of rest) {
3657
3566
  i++;
3658
- const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
3567
+ const result = def.rest._zod.run({
3568
+ value: el,
3569
+ issues: []
3570
+ }, ctx);
3659
3571
  if (result instanceof Promise) {
3660
- proms.push(result.then((r) => handleTupleResult(r, payload, i)));
3572
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
3661
3573
  } else {
3662
3574
  handleTupleResult(result, payload, i);
3663
3575
  }
3664
3576
  }
3665
3577
  }
3666
- if (proms.length) {
3667
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
3668
- }
3669
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
3578
+ if (proms.length)
3579
+ return Promise.all(proms).then(() => payload);
3580
+ return payload;
3670
3581
  };
3671
3582
  });
3672
- function getTupleOptStart(items, key) {
3673
- for (let i = items.length - 1;i >= 0; i--) {
3674
- if (items[i]._zod[key] !== "optional")
3675
- return i + 1;
3676
- }
3677
- return 0;
3678
- }
3679
3583
  function handleTupleResult(result, final, index) {
3680
3584
  if (result.issues.length) {
3681
3585
  final.issues.push(...prefixIssues(index, result.issues));
3682
3586
  }
3683
3587
  final.value[index] = result.value;
3684
3588
  }
3685
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
3686
- for (let i = 0;i < items.length; i++) {
3687
- const r = itemResults[i];
3688
- const isPresent = i < input.length;
3689
- if (r.issues.length) {
3690
- if (!isPresent && i >= optoutStart) {
3691
- final.value.length = i;
3692
- break;
3693
- }
3694
- final.issues.push(...prefixIssues(i, r.issues));
3695
- }
3696
- final.value[i] = r.value;
3697
- }
3698
- for (let i = final.value.length - 1;i >= input.length; i--) {
3699
- if (items[i]._zod.optout === "optional" && final.value[i] === undefined) {
3700
- final.value.length = i;
3701
- } else {
3702
- break;
3703
- }
3704
- }
3705
- return final;
3706
- }
3707
3589
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3708
3590
  $ZodType.init(inst, def);
3709
3591
  inst._zod.parse = (payload, ctx) => {
@@ -3725,35 +3607,19 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3725
3607
  for (const key of values) {
3726
3608
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
3727
3609
  recordKeys.add(typeof key === "number" ? key.toString() : key);
3728
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
3729
- if (keyResult instanceof Promise) {
3730
- throw new Error("Async schemas not supported in object keys currently");
3731
- }
3732
- if (keyResult.issues.length) {
3733
- payload.issues.push({
3734
- code: "invalid_key",
3735
- origin: "record",
3736
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
3737
- input: key,
3738
- path: [key],
3739
- inst
3740
- });
3741
- continue;
3742
- }
3743
- const outKey = keyResult.value;
3744
3610
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
3745
3611
  if (result instanceof Promise) {
3746
3612
  proms.push(result.then((result2) => {
3747
3613
  if (result2.issues.length) {
3748
3614
  payload.issues.push(...prefixIssues(key, result2.issues));
3749
3615
  }
3750
- payload.value[outKey] = result2.value;
3616
+ payload.value[key] = result2.value;
3751
3617
  }));
3752
3618
  } else {
3753
3619
  if (result.issues.length) {
3754
3620
  payload.issues.push(...prefixIssues(key, result.issues));
3755
3621
  }
3756
- payload.value[outKey] = result.value;
3622
+ payload.value[key] = result.value;
3757
3623
  }
3758
3624
  }
3759
3625
  }
@@ -3777,8 +3643,6 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3777
3643
  for (const key of Reflect.ownKeys(input)) {
3778
3644
  if (key === "__proto__")
3779
3645
  continue;
3780
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
3781
- continue;
3782
3646
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
3783
3647
  if (keyResult instanceof Promise) {
3784
3648
  throw new Error("Async schemas not supported in object keys currently");
@@ -3983,7 +3847,6 @@ var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
3983
3847
  });
3984
3848
  var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
3985
3849
  $ZodType.init(inst, def);
3986
- inst._zod.optin = "optional";
3987
3850
  inst._zod.parse = (payload, ctx) => {
3988
3851
  if (ctx.direction === "backward") {
3989
3852
  throw new $ZodEncodeError(inst.constructor.name);
@@ -3993,7 +3856,6 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
3993
3856
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
3994
3857
  return output.then((output2) => {
3995
3858
  payload.value = output2;
3996
- payload.fallback = true;
3997
3859
  return payload;
3998
3860
  });
3999
3861
  }
@@ -4001,12 +3863,11 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
4001
3863
  throw new $ZodAsyncError;
4002
3864
  }
4003
3865
  payload.value = _out;
4004
- payload.fallback = true;
4005
3866
  return payload;
4006
3867
  };
4007
3868
  });
4008
3869
  function handleOptionalResult(result, input) {
4009
- if (input === undefined && (result.issues.length || result.fallback)) {
3870
+ if (result.issues.length && input === undefined) {
4010
3871
  return { issues: [], value: undefined };
4011
3872
  }
4012
3873
  return result;
@@ -4024,11 +3885,10 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
4024
3885
  });
4025
3886
  inst._zod.parse = (payload, ctx) => {
4026
3887
  if (def.innerType._zod.optin === "optional") {
4027
- const input = payload.value;
4028
3888
  const result = def.innerType._zod.run(payload, ctx);
4029
3889
  if (result instanceof Promise)
4030
- return result.then((r) => handleOptionalResult(r, input));
4031
- return handleOptionalResult(result, input);
3890
+ return result.then((r) => handleOptionalResult(r, payload.value));
3891
+ return handleOptionalResult(result, payload.value);
4032
3892
  }
4033
3893
  if (payload.value === undefined) {
4034
3894
  return payload;
@@ -4144,7 +4004,7 @@ var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
4144
4004
  });
4145
4005
  var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
4146
4006
  $ZodType.init(inst, def);
4147
- inst._zod.optin = "optional";
4007
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
4148
4008
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
4149
4009
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4150
4010
  inst._zod.parse = (payload, ctx) => {
@@ -4164,7 +4024,6 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
4164
4024
  input: payload.value
4165
4025
  });
4166
4026
  payload.issues = [];
4167
- payload.fallback = true;
4168
4027
  }
4169
4028
  return payload;
4170
4029
  });
@@ -4179,7 +4038,6 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
4179
4038
  input: payload.value
4180
4039
  });
4181
4040
  payload.issues = [];
4182
- payload.fallback = true;
4183
4041
  }
4184
4042
  return payload;
4185
4043
  };
@@ -4225,7 +4083,7 @@ function handlePipeResult(left, next, ctx) {
4225
4083
  left.aborted = true;
4226
4084
  return left;
4227
4085
  }
4228
- return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
4086
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
4229
4087
  }
4230
4088
  var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => {
4231
4089
  $ZodType.init(inst, def);
@@ -4277,9 +4135,6 @@ function handleCodecTxResult(left, value, nextSchema, ctx) {
4277
4135
  }
4278
4136
  return nextSchema._zod.run({ value, issues: left.issues }, ctx);
4279
4137
  }
4280
- var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
4281
- $ZodPipe.init(inst, def);
4282
- });
4283
4138
  var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
4284
4139
  $ZodType.init(inst, def);
4285
4140
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
@@ -4431,12 +4286,7 @@ var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
4431
4286
  });
4432
4287
  var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
4433
4288
  $ZodType.init(inst, def);
4434
- defineLazy(inst._zod, "innerType", () => {
4435
- const d = def;
4436
- if (!d._cachedInner)
4437
- d._cachedInner = def.getter();
4438
- return d._cachedInner;
4439
- });
4289
+ defineLazy(inst._zod, "innerType", () => def.getter());
4440
4290
  defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
4441
4291
  defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
4442
4292
  defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
@@ -4493,7 +4343,6 @@ __export(exports_locales, {
4493
4343
  sv: () => sv_default,
4494
4344
  sl: () => sl_default,
4495
4345
  ru: () => ru_default,
4496
- ro: () => ro_default,
4497
4346
  pt: () => pt_default,
4498
4347
  ps: () => ps_default,
4499
4348
  pl: () => pl_default,
@@ -4513,7 +4362,6 @@ __export(exports_locales, {
4513
4362
  id: () => id_default,
4514
4363
  hy: () => hy_default,
4515
4364
  hu: () => hu_default,
4516
- hr: () => hr_default,
4517
4365
  he: () => he_default,
4518
4366
  frCA: () => fr_CA_default,
4519
4367
  fr: () => fr_default,
@@ -4522,7 +4370,6 @@ __export(exports_locales, {
4522
4370
  es: () => es_default,
4523
4371
  eo: () => eo_default,
4524
4372
  en: () => en_default,
4525
- el: () => el_default,
4526
4373
  de: () => de_default,
4527
4374
  da: () => da_default,
4528
4375
  cs: () => cs_default,
@@ -5461,117 +5308,8 @@ function de_default() {
5461
5308
  localeError: error8()
5462
5309
  };
5463
5310
  }
5464
- // node_modules/zod/v4/locales/el.js
5465
- var error9 = () => {
5466
- const Sizable = {
5467
- string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
5468
- file: { unit: "bytes", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
5469
- array: { unit: "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
5470
- set: { unit: "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
5471
- map: { unit: "\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }
5472
- };
5473
- function getSizing(origin) {
5474
- return Sizable[origin] ?? null;
5475
- }
5476
- const FormatDictionary = {
5477
- regex: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",
5478
- email: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",
5479
- url: "URL",
5480
- emoji: "emoji",
5481
- uuid: "UUID",
5482
- uuidv4: "UUIDv4",
5483
- uuidv6: "UUIDv6",
5484
- nanoid: "nanoid",
5485
- guid: "GUID",
5486
- cuid: "cuid",
5487
- cuid2: "cuid2",
5488
- ulid: "ULID",
5489
- xid: "XID",
5490
- ksuid: "KSUID",
5491
- datetime: "ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",
5492
- date: "ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",
5493
- time: "ISO \u03CE\u03C1\u03B1",
5494
- duration: "ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",
5495
- ipv4: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",
5496
- ipv6: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",
5497
- mac: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",
5498
- cidrv4: "\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",
5499
- cidrv6: "\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",
5500
- base64: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",
5501
- base64url: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",
5502
- json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",
5503
- e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",
5504
- jwt: "JWT",
5505
- template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"
5506
- };
5507
- const TypeDictionary = {
5508
- nan: "NaN"
5509
- };
5510
- return (issue2) => {
5511
- switch (issue2.code) {
5512
- case "invalid_type": {
5513
- const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
5514
- const receivedType = parsedType(issue2.input);
5515
- const received = TypeDictionary[receivedType] ?? receivedType;
5516
- if (typeof issue2.expected === "string" && /^[A-Z]/.test(issue2.expected)) {
5517
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${issue2.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${received}`;
5518
- }
5519
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${received}`;
5520
- }
5521
- case "invalid_value":
5522
- if (issue2.values.length === 1)
5523
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${stringifyPrimitive(issue2.values[0])}`;
5524
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${joinValues(issue2.values, "|")}`;
5525
- case "too_big": {
5526
- const adj = issue2.inclusive ? "<=" : "<";
5527
- const sizing = getSizing(issue2.origin);
5528
- if (sizing)
5529
- return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin ?? "\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`;
5530
- return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin ?? "\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${adj}${issue2.maximum.toString()}`;
5531
- }
5532
- case "too_small": {
5533
- const adj = issue2.inclusive ? ">=" : ">";
5534
- const sizing = getSizing(issue2.origin);
5535
- if (sizing) {
5536
- return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
5537
- }
5538
- return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${adj}${issue2.minimum.toString()}`;
5539
- }
5540
- case "invalid_format": {
5541
- const _issue = issue2;
5542
- if (_issue.format === "starts_with") {
5543
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${_issue.prefix}"`;
5544
- }
5545
- if (_issue.format === "ends_with")
5546
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${_issue.suffix}"`;
5547
- if (_issue.format === "includes")
5548
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${_issue.includes}"`;
5549
- if (_issue.format === "regex")
5550
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${_issue.pattern}`;
5551
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${FormatDictionary[_issue.format] ?? issue2.format}`;
5552
- }
5553
- case "not_multiple_of":
5554
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${issue2.divisor}`;
5555
- case "unrecognized_keys":
5556
- return `\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${issue2.keys.length > 1 ? "\u03B1" : "\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${issue2.keys.length > 1 ? "\u03B9\u03AC" : "\u03AF"}: ${joinValues(issue2.keys, ", ")}`;
5557
- case "invalid_key":
5558
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${issue2.origin}`;
5559
- case "invalid_union":
5560
- return "\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";
5561
- case "invalid_element":
5562
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${issue2.origin}`;
5563
- default:
5564
- return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2`;
5565
- }
5566
- };
5567
- };
5568
- function el_default() {
5569
- return {
5570
- localeError: error9()
5571
- };
5572
- }
5573
5311
  // node_modules/zod/v4/locales/en.js
5574
- var error10 = () => {
5312
+ var error9 = () => {
5575
5313
  const Sizable = {
5576
5314
  string: { unit: "characters", verb: "to have" },
5577
5315
  file: { unit: "bytes", verb: "to have" },
@@ -5663,10 +5401,6 @@ var error10 = () => {
5663
5401
  case "invalid_key":
5664
5402
  return `Invalid key in ${issue2.origin}`;
5665
5403
  case "invalid_union":
5666
- if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
5667
- const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
5668
- return `Invalid discriminator value. Expected ${opts}`;
5669
- }
5670
5404
  return "Invalid input";
5671
5405
  case "invalid_element":
5672
5406
  return `Invalid value in ${issue2.origin}`;
@@ -5677,11 +5411,11 @@ var error10 = () => {
5677
5411
  };
5678
5412
  function en_default() {
5679
5413
  return {
5680
- localeError: error10()
5414
+ localeError: error9()
5681
5415
  };
5682
5416
  }
5683
5417
  // node_modules/zod/v4/locales/eo.js
5684
- var error11 = () => {
5418
+ var error10 = () => {
5685
5419
  const Sizable = {
5686
5420
  string: { unit: "karaktrojn", verb: "havi" },
5687
5421
  file: { unit: "bajtojn", verb: "havi" },
@@ -5786,11 +5520,11 @@ var error11 = () => {
5786
5520
  };
5787
5521
  function eo_default() {
5788
5522
  return {
5789
- localeError: error11()
5523
+ localeError: error10()
5790
5524
  };
5791
5525
  }
5792
5526
  // node_modules/zod/v4/locales/es.js
5793
- var error12 = () => {
5527
+ var error11 = () => {
5794
5528
  const Sizable = {
5795
5529
  string: { unit: "caracteres", verb: "tener" },
5796
5530
  file: { unit: "bytes", verb: "tener" },
@@ -5918,11 +5652,11 @@ var error12 = () => {
5918
5652
  };
5919
5653
  function es_default() {
5920
5654
  return {
5921
- localeError: error12()
5655
+ localeError: error11()
5922
5656
  };
5923
5657
  }
5924
5658
  // node_modules/zod/v4/locales/fa.js
5925
- var error13 = () => {
5659
+ var error12 = () => {
5926
5660
  const Sizable = {
5927
5661
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
5928
5662
  file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -6032,11 +5766,11 @@ var error13 = () => {
6032
5766
  };
6033
5767
  function fa_default() {
6034
5768
  return {
6035
- localeError: error13()
5769
+ localeError: error12()
6036
5770
  };
6037
5771
  }
6038
5772
  // node_modules/zod/v4/locales/fi.js
6039
- var error14 = () => {
5773
+ var error13 = () => {
6040
5774
  const Sizable = {
6041
5775
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
6042
5776
  file: { unit: "tavua", subject: "tiedoston" },
@@ -6144,11 +5878,11 @@ var error14 = () => {
6144
5878
  };
6145
5879
  function fi_default() {
6146
5880
  return {
6147
- localeError: error14()
5881
+ localeError: error13()
6148
5882
  };
6149
5883
  }
6150
5884
  // node_modules/zod/v4/locales/fr.js
6151
- var error15 = () => {
5885
+ var error14 = () => {
6152
5886
  const Sizable = {
6153
5887
  string: { unit: "caract\xE8res", verb: "avoir" },
6154
5888
  file: { unit: "octets", verb: "avoir" },
@@ -6189,27 +5923,9 @@ var error15 = () => {
6189
5923
  template_literal: "entr\xE9e"
6190
5924
  };
6191
5925
  const TypeDictionary = {
6192
- string: "cha\xEEne",
6193
- number: "nombre",
6194
- int: "entier",
6195
- boolean: "bool\xE9en",
6196
- bigint: "grand entier",
6197
- symbol: "symbole",
6198
- undefined: "ind\xE9fini",
6199
- null: "null",
6200
- never: "jamais",
6201
- void: "vide",
6202
- date: "date",
6203
- array: "tableau",
6204
- object: "objet",
6205
- tuple: "tuple",
6206
- record: "enregistrement",
6207
- map: "carte",
6208
- set: "ensemble",
6209
- file: "fichier",
6210
- nonoptional: "non-optionnel",
6211
5926
  nan: "NaN",
6212
- function: "fonction"
5927
+ number: "nombre",
5928
+ array: "tableau"
6213
5929
  };
6214
5930
  return (issue2) => {
6215
5931
  switch (issue2.code) {
@@ -6230,15 +5946,16 @@ var error15 = () => {
6230
5946
  const adj = issue2.inclusive ? "<=" : "<";
6231
5947
  const sizing = getSizing(issue2.origin);
6232
5948
  if (sizing)
6233
- return `Trop grand : ${TypeDictionary[issue2.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xE9l\xE9ment(s)"}`;
6234
- return `Trop grand : ${TypeDictionary[issue2.origin] ?? "valeur"} doit \xEAtre ${adj}${issue2.maximum.toString()}`;
5949
+ return `Trop grand : ${issue2.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xE9l\xE9ment(s)"}`;
5950
+ return `Trop grand : ${issue2.origin ?? "valeur"} doit \xEAtre ${adj}${issue2.maximum.toString()}`;
6235
5951
  }
6236
5952
  case "too_small": {
6237
5953
  const adj = issue2.inclusive ? ">=" : ">";
6238
5954
  const sizing = getSizing(issue2.origin);
6239
- if (sizing)
6240
- return `Trop petit : ${TypeDictionary[issue2.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
6241
- return `Trop petit : ${TypeDictionary[issue2.origin] ?? "valeur"} doit \xEAtre ${adj}${issue2.minimum.toString()}`;
5955
+ if (sizing) {
5956
+ return `Trop petit : ${issue2.origin} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
5957
+ }
5958
+ return `Trop petit : ${issue2.origin} doit \xEAtre ${adj}${issue2.minimum.toString()}`;
6242
5959
  }
6243
5960
  case "invalid_format": {
6244
5961
  const _issue = issue2;
@@ -6269,11 +5986,11 @@ var error15 = () => {
6269
5986
  };
6270
5987
  function fr_default() {
6271
5988
  return {
6272
- localeError: error15()
5989
+ localeError: error14()
6273
5990
  };
6274
5991
  }
6275
5992
  // node_modules/zod/v4/locales/fr-CA.js
6276
- var error16 = () => {
5993
+ var error15 = () => {
6277
5994
  const Sizable = {
6278
5995
  string: { unit: "caract\xE8res", verb: "avoir" },
6279
5996
  file: { unit: "octets", verb: "avoir" },
@@ -6376,11 +6093,11 @@ var error16 = () => {
6376
6093
  };
6377
6094
  function fr_CA_default() {
6378
6095
  return {
6379
- localeError: error16()
6096
+ localeError: error15()
6380
6097
  };
6381
6098
  }
6382
6099
  // node_modules/zod/v4/locales/he.js
6383
- var error17 = () => {
6100
+ var error16 = () => {
6384
6101
  const TypeNames = {
6385
6102
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
6386
6103
  number: { label: "\u05DE\u05E1\u05E4\u05E8", gender: "m" },
@@ -6569,23 +6286,23 @@ var error17 = () => {
6569
6286
  };
6570
6287
  function he_default() {
6571
6288
  return {
6572
- localeError: error17()
6289
+ localeError: error16()
6573
6290
  };
6574
6291
  }
6575
- // node_modules/zod/v4/locales/hr.js
6576
- var error18 = () => {
6292
+ // node_modules/zod/v4/locales/hu.js
6293
+ var error17 = () => {
6577
6294
  const Sizable = {
6578
- string: { unit: "znakova", verb: "imati" },
6579
- file: { unit: "bajtova", verb: "imati" },
6580
- array: { unit: "stavki", verb: "imati" },
6581
- set: { unit: "stavki", verb: "imati" }
6295
+ string: { unit: "karakter", verb: "legyen" },
6296
+ file: { unit: "byte", verb: "legyen" },
6297
+ array: { unit: "elem", verb: "legyen" },
6298
+ set: { unit: "elem", verb: "legyen" }
6582
6299
  };
6583
6300
  function getSizing(origin) {
6584
6301
  return Sizable[origin] ?? null;
6585
6302
  }
6586
6303
  const FormatDictionary = {
6587
- regex: "unos",
6588
- email: "email adresa",
6304
+ regex: "bemenet",
6305
+ email: "email c\xEDm",
6589
6306
  url: "URL",
6590
6307
  emoji: "emoji",
6591
6308
  uuid: "UUID",
@@ -6598,147 +6315,25 @@ var error18 = () => {
6598
6315
  ulid: "ULID",
6599
6316
  xid: "XID",
6600
6317
  ksuid: "KSUID",
6601
- datetime: "ISO datum i vrijeme",
6602
- date: "ISO datum",
6603
- time: "ISO vrijeme",
6604
- duration: "ISO trajanje",
6605
- ipv4: "IPv4 adresa",
6606
- ipv6: "IPv6 adresa",
6607
- cidrv4: "IPv4 raspon",
6608
- cidrv6: "IPv6 raspon",
6609
- base64: "base64 kodirani tekst",
6610
- base64url: "base64url kodirani tekst",
6611
- json_string: "JSON tekst",
6612
- e164: "E.164 broj",
6318
+ datetime: "ISO id\u0151b\xE9lyeg",
6319
+ date: "ISO d\xE1tum",
6320
+ time: "ISO id\u0151",
6321
+ duration: "ISO id\u0151intervallum",
6322
+ ipv4: "IPv4 c\xEDm",
6323
+ ipv6: "IPv6 c\xEDm",
6324
+ cidrv4: "IPv4 tartom\xE1ny",
6325
+ cidrv6: "IPv6 tartom\xE1ny",
6326
+ base64: "base64-k\xF3dolt string",
6327
+ base64url: "base64url-k\xF3dolt string",
6328
+ json_string: "JSON string",
6329
+ e164: "E.164 sz\xE1m",
6613
6330
  jwt: "JWT",
6614
- template_literal: "unos"
6331
+ template_literal: "bemenet"
6615
6332
  };
6616
6333
  const TypeDictionary = {
6617
6334
  nan: "NaN",
6618
- string: "tekst",
6619
- number: "broj",
6620
- boolean: "boolean",
6621
- array: "niz",
6622
- object: "objekt",
6623
- set: "skup",
6624
- file: "datoteka",
6625
- date: "datum",
6626
- bigint: "bigint",
6627
- symbol: "simbol",
6628
- undefined: "undefined",
6629
- null: "null",
6630
- function: "funkcija",
6631
- map: "mapa"
6632
- };
6633
- return (issue2) => {
6634
- switch (issue2.code) {
6635
- case "invalid_type": {
6636
- const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
6637
- const receivedType = parsedType(issue2.input);
6638
- const received = TypeDictionary[receivedType] ?? receivedType;
6639
- if (/^[A-Z]/.test(issue2.expected)) {
6640
- return `Neispravan unos: o\u010Dekuje se instanceof ${issue2.expected}, a primljeno je ${received}`;
6641
- }
6642
- return `Neispravan unos: o\u010Dekuje se ${expected}, a primljeno je ${received}`;
6643
- }
6644
- case "invalid_value":
6645
- if (issue2.values.length === 1)
6646
- return `Neispravna vrijednost: o\u010Dekivano ${stringifyPrimitive(issue2.values[0])}`;
6647
- return `Neispravna opcija: o\u010Dekivano jedno od ${joinValues(issue2.values, "|")}`;
6648
- case "too_big": {
6649
- const adj = issue2.inclusive ? "<=" : "<";
6650
- const sizing = getSizing(issue2.origin);
6651
- const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
6652
- if (sizing)
6653
- return `Preveliko: o\u010Dekivano da ${origin ?? "vrijednost"} ima ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemenata"}`;
6654
- return `Preveliko: o\u010Dekivano da ${origin ?? "vrijednost"} bude ${adj}${issue2.maximum.toString()}`;
6655
- }
6656
- case "too_small": {
6657
- const adj = issue2.inclusive ? ">=" : ">";
6658
- const sizing = getSizing(issue2.origin);
6659
- const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
6660
- if (sizing) {
6661
- return `Premalo: o\u010Dekivano da ${origin} ima ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
6662
- }
6663
- return `Premalo: o\u010Dekivano da ${origin} bude ${adj}${issue2.minimum.toString()}`;
6664
- }
6665
- case "invalid_format": {
6666
- const _issue = issue2;
6667
- if (_issue.format === "starts_with")
6668
- return `Neispravan tekst: mora zapo\u010Dinjati s "${_issue.prefix}"`;
6669
- if (_issue.format === "ends_with")
6670
- return `Neispravan tekst: mora zavr\u0161avati s "${_issue.suffix}"`;
6671
- if (_issue.format === "includes")
6672
- return `Neispravan tekst: mora sadr\u017Eavati "${_issue.includes}"`;
6673
- if (_issue.format === "regex")
6674
- return `Neispravan tekst: mora odgovarati uzorku ${_issue.pattern}`;
6675
- return `Neispravna ${FormatDictionary[_issue.format] ?? issue2.format}`;
6676
- }
6677
- case "not_multiple_of":
6678
- return `Neispravan broj: mora biti vi\u0161ekratnik od ${issue2.divisor}`;
6679
- case "unrecognized_keys":
6680
- return `Neprepoznat${issue2.keys.length > 1 ? "i klju\u010Devi" : " klju\u010D"}: ${joinValues(issue2.keys, ", ")}`;
6681
- case "invalid_key":
6682
- return `Neispravan klju\u010D u ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
6683
- case "invalid_union":
6684
- return "Neispravan unos";
6685
- case "invalid_element":
6686
- return `Neispravna vrijednost u ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
6687
- default:
6688
- return `Neispravan unos`;
6689
- }
6690
- };
6691
- };
6692
- function hr_default() {
6693
- return {
6694
- localeError: error18()
6695
- };
6696
- }
6697
- // node_modules/zod/v4/locales/hu.js
6698
- var error19 = () => {
6699
- const Sizable = {
6700
- string: { unit: "karakter", verb: "legyen" },
6701
- file: { unit: "byte", verb: "legyen" },
6702
- array: { unit: "elem", verb: "legyen" },
6703
- set: { unit: "elem", verb: "legyen" }
6704
- };
6705
- function getSizing(origin) {
6706
- return Sizable[origin] ?? null;
6707
- }
6708
- const FormatDictionary = {
6709
- regex: "bemenet",
6710
- email: "email c\xEDm",
6711
- url: "URL",
6712
- emoji: "emoji",
6713
- uuid: "UUID",
6714
- uuidv4: "UUIDv4",
6715
- uuidv6: "UUIDv6",
6716
- nanoid: "nanoid",
6717
- guid: "GUID",
6718
- cuid: "cuid",
6719
- cuid2: "cuid2",
6720
- ulid: "ULID",
6721
- xid: "XID",
6722
- ksuid: "KSUID",
6723
- datetime: "ISO id\u0151b\xE9lyeg",
6724
- date: "ISO d\xE1tum",
6725
- time: "ISO id\u0151",
6726
- duration: "ISO id\u0151intervallum",
6727
- ipv4: "IPv4 c\xEDm",
6728
- ipv6: "IPv6 c\xEDm",
6729
- cidrv4: "IPv4 tartom\xE1ny",
6730
- cidrv6: "IPv6 tartom\xE1ny",
6731
- base64: "base64-k\xF3dolt string",
6732
- base64url: "base64url-k\xF3dolt string",
6733
- json_string: "JSON string",
6734
- e164: "E.164 sz\xE1m",
6735
- jwt: "JWT",
6736
- template_literal: "bemenet"
6737
- };
6738
- const TypeDictionary = {
6739
- nan: "NaN",
6740
- number: "sz\xE1m",
6741
- array: "t\xF6mb"
6335
+ number: "sz\xE1m",
6336
+ array: "t\xF6mb"
6742
6337
  };
6743
6338
  return (issue2) => {
6744
6339
  switch (issue2.code) {
@@ -6799,7 +6394,7 @@ var error19 = () => {
6799
6394
  };
6800
6395
  function hu_default() {
6801
6396
  return {
6802
- localeError: error19()
6397
+ localeError: error17()
6803
6398
  };
6804
6399
  }
6805
6400
  // node_modules/zod/v4/locales/hy.js
@@ -6813,7 +6408,7 @@ function withDefiniteArticle(word) {
6813
6408
  const lastChar = word[word.length - 1];
6814
6409
  return word + (vowels.includes(lastChar) ? "\u0576" : "\u0568");
6815
6410
  }
6816
- var error20 = () => {
6411
+ var error18 = () => {
6817
6412
  const Sizable = {
6818
6413
  string: {
6819
6414
  unit: {
@@ -6946,11 +6541,11 @@ var error20 = () => {
6946
6541
  };
6947
6542
  function hy_default() {
6948
6543
  return {
6949
- localeError: error20()
6544
+ localeError: error18()
6950
6545
  };
6951
6546
  }
6952
6547
  // node_modules/zod/v4/locales/id.js
6953
- var error21 = () => {
6548
+ var error19 = () => {
6954
6549
  const Sizable = {
6955
6550
  string: { unit: "karakter", verb: "memiliki" },
6956
6551
  file: { unit: "byte", verb: "memiliki" },
@@ -7052,11 +6647,11 @@ var error21 = () => {
7052
6647
  };
7053
6648
  function id_default() {
7054
6649
  return {
7055
- localeError: error21()
6650
+ localeError: error19()
7056
6651
  };
7057
6652
  }
7058
6653
  // node_modules/zod/v4/locales/is.js
7059
- var error22 = () => {
6654
+ var error20 = () => {
7060
6655
  const Sizable = {
7061
6656
  string: { unit: "stafi", verb: "a\xF0 hafa" },
7062
6657
  file: { unit: "b\xE6ti", verb: "a\xF0 hafa" },
@@ -7161,11 +6756,11 @@ var error22 = () => {
7161
6756
  };
7162
6757
  function is_default() {
7163
6758
  return {
7164
- localeError: error22()
6759
+ localeError: error20()
7165
6760
  };
7166
6761
  }
7167
6762
  // node_modules/zod/v4/locales/it.js
7168
- var error23 = () => {
6763
+ var error21 = () => {
7169
6764
  const Sizable = {
7170
6765
  string: { unit: "caratteri", verb: "avere" },
7171
6766
  file: { unit: "byte", verb: "avere" },
@@ -7250,7 +6845,7 @@ var error23 = () => {
7250
6845
  return `Stringa non valida: deve includere "${_issue.includes}"`;
7251
6846
  if (_issue.format === "regex")
7252
6847
  return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
7253
- return `Input non valido: ${FormatDictionary[_issue.format] ?? issue2.format}`;
6848
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
7254
6849
  }
7255
6850
  case "not_multiple_of":
7256
6851
  return `Numero non valido: deve essere un multiplo di ${issue2.divisor}`;
@@ -7269,11 +6864,11 @@ var error23 = () => {
7269
6864
  };
7270
6865
  function it_default() {
7271
6866
  return {
7272
- localeError: error23()
6867
+ localeError: error21()
7273
6868
  };
7274
6869
  }
7275
6870
  // node_modules/zod/v4/locales/ja.js
7276
- var error24 = () => {
6871
+ var error22 = () => {
7277
6872
  const Sizable = {
7278
6873
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
7279
6874
  file: { unit: "\u30D0\u30A4\u30C8", verb: "\u3067\u3042\u308B" },
@@ -7376,11 +6971,11 @@ var error24 = () => {
7376
6971
  };
7377
6972
  function ja_default() {
7378
6973
  return {
7379
- localeError: error24()
6974
+ localeError: error22()
7380
6975
  };
7381
6976
  }
7382
6977
  // node_modules/zod/v4/locales/ka.js
7383
- var error25 = () => {
6978
+ var error23 = () => {
7384
6979
  const Sizable = {
7385
6980
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
7386
6981
  file: { unit: "\u10D1\u10D0\u10D8\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -7413,9 +7008,9 @@ var error25 = () => {
7413
7008
  ipv6: "IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",
7414
7009
  cidrv4: "IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",
7415
7010
  cidrv6: "IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",
7416
- base64: "base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",
7417
- base64url: "base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",
7418
- json_string: "JSON \u10D5\u10D4\u10DA\u10D8",
7011
+ base64: "base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
7012
+ base64url: "base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
7013
+ json_string: "JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
7419
7014
  e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
7420
7015
  jwt: "JWT",
7421
7016
  template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
@@ -7423,7 +7018,7 @@ var error25 = () => {
7423
7018
  const TypeDictionary = {
7424
7019
  nan: "NaN",
7425
7020
  number: "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",
7426
- string: "\u10D5\u10D4\u10DA\u10D8",
7021
+ string: "\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
7427
7022
  boolean: "\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",
7428
7023
  function: "\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",
7429
7024
  array: "\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"
@@ -7461,14 +7056,14 @@ var error25 = () => {
7461
7056
  case "invalid_format": {
7462
7057
  const _issue = issue2;
7463
7058
  if (_issue.format === "starts_with") {
7464
- return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.prefix}"-\u10D8\u10D7`;
7059
+ return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.prefix}"-\u10D8\u10D7`;
7465
7060
  }
7466
7061
  if (_issue.format === "ends_with")
7467
- return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.suffix}"-\u10D8\u10D7`;
7062
+ return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.suffix}"-\u10D8\u10D7`;
7468
7063
  if (_issue.format === "includes")
7469
- return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${_issue.includes}"-\u10E1`;
7064
+ return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${_issue.includes}"-\u10E1`;
7470
7065
  if (_issue.format === "regex")
7471
- return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${_issue.pattern}`;
7066
+ return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${_issue.pattern}`;
7472
7067
  return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${FormatDictionary[_issue.format] ?? issue2.format}`;
7473
7068
  }
7474
7069
  case "not_multiple_of":
@@ -7488,11 +7083,11 @@ var error25 = () => {
7488
7083
  };
7489
7084
  function ka_default() {
7490
7085
  return {
7491
- localeError: error25()
7086
+ localeError: error23()
7492
7087
  };
7493
7088
  }
7494
7089
  // node_modules/zod/v4/locales/km.js
7495
- var error26 = () => {
7090
+ var error24 = () => {
7496
7091
  const Sizable = {
7497
7092
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
7498
7093
  file: { unit: "\u1794\u17C3", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -7598,7 +7193,7 @@ var error26 = () => {
7598
7193
  };
7599
7194
  function km_default() {
7600
7195
  return {
7601
- localeError: error26()
7196
+ localeError: error24()
7602
7197
  };
7603
7198
  }
7604
7199
 
@@ -7607,7 +7202,7 @@ function kh_default() {
7607
7202
  return km_default();
7608
7203
  }
7609
7204
  // node_modules/zod/v4/locales/ko.js
7610
- var error27 = () => {
7205
+ var error25 = () => {
7611
7206
  const Sizable = {
7612
7207
  string: { unit: "\uBB38\uC790", verb: "to have" },
7613
7208
  file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" },
@@ -7714,7 +7309,7 @@ var error27 = () => {
7714
7309
  };
7715
7310
  function ko_default() {
7716
7311
  return {
7717
- localeError: error27()
7312
+ localeError: error25()
7718
7313
  };
7719
7314
  }
7720
7315
  // node_modules/zod/v4/locales/lt.js
@@ -7731,7 +7326,7 @@ function getUnitTypeFromNumber(number2) {
7731
7326
  return "one";
7732
7327
  return "few";
7733
7328
  }
7734
- var error28 = () => {
7329
+ var error26 = () => {
7735
7330
  const Sizable = {
7736
7331
  string: {
7737
7332
  unit: {
@@ -7917,11 +7512,11 @@ var error28 = () => {
7917
7512
  };
7918
7513
  function lt_default() {
7919
7514
  return {
7920
- localeError: error28()
7515
+ localeError: error26()
7921
7516
  };
7922
7517
  }
7923
7518
  // node_modules/zod/v4/locales/mk.js
7924
- var error29 = () => {
7519
+ var error27 = () => {
7925
7520
  const Sizable = {
7926
7521
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
7927
7522
  file: { unit: "\u0431\u0430\u0458\u0442\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -8026,11 +7621,11 @@ var error29 = () => {
8026
7621
  };
8027
7622
  function mk_default() {
8028
7623
  return {
8029
- localeError: error29()
7624
+ localeError: error27()
8030
7625
  };
8031
7626
  }
8032
7627
  // node_modules/zod/v4/locales/ms.js
8033
- var error30 = () => {
7628
+ var error28 = () => {
8034
7629
  const Sizable = {
8035
7630
  string: { unit: "aksara", verb: "mempunyai" },
8036
7631
  file: { unit: "bait", verb: "mempunyai" },
@@ -8133,11 +7728,11 @@ var error30 = () => {
8133
7728
  };
8134
7729
  function ms_default() {
8135
7730
  return {
8136
- localeError: error30()
7731
+ localeError: error28()
8137
7732
  };
8138
7733
  }
8139
7734
  // node_modules/zod/v4/locales/nl.js
8140
- var error31 = () => {
7735
+ var error29 = () => {
8141
7736
  const Sizable = {
8142
7737
  string: { unit: "tekens", verb: "heeft" },
8143
7738
  file: { unit: "bytes", verb: "heeft" },
@@ -8243,11 +7838,11 @@ var error31 = () => {
8243
7838
  };
8244
7839
  function nl_default() {
8245
7840
  return {
8246
- localeError: error31()
7841
+ localeError: error29()
8247
7842
  };
8248
7843
  }
8249
7844
  // node_modules/zod/v4/locales/no.js
8250
- var error32 = () => {
7845
+ var error30 = () => {
8251
7846
  const Sizable = {
8252
7847
  string: { unit: "tegn", verb: "\xE5 ha" },
8253
7848
  file: { unit: "bytes", verb: "\xE5 ha" },
@@ -8351,11 +7946,11 @@ var error32 = () => {
8351
7946
  };
8352
7947
  function no_default() {
8353
7948
  return {
8354
- localeError: error32()
7949
+ localeError: error30()
8355
7950
  };
8356
7951
  }
8357
7952
  // node_modules/zod/v4/locales/ota.js
8358
- var error33 = () => {
7953
+ var error31 = () => {
8359
7954
  const Sizable = {
8360
7955
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
8361
7956
  file: { unit: "bayt", verb: "olmal\u0131d\u0131r" },
@@ -8460,11 +8055,11 @@ var error33 = () => {
8460
8055
  };
8461
8056
  function ota_default() {
8462
8057
  return {
8463
- localeError: error33()
8058
+ localeError: error31()
8464
8059
  };
8465
8060
  }
8466
8061
  // node_modules/zod/v4/locales/ps.js
8467
- var error34 = () => {
8062
+ var error32 = () => {
8468
8063
  const Sizable = {
8469
8064
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
8470
8065
  file: { unit: "\u0628\u0627\u06CC\u067C\u0633", verb: "\u0648\u0644\u0631\u064A" },
@@ -8574,11 +8169,11 @@ var error34 = () => {
8574
8169
  };
8575
8170
  function ps_default() {
8576
8171
  return {
8577
- localeError: error34()
8172
+ localeError: error32()
8578
8173
  };
8579
8174
  }
8580
8175
  // node_modules/zod/v4/locales/pl.js
8581
- var error35 = () => {
8176
+ var error33 = () => {
8582
8177
  const Sizable = {
8583
8178
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
8584
8179
  file: { unit: "bajt\xF3w", verb: "mie\u0107" },
@@ -8683,11 +8278,11 @@ var error35 = () => {
8683
8278
  };
8684
8279
  function pl_default() {
8685
8280
  return {
8686
- localeError: error35()
8281
+ localeError: error33()
8687
8282
  };
8688
8283
  }
8689
8284
  // node_modules/zod/v4/locales/pt.js
8690
- var error36 = () => {
8285
+ var error34 = () => {
8691
8286
  const Sizable = {
8692
8287
  string: { unit: "caracteres", verb: "ter" },
8693
8288
  file: { unit: "bytes", verb: "ter" },
@@ -8791,126 +8386,7 @@ var error36 = () => {
8791
8386
  };
8792
8387
  function pt_default() {
8793
8388
  return {
8794
- localeError: error36()
8795
- };
8796
- }
8797
- // node_modules/zod/v4/locales/ro.js
8798
- var error37 = () => {
8799
- const Sizable = {
8800
- string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
8801
- file: { unit: "octe\u021Bi", verb: "s\u0103 aib\u0103" },
8802
- array: { unit: "elemente", verb: "s\u0103 aib\u0103" },
8803
- set: { unit: "elemente", verb: "s\u0103 aib\u0103" },
8804
- map: { unit: "intr\u0103ri", verb: "s\u0103 aib\u0103" }
8805
- };
8806
- function getSizing(origin) {
8807
- return Sizable[origin] ?? null;
8808
- }
8809
- const FormatDictionary = {
8810
- regex: "intrare",
8811
- email: "adres\u0103 de email",
8812
- url: "URL",
8813
- emoji: "emoji",
8814
- uuid: "UUID",
8815
- uuidv4: "UUIDv4",
8816
- uuidv6: "UUIDv6",
8817
- nanoid: "nanoid",
8818
- guid: "GUID",
8819
- cuid: "cuid",
8820
- cuid2: "cuid2",
8821
- ulid: "ULID",
8822
- xid: "XID",
8823
- ksuid: "KSUID",
8824
- datetime: "dat\u0103 \u0219i or\u0103 ISO",
8825
- date: "dat\u0103 ISO",
8826
- time: "or\u0103 ISO",
8827
- duration: "durat\u0103 ISO",
8828
- ipv4: "adres\u0103 IPv4",
8829
- ipv6: "adres\u0103 IPv6",
8830
- mac: "adres\u0103 MAC",
8831
- cidrv4: "interval IPv4",
8832
- cidrv6: "interval IPv6",
8833
- base64: "\u0219ir codat base64",
8834
- base64url: "\u0219ir codat base64url",
8835
- json_string: "\u0219ir JSON",
8836
- e164: "num\u0103r E.164",
8837
- jwt: "JWT",
8838
- template_literal: "intrare"
8839
- };
8840
- const TypeDictionary = {
8841
- nan: "NaN",
8842
- string: "\u0219ir",
8843
- number: "num\u0103r",
8844
- boolean: "boolean",
8845
- function: "func\u021Bie",
8846
- array: "matrice",
8847
- object: "obiect",
8848
- undefined: "nedefinit",
8849
- symbol: "simbol",
8850
- bigint: "num\u0103r mare",
8851
- void: "void",
8852
- never: "never",
8853
- map: "hart\u0103",
8854
- set: "set"
8855
- };
8856
- return (issue2) => {
8857
- switch (issue2.code) {
8858
- case "invalid_type": {
8859
- const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
8860
- const receivedType = parsedType(issue2.input);
8861
- const received = TypeDictionary[receivedType] ?? receivedType;
8862
- return `Intrare invalid\u0103: a\u0219teptat ${expected}, primit ${received}`;
8863
- }
8864
- case "invalid_value":
8865
- if (issue2.values.length === 1)
8866
- return `Intrare invalid\u0103: a\u0219teptat ${stringifyPrimitive(issue2.values[0])}`;
8867
- return `Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${joinValues(issue2.values, "|")}`;
8868
- case "too_big": {
8869
- const adj = issue2.inclusive ? "<=" : "<";
8870
- const sizing = getSizing(issue2.origin);
8871
- if (sizing)
8872
- return `Prea mare: a\u0219teptat ca ${issue2.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemente"}`;
8873
- return `Prea mare: a\u0219teptat ca ${issue2.origin ?? "valoarea"} s\u0103 fie ${adj}${issue2.maximum.toString()}`;
8874
- }
8875
- case "too_small": {
8876
- const adj = issue2.inclusive ? ">=" : ">";
8877
- const sizing = getSizing(issue2.origin);
8878
- if (sizing) {
8879
- return `Prea mic: a\u0219teptat ca ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
8880
- }
8881
- return `Prea mic: a\u0219teptat ca ${issue2.origin} s\u0103 fie ${adj}${issue2.minimum.toString()}`;
8882
- }
8883
- case "invalid_format": {
8884
- const _issue = issue2;
8885
- if (_issue.format === "starts_with") {
8886
- return `\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${_issue.prefix}"`;
8887
- }
8888
- if (_issue.format === "ends_with")
8889
- return `\u0218ir invalid: trebuie s\u0103 se termine cu "${_issue.suffix}"`;
8890
- if (_issue.format === "includes")
8891
- return `\u0218ir invalid: trebuie s\u0103 includ\u0103 "${_issue.includes}"`;
8892
- if (_issue.format === "regex")
8893
- return `\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${_issue.pattern}`;
8894
- return `Format invalid: ${FormatDictionary[_issue.format] ?? issue2.format}`;
8895
- }
8896
- case "not_multiple_of":
8897
- return `Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${issue2.divisor}`;
8898
- case "unrecognized_keys":
8899
- return `Chei nerecunoscute: ${joinValues(issue2.keys, ", ")}`;
8900
- case "invalid_key":
8901
- return `Cheie invalid\u0103 \xEEn ${issue2.origin}`;
8902
- case "invalid_union":
8903
- return "Intrare invalid\u0103";
8904
- case "invalid_element":
8905
- return `Valoare invalid\u0103 \xEEn ${issue2.origin}`;
8906
- default:
8907
- return `Intrare invalid\u0103`;
8908
- }
8909
- };
8910
- };
8911
- function ro_default() {
8912
- return {
8913
- localeError: error37()
8389
+ localeError: error34()
8914
8390
  };
8915
8391
  }
8916
8392
  // node_modules/zod/v4/locales/ru.js
@@ -8929,7 +8405,7 @@ function getRussianPlural(count, one, few, many) {
8929
8405
  }
8930
8406
  return many;
8931
8407
  }
8932
- var error38 = () => {
8408
+ var error35 = () => {
8933
8409
  const Sizable = {
8934
8410
  string: {
8935
8411
  unit: {
@@ -9066,11 +8542,11 @@ var error38 = () => {
9066
8542
  };
9067
8543
  function ru_default() {
9068
8544
  return {
9069
- localeError: error38()
8545
+ localeError: error35()
9070
8546
  };
9071
8547
  }
9072
8548
  // node_modules/zod/v4/locales/sl.js
9073
- var error39 = () => {
8549
+ var error36 = () => {
9074
8550
  const Sizable = {
9075
8551
  string: { unit: "znakov", verb: "imeti" },
9076
8552
  file: { unit: "bajtov", verb: "imeti" },
@@ -9175,11 +8651,11 @@ var error39 = () => {
9175
8651
  };
9176
8652
  function sl_default() {
9177
8653
  return {
9178
- localeError: error39()
8654
+ localeError: error36()
9179
8655
  };
9180
8656
  }
9181
8657
  // node_modules/zod/v4/locales/sv.js
9182
- var error40 = () => {
8658
+ var error37 = () => {
9183
8659
  const Sizable = {
9184
8660
  string: { unit: "tecken", verb: "att ha" },
9185
8661
  file: { unit: "bytes", verb: "att ha" },
@@ -9285,11 +8761,11 @@ var error40 = () => {
9285
8761
  };
9286
8762
  function sv_default() {
9287
8763
  return {
9288
- localeError: error40()
8764
+ localeError: error37()
9289
8765
  };
9290
8766
  }
9291
8767
  // node_modules/zod/v4/locales/ta.js
9292
- var error41 = () => {
8768
+ var error38 = () => {
9293
8769
  const Sizable = {
9294
8770
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
9295
8771
  file: { unit: "\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -9395,11 +8871,11 @@ var error41 = () => {
9395
8871
  };
9396
8872
  function ta_default() {
9397
8873
  return {
9398
- localeError: error41()
8874
+ localeError: error38()
9399
8875
  };
9400
8876
  }
9401
8877
  // node_modules/zod/v4/locales/th.js
9402
- var error42 = () => {
8878
+ var error39 = () => {
9403
8879
  const Sizable = {
9404
8880
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
9405
8881
  file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -9505,11 +8981,11 @@ var error42 = () => {
9505
8981
  };
9506
8982
  function th_default() {
9507
8983
  return {
9508
- localeError: error42()
8984
+ localeError: error39()
9509
8985
  };
9510
8986
  }
9511
8987
  // node_modules/zod/v4/locales/tr.js
9512
- var error43 = () => {
8988
+ var error40 = () => {
9513
8989
  const Sizable = {
9514
8990
  string: { unit: "karakter", verb: "olmal\u0131" },
9515
8991
  file: { unit: "bayt", verb: "olmal\u0131" },
@@ -9610,11 +9086,11 @@ var error43 = () => {
9610
9086
  };
9611
9087
  function tr_default() {
9612
9088
  return {
9613
- localeError: error43()
9089
+ localeError: error40()
9614
9090
  };
9615
9091
  }
9616
9092
  // node_modules/zod/v4/locales/uk.js
9617
- var error44 = () => {
9093
+ var error41 = () => {
9618
9094
  const Sizable = {
9619
9095
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
9620
9096
  file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -9718,7 +9194,7 @@ var error44 = () => {
9718
9194
  };
9719
9195
  function uk_default() {
9720
9196
  return {
9721
- localeError: error44()
9197
+ localeError: error41()
9722
9198
  };
9723
9199
  }
9724
9200
 
@@ -9727,7 +9203,7 @@ function ua_default() {
9727
9203
  return uk_default();
9728
9204
  }
9729
9205
  // node_modules/zod/v4/locales/ur.js
9730
- var error45 = () => {
9206
+ var error42 = () => {
9731
9207
  const Sizable = {
9732
9208
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
9733
9209
  file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" },
@@ -9833,17 +9309,16 @@ var error45 = () => {
9833
9309
  };
9834
9310
  function ur_default() {
9835
9311
  return {
9836
- localeError: error45()
9312
+ localeError: error42()
9837
9313
  };
9838
9314
  }
9839
9315
  // node_modules/zod/v4/locales/uz.js
9840
- var error46 = () => {
9316
+ var error43 = () => {
9841
9317
  const Sizable = {
9842
9318
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
9843
9319
  file: { unit: "bayt", verb: "bo\u2018lishi kerak" },
9844
9320
  array: { unit: "element", verb: "bo\u2018lishi kerak" },
9845
- set: { unit: "element", verb: "bo\u2018lishi kerak" },
9846
- map: { unit: "yozuv", verb: "bo\u2018lishi kerak" }
9321
+ set: { unit: "element", verb: "bo\u2018lishi kerak" }
9847
9322
  };
9848
9323
  function getSizing(origin) {
9849
9324
  return Sizable[origin] ?? null;
@@ -9943,11 +9418,11 @@ var error46 = () => {
9943
9418
  };
9944
9419
  function uz_default() {
9945
9420
  return {
9946
- localeError: error46()
9421
+ localeError: error43()
9947
9422
  };
9948
9423
  }
9949
9424
  // node_modules/zod/v4/locales/vi.js
9950
- var error47 = () => {
9425
+ var error44 = () => {
9951
9426
  const Sizable = {
9952
9427
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
9953
9428
  file: { unit: "byte", verb: "c\xF3" },
@@ -10051,11 +9526,11 @@ var error47 = () => {
10051
9526
  };
10052
9527
  function vi_default() {
10053
9528
  return {
10054
- localeError: error47()
9529
+ localeError: error44()
10055
9530
  };
10056
9531
  }
10057
9532
  // node_modules/zod/v4/locales/zh-CN.js
10058
- var error48 = () => {
9533
+ var error45 = () => {
10059
9534
  const Sizable = {
10060
9535
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
10061
9536
  file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" },
@@ -10160,11 +9635,11 @@ var error48 = () => {
10160
9635
  };
10161
9636
  function zh_CN_default() {
10162
9637
  return {
10163
- localeError: error48()
9638
+ localeError: error45()
10164
9639
  };
10165
9640
  }
10166
9641
  // node_modules/zod/v4/locales/zh-TW.js
10167
- var error49 = () => {
9642
+ var error46 = () => {
10168
9643
  const Sizable = {
10169
9644
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
10170
9645
  file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" },
@@ -10267,11 +9742,11 @@ var error49 = () => {
10267
9742
  };
10268
9743
  function zh_TW_default() {
10269
9744
  return {
10270
- localeError: error49()
9745
+ localeError: error46()
10271
9746
  };
10272
9747
  }
10273
9748
  // node_modules/zod/v4/locales/yo.js
10274
- var error50 = () => {
9749
+ var error47 = () => {
10275
9750
  const Sizable = {
10276
9751
  string: { unit: "\xE0mi", verb: "n\xED" },
10277
9752
  file: { unit: "bytes", verb: "n\xED" },
@@ -10374,11 +9849,11 @@ var error50 = () => {
10374
9849
  };
10375
9850
  function yo_default() {
10376
9851
  return {
10377
- localeError: error50()
9852
+ localeError: error47()
10378
9853
  };
10379
9854
  }
10380
9855
  // node_modules/zod/v4/core/registries.js
10381
- var _a2;
9856
+ var _a;
10382
9857
  var $output = Symbol("ZodOutput");
10383
9858
  var $input = Symbol("ZodInput");
10384
9859
 
@@ -10425,7 +9900,7 @@ class $ZodRegistry {
10425
9900
  function registry() {
10426
9901
  return new $ZodRegistry;
10427
9902
  }
10428
- (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
9903
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
10429
9904
  var globalRegistry = globalThis.__zod_globalRegistry;
10430
9905
  // node_modules/zod/v4/core/api.js
10431
9906
  function _string(Class2, params) {
@@ -11231,7 +10706,7 @@ function _refine(Class2, fn, _params) {
11231
10706
  });
11232
10707
  return schema;
11233
10708
  }
11234
- function _superRefine(fn, params) {
10709
+ function _superRefine(fn) {
11235
10710
  const ch = _check((payload) => {
11236
10711
  payload.addIssue = (issue2) => {
11237
10712
  if (typeof issue2 === "string") {
@@ -11248,7 +10723,7 @@ function _superRefine(fn, params) {
11248
10723
  }
11249
10724
  };
11250
10725
  return fn(payload.value, payload);
11251
- }, params);
10726
+ });
11252
10727
  return ch;
11253
10728
  }
11254
10729
  function _check(fn, params) {
@@ -11369,7 +10844,7 @@ function initializeContext(params) {
11369
10844
  };
11370
10845
  }
11371
10846
  function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
11372
- var _a3;
10847
+ var _a2;
11373
10848
  const def = schema._zod.def;
11374
10849
  const seen = ctx.seen.get(schema);
11375
10850
  if (seen) {
@@ -11416,8 +10891,8 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
11416
10891
  delete result.schema.examples;
11417
10892
  delete result.schema.default;
11418
10893
  }
11419
- if (ctx.io === "input" && "_prefault" in result.schema)
11420
- (_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
10894
+ if (ctx.io === "input" && result.schema._prefault)
10895
+ (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
11421
10896
  delete result.schema._prefault;
11422
10897
  const _result = ctx.seen.get(schema);
11423
10898
  return _result.schema;
@@ -11594,15 +11069,10 @@ function finalize(ctx, schema) {
11594
11069
  result.$id = ctx.external.uri(id);
11595
11070
  }
11596
11071
  Object.assign(result, root.def ?? root.schema);
11597
- const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
11598
- if (rootMetaId !== undefined && result.id === rootMetaId)
11599
- delete result.id;
11600
11072
  const defs = ctx.external?.defs ?? {};
11601
11073
  for (const entry of ctx.seen.entries()) {
11602
11074
  const seen = entry[1];
11603
11075
  if (seen.def && seen.defId) {
11604
- if (seen.def.id === seen.defId)
11605
- delete seen.def.id;
11606
11076
  defs[seen.defId] = seen.def;
11607
11077
  }
11608
11078
  }
@@ -11657,8 +11127,6 @@ function isTransforming(_schema, _ctx) {
11657
11127
  return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
11658
11128
  }
11659
11129
  if (def.type === "pipe") {
11660
- if (_schema._zod.traits.has("$ZodCodec"))
11661
- return true;
11662
11130
  return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
11663
11131
  }
11664
11132
  if (def.type === "object") {
@@ -11746,28 +11214,39 @@ var numberProcessor = (schema, ctx, _json, _params) => {
11746
11214
  json.type = "integer";
11747
11215
  else
11748
11216
  json.type = "number";
11749
- const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
11750
- const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
11751
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
11752
- if (exMin) {
11753
- if (legacy) {
11217
+ if (typeof exclusiveMinimum === "number") {
11218
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
11754
11219
  json.minimum = exclusiveMinimum;
11755
11220
  json.exclusiveMinimum = true;
11756
11221
  } else {
11757
11222
  json.exclusiveMinimum = exclusiveMinimum;
11758
11223
  }
11759
- } else if (typeof minimum === "number") {
11224
+ }
11225
+ if (typeof minimum === "number") {
11760
11226
  json.minimum = minimum;
11227
+ if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
11228
+ if (exclusiveMinimum >= minimum)
11229
+ delete json.minimum;
11230
+ else
11231
+ delete json.exclusiveMinimum;
11232
+ }
11761
11233
  }
11762
- if (exMax) {
11763
- if (legacy) {
11234
+ if (typeof exclusiveMaximum === "number") {
11235
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
11764
11236
  json.maximum = exclusiveMaximum;
11765
11237
  json.exclusiveMaximum = true;
11766
11238
  } else {
11767
11239
  json.exclusiveMaximum = exclusiveMaximum;
11768
11240
  }
11769
- } else if (typeof maximum === "number") {
11241
+ }
11242
+ if (typeof maximum === "number") {
11770
11243
  json.maximum = maximum;
11244
+ if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
11245
+ if (exclusiveMaximum <= maximum)
11246
+ delete json.maximum;
11247
+ else
11248
+ delete json.exclusiveMaximum;
11249
+ }
11771
11250
  }
11772
11251
  if (typeof multipleOf === "number")
11773
11252
  json.multipleOf = multipleOf;
@@ -11935,10 +11414,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
11935
11414
  if (typeof maximum === "number")
11936
11415
  json.maxItems = maximum;
11937
11416
  json.type = "array";
11938
- json.items = process2(def.element, ctx, {
11939
- ...params,
11940
- path: [...params.path, "items"]
11941
- });
11417
+ json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
11942
11418
  };
11943
11419
  var objectProcessor = (schema, ctx, _json, params) => {
11944
11420
  const json = _json;
@@ -12131,8 +11607,7 @@ var catchProcessor = (schema, ctx, json, params) => {
12131
11607
  };
12132
11608
  var pipeProcessor = (schema, ctx, _json, params) => {
12133
11609
  const def = schema._zod.def;
12134
- const inIsTransform = def.in._zod.traits.has("$ZodTransform");
12135
- const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
11610
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
12136
11611
  process2(innerType, ctx, params);
12137
11612
  const seen = ctx.seen.get(schema);
12138
11613
  seen.ref = innerType;
@@ -12358,7 +11833,6 @@ __export(exports_schemas2, {
12358
11833
  json: () => json,
12359
11834
  ipv6: () => ipv62,
12360
11835
  ipv4: () => ipv42,
12361
- invertCodec: () => invertCodec,
12362
11836
  intersection: () => intersection,
12363
11837
  int64: () => int64,
12364
11838
  int32: () => int32,
@@ -12419,7 +11893,6 @@ __export(exports_schemas2, {
12419
11893
  ZodRecord: () => ZodRecord,
12420
11894
  ZodReadonly: () => ZodReadonly,
12421
11895
  ZodPromise: () => ZodPromise,
12422
- ZodPreprocess: () => ZodPreprocess,
12423
11896
  ZodPrefault: () => ZodPrefault,
12424
11897
  ZodPipe: () => ZodPipe,
12425
11898
  ZodOptional: () => ZodOptional,
@@ -12574,8 +12047,8 @@ var initializer2 = (inst, issues) => {
12574
12047
  }
12575
12048
  });
12576
12049
  };
12577
- var ZodError = /* @__PURE__ */ $constructor("ZodError", initializer2);
12578
- var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
12050
+ var ZodError = $constructor("ZodError", initializer2);
12051
+ var ZodRealError = $constructor("ZodError", initializer2, {
12579
12052
  Parent: Error
12580
12053
  });
12581
12054
 
@@ -12594,43 +12067,6 @@ var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
12594
12067
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
12595
12068
 
12596
12069
  // node_modules/zod/v4/classic/schemas.js
12597
- var _installedGroups = /* @__PURE__ */ new WeakMap;
12598
- function _installLazyMethods(inst, group, methods) {
12599
- const proto = Object.getPrototypeOf(inst);
12600
- let installed = _installedGroups.get(proto);
12601
- if (!installed) {
12602
- installed = new Set;
12603
- _installedGroups.set(proto, installed);
12604
- }
12605
- if (installed.has(group))
12606
- return;
12607
- installed.add(group);
12608
- for (const key in methods) {
12609
- const fn = methods[key];
12610
- Object.defineProperty(proto, key, {
12611
- configurable: true,
12612
- enumerable: false,
12613
- get() {
12614
- const bound = fn.bind(this);
12615
- Object.defineProperty(this, key, {
12616
- configurable: true,
12617
- writable: true,
12618
- enumerable: true,
12619
- value: bound
12620
- });
12621
- return bound;
12622
- },
12623
- set(v) {
12624
- Object.defineProperty(this, key, {
12625
- configurable: true,
12626
- writable: true,
12627
- enumerable: true,
12628
- value: v
12629
- });
12630
- }
12631
- });
12632
- }
12633
- }
12634
12070
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
12635
12071
  $ZodType.init(inst, def);
12636
12072
  Object.assign(inst["~standard"], {
@@ -12643,6 +12079,23 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
12643
12079
  inst.def = def;
12644
12080
  inst.type = def.type;
12645
12081
  Object.defineProperty(inst, "_def", { value: def });
12082
+ inst.check = (...checks2) => {
12083
+ return inst.clone(exports_util.mergeDefs(def, {
12084
+ checks: [
12085
+ ...def.checks ?? [],
12086
+ ...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
12087
+ ]
12088
+ }), {
12089
+ parent: true
12090
+ });
12091
+ };
12092
+ inst.with = inst.check;
12093
+ inst.clone = (def2, params) => clone(inst, def2, params);
12094
+ inst.brand = () => inst;
12095
+ inst.register = (reg, meta2) => {
12096
+ reg.add(inst, meta2);
12097
+ return inst;
12098
+ };
12646
12099
  inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
12647
12100
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
12648
12101
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
@@ -12656,108 +12109,45 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
12656
12109
  inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
12657
12110
  inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
12658
12111
  inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
12659
- _installLazyMethods(inst, "ZodType", {
12660
- check(...chks) {
12661
- const def2 = this.def;
12662
- return this.clone(exports_util.mergeDefs(def2, {
12663
- checks: [
12664
- ...def2.checks ?? [],
12665
- ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
12666
- ]
12667
- }), { parent: true });
12668
- },
12669
- with(...chks) {
12670
- return this.check(...chks);
12671
- },
12672
- clone(def2, params) {
12673
- return clone(this, def2, params);
12674
- },
12675
- brand() {
12676
- return this;
12677
- },
12678
- register(reg, meta2) {
12679
- reg.add(this, meta2);
12680
- return this;
12681
- },
12682
- refine(check, params) {
12683
- return this.check(refine(check, params));
12684
- },
12685
- superRefine(refinement, params) {
12686
- return this.check(superRefine(refinement, params));
12687
- },
12688
- overwrite(fn) {
12689
- return this.check(_overwrite(fn));
12690
- },
12691
- optional() {
12692
- return optional(this);
12693
- },
12694
- exactOptional() {
12695
- return exactOptional(this);
12696
- },
12697
- nullable() {
12698
- return nullable(this);
12699
- },
12700
- nullish() {
12701
- return optional(nullable(this));
12702
- },
12703
- nonoptional(params) {
12704
- return nonoptional(this, params);
12705
- },
12706
- array() {
12707
- return array(this);
12708
- },
12709
- or(arg) {
12710
- return union([this, arg]);
12711
- },
12712
- and(arg) {
12713
- return intersection(this, arg);
12714
- },
12715
- transform(tx) {
12716
- return pipe(this, transform(tx));
12717
- },
12718
- default(d) {
12719
- return _default2(this, d);
12720
- },
12721
- prefault(d) {
12722
- return prefault(this, d);
12723
- },
12724
- catch(params) {
12725
- return _catch2(this, params);
12726
- },
12727
- pipe(target) {
12728
- return pipe(this, target);
12729
- },
12730
- readonly() {
12731
- return readonly(this);
12732
- },
12733
- describe(description) {
12734
- const cl = this.clone();
12735
- globalRegistry.add(cl, { description });
12736
- return cl;
12737
- },
12738
- meta(...args) {
12739
- if (args.length === 0)
12740
- return globalRegistry.get(this);
12741
- const cl = this.clone();
12742
- globalRegistry.add(cl, args[0]);
12743
- return cl;
12744
- },
12745
- isOptional() {
12746
- return this.safeParse(undefined).success;
12747
- },
12748
- isNullable() {
12749
- return this.safeParse(null).success;
12750
- },
12751
- apply(fn) {
12752
- return fn(this);
12753
- }
12754
- });
12112
+ inst.refine = (check, params) => inst.check(refine(check, params));
12113
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
12114
+ inst.overwrite = (fn) => inst.check(_overwrite(fn));
12115
+ inst.optional = () => optional(inst);
12116
+ inst.exactOptional = () => exactOptional(inst);
12117
+ inst.nullable = () => nullable(inst);
12118
+ inst.nullish = () => optional(nullable(inst));
12119
+ inst.nonoptional = (params) => nonoptional(inst, params);
12120
+ inst.array = () => array(inst);
12121
+ inst.or = (arg) => union([inst, arg]);
12122
+ inst.and = (arg) => intersection(inst, arg);
12123
+ inst.transform = (tx) => pipe(inst, transform(tx));
12124
+ inst.default = (def2) => _default2(inst, def2);
12125
+ inst.prefault = (def2) => prefault(inst, def2);
12126
+ inst.catch = (params) => _catch2(inst, params);
12127
+ inst.pipe = (target) => pipe(inst, target);
12128
+ inst.readonly = () => readonly(inst);
12129
+ inst.describe = (description) => {
12130
+ const cl = inst.clone();
12131
+ globalRegistry.add(cl, { description });
12132
+ return cl;
12133
+ };
12755
12134
  Object.defineProperty(inst, "description", {
12756
12135
  get() {
12757
12136
  return globalRegistry.get(inst)?.description;
12758
12137
  },
12759
12138
  configurable: true
12760
12139
  });
12140
+ inst.meta = (...args) => {
12141
+ if (args.length === 0) {
12142
+ return globalRegistry.get(inst);
12143
+ }
12144
+ const cl = inst.clone();
12145
+ globalRegistry.add(cl, args[0]);
12146
+ return cl;
12147
+ };
12148
+ inst.isOptional = () => inst.safeParse(undefined).success;
12149
+ inst.isNullable = () => inst.safeParse(null).success;
12150
+ inst.apply = (fn) => fn(inst);
12761
12151
  return inst;
12762
12152
  });
12763
12153
  var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
@@ -12768,53 +12158,21 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
12768
12158
  inst.format = bag.format ?? null;
12769
12159
  inst.minLength = bag.minimum ?? null;
12770
12160
  inst.maxLength = bag.maximum ?? null;
12771
- _installLazyMethods(inst, "_ZodString", {
12772
- regex(...args) {
12773
- return this.check(_regex(...args));
12774
- },
12775
- includes(...args) {
12776
- return this.check(_includes(...args));
12777
- },
12778
- startsWith(...args) {
12779
- return this.check(_startsWith(...args));
12780
- },
12781
- endsWith(...args) {
12782
- return this.check(_endsWith(...args));
12783
- },
12784
- min(...args) {
12785
- return this.check(_minLength(...args));
12786
- },
12787
- max(...args) {
12788
- return this.check(_maxLength(...args));
12789
- },
12790
- length(...args) {
12791
- return this.check(_length(...args));
12792
- },
12793
- nonempty(...args) {
12794
- return this.check(_minLength(1, ...args));
12795
- },
12796
- lowercase(params) {
12797
- return this.check(_lowercase(params));
12798
- },
12799
- uppercase(params) {
12800
- return this.check(_uppercase(params));
12801
- },
12802
- trim() {
12803
- return this.check(_trim());
12804
- },
12805
- normalize(...args) {
12806
- return this.check(_normalize(...args));
12807
- },
12808
- toLowerCase() {
12809
- return this.check(_toLowerCase());
12810
- },
12811
- toUpperCase() {
12812
- return this.check(_toUpperCase());
12813
- },
12814
- slugify() {
12815
- return this.check(_slugify());
12816
- }
12817
- });
12161
+ inst.regex = (...args) => inst.check(_regex(...args));
12162
+ inst.includes = (...args) => inst.check(_includes(...args));
12163
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
12164
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
12165
+ inst.min = (...args) => inst.check(_minLength(...args));
12166
+ inst.max = (...args) => inst.check(_maxLength(...args));
12167
+ inst.length = (...args) => inst.check(_length(...args));
12168
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
12169
+ inst.lowercase = (params) => inst.check(_lowercase(params));
12170
+ inst.uppercase = (params) => inst.check(_uppercase(params));
12171
+ inst.trim = () => inst.check(_trim());
12172
+ inst.normalize = (...args) => inst.check(_normalize(...args));
12173
+ inst.toLowerCase = () => inst.check(_toLowerCase());
12174
+ inst.toUpperCase = () => inst.check(_toUpperCase());
12175
+ inst.slugify = () => inst.check(_slugify());
12818
12176
  });
12819
12177
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
12820
12178
  $ZodString.init(inst, def);
@@ -12893,7 +12251,7 @@ function url(params) {
12893
12251
  }
12894
12252
  function httpUrl(params) {
12895
12253
  return _url(ZodURL, {
12896
- protocol: exports_regexes.httpProtocol,
12254
+ protocol: /^https?$/,
12897
12255
  hostname: exports_regexes.domain,
12898
12256
  ...exports_util.normalizeParams(params)
12899
12257
  });
@@ -13035,53 +12393,21 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
13035
12393
  $ZodNumber.init(inst, def);
13036
12394
  ZodType.init(inst, def);
13037
12395
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
13038
- _installLazyMethods(inst, "ZodNumber", {
13039
- gt(value, params) {
13040
- return this.check(_gt(value, params));
13041
- },
13042
- gte(value, params) {
13043
- return this.check(_gte(value, params));
13044
- },
13045
- min(value, params) {
13046
- return this.check(_gte(value, params));
13047
- },
13048
- lt(value, params) {
13049
- return this.check(_lt(value, params));
13050
- },
13051
- lte(value, params) {
13052
- return this.check(_lte(value, params));
13053
- },
13054
- max(value, params) {
13055
- return this.check(_lte(value, params));
13056
- },
13057
- int(params) {
13058
- return this.check(int(params));
13059
- },
13060
- safe(params) {
13061
- return this.check(int(params));
13062
- },
13063
- positive(params) {
13064
- return this.check(_gt(0, params));
13065
- },
13066
- nonnegative(params) {
13067
- return this.check(_gte(0, params));
13068
- },
13069
- negative(params) {
13070
- return this.check(_lt(0, params));
13071
- },
13072
- nonpositive(params) {
13073
- return this.check(_lte(0, params));
13074
- },
13075
- multipleOf(value, params) {
13076
- return this.check(_multipleOf(value, params));
13077
- },
13078
- step(value, params) {
13079
- return this.check(_multipleOf(value, params));
13080
- },
13081
- finite() {
13082
- return this;
13083
- }
13084
- });
12396
+ inst.gt = (value, params) => inst.check(_gt(value, params));
12397
+ inst.gte = (value, params) => inst.check(_gte(value, params));
12398
+ inst.min = (value, params) => inst.check(_gte(value, params));
12399
+ inst.lt = (value, params) => inst.check(_lt(value, params));
12400
+ inst.lte = (value, params) => inst.check(_lte(value, params));
12401
+ inst.max = (value, params) => inst.check(_lte(value, params));
12402
+ inst.int = (params) => inst.check(int(params));
12403
+ inst.safe = (params) => inst.check(int(params));
12404
+ inst.positive = (params) => inst.check(_gt(0, params));
12405
+ inst.nonnegative = (params) => inst.check(_gte(0, params));
12406
+ inst.negative = (params) => inst.check(_lt(0, params));
12407
+ inst.nonpositive = (params) => inst.check(_lte(0, params));
12408
+ inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
12409
+ inst.step = (value, params) => inst.check(_multipleOf(value, params));
12410
+ inst.finite = () => inst;
13085
12411
  const bag = inst._zod.bag;
13086
12412
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
13087
12413
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
@@ -13228,23 +12554,11 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
13228
12554
  ZodType.init(inst, def);
13229
12555
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
13230
12556
  inst.element = def.element;
13231
- _installLazyMethods(inst, "ZodArray", {
13232
- min(n, params) {
13233
- return this.check(_minLength(n, params));
13234
- },
13235
- nonempty(params) {
13236
- return this.check(_minLength(1, params));
13237
- },
13238
- max(n, params) {
13239
- return this.check(_maxLength(n, params));
13240
- },
13241
- length(n, params) {
13242
- return this.check(_length(n, params));
13243
- },
13244
- unwrap() {
13245
- return this.element;
13246
- }
13247
- });
12557
+ inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
12558
+ inst.nonempty = (params) => inst.check(_minLength(1, params));
12559
+ inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
12560
+ inst.length = (len, params) => inst.check(_length(len, params));
12561
+ inst.unwrap = () => inst.element;
13248
12562
  });
13249
12563
  function array(element, params) {
13250
12564
  return _array(ZodArray, element, params);
@@ -13260,47 +12574,23 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
13260
12574
  exports_util.defineLazy(inst, "shape", () => {
13261
12575
  return def.shape;
13262
12576
  });
13263
- _installLazyMethods(inst, "ZodObject", {
13264
- keyof() {
13265
- return _enum2(Object.keys(this._zod.def.shape));
13266
- },
13267
- catchall(catchall) {
13268
- return this.clone({ ...this._zod.def, catchall });
13269
- },
13270
- passthrough() {
13271
- return this.clone({ ...this._zod.def, catchall: unknown() });
13272
- },
13273
- loose() {
13274
- return this.clone({ ...this._zod.def, catchall: unknown() });
13275
- },
13276
- strict() {
13277
- return this.clone({ ...this._zod.def, catchall: never() });
13278
- },
13279
- strip() {
13280
- return this.clone({ ...this._zod.def, catchall: undefined });
13281
- },
13282
- extend(incoming) {
13283
- return exports_util.extend(this, incoming);
13284
- },
13285
- safeExtend(incoming) {
13286
- return exports_util.safeExtend(this, incoming);
13287
- },
13288
- merge(other) {
13289
- return exports_util.merge(this, other);
13290
- },
13291
- pick(mask) {
13292
- return exports_util.pick(this, mask);
13293
- },
13294
- omit(mask) {
13295
- return exports_util.omit(this, mask);
13296
- },
13297
- partial(...args) {
13298
- return exports_util.partial(ZodOptional, this, args[0]);
13299
- },
13300
- required(...args) {
13301
- return exports_util.required(ZodNonOptional, this, args[0]);
13302
- }
13303
- });
12577
+ inst.keyof = () => _enum2(Object.keys(inst._zod.def.shape));
12578
+ inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
12579
+ inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
12580
+ inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
12581
+ inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
12582
+ inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
12583
+ inst.extend = (incoming) => {
12584
+ return exports_util.extend(inst, incoming);
12585
+ };
12586
+ inst.safeExtend = (incoming) => {
12587
+ return exports_util.safeExtend(inst, incoming);
12588
+ };
12589
+ inst.merge = (other) => exports_util.merge(inst, other);
12590
+ inst.pick = (mask) => exports_util.pick(inst, mask);
12591
+ inst.omit = (mask) => exports_util.omit(inst, mask);
12592
+ inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);
12593
+ inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);
13304
12594
  });
13305
12595
  function object(shape, params) {
13306
12596
  const def = {
@@ -13405,14 +12695,6 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
13405
12695
  inst.valueType = def.valueType;
13406
12696
  });
13407
12697
  function record(keyType, valueType, params) {
13408
- if (!valueType || !valueType._zod) {
13409
- return new ZodRecord({
13410
- type: "record",
13411
- keyType: string2(),
13412
- valueType: keyType,
13413
- ...exports_util.normalizeParams(valueType)
13414
- });
13415
- }
13416
12698
  return new ZodRecord({
13417
12699
  type: "record",
13418
12700
  keyType,
@@ -13584,12 +12866,10 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
13584
12866
  if (output instanceof Promise) {
13585
12867
  return output.then((output2) => {
13586
12868
  payload.value = output2;
13587
- payload.fallback = true;
13588
12869
  return payload;
13589
12870
  });
13590
12871
  }
13591
12872
  payload.value = output;
13592
- payload.fallback = true;
13593
12873
  return payload;
13594
12874
  };
13595
12875
  });
@@ -13743,20 +13023,6 @@ function codec(in_, out, params) {
13743
13023
  reverseTransform: params.encode
13744
13024
  });
13745
13025
  }
13746
- function invertCodec(codec2) {
13747
- const def = codec2._zod.def;
13748
- return new ZodCodec({
13749
- type: "pipe",
13750
- in: def.out,
13751
- out: def.in,
13752
- transform: def.reverseTransform,
13753
- reverseTransform: def.transform
13754
- });
13755
- }
13756
- var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
13757
- ZodPipe.init(inst, def);
13758
- $ZodPreprocess.init(inst, def);
13759
- });
13760
13026
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
13761
13027
  $ZodReadonly.init(inst, def);
13762
13028
  ZodType.init(inst, def);
@@ -13835,8 +13101,8 @@ function custom(fn, _params) {
13835
13101
  function refine(fn, _params = {}) {
13836
13102
  return _refine(ZodCustom, fn, _params);
13837
13103
  }
13838
- function superRefine(fn, params) {
13839
- return _superRefine(fn, params);
13104
+ function superRefine(fn) {
13105
+ return _superRefine(fn);
13840
13106
  }
13841
13107
  var describe2 = describe;
13842
13108
  var meta2 = meta;
@@ -13874,11 +13140,7 @@ function json(params) {
13874
13140
  return jsonSchema;
13875
13141
  }
13876
13142
  function preprocess(fn, schema) {
13877
- return new ZodPreprocess({
13878
- type: "pipe",
13879
- in: transform(fn),
13880
- out: schema
13881
- });
13143
+ return pipe(transform(fn), schema);
13882
13144
  }
13883
13145
  // node_modules/zod/v4/classic/compat.js
13884
13146
  var ZodIssueCode = {
@@ -13910,7 +13172,7 @@ var z = {
13910
13172
  ...exports_checks2,
13911
13173
  iso: exports_iso
13912
13174
  };
13913
- var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
13175
+ var RECOGNIZED_KEYS = new Set([
13914
13176
  "$schema",
13915
13177
  "$ref",
13916
13178
  "$defs",
@@ -14284,6 +13546,12 @@ function convertBaseSchema(schema, ctx) {
14284
13546
  default:
14285
13547
  throw new Error(`Unsupported type: ${type}`);
14286
13548
  }
13549
+ if (schema.description) {
13550
+ zodSchema = zodSchema.describe(schema.description);
13551
+ }
13552
+ if (schema.default !== undefined) {
13553
+ zodSchema = zodSchema.default(schema.default);
13554
+ }
14287
13555
  return zodSchema;
14288
13556
  }
14289
13557
  function convertSchema(schema, ctx) {
@@ -14320,9 +13588,6 @@ function convertSchema(schema, ctx) {
14320
13588
  if (schema.readOnly === true) {
14321
13589
  baseSchema = z.readonly(baseSchema);
14322
13590
  }
14323
- if (schema.default !== undefined) {
14324
- baseSchema = baseSchema.default(schema.default);
14325
- }
14326
13591
  const extraMeta = {};
14327
13592
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
14328
13593
  for (const key of coreMetadataKeys) {
@@ -14344,32 +13609,23 @@ function convertSchema(schema, ctx) {
14344
13609
  if (Object.keys(extraMeta).length > 0) {
14345
13610
  ctx.registry.add(baseSchema, extraMeta);
14346
13611
  }
14347
- if (schema.description) {
14348
- baseSchema = baseSchema.describe(schema.description);
14349
- }
14350
13612
  return baseSchema;
14351
13613
  }
14352
13614
  function fromJSONSchema(schema, params) {
14353
13615
  if (typeof schema === "boolean") {
14354
13616
  return schema ? z.any() : z.never();
14355
13617
  }
14356
- let normalized;
14357
- try {
14358
- normalized = JSON.parse(JSON.stringify(schema));
14359
- } catch {
14360
- throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
14361
- }
14362
- const version2 = detectVersion(normalized, params?.defaultTarget);
14363
- const defs = normalized.$defs || normalized.definitions || {};
13618
+ const version2 = detectVersion(schema, params?.defaultTarget);
13619
+ const defs = schema.$defs || schema.definitions || {};
14364
13620
  const ctx = {
14365
13621
  version: version2,
14366
13622
  defs,
14367
13623
  refs: new Map,
14368
13624
  processing: new Set,
14369
- rootSchema: normalized,
13625
+ rootSchema: schema,
14370
13626
  registry: params?.registry ?? globalRegistry
14371
13627
  };
14372
- return convertSchema(normalized, ctx);
13628
+ return convertSchema(schema, ctx);
14373
13629
  }
14374
13630
  // node_modules/zod/v4/classic/coerce.js
14375
13631
  var exports_coerce = {};
@@ -14398,23 +13654,202 @@ function date4(params) {
14398
13654
 
14399
13655
  // node_modules/zod/v4/classic/external.js
14400
13656
  config(en_default());
13657
+ // src/mcp.js
13658
+ import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
13659
+ // package.json
13660
+ var package_default = {
13661
+ name: "@hasna/knowledge",
13662
+ version: "0.2.4",
13663
+ description: "Agent-friendly local knowledge CLI with JSON output, pagination, and safe destructive actions",
13664
+ type: "module",
13665
+ bin: {
13666
+ "open-knowledge": "./bin/open-knowledge.js",
13667
+ "open-knowledge-mcp": "./bin/open-knowledge-mcp.js"
13668
+ },
13669
+ files: [
13670
+ "bin",
13671
+ "src",
13672
+ "docs",
13673
+ "LICENSE",
13674
+ "README.md"
13675
+ ],
13676
+ scripts: {
13677
+ test: "bun test",
13678
+ "test:cli": "bun test tests/cli.test.ts",
13679
+ build: "bun build --target=bun --outfile=bin/open-knowledge.js --minify --external @aws-sdk/client-s3 --external @aws-sdk/credential-providers src/cli.ts && bun build --target=bun --outfile=bin/open-knowledge-mcp.js --external @modelcontextprotocol/sdk src/mcp.js",
13680
+ prepublishOnly: "bun run build",
13681
+ postinstall: "bun run build"
13682
+ },
13683
+ keywords: [
13684
+ "knowledge",
13685
+ "cli",
13686
+ "agents",
13687
+ "json",
13688
+ "notes",
13689
+ "local",
13690
+ "store"
13691
+ ],
13692
+ license: "Apache-2.0",
13693
+ publishConfig: {
13694
+ registry: "https://registry.npmjs.org",
13695
+ access: "public"
13696
+ },
13697
+ repository: {
13698
+ type: "git",
13699
+ url: "https://github.com/hasna/knowledge"
13700
+ },
13701
+ bugs: {
13702
+ url: "https://github.com/hasna/knowledge/issues"
13703
+ },
13704
+ author: "Hasna Inc. <hasna@example.com>",
13705
+ engines: {
13706
+ bun: ">=1.0",
13707
+ node: ">=18"
13708
+ },
13709
+ dependencies: {
13710
+ "@aws-sdk/client-s3": "^3.1063.0",
13711
+ "@aws-sdk/credential-providers": "^3.1063.0",
13712
+ "@modelcontextprotocol/sdk": "^1.29.0",
13713
+ zod: "^4.3.6"
13714
+ },
13715
+ devDependencies: {
13716
+ "@types/bun": "^1.3.14"
13717
+ }
13718
+ };
13719
+
14401
13720
  // src/store.ts
14402
- import { mkdirSync, readFileSync, writeFileSync, existsSync, renameSync, unlinkSync } from "fs";
14403
- import { dirname } from "path";
14404
- import { homedir } from "os";
13721
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, renameSync, unlinkSync } from "fs";
14405
13722
  import { randomUUID } from "crypto";
13723
+
13724
+ // src/workspace.ts
13725
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
13726
+ import { homedir } from "os";
13727
+ import { dirname, join, resolve } from "path";
13728
+ var HASNA_KNOWLEDGE_APP_PATH = join(".hasna", "apps", "knowledge");
13729
+ function legacyGlobalStorePath() {
13730
+ return join(homedir(), ".open-knowledge", "db.json");
13731
+ }
13732
+ function globalKnowledgeHome() {
13733
+ return join(homedir(), ".hasna", "apps", "knowledge");
13734
+ }
13735
+ function projectKnowledgeHome(cwd = process.cwd()) {
13736
+ return resolve(cwd, HASNA_KNOWLEDGE_APP_PATH);
13737
+ }
13738
+ function workspaceForHome(home) {
13739
+ return {
13740
+ home,
13741
+ configPath: join(home, "config.json"),
13742
+ jsonStorePath: join(home, "db.json"),
13743
+ knowledgeDbPath: join(home, "knowledge.db"),
13744
+ artifactsDir: join(home, "artifacts"),
13745
+ cacheDir: join(home, "cache"),
13746
+ exportsDir: join(home, "exports"),
13747
+ indexesDir: join(home, "indexes"),
13748
+ logsDir: join(home, "logs"),
13749
+ runsDir: join(home, "runs"),
13750
+ schemasDir: join(home, "schemas"),
13751
+ wikiDir: join(home, "wiki")
13752
+ };
13753
+ }
13754
+ function defaultKnowledgeConfig() {
13755
+ return {
13756
+ version: 1,
13757
+ mode: "local",
13758
+ storage: {
13759
+ type: "local",
13760
+ artifacts_root: "artifacts"
13761
+ },
13762
+ sources: {
13763
+ preferred_ref: "open-files",
13764
+ allowed_schemes: ["open-files", "s3", "file", "https", "http"]
13765
+ }
13766
+ };
13767
+ }
13768
+ function ensureKnowledgeWorkspace(home) {
13769
+ const workspace = workspaceForHome(home);
13770
+ mkdirSync(workspace.home, { recursive: true });
13771
+ for (const dir of [
13772
+ workspace.artifactsDir,
13773
+ workspace.cacheDir,
13774
+ workspace.exportsDir,
13775
+ workspace.indexesDir,
13776
+ workspace.logsDir,
13777
+ workspace.runsDir,
13778
+ workspace.schemasDir,
13779
+ workspace.wikiDir
13780
+ ]) {
13781
+ mkdirSync(dir, { recursive: true });
13782
+ }
13783
+ if (!existsSync(workspace.configPath)) {
13784
+ writeFileSync(workspace.configPath, `${JSON.stringify(defaultKnowledgeConfig(), null, 2)}
13785
+ `);
13786
+ }
13787
+ return workspace;
13788
+ }
13789
+ function resolveScopedWorkspace(scope, cwd = process.cwd()) {
13790
+ if (scope === "project" || scope === "local") {
13791
+ return workspaceForHome(projectKnowledgeHome(cwd));
13792
+ }
13793
+ return workspaceForHome(globalKnowledgeHome());
13794
+ }
13795
+ function ensureParentDir(path) {
13796
+ mkdirSync(dirname(path), { recursive: true });
13797
+ }
13798
+ function readKnowledgeConfig(path) {
13799
+ const raw = readFileSync(path, "utf8");
13800
+ return JSON.parse(raw);
13801
+ }
13802
+
13803
+ // src/store.ts
14406
13804
  function defaultStorePath() {
14407
- return `${homedir()}/.open-knowledge/db.json`;
13805
+ return workspaceForHome(globalKnowledgeHome()).jsonStorePath;
14408
13806
  }
14409
13807
  function ensureStore(path) {
14410
- if (!existsSync(path)) {
14411
- mkdirSync(dirname(path), { recursive: true });
14412
- writeFileSync(path, JSON.stringify({ items: [] }, null, 2));
13808
+ if (!existsSync2(path)) {
13809
+ ensureParentDir(path);
13810
+ if (path === defaultStorePath() && existsSync2(legacyGlobalStorePath())) {
13811
+ writeFileSync2(path, readFileSync2(legacyGlobalStorePath(), "utf8"));
13812
+ } else {
13813
+ writeFileSync2(path, JSON.stringify({ items: [] }, null, 2));
13814
+ }
14413
13815
  }
14414
13816
  }
13817
+ function lockPath(path) {
13818
+ return `${path}.lock`;
13819
+ }
13820
+ function acquireLock(lockPath2, ownerId) {
13821
+ const maxWait = 5000;
13822
+ const interval = 50;
13823
+ const start = Date.now();
13824
+ while (Date.now() - start < maxWait) {
13825
+ try {
13826
+ if (!existsSync2(lockPath2)) {
13827
+ writeFileSync2(lockPath2, JSON.stringify({ owner: ownerId, ts: Date.now() }));
13828
+ return;
13829
+ }
13830
+ const lock = JSON.parse(readFileSync2(lockPath2, "utf8"));
13831
+ if (Date.now() - lock.ts > 1e4) {
13832
+ unlinkSync(lockPath2);
13833
+ }
13834
+ } catch {}
13835
+ const start2 = Date.now();
13836
+ while (Date.now() - start2 < interval) {}
13837
+ }
13838
+ throw new Error(`Could not acquire lock on ${lockPath2} after ${maxWait}ms`);
13839
+ }
13840
+ function releaseLock(lockPath2, ownerId) {
13841
+ try {
13842
+ if (existsSync2(lockPath2)) {
13843
+ const lock = JSON.parse(readFileSync2(lockPath2, "utf8"));
13844
+ if (lock.owner === ownerId) {
13845
+ unlinkSync(lockPath2);
13846
+ }
13847
+ }
13848
+ } catch {}
13849
+ }
14415
13850
  function loadStore(path) {
14416
13851
  ensureStore(path);
14417
- const raw = readFileSync(path, "utf8");
13852
+ const raw = readFileSync2(path, "utf8");
14418
13853
  const parsed = JSON.parse(raw);
14419
13854
  if (!parsed || !Array.isArray(parsed.items)) {
14420
13855
  return { items: [] };
@@ -14423,494 +13858,556 @@ function loadStore(path) {
14423
13858
  }
14424
13859
  function saveStore(path, store) {
14425
13860
  const tmp = `${path}.tmp.${randomUUID()}`;
14426
- writeFileSync(tmp, JSON.stringify(store, null, 2));
13861
+ writeFileSync2(tmp, JSON.stringify(store, null, 2));
14427
13862
  renameSync(tmp, path);
14428
13863
  }
13864
+ function withLock(path, fn) {
13865
+ const owner = randomUUID();
13866
+ const lpath = lockPath(path);
13867
+ acquireLock(lpath, owner);
13868
+ try {
13869
+ return fn();
13870
+ } finally {
13871
+ releaseLock(lpath, owner);
13872
+ }
13873
+ }
14429
13874
  function makeId() {
14430
13875
  return `k_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
14431
13876
  }
14432
13877
 
14433
- // src/mcp.js
14434
- import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
14435
- function createAddSchema() {
14436
- return exports_external.object({
14437
- title: exports_external.string().describe("Item title"),
14438
- content: exports_external.string().describe("Item content/body"),
14439
- tags: exports_external.array(exports_external.string()).optional().describe("Tags to attach"),
14440
- metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Metadata key-value pairs"),
14441
- store_path: exports_external.string().optional().describe("Path to the store file")
14442
- });
13878
+ // src/source-ref.ts
13879
+ function assertNonEmpty(value, message) {
13880
+ if (!value)
13881
+ throw new Error(message);
13882
+ return value;
14443
13883
  }
14444
- function createIdSchema() {
14445
- return exports_external.object({
14446
- id: exports_external.string().describe("Item ID or short ID"),
14447
- store_path: exports_external.string().optional().describe("Path to the store file")
14448
- });
13884
+ function parseOpenFilesRef(uri) {
13885
+ const withoutScheme = uri.slice("open-files://".length);
13886
+ const parts = withoutScheme.split("/").filter(Boolean);
13887
+ const entity = parts[0];
13888
+ if (entity !== "file" && entity !== "source") {
13889
+ throw new Error("Invalid open-files ref. Expected open-files://file/<id>, open-files://file/<id>/revision/<revision_id>, or open-files://source/<id>/path/<path>.");
13890
+ }
13891
+ const id = assertNonEmpty(parts[1], "Invalid open-files ref. Missing id.");
13892
+ if (entity === "file") {
13893
+ if (parts.length === 2)
13894
+ return { kind: "open-files", uri, entity, id };
13895
+ if (parts[2] === "revision" && parts[3] && parts.length === 4) {
13896
+ return { kind: "open-files", uri, entity, id, revision_id: decodeURIComponent(parts[3]) };
13897
+ }
13898
+ throw new Error("Invalid open-files file ref. Expected open-files://file/<id>/revision/<revision_id>.");
13899
+ }
13900
+ const pathIndex = parts.indexOf("path");
13901
+ const path = pathIndex >= 0 ? decodeURIComponent(parts.slice(pathIndex + 1).join("/")) : undefined;
13902
+ return { kind: "open-files", uri, entity, id, path };
13903
+ }
13904
+ function parseS3Ref(uri) {
13905
+ const parsed = new URL(uri);
13906
+ const bucket = assertNonEmpty(parsed.hostname, "Invalid s3 ref. Missing bucket.");
13907
+ const key = decodeURIComponent(parsed.pathname.replace(/^\/+/, ""));
13908
+ if (!key)
13909
+ throw new Error("Invalid s3 ref. Missing object key.");
13910
+ return { kind: "s3", uri, bucket, key };
13911
+ }
13912
+ function parseFileRef(uri) {
13913
+ const parsed = new URL(uri);
13914
+ return { kind: "file", uri, path: decodeURIComponent(parsed.pathname) };
13915
+ }
13916
+ function parseWebRef(uri) {
13917
+ const parsed = new URL(uri);
13918
+ return { kind: "web", uri, url: parsed.toString() };
13919
+ }
13920
+ function parseSourceRef(uri) {
13921
+ if (uri.startsWith("open-files://"))
13922
+ return parseOpenFilesRef(uri);
13923
+ if (uri.startsWith("s3://"))
13924
+ return parseS3Ref(uri);
13925
+ if (uri.startsWith("file://"))
13926
+ return parseFileRef(uri);
13927
+ if (uri.startsWith("https://") || uri.startsWith("http://"))
13928
+ return parseWebRef(uri);
13929
+ throw new Error(`Unsupported source ref scheme: ${uri}`);
14449
13930
  }
14450
- function createListSchema() {
14451
- return exports_external.object({
14452
- search: exports_external.string().optional().describe("Search text for title/content"),
14453
- fuzzy: exports_external.boolean().optional().describe("Use fuzzy matching for search"),
14454
- tag: exports_external.array(exports_external.string()).optional().describe("Filter by tags (must match all)"),
14455
- archived: exports_external.boolean().optional().describe("Show only archived items"),
14456
- include_archived: exports_external.boolean().optional().describe("Include archived items in results"),
14457
- page: exports_external.number().optional().describe("Page number (default: 1)"),
14458
- limit: exports_external.number().optional().describe("Items per page (default: 20)"),
14459
- sort: exports_external.enum(["created", "title"]).optional().describe("Sort field"),
14460
- desc: exports_external.boolean().optional().describe("Sort descending"),
14461
- after: exports_external.string().optional().describe("Filter items created after ISO date"),
14462
- before: exports_external.string().optional().describe("Filter items created before ISO date"),
14463
- store_path: exports_external.string().optional().describe("Path to the store file")
14464
- });
13931
+
13932
+ // src/mcp.js
13933
+ var storePathField = exports_external.string().optional().describe("Path to the JSON store file");
13934
+ var scopeField = exports_external.enum(["local", "global", "project"]).optional().describe("Workspace scope");
13935
+ function jsonText(data) {
13936
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
14465
13937
  }
14466
- function createUpdateSchema() {
14467
- return exports_external.object({
14468
- id: exports_external.string().describe("Item ID or short ID"),
14469
- title: exports_external.string().optional().describe("New title"),
14470
- content: exports_external.string().optional().describe("New content"),
14471
- tags: exports_external.array(exports_external.string()).optional().describe("Tags to add"),
14472
- metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Metadata to merge"),
14473
- store_path: exports_external.string().optional().describe("Path to the store file")
14474
- });
13938
+ function errorText(message) {
13939
+ return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
14475
13940
  }
14476
- function createDeleteSchema() {
14477
- return exports_external.object({
14478
- id: exports_external.string().describe("Item ID or short ID"),
14479
- confirm: exports_external.boolean().describe("Must be true to confirm deletion"),
14480
- store_path: exports_external.string().optional().describe("Path to the store file")
14481
- });
13941
+ function shortIdFor(id) {
13942
+ return id.replace(/^k_/, "").slice(0, 12);
14482
13943
  }
14483
- function createUpsertSchema() {
14484
- return exports_external.object({
14485
- id: exports_external.string().describe("Item ID (used as id for new items)"),
14486
- title: exports_external.string().optional().describe("Item title"),
14487
- content: exports_external.string().optional().describe("Item content"),
14488
- tags: exports_external.array(exports_external.string()).optional().describe("Tags"),
14489
- metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Metadata"),
14490
- store_path: exports_external.string().optional().describe("Path to the store file")
14491
- });
13944
+ function resolveStorePath(storePath, scope) {
13945
+ if (storePath)
13946
+ return storePath;
13947
+ if (scope === "project" || scope === "local") {
13948
+ return ensureKnowledgeWorkspace(resolveScopedWorkspace(scope).home).jsonStorePath;
13949
+ }
13950
+ return defaultStorePath();
14492
13951
  }
14493
- function createBulkDeleteSchema() {
14494
- return exports_external.object({
14495
- tag: exports_external.array(exports_external.string()).optional().describe("Delete items with these tags"),
14496
- search: exports_external.string().optional().describe("Delete items matching search in title/content"),
14497
- confirm: exports_external.boolean().describe("Must be true to confirm deletion"),
14498
- store_path: exports_external.string().optional().describe("Path to the store file")
14499
- });
13952
+ function readStoreLocked(storePath, fn) {
13953
+ return withLock(storePath, () => fn(loadStore(storePath)));
14500
13954
  }
14501
- function createExportSchema() {
14502
- return exports_external.object({
14503
- file: exports_external.string().optional().describe("Output file path (default: ./knowledge-export.json)"),
14504
- store_path: exports_external.string().optional().describe("Path to the store file")
13955
+ function writeStoreLocked(storePath, fn) {
13956
+ return withLock(storePath, () => {
13957
+ const db = loadStore(storePath);
13958
+ const result = fn(db);
13959
+ saveStore(storePath, db);
13960
+ return result;
14505
13961
  });
14506
13962
  }
14507
- function createImportSchema() {
14508
- return exports_external.object({
14509
- file: exports_external.string().describe("Path to exported JSON file"),
14510
- store_path: exports_external.string().optional().describe("Path to the store file")
14511
- });
13963
+ function findItem(db, id) {
13964
+ return db.items.find((item) => item.id === id || item.short_id === id);
14512
13965
  }
14513
- function createStatsSchema() {
14514
- return exports_external.object({
14515
- store_path: exports_external.string().optional().describe("Path to the store file")
13966
+ function sortItems(items, sort = "created", desc = false) {
13967
+ const sorted = [...items].sort((a, b) => {
13968
+ if (sort === "title")
13969
+ return a.title.localeCompare(b.title);
13970
+ return a.created_at.localeCompare(b.created_at);
14516
13971
  });
13972
+ if (desc)
13973
+ sorted.reverse();
13974
+ return sorted;
14517
13975
  }
14518
- function createBatchSchema() {
14519
- return exports_external.object({
14520
- items: exports_external.array(exports_external.object({
14521
- id: exports_external.string().optional(),
14522
- title: exports_external.string(),
14523
- content: exports_external.string(),
14524
- tags: exports_external.array(exports_external.string()).optional(),
14525
- metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
14526
- created_at: exports_external.string().optional(),
14527
- updated_at: exports_external.string().optional()
14528
- })).describe("Array of items to import"),
14529
- store_path: exports_external.string().optional().describe("Path to the store file")
14530
- });
13976
+ function activeItems(items, includeArchived) {
13977
+ return includeArchived ? items : items.filter((item) => !item.archived);
14531
13978
  }
14532
- function createUntagSchema() {
14533
- return exports_external.object({
14534
- id: exports_external.string().describe("Item ID or short ID"),
14535
- tags: exports_external.array(exports_external.string()).describe("Tags to remove"),
14536
- store_path: exports_external.string().optional().describe("Path to the store file")
14537
- });
13979
+ function registerTool(server, name, title, description, inputSchema, handler) {
13980
+ server.registerTool(name, { title, description, inputSchema }, handler);
14538
13981
  }
14539
13982
  function buildServer() {
14540
13983
  const server = new McpServer({
14541
13984
  name: "open-knowledge",
14542
- version: "0.1.0"
13985
+ version: package_default.version
13986
+ });
13987
+ registerTool(server, "ok_paths", "Knowledge workspace paths", "Show resolved workspace and store paths", {
13988
+ scope: scopeField
13989
+ }, async ({ scope }) => {
13990
+ const workspace = ensureKnowledgeWorkspace(resolveScopedWorkspace(scope).home);
13991
+ return jsonText({
13992
+ ok: true,
13993
+ scope: scope ?? "global",
13994
+ home: workspace.home,
13995
+ config_path: workspace.configPath,
13996
+ json_store_path: workspace.jsonStorePath,
13997
+ knowledge_db_path: workspace.knowledgeDbPath,
13998
+ artifacts_dir: workspace.artifactsDir,
13999
+ indexes_dir: workspace.indexesDir,
14000
+ logs_dir: workspace.logsDir,
14001
+ runs_dir: workspace.runsDir,
14002
+ schemas_dir: workspace.schemasDir,
14003
+ wiki_dir: workspace.wikiDir,
14004
+ config: readKnowledgeConfig(workspace.configPath)
14005
+ });
14543
14006
  });
14544
- function resolveStore(path) {
14545
- return path || defaultStorePath();
14546
- }
14547
- server.registerTool("ok_add", {
14548
- title: "Add a knowledge item",
14549
- description: "Add a new item to the knowledge store with title, content, optional tags and metadata",
14550
- inputSchema: createAddSchema(),
14551
- handler: async ({ title, content, tags, metadata, store_path }) => {
14552
- const db = loadStore(resolveStore(store_path));
14007
+ registerTool(server, "ok_parse_source_ref", "Parse source reference", "Parse and validate an open-files, S3, file, or web source ref", {
14008
+ uri: exports_external.string().describe("Source reference URI")
14009
+ }, async ({ uri }) => {
14010
+ try {
14011
+ return jsonText({ ok: true, source_ref: parseSourceRef(uri) });
14012
+ } catch (error48) {
14013
+ return errorText(error48 instanceof Error ? error48.message : String(error48));
14014
+ }
14015
+ });
14016
+ registerTool(server, "ok_add", "Add a knowledge item", "Add a new item to the knowledge store", {
14017
+ title: exports_external.string().describe("Item title"),
14018
+ content: exports_external.string().describe("Item content/body"),
14019
+ tags: exports_external.array(exports_external.string()).optional().describe("Tags to attach"),
14020
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Metadata key-value pairs"),
14021
+ url: exports_external.string().optional().describe("Source URL or URI"),
14022
+ store_path: storePathField,
14023
+ scope: scopeField
14024
+ }, async ({ title, content, tags, metadata, url: url2, store_path, scope }) => {
14025
+ const storePath = resolveStorePath(store_path, scope);
14026
+ const item = writeStoreLocked(storePath, (db) => {
14553
14027
  const now = new Date().toISOString();
14554
- const { id, shortId } = makeId();
14555
- const item = {
14028
+ const id = makeId();
14029
+ const entry = {
14556
14030
  id,
14557
- short_id: shortId,
14031
+ short_id: shortIdFor(id),
14558
14032
  title,
14559
14033
  content,
14034
+ url: url2 ?? null,
14560
14035
  tags: tags ?? [],
14561
14036
  metadata: metadata ?? {},
14037
+ archived: false,
14562
14038
  created_at: now,
14563
14039
  updated_at: now
14564
14040
  };
14565
- db.items.push(item);
14566
- saveStore(resolveStore(store_path), db);
14567
- return {
14568
- content: [{ type: "text", text: JSON.stringify({ ok: true, item, message: `Added ${item.id}` }, null, 2) }]
14569
- };
14570
- }
14041
+ db.items.push(entry);
14042
+ return entry;
14043
+ });
14044
+ return jsonText({ ok: true, item, message: `Added ${item.id}` });
14571
14045
  });
14572
- server.registerTool("ok_list", {
14573
- title: "List knowledge items",
14574
- description: "List items with pagination, search, tag filter, date filter, and sorting",
14575
- inputSchema: createListSchema(),
14576
- handler: async ({ search, fuzzy, tag, archived, include_archived, page, limit, sort, desc, after, before, store_path }) => {
14577
- const db = loadStore(resolveStore(store_path));
14578
- let items = db.items;
14579
- if (search) {
14580
- const q = search.toLowerCase();
14581
- if (fuzzy) {
14582
- const levenshtein = (a, b) => {
14583
- const dp = Array.from({ length: a.length + 1 }, () => Array(b.length + 1).fill(0));
14584
- for (let i = 0;i <= a.length; i += 1)
14585
- dp[i][0] = i;
14586
- for (let j = 0;j <= b.length; j += 1)
14587
- dp[0][j] = j;
14588
- for (let i = 1;i <= a.length; i += 1) {
14589
- for (let j = 1;j <= b.length; j += 1) {
14590
- const cost = a[i - 1] === b[j - 1] ? 0 : 1;
14591
- dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
14592
- }
14593
- }
14594
- return dp[a.length][b.length];
14595
- };
14596
- const scored = items.map((x) => {
14597
- const titleScore = levenshtein(q, x.title.toLowerCase());
14598
- const contentScore = Math.min(levenshtein(q, x.content.slice(0, 200).toLowerCase()), 20);
14599
- return { ...x, _fuzzyScore: Math.min(titleScore, contentScore) };
14600
- }).filter((x) => x._fuzzyScore <= 5);
14601
- scored.sort((a, b) => a._fuzzyScore - b._fuzzyScore);
14602
- items = scored;
14603
- } else {
14604
- items = items.filter((x) => x.title.toLowerCase().includes(q) || x.content.toLowerCase().includes(q));
14605
- }
14606
- }
14607
- if (tag && tag.length > 0) {
14608
- items = items.filter((x) => {
14609
- const itemTags = (x.tags ?? []).map((t) => t.toLowerCase());
14610
- return tag.every((t) => itemTags.includes(t.toLowerCase()));
14046
+ registerTool(server, "ok_list", "List knowledge items", "List items with pagination, search, tag filtering, and sorting", {
14047
+ search: exports_external.string().optional().describe("Search text for title/content"),
14048
+ tag: exports_external.array(exports_external.string()).optional().describe("Filter by tags; item must match all tags"),
14049
+ include_archived: exports_external.boolean().optional().describe("Include archived items"),
14050
+ page: exports_external.number().optional().describe("Page number"),
14051
+ limit: exports_external.number().optional().describe("Items per page"),
14052
+ sort: exports_external.enum(["created", "title"]).optional().describe("Sort field"),
14053
+ desc: exports_external.boolean().optional().describe("Sort descending"),
14054
+ store_path: storePathField,
14055
+ scope: scopeField
14056
+ }, async ({ search, tag, include_archived, page, limit, sort, desc, store_path, scope }) => {
14057
+ const storePath = resolveStorePath(store_path, scope);
14058
+ return readStoreLocked(storePath, (db) => {
14059
+ const q = search ? search.toLowerCase() : "";
14060
+ const requiredTags = (tag ?? []).map((entry) => entry.toLowerCase());
14061
+ let items = activeItems(db.items, include_archived);
14062
+ if (q)
14063
+ items = items.filter((item) => item.title.toLowerCase().includes(q) || item.content.toLowerCase().includes(q));
14064
+ if (requiredTags.length > 0) {
14065
+ items = items.filter((item) => {
14066
+ const itemTags = (item.tags ?? []).map((entry) => entry.toLowerCase());
14067
+ return requiredTags.every((entry) => itemTags.includes(entry));
14611
14068
  });
14612
14069
  }
14613
- if (archived) {
14614
- items = items.filter((x) => x.archived === true);
14615
- } else if (!include_archived) {
14616
- items = items.filter((x) => !x.archived);
14617
- }
14618
- if (after) {
14619
- items = items.filter((x) => x.created_at > after);
14620
- }
14621
- if (before) {
14622
- items = items.filter((x) => x.created_at < before);
14623
- }
14624
- const p = page ?? 1;
14625
- const l = limit ?? 20;
14070
+ const p = page && page > 0 ? page : 1;
14071
+ const l = limit && limit > 0 ? limit : 20;
14072
+ const sorted = sortItems(items, sort ?? "created", desc ?? false);
14626
14073
  const start = (p - 1) * l;
14627
- const totalPages = Math.max(1, Math.ceil(items.length / l));
14628
- const rows = items.slice(start, start + l);
14629
- return {
14630
- content: [{ type: "text", text: JSON.stringify({ page: p, limit: l, total: items.length, total_pages: totalPages, items: rows }, null, 2) }]
14631
- };
14632
- }
14074
+ const rows = sorted.slice(start, start + l);
14075
+ return jsonText({
14076
+ ok: true,
14077
+ page: p,
14078
+ limit: l,
14079
+ total: sorted.length,
14080
+ total_pages: Math.max(1, Math.ceil(sorted.length / l)),
14081
+ items: rows
14082
+ });
14083
+ });
14633
14084
  });
14634
- server.registerTool("ok_get", {
14635
- title: "Get a knowledge item",
14636
- description: "Retrieve a single item by its ID or short ID",
14637
- inputSchema: createIdSchema(),
14638
- handler: async ({ id, store_path }) => {
14639
- const db = loadStore(resolveStore(store_path));
14640
- const item = db.items.find((x) => x.id === id || x.short_id === id);
14641
- if (!item) {
14642
- return { content: [{ type: "text", text: `Error: Item not found: ${id}` }] };
14643
- }
14644
- return { content: [{ type: "text", text: JSON.stringify({ item }, null, 2) }] };
14645
- }
14085
+ registerTool(server, "ok_get", "Get a knowledge item", "Retrieve a single item by ID or short ID", {
14086
+ id: exports_external.string().describe("Item ID or short ID"),
14087
+ store_path: storePathField,
14088
+ scope: scopeField
14089
+ }, async ({ id, store_path, scope }) => {
14090
+ const storePath = resolveStorePath(store_path, scope);
14091
+ return readStoreLocked(storePath, (db) => {
14092
+ const item = findItem(db, id);
14093
+ return item ? jsonText({ ok: true, item }) : errorText(`Item not found: ${id}`);
14094
+ });
14646
14095
  });
14647
- server.registerTool("ok_update", {
14648
- title: "Update a knowledge item",
14649
- description: "Update title, content, tags, or metadata of an existing item",
14650
- inputSchema: createUpdateSchema(),
14651
- handler: async ({ id, title, content, tags, metadata, store_path }) => {
14652
- const db = loadStore(resolveStore(store_path));
14653
- const item = db.items.find((x) => x.id === id || x.short_id === id);
14654
- if (!item) {
14655
- return { content: [{ type: "text", text: `Error: Item not found: ${id}` }] };
14656
- }
14657
- if (title)
14096
+ registerTool(server, "ok_update", "Update a knowledge item", "Update title, content, URL, tags, or metadata", {
14097
+ id: exports_external.string().describe("Item ID or short ID"),
14098
+ title: exports_external.string().optional(),
14099
+ content: exports_external.string().optional(),
14100
+ url: exports_external.string().optional(),
14101
+ tags: exports_external.array(exports_external.string()).optional(),
14102
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
14103
+ store_path: storePathField,
14104
+ scope: scopeField
14105
+ }, async ({ id, title, content, url: url2, tags, metadata, store_path, scope }) => {
14106
+ const storePath = resolveStorePath(store_path, scope);
14107
+ const result = writeStoreLocked(storePath, (db) => {
14108
+ const item = findItem(db, id);
14109
+ if (!item)
14110
+ return null;
14111
+ if (title !== undefined)
14658
14112
  item.title = title;
14659
- if (content)
14113
+ if (content !== undefined)
14660
14114
  item.content = content;
14661
- if (tags) {
14115
+ if (url2 !== undefined)
14116
+ item.url = url2;
14117
+ if (tags)
14662
14118
  item.tags = [...new Set([...item.tags ?? [], ...tags])];
14663
- }
14664
- if (metadata) {
14119
+ if (metadata)
14665
14120
  item.metadata = { ...item.metadata ?? {}, ...metadata };
14666
- }
14667
14121
  item.updated_at = new Date().toISOString();
14668
- saveStore(resolveStore(store_path), db);
14669
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, item }, null, 2) }] };
14670
- }
14122
+ return item;
14123
+ });
14124
+ return result ? jsonText({ ok: true, item: result }) : errorText(`Item not found: ${id}`);
14671
14125
  });
14672
- server.registerTool("ok_delete", {
14673
- title: "Delete a knowledge item",
14674
- description: "Permanently delete an item by ID. Requires confirm=true to prevent accidental deletion.",
14675
- inputSchema: createDeleteSchema(),
14676
- handler: async ({ id, confirm, store_path }) => {
14677
- if (!confirm) {
14678
- return { content: [{ type: "text", text: "Error: Refusing delete without confirm=true. Re-run with confirm: true." }] };
14679
- }
14680
- const db = loadStore(resolveStore(store_path));
14126
+ registerTool(server, "ok_delete", "Delete a knowledge item", "Permanently delete an item by ID. Requires confirm=true.", {
14127
+ id: exports_external.string().describe("Item ID or short ID"),
14128
+ confirm: exports_external.boolean().describe("Must be true to confirm deletion"),
14129
+ store_path: storePathField,
14130
+ scope: scopeField
14131
+ }, async ({ id, confirm, store_path, scope }) => {
14132
+ if (!confirm)
14133
+ return errorText("Refusing delete without confirm=true.");
14134
+ const storePath = resolveStorePath(store_path, scope);
14135
+ const deleted = writeStoreLocked(storePath, (db) => {
14681
14136
  const before = db.items.length;
14682
- db.items = db.items.filter((x) => x.id !== id && x.short_id !== id);
14683
- if (db.items.length === before) {
14684
- return { content: [{ type: "text", text: `Error: Item not found: ${id}` }] };
14685
- }
14686
- saveStore(resolveStore(store_path), db);
14687
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, deleted_id: id }, null, 2) }] };
14688
- }
14689
- });
14690
- server.registerTool("ok_archive", {
14691
- title: "Archive a knowledge item",
14692
- description: "Soft-delete an item by setting its archived flag to true",
14693
- inputSchema: createIdSchema(),
14694
- handler: async ({ id, store_path }) => {
14695
- const db = loadStore(resolveStore(store_path));
14696
- const item = db.items.find((x) => x.id === id || x.short_id === id);
14697
- if (!item) {
14698
- return { content: [{ type: "text", text: `Error: Item not found: ${id}` }] };
14699
- }
14700
- item.archived = true;
14701
- item.updated_at = new Date().toISOString();
14702
- saveStore(resolveStore(store_path), db);
14703
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, item }, null, 2) }] };
14704
- }
14705
- });
14706
- server.registerTool("ok_restore", {
14707
- title: "Restore a knowledge item",
14708
- description: "Un-archive an item by setting its archived flag back to false",
14709
- inputSchema: createIdSchema(),
14710
- handler: async ({ id, store_path }) => {
14711
- const db = loadStore(resolveStore(store_path));
14712
- const item = db.items.find((x) => x.id === id || x.short_id === id);
14713
- if (!item) {
14714
- return { content: [{ type: "text", text: `Error: Item not found: ${id}` }] };
14715
- }
14716
- item.archived = false;
14717
- item.updated_at = new Date().toISOString();
14718
- saveStore(resolveStore(store_path), db);
14719
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, item }, null, 2) }] };
14720
- }
14721
- });
14722
- server.registerTool("ok_upsert", {
14723
- title: "Upsert a knowledge item",
14724
- description: "Create or update an item by ID. Creates new if ID does not exist, updates if it does.",
14725
- inputSchema: createUpsertSchema(),
14726
- handler: async ({ id, title, content, tags, metadata, store_path }) => {
14727
- const db = loadStore(resolveStore(store_path));
14728
- let item = db.items.find((x) => x.id === id || x.short_id === id);
14137
+ db.items = db.items.filter((item) => item.id !== id && item.short_id !== id);
14138
+ return before !== db.items.length;
14139
+ });
14140
+ return deleted ? jsonText({ ok: true, deleted_id: id }) : errorText(`Item not found: ${id}`);
14141
+ });
14142
+ registerTool(server, "ok_archive", "Archive a knowledge item", "Soft-delete an item by setting archived=true", {
14143
+ id: exports_external.string(),
14144
+ store_path: storePathField,
14145
+ scope: scopeField
14146
+ }, async ({ id, store_path, scope }) => {
14147
+ const storePath = resolveStorePath(store_path, scope);
14148
+ const item = writeStoreLocked(storePath, (db) => {
14149
+ const entry = findItem(db, id);
14150
+ if (!entry)
14151
+ return null;
14152
+ entry.archived = true;
14153
+ entry.updated_at = new Date().toISOString();
14154
+ return entry;
14155
+ });
14156
+ return item ? jsonText({ ok: true, item }) : errorText(`Item not found: ${id}`);
14157
+ });
14158
+ registerTool(server, "ok_restore", "Restore a knowledge item", "Restore an archived item", {
14159
+ id: exports_external.string(),
14160
+ store_path: storePathField,
14161
+ scope: scopeField
14162
+ }, async ({ id, store_path, scope }) => {
14163
+ const storePath = resolveStorePath(store_path, scope);
14164
+ const item = writeStoreLocked(storePath, (db) => {
14165
+ const entry = findItem(db, id);
14166
+ if (!entry)
14167
+ return null;
14168
+ entry.archived = false;
14169
+ entry.updated_at = new Date().toISOString();
14170
+ return entry;
14171
+ });
14172
+ return item ? jsonText({ ok: true, item }) : errorText(`Item not found: ${id}`);
14173
+ });
14174
+ registerTool(server, "ok_upsert", "Upsert a knowledge item", "Create or update an item by ID", {
14175
+ id: exports_external.string(),
14176
+ title: exports_external.string().optional(),
14177
+ content: exports_external.string().optional(),
14178
+ tags: exports_external.array(exports_external.string()).optional(),
14179
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
14180
+ store_path: storePathField,
14181
+ scope: scopeField
14182
+ }, async ({ id, title, content, tags, metadata, store_path, scope }) => {
14183
+ const storePath = resolveStorePath(store_path, scope);
14184
+ const item = writeStoreLocked(storePath, (db) => {
14185
+ let entry = findItem(db, id);
14729
14186
  const now = new Date().toISOString();
14730
- if (!item) {
14731
- if (!title || !content) {
14732
- return { content: [{ type: "text", text: "Error: New item requires both title and content." }] };
14733
- }
14734
- const { shortId } = makeId();
14735
- item = {
14187
+ if (!entry) {
14188
+ if (!title || !content)
14189
+ return null;
14190
+ entry = {
14736
14191
  id,
14737
- short_id: shortId,
14192
+ short_id: shortIdFor(id),
14738
14193
  title,
14739
14194
  content,
14740
14195
  tags: tags ?? [],
14741
14196
  metadata: metadata ?? {},
14197
+ archived: false,
14742
14198
  created_at: now,
14743
14199
  updated_at: now
14744
14200
  };
14745
- db.items.push(item);
14746
- } else {
14747
- if (title)
14748
- item.title = title;
14749
- if (content)
14750
- item.content = content;
14751
- if (tags) {
14752
- item.tags = [...new Set([...item.tags ?? [], ...tags])];
14753
- }
14754
- if (metadata) {
14755
- item.metadata = { ...item.metadata ?? {}, ...metadata };
14756
- }
14757
- item.updated_at = now;
14758
- }
14759
- saveStore(resolveStore(store_path), db);
14760
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, item }, null, 2) }] };
14761
- }
14762
- });
14763
- server.registerTool("ok_untag", {
14764
- title: "Remove tags from a knowledge item",
14765
- description: "Remove specific tags from an item",
14766
- inputSchema: createUntagSchema(),
14767
- handler: async ({ id, tags, store_path }) => {
14768
- const db = loadStore(resolveStore(store_path));
14769
- const item = db.items.find((x) => x.id === id || x.short_id === id);
14770
- if (!item) {
14771
- return { content: [{ type: "text", text: `Error: Item not found: ${id}` }] };
14772
- }
14773
- const removeTags = new Set(tags.map((t) => t.toLowerCase()));
14201
+ db.items.push(entry);
14202
+ return entry;
14203
+ }
14204
+ if (title !== undefined)
14205
+ entry.title = title;
14206
+ if (content !== undefined)
14207
+ entry.content = content;
14208
+ if (tags)
14209
+ entry.tags = [...new Set([...entry.tags ?? [], ...tags])];
14210
+ if (metadata)
14211
+ entry.metadata = { ...entry.metadata ?? {}, ...metadata };
14212
+ entry.updated_at = now;
14213
+ return entry;
14214
+ });
14215
+ return item ? jsonText({ ok: true, item }) : errorText("New item requires both title and content.");
14216
+ });
14217
+ registerTool(server, "ok_untag", "Remove tags from a knowledge item", "Remove specific tags from an item", {
14218
+ id: exports_external.string(),
14219
+ tags: exports_external.array(exports_external.string()),
14220
+ store_path: storePathField,
14221
+ scope: scopeField
14222
+ }, async ({ id, tags, store_path, scope }) => {
14223
+ const storePath = resolveStorePath(store_path, scope);
14224
+ const result = writeStoreLocked(storePath, (db) => {
14225
+ const item = findItem(db, id);
14226
+ if (!item)
14227
+ return null;
14228
+ const remove = new Set(tags.map((tag) => tag.toLowerCase()));
14774
14229
  const before = (item.tags ?? []).length;
14775
- item.tags = (item.tags ?? []).filter((t) => !removeTags.has(t.toLowerCase()));
14776
- const removed = before - item.tags.length;
14230
+ item.tags = (item.tags ?? []).filter((tag) => !remove.has(tag.toLowerCase()));
14777
14231
  item.updated_at = new Date().toISOString();
14778
- saveStore(resolveStore(store_path), db);
14779
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, item, removed }, null, 2) }] };
14780
- }
14781
- });
14782
- server.registerTool("ok_bulk_delete", {
14783
- title: "Bulk delete knowledge items",
14784
- description: "Delete multiple items by tag or search pattern. Requires confirm=true.",
14785
- inputSchema: createBulkDeleteSchema(),
14786
- handler: async ({ tag, search, confirm, store_path }) => {
14787
- if (!confirm) {
14788
- return { content: [{ type: "text", text: "Error: Refusing bulk delete without confirm=true." }] };
14789
- }
14790
- if (!tag && !search) {
14791
- return { content: [{ type: "text", text: "Error: Missing filter. Use tag or search to specify items." }] };
14792
- }
14793
- const db = loadStore(resolveStore(store_path));
14232
+ return { item, removed: before - item.tags.length };
14233
+ });
14234
+ return result ? jsonText({ ok: true, ...result }) : errorText(`Item not found: ${id}`);
14235
+ });
14236
+ registerTool(server, "ok_bulk_delete", "Bulk delete knowledge items", "Delete multiple items by tag or search. Requires confirm=true.", {
14237
+ tag: exports_external.array(exports_external.string()).optional(),
14238
+ search: exports_external.string().optional(),
14239
+ confirm: exports_external.boolean(),
14240
+ store_path: storePathField,
14241
+ scope: scopeField
14242
+ }, async ({ tag, search, confirm, store_path, scope }) => {
14243
+ if (!confirm)
14244
+ return errorText("Refusing bulk delete without confirm=true.");
14245
+ if (!tag && !search)
14246
+ return errorText("Missing filter. Use tag or search.");
14247
+ const storePath = resolveStorePath(store_path, scope);
14248
+ const deleted = writeStoreLocked(storePath, (db) => {
14249
+ const q = search ? search.toLowerCase() : "";
14250
+ const tags = (tag ?? []).map((entry) => entry.toLowerCase());
14251
+ const deleteIds = new Set(db.items.filter((item) => {
14252
+ const matchesSearch = q ? item.title.toLowerCase().includes(q) || item.content.toLowerCase().includes(q) : false;
14253
+ const itemTags = (item.tags ?? []).map((entry) => entry.toLowerCase());
14254
+ const matchesTag = tags.length > 0 ? tags.some((entry) => itemTags.includes(entry)) : false;
14255
+ return matchesSearch || matchesTag;
14256
+ }).map((item) => item.id));
14257
+ db.items = db.items.filter((item) => !deleteIds.has(item.id));
14258
+ return deleteIds.size;
14259
+ });
14260
+ return jsonText({ ok: true, deleted });
14261
+ });
14262
+ registerTool(server, "ok_prune", "Prune knowledge items", "Remove old and/or empty knowledge items. Requires confirm=true.", {
14263
+ older_than_days: exports_external.number().optional().describe("Remove items older than N days"),
14264
+ empty: exports_external.boolean().optional().describe("Remove items with empty content"),
14265
+ confirm: exports_external.boolean(),
14266
+ store_path: storePathField,
14267
+ scope: scopeField
14268
+ }, async ({ older_than_days, empty, confirm, store_path, scope }) => {
14269
+ if (!confirm)
14270
+ return errorText("Refusing prune without confirm=true.");
14271
+ const storePath = resolveStorePath(store_path, scope);
14272
+ const pruned = writeStoreLocked(storePath, (db) => {
14794
14273
  const before = db.items.length;
14795
- let items = db.items;
14796
- if (tag && tag.length > 0) {
14797
- items = items.filter((x) => {
14798
- const itemTags = (x.tags ?? []).map((t) => t.toLowerCase());
14799
- return tag.some((t) => itemTags.includes(t.toLowerCase()));
14800
- });
14801
- }
14802
- if (search) {
14803
- const q = search.toLowerCase();
14804
- items = items.filter((x) => x.title.toLowerCase().includes(q) || x.content.toLowerCase().includes(q));
14805
- }
14806
- const deleteIds = new Set(items.map((x) => x.id));
14807
- db.items = db.items.filter((x) => !deleteIds.has(x.id));
14808
- const deleted = before - db.items.length;
14809
- saveStore(resolveStore(store_path), db);
14810
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, deleted }, null, 2) }] };
14811
- }
14812
- });
14813
- server.registerTool("ok_stats", {
14814
- title: "Knowledge store statistics",
14815
- description: "Get stats about the knowledge store: total items, tags, recent activity",
14816
- inputSchema: createStatsSchema(),
14817
- handler: async ({ store_path }) => {
14818
- const db = loadStore(resolveStore(store_path));
14819
- const items = db.items.filter((x) => !x.archived);
14820
- const total = items.length;
14274
+ let cutoff = null;
14275
+ if (older_than_days !== undefined) {
14276
+ cutoff = new Date;
14277
+ cutoff.setDate(cutoff.getDate() - older_than_days);
14278
+ }
14279
+ db.items = db.items.filter((item) => {
14280
+ if (cutoff && new Date(item.created_at) < cutoff)
14281
+ return false;
14282
+ if (empty && item.content.trim().length === 0)
14283
+ return false;
14284
+ return true;
14285
+ });
14286
+ return before - db.items.length;
14287
+ });
14288
+ return jsonText({ ok: true, pruned });
14289
+ });
14290
+ registerTool(server, "ok_dedupe", "Dedupe knowledge items", "Remove duplicate items by title and content. Requires confirm=true.", {
14291
+ confirm: exports_external.boolean(),
14292
+ store_path: storePathField,
14293
+ scope: scopeField
14294
+ }, async ({ confirm, store_path, scope }) => {
14295
+ if (!confirm)
14296
+ return errorText("Refusing dedupe without confirm=true.");
14297
+ const storePath = resolveStorePath(store_path, scope);
14298
+ const removed = writeStoreLocked(storePath, (db) => {
14299
+ const seen = new Set;
14300
+ const before = db.items.length;
14301
+ db.items = db.items.filter((item) => {
14302
+ const key = `${item.title}\x00${item.content}`;
14303
+ if (seen.has(key))
14304
+ return false;
14305
+ seen.add(key);
14306
+ return true;
14307
+ });
14308
+ return before - db.items.length;
14309
+ });
14310
+ return jsonText({ ok: true, removed });
14311
+ });
14312
+ registerTool(server, "ok_stats", "Knowledge store statistics", "Get aggregate stats about the knowledge store", {
14313
+ store_path: storePathField,
14314
+ scope: scopeField
14315
+ }, async ({ store_path, scope }) => {
14316
+ const storePath = resolveStorePath(store_path, scope);
14317
+ return readStoreLocked(storePath, (db) => {
14318
+ const items = activeItems(db.items, false);
14821
14319
  const tagCounts = {};
14822
14320
  for (const item of items) {
14823
- for (const t of item.tags ?? []) {
14824
- tagCounts[t] = (tagCounts[t] ?? 0) + 1;
14825
- }
14826
- }
14827
- const now = new Date;
14828
- const today = now.toISOString().slice(0, 10);
14829
- const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString();
14830
- return {
14831
- content: [{ type: "text", text: JSON.stringify({
14832
- total,
14833
- created_today: items.filter((x) => x.created_at.slice(0, 10) === today).length,
14834
- created_week: items.filter((x) => x.created_at > weekAgo).length,
14835
- updated_week: items.filter((x) => x.updated_at && x.updated_at > weekAgo).length,
14836
- tags: Object.fromEntries(Object.entries(tagCounts).sort((a, b) => b[1] - a[1]))
14837
- }, null, 2) }]
14838
- };
14839
- }
14321
+ for (const tag of item.tags ?? [])
14322
+ tagCounts[tag] = (tagCounts[tag] ?? 0) + 1;
14323
+ }
14324
+ return jsonText({
14325
+ ok: true,
14326
+ total: items.length,
14327
+ archived: db.items.length - items.length,
14328
+ tags: Object.fromEntries(Object.entries(tagCounts).sort((a, b) => b[1] - a[1]))
14329
+ });
14330
+ });
14840
14331
  });
14841
- server.registerTool("ok_export", {
14842
- title: "Export knowledge items",
14843
- description: "Export all items to a JSON file",
14844
- inputSchema: createExportSchema(),
14845
- handler: async ({ file: file2, store_path }) => {
14846
- const db = loadStore(resolveStore(store_path));
14332
+ registerTool(server, "ok_export", "Export knowledge items", "Export all items to a JSON file", {
14333
+ file: exports_external.string().optional().describe("Output file path"),
14334
+ store_path: storePathField,
14335
+ scope: scopeField
14336
+ }, async ({ file: file2, store_path, scope }) => {
14337
+ const storePath = resolveStorePath(store_path, scope);
14338
+ return readStoreLocked(storePath, (db) => {
14847
14339
  const filePath = file2 || "./knowledge-export.json";
14848
- writeFileSync2(filePath, JSON.stringify(db, null, 2));
14849
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, file: filePath, count: db.items.length }, null, 2) }] };
14850
- }
14340
+ writeFileSync3(filePath, JSON.stringify(db, null, 2));
14341
+ return jsonText({ ok: true, file: filePath, count: db.items.length });
14342
+ });
14851
14343
  });
14852
- server.registerTool("ok_import", {
14853
- title: "Import knowledge items",
14854
- description: "Import items from an exported JSON file, skipping duplicates",
14855
- inputSchema: createImportSchema(),
14856
- handler: async ({ file: file2, store_path }) => {
14857
- if (!existsSync2(file2)) {
14858
- return { content: [{ type: "text", text: `Error: File not found: ${file2}` }] };
14859
- }
14860
- const raw = readFileSync2(file2, "utf8");
14861
- const imported = JSON.parse(raw);
14862
- if (!imported || !Array.isArray(imported.items)) {
14863
- return { content: [{ type: "text", text: 'Error: Invalid import file: expected {"items": [...]}' }] };
14864
- }
14865
- const db = loadStore(resolveStore(store_path));
14866
- const existingIds = new Set(db.items.map((x) => x.id));
14344
+ registerTool(server, "ok_import", "Import knowledge items", "Import items from an exported JSON file, skipping duplicate IDs", {
14345
+ file: exports_external.string().describe("Path to exported JSON file"),
14346
+ store_path: storePathField,
14347
+ scope: scopeField
14348
+ }, async ({ file: file2, store_path, scope }) => {
14349
+ if (!existsSync3(file2))
14350
+ return errorText(`File not found: ${file2}`);
14351
+ const imported = JSON.parse(readFileSync3(file2, "utf8"));
14352
+ if (!imported || !Array.isArray(imported.items))
14353
+ return errorText('Invalid import file: expected {"items": [...]}');
14354
+ const storePath = resolveStorePath(store_path, scope);
14355
+ const result = writeStoreLocked(storePath, (db) => {
14356
+ const existingIds = new Set(db.items.map((item) => item.id));
14867
14357
  let added = 0;
14868
14358
  for (const item of imported.items) {
14869
14359
  if (!existingIds.has(item.id)) {
14870
14360
  db.items.push(item);
14361
+ existingIds.add(item.id);
14871
14362
  added += 1;
14872
14363
  }
14873
14364
  }
14874
- saveStore(resolveStore(store_path), db);
14875
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, added, skipped: imported.items.length - added }, null, 2) }] };
14876
- }
14365
+ return { added, skipped: imported.items.length - added };
14366
+ });
14367
+ return jsonText({ ok: true, ...result });
14877
14368
  });
14878
- server.registerTool("ok_batch", {
14879
- title: "Batch add knowledge items",
14880
- description: "Add multiple items at once from an array of item objects",
14881
- inputSchema: createBatchSchema(),
14882
- handler: async ({ items, store_path }) => {
14883
- const db = loadStore(resolveStore(store_path));
14884
- const now = new Date().toISOString();
14885
- const existingIds = new Set(db.items.map((x) => x.id));
14369
+ registerTool(server, "ok_batch", "Batch add knowledge items", "Add multiple items at once", {
14370
+ items: exports_external.array(exports_external.object({
14371
+ id: exports_external.string().optional(),
14372
+ title: exports_external.string(),
14373
+ content: exports_external.string(),
14374
+ tags: exports_external.array(exports_external.string()).optional(),
14375
+ metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
14376
+ created_at: exports_external.string().optional(),
14377
+ updated_at: exports_external.string().optional()
14378
+ })),
14379
+ store_path: storePathField,
14380
+ scope: scopeField
14381
+ }, async ({ items, store_path, scope }) => {
14382
+ const storePath = resolveStorePath(store_path, scope);
14383
+ const result = writeStoreLocked(storePath, (db) => {
14384
+ const existingIds = new Set(db.items.map((item) => item.id));
14886
14385
  let added = 0;
14887
14386
  let skipped = 0;
14387
+ const now = new Date().toISOString();
14888
14388
  for (const entry of items) {
14889
14389
  if (entry.id && existingIds.has(entry.id)) {
14890
14390
  skipped += 1;
14891
14391
  continue;
14892
14392
  }
14893
- if (!entry.title || !entry.content) {
14894
- skipped += 1;
14895
- continue;
14896
- }
14897
- const ids = entry.id ? { id: entry.id, short_id: entry.short_id || null } : makeId();
14898
- const item = {
14899
- id: ids.id,
14900
- short_id: ids.short_id,
14393
+ const id = entry.id ?? makeId();
14394
+ db.items.push({
14395
+ id,
14396
+ short_id: shortIdFor(id),
14901
14397
  title: entry.title,
14902
14398
  content: entry.content,
14903
14399
  tags: entry.tags ?? [],
14904
14400
  metadata: entry.metadata ?? {},
14905
- created_at: entry.created_at || now,
14906
- updated_at: entry.updated_at || now
14907
- };
14908
- db.items.push(item);
14401
+ archived: false,
14402
+ created_at: entry.created_at ?? now,
14403
+ updated_at: entry.updated_at ?? now
14404
+ });
14405
+ existingIds.add(id);
14909
14406
  added += 1;
14910
14407
  }
14911
- saveStore(resolveStore(store_path), db);
14912
- return { content: [{ type: "text", text: JSON.stringify({ ok: true, added, skipped }, null, 2) }] };
14913
- }
14408
+ return { added, skipped };
14409
+ });
14410
+ return jsonText({ ok: true, ...result });
14914
14411
  });
14915
14412
  return server;
14916
14413
  }
@@ -14950,5 +14447,6 @@ if (import.meta.main) {
14950
14447
  });
14951
14448
  }
14952
14449
  export {
14450
+ main,
14953
14451
  buildServer
14954
14452
  };