jj-octo 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/dist/jj-octo.js +1282 -802
  3. package/package.json +6 -6
package/dist/jj-octo.js CHANGED
@@ -790,6 +790,10 @@ function assignProperty(self, key, value) {
790
790
  }
791
791
  }
792
792
  function assignProperties(self, source) {
793
+ if (!Object.hasOwn(source, "__proto__")) {
794
+ Object.assign(self, source);
795
+ return;
796
+ }
793
797
  for (const key of Reflect.ownKeys(source)) {
794
798
  if (Object.prototype.propertyIsEnumerable.call(source, key)) {
795
799
  assignProperty(self, key, source[key]);
@@ -880,7 +884,7 @@ class CauseImpl {
880
884
  toJSON() {
881
885
  return {
882
886
  _id: "Cause",
883
- failures: this.reasons.map((f) => f.toJSON())
887
+ reasons: this.reasons.map((f) => f.toJSON())
884
888
  };
885
889
  }
886
890
  toString() {
@@ -1390,6 +1394,7 @@ var succeed = (success) => new SuccessImpl(success);
1390
1394
  function make2(compare) {
1391
1395
  return (self, that) => self === that ? 0 : compare(self, that);
1392
1396
  }
1397
+ var String2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
1393
1398
  var Number2 = /* @__PURE__ */ make2((self, that) => {
1394
1399
  if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that))
1395
1400
  return 0;
@@ -1400,6 +1405,7 @@ var Number2 = /* @__PURE__ */ make2((self, that) => {
1400
1405
  return self < that ? -1 : 1;
1401
1406
  });
1402
1407
  var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
1408
+ var isLessThan = (O) => dual(2, (self, that) => O(self, that) === -1);
1403
1409
  var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
1404
1410
 
1405
1411
  // node_modules/effect/dist/Option.js
@@ -1665,11 +1671,19 @@ var try_ = (evaluate) => {
1665
1671
  var isResult2 = isResult;
1666
1672
  var isFailure2 = isFailure;
1667
1673
  var isSuccess2 = isSuccess;
1674
+ var mapError = /* @__PURE__ */ dual(2, (self, f) => isFailure2(self) ? fail2(f(self.failure)) : self);
1668
1675
  var map2 = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) : self);
1669
1676
  var match2 = /* @__PURE__ */ dual(2, (self, {
1670
1677
  onFailure,
1671
1678
  onSuccess
1672
1679
  }) => isFailure2(self) ? onFailure(self.failure) : onSuccess(self.success));
1680
+ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onFailure) => {
1681
+ if (isSuccess2(self)) {
1682
+ return self.success;
1683
+ }
1684
+ throw onFailure(self.failure);
1685
+ });
1686
+ var getOrThrow = /* @__PURE__ */ getOrThrowWith(identity);
1673
1687
  var all = (input) => {
1674
1688
  if (Symbol.iterator in input) {
1675
1689
  const out = [];
@@ -1821,9 +1835,21 @@ var bigint2 = /* @__PURE__ */ BigInt(2);
1821
1835
  var bigint10 = /* @__PURE__ */ BigInt(10);
1822
1836
  var bigint1e3 = /* @__PURE__ */ BigInt(1000);
1823
1837
  var bigint1e6 = /* @__PURE__ */ BigInt(1e6);
1838
+ var bigint1e9 = /* @__PURE__ */ BigInt(1e9);
1839
+ var bigintNanosPerMinute = /* @__PURE__ */ BigInt(60000000000);
1840
+ var bigintNanosPerHour = /* @__PURE__ */ BigInt(3600000000000);
1841
+ var bigintNanosPerDay = /* @__PURE__ */ BigInt(86400000000000);
1842
+ var bigintNanosPerWeek = /* @__PURE__ */ BigInt(604800000000000);
1824
1843
  var roundTiesAwayFromZero = (input) => BigInt(Math.sign(input) * Math.round(Math.abs(input)));
1825
1844
  var roundMillisToNanos = (millis) => Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1e6);
1826
1845
  var fromNanosNumber = (nanos) => make4(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
1846
+ var nanosToUnit = (nanos, divisor) => {
1847
+ const value = Number(nanos);
1848
+ if (Number.isFinite(value))
1849
+ return value / divisor;
1850
+ const scale = BigInt(divisor);
1851
+ return Number(nanos / scale) + Number(nanos % scale) / divisor;
1852
+ };
1827
1853
  var parseNanos = (input, scale) => {
1828
1854
  const decimalIndex = input.indexOf(".");
1829
1855
  if (decimalIndex === -1)
@@ -1839,6 +1865,13 @@ var divideTiesAwayFromZero = (numerator, denominator) => {
1839
1865
  const rounded = absolute / denominator + (absolute % denominator * bigint2 >= denominator ? bigint1 : bigint0);
1840
1866
  return numerator < bigint0 ? -rounded : rounded;
1841
1867
  };
1868
+ var fromMillisString = (input, scale) => {
1869
+ const millis = Number(input) * scale;
1870
+ if (!Number.isFinite(millis))
1871
+ return make4(millis);
1872
+ const nanos = parseNanos(input, BigInt(scale) * bigint1e6);
1873
+ return make4(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos);
1874
+ };
1842
1875
  var DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/;
1843
1876
  var fromInputUnsafe = (input) => {
1844
1877
  switch (typeof input) {
@@ -1863,26 +1896,25 @@ var fromInputUnsafe = (input) => {
1863
1896
  if (unit === "micro" || unit === "micros") {
1864
1897
  return nanos(parseNanos(valueStr, bigint1e3));
1865
1898
  }
1866
- const value = Number(valueStr);
1867
1899
  switch (unit) {
1868
1900
  case "milli":
1869
1901
  case "millis":
1870
- return millis(value);
1902
+ return fromMillisString(valueStr, 1);
1871
1903
  case "second":
1872
1904
  case "seconds":
1873
- return seconds(value);
1905
+ return fromMillisString(valueStr, 1000);
1874
1906
  case "minute":
1875
1907
  case "minutes":
1876
- return minutes(value);
1908
+ return fromMillisString(valueStr, 60000);
1877
1909
  case "hour":
1878
1910
  case "hours":
1879
- return hours(value);
1911
+ return fromMillisString(valueStr, 3600000);
1880
1912
  case "day":
1881
1913
  case "days":
1882
- return days(value);
1914
+ return fromMillisString(valueStr, 86400000);
1883
1915
  case "week":
1884
1916
  case "weeks":
1885
- return weeks(value);
1917
+ return fromMillisString(valueStr, 604800000);
1886
1918
  }
1887
1919
  break;
1888
1920
  }
@@ -1904,7 +1936,8 @@ var fromInputUnsafe = (input) => {
1904
1936
  if (input[0] === Infinity || input[1] === Infinity) {
1905
1937
  return infinity;
1906
1938
  }
1907
- return fromNanosNumber(input[0] * 1e9 + input[1]);
1939
+ const nanos = input[0] * 1e9 + input[1];
1940
+ return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make4(BigInt(input[0]) * bigint1e9 + BigInt(input[1])) : fromNanosNumber(nanos);
1908
1941
  }
1909
1942
  const obj = input;
1910
1943
  let millis = 0;
@@ -1920,13 +1953,42 @@ var fromInputUnsafe = (input) => {
1920
1953
  millis += obj.seconds * 1000;
1921
1954
  if (obj.milliseconds)
1922
1955
  millis += obj.milliseconds;
1923
- if (!obj.microseconds && !obj.nanoseconds)
1924
- return make4(millis);
1925
- return fromNanosNumber(millis * 1e6 + (obj.microseconds ?? 0) * 1000 + (obj.nanoseconds ?? 0));
1956
+ if (!obj.microseconds && !obj.nanoseconds) {
1957
+ if (!Number.isFinite(millis))
1958
+ return make4(millis);
1959
+ const exact = sumObjectNanos(obj);
1960
+ return exact === undefined || BigInt(millis) * bigint1e6 === exact ? make4(millis) : make4(exact);
1961
+ }
1962
+ const nanos = millis * 1e6 + (obj.microseconds ?? 0) * 1000 + (obj.nanoseconds ?? 0);
1963
+ const exact = Number.isFinite(nanos) ? sumObjectNanos(obj) : undefined;
1964
+ return exact === undefined ? fromNanosNumber(nanos) : make4(exact);
1926
1965
  }
1927
1966
  }
1928
1967
  return invalid(input);
1929
1968
  };
1969
+ var isIntegerOrUnset = (n) => !n || Number.isInteger(n);
1970
+ var sumObjectNanos = (obj) => {
1971
+ if (!isIntegerOrUnset(obj.weeks) || !isIntegerOrUnset(obj.days) || !isIntegerOrUnset(obj.hours) || !isIntegerOrUnset(obj.minutes) || !isIntegerOrUnset(obj.seconds) || !isIntegerOrUnset(obj.milliseconds) || !isIntegerOrUnset(obj.microseconds) || !isIntegerOrUnset(obj.nanoseconds))
1972
+ return;
1973
+ let nanos = bigint0;
1974
+ if (obj.weeks)
1975
+ nanos += BigInt(obj.weeks) * bigintNanosPerWeek;
1976
+ if (obj.days)
1977
+ nanos += BigInt(obj.days) * bigintNanosPerDay;
1978
+ if (obj.hours)
1979
+ nanos += BigInt(obj.hours) * bigintNanosPerHour;
1980
+ if (obj.minutes)
1981
+ nanos += BigInt(obj.minutes) * bigintNanosPerMinute;
1982
+ if (obj.seconds)
1983
+ nanos += BigInt(obj.seconds) * bigint1e9;
1984
+ if (obj.milliseconds)
1985
+ nanos += BigInt(obj.milliseconds) * bigint1e6;
1986
+ if (obj.microseconds)
1987
+ nanos += BigInt(obj.microseconds) * bigint1e3;
1988
+ if (obj.nanoseconds)
1989
+ nanos += BigInt(obj.nanoseconds);
1990
+ return nanos;
1991
+ };
1930
1992
  var invalid = (input) => {
1931
1993
  throw new Error(`Invalid Input: ${input}`);
1932
1994
  };
@@ -2036,13 +2098,9 @@ var negativeInfinity = /* @__PURE__ */ make4(-Infinity);
2036
2098
  var nanos = (nanos) => make4(nanos);
2037
2099
  var millis = (millis) => make4(millis);
2038
2100
  var seconds = (seconds) => make4(seconds * 1000);
2039
- var minutes = (minutes) => make4(minutes * 60000);
2040
- var hours = (hours) => make4(hours * 3600000);
2041
- var days = (days) => make4(days * 86400000);
2042
- var weeks = (weeks) => make4(weeks * 604800000);
2043
2101
  var toMillis = (self) => match4(fromInputUnsafe(self), {
2044
2102
  onMillis: identity,
2045
- onNanos: (nanos) => Number(nanos) / 1e6,
2103
+ onNanos: (nanos) => nanosToUnit(nanos, 1e6),
2046
2104
  onInfinity: () => Infinity,
2047
2105
  onNegativeInfinity: () => -Infinity
2048
2106
  });
@@ -2114,7 +2172,7 @@ var setTimer = "setImmediate" in globalThis ? (f) => {
2114
2172
  const timer = setTimeout(f, 0);
2115
2173
  return () => clearTimeout(timer);
2116
2174
  };
2117
- var setImmediate = (f) => {
2175
+ var setImmediate2 = (f) => {
2118
2176
  try {
2119
2177
  return setTimer(f);
2120
2178
  } catch {
@@ -2154,7 +2212,7 @@ class MixedScheduler {
2154
2212
  setImmediate;
2155
2213
  constructor(executionMode = "async", setImmediateFn) {
2156
2214
  this.executionMode = executionMode;
2157
- this.setImmediate = setImmediateFn ?? (executionMode === "sync" ? setMicrotask : setImmediate);
2215
+ this.setImmediate = setImmediateFn ?? (executionMode === "sync" ? setMicrotask : setImmediate2);
2158
2216
  }
2159
2217
  shouldYield(fiber) {
2160
2218
  return fiber.currentOpCount >= fiber.cache.maxOpsBeforeYield;
@@ -2168,7 +2226,7 @@ class MixedSchedulerDispatcher {
2168
2226
  tasks = /* @__PURE__ */ new PriorityBuckets;
2169
2227
  running = undefined;
2170
2228
  setImmediate;
2171
- constructor(setImmediateFn = setImmediate) {
2229
+ constructor(setImmediateFn = setImmediate2) {
2172
2230
  this.setImmediate = setImmediateFn;
2173
2231
  }
2174
2232
  scheduleTask(task, priority) {
@@ -2458,10 +2516,7 @@ class Interrupt extends ReasonBase {
2458
2516
  }
2459
2517
  }
2460
2518
  var causeInterrupt = (fiberId) => new CauseImpl([new Interrupt(fiberId)]);
2461
- var findFail = (self) => {
2462
- const reason = self.reasons.find(isFailReason);
2463
- return reason ? succeed2(reason) : fail2(self);
2464
- };
2519
+ var hasFails = (self) => self.reasons.some(isFailReason);
2465
2520
  var findError = (self) => {
2466
2521
  for (let i = 0;i < self.reasons.length; i++) {
2467
2522
  const reason = self.reasons[i];
@@ -2472,6 +2527,9 @@ var findError = (self) => {
2472
2527
  return fail2(self);
2473
2528
  };
2474
2529
  var findErrorOption = /* @__PURE__ */ toOption(findError);
2530
+ var hasDies = (self) => self.reasons.some(isDieReason);
2531
+ var causeElectDefects = (self) => hasDies(self) && hasFails(self) ? causeFromReasons(self.reasons.map((reason) => reason._tag === "Fail" && !isDone(reason.error) ? new Die(reason.error, reason.annotations) : reason)) : self;
2532
+ var findRecoverableError = (self) => hasDies(self) ? fail2(causeElectDefects(self)) : findError(self);
2475
2533
  var hasInterrupts = (self) => self.reasons.some(isInterruptReason);
2476
2534
  var causeFilterInterruptors = (self) => {
2477
2535
  let interruptors;
@@ -2546,12 +2604,14 @@ var causePrettyErrors = (self, options) => {
2546
2604
  }
2547
2605
  return errors;
2548
2606
  };
2549
- var causePrettyError = (original, annotations, options) => {
2607
+ var causePrettyError = (original, annotations, options, seen = new Set) => {
2550
2608
  const kind = typeof original;
2551
2609
  let error;
2552
2610
  if (original && kind === "object") {
2611
+ seen.add(original);
2612
+ const cause = original.cause;
2553
2613
  error = new globalThis.Error(causePrettyMessage(original), {
2554
- cause: original.cause ? causePrettyError(original.cause) : undefined
2614
+ cause: cause !== undefined && !seen.has(cause) ? causePrettyError(cause, undefined, undefined, seen) : undefined
2555
2615
  });
2556
2616
  if (typeof original.name === "string") {
2557
2617
  error.name = original.name;
@@ -2762,7 +2822,11 @@ class FiberImpl {
2762
2822
  } else if (this._asyncContext !== undefined) {
2763
2823
  const asyncContext = this._asyncContext;
2764
2824
  this._asyncContext = undefined;
2765
- return asyncContext.runInAsyncScope(this.evaluate, this, effect);
2825
+ try {
2826
+ return asyncContext.runInAsyncScope(this.evaluate, this, effect);
2827
+ } finally {
2828
+ asyncContext.emitDestroy();
2829
+ }
2766
2830
  } else if (this._yielded !== undefined) {
2767
2831
  const yielded = this._yielded;
2768
2832
  this._yielded = undefined;
@@ -3063,7 +3127,6 @@ var tryPromise = (options) => {
3063
3127
  }
3064
3128
  }, f.length !== 0);
3065
3129
  };
3066
- var withFiberId = (f) => withFiber((fiber) => f(fiber.id));
3067
3130
  var callbackOptions = /* @__PURE__ */ function() {
3068
3131
  const Proto = /* @__PURE__ */ makePrimitiveProto({
3069
3132
  op: "Async",
@@ -3084,9 +3147,9 @@ var callbackOptions = /* @__PURE__ */ function() {
3084
3147
  if (yielded !== false)
3085
3148
  return yielded;
3086
3149
  yielded = true;
3087
- fiber._yielded = () => {
3150
+ fiber.yieldWith(() => {
3088
3151
  resumed = true;
3089
- };
3152
+ });
3090
3153
  if (controller === undefined && onCancel === undefined) {
3091
3154
  return Yield;
3092
3155
  }
@@ -3315,9 +3378,9 @@ var catchEager = /* @__PURE__ */ dual(2, (self, f) => {
3315
3378
  if (effectIsExit(self)) {
3316
3379
  if (self._tag === "Success")
3317
3380
  return self;
3318
- const error = findError(self.cause);
3381
+ const error = findRecoverableError(self.cause);
3319
3382
  if (isFailure2(error))
3320
- return self;
3383
+ return exitFailCause(error.failure);
3321
3384
  return f(error.success);
3322
3385
  }
3323
3386
  return catch_(self, f);
@@ -3332,18 +3395,12 @@ var exitMap = /* @__PURE__ */ dual(2, (self, f) => self._tag === "Success" ? exi
3332
3395
  var exitMapError = /* @__PURE__ */ dual(2, (self, f) => {
3333
3396
  if (self._tag === "Success")
3334
3397
  return self;
3335
- const error = findError(self.cause);
3336
- if (isFailure2(error))
3337
- return self;
3338
- return exitFail(f(error.success));
3398
+ return exitFailCause(causeMap(self.cause, f));
3339
3399
  });
3340
3400
  var exitMapBoth = /* @__PURE__ */ dual(2, (self, options) => {
3341
3401
  if (self._tag === "Success")
3342
3402
  return exitSucceed(options.onSuccess(self.value));
3343
- const error = findError(self.cause);
3344
- if (isFailure2(error))
3345
- return self;
3346
- return exitFail(options.onFailure(error.success));
3403
+ return exitFailCause(causeMap(self.cause, options.onFailure));
3347
3404
  });
3348
3405
  var exitZipRight = /* @__PURE__ */ dual(2, (self, that) => exitIsSuccess(self) ? that : self);
3349
3406
  var exitAsVoidAll = (exits) => {
@@ -3410,7 +3467,7 @@ var catchCauseFilter = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause(s
3410
3467
  const eb = filter(cause);
3411
3468
  return isFailure2(eb) ? failCause(eb.failure) : f(eb.success, cause);
3412
3469
  }));
3413
- var catch_ = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter(self, findError, (e) => f(e)));
3470
+ var catch_ = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter(self, findRecoverableError, (e) => f(e)));
3414
3471
  var tapCause = /* @__PURE__ */ dual(2, (self, f) => catchCause(self, (cause) => andThen(f(cause), failCause(cause))));
3415
3472
  var tapCauseFilter = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause(self, (cause) => {
3416
3473
  const result = filter(cause);
@@ -3421,7 +3478,7 @@ var tapCauseFilter = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause(sel
3421
3478
  }));
3422
3479
  var tapError = /* @__PURE__ */ dual(2, (self, f) => tapCauseFilter(self, findError, (e) => f(e)));
3423
3480
  var catchIf = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, predicate, f, orElse) => catchCause(self, (cause) => {
3424
- const error = findError(cause);
3481
+ const error = findRecoverableError(cause);
3425
3482
  if (isFailure2(error))
3426
3483
  return failCause(error.failure);
3427
3484
  if (!predicate(error.success)) {
@@ -3430,7 +3487,7 @@ var catchIf = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, predicate
3430
3487
  return f(error.success);
3431
3488
  }));
3432
3489
  var catchFilter = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, filter, f, orElse) => catchCause(self, (cause) => {
3433
- const error = findError(cause);
3490
+ const error = findRecoverableError(cause);
3434
3491
  if (isFailure2(error))
3435
3492
  return failCause(error.failure);
3436
3493
  const result = filter(error.success);
@@ -3450,9 +3507,9 @@ var catchTags = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, cases,
3450
3507
  return hasProperty(e, "_tag") && isString(e["_tag"]) && keys.includes(e["_tag"]) ? succeed2(e) : fail2(e);
3451
3508
  }, (e) => cases[e["_tag"]](e), orElse);
3452
3509
  });
3453
- var mapError2 = /* @__PURE__ */ dual(2, (self, f) => catch_(self, (error) => failSync(() => f(error))));
3454
- var mapBoth = /* @__PURE__ */ dual(2, (self, options) => matchEffect(self, {
3455
- onFailure: (e) => failSync(() => options.onFailure(e)),
3510
+ var mapError2 = /* @__PURE__ */ dual(2, (self, f) => catchCause(self, (cause) => failCause(causeMap(cause, f))));
3511
+ var mapBoth = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect(self, {
3512
+ onFailure: (cause) => failCause(causeMap(cause, options.onFailure)),
3456
3513
  onSuccess: (a) => sync(() => options.onSuccess(a))
3457
3514
  }));
3458
3515
  var orDie = (self) => catch_(self, die);
@@ -3467,8 +3524,8 @@ var ignore = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, options) =
3467
3524
  const logEffect = logWithLevel(options.log === true ? undefined : options.log);
3468
3525
  return matchCauseEffect(self, {
3469
3526
  onFailure(cause) {
3470
- const failure = findFail(cause);
3471
- return isFailure2(failure) ? failCause(failure.failure) : options.message === undefined ? logEffect(cause) : logEffect(options.message, cause);
3527
+ const error = findRecoverableError(cause);
3528
+ return isFailure2(error) ? failCause(error.failure) : options.message === undefined ? logEffect(cause) : logEffect(options.message, cause);
3472
3529
  },
3473
3530
  onSuccess: (_) => void_
3474
3531
  });
@@ -3507,16 +3564,16 @@ var makeMatch = (op, onFailure) => {
3507
3564
  return MatchImpl;
3508
3565
  };
3509
3566
  var MatchImpl = /* @__PURE__ */ makeMatch("Match", function(cause, fiber) {
3510
- const fail = cause.reasons.find(isFailReason);
3511
- if (fail === undefined)
3512
- return failCause(cause);
3567
+ const error = findRecoverableError(cause);
3568
+ if (isFailure2(error))
3569
+ return failCause(error.failure);
3513
3570
  const handlers = this.payload;
3514
- return fiber.succeedWith(continuationMarksStack ? handlers.onFailure(fail.error) : internalCall(() => handlers.onFailure(fail.error)));
3571
+ return fiber.succeedWith(continuationMarksStack ? handlers.onFailure(error.success) : internalCall(() => handlers.onFailure(error.success)));
3515
3572
  });
3516
3573
  var matchEffect = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect(self, {
3517
3574
  onFailure: (cause) => {
3518
- const fail = cause.reasons.find(isFailReason);
3519
- return fail ? options.onFailure(fail.error) : failCause(cause);
3575
+ const error = findRecoverableError(cause);
3576
+ return isFailure2(error) ? failCause(error.failure) : options.onFailure(error.success);
3520
3577
  },
3521
3578
  onSuccess: options.onSuccess
3522
3579
  }));
@@ -3525,9 +3582,9 @@ var matchEager = /* @__PURE__ */ dual(2, (self, options) => {
3525
3582
  if (effectIsExit(self)) {
3526
3583
  if (self._tag === "Success")
3527
3584
  return exitSucceed(options.onSuccess(self.value));
3528
- const error = findError(self.cause);
3585
+ const error = findRecoverableError(self.cause);
3529
3586
  if (isFailure2(error))
3530
- return self;
3587
+ return exitFailCause(error.failure);
3531
3588
  return exitSucceed(options.onFailure(error.success));
3532
3589
  }
3533
3590
  return match5(self, options);
@@ -3582,17 +3639,17 @@ var runFinalizer = (finalizer, exit_) => {
3582
3639
  return exitDie(defect);
3583
3640
  }
3584
3641
  };
3585
- var combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause(finalizer, (cause) => failCause(causeCombine(exit_.cause, cause)));
3642
+ var combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause(finalizer, (cause) => failCause(causeElectDefects(causeCombine(exit_.cause, cause))));
3586
3643
  var scopeCloseFinalizers = /* @__PURE__ */ fnUntraced(function* (self, finalizers, exit_) {
3587
3644
  let exits = [];
3588
3645
  const fibers = [];
3589
- const arr = Array.from(finalizers.values());
3646
+ const arr = Array.from(finalizers);
3590
3647
  const parent = getCurrentFiber();
3591
3648
  for (let i = arr.length - 1;i >= 0; i--) {
3592
- const finalizer = arr[i];
3649
+ const [key, finalizer] = arr[i];
3593
3650
  if (self.strategy === "sequential") {
3594
3651
  exits.push(yield* exit(runFinalizer(finalizer, exit_)));
3595
- } else {
3652
+ } else if (key !== parent) {
3596
3653
  fibers.push(forkUnsafe(parent, runFinalizer(finalizer, exit_), true, true, "inherit"));
3597
3654
  }
3598
3655
  }
@@ -3751,9 +3808,10 @@ var makeCachedUnsafe = (self, ttlMillis) => {
3751
3808
  const join = (fiber, run) => {
3752
3809
  run.awaiters++;
3753
3810
  onExitUnsafe(fiber, () => {
3754
- if (--run.awaiters > 0 || current !== run)
3811
+ if (--run.awaiters > 0 || run.done)
3755
3812
  return;
3756
- current = undefined;
3813
+ if (current === run)
3814
+ current = undefined;
3757
3815
  return fiberInterrupt(run.fiber);
3758
3816
  });
3759
3817
  return fiberJoin(run.fiber);
@@ -3769,11 +3827,13 @@ var makeCachedUnsafe = (self, ttlMillis) => {
3769
3827
  const clock = fiber.getRef(ClockRef);
3770
3828
  const run = {
3771
3829
  fiber: new FiberImpl(fiber.context),
3772
- awaiters: 0
3830
+ awaiters: 0,
3831
+ done: false
3773
3832
  };
3774
3833
  current = run;
3775
3834
  const joined = join(fiber, run);
3776
3835
  run.fiber.evaluate(onExitPrimitive(self, (exit_) => {
3836
+ run.done = true;
3777
3837
  if (current !== run)
3778
3838
  return;
3779
3839
  current = undefined;
@@ -3785,6 +3845,7 @@ var makeCachedUnsafe = (self, ttlMillis) => {
3785
3845
  }));
3786
3846
  return run.fiber._exit ?? joined;
3787
3847
  }), sync(() => {
3848
+ current = undefined;
3788
3849
  exit = undefined;
3789
3850
  })];
3790
3851
  };
@@ -3839,15 +3900,9 @@ var all2 = (arg, options) => {
3839
3900
  } else if (options?.discard) {
3840
3901
  return options.mode === "result" ? forEach(Object.values(arg), result, options) : forEach(Object.values(arg), identity, options);
3841
3902
  }
3842
- return suspend(() => {
3843
- const out = {};
3844
- return as(forEach(Object.entries(arg), ([key, effect]) => map5(options?.mode === "result" ? result(effect) : effect, (value) => {
3845
- assignProperty(out, key, value);
3846
- }), {
3847
- discard: true,
3848
- concurrency: options?.concurrency
3849
- }), out);
3850
- });
3903
+ return suspend(() => map5(forEach(Object.entries(arg), ([key, effect]) => map5(options?.mode === "result" ? result(effect) : effect, (value) => [key, value]), {
3904
+ concurrency: options?.concurrency
3905
+ }), Object.fromEntries));
3851
3906
  };
3852
3907
  var whileLoop = /* @__PURE__ */ makePrimitive({
3853
3908
  op: "While",
@@ -3986,7 +4041,7 @@ var iterateConcurrentImpl = (options) => {
3986
4041
  const reasons = exit.cause.reasons.filter((reason) => reason._tag !== "Interrupt");
3987
4042
  if (reasons.length > 0) {
3988
4043
  const cause = causeFromReasons(reasons);
3989
- terminal = exitFailCause(terminal._tag === "Failure" ? causeCombine(terminal.cause, cause) : cause);
4044
+ terminal = exitFailCause(terminal._tag === "Failure" ? causeElectDefects(causeCombine(terminal.cause, cause)) : cause);
3990
4045
  }
3991
4046
  }
3992
4047
  } else {
@@ -4065,14 +4120,13 @@ var forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterrupt
4065
4120
  }
4066
4121
  return child;
4067
4122
  };
4123
+ var fiberScopeFinalizer = (fiber) => () => withFiber((current) => current === fiber ? void_ : fiberInterrupt(fiber));
4068
4124
  var forkIn = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, scope, options) => withFiber((parent) => {
4069
- const fiber = forkUnsafe(parent, self, options?.startImmediately, true, options?.uninterruptible);
4125
+ const fiber = scope.state._tag === "Closed" ? new FiberImpl(parent.context) : forkUnsafe(parent, self, options?.startImmediately, true, options?.uninterruptible);
4070
4126
  if (!fiber._exit) {
4071
4127
  if (scope.state._tag !== "Closed") {
4072
- const key = {};
4073
- const finalizer = () => withFiberId((interruptor) => interruptor === fiber.id ? void_ : fiberInterrupt(fiber));
4074
- scopeAddFinalizerUnsafe(scope, key, finalizer);
4075
- fiber.addObserver(() => scopeRemoveFinalizerUnsafe(scope, key));
4128
+ scopeAddFinalizerUnsafe(scope, fiber, fiberScopeFinalizer(fiber));
4129
+ fiber.addObserver(() => scopeRemoveFinalizerUnsafe(scope, fiber));
4076
4130
  } else {
4077
4131
  fiber.interruptUnsafe(parent.id, fiberStackAnnotations(parent));
4078
4132
  }
@@ -4109,7 +4163,7 @@ var fiberRunIn = /* @__PURE__ */ dual(2, (self, scope) => {
4109
4163
  return self;
4110
4164
  }
4111
4165
  scopeRemoveFinalizerUnsafe(scope, self);
4112
- scopeAddFinalizerUnsafe(scope, self, () => fiberInterrupt(self));
4166
+ scopeAddFinalizerUnsafe(scope, self, fiberScopeFinalizer(self));
4113
4167
  self.addObserver(() => scopeRemoveFinalizerUnsafe(scope, self));
4114
4168
  return self;
4115
4169
  });
@@ -4804,8 +4858,8 @@ var mergeAllEffect = (layers, memoMap, scope) => {
4804
4858
  concurrency: layers.length
4805
4859
  }).pipe(map5((context) => mergeAll(...context)));
4806
4860
  };
4807
- var mergeAll2 = (...layers) => fromBuild((memoMap, scope) => mergeAllEffect(layers, memoMap, scope));
4808
- var provideWith = (self, that, f) => fromBuild((memoMap, scope) => flatMap2(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), (context) => self.build(memoMap, scope).pipe(provideContext(context), map5((merged) => f(merged, context)))));
4861
+ var mergeAll2 = (...layers) => fromBuildMemo((memoMap, scope) => mergeAllEffect(layers, memoMap, scope));
4862
+ var provideWith = (self, that, f) => fromBuildMemo((memoMap, scope) => flatMap2(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), (context) => self.build(memoMap, scope).pipe(provideContext(context), map5((merged) => f(merged, context)))));
4809
4863
  var provideMerge = /* @__PURE__ */ dual(2, (self, that) => provideWith(self, that, (self, that) => merge(that, self)));
4810
4864
  var flatMap3 = /* @__PURE__ */ dual(2, (self, f) => fromBuild((memoMap, scope) => flatMap2(self.build(memoMap, scope), (context) => f(context).build(memoMap, scope))));
4811
4865
 
@@ -4964,14 +5018,17 @@ var provideLayer = (self, layer, options) => scopedWith((scope) => flatMap2(opti
4964
5018
  var provide2 = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, source, options) => isContext(source) ? provideContext(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll2(...source) : source, options));
4965
5019
 
4966
5020
  // node_modules/effect/dist/internal/schedule.js
4967
- var findErrorOnly = (cause) => cause.reasons.every(isFailReason) ? findError(cause) : fail2(cause);
4968
5021
  var repeatOrElse = /* @__PURE__ */ dual(3, (self, schedule, orElse) => flatMap2(toStepWithMetadata(schedule), (step) => {
4969
5022
  let meta = CurrentMetadata.defaultValue();
4970
- return catchCauseFilter(catchDone(forever(tap(flatMap2(suspend(() => provideService(self, CurrentMetadata, meta)), step), (meta_) => sync(() => {
4971
- meta = meta_;
4972
- })), {
4973
- disableYield: true
4974
- }), (out) => succeed3(out)), findErrorOnly, (error) => orElse(error, meta.attempt === 0 ? none2() : some2(meta)));
5023
+ const loop = (input) => matchEffect2(step(input), {
5024
+ onSuccess(meta_) {
5025
+ meta = meta_;
5026
+ return flatMap2(provideService(self, CurrentMetadata, meta), loop);
5027
+ },
5028
+ onFailure: failCause,
5029
+ onDone: succeed3
5030
+ });
5031
+ return catchCauseFilter(flatMap2(provideService(self, CurrentMetadata, meta), loop), findRecoverableError, (error) => orElse(error, meta.attempt === 0 ? none2() : some2(meta)));
4975
5032
  }));
4976
5033
  var repeat = /* @__PURE__ */ dual(2, (self, options) => {
4977
5034
  const schedule = typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options);
@@ -5018,6 +5075,7 @@ var void_3 = void_;
5018
5075
  var callback2 = callback;
5019
5076
  var gen2 = gen;
5020
5077
  var fail6 = fail3;
5078
+ var failSync2 = failSync;
5021
5079
  var failCause3 = failCause;
5022
5080
  var failCauseSync2 = failCauseSync;
5023
5081
  var die3 = die;
@@ -5085,16 +5143,23 @@ var fnUntraced2 = fnUntraced;
5085
5143
  var clockWith2 = clockWith;
5086
5144
  var logError = /* @__PURE__ */ logWithLevel("Error");
5087
5145
  var effectify = (fn, onError, onSyncError) => (...args) => callback2((resume) => {
5146
+ let synchronous = true;
5147
+ let pending;
5088
5148
  try {
5089
5149
  fn(...args, (err, result) => {
5090
- if (err) {
5091
- resume(onError ? suspend2(() => fail6(onError(err, args))) : fail6(err));
5150
+ const effect = err ? onError ? suspend2(() => fail6(onError(err, args))) : fail6(err) : succeed6(result);
5151
+ if (synchronous) {
5152
+ pending ??= effect;
5092
5153
  } else {
5093
- resume(succeed6(result));
5154
+ resume(effect);
5094
5155
  }
5095
5156
  });
5096
5157
  } catch (err) {
5097
- resume(onSyncError ? fail6(onSyncError(err, args)) : die3(err));
5158
+ pending = onSyncError ? fail6(onSyncError(err, args)) : die3(err);
5159
+ }
5160
+ synchronous = false;
5161
+ if (pending) {
5162
+ resume(pending);
5098
5163
  }
5099
5164
  });
5100
5165
  var mapEager2 = mapEager;
@@ -5113,23 +5178,26 @@ var defaultTeardown = (exit, onExit) => {
5113
5178
  return onExit(getErrorExitCode(squash(exit.cause)));
5114
5179
  };
5115
5180
  var makeRunMain = (f) => dual((args) => isEffect2(args[0]), (effect, options) => {
5116
- const fiber = options?.disableErrorReporting === true ? runFork2(effect) : runFork2(tapCause2(effect, (cause) => {
5181
+ const main = options?.disableErrorReporting === true ? effect : tapCause2(effect, (cause) => {
5117
5182
  if (hasInterruptsOnly2(cause))
5118
5183
  return void_3;
5119
5184
  const isReported = getErrorReported(squash(cause));
5120
5185
  return isReported ? logError(cause) : void_3;
5121
- }));
5122
- try {
5123
- const keepAlive = globalThis.setInterval(constVoid, 2147483647);
5124
- fiber.addObserver(() => {
5125
- clearInterval(keepAlive);
5126
- });
5127
- } catch {}
5128
- const teardown = options?.teardown ?? defaultTeardown;
5129
- return f({
5130
- fiber,
5131
- teardown
5132
5186
  });
5187
+ const teardown = options?.teardown ?? defaultTeardown;
5188
+ runFork2(withFiber2((fiber) => {
5189
+ try {
5190
+ const keepAlive = globalThis.setInterval(constVoid, 2147483647);
5191
+ fiber.addObserver(() => {
5192
+ clearInterval(keepAlive);
5193
+ });
5194
+ } catch {}
5195
+ f({
5196
+ fiber,
5197
+ teardown
5198
+ });
5199
+ return main;
5200
+ }));
5133
5201
  });
5134
5202
  var errorExitCode = "~effect/Runtime/errorExitCode";
5135
5203
  var getErrorExitCode = (u) => {
@@ -5774,7 +5842,9 @@ var toTransform = (channel) => channel.transform;
5774
5842
  var asyncQueue = (scope, f, options) => make9({
5775
5843
  capacity: options?.bufferSize,
5776
5844
  strategy: options?.strategy
5777
- }).pipe(tap2((queue) => addFinalizer2(scope, shutdown(queue))), tap2((queue) => provide(f(queue), scope).pipe(catchCause2((cause) => failCause4(queue, cause)), forkIn2(scope))));
5845
+ }).pipe(tap2((queue) => addFinalizer2(scope, shutdown(queue))), tap2((queue) => provide(f(queue), scope).pipe(catchCause2((cause) => failCause4(queue, cause)), forkIn2(scope, {
5846
+ startImmediately: true
5847
+ }))));
5778
5848
  var callbackArray = (f, options) => fromTransform((_, scope) => map7(asyncQueue(scope, f, options), takeAll2));
5779
5849
  var suspend3 = (evaluate) => fromTransform((upstream, scope) => suspend2(() => toTransform(evaluate())(upstream, scope)));
5780
5850
  var succeed7 = (value) => fromEffect(succeed6(value));
@@ -5816,7 +5886,7 @@ var readableStreamToPullUnsafe = (options) => {
5816
5886
  }
5817
5887
  });
5818
5888
  });
5819
- return as2(addFinalizer2(options.scope, options.releaseLockOnEnd ? sync2(() => reader.releaseLock()) : promise2(() => reader.cancel().catch(constVoid))), pull);
5889
+ return as2(addFinalizer2(options.scope, options.releaseLockOnEnd ? sync2(() => reader.releaseLock()) : promise2(() => reader.cancel().catch((error) => reader.closed.then(() => Promise.reject(error), constVoid))).pipe(ensuring2(sync2(() => reader.releaseLock())))), pull);
5820
5890
  };
5821
5891
  var map8 = /* @__PURE__ */ dual(2, (self, f) => transformPull(self, (pull) => sync2(() => {
5822
5892
  let i = 0;
@@ -5934,6 +6004,18 @@ var splitLines = () => fromTransform((upstream, _scope) => sync2(() => {
5934
6004
  }
5935
6005
  return pullOrFlush;
5936
6006
  }));
6007
+ var decodeText = (encoding, options) => fromTransform((upstream, _scope) => sync2(() => {
6008
+ const decoder = new TextDecoder(encoding, options);
6009
+ const streamOptions = {
6010
+ stream: true
6011
+ };
6012
+ let pull = upstream.pipe(map7(map4((bytes) => decoder.decode(bytes, streamOptions))), catchDone((leftover) => {
6013
+ pull = done2(leftover);
6014
+ const last = decoder.decode();
6015
+ return last.length > 0 ? succeed6(of(last)) : pull;
6016
+ }));
6017
+ return suspend2(() => pull);
6018
+ }));
5937
6019
  var pipeTo = /* @__PURE__ */ dual(2, (self, that) => fromTransform((upstream, scope) => flatMap4(toTransform(self)(upstream, scope), (upstream) => toTransform(that)(upstream, scope))));
5938
6020
  var unwrap2 = (channel) => fromTransform((upstream, scope) => {
5939
6021
  let pull;
@@ -5943,6 +6025,9 @@ var unwrap2 = (channel) => fromTransform((upstream, scope) => {
5943
6025
  return channel.pipe(provide(scope), flatMap4((channel) => toTransform(channel)(upstream, scope)), flatMap4((pull_) => pull = pull_));
5944
6026
  }));
5945
6027
  });
6028
+ var interruptWhen = /* @__PURE__ */ dual(2, (self, effect) => merge2(self, fromPull(succeed6(flatMap4(effect, done2))), {
6029
+ haltStrategy: "either"
6030
+ }));
5946
6031
  var onExit3 = /* @__PURE__ */ dual(2, (self, finalizer) => fromTransformBracket((upstream, scope, forkedScope) => addFinalizerExit(forkedScope, finalizer).pipe(andThen2(toTransform(self)(upstream, scope)))));
5947
6032
  var ensuring3 = /* @__PURE__ */ dual(2, (self, finalizer) => onExit3(self, (_) => finalizer));
5948
6033
  var runWith = (self, f, onHalt) => suspend2(() => {
@@ -6169,7 +6254,12 @@ var toChannel2 = (stream) => stream.channel;
6169
6254
  var callback3 = (f, options) => fromChannel3(callbackArray(f, options));
6170
6255
  var empty4 = /* @__PURE__ */ fromChannel3(empty3);
6171
6256
  var make12 = (...values) => fromArray2(values);
6172
- var suspend4 = (stream) => fromChannel3(suspend3(() => stream().channel));
6257
+ var suspend4 = (stream) => {
6258
+ const suspended = fromChannel3(suspend3(() => stream().channel));
6259
+ suspendedStreams.set(suspended, stream);
6260
+ return suspended;
6261
+ };
6262
+ var suspendedStreams = /* @__PURE__ */ new WeakMap;
6173
6263
  var fail8 = (error) => fromChannel3(fail7(error));
6174
6264
  var fromArray2 = (array) => isReadonlyArrayNonEmpty(array) ? fromChannel3(succeed7(array)) : empty4;
6175
6265
  var fromReadableStream2 = (options) => fromChannel3(fromReadableStream(options));
@@ -6199,17 +6289,13 @@ var transduce = /* @__PURE__ */ dual(2, (self, sink) => transformPull2(self, (up
6199
6289
  });
6200
6290
  return suspend2(() => done ? done : pull);
6201
6291
  })));
6202
- var decodeText = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, options) => suspend4(() => {
6203
- const decoder = new TextDecoder(options?.encoding);
6204
- return map9(self, (chunk) => decoder.decode(chunk, {
6205
- stream: true
6206
- }));
6207
- }));
6292
+ var decodeText2 = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, options) => self.channel.pipe(pipeTo(decodeText(options?.encoding)), fromChannel3));
6208
6293
  var encodeText = (self) => suspend4(() => {
6209
6294
  const encoder = new TextEncoder;
6210
6295
  return map9(self, (chunk) => encoder.encode(chunk));
6211
6296
  });
6212
6297
  var splitLines2 = (self) => self.channel.pipe(pipeTo(splitLines()), fromChannel3);
6298
+ var interruptWhen2 = /* @__PURE__ */ dual(2, (self, effect) => fromChannel3(interruptWhen(self.channel, effect)));
6213
6299
  var ensuring4 = /* @__PURE__ */ dual(2, (self, finalizer) => fromChannel3(ensuring3(self.channel, finalizer)));
6214
6300
  var run = /* @__PURE__ */ dual(2, (self, sink) => scopedWith2((scope) => toPullScoped(self.channel, scope).pipe(flatMap4((upstream) => sink.transform(upstream, scope)), map7(([a]) => a))));
6215
6301
  var runCollect = (self) => runFold(self.channel, () => [], (acc, chunk) => {
@@ -6218,7 +6304,6 @@ var runCollect = (self) => runFold(self.channel, () => [], (acc, chunk) => {
6218
6304
  }
6219
6305
  return acc;
6220
6306
  });
6221
- var runForEachArray = /* @__PURE__ */ dual(2, (self, f) => runForEach(self.channel, f));
6222
6307
  var mkString = (self) => runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
6223
6308
  var toReadableStreamWith = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, context, options) => {
6224
6309
  let currentResolve = undefined;
@@ -6229,14 +6314,14 @@ var toReadableStreamWith = /* @__PURE__ */ dual((args) => isStream(args[0]), (se
6229
6314
  const onAbort = () => fiber.interruptUnsafe();
6230
6315
  return new ReadableStream({
6231
6316
  start(controller) {
6232
- fiber = runFork2(provideContext2(runForEachArray(self, (chunk) => latch.whenOpen(sync2(() => {
6317
+ fiber = runFork2(provideContext2(runForEach(transformPull(self.channel, (pull) => succeed6(latch.whenOpen(pull))), (chunk) => sync2(() => {
6233
6318
  latch.closeUnsafe();
6234
6319
  for (let i = 0;i < chunk.length; i++) {
6235
6320
  controller.enqueue(chunk[i]);
6236
6321
  }
6237
6322
  currentResolve();
6238
6323
  currentResolve = undefined;
6239
- }))), context));
6324
+ })), context));
6240
6325
  fiber.addObserver((exit) => {
6241
6326
  signal?.removeEventListener("abort", onAbort);
6242
6327
  if (cancelled)
@@ -6546,7 +6631,7 @@ var defaultLeafHook = (issue) => {
6546
6631
  }
6547
6632
  }
6548
6633
  };
6549
- var defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);
6634
+ var defaultCheckHook = (issue) => findMessage(issue) ?? findMessage(issue.issue);
6550
6635
  function formatInput(issue) {
6551
6636
  return hasInput(issue) ? format(issue.input) : undefined;
6552
6637
  }
@@ -6558,6 +6643,13 @@ function getExpectedMessage(expected, issue) {
6558
6643
  const input = formatInput(issue);
6559
6644
  return input === undefined ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
6560
6645
  }
6646
+ function getFilterMessage(issue, checkHook) {
6647
+ const message = checkHook(issue);
6648
+ if (message !== undefined || issue.issue._tag !== "InvalidValue")
6649
+ return message;
6650
+ const expected = findExpected(issue.issue);
6651
+ return expected === undefined ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
6652
+ }
6561
6653
  function formatCheck(check) {
6562
6654
  const expected = check.annotations?.expected;
6563
6655
  if (typeof expected === "string")
@@ -6573,44 +6665,33 @@ function makeFormatterDefault() {
6573
6665
  return (issue) => formatIssue(issue, "");
6574
6666
  }
6575
6667
  var defaultFormatter = /* @__PURE__ */ makeFormatterDefault();
6576
- function formatIssue(issue, path) {
6668
+ function formatIssue(issue, path, messageOverride) {
6577
6669
  let message;
6578
6670
  switch (issue._tag) {
6579
- case "Filter": {
6580
- const annotated = defaultCheckHook(issue);
6581
- if (annotated !== undefined) {
6582
- message = annotated;
6583
- } else {
6584
- if (issue.issue._tag !== "InvalidValue") {
6585
- return formatIssue(issue.issue, path);
6586
- }
6587
- const expected = findExpected(issue.issue);
6588
- message = expected === undefined ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
6589
- }
6590
- break;
6591
- }
6671
+ case "Filter":
6672
+ return formatIssue(issue.issue, path, messageOverride ?? getFilterMessage(issue, defaultCheckHook));
6592
6673
  case "Encoding":
6593
- return formatIssue(issue.issue, path);
6674
+ return formatIssue(issue.issue, path, messageOverride);
6594
6675
  case "Pointer":
6595
- return formatIssue(issue.issue, path + formatPath(issue.path));
6676
+ return formatIssue(issue.issue, path + formatPath(issue.path), messageOverride);
6596
6677
  case "Composite":
6597
6678
  case "AnyOf": {
6598
6679
  if (issue._tag === "Composite" || issue.issues.length > 0) {
6599
- return issue.issues.map((issue) => formatIssue(issue, path)).join(`
6680
+ return issue.issues.map((issue) => formatIssue(issue, path, messageOverride)).join(`
6600
6681
  `);
6601
6682
  }
6602
- message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
6683
+ message = messageOverride ?? findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
6603
6684
  break;
6604
6685
  }
6605
6686
  default:
6606
- message = defaultLeafHook(issue);
6687
+ message = messageOverride ?? defaultLeafHook(issue);
6607
6688
  break;
6608
6689
  }
6609
6690
  return path ? `${message}
6610
6691
  at ${path}` : message;
6611
6692
  }
6612
6693
  function findMessage(issue) {
6613
- if (issue._tag === "Pointer")
6694
+ if (issue._tag === "Pointer" || issue._tag === "Composite")
6614
6695
  return;
6615
6696
  if (issue._tag === "Encoding")
6616
6697
  return findMessage(issue.issue);
@@ -6756,7 +6837,7 @@ function transformOptionalEffect(f) {
6756
6837
  transform: f
6757
6838
  });
6758
6839
  }
6759
- function String2() {
6840
+ function String3() {
6760
6841
  return transform(globalThis.String);
6761
6842
  }
6762
6843
  function Number4() {
@@ -6828,7 +6909,7 @@ var passthrough_2 = /* @__PURE__ */ new Transformation(/* @__PURE__ */ passthrou
6828
6909
  function passthrough3() {
6829
6910
  return passthrough_2;
6830
6911
  }
6831
- var numberFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number4(), /* @__PURE__ */ String2());
6912
+ var numberFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number4(), /* @__PURE__ */ String3());
6832
6913
  var isJsonError = (input) => isObject(input) && typeof input["message"] === "string";
6833
6914
  var decodeJsonError = (input) => {
6834
6915
  const hasCause = Object.hasOwn(input, "cause");
@@ -6962,7 +7043,12 @@ var Declaration = class extends ASTNodeImpl {
6962
7043
  return (input, options) => {
6963
7044
  if (input === missing)
6964
7045
  return missingExit;
6965
- return (run ??= this.run(this.typeParameters))(input, this, options);
7046
+ run ??= this.run(this.typeParameters);
7047
+ try {
7048
+ return run(input, this, options);
7049
+ } catch (error) {
7050
+ return die3(error);
7051
+ }
6966
7052
  };
6967
7053
  }
6968
7054
  _rebuild(recur, checks, encodingChecks, run, encodingRun) {
@@ -7048,7 +7134,7 @@ function literalToString(ast) {
7048
7134
  const literalAsString = globalThis.String(ast.literal);
7049
7135
  return replaceEncoding(ast, [new Link(new Literal(literalAsString), new Transformation(transform(() => ast.literal), transform(() => literalAsString)))]);
7050
7136
  }
7051
- var String3 = class extends ASTNodeImpl {
7137
+ var String4 = class extends ASTNodeImpl {
7052
7138
  _tag = "String";
7053
7139
  getParser() {
7054
7140
  return fromRefinement(this, isString);
@@ -7061,7 +7147,7 @@ var String3 = class extends ASTNodeImpl {
7061
7147
  return "string";
7062
7148
  }
7063
7149
  };
7064
- var string2 = /* @__PURE__ */ new String3;
7150
+ var string2 = /* @__PURE__ */ new String4;
7065
7151
  var Number5 = class extends ASTNodeImpl {
7066
7152
  _tag = "Number";
7067
7153
  getParser() {
@@ -7187,7 +7273,7 @@ var Arrays = class extends ASTNodeImpl {
7187
7273
  input,
7188
7274
  len,
7189
7275
  tailThreshold: Math.max(elementLen, len - tailLen),
7190
- output: new globalThis.Array(len),
7276
+ output: [],
7191
7277
  issues: undefined,
7192
7278
  options
7193
7279
  };
@@ -7296,7 +7382,7 @@ var wrapPropertyKeyIssue = (s, ast, key, exit) => {
7296
7382
  return fail5(new Composite(ast, [pointer], s.input, s.options));
7297
7383
  }
7298
7384
  };
7299
- var FINITE_PATTERN = "[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";
7385
+ var FINITE_PATTERN = "[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[Ee][+-]?\\d+)?";
7300
7386
  function getIndexSignatureKeys(input, parameter, options = defaultParseOptions) {
7301
7387
  let stringKeys;
7302
7388
  let symbolKeys;
@@ -7535,9 +7621,15 @@ var Objects = class extends ASTNodeImpl {
7535
7621
  if (indexCount)
7536
7622
  return makeFallback();
7537
7623
  let fallback;
7538
- const resume = (state, index, pending) => {
7624
+ const resume = (snapshot, index, pending) => {
7539
7625
  const property = properties[index];
7540
7626
  return flatMap4(exit2(pending), (exit) => {
7627
+ const state = {
7628
+ ...snapshot,
7629
+ out: {
7630
+ ...snapshot.out
7631
+ }
7632
+ };
7541
7633
  const terminal = stepProperty(state, property, exit);
7542
7634
  if (terminal)
7543
7635
  return terminal;
@@ -7667,9 +7759,6 @@ function struct(fields, checks, annotations) {
7667
7759
  function getAST(self) {
7668
7760
  return self.ast;
7669
7761
  }
7670
- function tuple(elements, checks = undefined) {
7671
- return new Arrays(false, elements.map((e) => e.ast), [], undefined, checks);
7672
- }
7673
7762
  function union(members, options, checks) {
7674
7763
  return new Union(members.map(getAST), options, undefined, checks);
7675
7764
  }
@@ -8588,7 +8677,7 @@ var makeHandle = (params) => Object.setPrototypeOf({
8588
8677
  ...params
8589
8678
  }, HandleProto);
8590
8679
  var make15 = (spawn) => {
8591
- const streamString = (command, options) => spawn(command).pipe(map7((handle) => decodeText(options?.includeStderr === true ? handle.all : handle.stdout)), unwrap4);
8680
+ const streamString = (command, options) => spawn(command).pipe(map7((handle) => decodeText2(options?.includeStderr === true ? handle.all : handle.stdout)), unwrap4);
8592
8681
  const streamLines = (command, options) => splitLines2(streamString(command, options));
8593
8682
  return ChildProcessSpawner.of({
8594
8683
  spawn,
@@ -8757,6 +8846,7 @@ var handleErrnoException = (module, method) => (err, [path]) => {
8757
8846
  reason = "NotFound";
8758
8847
  break;
8759
8848
  case "EACCES":
8849
+ case "EPERM":
8760
8850
  reason = "PermissionDenied";
8761
8851
  break;
8762
8852
  case "EEXIST":
@@ -8785,66 +8875,149 @@ var handleErrnoException = (module, method) => (err, [path]) => {
8785
8875
  });
8786
8876
  };
8787
8877
 
8878
+ // node_modules/@effect/platform-node-shared/dist/NodeSink.js
8879
+ import { finished } from "stream";
8880
+
8881
+ // node_modules/@effect/platform-node-shared/dist/internal/stream.js
8882
+ var destroyStream = (stream, cleanup, onDestroyed) => {
8883
+ if (!("closed" in stream)) {
8884
+ cleanup();
8885
+ onDestroyed?.();
8886
+ return;
8887
+ }
8888
+ const onDone = () => {
8889
+ clearImmediate(immediate);
8890
+ stream.off("error", onDone);
8891
+ stream.off("close", onDone);
8892
+ onDestroyed?.();
8893
+ };
8894
+ const onClosed = () => {
8895
+ if (stream.closed) {
8896
+ onDone();
8897
+ } else {
8898
+ immediate = setImmediate(onClosed);
8899
+ if (!onDestroyed)
8900
+ immediate.unref();
8901
+ }
8902
+ };
8903
+ let immediate = setImmediate(onClosed);
8904
+ if (!onDestroyed)
8905
+ immediate.unref();
8906
+ stream.once("error", onDone);
8907
+ stream.once("close", onDone);
8908
+ cleanup();
8909
+ if (!stream.closed) {
8910
+ stream.destroy();
8911
+ }
8912
+ };
8913
+
8788
8914
  // node_modules/@effect/platform-node-shared/dist/NodeSink.js
8789
8915
  var fromWritable = (options) => fromChannel2(mapDone(fromWritableChannel(options), (_) => [_]));
8790
8916
  var fromWritableChannel = (options) => fromTransform((pull) => {
8791
8917
  const writable = options.evaluate();
8792
- return succeed6(pullIntoWritable({
8918
+ const write = pullIntoWritable({
8793
8919
  ...options,
8794
8920
  writable,
8795
8921
  pull
8796
- }));
8797
- });
8798
- var pullIntoWritable = (options) => options.pull.pipe(flatMap4((chunk) => {
8799
- let i = 0;
8800
- return callback2((resume) => {
8801
- let cancelled = false;
8802
- const loop = () => {
8803
- for (;i < chunk.length; ) {
8804
- if (cancelled) {
8805
- return;
8806
- }
8807
- const success = options.writable.write(chunk[i++], options.encoding);
8808
- if (!success) {
8809
- if (!cancelled) {
8810
- options.writable.once("drain", loop);
8922
+ });
8923
+ return succeed6(options.endOnDone === false ? write : onError2(write, (cause) => isDoneCause(cause) ? void_3 : releaseWritable(writable)));
8924
+ });
8925
+ var releaseWritable = (writable) => callback2((resume) => {
8926
+ const onDestroyed = () => resume(void_3);
8927
+ if (writable.closed) {
8928
+ const cleanup = finished(writable, {
8929
+ readable: false
8930
+ }, () => {
8931
+ cleanup();
8932
+ onDestroyed();
8933
+ });
8934
+ } else {
8935
+ destroyStream(writable, constVoid, onDestroyed);
8936
+ }
8937
+ });
8938
+ var pullIntoWritable = (options) => withFiber2((fiber) => {
8939
+ const dispatcher = fiber.currentDispatcher;
8940
+ const completion = makeUnsafe2();
8941
+ const failure = makeUnsafe2();
8942
+ const onError = (error) => doneUnsafe(failure, failSync2(() => options.onError(error)));
8943
+ let errorEmitted = false;
8944
+ const onStreamError = (error) => {
8945
+ errorEmitted = true;
8946
+ onError(error);
8947
+ };
8948
+ options.writable.on("error", onStreamError);
8949
+ const cleanup = finished(options.writable, {
8950
+ readable: false
8951
+ }, (error) => {
8952
+ if (error) {
8953
+ onError(error);
8954
+ } else {
8955
+ doneUnsafe(completion, void_3);
8956
+ }
8957
+ });
8958
+ return options.pull.pipe(flatMap4((chunk) => {
8959
+ let i = 0;
8960
+ return callback2((resume) => {
8961
+ let cancelled = false;
8962
+ const onFinish = () => dispatcher.scheduleTask(loop, 0);
8963
+ const loop = () => {
8964
+ options.writable.off("drain", loop);
8965
+ options.writable.off("finish", onFinish);
8966
+ for (;i < chunk.length; ) {
8967
+ if (cancelled) {
8968
+ return;
8969
+ }
8970
+ const success = options.writable.write(chunk[i++], options.encoding, (error) => {
8971
+ if (!error)
8972
+ return;
8973
+ if (options.writable.closed) {
8974
+ onError(error);
8975
+ } else {
8976
+ dispatcher.scheduleTask(() => onError(error), 0);
8977
+ }
8978
+ });
8979
+ if (!success) {
8980
+ if (!cancelled) {
8981
+ options.writable.once("drain", loop);
8982
+ options.writable.once("finish", onFinish);
8983
+ }
8984
+ return;
8811
8985
  }
8812
- return;
8813
8986
  }
8814
- }
8815
- if (!cancelled) {
8816
- resume(void_3);
8817
- }
8818
- };
8819
- loop();
8820
- return sync2(() => {
8821
- cancelled = true;
8822
- options.writable.off("drain", loop);
8987
+ if (!cancelled) {
8988
+ resume(void_3);
8989
+ }
8990
+ };
8991
+ loop();
8992
+ return sync2(() => {
8993
+ cancelled = true;
8994
+ options.writable.off("drain", loop);
8995
+ options.writable.off("finish", onFinish);
8996
+ });
8823
8997
  });
8824
- });
8825
- }), forever3({
8826
- disableYield: true
8827
- }), options.endOnDone !== false ? catchDone((_) => {
8828
- if ("closed" in options.writable && options.writable.closed) {
8829
- return done2(_);
8830
- }
8831
- return callback2((resume) => {
8832
- const onFinish = () => resume(done2(_));
8833
- options.writable.once("finish", onFinish);
8998
+ }), forever3({
8999
+ disableYield: true
9000
+ }), options.endOnDone !== false ? catchDone((_) => {
8834
9001
  options.writable.end();
8835
- return sync2(() => {
8836
- options.writable.off("finish", onFinish);
8837
- });
8838
- });
8839
- }) : identity, raceFirst2(callback2((resume) => {
8840
- const onError = (error) => resume(fail6(options.onError(error)));
8841
- options.writable.once("error", onError);
8842
- return sync2(() => {
8843
- options.writable.off("error", onError);
8844
- });
8845
- })));
9002
+ return andThen2(_await(completion), done2(_));
9003
+ }) : identity, raceFirst2(_await(failure)), ensuring2(sync2(() => {
9004
+ cleanup();
9005
+ const removeErrorListener = () => {
9006
+ options.writable.off("error", onStreamError);
9007
+ options.writable.off("error", removeErrorListener);
9008
+ options.writable.off("close", removeErrorListener);
9009
+ };
9010
+ if (options.writable.errored && !options.writable.closed && !errorEmitted) {
9011
+ options.writable.once("error", removeErrorListener);
9012
+ options.writable.once("close", removeErrorListener);
9013
+ } else {
9014
+ removeErrorListener();
9015
+ }
9016
+ })));
9017
+ });
8846
9018
 
8847
9019
  // node_modules/@effect/platform-node-shared/dist/NodeStream.js
9020
+ import { finished as finished2, Readable } from "stream";
8848
9021
  var fromReadable = (options) => fromChannel3(fromReadableChannel(options));
8849
9022
  var fromReadableChannel = (options) => fromTransform((_, scope) => readableToPullUnsafe({
8850
9023
  scope,
@@ -8861,17 +9034,14 @@ var readableToPullUnsafe = (options) => {
8861
9034
  function onReadable() {
8862
9035
  latch.openUnsafe();
8863
9036
  }
8864
- function onError(error) {
8865
- exit.current = fail5(options.onError(error));
8866
- latch.openUnsafe();
8867
- }
8868
- function onEnd() {
8869
- exit.current = fail5(Done2());
8870
- latch.openUnsafe();
8871
- }
8872
9037
  readable.on("readable", onReadable);
8873
- readable.once("error", onError);
8874
- readable.once("end", onEnd);
9038
+ const cleanup = finished2(readable, {
9039
+ readable: true,
9040
+ writable: false
9041
+ }, (error) => {
9042
+ exit.current ??= fail5(error ? options.onError(error) : Done2());
9043
+ latch.openUnsafe();
9044
+ });
8875
9045
  const pull = suspend2(function loop() {
8876
9046
  let item = options.readable.read(options.chunkSize);
8877
9047
  if (item === null) {
@@ -8895,10 +9065,10 @@ var readableToPullUnsafe = (options) => {
8895
9065
  });
8896
9066
  return as2(addFinalizer2(options.scope, sync2(() => {
8897
9067
  readable.off("readable", onReadable);
8898
- readable.off("error", onError);
8899
- readable.off("end", onEnd);
8900
- if (closeOnDone && "closed" in options.readable && !options.readable.closed) {
8901
- options.readable.destroy();
9068
+ if (closeOnDone) {
9069
+ destroyStream(readable, cleanup);
9070
+ } else {
9071
+ cleanup();
8902
9072
  }
8903
9073
  })), pull);
8904
9074
  };
@@ -9223,6 +9393,7 @@ var make17 = /* @__PURE__ */ gen2(function* () {
9223
9393
  const signalGroup = (signal) => killProcessGroup(command, childProcess, signal).pipe(catch_2(() => killProcess(command, childProcess, signal)));
9224
9394
  yield* signalGroup(options?.killSignal ?? "SIGTERM");
9225
9395
  if (isUndefined(options?.forceKillAfter)) {
9396
+ yield* _await(exitSignal);
9226
9397
  yield* awaitProcessExit(childProcess, exitSignal, processGroupGraceMillis);
9227
9398
  } else {
9228
9399
  yield* awaitProcessExit(childProcess, exitSignal, toMillis(options.forceKillAfter));
@@ -9469,10 +9640,14 @@ var ulidString = (timestampMillis, bytes) => {
9469
9640
  };
9470
9641
 
9471
9642
  // node_modules/effect/dist/internal/uuid.js
9472
- var hex = (byte) => byte.toString(16).padStart(2, "0");
9643
+ var hex = /* @__PURE__ */ Array.from({
9644
+ length: 256
9645
+ }, (_, byte) => byte.toString(16).padStart(2, "0"));
9473
9646
  var stringify = (bytes) => {
9474
- const segments = [bytes.subarray(0, 4), bytes.subarray(4, 6), bytes.subarray(6, 8), bytes.subarray(8, 10), bytes.subarray(10, 16)];
9475
- return segments.map((segment) => Array.from(segment, hex).join("")).join("-");
9647
+ if (bytes.length < 16) {
9648
+ return [bytes.subarray(0, 4), bytes.subarray(4, 6), bytes.subarray(6, 8), bytes.subarray(8, 10), bytes.subarray(10, 16)].map((segment) => Array.from(segment, (byte) => hex[byte]).join("")).join("-");
9649
+ }
9650
+ return hex[bytes[0]] + hex[bytes[1]] + hex[bytes[2]] + hex[bytes[3]] + "-" + hex[bytes[4]] + hex[bytes[5]] + "-" + hex[bytes[6]] + hex[bytes[7]] + "-" + hex[bytes[8]] + hex[bytes[9]] + "-" + hex[bytes[10]] + hex[bytes[11]] + hex[bytes[12]] + hex[bytes[13]] + hex[bytes[14]] + hex[bytes[15]];
9476
9651
  };
9477
9652
  var randomBytes = () => globalThis.crypto.getRandomValues(new Uint8Array(16));
9478
9653
  function v4Bytes(bytes = randomBytes()) {
@@ -9933,14 +10108,14 @@ var readLink = /* @__PURE__ */ (() => {
9933
10108
  return (path) => nodeReadLink(path);
9934
10109
  })();
9935
10110
  var realPath = /* @__PURE__ */ (() => {
9936
- const nodeRealPath = /* @__PURE__ */ effectify(NFS.realpath, /* @__PURE__ */ handleErrnoException("FileSystem", "realPath"), /* @__PURE__ */ handleBadArgument("realPath"));
10111
+ const nodeRealPath = /* @__PURE__ */ effectify(process.platform === "win32" ? NFS.realpath.native : NFS.realpath, /* @__PURE__ */ handleErrnoException("FileSystem", "realPath"), /* @__PURE__ */ handleBadArgument("realPath"));
9937
10112
  return (path) => nodeRealPath(path);
9938
10113
  })();
9939
10114
  var rename2 = /* @__PURE__ */ (() => {
9940
10115
  const nodeRename = /* @__PURE__ */ effectify(NFS.rename, /* @__PURE__ */ handleErrnoException("FileSystem", "rename"), /* @__PURE__ */ handleBadArgument("rename"));
9941
10116
  return (oldPath, newPath) => nodeRename(oldPath, newPath);
9942
10117
  })();
9943
- var makeFileInfo = (stat) => try_3({
10118
+ var makeFileInfo = (stat, method = "stat") => try_3({
9944
10119
  try: () => ({
9945
10120
  type: stat.isFile() ? "File" : stat.isDirectory() ? "Directory" : stat.isSymbolicLink() ? "SymbolicLink" : stat.isBlockDevice() ? "BlockDevice" : stat.isCharacterDevice() ? "CharacterDevice" : stat.isFIFO() ? "FIFO" : stat.isSocket() ? "Socket" : "Unknown",
9946
10121
  mtime: fromNullishOr(stat.mtime),
@@ -9957,14 +10132,16 @@ var makeFileInfo = (stat) => try_3({
9957
10132
  blksize: stat.blksize !== undefined ? some2(bytes(stat.blksize)) : none2(),
9958
10133
  blocks: fromNullishOr(stat.blocks)
9959
10134
  }),
9960
- catch: handleBadArgument("stat")
10135
+ catch: handleBadArgument(method)
9961
10136
  });
9962
- var stat2 = /* @__PURE__ */ (() => {
9963
- const nodeStat = /* @__PURE__ */ effectify(NFS.stat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
10137
+ var statFactory = (method, nodeStatFn) => {
10138
+ const nodeStat = effectify(nodeStatFn, handleErrnoException("FileSystem", method), handleBadArgument(method));
9964
10139
  return (path) => flatMap4(nodeStat(path, {
9965
10140
  bigint: true
9966
- }), makeFileInfo);
9967
- })();
10141
+ }), (stat) => makeFileInfo(stat, method));
10142
+ };
10143
+ var stat2 = /* @__PURE__ */ statFactory("stat", NFS.stat);
10144
+ var lstat2 = /* @__PURE__ */ statFactory("lstat", NFS.lstat);
9968
10145
  var symlink2 = /* @__PURE__ */ (() => {
9969
10146
  const nodeSymlink = /* @__PURE__ */ effectify(NFS.symlink, /* @__PURE__ */ handleErrnoException("FileSystem", "symlink"), /* @__PURE__ */ handleBadArgument("symlink"));
9970
10147
  return (target, path) => nodeSymlink(target, path);
@@ -10047,6 +10224,7 @@ var makeFileSystem = /* @__PURE__ */ map7(/* @__PURE__ */ serviceOption2(WatchBa
10047
10224
  copyFile: copyFile2,
10048
10225
  glob: glob2,
10049
10226
  link: link2,
10227
+ lstat: lstat2,
10050
10228
  makeDirectory,
10051
10229
  makeTempDirectory,
10052
10230
  makeTempDirectoryScoped,
@@ -10662,6 +10840,16 @@ var CurrentRedactedNames2 = /* @__PURE__ */ Reference("effect/http/UrlParams/Cur
10662
10840
  // node_modules/effect/dist/internal/schema/interpreter.js
10663
10841
  var flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager2(result, f);
10664
10842
  function compileTransformation(transformation) {
10843
+ const apply = compileTransformationUnsafe(transformation);
10844
+ return (result, current, options) => {
10845
+ try {
10846
+ return apply(result, current, options);
10847
+ } catch (error) {
10848
+ return die3(error);
10849
+ }
10850
+ };
10851
+ }
10852
+ function compileTransformationUnsafe(transformation) {
10665
10853
  if (transformation._tag === "Middleware") {
10666
10854
  return (result, current, options) => {
10667
10855
  const transformed = result === sameExit ? transformation.decode(succeed8(toOption2(current)), options) : transformation.decode(mapEager2(result, toOption2), options);
@@ -10737,53 +10925,57 @@ function compile(ast, compile, compileField, base, specialize) {
10737
10925
  let encodingParsers;
10738
10926
  const parseChecks = (input, options) => {
10739
10927
  let result = parser(input, options);
10740
- if (encodingChecks && !options.disableChecks) {
10741
- if (effectIsExit(result)) {
10742
- if (result._tag === "Success") {
10743
- const output = result === sameExit ? input : result[args];
10744
- if (input !== missing && output !== missing) {
10745
- const issues = collectIssues(encodingChecks, input, undefined, ast, options);
10746
- if (issues) {
10747
- result = fail6(new Composite(ast, issues, input, options));
10928
+ try {
10929
+ if (encodingChecks && !options.disableChecks) {
10930
+ if (effectIsExit(result)) {
10931
+ if (result._tag === "Success") {
10932
+ const output = result === sameExit ? input : result[args];
10933
+ if (input !== missing && output !== missing) {
10934
+ const issues = collectIssues(encodingChecks, input, undefined, ast, options);
10935
+ if (issues) {
10936
+ result = fail6(new Composite(ast, issues, input, options));
10937
+ }
10748
10938
  }
10749
10939
  }
10750
- }
10751
- } else {
10752
- result = flatMap4(result, (value) => {
10753
- if (input !== missing && value !== missing) {
10754
- const issues = collectIssues(encodingChecks, input, undefined, ast, options);
10755
- if (issues) {
10756
- return fail6(new Composite(ast, issues, input, options));
10940
+ } else {
10941
+ result = flatMap4(result, (value) => {
10942
+ if (input !== missing && value !== missing) {
10943
+ const issues = collectIssues(encodingChecks, input, undefined, ast, options);
10944
+ if (issues) {
10945
+ return fail6(new Composite(ast, issues, input, options));
10946
+ }
10757
10947
  }
10758
- }
10759
- return succeed6(value);
10760
- });
10761
- }
10762
- }
10763
- if (checks && !options.disableChecks) {
10764
- if (effectIsExit(result)) {
10765
- if (result._tag === "Success") {
10766
- const value = result === sameExit ? input : result[args];
10767
- if (value === missing)
10768
- return result;
10769
- const issues = collectIssues(checks, value, undefined, ast, options);
10770
- if (issues) {
10771
- result = fail6(new Composite(ast, issues, value, options));
10772
- }
10948
+ return succeed6(value);
10949
+ });
10773
10950
  }
10774
- } else {
10775
- result = flatMap4(result, (value) => {
10776
- if (value !== missing) {
10951
+ }
10952
+ if (checks && !options.disableChecks) {
10953
+ if (effectIsExit(result)) {
10954
+ if (result._tag === "Success") {
10955
+ const value = result === sameExit ? input : result[args];
10956
+ if (value === missing)
10957
+ return result;
10777
10958
  const issues = collectIssues(checks, value, undefined, ast, options);
10778
10959
  if (issues) {
10779
- return fail6(new Composite(ast, issues, value, options));
10960
+ result = fail6(new Composite(ast, issues, value, options));
10780
10961
  }
10781
10962
  }
10782
- return succeed6(value);
10783
- });
10963
+ } else {
10964
+ result = flatMap4(result, (value) => {
10965
+ if (value !== missing) {
10966
+ const issues = collectIssues(checks, value, undefined, ast, options);
10967
+ if (issues) {
10968
+ return fail6(new Composite(ast, issues, value, options));
10969
+ }
10970
+ }
10971
+ return succeed6(value);
10972
+ });
10973
+ }
10784
10974
  }
10975
+ return result;
10976
+ } catch (error) {
10977
+ return die3(error);
10785
10978
  }
10786
- return result;
10787
10979
  };
10788
10980
  const parseLocal = specialize === undefined ? parseChecks : specialize(parseChecks);
10789
10981
  if (!links) {
@@ -11155,6 +11347,14 @@ function toCodecJson(schema) {
11155
11347
  });
11156
11348
  }
11157
11349
  var toCodecJsonAST = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
11350
+ const owner = getContextOwner(ast);
11351
+ if (owner !== ast) {
11352
+ const fromOwner = toCodecJsonAST(owner);
11353
+ if (fromOwner === owner)
11354
+ return ast;
11355
+ if (fromOwner.encoding === undefined)
11356
+ return replaceContext(fromOwner, ast.context);
11357
+ }
11158
11358
  const out = toCodecJsonASTStep(ast, toCodecJsonAST);
11159
11359
  const context = ast.context;
11160
11360
  if (out === ast || context === undefined)
@@ -11298,7 +11498,7 @@ function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
11298
11498
  return ast;
11299
11499
  }
11300
11500
  var nullToString = /* @__PURE__ */ new Link(/* @__PURE__ */ new Literal("null"), /* @__PURE__ */ new Transformation(/* @__PURE__ */ transform(() => null), /* @__PURE__ */ transform(() => "null")));
11301
- var booleanToString = /* @__PURE__ */ new Link(/* @__PURE__ */ new Union([/* @__PURE__ */ new Literal("true"), /* @__PURE__ */ new Literal("false")]), /* @__PURE__ */ new Transformation(/* @__PURE__ */ transform((s) => s === "true"), /* @__PURE__ */ String2()));
11501
+ var booleanToString = /* @__PURE__ */ new Link(/* @__PURE__ */ new Union([/* @__PURE__ */ new Literal("true"), /* @__PURE__ */ new Literal("false")]), /* @__PURE__ */ new Transformation(/* @__PURE__ */ transform((s) => s === "true"), /* @__PURE__ */ String3()));
11302
11502
  var arrayFromSingleTransformation = /* @__PURE__ */ new Transformation(/* @__PURE__ */ transform((input) => typeof input === "string" ? [input] : input), /* @__PURE__ */ passthrough2());
11303
11503
  var isCodecArrayFromSingleLink = (link) => link.transformation === arrayFromSingleTransformation;
11304
11504
  var toCodecStringTreeAST = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
@@ -11321,8 +11521,150 @@ var lambda = (f) => f;
11321
11521
  // node_modules/effect/dist/internal/schemaError.js
11322
11522
  var SchemaErrorTypeId = "~effect/Schema/SchemaError";
11323
11523
 
11524
+ // node_modules/effect/dist/SemVer.js
11525
+ var TypeId29 = "~effect/SemVer";
11526
+ var SemVerErrorTypeId = "~effect/SemVer/SemVerError";
11527
+
11528
+ class SemVerError extends (/* @__PURE__ */ TaggedError2("SemVerError")) {
11529
+ [SemVerErrorTypeId] = SemVerErrorTypeId;
11530
+ }
11531
+ var isSemVerError = (u) => hasProperty(u, SemVerErrorTypeId);
11532
+ var invalid4 = (message) => {
11533
+ throw new SemVerError({
11534
+ message
11535
+ });
11536
+ };
11537
+ var attempt = (evaluate) => try_({
11538
+ try: evaluate,
11539
+ catch: (error) => {
11540
+ if (!isSemVerError(error))
11541
+ throw error;
11542
+ return error;
11543
+ }
11544
+ });
11545
+ var tryParse = (label, input, parse) => mapError(attempt(() => parse(input)), (error) => new SemVerError({
11546
+ message: `Invalid ${label} ${JSON.stringify(input)}: ${error.message}`,
11547
+ input
11548
+ }));
11549
+ var numericPattern = /^(?:0|[1-9]\d*)$/;
11550
+ var digitsPattern = /^\d+$/;
11551
+ var identifierPattern = /^[0-9A-Za-z-]+$/;
11552
+ var checkComponent = (value, label) => {
11553
+ if (!Number.isSafeInteger(value) || value < 0) {
11554
+ return invalid4(`${label} must be a non-negative safe integer, received ${value}`);
11555
+ }
11556
+ return value;
11557
+ };
11558
+ var parseComponent = (value, label) => {
11559
+ if (!numericPattern.test(value)) {
11560
+ return invalid4(`${label} must be a non-negative integer without leading zeros, received ${JSON.stringify(value)}`);
11561
+ }
11562
+ return checkComponent(Number(value), label);
11563
+ };
11564
+ var prereleaseIdentifier = (identifier) => {
11565
+ if (typeof identifier === "number")
11566
+ return checkComponent(identifier, "numeric pre-release identifier");
11567
+ if (!identifierPattern.test(identifier)) {
11568
+ return invalid4(`pre-release identifier must be non-empty [0-9A-Za-z-], received ${JSON.stringify(identifier)}`);
11569
+ }
11570
+ return digitsPattern.test(identifier) ? parseComponent(identifier, "numeric pre-release identifier") : identifier;
11571
+ };
11572
+ var buildIdentifier = (identifier) => {
11573
+ if (!identifierPattern.test(identifier)) {
11574
+ return invalid4(`build identifier must be non-empty [0-9A-Za-z-], received ${JSON.stringify(identifier)}`);
11575
+ }
11576
+ return identifier;
11577
+ };
11578
+ var comparePrerelease = (self, that) => {
11579
+ if (self.length === 0)
11580
+ return that.length === 0 ? 0 : 1;
11581
+ if (that.length === 0)
11582
+ return -1;
11583
+ const length = Math.min(self.length, that.length);
11584
+ for (let i = 0;i < length; i++) {
11585
+ const a = self[i];
11586
+ const b = that[i];
11587
+ if (a === b)
11588
+ continue;
11589
+ if (typeof a === "number")
11590
+ return typeof b === "number" ? Number2(a, b) : -1;
11591
+ if (typeof b === "number")
11592
+ return 1;
11593
+ return String2(a, b);
11594
+ }
11595
+ return Number2(self.length, that.length);
11596
+ };
11597
+ var compareCore = (self, that) => Number2(self.major, that.major) || Number2(self.minor, that.minor) || Number2(self.patch, that.patch) || comparePrerelease(self.prerelease, that.prerelease);
11598
+ var SemVerProto = {
11599
+ [TypeId29]: TypeId29,
11600
+ [symbol2](that) {
11601
+ return isSemVer(that) && Equivalence4(this, that);
11602
+ },
11603
+ [symbol]() {
11604
+ return string(format3(this));
11605
+ },
11606
+ toString() {
11607
+ return `SemVer(${format3(this)})`;
11608
+ },
11609
+ toJSON() {
11610
+ return {
11611
+ _id: "SemVer",
11612
+ value: format3(this)
11613
+ };
11614
+ },
11615
+ [NodeInspectSymbol]() {
11616
+ return this.toJSON();
11617
+ },
11618
+ pipe() {
11619
+ return pipeArguments(this, arguments);
11620
+ }
11621
+ };
11622
+ var unchecked = (major, minor, patch, prerelease, build) => {
11623
+ const self = Object.create(SemVerProto);
11624
+ self.major = major;
11625
+ self.minor = minor;
11626
+ self.patch = patch;
11627
+ self.prerelease = prerelease;
11628
+ self.build = build;
11629
+ return self;
11630
+ };
11631
+ var isSemVer = (u) => hasProperty(u, TypeId29);
11632
+ var parseOrThrow = (input) => {
11633
+ let rest = input;
11634
+ let build = [];
11635
+ const plus = rest.indexOf("+");
11636
+ if (plus !== -1) {
11637
+ build = rest.slice(plus + 1).split(".").map(buildIdentifier);
11638
+ rest = rest.slice(0, plus);
11639
+ }
11640
+ let prerelease = [];
11641
+ const dash = rest.indexOf("-");
11642
+ if (dash !== -1) {
11643
+ prerelease = rest.slice(dash + 1).split(".").map(prereleaseIdentifier);
11644
+ rest = rest.slice(0, dash);
11645
+ }
11646
+ const core = rest.split(".");
11647
+ if (core.length !== 3)
11648
+ return invalid4("expected MAJOR.MINOR.PATCH");
11649
+ return unchecked(parseComponent(core[0], "major"), parseComponent(core[1], "minor"), parseComponent(core[2], "patch"), prerelease, build);
11650
+ };
11651
+ var parse = (input) => tryParse("SemVer", input, parseOrThrow);
11652
+ var parseUnsafe = (input) => getOrThrow(parse(input));
11653
+ var format3 = (self) => {
11654
+ let out = `${self.major}.${self.minor}.${self.patch}`;
11655
+ if (self.prerelease.length > 0)
11656
+ out += `-${self.prerelease.join(".")}`;
11657
+ if (self.build.length > 0)
11658
+ out += `+${self.build.join(".")}`;
11659
+ return out;
11660
+ };
11661
+ var Order = /* @__PURE__ */ make2(compareCore);
11662
+ var identifiersEqual = /* @__PURE__ */ Array_(/* @__PURE__ */ strictEqual());
11663
+ var Equivalence4 = /* @__PURE__ */ make((self, that) => self.major === that.major && self.minor === that.minor && self.patch === that.patch && identifiersEqual(self.prerelease, that.prerelease) && identifiersEqual(self.build, that.build));
11664
+ var isLessThan2 = /* @__PURE__ */ isLessThan(Order);
11665
+
11324
11666
  // node_modules/effect/dist/Schema.js
11325
- var TypeId29 = TypeId28;
11667
+ var TypeId30 = TypeId28;
11326
11668
  function declareConstructor() {
11327
11669
  return (typeParameters, run, annotations) => {
11328
11670
  return make26(new Declaration(typeParameters.map(getAST), (typeParameters) => run(typeParameters.map((ast) => make26(ast))), annotations));
@@ -11380,7 +11722,7 @@ var decodeEffect2 = decodeUnknownEffect2;
11380
11722
  var decodeUnknownOption2 = decodeUnknownOption;
11381
11723
  var make26 = make25;
11382
11724
  function isSchema(u) {
11383
- return hasProperty(u, TypeId29) && u[TypeId29] === TypeId29;
11725
+ return hasProperty(u, TypeId30) && u[TypeId30] === TypeId30;
11384
11726
  }
11385
11727
  var optionalKey2 = /* @__PURE__ */ lambda((schema) => make26(optionalKey(schema.ast), {
11386
11728
  schema
@@ -11406,7 +11748,7 @@ function Literal2(literal) {
11406
11748
  var Unknown2 = /* @__PURE__ */ make26(unknown);
11407
11749
  var Null2 = /* @__PURE__ */ make26(null_);
11408
11750
  var Undefined2 = /* @__PURE__ */ make26(undefined_2);
11409
- var String4 = /* @__PURE__ */ make26(string2);
11751
+ var String5 = /* @__PURE__ */ make26(string2);
11410
11752
  var Number6 = /* @__PURE__ */ make26(number2);
11411
11753
  var Boolean3 = /* @__PURE__ */ make26(boolean);
11412
11754
  function makeStruct(ast, fields) {
@@ -11421,18 +11763,6 @@ function makeStruct(ast, fields) {
11421
11763
  function Struct(fields) {
11422
11764
  return makeStruct(struct(fields, undefined), fields);
11423
11765
  }
11424
- function makeTuple(ast, elements) {
11425
- return make26(ast, {
11426
- elements,
11427
- mapElements(f, options) {
11428
- const elements = f(this.elements);
11429
- return makeTuple(tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements);
11430
- }
11431
- });
11432
- }
11433
- function Tuple2(elements) {
11434
- return makeTuple(tuple(elements), elements);
11435
- }
11436
11766
  var ArraySchema = /* @__PURE__ */ lambda((schema) => make26(new Arrays(false, [], [schema.ast]), {
11437
11767
  value: schema
11438
11768
  }));
@@ -11509,32 +11839,24 @@ function link3() {
11509
11839
  };
11510
11840
  }
11511
11841
  var makeFilter2 = makeFilter;
11512
- function isPattern2(regExp, annotations) {
11513
- const source = regExp.source;
11514
- const flags = regExp.flags;
11515
- const canExport = /^[dg]*uy?$/.test(flags);
11516
- const runtimeRegExp = flags === "" ? `new RegExp(${format(source)})` : `new RegExp(${format(source)}, ${format(flags)})`;
11517
- return isPattern(regExp, {
11518
- toJsonSchema: () => canExport ? {
11519
- pattern: flags.endsWith("y") ? `^(?:${source})` : source
11520
- } : [{}, true],
11521
- toCode: () => ({
11522
- runtime: `Schema.isPattern(${runtimeRegExp})`
11523
- }),
11524
- ...annotations
11525
- });
11526
- }
11527
11842
  function isBase64(annotations) {
11528
- const regExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
11529
- return isPattern2(regExp, {
11843
+ const pattern = "^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$";
11844
+ const regExp = /^[0-9a-zA-Z+/]*={0,2}$/;
11845
+ return makeFilter2((s) => s.length % 4 === 0 && regExp.test(s), {
11530
11846
  expected: "a base64 encoded string",
11531
11847
  representation: {
11532
11848
  id: "effect/schema/isBase64",
11533
11849
  payload: null
11534
11850
  },
11535
11851
  toJsonSchema: () => ({
11536
- pattern: regExp.source
11852
+ pattern
11537
11853
  }),
11854
+ arbitraryConstraint: {
11855
+ patterns: [{
11856
+ source: pattern,
11857
+ flags: ""
11858
+ }]
11859
+ },
11538
11860
  toCode: () => ({
11539
11861
  runtime: "Schema.isBase64()"
11540
11862
  }),
@@ -11605,8 +11927,8 @@ var RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
11605
11927
  }),
11606
11928
  expected: "RegExp",
11607
11929
  toCodecJson: () => link3()(Struct({
11608
- source: String4,
11609
- flags: String4
11930
+ source: String5,
11931
+ flags: String5
11610
11932
  }), transformEffect2({
11611
11933
  decode: (e, options) => try_3({
11612
11934
  try: () => new globalThis.RegExp(e.source, e.flags),
@@ -11620,7 +11942,7 @@ var RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
11620
11942
  })
11621
11943
  }))
11622
11944
  });
11623
- var URLString = /* @__PURE__ */ String4.annotate({
11945
+ var URLString = /* @__PURE__ */ String5.annotate({
11624
11946
  expected: "a string that will be decoded as a URL"
11625
11947
  });
11626
11948
  var URL2 = /* @__PURE__ */ instanceOf(globalThis.URL, {
@@ -11635,7 +11957,7 @@ var URL2 = /* @__PURE__ */ instanceOf(globalThis.URL, {
11635
11957
  expected: "URL",
11636
11958
  toCodecJson: () => link3()(URLString, urlFromString)
11637
11959
  });
11638
- var JsonString = /* @__PURE__ */ String4.annotate({
11960
+ var JsonString = /* @__PURE__ */ String5.annotate({
11639
11961
  expected: "a string that will be decoded as JSON",
11640
11962
  contentMediaType: "application/json"
11641
11963
  });
@@ -11653,9 +11975,9 @@ var File = /* @__PURE__ */ instanceOf(globalThis.File, {
11653
11975
  }),
11654
11976
  expected: "File",
11655
11977
  toCodecJson: () => link3()(Struct({
11656
- data: String4.check(isBase64()),
11657
- type: String4,
11658
- name: String4,
11978
+ data: String5.check(isBase64()),
11979
+ type: String5,
11980
+ name: String5,
11659
11981
  lastModified: Int
11660
11982
  }), transformEffect2({
11661
11983
  decode: (e, options) => match2(decode(e.data), {
@@ -11686,47 +12008,6 @@ var File = /* @__PURE__ */ instanceOf(globalThis.File, {
11686
12008
  })
11687
12009
  }))
11688
12010
  });
11689
- var FormData2 = /* @__PURE__ */ instanceOf(globalThis.FormData, {
11690
- representation: {
11691
- id: "effect/schema/FormData",
11692
- payload: null
11693
- },
11694
- toCode: () => ({
11695
- runtime: `Schema.FormData`,
11696
- Type: `globalThis.FormData`
11697
- }),
11698
- expected: "FormData",
11699
- toCodecJson: () => link3()(ArraySchema(Tuple2([String4, Union2([Struct({
11700
- _tag: tag("String"),
11701
- value: String4
11702
- }), Struct({
11703
- _tag: tag("File"),
11704
- value: File
11705
- })])])), transformEffect2({
11706
- decode: (e) => {
11707
- const out = new globalThis.FormData;
11708
- for (const [key, entry] of e) {
11709
- out.append(key, entry.value);
11710
- }
11711
- return succeed6(out);
11712
- },
11713
- encode: (formData) => {
11714
- return succeed6(globalThis.Array.from(formData.entries()).map(([key, value]) => {
11715
- if (typeof value === "string") {
11716
- return [key, {
11717
- _tag: "String",
11718
- value
11719
- }];
11720
- } else {
11721
- return [key, {
11722
- _tag: "File",
11723
- value
11724
- }];
11725
- }
11726
- }));
11727
- }
11728
- }))
11729
- });
11730
12011
  var URLSearchParams2 = /* @__PURE__ */ instanceOf(globalThis.URLSearchParams, {
11731
12012
  representation: {
11732
12013
  id: "effect/schema/URLSearchParams",
@@ -11737,14 +12018,14 @@ var URLSearchParams2 = /* @__PURE__ */ instanceOf(globalThis.URLSearchParams, {
11737
12018
  Type: `globalThis.URLSearchParams`
11738
12019
  }),
11739
12020
  expected: "URLSearchParams",
11740
- toCodecJson: () => link3()(String4.annotate({
12021
+ toCodecJson: () => link3()(String5.annotate({
11741
12022
  expected: "a query string that will be decoded as URLSearchParams"
11742
12023
  }), transform2({
11743
12024
  decode: (e) => new globalThis.URLSearchParams(e),
11744
12025
  encode: (params) => params.toString()
11745
12026
  }))
11746
12027
  });
11747
- var Base64String = /* @__PURE__ */ String4.annotate({
12028
+ var Base64String = /* @__PURE__ */ String5.annotate({
11748
12029
  expected: "a base64 encoded string that will be decoded as Uint8Array",
11749
12030
  format: "byte",
11750
12031
  contentEncoding: "base64"
@@ -11836,7 +12117,7 @@ function makeClass(Inherited, identifier, struct2, annotations, proto) {
11836
12117
  }
11837
12118
  });
11838
12119
  }
11839
- static [TypeId29] = TypeId29;
12120
+ static [TypeId30] = TypeId30;
11840
12121
  get [ClassTypeId]() {
11841
12122
  return ClassTypeId;
11842
12123
  }
@@ -11892,13 +12173,16 @@ function makeClass(Inherited, identifier, struct2, annotations, proto) {
11892
12173
  }
11893
12174
  return out;
11894
12175
  }
11895
- function getClassTransformation(self) {
11896
- return new Transformation(transform((input) => new self(input, {
12176
+ function makeClassTrusted(self, fields) {
12177
+ return new self(fields, {
11897
12178
  "~payload": {
11898
12179
  token: payloadToken,
11899
- value: input
12180
+ value: fields
11900
12181
  }
11901
- })), passthrough2());
12182
+ });
12183
+ }
12184
+ function getClassTransformation(self) {
12185
+ return new Transformation(transform((input) => makeClassTrusted(self, input)), passthrough2());
11902
12186
  }
11903
12187
  function getClassTypeId(identifier) {
11904
12188
  return `~effect/Schema/Class/${identifier}`;
@@ -11960,7 +12244,7 @@ var Json2 = /* @__PURE__ */ make26(/* @__PURE__ */ annotate(Json, {
11960
12244
  }));
11961
12245
 
11962
12246
  // node_modules/effect/dist/Terminal.js
11963
- var TypeId30 = "~effect/Terminal";
12247
+ var TypeId31 = "~effect/Terminal";
11964
12248
  var QuitErrorTypeId = "~effect/Terminal/QuitError";
11965
12249
 
11966
12250
  class QuitError extends (/* @__PURE__ */ Error4("QuitError")({
@@ -11972,7 +12256,7 @@ var isQuitError = (u) => hasProperty(u, QuitErrorTypeId);
11972
12256
  var Terminal = /* @__PURE__ */ Service("effect/Terminal");
11973
12257
  var make27 = (impl) => Terminal.of({
11974
12258
  ...impl,
11975
- [TypeId30]: TypeId30
12259
+ [TypeId31]: TypeId31
11976
12260
  });
11977
12261
 
11978
12262
  // node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
@@ -12006,9 +12290,6 @@ var make28 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12006
12290
  readline.emitKeypressEvents(stdin, rl);
12007
12291
  rl.on("line", onLine);
12008
12292
  rl.once("close", onClose);
12009
- if (stdin.isTTY) {
12010
- stdin.setRawMode(true);
12011
- }
12012
12293
  return {
12013
12294
  rl,
12014
12295
  onClose,
@@ -12022,9 +12303,6 @@ var make28 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12022
12303
  readlineActive = false;
12023
12304
  rl.off("line", onLine);
12024
12305
  rl.off("close", onClose);
12025
- if (stdin.isTTY) {
12026
- stdin.setRawMode(false);
12027
- }
12028
12306
  rl.close();
12029
12307
  if (inputEnded) {
12030
12308
  endUnsafe(lines);
@@ -12032,6 +12310,14 @@ var make28 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12032
12310
  })),
12033
12311
  idleTimeToLive: "10 millis"
12034
12312
  });
12313
+ const setRawMode = (enabled) => sync2(() => {
12314
+ if (stdin.isTTY)
12315
+ stdin.setRawMode(enabled);
12316
+ });
12317
+ const rawModeRef = yield* make11({
12318
+ acquire: acquireRelease2(setRawMode(true), () => setRawMode(false)),
12319
+ idleTimeToLive: "10 millis"
12320
+ });
12035
12321
  const columns = sync2(() => stdout.columns ?? 0);
12036
12322
  const rows = sync2(() => stdout.rows ?? 0);
12037
12323
  const readInput = gen2(function* () {
@@ -12066,6 +12352,7 @@ var make28 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12066
12352
  handleEnd();
12067
12353
  } else {
12068
12354
  yield* get3(rlRef);
12355
+ yield* get3(rawModeRef);
12069
12356
  stdin.once("end", handleEnd);
12070
12357
  }
12071
12358
  return queue;
@@ -12205,7 +12492,7 @@ function trieNodeAt(root, path) {
12205
12492
  }
12206
12493
 
12207
12494
  // node_modules/effect/dist/Config.js
12208
- var TypeId31 = "~effect/Config";
12495
+ var TypeId32 = "~effect/Config";
12209
12496
  class ConfigError {
12210
12497
  _tag = "ConfigError";
12211
12498
  name = "ConfigError";
@@ -12227,7 +12514,7 @@ var Proto8 = {
12227
12514
  return this.parse(fiber.getRef(ConfigProvider));
12228
12515
  }
12229
12516
  }),
12230
- [TypeId31]: TypeId31,
12517
+ [TypeId32]: TypeId32,
12231
12518
  toJSON() {
12232
12519
  return {
12233
12520
  _id: "Config"
@@ -12304,7 +12591,6 @@ var toConfigCursorAST = /* @__PURE__ */ memoize((root) => {
12304
12591
  seen.add(ast);
12305
12592
  switch (ast._tag) {
12306
12593
  case "Objects": {
12307
- const matchesIndex = ast.indexSignatures.map((is) => _is(is.parameter));
12308
12594
  const materialize = fnUntraced2(function* (cursor) {
12309
12595
  if (cursor.node?._tag !== "Record") {
12310
12596
  return;
@@ -12315,10 +12601,16 @@ var toConfigCursorAST = /* @__PURE__ */ memoize((root) => {
12315
12601
  if (typeof property.name === "string")
12316
12602
  keys.add(property.name);
12317
12603
  }
12318
- if (matchesIndex.length > 0) {
12604
+ if (ast.indexSignatures.length > 0) {
12605
+ const input = {};
12319
12606
  for (const key of node.keys) {
12320
- if (matchesIndex.some((matches) => matches(key)))
12321
- keys.add(key);
12607
+ assignProperty(input, key, undefined);
12608
+ }
12609
+ for (const is of ast.indexSignatures) {
12610
+ for (const key of getIndexSignatureKeys(input, is.parameter)) {
12611
+ if (typeof key === "string")
12612
+ keys.add(key);
12613
+ }
12322
12614
  }
12323
12615
  }
12324
12616
  const out = {};
@@ -12380,11 +12672,11 @@ function schema(codec, path) {
12380
12672
  }))), mapReasons((reason) => isDieReason2(reason) && isSourceError(reason.defect) ? makeFailReason(new ConfigError(reason.defect)).annotate(reasonAnnotations2(reason)) : reason));
12381
12673
  });
12382
12674
  }
12383
- function String5(name) {
12384
- return schema(String4, name);
12675
+ function String6(name) {
12676
+ return schema(String5, name);
12385
12677
  }
12386
12678
  function Redacted2(name) {
12387
- return schema(Redacted(String4), name);
12679
+ return schema(Redacted(String5), name);
12388
12680
  }
12389
12681
  // node_modules/effect/dist/Console.js
12390
12682
  var Console = ConsoleRef;
@@ -12396,9 +12688,9 @@ var log = (...args) => consoleWith((console) => sync(() => {
12396
12688
  console.log(...args);
12397
12689
  }));
12398
12690
  // node_modules/effect/dist/internal/matcher.js
12399
- var TypeId32 = "~effect/Match/Matcher";
12691
+ var TypeId33 = "~effect/Match/Matcher";
12400
12692
  var TypeMatcherProto = {
12401
- [TypeId32]: {
12693
+ [TypeId33]: {
12402
12694
  _input: identity,
12403
12695
  _filters: identity,
12404
12696
  _remaining: identity,
@@ -12421,7 +12713,7 @@ function makeTypeMatcher(select, cases) {
12421
12713
  return matcher;
12422
12714
  }
12423
12715
  var ValueMatcherProto = {
12424
- [TypeId32]: {
12716
+ [TypeId33]: {
12425
12717
  _input: identity,
12426
12718
  _filters: identity,
12427
12719
  _result: identity,
@@ -12516,15 +12808,15 @@ var value4 = value3;
12516
12808
  var tag3 = tag2;
12517
12809
  var exhaustive2 = exhaustive;
12518
12810
  // node_modules/effect/dist/cli/CliError.js
12519
- var TypeId33 = "~effect/cli/CliError";
12520
- var isCliError = (u) => hasProperty(u, TypeId33);
12811
+ var TypeId34 = "~effect/cli/CliError";
12812
+ var isCliError = (u) => hasProperty(u, TypeId34);
12521
12813
 
12522
- class UnrecognizedOption extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/UnrecognizedOption`)("UnrecognizedOption", {
12523
- option: String4,
12524
- command: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String4)),
12525
- suggestions: /* @__PURE__ */ ArraySchema(String4)
12814
+ class UnrecognizedOption extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/UnrecognizedOption`)("UnrecognizedOption", {
12815
+ option: String5,
12816
+ command: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String5)),
12817
+ suggestions: /* @__PURE__ */ ArraySchema(String5)
12526
12818
  })) {
12527
- [TypeId33] = TypeId33;
12819
+ [TypeId34] = TypeId34;
12528
12820
  get message() {
12529
12821
  const suggestionText = this.suggestions.length > 0 ? `
12530
12822
 
@@ -12536,52 +12828,52 @@ class UnrecognizedOption extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/Unre
12536
12828
  }
12537
12829
  }
12538
12830
 
12539
- class DuplicateOption extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/DuplicateOption`)("DuplicateOption", {
12540
- option: String4,
12541
- parentCommand: String4,
12542
- childCommand: String4
12831
+ class DuplicateOption extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/DuplicateOption`)("DuplicateOption", {
12832
+ option: String5,
12833
+ parentCommand: String5,
12834
+ childCommand: String5
12543
12835
  })) {
12544
- [TypeId33] = TypeId33;
12836
+ [TypeId34] = TypeId34;
12545
12837
  get message() {
12546
12838
  return `Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". ` + `Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`;
12547
12839
  }
12548
12840
  }
12549
12841
 
12550
- class MissingOption extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/MissingOption`)("MissingOption", {
12551
- option: String4
12842
+ class MissingOption extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/MissingOption`)("MissingOption", {
12843
+ option: String5
12552
12844
  })) {
12553
- [TypeId33] = TypeId33;
12845
+ [TypeId34] = TypeId34;
12554
12846
  get message() {
12555
12847
  return `Missing required flag: --${this.option}`;
12556
12848
  }
12557
12849
  }
12558
12850
 
12559
- class MissingArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/MissingArgument`)("MissingArgument", {
12560
- argument: String4
12851
+ class MissingArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/MissingArgument`)("MissingArgument", {
12852
+ argument: String5
12561
12853
  })) {
12562
- [TypeId33] = TypeId33;
12854
+ [TypeId34] = TypeId34;
12563
12855
  get message() {
12564
12856
  return `Missing required argument: ${this.argument}`;
12565
12857
  }
12566
12858
  }
12567
12859
 
12568
- class UnexpectedArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/UnexpectedArgument`)("UnexpectedArgument", {
12569
- arguments: /* @__PURE__ */ ArraySchema(String4)
12860
+ class UnexpectedArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/UnexpectedArgument`)("UnexpectedArgument", {
12861
+ arguments: /* @__PURE__ */ ArraySchema(String5)
12570
12862
  })) {
12571
- [TypeId33] = TypeId33;
12863
+ [TypeId34] = TypeId34;
12572
12864
  get message() {
12573
12865
  const label = this.arguments.length === 1 ? "argument" : "arguments";
12574
12866
  return `Unexpected positional ${label}: ${this.arguments.map((value) => JSON.stringify(value)).join(", ")}`;
12575
12867
  }
12576
12868
  }
12577
12869
 
12578
- class InvalidValue2 extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/InvalidValue`)("InvalidValue", {
12579
- option: String4,
12580
- value: String4,
12581
- expected: String4,
12870
+ class InvalidValue2 extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/InvalidValue`)("InvalidValue", {
12871
+ option: String5,
12872
+ value: String5,
12873
+ expected: String5,
12582
12874
  kind: /* @__PURE__ */ Union2([/* @__PURE__ */ Literal2("flag"), /* @__PURE__ */ Literal2("argument")])
12583
12875
  })) {
12584
- [TypeId33] = TypeId33;
12876
+ [TypeId34] = TypeId34;
12585
12877
  get message() {
12586
12878
  const expectation = this.expected.startsWith("Expected ") || this.expected.startsWith("Expected:") ? this.expected : `Expected: ${this.expected}`;
12587
12879
  if (this.kind === "argument") {
@@ -12594,12 +12886,12 @@ class InvalidValue2 extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/InvalidVa
12594
12886
  }
12595
12887
  }
12596
12888
 
12597
- class UnknownSubcommand extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/UnknownSubcommand`)("UnknownSubcommand", {
12598
- subcommand: String4,
12599
- parent: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String4)),
12600
- suggestions: /* @__PURE__ */ ArraySchema(String4)
12889
+ class UnknownSubcommand extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/UnknownSubcommand`)("UnknownSubcommand", {
12890
+ subcommand: String5,
12891
+ parent: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String5)),
12892
+ suggestions: /* @__PURE__ */ ArraySchema(String5)
12601
12893
  })) {
12602
- [TypeId33] = TypeId33;
12894
+ [TypeId34] = TypeId34;
12603
12895
  get message() {
12604
12896
  const suggestionText = this.suggestions.length > 0 ? `
12605
12897
 
@@ -12610,11 +12902,17 @@ class UnknownSubcommand extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/Unkno
12610
12902
  }
12611
12903
  }
12612
12904
 
12613
- class UserError extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/UserError`)("UserError", {
12905
+ class ValidationError extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/ValidationError`)("ValidationError", {
12906
+ message: String5
12907
+ })) {
12908
+ [TypeId34] = TypeId34;
12909
+ }
12910
+
12911
+ class UserError extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/UserError`)("UserError", {
12614
12912
  cause: /* @__PURE__ */ Defect(),
12615
- userMessage: /* @__PURE__ */ optionalKey2(String4)
12913
+ userMessage: /* @__PURE__ */ optionalKey2(String5)
12616
12914
  })) {
12617
- [TypeId33] = TypeId33;
12915
+ [TypeId34] = TypeId34;
12618
12916
  [errorReported] = true;
12619
12917
  get message() {
12620
12918
  if (this.userMessage)
@@ -12626,13 +12924,13 @@ class UserError extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/UserError`)("
12626
12924
  return "An error occurred";
12627
12925
  }
12628
12926
  }
12629
- var NonShowHelpErrors = /* @__PURE__ */ Union2([UnrecognizedOption, DuplicateOption, MissingOption, MissingArgument, UnexpectedArgument, InvalidValue2, UnknownSubcommand, UserError]);
12927
+ var NonShowHelpErrors = /* @__PURE__ */ Union2([UnrecognizedOption, DuplicateOption, MissingOption, MissingArgument, UnexpectedArgument, InvalidValue2, UnknownSubcommand, ValidationError, UserError]);
12630
12928
 
12631
- class ShowHelp extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/ShowHelp`)("ShowHelp", {
12632
- commandPath: /* @__PURE__ */ ArraySchema(String4),
12929
+ class ShowHelp extends (/* @__PURE__ */ TaggedError3(`${TypeId34}/ShowHelp`)("ShowHelp", {
12930
+ commandPath: /* @__PURE__ */ ArraySchema(String5),
12633
12931
  errors: /* @__PURE__ */ ArraySchema(NonShowHelpErrors)
12634
12932
  })) {
12635
- [TypeId33] = TypeId33;
12933
+ [TypeId34] = TypeId34;
12636
12934
  [errorExitCode] = this.errors.length ? 1 : 0;
12637
12935
  [errorReported] = false;
12638
12936
  get message() {
@@ -12641,9 +12939,9 @@ class ShowHelp extends (/* @__PURE__ */ TaggedError3(`${TypeId33}/ShowHelp`)("Sh
12641
12939
  }
12642
12940
 
12643
12941
  // node_modules/effect/dist/cli/Primitive.js
12644
- var TypeId34 = "~effect/cli/Primitive";
12942
+ var TypeId35 = "~effect/cli/Primitive";
12645
12943
  var Proto9 = {
12646
- [TypeId34]: {
12944
+ [TypeId35]: {
12647
12945
  _A: identity
12648
12946
  }
12649
12947
  };
@@ -12660,7 +12958,7 @@ var makeSchemaPrimitive = (tag, schema) => {
12660
12958
  return makePrimitive2(tag, (value) => mapError3(decode(value), (error) => error.message));
12661
12959
  };
12662
12960
  var Boolean4 = /* @__PURE__ */ makeSchemaPrimitive("Boolean", BooleanLiterals);
12663
- var String6 = /* @__PURE__ */ makePrimitive2("String", (value) => succeed6(value));
12961
+ var String7 = /* @__PURE__ */ makePrimitive2("String", (value) => succeed6(value));
12664
12962
  var Choice = (choices) => {
12665
12963
  const choiceMap = new Map(choices);
12666
12964
  const validChoices = choices.map(([key]) => format(key)).join(" | ");
@@ -12778,7 +13076,7 @@ var eraseLines = (rows) => {
12778
13076
  };
12779
13077
 
12780
13078
  // node_modules/effect/dist/cli/Prompt.js
12781
- var TypeId35 = "~effect/cli/Prompt";
13079
+ var TypeId36 = "~effect/cli/Prompt";
12782
13080
  var defaultTheme = {
12783
13081
  prefix: "?",
12784
13082
  arrowUp: "\u2191",
@@ -13003,7 +13301,7 @@ var succeed9 = (value) => {
13003
13301
  op.value = value;
13004
13302
  return op;
13005
13303
  };
13006
- var String7 = (options) => basePrompt(options, "text");
13304
+ var String8 = (options) => basePrompt(options, "text");
13007
13305
  var Toggle = (options) => {
13008
13306
  const opts = {
13009
13307
  initial: false,
@@ -13024,7 +13322,7 @@ var proto = {
13024
13322
  return run3(this);
13025
13323
  }
13026
13324
  }),
13027
- [TypeId35]: {
13325
+ [TypeId36]: {
13028
13326
  _Output: (_) => _
13029
13327
  }
13030
13328
  };
@@ -14435,18 +14733,18 @@ var entriesToDisplay = (cursor, total, maxVisible) => {
14435
14733
  };
14436
14734
 
14437
14735
  // node_modules/effect/dist/cli/Param.js
14438
- var TypeId36 = "~effect/cli/Param";
14736
+ var TypeId37 = "~effect/cli/Param";
14439
14737
  var argumentKind = "argument";
14440
14738
  var flagKind = "flag";
14441
14739
  var Proto10 = {
14442
- [TypeId36]: {
14740
+ [TypeId37]: {
14443
14741
  _A: identity
14444
14742
  },
14445
14743
  pipe() {
14446
14744
  return pipeArguments(this, arguments);
14447
14745
  }
14448
14746
  };
14449
- var isParam = (u) => hasProperty(u, TypeId36);
14747
+ var isParam = (u) => hasProperty(u, TypeId37);
14450
14748
  var isFlagParam = (single) => single.kind === "flag";
14451
14749
  var makeSingle2 = (params) => {
14452
14750
  const parse = (args) => params.kind === argumentKind ? parsePositional(params.name, params.primitiveType, args) : parseFlag(params.name, params.primitiveType, args);
@@ -14459,9 +14757,9 @@ var makeSingle2 = (params) => {
14459
14757
  parse
14460
14758
  }, Proto10);
14461
14759
  };
14462
- var String8 = (kind, name) => makeSingle2({
14760
+ var String9 = (kind, name) => makeSingle2({
14463
14761
  name,
14464
- primitiveType: String6,
14762
+ primitiveType: String7,
14465
14763
  kind
14466
14764
  });
14467
14765
  var Boolean5 = (kind, name) => makeSingle2({
@@ -14712,229 +15010,6 @@ var getParamMetadata = (param) => {
14712
15010
  })
14713
15011
  });
14714
15012
  };
14715
- // node_modules/effect/dist/cli/CliOutput.js
14716
- var Formatter = /* @__PURE__ */ Reference("effect/cli/CliOutput", {
14717
- defaultValue: () => defaultFormatter2()
14718
- });
14719
- var escapeControlCharacters = (text) => text.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, (character) => `\\x${character.charCodeAt(0).toString(16).padStart(2, "0")}`);
14720
- var defaultFormatter2 = (options) => {
14721
- const useColor = options?.colors ?? detectColors();
14722
- const colors = useColor ? {
14723
- bold: (text) => `\x1B[1m${text}\x1B[0m`,
14724
- dim: (text) => `\x1B[2m${text}\x1B[0m`,
14725
- cyan: (text) => `\x1B[36m${text}\x1B[0m`,
14726
- green: (text) => `\x1B[32m${text}\x1B[0m`,
14727
- blue: (text) => `\x1B[34m${text}\x1B[0m`,
14728
- yellow: (text) => `\x1B[33m${text}\x1B[0m`,
14729
- magenta: (text) => `\x1B[35m${text}\x1B[0m`
14730
- } : {
14731
- bold: (text) => text,
14732
- dim: (text) => text,
14733
- cyan: (text) => text,
14734
- green: (text) => text,
14735
- blue: (text) => text,
14736
- yellow: (text) => text,
14737
- magenta: (text) => text
14738
- };
14739
- const reset = useColor ? "\x1B[0m" : "";
14740
- const red = useColor ? "\x1B[31m" : "";
14741
- const bold = useColor ? "\x1B[1m" : "";
14742
- return {
14743
- formatHelpDoc: (doc) => formatHelpDocImpl(doc, colors),
14744
- formatCliError: (error) => escapeControlCharacters(error.message),
14745
- formatError: (error) => {
14746
- return `
14747
- ${bold}${red}ERROR${reset}
14748
- ${escapeControlCharacters(error.message)}${reset}`;
14749
- },
14750
- formatErrors: (errors) => {
14751
- if (errors.length === 0)
14752
- return "";
14753
- if (errors.length === 1) {
14754
- return `
14755
- ${bold}${red}ERROR${reset}
14756
- ${escapeControlCharacters(errors[0].message)}${reset}`;
14757
- }
14758
- const grouped = new Map;
14759
- for (const error of errors) {
14760
- const tag = error._tag ?? "Error";
14761
- const group = grouped.get(tag) ?? [];
14762
- group.push(error);
14763
- grouped.set(tag, group);
14764
- }
14765
- const sections = [];
14766
- sections.push(`
14767
- ${bold}${red}ERRORS${reset}`);
14768
- for (const [, group] of grouped) {
14769
- for (const error of group) {
14770
- sections.push(` ${escapeControlCharacters(error.message)}${reset}`);
14771
- }
14772
- }
14773
- return sections.join(`
14774
- `);
14775
- },
14776
- formatVersion: (name, version) => `${colors.bold(name)} ${colors.dim("v")}${colors.bold(version)}`
14777
- };
14778
- };
14779
- var stripAnsi = (text) => {
14780
- return text.replace(/\u001B\[[0-9;]*m/g, "");
14781
- };
14782
- var graphemeSegmenter = /* @__PURE__ */ new Intl.Segmenter(undefined, {
14783
- granularity: "grapheme"
14784
- });
14785
- var zeroWidthCodePoints = /[\p{Mark}\p{Control}\p{Default_Ignorable_Code_Point}]/gu;
14786
- var emojiPresentation = /\p{Emoji_Presentation}/u;
14787
- var isFullWidthCodePoint = (codePoint) => {
14788
- if (codePoint < 4352)
14789
- return false;
14790
- return codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || codePoint >= 11904 && codePoint <= 12350 || codePoint >= 12352 && codePoint <= 42191 || codePoint >= 44032 && codePoint <= 55203 || codePoint >= 63744 && codePoint <= 64255 || codePoint >= 65040 && codePoint <= 65049 || codePoint >= 65072 && codePoint <= 65135 || codePoint >= 65280 && codePoint <= 65376 || codePoint >= 65504 && codePoint <= 65510 || codePoint >= 110592 && codePoint <= 111359 || codePoint >= 127488 && codePoint <= 127569 || codePoint >= 131072 && codePoint <= 262141;
14791
- };
14792
- var graphemeWidth = (grapheme) => {
14793
- const visible = grapheme.replace(zeroWidthCodePoints, "");
14794
- if (visible.length === 0)
14795
- return 0;
14796
- if (emojiPresentation.test(grapheme) || grapheme.includes("\uFE0F"))
14797
- return 2;
14798
- return isFullWidthCodePoint(visible.codePointAt(0)) ? 2 : 1;
14799
- };
14800
- var displayWidth = (text) => {
14801
- let length = 0;
14802
- for (const {
14803
- segment
14804
- } of graphemeSegmenter.segment(stripAnsi(text))) {
14805
- length += graphemeWidth(segment);
14806
- }
14807
- return length;
14808
- };
14809
- var pad = (s, width) => {
14810
- const actualLength = displayWidth(s);
14811
- const padding = Math.max(0, width - actualLength);
14812
- return s + " ".repeat(padding);
14813
- };
14814
- var renderTable = (rows, widthCap) => {
14815
- const maxColumn = Math.max(...rows.map((r) => displayWidth(r.left))) + 4;
14816
- const col = widthCap === undefined ? maxColumn : Math.min(maxColumn, widthCap);
14817
- return rows.map(({
14818
- left,
14819
- right
14820
- }) => ` ${pad(left, Math.max(col, displayWidth(left) + 1))}${right}`).join(`
14821
- `);
14822
- };
14823
- var formatSubcommandName = (name, alias) => alias ? `${name}, ${alias}` : name;
14824
- var formatHelpDocImpl = (doc, colors) => {
14825
- const sections = [];
14826
- if (doc.description) {
14827
- sections.push(colors.bold("DESCRIPTION"));
14828
- sections.push(` ${doc.description}`);
14829
- sections.push("");
14830
- }
14831
- sections.push(colors.bold("USAGE"));
14832
- sections.push(` ${colors.cyan(doc.usage)}`);
14833
- sections.push("");
14834
- if (doc.args && doc.args.length > 0) {
14835
- sections.push(colors.bold("ARGUMENTS"));
14836
- const argRows = doc.args.map((arg) => {
14837
- let name = arg.name;
14838
- if (arg.variadic) {
14839
- name += "...";
14840
- }
14841
- const coloredName = colors.green(name);
14842
- const coloredType = colors.dim(arg.type);
14843
- const nameType = `${coloredName} ${coloredType}`;
14844
- const optionalSuffix = arg.required ? "" : colors.dim(" (optional)");
14845
- const description = getOrElse(arg.description, () => "") + optionalSuffix;
14846
- return {
14847
- left: nameType,
14848
- right: description
14849
- };
14850
- });
14851
- sections.push(renderTable(argRows, 25));
14852
- sections.push("");
14853
- }
14854
- if (doc.flags.length > 0) {
14855
- sections.push(colors.bold("FLAGS"));
14856
- const flagRows = doc.flags.map((flag) => {
14857
- const names = [];
14858
- names.push(colors.green(`--${flag.name}`));
14859
- for (const alias of flag.aliases) {
14860
- names.push(colors.green(alias));
14861
- }
14862
- const namesPart = names.join(", ");
14863
- const typePart = flag.type !== "boolean" ? ` ${colors.dim(flag.type)}` : "";
14864
- return {
14865
- left: namesPart + typePart,
14866
- right: getOrElse(flag.description, () => "")
14867
- };
14868
- });
14869
- sections.push(renderTable(flagRows));
14870
- sections.push("");
14871
- }
14872
- if (doc.globalFlags && doc.globalFlags.length > 0) {
14873
- sections.push(colors.bold("GLOBAL FLAGS"));
14874
- const globalFlagRows = doc.globalFlags.map((flag) => {
14875
- const names = [];
14876
- names.push(colors.green(`--${flag.name}`));
14877
- for (const alias of flag.aliases) {
14878
- names.push(colors.green(alias));
14879
- }
14880
- const namesPart = names.join(", ");
14881
- const typePart = flag.type !== "boolean" ? ` ${colors.dim(flag.type)}` : "";
14882
- return {
14883
- left: namesPart + typePart,
14884
- right: getOrElse(flag.description, () => "")
14885
- };
14886
- });
14887
- sections.push(renderTable(globalFlagRows));
14888
- sections.push("");
14889
- }
14890
- if (doc.subcommands && doc.subcommands.length > 0) {
14891
- const ungrouped = doc.subcommands.find((group) => group.group === undefined);
14892
- if (ungrouped) {
14893
- sections.push(colors.bold("SUBCOMMANDS"));
14894
- sections.push(renderTable(ungrouped.commands.map((sub) => ({
14895
- left: colors.cyan(formatSubcommandName(sub.name, sub.alias)),
14896
- right: sub.shortDescription ?? sub.description
14897
- })), 20));
14898
- if (doc.subcommands.length > 1) {
14899
- sections.push("");
14900
- }
14901
- }
14902
- for (const group of doc.subcommands) {
14903
- if (group.group === undefined)
14904
- continue;
14905
- sections.push(colors.bold(`${group.group}:`));
14906
- sections.push(renderTable(group.commands.map((sub) => ({
14907
- left: colors.cyan(formatSubcommandName(sub.name, sub.alias)),
14908
- right: sub.shortDescription ?? sub.description
14909
- })), 20));
14910
- sections.push("");
14911
- }
14912
- }
14913
- if (doc.examples && doc.examples.length > 0) {
14914
- sections.push(colors.bold("EXAMPLES"));
14915
- let first = true;
14916
- let previousHadDescription = false;
14917
- for (const example of doc.examples) {
14918
- if (example.description) {
14919
- if (!first)
14920
- sections.push("");
14921
- sections.push(` ${colors.dim(`# ${example.description}`)}`);
14922
- } else if (previousHadDescription) {
14923
- sections.push("");
14924
- }
14925
- sections.push(` ${colors.cyan(example.command)}`);
14926
- first = false;
14927
- previousHadDescription = !!example.description;
14928
- }
14929
- sections.push("");
14930
- }
14931
- if (sections[sections.length - 1] === "") {
14932
- sections.pop();
14933
- }
14934
- return sections.join(`
14935
- `);
14936
- };
14937
-
14938
15013
  // node_modules/effect/dist/cli/internal/config.js
14939
15014
  var ConfigInternalTypeId = "~effect/cli/Command/Config/Internal";
14940
15015
  var parseConfig = (config) => {
@@ -15001,7 +15076,7 @@ var reconstructTree = (tree, results) => {
15001
15076
  };
15002
15077
 
15003
15078
  // node_modules/effect/dist/cli/internal/command.js
15004
- var TypeId37 = "~effect/cli/Command";
15079
+ var TypeId38 = "~effect/cli/Command";
15005
15080
  var toImpl = (self) => self;
15006
15081
  var Proto11 = {
15007
15082
  .../* @__PURE__ */ Prototype2({
@@ -15014,10 +15089,11 @@ var Proto11 = {
15014
15089
  var makeCommand = (options) => {
15015
15090
  const config = options.config;
15016
15091
  const contextConfig = options.contextConfig ?? emptyConfig;
15017
- const service = options.service ?? Service(`${TypeId37}/${options.name}`);
15092
+ const service = options.service ?? Service(`${TypeId38}/${options.name}`);
15018
15093
  const annotations = options.annotations ?? empty();
15019
15094
  const globalFlags = options.globalFlags ?? [];
15020
15095
  const subcommands = options.subcommands ?? [];
15096
+ const resolveExamples = options.resolveExamples ?? noExamples;
15021
15097
  const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail6(new ShowHelp({
15022
15098
  commandPath,
15023
15099
  errors: []
@@ -15075,7 +15151,7 @@ var makeCommand = (options) => {
15075
15151
  }))
15076
15152
  });
15077
15153
  }
15078
- const examples = options.examples ?? [];
15154
+ const examples = resolveExamples(commandPath);
15079
15155
  return {
15080
15156
  description: options.description ?? "",
15081
15157
  usage,
@@ -15093,9 +15169,10 @@ var makeCommand = (options) => {
15093
15169
  };
15094
15170
  };
15095
15171
  return Object.assign(Object.create(Proto11), {
15096
- [TypeId37]: TypeId37,
15172
+ [TypeId38]: TypeId38,
15097
15173
  name: options.name,
15098
- examples: options.examples ?? [],
15174
+ examples: resolveExamples([options.name]),
15175
+ resolveExamples,
15099
15176
  annotations,
15100
15177
  globalFlags,
15101
15178
  subcommands,
@@ -15118,6 +15195,7 @@ var makeCommand = (options) => {
15118
15195
  } : {}
15119
15196
  });
15120
15197
  };
15198
+ var noExamples = () => [];
15121
15199
  var toFlagDoc = (single, metadata) => {
15122
15200
  const formattedAliases = single.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`);
15123
15201
  const type = single.typeName ?? getTypeName(single.primitiveType);
@@ -15299,7 +15377,8 @@ var fromCommand = (cmd, inheritedFlags = []) => {
15299
15377
  aliases: single.aliases,
15300
15378
  description: getOrUndefined(single.description),
15301
15379
  type: toFlagType(single),
15302
- optionalValue: single.optionalValue !== undefined
15380
+ optionalValue: single.optionalValue !== undefined,
15381
+ negation: single.negation
15303
15382
  });
15304
15383
  }
15305
15384
  }
@@ -15344,6 +15423,7 @@ var fromCommand = (cmd, inheritedFlags = []) => {
15344
15423
  };
15345
15424
  };
15346
15425
  var takesSeparateValue = (flag) => flag.type._tag !== "Boolean" && flag.optionalValue !== true;
15426
+ var negatedName = (flag) => flag.type._tag !== "Boolean" || flag.negation === false ? undefined : flag.negation ?? `no-${flag.name}`;
15347
15427
 
15348
15428
  // node_modules/effect/dist/cli/internal/completions/bash.js
15349
15429
  var escapeForBash = (s) => s.replace(/'/g, "'\\''");
@@ -15353,8 +15433,9 @@ var flagNamesForWordlist = (flag) => {
15353
15433
  for (const alias of flag.aliases) {
15354
15434
  names.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
15355
15435
  }
15356
- if (flag.type._tag === "Boolean") {
15357
- names.push(`--no-${flag.name}`);
15436
+ const negation = negatedName(flag);
15437
+ if (negation !== undefined) {
15438
+ names.push(`--${negation}`);
15358
15439
  }
15359
15440
  return names;
15360
15441
  };
@@ -15663,8 +15744,9 @@ var flagContainsOptCondition = (flag) => {
15663
15744
  optArgs.push(alias);
15664
15745
  }
15665
15746
  }
15666
- if (flag.type._tag === "Boolean") {
15667
- optArgs.push(`no-${flag.name}`);
15747
+ const negation = negatedName(flag);
15748
+ if (negation !== undefined) {
15749
+ optArgs.push(negation);
15668
15750
  }
15669
15751
  return `not __fish_contains_opt ${optArgs.join(" ")}`;
15670
15752
  };
@@ -15748,11 +15830,12 @@ var generateCompletions = (executableName, descriptor, parentPath, lines) => {
15748
15830
  parts.push(flagCondArg);
15749
15831
  parts.push(...flagCompletionArgs(flag));
15750
15832
  lines.push(parts.join(" "));
15751
- if (flag.type._tag === "Boolean") {
15833
+ const negation = negatedName(flag);
15834
+ if (negation !== undefined) {
15752
15835
  const negParts = [`complete -c ${executableName}`];
15753
15836
  if (flagCondArg)
15754
15837
  negParts.push(flagCondArg);
15755
- negParts.push(`-l no-${flag.name}`);
15838
+ negParts.push(`-l ${negation}`);
15756
15839
  if (flag.description) {
15757
15840
  negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);
15758
15841
  }
@@ -15764,7 +15847,7 @@ var generateCompletions = (executableName, descriptor, parentPath, lines) => {
15764
15847
  const bareBase = condition ? `${condition}; and ${notDash}` : notDash;
15765
15848
  for (const flag of descriptor.flags) {
15766
15849
  const bareCondition = `${bareBase}; and ${flagContainsOptCondition(flag)}`;
15767
- const isBoolean = flag.type._tag === "Boolean";
15850
+ const negation = negatedName(flag);
15768
15851
  const parts = [`complete -c ${executableName}`];
15769
15852
  parts.push(`-n '${bareCondition}'`);
15770
15853
  parts.push(`-f -a '--${flag.name}'`);
@@ -15772,10 +15855,10 @@ var generateCompletions = (executableName, descriptor, parentPath, lines) => {
15772
15855
  parts.push(`-d '${escapeFishString(flag.description)}'`);
15773
15856
  }
15774
15857
  lines.push(parts.join(" "));
15775
- if (isBoolean) {
15858
+ if (negation !== undefined) {
15776
15859
  const negParts = [`complete -c ${executableName}`];
15777
15860
  negParts.push(`-n '${bareCondition}'`);
15778
- negParts.push(`-f -a '--no-${flag.name}'`);
15861
+ negParts.push(`-f -a '--${negation}'`);
15779
15862
  if (flag.description) {
15780
15863
  negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);
15781
15864
  }
@@ -15841,7 +15924,10 @@ var psOptional = (s) => s ? quotePs(s) : "$null";
15841
15924
  var sanitize = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
15842
15925
  var flagForms = (flag) => [`--${flag.name}`, ...flag.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`)];
15843
15926
  var valueFields = (type) => `values = ${psArray(type._tag === "Choice" ? type.values : [])}; ` + `pathType = ${type._tag === "Path" ? quotePs(type.pathType) : "$null"}`;
15844
- var flagEntry = (flag) => `@{ name = ${quotePs(flag.name)}; forms = ${psArray(flagForms(flag))}; ` + `takesValue = $${flag.type._tag !== "Boolean"}; ` + (flag.optionalValue === true ? `optionalValue = $true; ` : "") + `${valueFields(flag.type)}; ` + `description = ${psOptional(flag.description)} }`;
15927
+ var flagEntry = (flag) => {
15928
+ const negation = negatedName(flag);
15929
+ return `@{ name = ${quotePs(flag.name)}; forms = ${psArray(flagForms(flag))}; ` + `takesValue = $${flag.type._tag !== "Boolean"}; ` + (negation === undefined ? "" : `negation = ${quotePs(`--${negation}`)}; `) + (flag.optionalValue === true ? `optionalValue = $true; ` : "") + `${valueFields(flag.type)}; ` + `description = ${psOptional(flag.description)} }`;
15930
+ };
15845
15931
  var argumentEntry = (argument) => `@{ name = ${quotePs(argument.name)}; variadic = $${argument.variadic}; ${valueFields(argument.type)}; ` + `description = ${psOptional(argument.description)} }`;
15846
15932
  var pushList = (lines, field, entries) => {
15847
15933
  if (entries.length === 0) {
@@ -15916,10 +16002,10 @@ var completer = (dataName) => String.raw` param($wordToComplete, $commandAst, $
15916
16002
  foreach ($form in $flag.forms) {
15917
16003
  & $add $form 'ParameterName' $flag.description $typed ''
15918
16004
  }
15919
- if (-not $flag.takesValue) {
16005
+ if ($flag.negation) {
15920
16006
  $tooltip = $null
15921
16007
  if ($flag.description) { $tooltip = 'Disable ' + $flag.name }
15922
- & $add ('--no-' + $flag.name) 'ParameterName' $tooltip $typed ''
16008
+ & $add $flag.negation 'ParameterName' $tooltip $typed ''
15923
16009
  }
15924
16010
  }
15925
16011
  }
@@ -15990,14 +16076,19 @@ var completer = (dataName) => String.raw` param($wordToComplete, $commandAst, $
15990
16076
  foreach ($form in $forms) {
15991
16077
  $pending = $null
15992
16078
  $flag = $lookup[$form]
15993
- if ($null -eq $flag) {
15994
- if ($form.StartsWith('--no-')) {
15995
- $name = $form.Substring(5)
15996
- $flag = $lookup['--' + $name]
15997
- if ($null -ne $flag -and -not $flag.takesValue -and $flag.name -ceq $name) { $used[$name] = $true }
16079
+ # As in the CLI parser, a negation wins over an alias but not over a
16080
+ # canonical name.
16081
+ if ($null -eq $flag -or $form -cne ('--' + $flag.name)) {
16082
+ $negated = $null
16083
+ foreach ($candidate in $context.flags) {
16084
+ if ($candidate.negation -ceq $form) { $negated = $candidate }
16085
+ }
16086
+ if ($null -ne $negated) {
16087
+ $used[$negated.name] = $true
16088
+ continue
15998
16089
  }
15999
- continue
16000
16090
  }
16091
+ if ($null -eq $flag) { continue }
16001
16092
  $used[$flag.name] = $true
16002
16093
  # A flag with an optional value only takes a value attached with '='.
16003
16094
  if (-not $hasValue -and -not $flag.optionalValue) { $pending = $flag }
@@ -16088,8 +16179,9 @@ var allForms = (flag) => {
16088
16179
  for (const alias of flag.aliases) {
16089
16180
  forms.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
16090
16181
  }
16091
- if (flag.type._tag === "Boolean") {
16092
- forms.push(`--no-${flag.name}`);
16182
+ const negation = negatedName(flag);
16183
+ if (negation !== undefined) {
16184
+ forms.push(`--${negation}`);
16093
16185
  }
16094
16186
  return forms;
16095
16187
  };
@@ -16133,9 +16225,10 @@ var flagSpecs = (flag) => {
16133
16225
  const prefix = alias.length === 1 ? "-" : "--";
16134
16226
  specs.push(`'${excl}${prefix}${alias}${valueSuffix}${desc}${action}'`);
16135
16227
  }
16136
- if (flag.type._tag === "Boolean") {
16228
+ const negation = negatedName(flag);
16229
+ if (negation !== undefined) {
16137
16230
  const negDesc = flag.description ? `[${escapeZshExplanation(`Disable ${flag.name}`)}]` : "";
16138
- specs.push(`'${excl}--no-${flag.name}${negDesc}'`);
16231
+ specs.push(`'${excl}--${negation}${negDesc}'`);
16139
16232
  }
16140
16233
  return specs;
16141
16234
  };
@@ -16262,7 +16355,7 @@ var generate5 = (executableName, shell, descriptor) => {
16262
16355
  };
16263
16356
 
16264
16357
  // node_modules/effect/dist/cli/Flag.js
16265
- var String9 = (name) => String8(flagKind, name);
16358
+ var String10 = (name) => String9(flagKind, name);
16266
16359
  var Boolean6 = (name) => Boolean5(flagKind, name);
16267
16360
  var ChoiceWithValue2 = (name, choices) => ChoiceWithValue(flagKind, name, choices);
16268
16361
  var withAlias2 = /* @__PURE__ */ dual(2, (self, alias) => withAlias(self, alias));
@@ -16271,33 +16364,292 @@ var withMetavar2 = /* @__PURE__ */ dual(2, (self, metavar) => withMetavar(self,
16271
16364
  var optional4 = (param) => optional3(param);
16272
16365
  var withDefault5 = withDefault4;
16273
16366
 
16274
- // node_modules/effect/dist/cli/internal/help.js
16275
- var dedupeGlobalFlags = (flags) => {
16276
- const seen = new Set;
16277
- const deduped = [];
16278
- for (const flag of flags) {
16279
- if (seen.has(flag)) {
16280
- continue;
16281
- }
16282
- seen.add(flag);
16283
- deduped.push(flag);
16284
- }
16285
- return deduped;
16286
- };
16287
- var getCommandsForCommandPath = (command, commandPath) => {
16288
- const commands = [command];
16289
- let currentCommand = command;
16290
- for (let i = 1;i < commandPath.length; i++) {
16291
- const subcommandName = commandPath[i];
16292
- let subcommand = undefined;
16293
- for (const group of currentCommand.subcommands) {
16294
- subcommand = group.commands.find((sub) => sub.name === subcommandName);
16295
- if (subcommand) {
16296
- break;
16297
- }
16298
- }
16299
- if (!subcommand) {
16300
- break;
16367
+ // node_modules/effect/dist/cli/CliOutput.js
16368
+ var Formatter = /* @__PURE__ */ Reference("effect/cli/CliOutput", {
16369
+ defaultValue: () => defaultFormatter2()
16370
+ });
16371
+ var escapeControlCharacters = (text) => text.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, (character) => `\\x${character.charCodeAt(0).toString(16).padStart(2, "0")}`);
16372
+ var defaultFormatter2 = (options) => {
16373
+ const useColor = options?.colors ?? detectColors();
16374
+ const colors = useColor ? {
16375
+ bold: (text) => `\x1B[1m${text}\x1B[0m`,
16376
+ dim: (text) => `\x1B[2m${text}\x1B[0m`,
16377
+ cyan: (text) => `\x1B[36m${text}\x1B[0m`,
16378
+ green: (text) => `\x1B[32m${text}\x1B[0m`,
16379
+ blue: (text) => `\x1B[34m${text}\x1B[0m`,
16380
+ yellow: (text) => `\x1B[33m${text}\x1B[0m`,
16381
+ magenta: (text) => `\x1B[35m${text}\x1B[0m`
16382
+ } : {
16383
+ bold: (text) => text,
16384
+ dim: (text) => text,
16385
+ cyan: (text) => text,
16386
+ green: (text) => text,
16387
+ blue: (text) => text,
16388
+ yellow: (text) => text,
16389
+ magenta: (text) => text
16390
+ };
16391
+ const reset = useColor ? "\x1B[0m" : "";
16392
+ const red = useColor ? "\x1B[31m" : "";
16393
+ const bold = useColor ? "\x1B[1m" : "";
16394
+ return {
16395
+ formatHelpDoc: (doc) => formatHelpDocImpl(doc, colors),
16396
+ formatCliError: (error) => escapeControlCharacters(error.message),
16397
+ formatError: (error) => {
16398
+ return `
16399
+ ${bold}${red}ERROR${reset}
16400
+ ${escapeControlCharacters(error.message)}${reset}`;
16401
+ },
16402
+ formatErrors: (errors) => {
16403
+ if (errors.length === 0)
16404
+ return "";
16405
+ if (errors.length === 1) {
16406
+ return `
16407
+ ${bold}${red}ERROR${reset}
16408
+ ${escapeControlCharacters(errors[0].message)}${reset}`;
16409
+ }
16410
+ const grouped = new Map;
16411
+ for (const error of errors) {
16412
+ const tag = error._tag ?? "Error";
16413
+ const group = grouped.get(tag) ?? [];
16414
+ group.push(error);
16415
+ grouped.set(tag, group);
16416
+ }
16417
+ const sections = [];
16418
+ sections.push(`
16419
+ ${bold}${red}ERRORS${reset}`);
16420
+ for (const [, group] of grouped) {
16421
+ for (const error of group) {
16422
+ sections.push(` ${escapeControlCharacters(error.message)}${reset}`);
16423
+ }
16424
+ }
16425
+ return sections.join(`
16426
+ `);
16427
+ },
16428
+ formatVersion: (name, version) => `${colors.bold(name)} ${colors.dim("v")}${colors.bold(version)}`
16429
+ };
16430
+ };
16431
+ var stripAnsi = (text) => {
16432
+ return text.replace(/\u001B\[[0-9;]*m/g, "");
16433
+ };
16434
+ var graphemeSegmenter = /* @__PURE__ */ new Intl.Segmenter(undefined, {
16435
+ granularity: "grapheme"
16436
+ });
16437
+ var zeroWidthCodePoints = /[\p{Mark}\p{Control}\p{Default_Ignorable_Code_Point}]/gu;
16438
+ var emojiPresentation = /\p{Emoji_Presentation}/u;
16439
+ var isFullWidthCodePoint = (codePoint) => {
16440
+ if (codePoint < 4352)
16441
+ return false;
16442
+ return codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || codePoint >= 11904 && codePoint <= 12350 || codePoint >= 12352 && codePoint <= 42191 || codePoint >= 44032 && codePoint <= 55203 || codePoint >= 63744 && codePoint <= 64255 || codePoint >= 65040 && codePoint <= 65049 || codePoint >= 65072 && codePoint <= 65135 || codePoint >= 65280 && codePoint <= 65376 || codePoint >= 65504 && codePoint <= 65510 || codePoint >= 110592 && codePoint <= 111359 || codePoint >= 127488 && codePoint <= 127569 || codePoint >= 131072 && codePoint <= 262141;
16443
+ };
16444
+ var graphemeWidth = (grapheme) => {
16445
+ const visible = grapheme.replace(zeroWidthCodePoints, "");
16446
+ if (visible.length === 0)
16447
+ return 0;
16448
+ if (emojiPresentation.test(grapheme) || grapheme.includes("\uFE0F"))
16449
+ return 2;
16450
+ return isFullWidthCodePoint(visible.codePointAt(0)) ? 2 : 1;
16451
+ };
16452
+ var displayWidth = (text) => {
16453
+ let length = 0;
16454
+ for (const {
16455
+ segment
16456
+ } of graphemeSegmenter.segment(stripAnsi(text))) {
16457
+ length += graphemeWidth(segment);
16458
+ }
16459
+ return length;
16460
+ };
16461
+ var pad = (s, width) => {
16462
+ const actualLength = displayWidth(s);
16463
+ const padding = Math.max(0, width - actualLength);
16464
+ return s + " ".repeat(padding);
16465
+ };
16466
+ var renderTable = (rows, widthCap) => {
16467
+ const maxColumn = Math.max(...rows.map((r) => displayWidth(r.left))) + 4;
16468
+ const col = widthCap === undefined ? maxColumn : Math.min(maxColumn, widthCap);
16469
+ return rows.map(({
16470
+ left,
16471
+ right
16472
+ }) => ` ${pad(left, Math.max(col, displayWidth(left) + 1))}${right}`).join(`
16473
+ `);
16474
+ };
16475
+ var formatSubcommandName = (name, alias) => alias ? `${name}, ${alias}` : name;
16476
+ var formatHelpDocImpl = (doc, colors) => {
16477
+ const sections = [];
16478
+ if (doc.description) {
16479
+ sections.push(colors.bold("DESCRIPTION"));
16480
+ sections.push(` ${doc.description}`);
16481
+ sections.push("");
16482
+ }
16483
+ sections.push(colors.bold("USAGE"));
16484
+ sections.push(` ${colors.cyan(doc.usage)}`);
16485
+ sections.push("");
16486
+ if (doc.args && doc.args.length > 0) {
16487
+ sections.push(colors.bold("ARGUMENTS"));
16488
+ const argRows = doc.args.map((arg) => {
16489
+ let name = arg.name;
16490
+ if (arg.variadic) {
16491
+ name += "...";
16492
+ }
16493
+ const coloredName = colors.green(name);
16494
+ const coloredType = colors.dim(arg.type);
16495
+ const nameType = `${coloredName} ${coloredType}`;
16496
+ const optionalSuffix = arg.required ? "" : colors.dim(" (optional)");
16497
+ const description = getOrElse(arg.description, () => "") + optionalSuffix;
16498
+ return {
16499
+ left: nameType,
16500
+ right: description
16501
+ };
16502
+ });
16503
+ sections.push(renderTable(argRows, 25));
16504
+ sections.push("");
16505
+ }
16506
+ if (doc.flags.length > 0) {
16507
+ sections.push(colors.bold("FLAGS"));
16508
+ const flagRows = doc.flags.map((flag) => {
16509
+ const names = [];
16510
+ names.push(colors.green(`--${flag.name}`));
16511
+ for (const alias of flag.aliases) {
16512
+ names.push(colors.green(alias));
16513
+ }
16514
+ const namesPart = names.join(", ");
16515
+ const typePart = flag.type !== "boolean" ? ` ${colors.dim(flag.type)}` : "";
16516
+ return {
16517
+ left: namesPart + typePart,
16518
+ right: getOrElse(flag.description, () => "")
16519
+ };
16520
+ });
16521
+ sections.push(renderTable(flagRows));
16522
+ sections.push("");
16523
+ }
16524
+ if (doc.globalFlags && doc.globalFlags.length > 0) {
16525
+ sections.push(colors.bold("GLOBAL FLAGS"));
16526
+ const globalFlagRows = doc.globalFlags.map((flag) => {
16527
+ const names = [];
16528
+ names.push(colors.green(`--${flag.name}`));
16529
+ for (const alias of flag.aliases) {
16530
+ names.push(colors.green(alias));
16531
+ }
16532
+ const namesPart = names.join(", ");
16533
+ const typePart = flag.type !== "boolean" ? ` ${colors.dim(flag.type)}` : "";
16534
+ return {
16535
+ left: namesPart + typePart,
16536
+ right: getOrElse(flag.description, () => "")
16537
+ };
16538
+ });
16539
+ sections.push(renderTable(globalFlagRows));
16540
+ sections.push("");
16541
+ }
16542
+ if (doc.subcommands && doc.subcommands.length > 0) {
16543
+ const ungrouped = doc.subcommands.find((group) => group.group === undefined);
16544
+ if (ungrouped) {
16545
+ sections.push(colors.bold("SUBCOMMANDS"));
16546
+ sections.push(renderTable(ungrouped.commands.map((sub) => ({
16547
+ left: colors.cyan(formatSubcommandName(sub.name, sub.alias)),
16548
+ right: sub.shortDescription ?? sub.description
16549
+ })), 20));
16550
+ if (doc.subcommands.length > 1) {
16551
+ sections.push("");
16552
+ }
16553
+ }
16554
+ for (const group of doc.subcommands) {
16555
+ if (group.group === undefined)
16556
+ continue;
16557
+ sections.push(colors.bold(`${group.group}:`));
16558
+ sections.push(renderTable(group.commands.map((sub) => ({
16559
+ left: colors.cyan(formatSubcommandName(sub.name, sub.alias)),
16560
+ right: sub.shortDescription ?? sub.description
16561
+ })), 20));
16562
+ sections.push("");
16563
+ }
16564
+ }
16565
+ if (doc.examples && doc.examples.length > 0) {
16566
+ sections.push(colors.bold("EXAMPLES"));
16567
+ let first = true;
16568
+ let previousHadDescription = false;
16569
+ for (const example of doc.examples) {
16570
+ if (example.description) {
16571
+ if (!first)
16572
+ sections.push("");
16573
+ sections.push(` ${colors.dim(`# ${example.description}`)}`);
16574
+ } else if (previousHadDescription) {
16575
+ sections.push("");
16576
+ }
16577
+ sections.push(` ${colors.cyan(example.command)}`);
16578
+ first = false;
16579
+ previousHadDescription = !!example.description;
16580
+ }
16581
+ sections.push("");
16582
+ }
16583
+ if (sections[sections.length - 1] === "") {
16584
+ sections.pop();
16585
+ }
16586
+ return sections.join(`
16587
+ `);
16588
+ };
16589
+
16590
+ // node_modules/effect/dist/cli/TerminalCapabilities.js
16591
+ var TerminalCapabilities = /* @__PURE__ */ Reference("effect/cli/TerminalCapabilities", {
16592
+ defaultValue: () => fromProcess()
16593
+ });
16594
+ var isPresent = (value) => value !== undefined && value.length > 0;
16595
+ var isForcingColor = (value) => isPresent(value) && value !== "0" && value.toLowerCase() !== "false";
16596
+ var detect = (input) => {
16597
+ if (input.term === "dumb") {
16598
+ return {
16599
+ canColor: false,
16600
+ canAnimate: false,
16601
+ canPrompt: false
16602
+ };
16603
+ }
16604
+ return {
16605
+ canColor: !isPresent(input.noColor) && (isForcingColor(input.forceColor) || input.stdoutIsTerminal),
16606
+ canAnimate: input.stdoutIsTerminal,
16607
+ canPrompt: input.stdinIsTerminal && input.stdoutIsTerminal
16608
+ };
16609
+ };
16610
+ var fromProcess = () => {
16611
+ const process2 = globalThis.process;
16612
+ return detect({
16613
+ noColor: process2?.env?.NO_COLOR,
16614
+ forceColor: process2?.env?.FORCE_COLOR,
16615
+ term: process2?.env?.TERM,
16616
+ stdinIsTerminal: process2?.stdin?.isTTY === true,
16617
+ stdoutIsTerminal: process2?.stdout?.isTTY === true
16618
+ });
16619
+ };
16620
+
16621
+ // node_modules/effect/dist/cli/internal/formatter.js
16622
+ var resolveFormatter = /* @__PURE__ */ contextWith2((context) => succeed6(getOrUndefined2(context, Formatter) ?? defaultFormatter2({
16623
+ colors: get(context, TerminalCapabilities).canColor
16624
+ })));
16625
+
16626
+ // node_modules/effect/dist/cli/internal/help.js
16627
+ var dedupeGlobalFlags = (flags) => {
16628
+ const seen = new Set;
16629
+ const deduped = [];
16630
+ for (const flag of flags) {
16631
+ if (seen.has(flag)) {
16632
+ continue;
16633
+ }
16634
+ seen.add(flag);
16635
+ deduped.push(flag);
16636
+ }
16637
+ return deduped;
16638
+ };
16639
+ var getCommandsForCommandPath = (command, commandPath) => {
16640
+ const commands = [command];
16641
+ let currentCommand = command;
16642
+ for (let i = 1;i < commandPath.length; i++) {
16643
+ const subcommandName = commandPath[i];
16644
+ let subcommand = undefined;
16645
+ for (const group of currentCommand.subcommands) {
16646
+ subcommand = group.commands.find((sub) => sub.name === subcommandName);
16647
+ if (subcommand) {
16648
+ break;
16649
+ }
16650
+ }
16651
+ if (!subcommand) {
16652
+ break;
16301
16653
  }
16302
16654
  commands.push(subcommand);
16303
16655
  currentCommand = subcommand;
@@ -16400,7 +16752,7 @@ var Help = /* @__PURE__ */ Action2({
16400
16752
  command,
16401
16753
  commandPath
16402
16754
  }) {
16403
- const formatter = yield* Formatter;
16755
+ const formatter = yield* resolveFormatter;
16404
16756
  const helpDoc = yield* getHelpForCommandPath(command, commandPath, builtIns);
16405
16757
  yield* log(formatter.formatHelpDoc(helpDoc));
16406
16758
  })
@@ -16411,7 +16763,7 @@ var Version = /* @__PURE__ */ Action2({
16411
16763
  command,
16412
16764
  version
16413
16765
  }) {
16414
- const formatter = yield* Formatter;
16766
+ const formatter = yield* resolveFormatter;
16415
16767
  yield* log(formatter.formatVersion(command.name, version));
16416
16768
  })
16417
16769
  });
@@ -16475,13 +16827,20 @@ var lexTokens = (args) => {
16475
16827
  const equalIndex = arg.indexOf("=");
16476
16828
  if (equalIndex !== -1) {
16477
16829
  const name = arg.slice(2, equalIndex);
16478
- const value = arg.slice(equalIndex + 1);
16479
- tokens.push({
16480
- _tag: "LongOption",
16481
- name,
16482
- raw: arg,
16483
- value
16484
- });
16830
+ if (name === "") {
16831
+ tokens.push({
16832
+ _tag: "Value",
16833
+ value: arg
16834
+ });
16835
+ } else {
16836
+ const value = arg.slice(equalIndex + 1);
16837
+ tokens.push({
16838
+ _tag: "LongOption",
16839
+ name,
16840
+ raw: arg,
16841
+ value
16842
+ });
16843
+ }
16485
16844
  } else {
16486
16845
  tokens.push({
16487
16846
  _tag: "LongOption",
@@ -16493,13 +16852,20 @@ var lexTokens = (args) => {
16493
16852
  const flags = arg.slice(1);
16494
16853
  const equalIndex = flags.indexOf("=");
16495
16854
  if (equalIndex !== -1) {
16496
- const flag = flags.slice(0, equalIndex);
16497
- const value = flags.slice(equalIndex + 1);
16855
+ const chars = Array.from(flags.slice(0, equalIndex));
16856
+ const flag = chars.pop() ?? "";
16857
+ for (const ch of chars) {
16858
+ tokens.push({
16859
+ _tag: "ShortOption",
16860
+ flag: ch,
16861
+ raw: `-${ch}`
16862
+ });
16863
+ }
16498
16864
  tokens.push({
16499
16865
  _tag: "ShortOption",
16500
16866
  flag,
16501
16867
  raw: `-${flag}`,
16502
- value
16868
+ value: flags.slice(equalIndex + 1)
16503
16869
  });
16504
16870
  } else {
16505
16871
  for (const ch of flags) {
@@ -16610,8 +16976,10 @@ var makeCursor = (tokens) => {
16610
16976
  rest: () => tokens.slice(i)
16611
16977
  };
16612
16978
  };
16979
+ var negatedName2 = (param) => !isBoolean2(param.primitiveType) || param.negation === false ? undefined : param.negation ?? `no-${param.name}`;
16613
16980
  var createFlagRegistry = (params) => {
16614
16981
  const index = new Map;
16982
+ const negations = new Map;
16615
16983
  for (const param of params) {
16616
16984
  if (index.has(param.name)) {
16617
16985
  throw new Error(`Duplicate flag name "${param.name}" in command definition`);
@@ -16623,10 +16991,18 @@ var createFlagRegistry = (params) => {
16623
16991
  }
16624
16992
  index.set(alias, param);
16625
16993
  }
16994
+ const negation = negatedName2(param);
16995
+ if (negation !== undefined) {
16996
+ if (negations.has(negation)) {
16997
+ throw new Error(`Duplicate negation "${negation}" in command definition (conflicts with "${negations.get(negation).name}")`);
16998
+ }
16999
+ negations.set(negation, param);
17000
+ }
16626
17001
  }
16627
17002
  return {
16628
17003
  params,
16629
- index
17004
+ index,
17005
+ negations
16630
17006
  };
16631
17007
  };
16632
17008
  var buildSubcommandIndex = (subcommands) => {
@@ -16680,15 +17056,12 @@ var resolveFlag = (token, registry) => {
16680
17056
  negated: false
16681
17057
  };
16682
17058
  }
16683
- if (token._tag === "LongOption" && token.name.startsWith("no-")) {
16684
- const canonicalName = token.name.slice(3);
16685
- const param = registry.index.get(canonicalName);
16686
- if (param && param.name === canonicalName && isBoolean2(param.primitiveType)) {
16687
- return {
16688
- param,
16689
- negated: true
16690
- };
16691
- }
17059
+ const negated = token._tag === "LongOption" ? registry.negations.get(token.name) : undefined;
17060
+ if (negated) {
17061
+ return {
17062
+ param: negated,
17063
+ negated: true
17064
+ };
16692
17065
  }
16693
17066
  if (direct) {
16694
17067
  return {
@@ -16932,8 +17305,9 @@ var createUnrecognizedFlagError = (token, params, commandPath) => {
16932
17305
  if (p.hidden)
16933
17306
  continue;
16934
17307
  validNames.push(p.name);
16935
- if (isBoolean2(p.primitiveType)) {
16936
- validNames.push(`no-${p.name}`);
17308
+ const negation = negatedName2(p);
17309
+ if (negation !== undefined) {
17310
+ validNames.push(negation);
16937
17311
  }
16938
17312
  for (const alias of p.aliases) {
16939
17313
  validNames.push(alias);
@@ -17218,7 +17592,7 @@ var promptSingle = (single) => {
17218
17592
  message
17219
17593
  })), (value) => commandLineArg(value2(value), "<redacted>"));
17220
17594
  default:
17221
- return map7(run3(String7({
17595
+ return map7(run3(String8({
17222
17596
  message
17223
17597
  })), commandLineArg);
17224
17598
  }
@@ -17279,7 +17653,7 @@ var wrapCommand = (commandLine) => {
17279
17653
  var formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
17280
17654
 
17281
17655
  // node_modules/effect/dist/cli/Command.js
17282
- var isCommand = (u) => hasProperty(u, TypeId37);
17656
+ var isCommand = (u) => hasProperty(u, TypeId38);
17283
17657
  var make32 = (name, config, handler) => {
17284
17658
  const parsedConfig = parseConfig(config ?? {});
17285
17659
  return makeCommand({
@@ -17382,7 +17756,7 @@ var withSubcommands = /* @__PURE__ */ dual(2, (self, subcommands) => {
17382
17756
  unlisted: impl.unlisted,
17383
17757
  annotations: impl.annotations,
17384
17758
  globalFlags: impl.globalFlags,
17385
- examples: impl.examples,
17759
+ resolveExamples: impl.resolveExamples,
17386
17760
  service: impl.service,
17387
17761
  subcommands: normalized.groups,
17388
17762
  parse,
@@ -17398,6 +17772,14 @@ var withShortDescription = /* @__PURE__ */ dual(2, (self, shortDescription) => m
17398
17772
  ...toImpl(self),
17399
17773
  shortDescription
17400
17774
  }));
17775
+ var mapHandler = (self, f) => {
17776
+ const impl = toImpl(self);
17777
+ return makeCommand({
17778
+ ...impl,
17779
+ handle: (input, path) => f(impl.handle(input, path), input)
17780
+ });
17781
+ };
17782
+ var provideEffectDiscard = /* @__PURE__ */ dual(2, (self, effect) => mapHandler(self, (handler, input) => andThen2(typeof effect === "function" ? effect(input) : effect, handler)));
17401
17783
  var getOutOfScopeGlobalFlagErrors = (allFlags, activeFlags, flagMap, commandPath) => {
17402
17784
  const activeSet = new Set(activeFlags);
17403
17785
  const errors = [];
@@ -17430,7 +17812,7 @@ var showHelp = (command, error2, renderErrors) => gen2(function* () {
17430
17812
  const {
17431
17813
  builtIns
17432
17814
  } = yield* CliConfig;
17433
- const formatter = yield* Formatter;
17815
+ const formatter = yield* resolveFormatter;
17434
17816
  const helpDoc = yield* getHelpForCommandPath(command, error2.commandPath, builtIns);
17435
17817
  yield* log(formatter.formatHelpDoc(helpDoc));
17436
17818
  if (renderErrors && error2.errors.length > 0) {
@@ -17438,7 +17820,7 @@ var showHelp = (command, error2, renderErrors) => gen2(function* () {
17438
17820
  }
17439
17821
  });
17440
17822
  var showUserError = (error2) => gen2(function* () {
17441
- const formatter = yield* Formatter;
17823
+ const formatter = yield* resolveFormatter;
17442
17824
  yield* error(formatter.formatError(error2));
17443
17825
  error2[errorReported] = false;
17444
17826
  });
@@ -17558,11 +17940,11 @@ var runWith2 = (command, config) => {
17558
17940
  }, catchFilter2((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed2(error) : fail2(error), (error) => andThen2(showHelp(command, error, config.renderErrors !== false), fail6(error))), catchFilter2((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed2(error) : fail2(error), (error) => andThen2(showUserError(error), fail6(error))), catchFilter2((e) => isQuitError(e) ? succeed2(e) : fail2(e), (_) => interrupt2));
17559
17941
  };
17560
17942
  // node_modules/effect/dist/http/HttpBody.js
17561
- var TypeId38 = "~effect/http/HttpBody";
17943
+ var TypeId39 = "~effect/http/HttpBody";
17562
17944
  class Proto12 {
17563
- [TypeId38];
17945
+ [TypeId39];
17564
17946
  constructor() {
17565
- this[TypeId38] = TypeId38;
17947
+ this[TypeId39] = TypeId39;
17566
17948
  }
17567
17949
  [NodeInspectSymbol]() {
17568
17950
  return this.toJSON();
@@ -17627,7 +18009,7 @@ var text = (body, contentType) => {
17627
18009
  var jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?? "application/json");
17628
18010
 
17629
18011
  // node_modules/effect/dist/http/HttpClientError.js
17630
- var TypeId39 = "~effect/http/HttpClientError";
18012
+ var TypeId40 = "~effect/http/HttpClientError";
17631
18013
  class HttpClientError extends (/* @__PURE__ */ TaggedError2("HttpClientError")) {
17632
18014
  constructor(props) {
17633
18015
  if ("cause" in props.reason) {
@@ -17639,7 +18021,7 @@ class HttpClientError extends (/* @__PURE__ */ TaggedError2("HttpClientError"))
17639
18021
  super(props);
17640
18022
  }
17641
18023
  }
17642
- [TypeId39] = TypeId39;
18024
+ [TypeId40] = TypeId40;
17643
18025
  get request() {
17644
18026
  return this.reason.request;
17645
18027
  }
@@ -17736,15 +18118,20 @@ var make33 = (url, params, hash) => try_({
17736
18118
  });
17737
18119
  var baseUrl = () => {
17738
18120
  if ("location" in globalThis && globalThis.location !== undefined && globalThis.location.origin !== undefined && globalThis.location.pathname !== undefined) {
17739
- return location.origin + location.pathname;
18121
+ const base = location.origin + location.pathname;
18122
+ try {
18123
+ return new URL(base).href;
18124
+ } catch {
18125
+ return;
18126
+ }
17740
18127
  }
17741
18128
  return;
17742
18129
  };
17743
18130
 
17744
18131
  // node_modules/effect/dist/http/HttpClientRequest.js
17745
- var TypeId40 = "~effect/http/HttpClientRequest";
18132
+ var TypeId41 = "~effect/http/HttpClientRequest";
17746
18133
  var Proto13 = {
17747
- [TypeId40]: TypeId40,
18134
+ [TypeId41]: TypeId41,
17748
18135
  ...BaseProto,
17749
18136
  toJSON() {
17750
18137
  return {
@@ -17853,49 +18240,38 @@ function toUrl(self) {
17853
18240
  }
17854
18241
 
17855
18242
  // node_modules/effect/dist/http/HttpIncomingMessage.js
17856
- var TypeId41 = "~effect/http/HttpIncomingMessage";
18243
+ var TypeId42 = "~effect/http/HttpIncomingMessage";
17857
18244
  var schemaBodyJson = (schema, options) => {
17858
18245
  const decode = decodeEffect2(toCodecJson2(schema));
17859
18246
  const decodeJson = options?.reviver === undefined ? undefined : decodeEffect2(fromJsonString2(toCodecJson2(schema), options));
17860
18247
  return (self) => decodeJson === undefined ? flatMap4(self.json, (u) => decode(u, options)) : flatMap4(self.text, (body) => body === "" ? flatMap4(self.json, (u) => decode(u, options)) : decodeJson(body, options));
17861
18248
  };
17862
18249
  var inspect = (self, that) => {
17863
- const contentType = self.headers["content-type"] ?? "";
17864
- let body;
17865
- if (contentType.includes("application/json")) {
17866
- try {
17867
- body = runSync2(self.json);
17868
- } catch (_) {}
17869
- } else if (contentType.includes("text/") || contentType.includes("urlencoded")) {
17870
- try {
17871
- body = runSync2(self.text);
17872
- } catch (_) {}
17873
- }
17874
- const obj = {
18250
+ return {
17875
18251
  ...that,
17876
18252
  headers: redact(self.headers),
17877
18253
  remoteAddress: self.remoteAddress
17878
18254
  };
17879
- if (body !== undefined) {
17880
- obj.body = body;
17881
- }
17882
- return obj;
17883
18255
  };
17884
18256
 
18257
+ // node_modules/effect/dist/http/internal/webResponse.js
18258
+ var WebSourceSymbol = "~effect/http/HttpClientResponse/WebSource";
18259
+ var getWebSource = (self) => self[WebSourceSymbol]?.();
18260
+
17885
18261
  // node_modules/effect/dist/http/HttpClientResponse.js
17886
- var TypeId42 = "~effect/http/HttpClientResponse";
18262
+ var TypeId43 = "~effect/http/HttpClientResponse";
17887
18263
  var fromWeb = (request, source) => new WebHttpClientResponse(request, source);
17888
18264
  class WebHttpClientResponse extends Class2 {
17889
- [TypeId41];
17890
18265
  [TypeId42];
18266
+ [TypeId43];
17891
18267
  request;
17892
18268
  source;
17893
18269
  constructor(request, source) {
17894
18270
  super();
17895
18271
  this.request = request;
17896
18272
  this.source = source;
17897
- this[TypeId41] = TypeId41;
17898
18273
  this[TypeId42] = TypeId42;
18274
+ this[TypeId43] = TypeId43;
17899
18275
  }
17900
18276
  toJSON() {
17901
18277
  return inspect(this, {
@@ -17929,6 +18305,9 @@ class WebHttpClientResponse extends Class2 {
17929
18305
  get remoteAddress() {
17930
18306
  return none2();
17931
18307
  }
18308
+ [WebSourceSymbol]() {
18309
+ return this.source;
18310
+ }
17932
18311
  get stream() {
17933
18312
  return this.source.body ? fromReadableStream2({
17934
18313
  evaluate: () => this.source.body,
@@ -18005,6 +18384,15 @@ class WebHttpClientResponse extends Class2 {
18005
18384
  }).pipe(cached2, runSync2);
18006
18385
  return this.arrayBufferBody;
18007
18386
  }
18387
+ get upgrade() {
18388
+ return fail6(new HttpClientError({
18389
+ reason: new StatusCodeError({
18390
+ request: this.request,
18391
+ response: this,
18392
+ description: "fetch cannot hand over the connection of an HTTP upgrade"
18393
+ })
18394
+ }));
18395
+ }
18008
18396
  pipe() {
18009
18397
  return pipeArguments(this, arguments);
18010
18398
  }
@@ -18055,7 +18443,7 @@ var addHeaderAttributes = (span, phase, headers, filter, redactedNames) => {
18055
18443
  };
18056
18444
 
18057
18445
  // node_modules/effect/dist/http/HttpClient.js
18058
- var TypeId43 = "~effect/http/HttpClient";
18446
+ var TypeId44 = "~effect/http/HttpClient";
18059
18447
  var HttpClient = /* @__PURE__ */ Service("effect/HttpClient");
18060
18448
  var transformResponse = /* @__PURE__ */ dual(2, (self, f) => makeWith2((request) => f(self.postprocess(request)), self.preprocess));
18061
18449
  var makeWith2 = (postprocess, preprocess) => {
@@ -18068,7 +18456,7 @@ var makeWith2 = (postprocess, preprocess) => {
18068
18456
  return self;
18069
18457
  };
18070
18458
  var Proto14 = {
18071
- [TypeId43]: TypeId43,
18459
+ [TypeId44]: TypeId44,
18072
18460
  pipe() {
18073
18461
  return pipeArguments(this, arguments);
18074
18462
  },
@@ -18179,7 +18567,9 @@ var layerMergedContext = (effect2) => effect(HttpClient)(contextWith2((context)
18179
18567
  var responseRegistry = /* @__PURE__ */ (() => {
18180
18568
  if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
18181
18569
  const registry = /* @__PURE__ */ new FinalizationRegistry((controller) => {
18182
- controller.abort();
18570
+ try {
18571
+ controller.abort();
18572
+ } catch {}
18183
18573
  });
18184
18574
  return {
18185
18575
  register(response, controller) {
@@ -18213,8 +18603,8 @@ class InterruptibleResponse {
18213
18603
  this.original = original;
18214
18604
  this.controller = controller;
18215
18605
  }
18606
+ [TypeId43] = TypeId43;
18216
18607
  [TypeId42] = TypeId42;
18217
- [TypeId41] = TypeId41;
18218
18608
  applyInterrupt(effect) {
18219
18609
  return suspend2(() => {
18220
18610
  responseRegistry.unregister(this.original);
@@ -18256,6 +18646,15 @@ class InterruptibleResponse {
18256
18646
  get arrayBuffer() {
18257
18647
  return this.applyInterrupt(this.original.arrayBuffer);
18258
18648
  }
18649
+ get upgrade() {
18650
+ return this.applyInterrupt(this.original.upgrade);
18651
+ }
18652
+ [WebSourceSymbol]() {
18653
+ const source = getWebSource(this.original);
18654
+ if (source !== undefined)
18655
+ responseRegistry.unregister(this.original);
18656
+ return source;
18657
+ }
18259
18658
  get stream() {
18260
18659
  return suspend4(() => {
18261
18660
  responseRegistry.unregister(this.original);
@@ -18283,12 +18682,22 @@ var Fetch = /* @__PURE__ */ Reference("effect/http/FetchHttpClient/Fetch", {
18283
18682
  class RequestInit extends (/* @__PURE__ */ Service()("effect/http/FetchHttpClient/RequestInit")) {
18284
18683
  }
18285
18684
  var fetch = /* @__PURE__ */ make35((request, url, signal, fiber) => {
18685
+ if (request.headers.upgrade !== undefined) {
18686
+ return fail6(new HttpClientError({
18687
+ reason: new TransportError({
18688
+ request,
18689
+ description: "fetch cannot send an HTTP upgrade request"
18690
+ })
18691
+ }));
18692
+ }
18286
18693
  const fetch = fiber.getRef(Fetch);
18287
18694
  const options = getOrUndefined2(fiber.context, RequestInit) ?? {};
18288
18695
  let headers = options.headers ? merge4(fromInput(options.headers), request.headers) : request.headers;
18289
18696
  if (headers["content-length"]) {
18290
18697
  headers = remove3(headers, "content-length");
18291
18698
  }
18699
+ let uploadController;
18700
+ const stopUpload = sync2(() => uploadController?.abort());
18292
18701
  const send = (body) => map7(tryPromise2({
18293
18702
  try: () => fetch(url, {
18294
18703
  ...options,
@@ -18296,7 +18705,7 @@ var fetch = /* @__PURE__ */ make35((request, url, signal, fiber) => {
18296
18705
  headers,
18297
18706
  body,
18298
18707
  duplex: typeof ReadableStream !== "undefined" && body instanceof ReadableStream ? "half" : undefined,
18299
- signal
18708
+ signal: uploadController ? AbortSignal.any([signal, uploadController.signal]) : signal
18300
18709
  }),
18301
18710
  catch: (cause) => new HttpClientError({
18302
18711
  reason: new TransportError({
@@ -18304,15 +18713,43 @@ var fetch = /* @__PURE__ */ make35((request, url, signal, fiber) => {
18304
18713
  cause
18305
18714
  })
18306
18715
  })
18307
- }), (response) => fromWeb(request, response));
18716
+ }), (response) => {
18717
+ const original = fromWeb(request, response);
18718
+ if (!uploadController)
18719
+ return original;
18720
+ if (response.body === null)
18721
+ uploadController.abort();
18722
+ return Object.create(original, {
18723
+ ...Object.fromEntries(["arrayBuffer", "text", "json", "formData", "urlParamsBody"].map((key) => [key, {
18724
+ get: () => ensuring2(original[key], stopUpload)
18725
+ }])),
18726
+ stream: {
18727
+ get: () => ensuring4(original.stream, stopUpload)
18728
+ }
18729
+ });
18730
+ }).pipe(onError2(() => stopUpload));
18308
18731
  switch (request.body._tag) {
18309
18732
  case "Raw":
18310
18733
  case "Uint8Array":
18311
18734
  return send(request.body.body);
18312
18735
  case "FormData":
18313
18736
  return send(request.body.formData);
18314
- case "Stream":
18315
- return flatMap4(toReadableStreamEffect(request.body.stream), send);
18737
+ case "Stream": {
18738
+ uploadController = new AbortController;
18739
+ const uploadSignal = AbortSignal.any([signal, uploadController.signal]);
18740
+ const stopped = callback2((resume) => {
18741
+ const onAbort = () => resume(interrupt2);
18742
+ if (uploadSignal.aborted) {
18743
+ onAbort();
18744
+ return;
18745
+ }
18746
+ uploadSignal.addEventListener("abort", onAbort, {
18747
+ once: true
18748
+ });
18749
+ return sync2(() => uploadSignal.removeEventListener("abort", onAbort));
18750
+ });
18751
+ return flatMap4(toReadableStreamEffect(interruptWhen2(request.body.stream, stopped)), send);
18752
+ }
18316
18753
  }
18317
18754
  return send(undefined);
18318
18755
  });
@@ -18320,7 +18757,7 @@ var layer14 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed6(fetch)
18320
18757
  // package.json
18321
18758
  var package_default = {
18322
18759
  name: "jj-octo",
18323
- version: "0.9.1",
18760
+ version: "0.9.3",
18324
18761
  description: "A jj subcommand for GitHub that supports stacked pull requests and works in Claude Code cloud sessions",
18325
18762
  license: "MIT",
18326
18763
  repository: {
@@ -18352,20 +18789,20 @@ var package_default = {
18352
18789
  test: "bun run build && bun run compile && bun test ./src"
18353
18790
  },
18354
18791
  devDependencies: {
18355
- "@effect/platform-bun": "4.0.5",
18792
+ "@effect/platform-bun": "4.0.6",
18356
18793
  "@octokit/openapi-types": "29.0.1",
18357
18794
  "@tsconfig/strictest": "2.0.8",
18358
- "@types/bun": "1.4.3",
18359
- effect: "4.0.5",
18795
+ "@types/bun": "1.4.4",
18796
+ effect: "4.0.6",
18360
18797
  oxfmt: "0.74.0",
18361
18798
  oxlint: "1.89.0",
18362
- "oxlint-tsgolint": "7.0.2004",
18799
+ "oxlint-tsgolint": "7.0.2005",
18363
18800
  typescript: "7.0.2"
18364
18801
  },
18365
18802
  engines: {
18366
18803
  bun: ">=1.4.0"
18367
18804
  },
18368
- packageManager: "bun@1.4.3"
18805
+ packageManager: "bun@1.4.4"
18369
18806
  };
18370
18807
 
18371
18808
  // src/cli/command.ts
@@ -18374,7 +18811,7 @@ var asUserError = (program) => program.pipe(mapError3(({ message }) => userError
18374
18811
  var withHelp = (summary, ...paragraphs) => (command) => command.pipe(withShortDescription(summary), withDescription3([summary, ...paragraphs].join(`
18375
18812
 
18376
18813
  `)));
18377
- var revisionFlag = (description) => String9("revision").pipe(withAlias2("r"), withDefault5("@"), withDescription2(`${description}, the working copy by default`));
18814
+ var revisionFlag = (description) => String10("revision").pipe(withAlias2("r"), withDefault5("@"), withDescription2(`${description}, the working copy by default`));
18378
18815
  // src/clients/git.ts
18379
18816
  class GitFailed extends TaggedError2("GitFailed") {
18380
18817
  }
@@ -18407,8 +18844,8 @@ var gitLayer = ({ cwd, env } = {}) => effect(Git, gen2(function* () {
18407
18844
  "github"
18408
18845
  ], { cwd: directory }));
18409
18846
  const [text, stderr, code] = yield* all3([
18410
- mkString(decodeText(handle.stdout)),
18411
- mkString(decodeText(handle.stderr)),
18847
+ mkString(decodeText2(handle.stdout)),
18848
+ mkString(decodeText2(handle.stderr)),
18412
18849
  handle.exitCode
18413
18850
  ], { concurrency: "unbounded" });
18414
18851
  if (code > 127) {
@@ -18419,8 +18856,8 @@ var gitLayer = ({ cwd, env } = {}) => effect(Git, gen2(function* () {
18419
18856
  read: (args) => scoped2(gen2(function* () {
18420
18857
  const handle = yield* spawner.spawn(make16("git", args, { cwd, env, extendEnv: true }));
18421
18858
  const [stdout, stderr, code] = yield* all3([
18422
- mkString(decodeText(handle.stdout)),
18423
- mkString(decodeText(handle.stderr)),
18859
+ mkString(decodeText2(handle.stdout)),
18860
+ mkString(decodeText2(handle.stderr)),
18424
18861
  handle.exitCode
18425
18862
  ], { concurrency: "unbounded" });
18426
18863
  return code === 0 ? stdout : yield* new GitFailed({
@@ -18464,8 +18901,8 @@ var jjLayer = ({ cwd, env, printed } = {}) => effect(Jj, gen2(function* () {
18464
18901
  const captured = (args) => scoped2(gen2(function* () {
18465
18902
  const handle = yield* spawner.spawn(make16("jj", args, location2));
18466
18903
  return yield* all3([
18467
- mkString(decodeText(handle.stdout)),
18468
- mkString(decodeText(handle.stderr)),
18904
+ mkString(decodeText2(handle.stdout)),
18905
+ mkString(decodeText2(handle.stderr)),
18469
18906
  handle.exitCode
18470
18907
  ], { concurrency: "unbounded" });
18471
18908
  })).pipe(catchTag2("PlatformError", (error) => fail6(failed(args, error.message))));
@@ -18537,14 +18974,27 @@ var parseDescription = (json) => {
18537
18974
  const parsed = JSON.parse(json);
18538
18975
  return typeof parsed === "string" ? parsed : "";
18539
18976
  };
18540
- var readLog = (revset, template) => gen2(function* () {
18977
+ var readLog = (revset, template, { ignoreWorkingCopy = false } = {}) => gen2(function* () {
18541
18978
  const jj = yield* Jj;
18542
- return yield* jj.read(["log", "--no-graph", "--reversed", "-r", revset, "-T", template]);
18979
+ return yield* jj.read([
18980
+ "log",
18981
+ ...ignoreWorkingCopy ? ["--ignore-working-copy"] : [],
18982
+ "--no-graph",
18983
+ "--reversed",
18984
+ "-r",
18985
+ revset,
18986
+ "-T",
18987
+ template
18988
+ ]);
18543
18989
  });
18544
- var logLines = (revset, template) => readLog(revset, template).pipe(map7(lines2));
18990
+ var logLines = (revset, template, options) => readLog(revset, template, options).pipe(map7(lines2));
18545
18991
  var changesIn = (revset) => logLines(revset, String.raw`change_id.shortest(8) ++ " " ++ description.first_line() ++ "\n"`);
18546
18992
  var commitsAt = (revset) => logLines(revset, String.raw`commit_id ++ "\n"`);
18547
18993
  var changeIdsAt = (revset) => logLines(revset, String.raw`change_id ++ "\n"`);
18994
+ var lineCountsAt = (commitIds) => logLines(anyOf(commitIds), String.raw`commit_id ++ "\t" ++ diff.stat().total_added() ++ "\t" ++ diff.stat().total_removed() ++ "\n"`, { ignoreWorkingCopy: true }).pipe(map7((logged) => new Map(logged.flatMap((line) => {
18995
+ const [commitId = "", added = "", removed = ""] = line.split("\t");
18996
+ return /^\d+$/u.test(added) && /^\d+$/u.test(removed) ? [[commitId, { added: Number(added), removed: Number(removed) }]] : [];
18997
+ }))));
18548
18998
  var bookmarksAt = (revset) => gen2(function* () {
18549
18999
  const jj = yield* Jj;
18550
19000
  const template = String.raw`if(!remote, name ++ "\n")`;
@@ -18650,31 +19100,31 @@ var StackNumberSchema = Number6.pipe(brand("StackNumber"));
18650
19100
  var CreatedPullRequest = responseOf()(Struct({ number: PullRequestNumberSchema }));
18651
19101
  var CreatedStack = responseOf()(Struct({ number: StackNumberSchema }));
18652
19102
  var PullRequests = responseOf()(ArraySchema(Struct({
18653
- base: Struct({ ref: String4 }),
18654
- body: NullOr(String4),
19103
+ base: Struct({ ref: String5 }),
19104
+ body: NullOr(String5),
18655
19105
  draft: optionalKey2(Boolean3),
18656
19106
  number: PullRequestNumberSchema,
18657
- title: String4
19107
+ title: String5
18658
19108
  })));
18659
19109
  var AnyPullRequests = responseOf()(ArraySchema(Struct({
18660
19110
  draft: optionalKey2(Boolean3),
18661
- head: Struct({ sha: String4 }),
18662
- html_url: String4,
18663
- merged_at: NullOr(String4),
19111
+ head: Struct({ sha: String5 }),
19112
+ html_url: String5,
19113
+ merged_at: NullOr(String5),
18664
19114
  number: PullRequestNumberSchema,
18665
- state: String4,
18666
- title: String4
19115
+ state: String5,
19116
+ title: String5
18667
19117
  })));
18668
19118
  var StackedPullRequest = Struct({
18669
19119
  number: PullRequestNumberSchema,
18670
19120
  state: Literals(["closed", "open"])
18671
19121
  });
18672
19122
  var Stacks = responseOf()(ArraySchema(Struct({ number: StackNumberSchema, pull_requests: ArraySchema(StackedPullRequest) })));
18673
- var RepositoryDetails = responseOf()(Struct({ default_branch: String4 }));
19123
+ var RepositoryDetails = responseOf()(Struct({ default_branch: String5 }));
18674
19124
  var MergeRequest = Struct({
18675
19125
  details: Struct({
18676
- message: String4,
18677
- uuid: optionalKey2(String4)
19126
+ message: String5,
19127
+ uuid: optionalKey2(String5)
18678
19128
  }),
18679
19129
  status: Literals(["enqueued", "failed", "merged", "pending"])
18680
19130
  });
@@ -18810,6 +19260,8 @@ var checkout = gen2(function* () {
18810
19260
  const isColocated = yield* fs.exists(`${root}/.jj`).pipe(orElseSucceed2(() => false));
18811
19261
  return { isColocated, isWorktree: gitDirectory !== commonDirectory, root };
18812
19262
  });
19263
+ var SET_UP_VERSION = "jj-octo.set-up-version";
19264
+ var readSetUpVersion = readJjConfig(SET_UP_VERSION, { repo: true });
18813
19265
  var colocated = {
18814
19266
  check: map7(checkout, ({ isColocated, isWorktree }) => {
18815
19267
  const problem = isWorktree ? {
@@ -18918,12 +19370,26 @@ var init = gen2(function* () {
18918
19370
  yield* new NotSetUp({ message: problems.join(`
18919
19371
  `) });
18920
19372
  }
19373
+ yield* setJjConfig(SET_UP_VERSION, package_default.version);
18921
19374
  yield* error(`set up jj, with trunk() as ${yield* branch}@origin`);
18922
19375
  });
18923
- var initCommand = make32("init", {}, () => asUserError(init)).pipe(withHelp("Set up a git checkout for the other commands", "Makes it a jj repository colocated with git, unless it already is one, and copies git's name and email into the repository's jj config where jj has none. Where neither has them, set them with `jj config set --user`.", "Reads the default branch from `origin`, fetches and tracks it, and sets `trunk()` to it in the repository's config. jj's own `trunk()` guesses from branch names, so without this a default branch it doesn't guess would be the base of pull requests but not of local rebases. `submit`, `merge` and `sync` check that the two agree.", "Sets the `jj gh` alias to run `jj-octo` from `PATH`, in the repository's config, unless the repository has one, such as one that runs another build.", "Needs no GitHub token. Running it again changes nothing that is already set up. Run it again after the default branch changes on GitHub. Fails with what it couldn't set up, after setting up the rest. Where it can't make a colocated jj repository, such as in a git worktree, it sets up nothing else."));
19376
+ var THIS_VERSION = parseUnsafe(package_default.version);
19377
+ var isOlder = (recorded) => typeof recorded !== "string" || match2(parse(recorded), {
19378
+ onFailure: () => true,
19379
+ onSuccess: (version) => isLessThan2(version, THIS_VERSION)
19380
+ });
19381
+ var setUpOnUpgrade = gen2(function* () {
19382
+ if (!isOlder(yield* readSetUpVersion)) {
19383
+ return;
19384
+ }
19385
+ yield* error(`setting this checkout up for jj-octo ${package_default.version}`);
19386
+ yield* init.pipe(catchTag2("NotSetUp", ({ message }) => andThen2(error(`${message}
19387
+ run \`jj-octo init\` once that's fixed`), setJjConfig(SET_UP_VERSION, package_default.version))));
19388
+ });
19389
+ var initCommand = make32("init", {}, () => asUserError(init)).pipe(withHelp("Set up a git checkout for the other commands", "Makes it a jj repository colocated with git, unless it already is one, and copies git's name and email into the repository's jj config where jj has none. Where neither has them, set them with `jj config set --user`.", "Reads the default branch from `origin`, fetches and tracks it, and sets `trunk()` to it in the repository's config. jj's own `trunk()` guesses from branch names, so without this a default branch it doesn't guess would be the base of pull requests but not of local rebases. `submit`, `merge` and `sync` check that the two agree.", "Sets the `jj gh` alias to run `jj-octo` from `PATH`, in the repository's config, unless the repository has one, such as one that runs another build.", "Records its version as `jj-octo.set-up-version` in the repository's config. The other commands, except `doctor`, run it first where an older version is recorded, or none is.", "Needs no GitHub token. Running it again changes nothing that is already set up. Run it again after the default branch changes on GitHub. Fails with what it couldn't set up, after setting up the rest. Where it can't make a colocated jj repository, such as in a git worktree, it sets up nothing else."));
18924
19390
 
18925
19391
  // src/clients/claude-code.ts
18926
- var claudeCodeCloudSession = orDie2(String5("CLAUDE_CODE_REMOTE").pipe(withDefault3(""), map10((value) => value === "true")));
19392
+ var claudeCodeCloudSession = orDie2(String6("CLAUDE_CODE_REMOTE").pipe(withDefault3(""), map10((value) => value === "true")));
18927
19393
 
18928
19394
  // src/clients/clipboard.ts
18929
19395
  class ClipboardFailed extends TaggedError2("ClipboardFailed") {
@@ -18944,8 +19410,8 @@ function run([html, text]) {
18944
19410
  }
18945
19411
  }`;
18946
19412
  var environment = all4({
18947
- path: String5("PATH").pipe(withDefault3("")),
18948
- wayland: String5("WAYLAND_DISPLAY").pipe(withDefault3(""))
19413
+ path: String6("PATH").pipe(withDefault3("")),
19414
+ wayland: String6("WAYLAND_DISPLAY").pipe(withDefault3(""))
18949
19415
  });
18950
19416
  var commandsFor = ({ html, text }, platform, wayland) => {
18951
19417
  if (platform === "darwin") {
@@ -19099,20 +19565,33 @@ var COPY_REPORT = {
19099
19565
  "The Claude app shows them as links, which paste into Slack as links."
19100
19566
  ].join(" ")
19101
19567
  };
19102
- var markdownLinks = (pullRequests) => pullRequests.map(({ number, state, title, url }) => `${EMOJI[state]} [#${number} ${title}](${url})`).join(`
19568
+ var lineCounts = ({ added, removed }) => `+${added}/-${removed}`;
19569
+ var markdownLinks = (pullRequests) => pullRequests.map((pullRequest) => `${EMOJI[pullRequest.state]} [#${pullRequest.number} ${pullRequest.title}](${pullRequest.url}) ${lineCounts(pullRequest)}`).join(`
19103
19570
  `);
19104
- var htmlLinks = (pullRequests) => `<meta charset="utf-8">${pullRequests.map(({ number, state, title, url }) => `${EMOJI[state]} <a href="${Bun.escapeHTML(url)}">#${number} ${Bun.escapeHTML(title)}</a>`).join("<br>")}`;
19571
+ var htmlLinks = (pullRequests) => `<meta charset="utf-8">${pullRequests.map((pullRequest) => `${EMOJI[pullRequest.state]} <a href="${Bun.escapeHTML(pullRequest.url)}">#${pullRequest.number} ${Bun.escapeHTML(pullRequest.title)}</a> ${lineCounts(pullRequest)}`).join("<br>")}`;
19105
19572
  var pullRequestOf = (pullRequests, commitId, pushed) => fromNullishOr(pullRequests.find(({ state }) => OPEN[state]) ?? pullRequests.find(({ head }) => head === commitId || head === pushed));
19106
19573
  var stackPullRequests = (revision) => gen2(function* () {
19107
19574
  const github = yield* GitHub;
19108
19575
  const stack = yield* stackChanges(revision);
19109
- const [targets, found] = yield* all3([
19576
+ const [targets, counts, found] = yield* all3([
19110
19577
  bookmarkTargets,
19578
+ lineCountsAt(stack.map(({ commitId }) => commitId)),
19111
19579
  forEach2(stack, ({ bookmark }) => github.pullRequestsFrom(bookmark), {
19112
19580
  concurrency: "unbounded"
19113
19581
  })
19114
19582
  ], { concurrency: "unbounded" });
19115
- return stack.flatMap(({ bookmark, commitId }, index) => toArray(pullRequestOf(found[index] ?? [], commitId, targets.get(bookmark)?.origin))).toReversed();
19583
+ const linked = [];
19584
+ for (const [index, { bookmark, commitId }] of stack.entries()) {
19585
+ const pullRequest = pullRequestOf(found[index] ?? [], commitId, targets.get(bookmark)?.origin);
19586
+ const changed = counts.get(commitId);
19587
+ if (isSome2(pullRequest)) {
19588
+ if (changed === undefined) {
19589
+ return yield* new JjFailed({ message: `jj printed no line counts for ${commitId}` });
19590
+ }
19591
+ linked.push({ ...pullRequest.value, ...changed });
19592
+ }
19593
+ }
19594
+ return linked.toReversed();
19116
19595
  });
19117
19596
  var links = ({
19118
19597
  copy,
@@ -19130,7 +19609,7 @@ var links = ({
19130
19609
  var linksCommand = make32("links", {
19131
19610
  copy: Boolean6("copy").pipe(withDefault5(false), withDescription2("Also copy the links to the clipboard, as links that Slack pastes, or in a Claude Code cloud session say how to give them to the user")),
19132
19611
  revision: revisionFlag("A change of the stack to list")
19133
- }, (options) => asUserError(links(options).pipe(provide3([GitHubFromOrigin, ClipboardLive])))).pipe(withHelp("Print the stack's pull requests as Markdown links", "Prints one line per pull request, top first: \uD83D\uDCDD for a draft, \uD83D\uDC40 for one ready for review, \uD83C\uDFC1 for a merged one and \uD83D\uDEAB for one closed unmerged, then a Markdown link showing its number and title.", "A change's pull request is the open one from its branch, or else the newest closed one whose head is the change or the commit pushed for it. A change with no pull request is left out, as is one that `sync` abandoned because its pull request merged. Fails where no change has one.", "With `--copy`, also puts the links on the clipboard as HTML, which Slack and other apps paste as links. That runs `osascript` on macOS, which also copies the Markdown as plain text, and `wl-copy` or `xclip` on Linux, which copy the HTML alone.", "In a Claude Code cloud session, where `CLAUDE_CODE_REMOTE` is `true`, `--copy` copies nothing. It tells the agent to put the Markdown in its reply, which the Claude app shows as links that paste into Slack.", "Fails if the changes aren't a chain, if one has conflicts, or if one doesn't have exactly one bookmark, as `log` does. Changes nothing, locally or on GitHub."));
19612
+ }, (options) => asUserError(links(options).pipe(provide3([GitHubFromOrigin, ClipboardLive])))).pipe(withHelp("Print the stack's pull requests as Markdown links", "Prints one line per pull request, top first: \uD83D\uDCDD for a draft, \uD83D\uDC40 for one ready for review, \uD83C\uDFC1 for a merged one and \uD83D\uDEAB for one closed unmerged, then a Markdown link showing its number and title, then the lines its change adds and removes, as `+123/-45`.", "A change's pull request is the open one from its branch, or else the newest closed one whose head is the change or the commit pushed for it. A change with no pull request is left out, as is one that `sync` abandoned because its pull request merged. Fails where no change has one.", "With `--copy`, also puts the links on the clipboard as HTML, which Slack and other apps paste as links. That runs `osascript` on macOS, which also copies the Markdown as plain text, and `wl-copy` or `xclip` on Linux, which copy the HTML alone.", "In a Claude Code cloud session, where `CLAUDE_CODE_REMOTE` is `true`, `--copy` copies nothing. It tells the agent to put the Markdown in its reply, which the Claude app shows as links that paste into Slack.", "Fails if the changes aren't a chain, if one has conflicts, or if one doesn't have exactly one bookmark, as `log` does. Changes nothing, locally or on GitHub."));
19134
19613
 
19135
19614
  // src/cli/gh/log.ts
19136
19615
  var logLines2 = (entries) => {
@@ -19163,9 +19642,9 @@ var logCommand = make32("log", { revision: revisionFlag("A change of the stack t
19163
19642
  class PrDescriptions extends Service()("jj-octo/PrDescriptions") {
19164
19643
  }
19165
19644
  var StoredRecord = Struct({
19166
- bookmark: String4,
19167
- commit: String4,
19168
- description: String4
19645
+ bookmark: String5,
19646
+ commit: String5,
19647
+ description: String5
19169
19648
  });
19170
19649
  var decode2 = decodeUnknownOption2(fromJsonString2(StoredRecord));
19171
19650
  var RECORD = /^\d+$/u;
@@ -19844,14 +20323,15 @@ var submitCommand = make32("submit", {
19844
20323
  }, ({ overwriteDescriptions, publish, revision }) => asUserError(submit(revision, { draft: !publish, overwriteDescriptions }).pipe(provide3(GitHubFromOrigin)))).pipe(withHelp("Push a change and the ones below it, and open their pull requests", "Pushes the bookmark of each of those changes. An empty working copy means the change below it, so from the top of a stack this submits all of it. Opens a pull request for each branch that has none, with the title and body from the change's description. Points each pull request at the branch below it, and the bottom one at the default branch.", "New pull requests are opened as drafts, or ready for review with `--publish`. The flag doesn't change a pull request that already exists.", "Keeps each pull request's title and body the same as its change's description. A description edited on GitHub is written into the change, one edited locally is sent to the pull request, and edits on both sides are merged line by line. That holds for a local edit pushed with `jj git push` too, since submit records the description that both sides last agreed on in `jj-octo/pr-descriptions` under the repository's `.jj/repo`, in the main workspace. Edits to the same lines stop the submit before anything is pushed.", "First, where any of those changes' pull requests merged or any of their branches changed on GitHub, syncs their stack as `jj gh sync` does, and leaves other stacks alone. That drops the merged changes, takes what GitHub added to the branches, and rebases the rest onto the trunk, so the push doesn't undo GitHub's work.", "Stops before changing anything where one of their branches was deleted on GitHub and their change doesn't count as merged: no pull request from it merged, another commit merged, or the change was edited since. It says how to push the change again, or drop it.", "Registers the pull requests as one GitHub stack. A stack of one change is a single pull request, which GitHub has no stack for.", "If changes were reordered, inserted or dropped since the last submit, the GitHub stack is dissolved and registered again under a new number. The pull requests stay open, including the one of a dropped change."));
19845
20324
 
19846
20325
  // src/cli/gh/command.ts
20326
+ var setUpFirst = (command) => provideEffectDiscard(command, asUserError(setUpOnUpgrade));
19847
20327
  var jjGhCommand = make32("jj gh").pipe(withSubcommands([
19848
20328
  doctorCommand,
19849
20329
  initCommand,
19850
- linksCommand,
19851
- logCommand,
19852
- mergeCommand,
19853
- submitCommand,
19854
- syncCommand
20330
+ linksCommand.pipe(setUpFirst),
20331
+ logCommand.pipe(setUpFirst),
20332
+ mergeCommand.pipe(setUpFirst),
20333
+ submitCommand.pipe(setUpFirst),
20334
+ syncCommand.pipe(setUpFirst)
19855
20335
  ]), withHelp("Commands for publishing jj changes as GitHub pull requests", "A stack is a chain of changes, each published as one pull request on the branch its bookmark names. Each pull request targets the branch of the change below it, so it shows only that change's diff. A single change is a stack of one, and is published as an ordinary pull request.", "The stack of a change is every change connected to it through mutable changes. An empty working copy with no description isn't part of it. `log` shows the whole stack, and `links` lists its pull requests as Markdown links. `submit` and `merge` act on a change and the ones below it, which must be a chain: no merges, no conflicts, and exactly one bookmark on each change.", "The repository is the one the `origin` remote points to. The token is read from `GH_TOKEN` or `GITHUB_TOKEN`, and otherwise from `gh auth token`."));
19856
20336
 
19857
20337
  // src/main.ts