@github/copilot-language-server 1.551.2 → 1.551.3

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 (73) hide show
  1. package/dist/main.js +657 -657
  2. package/dist/node_modules/@github/copilot-sdk/dist/cjs/cliVersion.js +1 -1
  3. package/dist/node_modules/@github/copilot-sdk/dist/cjs/client.js +499 -36
  4. package/dist/node_modules/@github/copilot-sdk/dist/cjs/copilotRequestHandler.js +156 -20
  5. package/dist/node_modules/@github/copilot-sdk/dist/cjs/extension.js +11 -9
  6. package/dist/node_modules/@github/copilot-sdk/dist/cjs/ffiRuntimeHost.js +14 -3
  7. package/dist/node_modules/@github/copilot-sdk/dist/cjs/generated/rpc.js +1305 -304
  8. package/dist/node_modules/@github/copilot-sdk/dist/cjs/host.js +67 -0
  9. package/dist/node_modules/@github/copilot-sdk/dist/cjs/index.js +12 -7
  10. package/dist/node_modules/@github/copilot-sdk/dist/cjs/installationConfirmation.js +98 -0
  11. package/dist/node_modules/@github/copilot-sdk/dist/cjs/runtimeArtifacts.js +1 -0
  12. package/dist/node_modules/@github/copilot-sdk/dist/cjs/schema.js +40 -0
  13. package/dist/node_modules/@github/copilot-sdk/dist/cjs/session.js +474 -151
  14. package/dist/node_modules/@github/copilot-sdk/dist/cjs/sessionFsProvider.js +57 -0
  15. package/dist/node_modules/@github/copilot-sdk/dist/cjs/types.js +5 -2
  16. package/dist/node_modules/@github/copilot-sdk/dist/cjs/{factory.js → workflow.js} +33 -33
  17. package/dist/node_modules/@github/copilot-sdk/package.json +27 -16
  18. package/dist/node_modules/zod/locales/package.json +1 -2
  19. package/dist/node_modules/zod/mini/package.json +1 -2
  20. package/dist/node_modules/zod/package.json +1 -1
  21. package/dist/node_modules/zod/v3/package.json +1 -2
  22. package/dist/node_modules/zod/v4/classic/errors.js +2 -2
  23. package/dist/node_modules/zod/v4/classic/from-json-schema.cjs +16 -31
  24. package/dist/node_modules/zod/v4/classic/from-json-schema.js +16 -31
  25. package/dist/node_modules/zod/v4/classic/package.json +1 -2
  26. package/dist/node_modules/zod/v4/classic/schemas.cjs +119 -358
  27. package/dist/node_modules/zod/v4/classic/schemas.js +118 -356
  28. package/dist/node_modules/zod/v4/core/api.cjs +2 -7
  29. package/dist/node_modules/zod/v4/core/api.js +2 -7
  30. package/dist/node_modules/zod/v4/core/core.cjs +1 -3
  31. package/dist/node_modules/zod/v4/core/core.js +2 -4
  32. package/dist/node_modules/zod/v4/core/errors.cjs +23 -26
  33. package/dist/node_modules/zod/v4/core/errors.js +23 -26
  34. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +20 -16
  35. package/dist/node_modules/zod/v4/core/json-schema-processors.js +20 -16
  36. package/dist/node_modules/zod/v4/core/package.json +1 -2
  37. package/dist/node_modules/zod/v4/core/parse.cjs +7 -7
  38. package/dist/node_modules/zod/v4/core/parse.js +7 -7
  39. package/dist/node_modules/zod/v4/core/regexes.cjs +3 -9
  40. package/dist/node_modules/zod/v4/core/regexes.js +1 -7
  41. package/dist/node_modules/zod/v4/core/schemas.cjs +65 -211
  42. package/dist/node_modules/zod/v4/core/schemas.js +64 -210
  43. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +1 -12
  44. package/dist/node_modules/zod/v4/core/to-json-schema.js +1 -12
  45. package/dist/node_modules/zod/v4/core/util.cjs +30 -54
  46. package/dist/node_modules/zod/v4/core/util.js +32 -55
  47. package/dist/node_modules/zod/v4/core/versions.cjs +2 -2
  48. package/dist/node_modules/zod/v4/core/versions.js +2 -2
  49. package/dist/node_modules/zod/v4/locales/en.cjs +0 -4
  50. package/dist/node_modules/zod/v4/locales/en.js +0 -4
  51. package/dist/node_modules/zod/v4/locales/fr.cjs +7 -24
  52. package/dist/node_modules/zod/v4/locales/fr.js +7 -24
  53. package/dist/node_modules/zod/v4/locales/index.cjs +1 -8
  54. package/dist/node_modules/zod/v4/locales/index.js +0 -3
  55. package/dist/node_modules/zod/v4/locales/it.cjs +1 -1
  56. package/dist/node_modules/zod/v4/locales/it.js +1 -1
  57. package/dist/node_modules/zod/v4/locales/ka.cjs +8 -8
  58. package/dist/node_modules/zod/v4/locales/ka.js +8 -8
  59. package/dist/node_modules/zod/v4/locales/package.json +1 -2
  60. package/dist/node_modules/zod/v4/locales/uz.cjs +0 -1
  61. package/dist/node_modules/zod/v4/locales/uz.js +0 -1
  62. package/dist/node_modules/zod/v4/mini/package.json +1 -2
  63. package/dist/node_modules/zod/v4/mini/schemas.cjs +4 -41
  64. package/dist/node_modules/zod/v4/mini/schemas.js +4 -40
  65. package/dist/node_modules/zod/v4/package.json +1 -2
  66. package/dist/node_modules/zod/v4-mini/package.json +1 -2
  67. package/package.json +20 -20
  68. package/dist/node_modules/zod/v4/locales/el.cjs +0 -136
  69. package/dist/node_modules/zod/v4/locales/el.js +0 -109
  70. package/dist/node_modules/zod/v4/locales/hr.cjs +0 -149
  71. package/dist/node_modules/zod/v4/locales/hr.js +0 -122
  72. package/dist/node_modules/zod/v4/locales/ro.cjs +0 -146
  73. package/dist/node_modules/zod/v4/locales/ro.js +0 -119
