dsh-github-copilot 0.4.0-alpha.121 → 0.4.0-alpha.123

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.
package/lib/client.js CHANGED
@@ -357,7 +357,7 @@ window.__ModuleLoader__.load({
357
357
  };
358
358
  }
359
359
  //#endregion
360
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
360
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
361
361
  function getEnumValues(entries) {
362
362
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
363
363
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -369,14 +369,22 @@ window.__ModuleLoader__.load({
369
369
  if (typeof value === "bigint") return value.toString();
370
370
  return value;
371
371
  }
372
- function cached(getter) {
373
- return { get value() {
374
- {
375
- const value = getter();
376
- Object.defineProperty(this, "value", { value });
377
- return value;
372
+ var Cached = class {
373
+ constructor(getter) {
374
+ this._getter = getter;
375
+ this._value = void 0;
376
+ }
377
+ get value() {
378
+ const getter = this._getter;
379
+ if (getter !== void 0) {
380
+ this._value = getter();
381
+ this._getter = void 0;
378
382
  }
379
- } };
383
+ return this._value;
384
+ }
385
+ };
386
+ function cached(getter) {
387
+ return new Cached(getter);
380
388
  }
381
389
  function nullish(input) {
382
390
  return input === null || input === void 0;
@@ -401,6 +409,58 @@ window.__ModuleLoader__.load({
401
409
  configurable: true
402
410
  });
403
411
  }
412
+ /**
413
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
414
+ *
415
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
416
+ */
417
+ function rawShape(def) {
418
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
419
+ return desc?.get ? desc.get.raw : desc?.value;
420
+ }
421
+ function sourceShape(schema) {
422
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
423
+ }
424
+ function deferProp(target, key, getter) {
425
+ Object.defineProperty(target, key, {
426
+ get() {
427
+ const value = getter();
428
+ assignProp(this, key, value);
429
+ return value;
430
+ },
431
+ enumerable: true,
432
+ configurable: true
433
+ });
434
+ }
435
+ function putProp(target, key, value) {
436
+ if (key in target) assignProp(target, key, value);
437
+ else target[key] = value;
438
+ }
439
+ /**
440
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
441
+ *
442
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
443
+ */
444
+ function mirrorShape(target, source, keys, wrap) {
445
+ const raw = sourceShape(source);
446
+ for (const key of keys) {
447
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
448
+ if (!desc.enumerable) continue;
449
+ if (desc.get) deferProp(target, key, () => {
450
+ const value = source._zod.def.shape[key];
451
+ return wrap ? wrap(value, key) : value;
452
+ });
453
+ else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
454
+ }
455
+ }
456
+ function mirrorProps(target, source) {
457
+ for (const key of Reflect.ownKeys(source)) {
458
+ const desc = Object.getOwnPropertyDescriptor(source, key);
459
+ if (!desc.enumerable) continue;
460
+ if (desc.get) deferProp(target, key, () => source[key]);
461
+ else putProp(target, key, desc.value);
462
+ }
463
+ }
404
464
  function mergeDefs(...defs) {
405
465
  const mergedDescriptors = {};
406
466
  for (const def of defs) {
@@ -491,39 +551,39 @@ window.__ModuleLoader__.load({
491
551
  float32: [-34028234663852886e22, 34028234663852886e22],
492
552
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
493
553
  }))();
554
+ const BIGINT_FORMAT_RANGES = {
555
+ int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
556
+ uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
557
+ };
494
558
  function pick(schema, mask) {
495
559
  const currDef = schema._zod.def;
496
560
  const checks = currDef.checks;
497
561
  if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
498
- return clone(schema, mergeDefs(schema._zod.def, {
499
- get shape() {
500
- const newShape = {};
501
- for (const key of Reflect.ownKeys(mask)) {
502
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
503
- if (!mask[key]) continue;
504
- assignProp(newShape, key, currDef.shape[key]);
505
- }
506
- assignProp(this, "shape", newShape);
507
- return newShape;
508
- },
562
+ const newShape = {};
563
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
564
+ return clone(schema, mergeDefs(currDef, {
565
+ shape: newShape,
509
566
  checks: []
510
567
  }));
511
568
  }
569
+ function maskedKeys(schema, mask) {
570
+ const raw = sourceShape(schema);
571
+ const keys = [];
572
+ for (const key of Reflect.ownKeys(mask)) {
573
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
574
+ if (mask[key]) keys.push(key);
575
+ }
576
+ return keys;
577
+ }
512
578
  function omit(schema, mask) {
513
579
  const currDef = schema._zod.def;
514
580
  const checks = currDef.checks;
515
581
  if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
516
- return clone(schema, mergeDefs(schema._zod.def, {
517
- get shape() {
518
- const newShape = { ...schema._zod.def.shape };
519
- for (const key of Reflect.ownKeys(mask)) {
520
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
521
- if (!mask[key]) continue;
522
- delete newShape[key];
523
- }
524
- assignProp(this, "shape", newShape);
525
- return newShape;
526
- },
582
+ const omitted = new Set(maskedKeys(schema, mask));
583
+ const newShape = {};
584
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
585
+ return clone(schema, mergeDefs(currDef, {
586
+ shape: newShape,
527
587
  checks: []
528
588
  }));
529
589
  }
@@ -531,41 +591,29 @@ window.__ModuleLoader__.load({
531
591
  if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
532
592
  const checks = schema._zod.def.checks;
533
593
  if (checks && checks.length > 0) {
534
- const existingShape = schema._zod.def.shape;
594
+ const existingShape = sourceShape(schema);
535
595
  for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
536
596
  }
537
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
538
- const _shape = {
539
- ...schema._zod.def.shape,
540
- ...shape
541
- };
542
- assignProp(this, "shape", _shape);
543
- return _shape;
544
- } }));
597
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
598
+ }
599
+ function extended(schema, shape) {
600
+ const newShape = {};
601
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
602
+ mirrorProps(newShape, shape);
603
+ return newShape;
545
604
  }
546
605
  function safeExtend(schema, shape) {
547
606
  if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
548
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
549
- const _shape = {
550
- ...schema._zod.def.shape,
551
- ...shape
552
- };
553
- assignProp(this, "shape", _shape);
554
- return _shape;
555
- } }));
607
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
556
608
  }
557
609
  function merge(a, b) {
558
610
  if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
559
611
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
612
+ const newShape = {};
613
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
614
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
560
615
  return clone(a, mergeDefs(a._zod.def, {
561
- get shape() {
562
- const _shape = {
563
- ...a._zod.def.shape,
564
- ...b._zod.def.shape
565
- };
566
- assignProp(this, "shape", _shape);
567
- return _shape;
568
- },
616
+ shape: newShape,
569
617
  get catchall() {
570
618
  return b._zod.def.catchall;
571
619
  },
@@ -575,47 +623,25 @@ window.__ModuleLoader__.load({
575
623
  function partial(Class, schema, mask, name = "partial") {
576
624
  const checks = schema._zod.def.checks;
577
625
  if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
626
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
627
+ const newShape = {};
628
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
629
+ type: "optional",
630
+ innerType: value
631
+ })));
578
632
  return clone(schema, mergeDefs(schema._zod.def, {
579
- get shape() {
580
- const oldShape = schema._zod.def.shape;
581
- const shape = { ...oldShape };
582
- if (mask) for (const key of Reflect.ownKeys(mask)) {
583
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
584
- if (!mask[key]) continue;
585
- shape[key] = Class ? new Class({
586
- type: "optional",
587
- innerType: oldShape[key]
588
- }) : oldShape[key];
589
- }
590
- else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
591
- type: "optional",
592
- innerType: oldShape[key]
593
- }) : oldShape[key];
594
- assignProp(this, "shape", shape);
595
- return shape;
596
- },
633
+ shape: newShape,
597
634
  checks: []
598
635
  }));
599
636
  }
600
637
  function required(Class, schema, mask) {
601
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
602
- const oldShape = schema._zod.def.shape;
603
- const shape = { ...oldShape };
604
- if (mask) for (const key of Reflect.ownKeys(mask)) {
605
- if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
606
- if (!mask[key]) continue;
607
- shape[key] = new Class({
608
- type: "nonoptional",
609
- innerType: oldShape[key]
610
- });
611
- }
612
- else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
613
- type: "nonoptional",
614
- innerType: oldShape[key]
615
- });
616
- assignProp(this, "shape", shape);
617
- return shape;
618
- } }));
638
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
639
+ const newShape = {};
640
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
641
+ type: "nonoptional",
642
+ innerType: value
643
+ }));
644
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
619
645
  }
