@cortexkit/magic-context 0.38.0 → 0.38.1

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 (2) hide show
  1. package/dist/index.js +1298 -2422
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20,12 +20,14 @@ var __toESM = (mod, isNodeMode, target) => {
20
20
  }
21
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
22
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
23
+ if (mod && typeof mod === "object" || typeof mod === "function") {
24
+ for (let key of __getOwnPropNames(mod))
25
+ if (!__hasOwnProp.call(to, key))
26
+ __defProp(to, key, {
27
+ get: __accessProp.bind(mod, key),
28
+ enumerable: true
29
+ });
30
+ }
29
31
  if (canCache)
30
32
  cache.set(mod, to);
31
33
  return to;
@@ -388,7 +390,7 @@ var init_main = __esm(() => {
388
390
  });
389
391
 
390
392
  // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
391
- var require_src = __commonJS((exports, module) => {
393
+ var require_src = __commonJS(function(exports, module) {
392
394
  var ESC2 = "\x1B";
393
395
  var CSI2 = `${ESC2}[`;
394
396
  var beep = "\x07";
@@ -457,25 +459,6 @@ function findCursor(s, o, l2) {
457
459
  const t = s + o, n = Math.max(l2.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
458
460
  return l2[e].disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
459
461
  }
460
- function findTextCursor(s, o, l2, i) {
461
- const t = i.split(`
462
- `);
463
- let n = 0, e = s;
464
- for (const r of t) {
465
- if (e <= r.length)
466
- break;
467
- e -= r.length + 1, n++;
468
- }
469
- for (n = Math.max(0, Math.min(t.length - 1, n + l2)), e = Math.min(e, t[n].length) + o;e < 0 && n > 0; )
470
- n--, e += t[n].length + 1;
471
- for (;e > t[n].length && n < t.length - 1; )
472
- e -= t[n].length + 1, n++;
473
- e = Math.max(0, Math.min(t[n].length, e));
474
- let h = 0;
475
- for (let r = 0;r < n; r++)
476
- h += t[r].length + 1;
477
- return h + e;
478
- }
479
462
  function isActionKey(n, e) {
480
463
  if (typeof n == "string")
481
464
  return settings.aliases.get(n) === e;
@@ -712,64 +695,7 @@ function m(l2, e) {
712
695
  if (e)
713
696
  return l2 ? e : e[0];
714
697
  }
715
- function M(r2) {
716
- return [...r2].map((t2) => _[t2]);
717
- }
718
- function P(r2) {
719
- const i = new Intl.DateTimeFormat(r2, {
720
- year: "numeric",
721
- month: "2-digit",
722
- day: "2-digit"
723
- }).formatToParts(new Date(2000, 0, 15)), s = [];
724
- let n = "/";
725
- for (const e of i)
726
- e.type === "literal" ? n = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
727
- return { segments: s, separator: n };
728
- }
729
- function p(r2) {
730
- return Number.parseInt((r2 || "0").replace(/_/g, "0"), 10) || 0;
731
- }
732
- function f(r2) {
733
- return {
734
- year: p(r2.year),
735
- month: p(r2.month),
736
- day: p(r2.day)
737
- };
738
- }
739
- function c(r2, t2) {
740
- return new Date(r2 || 2001, t2 || 1, 0).getDate();
741
- }
742
- function b(r2) {
743
- const { year: t2, month: i, day: s } = f(r2);
744
- if (!t2 || t2 < 0 || t2 > 9999 || !i || i < 1 || i > 12 || !s || s < 1)
745
- return;
746
- const n = new Date(Date.UTC(t2, i - 1, s));
747
- if (!(n.getUTCFullYear() !== t2 || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s))
748
- return { year: t2, month: i, day: s };
749
- }
750
- function C(r2) {
751
- const t2 = b(r2);
752
- return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : undefined;
753
- }
754
- function T2(r2, t2, i, s) {
755
- const n = i ? {
756
- year: i.getUTCFullYear(),
757
- month: i.getUTCMonth() + 1,
758
- day: i.getUTCDate()
759
- } : null, e = s ? {
760
- year: s.getUTCFullYear(),
761
- month: s.getUTCMonth() + 1,
762
- day: s.getUTCDate()
763
- } : null;
764
- return r2 === "year" ? { min: n?.year ?? 1, max: e?.year ?? 9999 } : r2 === "month" ? {
765
- min: n && t2.year === n.year ? n.month : 1,
766
- max: e && t2.year === e.year ? e.month : 12
767
- } : {
768
- min: n && t2.year === n.year && t2.month === n.month ? n.day : 1,
769
- max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
770
- };
771
- }
772
- var import_sisteransi, a$2, t, settings, R, CANCEL_SYMBOL, getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20, T$1, r, _, U, u$1, o$1, h, a$1, a2, n;
698
+ var import_sisteransi, a$2, t, settings, R, CANCEL_SYMBOL, getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20, T$1, r, a$1, a2, n;
773
699
  var init_dist3 = __esm(() => {
774
700
  init_main();
775
701
  import_sisteransi = __toESM(require_src(), 1);
@@ -899,304 +825,6 @@ var init_dist3 = __esm(() => {
899
825
  });
900
826
  }
901
827
  };
902
- _ = {
903
- Y: { type: "year", len: 4 },
904
- M: { type: "month", len: 2 },
905
- D: { type: "day", len: 2 }
906
- };
907
- U = class U extends V {
908
- #i;
909
- #o;
910
- #t;
911
- #h;
912
- #u;
913
- #e = { segmentIndex: 0, positionInSegment: 0 };
914
- #n = true;
915
- #s = null;
916
- inlineError = "";
917
- get segmentCursor() {
918
- return { ...this.#e };
919
- }
920
- get segmentValues() {
921
- return { ...this.#t };
922
- }
923
- get segments() {
924
- return this.#i;
925
- }
926
- get separator() {
927
- return this.#o;
928
- }
929
- get formattedValue() {
930
- return this.#l(this.#t);
931
- }
932
- #l(t2) {
933
- return this.#i.map((i) => t2[i.type]).join(this.#o);
934
- }
935
- #r() {
936
- this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? undefined);
937
- }
938
- constructor(t2) {
939
- const i = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i.separator, n = t2.format ? M(t2.format) : i.segments, e = t2.initialValue ?? t2.defaultValue, m2 = e ? {
940
- year: String(e.getUTCFullYear()).padStart(4, "0"),
941
- month: String(e.getUTCMonth() + 1).padStart(2, "0"),
942
- day: String(e.getUTCDate()).padStart(2, "0")
943
- } : { year: "____", month: "__", day: "__" }, o = n.map((a) => m2[a.type]).join(s);
944
- super({ ...t2, initialUserInput: o }, false), this.#i = n, this.#o = s, this.#t = m2, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a) => this.#f(a)), this.on("key", (a, u) => this.#y(a, u)), this.on("finalize", () => this.#p(t2));
945
- }
946
- #a() {
947
- const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t2];
948
- if (i)
949
- return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i.len - 1)), { segment: i, index: t2 };
950
- }
951
- #m(t2) {
952
- this.inlineError = "", this.#s = null;
953
- const i = this.#a();
954
- i && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i.index + t2)), this.#e.positionInSegment = 0, this.#n = true);
955
- }
956
- #d(t2) {
957
- const i = this.#a();
958
- if (!i)
959
- return;
960
- const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m2 = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type, f(this.#t), this.#h, this.#u);
961
- let a;
962
- e ? a = t2 === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m2 + t2), o.min), this.#t = {
963
- ...this.#t,
964
- [s.type]: a.toString().padStart(s.len, "0")
965
- }, this.#n = true, this.#s = null, this.#r();
966
- }
967
- #f(t2) {
968
- if (t2)
969
- switch (t2) {
970
- case "right":
971
- return this.#m(1);
972
- case "left":
973
- return this.#m(-1);
974
- case "up":
975
- return this.#d(1);
976
- case "down":
977
- return this.#d(-1);
978
- }
979
- }
980
- #y(t2, i) {
981
- if (i?.name === "backspace" || i?.sequence === "" || i?.sequence === "\b" || t2 === "" || t2 === "\b") {
982
- this.inlineError = "";
983
- const n = this.#a();
984
- if (!n)
985
- return;
986
- if (!this.#t[n.segment.type].replace(/_/g, "")) {
987
- this.#m(-1);
988
- return;
989
- }
990
- this.#t[n.segment.type] = "_".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
991
- return;
992
- }
993
- if (i?.name === "tab") {
994
- this.inlineError = "";
995
- const n = this.#a();
996
- if (!n)
997
- return;
998
- const e = i.shift ? -1 : 1, m2 = n.index + e;
999
- m2 >= 0 && m2 < this.#i.length && (this.#e.segmentIndex = m2, this.#e.positionInSegment = 0, this.#n = true);
1000
- return;
1001
- }
1002
- if (t2 && /^[0-9]$/.test(t2)) {
1003
- const n = this.#a();
1004
- if (!n)
1005
- return;
1006
- const { segment: e } = n, m2 = !this.#t[e.type].replace(/_/g, "");
1007
- if (this.#n && this.#s !== null && !m2) {
1008
- const h = this.#s + t2, d = { ...this.#t, [e.type]: h }, g2 = this.#g(d, e);
1009
- if (g2) {
1010
- this.inlineError = g2, this.#s = null, this.#n = false;
1011
- return;
1012
- }
1013
- this.inlineError = "", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);
1014
- return;
1015
- }
1016
- this.#n && !m2 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
1017
- const o = this.#t[e.type], a = o.indexOf("_"), u = a >= 0 ? a : Math.min(this.#e.positionInSegment, e.len - 1);
1018
- if (u < 0 || u >= e.len)
1019
- return;
1020
- let l2 = o.slice(0, u) + t2 + o.slice(u + 1), D = false;
1021
- if (u === 0 && o === "__" && (e.type === "month" || e.type === "day")) {
1022
- const h = Number.parseInt(t2, 10);
1023
- l2 = `0${t2}`, D = h <= (e.type === "month" ? 1 : 2);
1024
- }
1025
- if (e.type === "year" && (l2 = (o.replace(/_/g, "") + t2).padStart(e.len, "_")), !l2.includes("_")) {
1026
- const h = { ...this.#t, [e.type]: l2 }, d = this.#g(h, e);
1027
- if (d) {
1028
- this.inlineError = d;
1029
- return;
1030
- }
1031
- }
1032
- this.inlineError = "", this.#t[e.type] = l2;
1033
- const y = l2.includes("_") ? undefined : b(this.#t);
1034
- if (y) {
1035
- const { year: h, month: d } = y, g2 = c(h, d);
1036
- this.#t = {
1037
- year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
1038
- month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
1039
- day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
1040
- };
1041
- }
1042
- this.#r();
1043
- const S = l2.indexOf("_");
1044
- D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);
1045
- }
1046
- }
1047
- #g(t2, i) {
1048
- const { month: s, day: n } = f(t2);
1049
- if (i.type === "month" && (s < 0 || s > 12))
1050
- return settings.date.messages.invalidMonth;
1051
- if (i.type === "day" && (n < 0 || n > 31))
1052
- return settings.date.messages.invalidDay(31, "any month");
1053
- }
1054
- #p(t2) {
1055
- const { year: i, month: s, day: n } = f(this.#t);
1056
- if (i && s && n) {
1057
- const e = c(i, s);
1058
- this.#t = {
1059
- ...this.#t,
1060
- day: String(Math.min(n, e)).padStart(2, "0")
1061
- };
1062
- }
1063
- this.value = C(this.#t) ?? t2.defaultValue ?? undefined;
1064
- }
1065
- };
1066
- u$1 = class u extends V {
1067
- options;
1068
- cursor = 0;
1069
- #t;
1070
- getGroupItems(t2) {
1071
- return this.options.filter((r2) => r2.group === t2);
1072
- }
1073
- isGroupSelected(t2) {
1074
- const r2 = this.getGroupItems(t2), e = this.value;
1075
- return e === undefined ? false : r2.every((s) => e.includes(s.value));
1076
- }
1077
- toggleValue() {
1078
- const t2 = this.options[this.cursor];
1079
- if (this.value === undefined && (this.value = []), t2.group === true) {
1080
- const r2 = t2.value, e = this.getGroupItems(r2);
1081
- this.isGroupSelected(r2) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
1082
- } else {
1083
- const r2 = this.value.includes(t2.value);
1084
- this.value = r2 ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
1085
- }
1086
- }
1087
- constructor(t2) {
1088
- super(t2, false);
1089
- const { options: r2 } = t2;
1090
- this.#t = t2.selectableGroups !== false, this.options = Object.entries(r2).flatMap(([e, s]) => [
1091
- { value: e, group: true, label: e },
1092
- ...s.map((i) => ({ ...i, group: e }))
1093
- ]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
1094
- switch (e) {
1095
- case "left":
1096
- case "up": {
1097
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1098
- const s = this.options[this.cursor]?.group === true;
1099
- !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
1100
- break;
1101
- }
1102
- case "down":
1103
- case "right": {
1104
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1105
- const s = this.options[this.cursor]?.group === true;
1106
- !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1107
- break;
1108
- }
1109
- case "space":
1110
- this.toggleValue();
1111
- break;
1112
- }
1113
- });
1114
- }
1115
- };
1116
- o$1 = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
1117
- h = class h extends V {
1118
- #t = false;
1119
- #s;
1120
- focused = "editor";
1121
- get userInputWithCursor() {
1122
- if (this.state === "submit")
1123
- return this.userInput;
1124
- const t2 = this.userInput;
1125
- if (this.cursor >= t2.length)
1126
- return `${t2}█`;
1127
- const s = t2.slice(0, this.cursor), r2 = t2[this.cursor], i = t2.slice(this.cursor + 1);
1128
- return r2 === `
1129
- ` ? `${s}█
1130
- ${i}` : `${s}${styleText("inverse", r2)}${i}`;
1131
- }
1132
- get cursor() {
1133
- return this._cursor;
1134
- }
1135
- #r(t2) {
1136
- if (this.userInput.length === 0) {
1137
- this._setUserInput(t2);
1138
- return;
1139
- }
1140
- this._setUserInput(this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor));
1141
- }
1142
- #i(t2) {
1143
- const s = this.value ?? "";
1144
- switch (t2) {
1145
- case "up":
1146
- this._cursor = findTextCursor(this._cursor, 0, -1, s);
1147
- return;
1148
- case "down":
1149
- this._cursor = findTextCursor(this._cursor, 0, 1, s);
1150
- return;
1151
- case "left":
1152
- this._cursor = findTextCursor(this._cursor, -1, 0, s);
1153
- return;
1154
- case "right":
1155
- this._cursor = findTextCursor(this._cursor, 1, 0, s);
1156
- return;
1157
- }
1158
- }
1159
- _shouldSubmit(t2, s) {
1160
- if (this.#s)
1161
- return this.focused === "submit" ? true : (this.#r(`
1162
- `), this._cursor++, false);
1163
- const r2 = this.#t;
1164
- return this.#t = true, r2 && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
1165
- ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
1166
- `), this._cursor++, false);
1167
- }
1168
- constructor(t2) {
1169
- const s = t2.initialUserInput ?? t2.initialValue;
1170
- super({
1171
- ...t2,
1172
- initialUserInput: s
1173
- }, false), s !== undefined && (this._cursor = s.length), this.#s = t2.showSubmit ?? false, this.on("key", (r2, i) => {
1174
- if (i?.name && o$1.has(i.name)) {
1175
- this.#t = false, this.#i(i.name);
1176
- return;
1177
- }
1178
- if (r2 === "\t" && this.#s) {
1179
- this.focused = this.focused === "editor" ? "submit" : "editor";
1180
- return;
1181
- }
1182
- if (i?.name !== "return") {
1183
- if (this.#t = false, i?.name === "backspace" && this.cursor > 0) {
1184
- this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
1185
- return;
1186
- }
1187
- if (i?.name === "delete" && this.cursor < this.userInput.length) {
1188
- this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
1189
- return;
1190
- }
1191
- r2 && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r2 ?? ""), this._cursor++);
1192
- }
1193
- }), this.on("userInput", (r2) => {
1194
- this._setValue(r2);
1195
- }), this.on("finalize", () => {
1196
- this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
1197
- });
1198
- }
1199
- };
1200
828
  a$1 = class a extends V {
1201
829
  options;
1202
830
  cursor = 0;
@@ -1310,18 +938,18 @@ function formatInstructionFooter(o2, e) {
1310
938
  const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o2.join(" • ")}`];
1311
939
  return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
1312
940
  }
1313
- function P2(t2) {
941
+ function P(t2) {
1314
942
  return t2.label ?? String(t2.value ?? "");
1315
943
  }
1316
- function E(t2, c2) {
944
+ function E(t2, c) {
1317
945
  if (!t2)
1318
946
  return true;
1319
- const n2 = (c2.label ?? String(c2.value ?? "")).toLowerCase(), i = (c2.hint ?? "").toLowerCase(), l2 = String(c2.value).toLowerCase(), o2 = t2.toLowerCase();
947
+ const n2 = (c.label ?? String(c.value ?? "")).toLowerCase(), i = (c.hint ?? "").toLowerCase(), l2 = String(c.value).toLowerCase(), o2 = t2.toLowerCase();
1320
948
  return n2.includes(o2) || i.includes(o2) || l2.includes(o2);
1321
949
  }
1322
- function N(t2, c2) {
950
+ function N(t2, c) {
1323
951
  const n2 = [];
1324
- for (const i of c2)
952
+ for (const i of c)
1325
953
  t2.includes(i.value) && n2.push(i);
1326
954
  return n2;
1327
955
  }
@@ -1349,33 +977,33 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", unicode
1349
977
  case "submit":
1350
978
  return styleText2("green", S_BAR);
1351
979
  }
1352
- }, E$1 = (l2, o2, g2, c2, h2, O = false) => {
980
+ }, E$1 = (l2, o2, g2, c, h2, O = false) => {
1353
981
  let r2 = o2, w = 0;
1354
982
  if (O)
1355
- for (let i = c2 - 1;i >= g2 && (r2 -= l2[i].length, w++, !(r2 <= h2)); i--)
983
+ for (let i = c - 1;i >= g2 && (r2 -= l2[i].length, w++, !(r2 <= h2)); i--)
1356
984
  ;
1357
985
  else
1358
- for (let i = g2;i < c2 && (r2 -= l2[i].length, w++, !(r2 <= h2)); i++)
986
+ for (let i = g2;i < c && (r2 -= l2[i].length, w++, !(r2 <= h2)); i++)
1359
987
  ;
1360
988
  return { lineCount: r2, removals: w };
1361
989
  }, limitOptions = ({
1362
990
  cursor: l2,
1363
991
  options: o2,
1364
992
  style: g2,
1365
- output: c2 = process.stdout,
993
+ output: c = process.stdout,
1366
994
  maxItems: h2 = Number.POSITIVE_INFINITY,
1367
995
  columnPadding: O = 0,
1368
996
  rowPadding: r2 = 4
1369
997
  }) => {
1370
- const i = getColumns(c2) - O, I = getRows(c2), C2 = styleText2("dim", "..."), x = Math.max(I - r2, 0), m2 = Math.max(Math.min(h2, x), 5);
1371
- let p2 = 0;
1372
- l2 >= m2 - 3 && (p2 = Math.max(Math.min(l2 - m2 + 3, o2.length - m2), 0));
1373
- let f2 = m2 < o2.length && p2 > 0, u3 = m2 < o2.length && p2 + m2 < o2.length;
1374
- const W = Math.min(p2 + m2, o2.length), e = [];
998
+ const i = getColumns(c) - O, I = getRows(c), C = styleText2("dim", "..."), x = Math.max(I - r2, 0), m2 = Math.max(Math.min(h2, x), 5);
999
+ let p = 0;
1000
+ l2 >= m2 - 3 && (p = Math.max(Math.min(l2 - m2 + 3, o2.length - m2), 0));
1001
+ let f = m2 < o2.length && p > 0, u2 = m2 < o2.length && p + m2 < o2.length;
1002
+ const W = Math.min(p + m2, o2.length), e = [];
1375
1003
  let d = 0;
1376
- f2 && d++, u3 && d++;
1377
- const v = p2 + (f2 ? 1 : 0), P2 = W - (u3 ? 1 : 0);
1378
- for (let t2 = v;t2 < P2; t2++) {
1004
+ f && d++, u2 && d++;
1005
+ const v = p + (f ? 1 : 0), P = W - (u2 ? 1 : 0);
1006
+ for (let t2 = v;t2 < P; t2++) {
1379
1007
  const n2 = wrapAnsi(g2(o2[t2], t2 === l2), i, {
1380
1008
  hard: true,
1381
1009
  trim: false
@@ -1385,17 +1013,17 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", unicode
1385
1013
  }
1386
1014
  if (d > x) {
1387
1015
  let t2 = 0, n2 = 0, s = d;
1388
- const M2 = l2 - v;
1016
+ const M = l2 - v;
1389
1017
  let a3 = x;
1390
- const T3 = () => E$1(e, s, 0, M2, a3), L = () => E$1(e, s, M2 + 1, e.length, a3, true);
1391
- f2 ? ({ lineCount: s, removals: t2 } = T3(), s > a3 && (u3 || (a3 -= 1), { lineCount: s, removals: n2 } = L())) : (u3 || (a3 -= 1), { lineCount: s, removals: n2 } = L(), s > a3 && (a3 -= 1, { lineCount: s, removals: t2 } = T3())), t2 > 0 && (f2 = true, e.splice(0, t2)), n2 > 0 && (u3 = true, e.splice(e.length - n2, n2));
1018
+ const T2 = () => E$1(e, s, 0, M, a3), L = () => E$1(e, s, M + 1, e.length, a3, true);
1019
+ f ? ({ lineCount: s, removals: t2 } = T2(), s > a3 && (u2 || (a3 -= 1), { lineCount: s, removals: n2 } = L())) : (u2 || (a3 -= 1), { lineCount: s, removals: n2 } = L(), s > a3 && (a3 -= 1, { lineCount: s, removals: t2 } = T2())), t2 > 0 && (f = true, e.splice(0, t2)), n2 > 0 && (u2 = true, e.splice(e.length - n2, n2));
1392
1020
  }
1393
- const b2 = [];
1394
- f2 && b2.push(C2);
1021
+ const b = [];
1022
+ f && b.push(C);
1395
1023
  for (const t2 of e)
1396
1024
  for (const n2 of t2)
1397
- b2.push(n2);
1398
- return u3 && b2.push(C2), b2;
1025
+ b.push(n2);
1026
+ return u2 && b.push(C), b;
1399
1027
  }, autocomplete = (t2) => new T$1({
1400
1028
  options: t2.options,
1401
1029
  initialValue: t2.initialValue ? [t2.initialValue] : undefined,
@@ -1407,11 +1035,11 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", unicode
1407
1035
  output: t2.output,
1408
1036
  validate: t2.validate,
1409
1037
  render() {
1410
- const n2 = t2.withGuide ?? settings.withGuide, i = n2 ? [`${styleText2("gray", S_BAR)}`, `${symbol(this.state)} ${t2.message}`] : [`${symbol(this.state)} ${t2.message}`], l2 = this.userInput, o2 = this.options, m2 = t2.placeholder, p2 = l2 === "" && m2 !== undefined, $ = (r2, s) => {
1411
- const a3 = P2(r2), u3 = r2.hint && r2.value === this.focusedValue ? styleText2("dim", ` (${r2.hint})`) : "";
1038
+ const n2 = t2.withGuide ?? settings.withGuide, i = n2 ? [`${styleText2("gray", S_BAR)}`, `${symbol(this.state)} ${t2.message}`] : [`${symbol(this.state)} ${t2.message}`], l2 = this.userInput, o2 = this.options, m2 = t2.placeholder, p = l2 === "" && m2 !== undefined, $ = (r2, s) => {
1039
+ const a3 = P(r2), u2 = r2.hint && r2.value === this.focusedValue ? styleText2("dim", ` (${r2.hint})`) : "";
1412
1040
  switch (s) {
1413
1041
  case "active":
1414
- return `${styleText2("green", S_RADIO_ACTIVE)} ${a3}${u3}`;
1042
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${a3}${u2}`;
1415
1043
  case "inactive":
1416
1044
  return `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a3)}`;
1417
1045
  case "disabled":
@@ -1420,7 +1048,7 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", unicode
1420
1048
  };
1421
1049
  switch (this.state) {
1422
1050
  case "submit": {
1423
- const r2 = N(this.selectedValues, o2), s = r2.length > 0 ? ` ${styleText2("dim", r2.map(P2).join(", "))}` : "", a3 = n2 ? styleText2("gray", S_BAR) : "";
1051
+ const r2 = N(this.selectedValues, o2), s = r2.length > 0 ? ` ${styleText2("dim", r2.map(P).join(", "))}` : "", a3 = n2 ? styleText2("gray", S_BAR) : "";
1424
1052
  return `${i.join(`
1425
1053
  `)}
1426
1054
  ${a3}${s}`;
@@ -1433,14 +1061,14 @@ ${s}${r2}`;
1433
1061
  }
1434
1062
  default: {
1435
1063
  const r2 = this.state === "error" ? "yellow" : "cyan", s = n2 ? `${styleText2(r2, S_BAR)} ` : "", a3 = n2 ? styleText2(r2, S_BAR_END) : "";
1436
- let u3 = "";
1437
- if (this.isNavigating || p2) {
1438
- const d = p2 ? m2 : l2;
1439
- u3 = d !== "" ? ` ${styleText2("dim", d)}` : "";
1064
+ let u2 = "";
1065
+ if (this.isNavigating || p) {
1066
+ const d = p ? m2 : l2;
1067
+ u2 = d !== "" ? ` ${styleText2("dim", d)}` : "";
1440
1068
  } else
1441
- u3 = ` ${this.userInputWithCursor}`;
1442
- const V2 = this.filteredOptions.length !== o2.length ? styleText2("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", y = this.filteredOptions.length === 0 && l2 ? [`${s}${styleText2("yellow", "No matches found")}`] : [], b2 = this.state === "error" ? [`${s}${styleText2("yellow", this.error)}`] : [];
1443
- n2 && i.push(`${s.trimEnd()}`), i.push(`${s}${styleText2("dim", "Search:")}${u3}${V2}`, ...y, ...b2);
1069
+ u2 = ` ${this.userInputWithCursor}`;
1070
+ const V2 = this.filteredOptions.length !== o2.length ? styleText2("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", y = this.filteredOptions.length === 0 && l2 ? [`${s}${styleText2("yellow", "No matches found")}`] : [], b = this.state === "error" ? [`${s}${styleText2("yellow", this.error)}`] : [];
1071
+ n2 && i.push(`${s.trimEnd()}`), i.push(`${s}${styleText2("dim", "Search:")}${u2}${V2}`, ...y, ...b);
1444
1072
  const v = [
1445
1073
  `${styleText2("dim", "↑/↓")} to select`,
1446
1074
  `${styleText2("dim", "Enter:")} confirm`,
@@ -1450,7 +1078,7 @@ ${s}${r2}`;
1450
1078
  options: this.filteredOptions,
1451
1079
  columnPadding: n2 ? 3 : 0,
1452
1080
  rowPadding: i.length + g2.length,
1453
- style: (d, f2) => $(d, d.disabled ? "disabled" : f2 ? "active" : "inactive"),
1081
+ style: (d, f) => $(d, d.disabled ? "disabled" : f ? "active" : "inactive"),
1454
1082
  maxItems: t2.maxItems,
1455
1083
  output: t2.output
1456
1084
  });
@@ -1473,17 +1101,17 @@ ${s}${r2}`;
1473
1101
  output: i.output,
1474
1102
  initialValue: i.initialValue ?? true,
1475
1103
  render() {
1476
- const e = i.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(i.output, i.message, l2, u3), o2 = `${e ? `${styleText2("gray", S_BAR)}
1477
- ` : ""}${f2}
1478
- `, c2 = this.value ? a3 : s;
1104
+ const e = i.withGuide ?? settings.withGuide, u2 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(i.output, i.message, l2, u2), o2 = `${e ? `${styleText2("gray", S_BAR)}
1105
+ ` : ""}${f}
1106
+ `, c = this.value ? a3 : s;
1479
1107
  switch (this.state) {
1480
1108
  case "submit": {
1481
1109
  const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1482
- return `${o2}${r2}${styleText2("dim", c2)}`;
1110
+ return `${o2}${r2}${styleText2("dim", c)}`;
1483
1111
  }
1484
1112
  case "cancel": {
1485
1113
  const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1486
- return `${o2}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
1114
+ return `${o2}${r2}${styleText2(["strikethrough", "dim"], c)}${e ? `
1487
1115
  ${styleText2("gray", S_BAR)}` : ""}`;
1488
1116
  }
