@vm0/cli 9.238.3 → 9.238.5

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 (144) hide show
  1. package/{agent-CTMIX4TA.js → agent-KS3ULPSZ.js} +6 -8
  2. package/{agent-CTMIX4TA.js.map → agent-KS3ULPSZ.js.map} +1 -1
  3. package/{banking-7EIKU7WX.js → banking-2B3GDOIE.js} +4 -6
  4. package/{banking-7EIKU7WX.js.map → banking-2B3GDOIE.js.map} +1 -1
  5. package/bill.generated-5FJHQPXY.js +16 -0
  6. package/bill.generated-5FJHQPXY.js.map +1 -0
  7. package/bill.generated-HYFQCA2Q.js +16 -0
  8. package/bill.generated-HYFQCA2Q.js.map +1 -0
  9. package/{chat-5MN7N3LD.js → chat-HP7XYF7H.js} +5 -7
  10. package/{chat-5MN7N3LD.js.map → chat-HP7XYF7H.js.map} +1 -1
  11. package/{chunk-65ZW3GHG.js → chunk-EJBHYDGP.js} +5 -7
  12. package/{chunk-65ZW3GHG.js.map → chunk-EJBHYDGP.js.map} +1 -1
  13. package/{chunk-XX3HVOWG.js → chunk-GIACTMOF.js} +18 -1015
  14. package/chunk-GIACTMOF.js.map +1 -0
  15. package/{chunk-ADBNTM34.js → chunk-H4Y7JDZB.js} +1947 -78
  16. package/chunk-H4Y7JDZB.js.map +1 -0
  17. package/{chunk-3LJFZEZ5.js → chunk-OCOHCUE3.js} +922 -290
  18. package/chunk-OCOHCUE3.js.map +1 -0
  19. package/{chunk-NAFRQSTL.js → chunk-T3XOMNS6.js} +3 -3
  20. package/{chunk-3SWR53IF.js → chunk-TEJZT6KB.js} +4 -4
  21. package/{chunk-3SZJPIMX.js → chunk-UHVWYX44.js} +2 -2
  22. package/{chunk-22VWTDX6.js → chunk-VC7E6IA7.js} +2830 -1325
  23. package/chunk-VC7E6IA7.js.map +1 -0
  24. package/{chunk-WPUM3KGN.js → chunk-VUER2HGS.js} +2 -2
  25. package/{chunk-4ODVSQ6H.js → chunk-YQ5ZYQN3.js} +2 -2
  26. package/{computer-use-JW6NHZFY.js → computer-use-6GZVM5S6.js} +3 -4
  27. package/{computer-use-JW6NHZFY.js.map → computer-use-6GZVM5S6.js.map} +1 -1
  28. package/{connector-II52GGER.js → connector-SFMD6HBQ.js} +5 -7
  29. package/{connector-II52GGER.js.map → connector-SFMD6HBQ.js.map} +1 -1
  30. package/copper.generated-PZRA3BV7.js +16 -0
  31. package/copper.generated-PZRA3BV7.js.map +1 -0
  32. package/copper.generated-UBWQDA5K.js +16 -0
  33. package/copper.generated-UBWQDA5K.js.map +1 -0
  34. package/{credit-SDMLLER2.js → credit-B465R4TF.js} +5 -7
  35. package/{credit-SDMLLER2.js.map → credit-B465R4TF.js.map} +1 -1
  36. package/datadog.generated-S4YB2V57.js +16 -0
  37. package/datadog.generated-S4YB2V57.js.map +1 -0
  38. package/datadog.generated-Z3O2DYLP.js +16 -0
  39. package/datadog.generated-Z3O2DYLP.js.map +1 -0
  40. package/{developer-support-7OGYYIJ2.js → developer-support-6GM2UW5P.js} +3 -4
  41. package/{developer-support-7OGYYIJ2.js.map → developer-support-6GM2UW5P.js.map} +1 -1
  42. package/{doctor-UJIIOA33.js → doctor-Z3HFRIKJ.js} +104 -18
  43. package/doctor-Z3HFRIKJ.js.map +1 -0
  44. package/expensify.generated-G2ZGBKBQ.js +16 -0
  45. package/expensify.generated-G2ZGBKBQ.js.map +1 -0
  46. package/expensify.generated-OHAW3AHP.js +16 -0
  47. package/expensify.generated-OHAW3AHP.js.map +1 -0
  48. package/{generate-DPGQKZTH.js → generate-37CJMAVG.js} +5 -7
  49. package/{generate-DPGQKZTH.js.map → generate-37CJMAVG.js.map} +1 -1
  50. package/{github-DA62AJIQ.js → github-6CSR7332.js} +3 -4
  51. package/{github-DA62AJIQ.js.map → github-6CSR7332.js.map} +1 -1
  52. package/{goal-WWM7OYBQ.js → goal-XURMW5OS.js} +3 -4
  53. package/{goal-WWM7OYBQ.js.map → goal-XURMW5OS.js.map} +1 -1
  54. package/google-contacts.generated-FL6Z7MTD.js +16 -0
  55. package/google-contacts.generated-FL6Z7MTD.js.map +1 -0
  56. package/google-contacts.generated-Q67YBTPW.js +16 -0
  57. package/google-contacts.generated-Q67YBTPW.js.map +1 -0
  58. package/google-forms.generated-AOKO24AB.js +16 -0
  59. package/google-forms.generated-AOKO24AB.js.map +1 -0
  60. package/google-forms.generated-KDCHIV43.js +16 -0
  61. package/google-forms.generated-KDCHIV43.js.map +1 -0
  62. package/{host-YMKJGV6R.js → host-EVFNV5BX.js} +4 -6
  63. package/{host-YMKJGV6R.js.map → host-EVFNV5BX.js.map} +1 -1
  64. package/index.js +14 -17
  65. package/index.js.map +1 -1
  66. package/{logs-FKXVE6QD.js → logs-DR7ZTWBK.js} +7 -10
  67. package/{logs-FKXVE6QD.js.map → logs-DR7ZTWBK.js.map} +1 -1
  68. package/{maps-MWMFHA72.js → maps-IAVJJMRT.js} +4 -6
  69. package/{maps-MWMFHA72.js.map → maps-IAVJJMRT.js.map} +1 -1
  70. package/{memory-KAGWT3GE.js → memory-X765S3ZI.js} +4 -6
  71. package/{memory-KAGWT3GE.js.map → memory-X765S3ZI.js.map} +1 -1
  72. package/{model-67UDE3IM.js → model-ZYVNUG47.js} +6 -8
  73. package/{model-67UDE3IM.js.map → model-ZYVNUG47.js.map} +1 -1
  74. package/{model-provider-YGNGMT6S.js → model-provider-SZIIRXS3.js} +5 -7
  75. package/{model-provider-YGNGMT6S.js.map → model-provider-SZIIRXS3.js.map} +1 -1
  76. package/netsuite.generated-3NXSZOXT.js +16 -0
  77. package/netsuite.generated-3NXSZOXT.js.map +1 -0
  78. package/netsuite.generated-XV3WXA4I.js +16 -0
  79. package/netsuite.generated-XV3WXA4I.js.map +1 -0
  80. package/{org-L52CQ6HJ.js → org-GBDLJZSE.js} +10 -12
  81. package/{org-L52CQ6HJ.js.map → org-GBDLJZSE.js.map} +1 -1
  82. package/package.json +1 -1
  83. package/paypal.generated-MDKROCJG.js +16 -0
  84. package/paypal.generated-MDKROCJG.js.map +1 -0
  85. package/paypal.generated-YZYYL7HX.js +16 -0
  86. package/paypal.generated-YZYYL7HX.js.map +1 -0
  87. package/{phone-VYQKHTRX.js → phone-KA4NZFQC.js} +4 -6
  88. package/{phone-VYQKHTRX.js.map → phone-KA4NZFQC.js.map} +1 -1
  89. package/{preference-7ULJO7RD.js → preference-TEMJHA73.js} +4 -6
  90. package/{preference-7ULJO7RD.js.map → preference-TEMJHA73.js.map} +1 -1
  91. package/ramp.generated-GDRLFPGX.js +16 -0
  92. package/ramp.generated-GDRLFPGX.js.map +1 -0
  93. package/ramp.generated-RJKZQLIG.js +16 -0
  94. package/ramp.generated-RJKZQLIG.js.map +1 -0
  95. package/{relationship-TNCKBWUW.js → relationship-OXV2SPNL.js} +4 -6
  96. package/{relationship-TNCKBWUW.js.map → relationship-OXV2SPNL.js.map} +1 -1
  97. package/{resource-V4AXTBFL.js → resource-2WREU3GR.js} +4 -6
  98. package/{resource-V4AXTBFL.js.map → resource-2WREU3GR.js.map} +1 -1
  99. package/{search-ABCFRK5K.js → search-V5V5IHY7.js} +7 -10
  100. package/{search-ABCFRK5K.js.map → search-V5V5IHY7.js.map} +1 -1
  101. package/{secret-6C53IEKW.js → secret-LIAHG47P.js} +12 -26
  102. package/secret-LIAHG47P.js.map +1 -0
  103. package/{slack-H4OQPL4A.js → slack-BUOXO2HU.js} +4 -6
  104. package/{slack-H4OQPL4A.js.map → slack-BUOXO2HU.js.map} +1 -1
  105. package/{teams-RLQBP3SK.js → teams-G7TYHRJB.js} +4 -6
  106. package/{teams-RLQBP3SK.js.map → teams-G7TYHRJB.js.map} +1 -1
  107. package/{telegram-TKQOVOWL.js → telegram-DEHNZSEN.js} +4 -6
  108. package/{telegram-TKQOVOWL.js.map → telegram-DEHNZSEN.js.map} +1 -1
  109. package/{variable-5PRGXPQX.js → variable-RMYF6NVZ.js} +4 -6
  110. package/{variable-5PRGXPQX.js.map → variable-RMYF6NVZ.js.map} +1 -1
  111. package/{video-CVM7TXWW.js → video-XEYMVSIU.js} +2 -3
  112. package/{video-CVM7TXWW.js.map → video-XEYMVSIU.js.map} +1 -1
  113. package/{web-E3KRU54R.js → web-4REDKON3.js} +3 -4
  114. package/{web-E3KRU54R.js.map → web-4REDKON3.js.map} +1 -1
  115. package/{whoami-7JOZNZEZ.js → whoami-66W7DPQX.js} +6 -8
  116. package/{whoami-7JOZNZEZ.js.map → whoami-66W7DPQX.js.map} +1 -1
  117. package/workday.generated-4MPT7O3V.js +16 -0
  118. package/workday.generated-4MPT7O3V.js.map +1 -0
  119. package/workday.generated-AHL44LEE.js +16 -0
  120. package/workday.generated-AHL44LEE.js.map +1 -0
  121. package/{workflow-RAR37LR4.js → workflow-PBJVC6HV.js} +5 -7
  122. package/workflow-PBJVC6HV.js.map +1 -0
  123. package/zero.js +34 -51
  124. package/zero.js.map +1 -1
  125. package/automation-7MAK66QT.js +0 -31
  126. package/automation-7MAK66QT.js.map +0 -1
  127. package/chunk-22VWTDX6.js.map +0 -1
  128. package/chunk-3LJFZEZ5.js.map +0 -1
  129. package/chunk-ADBNTM34.js.map +0 -1
  130. package/chunk-JUTUEPIR.js +0 -512
  131. package/chunk-JUTUEPIR.js.map +0 -1
  132. package/chunk-NBAZLPV3.js +0 -1301
  133. package/chunk-NBAZLPV3.js.map +0 -1
  134. package/chunk-XX3HVOWG.js.map +0 -1
  135. package/doctor-UJIIOA33.js.map +0 -1
  136. package/schedule-OSHL7HWT.js +0 -33
  137. package/schedule-OSHL7HWT.js.map +0 -1
  138. package/secret-6C53IEKW.js.map +0 -1
  139. package/workflow-RAR37LR4.js.map +0 -1
  140. /package/{chunk-NAFRQSTL.js.map → chunk-T3XOMNS6.js.map} +0 -0
  141. /package/{chunk-3SWR53IF.js.map → chunk-TEJZT6KB.js.map} +0 -0
  142. /package/{chunk-3SZJPIMX.js.map → chunk-UHVWYX44.js.map} +0 -0
  143. /package/{chunk-WPUM3KGN.js.map → chunk-VUER2HGS.js.map} +0 -0
  144. /package/{chunk-4ODVSQ6H.js.map → chunk-YQ5ZYQN3.js.map} +0 -0
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
- import {
5
- source_default
6
- } from "./chunk-JUTUEPIR.js";
7
4
  import {
8
5
  decodeZeroTokenPayload
9
6
  } from "./chunk-LRHXR7JT.js";
@@ -12,6 +9,507 @@ import {
12
9
  init_esm_shims
13
10
  } from "./chunk-DIRAZ3YX.js";
14
11
 
12
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
13
+ init_esm_shims();
14
+
15
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
16
+ init_esm_shims();
17
+ var ANSI_BACKGROUND_OFFSET = 10;
18
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
19
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
20
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
21
+ var styles = {
22
+ modifier: {
23
+ reset: [0, 0],
24
+ // 21 isn't widely supported and 22 does the same thing
25
+ bold: [1, 22],
26
+ dim: [2, 22],
27
+ italic: [3, 23],
28
+ underline: [4, 24],
29
+ overline: [53, 55],
30
+ inverse: [7, 27],
31
+ hidden: [8, 28],
32
+ strikethrough: [9, 29]
33
+ },
34
+ color: {
35
+ black: [30, 39],
36
+ red: [31, 39],
37
+ green: [32, 39],
38
+ yellow: [33, 39],
39
+ blue: [34, 39],
40
+ magenta: [35, 39],
41
+ cyan: [36, 39],
42
+ white: [37, 39],
43
+ // Bright color
44
+ blackBright: [90, 39],
45
+ gray: [90, 39],
46
+ // Alias of `blackBright`
47
+ grey: [90, 39],
48
+ // Alias of `blackBright`
49
+ redBright: [91, 39],
50
+ greenBright: [92, 39],
51
+ yellowBright: [93, 39],
52
+ blueBright: [94, 39],
53
+ magentaBright: [95, 39],
54
+ cyanBright: [96, 39],
55
+ whiteBright: [97, 39]
56
+ },
57
+ bgColor: {
58
+ bgBlack: [40, 49],
59
+ bgRed: [41, 49],
60
+ bgGreen: [42, 49],
61
+ bgYellow: [43, 49],
62
+ bgBlue: [44, 49],
63
+ bgMagenta: [45, 49],
64
+ bgCyan: [46, 49],
65
+ bgWhite: [47, 49],
66
+ // Bright color
67
+ bgBlackBright: [100, 49],
68
+ bgGray: [100, 49],
69
+ // Alias of `bgBlackBright`
70
+ bgGrey: [100, 49],
71
+ // Alias of `bgBlackBright`
72
+ bgRedBright: [101, 49],
73
+ bgGreenBright: [102, 49],
74
+ bgYellowBright: [103, 49],
75
+ bgBlueBright: [104, 49],
76
+ bgMagentaBright: [105, 49],
77
+ bgCyanBright: [106, 49],
78
+ bgWhiteBright: [107, 49]
79
+ }
80
+ };
81
+ var modifierNames = Object.keys(styles.modifier);
82
+ var foregroundColorNames = Object.keys(styles.color);
83
+ var backgroundColorNames = Object.keys(styles.bgColor);
84
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
85
+ function assembleStyles() {
86
+ const codes = /* @__PURE__ */ new Map();
87
+ for (const [groupName, group] of Object.entries(styles)) {
88
+ for (const [styleName, style] of Object.entries(group)) {
89
+ styles[styleName] = {
90
+ open: `\x1B[${style[0]}m`,
91
+ close: `\x1B[${style[1]}m`
92
+ };
93
+ group[styleName] = styles[styleName];
94
+ codes.set(style[0], style[1]);
95
+ }
96
+ Object.defineProperty(styles, groupName, {
97
+ value: group,
98
+ enumerable: false
99
+ });
100
+ }
101
+ Object.defineProperty(styles, "codes", {
102
+ value: codes,
103
+ enumerable: false
104
+ });
105
+ styles.color.close = "\x1B[39m";
106
+ styles.bgColor.close = "\x1B[49m";
107
+ styles.color.ansi = wrapAnsi16();
108
+ styles.color.ansi256 = wrapAnsi256();
109
+ styles.color.ansi16m = wrapAnsi16m();
110
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
111
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
112
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
113
+ Object.defineProperties(styles, {
114
+ rgbToAnsi256: {
115
+ value(red, green, blue) {
116
+ if (red === green && green === blue) {
117
+ if (red < 8) {
118
+ return 16;
119
+ }
120
+ if (red > 248) {
121
+ return 231;
122
+ }
123
+ return Math.round((red - 8) / 247 * 24) + 232;
124
+ }
125
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
126
+ },
127
+ enumerable: false
128
+ },
129
+ hexToRgb: {
130
+ value(hex3) {
131
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
132
+ if (!matches) {
133
+ return [0, 0, 0];
134
+ }
135
+ let [colorString] = matches;
136
+ if (colorString.length === 3) {
137
+ colorString = [...colorString].map((character) => character + character).join("");
138
+ }
139
+ const integer2 = Number.parseInt(colorString, 16);
140
+ return [
141
+ /* eslint-disable no-bitwise */
142
+ integer2 >> 16 & 255,
143
+ integer2 >> 8 & 255,
144
+ integer2 & 255
145
+ /* eslint-enable no-bitwise */
146
+ ];
147
+ },
148
+ enumerable: false
149
+ },
150
+ hexToAnsi256: {
151
+ value: (hex3) => styles.rgbToAnsi256(...styles.hexToRgb(hex3)),
152
+ enumerable: false
153
+ },
154
+ ansi256ToAnsi: {
155
+ value(code) {
156
+ if (code < 8) {
157
+ return 30 + code;
158
+ }
159
+ if (code < 16) {
160
+ return 90 + (code - 8);
161
+ }
162
+ let red;
163
+ let green;
164
+ let blue;
165
+ if (code >= 232) {
166
+ red = ((code - 232) * 10 + 8) / 255;
167
+ green = red;
168
+ blue = red;
169
+ } else {
170
+ code -= 16;
171
+ const remainder = code % 36;
172
+ red = Math.floor(code / 36) / 5;
173
+ green = Math.floor(remainder / 6) / 5;
174
+ blue = remainder % 6 / 5;
175
+ }
176
+ const value = Math.max(red, green, blue) * 2;
177
+ if (value === 0) {
178
+ return 30;
179
+ }
180
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
181
+ if (value === 2) {
182
+ result += 60;
183
+ }
184
+ return result;
185
+ },
186
+ enumerable: false
187
+ },
188
+ rgbToAnsi: {
189
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
190
+ enumerable: false
191
+ },
192
+ hexToAnsi: {
193
+ value: (hex3) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex3)),
194
+ enumerable: false
195
+ }
196
+ });
197
+ return styles;
198
+ }
199
+ var ansiStyles = assembleStyles();
200
+ var ansi_styles_default = ansiStyles;
201
+
202
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
203
+ init_esm_shims();
204
+ import process2 from "process";
205
+ import os from "os";
206
+ import tty from "tty";
207
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
208
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
209
+ const position = argv.indexOf(prefix + flag);
210
+ const terminatorPosition = argv.indexOf("--");
211
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
212
+ }
213
+ var { env } = process2;
214
+ var flagForceColor;
215
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
216
+ flagForceColor = 0;
217
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
218
+ flagForceColor = 1;
219
+ }
220
+ function envForceColor() {
221
+ if ("FORCE_COLOR" in env) {
222
+ if (env.FORCE_COLOR === "true") {
223
+ return 1;
224
+ }
225
+ if (env.FORCE_COLOR === "false") {
226
+ return 0;
227
+ }
228
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
229
+ }
230
+ }
231
+ function translateLevel(level) {
232
+ if (level === 0) {
233
+ return false;
234
+ }
235
+ return {
236
+ level,
237
+ hasBasic: true,
238
+ has256: level >= 2,
239
+ has16m: level >= 3
240
+ };
241
+ }
242
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
243
+ const noFlagForceColor = envForceColor();
244
+ if (noFlagForceColor !== void 0) {
245
+ flagForceColor = noFlagForceColor;
246
+ }
247
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
248
+ if (forceColor === 0) {
249
+ return 0;
250
+ }
251
+ if (sniffFlags) {
252
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
253
+ return 3;
254
+ }
255
+ if (hasFlag("color=256")) {
256
+ return 2;
257
+ }
258
+ }
259
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
260
+ return 1;
261
+ }
262
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
263
+ return 0;
264
+ }
265
+ const min = forceColor || 0;
266
+ if (env.TERM === "dumb") {
267
+ return min;
268
+ }
269
+ if (process2.platform === "win32") {
270
+ const osRelease = os.release().split(".");
271
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
272
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
273
+ }
274
+ return 1;
275
+ }
276
+ if ("CI" in env) {
277
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
278
+ return 3;
279
+ }
280
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
281
+ return 1;
282
+ }
283
+ return min;
284
+ }
285
+ if ("TEAMCITY_VERSION" in env) {
286
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
287
+ }
288
+ if (env.COLORTERM === "truecolor") {
289
+ return 3;
290
+ }
291
+ if (env.TERM === "xterm-kitty") {
292
+ return 3;
293
+ }
294
+ if (env.TERM === "xterm-ghostty") {
295
+ return 3;
296
+ }
297
+ if (env.TERM === "wezterm") {
298
+ return 3;
299
+ }
300
+ if ("TERM_PROGRAM" in env) {
301
+ const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
302
+ switch (env.TERM_PROGRAM) {
303
+ case "iTerm.app": {
304
+ return version2 >= 3 ? 3 : 2;
305
+ }
306
+ case "Apple_Terminal": {
307
+ return 2;
308
+ }
309
+ }
310
+ }
311
+ if (/-256(color)?$/i.test(env.TERM)) {
312
+ return 2;
313
+ }
314
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
315
+ return 1;
316
+ }
317
+ if ("COLORTERM" in env) {
318
+ return 1;
319
+ }
320
+ return min;
321
+ }
322
+ function createSupportsColor(stream, options = {}) {
323
+ const level = _supportsColor(stream, {
324
+ streamIsTTY: stream && stream.isTTY,
325
+ ...options
326
+ });
327
+ return translateLevel(level);
328
+ }
329
+ var supportsColor = {
330
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
331
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
332
+ };
333
+ var supports_color_default = supportsColor;
334
+
335
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
336
+ init_esm_shims();
337
+ function stringReplaceAll(string4, substring, replacer) {
338
+ let index = string4.indexOf(substring);
339
+ if (index === -1) {
340
+ return string4;
341
+ }
342
+ const substringLength = substring.length;
343
+ let endIndex = 0;
344
+ let returnValue = "";
345
+ do {
346
+ returnValue += string4.slice(endIndex, index) + substring + replacer;
347
+ endIndex = index + substringLength;
348
+ index = string4.indexOf(substring, endIndex);
349
+ } while (index !== -1);
350
+ returnValue += string4.slice(endIndex);
351
+ return returnValue;
352
+ }
353
+ function stringEncaseCRLFWithFirstIndex(string4, prefix, postfix, index) {
354
+ let endIndex = 0;
355
+ let returnValue = "";
356
+ do {
357
+ const gotCR = string4[index - 1] === "\r";
358
+ returnValue += string4.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
359
+ endIndex = index + 1;
360
+ index = string4.indexOf("\n", endIndex);
361
+ } while (index !== -1);
362
+ returnValue += string4.slice(endIndex);
363
+ return returnValue;
364
+ }
365
+
366
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
367
+ var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
368
+ var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
369
+ var STYLER = /* @__PURE__ */ Symbol("STYLER");
370
+ var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
371
+ var levelMapping = [
372
+ "ansi",
373
+ "ansi",
374
+ "ansi256",
375
+ "ansi16m"
376
+ ];
377
+ var styles2 = /* @__PURE__ */ Object.create(null);
378
+ var applyOptions = (object2, options = {}) => {
379
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
380
+ throw new Error("The `level` option should be an integer from 0 to 3");
381
+ }
382
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
383
+ object2.level = options.level === void 0 ? colorLevel : options.level;
384
+ };
385
+ var chalkFactory = (options) => {
386
+ const chalk2 = (...strings) => strings.join(" ");
387
+ applyOptions(chalk2, options);
388
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
389
+ return chalk2;
390
+ };
391
+ function createChalk(options) {
392
+ return chalkFactory(options);
393
+ }
394
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
395
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
396
+ styles2[styleName] = {
397
+ get() {
398
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
399
+ Object.defineProperty(this, styleName, { value: builder });
400
+ return builder;
401
+ }
402
+ };
403
+ }
404
+ styles2.visible = {
405
+ get() {
406
+ const builder = createBuilder(this, this[STYLER], true);
407
+ Object.defineProperty(this, "visible", { value: builder });
408
+ return builder;
409
+ }
410
+ };
411
+ var getModelAnsi = (model, level, type, ...arguments_) => {
412
+ if (model === "rgb") {
413
+ if (level === "ansi16m") {
414
+ return ansi_styles_default[type].ansi16m(...arguments_);
415
+ }
416
+ if (level === "ansi256") {
417
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
418
+ }
419
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
420
+ }
421
+ if (model === "hex") {
422
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
423
+ }
424
+ return ansi_styles_default[type][model](...arguments_);
425
+ };
426
+ var usedModels = ["rgb", "hex", "ansi256"];
427
+ for (const model of usedModels) {
428
+ styles2[model] = {
429
+ get() {
430
+ const { level } = this;
431
+ return function(...arguments_) {
432
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
433
+ return createBuilder(this, styler, this[IS_EMPTY]);
434
+ };
435
+ }
436
+ };
437
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
438
+ styles2[bgModel] = {
439
+ get() {
440
+ const { level } = this;
441
+ return function(...arguments_) {
442
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
443
+ return createBuilder(this, styler, this[IS_EMPTY]);
444
+ };
445
+ }
446
+ };
447
+ }
448
+ var proto = Object.defineProperties(() => {
449
+ }, {
450
+ ...styles2,
451
+ level: {
452
+ enumerable: true,
453
+ get() {
454
+ return this[GENERATOR].level;
455
+ },
456
+ set(level) {
457
+ this[GENERATOR].level = level;
458
+ }
459
+ }
460
+ });
461
+ var createStyler = (open, close, parent) => {
462
+ let openAll;
463
+ let closeAll;
464
+ if (parent === void 0) {
465
+ openAll = open;
466
+ closeAll = close;
467
+ } else {
468
+ openAll = parent.openAll + open;
469
+ closeAll = close + parent.closeAll;
470
+ }
471
+ return {
472
+ open,
473
+ close,
474
+ openAll,
475
+ closeAll,
476
+ parent
477
+ };
478
+ };
479
+ var createBuilder = (self, _styler, _isEmpty) => {
480
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
481
+ Object.setPrototypeOf(builder, proto);
482
+ builder[GENERATOR] = self;
483
+ builder[STYLER] = _styler;
484
+ builder[IS_EMPTY] = _isEmpty;
485
+ return builder;
486
+ };
487
+ var applyStyle = (self, string4) => {
488
+ if (self.level <= 0 || !string4) {
489
+ return self[IS_EMPTY] ? "" : string4;
490
+ }
491
+ let styler = self[STYLER];
492
+ if (styler === void 0) {
493
+ return string4;
494
+ }
495
+ const { openAll, closeAll } = styler;
496
+ if (string4.includes("\x1B")) {
497
+ while (styler !== void 0) {
498
+ string4 = stringReplaceAll(string4, styler.close, styler.open);
499
+ styler = styler.parent;
500
+ }
501
+ }
502
+ const lfIndex = string4.indexOf("\n");
503
+ if (lfIndex !== -1) {
504
+ string4 = stringEncaseCRLFWithFirstIndex(string4, closeAll, openAll, lfIndex);
505
+ }
506
+ return openAll + string4 + closeAll;
507
+ };
508
+ Object.defineProperties(createChalk.prototype, styles2);
509
+ var chalk = createChalk();
510
+ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
511
+ var source_default = chalk;
512
+
15
513
  // src/lib/api/config.ts