620
646
  function aborted(x, startIndex = 0) {
621
647
  if (x.aborted === true) return true;
@@ -651,11 +677,15 @@ window.__ModuleLoader__.load({
651
677
  }
652
678
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
653
679
  const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
654
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
655
- rest.path ?? (rest.path = []);
656
- rest.message = message;
657
- if (ctx?.reportInput) rest.input = _input;
658
- return rest;
680
+ const full = {};
681
+ for (const k of Object.keys(iss)) {
682
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
683
+ full[k] = iss[k];
684
+ }
685
+ full.path ?? (full.path = []);
686
+ full.message = message;
687
+ if (ctx?.reportInput) full.input = iss.input;
688
+ return full;
659
689
  }
660
690
  const highSurrogate = /[\uD800-\uDBFF]/;
661
691
  function codePointLength(str) {
@@ -725,6 +755,23 @@ window.__ModuleLoader__.load({
725
755
  function hide(inst, key, value) {
726
756
  return own(inst, key, value, false);
727
757
  }
758
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
759
+ function derived(computes, table) {
760
+ for (const key in computes) {
761
+ const compute = computes[key];
762
+ Object.defineProperty(table, key, {
763
+ configurable: true,
764
+ enumerable: true,
765
+ get() {
766
+ return own(this, key, compute(this));
767
+ },
768
+ set(value) {
769
+ own(this, key, value);
770
+ }
771
+ });
772
+ }
773
+ return table;
774
+ }
728
775
  function defineBound(proto, key, fn) {
729
776
  Object.defineProperty(proto, key, {
730
777
  configurable: true,
@@ -833,9 +880,9 @@ window.__ModuleLoader__.load({
833
880
  return fn;
834
881
  }
835
882
  //#endregion
836
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js
883
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
837
884
  var _a$1;
838
- const _zodDesc$1 = {
885
+ const _zodDesc = {
839
886
  value: void 0,
840
887
  enumerable: false
841
888
  };
@@ -872,14 +919,13 @@ window.__ModuleLoader__.load({
872
919
  const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
873
920
  function init(inst, def) {
874
921
  if (!inst._zod) {
875
- _zodDesc$1.value = new Internals(def);
922
+ _zodDesc.value = new Internals(def);
876
923
  try {
877
- Object.defineProperty(inst, "_zod", _zodDesc$1);
924
+ Object.defineProperty(inst, "_zod", _zodDesc);
878
925
  } finally {
879
- _zodDesc$1.value = void 0;
926
+ _zodDesc.value = void 0;
880
927
  }
881
- }
882
- if (inst._zod.traits.has(name)) return;
928
+ } else if (inst._zod.traits.has(name)) return;
883
929
  inst._zod.traits.add(name);
884
930
  initializer(inst, def);
885
931
  if (initialized) {
@@ -940,7 +986,7 @@ window.__ModuleLoader__.load({
940
986
  return globalConfig;
941
987
  }
942
988
  //#endregion
943
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js
989
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
944
990
  function _getMessage() {
945
991
  const internals = this._zod;
946
992
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -955,10 +1001,6 @@ window.__ModuleLoader__.load({
955
1001
  enumerable: true,
956
1002
  configurable: true
957
1003
  };
958
- const _zodDesc = {
959
- value: void 0,
960
- enumerable: false
961
- };
962
1004
  const _issuesDesc = {
963
1005
  value: void 0,
964
1006
  enumerable: false
@@ -966,11 +1008,8 @@ window.__ModuleLoader__.load({
966
1008
  const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
967
1009
  const initializer$1 = (inst, def) => {
968
1010
  inst.name = "$ZodError";
969
- _zodDesc.value = inst._zod;
970
- Object.defineProperty(inst, "_zod", _zodDesc);
971
1011
  _issuesDesc.value = def;
972
1012
  Object.defineProperty(inst, "issues", _issuesDesc);
973
- _zodDesc.value = void 0;
974
1013
  _issuesDesc.value = void 0;
975
1014
  Object.defineProperty(inst, "message", _messageDesc);
976
1015
  const proto = Object.getPrototypeOf(inst);
@@ -999,7 +1038,7 @@ window.__ModuleLoader__.load({
999
1038
  }
1000
1039
  };
1001
1040
  const $ZodError = $constructor("$ZodError", initializer$1);
1002
- const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
1041
+ $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
1003
1042
  /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
1004
1043
  * ("toString", "constructor") would otherwise read through to the prototype, and assigning
1005
1044
  * "__proto__" would hit the setter instead of creating a key. */
@@ -1063,7 +1102,7 @@ window.__ModuleLoader__.load({
1063
1102
  return fieldErrors;
1064
1103
  }
1065
1104
  //#endregion
1066
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js
1105
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
1067
1106
  function finalizeParams(callee, params) {
1068
1107
  return {
1069
1108
  callee: params?.callee ?? callee,
@@ -1120,15 +1159,30 @@ window.__ModuleLoader__.load({
1120
1159
  issues: []
1121
1160
  }, ctx);
1122
1161
  if (result instanceof Promise) throw new $ZodAsyncError();
1123
- return result.issues.length ? {
1124
- success: false,
1125
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1126
- } : {
1162
+ return result.issues.length ? failure(_Err, result.issues, ctx) : {
1127
1163
  success: true,
1128
1164
  data: result.value
1129
1165
  };
1130
1166
  };
1131
- const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
1167
+ function failure(Err, issues, ctx) {
1168
+ let error;
1169
+ return {
1170
+ success: false,
1171
+ get error() {
1172
+ if (!error) {
1173
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
1174
+ issues = void 0;
1175
+ ctx = void 0;
1176
+ }
1177
+ return error;
1178
+ },
1179
+ set error(e) {
1180
+ error = e;
1181
+ issues = void 0;
1182
+ ctx = void 0;
1183
+ }
1184
+ };
1185
+ }
1132
1186
  const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
1133
1187
  const ctx = _ctx ? {
1134
1188
  ..._ctx,
@@ -1139,15 +1193,61 @@ window.__ModuleLoader__.load({
1139
1193
  issues: []
1140
1194
  }, ctx);
1141
1195
  if (result instanceof Promise) result = await result;
1142
- return result.issues.length ? {
1143
- success: false,
1144
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1145
- } : {
1196
+ return result.issues.length ? failure(_Err, result.issues, ctx) : {
1146
1197
  success: true,
1147
1198
  data: result.value
1148
1199
  };
1149
1200
  };
1150
- const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
1201
+ const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
1202
+ const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
1203
+ const validate = ((schema, value, _ctx) => {
1204
+ const validator = schema._zod.bag.validator;
1205
+ if (validator !== void 0) {
1206
+ if (validator(value) !== COMPILE_INVALID) return true;
1207
+ if (validator.definite === true && _ctx === void 0) return false;
1208
+ }
1209
+ return validateFallback(schema, value, _ctx);
1210
+ });
1211
+ function validateFallback(schema, value, _ctx) {
1212
+ const ctx = _ctx ? {
1213
+ ..._ctx,
1214
+ async: false,
1215
+ abortEarly: true
1216
+ } : {
1217
+ async: false,
1218
+ abortEarly: true
1219
+ };
1220
+ const fallbackRun = schema._zod.bag.fallbackRun;
1221
+ let result;
1222
+ if (fallbackRun) {
1223
+ ctx[COMPILE_FALLBACK] = true;
1224
+ result = fallbackRun({
1225
+ value,
1226
+ issues: []
1227
+ }, ctx);
1228
+ } else result = schema._zod.run({
1229
+ value,
1230
+ issues: []
1231
+ }, ctx);
1232
+ if (result instanceof Promise) throw new $ZodAsyncError();
1233
+ return result.issues.length === 0;
1234
+ }
1235
+ const validateAsync$1 = async (schema, value, _ctx) => {
1236
+ const ctx = _ctx ? {
1237
+ ..._ctx,
1238
+ async: true,
1239
+ abortEarly: true
1240
+ } : {
1241
+ async: true,
1242
+ abortEarly: true
1243
+ };
1244
+ let result = schema._zod.run({
1245
+ value,
1246
+ issues: []
1247
+ }, ctx);
1248
+ if (result instanceof Promise) result = await result;
1249
+ return result.issues.length === 0;
1250
+ };
1151
1251
  const _encode = (_Err) => {
1152
1252
  const parse = _parse(_Err);
1153
1253
  const fn = (schema, value, _ctx, _params) => {
@@ -1205,7 +1305,7 @@ window.__ModuleLoader__.load({
1205
1305
  return _safeParseAsync(_Err)(schema, value, _ctx);
1206
1306
  };
1207
1307
  //#endregion
1208
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js
1308
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
1209
1309
  /**
1210
1310
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
1211
1311
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -1232,8 +1332,8 @@ window.__ModuleLoader__.load({
1232
1332
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
1233
1333
  };
1234
1334
  /** Practical email validation */
1235
- const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1236
- const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
1335
+ const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1336
+ const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
1237
1337
  function emoji() {
1238
1338
  return new RegExp(_emoji$1, "u");
1239
1339
  }
@@ -1242,7 +1342,7 @@ window.__ModuleLoader__.load({
1242
1342
  const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
1243
1343
  const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1244
1344
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1245
- const base64url = /^[A-Za-z0-9_-]*$/;
1345
+ const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
1246
1346
  const httpProtocol = /^https?$/;
1247
1347
  const e164 = /^\+[1-9]\d{6,14}$/;
1248
1348
  const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
@@ -1270,17 +1370,13 @@ window.__ModuleLoader__.load({
1270
1370
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
1271
1371
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1272
1372
  }
1273
- const string$1 = (params) => {
1274
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1275
- return new RegExp(`^${regex}$`);
1276
- };
1277
- const integer = /^-?\d+$/;
1373
+ const anyString = /^[\s\S]{0,}$/;
1278
1374
  const number$1 = /^-?\d+(?:\.\d+)?$/;
1279
1375
  const boolean$1 = /^(?:true|false)$/i;
1280
1376
  const lowercase = /^[^A-Z]*$/;
1281
1377
  const uppercase = /^[^a-z]*$/;
1282
1378
  //#endregion
1283
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js
1379
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
1284
1380
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1285
1381
  var _a;
1286
1382
  inst._zod ?? (inst._zod = {});
@@ -1300,14 +1396,6 @@ window.__ModuleLoader__.load({
1300
1396
  const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
1301
1397
  $ZodCheck.init(inst, def);
1302
1398
  const origin = numericOriginMap[typeof def.value];
1303
- inst._zod.onattach.push((inst) => {
1304
- const bag = inst._zod.bag;
1305
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1306
- if (def.value < curr) {
1307
- if (def.inclusive) bag.maximum = def.value;
1308
- else bag.exclusiveMaximum = def.value;
1309
- }
1310
- });
1311
1399
  inst._zod.check = (payload) => {
1312
1400
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
1313
1401
  payload.issues.push({
@@ -1324,14 +1412,6 @@ window.__ModuleLoader__.load({
1324
1412
  const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
1325
1413
  $ZodCheck.init(inst, def);
1326
1414
  const origin = numericOriginMap[typeof def.value];
1327
- inst._zod.onattach.push((inst) => {
1328
- const bag = inst._zod.bag;
1329
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1330
- if (def.value > curr) {
1331
- if (def.inclusive) bag.minimum = def.value;
1332
- else bag.exclusiveMinimum = def.value;
1333
- }
1334
- });
1335
1415
  inst._zod.check = (payload) => {
1336
1416
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
1337
1417
  payload.issues.push({
@@ -1347,10 +1427,6 @@ window.__ModuleLoader__.load({
1347
1427
  });
1348
1428
  const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1349
1429
  $ZodCheck.init(inst, def);
1350
- inst._zod.onattach.push((inst) => {
1351
- var _a;
1352
- (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
1353
- });
1354
1430
  inst._zod.check = (payload) => {
1355
1431
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
1356
1432
  if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
@@ -1370,13 +1446,6 @@ window.__ModuleLoader__.load({
1370
1446
  const isInt = def.format?.includes("int");
1371
1447
  const origin = isInt ? "int" : "number";
1372
1448
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
1373
- inst._zod.onattach.push((inst) => {
1374
- const bag = inst._zod.bag;
1375
- bag.format = def.format;
1376
- bag.minimum = minimum;
1377
- bag.maximum = maximum;
1378
- if (isInt) bag.pattern = integer;
1379
- });
1380
1449
  inst._zod.check = (payload) => {
1381
1450
  const input = payload.value;
1382
1451
  if (isInt) {
@@ -1439,10 +1508,6 @@ window.__ModuleLoader__.load({
1439
1508
  var _a;
1440
1509
  $ZodCheck.init(inst, def);
1441
1510
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1442
- inst._zod.onattach.push((inst) => {
1443
- const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1444
- if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1445
- });
1446
1511
  inst._zod.check = (payload) => {
1447
1512
  const input = payload.value;
1448
1513
  const units = input.length;
@@ -1463,10 +1528,6 @@ window.__ModuleLoader__.load({
1463
1528
  var _a;
1464
1529
  $ZodCheck.init(inst, def);
1465
1530
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1466
- inst._zod.onattach.push((inst) => {
1467
- const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1468
- if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1469
- });
1470
1531
  inst._zod.check = (payload) => {
1471
1532
  const input = payload.value;
1472
1533
  const units = input.length;
@@ -1487,12 +1548,6 @@ window.__ModuleLoader__.load({
1487
1548
  var _a;
1488
1549
  $ZodCheck.init(inst, def);
1489
1550
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1490
- inst._zod.onattach.push((inst) => {
1491
- const bag = inst._zod.bag;
1492
- bag.minimum = def.length;
1493
- bag.maximum = def.length;
1494
- bag.length = def.length;
1495
- });
1496
1551
  inst._zod.check = (payload) => {
1497
1552
  const input = payload.value;
1498
1553
  const units = input.length;
@@ -1520,14 +1575,6 @@ window.__ModuleLoader__.load({
1520
1575
  const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
1521
1576
  var _a, _b;
1522
1577
  $ZodCheck.init(inst, def);
1523
- inst._zod.onattach.push((inst) => {
1524
- const bag = inst._zod.bag;
1525
- bag.format = def.format;
1526
- if (def.pattern) {
1527
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1528
- bag.patterns.add(def.pattern);
1529
- }
1530
- });
1531
1578
  if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
1532
1579
  def.pattern.lastIndex = 0;
1533
1580
  if (def.pattern.test(payload.value)) return;
@@ -1570,13 +1617,7 @@ window.__ModuleLoader__.load({
1570
1617
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
1571
1618
  $ZodCheck.init(inst, def);
1572
1619
  const escapedRegex = escapeRegex(def.includes);
1573
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1574
- def.pattern = pattern;
1575
- inst._zod.onattach.push((inst) => {
1576
- const bag = inst._zod.bag;
1577
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1578
- bag.patterns.add(pattern);
1579
- });
1620
+ def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1580
1621
  inst._zod.check = (payload) => {
1581
1622
  if (payload.value.includes(def.includes, def.position)) return;
1582
1623
  payload.issues.push({
@@ -1594,11 +1635,6 @@ window.__ModuleLoader__.load({
1594
1635
  $ZodCheck.init(inst, def);
1595
1636
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
1596
1637
  def.pattern ?? (def.pattern = pattern);
1597
- inst._zod.onattach.push((inst) => {
1598
- const bag = inst._zod.bag;
1599
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1600
- bag.patterns.add(pattern);
1601
- });
1602
1638
  inst._zod.check = (payload) => {
1603
1639
  if (payload.value.startsWith(def.prefix)) return;
1604
1640
  payload.issues.push({
@@ -1616,11 +1652,6 @@ window.__ModuleLoader__.load({
1616
1652
  $ZodCheck.init(inst, def);
1617
1653
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
1618
1654
  def.pattern ?? (def.pattern = pattern);
1619
- inst._zod.onattach.push((inst) => {
1620
- const bag = inst._zod.bag;
1621
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1622
- bag.patterns.add(pattern);
1623
- });
1624
1655
  inst._zod.check = (payload) => {
1625
1656
  if (payload.value.endsWith(def.suffix)) return;
1626
1657
  payload.issues.push({
@@ -1641,7 +1672,7 @@ window.__ModuleLoader__.load({
1641
1672
  };
1642
1673
  });
1643
1674
  //#endregion
1644
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js
1675
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
1645
1676
  var Doc = class {
1646
1677
  constructor(args = [], closed = {}) {
1647
1678
  this.content = [];
@@ -1651,8 +1682,11 @@ window.__ModuleLoader__.load({
1651
1682
  }
1652
1683
  indented(fn) {
1653
1684
  this.indent += 1;
1654
- fn(this);
1655
- this.indent -= 1;
1685
+ try {
1686
+ fn(this);
1687
+ } finally {
1688
+ this.indent -= 1;
1689
+ }
1656
1690
  }
1657
1691
  write(arg) {
1658
1692
  if (typeof arg === "function") {
@@ -1672,20 +1706,20 @@ window.__ModuleLoader__.load({
1672
1706
  }
1673
1707
  };
1674
1708
  //#endregion
1675
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js
1676
- const version = {
1709
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1710
+ const version$2 = {
1677
1711
  major: 4,
1678
- minor: 5,
1679
- patch: 4
1712
+ minor: 6,
1713
+ patch: 5
1680
1714
  };
1681
1715
  //#endregion
1682
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js
1716
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
1683
1717
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1684
1718
  var _a;
1685
1719
  inst ?? (inst = {});
1686
1720
  inst._zod.def = def;
1687
1721
  inst._zod.bag = inst._zod.bag || {};
1688
- inst._zod.version = version;
1722
+ inst._zod.version = version$2;
1689
1723
  const defChecks = inst._zod.def.checks;
1690
1724
  const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
1691
1725
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
@@ -1768,15 +1802,26 @@ window.__ModuleLoader__.load({
1768
1802
  }
1769
1803
  });
1770
1804
  /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1771
- const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1805
+ const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
1806
+ async function validateAsync(inst, value) {
1807
+ const ctx = { async: true };
1808
+ return toStandardResult(await inst._zod.run({
1809
+ value,
1810
+ issues: []
1811
+ }, ctx), ctx);
1812
+ }
1772
1813
  function standardProps(inst) {
1773
1814
  return {
1774
1815
  validate: (value) => {
1816
+ const ctx = { async: false };
1775
1817
  try {
1776
- return toStandardResult(safeParse$1(inst, value));
1777
- } catch (_) {
1778
- return safeParseAsync$1(inst, value).then(toStandardResult);
1779
- }
1818
+ const r = inst._zod.run({
1819
+ value,
1820
+ issues: []
1821
+ }, ctx);
1822
+ if (!(r instanceof Promise)) return toStandardResult(r, ctx);
1823
+ } catch (_) {}
1824
+ return validateAsync(inst, value);
1780
1825
  },
1781
1826
  vendor: "zod",
1782
1827
  version: 1
@@ -1784,7 +1829,7 @@ window.__ModuleLoader__.load({
1784
1829
  }
1785
1830
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1786
1831
  $ZodType.init(inst, def);
1787
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1832
+ inst._zod.pattern = def.pattern ?? anyString;
1788
1833
  inst._zod.parse = (payload, _) => {
1789
1834
  if (def.coerce) try {
1790
1835
  payload.value = String(payload.value);
@@ -1828,10 +1873,27 @@ window.__ModuleLoader__.load({
1828
1873
  def.pattern ?? (def.pattern = email);
1829
1874
  $ZodStringFormat.init(inst, def);
1830
1875
  });
1831
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
1876
+ function canParseURL(input) {
1877
+ try {
1878
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
1879
+ new URL(input);
1880
+ return true;
1881
+ } catch {
1882
+ return false;
1883
+ }
1884
+ }
1885
+ function validateURL(trimmed, def) {
1886
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
1887
+ return parseURLObject(trimmed, def);
1888
+ }
1889
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
1832
1890
  function parseURLObject(trimmed, def) {
1833
1891
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1834
1892
  try {
1893
+ if (typeof URL !== "undefined") {
1894
+ const URLStatic = URL;
1895
+ if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
1896
+ }
1835
1897
  return new URL(trimmed);
1836
1898
  } catch {
1837
1899
  return 2;
@@ -1855,7 +1917,7 @@ window.__ModuleLoader__.load({
1855
1917
  inst._zod.check = (payload) => {
1856
1918
  try {
1857
1919
  const trimmed = payload.value.trim();
1858
- const url = parseURLObject(trimmed, def);
1920
+ const url = validateURL(trimmed, def);
1859
1921
  if (url === 1) {
1860
1922
  payload.issues.push({
1861
1923
  code: "invalid_format",
@@ -1877,6 +1939,10 @@ window.__ModuleLoader__.load({
1877
1939
  });
1878
1940
  return;
1879
1941
  }
1942
+ if (url === true) {
1943
+ payload.value = stripTabAndNewline(trimmed);
1944
+ return;
1945
+ }
1880
1946
  if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1881
1947
  code: "invalid_format",
1882
1948
  format: "url",
@@ -1945,12 +2011,6 @@ window.__ModuleLoader__.load({
1945
2011
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1946
2012
  def.pattern ?? (def.pattern = datetime(def));
1947
2013
  $ZodStringFormat.init(inst, def);
1948
- if (def.local || def.precision === -1) {
1949
- inst._zod.bag.laxFormat = true;
1950
- inst._zod.onattach.push((s) => {
1951
- s._zod.bag.laxFormat = true;
1952
- });
1953
- }
1954
2014
  });
1955
2015
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1956
2016
  def.pattern ?? (def.pattern = date);
@@ -1967,23 +2027,16 @@ window.__ModuleLoader__.load({
1967
2027
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1968
2028
  def.pattern ?? (def.pattern = ipv4);
1969
2029
  $ZodStringFormat.init(inst, def);
1970
- inst._zod.bag.format = `ipv4`;
1971
2030
  });
1972
2031
  /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
1973
2032
  const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1974
2033
  function isValidIPv6(value) {
1975
2034
  if (!ipv6Alphabet.test(value)) return false;
1976
- try {
1977
- new URL(`http://[${value}]`);
1978
- return true;
1979
- } catch {
1980
- return false;
1981
- }
2035
+ return canParseURL(`http://[${value}]`);
1982
2036
  }
1983
2037
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1984
2038
  def.pattern ?? (def.pattern = ipv6);
1985
2039
  $ZodStringFormat.init(inst, def);
1986
- inst._zod.bag.format = `ipv6`;
1987
2040
  inst._zod.check = (payload) => {
1988
2041
  if (!isValidIPv6(payload.value)) payload.issues.push({
1989
2042
  code: "invalid_format",
@@ -2032,10 +2085,10 @@ window.__ModuleLoader__.load({
2032
2085
  return false;
2033
2086
  }
2034
2087
  }
2088
+ const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
2035
2089
  const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
2036
- def.pattern ?? (def.pattern = base64);
2090
+ def.pattern ?? (def.pattern = base64Charset);
2037
2091
  $ZodStringFormat.init(inst, def);
2038
- inst._zod.bag.contentEncoding = "base64";
2039
2092
  inst._zod.check = (payload) => {
2040
2093
  if (isValidBase64(payload.value)) return;
2041
2094
  payload.issues.push({
@@ -2047,15 +2100,15 @@ window.__ModuleLoader__.load({
2047
2100
  });
2048
2101
  };
2049
2102
  });
2103
+ const base64urlCharset = /^[A-Za-z0-9_-]*$/;
2050
2104
  function isValidBase64URL(data) {
2051
- if (!base64url.test(data)) return false;
2105
+ if (!base64urlCharset.test(data)) return false;
2052
2106
  const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2053
2107
  return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
2054
2108
  }
2055
2109
  const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
2056
- def.pattern ?? (def.pattern = base64url);
2110
+ def.pattern ?? (def.pattern = base64urlCharset);
2057
2111
  $ZodStringFormat.init(inst, def);
2058
- inst._zod.bag.contentEncoding = "base64url";
2059
2112
  inst._zod.check = (payload) => {
2060
2113
  if (isValidBase64URL(payload.value)) return;
2061
2114
  payload.issues.push({
@@ -2101,7 +2154,7 @@ window.__ModuleLoader__.load({
2101
2154
  });
2102
2155
  const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
2103
2156
  $ZodType.init(inst, def);
2104
- inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
2157
+ inst._zod.pattern = number$1;
2105
2158
  inst._zod.parse = (payload, _ctx) => {
2106
2159
  if (def.coerce) try {
2107
2160
  payload.value = Number(payload.value);
@@ -2178,6 +2231,7 @@ window.__ModuleLoader__.load({
2178
2231
  }
2179
2232
  payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
2180
2233
  const proms = [];
2234
+ const abortEarly = ctx?.abortEarly;
2181
2235
  for (let i = 0; i < input.length; i++) {
2182
2236
  const item = input[i];
2183
2237
  const result = def.element._zod.run({
@@ -2185,7 +2239,10 @@ window.__ModuleLoader__.load({
2185
2239
  issues: []
2186
2240
  }, ctx);
2187
2241
  if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
2188
- else handleArrayResult(result, payload, i);
2242
+ else {
2243
+ handleArrayResult(result, payload, i);
2244
+ if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
2245
+ }
2189
2246
  }
2190
2247
  if (proms.length) return Promise.all(proms).then(() => payload);
2191
2248
  return payload;
@@ -2209,7 +2266,7 @@ window.__ModuleLoader__.load({
2209
2266
  return;
2210
2267
  }
2211
2268
  if (result.value === void 0) {
2212
- if (isPresent) final.value[key] = void 0;
2269
+ if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
2213
2270
  } else final.value[key] = result.value;
2214
2271
  }
2215
2272
  const NO_SYMBOL_KEYS = [];
@@ -2229,14 +2286,19 @@ window.__ModuleLoader__.load({
2229
2286
  optionalKeys: new Set(okeys)
2230
2287
  };
2231
2288
  }
2232
- function handleCatchall(proms, input, payload, ctx, def, inst) {
2289
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
2233
2290
  const unrecognized = [];
2234
2291
  const keySet = def.keySet;
2235
2292
  const _catchall = def.catchall._zod;
2236
2293
  const t = _catchall.def.type;
2237
2294
  const optin = _catchall.optin;
2238
2295
  const optout = _catchall.optout;
2296
+ let seen = 0;
2239
2297
  for (const key in input) {
2298
+ if (abortEarly && payload.issues.length !== seen) {
2299
+ if (aborted(payload, seen)) break;
2300
+ seen = payload.issues.length;
2301
+ }
2240
2302
  if (keySet.has(key)) continue;
2241
2303
  if (key === "__proto__") {
2242
2304
  if (t === "never") unrecognized.push(key);
@@ -2265,18 +2327,19 @@ window.__ModuleLoader__.load({
2265
2327
  return payload;
2266
2328
  });
2267
2329
  }
2268
- const propShapes = /* @__PURE__ */ new WeakMap();
2269
2330
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2270
2331
  $ZodType.init(inst, def);
2271
- if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
2272
- const sh = def.shape;
2273
- propShapes.set(def, sh);
2274
- Object.defineProperty(def, "shape", { get: () => {
2332
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
2333
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
2334
+ if (sh) {
2335
+ const get = () => {
2275
2336
  const newSh = { ...sh };
2276
2337
  Object.defineProperty(def, "shape", { value: newSh });
2277
- propShapes.set(def, newSh);
2338
+ get.raw = newSh;
2278
2339
  return newSh;
2279
- } });
2340
+ };
2341
+ get.raw = sh;
2342
+ Object.defineProperty(def, "shape", { get });
2280
2343
  }
2281
2344
  const _normalized = cached(() => normalizeDef(def));
2282
2345
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -2292,7 +2355,7 @@ window.__ModuleLoader__.load({
2292
2355
  }
2293
2356
  return propValues;
2294
2357
  });
2295
- const isObject$1 = isObject;
2358
+ const isObject$2 = isObject;
2296
2359
  const catchall = def.catchall;
2297
2360
  let value;
2298
2361
  const memo = globalConfig.memoizer;
@@ -2300,7 +2363,7 @@ window.__ModuleLoader__.load({
2300
2363
  inst._zod.parse = (payload, ctx) => {
2301
2364
  value ?? (value = _normalized.value);
2302
2365
  const input = payload.value;
2303
- if (!isObject$1(input)) {
2366
+ if (!isObject$2(input)) {
2304
2367
  payload.issues.push({
2305
2368
  expected: "object",
2306
2369
  code: "invalid_type",
@@ -2312,7 +2375,13 @@ window.__ModuleLoader__.load({
2312
2375
  payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2313
2376
  const proms = [];
2314
2377
  const shape = value.shape;
2378
+ const abortEarly = ctx?.abortEarly;
2379
+ let seen = payload.issues.length;
2315
2380
  for (const key of value.allKeys) {
2381
+ if (abortEarly && payload.issues.length !== seen) {
2382
+ if (aborted(payload, seen)) break;
2383
+ seen = payload.issues.length;
2384
+ }
2316
2385
  if (key === "__proto__") continue;
2317
2386
  const el = shape[key];
2318
2387
  const optin = el._zod.optin;
@@ -2325,7 +2394,7 @@ window.__ModuleLoader__.load({
2325
2394
  else handlePropertyResult(r, payload, key, input, optin, optout);
2326
2395
  }
2327
2396
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
2328
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2397
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
2329
2398
  };
2330
2399
  });
2331
2400
  const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -2344,10 +2413,16 @@ window.__ModuleLoader__.load({
2344
2413
  });
2345
2414
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2346
2415
  const prefixStr = (id, k) => `
2416
+ let ${id}_ab = false;
2347
2417
  for (let i = 0; i < ${id}.issues.length; i++) {
2348
2418
  const iss = ${id}.issues[i];
2349
2419
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2350
2420
  payload.issues.push(iss);
2421
+ if (iss.continue !== true) ${id}_ab = true;
2422
+ }
2423
+ if (${id}_ab && ctx && ctx.abortEarly) {
2424
+ payload.value = newResult;
2425
+ return payload;
2351
2426
  }`;
2352
2427
  doc.write(`const input = payload.value;`);
2353
2428
  const ids = Object.create(null);
@@ -2389,6 +2464,10 @@ window.__ModuleLoader__.load({
2389
2464
  input: undefined,
2390
2465
  path: [${k}]
2391
2466
  });
2467
+ if (ctx && ctx.abortEarly) {
2468
+ payload.value = newResult;
2469
+ return payload;
2470
+ }
2392
2471
  }
2393
2472
 
2394
2473
  if (${id}_present) {
@@ -2396,26 +2475,25 @@ window.__ModuleLoader__.load({
2396
2475
  }
2397
2476
 
2398
2477
  `);
2399
- else doc.write(`
2478
+ else {
2479
+ doc.write(`
2400
2480
  if (${id}.issues.length) {${prefixStr(id, k)}
2401
2481
  }
2402
-
2403
- if (${id}.value === undefined) {
2404
- if (${isPresent}) {
2405
- newResult[${k}] = undefined;
2406
- }
2407
- } else {
2482
+ `);
2483
+ if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
2484
+ else doc.write(`
2485
+ if (${id}.value !== undefined || ${isPresent}) {
2408
2486
  newResult[${k}] = ${id}.value;
2409
2487
  }
2410
-
2411
2488
  `);
2489
+ }
2412
2490
  }
2413
2491
  doc.write(`payload.value = newResult;`);
2414
2492
  doc.write(`return payload;`);
2415
2493
  return doc.compile();
2416
2494
  };
2417
2495
  let fastpass;
2418
- const isObject$2 = isObject;
2496
+ const isObject$1 = isObject;
2419
2497
  const jit = !globalConfig.jitless;
2420
2498
  const fastEnabled = jit && allowsEval.value;
2421
2499
  const catchall = def.catchall;
@@ -2423,7 +2501,7 @@ window.__ModuleLoader__.load({
2423
2501
  inst._zod.parse = (payload, ctx) => {
2424
2502
  value ?? (value = _normalized.value);
2425
2503
  const input = payload.value;
2426
- if (!isObject$2(input)) {
2504
+ if (!isObject$1(input)) {
2427
2505
  payload.issues.push({
2428
2506
  expected: "object",
2429
2507
  code: "invalid_type",
@@ -2436,7 +2514,7 @@ window.__ModuleLoader__.load({
2436
2514
  if (!fastpass) fastpass = generateFastpass(def.shape);
2437
2515
  payload = fastpass(payload, ctx);
2438
2516
  if (!catchall) return payload;
2439
- return handleCatchall([], input, payload, ctx, value, inst);
2517
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
2440
2518
  }
2441
2519
  return superParse(payload, ctx);
2442
2520
  };
@@ -2496,39 +2574,42 @@ window.__ModuleLoader__.load({
2496
2574
  });
2497
2575
  };
2498
2576
  });
2577
+ function discriminatorMap(def) {
2578
+ const map = /* @__PURE__ */ new Map();
2579
+ for (const option of def.options) {
2580
+ const values = option._zod.propValues?.[def.discriminator];
2581
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2582
+ for (const value of values) if (map.has(value)) {
2583
+ if (value !== void 0) throw new Error(`Duplicate discriminator value "${String(value)}"`);
2584
+ map.set(value, null);
2585
+ } else map.set(value, option);
2586
+ }
2587
+ return map;
2588
+ }
2499
2589
  const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
2500
2590
  def.inclusive = false;
2501
2591
  $ZodUnion.init(inst, def);
2502
2592
  const _super = inst._zod.parse;
2503
2593
  defineLazyInternal(inst, "propValues", (zod) => {
2504
2594
  const propValues = {};
2595
+ let undefinedCount = 0;
2505
2596
  for (const option of zod.def.options) {
2506
2597
  const pv = option._zod.propValues;
2507
2598
  if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2599
+ if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
2508
2600
  for (const [k, v] of Object.entries(pv)) {
2509
2601
  if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
2510
2602
  for (const val of v) propValues[k].add(val);
2511
2603
  }
2512
2604
  }
2605
+ if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(void 0);
2513
2606
  return propValues;
2514
2607
  });
2515
2608
  def.options.forEach((option, i) => {
2516
- const propShape = propShapes.get(option._zod.def);
2609
+ const propShape = rawShape(option._zod.def);
2517
2610
  if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
2518
2611
  });
2519
- const disc = cached(() => {
2520
- const opts = def.options;
2521
- const map = /* @__PURE__ */ new Map();
2522
- for (const o of opts) {
2523
- const values = o._zod.propValues?.[def.discriminator];
2524
- if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2525
- for (const v of values) {
2526
- if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
2527
- map.set(v, o);
2528
- }
2529
- }
2530
- return map;
2531
- });
2612
+ const disc = cached(() => discriminatorMap(def));
2532
2613
  inst._zod.parse = (payload, ctx) => {
2533
2614
  const input = payload.value;
2534
2615
  if (!isObject(input)) {
@@ -2540,15 +2621,16 @@ window.__ModuleLoader__.load({
2540
2621
  });
2541
2622
  return payload;
2542
2623
  }
2543
- const opt = disc.value.get(input?.[def.discriminator]);
2544
- if (opt) return opt._zod.run(payload, ctx);
2624
+ const value = input?.[def.discriminator];
2625
+ const opt = disc.value.get(value);
2626
+ if (opt && (value !== void 0 || ctx.direction !== "backward")) return opt._zod.run(payload, ctx);
2545
2627
  if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
2546
2628
  payload.issues.push({
2547
2629
  code: "invalid_union",
2548
2630
  errors: [],
2549
2631
  note: "No matching discriminator",
2550
2632
  discriminator: def.discriminator,
2551
- options: Array.from(disc.value.keys()),
2633
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
2552
2634
  input,
2553
2635
  path: [def.discriminator],
2554
2636
  inst
@@ -2675,8 +2757,10 @@ window.__ModuleLoader__.load({
2675
2757
  const values = getEnumValues(def.entries);
2676
2758
  const valuesSet = new Set(values);
2677
2759
  inst._zod.values = valuesSet;
2678
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
2679
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2760
+ defineLazyInternal(inst, "pattern", (zod) => {
2761
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
2762
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2763
+ });
2680
2764
  inst._zod.parse = (payload, _ctx) => {
2681
2765
  const input = payload.value;
2682
2766
  if (valuesSet.has(input)) return payload;
@@ -2693,7 +2777,10 @@ window.__ModuleLoader__.load({
2693
2777
  $ZodType.init(inst, def);
2694
2778
  const values = new Set(def.values);
2695
2779
  inst._zod.values = values;
2696
- inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
2780
+ defineLazyInternal(inst, "pattern", (zod) => {
2781
+ const vals = zod.def.values;
2782
+ return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
2783
+ });
2697
2784
  inst._zod.parse = (payload, _ctx) => {
2698
2785
  const input = payload.value;
2699
2786
  if (values.has(input)) return payload;
@@ -2928,7 +3015,7 @@ window.__ModuleLoader__.load({
2928
3015
  }
2929
3016
  }
2930
3017
  //#endregion
2931
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
3018
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
2932
3019
  var $ZodCyclicError = class extends Error {
2933
3020
  constructor() {
2934
3021
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -2938,6 +3025,9 @@ window.__ModuleLoader__.load({
2938
3025
  /** Keyed off the context object every schema in one parse call already shares. */
2939
3026
  const STATE = "~memo";
2940
3027
  const NO_ISSUES = [];
3028
+ function isRef(value) {
3029
+ return value !== null && typeof value === "object";
3030
+ }
2941
3031
  function cloneIssues(issues) {
2942
3032
  return issues.map((iss) => iss.path ? {
2943
3033
  ...iss,
@@ -2945,22 +3035,44 @@ window.__ModuleLoader__.load({
2945
3035
  } : { ...iss });
2946
3036
  }
2947
3037
  const recursive = /*@__PURE__*/ new WeakMap();
3038
+ /** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
3039
+ const NONE = 0;
3040
+ const ASSUMED = 1;
3041
+ const PROVEN = 2;
2948
3042
  /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
2949
- function isRecursive(inst, stack) {
3043
+ function isRecursive(inst, stack, resolve) {
2950
3044
  const cached = recursive.get(inst);
2951
- if (cached !== void 0) return cached;
2952
- if (stack.has(inst)) return true;
3045
+ if (cached !== void 0) return cached ? PROVEN : NONE;
3046
+ if (stack.has(inst)) return PROVEN;
2953
3047
  stack.add(inst);
2954
- let result = false;
3048
+ let result = NONE;
2955
3049
  const check = (child) => {
2956
- if (!result && child?._zod && isRecursive(child, stack)) result = true;
3050
+ if (result !== PROVEN && child?._zod) {
3051
+ const answer = isRecursive(child, stack, resolve);
3052
+ if (answer > result) result = answer;
3053
+ }
3054
+ };
3055
+ const shape = (sh, spread) => {
3056
+ let answer = NONE;
3057
+ for (const key of Reflect.ownKeys(sh)) {
3058
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
3059
+ if (spread && !desc.enumerable) continue;
3060
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
3061
+ if (child > answer) answer = child;
3062
+ }
3063
+ return answer;
3064
+ };
3065
+ const merge = (answer) => {
3066
+ if (answer > result) result = answer;
2957
3067
  };
2958
3068
  const def = inst._zod.def;
2959
3069
  switch (def.type) {
2960
- case "object":
2961
- for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]);
3070
+ case "object": {
3071
+ const raw = rawShape(def);
3072
+ merge(raw ? shape(raw, true) : ASSUMED);
2962
3073
  check(def.catchall);
2963
3074
  break;
3075
+ }
2964
3076
  case "array":
2965
3077
  check(def.element);
2966
3078
  break;
@@ -3002,9 +3114,11 @@ window.__ModuleLoader__.load({
3002
3114
  check(def.input);
3003
3115
  check(def.output);
3004
3116
  break;
3005
- case "lazy":
3006
- check(inst._zod.innerType);
3117
+ case "lazy": {
3118
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
3119
+ merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
3007
3120
  break;
3121
+ }
3008
3122
  case "template_literal":
3009
3123
  case "string":
3010
3124
  case "number":
@@ -3035,13 +3149,17 @@ window.__ModuleLoader__.load({
3035
3149
  }
3036
3150
  }
3037
3151
  stack.delete(inst);
3038
- recursive.set(inst, result);
3039
- return result;
3152
+ return settle(inst, result);
3153
+ }
3154
+ /** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
3155
+ function settle(inst, answer) {
3156
+ if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
3157
+ return answer;
3040
3158
  }
3041
3159
  function bucketFor(state, inst) {
3042
3160
  let bucket = state.buckets.get(inst);
3043
3161
  if (!bucket) {
3044
- bucket = /* @__PURE__ */ new Map();
3162
+ bucket = /* @__PURE__ */ new WeakMap();
3045
3163
  state.buckets.set(inst, bucket);
3046
3164
  }
3047
3165
  return bucket;
@@ -3077,6 +3195,7 @@ window.__ModuleLoader__.load({
3077
3195
  attach(inst) {
3078
3196
  var _a;
3079
3197
  let isRecursiveInst;
3198
+ let rechecked = false;
3080
3199
  let lastCtx;
3081
3200
  let lastBucket;
3082
3201
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -3084,19 +3203,21 @@ window.__ModuleLoader__.load({
3084
3203
  const base = inst._zod.parse;
3085
3204
  const wrapped = (payload, ctx) => {
3086
3205
  if (isRecursiveInst === void 0) {
3087
- isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
3088
- if (!isRecursiveInst) {
3206
+ const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
3207
+ if (walked === NONE) {
3089
3208
  inst._zod.parse = base;
3090
3209
  if (inst._zod.run === wrapped) inst._zod.run = base;
3091
3210
  return base(payload, ctx);
3092
3211
  }
3212
+ if (walked === PROVEN || rechecked) isRecursiveInst = true;
3213
+ else rechecked = true;
3093
3214
  }
3094
3215
  const input = payload.value;
3095
- if (input === null || typeof input !== "object") return base(payload, ctx);
3216
+ if (!isRef(input)) return base(payload, ctx);
3096
3217
  let state = ctx[STATE];
3097
3218
  if (!state) {
3098
3219
  state = {
3099
- buckets: /* @__PURE__ */ new Map(),
3220
+ buckets: /* @__PURE__ */ new WeakMap(),
3100
3221
  backEdges: void 0
3101
3222
  };
3102
3223
  ctx[STATE] = state;
@@ -3115,7 +3236,7 @@ window.__ModuleLoader__.load({
3115
3236
  if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
3116
3237
  } else {
3117
3238
  payload.memo = true;
3118
- state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
3239
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
3119
3240
  state.backEdges.add(hit.value);
3120
3241
  }
3121
3242
  return payload;
@@ -3144,10 +3265,10 @@ window.__ModuleLoader__.load({
3144
3265
  /** Whether this value is a node a back-edge resolved to before it finished. */
3145
3266
  function isBackEdge(ctx, value) {
3146
3267
  const backEdges = ctx[STATE]?.backEdges;
3147
- return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
3268
+ return backEdges !== void 0 && isRef(value) && backEdges.has(value);
3148
3269
  }
3149
3270
  //#endregion
3150
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js
3271
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
3151
3272
  const error = () => {
3152
3273
  const Sizable = {
3153
3274
  string: {
@@ -3202,7 +3323,9 @@ window.__ModuleLoader__.load({
3202
3323
  base64url: "base64url-encoded string",
3203
3324
  json_string: "JSON string",
3204
3325
  e164: "E.164 number",
3326
+ currency_code: "currency code",
3205
3327
  credit_card: "credit card number",
3328
+ iban: "IBAN",
3206
3329
  jwt: "JWT",
3207
3330
  template_literal: "input"
3208
3331
  };
@@ -3253,7 +3376,7 @@ window.__ModuleLoader__.load({
3253
3376
  return { localeError: error() };
3254
3377
  }
3255
3378
  //#endregion
3256
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js
3379
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
3257
3380
  var _a;
3258
3381
  var $ZodRegistry = class {
3259
3382
  constructor() {
@@ -3300,13 +3423,17 @@ window.__ModuleLoader__.load({
3300
3423
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3301
3424
  const globalRegistry = globalThis.__zod_globalRegistry;
3302
3425
  //#endregion
3303
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js
3426
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
3427
+ function snapshotChecks(def) {
3428
+ if (def.checks) def.checks = [...def.checks];
3429
+ return def;
3430
+ }
3304
3431
  // @__NO_SIDE_EFFECTS__
3305
3432
  function _string(Class, params) {
3306
- return new Class({
3433
+ return new Class(snapshotChecks({
3307
3434
  type: "string",
3308
3435
  ...normalizeParams(params)
3309
- });
3436
+ }));
3310
3437
  }
3311
3438
  // @__NO_SIDE_EFFECTS__
3312
3439
  function _email(Class, params) {
@@ -3578,11 +3705,11 @@ window.__ModuleLoader__.load({
3578
3705
  }
3579
3706
  // @__NO_SIDE_EFFECTS__
3580
3707
  function _number(Class, params) {
3581
- return new Class({
3708
+ return new Class(snapshotChecks({
3582
3709
  type: "number",
3583
3710
  checks: [],
3584
3711
  ...normalizeParams(params)
3585
- });
3712
+ }));
3586
3713
  }
3587
3714
  // @__NO_SIDE_EFFECTS__
3588
3715
  function _int(Class, params) {
@@ -3805,7 +3932,7 @@ window.__ModuleLoader__.load({
3805
3932
  return ch;
3806
3933
  }
3807
3934
  //#endregion
3808
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
3935
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
3809
3936
  function assignProps(target, ...sources) {
3810
3937
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3811
3938
  return target;
@@ -3848,7 +3975,7 @@ window.__ModuleLoader__.load({
3848
3975
  Object.assign(json, result);
3849
3976
  return true;
3850
3977
  }
3851
- function process(schema, ctx, _params = {
3978
+ function processSchema(schema, ctx, _params = {
3852
3979
  path: [],
3853
3980
  schemaPath: []
3854
3981
  }) {
@@ -3887,7 +4014,7 @@ window.__ModuleLoader__.load({
3887
4014
  const parent = schema._zod.parent;
3888
4015
  if (parent) {
3889
4016
  if (!result.ref) result.ref = parent;
3890
- process(parent, ctx, params);
4017
+ processSchema(parent, ctx, params);
3891
4018
  ctx.seen.get(parent).isParent = true;
3892
4019
  }
3893
4020
  }
@@ -3977,10 +4104,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3977
4104
  continue;
3978
4105
  }
3979
4106
  if (seen.count > 1) {
3980
- if (ctx.reused === "ref") {
3981
- extractToDef(entry);
3982
- continue;
3983
- }
4107
+ if (ctx.reused === "ref") extractToDef(entry);
3984
4108
  }
3985
4109
  }
3986
4110
  if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
@@ -4235,7 +4359,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4235
4359
  ...params,
4236
4360
  processors
4237
4361
  });
4238
- process(schema, ctx);
4362
+ processSchema(schema, ctx);
4239
4363
  extractDefs(ctx, schema);
4240
4364
  return finalize(ctx, schema);
4241
4365
  };
@@ -4247,12 +4371,84 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4247
4371
  io,
4248
4372
  processors
4249
4373
  });
4250
- process(schema, ctx);
4374
+ processSchema(schema, ctx);
4251
4375
  extractDefs(ctx, schema);
4252
4376
  return finalize(ctx, schema);
4253
4377
  };
4254
4378
  //#endregion
4255
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
4379
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
4380
+ const narrowMin = (agg, key, value) => {
4381
+ if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
4382
+ };
4383
+ const narrowMax = (agg, key, value) => {
4384
+ if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
4385
+ };
4386
+ const narrowBoth = (agg, value) => {
4387
+ narrowMin(agg, "minimum", value);
4388
+ narrowMax(agg, "maximum", value);
4389
+ };
4390
+ const addDivisor = (agg, value) => {
4391
+ agg.multipleOf ?? (agg.multipleOf = []);
4392
+ if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
4393
+ };
4394
+ const addPattern = (agg, pattern) => {
4395
+ agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
4396
+ agg.patterns.add(pattern);
4397
+ };
4398
+ const intersectMime = (agg, mime) => {
4399
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
4400
+ };
4401
+ const setFormat = (agg, format) => {
4402
+ agg.format = format;
4403
+ if (format.includes("int")) agg.isInt = true;
4404
+ };
4405
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
4406
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
4407
+ const formatContributor = (ranges) => (agg, def) => {
4408
+ setFormat(agg, def.format);
4409
+ const [minimum, maximum] = ranges[def.format];
4410
+ narrowMin(agg, "minimum", minimum);
4411
+ narrowMax(agg, "maximum", maximum);
4412
+ };
4413
+ const contributors = {
4414
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
4415
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
4416
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
4417
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
4418
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
4419
+ min_length: minContributor,
4420
+ max_length: maxContributor,
4421
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
4422
+ min_size: minContributor,
4423
+ max_size: maxContributor,
4424
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
4425
+ string_format: (agg, def) => {
4426
+ setFormat(agg, def.format);
4427
+ if (def.pattern) addPattern(agg, def.pattern);
4428
+ if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
4429
+ if (def.local || def.precision === -1) agg.laxFormat = true;
4430
+ },
4431
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
4432
+ };
4433
+ function aggregateChecks(schema) {
4434
+ const agg = {};
4435
+ const def = schema._zod.def;
4436
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
4437
+ for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
4438
+ const bag = schema._zod.bag;
4439
+ if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
4440
+ if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
4441
+ if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
4442
+ if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
4443
+ if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
4444
+ if (bag.format !== void 0) {
4445
+ agg.format ?? (agg.format = bag.format);
4446
+ if (bag.format.includes("int")) agg.isInt = true;
4447
+ }
4448
+ if (bag.mime) intersectMime(agg, bag.mime);
4449
+ for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
4450
+ return agg;
4451
+ }
4256
4452
  const formatMap = {
4257
4453
  guid: "uuid",
4258
4454
  url: "uri",
@@ -4260,10 +4456,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4260
4456
  json_string: "json-string",
4261
4457
  regex: ""
4262
4458
  };
4459
+ const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
4460
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
4263
4461
  const stringProcessor = (schema, ctx, _json, _params) => {
4264
4462
  const json = _json;
4265
4463
  json.type = "string";
4266
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
4464
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
4267
4465
  if (typeof minimum === "number") json.minLength = minimum;
4268
4466
  if (typeof maximum === "number") json.maxLength = maximum;
4269
4467
  if (format) {
@@ -4273,7 +4471,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4273
4471
  }
4274
4472
  if (contentEncoding) json.contentEncoding = contentEncoding;
4275
4473
  if (patterns && patterns.size > 0) {
4276
- const patternList = [...patterns];
4474
+ const patternList = [...patterns].map(exactPattern);
4277
4475
  if (patternList.length === 1) json.pattern = patternList[0].source;
4278
4476
  else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
4279
4477
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
@@ -4283,9 +4481,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4283
4481
  };
4284
4482
  const numberProcessor = (schema, ctx, _json, params) => {
4285
4483
  const json = _json;
4286
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
4287
- if (typeof format === "string" && format.includes("int")) json.type = "integer";
4288
- else json.type = "number";
4484
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
4485
+ json.type = isInt ? "integer" : "number";
4289
4486
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
4290
4487
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
4291
4488
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
@@ -4301,9 +4498,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4301
4498
  json.exclusiveMaximum = true;
4302
4499
  } else json.exclusiveMaximum = exclusiveMaximum;
4303
4500
  } else if (typeof maximum === "number") json.maximum = maximum;
4304
- if (typeof multipleOf === "number") {
4305
- if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
4306
- else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
4501
+ if (multipleOf) {
4502
+ const divisors = /* @__PURE__ */ new Set();
4503
+ for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
4504
+ else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
4505
+ const [first, ...rest] = divisors;
4506
+ if (first !== void 0) json.multipleOf = first;
4507
+ if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
4307
4508
  }
4308
4509
  };
4309
4510
  const booleanProcessor = (_schema, _ctx, json, _params) => {
@@ -4358,11 +4559,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4358
4559
  const arrayProcessor = (schema, ctx, _json, params) => {
4359
4560
  const json = _json;
4360
4561
  const def = schema._zod.def;
4361
- const { minimum, maximum } = schema._zod.bag;
4562
+ const { minimum, maximum } = aggregateChecks(schema);
4362
4563
  if (typeof minimum === "number") json.minItems = minimum;
4363
4564
  if (typeof maximum === "number") json.maxItems = maximum;
4364
4565
  json.type = "array";
4365
- json.items = process(def.element, ctx, {
4566
+ json.items = processSchema(def.element, ctx, {
4366
4567
  ...params,
4367
4568
  path: [...params.path, "items"]
4368
4569
  });
@@ -4380,7 +4581,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4380
4581
  if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
4381
4582
  json.type = "object";
4382
4583
  json.properties = {};
4383
- for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
4584
+ for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
4384
4585
  ...params,
4385
4586
  path: [
4386
4587
  ...params.path,
@@ -4388,17 +4589,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4388
4589
  key
4389
4590
  ]
4390
4591
  }));
4391
- const allKeys = new Set(Object.keys(shape));
4392
- const requiredKeys = new Set([...allKeys].filter((key) => {
4592
+ const requiredKeys = [];
4593
+ for (const key of Object.keys(shape)) {
4393
4594
  const field = def.shape[key];
4394
- if (ctx.io === "input") return inputOptin(field) === void 0;
4395
- else return field._zod.optout === void 0;
4396
- }));
4397
- if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
4595
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
4596
+ }
4597
+ if (requiredKeys.length > 0) json.required = requiredKeys;
4398
4598
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
4399
4599
  else if (!def.catchall) {
4400
4600
  if (ctx.io === "output") json.additionalProperties = false;
4401
- } else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
4601
+ } else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
4402
4602
  ...params,
4403
4603
  path: [...params.path, "additionalProperties"]
4404
4604
  });
@@ -4406,7 +4606,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4406
4606
  const unionProcessor = (schema, ctx, json, params) => {
4407
4607
  const def = schema._zod.def;
4408
4608
  const isExclusive = def.inclusive === false;
4409
- const options = def.options.map((x, i) => process(x, ctx, {
4609
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
4410
4610
  ...params,
4411
4611
  path: [
4412
4612
  ...params.path,
@@ -4419,7 +4619,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4419
4619
  };
4420
4620
  const intersectionProcessor = (schema, ctx, json, params) => {
4421
4621
  const def = schema._zod.def;
4422
- const a = process(def.left, ctx, {
4622
+ const a = processSchema(def.left, ctx, {
4423
4623
  ...params,
4424
4624
  path: [
4425
4625
  ...params.path,
@@ -4427,7 +4627,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4427
4627
  0
4428
4628
  ]
4429
4629
  });
4430
- const b = process(def.right, ctx, {
4630
+ const b = processSchema(def.right, ctx, {
4431
4631
  ...params,
4432
4632
  path: [
4433
4633
  ...params.path,
@@ -4442,7 +4642,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4442
4642
  };
4443
4643
  const nullableProcessor = (schema, ctx, json, params) => {
4444
4644
  const def = schema._zod.def;
4445
- const inner = process(def.innerType, ctx, params);
4645
+ const inner = processSchema(def.innerType, ctx, params);
4446
4646
  const seen = ctx.seen.get(schema);
4447
4647
  if (ctx.target === "openapi-3.0") {
4448
4648
  seen.ref = def.innerType;
@@ -4451,7 +4651,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4451
4651
  };
4452
4652
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
4453
4653
  const def = schema._zod.def;
4454
- process(def.innerType, ctx, params);
4654
+ processSchema(def.innerType, ctx, params);
4455
4655
  const seen = ctx.seen.get(schema);
4456
4656
  seen.ref = def.innerType;
4457
4657
  };
@@ -4472,7 +4672,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4472
4672
  }
4473
4673
  const defaultProcessor = (schema, ctx, json, params) => {
4474
4674
  const def = schema._zod.def;
4475
- process(def.innerType, ctx, params);
4675
+ processSchema(def.innerType, ctx, params);
4476
4676
  const seen = ctx.seen.get(schema);
4477
4677
  seen.ref = def.innerType;
4478
4678
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -4480,7 +4680,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4480
4680
  };
4481
4681
  const prefaultProcessor = (schema, ctx, json, params) => {
4482
4682
  const def = schema._zod.def;
4483
- process(def.innerType, ctx, params);
4683
+ processSchema(def.innerType, ctx, params);
4484
4684
  const seen = ctx.seen.get(schema);
4485
4685
  seen.ref = def.innerType;
4486
4686
  if (ctx.io !== "input") return;
@@ -4489,7 +4689,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4489
4689
  };
4490
4690
  const catchProcessor = (schema, ctx, json, params) => {
4491
4691
  const def = schema._zod.def;
4492
- process(def.innerType, ctx, params);
4692
+ processSchema(def.innerType, ctx, params);
4493
4693
  const seen = ctx.seen.get(schema);
4494
4694
  seen.ref = def.innerType;
4495
4695
  let catchValue;
@@ -4505,25 +4705,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4505
4705
  const def = schema._zod.def;
4506
4706
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
4507
4707
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
4508
- process(innerType, ctx, params);
4708
+ processSchema(innerType, ctx, params);
4509
4709
  const seen = ctx.seen.get(schema);
4510
4710
  seen.ref = innerType;
4511
4711
  };
4512
4712
  const readonlyProcessor = (schema, ctx, json, params) => {
4513
4713
  const def = schema._zod.def;
4514
- process(def.innerType, ctx, params);
4714
+ processSchema(def.innerType, ctx, params);
4515
4715
  const seen = ctx.seen.get(schema);
4516
4716
  seen.ref = def.innerType;
4517
4717
  json.readOnly = true;
4518
4718
  };
4519
4719
  const optionalProcessor = (schema, ctx, _json, params) => {
4520
4720
  const def = schema._zod.def;
4521
- process(def.innerType, ctx, params);
4721
+ processSchema(def.innerType, ctx, params);
4522
4722
  const seen = ctx.seen.get(schema);
4523
4723
  seen.ref = def.innerType;
4524
4724
  };
4525
4725
  //#endregion
4526
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js
4726
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
4527
4727
  const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4528
4728
  function _lazyMethod(proto, key, make) {
4529
4729
  Object.defineProperty(proto, key, {
@@ -4573,7 +4773,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4573
4773
  };
4574
4774
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
4575
4775
  //#endregion
4576
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js
4776
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
4577
4777
  const parse = /* @__PURE__ */ _parse(ZodRealError);
4578
4778
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4579
4779
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -4587,7 +4787,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4587
4787
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
4588
4788
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
4589
4789
  //#endregion
4590
- //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
4790
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
4591
4791
  function _ensureDefaultLocale() {
4592
4792
  if (!globalConfig.localeError) config(en_default());
4593
4793
  }
@@ -4723,6 +4923,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4723
4923
  set spa(value) {
4724
4924
  own(this, "spa", value);
4725
4925
  },
4926
+ validate(data, params) {
4927
+ return validate(this, data, params);
4928
+ },
4929
+ validateAsync(data, params) {
4930
+ return validateAsync$1(this, data, params);
4931
+ },
4726
4932
  encode: function _encode(data, params) {
4727
4933
  return encode(this, data, params, { callee: _encode });
4728
4934
  },
@@ -4762,10 +4968,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4762
4968
  $ZodString.init(inst, def);
4763
4969
  ZodType.init(inst, def);
4764
4970
  inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
4765
- const bag = inst._zod.bag;
4766
- inst.format = bag.format ?? null;
4767
- inst.minLength = bag.minimum ?? null;
4768
- inst.maxLength = bag.maximum ?? null;
4971
+ }, /*@__PURE__*/ derived({
4972
+ format: (inst) => aggregateChecks(inst).format ?? null,
4973
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
4974
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
4769
4975
  }, {
4770
4976
  regex(...args) {
4771
4977
  return this.check(/* @__PURE__ */ _regex(...args));
@@ -4812,7 +5018,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4812
5018
  slugify() {
4813
5019
  return this.check(/* @__PURE__ */ _slugify());
4814
5020
  }
4815
- });
5021
+ }));
4816
5022
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
4817
5023
  $ZodString.init(inst, def);
4818
5024
  _ZodString.init(inst, def);
@@ -5004,12 +5210,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5004
5210
  $ZodNumber.init(inst, def);
5005
5211
  ZodType.init(inst, def);
5006
5212
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
5007
- const bag = inst._zod.bag;
5008
- inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
5009
- inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
5010
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
5011
5213
  inst.isFinite = true;
5012
- inst.format = bag.format ?? null;
5214
+ }, /*@__PURE__*/ derived({
5215
+ minValue: (inst) => {
5216
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
5217
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
5218
+ },
5219
+ maxValue: (inst) => {
5220
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
5221
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
5222
+ },
5223
+ isInt: (inst) => {
5224
+ const { isInt, multipleOf } = aggregateChecks(inst);
5225
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
5226
+ },
5227
+ format: (inst) => aggregateChecks(inst).format ?? null
5013
5228
  }, {
5014
5229
  gt(value, params) {
5015
5230
  return this.check(/* @__PURE__ */ _gt(value, params));
@@ -5056,7 +5271,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5056
5271
  finite() {
5057
5272
  return this;
5058
5273
  }
5059
- });
5274
+ }));
5060
5275
  function number(params) {
5061
5276
  return /* @__PURE__ */ _number(ZodNumber, params);
5062
5277
  }
@@ -5128,34 +5343,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5128
5343
  return _enum(Object.keys(this._zod.def.shape));
5129
5344
  },
5130
5345
  catchall(catchall) {
5131
- return this.clone({
5132
- ...this._zod.def,
5133
- catchall
5134
- });
5346
+ return this.clone(mergeDefs(this._zod.def, { catchall }));
5135
5347
  },
5136
5348
  passthrough() {
5137
- return this.clone({
5138
- ...this._zod.def,
5139
- catchall: unknown()
5140
- });
5349
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
5141
5350
  },
5142
5351
  loose() {
5143
- return this.clone({
5144
- ...this._zod.def,
5145
- catchall: unknown()
5146
- });
5352
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
5147
5353
  },
5148
5354
  strict() {
5149
- return this.clone({
5150
- ...this._zod.def,
5151
- catchall: never()
5152
- });
5355
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
5153
5356
  },
5154
5357
  strip() {
5155
- return this.clone({
5156
- ...this._zod.def,
5157
- catchall: void 0
5158
- });
5358
+ return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
5159
5359
  },
5160
5360
  extend(incoming) {
5161
5361
  return extend(this, incoming);
@@ -5232,7 +5432,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5232
5432
  ZodType.init(inst, def);
5233
5433
  inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
5234
5434
  inst.enum = def.entries;
5235
- inst.options = Object.values(def.entries);
5435
+ inst.options = [...inst._zod.values];
5236
5436
  const keys = new Set(Object.keys(def.entries));
5237
5437
  inst.extract = (values, params) => {
5238
5438
  const newEntries = {};
@@ -5491,7 +5691,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5491
5691
  expectedRevision: revision$1
5492
5692
  }).strict();
5493
5693
  const DualModelCreateResultSchema = object({ sessionId: id }).strict();
5494
- const contribution$8 = {
5694
+ const contribution$9 = {
5495
5695
  package: "dsh-github-copilot",
5496
5696
  descriptors: [
5497
5697
  {
@@ -5539,7 +5739,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5539
5739
  supported: boolean(),
5540
5740
  providers: array(object({ id: string().min(1).max(512) }).strict()).max(512)
5541
5741
  }).strict();
5542
- const contribution$7 = {
5742
+ const contribution$8 = {
5543
5743
  package: "dsh-github-copilot",
5544
5744
  descriptors: [{
5545
5745
  id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
@@ -5667,7 +5867,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5667
5867
  if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
5668
5868
  }
5669
5869
  });
5670
- const contribution$6 = {
5870
+ const contribution$7 = {
5671
5871
  package: "dsh-github-copilot",
5672
5872
  descriptors: ["get", "refresh"].map((method) => ({
5673
5873
  id: `dsh-github-copilot:githubCopilotUsage.${method}`,
@@ -5865,7 +6065,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5865
6065
  }).strict();
5866
6066
  //#endregion
5867
6067
  //#region lib/types/turn-selection-remote.js
5868
- const contribution$5 = {
6068
+ const contribution$6 = {
5869
6069
  package: "dsh-github-copilot",
5870
6070
  descriptors: [
5871
6071
  {
@@ -5945,7 +6145,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5945
6145
  lookup: "agent",
5946
6146
  codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5947
6147
  };
5948
- const contribution$4 = {
6148
+ const contribution$5 = {
5949
6149
  package: "dsh-github-copilot",
5950
6150
  descriptors: [
5951
6151
  {
@@ -6053,7 +6253,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6053
6253
  if (row.identity !== void 0 && !row.configured) invalid();
6054
6254
  }
6055
6255
  });
6056
- const contribution$3 = {
6256
+ const contribution$4 = {
6057
6257
  package: "dsh-github-copilot",
6058
6258
  descriptors: [
6059
6259
  "get",
@@ -6106,7 +6306,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6106
6306
  lookup: "agent",
6107
6307
  codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
6108
6308
  };
6109
- const contribution$2 = {
6309
+ const contribution$3 = {
6110
6310
  package: "dsh-github-copilot",
6111
6311
  descriptors: [
6112
6312
  "get",
@@ -6141,6 +6341,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6141
6341
  result: method === "usage" || method === "refreshUsage" ? strictRemoteCodec("dsh-github-copilot#CopilotUsageView", CopilotUsageViewSchema) : method === "turn" ? strictRemoteCodec("dsh-github-copilot#TurnAccountView", TurnAccountViewSchema) : strictRemoteCodec("dsh-github-copilot#SessionAccountView", SessionAccountViewSchema)
6142
6342
  }))
6143
6343
  };
6344
+ //#endregion
6345
+ //#region lib/types/session-continuation-types.js
6346
+ const COMPACTION_CONTINUATION = "githubCopilotCompactionLifecycle";
6347
+ const CompactionContinuationStatusSchema = object({
6348
+ id: string().min(1).max(256),
6349
+ state: _enum([
6350
+ "running",
6351
+ "completed",
6352
+ "failed",
6353
+ "cancelled",
6354
+ "blocked"
6355
+ ])
6356
+ }).strict();
6357
+ const CompactionContinuationLifecycleSchema = object({
6358
+ id: string().nullable(),
6359
+ running: boolean()
6360
+ }).strict();
6144
6361
  array(object({
6145
6362
  sessionId: string().min(1).max(256).refine((value) => !/[\p{Cc}\p{Cf}]/u.test(value)),
6146
6363
  version: literal(1),
@@ -6160,11 +6377,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6160
6377
  revision: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
6161
6378
  activeTurnEnabled: boolean().optional(),
6162
6379
  source: _enum(["default", "session"]).optional(),
6163
- nextTurnAuthorized: boolean().optional()
6380
+ nextTurnAuthorized: boolean().optional(),
6381
+ compaction: CompactionContinuationStatusSchema.optional()
6164
6382
  }).strict();
6165
6383
  //#endregion
6166
6384
  //#region lib/types/session-continuation-remote.js
6167
- const contribution$1 = {
6385
+ const contribution$2 = {
6168
6386
  package: "dsh-github-copilot",
6169
6387
  descriptors: [
6170
6388
  "get",
@@ -6199,6 +6417,232 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6199
6417
  }))
6200
6418
  };
6201
6419
  //#endregion
6420
+ //#region lib/types/diagnostics-types.js
6421
+ const DIAGNOSTICS_OPERATIONS = [
6422
+ "account-global-switch",
6423
+ "account-session-select",
6424
+ "account-session-inherit",
6425
+ "identity-read",
6426
+ "identity-flight",
6427
+ "compaction",
6428
+ "compaction-summary",
6429
+ "collection"
6430
+ ];
6431
+ const DIAGNOSTICS_STAGES = [
6432
+ "admitted",
6433
+ "rpc-invoked",
6434
+ "host-received",
6435
+ "identity-validation",
6436
+ "model-validation",
6437
+ "cas",
6438
+ "readback",
6439
+ "response-received",
6440
+ "decoded",
6441
+ "client-settled",
6442
+ "summary-attempt",
6443
+ "checkpoint-committed",
6444
+ "ended",
6445
+ "cache-hit",
6446
+ "joined-flight",
6447
+ "cooldown",
6448
+ "dispatched"
6449
+ ];
6450
+ const DIAGNOSTICS_METRICS = [
6451
+ "started",
6452
+ "stage",
6453
+ "success",
6454
+ "no-op",
6455
+ "cancelled",
6456
+ "policy-rejected",
6457
+ "revoked",
6458
+ "environment-fault",
6459
+ "failed",
6460
+ "unknown",
6461
+ "interrupted",
6462
+ "dropped",
6463
+ "paused",
6464
+ "expired",
6465
+ "clock-discontinuity",
6466
+ "pending-sample"
6467
+ ];
6468
+ const DIAGNOSTICS_REASONS = [
6469
+ "none",
6470
+ "unknown",
6471
+ "rpc-unavailable",
6472
+ "decode-invalid",
6473
+ "COPILOT_ACCOUNTS_BUSY",
6474
+ "COPILOT_ACCOUNTS_CONFLICT",
6475
+ "COPILOT_ACCOUNTS_CHANGED",
6476
+ "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN",
6477
+ "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT",
6478
+ "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE",
6479
+ "COPILOT_ACCOUNTS_MODELS_FAILED",
6480
+ "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE",
6481
+ "COPILOT_ACCOUNTS_IDENTITY_TLS",
6482
+ "COPILOT_ACCOUNTS_IDENTITY_NETWORK",
6483
+ "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED",
6484
+ "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED",
6485
+ "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR",
6486
+ "COPILOT_ACCOUNTS_IDENTITY_INVALID",
6487
+ "COPILOT_SESSION_ACCOUNTS_UNAVAILABLE",
6488
+ "COPILOT_SESSION_ACCOUNTS_SETTINGS_UNAVAILABLE",
6489
+ "COPILOT_SESSION_ACCOUNTS_COMMIT_UNCERTAIN",
6490
+ "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH",
6491
+ "CONTEXT_WINDOW_EXCEEDED",
6492
+ "COPILOT_MANUAL_RECOVERY_FIXED_PREFIX",
6493
+ "COPILOT_MANUAL_RECOVERY_INDIVISIBLE",
6494
+ "COPILOT_MANUAL_RECOVERY_CALL_LIMIT",
6495
+ "COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY",
6496
+ "COPILOT_MANUAL_RECOVERY_UNBALANCED"
6497
+ ];
6498
+ const DIAGNOSTICS_MAX_ROWS = 4096;
6499
+ const DIAGNOSTICS_MAX_BYTES = 2097152;
6500
+ const integer = number().int().min(0).max(Number.MAX_SAFE_INTEGER);
6501
+ const version$1 = string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
6502
+ const DiagnosticsRowSchema = object({
6503
+ hour: integer.multipleOf(36e5),
6504
+ version: version$1,
6505
+ layer: _enum(["client", "host"]),
6506
+ operation: _enum(DIAGNOSTICS_OPERATIONS),
6507
+ stage: _enum(DIAGNOSTICS_STAGES),
6508
+ metric: _enum(DIAGNOSTICS_METRICS),
6509
+ reason: _enum(DIAGNOSTICS_REASONS),
6510
+ bucket: number().int().min(0).max(7),
6511
+ count: integer.min(1)
6512
+ }).strict();
6513
+ const DiagnosticsPendingSchema = object({
6514
+ version: version$1,
6515
+ operation: _enum(DIAGNOSTICS_OPERATIONS),
6516
+ stage: _enum(DIAGNOSTICS_STAGES),
6517
+ bucket: number().int().min(0).max(7),
6518
+ count: integer.min(1).max(128)
6519
+ }).strict();
6520
+ const DiagnosticsSnapshotSchema = object({
6521
+ schemaVersion: literal(1),
6522
+ coverageVersion: literal(1),
6523
+ epoch: integer,
6524
+ updatedAt: integer,
6525
+ rows: array(DiagnosticsRowSchema).max(DIAGNOSTICS_MAX_ROWS),
6526
+ pending: array(DiagnosticsPendingSchema).max(128),
6527
+ dropped: integer,
6528
+ clientDropped: integer,
6529
+ clientUnconfirmed: integer,
6530
+ saturated: integer,
6531
+ evicted: integer,
6532
+ interrupted: integer
6533
+ }).strict().refine((value) => value.pending.reduce((sum, row) => sum + row.count, 0) <= 128, "Diagnostics pending capacity exceeded").refine((value) => JSON.stringify(value).length <= DIAGNOSTICS_MAX_BYTES, "Diagnostics capacity exceeded");
6534
+ const DiagnosticsViewSchema = object({
6535
+ enabled: boolean(),
6536
+ state: _enum([
6537
+ "loading",
6538
+ "ready",
6539
+ "unavailable",
6540
+ "error"
6541
+ ]),
6542
+ diagnostic: _enum([
6543
+ "none",
6544
+ "storage-unavailable",
6545
+ "storage-invalid",
6546
+ "storage-write-failed",
6547
+ "profile-unavailable",
6548
+ "settings-unavailable",
6549
+ "settings-conflict",
6550
+ "client-report-failed",
6551
+ "client-report-revoked",
6552
+ "closed"
6553
+ ]),
6554
+ persistedAt: integer.optional(),
6555
+ dirty: boolean(),
6556
+ snapshot: DiagnosticsSnapshotSchema
6557
+ }).strict();
6558
+ function diagnosticsBucket(ms) {
6559
+ return [
6560
+ 100,
6561
+ 500,
6562
+ 1e3,
6563
+ 5e3,
6564
+ 15e3,
6565
+ 6e4,
6566
+ 3e5
6567
+ ].findIndex((bound) => ms < bound) === -1 ? 7 : [
6568
+ 100,
6569
+ 500,
6570
+ 1e3,
6571
+ 5e3,
6572
+ 15e3,
6573
+ 6e4,
6574
+ 3e5
6575
+ ].findIndex((bound) => ms < bound);
6576
+ }
6577
+ function diagnosticsReason(error) {
6578
+ const seen = /* @__PURE__ */ new Set();
6579
+ for (let depth = 0; depth < 8 && error instanceof Error && !seen.has(error); depth++) {
6580
+ seen.add(error);
6581
+ const nativeCode = "code" in error ? error.code : void 0;
6582
+ const typed = DIAGNOSTICS_REASONS.find((code) => code !== "none" && code !== "unknown" && code === nativeCode);
6583
+ if (typed !== void 0) return typed;
6584
+ const message = error.message.slice(0, 4096);
6585
+ for (const code of DIAGNOSTICS_REASONS) if (code.startsWith("COPILOT_") || code === "CONTEXT_WINDOW_EXCEEDED") {
6586
+ if (new RegExp(`(?:^|[^A-Za-z0-9_])${code}(?:$|[^A-Za-z0-9_])`).test(message)) return code;
6587
+ }
6588
+ error = error.cause;
6589
+ }
6590
+ return "unknown";
6591
+ }
6592
+ function diagnosticsOutcome(reason) {
6593
+ if (reason === "COPILOT_ACCOUNTS_BUSY" || reason === "COPILOT_ACCOUNTS_CONFLICT") return "policy-rejected";
6594
+ if (reason === "COPILOT_ACCOUNTS_CHANGED") return "revoked";
6595
+ if (reason.endsWith("SETTINGS_UNAVAILABLE") || reason === "COPILOT_SESSION_ACCOUNTS_UNAVAILABLE") return "environment-fault";
6596
+ return "failed";
6597
+ }
6598
+ //#endregion
6599
+ //#region lib/types/diagnostics-remote.js
6600
+ const ClientDiagnosticsBatchSchema = object({
6601
+ epoch: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
6602
+ rows: array(DiagnosticsRowSchema.refine((row) => row.layer === "client")).max(128),
6603
+ dropped: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
6604
+ unconfirmed: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
6605
+ }).strict();
6606
+ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", DiagnosticsViewSchema);
6607
+ const contribution$1 = {
6608
+ package: "dsh-github-copilot",
6609
+ descriptors: [
6610
+ {
6611
+ method: "get",
6612
+ parameters: []
6613
+ },
6614
+ {
6615
+ method: "clear",
6616
+ parameters: []
6617
+ },
6618
+ {
6619
+ method: "setEnabled",
6620
+ parameters: [{
6621
+ name: "enabled",
6622
+ wire: "enabled",
6623
+ source: "json",
6624
+ codec: strictRemoteCodec("dsh-github-copilot#DiagnosticsEnabled", boolean())
6625
+ }]
6626
+ },
6627
+ {
6628
+ method: "recordClient",
6629
+ parameters: [{
6630
+ name: "batch",
6631
+ wire: "batch",
6632
+ source: "json",
6633
+ codec: strictRemoteCodec("dsh-github-copilot#ClientDiagnosticsBatch", ClientDiagnosticsBatchSchema)
6634
+ }]
6635
+ }
6636
+ ].map((descriptor) => ({
6637
+ ...descriptor,
6638
+ id: `dsh-github-copilot:githubCopilotDiagnostics.${descriptor.method}`,
6639
+ namespace: "githubCopilotDiagnostics",
6640
+ service: "githubCopilotDiagnostics",
6641
+ invocation: { kind: "direct" },
6642
+ result: result$1
6643
+ }))
6644
+ };
6645
+ //#endregion
6202
6646
  //#region lib/types/remote.js
6203
6647
  /**
6204
6648
  * Client-safe Remote contribution for the plugin-owned authorization bridge.
@@ -6427,6 +6871,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6427
6871
  parameters: [],
6428
6872
  result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
6429
6873
  },
6874
+ ...contribution$9.descriptors,
6430
6875
  ...contribution$8.descriptors,
6431
6876
  ...contribution$7.descriptors,
6432
6877
  ...contribution$6.descriptors,
@@ -6438,6 +6883,339 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6438
6883
  ]
6439
6884
  };
6440
6885
  //#endregion
6886
+ //#region package.json
6887
+ var version = "0.4.0-alpha.123";
6888
+ //#endregion
6889
+ //#region lib/types/diagnostics-client.js
6890
+ let owner;
6891
+ function updateDiagnosticsClient(view) {
6892
+ const current = owner;
6893
+ if (!current) return;
6894
+ if (current.view && (view.snapshot.epoch < current.view.snapshot.epoch || view.snapshot.epoch === current.view.snapshot.epoch && view.snapshot.updatedAt < current.view.snapshot.updatedAt)) return;
6895
+ if (current.view?.snapshot.epoch !== view.snapshot.epoch || !view.enabled) {
6896
+ current.rows = [];
6897
+ current.live.clear();
6898
+ current.dropped = 0;
6899
+ current.unconfirmed = 0;
6900
+ }
6901
+ current.view = view;
6902
+ }
6903
+ function clientDiagnosticsReportingFailed() {
6904
+ return owner?.reportFailure === true;
6905
+ }
6906
+ function append(current, live, metric, reason) {
6907
+ if (current.rows.length >= 128) {
6908
+ current.dropped = Math.min(Number.MAX_SAFE_INTEGER, current.dropped + 1);
6909
+ current.reportFailure = true;
6910
+ return;
6911
+ }
6912
+ current.rows.push({
6913
+ hour: Math.floor(Date.now() / 36e5) * 36e5,
6914
+ version,
6915
+ layer: "client",
6916
+ operation: live.operation,
6917
+ stage: live.stage,
6918
+ metric,
6919
+ reason,
6920
+ bucket: diagnosticsBucket(Math.max(0, performance.now() - live.start)),
6921
+ count: 1
6922
+ });
6923
+ }
6924
+ function beginClientDiagnostics(operation) {
6925
+ const current = owner;
6926
+ if (!current?.active || !current.view?.enabled || current.view.state !== "ready") return void 0;
6927
+ if (current.live.size >= 128) {
6928
+ current.dropped = Math.min(Number.MAX_SAFE_INTEGER, current.dropped + 1);
6929
+ current.reportFailure = true;
6930
+ return;
6931
+ }
6932
+ const live = {
6933
+ operation,
6934
+ stage: "rpc-invoked",
6935
+ start: performance.now(),
6936
+ epoch: current.view.snapshot.epoch
6937
+ };
6938
+ current.live.add(live);
6939
+ append(current, live, "started", "none");
6940
+ current.flush();
6941
+ const valid = () => current.live.has(live) && current.view?.snapshot.epoch === live.epoch;
6942
+ return {
6943
+ stage: (stage) => {
6944
+ if (valid()) {
6945
+ live.stage = stage;
6946
+ append(current, live, "stage", "none");
6947
+ }
6948
+ },
6949
+ finish: (outcome, reason = "none") => {
6950
+ if (!valid()) return;
6951
+ current.live.delete(live);
6952
+ append(current, live, outcome, reason);
6953
+ current.flush();
6954
+ }
6955
+ };
6956
+ }
6957
+ function createClientDiagnosticsScope() {
6958
+ const handles = /* @__PURE__ */ new Set();
6959
+ return {
6960
+ begin(operation) {
6961
+ const observed = beginClientDiagnostics(operation);
6962
+ if (!observed) return;
6963
+ const handle = {
6964
+ stage: (stage) => observed.stage(stage),
6965
+ finish: (outcome, reason) => {
6966
+ handles.delete(handle);
6967
+ observed.finish(outcome, reason);
6968
+ }
6969
+ };
6970
+ handles.add(handle);
6971
+ return handle;
6972
+ },
6973
+ close() {
6974
+ for (const handle of handles) handle.finish("interrupted", "unknown");
6975
+ }
6976
+ };
6977
+ }
6978
+ /** Bounded additive reporting, no retry after an uncertain RPC result. */
6979
+ function installDiagnosticsClient(ctx) {
6980
+ const remote = ctx.remote.githubCopilotDiagnostics;
6981
+ let writing;
6982
+ const current = {
6983
+ active: true,
6984
+ live: /* @__PURE__ */ new Set(),
6985
+ rows: [],
6986
+ dropped: 0,
6987
+ unconfirmed: 0,
6988
+ reportFailure: false,
6989
+ async flush() {
6990
+ if (writing || !current.view || current.rows.length === 0 && !current.dropped && !current.unconfirmed) return;
6991
+ const rows = current.rows.splice(0, 128);
6992
+ const dropped = current.dropped, unconfirmed = current.unconfirmed;
6993
+ current.dropped = 0;
6994
+ current.unconfirmed = 0;
6995
+ const epoch = current.view.snapshot.epoch;
6996
+ const failed = () => {
6997
+ current.reportFailure = true;
6998
+ if (current.view?.snapshot.epoch === epoch) current.unconfirmed = Math.min(Number.MAX_SAFE_INTEGER, current.unconfirmed + rows.length + dropped + unconfirmed);
6999
+ ctx.logger.warn("[github-copilot] COPILOT_DIAGNOSTICS_CLIENT_REPORT_FAILED");
7000
+ };
7001
+ writing = (async () => {
7002
+ try {
7003
+ const result = await remote.recordClient({
7004
+ epoch,
7005
+ rows,
7006
+ dropped,
7007
+ unconfirmed
7008
+ });
7009
+ const parsed = result.ok ? DiagnosticsViewSchema.safeParse(result.value) : void 0;
7010
+ if (!parsed?.success) {
7011
+ failed();
7012
+ return;
7013
+ }
7014
+ if (parsed.data.diagnostic === "client-report-revoked") ctx.logger.warn("[github-copilot] COPILOT_DIAGNOSTICS_CLIENT_REPORT_REVOKED");
7015
+ if (current.active && owner === current) updateDiagnosticsClient(parsed.data);
7016
+ } catch {
7017
+ failed();
7018
+ } finally {
7019
+ writing = void 0;
7020
+ }
7021
+ })();
7022
+ await writing;
7023
+ }
7024
+ };
7025
+ owner = current;
7026
+ const refresh = async () => {
7027
+ try {
7028
+ const result = await remote.get();
7029
+ const parsed = result.ok ? DiagnosticsViewSchema.safeParse(result.value) : void 0;
7030
+ if (owner === current && current.active) {
7031
+ if (parsed?.success) updateDiagnosticsClient(parsed.data);
7032
+ else current.reportFailure = true;
7033
+ }
7034
+ } catch {
7035
+ current.reportFailure = true;
7036
+ ctx.logger.warn("[github-copilot] COPILOT_DIAGNOSTICS_CLIENT_STATUS_FAILED");
7037
+ }
7038
+ };
7039
+ refresh();
7040
+ const timer = setInterval(() => {
7041
+ for (const live of current.live) append(current, live, "pending-sample", "none");
7042
+ current.flush();
7043
+ refresh();
7044
+ }, 1e4);
7045
+ return async () => {
7046
+ clearInterval(timer);
7047
+ for (const live of current.live) append(current, live, "interrupted", "unknown");
7048
+ current.live.clear();
7049
+ await writing;
7050
+ await current.flush();
7051
+ current.active = false;
7052
+ if (owner === current) owner = void 0;
7053
+ };
7054
+ }
7055
+ //#endregion
7056
+ //#region lib/types/diagnostics-card.js
7057
+ const section = {
7058
+ marginTop: 24,
7059
+ paddingTop: 18,
7060
+ borderTop: "1px solid color-mix(in srgb, currentColor 20%, transparent)",
7061
+ display: "grid",
7062
+ gap: 12,
7063
+ minWidth: 0
7064
+ };
7065
+ const button$3 = {
7066
+ font: "inherit",
7067
+ color: "inherit",
7068
+ cursor: "pointer",
7069
+ padding: "8px 12px",
7070
+ minHeight: 44,
7071
+ borderRadius: 8,
7072
+ border: "1px solid color-mix(in srgb, currentColor 30%, transparent)",
7073
+ background: "color-mix(in srgb, currentColor 6%, transparent)"
7074
+ };
7075
+ function DiagnosticsCard({ remote }) {
7076
+ const [view, setView] = (0, react.useState)();
7077
+ const [busy, setBusy] = (0, react.useState)(false);
7078
+ const [failed, setFailed] = (0, react.useState)(false);
7079
+ const [confirmClear, setConfirmClear] = (0, react.useState)(false);
7080
+ const [exported, setExported] = (0, react.useState)(false);
7081
+ const owner = (0, react.useRef)({
7082
+ active: false,
7083
+ generation: 0,
7084
+ busy: false
7085
+ });
7086
+ async function run(action) {
7087
+ const current = owner.current;
7088
+ if (!remote || !current.active || current.busy) return;
7089
+ current.busy = true;
7090
+ const generation = ++current.generation;
7091
+ setBusy(true);
7092
+ setFailed(false);
7093
+ setExported(false);
7094
+ try {
7095
+ const result = await action(remote);
7096
+ if (!current.active || current.generation !== generation) return;
7097
+ const parsed = result.ok ? DiagnosticsViewSchema.safeParse(result.value) : void 0;
7098
+ if (!parsed?.success) {
7099
+ setFailed(true);
7100
+ return;
7101
+ }
7102
+ setView(parsed.data);
7103
+ updateDiagnosticsClient(parsed.data);
7104
+ } catch {
7105
+ if (current.active && current.generation === generation) setFailed(true);
7106
+ } finally {
7107
+ if (current.active && current.generation === generation) {
7108
+ current.busy = false;
7109
+ setBusy(false);
7110
+ }
7111
+ }
7112
+ }
7113
+ (0, react.useEffect)(() => {
7114
+ const current = owner.current;
7115
+ current.active = true;
7116
+ run((value) => value.get());
7117
+ return () => {
7118
+ current.active = false;
7119
+ current.generation++;
7120
+ current.busy = false;
7121
+ };
7122
+ }, [remote]);
7123
+ const rows = view?.snapshot.rows ?? [];
7124
+ const populations = [...new Set(rows.filter((row) => row.operation !== "collection").map((row) => `${row.layer}/${row.operation}`))];
7125
+ const count = (metrics, population) => rows.filter((row) => metrics.includes(row.metric) && `${row.layer}/${row.operation}` === population).reduce((sum, row) => sum + row.count, 0);
7126
+ const control = (label, action, disabled = false) => (0, react.createElement)("button", {
7127
+ type: "button",
7128
+ style: button$3,
7129
+ onClick: action,
7130
+ disabled: busy || disabled
7131
+ }, label);
7132
+ return (0, react.createElement)("section", {
7133
+ "aria-label": "Local diagnostics",
7134
+ style: section
7135
+ }, (0, react.createElement)("h3", { style: { margin: 0 } }, "Local diagnostics"), (0, react.createElement)("p", { style: {
7136
+ margin: 0,
7137
+ lineHeight: 1.5,
7138
+ maxWidth: "70ch"
7139
+ } }, "Account, Checking and compaction counts stay in this profile. No identities, conversation content or raw errors. No upload, scheduled analysis or automatic repair."), (0, react.createElement)("p", {
7140
+ role: "status",
7141
+ style: { margin: 0 }
7142
+ }, !remote ? "Diagnostics controls are unavailable in this connection." : !view ? busy ? "Reading local collection status…" : "Collection status is unknown." : `${view.enabled ? view.state === "ready" ? "Collection enabled" : "Collection configured on; not collecting" : "Collection paused"} · Storage ${view.state}` + (view.diagnostic === "none" ? "" : ` · ${view.diagnostic}`) + (view.dirty ? " · Not all observations are persisted yet" : "")), failed ? (0, react.createElement)("p", {
7143
+ role: "alert",
7144
+ style: { margin: 0 }
7145
+ }, "Could not confirm the operation. Read status before retrying; no write is automatically replayed.") : null, clientDiagnosticsReportingFailed() ? (0, react.createElement)("p", {
7146
+ role: "alert",
7147
+ style: { margin: 0 }
7148
+ }, "Some Client observations could not be confirmed. Client counts are incomplete; Host counts are separate.") : null, (0, react.createElement)("div", { style: {
7149
+ display: "flex",
7150
+ flexWrap: "wrap",
7151
+ gap: 8
7152
+ } }, control("Read status", () => {
7153
+ run((value) => value.get());
7154
+ }, !remote), control(view?.enabled ? "Pause collection" : "Enable local collection", () => {
7155
+ run((value) => value.setEnabled(!view?.enabled));
7156
+ }, !remote || !view || !view.enabled && view.state !== "ready"), control("Clear local aggregates", () => setConfirmClear(true), !remote || !view || view.state !== "ready")), confirmClear ? (0, react.createElement)("div", {
7157
+ role: "group",
7158
+ "aria-label": "Confirm clearing local diagnostics"
7159
+ }, (0, react.createElement)("p", null, "Delete collected aggregates only? Collection keeps its current enabled/paused setting. This does not clear account settings or conversation history."), control("Confirm clear", () => {
7160
+ setConfirmClear(false);
7161
+ run((value) => value.clear());
7162
+ }), control("Cancel", () => setConfirmClear(false))) : null, view && populations.length ? (0, react.createElement)("div", { style: {
7163
+ overflowX: "auto",
7164
+ minWidth: 0
7165
+ } }, (0, react.createElement)("table", { style: {
7166
+ width: "100%",
7167
+ borderCollapse: "collapse",
7168
+ textAlign: "left"
7169
+ } }, (0, react.createElement)("caption", { style: {
7170
+ textAlign: "left",
7171
+ marginBottom: 8
7172
+ } }, "Retained observations · independent Client and Host populations"), (0, react.createElement)("thead", null, (0, react.createElement)("tr", null, ...[
7173
+ "Population",
7174
+ "Started",
7175
+ "Success",
7176
+ "Failed",
7177
+ "Cancelled",
7178
+ "Interrupted",
7179
+ "Other settled"
7180
+ ].map((label) => (0, react.createElement)("th", {
7181
+ key: label,
7182
+ scope: "col",
7183
+ style: { padding: 6 }
7184
+ }, label)))), (0, react.createElement)("tbody", null, ...populations.map((population) => (0, react.createElement)("tr", { key: population }, (0, react.createElement)("th", {
7185
+ scope: "row",
7186
+ style: { padding: 6 }
7187
+ }, population), ...[
7188
+ "started",
7189
+ "success",
7190
+ "failed",
7191
+ "cancelled",
7192
+ "interrupted"
7193
+ ].map((metric) => (0, react.createElement)("td", {
7194
+ key: metric,
7195
+ style: { padding: 6 }
7196
+ }, count([metric], population))), (0, react.createElement)("td", { style: { padding: 6 } }, count([
7197
+ "no-op",
7198
+ "policy-rejected",
7199
+ "revoked",
7200
+ "environment-fault",
7201
+ "unknown"
7202
+ ], population))))))) : null, view && !populations.length ? (0, react.createElement)("p", null, "No retained operation observations. This is not evidence of zero failures.") : null, view ? (0, react.createElement)("p", { style: {
7203
+ margin: 0,
7204
+ fontSize: 13,
7205
+ lineHeight: 1.5
7206
+ } }, `Host pending: ${view.snapshot.pending.reduce((sum, row) => sum + row.count, 0)}. Host dropped: ${view.snapshot.dropped}; Client dropped: ${view.snapshot.clientDropped}; Client unconfirmed: ${view.snapshot.clientUnconfirmed}; evicted/expired: ${view.snapshot.evicted}; saturated: ${view.snapshot.saturated}. Retention: 14 days, at most 4,096 aggregate rows and 2 MiB. Client pending samples are periodic observations, not a live outstanding count. Other settled includes policy rejection, revocation, environment faults and unknown/no-checkpoint results; JSON preserves each category. Stock/custom-engine physical summaries, native recovery opt-out, OAuth, quota and unwrapped RPCs are not covered.`) : null, view ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Review aggregate-only JSON"), (0, react.createElement)("p", null, "Review before sharing. This includes build versions, hour windows and fixed diagnostic counts, never account or Session identifiers."), control("Prepare current JSON", () => setExported(true)), exported ? (0, react.createElement)("textarea", {
7207
+ "aria-label": "Local diagnostics aggregate JSON",
7208
+ readOnly: true,
7209
+ value: JSON.stringify(view, null, 2),
7210
+ rows: 12,
7211
+ style: {
7212
+ width: "100%",
7213
+ boxSizing: "border-box",
7214
+ font: "inherit"
7215
+ }
7216
+ }) : null) : null);
7217
+ }
7218
+ //#endregion
6441
7219
  //#region lib/types/reasoning-presentation.js
6442
7220
  /** Plugin-owned, Step-scoped provenance; never a model route or durable message. */
6443
7221
  const ASSISTANT_ORIGIN_KEY = "github-copilot-assistant-origin";
@@ -9120,6 +9898,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9120
9898
  const changedCallback = (0, react.useRef)(props.onChanged);
9121
9899
  changedCallback.current = props.onChanged;
9122
9900
  const identityRead = (0, react.useRef)();
9901
+ const diagnostics = (0, react.useRef)(createClientDiagnosticsScope());
9902
+ (0, react.useEffect)(() => () => diagnostics.current.close(), [props.remote]);
9123
9903
  const refreshed = (0, react.useRef)(props.refreshKey);
9124
9904
  const text = props.locale?.toLowerCase().startsWith("zh") ? accountCopy.zh : accountCopy.en;
9125
9905
  (0, react.useEffect)(() => {
@@ -9128,21 +9908,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9128
9908
  setConfirmation(void 0);
9129
9909
  }
9130
9910
  }, [props.expanded]);
9131
- const run = (0, react.useCallback)(async (operation, changed = false, invalidate = changed) => {
9911
+ const run = (0, react.useCallback)(async (operation, changed = false, invalidate = changed, diagnosticOperation) => {
9132
9912
  const owner = lifetime.current;
9133
9913
  if (!owner.active || owner.busy) return;
9134
9914
  owner.busy = true;
9915
+ diagnostics.current.close();
9135
9916
  const generation = ++owner.generation;
9136
9917
  const current = () => owner.active && owner.generation === generation;
9137
9918
  setBusy(true);
9138
9919
  setFailed(false);
9920
+ const observed = diagnosticOperation === void 0 ? void 0 : diagnostics.current.begin(diagnosticOperation);
9139
9921
  const finishChange = invalidate ? accountPresentationChanges.begin() : void 0;
9140
9922
  try {
9141
9923
  const result = await operation();
9142
- if (!current()) return;
9924
+ observed?.stage("response-received");
9925
+ if (!current()) {
9926
+ observed?.finish("interrupted", "unknown");
9927
+ return;
9928
+ }
9143
9929
  const next = result.ok ? accountsViewFrom(result.value) : void 0;
9144
9930
  setView(next);
9145
9931
  setFailed(next === void 0);
9932
+ observed?.stage("decoded");
9933
+ observed?.stage("client-settled");
9934
+ const reason = next?.state === "error" ? diagnosticsReason(new Error(next.diagnostic)) : "none";
9935
+ observed?.finish(next === void 0 ? "failed" : reason === "none" ? "success" : diagnosticsOutcome(reason), next === void 0 ? result.ok ? "decode-invalid" : "rpc-unavailable" : reason);
9146
9936
  if (next?.operation === void 0) {
9147
9937
  setAuthorizationIntent(void 0);
9148
9938
  setCancelRequested(false);
@@ -9150,6 +9940,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9150
9940
  if (next !== void 0 && changed && next.operation === void 0) changedCallback.current?.();
9151
9941
  return next;
9152
9942
  } catch {
9943
+ observed?.finish("failed", "rpc-unavailable");
9153
9944
  if (current()) {
9154
9945
  setView(void 0);
9155
9946
  setFailed(true);
@@ -9171,18 +9962,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9171
9962
  const current = () => owner.active && owner.generation === generation;
9172
9963
  setIdentityChecking(true);
9173
9964
  const reading = Promise.resolve().then(async () => {
9965
+ const observed = diagnostics.current.begin("identity-read");
9174
9966
  try {
9175
- if (!current()) return;
9967
+ if (!current()) {
9968
+ observed?.finish("interrupted", "unknown");
9969
+ return;
9970
+ }
9176
9971
  const result = await managementRemote.ensureIdentity();
9177
- if (!current()) return;
9972
+ observed?.stage("response-received");
9973
+ if (!current()) {
9974
+ observed?.finish("interrupted", "unknown");
9975
+ return;
9976
+ }
9178
9977
  const next = result.ok ? accountsViewFrom(result.value) : void 0;
9179
9978
  if (next === void 0) {
9979
+ observed?.finish("failed", result.ok ? "decode-invalid" : "rpc-unavailable");
9180
9980
  setFailed(true);
9181
9981
  return;
9182
9982
  }
9183
9983
  setView(next);
9184
9984
  setFailed(false);
9985
+ observed?.stage("client-settled");
9986
+ const reason = next.state === "error" ? diagnosticsReason(new Error(next.diagnostic)) : "none";
9987
+ observed?.finish(reason === "none" ? "success" : diagnosticsOutcome(reason), reason);
9185
9988
  } catch {
9989
+ observed?.finish("failed", "rpc-unavailable");
9186
9990
  if (current()) setFailed(true);
9187
9991
  }
9188
9992
  }).finally(() => {
@@ -9519,7 +10323,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9519
10323
  } }, control(confirmation.remove ? text.confirmRemove : text.confirmSwitch, () => {
9520
10324
  const target = confirmation;
9521
10325
  setConfirmation(void 0);
9522
- if (managementRemote !== void 0) run(() => target.remove ? managementRemote.removeAccount(target.id, target.revision) : managementRemote.switchAccount(target.id, target.revision), true);
10326
+ if (managementRemote !== void 0) run(() => target.remove ? managementRemote.removeAccount(target.id, target.revision) : managementRemote.switchAccount(target.id, target.revision), true, true, target.remove ? void 0 : "account-global-switch");
9523
10327
  }, pending), control(text.cancel, () => setConfirmation(void 0), pending))), props.addOnly ? null : (0, react.createElement)("div", { style: {
9524
10328
  display: "flex",
9525
10329
  flexWrap: "wrap",
@@ -9712,6 +10516,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9712
10516
  const closeButton = (0, react.useRef)(null);
9713
10517
  const switchButton = (0, react.useRef)(null);
9714
10518
  const followCheckbox = (0, react.useRef)(null);
10519
+ const diagnostics = (0, react.useRef)(createClientDiagnosticsScope());
10520
+ (0, react.useEffect)(() => () => diagnostics.current.close(), [
10521
+ props.remote,
10522
+ props.contextKey,
10523
+ props.sessionAccount
10524
+ ]);
9715
10525
  const lifecycle = (0, react.useRef)({
9716
10526
  active: false,
9717
10527
  generation: 0,
@@ -9741,12 +10551,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9741
10551
  const owner = lifecycle.current;
9742
10552
  if (!owner.active || owner.busy || owner.save !== void 0 || accountPresentationChanges.pending() || props.remote === void 0 || document.visibilityState === "hidden") return;
9743
10553
  owner.busy = true;
10554
+ diagnostics.current.close();
9744
10555
  const generation = ++owner.generation;
9745
10556
  const current = () => owner.active && owner.generation === generation;
9746
10557
  setBusy(true);
9747
10558
  setFailed(false);
9748
10559
  try {
9749
- const identityOperation = props.accountsRemote === void 0 ? void 0 : (force ? props.accountsRemote.refreshIdentity() : props.accountsRemote.ensureIdentity()).catch(() => void 0);
10560
+ const identityOperation = props.accountsRemote === void 0 ? void 0 : (async () => {
10561
+ const observed = diagnostics.current.begin("identity-read");
10562
+ try {
10563
+ const result = await (force ? props.accountsRemote.refreshIdentity() : props.accountsRemote.ensureIdentity());
10564
+ observed?.stage("response-received");
10565
+ if (!current()) {
10566
+ observed?.finish("interrupted", "unknown");
10567
+ return result;
10568
+ }
10569
+ const parsed = result.ok ? accountsViewFrom(result.value) : void 0;
10570
+ const reason = parsed?.state === "error" ? diagnosticsReason(new Error(parsed.diagnostic)) : "none";
10571
+ observed?.finish(parsed === void 0 ? "failed" : reason === "none" ? "success" : diagnosticsOutcome(reason), parsed === void 0 ? result.ok ? "decode-invalid" : "rpc-unavailable" : reason);
10572
+ return result;
10573
+ } catch {
10574
+ observed?.finish("failed", "rpc-unavailable");
10575
+ return;
10576
+ }
10577
+ })();
9750
10578
  const [result, identityResult, sessionResult] = await Promise.all([
9751
10579
  force ? props.remote.refresh() : props.remote.get(),
9752
10580
  confirmed === void 0 ? props.accountsRemote?.get().catch(() => void 0) : {
@@ -9869,6 +10697,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9869
10697
  setBusy(false);
9870
10698
  setSavingAccount(true);
9871
10699
  setAccountSaveFailed(false);
10700
+ let observed;
9872
10701
  try {
9873
10702
  if (props.beforeAccountChange !== void 0) {
9874
10703
  owner.confirmation = save;
@@ -9896,10 +10725,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9896
10725
  owner.confirmation = void 0;
9897
10726
  setConfirmingAccount(false);
9898
10727
  }
10728
+ observed = diagnostics.current.begin(accountId === null ? "account-session-inherit" : "account-session-select");
9899
10729
  const result = await props.sessionAccount.set(accountId, revision);
9900
- if (!owner.active || owner.generation !== generation) return;
10730
+ observed?.stage("response-received");
10731
+ if (!owner.active || owner.generation !== generation) {
10732
+ observed?.finish("interrupted", "unknown");
10733
+ return;
10734
+ }
9901
10735
  const parsed = result.ok ? SessionAccountViewSchema.safeParse(result.value) : void 0;
9902
10736
  if (!parsed?.success) {
10737
+ observed?.finish("failed", result.ok ? "decode-invalid" : "rpc-unavailable");
9903
10738
  setAccountSaveFailed(true);
9904
10739
  setView(void 0);
9905
10740
  setAccounts(void 0);
@@ -9907,6 +10742,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9907
10742
  return;
9908
10743
  }
9909
10744
  setSessionAccount(parsed.data);
10745
+ observed?.stage("client-settled");
10746
+ const reason = parsed.data.accounts.state === "error" ? diagnosticsReason(new Error(parsed.data.accounts.diagnostic)) : "none";
10747
+ observed?.finish(parsed.data.accounts.state === "error" ? diagnosticsOutcome(reason) : "success", reason);
9910
10748
  setAccounts(parsed.data.accounts);
9911
10749
  setAccountFailed(false);
9912
10750
  setFailed(false);
@@ -9918,6 +10756,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9918
10756
  setRestoreAccountFocus(focus);
9919
10757
  if (!retainedQuota) load(false, parsed.data);
9920
10758
  } catch {
10759
+ observed?.finish("failed", "rpc-unavailable");
9921
10760
  if (owner.active && owner.generation === generation) {
9922
10761
  setAccountSaveFailed(true);
9923
10762
  setView(void 0);
@@ -10362,7 +11201,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10362
11201
  if (owner.current === generation) setBusy(false);
10363
11202
  }
10364
11203
  };
10365
- const loss = (0, react.createElement)("p", { style: body }, zh ? "每个新轮次不回放旧加密推理及内嵌摘要,同账号也适用。可见消息、工具记录和磁盘历史不变;可能失去隐含细节。不会自动发送或重试。" : "Every new turn omits old encrypted reasoning and embedded summaries, including on the same account. Visible messages, tool records and disk history stay unchanged; implicit details may be lost. No automatic sending or retries.");
11204
+ const loss = (0, react.createElement)("p", { style: body }, zh ? "聊天及本 Session 的原生压缩使用可见历史,省略旧加密推理及内嵌摘要,同账号也适用;可能失去隐含细节。可见消息、工具关系和原历史保留,摘要由原生事务提交。不会额外发送聊天或重试。" : "Chat and native compaction in this Session use visible history, omitting old encrypted reasoning and embedded summaries even on the same account; implicit details may be lost. Visible messages, tool relations and source history remain intact; native transactions commit summaries. No extra chat sending or retries.");
10366
11205
  const unavailable = error ? (0, react.createElement)("p", {
10367
11206
  role: "alert",
10368
11207
  style: body
@@ -10478,7 +11317,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10478
11317
  checked: view?.enabled ?? false,
10479
11318
  disabled: busy || !view,
10480
11319
  onChange: (event) => void save(event.currentTarget.checked)
10481
- }), zh ? "新 Session 默认开启降级续聊" : "Enable visible-history continuation for new Sessions"), (0, react.createElement)("p", { style: paragraph }, zh ? "开启即同意新 Session 每轮省略旧加密推理及内嵌摘要,同账号也适用。已有 Session 和继承历史不自动授权,不修改消息或工具记录。" : "Enabling consents to omitting prior encrypted reasoning and embedded summaries each turn, even on the same account. Existing Sessions and seeded histories are not automatically enrolled. Messages and tools are unchanged."), error ? (0, react.createElement)("p", { role: "alert" }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
11320
+ }), zh ? "新 Session 默认开启降级续聊" : "Enable visible-history continuation for new Sessions"), (0, react.createElement)("p", { style: paragraph }, zh ? "开启即同意新 Session 的聊天及原生压缩省略旧加密推理及内嵌摘要,可能丢失隐藏细节,同账号也适用。已有 Session 和继承历史不自动授权,原历史和工具关系保留。" : "Enabling consents to omitting prior encrypted reasoning and embedded summaries in new Session chat and native compaction, even on the same account; hidden details may be lost. Existing Sessions and seeded histories are not automatically enrolled. Source history and tool relations are preserved."), error ? (0, react.createElement)("p", { role: "alert" }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
10482
11321
  type: "button",
10483
11322
  style: control,
10484
11323
  onClick: () => setReload((value) => value + 1)
@@ -10987,6 +11826,76 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10987
11826
  });
10988
11827
  }
10989
11828
  //#endregion
11829
+ //#region lib/types/compaction-continuation-ui.js
11830
+ function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale = "en" }) {
11831
+ const parsed = CompactionContinuationLifecycleSchema.safeParse(lifecycle);
11832
+ const id = parsed.success ? parsed.data.id : null;
11833
+ const running = parsed.success && parsed.data.running;
11834
+ const [status, setStatus] = (0, react.useState)();
11835
+ const [error, setError] = (0, react.useState)(false);
11836
+ const [dismissed, setDismissed] = (0, react.useState)();
11837
+ (0, react.useEffect)(() => {
11838
+ let current = true;
11839
+ let timer;
11840
+ setStatus(void 0);
11841
+ setError(false);
11842
+ if (!id || !remote) return;
11843
+ const read = async () => {
11844
+ try {
11845
+ const result = await remote.get(sessionId);
11846
+ const view = result.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
11847
+ if (!current) return;
11848
+ if (!view?.success) {
11849
+ setError(true);
11850
+ setStatus(void 0);
11851
+ } else {
11852
+ setError(false);
11853
+ setStatus(view.data.compaction?.id === id ? view.data.compaction : void 0);
11854
+ }
11855
+ } catch {
11856
+ if (current) {
11857
+ setError(true);
11858
+ setStatus(void 0);
11859
+ }
11860
+ } finally {
11861
+ if (current && running) timer = setTimeout(() => void read(), 1e3);
11862
+ }
11863
+ };
11864
+ read();
11865
+ return () => {
11866
+ current = false;
11867
+ if (timer) clearTimeout(timer);
11868
+ };
11869
+ }, [
11870
+ sessionId,
11871
+ remote,
11872
+ id,
11873
+ running
11874
+ ]);
11875
+ const zh = locale.startsWith("zh");
11876
+ if (!status && !error) return null;
11877
+ if (status?.state === "blocked") return dismissed === status.id ? null : (0, react.createElement)("section", {
11878
+ "data-copilot-composer-notice": "compaction-continuation",
11879
+ style: composerNoticeSurfaceStyle
11880
+ }, (0, react.createElement)("p", {
11881
+ role: "alert",
11882
+ style: composerNoticeParagraphStyle
11883
+ }, zh ? "旧推理回放被拒绝,压缩未提交。开启降级可让后续聊天与压缩使用可见历史。" : "Old reasoning replay was rejected; compaction did not commit. Enabling continuation lets subsequent chat and compaction use visible history."), (0, react.createElement)(SessionContinuationCard, {
11884
+ sessionId,
11885
+ remote,
11886
+ locale,
11887
+ recovery: true,
11888
+ onCancel: () => setDismissed(status.id)
11889
+ }));
11890
+ const text = error ? zh ? "无法确认压缩降级状态;请查看原生压缩结果。" : "Compaction recovery status is unavailable; check the native compaction result." : status?.state === "running" ? zh ? "正在使用可见历史降级压缩,隐藏推理上下文可能丢失。" : "Compacting with visible history; hidden reasoning context may be lost." : status?.state === "completed" ? zh ? "可见历史压缩已提交;隐藏推理上下文未带入摘要。" : "Visible-history compaction committed; hidden reasoning context was omitted from the summary." : status?.state === "cancelled" ? zh ? "可见历史压缩已取消;未确认提交恢复摘要。" : "Visible-history compaction cancelled; no recovery summary commit is confirmed." : zh ? "可见历史压缩失败;Session 尚未恢复。请查看原生失败原因。" : "Visible-history compaction failed; the Session is not recovered. Check the native failure.";
11891
+ return (0, react.createElement)("section", {
11892
+ "data-copilot-composer-notice": "compaction-continuation",
11893
+ role: error || status?.state === "failed" ? "alert" : "status",
11894
+ "aria-live": "polite",
11895
+ style: composerNoticeSurfaceStyle
11896
+ }, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text));
11897
+ }
11898
+ //#endregion
10990
11899
  //#region lib/types/replay-recovery-ui.js
10991
11900
  const noop = () => {};
10992
11901
  function record(value) {
@@ -11122,11 +12031,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11122
12031
  function Surface({ runtime, remote, continuation, locale }) {
11123
12032
  const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
11124
12033
  const selected = runtime.useProjection("modelSelection");
12034
+ const compaction = runtime.useProjection(COMPACTION_CONTINUATION);
11125
12035
  const running = runtime.useSession((value) => !record(value) || value.running !== false);
11126
12036
  const lastError = runtime.useSession((value) => record(value) && typeof value.lastAgentError === "string" ? value.lastAgentError : "");
11127
12037
  const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop, () => locale?.getLocale().active ?? "en", () => "en");
11128
12038
  if (!valid || !record(selected) || !record(selected.next) || selected.next.provider !== "github-copilot-preview") return null;
11129
- return (0, react.createElement)(ReplayRecoveryCard, {
12039
+ return (0, react.createElement)("div", null, (0, react.createElement)(CompactionContinuationNotice, {
12040
+ sessionId: runtime.sessionId,
12041
+ remote: continuation,
12042
+ lifecycle: compaction,
12043
+ locale: language
12044
+ }), (0, react.createElement)(ReplayRecoveryCard, {
11130
12045
  key: JSON.stringify([runtime.sessionId, selected.next.model]),
11131
12046
  sessionId: runtime.sessionId,
11132
12047
  remote,
@@ -11134,7 +12049,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11134
12049
  locale: language,
11135
12050
  running,
11136
12051
  refreshKey: lastError
11137
- });
12052
+ }));
11138
12053
  }
11139
12054
  function registerReplayRecoveryUi(ctx) {
11140
12055
  const candidate = ctx.get("slots");
@@ -12548,7 +13463,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12548
13463
  }), (0, react.createElement)(WebSearchRoutingCard, {
12549
13464
  ...props,
12550
13465
  settingsRevision: revision
12551
- }));
13466
+ }), props.diagnosticsControl ?? (0, react.createElement)(DiagnosticsCard, { remote: props.diagnostics }));
13467
+ }
13468
+ function DiagnosticsConnectionCard({ ctx }) {
13469
+ const [remote, setRemote] = (0, react.useState)();
13470
+ (0, react.useEffect)(() => {
13471
+ let active = true;
13472
+ const injection = ctx.inject(["remote.githubCopilotDiagnostics"], (scope) => {
13473
+ const captured = scope.remote.githubCopilotDiagnostics;
13474
+ if (active) setRemote(captured);
13475
+ return () => {
13476
+ if (active) setRemote(void 0);
13477
+ };
13478
+ });
13479
+ return () => {
13480
+ active = false;
13481
+ injection.dispose();
13482
+ };
13483
+ }, [ctx]);
13484
+ return (0, react.createElement)(DiagnosticsCard, { remote });
12552
13485
  }
12553
13486
  /** Optional search settings must never hold account authorization UI in waiting. */
12554
13487
  function registerSearchUi(ctx) {
@@ -12560,10 +13493,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12560
13493
  let fallback;
12561
13494
  const settings = ctx.remote.settings;
12562
13495
  const routing = ctx.remote.githubCopilotSearchRouting;
12563
- const render = () => (0, react.createElement)(WebSearchRoutingCard, {
13496
+ const diagnosticsControl = (0, react.createElement)(DiagnosticsConnectionCard, { ctx });
13497
+ const render = () => (0, react.createElement)("div", null, (0, react.createElement)(WebSearchRoutingCard, {
12564
13498
  settings,
12565
13499
  routing
12566
- });
13500
+ }), diagnosticsControl);
12567
13501
  const syncFallback = () => {
12568
13502
  if (active && footerReady && !bundleActive && footerSeat === void 0) try {
12569
13503
  footerSeat = ctx.slots.register({
@@ -12604,7 +13538,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12604
13538
  key: "dsh-github-copilot"
12605
13539
  }, ({ view }) => view === "page" ? (0, react.createElement)(CopilotPluginSettingsPage, {
12606
13540
  settings,
12607
- routing
13541
+ routing,
13542
+ diagnosticsControl
12608
13543
  }) : null);
12609
13544
  } catch {
12610
13545
  ctx.logger.warn("[github-copilot] WEB_SEARCH_ROUTING_BUNDLE_UNAVAILABLE");
@@ -12674,6 +13609,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12674
13609
  "remote.githubCopilotSearchRouting",
12675
13610
  "slots"
12676
13611
  ], registerSearchUi);
13612
+ const diagnosticsUi = ctx.inject(["remote.githubCopilotDiagnostics"], (scope) => installDiagnosticsClient(scope));
12677
13613
  const usageUi = ctx.inject([
12678
13614
  "remote.githubCopilotUsage",
12679
13615
  "remote.githubCopilotAccounts",
@@ -12713,6 +13649,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12713
13649
  };
12714
13650
  });
12715
13651
  return async () => {
13652
+ await diagnosticsUi.dispose();
12716
13653
  await recoveryUi.dispose();
12717
13654
  await contextUi.dispose();
12718
13655
  await usageUi.dispose();