@@ -35,8 +35,6 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
35
35
  let asyncResult;
36
36
  for (const ch of checks) {
37
37
  if (ch._zod.def.when) {
38
- if (util.explicitlyAborted(payload))
39
- continue;
40
38
  const shouldRun = ch._zod.def.when(payload);
41
39
  if (!shouldRun)
42
40
  continue;
@@ -190,21 +188,6 @@ export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) =>
190
188
  try {
191
189
  // Trim whitespace from input
192
190
  const trimmed = payload.value.trim();
193
- // When normalize is off, require :// for http/https URLs
194
- // This prevents strings like "http:example.com" or "https:/path" from being silently accepted
195
- if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source) {
196
- if (!/^https?:\/\//i.test(trimmed)) {
197
- payload.issues.push({
198
- code: "invalid_format",
199
- format: "url",
200
- note: "Invalid URL format",
201
- input: payload.value,
202
- inst,
203
- continue: !def.abort,
204
- });
205
- return;
206
- }
207
- }
208
191
  // @ts-ignore
209
192
  const url = new URL(trimmed);
210
193
  if (def.hostname) {
@@ -265,11 +248,6 @@ export const $ZodNanoID = /*@__PURE__*/ core.$constructor("$ZodNanoID", (inst, d
265
248
  def.pattern ?? (def.pattern = regexes.nanoid);
266
249
  $ZodStringFormat.init(inst, def);
267
250
  });
268
- /**
269
- * @deprecated CUID v1 is deprecated by its authors due to information leakage
270
- * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
271
- * See https://github.com/paralleldrive/cuid.
272
- */
273
251
  export const $ZodCUID = /*@__PURE__*/ core.$constructor("$ZodCUID", (inst, def) => {
274
252
  def.pattern ?? (def.pattern = regexes.cuid);
275
253
  $ZodStringFormat.init(inst, def);
@@ -375,9 +353,6 @@ export const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor("$ZodCIDRv6", (inst, d
375
353
  export function isValidBase64(data) {
376
354
  if (data === "")
377
355
  return true;
378
- // atob ignores whitespace, so reject it up front.
379
- if (/\s/.test(data))
380
- return false;
381
356
  if (data.length % 4 !== 0)
382
357
  return false;
383
358
  try {
@@ -582,6 +557,8 @@ export const $ZodUndefined = /*@__PURE__*/ core.$constructor("$ZodUndefined", (i
582
557
  $ZodType.init(inst, def);
583
558
  inst._zod.pattern = regexes.undefined;
584
559
  inst._zod.values = new Set([undefined]);
560
+ inst._zod.optin = "optional";
561
+ inst._zod.optout = "optional";
585
562
  inst._zod.parse = (payload, _ctx) => {
586
563
  const input = payload.value;
587
564
  if (typeof input === "undefined")
@@ -711,28 +688,16 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
711
688
  return payload; //handleArrayResultsAsync(parseResults, final);
712
689
  };
713
690
  });
714
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
715
- const isPresent = key in input;
691
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
716
692
  if (result.issues.length) {
717
- // For optional-in/out schemas, ignore errors on absent keys.
718
- if (isOptionalIn && isOptionalOut && !isPresent) {
693
+ // For optional-out schemas, ignore errors on absent keys
694
+ if (isOptionalOut && !(key in input)) {
719
695
  return;
720
696
  }
721
697
  final.issues.push(...util.prefixIssues(key, result.issues));
722
698
  }
723
- if (!isPresent && !isOptionalIn) {
724
- if (!result.issues.length) {
725
- final.issues.push({
726
- code: "invalid_type",
727
- expected: "nonoptional",
728
- input: undefined,
729
- path: [key],
730
- });
731
- }
732
- return;
733
- }
734
699
  if (result.value === undefined) {
735
- if (isPresent) {
700
+ if (key in input) {
736
701
  final.value[key] = undefined;
737
702
  }
738
703
  }
@@ -758,16 +723,12 @@ function normalizeDef(def) {
758
723
  }
759
724
  function handleCatchall(proms, input, payload, ctx, def, inst) {
760
725
  const unrecognized = [];
726
+ // iterate over input keys
761
727
  const keySet = def.keySet;
762
728
  const _catchall = def.catchall._zod;
763
729
  const t = _catchall.def.type;
764
- const isOptionalIn = _catchall.optin === "optional";
765
730
  const isOptionalOut = _catchall.optout === "optional";
766
731
  for (const key in input) {
767
- // skip __proto__ so it can't replace the result prototype via the
768
- // assignment setter on the plain {} we build into
769
- if (key === "__proto__")
770
- continue;
771
732
  if (keySet.has(key))
772
733
  continue;
773
734
  if (t === "never") {
@@ -776,10 +737,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
776
737
  }
777
738
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
778
739
  if (r instanceof Promise) {
779
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
740
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
780
741
  }
781
742
  else {
782
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
743
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
783
744
  }
784
745
  }
785
746
  if (unrecognized.length) {
@@ -847,14 +808,13 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
847
808
  const shape = value.shape;
848
809
  for (const key of value.keys) {
849
810
  const el = shape[key];
850
- const isOptionalIn = el._zod.optin === "optional";
851
811
  const isOptionalOut = el._zod.optout === "optional";
852
812
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
853
813
  if (r instanceof Promise) {
854
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
814
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
855
815
  }
856
816
  else {
857
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
817
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
858
818
  }
859
819
  }
860
820
  if (!catchall) {
@@ -887,11 +847,10 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
887
847
  const id = ids[key];
888
848
  const k = util.esc(key);
889
849
  const schema = shape[key];
890
- const isOptionalIn = schema?._zod?.optin === "optional";
891
850
  const isOptionalOut = schema?._zod?.optout === "optional";
892
851
  doc.write(`const ${id} = ${parseStr(key)};`);
893
- if (isOptionalIn && isOptionalOut) {
894
- // For optional-in/out schemas, ignore errors on absent keys
852
+ if (isOptionalOut) {
853
+ // For optional-out schemas, ignore errors on absent keys
895
854
  doc.write(`
896
855
  if (${id}.issues.length) {
897
856
  if (${k} in input) {
@@ -910,34 +869,6 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
910
869
  newResult[${k}] = ${id}.value;
911
870
  }
912
871
 
913
- `);
914
- }
915
- else if (!isOptionalIn) {
916
- doc.write(`
917
- const ${id}_present = ${k} in input;
918
- if (${id}.issues.length) {
919
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
920
- ...iss,
921
- path: iss.path ? [${k}, ...iss.path] : [${k}]
922
- })));
923
- }
924
- if (!${id}_present && !${id}.issues.length) {
925
- payload.issues.push({
926
- code: "invalid_type",
927
- expected: "nonoptional",
928
- input: undefined,
929
- path: [${k}]
930
- });
931
- }
932
-
933
- if (${id}_present) {
934
- if (${id}.value === undefined) {
935
- newResult[${k}] = undefined;
936
- } else {
937
- newResult[${k}] = ${id}.value;
938
- }
939
- }
940
-
941
872
  `);
942
873
  }
943
874
  else {
@@ -1033,9 +964,10 @@ export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def
1033
964
  }
1034
965
  return undefined;
1035
966
  });
1036
- const first = def.options.length === 1 ? def.options[0]._zod.run : null;
967
+ const single = def.options.length === 1;
968
+ const first = def.options[0]._zod.run;
1037
969
  inst._zod.parse = (payload, ctx) => {
1038
- if (first) {
970
+ if (single) {
1039
971
  return first(payload, ctx);
1040
972
  }
1041
973
  let async = false;
@@ -1092,9 +1024,10 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
1092
1024
  export const $ZodXor = /*@__PURE__*/ core.$constructor("$ZodXor", (inst, def) => {
1093
1025
  $ZodUnion.init(inst, def);
1094
1026
  def.inclusive = false;
1095
- const first = def.options.length === 1 ? def.options[0]._zod.run : null;
1027
+ const single = def.options.length === 1;
1028
+ const first = def.options[0]._zod.run;
1096
1029
  inst._zod.parse = (payload, ctx) => {
1097
- if (first) {
1030
+ if (single) {
1098
1031
  return first(payload, ctx);
1099
1032
  }
1100
1033
  let async = false;
@@ -1172,11 +1105,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
1172
1105
  if (opt) {
1173
1106
  return opt._zod.run(payload, ctx);
1174
1107
  }
1175
- // Fall back to union matching when the fast discriminator path fails:
1176
- // - explicitly enabled via unionFallback, or
1177
- // - during backward direction (encode), since codec-based discriminators
1178
- // have different values in forward vs backward directions
1179
- if (def.unionFallback || ctx.direction === "backward") {
1108
+ if (def.unionFallback) {
1180
1109
  return _super(payload, ctx);
1181
1110
  }
1182
1111
  // no matching discriminator
@@ -1185,7 +1114,6 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
1185
1114
  errors: [],
1186
1115
  note: "No matching discriminator",
1187
1116
  discriminator: def.discriminator,
1188
- options: Array.from(disc.value.keys()),
1189
1117
  input,
1190
1118
  path: [def.discriminator],
1191
1119
  inst,
@@ -1313,112 +1241,67 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
1313
1241
  }
1314
1242
  payload.value = [];
1315
1243
  const proms = [];
1316
- const optinStart = getTupleOptStart(items, "optin");
1317
- const optoutStart = getTupleOptStart(items, "optout");
1244
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1245
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
1318
1246
  if (!def.rest) {
1319
- if (input.length < optinStart) {
1247
+ const tooBig = input.length > items.length;
1248
+ const tooSmall = input.length < optStart - 1;
1249
+ if (tooBig || tooSmall) {
1320
1250
  payload.issues.push({
1321
- code: "too_small",
1322
- minimum: optinStart,
1323
- inclusive: true,
1251
+ ...(tooBig
1252
+ ? { code: "too_big", maximum: items.length, inclusive: true }
1253
+ : { code: "too_small", minimum: items.length }),
1324
1254
  input,
1325
1255
  inst,
1326
1256
  origin: "array",
1327
1257
  });
1328
1258
  return payload;
1329
1259
  }
1330
- if (input.length > items.length) {
1331
- payload.issues.push({
1332
- code: "too_big",
1333
- maximum: items.length,
1334
- inclusive: true,
1335
- input,
1336
- inst,
1337
- origin: "array",
1338
- });
1339
- }
1340
1260
  }
1341
- // Run every item in parallel, collecting results into an indexed
1342
- // array. The post-processing in `handleTupleResults` walks them in
1343
- // order so it can decide whether an absent optional-output error can
1344
- // truncate the tail or must be reported to preserve required output.
1345
- const itemResults = new Array(items.length);
1346
- for (let i = 0; i < items.length; i++) {
1347
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
1348
- if (r instanceof Promise) {
1349
- proms.push(r.then((rr) => {
1350
- itemResults[i] = rr;
1351
- }));
1261
+ let i = -1;
1262
+ for (const item of items) {
1263
+ i++;
1264
+ if (i >= input.length)
1265
+ if (i >= optStart)
1266
+ continue;
1267
+ const result = item._zod.run({
1268
+ value: input[i],
1269
+ issues: [],
1270
+ }, ctx);
1271
+ if (result instanceof Promise) {
1272
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1352
1273
  }
1353
1274
  else {
1354
- itemResults[i] = r;
1275
+ handleTupleResult(result, payload, i);
1355
1276
  }
1356
1277
  }
1357
1278
  if (def.rest) {
1358
- let i = items.length - 1;
1359
1279
  const rest = input.slice(items.length);
1360
1280
  for (const el of rest) {
1361
1281
  i++;
1362
- const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
1282
+ const result = def.rest._zod.run({
1283
+ value: el,
1284
+ issues: [],
1285
+ }, ctx);
1363
1286
  if (result instanceof Promise) {
1364
- proms.push(result.then((r) => handleTupleResult(r, payload, i)));
1287
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1365
1288
  }
1366
1289
  else {
1367
1290
  handleTupleResult(result, payload, i);
1368
1291
  }
1369
1292
  }
1370
1293
  }
1371
- if (proms.length) {
1372
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
1373
- }
1374
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
1294
+ if (proms.length)
1295
+ return Promise.all(proms).then(() => payload);
1296
+ return payload;
1375
1297
  };
1376
1298
  });
1377
- function getTupleOptStart(items, key) {
1378
- for (let i = items.length - 1; i >= 0; i--) {
1379
- if (items[i]._zod[key] !== "optional")
1380
- return i + 1;
1381
- }
1382
- return 0;
1383
- }
1384
1299
  function handleTupleResult(result, final, index) {
1385
1300
  if (result.issues.length) {
1386
1301
  final.issues.push(...util.prefixIssues(index, result.issues));
1387
1302
  }
1388
1303
  final.value[index] = result.value;
1389
1304
  }
1390
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
1391
- // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
1392
- // rule, but only after `optoutStart`: the first index where the output
1393
- // tuple tail can be absent.
1394
- for (let i = 0; i < items.length; i++) {
1395
- const r = itemResults[i];
1396
- const isPresent = i < input.length;
1397
- if (r.issues.length) {
1398
- if (!isPresent && i >= optoutStart) {
1399
- final.value.length = i;
1400
- break;
1401
- }
1402
- final.issues.push(...util.prefixIssues(i, r.issues));
1403
- }
1404
- final.value[i] = r.value;
1405
- }
1406
- // Drop trailing slots that produced `undefined` for absent input
1407
- // (the array analog of an absent optional key on an object). The
1408
- // `i >= input.length` floor is critical: an explicit `undefined`
1409
- // *inside* the input must be preserved even when the schema is
1410
- // optional-out (e.g. `z.string().or(z.undefined())` accepting an
1411
- // explicit undefined value).
1412
- for (let i = final.value.length - 1; i >= input.length; i--) {
1413
- if (items[i]._zod.optout === "optional" && final.value[i] === undefined) {
1414
- final.value.length = i;
1415
- }
1416
- else {
1417
- break;
1418
- }
1419
- }
1420
- return final;
1421
- }
1422
1305
  export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
1423
1306
  $ZodType.init(inst, def);
1424
1307
  inst._zod.parse = (payload, ctx) => {
@@ -1440,36 +1323,20 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
1440
1323
  for (const key of values) {
1441
1324
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1442
1325
  recordKeys.add(typeof key === "number" ? key.toString() : key);
1443
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1444
- if (keyResult instanceof Promise) {
1445
- throw new Error("Async schemas not supported in object keys currently");
1446
- }
1447
- if (keyResult.issues.length) {
1448
- payload.issues.push({
1449
- code: "invalid_key",
1450
- origin: "record",
1451
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1452
- input: key,
1453
- path: [key],
1454
- inst,
1455
- });
1456
- continue;
1457
- }
1458
- const outKey = keyResult.value;
1459
1326
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1460
1327
  if (result instanceof Promise) {
1461
1328
  proms.push(result.then((result) => {
1462
1329
  if (result.issues.length) {
1463
1330
  payload.issues.push(...util.prefixIssues(key, result.issues));
1464
1331
  }
1465
- payload.value[outKey] = result.value;
1332
+ payload.value[key] = result.value;
1466
1333
  }));
1467
1334
  }
1468
1335
  else {
1469
1336
  if (result.issues.length) {
1470
1337
  payload.issues.push(...util.prefixIssues(key, result.issues));
1471
1338
  }
1472
- payload.value[outKey] = result.value;
1339
+ payload.value[key] = result.value;
1473
1340
  }
1474
1341
  }
1475
1342
  }
@@ -1491,12 +1358,9 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
1491
1358
  }
1492
1359
  else {
1493
1360
  payload.value = {};
1494
- // Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
1495
1361
  for (const key of Reflect.ownKeys(input)) {
1496
1362
  if (key === "__proto__")
1497
1363
  continue;
1498
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
1499
- continue;
1500
1364
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1501
1365
  if (keyResult instanceof Promise) {
1502
1366
  throw new Error("Async schemas not supported in object keys currently");
@@ -1717,7 +1581,6 @@ export const $ZodFile = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def)
1717
1581
  });
1718
1582
  export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (inst, def) => {
1719
1583
  $ZodType.init(inst, def);
1720
- inst._zod.optin = "optional";
1721
1584
  inst._zod.parse = (payload, ctx) => {
1722
1585
  if (ctx.direction === "backward") {
1723
1586
  throw new core.$ZodEncodeError(inst.constructor.name);
@@ -1727,7 +1590,6 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
1727
1590
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1728
1591
  return output.then((output) => {
1729
1592
  payload.value = output;
1730
- payload.fallback = true;
1731
1593
  return payload;
1732
1594
  });
1733
1595
  }
@@ -1735,12 +1597,11 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
1735
1597
  throw new core.$ZodAsyncError();
1736
1598
  }
1737
1599
  payload.value = _out;
1738
- payload.fallback = true;
1739
1600
  return payload;
1740
1601
  };
1741
1602
  });
1742
1603
  function handleOptionalResult(result, input) {
1743
- if (input === undefined && (result.issues.length || result.fallback)) {
1604
+ if (result.issues.length && input === undefined) {
1744
1605
  return { issues: [], value: undefined };
1745
1606
  }
1746
1607
  return result;
@@ -1758,11 +1619,10 @@ export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (ins
1758
1619
  });
1759
1620
  inst._zod.parse = (payload, ctx) => {
1760
1621
  if (def.innerType._zod.optin === "optional") {
1761
- const input = payload.value;
1762
1622
  const result = def.innerType._zod.run(payload, ctx);
1763
1623
  if (result instanceof Promise)
1764
- return result.then((r) => handleOptionalResult(r, input));
1765
- return handleOptionalResult(result, input);
1624
+ return result.then((r) => handleOptionalResult(r, payload.value));
1625
+ return handleOptionalResult(result, payload.value);
1766
1626
  }
1767
1627
  if (payload.value === undefined) {
1768
1628
  return payload;
@@ -1889,7 +1749,7 @@ export const $ZodSuccess = /*@__PURE__*/ core.$constructor("$ZodSuccess", (inst,
1889
1749
  });
1890
1750
  export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
1891
1751
  $ZodType.init(inst, def);
1892
- inst._zod.optin = "optional";
1752
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1893
1753
  util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1894
1754
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1895
1755
  inst._zod.parse = (payload, ctx) => {
@@ -1910,7 +1770,6 @@ export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def
1910
1770
  input: payload.value,
1911
1771
  });
1912
1772
  payload.issues = [];
1913
- payload.fallback = true;
1914
1773
  }
1915
1774
  return payload;
1916
1775
  });
@@ -1925,7 +1784,6 @@ export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def
1925
1784
  input: payload.value,
1926
1785
  });
1927
1786
  payload.issues = [];
1928
- payload.fallback = true;
1929
1787
  }
1930
1788
  return payload;
1931
1789
  };
@@ -1972,7 +1830,7 @@ function handlePipeResult(left, next, ctx) {
1972
1830
  left.aborted = true;
1973
1831
  return left;
1974
1832
  }
1975
- return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
1833
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
1976
1834
  }
1977
1835
  export const $ZodCodec = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
1978
1836
  $ZodType.init(inst, def);
@@ -2028,9 +1886,6 @@ function handleCodecTxResult(left, value, nextSchema, ctx) {
2028
1886
  }
2029
1887
  return nextSchema._zod.run({ value, issues: left.issues }, ctx);
2030
1888
  }
2031
- export const $ZodPreprocess = /*@__PURE__*/ core.$constructor("$ZodPreprocess", (inst, def) => {
2032
- $ZodPipe.init(inst, def);
2033
- });
2034
1889
  export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (inst, def) => {
2035
1890
  $ZodType.init(inst, def);
2036
1891
  util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
@@ -2188,15 +2043,14 @@ export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst,
2188
2043
  });
2189
2044
  export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
2190
2045
  $ZodType.init(inst, def);
2191
- // Cache the resolved inner type on the shared `def` so all clones of this
2192
- // lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
2193
- // preserving identity for cycle detection on recursive schemas.
2194
- util.defineLazy(inst._zod, "innerType", () => {
2195
- const d = def;
2196
- if (!d._cachedInner)
2197
- d._cachedInner = def.getter();
2198
- return d._cachedInner;
2199
- });
2046
+ // let _innerType!: any;
2047
+ // util.defineLazy(def, "getter", () => {
2048
+ // if (!_innerType) {
2049
+ // _innerType = def.getter();
2050
+ // }
2051
+ // return () => _innerType;
2052
+ // });
2053
+ util.defineLazy(inst._zod, "innerType", () => def.getter());
2200
2054
  util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
2201
2055
  util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
2202
2056
  util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
@@ -93,7 +93,7 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
93
93
  delete result.schema.default;
94
94
  }
95
95
  // set prefault as default
96
- if (ctx.io === "input" && "_prefault" in result.schema)
96
+ if (ctx.io === "input" && result.schema._prefault)
97
97
  (_a = result.schema).default ?? (_a.default = result.schema._prefault);
98
98
  delete result.schema._prefault;
99
99
  // pulling fresh from ctx.seen in case it was overwritten
@@ -325,20 +325,11 @@ function finalize(ctx, schema) {
325
325
  result.$id = ctx.external.uri(id);
326
326
  }
327
327
  Object.assign(result, root.def ?? root.schema);
328
- // The `id` in `.meta()` is a Zod-specific registration tag used to extract
329
- // schemas into $defs — it is not user-facing JSON Schema metadata. Strip it
330
- // from the output body where it would otherwise leak. The id is preserved
331
- // implicitly via the $defs key (and via $ref paths).
332
- const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
333
- if (rootMetaId !== undefined && result.id === rootMetaId)
334
- delete result.id;
335
328
  // build defs object
336
329
  const defs = ctx.external?.defs ?? {};
337
330
  for (const entry of ctx.seen.entries()) {
338
331
  const seen = entry[1];
339
332
  if (seen.def && seen.defId) {
340
- if (seen.def.id === seen.defId)
341
- delete seen.def.id;
342
333
  defs[seen.defId] = seen.def;
343
334
  }
344
335
  }
@@ -407,8 +398,6 @@ function isTransforming(_schema, _ctx) {
407
398
  return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
408
399
  }
409
400
  if (def.type === "pipe") {
410
- if (_schema._zod.traits.has("$ZodCodec"))
411
- return true;
412
401
  return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
413
402
  }
414
403
  if (def.type === "object") {
@@ -86,7 +86,7 @@ export function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
86
86
  delete result.schema.default;
87
87
  }
88
88
  // set prefault as default
89
- if (ctx.io === "input" && "_prefault" in result.schema)
89
+ if (ctx.io === "input" && result.schema._prefault)
90
90
  (_a = result.schema).default ?? (_a.default = result.schema._prefault);
91
91
  delete result.schema._prefault;
92
92
  // pulling fresh from ctx.seen in case it was overwritten
@@ -318,20 +318,11 @@ export function finalize(ctx, schema) {
318
318
  result.$id = ctx.external.uri(id);
319
319
  }
320
320
  Object.assign(result, root.def ?? root.schema);
321
- // The `id` in `.meta()` is a Zod-specific registration tag used to extract
322
- // schemas into $defs — it is not user-facing JSON Schema metadata. Strip it
323
- // from the output body where it would otherwise leak. The id is preserved
324
- // implicitly via the $defs key (and via $ref paths).
325
- const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
326
- if (rootMetaId !== undefined && result.id === rootMetaId)
327
- delete result.id;
328
321
  // build defs object
329
322
  const defs = ctx.external?.defs ?? {};
330
323
  for (const entry of ctx.seen.entries()) {
331
324
  const seen = entry[1];
332
325
  if (seen.def && seen.defId) {
333
- if (seen.def.id === seen.defId)
334
- delete seen.def.id;
335
326
  defs[seen.defId] = seen.def;
336
327
  }
337
328
  }
@@ -400,8 +391,6 @@ function isTransforming(_schema, _ctx) {
400
391
  return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
401
392
  }
402
393
  if (def.type === "pipe") {
403
- if (_schema._zod.traits.has("$ZodCodec"))
404
- return true;
405
394
  return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
406
395
  }
407
396
  if (def.type === "object") {