@opentig/cli 0.1.6 → 0.1.7

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 (110) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/chunks/{cli-ABzC6-gR.mjs → cli-DCPhUVBb.mjs} +1 -1
  3. package/dist/client/assets/App-CGiS2z40.js +74 -0
  4. package/dist/client/assets/{CreatePullRequestDialog-W82oHjYm.js → CreatePullRequestDialog-dNbTTo9i.js} +2 -2
  5. package/dist/client/assets/{DiffWorkspace-BWkTIl5n.js → DiffWorkspace-XS025gbZ.js} +1 -1
  6. package/dist/client/assets/{EditableFileViewer-Cv3aNJBN.js → EditableFileViewer-Cve4V9RS.js} +1 -1
  7. package/dist/client/assets/{File-DiOOsHOl.js → File-BJuBDans.js} +1 -1
  8. package/dist/client/assets/{FilesView-DIqPfRbv.js → FilesView-BUAz46Qa.js} +1 -1
  9. package/dist/client/assets/GitHubAvatar-Depnd_JA.js +1 -0
  10. package/dist/client/assets/HistoryView-Dd4Kr4KN.js +1 -0
  11. package/dist/client/assets/{HtmlFileViewer-BsewwJtM.js → HtmlFileViewer-C3Qylr9B.js} +1 -1
  12. package/dist/client/assets/{IconEdit-CxvzMyLV.js → IconEdit-BHqlqze_.js} +1 -1
  13. package/dist/client/assets/{IconFolderPlus-1vLDIzhC.js → IconFolderPlus-BJIo1hfe.js} +1 -1
  14. package/dist/client/assets/{ImageFileViewer-CoQZkgET.js → ImageFileViewer-BJy0ptmR.js} +1 -1
  15. package/dist/client/assets/{LocalRefsDialog-sw-ROjfe.js → LocalRefsDialog-C1MWMkv1.js} +1 -1
  16. package/dist/client/assets/{MarkdownFileViewer-BedKCXTI.js → MarkdownFileViewer-pagMxv2y.js} +2 -2
  17. package/dist/client/assets/{PairingPage-CYJXzBZC.js → PairingPage-DOPAXy3a.js} +1 -1
  18. package/dist/client/assets/{PierreDiffViewer-uhTsb-F7.js → PierreDiffViewer-FmgbHdls.js} +1 -1
  19. package/dist/client/assets/{PierreEditBoundary-Bb4dONIq.js → PierreEditBoundary-mxtF7x3F.js} +1 -1
  20. package/dist/client/assets/{PierreWorkerPool-BuBzE8K1.js → PierreWorkerPool-B_NFnwU-.js} +1 -1
  21. package/dist/client/assets/{PullRequestDiff-CgY4QIHC.js → PullRequestDiff-Bcu8Gmrf.js} +1 -1
  22. package/dist/client/assets/PullRequestViewer-oeDoq-3g.js +2 -0
  23. package/dist/client/assets/PullRequestsView-DpTtagTX.js +1 -0
  24. package/dist/client/assets/{QuickOpenDialog-Cn-aQRAS.js → QuickOpenDialog-rjeV0l_J.js} +1 -1
  25. package/dist/client/assets/RepositoryProjectsDialog-QYXEt7Lg.js +1 -0
  26. package/dist/client/assets/{SearchView-BtKBEJ7e.js → SearchView-C-c6oCil.js} +1 -1
  27. package/dist/client/assets/{SettingsDialog-wfWhEzZY.js → SettingsDialog-DHmWkKYV.js} +2 -2
  28. package/dist/client/assets/Viewer-B6qUr83C.js +3 -0
  29. package/dist/client/assets/{abnfDiagram-N423BO3Z-DLBLFOdy.js → abnfDiagram-N423BO3Z-BxGW6tGd.js} +1 -1
  30. package/dist/client/assets/{arc-D-Yei3Vr.js → arc-CphVLv_F.js} +1 -1
  31. package/dist/client/assets/{architectureDiagram-T3A2C74G-BOgBvzWh.js → architectureDiagram-T3A2C74G-D9IDzZ6u.js} +1 -1
  32. package/dist/client/assets/base-ui-DT3JsyND.js +1 -0
  33. package/dist/client/assets/{blockDiagram-VBNYF7ZC-BQXRJDyR.js → blockDiagram-VBNYF7ZC-CzCatff9.js} +1 -1
  34. package/dist/client/assets/{c4Diagram-5PPSVZJV-DTZseD56.js → c4Diagram-5PPSVZJV-jvC7ACDE.js} +1 -1
  35. package/dist/client/assets/channel-BGbncBYv.js +1 -0
  36. package/dist/client/assets/{checkbox-BwbxYGgK.js → checkbox-DDpujnre.js} +1 -1
  37. package/dist/client/assets/{chunk-2GRJ4B5K-spRCgfPY.js → chunk-2GRJ4B5K-CNRn3w2y.js} +1 -1
  38. package/dist/client/assets/{chunk-2Q5K7J3B-CLVClH0M.js → chunk-2Q5K7J3B-CnTjXDS8.js} +1 -1
  39. package/dist/client/assets/{chunk-5RXB4S5H-CuQ5tYjB.js → chunk-5RXB4S5H-8QZZSU3J.js} +1 -1
  40. package/dist/client/assets/{chunk-5VM5RSS4-DyOEOe90.js → chunk-5VM5RSS4-B2MFN1L0.js} +1 -1
  41. package/dist/client/assets/{chunk-6Q2QTUOP-CgMtuJIx.js → chunk-6Q2QTUOP-BRGuFKSr.js} +1 -1
  42. package/dist/client/assets/{chunk-GF5L2VYU-BH63P4Vv.js → chunk-GF5L2VYU-CWTKyD7U.js} +1 -1
  43. package/dist/client/assets/{chunk-JWPE2WC7-BANDbaPq.js → chunk-JWPE2WC7-rGurufZY.js} +1 -1
  44. package/dist/client/assets/{chunk-KBJHAD2P-Bfty2upo.js → chunk-KBJHAD2P-DOwIHyo0.js} +1 -1
  45. package/dist/client/assets/{chunk-RYQCIY6F-Cvu8BZS9.js → chunk-RYQCIY6F-qrVd0AV3.js} +1 -1
  46. package/dist/client/assets/{chunk-XXDRQBXY-bnohf1yd.js → chunk-XXDRQBXY-BGvaybJK.js} +1 -1
  47. package/dist/client/assets/classDiagram-JCYQIIEL-BoYriqPM.js +1 -0
  48. package/dist/client/assets/classDiagram-v2-OCEON4UE-BoYriqPM.js +1 -0
  49. package/dist/client/assets/{cose-bilkent-JH36ORCC-DCTEAZwO.js → cose-bilkent-JH36ORCC-CHgOt-vq.js} +1 -1
  50. package/dist/client/assets/{cynefin-VYW2F7L2-Bp2wXvdt.js → cynefin-VYW2F7L2-DX7Kb3Ft.js} +1 -1
  51. package/dist/client/assets/{cynefinDiagram-MW4NZA55-DRRWzuF0.js → cynefinDiagram-MW4NZA55-B4MgYgbV.js} +1 -1
  52. package/dist/client/assets/{dagre-VZM6K2ZE-DDvsotRK.js → dagre-VZM6K2ZE-xG9l95NU.js} +1 -1
  53. package/dist/client/assets/{diagram-7IWD3JNH-CMqhRNRq.js → diagram-7IWD3JNH-BQKb8ivh.js} +1 -1
  54. package/dist/client/assets/{diagram-B4RE2ZJO-D_PYI1ut.js → diagram-B4RE2ZJO-CyIMrtDr.js} +1 -1
  55. package/dist/client/assets/{diagram-LBJQPF4R-BSUx7mMM.js → diagram-LBJQPF4R-WuCMu4WW.js} +1 -1
  56. package/dist/client/assets/{diagram-Q27KOJAE-C8O3g6WT.js → diagram-Q27KOJAE--Oi1nRrR.js} +1 -1
  57. package/dist/client/assets/{diagram-UB23O5K3-C5-NDsgC.js → diagram-UB23O5K3-CP1DXsa_.js} +1 -1
  58. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-D71hx4Ww.js → ebnfDiagram-BXEA7PRR-C-7jJg9C.js} +1 -1
  59. package/dist/client/assets/{erDiagram-JOGREHBK-yd9B5d8I.js → erDiagram-JOGREHBK-FSyqgO_9.js} +1 -1
  60. package/dist/client/assets/{flowDiagram-UKHOOZJN-CWU5VVbw.js → flowDiagram-UKHOOZJN-y2e2HZHu.js} +1 -1
  61. package/dist/client/assets/{ganttDiagram-PKOTCBZU-D2siVjfa.js → ganttDiagram-PKOTCBZU-kZ3m3wwW.js} +1 -1
  62. package/dist/client/assets/{gh-utils-B0Nlmxep.js → gh-utils-DxPHIkD8.js} +1 -1
  63. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-CIvIFcxR.js → gitGraphDiagram-DS77QQ5N-3Z9e4WPi.js} +1 -1
  64. package/dist/client/assets/{index-BOPi2b1j.js → index-ChKJF4C_.js} +3 -3
  65. package/dist/client/assets/index-WwGOu_aM.css +1 -0
  66. package/dist/client/assets/{infoDiagram-6WML65LV-DRvl8KfO.js → infoDiagram-6WML65LV-TfCo0Rhw.js} +1 -1
  67. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-H5EQq6uE.js → ishikawaDiagram-WSZJBQD7-DaXI89rw.js} +1 -1
  68. package/dist/client/assets/{journeyDiagram-NVQOT4AX-CCwLmD-U.js → journeyDiagram-NVQOT4AX-C4jS6BVn.js} +1 -1
  69. package/dist/client/assets/{kanban-definition-27J2QSJJ-DS--XHEu.js → kanban-definition-27J2QSJJ-bwOtQiC8.js} +1 -1
  70. package/dist/client/assets/{linear-Q3JNM6CR.js → linear-DfZM9J6Z.js} +1 -1
  71. package/dist/client/assets/{mermaid.core-EwS_m22C.js → mermaid.core-B-iLnCqi.js} +4 -4
  72. package/dist/client/assets/{mindmap-definition-FAOFIHXS-D15nrwfe.js → mindmap-definition-FAOFIHXS-DAdKdypB.js} +1 -1
  73. package/dist/client/assets/{pegDiagram-VL7TDLO6-DOG19gxx.js → pegDiagram-VL7TDLO6-Bl95_ELH.js} +1 -1
  74. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-Bstdr7Wh.js → pieDiagram-7S7Q4E2Y-DXf4GTLI.js} +1 -1
  75. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-DfKs4qZW.js → quadrantDiagram-CIZ2JOQS-CDiwouFY.js} +1 -1
  76. package/dist/client/assets/{railroadDiagram-AXF67PYL-DJKxyuhV.js → railroadDiagram-AXF67PYL-CZAR7rja.js} +1 -1
  77. package/dist/client/assets/{render-markdown-C7X2TwRk.js → render-markdown-BiKX2Zdv.js} +1 -1
  78. package/dist/client/assets/{requirementDiagram-LRYGKXZP-SGJWVmBV.js → requirementDiagram-LRYGKXZP-BklWtcnl.js} +1 -1
  79. package/dist/client/assets/{sankeyDiagram-W5VNT64P-CpZFct0O.js → sankeyDiagram-W5VNT64P-CpD7cM5j.js} +1 -1
  80. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-B7plRik9.js → sequenceDiagram-SI44F4Z6-BnHPNl9l.js} +1 -1
  81. package/dist/client/assets/{sizeCapture-X5ZJPWSS-CNbK285t.js → sizeCapture-X5ZJPWSS-D1eo0r-2.js} +1 -1
  82. package/dist/client/assets/{stateDiagram-OKZ733FA-BIHk9QCC.js → stateDiagram-OKZ733FA-ClTacl-d.js} +1 -1
  83. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-DAo7Tfh9.js +1 -0
  84. package/dist/client/assets/{swimlanes-SLNWSIFB-7g_XCosC.js → swimlanes-SLNWSIFB-_PLbkM5u.js} +2 -2
  85. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DHeOpgR_.js +8 -0
  86. package/dist/client/assets/{tanstack-B8_amOz8.js → tanstack-CtfgE41X.js} +1 -1
  87. package/dist/client/assets/{timeline-definition-Z64GVDOM-B-cgSggY.js → timeline-definition-Z64GVDOM-C9U6VikV.js} +1 -1
  88. package/dist/client/assets/{vennDiagram-T6HMQDX7-Bt5-8VZ2.js → vennDiagram-T6HMQDX7-Desj7KFU.js} +1 -1
  89. package/dist/client/assets/{viewer-tabs-DxCOe0ut.js → viewer-tabs-BwMhis6Q.js} +1 -1
  90. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-B5Imx6zh.js → wardleyDiagram-T6FBY63Y-rlMEd5tV.js} +1 -1
  91. package/dist/client/assets/{xychartDiagram-ELKLHX3M-CDaY4xFS.js → xychartDiagram-ELKLHX3M-CzFgA0NM.js} +1 -1
  92. package/dist/client/index.html +4 -4
  93. package/dist/dev.mjs +1 -1
  94. package/dist/manifest.json +1 -1
  95. package/dist/server.mjs +506 -212
  96. package/package.json +1 -1
  97. package/dist/client/assets/App-CBetJ5ZN.js +0 -74
  98. package/dist/client/assets/GitHubAvatar-DBc3Vxnk.js +0 -1
  99. package/dist/client/assets/HistoryView-DYxWYYVx.js +0 -1
  100. package/dist/client/assets/PullRequestViewer-KZl0osME.js +0 -2
  101. package/dist/client/assets/PullRequestsView-DkN3pW33.js +0 -1
  102. package/dist/client/assets/RepositoryProjectsDialog-F-EctLXx.js +0 -1
  103. package/dist/client/assets/Viewer-D-oFua7K.js +0 -3
  104. package/dist/client/assets/base-ui-qeHDA5zu.js +0 -1
  105. package/dist/client/assets/channel-DrMuSkDK.js +0 -1
  106. package/dist/client/assets/classDiagram-JCYQIIEL-BKiL0hkR.js +0 -1
  107. package/dist/client/assets/classDiagram-v2-OCEON4UE-BKiL0hkR.js +0 -1
  108. package/dist/client/assets/index-CryuKDT3.css +0 -1
  109. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-Cqw0H5cq.js +0 -1
  110. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BzKpdiGK.js +0 -8