1489
1117
  default: {
@@ -1520,30 +1148,30 @@ ${styleText2("reset", styleText2("dim", `Press ${styleText2(["gray", "bgWhite",
1520
1148
  render() {
1521
1149
  const t2 = n2.withGuide ?? settings.withGuide, a3 = wrapTextWithPrefix(n2.output, n2.message, t2 ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
1522
1150
  ` : ""}${a3}
1523
- `, l2 = this.value ?? [], p2 = (i, u3) => {
1151
+ `, l2 = this.value ?? [], p = (i, u2) => {
1524
1152
  if (i.disabled)
1525
1153
  return o2(i, "disabled");
1526
1154
  const s = l2.includes(i.value);
1527
- return u3 && s ? o2(i, "active-selected") : s ? o2(i, "selected") : o2(i, u3 ? "active" : "inactive");
1155
+ return u2 && s ? o2(i, "active-selected") : s ? o2(i, "selected") : o2(i, u2 ? "active" : "inactive");
1528
1156
  };
1529
1157
  switch (this.state) {
1530
1158
  case "submit": {
1531
- const i = this.options.filter(({ value: s }) => l2.includes(s)).map((s) => o2(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), u3 = wrapTextWithPrefix(n2.output, i, t2 ? `${styleText2("gray", S_BAR)} ` : "");
1532
- return `${r2}${u3}`;
1159
+ const i = this.options.filter(({ value: s }) => l2.includes(s)).map((s) => o2(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), u2 = wrapTextWithPrefix(n2.output, i, t2 ? `${styleText2("gray", S_BAR)} ` : "");
1160
+ return `${r2}${u2}`;
1533
1161
  }
1534
1162
  case "cancel": {
1535
1163
  const i = this.options.filter(({ value: s }) => l2.includes(s)).map((s) => o2(s, "cancelled")).join(styleText2("dim", ", "));
1536
1164
  if (i.trim() === "")
1537
1165
  return `${r2}${styleText2("gray", S_BAR)}`;
1538
- const u3 = wrapTextWithPrefix(n2.output, i, t2 ? `${styleText2("gray", S_BAR)} ` : "");
1539
- return `${r2}${u3}${t2 ? `
1166
+ const u2 = wrapTextWithPrefix(n2.output, i, t2 ? `${styleText2("gray", S_BAR)} ` : "");
1167
+ return `${r2}${u2}${t2 ? `
1540
1168
  ${styleText2("gray", S_BAR)}` : ""}`;
1541
1169
  }
1542
1170
  case "error": {
1543
- const i = t2 ? `${styleText2("yellow", S_BAR)} ` : "", u3 = this.error.split(`
1171
+ const i = t2 ? `${styleText2("yellow", S_BAR)} ` : "", u2 = this.error.split(`
1544
1172
  `).map(($, x) => x === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`).join(`
1545
1173
  `), s = r2.split(`
1546
- `).length, g2 = u3.split(`
1174
+ `).length, g2 = u2.split(`
1547
1175
  `).length + 1;
1548
1176
  return `${r2}${i}${limitOptions({
1549
1177
  output: n2.output,
@@ -1552,14 +1180,14 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1552
1180
  maxItems: n2.maxItems,
1553
1181
  columnPadding: i.length,
1554
1182
  rowPadding: s + g2,
1555
- style: p2
1183
+ style: p
1556
1184
  }).join(`
1557
1185
  ${i}`)}
1558
- ${u3}
1186
+ ${u2}
1559
1187
  `;
1560
1188
  }
1561
1189
  default: {
1562
- const i = t2 ? `${styleText2("cyan", S_BAR)} ` : "", u3 = r2.split(`
1190
+ const i = t2 ? `${styleText2("cyan", S_BAR)} ` : "", u2 = r2.split(`
1563
1191
  `).length, s = formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2), g2 = s.join(`
1564
1192
  `), $ = s.length + 1;
1565
1193
  return `${r2}${i}${limitOptions({
@@ -1568,8 +1196,8 @@ ${u3}
1568
1196
  cursor: this.cursor,
1569
1197
  maxItems: n2.maxItems,
1570
1198
  columnPadding: i.length,
1571
- rowPadding: u3 + $,
1572
- style: p2
1199
+ rowPadding: u2 + $,
1200
+ style: p
1573
1201
  }).join(`
1574
1202
  ${i}`)}
1575
1203
  ${g2}
@@ -1593,22 +1221,22 @@ ${styleText2("gray", S_BAR_END)} ` : "";
1593
1221
  i.write(`${e}${o2}
1594
1222
 
1595
1223
  `);
1596
- }, W$1 = (o2) => o2, C2 = (o2, e, s) => {
1224
+ }, W$1 = (o2) => o2, C = (o2, e, s) => {
1597
1225
  const a3 = {
1598
1226
  hard: true,
1599
1227
  trim: false
1600
1228
  }, i = wrapAnsi(o2, e, a3).split(`
1601
- `), c2 = i.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u3 = i.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g2 = e - (u3 - c2);
1229
+ `), c = i.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u2 = i.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g2 = e - (u2 - c);
1602
1230
  return wrapAnsi(o2, g2, a3);
1603
1231
  }, note = (o2 = "", e = "", s) => {
1604
- const a3 = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g2 = ["", ...C2(o2, getColumns(a3) - 6, c2).split(`
1605
- `).map(c2), ""], n2 = dist_default2(e), t2 = Math.max(g2.reduce((m3, F) => {
1232
+ const a3 = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g2 = ["", ...C(o2, getColumns(a3) - 6, c).split(`
1233
+ `).map(c), ""], n2 = dist_default2(e), t2 = Math.max(g2.reduce((m3, F) => {
1606
1234
  const O = dist_default2(F);
1607
1235
  return O > m3 ? O : m3;
1608
1236
  }, 0), n2) + 2, h2 = g2.map((m3) => `${styleText2("gray", S_BAR)} ${m3}${" ".repeat(t2 - dist_default2(m3))}${styleText2("gray", S_BAR)}`).join(`
1609
- `), T3 = i ? `${styleText2("gray", S_BAR)}
1237
+ `), T2 = i ? `${styleText2("gray", S_BAR)}
1610
1238
  ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
1611
- a3.write(`${T3}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2("gray", S_BAR_H.repeat(Math.max(t2 - n2 - 1, 1)) + S_CORNER_TOP_RIGHT)}
1239
+ a3.write(`${T2}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2("gray", S_BAR_H.repeat(Math.max(t2 - n2 - 1, 1)) + S_CORNER_TOP_RIGHT)}
1612
1240
  ${h2}
1613
1241
  ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1614
1242
  `);
@@ -1623,43 +1251,43 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1623
1251
  signal: m3,
1624
1252
  ...I
1625
1253
  } = {}) => {
1626
- const u3 = isCI();
1627
- let M2, T3, d = false, S = false, s = "", p2, w = performance.now();
1254
+ const u2 = isCI();
1255
+ let M, T2, d = false, S = false, s = "", p, w = performance.now();
1628
1256
  const x = getColumns(n2), k = I?.styleFrame ?? W, g2 = (e) => {
1629
1257
  const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1630
1258
  S = e === 1, d && (a3(r2, e), S && typeof h2 == "function" && h2());
1631
- }, f2 = () => g2(2), i = () => g2(1), A = () => {
1632
- process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g2), m3 && m3.addEventListener("abort", i);
1259
+ }, f = () => g2(2), i = () => g2(1), A = () => {
1260
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g2), m3 && m3.addEventListener("abort", i);
1633
1261
  }, H = () => {
1634
- process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g2), m3 && m3.removeEventListener("abort", i);
1262
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g2), m3 && m3.removeEventListener("abort", i);
1635
1263
  }, y = () => {
1636
- if (p2 === undefined)
1264
+ if (p === undefined)
1637
1265
  return;
1638
- u3 && n2.write(`
1266
+ u2 && n2.write(`
1639
1267
  `);
1640
- const r2 = wrapAnsi(p2, x, {
1268
+ const r2 = wrapAnsi(p, x, {
1641
1269
  hard: true,
1642
1270
  trim: false
1643
1271
  }).split(`
1644
1272
  `);
1645
1273
  r2.length > 1 && n2.write(import_sisteransi2.cursor.up(r2.length - 1)), n2.write(import_sisteransi2.cursor.to(0)), n2.write(import_sisteransi2.erase.down());
1646
- }, C3 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
1274
+ }, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1647
1275
  const r2 = (performance.now() - e) / 1000, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
1648
1276
  return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
1649
- }, N2 = I.withGuide ?? settings.withGuide, P3 = (e = "") => {
1650
- d = true, M2 = block({ output: n2 }), s = C3(e), w = performance.now(), N2 && n2.write(`${styleText2("gray", S_BAR)}
1277
+ }, N2 = I.withGuide ?? settings.withGuide, P2 = (e = "") => {
1278
+ d = true, M = block({ output: n2 }), s = C2(e), w = performance.now(), N2 && n2.write(`${styleText2("gray", S_BAR)}
1651
1279
  `);
1652
1280
  let r2 = 0, t2 = 0;
1653
- A(), T3 = setInterval(() => {
1654
- if (u3 && s === p2)
1281
+ A(), T2 = setInterval(() => {
1282
+ if (u2 && s === p)
1655
1283
  return;
1656
- y(), p2 = s;
1284
+ y(), p = s;
1657
1285
  const o2 = k(E2[r2]);
1658
1286
  let v;
1659
- if (u3)
1287
+ if (u2)
1660
1288
  v = `${o2} ${s}...`;
1661
1289
  else if (l2 === "timer")
1662
- v = `${o2} ${s} ${_2(w)}`;
1290
+ v = `${o2} ${s} ${_(w)}`;
1663
1291
  else {
1664
1292
  const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1665
1293
  v = `${o2} ${s}${B}`;
@@ -1673,17 +1301,17 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1673
1301
  }, a3 = (e = "", r2 = 0, t2 = false) => {
1674
1302
  if (!d)
1675
1303
  return;
1676
- d = false, clearInterval(T3), y();
1304
+ d = false, clearInterval(T2), y();
1677
1305
  const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1678
- s = e ?? s, t2 || (l2 === "timer" ? n2.write(`${o2} ${s} ${_2(w)}
1306
+ s = e ?? s, t2 || (l2 === "timer" ? n2.write(`${o2} ${s} ${_(w)}
1679
1307
  `) : n2.write(`${o2} ${s}
1680
- `)), H(), M2();
1308
+ `)), H(), M();
1681
1309
  };
1682
1310
  return {
1683
- start: P3,
1311
+ start: P2,
1684
1312
  stop: (e = "") => a3(e, 0),
1685
1313
  message: (e = "") => {
1686
- s = C3(e ?? s);
1314
+ s = C2(e ?? s);
1687
1315
  },
1688
1316
  cancel: (e = "") => a3(e, 1),
1689
1317
  error: (e = "") => a3(e, 2),
@@ -1692,7 +1320,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1692
1320
  return S;
1693
1321
  }
1694
1322
  };
1695
- }, u3, SELECT_INSTRUCTIONS, c2 = (t2, a3) => t2.includes(`
1323
+ }, u2, SELECT_INSTRUCTIONS, c = (t2, a3) => t2.includes(`
1696
1324
  `) ? t2.split(`
1697
1325
  `).map((i) => a3(i)).join(`
1698
1326
  `) : a3(t2), select = (t2) => {
@@ -1700,15 +1328,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1700
1328
  const s = i.label ?? String(i.value);
1701
1329
  switch (m3) {
1702
1330
  case "disabled":
1703
- return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (n2) => styleText2("gray", n2))}${i.hint ? ` ${styleText2("dim", `(${i.hint ?? "disabled"})`)}` : ""}`;
1331
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (n2) => styleText2("gray", n2))}${i.hint ? ` ${styleText2("dim", `(${i.hint ?? "disabled"})`)}` : ""}`;
1704
1332
  case "selected":
1705
- return `${c2(s, (n2) => styleText2("dim", n2))}`;
1333
+ return `${c(s, (n2) => styleText2("dim", n2))}`;
1706
1334
  case "active":
1707
1335
  return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${i.hint ? ` ${styleText2("dim", `(${i.hint})`)}` : ""}`;
1708
1336
  case "cancelled":
1709
- return `${c2(s, (n2) => styleText2(["strikethrough", "dim"], n2))}`;
1337
+ return `${c(s, (n2) => styleText2(["strikethrough", "dim"], n2))}`;
1710
1338
  default:
1711
- return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (n2) => styleText2("dim", n2))}`;
1339
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (n2) => styleText2("dim", n2))}`;
1712
1340
  }
1713
1341
  };
1714
1342
  return new a2({
@@ -1718,31 +1346,31 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1718
1346
  output: t2.output,
1719
1347
  initialValue: t2.initialValue,
1720
1348
  render() {
1721
- const i = t2.withGuide ?? settings.withGuide, m3 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, n2 = wrapTextWithPrefix(t2.output, t2.message, s, m3), u4 = `${i ? `${styleText2("gray", S_BAR)}
1349
+ const i = t2.withGuide ?? settings.withGuide, m3 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, n2 = wrapTextWithPrefix(t2.output, t2.message, s, m3), u3 = `${i ? `${styleText2("gray", S_BAR)}
1722
1350
  ` : ""}${n2}
1723
1351
  `;
1724
1352
  switch (this.state) {
1725
1353
  case "submit": {
1726
1354
  const r2 = i ? `${styleText2("gray", S_BAR)} ` : "", o2 = wrapTextWithPrefix(t2.output, a3(this.options[this.cursor], "selected"), r2);
1727
- return `${u4}${o2}`;
1355
+ return `${u3}${o2}`;
1728
1356
  }
1729
1357
  case "cancel": {
1730
1358
  const r2 = i ? `${styleText2("gray", S_BAR)} ` : "", o2 = wrapTextWithPrefix(t2.output, a3(this.options[this.cursor], "cancelled"), r2);
1731
- return `${u4}${o2}${i ? `
1359
+ return `${u3}${o2}${i ? `
1732
1360
  ${styleText2("gray", S_BAR)}` : ""}`;
1733
1361
  }
1734
1362
  default: {
1735
- const r2 = i ? `${styleText2("cyan", S_BAR)} ` : "", o2 = u4.split(`
1363
+ const r2 = i ? `${styleText2("cyan", S_BAR)} ` : "", o2 = u3.split(`
1736
1364
  `).length, $ = formatInstructionFooter(SELECT_INSTRUCTIONS, i), h2 = $.join(`
1737
- `), b2 = $.length + 1;
1738
- return `${u4}${r2}${limitOptions({
1365
+ `), b = $.length + 1;
1366
+ return `${u3}${r2}${limitOptions({
1739
1367
  output: t2.output,
1740
1368
  cursor: this.cursor,
1741
1369
  options: this.options,
1742
1370
  maxItems: t2.maxItems,
1743
1371
  columnPadding: r2.length,
1744
- rowPadding: o2 + b2,
1745
- style: (p2, x) => a3(p2, p2.disabled ? "disabled" : x ? "active" : "inactive")
1372
+ rowPadding: o2 + b,
1373
+ style: (p, x) => a3(p, p.disabled ? "disabled" : x ? "active" : "inactive")
1746
1374
  }).join(`
1747
1375
  ${r2}`)}
1748
1376
  ${h2}
@@ -1762,7 +1390,7 @@ ${h2}
1762
1390
  render() {
1763
1391
  const i2 = t2?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${styleText2("gray", S_BAR)}
1764
1392
  ` : ""}${symbol(this.state)} `}${t2.message}
1765
- `, c3 = t2.placeholder ? styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, a3 = this.value ?? "";
1393
+ `, c2 = t2.placeholder ? styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c2, a3 = this.value ?? "";
1766
1394
  switch (this.state) {
1767
1395
  case "error": {
1768
1396
  const n2 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i2 ? `${styleText2("yellow", S_BAR)} ` : "", d = i2 ? styleText2("yellow", S_BAR_END) : "";
@@ -1832,18 +1460,18 @@ var init_dist4 = __esm(() => {
1832
1460
  secondarySymbol: r2 = styleText2("gray", S_BAR),
1833
1461
  output: m3 = process.stdout,
1834
1462
  spacing: l2 = 1,
1835
- withGuide: c2
1463
+ withGuide: c
1836
1464
  } = {}) => {
1837
- const t2 = [], o2 = c2 ?? settings.withGuide, f2 = o2 ? r2 : "", O = o2 ? `${e} ` : "", u3 = o2 ? `${r2} ` : "";
1465
+ const t2 = [], o2 = c ?? settings.withGuide, f = o2 ? r2 : "", O = o2 ? `${e} ` : "", u2 = o2 ? `${r2} ` : "";
1838
1466
  for (let i = 0;i < l2; i++)
1839
- t2.push(f2);
1467
+ t2.push(f);
1840
1468
  const g2 = Array.isArray(s) ? s : s.split(`
1841
1469
  `);
1842
1470
  if (g2.length > 0) {
1843
1471
  const [i, ...y] = g2;
1844
1472
  i.length > 0 ? t2.push(`${O}${i}`) : t2.push(o2 ? e : "");
1845
- for (const p2 of y)
1846
- p2.length > 0 ? t2.push(`${u3}${p2}`) : t2.push(o2 ? r2 : "");
1473
+ for (const p of y)
1474
+ p.length > 0 ? t2.push(`${u2}${p}`) : t2.push(o2 ? r2 : "");
1847
1475
  }
1848
1476
  m3.write(`${t2.join(`
1849
1477
  `)}
@@ -1868,7 +1496,7 @@ var init_dist4 = __esm(() => {
1868
1496
  log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
1869
1497
  }
1870
1498
  };
1871
- u3 = {
1499
+ u2 = {
1872
1500
  light: unicodeOr("─", "-"),
1873
1501
  heavy: unicodeOr("━", "="),
1874
1502
  block: unicodeOr("█", "#")
@@ -1883,20 +1511,20 @@ var init_dist4 = __esm(() => {
1883
1511
  // src/lib/prompts.ts
1884
1512
  var exports_prompts = {};
1885
1513
  __export(exports_prompts, {
1886
- text: () => text2,
1887
- spinner: () => spinner2,
1888
- selectOne: () => selectOne,
1889
- selectMany: () => selectMany,
1890
- selectAutocomplete: () => selectAutocomplete,
1891
- promptIO: () => promptIO,
1892
- outro: () => outro2,
1893
- note: () => note2,
1894
- log: () => log2,
1895
- isPromptCancelledError: () => isPromptCancelledError,
1896
- isCancel: () => isCancel,
1897
- intro: () => intro2,
1514
+ PromptCancelledError: () => PromptCancelledError,
1898
1515
  confirm: () => confirm2,
1899
- PromptCancelledError: () => PromptCancelledError
1516
+ intro: () => intro2,
1517
+ isCancel: () => isCancel,
1518
+ isPromptCancelledError: () => isPromptCancelledError,
1519
+ log: () => log2,
1520
+ note: () => note2,
1521
+ outro: () => outro2,
1522
+ promptIO: () => promptIO,
1523
+ selectAutocomplete: () => selectAutocomplete,
1524
+ selectMany: () => selectMany,
1525
+ selectOne: () => selectOne,
1526
+ spinner: () => spinner2,
1527
+ text: () => text2
1900
1528
  });
1901
1529
  function isPromptCancelledError(error) {
1902
1530
  return error instanceof PromptCancelledError;
@@ -2028,11 +1656,11 @@ var init_prompts = __esm(() => {
2028
1656
  // ../plugin/src/shared/sqlite.ts
2029
1657
  var exports_sqlite = {};
2030
1658
  __export(exports_sqlite, {
2031
- withPrivilegedWriter: () => withPrivilegedWriter,
2032
- loadSqliteModule: () => loadSqliteModule,
2033
- detectSqliteRuntime: () => detectSqliteRuntime,
1659
+ Database: () => Database,
2034
1660
  SqliteRuntimeUnavailableError: () => SqliteRuntimeUnavailableError,
2035
- Database: () => Database
1661
+ detectSqliteRuntime: () => detectSqliteRuntime,
1662
+ loadSqliteModule: () => loadSqliteModule,
1663
+ withPrivilegedWriter: () => withPrivilegedWriter
2036
1664
  });
2037
1665
  function detectSqliteRuntime() {
2038
1666
  const hasBunVersion = typeof process !== "undefined" && typeof process.versions?.bun === "string";
@@ -2402,11 +2030,11 @@ function sortJson(value) {
2402
2030
  function normalizedJsoncSemantics(content) {
2403
2031
  return JSON.stringify(sortJson(JSON.parse(stripJsoncForParse(content))));
2404
2032
  }
2405
- function fileSemanticsMatch(a3, b2) {
2033
+ function fileSemanticsMatch(a3, b) {
2406
2034
  try {
2407
- return normalizedJsoncSemantics(a3) === normalizedJsoncSemantics(b2);
2035
+ return normalizedJsoncSemantics(a3) === normalizedJsoncSemantics(b);
2408
2036
  } catch {
2409
- return a3 === b2;
2037
+ return a3 === b;
2410
2038
  }
2411
2039
  }
2412
2040
  function acquireConfigMigrationLock(lockDir) {
@@ -2618,18 +2246,18 @@ var currentHarness = "opencode";
2618
2246
  // ../plugin/src/shared/data-path.ts
2619
2247
  var exports_data_path = {};
2620
2248
  __export(exports_data_path, {
2621
- getProjectMagicContextHistorianDir: () => getProjectMagicContextHistorianDir,
2622
- getProjectMagicContextDir: () => getProjectMagicContextDir,
2623
- getOpenCodeStorageDir: () => getOpenCodeStorageDir,
2624
- getOpenCodeCacheDir: () => getOpenCodeCacheDir,
2625
- getMagicContextTempDir: () => getMagicContextTempDir,
2626
- getMagicContextStorageDir: () => getMagicContextStorageDir,
2627
- getMagicContextLogPath: () => getMagicContextLogPath,
2628
- getMagicContextHistorianDir: () => getMagicContextHistorianDir,
2629
- getLegacyOpenCodeMagicContextStorageDir: () => getLegacyOpenCodeMagicContextStorageDir,
2630
- getDataDir: () => getDataDir,
2249
+ ensureCortexKitArtifactGitignore: () => ensureCortexKitArtifactGitignore,
2631
2250
  getCacheDir: () => getCacheDir,
2632
- ensureCortexKitArtifactGitignore: () => ensureCortexKitArtifactGitignore
2251
+ getDataDir: () => getDataDir,
2252
+ getLegacyOpenCodeMagicContextStorageDir: () => getLegacyOpenCodeMagicContextStorageDir,
2253
+ getMagicContextHistorianDir: () => getMagicContextHistorianDir,
2254
+ getMagicContextLogPath: () => getMagicContextLogPath,
2255
+ getMagicContextStorageDir: () => getMagicContextStorageDir,
2256
+ getMagicContextTempDir: () => getMagicContextTempDir,
2257
+ getOpenCodeCacheDir: () => getOpenCodeCacheDir,
2258
+ getOpenCodeStorageDir: () => getOpenCodeStorageDir,
2259
+ getProjectMagicContextDir: () => getProjectMagicContextDir,
2260
+ getProjectMagicContextHistorianDir: () => getProjectMagicContextHistorianDir
2633
2261
  });
2634
2262
  import { existsSync as existsSync3, mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
2635
2263
  import * as os from "node:os";
@@ -3317,7 +2945,7 @@ var init_omp = __esm(() => {
3317
2945
  });
3318
2946
 
3319
2947
  // ../../node_modules/.bun/esprima@4.0.1/node_modules/esprima/dist/esprima.js
3320
- var require_esprima = __commonJS((exports, module) => {
2948
+ var require_esprima = __commonJS(function(exports, module) {
3321
2949
  (function webpackUniversalModuleDefinition(root, factory) {
3322
2950
  if (typeof exports === "object" && typeof module === "object")
3323
2951
  module.exports = factory();
@@ -3657,19 +3285,19 @@ var require_esprima = __commonJS((exports, module) => {
3657
3285
  },
3658
3286
  function(module2, exports2, __webpack_require__) {
3659
3287
  var __extends = this && this.__extends || function() {
3660
- var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b2) {
3661
- d.__proto__ = b2;
3662
- } || function(d, b2) {
3663
- for (var p2 in b2)
3664
- if (b2.hasOwnProperty(p2))
3665
- d[p2] = b2[p2];
3288
+ var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
3289
+ d.__proto__ = b;
3290
+ } || function(d, b) {
3291
+ for (var p in b)
3292
+ if (b.hasOwnProperty(p))
3293
+ d[p] = b[p];
3666
3294
  };
3667
- return function(d, b2) {
3668
- extendStatics(d, b2);
3295
+ return function(d, b) {
3296
+ extendStatics(d, b);
3669
3297
  function __() {
3670
3298
  this.constructor = d;
3671
3299
  }
3672
- d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __);
3300
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);
3673
3301
  };
3674
3302
  }();
3675
3303
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -9457,50 +9085,50 @@ var require_esprima = __commonJS((exports, module) => {
9457
9085
  });
9458
9086
 
9459
9087
  // ../../node_modules/.bun/array-timsort@1.0.3/node_modules/array-timsort/src/index.js
9460
- var require_src2 = __commonJS((exports, module) => {
9088
+ var require_src2 = __commonJS(function(exports, module) {
9461
9089
  var DEFAULT_MIN_MERGE = 32;
9462
9090
  var DEFAULT_MIN_GALLOPING = 7;
9463
9091
  var DEFAULT_TMP_STORAGE_LENGTH = 256;
9464
9092
  var POWERS_OF_TEN = [1, 10, 100, 1000, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
9465
9093
  var results;
9466
9094
  var log10 = (x) => x < 1e5 ? x < 100 ? x < 10 ? 0 : 1 : x < 1e4 ? x < 1000 ? 2 : 3 : 4 : x < 1e7 ? x < 1e6 ? 5 : 6 : x < 1e9 ? x < 1e8 ? 7 : 8 : 9;
9467
- function alphabeticalCompare(a3, b2) {
9468
- if (a3 === b2) {
9095
+ function alphabeticalCompare(a3, b) {
9096
+ if (a3 === b) {
9469
9097
  return 0;
9470
9098
  }
9471
- if (~~a3 === a3 && ~~b2 === b2) {
9472
- if (a3 === 0 || b2 === 0) {
9473
- return a3 < b2 ? -1 : 1;
9099
+ if (~~a3 === a3 && ~~b === b) {
9100
+ if (a3 === 0 || b === 0) {
9101
+ return a3 < b ? -1 : 1;
9474
9102
  }
9475
- if (a3 < 0 || b2 < 0) {
9476
- if (b2 >= 0) {
9103
+ if (a3 < 0 || b < 0) {
9104
+ if (b >= 0) {
9477
9105
  return -1;
9478
9106
  }
9479
9107
  if (a3 >= 0) {
9480
9108
  return 1;
9481
9109
  }
9482
9110
  a3 = -a3;
9483
- b2 = -b2;
9111
+ b = -b;
9484
9112
  }
9485
9113
  const al = log10(a3);
9486
- const bl = log10(b2);
9114
+ const bl = log10(b);
9487
9115
  let t2 = 0;
9488
9116
  if (al < bl) {
9489
9117
  a3 *= POWERS_OF_TEN[bl - al - 1];
9490
- b2 /= 10;
9118
+ b /= 10;
9491
9119
  t2 = -1;
9492
9120
  } else if (al > bl) {
9493
- b2 *= POWERS_OF_TEN[al - bl - 1];
9121
+ b *= POWERS_OF_TEN[al - bl - 1];
9494
9122
  a3 /= 10;
9495
9123
  t2 = 1;
9496
9124
  }
9497
- if (a3 === b2) {
9125
+ if (a3 === b) {
9498
9126
  return t2;
9499
9127
  }
9500
- return a3 < b2 ? -1 : 1;
9128
+ return a3 < b ? -1 : 1;
9501
9129
  }
9502
9130
  const aStr = String(a3);
9503
- const bStr = String(b2);
9131
+ const bStr = String(b);
9504
9132
  if (aStr === bStr) {
9505
9133
  return 0;
9506
9134
  }
@@ -10100,7 +9728,7 @@ var require_src2 = __commonJS((exports, module) => {
10100
9728
  });
10101
9729
 
10102
9730
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/common.js
10103
- var require_common = __commonJS((exports, module) => {
9731
+ var require_common = __commonJS(function(exports, module) {
10104
9732
  var PREFIX_BEFORE = "before";
10105
9733
  var PREFIX_AFTER_PROP = "after-prop";
10106
9734
  var PREFIX_AFTER_COLON = "after-colon";
@@ -10386,7 +10014,7 @@ var require_common = __commonJS((exports, module) => {
10386
10014
  });
10387
10015
 
10388
10016
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/array.js
10389
- var require_array = __commonJS((exports, module) => {
10017
+ var require_array = __commonJS(function(exports, module) {
10390
10018
  var { sort } = require_src2();
10391
10019
  var {
10392
10020
  PROP_SYMBOL_PREFIXES,
@@ -10544,7 +10172,7 @@ var require_array = __commonJS((exports, module) => {
10544
10172
  });
10545
10173
 
10546
10174
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/parse.js
10547
- var require_parse = __commonJS((exports, module) => {
10175
+ var require_parse = __commonJS(function(exports, module) {
10548
10176
  var esprima = require_esprima();
10549
10177
  var {
10550
10178
  CommentArray
@@ -10910,7 +10538,7 @@ var require_parse = __commonJS((exports, module) => {
10910
10538
  });
10911
10539
 
10912
10540
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/stringify.js
10913
- var require_stringify = __commonJS((exports, module) => {
10541
+ var require_stringify = __commonJS(function(exports, module) {
10914
10542
  var {
10915
10543
  PREFIX_BEFORE_ALL,
10916
10544
  PREFIX_BEFORE,
@@ -11118,7 +10746,7 @@ var require_stringify = __commonJS((exports, module) => {
11118
10746
  });
11119
10747
 
11120
10748
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/index.js
11121
- var require_src3 = __commonJS((exports, module) => {
10749
+ var require_src3 = __commonJS(function(exports, module) {
11122
10750
  var { parse, tokenize } = require_parse();
11123
10751
  var stringify = require_stringify();
11124
10752
  var { CommentArray } = require_array();
@@ -12128,7 +11756,8 @@ var init_harness_provider_map = __esm(() => {
12128
11756
  };
12129
11757
  OMP_TO_CANONICAL_PROVIDER = {
12130
11758
  "openai-codex": "openai",
12131
- "google-antigravity": "google"
11759
+ "google-antigravity": "google",
11760
+ "opencode-zen": "opencode"
12132
11761
  };
12133
11762
  });
12134
11763
 
@@ -12278,7 +11907,7 @@ var init_task_registry = __esm(() => {
12278
11907
 
12279
11908
  // src/lib/model-picker.ts
12280
11909
  function sortModelsForPicker(models) {
12281
- return [...new Set(models)].sort((a3, b2) => a3.localeCompare(b2));
11910
+ return [...new Set(models)].sort((a3, b) => a3.localeCompare(b));
12282
11911
  }
12283
11912
  function modelOptions(models) {
12284
11913
  return sortModelsForPicker(models).map((model) => ({ label: model, value: model }));
@@ -12330,15 +11959,15 @@ var init_model_picker = __esm(() => {
12330
11959
 
12331
11960
  // src/lib/dreamer-setup.ts
12332
11961
  function presetValueForCron(cron) {
12333
- const match = SCHEDULE_PRESETS.find((p2) => p2.cron === cron);
11962
+ const match = SCHEDULE_PRESETS.find((p) => p.cron === cron);
12334
11963
  return match ? match.cron : PRESET_CUSTOM;
12335
11964
  }
12336
11965
  function scheduleOptions(defaultCron) {
12337
11966
  const recommended = presetValueForCron(defaultCron);
12338
- const opts = SCHEDULE_PRESETS.map((p2) => ({
12339
- label: p2.label,
12340
- value: `cron:${p2.cron}`,
12341
- recommended: p2.cron === recommended
11967
+ const opts = SCHEDULE_PRESETS.map((p) => ({
11968
+ label: p.label,
11969
+ value: `cron:${p.cron}`,
11970
+ recommended: p.cron === recommended
12342
11971
  }));
12343
11972
  opts.push({
12344
11973
  label: "Custom cron…",
@@ -12437,13 +12066,13 @@ function compactObject(obj) {
12437
12066
  }
12438
12067
  return obj;
12439
12068
  }
12440
- function comparePiVersion(a3, b2) {
12069
+ function comparePiVersion(a3, b) {
12441
12070
  const parse = (v) => {
12442
12071
  const match = v.match(/(\d+)\.(\d+)\.(\d+)/);
12443
12072
  return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
12444
12073
  };
12445
12074
  const left = parse(a3);
12446
- const right = parse(b2);
12075
+ const right = parse(b);
12447
12076
  if (!left || !right)
12448
12077
  return 0;
12449
12078
  for (let i2 = 0;i2 < 3; i2 += 1) {
@@ -13089,7 +12718,7 @@ function mostFrequentSchedule(schedules) {
13089
12718
  const enabled = schedules.map((s) => s.trim()).filter(Boolean);
13090
12719
  if (enabled.length === 0)
13091
12720
  return "";
13092
- return enabled.sort((a3, b2) => cronIntervalScore(a3) - cronIntervalScore(b2))[0] ?? "";
12721
+ return enabled.sort((a3, b) => cronIntervalScore(a3) - cronIntervalScore(b))[0] ?? "";
13093
12722
  }
13094
12723
  function withoutBroadInterval(entry) {
13095
12724
  const { broad_interval_days: _broad, ...rest } = entry;
@@ -13362,7 +12991,7 @@ function $constructor(name, initializer, params) {
13362
12991
  Object.defineProperty(inst, "_zod", {
13363
12992
  value: {
13364
12993
  def,
13365
- constr: _2,
12994
+ constr: _,
13366
12995
  traits: new Set
13367
12996
  },
13368
12997
  enumerable: false
@@ -13373,7 +13002,7 @@ function $constructor(name, initializer, params) {
13373
13002
  }
13374
13003
  inst._zod.traits.add(name);
13375
13004
  initializer(inst, def);
13376
- const proto = _2.prototype;
13005
+ const proto = _.prototype;
13377
13006
  const keys = Object.keys(proto);
13378
13007
  for (let i2 = 0;i2 < keys.length; i2++) {
13379
13008
  const k = keys[i2];
@@ -13387,7 +13016,7 @@ function $constructor(name, initializer, params) {
13387
13016
  class Definition extends Parent {
13388
13017
  }
13389
13018
  Object.defineProperty(Definition, "name", { value: name });
13390
- function _2(def) {
13019
+ function _(def) {
13391
13020
  var _a2;
13392
13021
  const inst = params?.Parent ? new Definition : this;
13393
13022
  init(inst, def);
@@ -13397,16 +13026,16 @@ function $constructor(name, initializer, params) {
13397
13026
  }
13398
13027
  return inst;
13399
13028
  }
13400
- Object.defineProperty(_2, "init", { value: init });
13401
- Object.defineProperty(_2, Symbol.hasInstance, {
13029
+ Object.defineProperty(_, "init", { value: init });
13030
+ Object.defineProperty(_, Symbol.hasInstance, {
13402
13031
  value: (inst) => {
13403
13032
  if (params?.Parent && inst instanceof params.Parent)
13404
13033
  return true;
13405
13034
  return inst?._zod?.traits?.has(name);
13406
13035
  }
13407
13036
  });
13408
- Object.defineProperty(_2, "name", { value: name });
13409
- return _2;
13037
+ Object.defineProperty(_, "name", { value: name });
13038
+ return _;
13410
13039
  }
13411
13040
  function config(newConfig) {
13412
13041
  if (newConfig)
@@ -13437,69 +13066,69 @@ var init_core = __esm(() => {
13437
13066
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/util.js
13438
13067
  var exports_util = {};
13439
13068
  __export(exports_util, {
13440
- unwrapMessage: () => unwrapMessage,
13441
- uint8ArrayToHex: () => uint8ArrayToHex,
13442
- uint8ArrayToBase64url: () => uint8ArrayToBase64url,
13443
- uint8ArrayToBase64: () => uint8ArrayToBase64,
13444
- stringifyPrimitive: () => stringifyPrimitive,
13445
- slugify: () => slugify,
13446
- shallowClone: () => shallowClone,
13447
- safeExtend: () => safeExtend,
13448
- required: () => required,
13449
- randomString: () => randomString,
13450
- propertyKeyTypes: () => propertyKeyTypes,
13451
- promiseAllObject: () => promiseAllObject,
13452
- primitiveTypes: () => primitiveTypes,
13453
- prefixIssues: () => prefixIssues,
13454
- pick: () => pick,
13455
- partial: () => partial,
13456
- parsedType: () => parsedType,
13457
- optionalKeys: () => optionalKeys,
13458
- omit: () => omit,
13459
- objectClone: () => objectClone,
13460
- numKeys: () => numKeys,
13461
- nullish: () => nullish,
13462
- normalizeParams: () => normalizeParams,
13463
- mergeDefs: () => mergeDefs,
13464
- merge: () => merge,
13465
- jsonStringifyReplacer: () => jsonStringifyReplacer,
13466
- joinValues: () => joinValues,
13467
- issue: () => issue,
13468
- isPlainObject: () => isPlainObject,
13469
- isObject: () => isObject,
13470
- hexToUint8Array: () => hexToUint8Array,
13471
- getSizableOrigin: () => getSizableOrigin,
13472
- getParsedType: () => getParsedType,
13473
- getLengthableOrigin: () => getLengthableOrigin,
13474
- getEnumValues: () => getEnumValues,
13475
- getElementAtPath: () => getElementAtPath,
13476
- floatSafeRemainder: () => floatSafeRemainder,
13477
- finalizeIssue: () => finalizeIssue,
13478
- extend: () => extend,
13479
- explicitlyAborted: () => explicitlyAborted,
13480
- escapeRegex: () => escapeRegex,
13481
- esc: () => esc,
13482
- defineLazy: () => defineLazy,
13483
- createTransparentProxy: () => createTransparentProxy,
13484
- cloneDef: () => cloneDef,
13485
- clone: () => clone,
13486
- cleanRegex: () => cleanRegex,
13487
- cleanEnum: () => cleanEnum,
13488
- captureStackTrace: () => captureStackTrace,
13489
- cached: () => cached,
13490
- base64urlToUint8Array: () => base64urlToUint8Array,
13491
- base64ToUint8Array: () => base64ToUint8Array,
13492
- assignProp: () => assignProp,
13493
- assertNotEqual: () => assertNotEqual,
13494
- assertNever: () => assertNever,
13495
- assertIs: () => assertIs,
13496
- assertEqual: () => assertEqual,
13497
- assert: () => assert,
13498
- allowsEval: () => allowsEval,
13499
- aborted: () => aborted,
13500
- NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
13069
+ BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
13501
13070
  Class: () => Class,
13502
- BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES
13071
+ NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
13072
+ aborted: () => aborted,
13073
+ allowsEval: () => allowsEval,
13074
+ assert: () => assert,
13075
+ assertEqual: () => assertEqual,
13076
+ assertIs: () => assertIs,
13077
+ assertNever: () => assertNever,
13078
+ assertNotEqual: () => assertNotEqual,
13079
+ assignProp: () => assignProp,
13080
+ base64ToUint8Array: () => base64ToUint8Array,
13081
+ base64urlToUint8Array: () => base64urlToUint8Array,
13082
+ cached: () => cached,
13083
+ captureStackTrace: () => captureStackTrace,
13084
+ cleanEnum: () => cleanEnum,
13085
+ cleanRegex: () => cleanRegex,
13086
+ clone: () => clone,
13087
+ cloneDef: () => cloneDef,
13088
+ createTransparentProxy: () => createTransparentProxy,
13089
+ defineLazy: () => defineLazy,
13090
+ esc: () => esc,
13091
+ escapeRegex: () => escapeRegex,
13092
+ explicitlyAborted: () => explicitlyAborted,
13093
+ extend: () => extend,
13094
+ finalizeIssue: () => finalizeIssue,
13095
+ floatSafeRemainder: () => floatSafeRemainder,
13096
+ getElementAtPath: () => getElementAtPath,
13097
+ getEnumValues: () => getEnumValues,
13098
+ getLengthableOrigin: () => getLengthableOrigin,
13099
+ getParsedType: () => getParsedType,
13100
+ getSizableOrigin: () => getSizableOrigin,
13101
+ hexToUint8Array: () => hexToUint8Array,
13102
+ isObject: () => isObject,
13103
+ isPlainObject: () => isPlainObject,
13104
+ issue: () => issue,
13105
+ joinValues: () => joinValues,
13106
+ jsonStringifyReplacer: () => jsonStringifyReplacer,
13107
+ merge: () => merge,
13108
+ mergeDefs: () => mergeDefs,
13109
+ normalizeParams: () => normalizeParams,
13110
+ nullish: () => nullish,
13111
+ numKeys: () => numKeys,
13112
+ objectClone: () => objectClone,
13113
+ omit: () => omit,
13114
+ optionalKeys: () => optionalKeys,
13115
+ parsedType: () => parsedType,
13116
+ partial: () => partial,
13117
+ pick: () => pick,
13118
+ prefixIssues: () => prefixIssues,
13119
+ primitiveTypes: () => primitiveTypes,
13120
+ promiseAllObject: () => promiseAllObject,
13121
+ propertyKeyTypes: () => propertyKeyTypes,
13122
+ randomString: () => randomString,
13123
+ required: () => required,
13124
+ safeExtend: () => safeExtend,
13125
+ shallowClone: () => shallowClone,
13126
+ slugify: () => slugify,
13127
+ stringifyPrimitive: () => stringifyPrimitive,
13128
+ uint8ArrayToBase64: () => uint8ArrayToBase64,
13129
+ uint8ArrayToBase64url: () => uint8ArrayToBase64url,
13130
+ uint8ArrayToHex: () => uint8ArrayToHex,
13131
+ unwrapMessage: () => unwrapMessage
13503
13132
  });
13504
13133
  function assertEqual(val) {
13505
13134
  return val;
@@ -13511,16 +13140,16 @@ function assertIs(_arg) {}
13511
13140
  function assertNever(_x) {
13512
13141
  throw new Error("Unexpected value in exhaustive check");
13513
13142
  }
13514
- function assert(_2) {}
13143
+ function assert(_) {}
13515
13144
  function getEnumValues(entries) {
13516
13145
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
13517
- const values = Object.entries(entries).filter(([k, _2]) => numericValues.indexOf(+k) === -1).map(([_2, v]) => v);
13146
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
13518
13147
  return values;
13519
13148
  }
13520
13149
  function joinValues(array, separator = "|") {
13521
13150
  return array.map((val) => stringifyPrimitive(val)).join(separator);
13522
13151
  }
13523
- function jsonStringifyReplacer(_2, value) {
13152
+ function jsonStringifyReplacer(_, value) {
13524
13153
  if (typeof value === "bigint")
13525
13154
  return value.toString();
13526
13155
  return value;
@@ -13694,31 +13323,31 @@ function normalizeParams(_params) {
13694
13323
  function createTransparentProxy(getter) {
13695
13324
  let target;
13696
13325
  return new Proxy({}, {
13697
- get(_2, prop, receiver) {
13326
+ get(_, prop, receiver) {
13698
13327
  target ?? (target = getter());
13699
13328
  return Reflect.get(target, prop, receiver);
13700
13329
  },
13701
- set(_2, prop, value, receiver) {
13330
+ set(_, prop, value, receiver) {
13702
13331
  target ?? (target = getter());
13703
13332
  return Reflect.set(target, prop, value, receiver);
13704
13333
  },
13705
- has(_2, prop) {
13334
+ has(_, prop) {
13706
13335
  target ?? (target = getter());
13707
13336
  return Reflect.has(target, prop);
13708
13337
  },
13709
- deleteProperty(_2, prop) {
13338
+ deleteProperty(_, prop) {
13710
13339
  target ?? (target = getter());
13711
13340
  return Reflect.deleteProperty(target, prop);
13712
13341
  },
13713
- ownKeys(_2) {
13342
+ ownKeys(_) {
13714
13343
  target ?? (target = getter());
13715
13344
  return Reflect.ownKeys(target);
13716
13345
  },
13717
- getOwnPropertyDescriptor(_2, prop) {
13346
+ getOwnPropertyDescriptor(_, prop) {
13718
13347
  target ?? (target = getter());
13719
13348
  return Reflect.getOwnPropertyDescriptor(target, prop);
13720
13349
  },
13721
- defineProperty(_2, prop, descriptor) {
13350
+ defineProperty(_, prop, descriptor) {
13722
13351
  target ?? (target = getter());
13723
13352
  return Reflect.defineProperty(target, prop, descriptor);
13724
13353
  }
@@ -13822,20 +13451,20 @@ function safeExtend(schema, shape) {
13822
13451
  });
13823
13452
  return clone(schema, def);
13824
13453
  }
13825
- function merge(a3, b2) {
13454
+ function merge(a3, b) {
13826
13455
  if (a3._zod.def.checks?.length) {
13827
13456
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
13828
13457
  }
13829
13458
  const def = mergeDefs(a3._zod.def, {
13830
13459
  get shape() {
13831
- const _shape = { ...a3._zod.def.shape, ...b2._zod.def.shape };
13460
+ const _shape = { ...a3._zod.def.shape, ...b._zod.def.shape };
13832
13461
  assignProp(this, "shape", _shape);
13833
13462
  return _shape;
13834
13463
  },
13835
13464
  get catchall() {
13836
- return b2._zod.def.catchall;
13465
+ return b._zod.def.catchall;
13837
13466
  },
13838
- checks: b2._zod.def.checks ?? []
13467
+ checks: b._zod.def.checks ?? []
13839
13468
  });
13840
13469
  return clone(a3, def);
13841
13470
  }
@@ -13999,7 +13628,7 @@ function issue(...args) {
13999
13628
  return { ...iss };
14000
13629
  }
14001
13630
  function cleanEnum(obj) {
14002
- return Object.entries(obj).filter(([k, _2]) => {
13631
+ return Object.entries(obj).filter(([k, _]) => {
14003
13632
  return Number.isNaN(Number.parseInt(k, 10));
14004
13633
  }).map((el) => el[1]);
14005
13634
  }
@@ -14038,7 +13667,7 @@ function hexToUint8Array(hex) {
14038
13667
  return bytes;
14039
13668
  }
14040
13669
  function uint8ArrayToHex(bytes) {
14041
- return Array.from(bytes).map((b2) => b2.toString(16).padStart(2, "0")).join("");
13670
+ return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
14042
13671
  }
14043
13672
 
14044
13673
  class Class {
@@ -14103,7 +13732,7 @@ var init_util = __esm(() => {
14103
13732
  const F = Function;
14104
13733
  new F("");
14105
13734
  return true;
14106
- } catch (_2) {
13735
+ } catch (_) {
14107
13736
  return false;
14108
13737
  }
14109
13738
  });
@@ -14241,7 +13870,7 @@ function toDotPath(_path) {
14241
13870
  }
14242
13871
  function prettifyError(error) {
14243
13872
  const lines = [];
14244
- const issues = [...error.issues].sort((a3, b2) => (a3.path ?? []).length - (b2.path ?? []).length);
13873
+ const issues = [...error.issues].sort((a3, b) => (a3.path ?? []).length - (b.path ?? []).length);
14245
13874
  for (const issue2 of issues) {
14246
13875
  lines.push(`✖ ${issue2.message}`);
14247
13876
  if (issue2.path?.length)
@@ -14358,65 +13987,65 @@ var init_parse = __esm(() => {
14358
13987
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/regexes.js
14359
13988
  var exports_regexes = {};
14360
13989
  __export(exports_regexes, {
14361
- xid: () => xid,
14362
- uuid7: () => uuid7,
14363
- uuid6: () => uuid6,
14364
- uuid4: () => uuid4,
14365
- uuid: () => uuid,
14366
- uppercase: () => uppercase,
14367
- unicodeEmail: () => unicodeEmail,
14368
- undefined: () => _undefined,
14369
- ulid: () => ulid,
14370
- time: () => time,
14371
- string: () => string,
14372
- sha512_hex: () => sha512_hex,
14373
- sha512_base64url: () => sha512_base64url,
14374
- sha512_base64: () => sha512_base64,
14375
- sha384_hex: () => sha384_hex,
14376
- sha384_base64url: () => sha384_base64url,
14377
- sha384_base64: () => sha384_base64,
14378
- sha256_hex: () => sha256_hex,
14379
- sha256_base64url: () => sha256_base64url,
14380
- sha256_base64: () => sha256_base64,
14381
- sha1_hex: () => sha1_hex,
14382
- sha1_base64url: () => sha1_base64url,
14383
- sha1_base64: () => sha1_base64,
14384
- rfc5322Email: () => rfc5322Email,
14385
- number: () => number,
14386
- null: () => _null,
14387
- nanoid: () => nanoid,
14388
- md5_hex: () => md5_hex,
14389
- md5_base64url: () => md5_base64url,
14390
- md5_base64: () => md5_base64,
14391
- mac: () => mac,
14392
- lowercase: () => lowercase,
14393
- ksuid: () => ksuid,
14394
- ipv6: () => ipv6,
14395
- ipv4: () => ipv4,
14396
- integer: () => integer,
14397
- idnEmail: () => idnEmail,
14398
- httpProtocol: () => httpProtocol,
14399
- html5Email: () => html5Email,
14400
- hostname: () => hostname,
14401
- hex: () => hex,
14402
- guid: () => guid,
14403
- extendedDuration: () => extendedDuration,
14404
- emoji: () => emoji,
14405
- email: () => email,
14406
- e164: () => e164,
14407
- duration: () => duration,
14408
- domain: () => domain,
14409
- datetime: () => datetime,
14410
- date: () => date,
14411
- cuid2: () => cuid2,
14412
- cuid: () => cuid,
14413
- cidrv6: () => cidrv6,
14414
- cidrv4: () => cidrv4,
14415
- browserEmail: () => browserEmail,
14416
- boolean: () => boolean,
14417
- bigint: () => bigint,
13990
+ base64: () => base64,
14418
13991
  base64url: () => base64url,
14419
- base64: () => base64
13992
+ bigint: () => bigint,
13993
+ boolean: () => boolean,
13994
+ browserEmail: () => browserEmail,
13995
+ cidrv4: () => cidrv4,
13996
+ cidrv6: () => cidrv6,
13997
+ cuid: () => cuid,
13998
+ cuid2: () => cuid2,
13999
+ date: () => date,
14000
+ datetime: () => datetime,
14001
+ domain: () => domain,
14002
+ duration: () => duration,
14003
+ e164: () => e164,
14004
+ email: () => email,
14005
+ emoji: () => emoji,
14006
+ extendedDuration: () => extendedDuration,
14007
+ guid: () => guid,
14008
+ hex: () => hex,
14009
+ hostname: () => hostname,
14010
+ html5Email: () => html5Email,
14011
+ httpProtocol: () => httpProtocol,
14012
+ idnEmail: () => idnEmail,
14013
+ integer: () => integer,
14014
+ ipv4: () => ipv4,
14015
+ ipv6: () => ipv6,
14016
+ ksuid: () => ksuid,
14017
+ lowercase: () => lowercase,
14018
+ mac: () => mac,
14019
+ md5_base64: () => md5_base64,
14020
+ md5_base64url: () => md5_base64url,
14021
+ md5_hex: () => md5_hex,
14022
+ nanoid: () => nanoid,
14023
+ null: () => _null,
14024
+ number: () => number,
14025
+ rfc5322Email: () => rfc5322Email,
14026
+ sha1_base64: () => sha1_base64,
14027
+ sha1_base64url: () => sha1_base64url,
14028
+ sha1_hex: () => sha1_hex,
14029
+ sha256_base64: () => sha256_base64,
14030
+ sha256_base64url: () => sha256_base64url,
14031
+ sha256_hex: () => sha256_hex,
14032
+ sha384_base64: () => sha384_base64,
14033
+ sha384_base64url: () => sha384_base64url,
14034
+ sha384_hex: () => sha384_hex,
14035
+ sha512_base64: () => sha512_base64,
14036
+ sha512_base64url: () => sha512_base64url,
14037
+ sha512_hex: () => sha512_hex,
14038
+ string: () => string,
14039
+ time: () => time,
14040
+ ulid: () => ulid,
14041
+ undefined: () => _undefined,
14042
+ unicodeEmail: () => unicodeEmail,
14043
+ uppercase: () => uppercase,
14044
+ uuid: () => uuid,
14045
+ uuid4: () => uuid4,
14046
+ uuid6: () => uuid6,
14047
+ uuid7: () => uuid7,
14048
+ xid: () => xid
14420
14049
  });
14421
14050
  function emoji() {
14422
14051
  return new RegExp(_emoji, "u");
@@ -15132,7 +14761,7 @@ function isValidBase64(data) {
15132
14761
  function isValidBase64URL(data) {
15133
14762
  if (!base64url.test(data))
15134
14763
  return false;
15135
- const base642 = data.replace(/[-_]/g, (c3) => c3 === "-" ? "+" : "/");
14764
+ const base642 = data.replace(/[-_]/g, (c2) => c2 === "-" ? "+" : "/");
15136
14765
  const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
15137
14766
  return isValidBase64(padded);
15138
14767
  }
@@ -15286,19 +14915,19 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
15286
14915
  }
15287
14916
  return final;
15288
14917
  }
15289
- function mergeValues(a3, b2) {
15290
- if (a3 === b2) {
14918
+ function mergeValues(a3, b) {
14919
+ if (a3 === b) {
15291
14920
  return { valid: true, data: a3 };
15292
14921
  }
15293
- if (a3 instanceof Date && b2 instanceof Date && +a3 === +b2) {
14922
+ if (a3 instanceof Date && b instanceof Date && +a3 === +b) {
15294
14923
  return { valid: true, data: a3 };
15295
14924
  }
15296
- if (isPlainObject(a3) && isPlainObject(b2)) {
15297
- const bKeys = Object.keys(b2);
14925
+ if (isPlainObject(a3) && isPlainObject(b)) {
14926
+ const bKeys = Object.keys(b);
15298
14927
  const sharedKeys = Object.keys(a3).filter((key) => bKeys.indexOf(key) !== -1);
15299
- const newObj = { ...a3, ...b2 };
14928
+ const newObj = { ...a3, ...b };
15300
14929
  for (const key of sharedKeys) {
15301
- const sharedValue = mergeValues(a3[key], b2[key]);
14930
+ const sharedValue = mergeValues(a3[key], b[key]);
15302
14931
  if (!sharedValue.valid) {
15303
14932
  return {
15304
14933
  valid: false,
@@ -15309,14 +14938,14 @@ function mergeValues(a3, b2) {
15309
14938
  }
15310
14939
  return { valid: true, data: newObj };
15311
14940
  }
15312
- if (Array.isArray(a3) && Array.isArray(b2)) {
15313
- if (a3.length !== b2.length) {
14941
+ if (Array.isArray(a3) && Array.isArray(b)) {
14942
+ if (a3.length !== b.length) {
15314
14943
  return { valid: false, mergeErrorPath: [] };
15315
14944
  }
15316
14945
  const newArray = [];
15317
14946
  for (let index = 0;index < a3.length; index++) {
15318
14947
  const itemA = a3[index];
15319
- const itemB = b2[index];
14948
+ const itemB = b[index];
15320
14949
  const sharedValue = mergeValues(itemA, itemB);
15321
14950
  if (!sharedValue.valid) {
15322
14951
  return {
@@ -15356,7 +14985,7 @@ function handleIntersectionResults(result, left, right) {
15356
14985
  result.issues.push(iss);
15357
14986
  }
15358
14987
  }
15359
- const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([k]) => k);
14988
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
15360
14989
  if (bothKeys.length && unrecIssue) {
15361
14990
  result.issues.push({ ...unrecIssue, keys: bothKeys });
15362
14991
  }
@@ -15559,13 +15188,13 @@ var init_schemas = __esm(() => {
15559
15188
  continue;
15560
15189
  }
15561
15190
  const currLen = payload.issues.length;
15562
- const _2 = ch._zod.check(payload);
15563
- if (_2 instanceof Promise && ctx?.async === false) {
15191
+ const _ = ch._zod.check(payload);
15192
+ if (_ instanceof Promise && ctx?.async === false) {
15564
15193
  throw new $ZodAsyncError;
15565
15194
  }
15566
- if (asyncResult || _2 instanceof Promise) {
15195
+ if (asyncResult || _ instanceof Promise) {
15567
15196
  asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
15568
- await _2;
15197
+ await _;
15569
15198
  const nextLen = payload.issues.length;
15570
15199
  if (nextLen === currLen)
15571
15200
  return;
@@ -15627,7 +15256,7 @@ var init_schemas = __esm(() => {
15627
15256
  try {
15628
15257
  const r2 = safeParse(inst, value);
15629
15258
  return r2.success ? { value: r2.data } : { issues: r2.error?.issues };
15630
- } catch (_2) {
15259
+ } catch (_) {
15631
15260
  return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });
15632
15261
  }
15633
15262
  },
@@ -15638,11 +15267,11 @@ var init_schemas = __esm(() => {
15638
15267
  $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
15639
15268
  $ZodType.init(inst, def);
15640
15269
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
15641
- inst._zod.parse = (payload, _2) => {
15270
+ inst._zod.parse = (payload, _) => {
15642
15271
  if (def.coerce)
15643
15272
  try {
15644
15273
  payload.value = String(payload.value);
15645
- } catch (_3) {}
15274
+ } catch (_2) {}
15646
15275
  if (typeof payload.value === "string")
15647
15276
  return payload;
15648
15277
  payload.issues.push({
@@ -15739,7 +15368,7 @@ var init_schemas = __esm(() => {
15739
15368
  payload.value = trimmed;
15740
15369
  }
15741
15370
  return;
15742
- } catch (_2) {
15371
+ } catch (_) {
15743
15372
  payload.issues.push({
15744
15373
  code: "invalid_format",
15745
15374
  format: "url",
@@ -15925,7 +15554,7 @@ var init_schemas = __esm(() => {
15925
15554
  if (def.coerce)
15926
15555
  try {
15927
15556
  payload.value = Number(payload.value);
15928
- } catch (_2) {}
15557
+ } catch (_) {}
15929
15558
  const input = payload.value;
15930
15559
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
15931
15560
  return payload;
@@ -15952,7 +15581,7 @@ var init_schemas = __esm(() => {
15952
15581
  if (def.coerce)
15953
15582
  try {
15954
15583
  payload.value = Boolean(payload.value);
15955
- } catch (_2) {}
15584
+ } catch (_) {}
15956
15585
  const input = payload.value;
15957
15586
  if (typeof input === "boolean")
15958
15587
  return payload;
@@ -15972,7 +15601,7 @@ var init_schemas = __esm(() => {
15972
15601
  if (def.coerce)
15973
15602
  try {
15974
15603
  payload.value = BigInt(payload.value);
15975
- } catch (_2) {}
15604
+ } catch (_) {}
15976
15605
  if (typeof payload.value === "bigint")
15977
15606
  return payload;
15978
15607
  payload.issues.push({
@@ -16332,7 +15961,7 @@ var init_schemas = __esm(() => {
16332
15961
  defineLazy(inst._zod, "pattern", () => {
16333
15962
  if (def.options.every((o2) => o2._zod.pattern)) {
16334
15963
  const patterns = def.options.map((o2) => o2._zod.pattern);
16335
- return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
15964
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
16336
15965
  }
16337
15966
  return;
16338
15967
  });
@@ -17194,7 +16823,7 @@ var init_schemas = __esm(() => {
17194
16823
  $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
17195
16824
  $ZodCheck.init(inst, def);
17196
16825
  $ZodType.init(inst, def);
17197
- inst._zod.parse = (payload, _2) => {
16826
+ inst._zod.parse = (payload, _) => {
17198
16827
  return payload;
17199
16828
  };
17200
16829
  inst._zod.check = (payload) => {
@@ -23261,58 +22890,58 @@ var init_yo = __esm(() => {
23261
22890
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/index.js
23262
22891
  var exports_locales = {};
23263
22892
  __export(exports_locales, {
23264
- zhTW: () => zh_TW_default,
23265
- zhCN: () => zh_CN_default,
23266
- yo: () => yo_default,
23267
- vi: () => vi_default,
23268
- uz: () => uz_default,
23269
- ur: () => ur_default,
23270
- uk: () => uk_default,
23271
- ua: () => ua_default,
23272
- tr: () => tr_default,
23273
- th: () => th_default,
23274
- ta: () => ta_default,
23275
- sv: () => sv_default,
23276
- sl: () => sl_default,
23277
- ru: () => ru_default,
23278
- ro: () => ro_default,
23279
- pt: () => pt_default,
23280
- ps: () => ps_default,
23281
- pl: () => pl_default,
23282
- ota: () => ota_default,
23283
- no: () => no_default,
23284
- nl: () => nl_default,
23285
- ms: () => ms_default,
23286
- mk: () => mk_default,
23287
- lt: () => lt_default,
23288
- ko: () => ko_default,
23289
- km: () => km_default,
23290
- kh: () => kh_default,
23291
- ka: () => ka_default,
23292
- ja: () => ja_default,
23293
- it: () => it_default,
23294
- is: () => is_default,
23295
- id: () => id_default,
23296
- hy: () => hy_default,
23297
- hu: () => hu_default,
23298
- hr: () => hr_default,
23299
- he: () => he_default,
23300
- frCA: () => fr_CA_default,
23301
- fr: () => fr_default,
23302
- fi: () => fi_default,
23303
- fa: () => fa_default,
23304
- es: () => es_default,
23305
- eo: () => eo_default,
23306
- en: () => en_default,
23307
- el: () => el_default,
23308
- de: () => de_default,
23309
- da: () => da_default,
23310
- cs: () => cs_default,
23311
- ca: () => ca_default,
23312
- bg: () => bg_default,
23313
- be: () => be_default,
22893
+ ar: () => ar_default,
23314
22894
  az: () => az_default,
23315
- ar: () => ar_default
22895
+ be: () => be_default,
22896
+ bg: () => bg_default,
22897
+ ca: () => ca_default,
22898
+ cs: () => cs_default,
22899
+ da: () => da_default,
22900
+ de: () => de_default,
22901
+ el: () => el_default,
22902
+ en: () => en_default,
22903
+ eo: () => eo_default,
22904
+ es: () => es_default,
22905
+ fa: () => fa_default,
22906
+ fi: () => fi_default,
22907
+ fr: () => fr_default,
22908
+ frCA: () => fr_CA_default,
22909
+ he: () => he_default,
22910
+ hr: () => hr_default,
22911
+ hu: () => hu_default,
22912
+ hy: () => hy_default,
22913
+ id: () => id_default,
22914
+ is: () => is_default,
22915
+ it: () => it_default,
22916
+ ja: () => ja_default,
22917
+ ka: () => ka_default,
22918
+ kh: () => kh_default,
22919
+ km: () => km_default,
22920
+ ko: () => ko_default,
22921
+ lt: () => lt_default,
22922
+ mk: () => mk_default,
22923
+ ms: () => ms_default,
22924
+ nl: () => nl_default,
22925
+ no: () => no_default,
22926
+ ota: () => ota_default,
22927
+ pl: () => pl_default,
22928
+ ps: () => ps_default,
22929
+ pt: () => pt_default,
22930
+ ro: () => ro_default,
22931
+ ru: () => ru_default,
22932
+ sl: () => sl_default,
22933
+ sv: () => sv_default,
22934
+ ta: () => ta_default,
22935
+ th: () => th_default,
22936
+ tr: () => tr_default,
22937
+ ua: () => ua_default,
22938
+ uk: () => uk_default,
22939
+ ur: () => ur_default,
22940
+ uz: () => uz_default,
22941
+ vi: () => vi_default,
22942
+ yo: () => yo_default,
22943
+ zhCN: () => zh_CN_default,
22944
+ zhTW: () => zh_TW_default
23316
22945
  });
23317
22946
  var init_locales = __esm(() => {
23318
22947
  init_ar();
@@ -23397,12 +23026,12 @@ class $ZodRegistry {
23397
23026
  return this;
23398
23027
  }
23399
23028
  get(schema) {
23400
- const p2 = schema._zod.parent;
23401
- if (p2) {
23402
- const pm = { ...this.get(p2) ?? {} };
23029
+ const p = schema._zod.parent;
23030
+ if (p) {
23031
+ const pm = { ...this.get(p) ?? {} };
23403
23032
  delete pm.id;
23404
- const f2 = { ...pm, ...this._map.get(schema) };
23405
- return Object.keys(f2).length ? f2 : undefined;
23033
+ const f = { ...pm, ...this._map.get(schema) };
23034
+ return Object.keys(f).length ? f : undefined;
23406
23035
  }
23407
23036
  return this._map.get(schema);
23408
23037
  }
@@ -24711,7 +24340,7 @@ function toJSONSchema(input, params) {
24711
24340
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
24712
24341
  const defs = {};
24713
24342
  for (const entry of registry2._idmap.entries()) {
24714
- const [_2, schema] = entry;
24343
+ const [_, schema] = entry;
24715
24344
  process2(schema, ctx2);
24716
24345
  }
24717
24346
  const schemas = {};
@@ -25001,14 +24630,14 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
25001
24630
  ...params,
25002
24631
  path: [...params.path, "allOf", 0]
25003
24632
  });
25004
- const b2 = process2(def.right, ctx, {
24633
+ const b = process2(def.right, ctx, {
25005
24634
  ...params,
25006
24635
  path: [...params.path, "allOf", 1]
25007
24636
  });
25008
24637
  const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
25009
24638
  const allOf = [
25010
24639
  ...isSimpleIntersection(a3) ? a3.allOf : [a3],
25011
- ...isSimpleIntersection(b2) ? b2.allOf : [b2]
24640
+ ...isSimpleIntersection(b) ? b.allOf : [b]
25012
24641
  ];
25013
24642
  json.allOf = allOf;
25014
24643
  }, tupleProcessor = (schema, ctx, _json, params) => {
@@ -25264,7 +24893,7 @@ class JSONSchemaGenerator {
25264
24893
  }
25265
24894
  extractDefs(this.ctx, schema);
25266
24895
  const result = finalize(this.ctx, schema);
25267
- const { "~standard": _2, ...plainResult } = result;
24896
+ const { "~standard": _, ...plainResult } = result;
25268
24897
  return plainResult;
25269
24898
  }
25270
24899
  }
@@ -25280,331 +24909,331 @@ var init_json_schema = () => {};
25280
24909
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/index.js
25281
24910
  var exports_core2 = {};
25282
24911
  __export(exports_core2, {
25283
- version: () => version,
25284
- util: () => exports_util,
25285
- treeifyError: () => treeifyError,
25286
- toJSONSchema: () => toJSONSchema,
25287
- toDotPath: () => toDotPath,
25288
- safeParseAsync: () => safeParseAsync,
25289
- safeParse: () => safeParse,
25290
- safeEncodeAsync: () => safeEncodeAsync,
25291
- safeEncode: () => safeEncode,
25292
- safeDecodeAsync: () => safeDecodeAsync,
25293
- safeDecode: () => safeDecode,
25294
- registry: () => registry,
25295
- regexes: () => exports_regexes,
25296
- process: () => process2,
25297
- prettifyError: () => prettifyError,
25298
- parseAsync: () => parseAsync,
25299
- parse: () => parse,
25300
- meta: () => meta,
25301
- locales: () => exports_locales,
25302
- isValidJWT: () => isValidJWT,
25303
- isValidBase64URL: () => isValidBase64URL,
25304
- isValidBase64: () => isValidBase64,
25305
- initializeContext: () => initializeContext,
25306
- globalRegistry: () => globalRegistry,
25307
- globalConfig: () => globalConfig,
25308
- formatError: () => formatError,
25309
- flattenError: () => flattenError,
25310
- finalize: () => finalize,
25311
- extractDefs: () => extractDefs,
25312
- encodeAsync: () => encodeAsync,
25313
- encode: () => encode,
25314
- describe: () => describe,
25315
- decodeAsync: () => decodeAsync,
25316
- decode: () => decode,
25317
- createToJSONSchemaMethod: () => createToJSONSchemaMethod,
25318
- createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
25319
- config: () => config,
25320
- clone: () => clone,
25321
- _xor: () => _xor,
25322
- _xid: () => _xid,
25323
- _void: () => _void,
25324
- _uuidv7: () => _uuidv7,
25325
- _uuidv6: () => _uuidv6,
25326
- _uuidv4: () => _uuidv4,
25327
- _uuid: () => _uuid,
25328
- _url: () => _url,
25329
- _uppercase: () => _uppercase,
25330
- _unknown: () => _unknown,
25331
- _union: () => _union,
25332
- _undefined: () => _undefined2,
25333
- _ulid: () => _ulid,
25334
- _uint64: () => _uint64,
25335
- _uint32: () => _uint32,
25336
- _tuple: () => _tuple,
25337
- _trim: () => _trim,
25338
- _transform: () => _transform,
25339
- _toUpperCase: () => _toUpperCase,
25340
- _toLowerCase: () => _toLowerCase,
25341
- _templateLiteral: () => _templateLiteral,
25342
- _symbol: () => _symbol,
25343
- _superRefine: () => _superRefine,
25344
- _success: () => _success,
25345
- _stringbool: () => _stringbool,
25346
- _stringFormat: () => _stringFormat,
25347
- _string: () => _string,
25348
- _startsWith: () => _startsWith,
25349
- _slugify: () => _slugify,
25350
- _size: () => _size,
25351
- _set: () => _set,
25352
- _safeParseAsync: () => _safeParseAsync,
25353
- _safeParse: () => _safeParse,
25354
- _safeEncodeAsync: () => _safeEncodeAsync,
25355
- _safeEncode: () => _safeEncode,
25356
- _safeDecodeAsync: () => _safeDecodeAsync,
25357
- _safeDecode: () => _safeDecode,
25358
- _regex: () => _regex,
25359
- _refine: () => _refine,
25360
- _record: () => _record,
25361
- _readonly: () => _readonly,
25362
- _property: () => _property,
25363
- _promise: () => _promise,
25364
- _positive: () => _positive,
25365
- _pipe: () => _pipe,
25366
- _parseAsync: () => _parseAsync,
25367
- _parse: () => _parse,
25368
- _overwrite: () => _overwrite,
25369
- _optional: () => _optional,
25370
- _number: () => _number,
25371
- _nullable: () => _nullable,
25372
- _null: () => _null2,
25373
- _normalize: () => _normalize,
25374
- _nonpositive: () => _nonpositive,
25375
- _nonoptional: () => _nonoptional,
25376
- _nonnegative: () => _nonnegative,
25377
- _never: () => _never,
25378
- _negative: () => _negative,
25379
- _nativeEnum: () => _nativeEnum,
25380
- _nanoid: () => _nanoid,
25381
- _nan: () => _nan,
25382
- _multipleOf: () => _multipleOf,
25383
- _minSize: () => _minSize,
25384
- _minLength: () => _minLength,
25385
- _min: () => _gte,
25386
- _mime: () => _mime,
25387
- _maxSize: () => _maxSize,
25388
- _maxLength: () => _maxLength,
25389
- _max: () => _lte,
25390
- _map: () => _map,
25391
- _mac: () => _mac,
25392
- _lte: () => _lte,
25393
- _lt: () => _lt,
25394
- _lowercase: () => _lowercase,
25395
- _literal: () => _literal,
25396
- _length: () => _length,
25397
- _lazy: () => _lazy,
25398
- _ksuid: () => _ksuid,
25399
- _jwt: () => _jwt,
25400
- _isoTime: () => _isoTime,
25401
- _isoDuration: () => _isoDuration,
25402
- _isoDateTime: () => _isoDateTime,
25403
- _isoDate: () => _isoDate,
25404
- _ipv6: () => _ipv6,
25405
- _ipv4: () => _ipv4,
25406
- _intersection: () => _intersection,
25407
- _int64: () => _int64,
25408
- _int32: () => _int32,
25409
- _int: () => _int,
25410
- _includes: () => _includes,
25411
- _guid: () => _guid,
25412
- _gte: () => _gte,
25413
- _gt: () => _gt,
25414
- _float64: () => _float64,
25415
- _float32: () => _float32,
25416
- _file: () => _file,
25417
- _enum: () => _enum,
25418
- _endsWith: () => _endsWith,
25419
- _encodeAsync: () => _encodeAsync,
25420
- _encode: () => _encode,
25421
- _emoji: () => _emoji2,
25422
- _email: () => _email,
25423
- _e164: () => _e164,
25424
- _discriminatedUnion: () => _discriminatedUnion,
25425
- _default: () => _default,
25426
- _decodeAsync: () => _decodeAsync,
25427
- _decode: () => _decode,
25428
- _date: () => _date,
25429
- _custom: () => _custom,
25430
- _cuid2: () => _cuid2,
25431
- _cuid: () => _cuid,
25432
- _coercedString: () => _coercedString,
25433
- _coercedNumber: () => _coercedNumber,
25434
- _coercedDate: () => _coercedDate,
25435
- _coercedBoolean: () => _coercedBoolean,
25436
- _coercedBigint: () => _coercedBigint,
25437
- _cidrv6: () => _cidrv6,
25438
- _cidrv4: () => _cidrv4,
25439
- _check: () => _check,
25440
- _catch: () => _catch,
25441
- _boolean: () => _boolean,
25442
- _bigint: () => _bigint,
25443
- _base64url: () => _base64url,
25444
- _base64: () => _base64,
25445
- _array: () => _array,
25446
- _any: () => _any,
25447
- TimePrecision: () => TimePrecision,
25448
- NEVER: () => NEVER,
25449
- JSONSchemaGenerator: () => JSONSchemaGenerator,
25450
- JSONSchema: () => exports_json_schema,
25451
- Doc: () => Doc,
25452
- $output: () => $output,
25453
- $input: () => $input,
25454
- $constructor: () => $constructor,
25455
- $brand: () => $brand,
25456
- $ZodXor: () => $ZodXor,
25457
- $ZodXID: () => $ZodXID,
25458
- $ZodVoid: () => $ZodVoid,
25459
- $ZodUnknown: () => $ZodUnknown,
25460
- $ZodUnion: () => $ZodUnion,
25461
- $ZodUndefined: () => $ZodUndefined,
25462
- $ZodUUID: () => $ZodUUID,
25463
- $ZodURL: () => $ZodURL,
25464
- $ZodULID: () => $ZodULID,
25465
- $ZodType: () => $ZodType,
25466
- $ZodTuple: () => $ZodTuple,
25467
- $ZodTransform: () => $ZodTransform,
25468
- $ZodTemplateLiteral: () => $ZodTemplateLiteral,
25469
- $ZodSymbol: () => $ZodSymbol,
25470
- $ZodSuccess: () => $ZodSuccess,
25471
- $ZodStringFormat: () => $ZodStringFormat,
25472
- $ZodString: () => $ZodString,
25473
- $ZodSet: () => $ZodSet,
25474
- $ZodRegistry: () => $ZodRegistry,
25475
- $ZodRecord: () => $ZodRecord,
25476
- $ZodRealError: () => $ZodRealError,
25477
- $ZodReadonly: () => $ZodReadonly,
25478
- $ZodPromise: () => $ZodPromise,
25479
- $ZodPreprocess: () => $ZodPreprocess,
25480
- $ZodPrefault: () => $ZodPrefault,
25481
- $ZodPipe: () => $ZodPipe,
25482
- $ZodOptional: () => $ZodOptional,
25483
- $ZodObjectJIT: () => $ZodObjectJIT,
25484
- $ZodObject: () => $ZodObject,
25485
- $ZodNumberFormat: () => $ZodNumberFormat,
25486
- $ZodNumber: () => $ZodNumber,
25487
- $ZodNullable: () => $ZodNullable,
25488
- $ZodNull: () => $ZodNull,
25489
- $ZodNonOptional: () => $ZodNonOptional,
25490
- $ZodNever: () => $ZodNever,
25491
- $ZodNanoID: () => $ZodNanoID,
25492
- $ZodNaN: () => $ZodNaN,
25493
- $ZodMap: () => $ZodMap,
25494
- $ZodMAC: () => $ZodMAC,
25495
- $ZodLiteral: () => $ZodLiteral,
25496
- $ZodLazy: () => $ZodLazy,
25497
- $ZodKSUID: () => $ZodKSUID,
25498
- $ZodJWT: () => $ZodJWT,
25499
- $ZodIntersection: () => $ZodIntersection,
25500
- $ZodISOTime: () => $ZodISOTime,
25501
- $ZodISODuration: () => $ZodISODuration,
25502
- $ZodISODateTime: () => $ZodISODateTime,
25503
- $ZodISODate: () => $ZodISODate,
25504
- $ZodIPv6: () => $ZodIPv6,
25505
- $ZodIPv4: () => $ZodIPv4,
25506
- $ZodGUID: () => $ZodGUID,
25507
- $ZodFunction: () => $ZodFunction,
25508
- $ZodFile: () => $ZodFile,
25509
- $ZodExactOptional: () => $ZodExactOptional,
25510
- $ZodError: () => $ZodError,
25511
- $ZodEnum: () => $ZodEnum,
25512
- $ZodEncodeError: () => $ZodEncodeError,
25513
- $ZodEmoji: () => $ZodEmoji,
25514
- $ZodEmail: () => $ZodEmail,
25515
- $ZodE164: () => $ZodE164,
25516
- $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,
25517
- $ZodDefault: () => $ZodDefault,
25518
- $ZodDate: () => $ZodDate,
25519
- $ZodCustomStringFormat: () => $ZodCustomStringFormat,
25520
- $ZodCustom: () => $ZodCustom,
25521
- $ZodCodec: () => $ZodCodec,
25522
- $ZodCheckUpperCase: () => $ZodCheckUpperCase,
25523
- $ZodCheckStringFormat: () => $ZodCheckStringFormat,
25524
- $ZodCheckStartsWith: () => $ZodCheckStartsWith,
25525
- $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
25526
- $ZodCheckRegex: () => $ZodCheckRegex,
25527
- $ZodCheckProperty: () => $ZodCheckProperty,
25528
- $ZodCheckOverwrite: () => $ZodCheckOverwrite,
25529
- $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
25530
- $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
25531
- $ZodCheckMinSize: () => $ZodCheckMinSize,
25532
- $ZodCheckMinLength: () => $ZodCheckMinLength,
25533
- $ZodCheckMimeType: () => $ZodCheckMimeType,
25534
- $ZodCheckMaxSize: () => $ZodCheckMaxSize,
25535
- $ZodCheckMaxLength: () => $ZodCheckMaxLength,
25536
- $ZodCheckLowerCase: () => $ZodCheckLowerCase,
25537
- $ZodCheckLessThan: () => $ZodCheckLessThan,
25538
- $ZodCheckLengthEquals: () => $ZodCheckLengthEquals,
25539
- $ZodCheckIncludes: () => $ZodCheckIncludes,
25540
- $ZodCheckGreaterThan: () => $ZodCheckGreaterThan,
25541
- $ZodCheckEndsWith: () => $ZodCheckEndsWith,
25542
- $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,
25543
- $ZodCheck: () => $ZodCheck,
25544
- $ZodCatch: () => $ZodCatch,
25545
- $ZodCUID2: () => $ZodCUID2,
25546
- $ZodCUID: () => $ZodCUID,
25547
- $ZodCIDRv6: () => $ZodCIDRv6,
25548
- $ZodCIDRv4: () => $ZodCIDRv4,
25549
- $ZodBoolean: () => $ZodBoolean,
25550
- $ZodBigIntFormat: () => $ZodBigIntFormat,
25551
- $ZodBigInt: () => $ZodBigInt,
25552
- $ZodBase64URL: () => $ZodBase64URL,
25553
- $ZodBase64: () => $ZodBase64,
25554
- $ZodAsyncError: () => $ZodAsyncError,
24912
+ $ZodAny: () => $ZodAny,
25555
24913
  $ZodArray: () => $ZodArray,
25556
- $ZodAny: () => $ZodAny
25557
- });
25558
- var init_core2 = __esm(() => {
25559
- init_util();
25560
- init_regexes();
25561
- init_locales();
25562
- init_json_schema_processors();
25563
- init_json_schema_generator();
25564
- init_json_schema();
25565
- init_core();
25566
- init_parse();
25567
- init_errors();
25568
- init_schemas();
25569
- init_checks();
25570
- init_versions();
25571
- init_registries();
25572
- init_api();
25573
- init_to_json_schema();
25574
- });
25575
-
25576
- // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/checks.js
25577
- var exports_checks2 = {};
25578
- __export(exports_checks2, {
25579
- uppercase: () => _uppercase,
25580
- trim: () => _trim,
25581
- toUpperCase: () => _toUpperCase,
25582
- toLowerCase: () => _toLowerCase,
25583
- startsWith: () => _startsWith,
25584
- slugify: () => _slugify,
25585
- size: () => _size,
25586
- regex: () => _regex,
25587
- property: () => _property,
25588
- positive: () => _positive,
25589
- overwrite: () => _overwrite,
25590
- normalize: () => _normalize,
25591
- nonpositive: () => _nonpositive,
25592
- nonnegative: () => _nonnegative,
25593
- negative: () => _negative,
25594
- multipleOf: () => _multipleOf,
25595
- minSize: () => _minSize,
25596
- minLength: () => _minLength,
25597
- mime: () => _mime,
25598
- maxSize: () => _maxSize,
25599
- maxLength: () => _maxLength,
25600
- lte: () => _lte,
25601
- lt: () => _lt,
25602
- lowercase: () => _lowercase,
25603
- length: () => _length,
25604
- includes: () => _includes,
25605
- gte: () => _gte,
24914
+ $ZodAsyncError: () => $ZodAsyncError,
24915
+ $ZodBase64: () => $ZodBase64,
24916
+ $ZodBase64URL: () => $ZodBase64URL,
24917
+ $ZodBigInt: () => $ZodBigInt,
24918
+ $ZodBigIntFormat: () => $ZodBigIntFormat,
24919
+ $ZodBoolean: () => $ZodBoolean,
24920
+ $ZodCIDRv4: () => $ZodCIDRv4,
24921
+ $ZodCIDRv6: () => $ZodCIDRv6,
24922
+ $ZodCUID: () => $ZodCUID,
24923
+ $ZodCUID2: () => $ZodCUID2,
24924
+ $ZodCatch: () => $ZodCatch,
24925
+ $ZodCheck: () => $ZodCheck,
24926
+ $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,
24927
+ $ZodCheckEndsWith: () => $ZodCheckEndsWith,
24928
+ $ZodCheckGreaterThan: () => $ZodCheckGreaterThan,
24929
+ $ZodCheckIncludes: () => $ZodCheckIncludes,
24930
+ $ZodCheckLengthEquals: () => $ZodCheckLengthEquals,
24931
+ $ZodCheckLessThan: () => $ZodCheckLessThan,
24932
+ $ZodCheckLowerCase: () => $ZodCheckLowerCase,
24933
+ $ZodCheckMaxLength: () => $ZodCheckMaxLength,
24934
+ $ZodCheckMaxSize: () => $ZodCheckMaxSize,
24935
+ $ZodCheckMimeType: () => $ZodCheckMimeType,
24936
+ $ZodCheckMinLength: () => $ZodCheckMinLength,
24937
+ $ZodCheckMinSize: () => $ZodCheckMinSize,
24938
+ $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
24939
+ $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
24940
+ $ZodCheckOverwrite: () => $ZodCheckOverwrite,
24941
+ $ZodCheckProperty: () => $ZodCheckProperty,
24942
+ $ZodCheckRegex: () => $ZodCheckRegex,
24943
+ $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
24944
+ $ZodCheckStartsWith: () => $ZodCheckStartsWith,
24945
+ $ZodCheckStringFormat: () => $ZodCheckStringFormat,
24946
+ $ZodCheckUpperCase: () => $ZodCheckUpperCase,
24947
+ $ZodCodec: () => $ZodCodec,
24948
+ $ZodCustom: () => $ZodCustom,
24949
+ $ZodCustomStringFormat: () => $ZodCustomStringFormat,
24950
+ $ZodDate: () => $ZodDate,
24951
+ $ZodDefault: () => $ZodDefault,
24952
+ $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,
24953
+ $ZodE164: () => $ZodE164,
24954
+ $ZodEmail: () => $ZodEmail,
24955
+ $ZodEmoji: () => $ZodEmoji,
24956
+ $ZodEncodeError: () => $ZodEncodeError,
24957
+ $ZodEnum: () => $ZodEnum,
24958
+ $ZodError: () => $ZodError,
24959
+ $ZodExactOptional: () => $ZodExactOptional,
24960
+ $ZodFile: () => $ZodFile,
24961
+ $ZodFunction: () => $ZodFunction,
24962
+ $ZodGUID: () => $ZodGUID,
24963
+ $ZodIPv4: () => $ZodIPv4,
24964
+ $ZodIPv6: () => $ZodIPv6,
24965
+ $ZodISODate: () => $ZodISODate,
24966
+ $ZodISODateTime: () => $ZodISODateTime,
24967
+ $ZodISODuration: () => $ZodISODuration,
24968
+ $ZodISOTime: () => $ZodISOTime,
24969
+ $ZodIntersection: () => $ZodIntersection,
24970
+ $ZodJWT: () => $ZodJWT,
24971
+ $ZodKSUID: () => $ZodKSUID,
24972
+ $ZodLazy: () => $ZodLazy,
24973
+ $ZodLiteral: () => $ZodLiteral,
24974
+ $ZodMAC: () => $ZodMAC,
24975
+ $ZodMap: () => $ZodMap,
24976
+ $ZodNaN: () => $ZodNaN,
24977
+ $ZodNanoID: () => $ZodNanoID,
24978
+ $ZodNever: () => $ZodNever,
24979
+ $ZodNonOptional: () => $ZodNonOptional,
24980
+ $ZodNull: () => $ZodNull,
24981
+ $ZodNullable: () => $ZodNullable,
24982
+ $ZodNumber: () => $ZodNumber,
24983
+ $ZodNumberFormat: () => $ZodNumberFormat,
24984
+ $ZodObject: () => $ZodObject,
24985
+ $ZodObjectJIT: () => $ZodObjectJIT,
24986
+ $ZodOptional: () => $ZodOptional,
24987
+ $ZodPipe: () => $ZodPipe,
24988
+ $ZodPrefault: () => $ZodPrefault,
24989
+ $ZodPreprocess: () => $ZodPreprocess,
24990
+ $ZodPromise: () => $ZodPromise,
24991
+ $ZodReadonly: () => $ZodReadonly,
24992
+ $ZodRealError: () => $ZodRealError,
24993
+ $ZodRecord: () => $ZodRecord,
24994
+ $ZodRegistry: () => $ZodRegistry,
24995
+ $ZodSet: () => $ZodSet,
24996
+ $ZodString: () => $ZodString,
24997
+ $ZodStringFormat: () => $ZodStringFormat,
24998
+ $ZodSuccess: () => $ZodSuccess,
24999
+ $ZodSymbol: () => $ZodSymbol,
25000
+ $ZodTemplateLiteral: () => $ZodTemplateLiteral,
25001
+ $ZodTransform: () => $ZodTransform,
25002
+ $ZodTuple: () => $ZodTuple,
25003
+ $ZodType: () => $ZodType,
25004
+ $ZodULID: () => $ZodULID,
25005
+ $ZodURL: () => $ZodURL,
25006
+ $ZodUUID: () => $ZodUUID,
25007
+ $ZodUndefined: () => $ZodUndefined,
25008
+ $ZodUnion: () => $ZodUnion,
25009
+ $ZodUnknown: () => $ZodUnknown,
25010
+ $ZodVoid: () => $ZodVoid,
25011
+ $ZodXID: () => $ZodXID,
25012
+ $ZodXor: () => $ZodXor,
25013
+ $brand: () => $brand,
25014
+ $constructor: () => $constructor,
25015
+ $input: () => $input,
25016
+ $output: () => $output,
25017
+ Doc: () => Doc,
25018
+ JSONSchema: () => exports_json_schema,
25019
+ JSONSchemaGenerator: () => JSONSchemaGenerator,
25020
+ NEVER: () => NEVER,
25021
+ TimePrecision: () => TimePrecision,
25022
+ _any: () => _any,
25023
+ _array: () => _array,
25024
+ _base64: () => _base64,
25025
+ _base64url: () => _base64url,
25026
+ _bigint: () => _bigint,
25027
+ _boolean: () => _boolean,
25028
+ _catch: () => _catch,
25029
+ _check: () => _check,
25030
+ _cidrv4: () => _cidrv4,
25031
+ _cidrv6: () => _cidrv6,
25032
+ _coercedBigint: () => _coercedBigint,
25033
+ _coercedBoolean: () => _coercedBoolean,
25034
+ _coercedDate: () => _coercedDate,
25035
+ _coercedNumber: () => _coercedNumber,
25036
+ _coercedString: () => _coercedString,
25037
+ _cuid: () => _cuid,
25038
+ _cuid2: () => _cuid2,
25039
+ _custom: () => _custom,
25040
+ _date: () => _date,
25041
+ _decode: () => _decode,
25042
+ _decodeAsync: () => _decodeAsync,
25043
+ _default: () => _default,
25044
+ _discriminatedUnion: () => _discriminatedUnion,
25045
+ _e164: () => _e164,
25046
+ _email: () => _email,
25047
+ _emoji: () => _emoji2,
25048
+ _encode: () => _encode,
25049
+ _encodeAsync: () => _encodeAsync,
25050
+ _endsWith: () => _endsWith,
25051
+ _enum: () => _enum,
25052
+ _file: () => _file,
25053
+ _float32: () => _float32,
25054
+ _float64: () => _float64,
25055
+ _gt: () => _gt,
25056
+ _gte: () => _gte,
25057
+ _guid: () => _guid,
25058
+ _includes: () => _includes,
25059
+ _int: () => _int,
25060
+ _int32: () => _int32,
25061
+ _int64: () => _int64,
25062
+ _intersection: () => _intersection,
25063
+ _ipv4: () => _ipv4,
25064
+ _ipv6: () => _ipv6,
25065
+ _isoDate: () => _isoDate,
25066
+ _isoDateTime: () => _isoDateTime,
25067
+ _isoDuration: () => _isoDuration,
25068
+ _isoTime: () => _isoTime,
25069
+ _jwt: () => _jwt,
25070
+ _ksuid: () => _ksuid,
25071
+ _lazy: () => _lazy,
25072
+ _length: () => _length,
25073
+ _literal: () => _literal,
25074
+ _lowercase: () => _lowercase,
25075
+ _lt: () => _lt,
25076
+ _lte: () => _lte,
25077
+ _mac: () => _mac,
25078
+ _map: () => _map,
25079
+ _max: () => _lte,
25080
+ _maxLength: () => _maxLength,
25081
+ _maxSize: () => _maxSize,
25082
+ _mime: () => _mime,
25083
+ _min: () => _gte,
25084
+ _minLength: () => _minLength,
25085
+ _minSize: () => _minSize,
25086
+ _multipleOf: () => _multipleOf,
25087
+ _nan: () => _nan,
25088
+ _nanoid: () => _nanoid,
25089
+ _nativeEnum: () => _nativeEnum,
25090
+ _negative: () => _negative,
25091
+ _never: () => _never,
25092
+ _nonnegative: () => _nonnegative,
25093
+ _nonoptional: () => _nonoptional,
25094
+ _nonpositive: () => _nonpositive,
25095
+ _normalize: () => _normalize,
25096
+ _null: () => _null2,
25097
+ _nullable: () => _nullable,
25098
+ _number: () => _number,
25099
+ _optional: () => _optional,
25100
+ _overwrite: () => _overwrite,
25101
+ _parse: () => _parse,
25102
+ _parseAsync: () => _parseAsync,
25103
+ _pipe: () => _pipe,
25104
+ _positive: () => _positive,
25105
+ _promise: () => _promise,
25106
+ _property: () => _property,
25107
+ _readonly: () => _readonly,
25108
+ _record: () => _record,
25109
+ _refine: () => _refine,
25110
+ _regex: () => _regex,
25111
+ _safeDecode: () => _safeDecode,
25112
+ _safeDecodeAsync: () => _safeDecodeAsync,
25113
+ _safeEncode: () => _safeEncode,
25114
+ _safeEncodeAsync: () => _safeEncodeAsync,
25115
+ _safeParse: () => _safeParse,
25116
+ _safeParseAsync: () => _safeParseAsync,
25117
+ _set: () => _set,
25118
+ _size: () => _size,
25119
+ _slugify: () => _slugify,
25120
+ _startsWith: () => _startsWith,
25121
+ _string: () => _string,
25122
+ _stringFormat: () => _stringFormat,
25123
+ _stringbool: () => _stringbool,
25124
+ _success: () => _success,
25125
+ _superRefine: () => _superRefine,
25126
+ _symbol: () => _symbol,
25127
+ _templateLiteral: () => _templateLiteral,
25128
+ _toLowerCase: () => _toLowerCase,
25129
+ _toUpperCase: () => _toUpperCase,
25130
+ _transform: () => _transform,
25131
+ _trim: () => _trim,
25132
+ _tuple: () => _tuple,
25133
+ _uint32: () => _uint32,
25134
+ _uint64: () => _uint64,
25135
+ _ulid: () => _ulid,
25136
+ _undefined: () => _undefined2,
25137
+ _union: () => _union,
25138
+ _unknown: () => _unknown,
25139
+ _uppercase: () => _uppercase,
25140
+ _url: () => _url,
25141
+ _uuid: () => _uuid,
25142
+ _uuidv4: () => _uuidv4,
25143
+ _uuidv6: () => _uuidv6,
25144
+ _uuidv7: () => _uuidv7,
25145
+ _void: () => _void,
25146
+ _xid: () => _xid,
25147
+ _xor: () => _xor,
25148
+ clone: () => clone,
25149
+ config: () => config,
25150
+ createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
25151
+ createToJSONSchemaMethod: () => createToJSONSchemaMethod,
25152
+ decode: () => decode,
25153
+ decodeAsync: () => decodeAsync,
25154
+ describe: () => describe,
25155
+ encode: () => encode,
25156
+ encodeAsync: () => encodeAsync,
25157
+ extractDefs: () => extractDefs,
25158
+ finalize: () => finalize,
25159
+ flattenError: () => flattenError,
25160
+ formatError: () => formatError,
25161
+ globalConfig: () => globalConfig,
25162
+ globalRegistry: () => globalRegistry,
25163
+ initializeContext: () => initializeContext,
25164
+ isValidBase64: () => isValidBase64,
25165
+ isValidBase64URL: () => isValidBase64URL,
25166
+ isValidJWT: () => isValidJWT,
25167
+ locales: () => exports_locales,
25168
+ meta: () => meta,
25169
+ parse: () => parse,
25170
+ parseAsync: () => parseAsync,
25171
+ prettifyError: () => prettifyError,
25172
+ process: () => process2,
25173
+ regexes: () => exports_regexes,
25174
+ registry: () => registry,
25175
+ safeDecode: () => safeDecode,
25176
+ safeDecodeAsync: () => safeDecodeAsync,
25177
+ safeEncode: () => safeEncode,
25178
+ safeEncodeAsync: () => safeEncodeAsync,
25179
+ safeParse: () => safeParse,
25180
+ safeParseAsync: () => safeParseAsync,
25181
+ toDotPath: () => toDotPath,
25182
+ toJSONSchema: () => toJSONSchema,
25183
+ treeifyError: () => treeifyError,
25184
+ util: () => exports_util,
25185
+ version: () => version
25186
+ });
25187
+ var init_core2 = __esm(() => {
25188
+ init_util();
25189
+ init_regexes();
25190
+ init_locales();
25191
+ init_json_schema_processors();
25192
+ init_json_schema_generator();
25193
+ init_json_schema();
25194
+ init_core();
25195
+ init_parse();
25196
+ init_errors();
25197
+ init_schemas();
25198
+ init_checks();
25199
+ init_versions();
25200
+ init_registries();
25201
+ init_api();
25202
+ init_to_json_schema();
25203
+ });
25204
+
25205
+ // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/checks.js
25206
+ var exports_checks2 = {};
25207
+ __export(exports_checks2, {
25208
+ endsWith: () => _endsWith,
25606
25209
  gt: () => _gt,
25607
- endsWith: () => _endsWith
25210
+ gte: () => _gte,
25211
+ includes: () => _includes,
25212
+ length: () => _length,
25213
+ lowercase: () => _lowercase,
25214
+ lt: () => _lt,
25215
+ lte: () => _lte,
25216
+ maxLength: () => _maxLength,
25217
+ maxSize: () => _maxSize,
25218
+ mime: () => _mime,
25219
+ minLength: () => _minLength,
25220
+ minSize: () => _minSize,
25221
+ multipleOf: () => _multipleOf,
25222
+ negative: () => _negative,
25223
+ nonnegative: () => _nonnegative,
25224
+ nonpositive: () => _nonpositive,
25225
+ normalize: () => _normalize,
25226
+ overwrite: () => _overwrite,
25227
+ positive: () => _positive,
25228
+ property: () => _property,
25229
+ regex: () => _regex,
25230
+ size: () => _size,
25231
+ slugify: () => _slugify,
25232
+ startsWith: () => _startsWith,
25233
+ toLowerCase: () => _toLowerCase,
25234
+ toUpperCase: () => _toUpperCase,
25235
+ trim: () => _trim,
25236
+ uppercase: () => _uppercase
25608
25237
  });
25609
25238
  var init_checks2 = __esm(() => {
25610
25239
  init_core2();
@@ -25613,14 +25242,14 @@ var init_checks2 = __esm(() => {
25613
25242
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/iso.js
25614
25243
  var exports_iso = {};
25615
25244
  __export(exports_iso, {
25616
- time: () => time2,
25617
- duration: () => duration2,
25618
- datetime: () => datetime2,
25619
- date: () => date2,
25620
- ZodISOTime: () => ZodISOTime,
25621
- ZodISODuration: () => ZodISODuration,
25245
+ ZodISODate: () => ZodISODate,
25622
25246
  ZodISODateTime: () => ZodISODateTime,
25623
- ZodISODate: () => ZodISODate
25247
+ ZodISODuration: () => ZodISODuration,
25248
+ ZodISOTime: () => ZodISOTime,
25249
+ date: () => date2,
25250
+ datetime: () => datetime2,
25251
+ duration: () => duration2,
25252
+ time: () => time2
25624
25253
  });
25625
25254
  function datetime2(params) {
25626
25255
  return _isoDateTime(ZodISODateTime, params);
@@ -25718,172 +25347,172 @@ var init_parse2 = __esm(() => {
25718
25347
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
25719
25348
  var exports_schemas2 = {};
25720
25349
  __export(exports_schemas2, {
25721
- xor: () => xor,
25722
- xid: () => xid2,
25723
- void: () => _void2,
25724
- uuidv7: () => uuidv7,
25725
- uuidv6: () => uuidv6,
25726
- uuidv4: () => uuidv4,
25727
- uuid: () => uuid2,
25728
- url: () => url,
25729
- unknown: () => unknown,
25730
- union: () => union,
25731
- undefined: () => _undefined3,
25732
- ulid: () => ulid2,
25733
- uint64: () => uint64,
25734
- uint32: () => uint32,
25735
- tuple: () => tuple,
25736
- transform: () => transform,
25737
- templateLiteral: () => templateLiteral,
25738
- symbol: () => symbol2,
25739
- superRefine: () => superRefine,
25740
- success: () => success,
25741
- stringbool: () => stringbool,
25742
- stringFormat: () => stringFormat,
25743
- string: () => string2,
25744
- strictObject: () => strictObject,
25745
- set: () => set,
25746
- refine: () => refine,
25747
- record: () => record,
25748
- readonly: () => readonly,
25749
- promise: () => promise,
25750
- preprocess: () => preprocess,
25751
- prefault: () => prefault,
25752
- pipe: () => pipe,
25753
- partialRecord: () => partialRecord,
25754
- optional: () => optional,
25755
- object: () => object,
25756
- number: () => number2,
25757
- nullish: () => nullish2,
25758
- nullable: () => nullable,
25759
- null: () => _null3,
25760
- nonoptional: () => nonoptional,
25761
- never: () => never,
25762
- nativeEnum: () => nativeEnum,
25763
- nanoid: () => nanoid2,
25764
- nan: () => nan,
25765
- meta: () => meta2,
25766
- map: () => map,
25767
- mac: () => mac2,
25768
- looseRecord: () => looseRecord,
25769
- looseObject: () => looseObject,
25770
- literal: () => literal,
25771
- lazy: () => lazy,
25772
- ksuid: () => ksuid2,
25773
- keyof: () => keyof,
25774
- jwt: () => jwt,
25775
- json: () => json,
25776
- ipv6: () => ipv62,
25777
- ipv4: () => ipv42,
25778
- invertCodec: () => invertCodec,
25779
- intersection: () => intersection,
25780
- int64: () => int64,
25781
- int32: () => int32,
25782
- int: () => int,
25783
- instanceof: () => _instanceof,
25784
- httpUrl: () => httpUrl,
25785
- hostname: () => hostname2,
25786
- hex: () => hex2,
25787
- hash: () => hash,
25788
- guid: () => guid2,
25789
- function: () => _function,
25790
- float64: () => float64,
25791
- float32: () => float32,
25792
- file: () => file,
25793
- exactOptional: () => exactOptional,
25794
- enum: () => _enum2,
25795
- emoji: () => emoji2,
25796
- email: () => email2,
25797
- e164: () => e1642,
25798
- discriminatedUnion: () => discriminatedUnion,
25799
- describe: () => describe2,
25800
- date: () => date3,
25801
- custom: () => custom,
25802
- cuid2: () => cuid22,
25803
- cuid: () => cuid3,
25804
- codec: () => codec,
25805
- cidrv6: () => cidrv62,
25806
- cidrv4: () => cidrv42,
25807
- check: () => check,
25808
- catch: () => _catch2,
25809
- boolean: () => boolean2,
25810
- bigint: () => bigint2,
25811
- base64url: () => base64url2,
25812
- base64: () => base642,
25813
- array: () => array,
25814
- any: () => any,
25815
- _function: () => _function,
25816
- _default: () => _default2,
25817
- _ZodString: () => _ZodString,
25818
- ZodXor: () => ZodXor,
25819
- ZodXID: () => ZodXID,
25820
- ZodVoid: () => ZodVoid,
25821
- ZodUnknown: () => ZodUnknown,
25822
- ZodUnion: () => ZodUnion,
25823
- ZodUndefined: () => ZodUndefined,
25824
- ZodUUID: () => ZodUUID,
25825
- ZodURL: () => ZodURL,
25826
- ZodULID: () => ZodULID,
25827
- ZodType: () => ZodType,
25828
- ZodTuple: () => ZodTuple,
25829
- ZodTransform: () => ZodTransform,
25830
- ZodTemplateLiteral: () => ZodTemplateLiteral,
25831
- ZodSymbol: () => ZodSymbol,
25832
- ZodSuccess: () => ZodSuccess,
25833
- ZodStringFormat: () => ZodStringFormat,
25834
- ZodString: () => ZodString,
25835
- ZodSet: () => ZodSet,
25836
- ZodRecord: () => ZodRecord,
25837
- ZodReadonly: () => ZodReadonly,
25838
- ZodPromise: () => ZodPromise,
25839
- ZodPreprocess: () => ZodPreprocess,
25840
- ZodPrefault: () => ZodPrefault,
25841
- ZodPipe: () => ZodPipe,
25842
- ZodOptional: () => ZodOptional,
25843
- ZodObject: () => ZodObject,
25844
- ZodNumberFormat: () => ZodNumberFormat,
25845
- ZodNumber: () => ZodNumber,
25846
- ZodNullable: () => ZodNullable,
25847
- ZodNull: () => ZodNull,
25848
- ZodNonOptional: () => ZodNonOptional,
25849
- ZodNever: () => ZodNever,
25850
- ZodNanoID: () => ZodNanoID,
25851
- ZodNaN: () => ZodNaN,
25852
- ZodMap: () => ZodMap,
25853
- ZodMAC: () => ZodMAC,
25854
- ZodLiteral: () => ZodLiteral,
25855
- ZodLazy: () => ZodLazy,
25856
- ZodKSUID: () => ZodKSUID,
25857
- ZodJWT: () => ZodJWT,
25858
- ZodIntersection: () => ZodIntersection,
25859
- ZodIPv6: () => ZodIPv6,
25860
- ZodIPv4: () => ZodIPv4,
25861
- ZodGUID: () => ZodGUID,
25862
- ZodFunction: () => ZodFunction,
25863
- ZodFile: () => ZodFile,
25864
- ZodExactOptional: () => ZodExactOptional,
25865
- ZodEnum: () => ZodEnum,
25866
- ZodEmoji: () => ZodEmoji,
25867
- ZodEmail: () => ZodEmail,
25868
- ZodE164: () => ZodE164,
25869
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
25870
- ZodDefault: () => ZodDefault,
25871
- ZodDate: () => ZodDate,
25872
- ZodCustomStringFormat: () => ZodCustomStringFormat,
25873
- ZodCustom: () => ZodCustom,
25874
- ZodCodec: () => ZodCodec,
25875
- ZodCatch: () => ZodCatch,
25876
- ZodCUID2: () => ZodCUID2,
25877
- ZodCUID: () => ZodCUID,
25878
- ZodCIDRv6: () => ZodCIDRv6,
25879
- ZodCIDRv4: () => ZodCIDRv4,
25880
- ZodBoolean: () => ZodBoolean,
25881
- ZodBigIntFormat: () => ZodBigIntFormat,
25882
- ZodBigInt: () => ZodBigInt,
25883
- ZodBase64URL: () => ZodBase64URL,
25884
- ZodBase64: () => ZodBase64,
25350
+ ZodAny: () => ZodAny,
25885
25351
  ZodArray: () => ZodArray,
25886
- ZodAny: () => ZodAny
25352
+ ZodBase64: () => ZodBase64,
25353
+ ZodBase64URL: () => ZodBase64URL,
25354
+ ZodBigInt: () => ZodBigInt,
25355
+ ZodBigIntFormat: () => ZodBigIntFormat,
25356
+ ZodBoolean: () => ZodBoolean,
25357
+ ZodCIDRv4: () => ZodCIDRv4,
25358
+ ZodCIDRv6: () => ZodCIDRv6,
25359
+ ZodCUID: () => ZodCUID,
25360
+ ZodCUID2: () => ZodCUID2,
25361
+ ZodCatch: () => ZodCatch,
25362
+ ZodCodec: () => ZodCodec,
25363
+ ZodCustom: () => ZodCustom,
25364
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
25365
+ ZodDate: () => ZodDate,
25366
+ ZodDefault: () => ZodDefault,
25367
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
25368
+ ZodE164: () => ZodE164,
25369
+ ZodEmail: () => ZodEmail,
25370
+ ZodEmoji: () => ZodEmoji,
25371
+ ZodEnum: () => ZodEnum,
25372
+ ZodExactOptional: () => ZodExactOptional,
25373
+ ZodFile: () => ZodFile,
25374
+ ZodFunction: () => ZodFunction,
25375
+ ZodGUID: () => ZodGUID,
25376
+ ZodIPv4: () => ZodIPv4,
25377
+ ZodIPv6: () => ZodIPv6,
25378
+ ZodIntersection: () => ZodIntersection,
25379
+ ZodJWT: () => ZodJWT,
25380
+ ZodKSUID: () => ZodKSUID,
25381
+ ZodLazy: () => ZodLazy,
25382
+ ZodLiteral: () => ZodLiteral,
25383
+ ZodMAC: () => ZodMAC,
25384
+ ZodMap: () => ZodMap,
25385
+ ZodNaN: () => ZodNaN,
25386
+ ZodNanoID: () => ZodNanoID,
25387
+ ZodNever: () => ZodNever,
25388
+ ZodNonOptional: () => ZodNonOptional,
25389
+ ZodNull: () => ZodNull,
25390
+ ZodNullable: () => ZodNullable,
25391
+ ZodNumber: () => ZodNumber,
25392
+ ZodNumberFormat: () => ZodNumberFormat,
25393
+ ZodObject: () => ZodObject,
25394
+ ZodOptional: () => ZodOptional,
25395
+ ZodPipe: () => ZodPipe,
25396
+ ZodPrefault: () => ZodPrefault,
25397
+ ZodPreprocess: () => ZodPreprocess,
25398
+ ZodPromise: () => ZodPromise,
25399
+ ZodReadonly: () => ZodReadonly,
25400
+ ZodRecord: () => ZodRecord,
25401
+ ZodSet: () => ZodSet,
25402
+ ZodString: () => ZodString,
25403
+ ZodStringFormat: () => ZodStringFormat,
25404
+ ZodSuccess: () => ZodSuccess,
25405
+ ZodSymbol: () => ZodSymbol,
25406
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
25407
+ ZodTransform: () => ZodTransform,
25408
+ ZodTuple: () => ZodTuple,
25409
+ ZodType: () => ZodType,
25410
+ ZodULID: () => ZodULID,
25411
+ ZodURL: () => ZodURL,
25412
+ ZodUUID: () => ZodUUID,
25413
+ ZodUndefined: () => ZodUndefined,
25414
+ ZodUnion: () => ZodUnion,
25415
+ ZodUnknown: () => ZodUnknown,
25416
+ ZodVoid: () => ZodVoid,
25417
+ ZodXID: () => ZodXID,
25418
+ ZodXor: () => ZodXor,
25419
+ _ZodString: () => _ZodString,
25420
+ _default: () => _default2,
25421
+ _function: () => _function,
25422
+ any: () => any,
25423
+ array: () => array,
25424
+ base64: () => base642,
25425
+ base64url: () => base64url2,
25426
+ bigint: () => bigint2,
25427
+ boolean: () => boolean2,
25428
+ catch: () => _catch2,
25429
+ check: () => check,
25430
+ cidrv4: () => cidrv42,
25431
+ cidrv6: () => cidrv62,
25432
+ codec: () => codec,
25433
+ cuid: () => cuid3,
25434
+ cuid2: () => cuid22,
25435
+ custom: () => custom,
25436
+ date: () => date3,
25437
+ describe: () => describe2,
25438
+ discriminatedUnion: () => discriminatedUnion,
25439
+ e164: () => e1642,
25440
+ email: () => email2,
25441
+ emoji: () => emoji2,
25442
+ enum: () => _enum2,
25443
+ exactOptional: () => exactOptional,
25444
+ file: () => file,
25445
+ float32: () => float32,
25446
+ float64: () => float64,
25447
+ function: () => _function,
25448
+ guid: () => guid2,
25449
+ hash: () => hash,
25450
+ hex: () => hex2,
25451
+ hostname: () => hostname2,
25452
+ httpUrl: () => httpUrl,
25453
+ instanceof: () => _instanceof,
25454
+ int: () => int,
25455
+ int32: () => int32,
25456
+ int64: () => int64,
25457
+ intersection: () => intersection,
25458
+ invertCodec: () => invertCodec,
25459
+ ipv4: () => ipv42,
25460
+ ipv6: () => ipv62,
25461
+ json: () => json,
25462
+ jwt: () => jwt,
25463
+ keyof: () => keyof,
25464
+ ksuid: () => ksuid2,
25465
+ lazy: () => lazy,
25466
+ literal: () => literal,
25467
+ looseObject: () => looseObject,
25468
+ looseRecord: () => looseRecord,
25469
+ mac: () => mac2,
25470
+ map: () => map,
25471
+ meta: () => meta2,
25472
+ nan: () => nan,
25473
+ nanoid: () => nanoid2,
25474
+ nativeEnum: () => nativeEnum,
25475
+ never: () => never,
25476
+ nonoptional: () => nonoptional,
25477
+ null: () => _null3,
25478
+ nullable: () => nullable,
25479
+ nullish: () => nullish2,
25480
+ number: () => number2,
25481
+ object: () => object,
25482
+ optional: () => optional,
25483
+ partialRecord: () => partialRecord,
25484
+ pipe: () => pipe,
25485
+ prefault: () => prefault,
25486
+ preprocess: () => preprocess,
25487
+ promise: () => promise,
25488
+ readonly: () => readonly,
25489
+ record: () => record,
25490
+ refine: () => refine,
25491
+ set: () => set,
25492
+ strictObject: () => strictObject,
25493
+ string: () => string2,
25494
+ stringFormat: () => stringFormat,
25495
+ stringbool: () => stringbool,
25496
+ success: () => success,
25497
+ superRefine: () => superRefine,
25498
+ symbol: () => symbol2,
25499
+ templateLiteral: () => templateLiteral,
25500
+ transform: () => transform,
25501
+ tuple: () => tuple,
25502
+ uint32: () => uint32,
25503
+ uint64: () => uint64,
25504
+ ulid: () => ulid2,
25505
+ undefined: () => _undefined3,
25506
+ union: () => union,
25507
+ unknown: () => unknown,
25508
+ url: () => url,
25509
+ uuid: () => uuid2,
25510
+ uuidv4: () => uuidv4,
25511
+ uuidv6: () => uuidv6,
25512
+ uuidv7: () => uuidv7,
25513
+ void: () => _void2,
25514
+ xid: () => xid2,
25515
+ xor: () => xor
25887
25516
  });
25888
25517
  function _installLazyMethods(inst, group, methods) {
25889
25518
  const proto = Object.getPrototypeOf(inst);
@@ -26847,9 +26476,9 @@ var init_schemas2 = __esm(() => {
26847
26476
  inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
26848
26477
  inst.min = (value, params) => inst.check(_gte(value, params));
26849
26478
  inst.max = (value, params) => inst.check(_lte(value, params));
26850
- const c3 = inst._zod.bag;
26851
- inst.minDate = c3.minimum ? new Date(c3.minimum) : null;
26852
- inst.maxDate = c3.maximum ? new Date(c3.maximum) : null;
26479
+ const c2 = inst._zod.bag;
26480
+ inst.minDate = c2.minimum ? new Date(c2.minimum) : null;
26481
+ inst.maxDate = c2.maximum ? new Date(c2.maximum) : null;
26853
26482
  });
26854
26483
  ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
26855
26484
  $ZodArray.init(inst, def);
@@ -27687,11 +27316,11 @@ var init_from_json_schema = __esm(() => {
27687
27316
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
27688
27317
  var exports_coerce = {};
27689
27318
  __export(exports_coerce, {
27690
- string: () => string3,
27691
- number: () => number3,
27692
- date: () => date4,
27319
+ bigint: () => bigint3,
27693
27320
  boolean: () => boolean3,
27694
- bigint: () => bigint3
27321
+ date: () => date4,
27322
+ number: () => number3,
27323
+ string: () => string3
27695
27324
  });
27696
27325
  function string3(params) {
27697
27326
  return _coercedString(ZodString, params);
@@ -27716,244 +27345,244 @@ var init_coerce = __esm(() => {
27716
27345
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
27717
27346
  var exports_external = {};
27718
27347
  __export(exports_external, {
27719
- xor: () => xor,
27720
- xid: () => xid2,
27721
- void: () => _void2,
27722
- uuidv7: () => uuidv7,
27723
- uuidv6: () => uuidv6,
27724
- uuidv4: () => uuidv4,
27725
- uuid: () => uuid2,
27726
- util: () => exports_util,
27727
- url: () => url,
27728
- uppercase: () => _uppercase,
27729
- unknown: () => unknown,
27730
- union: () => union,
27731
- undefined: () => _undefined3,
27732
- ulid: () => ulid2,
27733
- uint64: () => uint64,
27734
- uint32: () => uint32,
27735
- tuple: () => tuple,
27736
- trim: () => _trim,
27737
- treeifyError: () => treeifyError,
27738
- transform: () => transform,
27739
- toUpperCase: () => _toUpperCase,
27740
- toLowerCase: () => _toLowerCase,
27741
- toJSONSchema: () => toJSONSchema,
27742
- templateLiteral: () => templateLiteral,
27743
- symbol: () => symbol2,
27744
- superRefine: () => superRefine,
27745
- success: () => success,
27746
- stringbool: () => stringbool,
27747
- stringFormat: () => stringFormat,
27748
- string: () => string2,
27749
- strictObject: () => strictObject,
27750
- startsWith: () => _startsWith,
27751
- slugify: () => _slugify,
27752
- size: () => _size,
27753
- setErrorMap: () => setErrorMap,
27754
- set: () => set,
27755
- safeParseAsync: () => safeParseAsync2,
27756
- safeParse: () => safeParse2,
27757
- safeEncodeAsync: () => safeEncodeAsync2,
27758
- safeEncode: () => safeEncode2,
27759
- safeDecodeAsync: () => safeDecodeAsync2,
27760
- safeDecode: () => safeDecode2,
27761
- registry: () => registry,
27762
- regexes: () => exports_regexes,
27763
- regex: () => _regex,
27764
- refine: () => refine,
27765
- record: () => record,
27766
- readonly: () => readonly,
27767
- property: () => _property,
27768
- promise: () => promise,
27769
- prettifyError: () => prettifyError,
27770
- preprocess: () => preprocess,
27771
- prefault: () => prefault,
27772
- positive: () => _positive,
27773
- pipe: () => pipe,
27774
- partialRecord: () => partialRecord,
27775
- parseAsync: () => parseAsync2,
27776
- parse: () => parse3,
27777
- overwrite: () => _overwrite,
27778
- optional: () => optional,
27779
- object: () => object,
27780
- number: () => number2,
27781
- nullish: () => nullish2,
27782
- nullable: () => nullable,
27783
- null: () => _null3,
27784
- normalize: () => _normalize,
27785
- nonpositive: () => _nonpositive,
27786
- nonoptional: () => nonoptional,
27787
- nonnegative: () => _nonnegative,
27788
- never: () => never,
27789
- negative: () => _negative,
27790
- nativeEnum: () => nativeEnum,
27791
- nanoid: () => nanoid2,
27792
- nan: () => nan,
27793
- multipleOf: () => _multipleOf,
27794
- minSize: () => _minSize,
27795
- minLength: () => _minLength,
27796
- mime: () => _mime,
27797
- meta: () => meta2,
27798
- maxSize: () => _maxSize,
27799
- maxLength: () => _maxLength,
27800
- map: () => map,
27801
- mac: () => mac2,
27802
- lte: () => _lte,
27803
- lt: () => _lt,
27804
- lowercase: () => _lowercase,
27805
- looseRecord: () => looseRecord,
27806
- looseObject: () => looseObject,
27807
- locales: () => exports_locales,
27808
- literal: () => literal,
27809
- length: () => _length,
27810
- lazy: () => lazy,
27811
- ksuid: () => ksuid2,
27812
- keyof: () => keyof,
27813
- jwt: () => jwt,
27814
- json: () => json,
27815
- iso: () => exports_iso,
27816
- ipv6: () => ipv62,
27817
- ipv4: () => ipv42,
27818
- invertCodec: () => invertCodec,
27819
- intersection: () => intersection,
27820
- int64: () => int64,
27821
- int32: () => int32,
27822
- int: () => int,
27823
- instanceof: () => _instanceof,
27824
- includes: () => _includes,
27825
- httpUrl: () => httpUrl,
27826
- hostname: () => hostname2,
27827
- hex: () => hex2,
27828
- hash: () => hash,
27829
- guid: () => guid2,
27830
- gte: () => _gte,
27831
- gt: () => _gt,
27832
- globalRegistry: () => globalRegistry,
27833
- getErrorMap: () => getErrorMap,
27834
- function: () => _function,
27835
- fromJSONSchema: () => fromJSONSchema,
27836
- formatError: () => formatError,
27837
- float64: () => float64,
27838
- float32: () => float32,
27839
- flattenError: () => flattenError,
27840
- file: () => file,
27841
- exactOptional: () => exactOptional,
27842
- enum: () => _enum2,
27843
- endsWith: () => _endsWith,
27844
- encodeAsync: () => encodeAsync2,
27845
- encode: () => encode2,
27846
- emoji: () => emoji2,
27847
- email: () => email2,
27848
- e164: () => e1642,
27849
- discriminatedUnion: () => discriminatedUnion,
27850
- describe: () => describe2,
27851
- decodeAsync: () => decodeAsync2,
27852
- decode: () => decode2,
27853
- date: () => date3,
27854
- custom: () => custom,
27855
- cuid2: () => cuid22,
27856
- cuid: () => cuid3,
27857
- core: () => exports_core2,
27858
- config: () => config,
27859
- coerce: () => exports_coerce,
27860
- codec: () => codec,
27861
- clone: () => clone,
27862
- cidrv6: () => cidrv62,
27863
- cidrv4: () => cidrv42,
27864
- check: () => check,
27865
- catch: () => _catch2,
27866
- boolean: () => boolean2,
27867
- bigint: () => bigint2,
27868
- base64url: () => base64url2,
27869
- base64: () => base642,
27870
- array: () => array,
27871
- any: () => any,
27872
- _function: () => _function,
27873
- _default: () => _default2,
27874
- _ZodString: () => _ZodString,
27875
- ZodXor: () => ZodXor,
27876
- ZodXID: () => ZodXID,
27877
- ZodVoid: () => ZodVoid,
27878
- ZodUnknown: () => ZodUnknown,
27879
- ZodUnion: () => ZodUnion,
27880
- ZodUndefined: () => ZodUndefined,
27881
- ZodUUID: () => ZodUUID,
27882
- ZodURL: () => ZodURL,
27883
- ZodULID: () => ZodULID,
27884
- ZodType: () => ZodType,
27885
- ZodTuple: () => ZodTuple,
27886
- ZodTransform: () => ZodTransform,
27887
- ZodTemplateLiteral: () => ZodTemplateLiteral,
27888
- ZodSymbol: () => ZodSymbol,
27889
- ZodSuccess: () => ZodSuccess,
27890
- ZodStringFormat: () => ZodStringFormat,
27891
- ZodString: () => ZodString,
27892
- ZodSet: () => ZodSet,
27893
- ZodRecord: () => ZodRecord,
27894
- ZodRealError: () => ZodRealError,
27895
- ZodReadonly: () => ZodReadonly,
27896
- ZodPromise: () => ZodPromise,
27897
- ZodPreprocess: () => ZodPreprocess,
27898
- ZodPrefault: () => ZodPrefault,
27899
- ZodPipe: () => ZodPipe,
27900
- ZodOptional: () => ZodOptional,
27901
- ZodObject: () => ZodObject,
27902
- ZodNumberFormat: () => ZodNumberFormat,
27903
- ZodNumber: () => ZodNumber,
27904
- ZodNullable: () => ZodNullable,
27905
- ZodNull: () => ZodNull,
27906
- ZodNonOptional: () => ZodNonOptional,
27907
- ZodNever: () => ZodNever,
27908
- ZodNanoID: () => ZodNanoID,
27909
- ZodNaN: () => ZodNaN,
27910
- ZodMap: () => ZodMap,
27911
- ZodMAC: () => ZodMAC,
27912
- ZodLiteral: () => ZodLiteral,
27913
- ZodLazy: () => ZodLazy,
27914
- ZodKSUID: () => ZodKSUID,
27915
- ZodJWT: () => ZodJWT,
27916
- ZodIssueCode: () => ZodIssueCode,
27917
- ZodIntersection: () => ZodIntersection,
27918
- ZodISOTime: () => ZodISOTime,
27919
- ZodISODuration: () => ZodISODuration,
27920
- ZodISODateTime: () => ZodISODateTime,
27921
- ZodISODate: () => ZodISODate,
27922
- ZodIPv6: () => ZodIPv6,
27923
- ZodIPv4: () => ZodIPv4,
27924
- ZodGUID: () => ZodGUID,
27925
- ZodFunction: () => ZodFunction,
27926
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
27927
- ZodFile: () => ZodFile,
27928
- ZodExactOptional: () => ZodExactOptional,
27929
- ZodError: () => ZodError,
27930
- ZodEnum: () => ZodEnum,
27931
- ZodEmoji: () => ZodEmoji,
27932
- ZodEmail: () => ZodEmail,
27933
- ZodE164: () => ZodE164,
27934
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
27935
- ZodDefault: () => ZodDefault,
27936
- ZodDate: () => ZodDate,
27937
- ZodCustomStringFormat: () => ZodCustomStringFormat,
27938
- ZodCustom: () => ZodCustom,
27939
- ZodCodec: () => ZodCodec,
27940
- ZodCatch: () => ZodCatch,
27941
- ZodCUID2: () => ZodCUID2,
27942
- ZodCUID: () => ZodCUID,
27943
- ZodCIDRv6: () => ZodCIDRv6,
27944
- ZodCIDRv4: () => ZodCIDRv4,
27945
- ZodBoolean: () => ZodBoolean,
27946
- ZodBigIntFormat: () => ZodBigIntFormat,
27947
- ZodBigInt: () => ZodBigInt,
27948
- ZodBase64URL: () => ZodBase64URL,
27949
- ZodBase64: () => ZodBase64,
27950
- ZodArray: () => ZodArray,
27951
- ZodAny: () => ZodAny,
27952
- TimePrecision: () => TimePrecision,
27953
- NEVER: () => NEVER,
27954
- $output: () => $output,
27348
+ $brand: () => $brand,
27955
27349
  $input: () => $input,
27956
- $brand: () => $brand
27350
+ $output: () => $output,
27351
+ NEVER: () => NEVER,
27352
+ TimePrecision: () => TimePrecision,
27353
+ ZodAny: () => ZodAny,
27354
+ ZodArray: () => ZodArray,
27355
+ ZodBase64: () => ZodBase64,
27356
+ ZodBase64URL: () => ZodBase64URL,
27357
+ ZodBigInt: () => ZodBigInt,
27358
+ ZodBigIntFormat: () => ZodBigIntFormat,
27359
+ ZodBoolean: () => ZodBoolean,
27360
+ ZodCIDRv4: () => ZodCIDRv4,
27361
+ ZodCIDRv6: () => ZodCIDRv6,
27362
+ ZodCUID: () => ZodCUID,
27363
+ ZodCUID2: () => ZodCUID2,
27364
+ ZodCatch: () => ZodCatch,
27365
+ ZodCodec: () => ZodCodec,
27366
+ ZodCustom: () => ZodCustom,
27367
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
27368
+ ZodDate: () => ZodDate,
27369
+ ZodDefault: () => ZodDefault,
27370
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
27371
+ ZodE164: () => ZodE164,
27372
+ ZodEmail: () => ZodEmail,
27373
+ ZodEmoji: () => ZodEmoji,
27374
+ ZodEnum: () => ZodEnum,
27375
+ ZodError: () => ZodError,
27376
+ ZodExactOptional: () => ZodExactOptional,
27377
+ ZodFile: () => ZodFile,
27378
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
27379
+ ZodFunction: () => ZodFunction,
27380
+ ZodGUID: () => ZodGUID,
27381
+ ZodIPv4: () => ZodIPv4,
27382
+ ZodIPv6: () => ZodIPv6,
27383
+ ZodISODate: () => ZodISODate,
27384
+ ZodISODateTime: () => ZodISODateTime,
27385
+ ZodISODuration: () => ZodISODuration,
27386
+ ZodISOTime: () => ZodISOTime,
27387
+ ZodIntersection: () => ZodIntersection,
27388
+ ZodIssueCode: () => ZodIssueCode,
27389
+ ZodJWT: () => ZodJWT,
27390
+ ZodKSUID: () => ZodKSUID,
27391
+ ZodLazy: () => ZodLazy,
27392
+ ZodLiteral: () => ZodLiteral,
27393
+ ZodMAC: () => ZodMAC,
27394
+ ZodMap: () => ZodMap,
27395
+ ZodNaN: () => ZodNaN,
27396
+ ZodNanoID: () => ZodNanoID,
27397
+ ZodNever: () => ZodNever,
27398
+ ZodNonOptional: () => ZodNonOptional,
27399
+ ZodNull: () => ZodNull,
27400
+ ZodNullable: () => ZodNullable,
27401
+ ZodNumber: () => ZodNumber,
27402
+ ZodNumberFormat: () => ZodNumberFormat,
27403
+ ZodObject: () => ZodObject,
27404
+ ZodOptional: () => ZodOptional,
27405
+ ZodPipe: () => ZodPipe,
27406
+ ZodPrefault: () => ZodPrefault,
27407
+ ZodPreprocess: () => ZodPreprocess,
27408
+ ZodPromise: () => ZodPromise,
27409
+ ZodReadonly: () => ZodReadonly,
27410
+ ZodRealError: () => ZodRealError,
27411
+ ZodRecord: () => ZodRecord,
27412
+ ZodSet: () => ZodSet,
27413
+ ZodString: () => ZodString,
27414
+ ZodStringFormat: () => ZodStringFormat,
27415
+ ZodSuccess: () => ZodSuccess,
27416
+ ZodSymbol: () => ZodSymbol,
27417
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
27418
+ ZodTransform: () => ZodTransform,
27419
+ ZodTuple: () => ZodTuple,
27420
+ ZodType: () => ZodType,
27421
+ ZodULID: () => ZodULID,
27422
+ ZodURL: () => ZodURL,
27423
+ ZodUUID: () => ZodUUID,
27424
+ ZodUndefined: () => ZodUndefined,
27425
+ ZodUnion: () => ZodUnion,
27426
+ ZodUnknown: () => ZodUnknown,
27427
+ ZodVoid: () => ZodVoid,
27428
+ ZodXID: () => ZodXID,
27429
+ ZodXor: () => ZodXor,
27430
+ _ZodString: () => _ZodString,
27431
+ _default: () => _default2,
27432
+ _function: () => _function,
27433
+ any: () => any,
27434
+ array: () => array,
27435
+ base64: () => base642,
27436
+ base64url: () => base64url2,
27437
+ bigint: () => bigint2,
27438
+ boolean: () => boolean2,
27439
+ catch: () => _catch2,
27440
+ check: () => check,
27441
+ cidrv4: () => cidrv42,
27442
+ cidrv6: () => cidrv62,
27443
+ clone: () => clone,
27444
+ codec: () => codec,
27445
+ coerce: () => exports_coerce,
27446
+ config: () => config,
27447
+ core: () => exports_core2,
27448
+ cuid: () => cuid3,
27449
+ cuid2: () => cuid22,
27450
+ custom: () => custom,
27451
+ date: () => date3,
27452
+ decode: () => decode2,
27453
+ decodeAsync: () => decodeAsync2,
27454
+ describe: () => describe2,
27455
+ discriminatedUnion: () => discriminatedUnion,
27456
+ e164: () => e1642,
27457
+ email: () => email2,
27458
+ emoji: () => emoji2,
27459
+ encode: () => encode2,
27460
+ encodeAsync: () => encodeAsync2,
27461
+ endsWith: () => _endsWith,
27462
+ enum: () => _enum2,
27463
+ exactOptional: () => exactOptional,
27464
+ file: () => file,
27465
+ flattenError: () => flattenError,
27466
+ float32: () => float32,
27467
+ float64: () => float64,
27468
+ formatError: () => formatError,
27469
+ fromJSONSchema: () => fromJSONSchema,
27470
+ function: () => _function,
27471
+ getErrorMap: () => getErrorMap,
27472
+ globalRegistry: () => globalRegistry,
27473
+ gt: () => _gt,
27474
+ gte: () => _gte,
27475
+ guid: () => guid2,
27476
+ hash: () => hash,
27477
+ hex: () => hex2,
27478
+ hostname: () => hostname2,
27479
+ httpUrl: () => httpUrl,
27480
+ includes: () => _includes,
27481
+ instanceof: () => _instanceof,
27482
+ int: () => int,
27483
+ int32: () => int32,
27484
+ int64: () => int64,
27485
+ intersection: () => intersection,
27486
+ invertCodec: () => invertCodec,
27487
+ ipv4: () => ipv42,
27488
+ ipv6: () => ipv62,
27489
+ iso: () => exports_iso,
27490
+ json: () => json,
27491
+ jwt: () => jwt,
27492
+ keyof: () => keyof,
27493
+ ksuid: () => ksuid2,
27494
+ lazy: () => lazy,
27495
+ length: () => _length,
27496
+ literal: () => literal,
27497
+ locales: () => exports_locales,
27498
+ looseObject: () => looseObject,
27499
+ looseRecord: () => looseRecord,
27500
+ lowercase: () => _lowercase,
27501
+ lt: () => _lt,
27502
+ lte: () => _lte,
27503
+ mac: () => mac2,
27504
+ map: () => map,
27505
+ maxLength: () => _maxLength,
27506
+ maxSize: () => _maxSize,
27507
+ meta: () => meta2,
27508
+ mime: () => _mime,
27509
+ minLength: () => _minLength,
27510
+ minSize: () => _minSize,
27511
+ multipleOf: () => _multipleOf,
27512
+ nan: () => nan,
27513
+ nanoid: () => nanoid2,
27514
+ nativeEnum: () => nativeEnum,
27515
+ negative: () => _negative,
27516
+ never: () => never,
27517
+ nonnegative: () => _nonnegative,
27518
+ nonoptional: () => nonoptional,
27519
+ nonpositive: () => _nonpositive,
27520
+ normalize: () => _normalize,
27521
+ null: () => _null3,
27522
+ nullable: () => nullable,
27523
+ nullish: () => nullish2,
27524
+ number: () => number2,
27525
+ object: () => object,
27526
+ optional: () => optional,
27527
+ overwrite: () => _overwrite,
27528
+ parse: () => parse3,
27529
+ parseAsync: () => parseAsync2,
27530
+ partialRecord: () => partialRecord,
27531
+ pipe: () => pipe,
27532
+ positive: () => _positive,
27533
+ prefault: () => prefault,
27534
+ preprocess: () => preprocess,
27535
+ prettifyError: () => prettifyError,
27536
+ promise: () => promise,
27537
+ property: () => _property,
27538
+ readonly: () => readonly,
27539
+ record: () => record,
27540
+ refine: () => refine,
27541
+ regex: () => _regex,
27542
+ regexes: () => exports_regexes,
27543
+ registry: () => registry,
27544
+ safeDecode: () => safeDecode2,
27545
+ safeDecodeAsync: () => safeDecodeAsync2,
27546
+ safeEncode: () => safeEncode2,
27547
+ safeEncodeAsync: () => safeEncodeAsync2,
27548
+ safeParse: () => safeParse2,
27549
+ safeParseAsync: () => safeParseAsync2,
27550
+ set: () => set,
27551
+ setErrorMap: () => setErrorMap,
27552
+ size: () => _size,
27553
+ slugify: () => _slugify,
27554
+ startsWith: () => _startsWith,
27555
+ strictObject: () => strictObject,
27556
+ string: () => string2,
27557
+ stringFormat: () => stringFormat,
27558
+ stringbool: () => stringbool,
27559
+ success: () => success,
27560
+ superRefine: () => superRefine,
27561
+ symbol: () => symbol2,
27562
+ templateLiteral: () => templateLiteral,
27563
+ toJSONSchema: () => toJSONSchema,
27564
+ toLowerCase: () => _toLowerCase,
27565
+ toUpperCase: () => _toUpperCase,
27566
+ transform: () => transform,
27567
+ treeifyError: () => treeifyError,
27568
+ trim: () => _trim,
27569
+ tuple: () => tuple,
27570
+ uint32: () => uint32,
27571
+ uint64: () => uint64,
27572
+ ulid: () => ulid2,
27573
+ undefined: () => _undefined3,
27574
+ union: () => union,
27575
+ unknown: () => unknown,
27576
+ uppercase: () => _uppercase,
27577
+ url: () => url,
27578
+ util: () => exports_util,
27579
+ uuid: () => uuid2,
27580
+ uuidv4: () => uuidv4,
27581
+ uuidv6: () => uuidv6,
27582
+ uuidv7: () => uuidv7,
27583
+ void: () => _void2,
27584
+ xid: () => xid2,
27585
+ xor: () => xor
27957
27586
  });
27958
27587
  var init_external = __esm(() => {
27959
27588
  init_core2();
@@ -28085,7 +27714,7 @@ function expandConfigPath(value) {
28085
27714
  return `${homedir7()}/${trimmed.slice(2)}`;
28086
27715
  return trimmed;
28087
27716
  }
28088
- var DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE = 65, EXECUTE_THRESHOLD_CAP_MESSAGE = "execute_threshold is capped at 90% for cache safety: output capacity is reserved from the usable context window, and the remaining 10% absorbs mid-turn growth before the absolute 95% emergency wall. Use a value between 20 and 90.", DEFAULT_HISTORIAN_TIMEOUT_MS = 300000, DEFAULT_HISTORY_BUDGET_PERCENTAGE = 0.15, DEFAULT_LOCAL_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2", PiThinkingLevelSchema, PiConfigSchema, PromptSurfacePresetSchema, PromptSurfaceModelKeySchema, PromptSurfaceToolKeySchema, PromptSurfaceConfigSchema, CronScheduleSchema, DreamTaskBaseConfigSchema, PromotionThresholdSchema, PrimerPromotionThresholdSchema, DreamTaskConfigSchema, ReviewUserMemoriesTaskConfigSchema, PromotePrimersTaskConfigSchema, DEFAULT_TASK_SCHEDULES2, DreamTasksSchema, DreamerConfigSchema, SidekickConfigSchema, HistorianConfigSchema, EmbeddingFallbackProviderSchema, BaseEmbeddingConfigSchema, EmbeddingConfigSchema, MagicContextConfigSchema;
27717
+ var DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE = 65, EXECUTE_THRESHOLD_CAP_MESSAGE = "execute_threshold is capped at 90% for cache safety: output capacity is reserved from the usable context window, and the remaining 10% absorbs mid-turn growth before the absolute 95% emergency wall. Use a value between 20 and 90.", DEFAULT_HISTORIAN_TIMEOUT_MS = 600000, DEFAULT_HISTORY_BUDGET_PERCENTAGE = 0.15, DEFAULT_LOCAL_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2", PiThinkingLevelSchema, PiConfigSchema, PromptSurfacePresetSchema, PromptSurfaceModelKeySchema, PromptSurfaceToolKeySchema, PromptSurfaceConfigSchema, CronScheduleSchema, DreamTaskBaseConfigSchema, PromotionThresholdSchema, PrimerPromotionThresholdSchema, DreamTaskConfigSchema, ReviewUserMemoriesTaskConfigSchema, PromotePrimersTaskConfigSchema, DEFAULT_TASK_SCHEDULES2, DreamTasksSchema, DreamerConfigSchema, SidekickConfigSchema, HistorianConfigSchema, EmbeddingFallbackProviderSchema, BaseEmbeddingConfigSchema, EmbeddingConfigSchema, MagicContextConfigSchema;
28089
27718
  var init_magic_context = __esm(() => {
28090
27719
  init_zod();
28091
27720
  init_language_directive();
@@ -28281,7 +27910,7 @@ var init_magic_context = __esm(() => {
28281
27910
  smart_notes: exports_external.object({
28282
27911
  retina_handoff: exports_external.boolean().default(false).describe("When true, dreamer skips smart notes whose surface conditions compiled to retina provider configs at authoring time. Default false keeps both paths active until the retina consumer is deployed.")
28283
27912
  }).default({ retina_handoff: false }).describe("Smart-note ownership transition controls."),
28284
- cache_ttl: exports_external.union([exports_external.string(), exports_external.object({ default: exports_external.string() }).catchall(exports_external.string())]).default("5m").describe('Cache TTL: string (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "model-id": "10m" }). Set to "never" for lanes kept warm by an external keepwarm proxy — disables the idle-TTL heuristic so MC never initiates a rebuild based on elapsed time.'),
27913
+ cache_ttl: exports_external.union([exports_external.string(), exports_external.object({ default: exports_external.string() }).catchall(exports_external.string())]).default("5m").describe(`How long Magic Context assumes the provider's cached prefix stays valid. This is MC's own deferral gate — it does not change the provider's actual cache lifetime. String (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "model-id": "10m" }). Set to "never" to mean MC never assumes expiry (for lanes kept warm externally by a cache-keep tool) — disables the idle-TTL heuristic so MC never initiates a rebuild based on elapsed time. Provider-side extended TTL is a separate request-level concern (cache_control: { ttl } in the request body).`),
28285
27914
  prompt_surface: PromptSurfaceConfigSchema.default({ default: "full" }).describe("Prompt-surface presets: default is full; models use bare model IDs, provider/model, or provider/* routing keys. Guidance and tool-description overrides are user-level only. On OpenCode and Pi, per-model routing applies to the guidance block only: tool descriptions are registered once per process, so they follow the default preset (a v1 plugin-surface limitation; per-model tool descriptions are planned for the OpenCode v2 plugin API once the SDK stabilizes)."),
28286
27915
  output_reserve: exports_external.union([
28287
27916
  exports_external.number().min(0),
@@ -28301,7 +27930,7 @@ var init_magic_context = __esm(() => {
28301
27930
  protected_tags: exports_external.number().min(1).max(100).optional().describe("Number of recent tags to protect from dropping (min: 1, max: 100, default: 20)"),
28302
27931
  clear_reasoning_age: exports_external.number().min(10).default(50).describe("Clear reasoning/thinking blocks older than N tags (default: 50)"),
28303
27932
  history_budget_percentage: exports_external.number().min(0.05).max(0.5).default(DEFAULT_HISTORY_BUDGET_PERCENTAGE).describe("Fraction of usable context (context_limit × execute_threshold) reserved for the session history block (default: 0.15)"),
28304
- historian_timeout_ms: exports_external.number().min(60000).default(DEFAULT_HISTORIAN_TIMEOUT_MS).describe("Timeout for each historian prompt call in milliseconds (default: 300000)"),
27933
+ historian_timeout_ms: exports_external.number().min(60000).default(DEFAULT_HISTORIAN_TIMEOUT_MS).describe("Timeout for each historian prompt call in milliseconds (default: 600000)"),
28305
27934
  commit_cluster_trigger: exports_external.object({
28306
27935
  enabled: exports_external.boolean().default(true).describe("Enable commit-cluster based historian triggering (default: true)"),
28307
27936
  min_clusters: exports_external.number().min(1).default(3).describe("Minimum commit clusters required to trigger historian (min: 1, default: 3)")
@@ -28818,7 +28447,7 @@ function substituteConfigVariables(input) {
28818
28447
  return { text: text3, warnings };
28819
28448
  }
28820
28449
  text3 = stripJsonComments(text3);
28821
- text3 = text3.replace(ENV_PATTERN, (_2, rawName) => {
28450
+ text3 = text3.replace(ENV_PATTERN, (_, rawName) => {
28822
28451
  const varName = rawName.trim();
28823
28452
  const value = varName ? process.env[varName] : undefined;
28824
28453
  if (value === undefined || value === "") {
@@ -29019,7 +28648,7 @@ function parsePluginConfig(rawConfig, recoveredTopLevelKeys = []) {
29019
28648
  paths.push([...issue2.path]);
29020
28649
  issuePathsByKey.set(key, paths);
29021
28650
  const msg = issue2.message;
29022
- if (msg && !GENERIC_ZOD_PREFIXES.some((p2) => msg.startsWith(p2))) {
28651
+ if (msg && !GENERIC_ZOD_PREFIXES.some((p) => msg.startsWith(p))) {
29023
28652
  if (!customMessagesByKey.has(key)) {
29024
28653
  customMessagesByKey.set(key, msg);
29025
28654
  }
@@ -29037,14 +28666,14 @@ function parsePluginConfig(rawConfig, recoveredTopLevelKeys = []) {
29037
28666
  }
29038
28667
  const issuePaths = issuePathsByKey.get(key) ?? [];
29039
28668
  const rawValue = rawConfig[key];
29040
- const allNested = issuePaths.length > 0 && issuePaths.every((p2) => p2.length >= 2) && typeof rawValue === "object" && rawValue !== null && !Array.isArray(rawValue);
28669
+ const allNested = issuePaths.length > 0 && issuePaths.every((p) => p.length >= 2) && typeof rawValue === "object" && rawValue !== null && !Array.isArray(rawValue);
29041
28670
  if (allNested) {
29042
28671
  let prunedBlock = {
29043
28672
  ...rawValue
29044
28673
  };
29045
28674
  const prunedLeaves = [];
29046
- for (const p2 of issuePaths) {
29047
- const relative = p2.slice(1);
28675
+ for (const p of issuePaths) {
28676
+ const relative = p.slice(1);
29048
28677
  const result = pruneNestedConfigLeaf(prunedBlock, relative);
29049
28678
  if (result) {
29050
28679
  prunedBlock = result.block;
@@ -29326,18 +28955,18 @@ function readProjectCompaction(directory) {
29326
28955
  const dotOcJson = join11(directory, ".opencode", "opencode.json");
29327
28956
  const dotOcConfig = readJsoncFile(dotOcJsonc) ?? readJsoncFile(dotOcJson);
29328
28957
  if (dotOcConfig?.compaction) {
29329
- const c3 = dotOcConfig.compaction;
29330
- if (c3.auto !== undefined || c3.prune !== undefined) {
29331
- return { auto: c3.auto === true, prune: c3.prune === true, resolved: true };
28958
+ const c2 = dotOcConfig.compaction;
28959
+ if (c2.auto !== undefined || c2.prune !== undefined) {
28960
+ return { auto: c2.auto === true, prune: c2.prune === true, resolved: true };
29332
28961
  }
29333
28962
  }
29334
28963
  const rootJsonc = join11(directory, "opencode.jsonc");
29335
28964
  const rootJson = join11(directory, "opencode.json");
29336
28965
  const rootConfig = readJsoncFile(rootJsonc) ?? readJsoncFile(rootJson);
29337
28966
  if (rootConfig?.compaction) {
29338
- const c3 = rootConfig.compaction;
29339
- if (c3.auto !== undefined || c3.prune !== undefined) {
29340
- return { auto: c3.auto === true, prune: c3.prune === true, resolved: true };
28967
+ const c2 = rootConfig.compaction;
28968
+ if (c2.auto !== undefined || c2.prune !== undefined) {
28969
+ return { auto: c2.auto === true, prune: c2.prune === true, resolved: true };
29341
28970
  }
29342
28971
  }
29343
28972
  return { auto: false, prune: false, resolved: false };
@@ -29347,9 +28976,9 @@ function readUserCompaction() {
29347
28976
  const paths = getOpenCodeConfigPaths({ binary: "opencode" });
29348
28977
  const config2 = readJsoncFile(paths.configJsonc) ?? readJsoncFile(paths.configJson);
29349
28978
  if (config2?.compaction) {
29350
- const c3 = config2.compaction;
29351
- if (c3.auto !== undefined || c3.prune !== undefined) {
29352
- return { auto: c3.auto === true, prune: c3.prune === true, resolved: true };
28979
+ const c2 = config2.compaction;
28980
+ if (c2.auto !== undefined || c2.prune !== undefined) {
28981
+ return { auto: c2.auto === true, prune: c2.prune === true, resolved: true };
29353
28982
  }
29354
28983
  }
29355
28984
  } catch {}
@@ -29357,7 +28986,7 @@ function readUserCompaction() {
29357
28986
  }
29358
28987
  function checkDcpPlugin(directory) {
29359
28988
  const plugins = collectPluginEntries(directory);
29360
- return plugins.some((p2) => matchesPackageName(p2, DCP_PACKAGE_NAMES));
28989
+ return plugins.some((p) => matchesPackageName(p, DCP_PACKAGE_NAMES));
29361
28990
  }
29362
28991
  function matchesPackageName(entry, canonicalNames) {
29363
28992
  if (entry.startsWith("file:") || entry.startsWith("http:") || entry.startsWith("https:") || entry.startsWith("/") || entry.startsWith("./") || entry.startsWith("../")) {
@@ -29410,7 +29039,7 @@ function checkOmoHooks(directory) {
29410
29039
  anthropicRecovery: false
29411
29040
  };
29412
29041
  const plugins = collectPluginEntries(directory);
29413
- const hasOmo = plugins.some((p2) => matchesPackageName(p2, OMO_PACKAGE_NAMES));
29042
+ const hasOmo = plugins.some((p) => matchesPackageName(p, OMO_PACKAGE_NAMES));
29414
29043
  if (!hasOmo)
29415
29044
  return result;
29416
29045
  const disabledHooks = readOmoDisabledHooks(directory);
@@ -31609,10 +31238,10 @@ function computeProof(key, domain2, clientNonce, serverNonce, daemonId) {
31609
31238
  mac3.update(Buffer.from(daemonId));
31610
31239
  return new Uint8Array(mac3.digest());
31611
31240
  }
31612
- function constantTimeEq(a3, b2) {
31613
- if (a3.length !== b2.length)
31241
+ function constantTimeEq(a3, b) {
31242
+ if (a3.length !== b.length)
31614
31243
  return false;
31615
- return timingSafeEqual(Buffer.from(a3), Buffer.from(b2));
31244
+ return timingSafeEqual(Buffer.from(a3), Buffer.from(b));
31616
31245
  }
31617
31246
  async function writeMessage(sock, value, deadlineMs) {
31618
31247
  const json2 = Buffer.from(JSON.stringify(value), "utf8");
@@ -32918,776 +32547,6 @@ var init_client = __esm(() => {
32918
32547
  });
32919
32548
 
32920
32549
  // ../../node_modules/.bun/@cortexkit+subc-client@0.4.1/node_modules/@cortexkit/subc-client/dist/provider.js
32921
- import { Buffer as Buffer2 } from "node:buffer";
32922
-
32923
- class AsyncPermitPool {
32924
- available;
32925
- waiters = [];
32926
- constructor(capacity) {
32927
- if (!Number.isInteger(capacity) || capacity <= 0) {
32928
- throw new SubcProviderError("provider handler capacity must be a positive integer", "invalid_handler_capacity");
32929
- }
32930
- this.available = capacity;
32931
- }
32932
- async acquire() {
32933
- if (this.available > 0) {
32934
- this.available -= 1;
32935
- return this.releaseOnce();
32936
- }
32937
- await new Promise((resolve5) => {
32938
- this.waiters.push(resolve5);
32939
- });
32940
- return this.releaseOnce();
32941
- }
32942
- releaseOnce() {
32943
- let released = false;
32944
- return () => {
32945
- if (released)
32946
- return;
32947
- released = true;
32948
- const next = this.waiters.shift();
32949
- if (next) {
32950
- next();
32951
- } else {
32952
- this.available += 1;
32953
- }
32954
- };
32955
- }
32956
- }
32957
-
32958
- class SubcProvider {
32959
- sock;
32960
- currentConn;
32961
- opts;
32962
- closed;
32963
- resolveClosed = () => {
32964
- return;
32965
- };
32966
- closeStarted = false;
32967
- closedErr = null;
32968
- inflight = new Map;
32969
- pending = new Map;
32970
- liveRoutes = new Map;
32971
- connectionToken = newConnectionToken();
32972
- nextCorr = 1n;
32973
- ingressEpochDropCount = 0;
32974
- requestGate = new AsyncPermitPool(DEFAULT_PROVIDER_HANDLER_CAPACITY);
32975
- reconnecting = null;
32976
- generation = 1;
32977
- connectionEpoch = 1;
32978
- stateQueue = [];
32979
- drainingStateQueue = false;
32980
- restoredDebounceToken = 0;
32981
- storage;
32982
- constructor(sock, currentConn, opts, storage) {
32983
- this.sock = sock;
32984
- this.currentConn = currentConn;
32985
- this.opts = opts;
32986
- this.storage = storage;
32987
- this.closed = new Promise((resolve5) => {
32988
- this.resolveClosed = resolve5;
32989
- });
32990
- this.readLoop(sock, this.generation);
32991
- this.enqueueConnectionState({ state: "connected", epoch: this.connectionEpoch });
32992
- }
32993
- get droppedIngressFrames() {
32994
- return this.ingressEpochDropCount;
32995
- }
32996
- get conn() {
32997
- return this.currentConn;
32998
- }
32999
- currentEpoch() {
33000
- return this.connectionEpoch;
33001
- }
33002
- async request(handle, body, opts = {}) {
33003
- this.assertLiveHandle(handle);
33004
- const corr = this.allocateCorr();
33005
- const key = routeKey(handle, corr);
33006
- const timeoutMs = opts.timeoutMs ?? WRITE_TIMEOUT_MS;
33007
- const frame = buildFrame(FrameType.Request, buildFlags(false, opts.priority ?? Priority.Interactive, false, opts.admissionClass ?? AdmissionClass.Normal), handle.channel, handle.epoch, corr, body);
33008
- return await new Promise((resolve5, reject) => {
33009
- const timer = setTimeout(() => {
33010
- if (this.pending.delete(key))
33011
- reject(new SubcProviderError("reverse request timed out", "request_timeout"));
33012
- }, timeoutMs);
33013
- this.pending.set(key, {
33014
- resolve: (response) => resolve5(response.body),
33015
- reject,
33016
- timer
33017
- });
33018
- this.sendOn(this.sock, this.generation, frame).catch((error51) => {
33019
- const pending = this.pending.get(key);
33020
- if (!pending)
33021
- return;
33022
- this.pending.delete(key);
33023
- clearTimeout(pending.timer);
33024
- reject(error51 instanceof Error ? error51 : new SubcProviderError(String(error51)));
33025
- });
33026
- });
33027
- }
33028
- async push(handle, body, opts = {}) {
33029
- this.assertLiveHandle(handle);
33030
- await this.sendOn(this.sock, this.generation, buildFrame(FrameType.Push, buildFlags(false, opts.priority ?? Priority.Interactive, false, opts.admissionClass ?? AdmissionClass.Normal), handle.channel, handle.epoch, 0n, body));
33031
- }
33032
- cancel(handle, corr) {
33033
- this.assertLiveHandle(handle);
33034
- this.sendOn(this.sock, this.generation, buildFrame(FrameType.Cancel, controlFlags(), handle.channel, handle.epoch, corr, new Uint8Array(0)));
33035
- }
33036
- closeRoute(handle) {
33037
- this.assertLiveHandle(handle);
33038
- this.liveRoutes.delete(handle.channel);
33039
- this.abortHandle(handle);
33040
- this.sendOn(this.sock, this.generation, buildFrame(FrameType.Goodbye, controlFlags(), handle.channel, handle.epoch, 0n, new Uint8Array(0)));
33041
- }
33042
- static async connect(opts) {
33043
- if (opts.manifest.protocol_ver !== PROTOCOL_VERSION) {
33044
- throw new SubcProviderError(`manifest protocol_ver ${opts.manifest.protocol_ver} does not match client protocol ${PROTOCOL_VERSION}`, "invalid_manifest");
33045
- }
33046
- const normalized = normalizeProviderConnectOptions(opts);
33047
- const opened = await SubcProvider.openConnection(normalized);
33048
- return new SubcProvider(opened.sock, opened.conn, normalized, opened.ack.storage);
33049
- }
33050
- async close() {
33051
- if (!this.closeStarted) {
33052
- this.closeStarted = true;
33053
- this.cancelRestoredDebounce();
33054
- const sock = this.sock;
33055
- try {
33056
- await sendFrame(sock, buildFrame(FrameType.Goodbye, controlFlags(), 0, 0, 0n, new Uint8Array(0)));
33057
- } catch {} finally {
33058
- sock.close();
33059
- this.finishClosed();
33060
- }
33061
- }
33062
- await this.closed;
33063
- }
33064
- static async openConnection(opts) {
33065
- const conn = await readConnectionFile(opts.connectionFile);
33066
- const deadline = Date.now() + (opts.handshakeTimeoutMs ?? DEFAULT_HANDSHAKE_TIMEOUT_MS2);
33067
- const endpoint = conn.endpoints[0];
33068
- const sock = await SubcSocket.connect(endpoint.host, endpoint.port, deadline);
33069
- try {
33070
- await authenticateClient(sock, conn, deadline);
33071
- await sendFrame(sock, buildHelloFrame(opts));
33072
- const ack = await expectHelloAck(sock, deadline);
33073
- return { sock, conn, ack };
33074
- } catch (err) {
33075
- sock.close();
33076
- throw err;
33077
- }
33078
- }
33079
- async readLoop(sock, generation) {
33080
- try {
33081
- for (;; ) {
33082
- const frame = await sock.readFrame(Number.POSITIVE_INFINITY, { afterHeaderMs: BODY_READ_TIMEOUT_MS2 });
33083
- const keepGoing = await this.dispatch(frame, sock, generation);
33084
- if (!keepGoing) {
33085
- if (this.sock === sock && this.generation === generation)
33086
- this.closeStarted = true;
33087
- break;
33088
- }
33089
- }
33090
- } catch (error51) {
33091
- if (this.sock === sock && this.generation === generation && !this.closeStarted) {
33092
- this.handleUnexpectedDrop(sock, generation, error51 instanceof Error ? error51 : new SubcProviderError(String(error51)));
33093
- return;
33094
- }
33095
- } finally {
33096
- if (this.sock === sock && this.generation === generation) {
33097
- sock.close();
33098
- if (this.closeStarted)
33099
- this.finishClosed();
33100
- }
33101
- }
33102
- }
33103
- async dispatch(frame, sock, generation) {
33104
- let handle = null;
33105
- if (frame.header.channel !== 0) {
33106
- handle = this.liveRoutes.get(frame.header.channel) ?? null;
33107
- if (!handle || handle.epoch !== frame.header.epoch) {
33108
- this.ingressEpochDropCount += 1;
33109
- return true;
33110
- }
33111
- }
33112
- if (handle) {
33113
- const pendingKey2 = routeKey(handle, frame.header.corr);
33114
- const pending = this.pending.get(pendingKey2);
33115
- if (pending) {
33116
- if (frame.header.ty === FrameType.Push || frame.header.ty === FrameType.StreamData)
33117
- return true;
33118
- if (frame.header.ty === FrameType.Response || frame.header.ty === FrameType.StreamEnd) {
33119
- this.pending.delete(pendingKey2);
33120
- clearTimeout(pending.timer);
33121
- pending.resolve(frame);
33122
- return true;
33123
- }
33124
- if (frame.header.ty === FrameType.Error) {
33125
- this.pending.delete(pendingKey2);
33126
- clearTimeout(pending.timer);
33127
- pending.reject(providerErrorFromFrame(frame));
33128
- return true;
33129
- }
33130
- }
33131
- }
33132
- switch (frame.header.ty) {
33133
- case FrameType.Ping:
33134
- if (frame.header.channel === 0) {
33135
- await this.sendOn(sock, generation, buildFrameWithVersion(frame.header.ver, FrameType.Pong, frame.header.flags, 0, 0, frame.header.corr, new Uint8Array(0)));
33136
- }
33137
- return true;
33138
- case FrameType.Goodbye:
33139
- if (!handle)
33140
- return false;
33141
- this.liveRoutes.delete(handle.channel);
33142
- this.abortHandle(handle);
33143
- await this.opts.onRouteGone?.(handle);
33144
- return true;
33145
- case FrameType.Cancel:
33146
- if (handle)
33147
- this.inflight.get(routeKey(handle, frame.header.corr))?.abort();
33148
- return true;
33149
- case FrameType.Request:
33150
- if (frame.header.channel === 0) {
33151
- await this.handleControlRequest(frame, sock, generation);
33152
- } else if (handle) {
33153
- this.handleDataRequest(frame, handle, sock, generation).catch((error51) => {
33154
- if (!this.closeStarted && this.sock === sock && this.generation === generation) {
33155
- console.warn("SubcProvider handler failed after its request was dispatched", error51);
33156
- }
33157
- });
33158
- }
33159
- return true;
33160
- default:
33161
- return true;
33162
- }
33163
- }
33164
- abortHandle(handle) {
33165
- const prefix = `${handle.channel}:${handle.epoch}:`;
33166
- for (const [key, controller] of this.inflight) {
33167
- if (key.startsWith(prefix))
33168
- controller.abort();
33169
- }
33170
- for (const [key, pending] of this.pending) {
33171
- if (!key.startsWith(prefix))
33172
- continue;
33173
- this.pending.delete(key);
33174
- clearTimeout(pending.timer);
33175
- pending.reject(new StaleRouteHandleError(handle));
33176
- }
33177
- }
33178
- abortGeneration(_generation) {
33179
- this.abortAllInflight();
33180
- for (const [key, pending] of this.pending) {
33181
- this.pending.delete(key);
33182
- clearTimeout(pending.timer);
33183
- pending.reject(new SubcProviderError("provider connection dropped", "connection_dropped"));
33184
- }
33185
- this.liveRoutes.clear();
33186
- }
33187
- abortAllInflight() {
33188
- for (const controller of this.inflight.values())
33189
- controller.abort();
33190
- }
33191
- async handleControlRequest(frame, sock, generation) {
33192
- const request = parseJson(frame.body);
33193
- if (request.op === HEALTH_CHECK_OP) {
33194
- this.handleHealthRequest(frame, sock, generation).catch((error51) => {
33195
- if (!this.closeStarted && this.sock === sock && this.generation === generation) {
33196
- console.warn("SubcProvider health handler failed after its request was dispatched", error51);
33197
- }
33198
- });
33199
- return;
33200
- }
33201
- if (request.op !== "route.bind") {
33202
- throw new SubcProviderError(`unsupported module control request ${request.op ?? "<missing op>"}`);
33203
- }
33204
- const tentative = createRouteHandle(numberField(request.route_channel, "route_channel"), numberField(request.epoch, "epoch"), this.connectionToken);
33205
- const bindRequest = {
33206
- handle: tentative,
33207
- target: request.target,
33208
- identity: request.identity,
33209
- principal: request.principal,
33210
- consumer_capabilities: request.consumer_capabilities
33211
- };
33212
- let decision;
33213
- try {
33214
- decision = await this.opts.onBind?.(bindRequest);
33215
- } catch (error51) {
33216
- try {
33217
- await this.sendError(frame, "route_rejected", error51 instanceof Error ? error51.message : String(error51), controlFlags(), sock, generation);
33218
- } finally {
33219
- await this.opts.onRouteGone?.(tentative);
33220
- }
33221
- return;
33222
- }
33223
- const rejection = bindRejection(decision);
33224
- if (rejection) {
33225
- try {
33226
- await this.sendError(frame, rejection.code, rejection.message, controlFlags(), sock, generation);
33227
- } finally {
33228
- await this.opts.onRouteGone?.(tentative);
33229
- }
33230
- return;
33231
- }
33232
- try {
33233
- await this.sendOn(sock, generation, buildFrameWithVersion(frame.header.ver, FrameType.Response, controlFlags(), 0, 0, frame.header.corr, encodeJson({ op: "route.bind" })));
33234
- } catch (error51) {
33235
- await this.opts.onRouteGone?.(tentative);
33236
- throw error51;
33237
- }
33238
- if (this.sock !== sock || this.generation !== generation || this.closeStarted || this.closedErr) {
33239
- await this.opts.onRouteGone?.(tentative);
33240
- return;
33241
- }
33242
- this.liveRoutes.set(tentative.channel, tentative);
33243
- await this.opts.onBound?.(tentative);
33244
- }
33245
- async handleDataRequest(frame, handle, sock, generation) {
33246
- const { corr, ver } = frame.header;
33247
- const key = routeKey(handle, corr);
33248
- const controller = new AbortController;
33249
- this.inflight.set(key, controller);
33250
- const context = {
33251
- handle,
33252
- signal: controller.signal,
33253
- currentEpoch: () => this.connectionEpoch,
33254
- emit: async (eventBody, options = {}) => {
33255
- this.assertLiveHandle(handle);
33256
- if (controller.signal.aborted)
33257
- return;
33258
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.StreamData, buildFlags(false, options.priority ?? Priority.Interactive, false, options.admissionClass ?? AdmissionClass.Normal), handle.channel, handle.epoch, corr, eventBody));
33259
- }
33260
- };
33261
- const releasePermit = await (this.requestGate ?? new AsyncPermitPool(DEFAULT_PROVIDER_HANDLER_CAPACITY)).acquire();
33262
- const dataFlags = buildFlags(false, Priority.Interactive, false);
33263
- try {
33264
- const body = await this.opts.handler(handle, frame.body, context);
33265
- if (controller.signal.aborted)
33266
- return;
33267
- this.assertLiveHandle(handle);
33268
- if (body === undefined) {
33269
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.StreamEnd, dataFlags, handle.channel, handle.epoch, corr, new Uint8Array(0)));
33270
- } else if (body instanceof Uint8Array) {
33271
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.Response, dataFlags, handle.channel, handle.epoch, corr, body));
33272
- } else {
33273
- throw new SubcProviderError("provider handler must return a Uint8Array or void", "invalid_handler_response");
33274
- }
33275
- } catch (error51) {
33276
- if (error51 instanceof StaleRouteHandleError || controller.signal.aborted)
33277
- return;
33278
- await this.sendError(frame, error51 instanceof SubcProviderError && error51.code ? error51.code : "handler_error", error51 instanceof Error ? error51.message : String(error51), dataFlags, sock, generation);
33279
- } finally {
33280
- releasePermit();
33281
- if (this.inflight.get(key) === controller)
33282
- this.inflight.delete(key);
33283
- }
33284
- }
33285
- async handleHealthRequest(frame, sock, generation) {
33286
- const { corr, ver } = frame.header;
33287
- const key = `control:${generation}:${corr}`;
33288
- const controller = new AbortController;
33289
- this.inflight.set(key, controller);
33290
- const releasePermit = await (this.requestGate ?? new AsyncPermitPool(DEFAULT_PROVIDER_HANDLER_CAPACITY)).acquire();
33291
- try {
33292
- if (controller.signal.aborted)
33293
- return;
33294
- const report = await this.opts.health();
33295
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.Response, controlFlags(), 0, 0, corr, encodeJson({
33296
- op: HEALTH_CHECK_OP,
33297
- status: report.status,
33298
- ...report.detail === undefined ? {} : { detail: report.detail },
33299
- ...report.metrics === undefined ? {} : { metrics: report.metrics }
33300
- })));
33301
- } catch (error51) {
33302
- await this.sendError(frame, error51 instanceof SubcProviderError && error51.code ? error51.code : "health_error", error51 instanceof Error ? error51.message : String(error51), controlFlags(), sock, generation);
33303
- } finally {
33304
- releasePermit();
33305
- if (this.inflight.get(key) === controller)
33306
- this.inflight.delete(key);
33307
- }
33308
- }
33309
- async sendError(frame, code, message, flags, sock, generation) {
33310
- await this.sendOn(sock, generation, buildFrameWithVersion(frame.header.ver, FrameType.Error, flags, frame.header.channel, frame.header.epoch, frame.header.corr, encodeJson({ code, message })));
33311
- }
33312
- async sendOn(sock, generation, frame) {
33313
- if (this.sock !== sock || this.generation !== generation || this.closeStarted || this.closedErr)
33314
- return;
33315
- await sendFrame(sock, frame);
33316
- }
33317
- handleUnexpectedDrop(sock, generation, cause) {
33318
- this.cancelRestoredDebounce();
33319
- this.abortGeneration(generation);
33320
- this.generation += 1;
33321
- sock.close();
33322
- this.enqueueConnectionState({ state: "down", cause });
33323
- this.scheduleReconnectAfterDrop(cause);
33324
- }
33325
- scheduleReconnectAfterDrop(trigger) {
33326
- if (this.closeStarted || this.reconnecting)
33327
- return;
33328
- const promise2 = this.reconnectWithRetry(trigger).catch((err) => {
33329
- if (!this.closeStarted)
33330
- this.failFatal(err instanceof Error ? err : new SubcProviderError(String(err)));
33331
- }).finally(() => {
33332
- if (this.reconnecting === promise2)
33333
- this.reconnecting = null;
33334
- });
33335
- this.reconnecting = promise2;
33336
- }
33337
- async reconnectWithRetry(_trigger) {
33338
- let attempt = 0;
33339
- let delay = this.opts.reconnectBackoff.baseMs;
33340
- for (;; ) {
33341
- if (this.closeStarted)
33342
- throw new SubcProviderError("provider closed");
33343
- attempt += 1;
33344
- this.enqueueConnectionState({ state: "reconnecting", attempt });
33345
- try {
33346
- const opened = await SubcProvider.openConnection(this.opts);
33347
- if (this.closeStarted) {
33348
- opened.sock.close();
33349
- throw new SubcProviderError("provider closed");
33350
- }
33351
- this.replaceConnection(opened);
33352
- return;
33353
- } catch (err) {
33354
- if (this.closeStarted)
33355
- throw err;
33356
- if (!isProviderReconnectTransient(err))
33357
- throw err;
33358
- await this.opts.sleep(delay);
33359
- delay = Math.min(delay * 2, this.opts.reconnectBackoff.capMs);
33360
- }
33361
- }
33362
- }
33363
- replaceConnection(opened) {
33364
- this.sock.close();
33365
- this.sock = opened.sock;
33366
- this.currentConn = opened.conn;
33367
- this.storage = opened.ack.storage;
33368
- this.closedErr = null;
33369
- this.connectionEpoch += 1;
33370
- this.connectionToken = newConnectionToken();
33371
- this.liveRoutes.clear();
33372
- this.nextCorr = 1n;
33373
- const generation = this.generation;
33374
- this.readLoop(opened.sock, generation);
33375
- this.scheduleRestored(generation, this.connectionEpoch);
33376
- }
33377
- scheduleRestored(generation, epoch) {
33378
- if (!this.opts.onConnectionState)
33379
- return;
33380
- const token = ++this.restoredDebounceToken;
33381
- this.opts.sleep(this.opts.restoredDebounceMs).then(() => {
33382
- if (token === this.restoredDebounceToken && !this.closeStarted && this.sock && this.generation === generation && this.connectionEpoch === epoch) {
33383
- this.enqueueConnectionState({ state: "restored", epoch });
33384
- }
33385
- }).catch((err) => {
33386
- if (token === this.restoredDebounceToken && !this.closeStarted) {
33387
- console.warn("SubcProvider restored debounce timer failed", err);
33388
- }
33389
- });
33390
- }
33391
- cancelRestoredDebounce() {
33392
- this.restoredDebounceToken += 1;
33393
- }
33394
- enqueueConnectionState(event) {
33395
- if (!this.opts.onConnectionState)
33396
- return;
33397
- this.stateQueue.push(event);
33398
- if (!this.drainingStateQueue)
33399
- this.drainConnectionStateQueue();
33400
- }
33401
- async drainConnectionStateQueue() {
33402
- if (this.drainingStateQueue)
33403
- return;
33404
- this.drainingStateQueue = true;
33405
- try {
33406
- while (this.stateQueue.length > 0) {
33407
- const event = this.stateQueue[0];
33408
- try {
33409
- await this.opts.onConnectionState?.(event);
33410
- this.stateQueue.shift();
33411
- } catch (err) {
33412
- if (event.state === "restored") {
33413
- console.warn("SubcProvider restored callback failed; retrying delivery", err);
33414
- await pauseBeforeStateRetry();
33415
- continue;
33416
- }
33417
- console.warn("SubcProvider connection-state callback failed", err);
33418
- this.stateQueue.shift();
33419
- }
33420
- }
33421
- } finally {
33422
- this.drainingStateQueue = false;
33423
- if (this.stateQueue.length > 0)
33424
- this.drainConnectionStateQueue();
33425
- }
33426
- }
33427
- isLiveHandle(handle) {
33428
- return belongsToConnection(handle, this.connectionToken) && this.liveRoutes.get(handle.channel) === handle;
33429
- }
33430
- assertLiveHandle(handle) {
33431
- if (!this.isLiveHandle(handle))
33432
- throw new StaleRouteHandleError(handle);
33433
- }
33434
- allocateCorr() {
33435
- const maximum = 0xffffffffffffffffn;
33436
- if (this.nextCorr > maximum) {
33437
- const error51 = new SubcProviderError("channel-0 correlation id allocator exhausted", "corr_exhausted");
33438
- this.handleUnexpectedDrop(this.sock, this.generation, error51);
33439
- throw error51;
33440
- }
33441
- const corr = this.nextCorr;
33442
- this.nextCorr += 1n;
33443
- return corr;
33444
- }
33445
- failFatal(err) {
33446
- if (!this.closedErr)
33447
- this.closedErr = err;
33448
- this.closeStarted = true;
33449
- this.cancelRestoredDebounce();
33450
- this.abortAllInflight();
33451
- this.sock.close();
33452
- this.finishClosed();
33453
- }
33454
- finishClosed() {
33455
- this.resolveClosed();
33456
- }
33457
- }
33458
- function routeKey(handle, corr) {
33459
- return `${handle.channel}:${handle.epoch}:${corr}`;
33460
- }
33461
- function providerErrorFromFrame(frame) {
33462
- try {
33463
- const body = parseJson(frame.body);
33464
- return new SubcProviderError(body.message ?? "subc error", body.code);
33465
- } catch {
33466
- return new SubcProviderError(Buffer2.from(frame.body).toString("utf8") || "subc error");
33467
- }
33468
- }
33469
- function launchNonce(opts) {
33470
- const nonce = opts.launchNonce ?? process.env[SUBC_LAUNCH_NONCE_ENV2];
33471
- return nonce && nonce.length > 0 ? nonce : undefined;
33472
- }
33473
- function normalizeProviderConnectOptions(opts) {
33474
- return {
33475
- connectionFile: opts.connectionFile,
33476
- manifest: opts.manifest,
33477
- handler: opts.handler,
33478
- health: opts.health ?? (() => ({ status: "ok" })),
33479
- handshakeTimeoutMs: opts.handshakeTimeoutMs,
33480
- controlOps: opts.controlOps,
33481
- onBind: opts.onBind,
33482
- onBound: opts.onBound,
33483
- onRouteGone: opts.onRouteGone,
33484
- reconnectBackoff: opts.reconnectBackoff ?? DEFAULT_RECONNECT_BACKOFF,
33485
- sleep: opts.sleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms))),
33486
- restoredDebounceMs: opts.restoredDebounceMs ?? DEFAULT_RESTORED_DEBOUNCE_MS,
33487
- onConnectionState: opts.onConnectionState,
33488
- launchNonce: opts.launchNonce
33489
- };
33490
- }
33491
- function normalizedControlOps(controlOps) {
33492
- if (controlOps === null)
33493
- return null;
33494
- const merged = new Set(controlOps ?? []);
33495
- merged.add(HEALTH_CHECK_OP);
33496
- return [...merged];
33497
- }
33498
- function buildHelloFrame(opts) {
33499
- const nonce = launchNonce(opts);
33500
- return buildFrame(FrameType.Hello, controlFlags(), 0, 0, HELLO_CORR, encodeJson({
33501
- manifest: normalizeManifest(opts.manifest),
33502
- protocol_ver: PROTOCOL_VERSION,
33503
- control_ops: normalizedControlOps(opts.controlOps),
33504
- ...nonce ? { launch_nonce: nonce } : {}
33505
- }));
33506
- }
33507
- function isProviderReconnectTransient(err) {
33508
- if (err instanceof SubcProviderError)
33509
- return err.code === "duplicate_module_id";
33510
- if (err instanceof SocketClosedError || err instanceof SocketTimeoutError)
33511
- return true;
33512
- if (err instanceof SocketWriteNotQueuedError || err instanceof SocketWriteQueuedError)
33513
- return true;
33514
- if (err instanceof AuthError)
33515
- return true;
33516
- if (err instanceof ConnectionFileError)
33517
- return false;
33518
- const code = errorCode2(err);
33519
- return code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPIPE" || code === "ETIMEDOUT" || code === "ENOENT";
33520
- }
33521
- function errorCode2(err) {
33522
- if (typeof err === "object" && err !== null && "code" in err) {
33523
- const code = err.code;
33524
- if (typeof code === "string")
33525
- return code;
33526
- }
33527
- return;
33528
- }
33529
- async function pauseBeforeStateRetry() {
33530
- await new Promise((resolve5) => setTimeout(resolve5, 0));
33531
- }
33532
- function controlFlags() {
33533
- return buildFlags(false, Priority.Passive, false);
33534
- }
33535
- async function sendFrame(sock, frame) {
33536
- await sock.write(encodeFrame(frame), Date.now() + WRITE_TIMEOUT_MS);
33537
- }
33538
- async function expectHelloAck(sock, deadline) {
33539
- const frame = await sock.readFrame(deadline, deadline);
33540
- switch (frame.header.ty) {
33541
- case FrameType.HelloAck: {
33542
- const ack = parseJson(frame.body);
33543
- if (ack.negotiated_ver !== PROTOCOL_VERSION) {
33544
- throw new SubcProviderError(`subc negotiated protocol ${ack.negotiated_ver}; expected exactly ${PROTOCOL_VERSION}`, "unsupported_version");
33545
- }
33546
- return ack;
33547
- }
33548
- case FrameType.Error: {
33549
- const error51 = parseJson(frame.body);
33550
- throw new SubcProviderError(`subc rejected HELLO: ${error51.code ?? "unknown"} — ${error51.message ?? "subc error"}`, error51.code);
33551
- }
33552
- default:
33553
- throw new SubcProviderError(`unexpected frame ${FrameType[frame.header.ty]} awaiting HELLO_ACK`);
33554
- }
33555
- }
33556
- function encodeJson(value) {
33557
- return new Uint8Array(Buffer2.from(JSON.stringify(value), "utf8"));
33558
- }
33559
- function parseJson(bytes) {
33560
- return JSON.parse(Buffer2.from(bytes).toString("utf8"));
33561
- }
33562
- function numberField(value, field) {
33563
- if (typeof value !== "number" || !Number.isInteger(value)) {
33564
- throw new SubcProviderError(`route.bind ${field} must be an integer`);
33565
- }
33566
- return value;
33567
- }
33568
- function bindRejection(decision) {
33569
- if (decision === undefined || decision === true)
33570
- return null;
33571
- if (decision === false) {
33572
- return { code: "route_rejected", message: "route.bind rejected by provider" };
33573
- }
33574
- if (decision.accept)
33575
- return null;
33576
- return {
33577
- code: decision.code ?? "route_rejected",
33578
- message: decision.message ?? "route.bind rejected by provider"
33579
- };
33580
- }
33581
- function normalizeManifest(manifest) {
33582
- return {
33583
- module_id: manifest.module_id,
33584
- module_version: manifest.module_version,
33585
- protocol_ver: manifest.protocol_ver,
33586
- trust_tier: manifest.trust_tier,
33587
- provides: manifest.provides.map(normalizeProviderRole),
33588
- consumes: manifest.consumes.map(normalizeConsumerRole),
33589
- scheduled_tasks: manifest.scheduled_tasks.map(normalizeScheduledTask),
33590
- bindings: {
33591
- storage: {
33592
- kind: manifest.bindings.storage.kind,
33593
- scope: manifest.bindings.storage.scope,
33594
- owns_schema: manifest.bindings.storage.owns_schema
33595
- },
33596
- vault_grants: manifest.bindings.vault_grants.map((grant) => ({
33597
- secret: grant.secret,
33598
- reason: grant.reason
33599
- })),
33600
- identity: {
33601
- requires: [...manifest.bindings.identity.requires],
33602
- optional: [...manifest.bindings.identity.optional]
33603
- }
33604
- }
33605
- };
33606
- }
33607
- function normalizeProviderRole(role) {
33608
- switch (role.role) {
33609
- case "tool_provider":
33610
- return {
33611
- role: "tool_provider",
33612
- tools: role.tools.map((tool) => ({
33613
- name: tool.name,
33614
- ...tool.description === undefined ? {} : { description: tool.description },
33615
- execution_mode: tool.execution_mode,
33616
- schema: tool.schema
33617
- })),
33618
- identity_scope: [...role.identity_scope],
33619
- concurrency: role.concurrency,
33620
- emits_push: role.emits_push,
33621
- sub_supervises: role.sub_supervises
33622
- };
33623
- case "pipeline_stage":
33624
- return {
33625
- role: "pipeline_stage",
33626
- stage: role.stage,
33627
- applies_to: {
33628
- provider: role.applies_to.provider,
33629
- model: role.applies_to.model
33630
- },
33631
- interface: role.interface,
33632
- declares_frozen_floor: role.declares_frozen_floor,
33633
- needs_signals: [...role.needs_signals],
33634
- conformance_class: role.conformance_class
33635
- };
33636
- case "management_surface":
33637
- return {
33638
- role: "management_surface",
33639
- operations: role.operations.map((operation) => ({
33640
- name: operation.name,
33641
- kind: operation.kind
33642
- })),
33643
- config_schema: role.config_schema,
33644
- observability: role.observability.map((surface) => ({
33645
- name: surface.name,
33646
- kind: surface.kind
33647
- })),
33648
- identity_scope: [...role.identity_scope]
33649
- };
33650
- case "internal_service":
33651
- return {
33652
- role: "internal_service",
33653
- service_id: role.service_id,
33654
- transport: role.transport,
33655
- agent_facing: role.agent_facing,
33656
- operations: [...role.operations]
33657
- };
33658
- }
33659
- }
33660
- function normalizeConsumerRole(role) {
33661
- switch (role.role) {
33662
- case "tool_client":
33663
- return { role: "tool_client", of: [...role.of] };
33664
- case "llm_client":
33665
- return { role: "llm_client", via: role.via, auth: role.auth };
33666
- case "service_client":
33667
- return { role: "service_client", of: [...role.of] };
33668
- }
33669
- }
33670
- function normalizeScheduledTask(task) {
33671
- return {
33672
- task_id: task.task_id,
33673
- eligibility: {
33674
- cooldown: task.eligibility.cooldown,
33675
- window: task.eligibility.window
33676
- },
33677
- lease_scope: task.lease_scope,
33678
- renews_during_calls: task.renews_during_calls,
33679
- toolset: [...task.toolset],
33680
- model_policy: {
33681
- tier: task.model_policy.tier,
33682
- fallback_chain: [...task.model_policy.fallback_chain]
33683
- },
33684
- step_cap: task.step_cap,
33685
- circuit_breaker: {
33686
- identical_failures: task.circuit_breaker.identical_failures
33687
- }
33688
- };
33689
- }
33690
- var DEFAULT_HANDSHAKE_TIMEOUT_MS2 = 1e4, BODY_READ_TIMEOUT_MS2 = 30000, WRITE_TIMEOUT_MS = 30000, DEFAULT_RESTORED_DEBOUNCE_MS = 250, DEFAULT_PROVIDER_HANDLER_CAPACITY = 64, HEALTH_CHECK_OP = "health.check", HELLO_CORR = 1n, SubcProviderError, SUBC_LAUNCH_NONCE_ENV2 = "SUBC_LAUNCH_NONCE";
33691
32550
  var init_provider = __esm(() => {
33692
32551
  init_auth();
33693
32552
  init_client();
@@ -33695,13 +32554,6 @@ var init_provider = __esm(() => {
33695
32554
  init_envelope();
33696
32555
  init_route_handle();
33697
32556
  init_socket();
33698
- SubcProviderError = class SubcProviderError extends Error {
33699
- code;
33700
- constructor(message, code) {
33701
- super(message);
33702
- this.code = code;
33703
- }
33704
- };
33705
32557
  });
33706
32558
 
33707
32559
  // ../../node_modules/.bun/@cortexkit+subc-client@0.4.1/node_modules/@cortexkit/subc-client/dist/index.js
@@ -34117,16 +32969,16 @@ class SubcModuleTransport {
34117
32969
  }
34118
32970
  async ensureRoute(sessionId, rawProjectRoot, deadlineMs = Date.now() + this.requestTimeoutMs) {
34119
32971
  const projectRoot = this.canonicalRoot(rawProjectRoot);
34120
- const routeKey2 = `${sessionId}\x00${projectRoot}`;
32972
+ const routeKey = `${sessionId}\x00${projectRoot}`;
34121
32973
  const client = await this.ensureConnected();
34122
32974
  const generation = this.connectionGeneration;
34123
- const existing = this.routes.get(routeKey2);
32975
+ const existing = this.routes.get(routeKey);
34124
32976
  if (existing?.generation === generation) {
34125
- return { client, route: existing.route, routeKey: routeKey2, generation };
32977
+ return { client, route: existing.route, routeKey, generation };
34126
32978
  }
34127
32979
  if (existing)
34128
- this.routes.delete(routeKey2);
34129
- const opening = this.routeOpenings.get(routeKey2);
32980
+ this.routes.delete(routeKey);
32981
+ const opening = this.routeOpenings.get(routeKey);
34130
32982
  if (opening?.client === client && opening.generation === generation) {
34131
32983
  return await opening.promise;
34132
32984
  }
@@ -34144,24 +32996,24 @@ class SubcModuleTransport {
34144
32996
  });
34145
32997
  throw this.connectionChangedError("subc connection changed while opening module route");
34146
32998
  }
34147
- this.routes.set(routeKey2, { route, generation });
34148
- return { client, route, routeKey: routeKey2, generation };
32999
+ this.routes.set(routeKey, { route, generation });
33000
+ return { client, route, routeKey, generation };
34149
33001
  })();
34150
33002
  const routeOpening = { client, generation, promise: promise2 };
34151
- this.routeOpenings.set(routeKey2, routeOpening);
33003
+ this.routeOpenings.set(routeKey, routeOpening);
34152
33004
  try {
34153
33005
  return await promise2;
34154
33006
  } finally {
34155
- if (this.routeOpenings.get(routeKey2) === routeOpening) {
34156
- this.routeOpenings.delete(routeKey2);
33007
+ if (this.routeOpenings.get(routeKey) === routeOpening) {
33008
+ this.routeOpenings.delete(routeKey);
34157
33009
  }
34158
33010
  }
34159
33011
  }
34160
- dropRoute(routeKey2, route) {
34161
- const existing = this.routes.get(routeKey2);
33012
+ dropRoute(routeKey, route) {
33013
+ const existing = this.routes.get(routeKey);
34162
33014
  if (!existing || route && existing.route !== route)
34163
33015
  return;
34164
- this.routes.delete(routeKey2);
33016
+ this.routes.delete(routeKey);
34165
33017
  }
34166
33018
  canonicalRoot(root) {
34167
33019
  const cached2 = this.canonicalRootCache.get(root);
@@ -34672,7 +33524,7 @@ function parseCompartmentOutput(text3) {
34672
33524
  }
34673
33525
  }
34674
33526
  const events = parseEvents(text3);
34675
- compartments.sort((a3, b2) => a3.startMessage - b2.startMessage);
33527
+ compartments.sort((a3, b) => a3.startMessage - b.startMessage);
34676
33528
  return { compartments, facts, events, unprocessedFrom, userObservations, primerCandidates };
34677
33529
  }
34678
33530
  function parseEvents(text3) {
@@ -35323,7 +34175,7 @@ var init_migrations = __esm(() => {
35323
34175
  description: "Add harness column to notes table for cross-harness sharing",
35324
34176
  up: (db) => {
35325
34177
  const cols = db.prepare("PRAGMA table_info(notes)").all();
35326
- if (!cols.some((c3) => c3.name === "harness")) {
34178
+ if (!cols.some((c2) => c2.name === "harness")) {
35327
34179
  db.exec("ALTER TABLE notes ADD COLUMN harness TEXT NOT NULL DEFAULT 'opencode'");
35328
34180
  }
35329
34181
  }
@@ -35366,7 +34218,7 @@ var init_migrations = __esm(() => {
35366
34218
  description: "Add tool_owner_message_id column to tags + composite identity indexes",
35367
34219
  up: (db) => {
35368
34220
  const cols = db.prepare("PRAGMA table_info(tags)").all();
35369
- if (!cols.some((c3) => c3.name === "tool_owner_message_id")) {
34221
+ if (!cols.some((c2) => c2.name === "tool_owner_message_id")) {
35370
34222
  db.exec("ALTER TABLE tags ADD COLUMN tool_owner_message_id TEXT DEFAULT NULL");
35371
34223
  }
35372
34224
  db.exec(`
@@ -35385,16 +34237,16 @@ var init_migrations = __esm(() => {
35385
34237
  description: "Add todo state synthesis columns to session_meta",
35386
34238
  up: (db) => {
35387
34239
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35388
- if (!cols.some((c3) => c3.name === "last_todo_state")) {
34240
+ if (!cols.some((c2) => c2.name === "last_todo_state")) {
35389
34241
  db.exec("ALTER TABLE session_meta ADD COLUMN last_todo_state TEXT DEFAULT ''");
35390
34242
  }
35391
- if (!cols.some((c3) => c3.name === "todo_synthetic_call_id")) {
34243
+ if (!cols.some((c2) => c2.name === "todo_synthetic_call_id")) {
35392
34244
  db.exec("ALTER TABLE session_meta ADD COLUMN todo_synthetic_call_id TEXT DEFAULT ''");
35393
34245
  }
35394
- if (!cols.some((c3) => c3.name === "todo_synthetic_anchor_message_id")) {
34246
+ if (!cols.some((c2) => c2.name === "todo_synthetic_anchor_message_id")) {
35395
34247
  db.exec("ALTER TABLE session_meta ADD COLUMN todo_synthetic_anchor_message_id TEXT DEFAULT ''");
35396
34248
  }
35397
- if (!cols.some((c3) => c3.name === "todo_synthetic_state_json")) {
34249
+ if (!cols.some((c2) => c2.name === "todo_synthetic_state_json")) {
35398
34250
  db.exec("ALTER TABLE session_meta ADD COLUMN todo_synthetic_state_json TEXT DEFAULT ''");
35399
34251
  }
35400
34252
  }
@@ -35417,7 +34269,7 @@ var init_migrations = __esm(() => {
35417
34269
  description: "Add pending_compaction_marker_state column for deferred marker drain",
35418
34270
  up: (db) => {
35419
34271
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35420
- if (!cols.some((c3) => c3.name === "pending_compaction_marker_state")) {
34272
+ if (!cols.some((c2) => c2.name === "pending_compaction_marker_state")) {
35421
34273
  db.exec("ALTER TABLE session_meta ADD COLUMN pending_compaction_marker_state TEXT");
35422
34274
  }
35423
34275
  }
@@ -35457,7 +34309,7 @@ var init_migrations = __esm(() => {
35457
34309
  description: "Add deferred_execute_state column for boundary execution drain",
35458
34310
  up: (db) => {
35459
34311
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35460
- if (!cols.some((c3) => c3.name === "deferred_execute_state")) {
34312
+ if (!cols.some((c2) => c2.name === "deferred_execute_state")) {
35461
34313
  db.exec("ALTER TABLE session_meta ADD COLUMN deferred_execute_state TEXT");
35462
34314
  }
35463
34315
  }
@@ -35467,10 +34319,10 @@ var init_migrations = __esm(() => {
35467
34319
  description: "Add context-limit cache regression sentinels",
35468
34320
  up: (db) => {
35469
34321
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35470
- if (!cols.some((c3) => c3.name === "observed_safe_input_tokens")) {
34322
+ if (!cols.some((c2) => c2.name === "observed_safe_input_tokens")) {
35471
34323
  db.exec("ALTER TABLE session_meta ADD COLUMN observed_safe_input_tokens INTEGER NOT NULL DEFAULT 0");
35472
34324
  }
35473
- if (!cols.some((c3) => c3.name === "cache_alert_sent")) {
34325
+ if (!cols.some((c2) => c2.name === "cache_alert_sent")) {
35474
34326
  db.exec("ALTER TABLE session_meta ADD COLUMN cache_alert_sent INTEGER NOT NULL DEFAULT 0");
35475
34327
  }
35476
34328
  }
@@ -35480,10 +34332,10 @@ var init_migrations = __esm(() => {
35480
34332
  description: "Multi-anchor JSON storage for note-nudge and auto-search-hint persistence",
35481
34333
  up: (db) => {
35482
34334
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35483
- if (!cols.some((c3) => c3.name === "note_nudge_anchors")) {
34335
+ if (!cols.some((c2) => c2.name === "note_nudge_anchors")) {
35484
34336
  db.exec("ALTER TABLE session_meta ADD COLUMN note_nudge_anchors TEXT NOT NULL DEFAULT '[]'");
35485
34337
  }
35486
- if (!cols.some((c3) => c3.name === "auto_search_hint_decisions")) {
34338
+ if (!cols.some((c2) => c2.name === "auto_search_hint_decisions")) {
35487
34339
  db.exec("ALTER TABLE session_meta ADD COLUMN auto_search_hint_decisions TEXT NOT NULL DEFAULT '[]'");
35488
34340
  }
35489
34341
  db.exec(`
@@ -35513,7 +34365,7 @@ var init_migrations = __esm(() => {
35513
34365
  description: "Add pending_pi_compaction_marker_state column for Pi deferred marker drain",
35514
34366
  up: (db) => {
35515
34367
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35516
- if (!cols.some((c3) => c3.name === "pending_pi_compaction_marker_state")) {
34368
+ if (!cols.some((c2) => c2.name === "pending_pi_compaction_marker_state")) {
35517
34369
  db.exec("ALTER TABLE session_meta ADD COLUMN pending_pi_compaction_marker_state TEXT");
35518
34370
  }
35519
34371
  }
@@ -35569,10 +34421,10 @@ var init_migrations = __esm(() => {
35569
34421
  description: "Add session lifetime work metrics",
35570
34422
  up: (db) => {
35571
34423
  const cols = db.prepare("PRAGMA table_info(session_meta)").all();
35572
- if (!cols.some((c3) => c3.name === "new_work_tokens")) {
34424
+ if (!cols.some((c2) => c2.name === "new_work_tokens")) {
35573
34425
  db.exec("ALTER TABLE session_meta ADD COLUMN new_work_tokens INTEGER NOT NULL DEFAULT 0");
35574
34426
  }
35575
- if (!cols.some((c3) => c3.name === "total_input_tokens")) {
34427
+ if (!cols.some((c2) => c2.name === "total_input_tokens")) {
35576
34428
  db.exec("ALTER TABLE session_meta ADD COLUMN total_input_tokens INTEGER NOT NULL DEFAULT 0");
35577
34429
  }
35578
34430
  }
@@ -37094,6 +35946,18 @@ var init_migrations = __esm(() => {
37094
35946
  );
37095
35947
  `);
37096
35948
  }
35949
+ },
35950
+ {
35951
+ version: 79,
35952
+ description: "record m[0] system-hash and model-key comparison telemetry",
35953
+ up(db) {
35954
+ if (!tableExists(db, "transform_decisions"))
35955
+ return;
35956
+ ensureColumn(db, "transform_decisions", "system_hash_prev", "TEXT");
35957
+ ensureColumn(db, "transform_decisions", "system_hash_new", "TEXT");
35958
+ ensureColumn(db, "transform_decisions", "m0_model_key_prev", "TEXT");
35959
+ ensureColumn(db, "transform_decisions", "m0_model_key_new", "TEXT");
35960
+ }
37097
35961
  }
37098
35962
  ];
37099
35963
  LATEST_MIGRATION_VERSION = MIGRATIONS.reduce((max, m3) => Math.max(max, m3.version), 0);
@@ -37290,7 +36154,7 @@ function inspectRpcServerDiscovery(storageDir) {
37290
36154
  return unreadableDiscovery(staleFile, "io");
37291
36155
  }
37292
36156
  }
37293
- const serverPids = [...pids].sort((a3, b2) => a3 - b2);
36157
+ const serverPids = [...pids].sort((a3, b) => a3 - b);
37294
36158
  if (serverPids.length > 0) {
37295
36159
  return {
37296
36160
  state: "live",
@@ -37299,7 +36163,7 @@ function inspectRpcServerDiscovery(storageDir) {
37299
36163
  staleFiles
37300
36164
  };
37301
36165
  }
37302
- const uncertainPids = [...inconclusivePids].sort((a3, b2) => a3 - b2);
36166
+ const uncertainPids = [...inconclusivePids].sort((a3, b) => a3 - b);
37303
36167
  if (uncertainPids.length > 0) {
37304
36168
  return {
37305
36169
  state: "inconclusive",
@@ -38067,6 +36931,10 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
38067
36931
  decision TEXT NOT NULL,
38068
36932
  materialized INTEGER NOT NULL DEFAULT 0,
38069
36933
  materialize_reason TEXT,
36934
+ system_hash_prev TEXT,
36935
+ system_hash_new TEXT,
36936
+ m0_model_key_prev TEXT,
36937
+ m0_model_key_new TEXT,
38070
36938
  emergency INTEGER NOT NULL DEFAULT 0,
38071
36939
  dropped_tokens INTEGER NOT NULL DEFAULT 0,
38072
36940
  dropped_count INTEGER NOT NULL DEFAULT 0,
@@ -38404,6 +37272,10 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
38404
37272
  decision TEXT NOT NULL,
38405
37273
  materialized INTEGER NOT NULL DEFAULT 0,
38406
37274
  materialize_reason TEXT,
37275
+ system_hash_prev TEXT,
37276
+ system_hash_new TEXT,
37277
+ m0_model_key_prev TEXT,
37278
+ m0_model_key_new TEXT,
38407
37279
  emergency INTEGER NOT NULL DEFAULT 0,
38408
37280
  dropped_tokens INTEGER NOT NULL DEFAULT 0,
38409
37281
  dropped_count INTEGER NOT NULL DEFAULT 0,
@@ -38413,6 +37285,10 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
38413
37285
  CREATE INDEX IF NOT EXISTS idx_transform_decisions_session_harness
38414
37286
  ON transform_decisions(session_id, harness);
38415
37287
  `);
37288
+ ensureColumn(db, "transform_decisions", "system_hash_prev", "TEXT");
37289
+ ensureColumn(db, "transform_decisions", "system_hash_new", "TEXT");
37290
+ ensureColumn(db, "transform_decisions", "m0_model_key_prev", "TEXT");
37291
+ ensureColumn(db, "transform_decisions", "m0_model_key_new", "TEXT");
38416
37292
  ensureColumn(db, "tags", "harness", "TEXT NOT NULL DEFAULT 'opencode'");
38417
37293
  ensureColumn(db, "message_history_index", "dirty_floor_ordinal", "INTEGER NOT NULL DEFAULT 0");
38418
37294
  ensureColumn(db, "pending_ops", "harness", "TEXT NOT NULL DEFAULT 'opencode'");
@@ -38426,7 +37302,7 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
38426
37302
  ensureColumn(db, "message_history_index", "harness", "TEXT NOT NULL DEFAULT 'opencode'");
38427
37303
  ensureColumn(db, "workspaces", "share_categories", `TEXT NOT NULL DEFAULT '["CONSTRAINTS"]'`);
38428
37304
  }
38429
- var databases, pendingAsyncOpens, persistenceByDatabase, persistenceErrorByDatabase, pathByDatabase, LATEST_SUPPORTED_VERSION = 78, PERMISSIONS_ENFORCEABLE, RPC_DISCOVERY_PARSE_GRACE_MS, defaultRpcDiscoveryFs, rpcDiscoveryFs, sqlitePragmaConfig, CHANNEL2_CLAIM_TTL_MS;
37305
+ var databases, pendingAsyncOpens, persistenceByDatabase, persistenceErrorByDatabase, pathByDatabase, LATEST_SUPPORTED_VERSION = 79, PERMISSIONS_ENFORCEABLE, RPC_DISCOVERY_PARSE_GRACE_MS, defaultRpcDiscoveryFs, rpcDiscoveryFs, sqlitePragmaConfig, CHANNEL2_CLAIM_TTL_MS;
38430
37306
  var init_storage_db = __esm(async () => {
38431
37307
  init_data_path();
38432
37308
  init_logger();
@@ -38561,10 +37437,10 @@ var init_database_access = __esm(async () => {
38561
37437
  // src/commands/doctor-authority.ts
38562
37438
  var exports_doctor_authority = {};
38563
37439
  __export(exports_doctor_authority, {
38564
- runDoctorDrainAuthority: () => runDoctorDrainAuthority,
38565
- reportAuthorityMarkers: () => reportAuthorityMarkers,
37440
+ assertProjectsUseTsAuthority: () => assertProjectsUseTsAuthority,
38566
37441
  authorityDrainCommand: () => authorityDrainCommand,
38567
- assertProjectsUseTsAuthority: () => assertProjectsUseTsAuthority
37442
+ reportAuthorityMarkers: () => reportAuthorityMarkers,
37443
+ runDoctorDrainAuthority: () => runDoctorDrainAuthority
38568
37444
  });
38569
37445
  function authorityDrainCommand(project) {
38570
37446
  return `magic-context doctor drain-authority ${project.projectRoot ?? `<${project.role} project root>`}`;
@@ -38741,7 +37617,7 @@ function discoverIdentityTables(db) {
38741
37617
  }
38742
37618
  function primaryKeyColumns(db, tableName) {
38743
37619
  const columns = db.prepare(`PRAGMA table_info(${quoteIdentifier(tableName)})`).all();
38744
- return columns.filter((column) => typeof column.name === "string" && typeof column.pk === "number" && column.pk > 0).sort((a3, b2) => Number(a3.pk) - Number(b2.pk)).map((column) => column.name);
37620
+ return columns.filter((column) => typeof column.name === "string" && typeof column.pk === "number" && column.pk > 0).sort((a3, b) => Number(a3.pk) - Number(b.pk)).map((column) => column.name);
38745
37621
  }
38746
37622
  function rowKey(db, tableName, row) {
38747
37623
  const keys = primaryKeyColumns(db, tableName);
@@ -38768,7 +37644,7 @@ function uniqueIndexes(db, tableName) {
38768
37644
  if (index.unique !== 1 || typeof index.name !== "string")
38769
37645
  continue;
38770
37646
  const columns = db.prepare(`PRAGMA index_info(${quoteIdentifier(index.name)})`).all();
38771
- result.push(columns.sort((a3, b2) => Number(a3.seqno) - Number(b2.seqno)).map((column) => column.name).filter((name) => typeof name === "string"));
37647
+ result.push(columns.sort((a3, b) => Number(a3.seqno) - Number(b.seqno)).map((column) => column.name).filter((name) => typeof name === "string"));
38772
37648
  }
38773
37649
  return result;
38774
37650
  }
@@ -38986,8 +37862,8 @@ var init_storage_identity_merge = __esm(() => {
38986
37862
  // src/commands/doctor-merge-identity.ts
38987
37863
  var exports_doctor_merge_identity = {};
38988
37864
  __export(exports_doctor_merge_identity, {
38989
- runMergeIdentityCli: () => runMergeIdentityCli,
38990
- parseMergeIdentityArgs: () => parseMergeIdentityArgs
37865
+ parseMergeIdentityArgs: () => parseMergeIdentityArgs,
37866
+ runMergeIdentityCli: () => runMergeIdentityCli
38991
37867
  });
38992
37868
  import { join as join15 } from "node:path";
38993
37869
  function valueAfter(args, flag) {
@@ -39072,10 +37948,10 @@ var init_doctor_merge_identity = __esm(async () => {
39072
37948
  // src/commands/doctor-repair-db.ts
39073
37949
  var exports_doctor_repair_db = {};
39074
37950
  __export(exports_doctor_repair_db, {
39075
- runRepairDbCli: () => runRepairDbCli,
39076
- runRepairDb: () => runRepairDb,
37951
+ REPAIR_DB_EXIT: () => REPAIR_DB_EXIT,
39077
37952
  defaultSqliteExecutable: () => defaultSqliteExecutable,
39078
- REPAIR_DB_EXIT: () => REPAIR_DB_EXIT
37953
+ runRepairDb: () => runRepairDb,
37954
+ runRepairDbCli: () => runRepairDbCli
39079
37955
  });
39080
37956
  import { spawnSync as spawnSync3 } from "node:child_process";
39081
37957
  import {
@@ -39597,16 +38473,16 @@ var init_migration_paths = () => {};
39597
38473
  // src/commands/migrate.ts
39598
38474
  var exports_migrate = {};
39599
38475
  __export(exports_migrate, {
39600
- sweepPendingMigrations: () => sweepPendingMigrations,
39601
- runMigrateCli: () => runMigrateCli,
39602
- projectPathToPiDirSlug: () => projectPathToPiDirSlug,
39603
- printMigrateHelp: () => printMigrateHelp,
39604
- parseMigrateArgs: () => parseMigrateArgs,
39605
- migrationKeyFor: () => migrationKeyFor,
39606
- migrateOpenCodeSessionToPi: () => migrateOpenCodeSessionToPi,
39607
- generateUuidV7: () => generateUuidV7,
38476
+ formatMigrationSweepLines: () => formatMigrationSweepLines,
39608
38477
  formatPiFilenameTimestamp: () => formatPiFilenameTimestamp,
39609
- formatMigrationSweepLines: () => formatMigrationSweepLines
38478
+ generateUuidV7: () => generateUuidV7,
38479
+ migrateOpenCodeSessionToPi: () => migrateOpenCodeSessionToPi,
38480
+ migrationKeyFor: () => migrationKeyFor,
38481
+ parseMigrateArgs: () => parseMigrateArgs,
38482
+ printMigrateHelp: () => printMigrateHelp,
38483
+ projectPathToPiDirSlug: () => projectPathToPiDirSlug,
38484
+ runMigrateCli: () => runMigrateCli,
38485
+ sweepPendingMigrations: () => sweepPendingMigrations
39610
38486
  });
39611
38487
  import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
39612
38488
  import { existsSync as existsSync21, mkdirSync as mkdirSync8, renameSync as renameSync4, unlinkSync as unlinkSync3 } from "node:fs";
@@ -40050,28 +38926,28 @@ function copyMagicContextState(args) {
40050
38926
  ORDER BY category ASC, id ASC`).all(args.sourceSessionId);
40051
38927
  let boundariesApproximated = 0;
40052
38928
  const remappedCompartments = [];
40053
- for (const c3 of sourceCompartments) {
40054
- const startRemap = remapBoundaryId(c3.start_message_id, "start", args.messageIdToFirstPiEntryId, args.messageIdToLastPiEntryId, args.orderedSourceMessageIds);
40055
- const endRemap = remapBoundaryId(c3.end_message_id, "end", args.messageIdToFirstPiEntryId, args.messageIdToLastPiEntryId, args.orderedSourceMessageIds);
38929
+ for (const c2 of sourceCompartments) {
38930
+ const startRemap = remapBoundaryId(c2.start_message_id, "start", args.messageIdToFirstPiEntryId, args.messageIdToLastPiEntryId, args.orderedSourceMessageIds);
38931
+ const endRemap = remapBoundaryId(c2.end_message_id, "end", args.messageIdToFirstPiEntryId, args.messageIdToLastPiEntryId, args.orderedSourceMessageIds);
40056
38932
  if (!startRemap || !endRemap)
40057
38933
  continue;
40058
38934
  if (!startRemap.exact || !endRemap.exact)
40059
38935
  boundariesApproximated++;
40060
38936
  remappedCompartments.push({
40061
- sequence: c3.sequence,
40062
- start_message: c3.start_message,
40063
- end_message: c3.end_message,
38937
+ sequence: c2.sequence,
38938
+ start_message: c2.start_message,
38939
+ end_message: c2.end_message,
40064
38940
  start_message_id: startRemap.piEntryId,
40065
38941
  end_message_id: endRemap.piEntryId,
40066
- title: c3.title,
40067
- content: c3.content,
40068
- p1: c3.p1,
40069
- p2: c3.p2,
40070
- p3: c3.p3,
40071
- p4: c3.p4,
40072
- importance: c3.importance,
40073
- episode_type: c3.episode_type,
40074
- legacy: c3.legacy
38942
+ title: c2.title,
38943
+ content: c2.content,
38944
+ p1: c2.p1,
38945
+ p2: c2.p2,
38946
+ p3: c2.p3,
38947
+ p4: c2.p4,
38948
+ importance: c2.importance,
38949
+ episode_type: c2.episode_type,
38950
+ legacy: c2.legacy
40075
38951
  });
40076
38952
  }
40077
38953
  const result = {
@@ -40097,11 +38973,11 @@ function copyMagicContextState(args) {
40097
38973
  try {
40098
38974
  stmt(args.cortexkitDb, "DELETE FROM compartments WHERE session_id = ? AND harness = 'pi'").run(args.piSessionId);
40099
38975
  stmt(args.cortexkitDb, "DELETE FROM session_facts WHERE session_id = ? AND harness = 'pi'").run(args.piSessionId);
40100
- for (const c3 of remappedCompartments) {
40101
- insertCompartment.run(args.piSessionId, c3.sequence, c3.start_message, c3.end_message, c3.start_message_id, c3.end_message_id, c3.title, c3.content, c3.p1, c3.p2, c3.p3, c3.p4, typeof c3.importance === "number" ? c3.importance : 50, c3.episode_type, c3.legacy, args.now);
38976
+ for (const c2 of remappedCompartments) {
38977
+ insertCompartment.run(args.piSessionId, c2.sequence, c2.start_message, c2.end_message, c2.start_message_id, c2.end_message_id, c2.title, c2.content, c2.p1, c2.p2, c2.p3, c2.p4, typeof c2.importance === "number" ? c2.importance : 50, c2.episode_type, c2.legacy, args.now);
40102
38978
  }
40103
- for (const f2 of sourceFacts) {
40104
- insertFact.run(args.piSessionId, f2.category, f2.content, f2.created_at, f2.updated_at);
38979
+ for (const f of sourceFacts) {
38980
+ insertFact.run(args.piSessionId, f.category, f.content, f.created_at, f.updated_at);
40105
38981
  }
40106
38982
  if (journalKey !== undefined) {
40107
38983
  stmt(args.cortexkitDb, "UPDATE migration_pending SET phase = 'db_committed' WHERE migration_key = ?").run(journalKey);
@@ -40519,13 +39395,13 @@ function getMemoryCopyColumns(db) {
40519
39395
  if (cached2)
40520
39396
  return cached2;
40521
39397
  const columns = db.prepare("PRAGMA table_info(memories)").all();
40522
- const names = columns.map((c3) => c3.name).filter((n2) => typeof n2 === "string" && n2 !== "id");
39398
+ const names = columns.map((c2) => c2.name).filter((n2) => typeof n2 === "string" && n2 !== "id");
40523
39399
  memoryCopyColumnsCache.set(db, names);
40524
39400
  return names;
40525
39401
  }
40526
39402
  function copyMemoriesToProject(db, ids, toIdentity) {
40527
39403
  const columns = getMemoryCopyColumns(db);
40528
- const selectExprs = columns.map((c3) => c3 === "project_path" ? "? AS project_path" : c3);
39404
+ const selectExprs = columns.map((c2) => c2 === "project_path" ? "? AS project_path" : c2);
40529
39405
  const insertSql = `INSERT OR IGNORE INTO memories (${columns.join(", ")})
40530
39406
  SELECT ${selectExprs.join(", ")} FROM memories WHERE id = ?`;
40531
39407
  const insertStmt = db.prepare(insertSql);
@@ -40553,10 +39429,10 @@ var init_relocate_memory = __esm(() => {
40553
39429
  // src/commands/migrate-session.ts
40554
39430
  var exports_migrate_session = {};
40555
39431
  __export(exports_migrate_session, {
40556
- runMigrateSessionCli: () => runMigrateSessionCli,
40557
- planMigrateSession: () => planMigrateSession,
39432
+ applyMigrateSession: () => applyMigrateSession,
40558
39433
  assertMigrateSessionIsSafeToRehome: () => assertMigrateSessionIsSafeToRehome,
40559
- applyMigrateSession: () => applyMigrateSession
39434
+ planMigrateSession: () => planMigrateSession,
39435
+ runMigrateSessionCli: () => runMigrateSessionCli
40560
39436
  });
40561
39437
  import { existsSync as existsSync22, realpathSync as realpathSync4 } from "node:fs";
40562
39438
  import { homedir as homedir13 } from "node:os";
@@ -40701,8 +39577,8 @@ function applyMigrateSession(plan, memoryAction, deps) {
40701
39577
  if (!priorRow)
40702
39578
  return;
40703
39579
  try {
40704
- const restoreSets = restoreCols.map((c3) => `${c3} = ?`).join(", ");
40705
- const restoreParams = restoreCols.map((c3) => priorRow[c3] ?? null);
39580
+ const restoreSets = restoreCols.map((c2) => `${c2} = ?`).join(", ");
39581
+ const restoreParams = restoreCols.map((c2) => priorRow[c2] ?? null);
40706
39582
  deps.opencodeDb.exec("BEGIN IMMEDIATE");
40707
39583
  deps.opencodeDb.prepare(`UPDATE session SET ${restoreSets} WHERE id = ?`).run(...restoreParams, plan.sessionId);
40708
39584
  deps.opencodeDb.exec("COMMIT");
@@ -40778,7 +39654,7 @@ function realDeps(opencodeDb, contextDb) {
40778
39654
  contextDb,
40779
39655
  resolveIdentity: resolveProjectIdentity,
40780
39656
  hasGitDir: (dir) => existsSync22(join19(dir, ".git")),
40781
- realpath: (p2) => realpathSync4(p2)
39657
+ realpath: (p) => realpathSync4(p)
40782
39658
  };
40783
39659
  }
40784
39660
  function valueAfter2(args, flag) {
@@ -41365,14 +40241,14 @@ function parsePiConfig(rawConfig, recoveredTopLevelKeys = []) {
41365
40241
  }
41366
40242
  const issuePaths = issuePathsByKey.get(key) ?? [];
41367
40243
  const rawValue = migrated[key];
41368
- const allNested = issuePaths.length > 0 && issuePaths.every((p2) => p2.length >= 2) && typeof rawValue === "object" && rawValue !== null && !Array.isArray(rawValue);
40244
+ const allNested = issuePaths.length > 0 && issuePaths.every((p) => p.length >= 2) && typeof rawValue === "object" && rawValue !== null && !Array.isArray(rawValue);
41369
40245
  if (allNested) {
41370
40246
  let prunedBlock = {
41371
40247
  ...rawValue
41372
40248
  };
41373
40249
  const prunedLeaves = [];
41374
- for (const p2 of issuePaths) {
41375
- const relative = p2.slice(1);
40250
+ for (const p of issuePaths) {
40251
+ const relative = p.slice(1);
41376
40252
  const result = pruneNestedConfigLeaf(prunedBlock, relative);
41377
40253
  if (result) {
41378
40254
  prunedBlock = result.block;
@@ -41429,12 +40305,12 @@ function loadPiConfig(opts = {}) {
41429
40305
  warnings.push("[project config] legacy Magic Context config exists but the shared CortexKit config is absent; embedding registration is paused until config migration completes.");
41430
40306
  }
41431
40307
  let rawConfig = {};
41432
- const mergeFiles = [...loadedFiles].sort((a3, b2) => {
41433
- if (a3.scope === b2.scope)
40308
+ const mergeFiles = [...loadedFiles].sort((a3, b) => {
40309
+ if (a3.scope === b.scope)
41434
40310
  return 0;
41435
40311
  return a3.scope === "user" ? -1 : 1;
41436
40312
  });
41437
- const userRaw = mergeFiles.find((f2) => f2.scope === "user")?.config;
40313
+ const userRaw = mergeFiles.find((f) => f.scope === "user")?.config;
41438
40314
  const trustedBaseConfig = parsePiConfig(userRaw ?? {}).config;
41439
40315
  for (const loaded of mergeFiles) {
41440
40316
  const prefix = loaded.scope === "user" ? "[user config]" : "[project config]";
@@ -42368,8 +41244,8 @@ function parseHistorianDumpMeta(path6) {
42368
41244
  for (const fact of parsed.facts) {
42369
41245
  factCountByCategory[fact.category] = (factCountByCategory[fact.category] ?? 0) + 1;
42370
41246
  }
42371
- const starts = parsed.compartments.map((c3) => c3.startMessage);
42372
- const ends = parsed.compartments.map((c3) => c3.endMessage);
41247
+ const starts = parsed.compartments.map((c2) => c2.startMessage);
41248
+ const ends = parsed.compartments.map((c2) => c2.endMessage);
42373
41249
  let gaps = 0;
42374
41250
  let overlaps = 0;
42375
41251
  for (let i2 = 1;i2 < parsed.compartments.length; i2++) {
@@ -42405,7 +41281,7 @@ function listDumpsInDir(dir, limit) {
42405
41281
  mtime: stat.mtimeMs,
42406
41282
  sizeKb: Math.round(stat.size / 1024)
42407
41283
  };
42408
- }).sort((a3, b2) => b2.mtime - a3.mtime);
41284
+ }).sort((a3, b) => b.mtime - a3.mtime);
42409
41285
  const now = Date.now();
42410
41286
  const recent = entries.slice(0, limit).map((entry) => {
42411
41287
  const meta3 = parseHistorianDumpMeta(join22(dir, entry.name));
@@ -42858,8 +41734,8 @@ function parseOnnxProbeVerdict(output) {
42858
41734
  }
42859
41735
  function probeOnnxRuntimeNodeLoad(packageDir) {
42860
41736
  const result = runOnnxRuntimeNodeLoadProbeChildForRuntime(packageDir);
42861
- const errorCode3 = result.error?.code;
42862
- if (errorCode3 === "ETIMEDOUT") {
41737
+ const errorCode2 = result.error?.code;
41738
+ if (errorCode2 === "ETIMEDOUT") {
42863
41739
  return {
42864
41740
  state: "load-failed",
42865
41741
  packageDir,
@@ -43276,7 +42152,7 @@ function mostFrequentSchedule2(schedules) {
43276
42152
  const enabled = schedules.map((s) => s.trim()).filter(Boolean);
43277
42153
  if (enabled.length === 0)
43278
42154
  return "";
43279
- return enabled.sort((a3, b2) => cronIntervalScore2(a3) - cronIntervalScore2(b2))[0] ?? "";
42155
+ return enabled.sort((a3, b) => cronIntervalScore2(a3) - cronIntervalScore2(b))[0] ?? "";
43280
42156
  }
43281
42157
  function withoutBroadInterval2(entry) {
43282
42158
  const { broad_interval_days: _broad, ...rest } = entry;
@@ -44160,9 +43036,9 @@ function collectNpmReleaseAgeWarnings() {
44160
43036
  } catch {}
44161
43037
  return ageWarnings;
44162
43038
  }
44163
- function compareVersions(a3, b2) {
43039
+ function compareVersions(a3, b) {
44164
43040
  const pa = a3.split(/[.-]/).map((s) => Number.parseInt(s, 10));
44165
- const pb = b2.split(/[.-]/).map((s) => Number.parseInt(s, 10));
43041
+ const pb = b.split(/[.-]/).map((s) => Number.parseInt(s, 10));
44166
43042
  const len = Math.max(pa.length, pb.length);
44167
43043
  for (let i2 = 0;i2 < len; i2++) {
44168
43044
  const x = pa[i2] ?? 0;
@@ -44932,7 +43808,7 @@ ${formatDatabaseRepairGuidance(dbPath)}`);
44932
43808
  const diagnostics = await collectDiagnostics();
44933
43809
  const dumpBuckets = diagnostics.historianDumps.byProject;
44934
43810
  if (dumpBuckets.length > 0) {
44935
- const totalCount = dumpBuckets.reduce((sum, b2) => sum + b2.count, 0);
43811
+ const totalCount = dumpBuckets.reduce((sum, b) => sum + b.count, 0);
44936
43812
  const sessionCount = dumpBuckets.length;
44937
43813
  warn2(`Historian debug dumps: ${totalCount} file(s) across ${sessionCount} project(s)`);
44938
43814
  for (const bucket of dumpBuckets) {
@@ -45136,7 +44012,7 @@ function collectPiRecentSessions() {
45136
44012
  } catch {}
45137
44013
  }
45138
44014
  }
45139
- candidates.sort((a3, b2) => b2.mtime - a3.mtime);
44015
+ candidates.sort((a3, b) => b.mtime - a3.mtime);
45140
44016
  return candidates.slice(0, 5).map((entry) => ({
45141
44017
  sessionId: entry.sessionId,
45142
44018
  directory: entry.directory,
@@ -45154,8 +44030,8 @@ function parseHistorianDumpMeta2(path6) {
45154
44030
  for (const fact of parsed.facts) {
45155
44031
  factCountByCategory[fact.category] = (factCountByCategory[fact.category] ?? 0) + 1;
45156
44032
  }
45157
- const starts = parsed.compartments.map((c3) => c3.startMessage);
45158
- const ends = parsed.compartments.map((c3) => c3.endMessage);
44033
+ const starts = parsed.compartments.map((c2) => c2.startMessage);
44034
+ const ends = parsed.compartments.map((c2) => c2.endMessage);
45159
44035
  let gaps = 0;
45160
44036
  let overlaps = 0;
45161
44037
  for (let i2 = 1;i2 < parsed.compartments.length; i2++) {
@@ -45191,7 +44067,7 @@ function listDumpsInDir2(dir, limit) {
45191
44067
  mtime: stat.mtimeMs,
45192
44068
  sizeKb: Math.round(stat.size / 1024)
45193
44069
  };
45194
- }).sort((a3, b2) => b2.mtime - a3.mtime);
44070
+ }).sort((a3, b) => b.mtime - a3.mtime);
45195
44071
  const now = Date.now();
45196
44072
  const recent = entries.slice(0, limit).map((entry) => {
45197
44073
  const meta3 = parseHistorianDumpMeta2(join29(dir, entry.name));
@@ -45527,9 +44403,9 @@ function parseSemver2(version2) {
45527
44403
  return null;
45528
44404
  return [Number(match[1]), Number(match[2]), Number(match[3])];
45529
44405
  }
45530
- function compareSemver(a3, b2) {
44406
+ function compareSemver(a3, b) {
45531
44407
  const left = parseSemver2(a3);
45532
- const right = parseSemver2(b2);
44408
+ const right = parseSemver2(b);
45533
44409
  if (!left || !right)
45534
44410
  return null;
45535
44411
  for (let i2 = 0;i2 < 3; i2 += 1) {
@@ -45980,7 +44856,7 @@ ${formatDatabaseRepairGuidance(dbPath)}`);
45980
44856
  const diagnosticsForDumps = await collectDiagnostics2(options.cwd);
45981
44857
  const dumpBuckets = diagnosticsForDumps.historianDumps.byProject;
45982
44858
  if (dumpBuckets.length > 0) {
45983
- const totalCount = dumpBuckets.reduce((sum, b2) => sum + b2.count, 0);
44859
+ const totalCount = dumpBuckets.reduce((sum, b) => sum + b.count, 0);
45984
44860
  add2(results, "warn", `Historian debug dumps: ${totalCount} file(s) across ${dumpBuckets.length} project(s)`);
45985
44861
  for (const bucket of dumpBuckets) {
45986
44862
  add2(results, "info", ` [${bucket.directory}] ${bucket.count} file(s)`);