16
514
  init_esm_shims();
17
515
  import { homedir } from "os";
@@ -104,772 +602,10 @@ async function clearConfig() {
104
602
  }
105
603
  }
106
604
 
107
- // src/lib/api/core/client-factory.ts
108
- init_esm_shims();
109
-
110
- // src/lib/api/client-headers.ts
111
- init_esm_shims();
112
- import { randomUUID } from "crypto";
113
-
114
- // ../../packages/api-contracts/src/contracts/client-headers.ts
115
- init_esm_shims();
116
- var CLIENT_VERSION_HEADER = "X-Client-Version";
117
- var CLIENT_TYPE_HEADER = "X-Client-Type";
118
- var CLIENT_SESSION_ID_HEADER = "X-Client-Session-Id";
119
- var CLIENT_REQUEST_ID_HEADER = "X-Client-Request-Id";
120
- var CLIENT_TYPE_CLI = "CLI";
121
-
122
- // ../../packages/api-contracts/src/contracts/trpc-contract.ts
123
- init_esm_shims();
124
-
125
- // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/index.mjs
126
- init_esm_shims();
127
-
128
- // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs
605
+ // ../../packages/api-contracts/src/contracts/model-providers.ts
129
606
  init_esm_shims();
130
607
 
131
- // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/codes-DagpWZLc.mjs
132
- init_esm_shims();
133
- function mergeWithoutOverrides(obj1, ...objs) {
134
- const newObj = Object.assign(emptyObject(), obj1);
135
- for (const overrides of objs) for (const key in overrides) {
136
- if (key in newObj && newObj[key] !== overrides[key]) throw new Error(`Duplicate key ${key}`);
137
- newObj[key] = overrides[key];
138
- }
139
- return newObj;
140
- }
141
- function isObject(value) {
142
- return !!value && !Array.isArray(value) && typeof value === "object";
143
- }
144
- function isFunction(fn) {
145
- return typeof fn === "function";
146
- }
147
- function emptyObject() {
148
- return /* @__PURE__ */ Object.create(null);
149
- }
150
- var TRPC_ERROR_CODES_BY_KEY = {
151
- PARSE_ERROR: -32700,
152
- BAD_REQUEST: -32600,
153
- INTERNAL_SERVER_ERROR: -32603,
154
- NOT_IMPLEMENTED: -32603,
155
- BAD_GATEWAY: -32603,
156
- SERVICE_UNAVAILABLE: -32603,
157
- GATEWAY_TIMEOUT: -32603,
158
- UNAUTHORIZED: -32001,
159
- PAYMENT_REQUIRED: -32002,
160
- FORBIDDEN: -32003,
161
- NOT_FOUND: -32004,
162
- METHOD_NOT_SUPPORTED: -32005,
163
- TIMEOUT: -32008,
164
- CONFLICT: -32009,
165
- PRECONDITION_FAILED: -32012,
166
- PAYLOAD_TOO_LARGE: -32013,
167
- UNSUPPORTED_MEDIA_TYPE: -32015,
168
- UNPROCESSABLE_CONTENT: -32022,
169
- PRECONDITION_REQUIRED: -32028,
170
- TOO_MANY_REQUESTS: -32029,
171
- CLIENT_CLOSED_REQUEST: -32099
172
- };
173
- var retryableRpcCodes = [
174
- TRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,
175
- TRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,
176
- TRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,
177
- TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
178
- ];
179
-
180
- // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs
181
- var __create = Object.create;
182
- var __defProp = Object.defineProperty;
183
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
184
- var __getOwnPropNames = Object.getOwnPropertyNames;
185
- var __getProtoOf = Object.getPrototypeOf;
186
- var __hasOwnProp = Object.prototype.hasOwnProperty;
187
- var __commonJS = (cb, mod) => function() {
188
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
189
- };
190
- var __copyProps = (to, from, except, desc) => {
191
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
192
- key = keys[i];
193
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
194
- get: ((k) => from[k]).bind(null, key),
195
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
196
- });
197
- }
198
- return to;
199
- };
200
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
201
- value: mod,
202
- enumerable: true
203
- }) : target, mod));
204
- var noop = () => {
205
- };
206
- var freezeIfAvailable = (obj) => {
207
- if (Object.freeze) Object.freeze(obj);
208
- };
209
- function createInnerProxy(callback, path, memo) {
210
- var _memo$cacheKey;
211
- const cacheKey = path.join(".");
212
- (_memo$cacheKey = memo[cacheKey]) !== null && _memo$cacheKey !== void 0 || (memo[cacheKey] = new Proxy(noop, {
213
- get(_obj, key) {
214
- if (typeof key !== "string" || key === "then") return void 0;
215
- return createInnerProxy(callback, [...path, key], memo);
216
- },
217
- apply(_1, _2, args) {
218
- const lastOfPath = path[path.length - 1];
219
- if (lastOfPath === "valueOf" || lastOfPath === "toString" || lastOfPath === "toJSON") {
220
- const debugPath = path.slice(0, -1).join(".");
221
- return `tRPC.proxy(${debugPath})`;
222
- }
223
- let opts = {
224
- args,
225
- path
226
- };
227
- if (lastOfPath === "call") opts = {
228
- args: args.length >= 2 ? [args[1]] : [],
229
- path: path.slice(0, -1)
230
- };
231
- else if (lastOfPath === "apply") opts = {
232
- args: args.length >= 2 ? args[1] : [],
233
- path: path.slice(0, -1)
234
- };
235
- freezeIfAvailable(opts.args);
236
- freezeIfAvailable(opts.path);
237
- return callback(opts);
238
- }
239
- }));
240
- return memo[cacheKey];
241
- }
242
- var createRecursiveProxy = (callback) => createInnerProxy(callback, [], emptyObject());
243
- var require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
244
- function _typeof$2(o) {
245
- "@babel/helpers - typeof";
246
- return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
247
- return typeof o$1;
248
- } : function(o$1) {
249
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
250
- }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
251
- }
252
- module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
253
- } });
254
- var require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
255
- var _typeof$1 = require_typeof()["default"];
256
- function toPrimitive$1(t2, r) {
257
- if ("object" != _typeof$1(t2) || !t2) return t2;
258
- var e = t2[Symbol.toPrimitive];
259
- if (void 0 !== e) {
260
- var i = e.call(t2, r || "default");
261
- if ("object" != _typeof$1(i)) return i;
262
- throw new TypeError("@@toPrimitive must return a primitive value.");
263
- }
264
- return ("string" === r ? String : Number)(t2);
265
- }
266
- module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
267
- } });
268
- var require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
269
- var _typeof = require_typeof()["default"];
270
- var toPrimitive = require_toPrimitive();
271
- function toPropertyKey$1(t2) {
272
- var i = toPrimitive(t2, "string");
273
- return "symbol" == _typeof(i) ? i : i + "";
274
- }
275
- module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
276
- } });
277
- var require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
278
- var toPropertyKey = require_toPropertyKey();
279
- function _defineProperty(e, r, t2) {
280
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
281
- value: t2,
282
- enumerable: true,
283
- configurable: true,
284
- writable: true
285
- }) : e[r] = t2, e;
286
- }
287
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
288
- } });
289
- var require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
290
- var defineProperty = require_defineProperty();
291
- function ownKeys(e, r) {
292
- var t2 = Object.keys(e);
293
- if (Object.getOwnPropertySymbols) {
294
- var o = Object.getOwnPropertySymbols(e);
295
- r && (o = o.filter(function(r$1) {
296
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
297
- })), t2.push.apply(t2, o);
298
- }
299
- return t2;
300
- }
301
- function _objectSpread2(e) {
302
- for (var r = 1; r < arguments.length; r++) {
303
- var t2 = null != arguments[r] ? arguments[r] : {};
304
- r % 2 ? ownKeys(Object(t2), true).forEach(function(r$1) {
305
- defineProperty(e, r$1, t2[r$1]);
306
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r$1) {
307
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t2, r$1));
308
- });
309
- }
310
- return e;
311
- }
312
- module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
313
- } });
314
- var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
315
-
316
- // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/tracked-DWInO6EQ.mjs
317
- init_esm_shims();
318
- var defaultFormatter = ({ shape }) => {
319
- return shape;
320
- };
321
- var import_defineProperty = __toESM(require_defineProperty(), 1);
322
- var UnknownCauseError = class extends Error {
323
- constructor(cause) {
324
- super(getMessage(cause));
325
- Object.assign(this, cause);
326
- }
327
- };
328
- function getMessage(cause) {
329
- if ("message" in cause) return String(cause.message);
330
- return void 0;
331
- }
332
- function getCauseFromUnknown(cause) {
333
- if (cause instanceof Error) return cause;
334
- const type = typeof cause;
335
- if (type === "undefined" || type === "function" || cause === null) return void 0;
336
- if (type !== "object") return new Error(String(cause));
337
- if (isObject(cause)) return new UnknownCauseError(cause);
338
- return void 0;
339
- }
340
- function getTRPCErrorFromUnknown(cause) {
341
- if (cause instanceof TRPCError) return cause;
342
- if (cause instanceof Error && cause.name === "TRPCError") return cause;
343
- const trpcError = new TRPCError({
344
- code: "INTERNAL_SERVER_ERROR",
345
- cause
346
- });
347
- if (cause instanceof Error && cause.stack) trpcError.stack = cause.stack;
348
- return trpcError;
349
- }
350
- var TRPCError = class extends Error {
351
- constructor(opts) {
352
- var _ref, _opts$message, _this$cause;
353
- const cause = getCauseFromUnknown(opts.cause);
354
- const message = (_ref = (_opts$message = opts.message) !== null && _opts$message !== void 0 ? _opts$message : cause === null || cause === void 0 ? void 0 : cause.message) !== null && _ref !== void 0 ? _ref : opts.code;
355
- super(message, { cause });
356
- (0, import_defineProperty.default)(this, "cause", void 0);
357
- (0, import_defineProperty.default)(this, "code", void 0);
358
- this.code = opts.code;
359
- this.name = "TRPCError";
360
- (_this$cause = this.cause) !== null && _this$cause !== void 0 || (this.cause = cause);
361
- }
362
- };
363
- var import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);
364
- function getDataTransformer(transformer) {
365
- if ("input" in transformer) return transformer;
366
- return {
367
- input: transformer,
368
- output: transformer
369
- };
370
- }
371
- var defaultTransformer = {
372
- input: {
373
- serialize: (obj) => obj,
374
- deserialize: (obj) => obj
375
- },
376
- output: {
377
- serialize: (obj) => obj,
378
- deserialize: (obj) => obj
379
- }
380
- };
381
- var import_objectSpread22 = __toESM(require_objectSpread2(), 1);
382
- var lazyMarker = "lazyMarker";
383
- function once(fn) {
384
- const uncalled = /* @__PURE__ */ Symbol();
385
- let result = uncalled;
386
- return () => {
387
- if (result === uncalled) result = fn();
388
- return result;
389
- };
390
- }
391
- function isLazy(input) {
392
- return typeof input === "function" && lazyMarker in input;
393
- }
394
- function isRouter(value) {
395
- return isObject(value) && isObject(value["_def"]) && "router" in value["_def"];
396
- }
397
- var emptyRouter = {
398
- _ctx: null,
399
- _errorShape: null,
400
- _meta: null,
401
- queries: {},
402
- mutations: {},
403
- subscriptions: {},
404
- errorFormatter: defaultFormatter,
405
- transformer: defaultTransformer
406
- };
407
- var reservedWords = [
408
- "then",
409
- "call",
410
- "apply"
411
- ];
412
- function createRouterFactory(config2) {
413
- function createRouterInner(input) {
414
- const reservedWordsUsed = new Set(Object.keys(input).filter((v) => reservedWords.includes(v)));
415
- if (reservedWordsUsed.size > 0) throw new Error("Reserved words used in `router({})` call: " + Array.from(reservedWordsUsed).join(", "));
416
- const procedures = emptyObject();
417
- const lazy$1 = emptyObject();
418
- function createLazyLoader(opts) {
419
- return {
420
- ref: opts.ref,
421
- load: once(async () => {
422
- const router$1 = await opts.ref();
423
- const lazyPath = [...opts.path, opts.key];
424
- const lazyKey = lazyPath.join(".");
425
- opts.aggregate[opts.key] = step(router$1._def.record, lazyPath);
426
- delete lazy$1[lazyKey];
427
- for (const [nestedKey, nestedItem] of Object.entries(router$1._def.lazy)) {
428
- const nestedRouterKey = [...lazyPath, nestedKey].join(".");
429
- lazy$1[nestedRouterKey] = createLazyLoader({
430
- ref: nestedItem.ref,
431
- path: lazyPath,
432
- key: nestedKey,
433
- aggregate: opts.aggregate[opts.key]
434
- });
435
- }
436
- })
437
- };
438
- }
439
- function step(from, path = []) {
440
- const aggregate = emptyObject();
441
- for (const [key, item] of Object.entries(from !== null && from !== void 0 ? from : {})) {
442
- if (isLazy(item)) {
443
- lazy$1[[...path, key].join(".")] = createLazyLoader({
444
- path,
445
- ref: item,
446
- key,
447
- aggregate
448
- });
449
- continue;
450
- }
451
- if (isRouter(item)) {
452
- aggregate[key] = step(item._def.record, [...path, key]);
453
- continue;
454
- }
455
- if (!isProcedure(item)) {
456
- aggregate[key] = step(item, [...path, key]);
457
- continue;
458
- }
459
- const newPath = [...path, key].join(".");
460
- if (procedures[newPath]) throw new Error(`Duplicate key: ${newPath}`);
461
- procedures[newPath] = item;
462
- aggregate[key] = item;
463
- }
464
- return aggregate;
465
- }
466
- const record2 = step(input);
467
- const _def = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({
468
- _config: config2,
469
- router: true,
470
- procedures,
471
- lazy: lazy$1
472
- }, emptyRouter), {}, { record: record2 });
473
- const router = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({}, record2), {}, {
474
- _def,
475
- createCaller: createCallerFactory()({ _def })
476
- });
477
- return router;
478
- }
479
- return createRouterInner;
480
- }
481
- function isProcedure(procedureOrRouter) {
482
- return typeof procedureOrRouter === "function";
483
- }
484
- async function getProcedureAtPath(router, path) {
485
- const { _def } = router;
486
- let procedure = _def.procedures[path];
487
- while (!procedure) {
488
- const key = Object.keys(_def.lazy).find((key$1) => path.startsWith(key$1));
489
- if (!key) return null;
490
- const lazyRouter = _def.lazy[key];
491
- await lazyRouter.load();
492
- procedure = _def.procedures[path];
493
- }
494
- return procedure;
495
- }
496
- function createCallerFactory() {
497
- return function createCallerInner(router) {
498
- const { _def } = router;
499
- return function createCaller(ctxOrCallback, opts) {
500
- return createRecursiveProxy(async (innerOpts) => {
501
- const { path, args } = innerOpts;
502
- const fullPath = path.join(".");
503
- if (path.length === 1 && path[0] === "_def") return _def;
504
- const procedure = await getProcedureAtPath(router, fullPath);
505
- let ctx = void 0;
506
- try {
507
- if (!procedure) throw new TRPCError({
508
- code: "NOT_FOUND",
509
- message: `No procedure found on path "${path}"`
510
- });
511
- ctx = isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
512
- return await procedure({
513
- path: fullPath,
514
- getRawInput: async () => args[0],
515
- ctx,
516
- type: procedure._def.type,
517
- signal: opts === null || opts === void 0 ? void 0 : opts.signal,
518
- batchIndex: 0
519
- });
520
- } catch (cause) {
521
- var _opts$onError, _procedure$_def$type;
522
- opts === null || opts === void 0 || (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {
523
- ctx,
524
- error: getTRPCErrorFromUnknown(cause),
525
- input: args[0],
526
- path: fullPath,
527
- type: (_procedure$_def$type = procedure === null || procedure === void 0 ? void 0 : procedure._def.type) !== null && _procedure$_def$type !== void 0 ? _procedure$_def$type : "unknown"
528
- });
529
- throw cause;
530
- }
531
- });
532
- };
533
- };
534
- }
535
- function mergeRouters(...routerList) {
536
- var _routerList$, _routerList$2;
537
- const record2 = mergeWithoutOverrides({}, ...routerList.map((r) => r._def.record));
538
- const errorFormatter = routerList.reduce((currentErrorFormatter, nextRouter) => {
539
- if (nextRouter._def._config.errorFormatter && nextRouter._def._config.errorFormatter !== defaultFormatter) {
540
- if (currentErrorFormatter !== defaultFormatter && currentErrorFormatter !== nextRouter._def._config.errorFormatter) throw new Error("You seem to have several error formatters");
541
- return nextRouter._def._config.errorFormatter;
542
- }
543
- return currentErrorFormatter;
544
- }, defaultFormatter);
545
- const transformer = routerList.reduce((prev, current) => {
546
- if (current._def._config.transformer && current._def._config.transformer !== defaultTransformer) {
547
- if (prev !== defaultTransformer && prev !== current._def._config.transformer) throw new Error("You seem to have several transformers");
548
- return current._def._config.transformer;
549
- }
550
- return prev;
551
- }, defaultTransformer);
552
- const router = createRouterFactory({
553
- errorFormatter,
554
- transformer,
555
- isDev: routerList.every((r) => r._def._config.isDev),
556
- allowOutsideOfServer: routerList.every((r) => r._def._config.allowOutsideOfServer),
557
- isServer: routerList.every((r) => r._def._config.isServer),
558
- $types: (_routerList$ = routerList[0]) === null || _routerList$ === void 0 ? void 0 : _routerList$._def._config.$types,
559
- sse: (_routerList$2 = routerList[0]) === null || _routerList$2 === void 0 ? void 0 : _routerList$2._def._config.sse
560
- })(record2);
561
- return router;
562
- }
563
-
564
- // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/initTRPC-BRf4imah.mjs
565
- init_esm_shims();
566
- var import_objectSpread2$2 = __toESM(require_objectSpread2(), 1);
567
- var middlewareMarker = "middlewareMarker";
568
- function createMiddlewareFactory() {
569
- function createMiddlewareInner(middlewares) {
570
- return {
571
- _middlewares: middlewares,
572
- unstable_pipe(middlewareBuilderOrFn) {
573
- const pipedMiddleware = "_middlewares" in middlewareBuilderOrFn ? middlewareBuilderOrFn._middlewares : [middlewareBuilderOrFn];
574
- return createMiddlewareInner([...middlewares, ...pipedMiddleware]);
575
- }
576
- };
577
- }
578
- function createMiddleware(fn) {
579
- return createMiddlewareInner([fn]);
580
- }
581
- return createMiddleware;
582
- }
583
- function createInputMiddleware(parse3) {
584
- const inputMiddleware = async function inputValidatorMiddleware(opts) {
585
- let parsedInput;
586
- const rawInput = await opts.getRawInput();
587
- try {
588
- parsedInput = await parse3(rawInput);
589
- } catch (cause) {
590
- throw new TRPCError({
591
- code: "BAD_REQUEST",
592
- cause
593
- });
594
- }
595
- const combinedInput = isObject(opts.input) && isObject(parsedInput) ? (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, opts.input), parsedInput) : parsedInput;
596
- return opts.next({ input: combinedInput });
597
- };
598
- inputMiddleware._type = "input";
599
- return inputMiddleware;
600
- }
601
- function createOutputMiddleware(parse3) {
602
- const outputMiddleware = async function outputValidatorMiddleware({ next }) {
603
- const result = await next();
604
- if (!result.ok) return result;
605
- try {
606
- const data = await parse3(result.data);
607
- return (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, result), {}, { data });
608
- } catch (cause) {
609
- throw new TRPCError({
610
- message: "Output validation failed",
611
- code: "INTERNAL_SERVER_ERROR",
612
- cause
613
- });
614
- }
615
- };
616
- outputMiddleware._type = "output";
617
- return outputMiddleware;
618
- }
619
- var import_defineProperty2 = __toESM(require_defineProperty(), 1);
620
- var StandardSchemaV1Error = class extends Error {
621
- /**
622
- * Creates a schema error with useful information.
623
- *
624
- * @param issues The schema issues.
625
- */
626
- constructor(issues) {
627
- var _issues$;
628
- super((_issues$ = issues[0]) === null || _issues$ === void 0 ? void 0 : _issues$.message);
629
- (0, import_defineProperty2.default)(this, "issues", void 0);
630
- this.name = "SchemaError";
631
- this.issues = issues;
632
- }
633
- };
634
- function getParseFn(procedureParser) {
635
- const parser = procedureParser;
636
- const isStandardSchema = "~standard" in parser;
637
- if (typeof parser === "function" && typeof parser.assert === "function") return parser.assert.bind(parser);
638
- if (typeof parser === "function" && !isStandardSchema) return parser;
639
- if (typeof parser.parseAsync === "function") return parser.parseAsync.bind(parser);
640
- if (typeof parser.parse === "function") return parser.parse.bind(parser);
641
- if (typeof parser.validateSync === "function") return parser.validateSync.bind(parser);
642
- if (typeof parser.create === "function") return parser.create.bind(parser);
643
- if (typeof parser.assert === "function") return (value) => {
644
- parser.assert(value);
645
- return value;
646
- };
647
- if (isStandardSchema) return async (value) => {
648
- const result = await parser["~standard"].validate(value);
649
- if (result.issues) throw new StandardSchemaV1Error(result.issues);
650
- return result.value;
651
- };
652
- throw new Error("Could not find a validator fn");
653
- }
654
- var require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
655
- function _objectWithoutPropertiesLoose(r, e) {
656
- if (null == r) return {};
657
- var t2 = {};
658
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
659
- if (e.includes(n)) continue;
660
- t2[n] = r[n];
661
- }
662
- return t2;
663
- }
664
- module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
665
- } });
666
- var require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
667
- var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
668
- function _objectWithoutProperties$1(e, t2) {
669
- if (null == e) return {};
670
- var o, r, i = objectWithoutPropertiesLoose(e, t2);
671
- if (Object.getOwnPropertySymbols) {
672
- var s = Object.getOwnPropertySymbols(e);
673
- for (r = 0; r < s.length; r++) o = s[r], t2.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
674
- }
675
- return i;
676
- }
677
- module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
678
- } });
679
- var import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
680
- var import_objectSpread2$12 = __toESM(require_objectSpread2(), 1);
681
- var _excluded = [
682
- "middlewares",
683
- "inputs",
684
- "meta"
685
- ];
686
- function createNewBuilder(def1, def2) {
687
- const { middlewares = [], inputs, meta: meta3 } = def2, rest = (0, import_objectWithoutProperties.default)(def2, _excluded);
688
- return createBuilder((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, mergeWithoutOverrides(def1, rest)), {}, {
689
- inputs: [...def1.inputs, ...inputs !== null && inputs !== void 0 ? inputs : []],
690
- middlewares: [...def1.middlewares, ...middlewares],
691
- meta: def1.meta && meta3 ? (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, def1.meta), meta3) : meta3 !== null && meta3 !== void 0 ? meta3 : def1.meta
692
- }));
693
- }
694
- function createBuilder(initDef = {}) {
695
- const _def = (0, import_objectSpread2$12.default)({
696
- procedure: true,
697
- inputs: [],
698
- middlewares: []
699
- }, initDef);
700
- const builder = {
701
- _def,
702
- input(input) {
703
- const parser = getParseFn(input);
704
- return createNewBuilder(_def, {
705
- inputs: [input],
706
- middlewares: [createInputMiddleware(parser)]
707
- });
708
- },
709
- output(output) {
710
- const parser = getParseFn(output);
711
- return createNewBuilder(_def, {
712
- output,
713
- middlewares: [createOutputMiddleware(parser)]
714
- });
715
- },
716
- meta(meta3) {
717
- return createNewBuilder(_def, { meta: meta3 });
718
- },
719
- use(middlewareBuilderOrFn) {
720
- const middlewares = "_middlewares" in middlewareBuilderOrFn ? middlewareBuilderOrFn._middlewares : [middlewareBuilderOrFn];
721
- return createNewBuilder(_def, { middlewares });
722
- },
723
- unstable_concat(builder$1) {
724
- return createNewBuilder(_def, builder$1._def);
725
- },
726
- concat(builder$1) {
727
- return createNewBuilder(_def, builder$1._def);
728
- },
729
- query(resolver) {
730
- return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "query" }), resolver);
731
- },
732
- mutation(resolver) {
733
- return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "mutation" }), resolver);
734
- },
735
- subscription(resolver) {
736
- return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "subscription" }), resolver);
737
- },
738
- experimental_caller(caller) {
739
- return createNewBuilder(_def, { caller });
740
- }
741
- };
742
- return builder;
743
- }
744
- function createResolver(_defIn, resolver) {
745
- const finalBuilder = createNewBuilder(_defIn, {
746
- resolver,
747
- middlewares: [async function resolveMiddleware(opts) {
748
- const data = await resolver(opts);
749
- return {
750
- marker: middlewareMarker,
751
- ok: true,
752
- data,
753
- ctx: opts.ctx
754
- };
755
- }]
756
- });
757
- const _def = (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, finalBuilder._def), {}, {
758
- type: _defIn.type,
759
- experimental_caller: Boolean(finalBuilder._def.caller),
760
- meta: finalBuilder._def.meta,
761
- $types: null
762
- });
763
- const invoke = createProcedureCaller(finalBuilder._def);
764
- const callerOverride = finalBuilder._def.caller;
765
- if (!callerOverride) return invoke;
766
- const callerWrapper = async (...args) => {
767
- return await callerOverride({
768
- args,
769
- invoke,
770
- _def
771
- });
772
- };
773
- callerWrapper._def = _def;
774
- return callerWrapper;
775
- }
776
- var codeblock = `
777
- This is a client-only function.
778
- If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
779
- `.trim();
780
- async function callRecursive(index, _def, opts) {
781
- try {
782
- const middleware = _def.middlewares[index];
783
- const result = await middleware((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts), {}, {
784
- meta: _def.meta,
785
- input: opts.input,
786
- next(_nextOpts) {
787
- var _nextOpts$getRawInput;
788
- const nextOpts = _nextOpts;
789
- return callRecursive(index + 1, _def, (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts), {}, {
790
- ctx: (nextOpts === null || nextOpts === void 0 ? void 0 : nextOpts.ctx) ? (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts.ctx), nextOpts.ctx) : opts.ctx,
791
- input: nextOpts && "input" in nextOpts ? nextOpts.input : opts.input,
792
- getRawInput: (_nextOpts$getRawInput = nextOpts === null || nextOpts === void 0 ? void 0 : nextOpts.getRawInput) !== null && _nextOpts$getRawInput !== void 0 ? _nextOpts$getRawInput : opts.getRawInput
793
- }));
794
- }
795
- }));
796
- return result;
797
- } catch (cause) {
798
- return {
799
- ok: false,
800
- error: getTRPCErrorFromUnknown(cause),
801
- marker: middlewareMarker
802
- };
803
- }
804
- }
805
- function createProcedureCaller(_def) {
806
- async function procedure(opts) {
807
- if (!opts || !("getRawInput" in opts)) throw new Error(codeblock);
808
- const result = await callRecursive(0, _def, opts);
809
- if (!result) throw new TRPCError({
810
- code: "INTERNAL_SERVER_ERROR",
811
- message: "No result from middlewares - did you forget to `return next()`?"
812
- });
813
- if (!result.ok) throw result.error;
814
- return result.data;
815
- }
816
- procedure._def = _def;
817
- procedure.procedure = true;
818
- procedure.meta = _def.meta;
819
- return procedure;
820
- }
821
- var _globalThis$process;
822
- var _globalThis$process2;
823
- var _globalThis$process3;
824
- var isServerDefault = typeof window === "undefined" || "Deno" in window || ((_globalThis$process = globalThis.process) === null || _globalThis$process === void 0 || (_globalThis$process = _globalThis$process.env) === null || _globalThis$process === void 0 ? void 0 : _globalThis$process["NODE_ENV"]) === "test" || !!((_globalThis$process2 = globalThis.process) === null || _globalThis$process2 === void 0 || (_globalThis$process2 = _globalThis$process2.env) === null || _globalThis$process2 === void 0 ? void 0 : _globalThis$process2["JEST_WORKER_ID"]) || !!((_globalThis$process3 = globalThis.process) === null || _globalThis$process3 === void 0 || (_globalThis$process3 = _globalThis$process3.env) === null || _globalThis$process3 === void 0 ? void 0 : _globalThis$process3["VITEST_WORKER_ID"]);
825
- var import_objectSpread23 = __toESM(require_objectSpread2(), 1);
826
- var TRPCBuilder = class TRPCBuilder2 {
827
- /**
828
- * Add a context shape as a generic to the root object
829
- * @see https://trpc.io/docs/v11/server/context
830
- */
831
- context() {
832
- return new TRPCBuilder2();
833
- }
834
- /**
835
- * Add a meta shape as a generic to the root object
836
- * @see https://trpc.io/docs/v11/quickstart
837
- */
838
- meta() {
839
- return new TRPCBuilder2();
840
- }
841
- /**
842
- * Create the root object
843
- * @see https://trpc.io/docs/v11/server/routers#initialize-trpc
844
- */
845
- create(opts) {
846
- var _opts$transformer, _opts$isDev, _globalThis$process$1, _opts$allowOutsideOfS, _opts$errorFormatter, _opts$isServer;
847
- const config2 = (0, import_objectSpread23.default)((0, import_objectSpread23.default)({}, opts), {}, {
848
- transformer: getDataTransformer((_opts$transformer = opts === null || opts === void 0 ? void 0 : opts.transformer) !== null && _opts$transformer !== void 0 ? _opts$transformer : defaultTransformer),
849
- isDev: (_opts$isDev = opts === null || opts === void 0 ? void 0 : opts.isDev) !== null && _opts$isDev !== void 0 ? _opts$isDev : ((_globalThis$process$1 = globalThis.process) === null || _globalThis$process$1 === void 0 ? void 0 : _globalThis$process$1.env["NODE_ENV"]) !== "production",
850
- allowOutsideOfServer: (_opts$allowOutsideOfS = opts === null || opts === void 0 ? void 0 : opts.allowOutsideOfServer) !== null && _opts$allowOutsideOfS !== void 0 ? _opts$allowOutsideOfS : false,
851
- errorFormatter: (_opts$errorFormatter = opts === null || opts === void 0 ? void 0 : opts.errorFormatter) !== null && _opts$errorFormatter !== void 0 ? _opts$errorFormatter : defaultFormatter,
852
- isServer: (_opts$isServer = opts === null || opts === void 0 ? void 0 : opts.isServer) !== null && _opts$isServer !== void 0 ? _opts$isServer : isServerDefault,
853
- $types: null
854
- });
855
- {
856
- var _opts$isServer2;
857
- const isServer = (_opts$isServer2 = opts === null || opts === void 0 ? void 0 : opts.isServer) !== null && _opts$isServer2 !== void 0 ? _opts$isServer2 : isServerDefault;
858
- if (!isServer && (opts === null || opts === void 0 ? void 0 : opts.allowOutsideOfServer) !== true) throw new Error(`You're trying to use @trpc/server in a non-server environment. This is not supported by default.`);
859
- }
860
- return {
861
- _config: config2,
862
- procedure: createBuilder({ meta: opts === null || opts === void 0 ? void 0 : opts.defaultMeta }),
863
- middleware: createMiddlewareFactory(),
864
- router: createRouterFactory(config2),
865
- mergeRouters,
866
- createCallerFactory: createCallerFactory()
867
- };
868
- }
869
- };
870
- var initTRPC = new TRPCBuilder();
871
-
872
- // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
608
+ // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
873
609
  init_esm_shims();
