@tonyclaw/agent-inspector 3.0.16 → 3.0.18

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.
Files changed (88) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-BJmxAiM0.js → CompareDrawer-Daj03-RL.js} +1 -1
  3. package/.output/public/assets/ProxyViewerContainer-BLCRQtU_.js +106 -0
  4. package/.output/public/assets/{ReplayDialog-CkLdOMJr.js → ReplayDialog-5FR5crdo.js} +1 -1
  5. package/.output/public/assets/{RequestAnatomy-DemOFfSc.js → RequestAnatomy-DF0hHdQY.js} +1 -1
  6. package/.output/public/assets/{ResponseView-9LhpuDo7.js → ResponseView-BwkMSsUa.js} +2 -2
  7. package/.output/public/assets/{StreamingChunkSequence-RRWYBOdz.js → StreamingChunkSequence-CKeUd58x.js} +1 -1
  8. package/.output/public/assets/{_sessionId-CWEh2Jsn.js → _sessionId-CThgXa41.js} +1 -1
  9. package/.output/public/assets/index-BHXN1Fsx.css +1 -0
  10. package/.output/public/assets/{index-Lwir70Rs.js → index-ClQ7Vi3J.js} +1 -1
  11. package/.output/public/assets/{index-hjNWJZGE.js → index-gm3A0idN.js} +1 -1
  12. package/.output/public/assets/{json-viewer-D8gvbDlB.js → json-viewer-BA-W-PZq.js} +1 -1
  13. package/.output/public/assets/{main-ovrz0tyD.js → main-BnRC1932.js} +2 -2
  14. package/.output/server/_libs/@opentelemetry/semantic-conventions+[...].mjs +2658 -0
  15. package/.output/server/_libs/agent-base.mjs +234 -0
  16. package/.output/server/_libs/anthropic-ai__sdk.mjs +6042 -0
  17. package/.output/server/_libs/atomically.mjs +3 -0
  18. package/.output/server/_libs/base64-js.mjs +102 -0
  19. package/.output/server/_libs/bignumber.js.mjs +1353 -0
  20. package/.output/server/_libs/buffer-equal-constant-time.mjs +38 -0
  21. package/.output/server/_libs/data-uri-to-buffer.mjs +39 -0
  22. package/.output/server/_libs/debug.mjs +547 -0
  23. package/.output/server/_libs/ecdsa-sig-formatter.mjs +162 -0
  24. package/.output/server/_libs/extend.mjs +2 -1
  25. package/.output/server/_libs/fetch-blob.mjs +287 -0
  26. package/.output/server/_libs/formdata-polyfill.mjs +88 -0
  27. package/.output/server/_libs/gaxios.mjs +927 -0
  28. package/.output/server/_libs/gcp-metadata.mjs +322 -0
  29. package/.output/server/_libs/google-auth-library.mjs +6339 -0
  30. package/.output/server/_libs/google-logging-utils.mjs +385 -0
  31. package/.output/server/_libs/google__genai.mjs +18034 -0
  32. package/.output/server/_libs/has-flag.mjs +16 -0
  33. package/.output/server/_libs/https-proxy-agent.mjs +280 -0
  34. package/.output/server/_libs/json-bigint.mjs +413 -0
  35. package/.output/server/_libs/jwa.mjs +233 -0
  36. package/.output/server/_libs/jws.mjs +298 -0
  37. package/.output/server/_libs/lucide-react.mjs +261 -226
  38. package/.output/server/_libs/mariozechner__pi-agent-core.mjs +824 -0
  39. package/.output/server/_libs/mariozechner__pi-ai.mjs +22889 -0
  40. package/.output/server/_libs/mistralai__mistralai.mjs +32045 -0
  41. package/.output/server/_libs/ms.mjs +120 -0
  42. package/.output/server/_libs/node-domexception.mjs +17 -0
  43. package/.output/server/_libs/node-fetch.mjs +1578 -0
  44. package/.output/server/_libs/ohash.mjs +1 -1
  45. package/.output/server/_libs/openai.mjs +6766 -0
  46. package/.output/server/_libs/opentelemetry__api.mjs +1678 -0
  47. package/.output/server/_libs/p-retry.mjs +87 -0
  48. package/.output/server/_libs/partial-json.mjs +244 -0
  49. package/.output/server/_libs/react-dom.mjs +5 -5
  50. package/.output/server/_libs/react-markdown.mjs +2 -2
  51. package/.output/server/_libs/react.mjs +30 -0
  52. package/.output/server/_libs/readable-stream.mjs +5 -5
  53. package/.output/server/_libs/retry.mjs +236 -0
  54. package/.output/server/_libs/safe-buffer.mjs +63 -1
  55. package/.output/server/_libs/srvx.mjs +2 -2
  56. package/.output/server/_libs/supports-color.mjs +108 -0
  57. package/.output/server/_libs/tanstack__router-core.mjs +1 -1
  58. package/.output/server/_libs/typebox.mjs +6596 -0
  59. package/.output/server/_libs/util-deprecate.mjs +2 -2
  60. package/.output/server/_libs/vfile.mjs +2 -2
  61. package/.output/server/_libs/web-streams-polyfill.mjs +4282 -0
  62. package/.output/server/_libs/ws.mjs +3715 -0
  63. package/.output/server/_libs/zod-to-json-schema.mjs +1207 -0
  64. package/.output/server/_libs/zod.mjs +597 -9
  65. package/.output/server/{_sessionId-zI_GFX_7.mjs → _sessionId-Bi3ZIrqT.mjs} +14 -13
  66. package/.output/server/_ssr/{CompareDrawer-Ckcx1RVu.mjs → CompareDrawer-BYZS_hCR.mjs} +14 -13
  67. package/.output/server/_ssr/{ProxyViewerContainer-BgXewlIr.mjs → ProxyViewerContainer-BE4umfVs.mjs} +205 -106
  68. package/.output/server/_ssr/{ReplayDialog-wx3nDtZn.mjs → ReplayDialog-BlID2ZH4.mjs} +15 -14
  69. package/.output/server/_ssr/{RequestAnatomy-DN80zt0G.mjs → RequestAnatomy-CGJ2lkzT.mjs} +14 -13
  70. package/.output/server/_ssr/{ResponseView-DD7rTu_l.mjs → ResponseView-DDjcGf7M.mjs} +14 -13
  71. package/.output/server/_ssr/{StreamingChunkSequence-DAgz6Vvw.mjs → StreamingChunkSequence-G7B8M5G2.mjs} +14 -13
  72. package/.output/server/_ssr/{index-dcTjp8du.mjs → index-ClQ9FvRJ.mjs} +13 -12
  73. package/.output/server/_ssr/index.mjs +4 -4
  74. package/.output/server/_ssr/{json-viewer-N2cuzGWR.mjs → json-viewer-CFbpkiBJ.mjs} +14 -13
  75. package/.output/server/_ssr/{router-BfQ0QsD5.mjs → router-Cq8LEvhE.mjs} +523 -97
  76. package/.output/server/_tanstack-start-manifest_v-p7J0QCMh.mjs +4 -0
  77. package/.output/server/index.mjs +75 -75
  78. package/package.json +4 -1
  79. package/src/components/ProxyViewer.tsx +3 -0
  80. package/src/components/pi-agent/PiAgentPanel.tsx +204 -0
  81. package/src/components/proxy-viewer/LogEntry.tsx +54 -19
  82. package/src/components/proxy-viewer/logEntryVisibility.ts +22 -0
  83. package/src/lib/piAgentContract.ts +21 -0
  84. package/src/routes/api/pi-agent.ts +29 -0
  85. package/src/services/piAgent.ts +390 -0
  86. package/.output/public/assets/ProxyViewerContainer-C40Nig73.js +0 -106
  87. package/.output/public/assets/index-HRfrFVYw.css +0 -1
  88. package/.output/server/_tanstack-start-manifest_v-BXnYrbcJ.mjs +0 -4