package/dist/server.mjs CHANGED
@@ -9098,6 +9098,132 @@ function handleIntersectionResults(result, left, right) {
9098
9098
  result.value = merged.data;
9099
9099
  return result;
9100
9100
  }
9101
+ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
9102
+ $ZodType.init(inst, def);
9103
+ inst._zod.parse = (payload, ctx) => {
9104
+ const input = payload.value;
9105
+ if (!isPlainObject(input)) {
9106
+ payload.issues.push({
9107
+ expected: "record",
9108
+ code: "invalid_type",
9109
+ input,
9110
+ inst
9111
+ });
9112
+ return payload;
9113
+ }
9114
+ const proms = [];
9115
+ const values = def.keyType._zod.values;
9116
+ if (values) {
9117
+ payload.value = {};
9118
+ const recordKeys = /* @__PURE__ */ new Set();
9119
+ for (const key of values) {
9120
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
9121
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
9122
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
9123
+ if (keyResult instanceof Promise) {
9124
+ throw new Error("Async schemas not supported in object keys currently");
9125
+ }
9126
+ if (keyResult.issues.length) {
9127
+ payload.issues.push({
9128
+ code: "invalid_key",
9129
+ origin: "record",
9130
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
9131
+ input: key,
9132
+ path: [key],
9133
+ inst
9134
+ });
9135
+ continue;
9136
+ }
9137
+ const outKey = keyResult.value;
9138
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
9139
+ if (result instanceof Promise) {
9140
+ proms.push(result.then((result2) => {
9141
+ if (result2.issues.length) {
9142
+ payload.issues.push(...prefixIssues(key, result2.issues));
9143
+ }
9144
+ payload.value[outKey] = result2.value;
9145
+ }));
9146
+ } else {
9147
+ if (result.issues.length) {
9148
+ payload.issues.push(...prefixIssues(key, result.issues));
9149
+ }
9150
+ payload.value[outKey] = result.value;
9151
+ }
9152
+ }
9153
+ }
9154
+ let unrecognized;
9155
+ for (const key in input) {
9156
+ if (!recordKeys.has(key)) {
9157
+ unrecognized = unrecognized ?? [];
9158
+ unrecognized.push(key);
9159
+ }
9160
+ }
9161
+ if (unrecognized && unrecognized.length > 0) {
9162
+ payload.issues.push({
9163
+ code: "unrecognized_keys",
9164
+ input,
9165
+ inst,
9166
+ keys: unrecognized
9167
+ });
9168
+ }
9169
+ } else {
9170
+ payload.value = {};
9171
+ for (const key of Reflect.ownKeys(input)) {
9172
+ if (key === "__proto__")
9173
+ continue;
9174
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
9175
+ continue;
9176
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
9177
+ if (keyResult instanceof Promise) {
9178
+ throw new Error("Async schemas not supported in object keys currently");
9179
+ }
9180
+ const checkNumericKey = typeof key === "string" && number$1.test(key) && keyResult.issues.length;
9181
+ if (checkNumericKey) {
9182
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
9183
+ if (retryResult instanceof Promise) {
9184
+ throw new Error("Async schemas not supported in object keys currently");
9185
+ }
9186
+ if (retryResult.issues.length === 0) {
9187
+ keyResult = retryResult;
9188
+ }
9189
+ }
9190
+ if (keyResult.issues.length) {
9191
+ if (def.mode === "loose") {
9192
+ payload.value[key] = input[key];
9193
+ } else {
9194
+ payload.issues.push({
9195
+ code: "invalid_key",
9196
+ origin: "record",
9197
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
9198
+ input: key,
9199
+ path: [key],
9200
+ inst
9201
+ });
9202
+ }
9203
+ continue;
9204
+ }
9205
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
9206
+ if (result instanceof Promise) {
9207
+ proms.push(result.then((result2) => {
9208
+ if (result2.issues.length) {
9209
+ payload.issues.push(...prefixIssues(key, result2.issues));
9210
+ }
9211
+ payload.value[keyResult.value] = result2.value;
9212
+ }));
9213
+ } else {
9214
+ if (result.issues.length) {
9215
+ payload.issues.push(...prefixIssues(key, result.issues));
9216
+ }
9217
+ payload.value[keyResult.value] = result.value;
9218
+ }
9219
+ }
9220
+ }
9221
+ if (proms.length) {
9222
+ return Promise.all(proms).then(() => payload);
9223
+ }
9224
+ return payload;
9225
+ };
9226
+ });
9101
9227
  const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
9102
9228
  $ZodType.init(inst, def);
9103
9229
  const values = getEnumValues(def.entries);
@@ -10304,29 +10430,29 @@ const formatMap = {
10304
10430
  // do not set
10305
10431
  };