874
610
 
875
611
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
@@ -1376,7 +1112,7 @@ __export(core_exports2, {
1376
1112
  parse: () => parse,
1377
1113
  parseAsync: () => parseAsync,
1378
1114
  prettifyError: () => prettifyError,
1379
- process: () => process2,
1115
+ process: () => process3,
1380
1116
  regexes: () => regexes_exports,
1381
1117
  registry: () => registry,
1382
1118
  safeDecode: () => safeDecode,
@@ -1416,12 +1152,12 @@ function $constructor(name, initializer3, params) {
1416
1152
  }
1417
1153
  inst._zod.traits.add(name);
1418
1154
  initializer3(inst, def);
1419
- const proto = _.prototype;
1420
- const keys = Object.keys(proto);
1155
+ const proto2 = _.prototype;
1156
+ const keys = Object.keys(proto2);
1421
1157
  for (let i = 0; i < keys.length; i++) {
1422
1158
  const k = keys[i];
1423
1159
  if (!(k in inst)) {
1424
- inst[k] = proto[k].bind(inst);
1160
+ inst[k] = proto2[k].bind(inst);
1425
1161
  }
1426
1162
  }
1427
1163
  }
@@ -1510,7 +1246,7 @@ __export(util_exports, {
1510
1246
  getParsedType: () => getParsedType,
1511
1247
  getSizableOrigin: () => getSizableOrigin,
1512
1248
  hexToUint8Array: () => hexToUint8Array,
1513
- isObject: () => isObject2,
1249
+ isObject: () => isObject,
1514
1250
  isPlainObject: () => isPlainObject,
1515
1251
  issue: () => issue,
1516
1252
  joinValues: () => joinValues,
@@ -1681,7 +1417,7 @@ function slugify(input) {
1681
1417
  }
1682
1418
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
1683
1419
  };
1684
- function isObject2(data) {
1420
+ function isObject(data) {
1685
1421
  return typeof data === "object" && data !== null && !Array.isArray(data);
1686
1422
  }
1687
1423
  var allowsEval = cached(() => {
@@ -1697,7 +1433,7 @@ var allowsEval = cached(() => {
1697
1433
  }
1698
1434
  });
1699
1435
  function isPlainObject(o) {
1700
- if (isObject2(o) === false)
1436
+ if (isObject(o) === false)
1701
1437
  return false;
1702
1438
  const ctor = o.constructor;
1703
1439
  if (ctor === void 0)
@@ -1705,7 +1441,7 @@ function isPlainObject(o) {
1705
1441
  if (typeof ctor !== "function")
1706
1442
  return true;
1707
1443
  const prot = ctor.prototype;
1708
- if (isObject2(prot) === false)
1444
+ if (isObject(prot) === false)
1709
1445
  return false;
1710
1446
  if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
1711
1447
  return false;
@@ -3872,7 +3608,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3872
3608
  }
3873
3609
  return propValues;
3874
3610
  });
3875
- const isObject3 = isObject2;
3611
+ const isObject3 = isObject;
3876
3612
  const catchall = def.catchall;
3877
3613
  let value;
3878
3614
  inst._zod.parse = (payload, ctx) => {
@@ -3976,7 +3712,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3976
3712
  return (payload, ctx) => fn(shape, payload, ctx);
3977
3713
  };
3978
3714
  let fastpass;
3979
- const isObject3 = isObject2;
3715
+ const isObject3 = isObject;
3980
3716
  const jit = !globalConfig.jitless;
3981
3717
  const allowsEval2 = allowsEval;
3982
3718
  const fastEnabled = jit && allowsEval2.value;
@@ -4163,7 +3899,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
4163
3899
  });
4164
3900
  inst._zod.parse = (payload, ctx) => {
4165
3901
  const input = payload.value;
4166
- if (!isObject2(input)) {
3902
+ if (!isObject(input)) {
4167
3903
  payload.issues.push({
4168
3904
  code: "invalid_type",
4169
3905
  expected: "object",
@@ -11852,7 +11588,7 @@ function initializeContext(params) {
11852
11588
  external: params?.external ?? void 0
11853
11589
  };
11854
11590
  }
11855
- function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
11591
+ function process3(schema, ctx, _params = { path: [], schemaPath: [] }) {
11856
11592
  var _a2;
11857
11593
  const def = schema._zod.def;
11858
11594
  const seen = ctx.seen.get(schema);
@@ -11889,7 +11625,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
11889
11625
  if (parent) {
11890
11626
  if (!result.ref)
11891
11627
  result.ref = parent;
11892
- process2(parent, ctx, params);
11628
+ process3(parent, ctx, params);
11893
11629
  ctx.seen.get(parent).isParent = true;
11894
11630
  }
11895
11631
  }
@@ -12170,14 +11906,14 @@ function isTransforming(_schema, _ctx) {
12170
11906
  }
12171
11907
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
12172
11908
  const ctx = initializeContext({ ...params, processors });
12173
- process2(schema, ctx);
11909
+ process3(schema, ctx);
12174
11910
  extractDefs(ctx, schema);
12175
11911
  return finalize(ctx, schema);
12176
11912
  };
12177
11913
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
12178
11914
  const { libraryOptions, target } = params ?? {};
12179
11915
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
12180
- process2(schema, ctx);
11916
+ process3(schema, ctx);
12181
11917
  extractDefs(ctx, schema);
12182
11918
  return finalize(ctx, schema);
12183
11919
  };
@@ -12435,7 +12171,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
12435
12171
  if (typeof maximum === "number")
12436
12172
  json2.maxItems = maximum;
12437
12173
  json2.type = "array";
12438
- json2.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
12174
+ json2.items = process3(def.element, ctx, { ...params, path: [...params.path, "items"] });
12439
12175
  };
12440
12176
  var objectProcessor = (schema, ctx, _json, params) => {
12441
12177
  const json2 = _json;
@@ -12444,7 +12180,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12444
12180
  json2.properties = {};
12445
12181
  const shape = def.shape;
12446
12182
  for (const key in shape) {
12447
- json2.properties[key] = process2(shape[key], ctx, {
12183
+ json2.properties[key] = process3(shape[key], ctx, {
12448
12184
  ...params,
12449
12185
  path: [...params.path, "properties", key]
12450
12186
  });
@@ -12467,7 +12203,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12467
12203
  if (ctx.io === "output")
12468
12204
  json2.additionalProperties = false;
12469
12205
  } else if (def.catchall) {
12470
- json2.additionalProperties = process2(def.catchall, ctx, {
12206
+ json2.additionalProperties = process3(def.catchall, ctx, {
12471
12207
  ...params,
12472
12208
  path: [...params.path, "additionalProperties"]
12473
12209
  });
@@ -12476,7 +12212,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12476
12212
  var unionProcessor = (schema, ctx, json2, params) => {
12477
12213
  const def = schema._zod.def;
12478
12214
  const isExclusive = def.inclusive === false;
12479
- const options = def.options.map((x, i) => process2(x, ctx, {
12215
+ const options = def.options.map((x, i) => process3(x, ctx, {
12480
12216
  ...params,
12481
12217
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
12482
12218
  }));
@@ -12488,11 +12224,11 @@ var unionProcessor = (schema, ctx, json2, params) => {
12488
12224
  };
12489
12225
  var intersectionProcessor = (schema, ctx, json2, params) => {
12490
12226
  const def = schema._zod.def;
12491
- const a = process2(def.left, ctx, {
12227
+ const a = process3(def.left, ctx, {
12492
12228
  ...params,
12493
12229
  path: [...params.path, "allOf", 0]
12494
12230
  });
12495
- const b = process2(def.right, ctx, {
12231
+ const b = process3(def.right, ctx, {
12496
12232
  ...params,
12497
12233
  path: [...params.path, "allOf", 1]
12498
12234
  });
@@ -12509,11 +12245,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
12509
12245
  json2.type = "array";
12510
12246
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
12511
12247
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
12512
- const prefixItems = def.items.map((x, i) => process2(x, ctx, {
12248
+ const prefixItems = def.items.map((x, i) => process3(x, ctx, {
12513
12249
  ...params,
12514
12250
  path: [...params.path, prefixPath, i]
12515
12251
  }));
12516
- const rest = def.rest ? process2(def.rest, ctx, {
12252
+ const rest = def.rest ? process3(def.rest, ctx, {
12517
12253
  ...params,
12518
12254
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
12519
12255
  }) : null;
@@ -12553,7 +12289,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
12553
12289
  const keyBag = keyType._zod.bag;
12554
12290
  const patterns = keyBag?.patterns;
12555
12291
  if (def.mode === "loose" && patterns && patterns.size > 0) {
12556
- const valueSchema = process2(def.valueType, ctx, {
12292
+ const valueSchema = process3(def.valueType, ctx, {
12557
12293
  ...params,
12558
12294
  path: [...params.path, "patternProperties", "*"]
12559
12295
  });
@@ -12563,12 +12299,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
12563
12299
  }
12564
12300
  } else {
12565
12301
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
12566
- json2.propertyNames = process2(def.keyType, ctx, {
12302
+ json2.propertyNames = process3(def.keyType, ctx, {
12567
12303
  ...params,
12568
12304
  path: [...params.path, "propertyNames"]
12569
12305
  });
12570
12306
  }
12571
- json2.additionalProperties = process2(def.valueType, ctx, {
12307
+ json2.additionalProperties = process3(def.valueType, ctx, {
12572
12308
  ...params,
12573
12309
  path: [...params.path, "additionalProperties"]
12574
12310
  });
@@ -12583,7 +12319,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
12583
12319
  };
12584
12320
  var nullableProcessor = (schema, ctx, json2, params) => {
12585
12321
  const def = schema._zod.def;
12586
- const inner = process2(def.innerType, ctx, params);
12322
+ const inner = process3(def.innerType, ctx, params);
12587
12323
  const seen = ctx.seen.get(schema);
12588
12324
  if (ctx.target === "openapi-3.0") {
12589
12325
  seen.ref = def.innerType;
@@ -12594,20 +12330,20 @@ var nullableProcessor = (schema, ctx, json2, params) => {
12594
12330
  };
12595
12331
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
12596
12332
  const def = schema._zod.def;
12597
- process2(def.innerType, ctx, params);
12333
+ process3(def.innerType, ctx, params);
12598
12334
  const seen = ctx.seen.get(schema);
12599
12335
  seen.ref = def.innerType;
12600
12336
  };
12601
12337
  var defaultProcessor = (schema, ctx, json2, params) => {
12602
12338
  const def = schema._zod.def;
12603
- process2(def.innerType, ctx, params);
12339
+ process3(def.innerType, ctx, params);
12604
12340
  const seen = ctx.seen.get(schema);
12605
12341
  seen.ref = def.innerType;
12606
12342
  json2.default = JSON.parse(JSON.stringify(def.defaultValue));
12607
12343
  };
12608
12344
  var prefaultProcessor = (schema, ctx, json2, params) => {
12609
12345
  const def = schema._zod.def;
12610
- process2(def.innerType, ctx, params);
12346
+ process3(def.innerType, ctx, params);
12611
12347
  const seen = ctx.seen.get(schema);
12612
12348
  seen.ref = def.innerType;
12613
12349
  if (ctx.io === "input")
@@ -12615,7 +12351,7 @@ var prefaultProcessor = (schema, ctx, json2, params) => {
12615
12351
  };
12616
12352
  var catchProcessor = (schema, ctx, json2, params) => {
12617
12353
  const def = schema._zod.def;
12618
- process2(def.innerType, ctx, params);
12354
+ process3(def.innerType, ctx, params);
12619
12355
  const seen = ctx.seen.get(schema);
12620
12356
  seen.ref = def.innerType;
12621
12357
  let catchValue;
@@ -12629,32 +12365,32 @@ var catchProcessor = (schema, ctx, json2, params) => {
12629
12365
  var pipeProcessor = (schema, ctx, _json, params) => {
12630
12366
  const def = schema._zod.def;
12631
12367
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
12632
- process2(innerType, ctx, params);
12368
+ process3(innerType, ctx, params);
12633
12369
  const seen = ctx.seen.get(schema);
12634
12370
  seen.ref = innerType;
12635
12371
  };
12636
12372
  var readonlyProcessor = (schema, ctx, json2, params) => {
12637
12373
  const def = schema._zod.def;
12638
- process2(def.innerType, ctx, params);
12374
+ process3(def.innerType, ctx, params);
12639
12375
  const seen = ctx.seen.get(schema);
12640
12376
  seen.ref = def.innerType;
12641
12377
  json2.readOnly = true;
12642
12378
  };
12643
12379
  var promiseProcessor = (schema, ctx, _json, params) => {
12644
12380
  const def = schema._zod.def;
12645
- process2(def.innerType, ctx, params);
12381
+ process3(def.innerType, ctx, params);
12646
12382
  const seen = ctx.seen.get(schema);
12647
12383
  seen.ref = def.innerType;
12648
12384
  };
12649
12385
  var optionalProcessor = (schema, ctx, _json, params) => {
12650
12386
  const def = schema._zod.def;
12651
- process2(def.innerType, ctx, params);
12387
+ process3(def.innerType, ctx, params);
12652
12388
  const seen = ctx.seen.get(schema);
12653
12389
  seen.ref = def.innerType;
12654
12390
  };
12655
12391
  var lazyProcessor = (schema, ctx, _json, params) => {
12656
12392
  const innerType = schema._zod.innerType;
12657
- process2(innerType, ctx, params);
12393
+ process3(innerType, ctx, params);
12658
12394
  const seen = ctx.seen.get(schema);
12659
12395
  seen.ref = innerType;
12660
12396
  };
@@ -12706,7 +12442,7 @@ function toJSONSchema(input, params) {
12706
12442
  const defs = {};
12707
12443
  for (const entry of registry2._idmap.entries()) {
12708
12444
  const [_, schema] = entry;
12709
- process2(schema, ctx2);
12445
+ process3(schema, ctx2);
12710
12446
  }
12711
12447
  const schemas = {};
12712
12448
  const external = {
@@ -12729,7 +12465,7 @@ function toJSONSchema(input, params) {
12729
12465
  return { schemas };
12730
12466
  }
12731
12467
  const ctx = initializeContext({ ...params, processors: allProcessors });
12732
- process2(input, ctx);
12468
+ process3(input, ctx);
12733
12469
  extractDefs(ctx, input);
12734
12470
  return finalize(ctx, input);
12735
12471
  }
@@ -12788,7 +12524,7 @@ var JSONSchemaGenerator = class {
12788
12524
  * This must be called before emit().
12789
12525
  */
12790
12526
  process(schema, _params = { path: [], schemaPath: [] }) {
12791
- return process2(schema, this.ctx, _params);
12527
+ return process3(schema, this.ctx, _params);
12792
12528
  }
12793
12529
  /**
12794
12530
  * Emit the final JSON Schema after processing.
@@ -14156,578 +13892,2329 @@ function custom(fn, _params) {
14156
13892
  function refine(fn, _params = {}) {
14157
13893
  return _refine(ZodCustom, fn, _params);
14158
13894
  }
14159
- function superRefine(fn) {
14160
- return _superRefine(fn);
13895
+ function superRefine(fn) {
13896
+ return _superRefine(fn);
13897
+ }
13898
+ var describe2 = describe;
13899
+ var meta2 = meta;
13900
+ function _instanceof(cls, params = {}) {
13901
+ const inst = new ZodCustom({
13902
+ type: "custom",
13903
+ check: "custom",
13904
+ fn: (data) => data instanceof cls,
13905
+ abort: true,
13906
+ ...util_exports.normalizeParams(params)
13907
+ });
13908
+ inst._zod.bag.Class = cls;
13909
+ inst._zod.check = (payload) => {
13910
+ if (!(payload.value instanceof cls)) {
13911
+ payload.issues.push({
13912
+ code: "invalid_type",
13913
+ expected: cls.name,
13914
+ input: payload.value,
13915
+ inst,
13916
+ path: [...inst._zod.def.path ?? []]
13917
+ });
13918
+ }
13919
+ };
13920
+ return inst;
13921
+ }
13922
+ var stringbool = (...args) => _stringbool({
13923
+ Codec: ZodCodec,
13924
+ Boolean: ZodBoolean,
13925
+ String: ZodString
13926
+ }, ...args);
13927
+ function json(params) {
13928
+ const jsonSchema = lazy(() => {
13929
+ return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
13930
+ });
13931
+ return jsonSchema;
13932
+ }
13933
+ function preprocess(fn, schema) {
13934
+ return pipe(transform(fn), schema);
13935
+ }
13936
+
13937
+ // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/compat.js
13938
+ init_esm_shims();
13939
+ var ZodIssueCode = {
13940
+ invalid_type: "invalid_type",
13941
+ too_big: "too_big",
13942
+ too_small: "too_small",
13943
+ invalid_format: "invalid_format",
13944
+ not_multiple_of: "not_multiple_of",
13945
+ unrecognized_keys: "unrecognized_keys",
13946
+ invalid_union: "invalid_union",
13947
+ invalid_key: "invalid_key",
13948
+ invalid_element: "invalid_element",
13949
+ invalid_value: "invalid_value",
13950
+ custom: "custom"
13951
+ };
13952
+ function setErrorMap(map2) {
13953
+ config({
13954
+ customError: map2
13955
+ });
13956
+ }
13957
+ function getErrorMap() {
13958
+ return config().customError;
13959
+ }
13960
+ var ZodFirstPartyTypeKind;
13961
+ /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
13962
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
13963
+
13964
+ // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js
13965
+ init_esm_shims();
13966
+ var z = {
13967
+ ...schemas_exports2,
13968
+ ...checks_exports2,
13969
+ iso: iso_exports
13970
+ };
13971
+ var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
13972
+ // Schema identification
13973
+ "$schema",
13974
+ "$ref",
13975
+ "$defs",
13976
+ "definitions",
13977
+ // Core schema keywords
13978
+ "$id",
13979
+ "id",
13980
+ "$comment",
13981
+ "$anchor",
13982
+ "$vocabulary",
13983
+ "$dynamicRef",
13984
+ "$dynamicAnchor",
13985
+ // Type
13986
+ "type",
13987
+ "enum",
13988
+ "const",
13989
+ // Composition
13990
+ "anyOf",
13991
+ "oneOf",
13992
+ "allOf",
13993
+ "not",
13994
+ // Object
13995
+ "properties",
13996
+ "required",
13997
+ "additionalProperties",
13998
+ "patternProperties",
13999
+ "propertyNames",
14000
+ "minProperties",
14001
+ "maxProperties",
14002
+ // Array
14003
+ "items",
14004
+ "prefixItems",
14005
+ "additionalItems",
14006
+ "minItems",
14007
+ "maxItems",
14008
+ "uniqueItems",
14009
+ "contains",
14010
+ "minContains",
14011
+ "maxContains",
14012
+ // String
14013
+ "minLength",
14014
+ "maxLength",
14015
+ "pattern",
14016
+ "format",
14017
+ // Number
14018
+ "minimum",
14019
+ "maximum",
14020
+ "exclusiveMinimum",
14021
+ "exclusiveMaximum",
14022
+ "multipleOf",
14023
+ // Already handled metadata
14024
+ "description",
14025
+ "default",
14026
+ // Content
14027
+ "contentEncoding",
14028
+ "contentMediaType",
14029
+ "contentSchema",
14030
+ // Unsupported (error-throwing)
14031
+ "unevaluatedItems",
14032
+ "unevaluatedProperties",
14033
+ "if",
14034
+ "then",
14035
+ "else",
14036
+ "dependentSchemas",
14037
+ "dependentRequired",
14038
+ // OpenAPI
14039
+ "nullable",
14040
+ "readOnly"
14041
+ ]);
14042
+ function detectVersion(schema, defaultTarget) {
14043
+ const $schema = schema.$schema;
14044
+ if ($schema === "https://json-schema.org/draft/2020-12/schema") {
14045
+ return "draft-2020-12";
14046
+ }
14047
+ if ($schema === "http://json-schema.org/draft-07/schema#") {
14048
+ return "draft-7";
14049
+ }
14050
+ if ($schema === "http://json-schema.org/draft-04/schema#") {
14051
+ return "draft-4";
14052
+ }
14053
+ return defaultTarget ?? "draft-2020-12";
14054
+ }
14055
+ function resolveRef(ref, ctx) {
14056
+ if (!ref.startsWith("#")) {
14057
+ throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14058
+ }
14059
+ const path = ref.slice(1).split("/").filter(Boolean);
14060
+ if (path.length === 0) {
14061
+ return ctx.rootSchema;
14062
+ }
14063
+ const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14064
+ if (path[0] === defsKey) {
14065
+ const key = path[1];
14066
+ if (!key || !ctx.defs[key]) {
14067
+ throw new Error(`Reference not found: ${ref}`);
14068
+ }
14069
+ return ctx.defs[key];
14070
+ }
14071
+ throw new Error(`Reference not found: ${ref}`);
14161
14072
  }
14162
- var describe2 = describe;
14163
- var meta2 = meta;
14164
- function _instanceof(cls, params = {}) {
14165
- const inst = new ZodCustom({
14166
- type: "custom",
14167
- check: "custom",
14168
- fn: (data) => data instanceof cls,
14169
- abort: true,
14170
- ...util_exports.normalizeParams(params)
14171
- });
14172
- inst._zod.bag.Class = cls;
14173
- inst._zod.check = (payload) => {
14174
- if (!(payload.value instanceof cls)) {
14175
- payload.issues.push({
14176
- code: "invalid_type",
14177
- expected: cls.name,
14178
- input: payload.value,
14179
- inst,
14180
- path: [...inst._zod.def.path ?? []]
14073
+ function convertBaseSchema(schema, ctx) {
14074
+ if (schema.not !== void 0) {
14075
+ if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
14076
+ return z.never();
14077
+ }
14078
+ throw new Error("not is not supported in Zod (except { not: {} } for never)");
14079
+ }
14080
+ if (schema.unevaluatedItems !== void 0) {
14081
+ throw new Error("unevaluatedItems is not supported");
14082
+ }
14083
+ if (schema.unevaluatedProperties !== void 0) {
14084
+ throw new Error("unevaluatedProperties is not supported");
14085
+ }
14086
+ if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0) {
14087
+ throw new Error("Conditional schemas (if/then/else) are not supported");
14088
+ }
14089
+ if (schema.dependentSchemas !== void 0 || schema.dependentRequired !== void 0) {
14090
+ throw new Error("dependentSchemas and dependentRequired are not supported");
14091
+ }
14092
+ if (schema.$ref) {
14093
+ const refPath = schema.$ref;
14094
+ if (ctx.refs.has(refPath)) {
14095
+ return ctx.refs.get(refPath);
14096
+ }
14097
+ if (ctx.processing.has(refPath)) {
14098
+ return z.lazy(() => {
14099
+ if (!ctx.refs.has(refPath)) {
14100
+ throw new Error(`Circular reference not resolved: ${refPath}`);
14101
+ }
14102
+ return ctx.refs.get(refPath);
14181
14103
  });
14182
14104
  }
14183
- };
14184
- return inst;
14185
- }
14186
- var stringbool = (...args) => _stringbool({
14187
- Codec: ZodCodec,
14188
- Boolean: ZodBoolean,
14189
- String: ZodString
14190
- }, ...args);
14191
- function json(params) {
14192
- const jsonSchema = lazy(() => {
14193
- return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
14194
- });
14195
- return jsonSchema;
14196
- }
14197
- function preprocess(fn, schema) {
14198
- return pipe(transform(fn), schema);
14199
- }
14200
-
14201
- // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/compat.js
14202
- init_esm_shims();
14203
- var ZodIssueCode = {
14204
- invalid_type: "invalid_type",
14205
- too_big: "too_big",
14206
- too_small: "too_small",
14207
- invalid_format: "invalid_format",
14208
- not_multiple_of: "not_multiple_of",
14209
- unrecognized_keys: "unrecognized_keys",
14210
- invalid_union: "invalid_union",
14211
- invalid_key: "invalid_key",
14212
- invalid_element: "invalid_element",
14213
- invalid_value: "invalid_value",
14214
- custom: "custom"
14215
- };
14216
- function setErrorMap(map2) {
14217
- config({
14218
- customError: map2
14219
- });
14220
- }
14221
- function getErrorMap() {
14222
- return config().customError;
14105
+ ctx.processing.add(refPath);
14106
+ const resolved = resolveRef(refPath, ctx);
14107
+ const zodSchema2 = convertSchema(resolved, ctx);
14108
+ ctx.refs.set(refPath, zodSchema2);
14109
+ ctx.processing.delete(refPath);
14110
+ return zodSchema2;
14111
+ }
14112
+ if (schema.enum !== void 0) {
14113
+ const enumValues = schema.enum;
14114
+ if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
14115
+ return z.null();
14116
+ }
14117
+ if (enumValues.length === 0) {
14118
+ return z.never();
14119
+ }
14120
+ if (enumValues.length === 1) {
14121
+ return z.literal(enumValues[0]);
14122
+ }
14123
+ if (enumValues.every((v) => typeof v === "string")) {
14124
+ return z.enum(enumValues);
14125
+ }
14126
+ const literalSchemas = enumValues.map((v) => z.literal(v));
14127
+ if (literalSchemas.length < 2) {
14128
+ return literalSchemas[0];
14129
+ }
14130
+ return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
14131
+ }
14132
+ if (schema.const !== void 0) {
14133
+ return z.literal(schema.const);
14134
+ }
14135
+ const type = schema.type;
14136
+ if (Array.isArray(type)) {
14137
+ const typeSchemas = type.map((t2) => {
14138
+ const typeSchema = { ...schema, type: t2 };
14139
+ return convertBaseSchema(typeSchema, ctx);
14140
+ });
14141
+ if (typeSchemas.length === 0) {
14142
+ return z.never();
14143
+ }
14144
+ if (typeSchemas.length === 1) {
14145
+ return typeSchemas[0];
14146
+ }
14147
+ return z.union(typeSchemas);
14148
+ }
14149
+ if (!type) {
14150
+ return z.any();
14151
+ }
14152
+ let zodSchema;
14153
+ switch (type) {
14154
+ case "string": {
14155
+ let stringSchema = z.string();
14156
+ if (schema.format) {
14157
+ const format = schema.format;
14158
+ if (format === "email") {
14159
+ stringSchema = stringSchema.check(z.email());
14160
+ } else if (format === "uri" || format === "uri-reference") {
14161
+ stringSchema = stringSchema.check(z.url());
14162
+ } else if (format === "uuid" || format === "guid") {
14163
+ stringSchema = stringSchema.check(z.uuid());
14164
+ } else if (format === "date-time") {
14165
+ stringSchema = stringSchema.check(z.iso.datetime());
14166
+ } else if (format === "date") {
14167
+ stringSchema = stringSchema.check(z.iso.date());
14168
+ } else if (format === "time") {
14169
+ stringSchema = stringSchema.check(z.iso.time());
14170
+ } else if (format === "duration") {
14171
+ stringSchema = stringSchema.check(z.iso.duration());
14172
+ } else if (format === "ipv4") {
14173
+ stringSchema = stringSchema.check(z.ipv4());
14174
+ } else if (format === "ipv6") {
14175
+ stringSchema = stringSchema.check(z.ipv6());
14176
+ } else if (format === "mac") {
14177
+ stringSchema = stringSchema.check(z.mac());
14178
+ } else if (format === "cidr") {
14179
+ stringSchema = stringSchema.check(z.cidrv4());
14180
+ } else if (format === "cidr-v6") {
14181
+ stringSchema = stringSchema.check(z.cidrv6());
14182
+ } else if (format === "base64") {
14183
+ stringSchema = stringSchema.check(z.base64());
14184
+ } else if (format === "base64url") {
14185
+ stringSchema = stringSchema.check(z.base64url());
14186
+ } else if (format === "e164") {
14187
+ stringSchema = stringSchema.check(z.e164());
14188
+ } else if (format === "jwt") {
14189
+ stringSchema = stringSchema.check(z.jwt());
14190
+ } else if (format === "emoji") {
14191
+ stringSchema = stringSchema.check(z.emoji());
14192
+ } else if (format === "nanoid") {
14193
+ stringSchema = stringSchema.check(z.nanoid());
14194
+ } else if (format === "cuid") {
14195
+ stringSchema = stringSchema.check(z.cuid());
14196
+ } else if (format === "cuid2") {
14197
+ stringSchema = stringSchema.check(z.cuid2());
14198
+ } else if (format === "ulid") {
14199
+ stringSchema = stringSchema.check(z.ulid());
14200
+ } else if (format === "xid") {
14201
+ stringSchema = stringSchema.check(z.xid());
14202
+ } else if (format === "ksuid") {
14203
+ stringSchema = stringSchema.check(z.ksuid());
14204
+ }
14205
+ }
14206
+ if (typeof schema.minLength === "number") {
14207
+ stringSchema = stringSchema.min(schema.minLength);
14208
+ }
14209
+ if (typeof schema.maxLength === "number") {
14210
+ stringSchema = stringSchema.max(schema.maxLength);
14211
+ }
14212
+ if (schema.pattern) {
14213
+ stringSchema = stringSchema.regex(new RegExp(schema.pattern));
14214
+ }
14215
+ zodSchema = stringSchema;
14216
+ break;
14217
+ }
14218
+ case "number":
14219
+ case "integer": {
14220
+ let numberSchema = type === "integer" ? z.number().int() : z.number();
14221
+ if (typeof schema.minimum === "number") {
14222
+ numberSchema = numberSchema.min(schema.minimum);
14223
+ }
14224
+ if (typeof schema.maximum === "number") {
14225
+ numberSchema = numberSchema.max(schema.maximum);
14226
+ }
14227
+ if (typeof schema.exclusiveMinimum === "number") {
14228
+ numberSchema = numberSchema.gt(schema.exclusiveMinimum);
14229
+ } else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
14230
+ numberSchema = numberSchema.gt(schema.minimum);
14231
+ }
14232
+ if (typeof schema.exclusiveMaximum === "number") {
14233
+ numberSchema = numberSchema.lt(schema.exclusiveMaximum);
14234
+ } else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
14235
+ numberSchema = numberSchema.lt(schema.maximum);
14236
+ }
14237
+ if (typeof schema.multipleOf === "number") {
14238
+ numberSchema = numberSchema.multipleOf(schema.multipleOf);
14239
+ }
14240
+ zodSchema = numberSchema;
14241
+ break;
14242
+ }
14243
+ case "boolean": {
14244
+ zodSchema = z.boolean();
14245
+ break;
14246
+ }
14247
+ case "null": {
14248
+ zodSchema = z.null();
14249
+ break;
14250
+ }
14251
+ case "object": {
14252
+ const shape = {};
14253
+ const properties = schema.properties || {};
14254
+ const requiredSet = new Set(schema.required || []);
14255
+ for (const [key, propSchema] of Object.entries(properties)) {
14256
+ const propZodSchema = convertSchema(propSchema, ctx);
14257
+ shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
14258
+ }
14259
+ if (schema.propertyNames) {
14260
+ const keySchema = convertSchema(schema.propertyNames, ctx);
14261
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
14262
+ if (Object.keys(shape).length === 0) {
14263
+ zodSchema = z.record(keySchema, valueSchema);
14264
+ break;
14265
+ }
14266
+ const objectSchema2 = z.object(shape).passthrough();
14267
+ const recordSchema = z.looseRecord(keySchema, valueSchema);
14268
+ zodSchema = z.intersection(objectSchema2, recordSchema);
14269
+ break;
14270
+ }
14271
+ if (schema.patternProperties) {
14272
+ const patternProps = schema.patternProperties;
14273
+ const patternKeys = Object.keys(patternProps);
14274
+ const looseRecords = [];
14275
+ for (const pattern of patternKeys) {
14276
+ const patternValue = convertSchema(patternProps[pattern], ctx);
14277
+ const keySchema = z.string().regex(new RegExp(pattern));
14278
+ looseRecords.push(z.looseRecord(keySchema, patternValue));
14279
+ }
14280
+ const schemasToIntersect = [];
14281
+ if (Object.keys(shape).length > 0) {
14282
+ schemasToIntersect.push(z.object(shape).passthrough());
14283
+ }
14284
+ schemasToIntersect.push(...looseRecords);
14285
+ if (schemasToIntersect.length === 0) {
14286
+ zodSchema = z.object({}).passthrough();
14287
+ } else if (schemasToIntersect.length === 1) {
14288
+ zodSchema = schemasToIntersect[0];
14289
+ } else {
14290
+ let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
14291
+ for (let i = 2; i < schemasToIntersect.length; i++) {
14292
+ result = z.intersection(result, schemasToIntersect[i]);
14293
+ }
14294
+ zodSchema = result;
14295
+ }
14296
+ break;
14297
+ }
14298
+ const objectSchema = z.object(shape);
14299
+ if (schema.additionalProperties === false) {
14300
+ zodSchema = objectSchema.strict();
14301
+ } else if (typeof schema.additionalProperties === "object") {
14302
+ zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
14303
+ } else {
14304
+ zodSchema = objectSchema.passthrough();
14305
+ }
14306
+ break;
14307
+ }
14308
+ case "array": {
14309
+ const prefixItems = schema.prefixItems;
14310
+ const items = schema.items;
14311
+ if (prefixItems && Array.isArray(prefixItems)) {
14312
+ const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
14313
+ const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
14314
+ if (rest) {
14315
+ zodSchema = z.tuple(tupleItems).rest(rest);
14316
+ } else {
14317
+ zodSchema = z.tuple(tupleItems);
14318
+ }
14319
+ if (typeof schema.minItems === "number") {
14320
+ zodSchema = zodSchema.check(z.minLength(schema.minItems));
14321
+ }
14322
+ if (typeof schema.maxItems === "number") {
14323
+ zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
14324
+ }
14325
+ } else if (Array.isArray(items)) {
14326
+ const tupleItems = items.map((item) => convertSchema(item, ctx));
14327
+ const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
14328
+ if (rest) {
14329
+ zodSchema = z.tuple(tupleItems).rest(rest);
14330
+ } else {
14331
+ zodSchema = z.tuple(tupleItems);
14332
+ }
14333
+ if (typeof schema.minItems === "number") {
14334
+ zodSchema = zodSchema.check(z.minLength(schema.minItems));
14335
+ }
14336
+ if (typeof schema.maxItems === "number") {
14337
+ zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
14338
+ }
14339
+ } else if (items !== void 0) {
14340
+ const element = convertSchema(items, ctx);
14341
+ let arraySchema = z.array(element);
14342
+ if (typeof schema.minItems === "number") {
14343
+ arraySchema = arraySchema.min(schema.minItems);
14344
+ }
14345
+ if (typeof schema.maxItems === "number") {
14346
+ arraySchema = arraySchema.max(schema.maxItems);
14347
+ }
14348
+ zodSchema = arraySchema;
14349
+ } else {
14350
+ zodSchema = z.array(z.any());
14351
+ }
14352
+ break;
14353
+ }
14354
+ default:
14355
+ throw new Error(`Unsupported type: ${type}`);
14356
+ }
14357
+ if (schema.description) {
14358
+ zodSchema = zodSchema.describe(schema.description);
14359
+ }
14360
+ if (schema.default !== void 0) {
14361
+ zodSchema = zodSchema.default(schema.default);
14362
+ }
14363
+ return zodSchema;
14223
14364
  }
14224
- var ZodFirstPartyTypeKind;
14225
- /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
14226
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
14227
-
14228
- // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js
14229
- init_esm_shims();
14230
- var z = {
14231
- ...schemas_exports2,
14232
- ...checks_exports2,
14233
- iso: iso_exports
14234
- };
14235
- var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
14236
- // Schema identification
14237
- "$schema",
14238
- "$ref",
14239
- "$defs",
14240
- "definitions",
14241
- // Core schema keywords
14242
- "$id",
14243
- "id",
14244
- "$comment",
14245
- "$anchor",
14246
- "$vocabulary",
14247
- "$dynamicRef",
14248
- "$dynamicAnchor",
14249
- // Type
14250
- "type",
14251
- "enum",
14252
- "const",
14253
- // Composition
14254
- "anyOf",
14255
- "oneOf",
14256
- "allOf",
14257
- "not",
14258
- // Object
14259
- "properties",
14260
- "required",
14261
- "additionalProperties",
14262
- "patternProperties",
14263
- "propertyNames",
14264
- "minProperties",
14265
- "maxProperties",
14266
- // Array
14267
- "items",
14268
- "prefixItems",
14269
- "additionalItems",
14270
- "minItems",
14271
- "maxItems",
14272
- "uniqueItems",
14273
- "contains",
14274
- "minContains",
14275
- "maxContains",
14276
- // String
14277
- "minLength",
14278
- "maxLength",
14279
- "pattern",
14280
- "format",
14281
- // Number
14282
- "minimum",
14283
- "maximum",
14284
- "exclusiveMinimum",
14285
- "exclusiveMaximum",
14286
- "multipleOf",
14287
- // Already handled metadata
14288
- "description",
14289
- "default",
14290
- // Content
14291
- "contentEncoding",
14292
- "contentMediaType",
14293
- "contentSchema",
14294
- // Unsupported (error-throwing)
14295
- "unevaluatedItems",
14296
- "unevaluatedProperties",
14297
- "if",
14298
- "then",
14299
- "else",
14300
- "dependentSchemas",
14301
- "dependentRequired",
14302
- // OpenAPI
14303
- "nullable",
14304
- "readOnly"
14305
- ]);
14306
- function detectVersion(schema, defaultTarget) {
14307
- const $schema = schema.$schema;
14308
- if ($schema === "https://json-schema.org/draft/2020-12/schema") {
14309
- return "draft-2020-12";
14365
+ function convertSchema(schema, ctx) {
14366
+ if (typeof schema === "boolean") {
14367
+ return schema ? z.any() : z.never();
14310
14368
  }
14311
- if ($schema === "http://json-schema.org/draft-07/schema#") {
14312
- return "draft-7";
14369
+ let baseSchema = convertBaseSchema(schema, ctx);
14370
+ const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
14371
+ if (schema.anyOf && Array.isArray(schema.anyOf)) {
14372
+ const options = schema.anyOf.map((s) => convertSchema(s, ctx));
14373
+ const anyOfUnion = z.union(options);
14374
+ baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
14313
14375
  }
14314
- if ($schema === "http://json-schema.org/draft-04/schema#") {
14315
- return "draft-4";
14376
+ if (schema.oneOf && Array.isArray(schema.oneOf)) {
14377
+ const options = schema.oneOf.map((s) => convertSchema(s, ctx));
14378
+ const oneOfUnion = z.xor(options);
14379
+ baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
14380
+ }
14381
+ if (schema.allOf && Array.isArray(schema.allOf)) {
14382
+ if (schema.allOf.length === 0) {
14383
+ baseSchema = hasExplicitType ? baseSchema : z.any();
14384
+ } else {
14385
+ let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
14386
+ const startIdx = hasExplicitType ? 0 : 1;
14387
+ for (let i = startIdx; i < schema.allOf.length; i++) {
14388
+ result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
14389
+ }
14390
+ baseSchema = result;
14391
+ }
14316
14392
  }
14317
- return defaultTarget ?? "draft-2020-12";
14318
- }
14319
- function resolveRef(ref, ctx) {
14320
- if (!ref.startsWith("#")) {
14321
- throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14393
+ if (schema.nullable === true && ctx.version === "openapi-3.0") {
14394
+ baseSchema = z.nullable(baseSchema);
14322
14395
  }
14323
- const path = ref.slice(1).split("/").filter(Boolean);
14324
- if (path.length === 0) {
14325
- return ctx.rootSchema;
14396
+ if (schema.readOnly === true) {
14397
+ baseSchema = z.readonly(baseSchema);
14326
14398
  }
14327
- const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14328
- if (path[0] === defsKey) {
14329
- const key = path[1];
14330
- if (!key || !ctx.defs[key]) {
14331
- throw new Error(`Reference not found: ${ref}`);
14399
+ const extraMeta = {};
14400
+ const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
14401
+ for (const key of coreMetadataKeys) {
14402
+ if (key in schema) {
14403
+ extraMeta[key] = schema[key];
14332
14404
  }
14333
- return ctx.defs[key];
14334
14405
  }
14335
- throw new Error(`Reference not found: ${ref}`);
14336
- }
14337
- function convertBaseSchema(schema, ctx) {
14338
- if (schema.not !== void 0) {
14339
- if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
14340
- return z.never();
14406
+ const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
14407
+ for (const key of contentMetadataKeys) {
14408
+ if (key in schema) {
14409
+ extraMeta[key] = schema[key];
14341
14410
  }
14342
- throw new Error("not is not supported in Zod (except { not: {} } for never)");
14343
- }
14344
- if (schema.unevaluatedItems !== void 0) {
14345
- throw new Error("unevaluatedItems is not supported");
14346
14411
  }
14347
- if (schema.unevaluatedProperties !== void 0) {
14348
- throw new Error("unevaluatedProperties is not supported");
14412
+ for (const key of Object.keys(schema)) {
14413
+ if (!RECOGNIZED_KEYS.has(key)) {
14414
+ extraMeta[key] = schema[key];
14415
+ }
14349
14416
  }
14350
- if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0) {
14351
- throw new Error("Conditional schemas (if/then/else) are not supported");
14417
+ if (Object.keys(extraMeta).length > 0) {
14418
+ ctx.registry.add(baseSchema, extraMeta);
14352
14419
  }
14353
- if (schema.dependentSchemas !== void 0 || schema.dependentRequired !== void 0) {
14354
- throw new Error("dependentSchemas and dependentRequired are not supported");
14420
+ return baseSchema;
14421
+ }
14422
+ function fromJSONSchema(schema, params) {
14423
+ if (typeof schema === "boolean") {
14424
+ return schema ? z.any() : z.never();
14355
14425
  }
14356
- if (schema.$ref) {
14357
- const refPath = schema.$ref;
14358
- if (ctx.refs.has(refPath)) {
14359
- return ctx.refs.get(refPath);
14360
- }
14361
- if (ctx.processing.has(refPath)) {
14362
- return z.lazy(() => {
14363
- if (!ctx.refs.has(refPath)) {
14364
- throw new Error(`Circular reference not resolved: ${refPath}`);
14365
- }
14366
- return ctx.refs.get(refPath);
14367
- });
14368
- }
14369
- ctx.processing.add(refPath);
14370
- const resolved = resolveRef(refPath, ctx);
14371
- const zodSchema2 = convertSchema(resolved, ctx);
14372
- ctx.refs.set(refPath, zodSchema2);
14373
- ctx.processing.delete(refPath);
14374
- return zodSchema2;
14426
+ const version2 = detectVersion(schema, params?.defaultTarget);
14427
+ const defs = schema.$defs || schema.definitions || {};
14428
+ const ctx = {
14429
+ version: version2,
14430
+ defs,
14431
+ refs: /* @__PURE__ */ new Map(),
14432
+ processing: /* @__PURE__ */ new Set(),
14433
+ rootSchema: schema,
14434
+ registry: params?.registry ?? globalRegistry
14435
+ };
14436
+ return convertSchema(schema, ctx);
14437
+ }
14438
+
14439
+ // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/coerce.js
14440
+ var coerce_exports = {};
14441
+ __export(coerce_exports, {
14442
+ bigint: () => bigint3,
14443
+ boolean: () => boolean3,
14444
+ date: () => date4,
14445
+ number: () => number3,
14446
+ string: () => string3
14447
+ });
14448
+ init_esm_shims();
14449
+ function string3(params) {
14450
+ return _coercedString(ZodString, params);
14451
+ }
14452
+ function number3(params) {
14453
+ return _coercedNumber(ZodNumber, params);
14454
+ }
14455
+ function boolean3(params) {
14456
+ return _coercedBoolean(ZodBoolean, params);
14457
+ }
14458
+ function bigint3(params) {
14459
+ return _coercedBigint(ZodBigInt, params);
14460
+ }
14461
+ function date4(params) {
14462
+ return _coercedDate(ZodDate, params);
14463
+ }
14464
+
14465
+ // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
14466
+ config(en_default());
14467
+
14468
+ // ../../packages/connectors/src/feature-switch-key.ts
14469
+ init_esm_shims();
14470
+
14471
+ // ../../packages/api-contracts/src/contracts/model-price-tiers.ts
14472
+ init_esm_shims();
14473
+ var SUPPORTED_RUN_MODELS = [
14474
+ "claude-fable-5",
14475
+ "gpt-5.6-sol",
14476
+ "gpt-5.6-terra",
14477
+ "gpt-5.6-luna",
14478
+ "gpt-5.5",
14479
+ "claude-opus-4-8",
14480
+ "claude-opus-4-7",
14481
+ "claude-opus-4-6",
14482
+ "claude-sonnet-5",
14483
+ "claude-sonnet-4-6",
14484
+ "deepseek-v4-pro",
14485
+ "kimi-k2.7-code",
14486
+ "MiniMax-M3",
14487
+ "glm-5.2",
14488
+ "glm-5.1",
14489
+ "mimo-v2.5",
14490
+ "hy3-preview",
14491
+ "gpt-5.4",
14492
+ "gpt-5.4-mini"
14493
+ ];
14494
+ var VM0_MODEL_PRICE_TIER = Object.freeze({
14495
+ "claude-fable-5": "$$$$",
14496
+ "gpt-5.6-sol": "$$$",
14497
+ "gpt-5.6-terra": "$$",
14498
+ "gpt-5.6-luna": "$",
14499
+ "gpt-5.5": "$$$",
14500
+ "claude-opus-4-8": "$$$",
14501
+ "claude-opus-4-7": "$$$",
14502
+ "claude-opus-4-6": "$$$",
14503
+ "claude-sonnet-5": "$$",
14504
+ "claude-sonnet-4-6": "$$",
14505
+ "deepseek-v4-pro": "$",
14506
+ "kimi-k2.7-code": "$",
14507
+ "MiniMax-M3": "$",
14508
+ "glm-5.2": "$",
14509
+ "glm-5.1": "$",
14510
+ "mimo-v2.5": "$",
14511
+ "hy3-preview": "$",
14512
+ "gpt-5.4": "$$",
14513
+ "gpt-5.4-mini": "$"
14514
+ });
14515
+ var VM0_MODEL_PRICE_TIER_LABEL = Object.freeze({
14516
+ $: "Economy tier for everyday simple tasks",
14517
+ $$: "Balanced cost and performance",
14518
+ $$$: "Frontier flagship model",
14519
+ $$$$: "Premium frontier model for the hardest tasks"
14520
+ });
14521
+
14522
+ // ../../packages/api-contracts/src/contracts/model-provider-types.ts
14523
+ init_esm_shims();
14524
+ var MODEL_PROVIDER_TYPE_IDS = [
14525
+ "claude-code-oauth-token",
14526
+ "anthropic-api-key",
14527
+ "openrouter-api-key",
14528
+ "moonshot-api-key",
14529
+ "minimax-api-key",
14530
+ "deepseek-api-key",
14531
+ "zai-api-key",
14532
+ "vercel-ai-gateway",
14533
+ "openrouter-codex",
14534
+ "vercel-ai-gateway-codex",
14535
+ "openai-api-key",
14536
+ "codex-oauth-token",
14537
+ "azure-foundry",
14538
+ "aws-bedrock",
14539
+ "vm0"
14540
+ ];
14541
+
14542
+ // ../../packages/api-contracts/src/contracts/model-provider-firewalls.ts
14543
+ init_esm_shims();
14544
+ var MODEL_PROVIDER_ENV_PLACEHOLDERS = {
14545
+ // Placeholder: sk-ant-api03-{93 word/hyphen chars}AA (108 chars total)
14546
+ // Source: Semgrep regex \Bsk-ant-api03-[\w\-]{93}AA\B
14547
+ // https://semgrep.dev/blog/2025/secrets-story-and-prefixed-secrets/
14548
+ ANTHROPIC_API_KEY: "sk-ant-api03-CoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCofAA",
14549
+ // Placeholder: sk-ant-oat01-{93 word/hyphen chars}AA (108 chars total)
14550
+ // Source: same structure as API key; prefix from claude setup-token output
14551
+ // https://github.com/anthropics/claude-code/issues/18340
14552
+ // Example: sk-ant-oat01-xxxxx...xxxxx (1-year OAuth token)
14553
+ CLAUDE_CODE_OAUTH_TOKEN: "sk-ant-oat01-CoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCofAA",
14554
+ // Generic bearer-token marker for Claude-compatible gateways that map
14555
+ // provider-specific secrets into ANTHROPIC_AUTH_TOKEN.
14556
+ ANTHROPIC_AUTH_TOKEN: "sk-CoffeeSafeLocalCoffeeSafeLocalCo",
14557
+ // Placeholder: sk-proj-{chars}T3BlbkFJ{chars} (typical project key shape)
14558
+ // Source: mirrors the OpenAI connector firewall placeholder shape.
14559
+ OPENAI_API_KEY: "sk-proj-CoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocaT3BlbkFJCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLoca",
14560
+ // Opaque fake marker, not a JWT. Codex ChatGPT mode reads auth.json, while
14561
+ // firewall auth substitutes this marker at egress.
14562
+ CHATGPT_ACCESS_TOKEN: "chatgpt-token-CoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocalCoffeeSafeLocal",
14563
+ CHATGPT_ACCOUNT_ID: "ws_VM0_PLACEHOLDER_DO_NOT_TRUST",
14564
+ CHATGPT_REFRESH_TOKEN: "rt_VM0_PLACEHOLDER_DO_NOT_TRUST"
14565
+ };
14566
+ var MODEL_PROVIDER_FIREWALL_PROVIDER_CONFIGS = {
14567
+ "anthropic-api-key": {
14568
+ framework: "claude-code",
14569
+ secretName: "ANTHROPIC_API_KEY"
14570
+ },
14571
+ "claude-code-oauth-token": {
14572
+ framework: "claude-code",
14573
+ secretName: "CLAUDE_CODE_OAUTH_TOKEN"
14574
+ },
14575
+ "openrouter-api-key": {
14576
+ framework: "claude-code",
14577
+ secretName: "OPENROUTER_API_KEY",
14578
+ anthropicBaseUrl: "https://openrouter.ai/api"
14579
+ },
14580
+ "moonshot-api-key": {
14581
+ framework: "claude-code",
14582
+ secretName: "MOONSHOT_API_KEY",
14583
+ anthropicBaseUrl: "https://api.moonshot.ai/anthropic"
14584
+ },
14585
+ "minimax-api-key": {
14586
+ framework: "claude-code",
14587
+ secretName: "MINIMAX_API_KEY",
14588
+ anthropicBaseUrl: "https://api.minimax.io/anthropic"
14589
+ },
14590
+ "deepseek-api-key": {
14591
+ framework: "claude-code",
14592
+ secretName: "DEEPSEEK_API_KEY",
14593
+ anthropicBaseUrl: "https://api.deepseek.com/anthropic"
14594
+ },
14595
+ "zai-api-key": {
14596
+ framework: "claude-code",
14597
+ secretName: "ZAI_API_KEY",
14598
+ anthropicBaseUrl: "https://api.z.ai/api/anthropic"
14599
+ },
14600
+ "vercel-ai-gateway": {
14601
+ framework: "claude-code",
14602
+ secretName: "VERCEL_AI_GATEWAY_API_KEY",
14603
+ anthropicBaseUrl: "https://ai-gateway.vercel.sh"
14604
+ },
14605
+ "openrouter-codex": {
14606
+ framework: "codex",
14607
+ secretName: "OPENROUTER_API_KEY",
14608
+ openaiBaseUrl: "https://openrouter.ai/api/v1"
14609
+ },
14610
+ "vercel-ai-gateway-codex": {
14611
+ framework: "codex",
14612
+ secretName: "VERCEL_AI_GATEWAY_API_KEY",
14613
+ openaiBaseUrl: "https://ai-gateway.vercel.sh/v1"
14614
+ },
14615
+ "openai-api-key": {
14616
+ framework: "codex",
14617
+ secretName: "OPENAI_API_KEY"
14375
14618
  }
14376
- if (schema.enum !== void 0) {
14377
- const enumValues = schema.enum;
14378
- if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
14379
- return z.null();
14380
- }
14381
- if (enumValues.length === 0) {
14382
- return z.never();
14383
- }
14384
- if (enumValues.length === 1) {
14385
- return z.literal(enumValues[0]);
14386
- }
14387
- if (enumValues.every((v) => typeof v === "string")) {
14388
- return z.enum(enumValues);
14389
- }
14390
- const literalSchemas = enumValues.map((v) => z.literal(v));
14391
- if (literalSchemas.length < 2) {
14392
- return literalSchemas[0];
14393
- }
14394
- return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
14619
+ };
14620
+ var ANTHROPIC_API_BASE = "https://api.anthropic.com";
14621
+ function isLegacySingleSecretProvider(type) {
14622
+ return type !== "codex-oauth-token";
14623
+ }
14624
+ function getFirewallBaseUrl(type) {
14625
+ if (!isLegacySingleSecretProvider(type)) {
14626
+ return "https://chatgpt.com/backend-api/codex";
14395
14627
  }
14396
- if (schema.const !== void 0) {
14397
- return z.literal(schema.const);
14628
+ const config2 = MODEL_PROVIDER_FIREWALL_PROVIDER_CONFIGS[type];
14629
+ if (config2.framework === "codex") {
14630
+ return config2.openaiBaseUrl?.replace(/\/+$/, "") ?? "https://api.openai.com/v1/responses";
14398
14631
  }
14399
- const type = schema.type;
14400
- if (Array.isArray(type)) {
14401
- const typeSchemas = type.map((t2) => {
14402
- const typeSchema = { ...schema, type: t2 };
14403
- return convertBaseSchema(typeSchema, ctx);
14404
- });
14405
- if (typeSchemas.length === 0) {
14406
- return z.never();
14407
- }
14408
- if (typeSchemas.length === 1) {
14409
- return typeSchemas[0];
14632
+ const base = (config2.anthropicBaseUrl ?? ANTHROPIC_API_BASE).replace(
14633
+ /\/+$/,
14634
+ ""
14635
+ );
14636
+ return `${base}/v1/messages`;
14637
+ }
14638
+ function mpFirewall(type, authHeader, placeholderValue) {
14639
+ const secretName = MODEL_PROVIDER_FIREWALL_PROVIDER_CONFIGS[type].secretName;
14640
+ const secretRef = `\${{ secrets.${secretName} }}`;
14641
+ const headerValue = authHeader.valuePrefix ? `${authHeader.valuePrefix} ${secretRef}` : secretRef;
14642
+ return {
14643
+ name: `model-provider:${type}`,
14644
+ apis: [
14645
+ {
14646
+ base: getFirewallBaseUrl(type),
14647
+ auth: { headers: { [authHeader.name]: headerValue } },
14648
+ permissions: []
14649
+ }
14650
+ ],
14651
+ placeholders: { [secretName]: placeholderValue }
14652
+ };
14653
+ }
14654
+ var MODEL_PROVIDER_FIREWALL_CONFIGS = {
14655
+ "anthropic-api-key": mpFirewall(
14656
+ "anthropic-api-key",
14657
+ { name: "x-api-key" },
14658
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_API_KEY
14659
+ ),
14660
+ "claude-code-oauth-token": mpFirewall(
14661
+ "claude-code-oauth-token",
14662
+ { name: "Authorization", valuePrefix: "Bearer" },
14663
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.CLAUDE_CODE_OAUTH_TOKEN
14664
+ ),
14665
+ "openrouter-api-key": mpFirewall(
14666
+ "openrouter-api-key",
14667
+ { name: "Authorization", valuePrefix: "Bearer" },
14668
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_AUTH_TOKEN
14669
+ ),
14670
+ "moonshot-api-key": mpFirewall(
14671
+ "moonshot-api-key",
14672
+ { name: "Authorization", valuePrefix: "Bearer" },
14673
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_AUTH_TOKEN
14674
+ ),
14675
+ "minimax-api-key": mpFirewall(
14676
+ "minimax-api-key",
14677
+ { name: "Authorization", valuePrefix: "Bearer" },
14678
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_AUTH_TOKEN
14679
+ ),
14680
+ "deepseek-api-key": mpFirewall(
14681
+ "deepseek-api-key",
14682
+ { name: "Authorization", valuePrefix: "Bearer" },
14683
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_AUTH_TOKEN
14684
+ ),
14685
+ "zai-api-key": mpFirewall(
14686
+ "zai-api-key",
14687
+ { name: "Authorization", valuePrefix: "Bearer" },
14688
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_AUTH_TOKEN
14689
+ ),
14690
+ "vercel-ai-gateway": mpFirewall(
14691
+ "vercel-ai-gateway",
14692
+ { name: "Authorization", valuePrefix: "Bearer" },
14693
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.ANTHROPIC_AUTH_TOKEN
14694
+ ),
14695
+ // Codex-framework twin of openrouter-api-key. It reuses the same stored
14696
+ // OpenRouter secret, but the sandbox env name is OPENAI_API_KEY because codex
14697
+ // SDK hits OpenAI-compatible paths (/chat/completions, /responses) under
14698
+ // https://openrouter.ai/api/v1.
14699
+ "openrouter-codex": mpFirewall(
14700
+ "openrouter-codex",
14701
+ { name: "Authorization", valuePrefix: "Bearer" },
14702
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.OPENAI_API_KEY
14703
+ ),
14704
+ // Codex-framework twin of vercel-ai-gateway. It reuses the same stored Vercel
14705
+ // secret, but the sandbox env name is OPENAI_API_KEY. Base URL is scoped to
14706
+ // the /v1 prefix so codex can use either /chat/completions or /responses.
14707
+ "vercel-ai-gateway-codex": mpFirewall(
14708
+ "vercel-ai-gateway-codex",
14709
+ { name: "Authorization", valuePrefix: "Bearer" },
14710
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.OPENAI_API_KEY
14711
+ ),
14712
+ "openai-api-key": mpFirewall(
14713
+ "openai-api-key",
14714
+ { name: "Authorization", valuePrefix: "Bearer" },
14715
+ MODEL_PROVIDER_ENV_PLACEHOLDERS.OPENAI_API_KEY
14716
+ ),
14717
+ // ChatGPT OAuth provider: multi-header injection plus unknown-policy auth.openai.com deny.
14718
+ "codex-oauth-token": {
14719
+ name: "model-provider:codex-oauth-token",
14720
+ apis: [
14721
+ {
14722
+ base: "https://chatgpt.com/backend-api/codex",
14723
+ auth: {
14724
+ headers: {
14725
+ Authorization: "Bearer ${{ secrets.CHATGPT_ACCESS_TOKEN }}",
14726
+ "ChatGPT-Account-ID": "${{ secrets.CHATGPT_ACCOUNT_ID }}"
14727
+ }
14728
+ },
14729
+ permissions: [
14730
+ {
14731
+ name: "codex:api",
14732
+ description: "Access the ChatGPT Codex backend with GET and POST requests.",
14733
+ rules: ["GET /{path*}", "POST /{path*}"]
14734
+ }
14735
+ ]
14736
+ },
14737
+ {
14738
+ base: "https://auth.openai.com",
14739
+ auth: { headers: {} },
14740
+ permissions: []
14741
+ }
14742
+ ],
14743
+ defaultPolicies: {
14744
+ unknownPolicy: "deny"
14745
+ },
14746
+ placeholders: {
14747
+ CHATGPT_ACCESS_TOKEN: MODEL_PROVIDER_ENV_PLACEHOLDERS.CHATGPT_ACCESS_TOKEN,
14748
+ CHATGPT_ACCOUNT_ID: MODEL_PROVIDER_ENV_PLACEHOLDERS.CHATGPT_ACCOUNT_ID,
14749
+ CHATGPT_REFRESH_TOKEN: MODEL_PROVIDER_ENV_PLACEHOLDERS.CHATGPT_REFRESH_TOKEN
14410
14750
  }
14411
- return z.union(typeSchemas);
14412
14751
  }
14413
- if (!type) {
14414
- return z.any();
14752
+ };
14753
+ var MINIMAX_CODEX_FIREWALL_CONFIG = {
14754
+ name: "model-provider:minimax-api-key",
14755
+ apis: [
14756
+ {
14757
+ base: "https://api.minimax.io/v1",
14758
+ auth: {
14759
+ headers: {
14760
+ Authorization: "Bearer ${{ secrets.MINIMAX_API_KEY }}"
14761
+ }
14762
+ },
14763
+ permissions: []
14764
+ }
14765
+ ],
14766
+ placeholders: {
14767
+ MINIMAX_API_KEY: MODEL_PROVIDER_ENV_PLACEHOLDERS.OPENAI_API_KEY
14415
14768
  }
14416
- let zodSchema;
14417
- switch (type) {
14418
- case "string": {
14419
- let stringSchema = z.string();
14420
- if (schema.format) {
14421
- const format = schema.format;
14422
- if (format === "email") {
14423
- stringSchema = stringSchema.check(z.email());
14424
- } else if (format === "uri" || format === "uri-reference") {
14425
- stringSchema = stringSchema.check(z.url());
14426
- } else if (format === "uuid" || format === "guid") {
14427
- stringSchema = stringSchema.check(z.uuid());
14428
- } else if (format === "date-time") {
14429
- stringSchema = stringSchema.check(z.iso.datetime());
14430
- } else if (format === "date") {
14431
- stringSchema = stringSchema.check(z.iso.date());
14432
- } else if (format === "time") {
14433
- stringSchema = stringSchema.check(z.iso.time());
14434
- } else if (format === "duration") {
14435
- stringSchema = stringSchema.check(z.iso.duration());
14436
- } else if (format === "ipv4") {
14437
- stringSchema = stringSchema.check(z.ipv4());
14438
- } else if (format === "ipv6") {
14439
- stringSchema = stringSchema.check(z.ipv6());
14440
- } else if (format === "mac") {
14441
- stringSchema = stringSchema.check(z.mac());
14442
- } else if (format === "cidr") {
14443
- stringSchema = stringSchema.check(z.cidrv4());
14444
- } else if (format === "cidr-v6") {
14445
- stringSchema = stringSchema.check(z.cidrv6());
14446
- } else if (format === "base64") {
14447
- stringSchema = stringSchema.check(z.base64());
14448
- } else if (format === "base64url") {
14449
- stringSchema = stringSchema.check(z.base64url());
14450
- } else if (format === "e164") {
14451
- stringSchema = stringSchema.check(z.e164());
14452
- } else if (format === "jwt") {
14453
- stringSchema = stringSchema.check(z.jwt());
14454
- } else if (format === "emoji") {
14455
- stringSchema = stringSchema.check(z.emoji());
14456
- } else if (format === "nanoid") {
14457
- stringSchema = stringSchema.check(z.nanoid());
14458
- } else if (format === "cuid") {
14459
- stringSchema = stringSchema.check(z.cuid());
14460
- } else if (format === "cuid2") {
14461
- stringSchema = stringSchema.check(z.cuid2());
14462
- } else if (format === "ulid") {
14463
- stringSchema = stringSchema.check(z.ulid());
14464
- } else if (format === "xid") {
14465
- stringSchema = stringSchema.check(z.xid());
14466
- } else if (format === "ksuid") {
14467
- stringSchema = stringSchema.check(z.ksuid());
14769
+ };
14770
+
14771
+ // ../../packages/api-contracts/src/contracts/model-providers.ts
14772
+ var modelProviderCodexRuntimeConfigSchema = external_exports.object({
14773
+ providerId: external_exports.string().regex(/^[A-Za-z0-9_-]+$/),
14774
+ name: external_exports.string().min(1),
14775
+ baseUrl: external_exports.url(),
14776
+ envKey: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),
14777
+ wireApi: external_exports.literal("responses"),
14778
+ supportsWebsockets: external_exports.boolean(),
14779
+ modelCatalog: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
14780
+ });
14781
+ var GATED_MODEL_PROVIDER_FEATURE_SWITCHES = {};
14782
+ var FRAMEWORK_SWITCHED_MODEL_PROVIDER_FEATURE_SWITCHES = {
14783
+ "minimax-api-key": "codexFrameworkForMinimax" /* CodexFrameworkForMinimax */
14784
+ };
14785
+ function isModelProviderTypeEnabled(type, featureStates) {
14786
+ const switchKey = GATED_MODEL_PROVIDER_FEATURE_SWITCHES[type];
14787
+ return switchKey ? featureStates?.[switchKey] === true : true;
14788
+ }
14789
+ var DEFAULT_ORG_MODEL_POLICY_DEFAULT_MODEL = "gpt-5.6-terra";
14790
+ var supportedRunModelSchema = external_exports.enum(SUPPORTED_RUN_MODELS);
14791
+ var modelProviderCredentialScopeSchema = external_exports.enum(["org", "member"]);
14792
+ var SUPPORTED_RUN_MODEL_SET = new Set(
14793
+ SUPPORTED_RUN_MODELS
14794
+ );
14795
+ function isSupportedRunModel(model) {
14796
+ return typeof model === "string" && SUPPORTED_RUN_MODEL_SET.has(model);
14797
+ }
14798
+ function getVm0ModelPriceTier(model) {
14799
+ return isSupportedRunModel(model) ? VM0_MODEL_PRICE_TIER[model] : void 0;
14800
+ }
14801
+ var VM0_MODEL_TO_PROVIDER = {
14802
+ "claude-fable-5": {
14803
+ concreteType: "anthropic-api-key",
14804
+ vendor: "anthropic"
14805
+ },
14806
+ "claude-opus-4-8": {
14807
+ concreteType: "anthropic-api-key",
14808
+ vendor: "anthropic"
14809
+ },
14810
+ "claude-opus-4-7": {
14811
+ concreteType: "anthropic-api-key",
14812
+ vendor: "anthropic"
14813
+ },
14814
+ "claude-opus-4-6": {
14815
+ concreteType: "anthropic-api-key",
14816
+ vendor: "anthropic"
14817
+ },
14818
+ "claude-sonnet-5": {
14819
+ concreteType: "anthropic-api-key",
14820
+ vendor: "anthropic"
14821
+ },
14822
+ "claude-sonnet-4-6": {
14823
+ concreteType: "anthropic-api-key",
14824
+ vendor: "anthropic"
14825
+ },
14826
+ "glm-5.2": {
14827
+ concreteType: "zai-api-key",
14828
+ vendor: "zai"
14829
+ },
14830
+ "glm-5.1": {
14831
+ concreteType: "zai-api-key",
14832
+ vendor: "zai"
14833
+ },
14834
+ "mimo-v2.5": {
14835
+ concreteType: "openrouter-api-key",
14836
+ vendor: "openrouter",
14837
+ apiModel: "xiaomi/mimo-v2.5"
14838
+ },
14839
+ "hy3-preview": {
14840
+ concreteType: "openrouter-api-key",
14841
+ vendor: "openrouter",
14842
+ apiModel: "tencent/hy3-preview"
14843
+ },
14844
+ "kimi-k2.7-code": {
14845
+ concreteType: "moonshot-api-key",
14846
+ vendor: "moonshot"
14847
+ },
14848
+ "MiniMax-M3": {
14849
+ concreteType: "minimax-api-key",
14850
+ vendor: "minimax"
14851
+ },
14852
+ "deepseek-v4-pro": {
14853
+ concreteType: "deepseek-api-key",
14854
+ vendor: "deepseek"
14855
+ },
14856
+ "gpt-5.6-sol": {
14857
+ concreteType: "openai-api-key",
14858
+ vendor: "openai"
14859
+ },
14860
+ "gpt-5.6-terra": {
14861
+ concreteType: "openai-api-key",
14862
+ vendor: "openai"
14863
+ },
14864
+ "gpt-5.6-luna": {
14865
+ concreteType: "openai-api-key",
14866
+ vendor: "openai"
14867
+ },
14868
+ "gpt-5.5": {
14869
+ concreteType: "openai-api-key",
14870
+ vendor: "openai"
14871
+ },
14872
+ "gpt-5.4": {
14873
+ concreteType: "openai-api-key",
14874
+ vendor: "openai"
14875
+ },
14876
+ "gpt-5.4-mini": {
14877
+ concreteType: "openai-api-key",
14878
+ vendor: "openai"
14879
+ }
14880
+ };
14881
+ var MODEL_PROVIDER_TYPES = {
14882
+ "claude-code-oauth-token": {
14883
+ framework: "claude-code",
14884
+ secretName: "CLAUDE_CODE_OAUTH_TOKEN",
14885
+ label: "Claude Code (OAuth Token)",
14886
+ secretLabel: "OAuth token",
14887
+ helpText: "To get your OAuth token, run: claude setup-token\n(Requires Claude Pro or Max subscription)",
14888
+ envBindings: {
14889
+ CLAUDE_CODE_OAUTH_TOKEN: "$secret",
14890
+ ANTHROPIC_MODEL: "$model"
14891
+ },
14892
+ models: [
14893
+ "claude-fable-5",
14894
+ "claude-sonnet-5",
14895
+ "claude-sonnet-4-6",
14896
+ "claude-opus-4-8",
14897
+ "claude-opus-4-7",
14898
+ "claude-opus-4-6"
14899
+ ],
14900
+ defaultModel: "claude-sonnet-4-6"
14901
+ },
14902
+ "anthropic-api-key": {
14903
+ framework: "claude-code",
14904
+ secretName: "ANTHROPIC_API_KEY",
14905
+ label: "Anthropic",
14906
+ secretLabel: "API key",
14907
+ helpText: "Get your API key at: https://console.anthropic.com/settings/keys",
14908
+ envBindings: {
14909
+ ANTHROPIC_API_KEY: "$secret",
14910
+ ANTHROPIC_MODEL: "$model"
14911
+ },
14912
+ models: [
14913
+ "claude-fable-5",
14914
+ "claude-sonnet-5",
14915
+ "claude-sonnet-4-6",
14916
+ "claude-opus-4-8",
14917
+ "claude-opus-4-7",
14918
+ "claude-opus-4-6"
14919
+ ],
14920
+ defaultModel: "claude-sonnet-4-6"
14921
+ },
14922
+ "openrouter-api-key": {
14923
+ framework: "claude-code",
14924
+ secretName: "OPENROUTER_API_KEY",
14925
+ label: "OpenRouter",
14926
+ secretLabel: "API key",
14927
+ helpText: "Get your API key at: https://openrouter.ai/settings/keys",
14928
+ envBindings: {
14929
+ ANTHROPIC_AUTH_TOKEN: "$secret",
14930
+ ANTHROPIC_BASE_URL: "https://openrouter.ai/api",
14931
+ ANTHROPIC_API_KEY: "",
14932
+ ANTHROPIC_MODEL: "$model",
14933
+ ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
14934
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
14935
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
14936
+ CLAUDE_CODE_SUBAGENT_MODEL: "$model"
14937
+ },
14938
+ models: [
14939
+ "anthropic/claude-fable-5",
14940
+ "anthropic/claude-opus-4.8",
14941
+ "anthropic/claude-opus-4.7",
14942
+ "anthropic/claude-sonnet-5",
14943
+ "anthropic/claude-sonnet-4.6",
14944
+ "anthropic/claude-opus-4.6",
14945
+ "anthropic/claude-opus-4.5",
14946
+ "anthropic/claude-sonnet-4.5",
14947
+ "z-ai/glm-5.2",
14948
+ "z-ai/glm-5.1",
14949
+ "xiaomi/mimo-v2.5",
14950
+ "tencent/hy3-preview",
14951
+ "deepseek/deepseek-v4-pro"
14952
+ ],
14953
+ defaultModel: ""
14954
+ },
14955
+ "moonshot-api-key": {
14956
+ framework: "claude-code",
14957
+ secretName: "MOONSHOT_API_KEY",
14958
+ label: "Moonshot (Kimi)",
14959
+ secretLabel: "API key",
14960
+ helpText: "Get your API key at: https://platform.moonshot.ai/console/api-keys",
14961
+ envBindings: {
14962
+ ANTHROPIC_AUTH_TOKEN: "$secret",
14963
+ ANTHROPIC_BASE_URL: "https://api.moonshot.ai/anthropic",
14964
+ ANTHROPIC_MODEL: "$model",
14965
+ ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
14966
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
14967
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
14968
+ CLAUDE_CODE_SUBAGENT_MODEL: "$model",
14969
+ // Moonshot rejects Anthropic document blocks; keep attachments as text.
14970
+ CLAUDE_CODE_DISABLE_ATTACHMENTS: "1"
14971
+ },
14972
+ models: [
14973
+ "kimi-k2.7-code",
14974
+ "kimi-k2-thinking-turbo",
14975
+ "kimi-k2-thinking"
14976
+ ],
14977
+ defaultModel: "kimi-k2.7-code"
14978
+ },
14979
+ "minimax-api-key": {
14980
+ framework: "claude-code",
14981
+ secretName: "MINIMAX_API_KEY",
14982
+ label: "MiniMax",
14983
+ secretLabel: "API key",
14984
+ helpText: "Get your API key at: https://platform.minimax.io/user-center/basic-information/interface-key",
14985
+ envBindings: {
14986
+ ANTHROPIC_AUTH_TOKEN: "$secret",
14987
+ ANTHROPIC_BASE_URL: "https://api.minimax.io/anthropic",
14988
+ ANTHROPIC_MODEL: "$model",
14989
+ ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
14990
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
14991
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
14992
+ CLAUDE_CODE_SUBAGENT_MODEL: "$model",
14993
+ API_TIMEOUT_MS: "3000000",
14994
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
14995
+ // MiniMax does not document support for Anthropic document blocks.
14996
+ CLAUDE_CODE_DISABLE_ATTACHMENTS: "1"
14997
+ },
14998
+ models: ["MiniMax-M3", "MiniMax-M2.1"],
14999
+ defaultModel: "MiniMax-M3"
15000
+ },
15001
+ "deepseek-api-key": {
15002
+ framework: "claude-code",
15003
+ secretName: "DEEPSEEK_API_KEY",
15004
+ label: "DeepSeek",
15005
+ secretLabel: "API key",
15006
+ helpText: "Get your API key at: https://platform.deepseek.com/api_keys",
15007
+ envBindings: {
15008
+ ANTHROPIC_AUTH_TOKEN: "$secret",
15009
+ ANTHROPIC_BASE_URL: "https://api.deepseek.com/anthropic",
15010
+ ANTHROPIC_MODEL: "$model",
15011
+ ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
15012
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
15013
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
15014
+ CLAUDE_CODE_SUBAGENT_MODEL: "$model",
15015
+ API_TIMEOUT_MS: "600000",
15016
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
15017
+ // DeepSeek explicitly rejects Anthropic document blocks.
15018
+ CLAUDE_CODE_DISABLE_ATTACHMENTS: "1"
15019
+ },
15020
+ models: ["deepseek-v4-pro"],
15021
+ defaultModel: "deepseek-v4-pro"
15022
+ },
15023
+ "zai-api-key": {
15024
+ framework: "claude-code",
15025
+ secretName: "ZAI_API_KEY",
15026
+ label: "Z.AI (GLM)",
15027
+ secretLabel: "API key",
15028
+ helpText: "Get your API key at: https://z.ai/model-api",
15029
+ envBindings: {
15030
+ ANTHROPIC_AUTH_TOKEN: "$secret",
15031
+ ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
15032
+ ANTHROPIC_MODEL: "$model",
15033
+ ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
15034
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
15035
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
15036
+ CLAUDE_CODE_SUBAGENT_MODEL: "$model",
15037
+ API_TIMEOUT_MS: "3000000"
15038
+ },
15039
+ models: [
15040
+ "glm-5.2",
15041
+ "glm-5.1",
15042
+ "glm-5",
15043
+ "glm-4.7",
15044
+ "glm-4.5-air"
15045
+ ],
15046
+ defaultModel: "glm-5.2"
15047
+ },
15048
+ "vercel-ai-gateway": {
15049
+ framework: "claude-code",
15050
+ secretName: "VERCEL_AI_GATEWAY_API_KEY",
15051
+ label: "Vercel AI Gateway",
15052
+ secretLabel: "API key",
15053
+ helpText: "Get your API key from the Vercel AI Gateway dashboard",
15054
+ envBindings: {
15055
+ ANTHROPIC_AUTH_TOKEN: "$secret",
15056
+ ANTHROPIC_BASE_URL: "https://ai-gateway.vercel.sh",
15057
+ ANTHROPIC_API_KEY: "",
15058
+ ANTHROPIC_MODEL: "$model",
15059
+ ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
15060
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
15061
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
15062
+ CLAUDE_CODE_SUBAGENT_MODEL: "$model"
15063
+ },
15064
+ models: [
15065
+ "anthropic/claude-fable-5",
15066
+ "anthropic/claude-opus-4.8",
15067
+ "anthropic/claude-opus-4.7",
15068
+ "anthropic/claude-opus-4.6",
15069
+ "anthropic/claude-sonnet-5",
15070
+ "anthropic/claude-opus-4.5",
15071
+ "anthropic/claude-sonnet-4.6",
15072
+ "anthropic/claude-sonnet-4.5",
15073
+ "minimax/minimax-m2.5",
15074
+ "zai/glm-5-turbo"
15075
+ ],
15076
+ defaultModel: "anthropic/claude-sonnet-4.6"
15077
+ },
15078
+ // Codex-framework twin of openrouter-api-key. Same upstream gateway (OpenRouter)
15079
+ // and same API key (shared secretName), but routes through OpenRouter's
15080
+ // OpenAI-compatible endpoint surface for GPT models that codex CLI requires.
15081
+ // Pairing rule: the claude-code entry serves Anthropic Messages API
15082
+ // (/v1/messages); this codex entry serves OpenAI Chat Completions / Responses
15083
+ // (/v1/chat/completions, /v1/responses) under the same /api/v1 prefix.
15084
+ "openrouter-codex": {
15085
+ framework: "codex",
15086
+ secretName: "OPENROUTER_API_KEY",
15087
+ label: "OpenRouter (Codex)",
15088
+ secretLabel: "API key",
15089
+ helpText: "Get your API key at: https://openrouter.ai/settings/keys",
15090
+ envBindings: {
15091
+ OPENAI_API_KEY: "$secret",
15092
+ OPENAI_BASE_URL: "https://openrouter.ai/api/v1",
15093
+ OPENAI_MODEL: "$model"
15094
+ },
15095
+ models: [
15096
+ "openai/gpt-5.5",
15097
+ "openai/gpt-5.4",
15098
+ "openai/gpt-5.4-mini"
15099
+ ],
15100
+ defaultModel: "openai/gpt-5.5"
15101
+ },
15102
+ // Codex-framework twin of vercel-ai-gateway. Vercel exposes both
15103
+ // Anthropic Messages and OpenAI Chat Completions / Responses on the same
15104
+ // base URL, distinguished by path. The claude-code entry uses /v1/messages;
15105
+ // this codex entry uses /v1/chat/completions or /v1/responses (codex CLI
15106
+ // picks the path it needs).
15107
+ "vercel-ai-gateway-codex": {
15108
+ framework: "codex",
15109
+ secretName: "VERCEL_AI_GATEWAY_API_KEY",
15110
+ label: "Vercel AI Gateway (Codex)",
15111
+ secretLabel: "API key",
15112
+ helpText: "Get your API key from the Vercel AI Gateway dashboard",
15113
+ envBindings: {
15114
+ OPENAI_API_KEY: "$secret",
15115
+ OPENAI_BASE_URL: "https://ai-gateway.vercel.sh/v1",
15116
+ OPENAI_MODEL: "$model"
15117
+ },
15118
+ models: [
15119
+ "openai/gpt-5.5",
15120
+ "openai/gpt-5.4",
15121
+ "openai/gpt-5.4-mini"
15122
+ ],
15123
+ defaultModel: "openai/gpt-5.5"
15124
+ },
15125
+ "openai-api-key": {
15126
+ framework: "codex",
15127
+ secretName: "OPENAI_API_KEY",
15128
+ label: "OpenAI",
15129
+ secretLabel: "API key",
15130
+ helpText: "Get your API key at: https://platform.openai.com/api-keys",
15131
+ envBindings: {
15132
+ OPENAI_API_KEY: "$secret",
15133
+ OPENAI_MODEL: "$model"
15134
+ },
15135
+ models: [
15136
+ "gpt-5.6-sol",
15137
+ "gpt-5.6-terra",
15138
+ "gpt-5.6-luna",
15139
+ "gpt-5.5",
15140
+ "gpt-5.4",
15141
+ "gpt-5.4-mini"
15142
+ ],
15143
+ defaultModel: "gpt-5.5"
15144
+ },
15145
+ "codex-oauth-token": {
15146
+ framework: "codex",
15147
+ label: "ChatGPT (Codex)",
15148
+ helpText: "Run `codex login` on your machine, then paste the resulting ~/.codex/auth.json contents to authorize ChatGPT (Plus / Pro / Business / Edu / Enterprise) for Codex.",
15149
+ authMethods: {
15150
+ // Paste-based auth: client posts CODEX_AUTH_JSON, server parses it via
15151
+ // codex-auth-json-parser.ts and persists the four derived CHATGPT_*
15152
+ // fields. The raw blob is NEVER stored. The wire-shape secret
15153
+ // (CODEX_AUTH_JSON) is declared optional+serverOnly so the contract
15154
+ // accepts it on POST without persisting; the four CHATGPT_* fields are
15155
+ // the canonical stored secrets and the firewall layer reads from those.
15156
+ auth_json: {
15157
+ label: "Codex auth.json",
15158
+ helpText: "Run `codex login` locally, then paste the contents of ~/.codex/auth.json below.",
15159
+ secrets: {
15160
+ CODEX_AUTH_JSON: {
15161
+ label: "auth.json contents",
15162
+ required: false,
15163
+ serverOnly: true,
15164
+ placeholder: '{"OPENAI_API_KEY":null,"tokens":{...}}',
15165
+ helpText: "Paste the entire contents of ~/.codex/auth.json"
15166
+ },
15167
+ // CHATGPT_ACCESS_TOKEN and CHATGPT_ACCOUNT_ID reach the sandbox env
15168
+ // as placeholder values (substituted by the firewall token-replacement
15169
+ // layer at egress) — keeping them non-serverOnly preserves the
15170
+ // placeholder injection path. CHATGPT_REFRESH_TOKEN and
15171
+ // CHATGPT_ID_TOKEN stay serverOnly per the #7365 invariant.
15172
+ //
15173
+ // All four are `derived: true` — the server-side parser populates
15174
+ // them from the user-pasted CODEX_AUTH_JSON. The UI MUST NOT render
15175
+ // them as input fields (per #12024).
15176
+ CHATGPT_ACCESS_TOKEN: {
15177
+ label: "CHATGPT_ACCESS_TOKEN",
15178
+ required: true,
15179
+ derived: true
15180
+ },
15181
+ CHATGPT_REFRESH_TOKEN: {
15182
+ label: "CHATGPT_REFRESH_TOKEN",
15183
+ required: true,
15184
+ serverOnly: true,
15185
+ derived: true
15186
+ },
15187
+ CHATGPT_ACCOUNT_ID: {
15188
+ label: "CHATGPT_ACCOUNT_ID",
15189
+ required: true,
15190
+ derived: true
15191
+ },
15192
+ CHATGPT_ID_TOKEN: {
15193
+ label: "CHATGPT_ID_TOKEN",
15194
+ required: true,
15195
+ serverOnly: true,
15196
+ derived: true
15197
+ }
14468
15198
  }
14469
15199
  }
14470
- if (typeof schema.minLength === "number") {
14471
- stringSchema = stringSchema.min(schema.minLength);
14472
- }
14473
- if (typeof schema.maxLength === "number") {
14474
- stringSchema = stringSchema.max(schema.maxLength);
15200
+ },
15201
+ defaultAuthMethod: "auth_json",
15202
+ envBindings: {
15203
+ CHATGPT_ACCESS_TOKEN: "$secrets.CHATGPT_ACCESS_TOKEN",
15204
+ CHATGPT_ACCOUNT_ID: "$secrets.CHATGPT_ACCOUNT_ID",
15205
+ OPENAI_MODEL: "$model"
15206
+ },
15207
+ models: [
15208
+ "gpt-5.6-sol",
15209
+ "gpt-5.6-terra",
15210
+ "gpt-5.6-luna",
15211
+ "gpt-5.5",
15212
+ "gpt-5.4",
15213
+ "gpt-5.4-mini"
15214
+ ],
15215
+ defaultModel: "gpt-5.5"
15216
+ },
15217
+ "azure-foundry": {
15218
+ framework: "claude-code",
15219
+ label: "Azure Foundry",
15220
+ helpText: "Run Claude on Microsoft Azure Foundry.\nSetup guide: https://code.claude.com/docs/en/microsoft-foundry",
15221
+ authMethods: {
15222
+ "api-key": {
15223
+ label: "API Key",
15224
+ helpText: "Use an Azure Foundry API key for authentication",
15225
+ secrets: {
15226
+ ANTHROPIC_FOUNDRY_API_KEY: {
15227
+ label: "ANTHROPIC_FOUNDRY_API_KEY",
15228
+ required: true,
15229
+ helpText: "API key from Azure Foundry portal (Endpoints and keys)"
15230
+ },
15231
+ ANTHROPIC_FOUNDRY_RESOURCE: {
15232
+ label: "ANTHROPIC_FOUNDRY_RESOURCE",
15233
+ required: true,
15234
+ placeholder: "my-resource",
15235
+ helpText: "Azure resource name (from portal URL)"
15236
+ }
15237
+ }
14475
15238
  }
14476
- if (schema.pattern) {
14477
- stringSchema = stringSchema.regex(new RegExp(schema.pattern));
15239
+ },
15240
+ defaultAuthMethod: "api-key",
15241
+ envBindings: {
15242
+ CLAUDE_CODE_USE_FOUNDRY: "1",
15243
+ ANTHROPIC_FOUNDRY_API_KEY: "$secrets.ANTHROPIC_FOUNDRY_API_KEY",
15244
+ ANTHROPIC_FOUNDRY_RESOURCE: "$secrets.ANTHROPIC_FOUNDRY_RESOURCE",
15245
+ ANTHROPIC_MODEL: "$model"
15246
+ },
15247
+ models: [],
15248
+ defaultModel: "",
15249
+ allowCustomModel: true,
15250
+ customModelPlaceholder: "claude-sonnet-4-5"
15251
+ },
15252
+ "aws-bedrock": {
15253
+ framework: "claude-code",
15254
+ label: "AWS Bedrock",
15255
+ helpText: "Run Claude on AWS Bedrock.\nSetup guide: https://code.claude.com/docs/en/amazon-bedrock",
15256
+ authMethods: {
15257
+ "api-key": {
15258
+ label: "Bedrock API Key",
15259
+ helpText: "Use a Bedrock API key for authentication",
15260
+ secrets: {
15261
+ AWS_BEARER_TOKEN_BEDROCK: {
15262
+ label: "AWS_BEARER_TOKEN_BEDROCK",
15263
+ required: true,
15264
+ helpText: "Bedrock API key from AWS console"
15265
+ },
15266
+ AWS_REGION: {
15267
+ label: "AWS_REGION",
15268
+ required: true,
15269
+ placeholder: "us-east-1",
15270
+ helpText: "e.g., us-east-1, us-west-2"
15271
+ }
15272
+ }
15273
+ },
15274
+ "access-keys": {
15275
+ label: "IAM Access Keys",
15276
+ helpText: "Use IAM access key secrets",
15277
+ secrets: {
15278
+ AWS_ACCESS_KEY_ID: {
15279
+ label: "AWS_ACCESS_KEY_ID",
15280
+ required: true,
15281
+ helpText: "IAM access key ID"
15282
+ },
15283
+ AWS_SECRET_ACCESS_KEY: {
15284
+ label: "AWS_SECRET_ACCESS_KEY",
15285
+ required: true,
15286
+ helpText: "IAM secret access key"
15287
+ },
15288
+ AWS_SESSION_TOKEN: {
15289
+ label: "AWS_SESSION_TOKEN",
15290
+ required: false,
15291
+ helpText: "Optional, for temporary secrets"
15292
+ },
15293
+ AWS_REGION: {
15294
+ label: "AWS_REGION",
15295
+ required: true,
15296
+ placeholder: "us-east-1",
15297
+ helpText: "e.g., us-east-1, us-west-2"
15298
+ }
15299
+ }
14478
15300
  }
14479
- zodSchema = stringSchema;
14480
- break;
15301
+ },
15302
+ defaultAuthMethod: "api-key",
15303
+ envBindings: {
15304
+ CLAUDE_CODE_USE_BEDROCK: "1",
15305
+ AWS_REGION: "$secrets.AWS_REGION",
15306
+ AWS_BEARER_TOKEN_BEDROCK: "$secrets.AWS_BEARER_TOKEN_BEDROCK",
15307
+ AWS_ACCESS_KEY_ID: "$secrets.AWS_ACCESS_KEY_ID",
15308
+ AWS_SECRET_ACCESS_KEY: "$secrets.AWS_SECRET_ACCESS_KEY",
15309
+ AWS_SESSION_TOKEN: "$secrets.AWS_SESSION_TOKEN",
15310
+ ANTHROPIC_MODEL: "$model"
15311
+ },
15312
+ models: [],
15313
+ defaultModel: "",
15314
+ allowCustomModel: true,
15315
+ customModelPlaceholder: "anthropic.claude-sonnet-4-20250514-v1:0"
15316
+ },
15317
+ vm0: {
15318
+ framework: "claude-code",
15319
+ label: "VM0 Managed",
15320
+ models: Object.keys(VM0_MODEL_TO_PROVIDER),
15321
+ defaultModel: DEFAULT_ORG_MODEL_POLICY_DEFAULT_MODEL
15322
+ }
15323
+ };
15324
+ var HIDDEN_PROVIDER_LIST = ["aws-bedrock", "azure-foundry"];
15325
+ var HIDDEN_PROVIDER_TYPES = new Set(
15326
+ HIDDEN_PROVIDER_LIST
15327
+ );
15328
+ function getSelectableProviderTypes(featureStates) {
15329
+ return Object.keys(MODEL_PROVIDER_TYPES).filter(
15330
+ (type) => {
15331
+ return !HIDDEN_PROVIDER_TYPES.has(type) && isModelProviderTypeEnabled(type, featureStates);
14481
15332
  }
14482
- case "number":
14483
- case "integer": {
14484
- let numberSchema = type === "integer" ? z.number().int() : z.number();
14485
- if (typeof schema.minimum === "number") {
14486
- numberSchema = numberSchema.min(schema.minimum);
14487
- }
14488
- if (typeof schema.maximum === "number") {
14489
- numberSchema = numberSchema.max(schema.maximum);
14490
- }
14491
- if (typeof schema.exclusiveMinimum === "number") {
14492
- numberSchema = numberSchema.gt(schema.exclusiveMinimum);
14493
- } else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
14494
- numberSchema = numberSchema.gt(schema.minimum);
14495
- }
14496
- if (typeof schema.exclusiveMaximum === "number") {
14497
- numberSchema = numberSchema.lt(schema.exclusiveMaximum);
14498
- } else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
14499
- numberSchema = numberSchema.lt(schema.maximum);
14500
- }
14501
- if (typeof schema.multipleOf === "number") {
14502
- numberSchema = numberSchema.multipleOf(schema.multipleOf);
15333
+ );
15334
+ }
15335
+ var modelProviderTypeSchema = external_exports.enum(MODEL_PROVIDER_TYPE_IDS);
15336
+ var modelProviderFrameworkSchema = external_exports.enum(["claude-code", "codex"]);
15337
+ function hasAuthMethods(type) {
15338
+ const config2 = MODEL_PROVIDER_TYPES[type];
15339
+ if (!config2) return false;
15340
+ return "authMethods" in config2;
15341
+ }
15342
+ function getAuthMethodsForType(type) {
15343
+ const config2 = MODEL_PROVIDER_TYPES[type];
15344
+ if (!config2) return void 0;
15345
+ return "authMethods" in config2 ? config2.authMethods : void 0;
15346
+ }
15347
+ function getDefaultAuthMethod(type) {
15348
+ const config2 = MODEL_PROVIDER_TYPES[type];
15349
+ return "defaultAuthMethod" in config2 ? config2.defaultAuthMethod : void 0;
15350
+ }
15351
+ function getSecretsForAuthMethod(type, authMethod) {
15352
+ const authMethods = getAuthMethodsForType(type);
15353
+ if (!authMethods || !(authMethod in authMethods)) {
15354
+ return void 0;
15355
+ }
15356
+ const method = authMethods[authMethod];
15357
+ return method?.secrets;
15358
+ }
15359
+ var modelProviderSubscriptionUsageWindowSchema = external_exports.object({
15360
+ usedPercent: external_exports.number().nullable(),
15361
+ remainingPercent: external_exports.number().nullable(),
15362
+ resetAt: external_exports.string().nullable(),
15363
+ windowSeconds: external_exports.number().nullable()
15364
+ });
15365
+ var modelProviderSubscriptionUsageSchema = external_exports.object({
15366
+ fiveHour: modelProviderSubscriptionUsageWindowSchema.nullable(),
15367
+ weekly: modelProviderSubscriptionUsageWindowSchema.nullable()
15368
+ });
15369
+ var modelProviderResponseSchema = external_exports.object({
15370
+ id: external_exports.uuid(),
15371
+ type: modelProviderTypeSchema,
15372
+ framework: modelProviderFrameworkSchema,
15373
+ secretName: external_exports.string().nullable(),
15374
+ // Legacy single-secret (deprecated for multi-auth)
15375
+ authMethod: external_exports.string().nullable(),
15376
+ // For multi-auth providers
15377
+ secretNames: external_exports.array(external_exports.string()).nullable(),
15378
+ // For multi-auth providers
15379
+ isDefault: external_exports.boolean(),
15380
+ selectedModel: external_exports.string().nullable(),
15381
+ createdAt: external_exports.string(),
15382
+ updatedAt: external_exports.string(),
15383
+ // OAuth account metadata populated by provider-specific connect flows. Other
15384
+ // provider types omit these.
15385
+ accountEmail: external_exports.string().nullable().optional(),
15386
+ workspaceName: external_exports.string().nullable().optional(),
15387
+ planType: external_exports.string().nullable().optional(),
15388
+ // Subscription quota metadata. Providers omit these until an upstream source
15389
+ // exposes the reset cadence or next reset timestamp.
15390
+ subscriptionResetPeriod: external_exports.string().nullable().optional(),
15391
+ subscriptionNextResetAt: external_exports.string().nullable().optional(),
15392
+ subscriptionUsage: modelProviderSubscriptionUsageSchema.nullable().optional(),
15393
+ subscriptionResetCredits: external_exports.number().int().nonnegative().nullable().optional(),
15394
+ // OAuth refresh state. `needsReconnect` flips to true when the firewall's
15395
+ // refresh attempt fails (#11921 writes this on the model_providers row).
15396
+ // `lastRefreshErrorCode` carries the typed code from `ChatgptRefreshError`
15397
+ // (e.g. `refresh_token_expired`) so the UI can render an actionable
15398
+ // re-connect message. Both fields are always emitted for OAuth-typed
15399
+ // providers; non-OAuth types default to false / null.
15400
+ needsReconnect: external_exports.boolean(),
15401
+ lastRefreshErrorCode: external_exports.string().nullable()
15402
+ });
15403
+ var modelProviderListResponseSchema = external_exports.object({
15404
+ modelProviders: external_exports.array(modelProviderResponseSchema)
15405
+ });
15406
+ var upsertModelProviderRequestSchema = external_exports.object({
15407
+ type: modelProviderTypeSchema,
15408
+ secret: external_exports.string().min(1).optional(),
15409
+ // Legacy single secret
15410
+ authMethod: external_exports.string().optional(),
15411
+ // For multi-auth providers
15412
+ secrets: external_exports.record(external_exports.string(), external_exports.string()).optional(),
15413
+ // For multi-auth providers
15414
+ selectedModel: external_exports.string().optional()
15415
+ });
15416
+ var upsertModelProviderResponseSchema = external_exports.object({
15417
+ provider: modelProviderResponseSchema,
15418
+ created: external_exports.boolean()
15419
+ });
15420
+ var orgModelPolicyRouteStatusSchema = external_exports.enum([
15421
+ "valid",
15422
+ "missing_provider",
15423
+ "invalid"
15424
+ ]);
15425
+ var orgModelPolicySchema = external_exports.object({
15426
+ id: external_exports.uuid(),
15427
+ model: supportedRunModelSchema,
15428
+ modelLabel: external_exports.string(),
15429
+ isDefault: external_exports.boolean(),
15430
+ defaultProviderType: modelProviderTypeSchema,
15431
+ credentialScope: modelProviderCredentialScopeSchema,
15432
+ modelProviderId: external_exports.uuid().nullable(),
15433
+ routeStatus: orgModelPolicyRouteStatusSchema,
15434
+ routeStatusReason: external_exports.string().nullable(),
15435
+ createdAt: external_exports.string(),
15436
+ updatedAt: external_exports.string()
15437
+ });
15438
+ var updateOrgModelPolicySchema = external_exports.object({
15439
+ model: supportedRunModelSchema,
15440
+ isDefault: external_exports.boolean(),
15441
+ defaultProviderType: modelProviderTypeSchema,
15442
+ credentialScope: modelProviderCredentialScopeSchema,
15443
+ modelProviderId: external_exports.uuid().nullable()
15444
+ });
15445
+ var orgModelPoliciesResponseSchema = external_exports.object({
15446
+ policies: external_exports.array(orgModelPolicySchema),
15447
+ workspaceDefaultModel: supportedRunModelSchema.nullable(),
15448
+ workspaceDefaultPolicyId: external_exports.uuid().nullable()
15449
+ });
15450
+ var updateOrgModelPoliciesRequestSchema = external_exports.object({
15451
+ policies: external_exports.array(updateOrgModelPolicySchema)
15452
+ });
15453
+
15454
+ // src/lib/api/core/client-factory.ts
15455
+ init_esm_shims();
15456
+
15457
+ // src/lib/api/client-headers.ts
15458
+ init_esm_shims();
15459
+ import { randomUUID } from "crypto";
15460
+
15461
+ // ../../packages/api-contracts/src/contracts/client-headers.ts
15462
+ init_esm_shims();
15463
+ var CLIENT_VERSION_HEADER = "X-Client-Version";
15464
+ var CLIENT_TYPE_HEADER = "X-Client-Type";
15465
+ var CLIENT_SESSION_ID_HEADER = "X-Client-Session-Id";
15466
+ var CLIENT_REQUEST_ID_HEADER = "X-Client-Request-Id";
15467
+ var CLIENT_TYPE_CLI = "CLI";
15468
+
15469
+ // ../../packages/api-contracts/src/contracts/trpc-contract.ts
15470
+ init_esm_shims();
15471
+
15472
+ // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/index.mjs
15473
+ init_esm_shims();
15474
+
15475
+ // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs
15476
+ init_esm_shims();
15477
+
15478
+ // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/codes-DagpWZLc.mjs
15479
+ init_esm_shims();
15480
+ function mergeWithoutOverrides(obj1, ...objs) {
15481
+ const newObj = Object.assign(emptyObject(), obj1);
15482
+ for (const overrides of objs) for (const key in overrides) {
15483
+ if (key in newObj && newObj[key] !== overrides[key]) throw new Error(`Duplicate key ${key}`);
15484
+ newObj[key] = overrides[key];
15485
+ }
15486
+ return newObj;
15487
+ }
15488
+ function isObject2(value) {
15489
+ return !!value && !Array.isArray(value) && typeof value === "object";
15490
+ }
15491
+ function isFunction(fn) {
15492
+ return typeof fn === "function";
15493
+ }
15494
+ function emptyObject() {
15495
+ return /* @__PURE__ */ Object.create(null);
15496
+ }
15497
+ var TRPC_ERROR_CODES_BY_KEY = {
15498
+ PARSE_ERROR: -32700,
15499
+ BAD_REQUEST: -32600,
15500
+ INTERNAL_SERVER_ERROR: -32603,
15501
+ NOT_IMPLEMENTED: -32603,
15502
+ BAD_GATEWAY: -32603,
15503
+ SERVICE_UNAVAILABLE: -32603,
15504
+ GATEWAY_TIMEOUT: -32603,
15505
+ UNAUTHORIZED: -32001,
15506
+ PAYMENT_REQUIRED: -32002,
15507
+ FORBIDDEN: -32003,
15508
+ NOT_FOUND: -32004,
15509
+ METHOD_NOT_SUPPORTED: -32005,
15510
+ TIMEOUT: -32008,
15511
+ CONFLICT: -32009,
15512
+ PRECONDITION_FAILED: -32012,
15513
+ PAYLOAD_TOO_LARGE: -32013,
15514
+ UNSUPPORTED_MEDIA_TYPE: -32015,
15515
+ UNPROCESSABLE_CONTENT: -32022,
15516
+ PRECONDITION_REQUIRED: -32028,
15517
+ TOO_MANY_REQUESTS: -32029,
15518
+ CLIENT_CLOSED_REQUEST: -32099
15519
+ };
15520
+ var retryableRpcCodes = [
15521
+ TRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,
15522
+ TRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,
15523
+ TRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,
15524
+ TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
15525
+ ];
15526
+
15527
+ // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs
15528
+ var __create = Object.create;
15529
+ var __defProp = Object.defineProperty;
15530
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15531
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15532
+ var __getProtoOf = Object.getPrototypeOf;
15533
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15534
+ var __commonJS = (cb, mod) => function() {
15535
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15536
+ };
15537
+ var __copyProps = (to, from, except, desc) => {
15538
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15539
+ key = keys[i];
15540
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15541
+ get: ((k) => from[k]).bind(null, key),
15542
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15543
+ });
15544
+ }
15545
+ return to;
15546
+ };
15547
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
15548
+ value: mod,
15549
+ enumerable: true
15550
+ }) : target, mod));
15551
+ var noop = () => {
15552
+ };
15553
+ var freezeIfAvailable = (obj) => {
15554
+ if (Object.freeze) Object.freeze(obj);
15555
+ };
15556
+ function createInnerProxy(callback, path, memo) {
15557
+ var _memo$cacheKey;
15558
+ const cacheKey = path.join(".");
15559
+ (_memo$cacheKey = memo[cacheKey]) !== null && _memo$cacheKey !== void 0 || (memo[cacheKey] = new Proxy(noop, {
15560
+ get(_obj, key) {
15561
+ if (typeof key !== "string" || key === "then") return void 0;
15562
+ return createInnerProxy(callback, [...path, key], memo);
15563
+ },
15564
+ apply(_1, _2, args) {
15565
+ const lastOfPath = path[path.length - 1];
15566
+ if (lastOfPath === "valueOf" || lastOfPath === "toString" || lastOfPath === "toJSON") {
15567
+ const debugPath = path.slice(0, -1).join(".");
15568
+ return `tRPC.proxy(${debugPath})`;
14503
15569
  }
14504
- zodSchema = numberSchema;
14505
- break;
15570
+ let opts = {
15571
+ args,
15572
+ path
15573
+ };
15574
+ if (lastOfPath === "call") opts = {
15575
+ args: args.length >= 2 ? [args[1]] : [],
15576
+ path: path.slice(0, -1)
15577
+ };
15578
+ else if (lastOfPath === "apply") opts = {
15579
+ args: args.length >= 2 ? args[1] : [],
15580
+ path: path.slice(0, -1)
15581
+ };
15582
+ freezeIfAvailable(opts.args);
15583
+ freezeIfAvailable(opts.path);
15584
+ return callback(opts);
14506
15585
  }
14507
- case "boolean": {
14508
- zodSchema = z.boolean();
14509
- break;
15586
+ }));
15587
+ return memo[cacheKey];
15588
+ }
15589
+ var createRecursiveProxy = (callback) => createInnerProxy(callback, [], emptyObject());
15590
+ var require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
15591
+ function _typeof$2(o) {
15592
+ "@babel/helpers - typeof";
15593
+ return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
15594
+ return typeof o$1;
15595
+ } : function(o$1) {
15596
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
15597
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
15598
+ }
15599
+ module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
15600
+ } });
15601
+ var require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
15602
+ var _typeof$1 = require_typeof()["default"];
15603
+ function toPrimitive$1(t2, r) {
15604
+ if ("object" != _typeof$1(t2) || !t2) return t2;
15605
+ var e = t2[Symbol.toPrimitive];
15606
+ if (void 0 !== e) {
15607
+ var i = e.call(t2, r || "default");
15608
+ if ("object" != _typeof$1(i)) return i;
15609
+ throw new TypeError("@@toPrimitive must return a primitive value.");
15610
+ }
15611
+ return ("string" === r ? String : Number)(t2);
15612
+ }
15613
+ module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
15614
+ } });
15615
+ var require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
15616
+ var _typeof = require_typeof()["default"];
15617
+ var toPrimitive = require_toPrimitive();
15618
+ function toPropertyKey$1(t2) {
15619
+ var i = toPrimitive(t2, "string");
15620
+ return "symbol" == _typeof(i) ? i : i + "";
15621
+ }
15622
+ module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
15623
+ } });
15624
+ var require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
15625
+ var toPropertyKey = require_toPropertyKey();
15626
+ function _defineProperty(e, r, t2) {
15627
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
15628
+ value: t2,
15629
+ enumerable: true,
15630
+ configurable: true,
15631
+ writable: true
15632
+ }) : e[r] = t2, e;
15633
+ }
15634
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
15635
+ } });
15636
+ var require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
15637
+ var defineProperty = require_defineProperty();
15638
+ function ownKeys(e, r) {
15639
+ var t2 = Object.keys(e);
15640
+ if (Object.getOwnPropertySymbols) {
15641
+ var o = Object.getOwnPropertySymbols(e);
15642
+ r && (o = o.filter(function(r$1) {
15643
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
15644
+ })), t2.push.apply(t2, o);
14510
15645
  }
14511
- case "null": {
14512
- zodSchema = z.null();
14513
- break;
15646
+ return t2;
15647
+ }
15648
+ function _objectSpread2(e) {
15649
+ for (var r = 1; r < arguments.length; r++) {
15650
+ var t2 = null != arguments[r] ? arguments[r] : {};
15651
+ r % 2 ? ownKeys(Object(t2), true).forEach(function(r$1) {
15652
+ defineProperty(e, r$1, t2[r$1]);
15653
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r$1) {
15654
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t2, r$1));
15655
+ });
14514
15656
  }
14515
- case "object": {
14516
- const shape = {};
14517
- const properties = schema.properties || {};
14518
- const requiredSet = new Set(schema.required || []);
14519
- for (const [key, propSchema] of Object.entries(properties)) {
14520
- const propZodSchema = convertSchema(propSchema, ctx);
14521
- shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
14522
- }
14523
- if (schema.propertyNames) {
14524
- const keySchema = convertSchema(schema.propertyNames, ctx);
14525
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
14526
- if (Object.keys(shape).length === 0) {
14527
- zodSchema = z.record(keySchema, valueSchema);
14528
- break;
14529
- }
14530
- const objectSchema2 = z.object(shape).passthrough();
14531
- const recordSchema = z.looseRecord(keySchema, valueSchema);
14532
- zodSchema = z.intersection(objectSchema2, recordSchema);
14533
- break;
14534
- }
14535
- if (schema.patternProperties) {
14536
- const patternProps = schema.patternProperties;
14537
- const patternKeys = Object.keys(patternProps);
14538
- const looseRecords = [];
14539
- for (const pattern of patternKeys) {
14540
- const patternValue = convertSchema(patternProps[pattern], ctx);
14541
- const keySchema = z.string().regex(new RegExp(pattern));
14542
- looseRecords.push(z.looseRecord(keySchema, patternValue));
14543
- }
14544
- const schemasToIntersect = [];
14545
- if (Object.keys(shape).length > 0) {
14546
- schemasToIntersect.push(z.object(shape).passthrough());
14547
- }
14548
- schemasToIntersect.push(...looseRecords);
14549
- if (schemasToIntersect.length === 0) {
14550
- zodSchema = z.object({}).passthrough();
14551
- } else if (schemasToIntersect.length === 1) {
14552
- zodSchema = schemasToIntersect[0];
14553
- } else {
14554
- let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
14555
- for (let i = 2; i < schemasToIntersect.length; i++) {
14556
- result = z.intersection(result, schemasToIntersect[i]);
15657
+ return e;
15658
+ }
15659
+ module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
15660
+ } });
15661
+ var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
15662
+
15663
+ // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/tracked-DWInO6EQ.mjs
15664
+ init_esm_shims();
15665
+ var defaultFormatter = ({ shape }) => {
15666
+ return shape;
15667
+ };
15668
+ var import_defineProperty = __toESM(require_defineProperty(), 1);
15669
+ var UnknownCauseError = class extends Error {
15670
+ constructor(cause) {
15671
+ super(getMessage(cause));
15672
+ Object.assign(this, cause);
15673
+ }
15674
+ };
15675
+ function getMessage(cause) {
15676
+ if ("message" in cause) return String(cause.message);
15677
+ return void 0;
15678
+ }
15679
+ function getCauseFromUnknown(cause) {
15680
+ if (cause instanceof Error) return cause;
15681
+ const type = typeof cause;
15682
+ if (type === "undefined" || type === "function" || cause === null) return void 0;
15683
+ if (type !== "object") return new Error(String(cause));
15684
+ if (isObject2(cause)) return new UnknownCauseError(cause);
15685
+ return void 0;
15686
+ }
15687
+ function getTRPCErrorFromUnknown(cause) {
15688
+ if (cause instanceof TRPCError) return cause;
15689
+ if (cause instanceof Error && cause.name === "TRPCError") return cause;
15690
+ const trpcError = new TRPCError({
15691
+ code: "INTERNAL_SERVER_ERROR",
15692
+ cause
15693
+ });
15694
+ if (cause instanceof Error && cause.stack) trpcError.stack = cause.stack;
15695
+ return trpcError;
15696
+ }
15697
+ var TRPCError = class extends Error {
15698
+ constructor(opts) {
15699
+ var _ref, _opts$message, _this$cause;
15700
+ const cause = getCauseFromUnknown(opts.cause);
15701
+ const message = (_ref = (_opts$message = opts.message) !== null && _opts$message !== void 0 ? _opts$message : cause === null || cause === void 0 ? void 0 : cause.message) !== null && _ref !== void 0 ? _ref : opts.code;
15702
+ super(message, { cause });
15703
+ (0, import_defineProperty.default)(this, "cause", void 0);
15704
+ (0, import_defineProperty.default)(this, "code", void 0);
15705
+ this.code = opts.code;
15706
+ this.name = "TRPCError";
15707
+ (_this$cause = this.cause) !== null && _this$cause !== void 0 || (this.cause = cause);
15708
+ }
15709
+ };
15710
+ var import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);
15711
+ function getDataTransformer(transformer) {
15712
+ if ("input" in transformer) return transformer;
15713
+ return {
15714
+ input: transformer,
15715
+ output: transformer
15716
+ };
15717
+ }
15718
+ var defaultTransformer = {
15719
+ input: {
15720
+ serialize: (obj) => obj,
15721
+ deserialize: (obj) => obj
15722
+ },
15723
+ output: {
15724
+ serialize: (obj) => obj,
15725
+ deserialize: (obj) => obj
15726
+ }
15727
+ };
15728
+ var import_objectSpread22 = __toESM(require_objectSpread2(), 1);
15729
+ var lazyMarker = "lazyMarker";
15730
+ function once(fn) {
15731
+ const uncalled = /* @__PURE__ */ Symbol();
15732
+ let result = uncalled;
15733
+ return () => {
15734
+ if (result === uncalled) result = fn();
15735
+ return result;
15736
+ };
15737
+ }
15738
+ function isLazy(input) {
15739
+ return typeof input === "function" && lazyMarker in input;
15740
+ }
15741
+ function isRouter(value) {
15742
+ return isObject2(value) && isObject2(value["_def"]) && "router" in value["_def"];
15743
+ }
15744
+ var emptyRouter = {
15745
+ _ctx: null,
15746
+ _errorShape: null,
15747
+ _meta: null,
15748
+ queries: {},
15749
+ mutations: {},
15750
+ subscriptions: {},
15751
+ errorFormatter: defaultFormatter,
15752
+ transformer: defaultTransformer
15753
+ };
15754
+ var reservedWords = [
15755
+ "then",
15756
+ "call",
15757
+ "apply"
15758
+ ];
15759
+ function createRouterFactory(config2) {
15760
+ function createRouterInner(input) {
15761
+ const reservedWordsUsed = new Set(Object.keys(input).filter((v) => reservedWords.includes(v)));
15762
+ if (reservedWordsUsed.size > 0) throw new Error("Reserved words used in `router({})` call: " + Array.from(reservedWordsUsed).join(", "));
15763
+ const procedures = emptyObject();
15764
+ const lazy$1 = emptyObject();
15765
+ function createLazyLoader(opts) {
15766
+ return {
15767
+ ref: opts.ref,
15768
+ load: once(async () => {
15769
+ const router$1 = await opts.ref();
15770
+ const lazyPath = [...opts.path, opts.key];
15771
+ const lazyKey = lazyPath.join(".");
15772
+ opts.aggregate[opts.key] = step(router$1._def.record, lazyPath);
15773
+ delete lazy$1[lazyKey];
15774
+ for (const [nestedKey, nestedItem] of Object.entries(router$1._def.lazy)) {
15775
+ const nestedRouterKey = [...lazyPath, nestedKey].join(".");
15776
+ lazy$1[nestedRouterKey] = createLazyLoader({
15777
+ ref: nestedItem.ref,
15778
+ path: lazyPath,
15779
+ key: nestedKey,
15780
+ aggregate: opts.aggregate[opts.key]
15781
+ });
14557
15782
  }
14558
- zodSchema = result;
14559
- }
14560
- break;
14561
- }
14562
- const objectSchema = z.object(shape);
14563
- if (schema.additionalProperties === false) {
14564
- zodSchema = objectSchema.strict();
14565
- } else if (typeof schema.additionalProperties === "object") {
14566
- zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
14567
- } else {
14568
- zodSchema = objectSchema.passthrough();
14569
- }
14570
- break;
14571
- }
14572
- case "array": {
14573
- const prefixItems = schema.prefixItems;
14574
- const items = schema.items;
14575
- if (prefixItems && Array.isArray(prefixItems)) {
14576
- const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
14577
- const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
14578
- if (rest) {
14579
- zodSchema = z.tuple(tupleItems).rest(rest);
14580
- } else {
14581
- zodSchema = z.tuple(tupleItems);
14582
- }
14583
- if (typeof schema.minItems === "number") {
14584
- zodSchema = zodSchema.check(z.minLength(schema.minItems));
14585
- }
14586
- if (typeof schema.maxItems === "number") {
14587
- zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
14588
- }
14589
- } else if (Array.isArray(items)) {
14590
- const tupleItems = items.map((item) => convertSchema(item, ctx));
14591
- const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
14592
- if (rest) {
14593
- zodSchema = z.tuple(tupleItems).rest(rest);
14594
- } else {
14595
- zodSchema = z.tuple(tupleItems);
14596
- }
14597
- if (typeof schema.minItems === "number") {
14598
- zodSchema = zodSchema.check(z.minLength(schema.minItems));
14599
- }
14600
- if (typeof schema.maxItems === "number") {
14601
- zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
15783
+ })
15784
+ };
15785
+ }
15786
+ function step(from, path = []) {
15787
+ const aggregate = emptyObject();
15788
+ for (const [key, item] of Object.entries(from !== null && from !== void 0 ? from : {})) {
15789
+ if (isLazy(item)) {
15790
+ lazy$1[[...path, key].join(".")] = createLazyLoader({
15791
+ path,
15792
+ ref: item,
15793
+ key,
15794
+ aggregate
15795
+ });
15796
+ continue;
14602
15797
  }
14603
- } else if (items !== void 0) {
14604
- const element = convertSchema(items, ctx);
14605
- let arraySchema = z.array(element);
14606
- if (typeof schema.minItems === "number") {
14607
- arraySchema = arraySchema.min(schema.minItems);
15798
+ if (isRouter(item)) {
15799
+ aggregate[key] = step(item._def.record, [...path, key]);
15800
+ continue;
14608
15801
  }
14609
- if (typeof schema.maxItems === "number") {
14610
- arraySchema = arraySchema.max(schema.maxItems);
15802
+ if (!isProcedure(item)) {
15803
+ aggregate[key] = step(item, [...path, key]);
15804
+ continue;
14611
15805
  }
14612
- zodSchema = arraySchema;
14613
- } else {
14614
- zodSchema = z.array(z.any());
15806
+ const newPath = [...path, key].join(".");
15807
+ if (procedures[newPath]) throw new Error(`Duplicate key: ${newPath}`);
15808
+ procedures[newPath] = item;
15809
+ aggregate[key] = item;
14615
15810
  }
14616
- break;
15811
+ return aggregate;
14617
15812
  }
14618
- default:
14619
- throw new Error(`Unsupported type: ${type}`);
14620
- }
14621
- if (schema.description) {
14622
- zodSchema = zodSchema.describe(schema.description);
14623
- }
14624
- if (schema.default !== void 0) {
14625
- zodSchema = zodSchema.default(schema.default);
15813
+ const record2 = step(input);
15814
+ const _def = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({
15815
+ _config: config2,
15816
+ router: true,
15817
+ procedures,
15818
+ lazy: lazy$1
15819
+ }, emptyRouter), {}, { record: record2 });
15820
+ const router = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({}, record2), {}, {
15821
+ _def,
15822
+ createCaller: createCallerFactory()({ _def })
15823
+ });
15824
+ return router;
14626
15825
  }
14627
- return zodSchema;
15826
+ return createRouterInner;
14628
15827
  }
14629
- function convertSchema(schema, ctx) {
14630
- if (typeof schema === "boolean") {
14631
- return schema ? z.any() : z.never();
14632
- }
14633
- let baseSchema = convertBaseSchema(schema, ctx);
14634
- const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
14635
- if (schema.anyOf && Array.isArray(schema.anyOf)) {
14636
- const options = schema.anyOf.map((s) => convertSchema(s, ctx));
14637
- const anyOfUnion = z.union(options);
14638
- baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
14639
- }
14640
- if (schema.oneOf && Array.isArray(schema.oneOf)) {
14641
- const options = schema.oneOf.map((s) => convertSchema(s, ctx));
14642
- const oneOfUnion = z.xor(options);
14643
- baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
15828
+ function isProcedure(procedureOrRouter) {
15829
+ return typeof procedureOrRouter === "function";
15830
+ }
15831
+ async function getProcedureAtPath(router, path) {
15832
+ const { _def } = router;
15833
+ let procedure = _def.procedures[path];
15834
+ while (!procedure) {
15835
+ const key = Object.keys(_def.lazy).find((key$1) => path.startsWith(key$1));
15836
+ if (!key) return null;
15837
+ const lazyRouter = _def.lazy[key];
15838
+ await lazyRouter.load();
15839
+ procedure = _def.procedures[path];
14644
15840
  }
14645
- if (schema.allOf && Array.isArray(schema.allOf)) {
14646
- if (schema.allOf.length === 0) {
14647
- baseSchema = hasExplicitType ? baseSchema : z.any();
14648
- } else {
14649
- let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
14650
- const startIdx = hasExplicitType ? 0 : 1;
14651
- for (let i = startIdx; i < schema.allOf.length; i++) {
14652
- result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
14653
- }
14654
- baseSchema = result;
15841
+ return procedure;
15842
+ }
15843
+ function createCallerFactory() {
15844
+ return function createCallerInner(router) {
15845
+ const { _def } = router;
15846
+ return function createCaller(ctxOrCallback, opts) {
15847
+ return createRecursiveProxy(async (innerOpts) => {
15848
+ const { path, args } = innerOpts;
15849
+ const fullPath = path.join(".");
15850
+ if (path.length === 1 && path[0] === "_def") return _def;
15851
+ const procedure = await getProcedureAtPath(router, fullPath);
15852
+ let ctx = void 0;
15853
+ try {
15854
+ if (!procedure) throw new TRPCError({
15855
+ code: "NOT_FOUND",
15856
+ message: `No procedure found on path "${path}"`
15857
+ });
15858
+ ctx = isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
15859
+ return await procedure({
15860
+ path: fullPath,
15861
+ getRawInput: async () => args[0],
15862
+ ctx,
15863
+ type: procedure._def.type,
15864
+ signal: opts === null || opts === void 0 ? void 0 : opts.signal,
15865
+ batchIndex: 0
15866
+ });
15867
+ } catch (cause) {
15868
+ var _opts$onError, _procedure$_def$type;
15869
+ opts === null || opts === void 0 || (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {
15870
+ ctx,
15871
+ error: getTRPCErrorFromUnknown(cause),
15872
+ input: args[0],
15873
+ path: fullPath,
15874
+ type: (_procedure$_def$type = procedure === null || procedure === void 0 ? void 0 : procedure._def.type) !== null && _procedure$_def$type !== void 0 ? _procedure$_def$type : "unknown"
15875
+ });
15876
+ throw cause;
15877
+ }
15878
+ });
15879
+ };
15880
+ };
15881
+ }
15882
+ function mergeRouters(...routerList) {
15883
+ var _routerList$, _routerList$2;
15884
+ const record2 = mergeWithoutOverrides({}, ...routerList.map((r) => r._def.record));
15885
+ const errorFormatter = routerList.reduce((currentErrorFormatter, nextRouter) => {
15886
+ if (nextRouter._def._config.errorFormatter && nextRouter._def._config.errorFormatter !== defaultFormatter) {
15887
+ if (currentErrorFormatter !== defaultFormatter && currentErrorFormatter !== nextRouter._def._config.errorFormatter) throw new Error("You seem to have several error formatters");
15888
+ return nextRouter._def._config.errorFormatter;
14655
15889
  }
15890
+ return currentErrorFormatter;
15891
+ }, defaultFormatter);
15892
+ const transformer = routerList.reduce((prev, current) => {
15893
+ if (current._def._config.transformer && current._def._config.transformer !== defaultTransformer) {
15894
+ if (prev !== defaultTransformer && prev !== current._def._config.transformer) throw new Error("You seem to have several transformers");
15895
+ return current._def._config.transformer;
15896
+ }
15897
+ return prev;
15898
+ }, defaultTransformer);
15899
+ const router = createRouterFactory({
15900
+ errorFormatter,
15901
+ transformer,
15902
+ isDev: routerList.every((r) => r._def._config.isDev),
15903
+ allowOutsideOfServer: routerList.every((r) => r._def._config.allowOutsideOfServer),
15904
+ isServer: routerList.every((r) => r._def._config.isServer),
15905
+ $types: (_routerList$ = routerList[0]) === null || _routerList$ === void 0 ? void 0 : _routerList$._def._config.$types,
15906
+ sse: (_routerList$2 = routerList[0]) === null || _routerList$2 === void 0 ? void 0 : _routerList$2._def._config.sse
15907
+ })(record2);
15908
+ return router;
15909
+ }
15910
+
15911
+ // ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/initTRPC-BRf4imah.mjs
15912
+ init_esm_shims();
15913
+ var import_objectSpread2$2 = __toESM(require_objectSpread2(), 1);
15914
+ var middlewareMarker = "middlewareMarker";
15915
+ function createMiddlewareFactory() {
15916
+ function createMiddlewareInner(middlewares) {
15917
+ return {
15918
+ _middlewares: middlewares,
15919
+ unstable_pipe(middlewareBuilderOrFn) {
15920
+ const pipedMiddleware = "_middlewares" in middlewareBuilderOrFn ? middlewareBuilderOrFn._middlewares : [middlewareBuilderOrFn];
15921
+ return createMiddlewareInner([...middlewares, ...pipedMiddleware]);
15922
+ }
15923
+ };
14656
15924
  }
14657
- if (schema.nullable === true && ctx.version === "openapi-3.0") {
14658
- baseSchema = z.nullable(baseSchema);
14659
- }
14660
- if (schema.readOnly === true) {
14661
- baseSchema = z.readonly(baseSchema);
15925
+ function createMiddleware(fn) {
15926
+ return createMiddlewareInner([fn]);
14662
15927
  }
14663
- const extraMeta = {};
14664
- const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
14665
- for (const key of coreMetadataKeys) {
14666
- if (key in schema) {
14667
- extraMeta[key] = schema[key];
15928
+ return createMiddleware;
15929
+ }
15930
+ function createInputMiddleware(parse3) {
15931
+ const inputMiddleware = async function inputValidatorMiddleware(opts) {
15932
+ let parsedInput;
15933
+ const rawInput = await opts.getRawInput();
15934
+ try {
15935
+ parsedInput = await parse3(rawInput);
15936
+ } catch (cause) {
15937
+ throw new TRPCError({
15938
+ code: "BAD_REQUEST",
15939
+ cause
15940
+ });
15941
+ }
15942
+ const combinedInput = isObject2(opts.input) && isObject2(parsedInput) ? (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, opts.input), parsedInput) : parsedInput;
15943
+ return opts.next({ input: combinedInput });
15944
+ };
15945
+ inputMiddleware._type = "input";
15946
+ return inputMiddleware;
15947
+ }
15948
+ function createOutputMiddleware(parse3) {
15949
+ const outputMiddleware = async function outputValidatorMiddleware({ next }) {
15950
+ const result = await next();
15951
+ if (!result.ok) return result;
15952
+ try {
15953
+ const data = await parse3(result.data);
15954
+ return (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, result), {}, { data });
15955
+ } catch (cause) {
15956
+ throw new TRPCError({
15957
+ message: "Output validation failed",
15958
+ code: "INTERNAL_SERVER_ERROR",
15959
+ cause
15960
+ });
14668
15961
  }
15962
+ };
15963
+ outputMiddleware._type = "output";
15964
+ return outputMiddleware;
15965
+ }
15966
+ var import_defineProperty2 = __toESM(require_defineProperty(), 1);
15967
+ var StandardSchemaV1Error = class extends Error {
15968
+ /**
15969
+ * Creates a schema error with useful information.
15970
+ *
15971
+ * @param issues The schema issues.
15972
+ */
15973
+ constructor(issues) {
15974
+ var _issues$;
15975
+ super((_issues$ = issues[0]) === null || _issues$ === void 0 ? void 0 : _issues$.message);
15976
+ (0, import_defineProperty2.default)(this, "issues", void 0);
15977
+ this.name = "SchemaError";
15978
+ this.issues = issues;
14669
15979
  }
14670
- const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
14671
- for (const key of contentMetadataKeys) {
14672
- if (key in schema) {
14673
- extraMeta[key] = schema[key];
15980
+ };
15981
+ function getParseFn(procedureParser) {
15982
+ const parser = procedureParser;
15983
+ const isStandardSchema = "~standard" in parser;
15984
+ if (typeof parser === "function" && typeof parser.assert === "function") return parser.assert.bind(parser);
15985
+ if (typeof parser === "function" && !isStandardSchema) return parser;
15986
+ if (typeof parser.parseAsync === "function") return parser.parseAsync.bind(parser);
15987
+ if (typeof parser.parse === "function") return parser.parse.bind(parser);
15988
+ if (typeof parser.validateSync === "function") return parser.validateSync.bind(parser);
15989
+ if (typeof parser.create === "function") return parser.create.bind(parser);
15990
+ if (typeof parser.assert === "function") return (value) => {
15991
+ parser.assert(value);
15992
+ return value;
15993
+ };
15994
+ if (isStandardSchema) return async (value) => {
15995
+ const result = await parser["~standard"].validate(value);
15996
+ if (result.issues) throw new StandardSchemaV1Error(result.issues);
15997
+ return result.value;
15998
+ };
15999
+ throw new Error("Could not find a validator fn");
16000
+ }
16001
+ var require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
16002
+ function _objectWithoutPropertiesLoose(r, e) {
16003
+ if (null == r) return {};
16004
+ var t2 = {};
16005
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
16006
+ if (e.includes(n)) continue;
16007
+ t2[n] = r[n];
14674
16008
  }
16009
+ return t2;
14675
16010
  }
14676
- for (const key of Object.keys(schema)) {
14677
- if (!RECOGNIZED_KEYS.has(key)) {
14678
- extraMeta[key] = schema[key];
16011
+ module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
16012
+ } });
16013
+ var require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
16014
+ var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
16015
+ function _objectWithoutProperties$1(e, t2) {
16016
+ if (null == e) return {};
16017
+ var o, r, i = objectWithoutPropertiesLoose(e, t2);
16018
+ if (Object.getOwnPropertySymbols) {
16019
+ var s = Object.getOwnPropertySymbols(e);
16020
+ for (r = 0; r < s.length; r++) o = s[r], t2.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
14679
16021
  }
16022
+ return i;
14680
16023
  }
14681
- if (Object.keys(extraMeta).length > 0) {
14682
- ctx.registry.add(baseSchema, extraMeta);
14683
- }
14684
- return baseSchema;
16024
+ module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
16025
+ } });
16026
+ var import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
16027
+ var import_objectSpread2$12 = __toESM(require_objectSpread2(), 1);
16028
+ var _excluded = [
16029
+ "middlewares",
16030
+ "inputs",
16031
+ "meta"
16032
+ ];
16033
+ function createNewBuilder(def1, def2) {
16034
+ const { middlewares = [], inputs, meta: meta3 } = def2, rest = (0, import_objectWithoutProperties.default)(def2, _excluded);
16035
+ return createBuilder2((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, mergeWithoutOverrides(def1, rest)), {}, {
16036
+ inputs: [...def1.inputs, ...inputs !== null && inputs !== void 0 ? inputs : []],
16037
+ middlewares: [...def1.middlewares, ...middlewares],
16038
+ meta: def1.meta && meta3 ? (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, def1.meta), meta3) : meta3 !== null && meta3 !== void 0 ? meta3 : def1.meta
16039
+ }));
14685
16040
  }
14686
- function fromJSONSchema(schema, params) {
14687
- if (typeof schema === "boolean") {
14688
- return schema ? z.any() : z.never();
14689
- }
14690
- const version2 = detectVersion(schema, params?.defaultTarget);
14691
- const defs = schema.$defs || schema.definitions || {};
14692
- const ctx = {
14693
- version: version2,
14694
- defs,
14695
- refs: /* @__PURE__ */ new Map(),
14696
- processing: /* @__PURE__ */ new Set(),
14697
- rootSchema: schema,
14698
- registry: params?.registry ?? globalRegistry
16041
+ function createBuilder2(initDef = {}) {
16042
+ const _def = (0, import_objectSpread2$12.default)({
16043
+ procedure: true,
16044
+ inputs: [],
16045
+ middlewares: []
16046
+ }, initDef);
16047
+ const builder = {
16048
+ _def,
16049
+ input(input) {
16050
+ const parser = getParseFn(input);
16051
+ return createNewBuilder(_def, {
16052
+ inputs: [input],
16053
+ middlewares: [createInputMiddleware(parser)]
16054
+ });
16055
+ },
16056
+ output(output) {
16057
+ const parser = getParseFn(output);
16058
+ return createNewBuilder(_def, {
16059
+ output,
16060
+ middlewares: [createOutputMiddleware(parser)]
16061
+ });
16062
+ },
16063
+ meta(meta3) {
16064
+ return createNewBuilder(_def, { meta: meta3 });
16065
+ },
16066
+ use(middlewareBuilderOrFn) {
16067
+ const middlewares = "_middlewares" in middlewareBuilderOrFn ? middlewareBuilderOrFn._middlewares : [middlewareBuilderOrFn];
16068
+ return createNewBuilder(_def, { middlewares });
16069
+ },
16070
+ unstable_concat(builder$1) {
16071
+ return createNewBuilder(_def, builder$1._def);
16072
+ },
16073
+ concat(builder$1) {
16074
+ return createNewBuilder(_def, builder$1._def);
16075
+ },
16076
+ query(resolver) {
16077
+ return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "query" }), resolver);
16078
+ },
16079
+ mutation(resolver) {
16080
+ return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "mutation" }), resolver);
16081
+ },
16082
+ subscription(resolver) {
16083
+ return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "subscription" }), resolver);
16084
+ },
16085
+ experimental_caller(caller) {
16086
+ return createNewBuilder(_def, { caller });
16087
+ }
14699
16088
  };
14700
- return convertSchema(schema, ctx);
14701
- }
14702
-
14703
- // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/coerce.js
14704
- var coerce_exports = {};
14705
- __export(coerce_exports, {
14706
- bigint: () => bigint3,
14707
- boolean: () => boolean3,
14708
- date: () => date4,
14709
- number: () => number3,
14710
- string: () => string3
14711
- });
14712
- init_esm_shims();
14713
- function string3(params) {
14714
- return _coercedString(ZodString, params);
14715
- }
14716
- function number3(params) {
14717
- return _coercedNumber(ZodNumber, params);
16089
+ return builder;
14718
16090
  }
14719
- function boolean3(params) {
14720
- return _coercedBoolean(ZodBoolean, params);
16091
+ function createResolver(_defIn, resolver) {
16092
+ const finalBuilder = createNewBuilder(_defIn, {
16093
+ resolver,
16094
+ middlewares: [async function resolveMiddleware(opts) {
16095
+ const data = await resolver(opts);
16096
+ return {
16097
+ marker: middlewareMarker,
16098
+ ok: true,
16099
+ data,
16100
+ ctx: opts.ctx
16101
+ };
16102
+ }]
16103
+ });
16104
+ const _def = (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, finalBuilder._def), {}, {
16105
+ type: _defIn.type,
16106
+ experimental_caller: Boolean(finalBuilder._def.caller),
16107
+ meta: finalBuilder._def.meta,
16108
+ $types: null
16109
+ });
16110
+ const invoke = createProcedureCaller(finalBuilder._def);
16111
+ const callerOverride = finalBuilder._def.caller;
16112
+ if (!callerOverride) return invoke;
16113
+ const callerWrapper = async (...args) => {
16114
+ return await callerOverride({
16115
+ args,
16116
+ invoke,
16117
+ _def
16118
+ });
16119
+ };
16120
+ callerWrapper._def = _def;
16121
+ return callerWrapper;
14721
16122
  }
14722
- function bigint3(params) {
14723
- return _coercedBigint(ZodBigInt, params);
16123
+ var codeblock = `
16124
+ This is a client-only function.
16125
+ If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
16126
+ `.trim();
16127
+ async function callRecursive(index, _def, opts) {
16128
+ try {
16129
+ const middleware = _def.middlewares[index];
16130
+ const result = await middleware((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts), {}, {
16131
+ meta: _def.meta,
16132
+ input: opts.input,
16133
+ next(_nextOpts) {
16134
+ var _nextOpts$getRawInput;
16135
+ const nextOpts = _nextOpts;
16136
+ return callRecursive(index + 1, _def, (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts), {}, {
16137
+ ctx: (nextOpts === null || nextOpts === void 0 ? void 0 : nextOpts.ctx) ? (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts.ctx), nextOpts.ctx) : opts.ctx,
16138
+ input: nextOpts && "input" in nextOpts ? nextOpts.input : opts.input,
16139
+ getRawInput: (_nextOpts$getRawInput = nextOpts === null || nextOpts === void 0 ? void 0 : nextOpts.getRawInput) !== null && _nextOpts$getRawInput !== void 0 ? _nextOpts$getRawInput : opts.getRawInput
16140
+ }));
16141
+ }
16142
+ }));
16143
+ return result;
16144
+ } catch (cause) {
16145
+ return {
16146
+ ok: false,
16147
+ error: getTRPCErrorFromUnknown(cause),
16148
+ marker: middlewareMarker
16149
+ };
16150
+ }
14724
16151
  }
14725
- function date4(params) {
14726
- return _coercedDate(ZodDate, params);
16152
+ function createProcedureCaller(_def) {
16153
+ async function procedure(opts) {
16154
+ if (!opts || !("getRawInput" in opts)) throw new Error(codeblock);
16155
+ const result = await callRecursive(0, _def, opts);
16156
+ if (!result) throw new TRPCError({
16157
+ code: "INTERNAL_SERVER_ERROR",
16158
+ message: "No result from middlewares - did you forget to `return next()`?"
16159
+ });
16160
+ if (!result.ok) throw result.error;
16161
+ return result.data;
16162
+ }
16163
+ procedure._def = _def;
16164
+ procedure.procedure = true;
16165
+ procedure.meta = _def.meta;
16166
+ return procedure;
14727
16167
  }
14728
-
14729
- // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
14730
- config(en_default());
16168
+ var _globalThis$process;
16169
+ var _globalThis$process2;
16170
+ var _globalThis$process3;
16171
+ var isServerDefault = typeof window === "undefined" || "Deno" in window || ((_globalThis$process = globalThis.process) === null || _globalThis$process === void 0 || (_globalThis$process = _globalThis$process.env) === null || _globalThis$process === void 0 ? void 0 : _globalThis$process["NODE_ENV"]) === "test" || !!((_globalThis$process2 = globalThis.process) === null || _globalThis$process2 === void 0 || (_globalThis$process2 = _globalThis$process2.env) === null || _globalThis$process2 === void 0 ? void 0 : _globalThis$process2["JEST_WORKER_ID"]) || !!((_globalThis$process3 = globalThis.process) === null || _globalThis$process3 === void 0 || (_globalThis$process3 = _globalThis$process3.env) === null || _globalThis$process3 === void 0 ? void 0 : _globalThis$process3["VITEST_WORKER_ID"]);
16172
+ var import_objectSpread23 = __toESM(require_objectSpread2(), 1);
16173
+ var TRPCBuilder = class TRPCBuilder2 {
16174
+ /**
16175
+ * Add a context shape as a generic to the root object
16176
+ * @see https://trpc.io/docs/v11/server/context
16177
+ */
16178
+ context() {
16179
+ return new TRPCBuilder2();
16180
+ }
16181
+ /**
16182
+ * Add a meta shape as a generic to the root object
16183
+ * @see https://trpc.io/docs/v11/quickstart
16184
+ */
16185
+ meta() {
16186
+ return new TRPCBuilder2();
16187
+ }
16188
+ /**
16189
+ * Create the root object
16190
+ * @see https://trpc.io/docs/v11/server/routers#initialize-trpc
16191
+ */
16192
+ create(opts) {
16193
+ var _opts$transformer, _opts$isDev, _globalThis$process$1, _opts$allowOutsideOfS, _opts$errorFormatter, _opts$isServer;
16194
+ const config2 = (0, import_objectSpread23.default)((0, import_objectSpread23.default)({}, opts), {}, {
16195
+ transformer: getDataTransformer((_opts$transformer = opts === null || opts === void 0 ? void 0 : opts.transformer) !== null && _opts$transformer !== void 0 ? _opts$transformer : defaultTransformer),
16196
+ isDev: (_opts$isDev = opts === null || opts === void 0 ? void 0 : opts.isDev) !== null && _opts$isDev !== void 0 ? _opts$isDev : ((_globalThis$process$1 = globalThis.process) === null || _globalThis$process$1 === void 0 ? void 0 : _globalThis$process$1.env["NODE_ENV"]) !== "production",
16197
+ allowOutsideOfServer: (_opts$allowOutsideOfS = opts === null || opts === void 0 ? void 0 : opts.allowOutsideOfServer) !== null && _opts$allowOutsideOfS !== void 0 ? _opts$allowOutsideOfS : false,
16198
+ errorFormatter: (_opts$errorFormatter = opts === null || opts === void 0 ? void 0 : opts.errorFormatter) !== null && _opts$errorFormatter !== void 0 ? _opts$errorFormatter : defaultFormatter,
16199
+ isServer: (_opts$isServer = opts === null || opts === void 0 ? void 0 : opts.isServer) !== null && _opts$isServer !== void 0 ? _opts$isServer : isServerDefault,
16200
+ $types: null
16201
+ });
16202
+ {
16203
+ var _opts$isServer2;
16204
+ const isServer = (_opts$isServer2 = opts === null || opts === void 0 ? void 0 : opts.isServer) !== null && _opts$isServer2 !== void 0 ? _opts$isServer2 : isServerDefault;
16205
+ if (!isServer && (opts === null || opts === void 0 ? void 0 : opts.allowOutsideOfServer) !== true) throw new Error(`You're trying to use @trpc/server in a non-server environment. This is not supported by default.`);
16206
+ }
16207
+ return {
16208
+ _config: config2,
16209
+ procedure: createBuilder2({ meta: opts === null || opts === void 0 ? void 0 : opts.defaultMeta }),
16210
+ middleware: createMiddlewareFactory(),
16211
+ router: createRouterFactory(config2),
16212
+ mergeRouters,
16213
+ createCallerFactory: createCallerFactory()
16214
+ };
16215
+ }
16216
+ };
16217
+ var initTRPC = new TRPCBuilder();
14731
16218
 
14732
16219
  // ../../packages/api-contracts/src/contracts/trpc-contract.ts
14733
16220
  var t = initTRPC.create({
@@ -14959,7 +16446,7 @@ function createCliClientHeaderInjector(options) {
14959
16446
  };
14960
16447
  }
14961
16448
  var addDefaultCliClientHeaders = createCliClientHeaderInjector({
14962
- clientVersion: "9.238.3"
16449
+ clientVersion: "9.238.5"
14963
16450
  });
14964
16451
  function addCliClientHeaders(headers) {
14965
16452
  addDefaultCliClientHeaders(headers);
@@ -15808,6 +17295,7 @@ async function transcribeAudio(audioPath, options = {}) {
15808
17295
  }
15809
17296
 
15810
17297
  export {
17298
+ source_default,
15811
17299
  loadConfig,
15812
17300
  saveConfig,
15813
17301
  getToken,
@@ -15820,6 +17308,23 @@ export {
15820
17308
  initClient,
15821
17309
  headersWithCliClientHeaders,
15822
17310
  cliClientHeaderApi,
17311
+ modelProviderCodexRuntimeConfigSchema,
17312
+ supportedRunModelSchema,
17313
+ isSupportedRunModel,
17314
+ getVm0ModelPriceTier,
17315
+ MODEL_PROVIDER_TYPES,
17316
+ getSelectableProviderTypes,
17317
+ modelProviderTypeSchema,
17318
+ hasAuthMethods,
17319
+ getAuthMethodsForType,
17320
+ getDefaultAuthMethod,
17321
+ getSecretsForAuthMethod,
17322
+ modelProviderResponseSchema,
17323
+ modelProviderListResponseSchema,
17324
+ upsertModelProviderRequestSchema,
17325
+ upsertModelProviderResponseSchema,
17326
+ orgModelPoliciesResponseSchema,
17327
+ updateOrgModelPoliciesRequestSchema,
15823
17328
  apiErrorSchema,
15824
17329
  ApiRequestError,
15825
17330
  getBaseUrl,
@@ -15833,4 +17338,4 @@ export {
15833
17338
  generateWebVideo,
15834
17339
  transcribeAudio
15835
17340
  };
15836
- //# sourceMappingURL=chunk-22VWTDX6.js.map
17341
+ //# sourceMappingURL=chunk-VC7E6IA7.js.map