@@ -521,6 +521,34 @@ function formatError(error, mapper = (issue2) => issue2.message) {
521
521
  processError(error);
522
522
  return fieldErrors;
523
523
  }
524
+ function toDotPath(_path) {
525
+ const segs = [];
526
+ const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
527
+ for (const seg of path) {
528
+ if (typeof seg === "number")
529
+ segs.push(`[${seg}]`);
530
+ else if (typeof seg === "symbol")
531
+ segs.push(`[${JSON.stringify(String(seg))}]`);
532
+ else if (/[^\w$]/.test(seg))
533
+ segs.push(`[${JSON.stringify(seg)}]`);
534
+ else {
535
+ if (segs.length)
536
+ segs.push(".");
537
+ segs.push(seg);
538
+ }
539
+ }
540
+ return segs.join("");
541
+ }
542
+ function prettifyError(error) {
543
+ const lines = [];
544
+ const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
545
+ for (const issue2 of issues) {
546
+ lines.push(`✖ ${issue2.message}`);
547
+ if (issue2.path?.length)
548
+ lines.push(` → at ${toDotPath(issue2.path)}`);
549
+ }
550
+ return lines.join("\n");
551
+ }
524
552
  const _parse = (_Err) => (schema, value, _ctx, _params) => {
525
553
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
526
554
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -623,7 +651,7 @@ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z
623
651
  const base64url = /^[A-Za-z0-9_-]*$/;
624
652
  const e164 = /^\+[1-9]\d{6,14}$/;
625
653
  const 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])))`;
626
- const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
654
+ const date$2 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
627
655
  function timeSource(args) {
628
656
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
629
657
  const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
@@ -648,7 +676,7 @@ const string$1 = (params) => {
648
676
  };
649
677
  const integer = /^-?\d+$/;
650
678
  const number$2 = /^-?\d+(?:\.\d+)?$/;
651
- const boolean$1 = /^(?:true|false)$/i;
679
+ const boolean$2 = /^(?:true|false)$/i;
652
680
  const _null$2 = /^null$/i;
653
681
  const lowercase = /^[^A-Z]*$/;
654
682
  const uppercase = /^[^a-z]*$/;
@@ -1324,7 +1352,7 @@ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, d
1324
1352
  $ZodStringFormat.init(inst, def);
1325
1353
  });
1326
1354
  const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1327
- def.pattern ?? (def.pattern = date$1);
1355
+ def.pattern ?? (def.pattern = date$2);
1328
1356
  $ZodStringFormat.init(inst, def);
1329
1357
  });
1330
1358
  const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
@@ -1509,7 +1537,7 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
1509
1537
  });
1510
1538
  const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
1511
1539
  $ZodType.init(inst, def);
1512
- inst._zod.pattern = boolean$1;
1540
+ inst._zod.pattern = boolean$2;
1513
1541
  inst._zod.parse = (payload, _ctx) => {
1514
1542
  if (def.coerce)
1515
1543
  try {
@@ -1565,6 +1593,45 @@ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1565
1593
  return payload;
1566
1594
  };
1567
1595
  });
1596
+ const $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
1597
+ $ZodType.init(inst, def);
1598
+ inst._zod.parse = (payload, _ctx) => {
1599
+ const input = payload.value;
1600
+ if (typeof input === "undefined")
1601
+ return payload;
1602
+ payload.issues.push({
1603
+ expected: "void",
1604
+ code: "invalid_type",
1605
+ input,
1606
+ inst
1607
+ });
1608
+ return payload;
1609
+ };
1610
+ });
1611
+ const $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
1612
+ $ZodType.init(inst, def);
1613
+ inst._zod.parse = (payload, _ctx) => {
1614
+ if (def.coerce) {
1615
+ try {
1616
+ payload.value = new Date(payload.value);
1617
+ } catch (_err) {
1618
+ }
1619
+ }
1620
+ const input = payload.value;
1621
+ const isDate = input instanceof Date;
1622
+ const isValidDate = isDate && !Number.isNaN(input.getTime());
1623
+ if (isValidDate)
1624
+ return payload;
1625
+ payload.issues.push({
1626
+ expected: "date",
1627
+ code: "invalid_type",
1628
+ input,
1629
+ ...isDate ? { received: "Invalid Date" } : {},
1630
+ inst
1631
+ });
1632
+ return payload;
1633
+ };
1634
+ });
1568
1635
  function handleArrayResult(result, final, index) {
1569
1636
  if (result.issues.length) {
1570
1637
  final.issues.push(...prefixIssues(index, result.issues));
@@ -2836,6 +2903,14 @@ function _boolean(Class, params) {
2836
2903
  });
2837
2904
  }
2838
2905
  // @__NO_SIDE_EFFECTS__
2906
+ function _coercedBoolean(Class, params) {
2907
+ return new Class({
2908
+ type: "boolean",
2909
+ coerce: true,
2910
+ ...normalizeParams(params)
2911
+ });
2912
+ }
2913
+ // @__NO_SIDE_EFFECTS__
2839
2914
  function _null$1(Class, params) {
2840
2915
  return new Class({
2841
2916
  type: "null",
@@ -2862,6 +2937,20 @@ function _never(Class, params) {
2862
2937
  });
2863
2938
  }
2864
2939
  // @__NO_SIDE_EFFECTS__
2940
+ function _void$1(Class, params) {
2941
+ return new Class({
2942
+ type: "void",
2943
+ ...normalizeParams(params)
2944
+ });
2945
+ }
2946
+ // @__NO_SIDE_EFFECTS__
2947
+ function _date(Class, params) {
2948
+ return new Class({
2949
+ type: "date",
2950
+ ...normalizeParams(params)
2951
+ });
2952
+ }
2953
+ // @__NO_SIDE_EFFECTS__
2865
2954
  function _lt(value, params) {
2866
2955
  return new $ZodCheckLessThan({
2867
2956
  check: "less_than",
@@ -3021,6 +3110,18 @@ function _array(Class, element, params) {
3021
3110
  });
3022
3111
  }
3023
3112
  // @__NO_SIDE_EFFECTS__
3113
+ function _custom(Class, fn, _params) {
3114
+ const norm = normalizeParams(_params);
3115
+ norm.abort ?? (norm.abort = true);
3116
+ const schema = new Class({
3117
+ type: "custom",
3118
+ check: "custom",
3119
+ fn,
3120
+ ...norm
3121
+ });
3122
+ return schema;
3123
+ }
3124
+ // @__NO_SIDE_EFFECTS__
3024
3125
  function _refine(Class, fn, _params) {
3025
3126
  const schema = new Class({
3026
3127
  type: "custom",
@@ -3496,6 +3597,16 @@ const numberProcessor = (schema, ctx, _json, _params) => {
3496
3597
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3497
3598
  json.type = "boolean";
3498
3599
  };
3600
+ const bigintProcessor = (_schema, ctx, _json, _params) => {
3601
+ if (ctx.unrepresentable === "throw") {
3602
+ throw new Error("BigInt cannot be represented in JSON Schema");
3603
+ }
3604
+ };
3605
+ const symbolProcessor = (_schema, ctx, _json, _params) => {
3606
+ if (ctx.unrepresentable === "throw") {
3607
+ throw new Error("Symbols cannot be represented in JSON Schema");
3608
+ }
3609
+ };
3499
3610
  const nullProcessor = (_schema, ctx, json, _params) => {
3500
3611
  if (ctx.target === "openapi-3.0") {
3501
3612
  json.type = "string";
@@ -3505,6 +3616,16 @@ const nullProcessor = (_schema, ctx, json, _params) => {
3505
3616
  json.type = "null";
3506
3617
  }
3507
3618
  };
3619
+ const undefinedProcessor = (_schema, ctx, _json, _params) => {
3620
+ if (ctx.unrepresentable === "throw") {
3621
+ throw new Error("Undefined cannot be represented in JSON Schema");
3622
+ }
3623
+ };
3624
+ const voidProcessor = (_schema, ctx, _json, _params) => {
3625
+ if (ctx.unrepresentable === "throw") {
3626
+ throw new Error("Void cannot be represented in JSON Schema");
3627
+ }
3628
+ };
3508
3629
  const neverProcessor = (_schema, _ctx, json, _params) => {
3509
3630
  json.not = {};
3510
3631
  };
@@ -3512,6 +3633,11 @@ const anyProcessor = (_schema, _ctx, _json, _params) => {
3512
3633
  };
3513
3634
  const unknownProcessor = (_schema, _ctx, _json, _params) => {
3514
3635
  };
3636
+ const dateProcessor = (_schema, ctx, _json, _params) => {
3637
+ if (ctx.unrepresentable === "throw") {
3638
+ throw new Error("Date cannot be represented in JSON Schema");
3639
+ }
3640
+ };
3515
3641
  const enumProcessor = (schema, _ctx, json, _params) => {
3516
3642
  const def = schema._zod.def;
3517
3643
  const values = getEnumValues(def.entries);
@@ -3560,16 +3686,71 @@ const literalProcessor = (schema, ctx, json, _params) => {
3560
3686
  json.enum = vals;
3561
3687
  }
3562
3688
  };
3689
+ const nanProcessor = (_schema, ctx, _json, _params) => {
3690
+ if (ctx.unrepresentable === "throw") {
3691
+ throw new Error("NaN cannot be represented in JSON Schema");
3692
+ }
3693
+ };
3694
+ const templateLiteralProcessor = (schema, _ctx, json, _params) => {
3695
+ const _json = json;
3696
+ const pattern = schema._zod.pattern;
3697
+ if (!pattern)
3698
+ throw new Error("Pattern not found in template literal");
3699
+ _json.type = "string";
3700
+ _json.pattern = pattern.source;
3701
+ };
3702
+ const fileProcessor = (schema, _ctx, json, _params) => {
3703
+ const _json = json;
3704
+ const file = {
3705
+ type: "string",
3706
+ format: "binary",
3707
+ contentEncoding: "binary"
3708
+ };
3709
+ const { minimum, maximum, mime } = schema._zod.bag;
3710
+ if (minimum !== void 0)
3711
+ file.minLength = minimum;
3712
+ if (maximum !== void 0)
3713
+ file.maxLength = maximum;
3714
+ if (mime) {
3715
+ if (mime.length === 1) {
3716
+ file.contentMediaType = mime[0];
3717
+ Object.assign(_json, file);
3718
+ } else {
3719
+ Object.assign(_json, file);
3720
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
3721
+ }
3722
+ } else {
3723
+ Object.assign(_json, file);
3724
+ }
3725
+ };
3726
+ const successProcessor = (_schema, _ctx, json, _params) => {
3727
+ json.type = "boolean";
3728
+ };
3563
3729
  const customProcessor = (_schema, ctx, _json, _params) => {
3564
3730
  if (ctx.unrepresentable === "throw") {
3565
3731
  throw new Error("Custom types cannot be represented in JSON Schema");
3566
3732
  }
3567
3733
  };
3734
+ const functionProcessor = (_schema, ctx, _json, _params) => {
3735
+ if (ctx.unrepresentable === "throw") {
3736
+ throw new Error("Function types cannot be represented in JSON Schema");
3737
+ }
3738
+ };
3568
3739
  const transformProcessor = (_schema, ctx, _json, _params) => {
3569
3740
  if (ctx.unrepresentable === "throw") {
3570
3741
  throw new Error("Transforms cannot be represented in JSON Schema");
3571
3742
  }
3572
3743
  };
3744
+ const mapProcessor = (_schema, ctx, _json, _params) => {
3745
+ if (ctx.unrepresentable === "throw") {
3746
+ throw new Error("Map cannot be represented in JSON Schema");
3747
+ }
3748
+ };
3749
+ const setProcessor = (_schema, ctx, _json, _params) => {
3750
+ if (ctx.unrepresentable === "throw") {
3751
+ throw new Error("Set cannot be represented in JSON Schema");
3752
+ }
3753
+ };
3573
3754
  const arrayProcessor = (schema, ctx, _json, params) => {
3574
3755
  const json = _json;
3575
3756
  const def = schema._zod.def;
@@ -3647,6 +3828,48 @@ const intersectionProcessor = (schema, ctx, json, params) => {
3647
3828
  ];
3648
3829
  json.allOf = allOf;
3649
3830
  };
3831
+ const tupleProcessor = (schema, ctx, _json, params) => {
3832
+ const json = _json;
3833
+ const def = schema._zod.def;
3834
+ json.type = "array";
3835
+ const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
3836
+ const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
3837
+ const prefixItems = def.items.map((x, i) => process(x, ctx, {
3838
+ ...params,
3839
+ path: [...params.path, prefixPath, i]
3840
+ }));
3841
+ const rest = def.rest ? process(def.rest, ctx, {
3842
+ ...params,
3843
+ path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
3844
+ }) : null;
3845
+ if (ctx.target === "draft-2020-12") {
3846
+ json.prefixItems = prefixItems;
3847
+ if (rest) {
3848
+ json.items = rest;
3849
+ }
3850
+ } else if (ctx.target === "openapi-3.0") {
3851
+ json.items = {
3852
+ anyOf: prefixItems
3853
+ };
3854
+ if (rest) {
3855
+ json.items.anyOf.push(rest);
3856
+ }
3857
+ json.minItems = prefixItems.length;
3858
+ if (!rest) {
3859
+ json.maxItems = prefixItems.length;
3860
+ }
3861
+ } else {
3862
+ json.items = prefixItems;
3863
+ if (rest) {
3864
+ json.additionalItems = rest;
3865
+ }
3866
+ }
3867
+ const { minimum, maximum } = schema._zod.bag;
3868
+ if (typeof minimum === "number")
3869
+ json.minItems = minimum;
3870
+ if (typeof maximum === "number")
3871
+ json.maxItems = maximum;
3872
+ };
3650
3873
  const recordProcessor = (schema, ctx, _json, params) => {
3651
3874
  const json = _json;
3652
3875
  const def = schema._zod.def;
@@ -3742,6 +3965,12 @@ const readonlyProcessor = (schema, ctx, json, params) => {
3742
3965
  seen.ref = def.innerType;
3743
3966
  json.readOnly = true;
3744
3967
  };
3968
+ const promiseProcessor = (schema, ctx, _json, params) => {
3969
+ const def = schema._zod.def;
3970
+ process(def.innerType, ctx, params);
3971
+ const seen = ctx.seen.get(schema);
3972
+ seen.ref = def.innerType;
3973
+ };
3745
3974
  const optionalProcessor = (schema, ctx, _json, params) => {
3746
3975
  const def = schema._zod.def;
3747
3976
  process(def.innerType, ctx, params);
@@ -3754,6 +3983,81 @@ const lazyProcessor = (schema, ctx, _json, params) => {
3754
3983
  const seen = ctx.seen.get(schema);
3755
3984
  seen.ref = innerType;
3756
3985
  };
3986
+ const allProcessors = {
3987
+ string: stringProcessor,
3988
+ number: numberProcessor,
3989
+ boolean: booleanProcessor,
3990
+ bigint: bigintProcessor,
3991
+ symbol: symbolProcessor,
3992
+ null: nullProcessor,
3993
+ undefined: undefinedProcessor,
3994
+ void: voidProcessor,
3995
+ never: neverProcessor,
3996
+ any: anyProcessor,
3997
+ unknown: unknownProcessor,
3998
+ date: dateProcessor,
3999
+ enum: enumProcessor,
4000
+ literal: literalProcessor,
4001
+ nan: nanProcessor,
4002
+ template_literal: templateLiteralProcessor,
4003
+ file: fileProcessor,
4004
+ success: successProcessor,
4005
+ custom: customProcessor,
4006
+ function: functionProcessor,
4007
+ transform: transformProcessor,
4008
+ map: mapProcessor,
4009
+ set: setProcessor,
4010
+ array: arrayProcessor,
4011
+ object: objectProcessor,
4012
+ union: unionProcessor,
4013
+ intersection: intersectionProcessor,
4014
+ tuple: tupleProcessor,
4015
+ record: recordProcessor,
4016
+ nullable: nullableProcessor,
4017
+ nonoptional: nonoptionalProcessor,
4018
+ default: defaultProcessor,
4019
+ prefault: prefaultProcessor,
4020
+ catch: catchProcessor,
4021
+ pipe: pipeProcessor,
4022
+ readonly: readonlyProcessor,
4023
+ promise: promiseProcessor,
4024
+ optional: optionalProcessor,
4025
+ lazy: lazyProcessor
4026
+ };
4027
+ function toJSONSchema(input, params) {
4028
+ if ("_idmap" in input) {
4029
+ const registry2 = input;
4030
+ const ctx2 = initializeContext({ ...params, processors: allProcessors });
4031
+ const defs = {};
4032
+ for (const entry of registry2._idmap.entries()) {
4033
+ const [_, schema] = entry;
4034
+ process(schema, ctx2);
4035
+ }
4036
+ const schemas = {};
4037
+ const external = {
4038
+ registry: registry2,
4039
+ uri: params?.uri,
4040
+ defs
4041
+ };
4042
+ ctx2.external = external;
4043
+ for (const entry of registry2._idmap.entries()) {
4044
+ const [key, schema] = entry;
4045
+ extractDefs(ctx2, schema);
4046
+ schemas[key] = finalize(ctx2, schema);
4047
+ }
4048
+ if (Object.keys(defs).length > 0) {
4049
+ const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
4050
+ schemas.__shared = {
4051
+ [defsSegment]: defs
4052
+ };
4053
+ }
4054
+ return { schemas };
4055
+ }
4056
+ const ctx = initializeContext({ ...params, processors: allProcessors });
4057
+ process(input, ctx);
4058
+ extractDefs(ctx, input);
4059
+ return finalize(ctx, input);
4060
+ }
3757
4061
  const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
3758
4062
  $ZodISODateTime.init(inst, def);
3759
4063
  ZodStringFormat.init(inst, def);
@@ -3765,7 +4069,7 @@ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
3765
4069
  $ZodISODate.init(inst, def);
3766
4070
  ZodStringFormat.init(inst, def);
3767
4071
  });
3768
- function date(params) {
4072
+ function date$1(params) {
3769
4073
  return /* @__PURE__ */ _isoDate(ZodISODate, params);
3770
4074
  }
3771
4075
  const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
@@ -3965,7 +4269,7 @@ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
3965
4269
  inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3966
4270
  inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3967
4271
  inst.datetime = (params) => inst.check(datetime(params));
3968
- inst.date = (params) => inst.check(date(params));
4272
+ inst.date = (params) => inst.check(date$1(params));
3969
4273
  inst.time = (params) => inst.check(time(params));
3970
4274
  inst.duration = (params) => inst.check(duration(params));
3971
4275
  });
@@ -4096,7 +4400,7 @@ const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
4096
4400
  ZodType.init(inst, def);
4097
4401
  inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
4098
4402
  });
4099
- function boolean(params) {
4403
+ function boolean$1(params) {
4100
4404
  return /* @__PURE__ */ _boolean(ZodBoolean, params);
4101
4405
  }
4102
4406
  const ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
@@ -4131,6 +4435,27 @@ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
4131
4435
  function never(params) {
4132
4436
  return /* @__PURE__ */ _never(ZodNever, params);
4133
4437
  }
4438
+ const ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
4439
+ $ZodVoid.init(inst, def);
4440
+ ZodType.init(inst, def);
4441
+ inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx);
4442
+ });
4443
+ function _void(params) {
4444
+ return /* @__PURE__ */ _void$1(ZodVoid, params);
4445
+ }
4446
+ const ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
4447
+ $ZodDate.init(inst, def);
4448
+ ZodType.init(inst, def);
4449
+ inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx);
4450
+ inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
4451
+ inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
4452
+ const c = inst._zod.bag;
4453
+ inst.minDate = c.minimum ? new Date(c.minimum) : null;
4454
+ inst.maxDate = c.maximum ? new Date(c.maximum) : null;
4455
+ });
4456
+ function date(params) {
4457
+ return /* @__PURE__ */ _date(ZodDate, params);
4458
+ }
4134
4459
  const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
4135
4460
  $ZodArray.init(inst, def);
4136
4461
  ZodType.init(inst, def);
@@ -4481,6 +4806,9 @@ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
4481
4806
  ZodType.init(inst, def);
4482
4807
  inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx);
4483
4808
  });
4809
+ function custom(fn, _params) {
4810
+ return /* @__PURE__ */ _custom(ZodCustom, fn ?? (() => true), _params);
4811
+ }
4484
4812
  function refine(fn, _params = {}) {
4485
4813
  return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
4486
4814
  }
@@ -4496,13 +4824,268 @@ const ZodIssueCode = {
4496
4824
  function number(params) {
4497
4825
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
4498
4826
  }
4827
+ function boolean(params) {
4828
+ return /* @__PURE__ */ _coercedBoolean(ZodBoolean, params);
4829
+ }
4830
+ var util;
4831
+ (function(util2) {
4832
+ util2.assertEqual = (_) => {
4833
+ };
4834
+ function assertIs(_arg) {
4835
+ }
4836
+ util2.assertIs = assertIs;
4837
+ function assertNever(_x) {
4838
+ throw new Error();
4839
+ }
4840
+ util2.assertNever = assertNever;
4841
+ util2.arrayToEnum = (items) => {
4842
+ const obj = {};
4843
+ for (const item of items) {
4844
+ obj[item] = item;
4845
+ }
4846
+ return obj;
4847
+ };
4848
+ util2.getValidEnumValues = (obj) => {
4849
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
4850
+ const filtered = {};
4851
+ for (const k of validKeys) {
4852
+ filtered[k] = obj[k];
4853
+ }
4854
+ return util2.objectValues(filtered);
4855
+ };
4856
+ util2.objectValues = (obj) => {
4857
+ return util2.objectKeys(obj).map(function(e) {
4858
+ return obj[e];
4859
+ });
4860
+ };
4861
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object2) => {
4862
+ const keys = [];
4863
+ for (const key in object2) {
4864
+ if (Object.prototype.hasOwnProperty.call(object2, key)) {
4865
+ keys.push(key);
4866
+ }
4867
+ }
4868
+ return keys;
4869
+ };
4870
+ util2.find = (arr, checker) => {
4871
+ for (const item of arr) {
4872
+ if (checker(item))
4873
+ return item;
4874
+ }
4875
+ return void 0;
4876
+ };
4877
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
4878
+ function joinValues(array2, separator = " | ") {
4879
+ return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
4880
+ }
4881
+ util2.joinValues = joinValues;
4882
+ util2.jsonStringifyReplacer = (_, value) => {
4883
+ if (typeof value === "bigint") {
4884
+ return value.toString();
4885
+ }
4886
+ return value;
4887
+ };
4888
+ })(util || (util = {}));
4889
+ var objectUtil;
4890
+ (function(objectUtil2) {
4891
+ objectUtil2.mergeShapes = (first, second) => {
4892
+ return {
4893
+ ...first,
4894
+ ...second
4895
+ // second overwrites first
4896
+ };
4897
+ };
4898
+ })(objectUtil || (objectUtil = {}));
4899
+ util.arrayToEnum([
4900
+ "string",
4901
+ "nan",
4902
+ "number",
4903
+ "integer",
4904
+ "float",
4905
+ "boolean",
4906
+ "date",
4907
+ "bigint",
4908
+ "symbol",
4909
+ "function",
4910
+ "undefined",
4911
+ "null",
4912
+ "array",
4913
+ "object",
4914
+ "unknown",
4915
+ "promise",
4916
+ "void",
4917
+ "never",
4918
+ "map",
4919
+ "set"
4920
+ ]);
4921
+ util.arrayToEnum([
4922
+ "invalid_type",
4923
+ "invalid_literal",
4924
+ "custom",
4925
+ "invalid_union",
4926
+ "invalid_union_discriminator",
4927
+ "invalid_enum_value",
4928
+ "unrecognized_keys",
4929
+ "invalid_arguments",
4930
+ "invalid_return_type",
4931
+ "invalid_date",
4932
+ "invalid_string",
4933
+ "too_small",
4934
+ "too_big",
4935
+ "invalid_intersection_types",
4936
+ "not_multiple_of",
4937
+ "not_finite"
4938
+ ]);
4939
+ class ZodError extends Error {
4940
+ get errors() {
4941
+ return this.issues;
4942
+ }
4943
+ constructor(issues) {
4944
+ super();
4945
+ this.issues = [];
4946
+ this.addIssue = (sub) => {
4947
+ this.issues = [...this.issues, sub];
4948
+ };
4949
+ this.addIssues = (subs = []) => {
4950
+ this.issues = [...this.issues, ...subs];
4951
+ };
4952
+ const actualProto = new.target.prototype;
4953
+ if (Object.setPrototypeOf) {
4954
+ Object.setPrototypeOf(this, actualProto);
4955
+ } else {
4956
+ this.__proto__ = actualProto;
4957
+ }
4958
+ this.name = "ZodError";
4959
+ this.issues = issues;
4960
+ }
4961
+ format(_mapper) {
4962
+ const mapper = _mapper || function(issue2) {
4963
+ return issue2.message;
4964
+ };
4965
+ const fieldErrors = { _errors: [] };
4966
+ const processError = (error) => {
4967
+ for (const issue2 of error.issues) {
4968
+ if (issue2.code === "invalid_union") {
4969
+ issue2.unionErrors.map(processError);
4970
+ } else if (issue2.code === "invalid_return_type") {
4971
+ processError(issue2.returnTypeError);
4972
+ } else if (issue2.code === "invalid_arguments") {
4973
+ processError(issue2.argumentsError);
4974
+ } else if (issue2.path.length === 0) {
4975
+ fieldErrors._errors.push(mapper(issue2));
4976
+ } else {
4977
+ let curr = fieldErrors;
4978
+ let i = 0;
4979
+ while (i < issue2.path.length) {
4980
+ const el = issue2.path[i];
4981
+ const terminal = i === issue2.path.length - 1;
4982
+ if (!terminal) {
4983
+ curr[el] = curr[el] || { _errors: [] };
4984
+ } else {
4985
+ curr[el] = curr[el] || { _errors: [] };
4986
+ curr[el]._errors.push(mapper(issue2));
4987
+ }
4988
+ curr = curr[el];
4989
+ i++;
4990
+ }
4991
+ }
4992
+ }
4993
+ };
4994
+ processError(this);
4995
+ return fieldErrors;
4996
+ }
4997
+ static assert(value) {
4998
+ if (!(value instanceof ZodError)) {
4999
+ throw new Error(`Not a ZodError: ${value}`);
5000
+ }
5001
+ }
5002
+ toString() {
5003
+ return this.message;
5004
+ }
5005
+ get message() {
5006
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
5007
+ }
5008
+ get isEmpty() {
5009
+ return this.issues.length === 0;
5010
+ }
5011
+ flatten(mapper = (issue2) => issue2.message) {
5012
+ const fieldErrors = /* @__PURE__ */ Object.create(null);
5013
+ const formErrors = [];
5014
+ for (const sub of this.issues) {
5015
+ if (sub.path.length > 0) {
5016
+ const firstEl = sub.path[0];
5017
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
5018
+ fieldErrors[firstEl].push(mapper(sub));
5019
+ } else {
5020
+ formErrors.push(mapper(sub));
5021
+ }
5022
+ }
5023
+ return { formErrors, fieldErrors };
5024
+ }
5025
+ get formErrors() {
5026
+ return this.flatten();
5027
+ }
5028
+ }
5029
+ ZodError.create = (issues) => {
5030
+ const error = new ZodError(issues);
5031
+ return error;
5032
+ };
5033
+ var errorUtil;
5034
+ (function(errorUtil2) {
5035
+ errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
5036
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
5037
+ })(errorUtil || (errorUtil = {}));
5038
+ var ZodFirstPartyTypeKind;
5039
+ (function(ZodFirstPartyTypeKind2) {
5040
+ ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
5041
+ ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
5042
+ ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
5043
+ ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
5044
+ ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
5045
+ ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
5046
+ ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
5047
+ ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
5048
+ ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
5049
+ ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
5050
+ ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
5051
+ ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
5052
+ ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
5053
+ ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
5054
+ ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
5055
+ ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
5056
+ ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
5057
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
5058
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
5059
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
5060
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
5061
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
5062
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
5063
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
5064
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
5065
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
5066
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
5067
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
5068
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
5069
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
5070
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
5071
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
5072
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
5073
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
5074
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
5075
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
5076
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4499
5077
  export {
5078
+ $ZodError as $,
5079
+ date as A,
5080
+ _void as B,
5081
+ toJSONSchema as C,
5082
+ ZodFirstPartyTypeKind as D,
4500
5083
  NEVER as N,
4501
5084
  ZodIssueCode as Z,
4502
5085
  _enum as _,
4503
5086
  array as a,
4504
5087
  string as b,
4505
- boolean as c,
5088
+ boolean$1 as c,
4506
5089
  object as d,
4507
5090
  unknown as e,
4508
5091
  looseObject as f,
@@ -4520,5 +5103,10 @@ export {
4520
5103
  record as r,
4521
5104
  safeParse as s,
4522
5105
  any as t,
4523
- union as u
5106
+ union as u,
5107
+ custom as v,
5108
+ boolean as w,
5109
+ prettifyError as x,
5110
+ int as y,
5111
+ nullable as z
4524
5112
  };