10306
10432
  const stringProcessor = (schema, ctx, _json, _params) => {
10307
- const json = _json;
10308
- json.type = "string";
10433
+ const json2 = _json;
10434
+ json2.type = "string";
10309
10435
  const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
10310
10436
  if (typeof minimum === "number")
10311
- json.minLength = minimum;
10437
+ json2.minLength = minimum;
10312
10438
  if (typeof maximum === "number")
10313
- json.maxLength = maximum;
10439
+ json2.maxLength = maximum;
10314
10440
  if (format2) {
10315
- json.format = formatMap[format2] ?? format2;
10316
- if (json.format === "")
10317
- delete json.format;
10441
+ json2.format = formatMap[format2] ?? format2;
10442
+ if (json2.format === "")
10443
+ delete json2.format;
10318
10444
  if (format2 === "time") {
10319
- delete json.format;
10445
+ delete json2.format;
10320
10446
  }
10321
10447
  }
10322
10448
  if (contentEncoding)
10323
- json.contentEncoding = contentEncoding;
10449
+ json2.contentEncoding = contentEncoding;
10324
10450
  if (patterns && patterns.size > 0) {
10325
10451
  const regexes = [...patterns];
10326
10452
  if (regexes.length === 1)
10327
- json.pattern = regexes[0].source;
10453
+ json2.pattern = regexes[0].source;
10328
10454
  else if (regexes.length > 1) {
10329
- json.allOf = [
10455
+ json2.allOf = [
10330
10456
  ...regexes.map((regex) => ({
10331
10457
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
10332
10458
  pattern: regex.source
@@ -10336,40 +10462,40 @@ const stringProcessor = (schema, ctx, _json, _params) => {
10336
10462
  }
10337
10463
  };
10338
10464
  const numberProcessor = (schema, ctx, _json, _params) => {
10339
- const json = _json;
10465
+ const json2 = _json;
10340
10466
  const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
10341
10467
  if (typeof format2 === "string" && format2.includes("int"))
10342
- json.type = "integer";
10468
+ json2.type = "integer";
10343
10469
  else
10344
- json.type = "number";
10470
+ json2.type = "number";
10345
10471
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
10346
10472
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
10347
10473
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
10348
10474
  if (exMin) {
10349
10475
  if (legacy) {
10350
- json.minimum = exclusiveMinimum;
10351
- json.exclusiveMinimum = true;
10476
+ json2.minimum = exclusiveMinimum;
10477
+ json2.exclusiveMinimum = true;
10352
10478
  } else {
10353
- json.exclusiveMinimum = exclusiveMinimum;
10479
+ json2.exclusiveMinimum = exclusiveMinimum;
10354
10480
  }
10355
10481
  } else if (typeof minimum === "number") {
10356
- json.minimum = minimum;
10482
+ json2.minimum = minimum;
10357
10483
  }
10358
10484
  if (exMax) {
10359
10485
  if (legacy) {
10360
- json.maximum = exclusiveMaximum;
10361
- json.exclusiveMaximum = true;
10486
+ json2.maximum = exclusiveMaximum;
10487
+ json2.exclusiveMaximum = true;
10362
10488
  } else {
10363
- json.exclusiveMaximum = exclusiveMaximum;
10489
+ json2.exclusiveMaximum = exclusiveMaximum;
10364
10490
  }
10365
10491
  } else if (typeof maximum === "number") {
10366
- json.maximum = maximum;
10492
+ json2.maximum = maximum;
10367
10493
  }
10368
10494
  if (typeof multipleOf === "number")
10369
- json.multipleOf = multipleOf;
10495
+ json2.multipleOf = multipleOf;
10370
10496
  };
10371
- const booleanProcessor = (_schema, _ctx, json, _params) => {
10372
- json.type = "boolean";
10497
+ const booleanProcessor = (_schema, _ctx, json2, _params) => {
10498
+ json2.type = "boolean";
10373
10499
  };
10374
10500
  const bigintProcessor = (_schema, ctx, _json, _params) => {
10375
10501
  if (ctx.unrepresentable === "throw") {
@@ -10381,13 +10507,13 @@ const symbolProcessor = (_schema, ctx, _json, _params) => {
10381
10507
  throw new Error("Symbols cannot be represented in JSON Schema");
10382
10508
  }
10383
10509
  };
10384
- const nullProcessor = (_schema, ctx, json, _params) => {
10510
+ const nullProcessor = (_schema, ctx, json2, _params) => {
10385
10511
  if (ctx.target === "openapi-3.0") {
10386
- json.type = "string";
10387
- json.nullable = true;
10388
- json.enum = [null];
10512
+ json2.type = "string";
10513
+ json2.nullable = true;
10514
+ json2.enum = [null];
10389
10515
  } else {
10390
- json.type = "null";
10516
+ json2.type = "null";
10391
10517
  }
10392
10518
  };
10393
10519
  const undefinedProcessor = (_schema, ctx, _json, _params) => {
@@ -10400,8 +10526,8 @@ const voidProcessor = (_schema, ctx, _json, _params) => {
10400
10526
  throw new Error("Void cannot be represented in JSON Schema");
10401
10527
  }
10402
10528
  };
10403
- const neverProcessor = (_schema, _ctx, json, _params) => {
10404
- json.not = {};
10529
+ const neverProcessor = (_schema, _ctx, json2, _params) => {
10530
+ json2.not = {};
10405
10531
  };
10406
10532
  const anyProcessor = (_schema, _ctx, _json, _params) => {
10407
10533
  };
@@ -10412,16 +10538,16 @@ const dateProcessor = (_schema, ctx, _json, _params) => {
10412
10538
  throw new Error("Date cannot be represented in JSON Schema");
10413
10539
  }
10414
10540
  };
10415
- const enumProcessor = (schema, _ctx, json, _params) => {
10541
+ const enumProcessor = (schema, _ctx, json2, _params) => {
10416
10542
  const def = schema._zod.def;
10417
10543
  const values = getEnumValues(def.entries);
10418
10544
  if (values.every((v) => typeof v === "number"))
10419
- json.type = "number";
10545
+ json2.type = "number";
10420
10546
  if (values.every((v) => typeof v === "string"))
10421
- json.type = "string";
10422
- json.enum = values;
10547
+ json2.type = "string";
10548
+ json2.enum = values;
10423
10549
  };
10424
- const literalProcessor = (schema, ctx, json, _params) => {
10550
+ const literalProcessor = (schema, ctx, json2, _params) => {
10425
10551
  const def = schema._zod.def;
10426
10552
  const vals = [];
10427
10553
  for (const val of def.values) {
@@ -10442,22 +10568,22 @@ const literalProcessor = (schema, ctx, json, _params) => {
10442
10568
  if (vals.length === 0) ;
10443
10569
  else if (vals.length === 1) {
10444
10570
  const val = vals[0];
10445
- json.type = val === null ? "null" : typeof val;
10571
+ json2.type = val === null ? "null" : typeof val;
10446
10572
  if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
10447
- json.enum = [val];
10573
+ json2.enum = [val];
10448
10574
  } else {
10449
- json.const = val;
10575
+ json2.const = val;
10450
10576
  }
10451
10577
  } else {
10452
10578
  if (vals.every((v) => typeof v === "number"))
10453
- json.type = "number";
10579
+ json2.type = "number";
10454
10580
  if (vals.every((v) => typeof v === "string"))
10455
- json.type = "string";
10581
+ json2.type = "string";
10456
10582
  if (vals.every((v) => typeof v === "boolean"))
10457
- json.type = "boolean";
10583
+ json2.type = "boolean";
10458
10584
  if (vals.every((v) => v === null))
10459
- json.type = "null";
10460
- json.enum = vals;
10585
+ json2.type = "null";
10586
+ json2.enum = vals;
10461
10587
  }
10462
10588
  };
10463
10589
  const nanProcessor = (_schema, ctx, _json, _params) => {
@@ -10465,16 +10591,16 @@ const nanProcessor = (_schema, ctx, _json, _params) => {
10465
10591
  throw new Error("NaN cannot be represented in JSON Schema");
10466
10592
  }
10467
10593
  };
10468
- const templateLiteralProcessor = (schema, _ctx, json, _params) => {
10469
- const _json = json;
10594
+ const templateLiteralProcessor = (schema, _ctx, json2, _params) => {
10595
+ const _json = json2;
10470
10596
  const pattern = schema._zod.pattern;
10471
10597
  if (!pattern)
10472
10598
  throw new Error("Pattern not found in template literal");
10473
10599
  _json.type = "string";
10474
10600
  _json.pattern = pattern.source;
10475
10601
  };
10476
- const fileProcessor = (schema, _ctx, json, _params) => {
10477
- const _json = json;
10602
+ const fileProcessor = (schema, _ctx, json2, _params) => {
10603
+ const _json = json2;
10478
10604
  const file = {
10479
10605
  type: "string",
10480
10606
  format: "binary",
@@ -10497,8 +10623,8 @@ const fileProcessor = (schema, _ctx, json, _params) => {
10497
10623
  Object.assign(_json, file);
10498
10624
  }
10499
10625
  };
10500
- const successProcessor = (_schema, _ctx, json, _params) => {
10501
- json.type = "boolean";
10626
+ const successProcessor = (_schema, _ctx, json2, _params) => {
10627
+ json2.type = "boolean";
10502
10628
  };
10503
10629
  const customProcessor = (_schema, ctx, _json, _params) => {
10504
10630
  if (ctx.unrepresentable === "throw") {
@@ -10526,27 +10652,27 @@ const setProcessor = (_schema, ctx, _json, _params) => {
10526
10652
  }
10527
10653
  };
10528
10654
  const arrayProcessor = (schema, ctx, _json, params) => {
10529
- const json = _json;
10655
+ const json2 = _json;
10530
10656
  const def = schema._zod.def;
10531
10657
  const { minimum, maximum } = schema._zod.bag;
10532
10658
  if (typeof minimum === "number")
10533
- json.minItems = minimum;
10659
+ json2.minItems = minimum;
10534
10660
  if (typeof maximum === "number")
10535
- json.maxItems = maximum;
10536
- json.type = "array";
10537
- json.items = process$1(def.element, ctx, {
10661
+ json2.maxItems = maximum;
10662
+ json2.type = "array";
10663
+ json2.items = process$1(def.element, ctx, {
10538
10664
  ...params,
10539
10665
  path: [...params.path, "items"]
10540
10666
  });
10541
10667
  };
10542
10668
  const objectProcessor = (schema, ctx, _json, params) => {
10543
- const json = _json;
10669
+ const json2 = _json;
10544
10670
  const def = schema._zod.def;
10545
- json.type = "object";
10546
- json.properties = {};
10671
+ json2.type = "object";
10672
+ json2.properties = {};
10547
10673
  const shape = def.shape;
10548
10674
  for (const key in shape) {
10549
- json.properties[key] = process$1(shape[key], ctx, {
10675
+ json2.properties[key] = process$1(shape[key], ctx, {
10550
10676
  ...params,
10551
10677
  path: [...params.path, "properties", key]
10552
10678
  });
@@ -10561,21 +10687,21 @@ const objectProcessor = (schema, ctx, _json, params) => {
10561
10687
  }
10562
10688
  }));
10563
10689
  if (requiredKeys.size > 0) {
10564
- json.required = Array.from(requiredKeys);
10690
+ json2.required = Array.from(requiredKeys);
10565
10691
  }
10566
10692
  if (def.catchall?._zod.def.type === "never") {
10567
- json.additionalProperties = false;
10693
+ json2.additionalProperties = false;
10568
10694
  } else if (!def.catchall) {
10569
10695
  if (ctx.io === "output")
10570
- json.additionalProperties = false;
10696
+ json2.additionalProperties = false;
10571
10697
  } else if (def.catchall) {
10572
- json.additionalProperties = process$1(def.catchall, ctx, {
10698
+ json2.additionalProperties = process$1(def.catchall, ctx, {
10573
10699
  ...params,
10574
10700
  path: [...params.path, "additionalProperties"]
10575
10701
  });
10576
10702
  }
10577
10703
  };
10578
- const unionProcessor = (schema, ctx, json, params) => {
10704
+ const unionProcessor = (schema, ctx, json2, params) => {
10579
10705
  const def = schema._zod.def;
10580
10706
  const isExclusive = def.inclusive === false;
10581
10707
  const options = def.options.map((x, i2) => process$1(x, ctx, {
@@ -10583,12 +10709,12 @@ const unionProcessor = (schema, ctx, json, params) => {
10583
10709
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i2]
10584
10710
  }));
10585
10711
  if (isExclusive) {
10586
- json.oneOf = options;
10712
+ json2.oneOf = options;
10587
10713
  } else {
10588
- json.anyOf = options;
10714
+ json2.anyOf = options;
10589
10715
  }
10590
10716
  };
10591
- const intersectionProcessor = (schema, ctx, json, params) => {
10717
+ const intersectionProcessor = (schema, ctx, json2, params) => {
10592
10718
  const def = schema._zod.def;
10593
10719
  const a2 = process$1(def.left, ctx, {
10594
10720
  ...params,
@@ -10603,12 +10729,12 @@ const intersectionProcessor = (schema, ctx, json, params) => {
10603
10729
  ...isSimpleIntersection(a2) ? a2.allOf : [a2],
10604
10730
  ...isSimpleIntersection(b) ? b.allOf : [b]
10605
10731
  ];
10606
- json.allOf = allOf;
10732
+ json2.allOf = allOf;
10607
10733
  };
10608
10734
  const tupleProcessor = (schema, ctx, _json, params) => {
10609
- const json = _json;
10735
+ const json2 = _json;
10610
10736
  const def = schema._zod.def;
10611
- json.type = "array";
10737
+ json2.type = "array";
10612
10738
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
10613
10739
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
10614
10740
  const prefixItems = def.items.map((x, i2) => process$1(x, ctx, {
@@ -10620,37 +10746,37 @@ const tupleProcessor = (schema, ctx, _json, params) => {
10620
10746
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
10621
10747
  }) : null;
10622
10748
  if (ctx.target === "draft-2020-12") {
10623
- json.prefixItems = prefixItems;
10749
+ json2.prefixItems = prefixItems;
10624
10750
  if (rest) {
10625
- json.items = rest;
10751
+ json2.items = rest;
10626
10752
  }
10627
10753
  } else if (ctx.target === "openapi-3.0") {
10628
- json.items = {
10754
+ json2.items = {
10629
10755
  anyOf: prefixItems
10630
10756
  };
10631
10757
  if (rest) {
10632
- json.items.anyOf.push(rest);
10758
+ json2.items.anyOf.push(rest);
10633
10759
  }
10634
- json.minItems = prefixItems.length;
10760
+ json2.minItems = prefixItems.length;
10635
10761
  if (!rest) {
10636
- json.maxItems = prefixItems.length;
10762
+ json2.maxItems = prefixItems.length;
10637
10763
  }
10638
10764
  } else {
10639
- json.items = prefixItems;
10765
+ json2.items = prefixItems;
10640
10766
  if (rest) {
10641
- json.additionalItems = rest;
10767
+ json2.additionalItems = rest;
10642
10768
  }
10643
10769
  }
10644
10770
  const { minimum, maximum } = schema._zod.bag;
10645
10771
  if (typeof minimum === "number")
10646
- json.minItems = minimum;
10772
+ json2.minItems = minimum;
10647
10773
  if (typeof maximum === "number")
10648
- json.maxItems = maximum;
10774
+ json2.maxItems = maximum;
10649
10775
  };
10650
10776
  const recordProcessor = (schema, ctx, _json, params) => {
10651
- const json = _json;
10777
+ const json2 = _json;
10652
10778
  const def = schema._zod.def;
10653
- json.type = "object";
10779
+ json2.type = "object";
10654
10780
  const keyType = def.keyType;
10655
10781
  const keyBag = keyType._zod.bag;
10656
10782
  const patterns = keyBag?.patterns;
@@ -10659,18 +10785,18 @@ const recordProcessor = (schema, ctx, _json, params) => {
10659
10785
  ...params,
10660
10786
  path: [...params.path, "patternProperties", "*"]
10661
10787
  });
10662
- json.patternProperties = {};
10788
+ json2.patternProperties = {};
10663
10789
  for (const pattern of patterns) {
10664
- json.patternProperties[pattern.source] = valueSchema;
10790
+ json2.patternProperties[pattern.source] = valueSchema;
10665
10791
  }
10666
10792
  } else {
10667
10793
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
10668
- json.propertyNames = process$1(def.keyType, ctx, {
10794
+ json2.propertyNames = process$1(def.keyType, ctx, {
10669
10795
  ...params,
10670
10796
  path: [...params.path, "propertyNames"]
10671
10797
  });
10672
10798
  }
10673
- json.additionalProperties = process$1(def.valueType, ctx, {
10799
+ json2.additionalProperties = process$1(def.valueType, ctx, {
10674
10800
  ...params,
10675
10801
  path: [...params.path, "additionalProperties"]
10676
10802
  });
@@ -10679,19 +10805,19 @@ const recordProcessor = (schema, ctx, _json, params) => {
10679
10805
  if (keyValues) {
10680
10806
  const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
10681
10807
  if (validKeyValues.length > 0) {
10682
- json.required = validKeyValues;
10808
+ json2.required = validKeyValues;
10683
10809
  }
10684
10810
  }
10685
10811
  };
10686
- const nullableProcessor = (schema, ctx, json, params) => {
10812
+ const nullableProcessor = (schema, ctx, json2, params) => {
10687
10813
  const def = schema._zod.def;
10688
10814
  const inner = process$1(def.innerType, ctx, params);
10689
10815
  const seen = ctx.seen.get(schema);
10690
10816
  if (ctx.target === "openapi-3.0") {
10691
10817
  seen.ref = def.innerType;
10692
- json.nullable = true;
10818
+ json2.nullable = true;
10693
10819
  } else {
10694
- json.anyOf = [inner, { type: "null" }];
10820
+ json2.anyOf = [inner, { type: "null" }];
10695
10821
  }
10696
10822
  };
10697
10823
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
@@ -10700,22 +10826,22 @@ const nonoptionalProcessor = (schema, ctx, _json, params) => {
10700
10826
  const seen = ctx.seen.get(schema);
10701
10827
  seen.ref = def.innerType;
10702
10828
  };
10703
- const defaultProcessor = (schema, ctx, json, params) => {
10829
+ const defaultProcessor = (schema, ctx, json2, params) => {
10704
10830
  const def = schema._zod.def;
10705
10831
  process$1(def.innerType, ctx, params);
10706
10832
  const seen = ctx.seen.get(schema);
10707
10833
  seen.ref = def.innerType;
10708
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
10834
+ json2.default = JSON.parse(JSON.stringify(def.defaultValue));
10709
10835
  };
10710
- const prefaultProcessor = (schema, ctx, json, params) => {
10836
+ const prefaultProcessor = (schema, ctx, json2, params) => {
10711
10837
  const def = schema._zod.def;
10712
10838
  process$1(def.innerType, ctx, params);
10713
10839
  const seen = ctx.seen.get(schema);
10714
10840
  seen.ref = def.innerType;
10715
10841
  if (ctx.io === "input")
10716
- json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
10842
+ json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
10717
10843
  };
10718
- const catchProcessor = (schema, ctx, json, params) => {
10844
+ const catchProcessor = (schema, ctx, json2, params) => {
10719
10845
  const def = schema._zod.def;
10720
10846
  process$1(def.innerType, ctx, params);
10721
10847
  const seen = ctx.seen.get(schema);
@@ -10726,7 +10852,7 @@ const catchProcessor = (schema, ctx, json, params) => {
10726
10852
  } catch {
10727
10853
  throw new Error("Dynamic catch values are not supported in JSON Schema");
10728
10854
  }
10729
- json.default = catchValue;
10855
+ json2.default = catchValue;
10730
10856
  };
10731
10857
  const pipeProcessor = (schema, ctx, _json, params) => {
10732
10858
  const def = schema._zod.def;
@@ -10736,12 +10862,12 @@ const pipeProcessor = (schema, ctx, _json, params) => {
10736
10862
  const seen = ctx.seen.get(schema);
10737
10863
  seen.ref = innerType;
10738
10864
  };
10739
- const readonlyProcessor = (schema, ctx, json, params) => {
10865
+ const readonlyProcessor = (schema, ctx, json2, params) => {
10740
10866
  const def = schema._zod.def;
10741
10867
  process$1(def.innerType, ctx, params);
10742
10868
  const seen = ctx.seen.get(schema);
10743
10869
  seen.ref = def.innerType;
10744
- json.readOnly = true;
10870
+ json2.readOnly = true;
10745
10871
  };
10746
10872
  const promiseProcessor = (schema, ctx, _json, params) => {
10747
10873
  const def = schema._zod.def;
@@ -11082,7 +11208,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
11082
11208
  const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
11083
11209
  $ZodString.init(inst, def);
11084
11210
  ZodType.init(inst, def);
11085
- inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json);
11211
+ inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2);
11086
11212
  const bag = inst._zod.bag;
11087
11213
  inst.format = bag.format ?? null;
11088
11214
  inst.minLength = bag.minimum ?? null;
@@ -11252,7 +11378,7 @@ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
11252
11378
  const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
11253
11379
  $ZodNumber.init(inst, def);
11254
11380
  ZodType.init(inst, def);
11255
- inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json);
11381
+ inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2);
11256
11382
  _installLazyMethods(inst, "ZodNumber", {
11257
11383
  gt(value, params) {
11258
11384
  return this.check(/* @__PURE__ */ _gt(value, params));
@@ -11320,7 +11446,7 @@ function int(params) {
11320
11446
  const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
11321
11447
  $ZodBoolean.init(inst, def);
11322
11448
  ZodType.init(inst, def);
11323
- inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
11449
+ inst._zod.processJSONSchema = (ctx, json2, params) => booleanProcessor(inst, ctx, json2);
11324
11450
  });
11325
11451
  function boolean(params) {
11326
11452
  return /* @__PURE__ */ _boolean(ZodBoolean, params);
@@ -11328,7 +11454,7 @@ function boolean(params) {
11328
11454
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
11329
11455
  $ZodUnknown.init(inst, def);
11330
11456
  ZodType.init(inst, def);
11331
- inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor();
11457
+ inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor();
11332
11458
  });
11333
11459
  function unknown() {
11334
11460
  return /* @__PURE__ */ _unknown(ZodUnknown);
@@ -11336,7 +11462,7 @@ function unknown() {
11336
11462
  const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
11337
11463
  $ZodNever.init(inst, def);
11338
11464
  ZodType.init(inst, def);
11339
- inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json);
11465
+ inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2);
11340
11466
  });
11341
11467
  function never(params) {
11342
11468
  return /* @__PURE__ */ _never(ZodNever, params);
@@ -11344,7 +11470,7 @@ function never(params) {
11344
11470
  const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
11345
11471
  $ZodArray.init(inst, def);
11346
11472
  ZodType.init(inst, def);
11347
- inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
11473
+ inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params);
11348
11474
  inst.element = def.element;
11349
11475
  _installLazyMethods(inst, "ZodArray", {
11350
11476
  min(n2, params) {
@@ -11370,7 +11496,7 @@ function array(element, params) {
11370
11496
  const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
11371
11497
  $ZodObjectJIT.init(inst, def);
11372
11498
  ZodType.init(inst, def);
11373
- inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
11499
+ inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params);
11374
11500
  defineLazy(inst, "shape", () => {
11375
11501
  return def.shape;
11376
11502
  });
@@ -11435,7 +11561,7 @@ function looseObject(shape, params) {
11435
11561
  const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
11436
11562
  $ZodUnion.init(inst, def);
11437
11563
  ZodType.init(inst, def);
11438
- inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
11564
+ inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
11439
11565
  inst.options = def.options;
11440
11566
  });
11441
11567
  function union(options, params) {
@@ -11448,7 +11574,7 @@ function union(options, params) {
11448
11574
  const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
11449
11575
  $ZodIntersection.init(inst, def);
11450
11576
  ZodType.init(inst, def);
11451
- inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
11577
+ inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params);
11452
11578
  });
11453
11579
  function intersection(left, right) {
11454
11580
  return new ZodIntersection({
@@ -11457,10 +11583,33 @@ function intersection(left, right) {
11457
11583
  right
11458
11584
  });
11459
11585
  }
11586
+ const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
11587
+ $ZodRecord.init(inst, def);
11588
+ ZodType.init(inst, def);
11589
+ inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params);
11590
+ inst.keyType = def.keyType;
11591
+ inst.valueType = def.valueType;
11592
+ });
11593
+ function record(keyType, valueType, params) {
11594
+ if (!valueType || !valueType._zod) {
11595
+ return new ZodRecord({
11596
+ type: "record",
11597
+ keyType: string(),
11598
+ valueType: keyType,
11599
+ ...normalizeParams(valueType)
11600
+ });
11601
+ }
11602
+ return new ZodRecord({
11603
+ type: "record",
11604
+ keyType,
11605
+ valueType,
11606
+ ...normalizeParams(params)
11607
+ });
11608
+ }
11460
11609
  const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
11461
11610
  $ZodEnum.init(inst, def);
11462
11611
  ZodType.init(inst, def);
11463
- inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json);
11612
+ inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2);
11464
11613
  inst.enum = def.entries;
11465
11614
  inst.options = Object.values(def.entries);
11466
11615
  const keys = new Set(Object.keys(def.entries));
@@ -11506,7 +11655,7 @@ function _enum(values, params) {
11506
11655
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
11507
11656
  $ZodTransform.init(inst, def);
11508
11657
  ZodType.init(inst, def);
11509
- inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx);
11658
+ inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx);
11510
11659
  inst._zod.parse = (payload, _ctx) => {
11511
11660
  if (_ctx.direction === "backward") {
11512
11661
  throw new $ZodEncodeError(inst.constructor.name);
@@ -11546,7 +11695,7 @@ function transform(fn) {
11546
11695
  const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
11547
11696
  $ZodOptional.init(inst, def);
11548
11697
  ZodType.init(inst, def);
11549
- inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
11698
+ inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
11550
11699
  inst.unwrap = () => inst._zod.def.innerType;
11551
11700
  });
11552
11701
  function optional(innerType) {
@@ -11558,7 +11707,7 @@ function optional(innerType) {
11558
11707
  const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
11559
11708
  $ZodExactOptional.init(inst, def);
11560
11709
  ZodType.init(inst, def);
11561
- inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
11710
+ inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
11562
11711
  inst.unwrap = () => inst._zod.def.innerType;
11563
11712
  });
11564
11713
  function exactOptional(innerType) {
@@ -11570,7 +11719,7 @@ function exactOptional(innerType) {
11570
11719
  const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
11571
11720
  $ZodNullable.init(inst, def);
11572
11721
  ZodType.init(inst, def);
11573
- inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
11722
+ inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
11574
11723
  inst.unwrap = () => inst._zod.def.innerType;
11575
11724
  });
11576
11725
  function nullable(innerType) {
@@ -11582,7 +11731,7 @@ function nullable(innerType) {
11582
11731
  const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
11583
11732
  $ZodDefault.init(inst, def);
11584
11733
  ZodType.init(inst, def);
11585
- inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
11734
+ inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
11586
11735
  inst.unwrap = () => inst._zod.def.innerType;
11587
11736
  inst.removeDefault = inst.unwrap;
11588
11737
  });
@@ -11598,7 +11747,7 @@ function _default(innerType, defaultValue) {
11598
11747
  const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
11599
11748
  $ZodPrefault.init(inst, def);
11600
11749
  ZodType.init(inst, def);
11601
- inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
11750
+ inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
11602
11751
  inst.unwrap = () => inst._zod.def.innerType;
11603
11752
  });
11604
11753
  function prefault(innerType, defaultValue) {
@@ -11613,7 +11762,7 @@ function prefault(innerType, defaultValue) {
11613
11762
  const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
11614
11763
  $ZodNonOptional.init(inst, def);
11615
11764
  ZodType.init(inst, def);
11616
- inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
11765
+ inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params);
11617
11766
  inst.unwrap = () => inst._zod.def.innerType;
11618
11767
  });
11619
11768
  function nonoptional(innerType, params) {
@@ -11626,7 +11775,7 @@ function nonoptional(innerType, params) {
11626
11775
  const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
11627
11776
  $ZodCatch.init(inst, def);
11628
11777
  ZodType.init(inst, def);
11629
- inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
11778
+ inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
11630
11779
  inst.unwrap = () => inst._zod.def.innerType;
11631
11780
  inst.removeCatch = inst.unwrap;
11632
11781
  });
@@ -11640,7 +11789,7 @@ function _catch(innerType, catchValue) {
11640
11789
  const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
11641
11790
  $ZodPipe.init(inst, def);
11642
11791
  ZodType.init(inst, def);
11643
- inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
11792
+ inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
11644
11793
  inst.in = def.in;
11645
11794
  inst.out = def.out;
11646
11795
  });
@@ -11655,7 +11804,7 @@ function pipe(in_, out) {
11655
11804
  const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
11656
11805
  $ZodReadonly.init(inst, def);
11657
11806
  ZodType.init(inst, def);
11658
- inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
11807
+ inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
11659
11808
  inst.unwrap = () => inst._zod.def.innerType;
11660
11809
  });
11661
11810
  function readonly(innerType) {
@@ -11667,7 +11816,7 @@ function readonly(innerType) {
11667
11816
  const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
11668
11817
  $ZodCustom.init(inst, def);
11669
11818
  ZodType.init(inst, def);
11670
- inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx);
11819
+ inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx);
11671
11820
  });
11672
11821
  function refine(fn, _params = {}) {
11673
11822
  return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
@@ -11884,8 +12033,8 @@ class AiLogStore {
11884
12033
  }
11885
12034
  /** Records one run. Never rejects; failures are dropped on purpose. */
11886
12035
  append(entry) {
11887
- const record = { ...entry, id: randomUUID(), at: (/* @__PURE__ */ new Date()).toISOString() };
11888
- const normalized = normalizeAiLogEntry(record);
12036
+ const record2 = { ...entry, id: randomUUID(), at: (/* @__PURE__ */ new Date()).toISOString() };
12037
+ const normalized = normalizeAiLogEntry(record2);
11889
12038
  if (!normalized) return;
11890
12039
  this.pending = this.pending.then(async () => {
11891
12040
  await mkdir(path.dirname(this.filePath), { recursive: true });
@@ -11990,18 +12139,18 @@ ${parsed.data.body}`.length > 1e4) throw invalidOutput$3();
11990
12139
  }
11991
12140
  function parseCommitSplitProposal(value, stagedPaths) {
11992
12141
  if (!value || typeof value !== "object") return { status: "absent" };
11993
- const record = value;
11994
- if (record.commits === void 0 || Array.isArray(record.commits) && record.commits.length === 0) return { status: "absent" };
11995
- if (!Array.isArray(record.commits)) return { status: "rejected", reason: "commits was not a list" };
12142
+ const record2 = value;
12143
+ if (record2.commits === void 0 || Array.isArray(record2.commits) && record2.commits.length === 0) return { status: "absent" };
12144
+ if (!Array.isArray(record2.commits)) return { status: "rejected", reason: "commits was not a list" };
11996
12145
  if (stagedPaths.length < 2) return { status: "absent" };
11997
- if (record.commits.length < 2) return { status: "rejected", reason: "fewer than two groups" };
11998
- if (record.commits.length > 8) return { status: "rejected", reason: `too many groups (${record.commits.length})` };
11999
- const rationale = cleanText(record.rationale, 1e3);
12146
+ if (record2.commits.length < 2) return { status: "rejected", reason: "fewer than two groups" };
12147
+ if (record2.commits.length > 8) return { status: "rejected", reason: `too many groups (${record2.commits.length})` };
12148
+ const rationale = cleanText(record2.rationale, 1e3);
12000
12149
  if (rationale === null) return { status: "rejected", reason: "missing or unusable rationale" };
12001
12150
  const allowed = new Set(stagedPaths);
12002
12151
  const used = /* @__PURE__ */ new Set();
12003
12152
  const commits = [];
12004
- for (const candidate of record.commits) {
12153
+ for (const candidate of record2.commits) {
12005
12154
  if (!candidate || typeof candidate !== "object") return { status: "rejected", reason: "a group was not an object" };
12006
12155
  let parts;
12007
12156
  try {
@@ -12323,8 +12472,8 @@ const AI_SERVER_TIMEOUT_MS = AI_PROVIDER_TIMEOUT_MS + 3e4;
12323
12472
  const DEFAULT_MODEL = { id: "default", label: "Default (CLI)" };
12324
12473
  function claudeUsage(envelope) {
12325
12474
  if (!envelope || typeof envelope !== "object") return { ...EMPTY_AI_USAGE };
12326
- const record = envelope;
12327
- const usage = record.usage ?? {};
12475
+ const record2 = envelope;
12476
+ const usage = record2.usage ?? {};
12328
12477
  const details = usage.output_tokens_details ?? {};
12329
12478
  return {
12330
12479
  inputTokens: count(usage.input_tokens),
@@ -12332,7 +12481,7 @@ function claudeUsage(envelope) {
12332
12481
  reasoningTokens: count(details.thinking_tokens),
12333
12482
  cacheReadTokens: count(usage.cache_read_input_tokens),
12334
12483
  cacheWriteTokens: count(usage.cache_creation_input_tokens),
12335
- costUsd: count(record.total_cost_usd, true)
12484
+ costUsd: count(record2.total_cost_usd, true)
12336
12485
  };
12337
12486
  }
12338
12487
  function codexUsage(stdout) {
@@ -12360,8 +12509,8 @@ function codexUsage(stdout) {
12360
12509
  }
12361
12510
  function openCodeUsage(info) {
12362
12511
  if (!info || typeof info !== "object") return { ...EMPTY_AI_USAGE };
12363
- const record = info;
12364
- const tokens = record.tokens ?? {};
12512
+ const record2 = info;
12513
+ const tokens = record2.tokens ?? {};
12365
12514
  const cache = tokens.cache ?? {};
12366
12515
  return {
12367
12516
  inputTokens: count(tokens.input),
@@ -12369,7 +12518,7 @@ function openCodeUsage(info) {
12369
12518
  reasoningTokens: count(tokens.reasoning),
12370
12519
  cacheReadTokens: count(cache.read),
12371
12520
  cacheWriteTokens: count(cache.write),
12372
- costUsd: count(record.cost, true)
12521
+ costUsd: count(record2.cost, true)
12373
12522
  };
12374
12523
  }
12375
12524
  function count(value, fractional = false) {
@@ -12431,29 +12580,29 @@ function toCodexOutputSchema(schema) {
12431
12580
  function strictify(value) {
12432
12581
  if (!value || typeof value !== "object") return value;
12433
12582
  if (Array.isArray(value)) return value.map(strictify);
12434
- const record = { ...value };
12435
- delete record.$schema;
12436
- if (record.properties && typeof record.properties === "object" && !Array.isArray(record.properties)) {
12583
+ const record2 = { ...value };
12584
+ delete record2.$schema;
12585
+ if (record2.properties && typeof record2.properties === "object" && !Array.isArray(record2.properties)) {
12437
12586
  const properties = Object.fromEntries(
12438
- Object.entries(record.properties).map(([key, item]) => [key, strictify(item)])
12587
+ Object.entries(record2.properties).map(([key, item]) => [key, strictify(item)])
12439
12588
  );
12440
- record.properties = properties;
12441
- record.required = Object.keys(properties);
12442
- record.additionalProperties = false;
12589
+ record2.properties = properties;
12590
+ record2.required = Object.keys(properties);
12591
+ record2.additionalProperties = false;
12443
12592
  }
12444
- if ("items" in record) record.items = strictify(record.items);
12593
+ if ("items" in record2) record2.items = strictify(record2.items);
12445
12594
  for (const key of ["$defs", "definitions"]) {
12446
- const defs = record[key];
12595
+ const defs = record2[key];
12447
12596
  if (defs && typeof defs === "object" && !Array.isArray(defs)) {
12448
- record[key] = Object.fromEntries(
12597
+ record2[key] = Object.fromEntries(
12449
12598
  Object.entries(defs).map(([name, item]) => [name, strictify(item)])
12450
12599
  );
12451
12600
  }
12452
12601
  }
12453
12602
  for (const key of ["anyOf", "oneOf", "allOf"]) {
12454
- if (Array.isArray(record[key])) record[key] = record[key].map(strictify);
12603
+ if (Array.isArray(record2[key])) record2[key] = record2[key].map(strictify);
12455
12604
  }
12456
- return record;
12605
+ return record2;
12457
12606
  }
12458
12607
  function cliDiagnostic(result) {
12459
12608
  let fromTurn = null;
@@ -16472,9 +16621,9 @@ function parseNumstat$1(output) {
16472
16621
  const stats = /* @__PURE__ */ new Map();
16473
16622
  const tokens = output.split("\0");
16474
16623
  for (let index = 0; index < tokens.length; index += 1) {
16475
- const record = tokens[index];
16476
- if (!record) continue;
16477
- const match = /^(\d+|-)\t(\d+|-)\t(.*)$/s.exec(record);
16624
+ const record2 = tokens[index];
16625
+ if (!record2) continue;
16626
+ const match = /^(\d+|-)\t(\d+|-)\t(.*)$/s.exec(record2);
16478
16627
  if (!match) continue;
16479
16628
  const binary = match[1] === "-" || match[2] === "-";
16480
16629
  const entry = {
@@ -16495,8 +16644,8 @@ const FIELD = "";
16495
16644
  const RECORD = "";
16496
16645
  const LOG_FORMAT = `%H${FIELD}%h${FIELD}%s${FIELD}%b${FIELD}%an${FIELD}%ae${FIELD}%aI${FIELD}%D${FIELD}%P${RECORD}`;
16497
16646
  function parseLog(output) {
16498
- return output.split(RECORD).map((record) => record.trim()).filter(Boolean).flatMap((record) => {
16499
- const fields = record.split(FIELD);
16647
+ return output.split(RECORD).map((record2) => record2.trim()).filter(Boolean).flatMap((record2) => {
16648
+ const fields = record2.split(FIELD);
16500
16649
  if (fields.length < 9) return [];
16501
16650
  const oid = fields[0] ?? "";
16502
16651
  if (!/^[0-9a-f]{40,64}$/i.test(oid)) return [];
@@ -16517,6 +16666,21 @@ function parseLog(output) {
16517
16666
  }];
16518
16667
  });
16519
16668
  }
16669
+ function selectHistoryBase(output, upstream) {
16670
+ const refs = output.trim().split("\n").map((line) => {
16671
+ const [ref = "", oid = "", target = ""] = line.split("\0");
16672
+ return { ref, oid, target };
16673
+ }).filter((ref) => /^[a-f0-9]{40,64}$/i.test(ref.oid));
16674
+ const remoteDefaults = refs.filter((ref) => ref.ref.startsWith("refs/remotes/") && ref.ref.endsWith("/HEAD") && ref.target);
16675
+ const preferred = remoteDefaults.filter((ref) => upstream?.startsWith(ref.ref.slice("refs/remotes/".length, -4))).sort((a2, b) => b.ref.length - a2.ref.length)[0] ?? remoteDefaults.find((ref) => ref.ref === "refs/remotes/origin/HEAD");
16676
+ if (preferred) return { ref: preferred.target.replace(/^refs\/(heads|remotes)\//, ""), oid: preferred.oid };
16677
+ const remotePrefix = upstream?.split("/")[0] ?? "origin";
16678
+ for (const name of [`refs/remotes/${remotePrefix}/main`, `refs/remotes/${remotePrefix}/master`, "refs/heads/main", "refs/heads/master"]) {
16679
+ const ref = refs.find((candidate) => candidate.ref === name);
16680
+ if (ref) return { ref: name.replace(/^refs\/(heads|remotes)\//, ""), oid: ref.oid };
16681
+ }
16682
+ return null;
16683
+ }
16520
16684
  const REF_FORMAT = "%(refname)%00%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track)%00%(worktreepath)%00%(objectname)%00%(objectname:short)%00%(subject)%00%(authorname)%00%(committerdate:iso-strict)%00";
16521
16685
  const FIELDS_PER_REF = 11;
16522
16686
  function parseRefs(buffer) {
@@ -16618,25 +16782,25 @@ function parseStatus(buffer) {
16618
16782
  };
16619
16783
  const chunks = splitNul(buffer).map((chunk) => chunk.toString("utf8"));
16620
16784
  for (let index = 0; index < chunks.length; index += 1) {
16621
- const record = chunks[index] ?? "";
16622
- if (!record) continue;
16623
- if (record.startsWith("# ")) {
16624
- parseHeader(record, status);
16785
+ const record2 = chunks[index] ?? "";
16786
+ if (!record2) continue;
16787
+ if (record2.startsWith("# ")) {
16788
+ parseHeader(record2, status);
16625
16789
  continue;
16626
16790
  }
16627
- if (record.startsWith("? ")) {
16628
- status.changes.push(makeChange(record.slice(2), "?", "?"));
16791
+ if (record2.startsWith("? ")) {
16792
+ status.changes.push(makeChange(record2.slice(2), "?", "?"));
16629
16793
  continue;
16630
16794
  }
16631
- if (record.startsWith("1 ") || record.startsWith("u ")) {
16632
- const fields = record.split(" ");
16795
+ if (record2.startsWith("1 ") || record2.startsWith("u ")) {
16796
+ const fields = record2.split(" ");
16633
16797
  const xy = fields[1] ?? "..";
16634
- const pathIndex = record.startsWith("1 ") ? 8 : 10;
16798
+ const pathIndex = record2.startsWith("1 ") ? 8 : 10;
16635
16799
  status.changes.push(makeChange(fields.slice(pathIndex).join(" "), xy[0] ?? ".", xy[1] ?? ".", fields[2] ?? ""));
16636
16800
  continue;
16637
16801
  }
16638
- if (record.startsWith("2 ")) {
16639
- const fields = record.split(" ");
16802
+ if (record2.startsWith("2 ")) {
16803
+ const fields = record2.split(" ");
16640
16804
  const xy = fields[1] ?? "..";
16641
16805
  const next = chunks[index + 1] ?? "";
16642
16806
  const pathValue = fields.slice(9).join(" ");
@@ -16984,14 +17148,18 @@ ${base}
16984
17148
  if (cursor && commits[0]?.oid === cursor) commits = commits.slice(1);
16985
17149
  const hasMore = commits.length > 100;
16986
17150
  commits = commits.slice(0, 100);
16987
- const localOids = await this.localOnlyOids(repository.path, status.upstream, status.detached || status.unborn);
17151
+ const [localOids, base] = await Promise.all([
17152
+ this.localOnlyOids(repository.path, status.upstream, status.detached || status.unborn),
17153
+ this.historyBase(repository.path, revision2, status.upstream)
17154
+ ]);
16988
17155
  commits = commits.map((commit) => ({
16989
17156
  ...commit,
16990
17157
  isHead: commit.oid === status.oid,
16991
- upstreamState: localOids === null ? "unknown" : localOids.has(commit.oid) ? "local-only" : "published"
17158
+ upstreamState: localOids === null ? "unknown" : localOids.has(commit.oid) ? "local-only" : "published",
17159
+ baseState: base === null ? "unknown" : base.outside.has(commit.oid) ? "outside" : "included"
16992
17160
  }));
16993
17161
  for (const commit of commits) this.rememberOid(repositoryId, commit.oid);
16994
- return { commits, nextCursor: hasMore ? commits.at(-1)?.oid ?? null : null };
17162
+ return { commits, nextCursor: hasMore ? commits.at(-1)?.oid ?? null : null, baseRef: base?.ref ?? null };
16995
17163
  } catch (error) {
16996
17164
  if (!cursor && error instanceof GitOperationError && /does not have any commits|unknown revision|bad revision/i.test(error.message)) return { commits: [], nextCursor: null };
16997
17165
  throw error;
@@ -17564,6 +17732,18 @@ ${body}
17564
17732
  const status = await this.repositories.status(repositoryId, false);
17565
17733
  if (status.readOnly) throw new GitOperationError({ code: "INVALID_ARGUMENT", operation: "write", message: `The repository is in the middle of ${status.operation}; OpenTig keeps it read-only.` });
17566
17734
  }
17735
+ async historyBase(repositoryPath, revision2, upstream) {
17736
+ try {
17737
+ const options = { operation: "history-base", readOnly: true, maxOutputBytes: 8 * 1024 * 1024 };
17738
+ const refs = await this.git.run(repositoryPath, ["for-each-ref", "--format=%(refname)%00%(objectname)%00%(symref)", "refs/heads/main", "refs/heads/master", "refs/remotes"], options);
17739
+ const base = selectHistoryBase(refs.stdout.toString("utf8"), upstream);
17740
+ if (!base) return null;
17741
+ const output = await this.git.run(repositoryPath, ["rev-list", revision2, `^${base.oid}`, "--"], options);
17742
+ return { ref: base.ref, outside: new Set(output.stdout.toString("utf8").trim().split("\n").filter(Boolean)) };
17743
+ } catch {
17744
+ return null;
17745
+ }
17746
+ }
17567
17747
  async localOnlyOids(repositoryPath, upstream, unavailable) {
17568
17748
  if (!upstream || unavailable) return null;
17569
17749
  try {
@@ -18253,6 +18433,73 @@ function revision(bytes) {
18253
18433
  function invalidReplacement(message) {
18254
18434
  return new GitOperationError({ code: "INVALID_ARGUMENT", operation: "replace-search", message });
18255
18435
  }
18436
+ const positive = number().int().positive().safe();
18437
+ const membershipSchema = object({
18438
+ stack: object({ number: positive, size: positive, baseRefName: string().min(1) }).nullable(),
18439
+ stackEntry: object({ position: positive }).nullable()
18440
+ });
18441
+ const stackSchema = object({
18442
+ number: positive,
18443
+ base: union([string().min(1), object({ ref: string().min(1) })]),
18444
+ pull_requests: array(object({
18445
+ number: positive,
18446
+ title: string().optional(),
18447
+ draft: boolean().optional(),
18448
+ head: object({ ref: string().min(1) }),
18449
+ state: _enum(["open", "closed", "merged"]),
18450
+ merged_at: string().nullable().optional()
18451
+ })).min(1)
18452
+ });
18453
+ function invalid() {
18454
+ return new GhOperationError({ code: "GH_INVALID_OUTPUT", operation: "gh-pr-stack", message: "GitHub returned unreadable stack information." });
18455
+ }
18456
+ function json(raw) {
18457
+ try {
18458
+ return JSON.parse(raw);
18459
+ } catch {
18460
+ throw invalid();
18461
+ }
18462
+ }
18463
+ function stackMembershipQuery(numbers) {
18464
+ if (!numbers.length || numbers.some((number2) => !positive.safeParse(number2).success)) throw invalid();
18465
+ return `query($owner:String!,$name:String!){repository(owner:$owner,name:$name){${numbers.map((number2) => `pr${number2}:pullRequest(number:${number2}){stack{number size baseRefName} stackEntry{position}}`).join(" ")}}}`;
18466
+ }
18467
+ function parseStackMemberships(raw, numbers) {
18468
+ const envelope = object({ data: object({ repository: record(string(), membershipSchema.nullable()) }), errors: array(unknown()).optional() }).safeParse(json(raw));
18469
+ if (!envelope.success || envelope.data.errors?.length) throw invalid();
18470
+ const result = /* @__PURE__ */ new Map();
18471
+ for (const number2 of numbers) {
18472
+ const entry = envelope.data.data.repository[`pr${number2}`];
18473
+ if (entry === void 0) throw invalid();
18474
+ if (!entry?.stack && !entry?.stackEntry) continue;
18475
+ if (!entry?.stack || !entry.stackEntry || entry.stackEntry.position > entry.stack.size) throw invalid();
18476
+ result.set(number2, { number: entry.stack.number, size: entry.stack.size, position: entry.stackEntry.position, base: entry.stack.baseRefName });
18477
+ }
18478
+ return result;
18479
+ }
18480
+ function parsePullRequestStack(raw, prNumber, listing = false) {
18481
+ let value = json(raw);
18482
+ if (listing) {
18483
+ if (!Array.isArray(value) || value.length > 1) throw invalid();
18484
+ if (!value.length) return null;
18485
+ value = value[0];
18486
+ }
18487
+ const parsed = stackSchema.safeParse(value);
18488
+ if (!parsed.success) throw invalid();
18489
+ const stack = parsed.data;
18490
+ if (!stack.pull_requests.some((pr) => pr.number === prNumber) || new Set(stack.pull_requests.map((pr) => pr.number)).size !== stack.pull_requests.length) throw invalid();
18491
+ return {
18492
+ number: stack.number,
18493
+ base: typeof stack.base === "string" ? stack.base : stack.base.ref,
18494
+ layers: stack.pull_requests.map((pr) => ({
18495
+ number: pr.number,
18496
+ title: pr.title || pr.head.ref,
18497
+ headRefName: pr.head.ref,
18498
+ state: pr.merged_at || pr.state === "merged" ? "MERGED" : pr.state === "closed" ? "CLOSED" : "OPEN",
18499
+ isDraft: pr.draft ?? false
18500
+ }))
18501
+ };
18502
+ }
18256
18503
  const OWNER_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/;
18257
18504
  const REPO_PATTERN = /^[A-Za-z0-9._-]+$/;
18258
18505
  function parseGitHubRemote(url) {
@@ -18292,13 +18539,13 @@ function parsePullRequestList(raw) {
18292
18539
  function parsePullRequestDetails(raw) {
18293
18540
  const item = parseJson(raw, "gh-pr-view");
18294
18541
  const summary = parseSummary(item, "gh-pr-view");
18295
- const record = item;
18542
+ const record2 = item;
18296
18543
  return {
18297
18544
  ...summary,
18298
- body: typeof record.body === "string" ? record.body : "",
18299
- changedFiles: numberOrZero(record.changedFiles),
18300
- labels: parseLabels(record.labels),
18301
- commits: parseCommits(record.commits)
18545
+ body: typeof record2.body === "string" ? record2.body : "",
18546
+ changedFiles: numberOrZero(record2.changedFiles),
18547
+ labels: parseLabels(record2.labels),
18548
+ commits: parseCommits(record2.commits)
18302
18549
  };
18303
18550
  }
18304
18551
  function sortPullRequestsNewestFirst(pulls) {
@@ -18325,27 +18572,27 @@ function parseCreatedPullRequestUrl(stdout) {
18325
18572
  function parseSummary(item, operation) {
18326
18573
  const parsed = summaryRecordSchema.safeParse(item);
18327
18574
  if (!parsed.success) throw invalidOutput(operation);
18328
- const record = parsed.data;
18575
+ const record2 = parsed.data;
18329
18576
  const { number: number2, state } = parsed.data;
18330
- const parsedAuthor = tolerantRecordSchema.safeParse(record.author);
18577
+ const parsedAuthor = tolerantRecordSchema.safeParse(record2.author);
18331
18578
  const authorRecord = parsedAuthor.success ? parsedAuthor.data : null;
18332
18579
  const author = authorRecord?.login;
18333
18580
  const authorLogin = typeof author === "string" ? author : "unknown";
18334
18581
  return {
18335
18582
  number: number2,
18336
- title: typeof record.title === "string" ? record.title : "",
18583
+ title: typeof record2.title === "string" ? record2.title : "",
18337
18584
  state,
18338
- isDraft: record.isDraft === true,
18585
+ isDraft: record2.isDraft === true,
18339
18586
  author: authorLogin,
18340
18587
  authorAvatarUrl: avatarUrl(authorLogin, authorRecord?.is_bot === true),
18341
- headRefName: typeof record.headRefName === "string" ? record.headRefName : "",
18342
- baseRefName: typeof record.baseRefName === "string" ? record.baseRefName : "",
18343
- updatedAt: typeof record.updatedAt === "string" ? record.updatedAt : "",
18344
- url: typeof record.url === "string" ? record.url : "",
18345
- reviewDecision: typeof record.reviewDecision === "string" && record.reviewDecision ? record.reviewDecision : null,
18346
- additions: numberOrZero(record.additions),
18347
- deletions: numberOrZero(record.deletions),
18348
- checksState: parseChecksState(record.statusCheckRollup)
18588
+ headRefName: typeof record2.headRefName === "string" ? record2.headRefName : "",
18589
+ baseRefName: typeof record2.baseRefName === "string" ? record2.baseRefName : "",
18590
+ updatedAt: typeof record2.updatedAt === "string" ? record2.updatedAt : "",
18591
+ url: typeof record2.url === "string" ? record2.url : "",
18592
+ reviewDecision: typeof record2.reviewDecision === "string" && record2.reviewDecision ? record2.reviewDecision : null,
18593
+ additions: numberOrZero(record2.additions),
18594
+ deletions: numberOrZero(record2.deletions),
18595
+ checksState: parseChecksState(record2.statusCheckRollup)
18349
18596
  };
18350
18597
  }
18351
18598
  function parseLabels(value) {
@@ -18354,10 +18601,10 @@ function parseLabels(value) {
18354
18601
  return parsed.data.flatMap((item) => {
18355
18602
  const candidate = tolerantRecordSchema.safeParse(item);
18356
18603
  if (!candidate.success) return [];
18357
- const record = candidate.data;
18358
- if (typeof record.name !== "string" || !record.name) return [];
18359
- const color = typeof record.color === "string" && /^[0-9a-f]{6}$/i.test(record.color) ? record.color : "6e7781";
18360
- return [{ name: record.name, color }];
18604
+ const record2 = candidate.data;
18605
+ if (typeof record2.name !== "string" || !record2.name) return [];
18606
+ const color = typeof record2.color === "string" && /^[0-9a-f]{6}$/i.test(record2.color) ? record2.color : "6e7781";
18607
+ return [{ name: record2.name, color }];
18361
18608
  });
18362
18609
  }
18363
18610
  function parseCommits(value) {
@@ -18366,16 +18613,16 @@ function parseCommits(value) {
18366
18613
  return parsed.data.flatMap((item) => {
18367
18614
  const candidate = tolerantRecordSchema.safeParse(item);
18368
18615
  if (!candidate.success) return [];
18369
- const record = candidate.data;
18370
- if (typeof record.oid !== "string" || !record.oid) return [];
18371
- const authors = Array.isArray(record.authors) ? record.authors : [];
18616
+ const record2 = candidate.data;
18617
+ if (typeof record2.oid !== "string" || !record2.oid) return [];
18618
+ const authors = Array.isArray(record2.authors) ? record2.authors : [];
18372
18619
  const authorRecord = authors.map((author) => tolerantRecordSchema.safeParse(author)).find((author) => author.success)?.data;
18373
18620
  const login = typeof authorRecord?.login === "string" ? authorRecord.login : null;
18374
18621
  const name = typeof authorRecord?.name === "string" && authorRecord.name ? authorRecord.name : login ?? "unknown";
18375
18622
  return [{
18376
- oid: record.oid,
18377
- messageHeadline: typeof record.messageHeadline === "string" ? record.messageHeadline : "",
18378
- authoredAt: typeof record.authoredDate === "string" ? record.authoredDate : "",
18623
+ oid: record2.oid,
18624
+ messageHeadline: typeof record2.messageHeadline === "string" ? record2.messageHeadline : "",
18625
+ authoredAt: typeof record2.authoredDate === "string" ? record2.authoredDate : "",
18379
18626
  author: name,
18380
18627
  authorAvatarUrl: login ? avatarUrl(login, login.endsWith("[bot]")) : null
18381
18628
  }];
@@ -18387,11 +18634,11 @@ function parseChecksState(value) {
18387
18634
  for (const item of value) {
18388
18635
  const parsed = tolerantRecordSchema.safeParse(item);
18389
18636
  if (!parsed.success) continue;
18390
- const record = parsed.data;
18391
- const conclusion = typeof record.conclusion === "string" ? record.conclusion.toUpperCase() : "";
18392
- const state = typeof record.state === "string" ? record.state.toUpperCase() : "";
18637
+ const record2 = parsed.data;
18638
+ const conclusion = typeof record2.conclusion === "string" ? record2.conclusion.toUpperCase() : "";
18639
+ const state = typeof record2.state === "string" ? record2.state.toUpperCase() : "";
18393
18640
  if (["FAILURE", "ERROR", "TIMED_OUT", "CANCELLED", "ACTION_REQUIRED", "STARTUP_FAILURE"].includes(conclusion || state)) return "FAILING";
18394
- const status = typeof record.status === "string" ? record.status.toUpperCase() : "";
18641
+ const status = typeof record2.status === "string" ? record2.status.toUpperCase() : "";
18395
18642
  if (status && status !== "COMPLETED" || ["PENDING", "EXPECTED"].includes(state)) pending = true;
18396
18643
  }
18397
18644
  return pending ? "PENDING" : "PASSING";
@@ -18456,7 +18703,7 @@ class GitHubService {
18456
18703
  ["pr", "list", "-R", nameWithOwner, "--state", state.toLowerCase(), "--json", PR_SUMMARY_FIELDS, "--limit", "50"],
18457
18704
  { cwd: repository.path, operation: "gh-pr-list", timeoutMs: NETWORK_TIMEOUT_MS, maxOutputBytes: 4 * 1024 * 1024 }
18458
18705
  )));
18459
- return selectPullRequestsNewestFirst(results.flatMap((result) => parsePullRequestList(result.stdout)), states);
18706
+ return this.withStackMembership(repository.path, nameWithOwner, selectPullRequestsNewestFirst(results.flatMap((result) => parsePullRequestList(result.stdout)), states));
18460
18707
  }
18461
18708
  async findPullRequestForBranch(repositoryId, branchName) {
18462
18709
  const operation = "gh-pr-for-branch";
@@ -18474,7 +18721,51 @@ class GitHubService {
18474
18721
  ["pr", "view", String(prNumber), "-R", nameWithOwner, "--json", PR_DETAIL_FIELDS],
18475
18722
  { cwd: repository.path, operation: "gh-pr-view", timeoutMs: NETWORK_TIMEOUT_MS, maxOutputBytes: 4 * 1024 * 1024 }
18476
18723
  );
18477
- return parsePullRequestDetails(result.stdout);
18724
+ const details = parsePullRequestDetails(result.stdout);
18725
+ return (await this.withStackMembership(repository.path, nameWithOwner, [details]))[0];
18726
+ }
18727
+ async withStackMembership(cwd, nameWithOwner, pulls) {
18728
+ const [owner, name] = nameWithOwner.split("/");
18729
+ const enriched = [];
18730
+ for (let start = 0; start < pulls.length; start += 25) {
18731
+ const batch = pulls.slice(start, start + 25);
18732
+ try {
18733
+ const numbers = batch.map((pr) => pr.number);
18734
+ const result = await this.runGh(["api", "graphql", "-f", `owner=${owner}`, "-f", `name=${name}`, "-f", `query=${stackMembershipQuery(numbers)}`], {
18735
+ cwd,
18736
+ operation: "gh-pr-stack-membership",
18737
+ timeoutMs: 1e4,
18738
+ maxOutputBytes: 1024 * 1024
18739
+ });
18740
+ const memberships = parseStackMemberships(result.stdout, numbers);
18741
+ enriched.push(...batch.map((pr) => {
18742
+ const stack = memberships.get(pr.number);
18743
+ return stack ? { ...pr, stack } : pr;
18744
+ }));
18745
+ } catch {
18746
+ enriched.push(...batch);
18747
+ }
18748
+ }
18749
+ return enriched;
18750
+ }
18751
+ async getPullRequestStack(repositoryId, prNumber) {
18752
+ const operation = "gh-pr-stack";
18753
+ const { repository, nameWithOwner } = await this.requireGitHub(repositoryId, operation);
18754
+ const options = { cwd: repository.path, operation, timeoutMs: NETWORK_TIMEOUT_MS, maxOutputBytes: 4 * 1024 * 1024 };
18755
+ const read = async (endpoint) => this.runGh(["api", endpoint], options);
18756
+ let listing;
18757
+ try {
18758
+ listing = await read(`repos/${nameWithOwner}/stacks?pull_request=${prNumber}`);
18759
+ } catch (error) {
18760
+ if (error instanceof GhOperationError && error.detail.code === "GH_PROCESS_FAILED" && /HTTP 404/.test(error.message)) return null;
18761
+ throw error;
18762
+ }
18763
+ const stack = parsePullRequestStack(listing.stdout, prNumber, true);
18764
+ if (!stack) return null;
18765
+ const details = await read(`repos/${nameWithOwner}/stacks/${stack.number}`);
18766
+ const complete = parsePullRequestStack(details.stdout, prNumber);
18767
+ if (complete?.number !== stack.number) throw new GhOperationError({ code: "GH_INVALID_OUTPUT", operation, message: "The stack changed while loading. Refresh to try again." });
18768
+ return complete;
18478
18769
  }
18479
18770
  async getPullRequestDiff(repositoryId, prNumber) {
18480
18771
  const { repository, nameWithOwner } = await this.requireGitHub(repositoryId, "gh-pr-diff");
@@ -18718,7 +19009,7 @@ class ProblemsLogStore {
18718
19009
  this.loaded = true;
18719
19010
  }
18720
19011
  record(entry) {
18721
- const record = {
19012
+ const record2 = {
18722
19013
  id: randomUUID(),
18723
19014
  at: (/* @__PURE__ */ new Date()).toISOString(),
18724
19015
  level: entry.level ?? "error",
@@ -18728,7 +19019,7 @@ class ProblemsLogStore {
18728
19019
  message: entry.message,
18729
19020
  repositoryId: entry.repositoryId ?? null
18730
19021
  };
18731
- const normalized = normalizeProblemLogEntry(record);
19022
+ const normalized = normalizeProblemLogEntry(record2);
18732
19023
  if (!normalized) return;
18733
19024
  this.pending = this.pending.then(async () => {
18734
19025
  await mkdir(path.dirname(this.filePath), { recursive: true });
@@ -18827,10 +19118,10 @@ resolveShortcuts();
18827
19118
  function sanitizeShortcutOverrides(value) {
18828
19119
  const result = {};
18829
19120
  if (!value || typeof value !== "object") return result;
18830
- const record = value;
19121
+ const record2 = value;
18831
19122
  const usedCombos = /* @__PURE__ */ new Set();
18832
19123
  for (const def of SHORTCUT_DEFINITIONS) {
18833
- const combo = record[def.id];
19124
+ const combo = record2[def.id];
18834
19125
  if (typeof combo !== "string" || combo === def.defaultCombo) continue;
18835
19126
  if (!isValidCombo(combo, def.allowBare)) continue;
18836
19127
  if (RESERVED_COMBOS.has(combo) || usedCombos.has(combo)) continue;
@@ -19836,6 +20127,7 @@ const IPC = {
19836
20127
  githubPrForBranch: "github:pr-for-branch",
19837
20128
  githubPrList: "github:pr-list",
19838
20129
  githubPrView: "github:pr-view",
20130
+ githubPrStack: "github:pr-stack",
19839
20131
  githubPrDiff: "github:pr-diff",
19840
20132
  githubPrCommitDiff: "github:pr-commit-diff",
19841
20133
  githubPrCreate: "github:pr-create",
@@ -19920,6 +20212,7 @@ const OPEN_TIG_SERVER_COMMANDS = {
19920
20212
  "github.findPullRequestForBranch": command(IPC.githubPrForBranch, "gh-pr-for-branch", false),
19921
20213
  "github.listPullRequests": command(IPC.githubPrList, "gh-pr-list", false),
19922
20214
  "github.getPullRequest": command(IPC.githubPrView, "gh-pr-view", false),
20215
+ "github.getPullRequestStack": command(IPC.githubPrStack, "gh-pr-stack", false),
19923
20216
  "github.getPullRequestDiff": command(IPC.githubPrDiff, "gh-pr-diff", false),
19924
20217
  "github.getPullRequestCommitDiff": command(IPC.githubPrCommitDiff, "gh-pr-commit-diff", false),
19925
20218
  "github.createPullRequest": command(IPC.githubPrCreate, "gh-pr-create", true),
@@ -20169,28 +20462,28 @@ function filesTreeStateArg(repositoryId, value, operation) {
20169
20462
  return { repositoryId, expandedPaths: normalizeExpandedPaths(expandedPaths) };
20170
20463
  }
20171
20464
  function openFilesStateArg(repositoryId, tabs, activePath, previewPath, operation) {
20172
- const invalid = () => new GitOperationError({ code: "INVALID_ARGUMENT", operation, message: "Invalid open files state." });
20465
+ const invalid2 = () => new GitOperationError({ code: "INVALID_ARGUMENT", operation, message: "Invalid open files state." });
20173
20466
  const parsedTabs = array(openFileTabSchema).max(MAX_OPEN_FILE_TABS).safeParse(tabs);
20174
- if (!isOpenFilesRepositoryId(repositoryId) || !parsedTabs.success) throw invalid();
20467
+ if (!isOpenFilesRepositoryId(repositoryId) || !parsedTabs.success) throw invalid2();
20175
20468
  const normalizedTabs = [];
20176
20469
  const seen = /* @__PURE__ */ new Set();
20177
20470
  for (const input of parsedTabs.data) {
20178
20471
  const path2 = normalizeOpenFilePath(input.path);
20179
- if (!path2 || typeof input.pinned !== "boolean") throw invalid();
20472
+ if (!path2 || typeof input.pinned !== "boolean") throw invalid2();
20180
20473
  if (seen.has(path2)) continue;
20181
20474
  seen.add(path2);
20182
20475
  normalizedTabs.push({ path: path2, pinned: input.pinned });
20183
20476
  }
20184
- const active = optionalOpenFilePath(activePath, invalid);
20185
- const preview = optionalOpenFilePath(previewPath, invalid);
20186
- if (active && !seen.has(active)) throw invalid();
20187
- if (preview && !seen.has(preview)) throw invalid();
20477
+ const active = optionalOpenFilePath(activePath, invalid2);
20478
+ const preview = optionalOpenFilePath(previewPath, invalid2);
20479
+ if (active && !seen.has(active)) throw invalid2();
20480
+ if (preview && !seen.has(preview)) throw invalid2();
20188
20481
  return { repositoryId, tabs: normalizedTabs, activePath: active, previewPath: preview };
20189
20482
  }
20190
- function optionalOpenFilePath(value, invalid) {
20483
+ function optionalOpenFilePath(value, invalid2) {
20191
20484
  if (value === null || value === void 0) return null;
20192
20485
  const normalized = normalizeOpenFilePath(value);
20193
- if (!normalized) throw invalid();
20486
+ if (!normalized) throw invalid2();
20194
20487
  return normalized;
20195
20488
  }
20196
20489
  function projectNameArg(value, operation) {
@@ -20770,6 +21063,7 @@ function registerServerCommands(registry2, services, host) {
20770
21063
  pullRequestStatesArg(states, "gh-pr-list")
20771
21064
  ));
20772
21065
  handle(IPC.githubPrView, "gh-pr-view", (id, prNumber) => services.github.getPullRequest(stringArg(id, "gh-pr-view", 64), prNumberArg(prNumber, "gh-pr-view")));
21066
+ handle(IPC.githubPrStack, "gh-pr-stack", (id, prNumber) => services.github.getPullRequestStack(stringArg(id, "gh-pr-stack", 64), prNumberArg(prNumber, "gh-pr-stack")));
20773
21067
  handle(IPC.githubPrDiff, "gh-pr-diff", (id, prNumber) => services.github.getPullRequestDiff(stringArg(id, "gh-pr-diff", 64), prNumberArg(prNumber, "gh-pr-diff")));
20774
21068
  handle(IPC.githubPrCommitDiff, "gh-pr-commit-diff", (id, oid) => services.github.getPullRequestCommitDiff(stringArg(id, "gh-pr-commit-diff", 64), oidArg(oid, "gh-pr-commit-diff")));
20775
21069
  handle(IPC.githubPrCreate, "gh-pr-create", (input) => services.github.createPullRequest(createPullRequestArg(input)));