@eliya-oss/agent-diff 0.1.0-alpha.114 → 0.1.0-alpha.115

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/CHANGELOG.md +10 -0
  2. package/dist/main.js +975 -453
  3. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -132,7 +132,7 @@ function memoizeIdempotent(f) {
132
132
  return result;
133
133
  };
134
134
  }
135
- var dual, identity, constant, constTrue, constFalse, constUndefined, constVoid;
135
+ var dual, identity, constant, constTrue, constFalse, constUndefined, constVoid, absurd;
136
136
  var init_Function = __esmMin((() => {
137
137
  dual = function(arity, body) {
138
138
  if (typeof arity === "function") return function() {
@@ -168,6 +168,9 @@ var init_Function = __esmMin((() => {
168
168
  constFalse = /*#__PURE__*/ constant(false);
169
169
  constUndefined = /*#__PURE__*/ constant(void 0);
170
170
  constVoid = constUndefined;
171
+ absurd = (_) => {
172
+ throw new Error("Called `absurd` function which should be uncallable");
173
+ };
171
174
  }));
172
175
  //#endregion
173
176
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/equal.js
@@ -385,6 +388,35 @@ function isFunction(input) {
385
388
  return typeof input === "function";
386
389
  }
387
390
  /**
391
+ * Checks whether a value is not `undefined`.
392
+ *
393
+ * **When to use**
394
+ *
395
+ * Use when you need a `Predicate` refinement that filters out `undefined`
396
+ * while preserving other falsy values.
397
+ *
398
+ * **Details**
399
+ *
400
+ * Returns a refinement that excludes `undefined`.
401
+ *
402
+ * **Example** (Filtering undefined values)
403
+ *
404
+ * ```ts import.meta.vitest
405
+ * import { Predicate } from "effect"
406
+ *
407
+ * const values = [1, undefined, 2]
408
+ * const defined = values.filter(Predicate.isNotUndefined) // => [1, 2]
409
+ * ```
410
+ *
411
+ * @see {@link isUndefined}
412
+ * @see {@link isNotNullish}
413
+ * @category guards
414
+ * @since 2.0.0
415
+ */
416
+ function isNotUndefined(input) {
417
+ return input !== void 0;
418
+ }
419
+ /**
388
420
  * Checks whether a value is not `null` and not `undefined`.
389
421
  *
390
422
  * **When to use**
@@ -742,9 +774,9 @@ var init_Equal = __esmMin((() => {
742
774
  }));
743
775
  //#endregion
744
776
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Equivalence.js
745
- var make$16;
777
+ var make$18;
746
778
  var init_Equivalence = __esmMin((() => {
747
- make$16 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
779
+ make$18 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
748
780
  }));
749
781
  //#endregion
750
782
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/array.js
@@ -1480,7 +1512,7 @@ var init_core = __esmMin((() => {
1480
1512
  }));
1481
1513
  //#endregion
1482
1514
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/option.js
1483
- var TypeId$18, CommonProto$1, SomeProto, NoneHash, NoneProto, isOption, isNone$1, isSome$1, none$1, some$1;
1515
+ var TypeId$20, CommonProto$1, SomeProto, NoneHash, NoneProto, isOption, isNone$1, isSome$1, none$1, some$1;
1484
1516
  var init_option = __esmMin((() => {
1485
1517
  init_Equal();
1486
1518
  init_Formatter();
@@ -1489,9 +1521,9 @@ var init_option = __esmMin((() => {
1489
1521
  init_Predicate();
1490
1522
  init_Utils();
1491
1523
  init_core();
1492
- TypeId$18 = "~effect/data/Option";
1524
+ TypeId$20 = "~effect/data/Option";
1493
1525
  CommonProto$1 = {
1494
- [TypeId$18]: { _A: (_) => _ },
1526
+ [TypeId$20]: { _A: (_) => _ },
1495
1527
  ...PipeInspectableProto,
1496
1528
  [Symbol.iterator]() {
1497
1529
  return new SingleShotGen(this);
@@ -1540,7 +1572,7 @@ var init_option = __esmMin((() => {
1540
1572
  };
1541
1573
  }
1542
1574
  });
1543
- isOption = (input) => hasProperty(input, TypeId$18);
1575
+ isOption = (input) => hasProperty(input, TypeId$20);
1544
1576
  isNone$1 = (fa) => fa._tag === "None";
1545
1577
  isSome$1 = (fa) => fa._tag === "Some";
1546
1578
  none$1 = /*#__PURE__*/ Object.create(NoneProto);
@@ -1552,7 +1584,7 @@ var init_option = __esmMin((() => {
1552
1584
  }));
1553
1585
  //#endregion
1554
1586
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/result.js
1555
- var TypeId$17, CommonProto, SuccessProto, FailureProto, isResult, isFailure$1, isSuccess$1, fail$4, succeed$7;
1587
+ var TypeId$19, CommonProto, SuccessProto, FailureProto, isResult, isFailure$1, isSuccess$1, fail$4, succeed$7;
1556
1588
  var init_result = __esmMin((() => {
1557
1589
  init_Equal();
1558
1590
  init_Formatter();
@@ -1561,9 +1593,9 @@ var init_result = __esmMin((() => {
1561
1593
  init_Predicate();
1562
1594
  init_Utils();
1563
1595
  init_core();
1564
- TypeId$17 = "~effect/data/Result";
1596
+ TypeId$19 = "~effect/data/Result";
1565
1597
  CommonProto = {
1566
- [TypeId$17]: {
1598
+ [TypeId$19]: {
1567
1599
  /* v8 ignore next 2 */
1568
1600
  _A: (_) => _,
1569
1601
  _E: (_) => _
@@ -1613,7 +1645,7 @@ var init_result = __esmMin((() => {
1613
1645
  };
1614
1646
  }
1615
1647
  });
1616
- isResult = (input) => hasProperty(input, TypeId$17);
1648
+ isResult = (input) => hasProperty(input, TypeId$19);
1617
1649
  isFailure$1 = (result) => result._tag === "Failure";
1618
1650
  isSuccess$1 = (result) => result._tag === "Success";
1619
1651
  fail$4 = (failure) => {
@@ -1664,20 +1696,24 @@ var init_result = __esmMin((() => {
1664
1696
  * @category constructors
1665
1697
  * @since 2.0.0
1666
1698
  */
1667
- function make$15(compare) {
1699
+ function make$17(compare) {
1668
1700
  return (self, that) => self === that ? 0 : compare(self, that);
1669
1701
  }
1670
- var Number$4, mapInput, isGreaterThan$1, init_Order = __esmMin((() => {
1702
+ var Number$4, mapInput, isGreaterThan$1;
1703
+ var init_Order = __esmMin((() => {
1671
1704
  init_Function();
1672
- Number$4 = /*#__PURE__*/ make$15((self, that) => {
1705
+ Number$4 = /*#__PURE__*/ make$17((self, that) => {
1673
1706
  if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
1674
1707
  if (globalThis.Number.isNaN(self)) return -1;
1675
1708
  if (globalThis.Number.isNaN(that)) return 1;
1676
1709
  return self < that ? -1 : 1;
1677
1710
  });
1678
- mapInput = /*#__PURE__*/ dual(2, (self, f) => make$15((b1, b2) => self(f(b1), f(b2))));
1711
+ mapInput = /*#__PURE__*/ dual(2, (self, f) => make$17((b1, b2) => self(f(b1), f(b2))));
1679
1712
  isGreaterThan$1 = (O) => dual(2, (self, that) => O(self, that) === 1);
1680
- })), none, some, isNone, isSome, match$3, getOrElse, orElse, fromNullishOr, getOrUndefined$1, map$4, flatMap$2;
1713
+ }));
1714
+ //#endregion
1715
+ //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Option.js
1716
+ var none, some, isNone, isSome, match$3, getOrElse, orElse, fromNullishOr, getOrUndefined$1, liftThrowable, map$4, flatMap$2, filter$1;
1681
1717
  var init_Option = __esmMin((() => {
1682
1718
  init_Function();
1683
1719
  init_option();
@@ -1690,8 +1726,16 @@ var init_Option = __esmMin((() => {
1690
1726
  orElse = /*#__PURE__*/ dual(2, (self, that) => isNone(self) ? that() : self);
1691
1727
  fromNullishOr = (a) => a == null ? none() : some(a);
1692
1728
  getOrUndefined$1 = /*#__PURE__*/ getOrElse(constUndefined);
1729
+ liftThrowable = (f) => (...a) => {
1730
+ try {
1731
+ return some(f(...a));
1732
+ } catch {
1733
+ return none();
1734
+ }
1735
+ };
1693
1736
  map$4 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
1694
1737
  flatMap$2 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : f(self.value));
1738
+ filter$1 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
1695
1739
  })), succeed$6, fail$3, isFailure;
1696
1740
  var init_Result = __esmMin((() => {
1697
1741
  init_Function();
@@ -1699,24 +1743,24 @@ var init_Result = __esmMin((() => {
1699
1743
  succeed$6 = succeed$7;
1700
1744
  fail$3 = fail$4;
1701
1745
  isFailure = isFailure$1;
1702
- })), Array$1, fromIterable, append$1, appendAll, isArrayNonEmpty, isReadonlyArrayNonEmpty, lastNonEmpty, hashBucketsAdd, union$1, empty$1, of, map$3, dedupe, init_Array = __esmMin((() => {
1746
+ })), Array$1, fromIterable$1, append$1, appendAll, isArrayNonEmpty, isReadonlyArrayNonEmpty, lastNonEmpty, hashBucketsAdd, union$1, empty$2, of, map$3, dedupe, init_Array = __esmMin((() => {
1703
1747
  init_Equal();
1704
1748
  init_Function();
1705
1749
  init_Hash();
1706
1750
  init_array();
1707
1751
  Array$1 = globalThis.Array;
1708
- fromIterable = (collection) => Array$1.isArray(collection) ? collection : Array$1.from(collection);
1752
+ fromIterable$1 = (collection) => Array$1.isArray(collection) ? collection : Array$1.from(collection);
1709
1753
  append$1 = /*#__PURE__*/ dual(2, (self, last) => [...self, last]);
1710
- appendAll = /*#__PURE__*/ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
1754
+ appendAll = /*#__PURE__*/ dual(2, (self, that) => fromIterable$1(self).concat(fromIterable$1(that)));
1711
1755
  Array$1.isArray;
1712
1756
  isArrayNonEmpty = isArrayNonEmpty$1;
1713
1757
  isReadonlyArrayNonEmpty = isArrayNonEmpty$1;
1714
1758
  lastNonEmpty = (self) => self[self.length - 1];
1715
1759
  hashBucketsAdd = (buckets, value) => {
1716
- const hash$1 = hash(value);
1717
- const bucket = buckets.get(hash$1);
1760
+ const hash$5 = hash(value);
1761
+ const bucket = buckets.get(hash$5);
1718
1762
  if (bucket === void 0) {
1719
- buckets.set(hash$1, [value]);
1763
+ buckets.set(hash$5, [value]);
1720
1764
  return true;
1721
1765
  }
1722
1766
  for (const previous of bucket) if (equals$2(previous, value)) return false;
@@ -1724,23 +1768,23 @@ var init_Result = __esmMin((() => {
1724
1768
  return true;
1725
1769
  };
1726
1770
  union$1 = /*#__PURE__*/ dual(2, (self, that) => {
1727
- const a = fromIterable(self);
1728
- const b = fromIterable(that);
1771
+ const a = fromIterable$1(self);
1772
+ const b = fromIterable$1(that);
1729
1773
  if (isReadonlyArrayNonEmpty(a)) return isReadonlyArrayNonEmpty(b) ? dedupe(appendAll(a, b)) : a;
1730
1774
  return b;
1731
1775
  });
1732
- empty$1 = () => [];
1776
+ empty$2 = () => [];
1733
1777
  of = (a) => [a];
1734
1778
  map$3 = /*#__PURE__*/ dual(2, (self, f) => self.map(f));
1735
1779
  dedupe = (self) => {
1736
- const input = fromIterable(self);
1780
+ const input = fromIterable$1(self);
1737
1781
  if (input.length < 2) return [...input];
1738
1782
  const buckets = /* @__PURE__ */ new Map();
1739
1783
  const out = [];
1740
1784
  for (const value of input) if (hashBucketsAdd(buckets, value)) out.push(value);
1741
1785
  return out;
1742
1786
  };
1743
- })), TypeId$16, BigDecimalProto, isBigDecimal, make$14, makeNormalizedUnsafe, bigint0$2, bigint10$1, zero$1, normalize, scale, abs, Equivalence$3, equals$1, format, toExponential, isZero, isNegative;
1787
+ })), TypeId$18, BigDecimalProto, isBigDecimal, make$16, makeNormalizedUnsafe, bigint0$2, bigint10$1, zero$2, normalize, scale, abs, Equivalence$3, equals$1, format, toExponential, isZero$1, isNegative;
1744
1788
  var init_BigDecimal = __esmMin((() => {
1745
1789
  init_Equal();
1746
1790
  init_Equivalence();
@@ -1750,9 +1794,9 @@ var init_BigDecimal = __esmMin((() => {
1750
1794
  init_Order();
1751
1795
  init_Pipeable();
1752
1796
  init_Predicate();
1753
- TypeId$16 = "~effect/BigDecimal";
1797
+ TypeId$18 = "~effect/BigDecimal";
1754
1798
  BigDecimalProto = {
1755
- [TypeId$16]: TypeId$16,
1799
+ [TypeId$18]: TypeId$18,
1756
1800
  [symbol$1]() {
1757
1801
  const normalized = normalize(this);
1758
1802
  return combine(hash(normalized.value), number$1(normalized.scale));
@@ -1777,8 +1821,8 @@ var init_BigDecimal = __esmMin((() => {
1777
1821
  return pipeArguments(this, arguments);
1778
1822
  }
1779
1823
  };
1780
- isBigDecimal = (u) => hasProperty(u, TypeId$16);
1781
- make$14 = (value, scale) => {
1824
+ isBigDecimal = (u) => hasProperty(u, TypeId$18);
1825
+ make$16 = (value, scale) => {
1782
1826
  const o = Object.create(BigDecimalProto);
1783
1827
  o.value = value;
1784
1828
  o.scale = scale;
@@ -1786,15 +1830,15 @@ var init_BigDecimal = __esmMin((() => {
1786
1830
  };
1787
1831
  makeNormalizedUnsafe = (value, scale) => {
1788
1832
  if (value !== bigint0$2 && value % bigint10$1 === bigint0$2) throw new RangeError("Value must be normalized");
1789
- const o = make$14(value, scale);
1833
+ const o = make$16(value, scale);
1790
1834
  o.normalized = o;
1791
1835
  return o;
1792
1836
  };
1793
1837
  bigint0$2 = /*#__PURE__*/ BigInt(0);
1794
1838
  bigint10$1 = /*#__PURE__*/ BigInt(10);
1795
- zero$1 = /*#__PURE__*/ makeNormalizedUnsafe(bigint0$2, 0);
1839
+ zero$2 = /*#__PURE__*/ makeNormalizedUnsafe(bigint0$2, 0);
1796
1840
  normalize = (self) => {
1797
- if (self.normalized === void 0) if (self.value === bigint0$2) self.normalized = zero$1;
1841
+ if (self.normalized === void 0) if (self.value === bigint0$2) self.normalized = zero$2;
1798
1842
  else {
1799
1843
  const digits = `${self.value}`;
1800
1844
  let trail = 0;
@@ -1808,12 +1852,12 @@ var init_BigDecimal = __esmMin((() => {
1808
1852
  return self.normalized;
1809
1853
  };
1810
1854
  scale = /*#__PURE__*/ dual(2, (self, scale) => {
1811
- if (scale > self.scale) return make$14(self.value * bigint10$1 ** BigInt(scale - self.scale), scale);
1812
- if (scale < self.scale) return make$14(self.value / bigint10$1 ** BigInt(self.scale - scale), scale);
1855
+ if (scale > self.scale) return make$16(self.value * bigint10$1 ** BigInt(scale - self.scale), scale);
1856
+ if (scale < self.scale) return make$16(self.value / bigint10$1 ** BigInt(self.scale - scale), scale);
1813
1857
  return self;
1814
1858
  });
1815
- abs = (n) => n.value < bigint0$2 ? make$14(-n.value, n.scale) : n;
1816
- Equivalence$3 = /*#__PURE__*/ make$16((self, that) => {
1859
+ abs = (n) => n.value < bigint0$2 ? make$16(-n.value, n.scale) : n;
1860
+ Equivalence$3 = /*#__PURE__*/ make$18((self, that) => {
1817
1861
  if (self.scale > that.scale) return scale(that, self.scale).value === self.value;
1818
1862
  if (self.scale < that.scale) return scale(self, that.scale).value === that.value;
1819
1863
  return self.value === that.value;
@@ -1844,7 +1888,7 @@ var init_BigDecimal = __esmMin((() => {
1844
1888
  return negative ? `-${complete}` : complete;
1845
1889
  };
1846
1890
  toExponential = (n) => {
1847
- if (isZero(n)) return "0e+0";
1891
+ if (isZero$1(n)) return "0e+0";
1848
1892
  const normalized = normalize(n);
1849
1893
  const digits = `${abs(normalized).value}`;
1850
1894
  const head = digits.slice(0, 1);
@@ -1854,7 +1898,7 @@ var init_BigDecimal = __esmMin((() => {
1854
1898
  const exp = tail.length - normalized.scale;
1855
1899
  return `${output}e${exp >= 0 ? "+" : ""}${exp}`;
1856
1900
  };
1857
- isZero = (n) => n.value === bigint0$2;
1901
+ isZero$1 = (n) => n.value === bigint0$2;
1858
1902
  isNegative = (n) => n.value < bigint0$2;
1859
1903
  }));
1860
1904
  //#endregion
@@ -1869,7 +1913,7 @@ var init_Effectable = __esmMin((() => {
1869
1913
  }));
1870
1914
  //#endregion
1871
1915
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Context.js
1872
- var ServiceTypeId, Service, ServiceProto, cacheKeys, ReferenceTypeId, TypeId$15, MaxDepth, FlattenAfterBaseHits, makeImpl, applyOverlays, flatten$1, withFlat, notFound, lookup, makeUnsafe$5, Proto$2, hasSameCache, isContext, isReference, empty, emptyContext, make$13, add$1, addUnsafe, getOrUndefined, getOrUndefinedUnsafe, getUnsafe$1, get, defaultValueCacheKey, getDefaultValue, serviceNotFoundError, merge, mergeAll$1, Reference;
1916
+ var ServiceTypeId, Service, ServiceProto, cacheKeys, ReferenceTypeId, TypeId$17, MaxDepth, FlattenAfterBaseHits, makeImpl, applyOverlays, flatten$1, withFlat, notFound, lookup, makeUnsafe$5, Proto$3, hasSameCache, isContext, isReference, empty$1, emptyContext, make$15, add$1, addUnsafe, getOrUndefined, getOrUndefinedUnsafe, getUnsafe$1, get$2, defaultValueCacheKey, getDefaultValue, serviceNotFoundError, merge, mergeAll$1, Reference;
1873
1917
  var init_Context = __esmMin((() => {
1874
1918
  init_Effectable();
1875
1919
  init_Equal();
@@ -1899,7 +1943,7 @@ var init_Context = __esmMin((() => {
1899
1943
  .../*#__PURE__*/ Prototype({
1900
1944
  label: "Service",
1901
1945
  evaluate(fiber) {
1902
- return exitSucceed(get(fiber.context, this));
1946
+ return exitSucceed(get$2(fiber.context, this));
1903
1947
  }
1904
1948
  }),
1905
1949
  toJSON() {
@@ -1912,22 +1956,22 @@ var init_Context = __esmMin((() => {
1912
1956
  return self;
1913
1957
  },
1914
1958
  context(self) {
1915
- return make$13(this, self);
1959
+ return make$15(this, self);
1916
1960
  },
1917
1961
  use(f) {
1918
- return withFiber$1((fiber) => f(get(fiber.context, this)));
1962
+ return withFiber$1((fiber) => f(get$2(fiber.context, this)));
1919
1963
  },
1920
1964
  useSync(f) {
1921
- return withFiber$1((fiber) => exitSucceed(f(get(fiber.context, this))));
1965
+ return withFiber$1((fiber) => exitSucceed(f(get$2(fiber.context, this))));
1922
1966
  }
1923
1967
  };
1924
1968
  cacheKeys = /*#__PURE__*/ new Set();
1925
1969
  ReferenceTypeId = "~effect/Context/Reference";
1926
- TypeId$15 = "~effect/Context";
1970
+ TypeId$17 = "~effect/Context";
1927
1971
  MaxDepth = 8;
1928
1972
  FlattenAfterBaseHits = 8;
1929
1973
  makeImpl = (cacheRoot, base, overlay, depth) => {
1930
- const self = Object.create(Proto$2);
1974
+ const self = Object.create(Proto$3);
1931
1975
  self.cacheRoot = cacheRoot ?? self;
1932
1976
  self.base = base;
1933
1977
  self.overlay = overlay;
@@ -1967,9 +2011,9 @@ var init_Context = __esmMin((() => {
1967
2011
  return value;
1968
2012
  };
1969
2013
  makeUnsafe$5 = (mapUnsafe) => makeImpl(void 0, mapUnsafe, void 0, 0);
1970
- Proto$2 = {
2014
+ Proto$3 = {
1971
2015
  ...PipeInspectableProto,
1972
- [TypeId$15]: { _Services: (_) => _ },
2016
+ [TypeId$17]: { _Services: (_) => _ },
1973
2017
  get mapUnsafe() {
1974
2018
  return flatten$1(this);
1975
2019
  },
@@ -1995,11 +2039,11 @@ var init_Context = __esmMin((() => {
1995
2039
  }
1996
2040
  };
1997
2041
  hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
1998
- isContext = (u) => hasProperty(u, TypeId$15);
2042
+ isContext = (u) => hasProperty(u, TypeId$17);
1999
2043
  isReference = (u) => !!u[ReferenceTypeId];
2000
- empty = () => emptyContext;
2044
+ empty$1 = () => emptyContext;
2001
2045
  emptyContext = /*#__PURE__*/ makeUnsafe$5(/*#__PURE__*/ new Map());
2002
- make$13 = (key, service) => makeUnsafe$5(/* @__PURE__ */ new Map([[key.key, service]]));
2046
+ make$15 = (key, service) => makeUnsafe$5(/* @__PURE__ */ new Map([[key.key, service]]));
2003
2047
  add$1 = /*#__PURE__*/ dual(3, (self, key, service) => addUnsafe(self, key.key, service));
2004
2048
  addUnsafe = (self, key, service) => {
2005
2049
  const impl = self;
@@ -2028,7 +2072,7 @@ var init_Context = __esmMin((() => {
2028
2072
  }
2029
2073
  return value;
2030
2074
  });
2031
- get = getUnsafe$1;
2075
+ get$2 = getUnsafe$1;
2032
2076
  defaultValueCacheKey = "~effect/Context/defaultValue";
2033
2077
  getDefaultValue = (ref) => {
2034
2078
  if (defaultValueCacheKey in ref) return ref[defaultValueCacheKey];
@@ -2059,7 +2103,7 @@ var init_Context = __esmMin((() => {
2059
2103
  }));
2060
2104
  //#endregion
2061
2105
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Duration.js
2062
- var TypeId$14, bigint0$1, bigint1, bigint2, bigint10, bigint1e3, roundTiesAwayFromZero, roundMillisToNanos, parseNanos, DURATION_REGEXP, fromInputUnsafe, invalid, zeroDurationValue, infinityDurationValue, negativeInfinityDurationValue, DurationProto, make$12, isDuration, zero, infinity, negativeInfinity, nanos, millis, seconds, minutes, hours, days, weeks, toMillis, toNanosUnsafe, match$1, matchPair, Equivalence$2, equals;
2106
+ var TypeId$16, bigint0$1, bigint1, bigint2, bigint10, bigint1e3, roundTiesAwayFromZero, roundMillisToNanos, parseNanos, DURATION_REGEXP, fromInputUnsafe, invalid, zeroDurationValue, infinityDurationValue, negativeInfinityDurationValue, DurationProto, make$14, isDuration, isFinite$1, isZero, zero$1, infinity, negativeInfinity, nanos, millis, seconds, minutes, hours, days, weeks, toMillis, toNanosUnsafe, match$1, matchPair, Equivalence$2, equals;
2063
2107
  var init_Duration = __esmMin((() => {
2064
2108
  init_Equal();
2065
2109
  init_Function();
@@ -2067,7 +2111,7 @@ var init_Duration = __esmMin((() => {
2067
2111
  init_Inspectable();
2068
2112
  init_Pipeable();
2069
2113
  init_Predicate();
2070
- TypeId$14 = "~effect/time/Duration";
2114
+ TypeId$16 = "~effect/time/Duration";
2071
2115
  bigint0$1 = /*#__PURE__*/ BigInt(0);
2072
2116
  bigint1 = /*#__PURE__*/ BigInt(1);
2073
2117
  bigint2 = /*#__PURE__*/ BigInt(2);
@@ -2117,13 +2161,13 @@ var init_Duration = __esmMin((() => {
2117
2161
  }
2118
2162
  case "object": {
2119
2163
  if (input === null) break;
2120
- if (TypeId$14 in input) return input;
2164
+ if (TypeId$16 in input) return input;
2121
2165
  if (Array.isArray(input)) {
2122
2166
  if (input.length !== 2 || !input.every(isNumber)) return invalid(input);
2123
- if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero;
2167
+ if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero$1;
2124
2168
  if (input[0] === -Infinity || input[1] === -Infinity) return negativeInfinity;
2125
2169
  if (input[0] === Infinity || input[1] === Infinity) return infinity;
2126
- return make$12(roundTiesAwayFromZero(input[0] * 1e9 + input[1]));
2170
+ return make$14(roundTiesAwayFromZero(input[0] * 1e9 + input[1]));
2127
2171
  }
2128
2172
  const obj = input;
2129
2173
  let millis = 0;
@@ -2133,8 +2177,8 @@ var init_Duration = __esmMin((() => {
2133
2177
  if (obj.minutes) millis += obj.minutes * 6e4;
2134
2178
  if (obj.seconds) millis += obj.seconds * 1e3;
2135
2179
  if (obj.milliseconds) millis += obj.milliseconds;
2136
- if (!obj.microseconds && !obj.nanoseconds) return make$12(millis);
2137
- return make$12(roundTiesAwayFromZero(millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0)));
2180
+ if (!obj.microseconds && !obj.nanoseconds) return make$14(millis);
2181
+ return make$14(roundTiesAwayFromZero(millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0)));
2138
2182
  }
2139
2183
  }
2140
2184
  return invalid(input);
@@ -2149,7 +2193,7 @@ var init_Duration = __esmMin((() => {
2149
2193
  infinityDurationValue = { _tag: "Infinity" };
2150
2194
  negativeInfinityDurationValue = { _tag: "NegativeInfinity" };
2151
2195
  DurationProto = {
2152
- [TypeId$14]: TypeId$14,
2196
+ [TypeId$16]: TypeId$16,
2153
2197
  [symbol$1]() {
2154
2198
  switch (this.value._tag) {
2155
2199
  case "Millis": {
@@ -2200,7 +2244,7 @@ var init_Duration = __esmMin((() => {
2200
2244
  return pipeArguments(this, arguments);
2201
2245
  }
2202
2246
  };
2203
- make$12 = (input) => {
2247
+ make$14 = (input) => {
2204
2248
  const duration = Object.create(DurationProto);
2205
2249
  if (typeof input === "number") if (isNaN(input) || input === 0 || Object.is(input, -0)) duration.value = zeroDurationValue;
2206
2250
  else if (!Number.isFinite(input)) duration.value = input > 0 ? infinityDurationValue : negativeInfinityDurationValue;
@@ -2219,17 +2263,26 @@ var init_Duration = __esmMin((() => {
2219
2263
  };
2220
2264
  return duration;
2221
2265
  };
2222
- isDuration = (u) => hasProperty(u, TypeId$14);
2223
- zero = /*#__PURE__*/ make$12(0);
2224
- infinity = /*#__PURE__*/ make$12(Infinity);
2225
- negativeInfinity = /*#__PURE__*/ make$12(-Infinity);
2226
- nanos = (nanos) => make$12(nanos);
2227
- millis = (millis) => make$12(millis);
2228
- seconds = (seconds) => make$12(seconds * 1e3);
2229
- minutes = (minutes) => make$12(minutes * 6e4);
2230
- hours = (hours) => make$12(hours * 36e5);
2231
- days = (days) => make$12(days * 864e5);
2232
- weeks = (weeks) => make$12(weeks * 6048e5);
2266
+ isDuration = (u) => hasProperty(u, TypeId$16);
2267
+ isFinite$1 = (self) => self.value._tag !== "Infinity" && self.value._tag !== "NegativeInfinity";
2268
+ isZero = (self) => {
2269
+ switch (self.value._tag) {
2270
+ case "Millis": return self.value.millis === 0;
2271
+ case "Nanos": return self.value.nanos === bigint0$1;
2272
+ case "Infinity":
2273
+ case "NegativeInfinity": return false;
2274
+ }
2275
+ };
2276
+ zero$1 = /*#__PURE__*/ make$14(0);
2277
+ infinity = /*#__PURE__*/ make$14(Infinity);
2278
+ negativeInfinity = /*#__PURE__*/ make$14(-Infinity);
2279
+ nanos = (nanos) => make$14(nanos);
2280
+ millis = (millis) => make$14(millis);
2281
+ seconds = (seconds) => make$14(seconds * 1e3);
2282
+ minutes = (minutes) => make$14(minutes * 6e4);
2283
+ hours = (hours) => make$14(hours * 36e5);
2284
+ days = (days) => make$14(days * 864e5);
2285
+ weeks = (weeks) => make$14(weeks * 6048e5);
2233
2286
  toMillis = (self) => match$1(fromInputUnsafe(self), {
2234
2287
  onMillis: identity,
2235
2288
  onNanos: (nanos) => Number(nanos) / 1e6,
@@ -2456,7 +2509,7 @@ var init_Encoding = __esmMin((() => {
2456
2509
  }));
2457
2510
  //#endregion
2458
2511
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Tracer.js
2459
- var ParentSpanKey, ParentSpan, make$11, DisablePropagation, CurrentTraceLevel, MinimumTraceLevel, TracerKey, Tracer, NativeSpan;
2512
+ var ParentSpanKey, ParentSpan, make$13, DisablePropagation, CurrentTraceLevel, MinimumTraceLevel, TracerKey, Tracer, NativeSpan;
2460
2513
  var init_Tracer = __esmMin((() => {
2461
2514
  init_Context();
2462
2515
  init_Encoding();
@@ -2464,14 +2517,14 @@ var init_Tracer = __esmMin((() => {
2464
2517
  init_Option();
2465
2518
  ParentSpanKey = "effect/Tracer/ParentSpan";
2466
2519
  ParentSpan = class extends Service()(ParentSpanKey, { fiberCached: true }) {};
2467
- make$11 = (options) => options;
2520
+ make$13 = (options) => options;
2468
2521
  DisablePropagation = /*#__PURE__*/ Reference("effect/Tracer/DisablePropagation", { defaultValue: constFalse });
2469
2522
  CurrentTraceLevel = /*#__PURE__*/ Reference("effect/Tracer/CurrentTraceLevel", { defaultValue: () => "Info" });
2470
2523
  MinimumTraceLevel = /*#__PURE__*/ Reference("effect/Tracer/MinimumTraceLevel", { defaultValue: () => "All" });
2471
2524
  TracerKey = "effect/Tracer";
2472
2525
  Tracer = /*#__PURE__*/ Reference(TracerKey, {
2473
2526
  fiberCached: true,
2474
- defaultValue: () => make$11({ span: (options) => new NativeSpan(options) })
2527
+ defaultValue: () => make$13({ span: (options) => new NativeSpan(options) })
2475
2528
  });
2476
2529
  NativeSpan = class {
2477
2530
  _tag = "Span";
@@ -2594,7 +2647,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
2594
2647
  };
2595
2648
  };
2596
2649
  spanCleaner = /*#__PURE__*/ makeStackCleaner(3);
2597
- })), Interrupt, causeInterrupt, findFail, findError$1, hasInterrupts, causeFilterInterruptors, causeCombine, causeMap, causePartition, causeSquash, causePrettyErrors, causePrettyError, causePrettyMessage, locationRegExp, cleanErrorStack, addStackAnnotations, interruptCauseStack, currentStackTrace, causePretty, renderPrettyError, renderErrorCause, FiberTypeId, fiberVariance, fiberIdStore, getCurrentFiber, FiberImpl, deferredInterruptCont, fiberMiddleware, fiberStackAnnotations, fiberAwait, fiberAwaitAll, fiberInterrupt, fiberInterruptAs, fiberInterruptAll, succeed$5, failCause$3, fail$2, sync$2, suspend$1, yieldNowWith, yieldNow, succeedNone$1, failCauseSync$1, die, failSync, void_$2, try_$1, promise$1, tryPromise$1, withFiberId, callbackOptions, asyncFinalizer, callback$2, never, gen$1, fnUntraced$1, defineFunctionLength, fnStackCleaner, fn$1, makeFn, fnUntracedEager$1, fromIteratorEagerUnsafe, fromIteratorUnsafe, as$1, asSome, andThen$1, tap$1, asVoid$1, raceAllFirst, raceFirst$1, flatMap$1, OnSuccessProto, effectIsExit, flatMapEager$1, map$2, mapEager$1, exitInterrupt$1, exitIsSuccess, exitFilterCause, exitVoid, exitMap, exitAsVoidAll, updateContext, updateService, contextWith$1, provideContext, provideService, provideServiceImpl, when$1, forever$2, catchCause$1, OnFailureProto, catchCauseFilter, catch_, catchIf, catchTag$1, mapError$1, orElseSucceed$1, ignore$1, option$2, result, matchCauseEffect, OnSuccessAndFailureProto, matchEffect$1, match, matchEager, exit$1, exitPrimitive, ScopeTypeId, ScopeCloseableTypeId, scopeTag, scopeClose, scopeCloseUnsafe, scopeCloseFinalizers, scopeForkUnsafe, scopeAddFinalizerExit, scopeAddFinalizer, scopeAddFinalizerUnsafe, scopeRemoveFinalizerUnsafe, scopeMakeUnsafe, constScopeEmpty, scope, provideScope, scopedWith, acquireRelease$1, onExitPrimitive, onExit$1, ensuring$1, onExitFilter, onError$1, onErrorFilter, onInterrupt$1, acquireUseRelease$1, interrupt$2, uninterruptible$1, setInterruptible, setInterruptibleTrue, setInterruptibleFalse, setFiberInterruptible, interruptible, uninterruptibleMask, all$1, whileLoop$1, forEach$1, forEachSequential, iterateEagerImpl, iterateEager, forEachConcurrent, forkUnsafe$1, forkDetach$1, forkIn$1, runForkWith, runFork$1, runPromiseExitWith, runPromiseWith, runPromise$1, runSyncExitWith, runSyncExit$1, runSyncWith, runSync$1, succeedTrue, succeedFalse, Latch, makeLatchUnsafe, bigint0, NoopSpanProto, noopSpan, filterDisablePropagation, makeSpanUnsafe, provideSpanStackFrame, endSpan, useSpan, provideParentSpan, withParentSpan, withSpan$1, ClockRef, MAX_TIMER_MILLIS, ClockImpl, nanosPerMilli, monotonicNowNanos, wallTimeNanos, clockWith, sleep$1, AsyncFiberErrorTypeId, AsyncFiberError, UnknownErrorTypeId, UnknownError, ConsoleRef, logLevelToOrder, LogLevelOrder, isLogLevelGreaterThan, CurrentLoggers, LogToStderr, LoggerTypeId, LoggerProto, loggerMake, formatLabel, formatLogSpan, logWithLevel, colors, defaultDateFormat, defaultLogger, tracerLogger, init_effect = __esmMin((() => {
2650
+ })), Interrupt, causeInterrupt, findFail, findError$1, hasInterrupts, causeFilterInterruptors, causeCombine, causeMap, causePartition, causeSquash, causePrettyErrors, causePrettyError, causePrettyMessage, locationRegExp, cleanErrorStack, addStackAnnotations, interruptCauseStack, currentStackTrace, causePretty, renderPrettyError, renderErrorCause, FiberTypeId, fiberVariance, fiberIdStore, getCurrentFiber, FiberImpl, deferredInterruptCont, fiberMiddleware, fiberStackAnnotations, fiberAwait, fiberAwaitAll, fiberJoin, fiberInterrupt, fiberInterruptAs, fiberInterruptAll, succeed$5, failCause$3, fail$2, sync$2, suspend$1, yieldNowWith, yieldNow, succeedNone$1, failCauseSync$1, die, failSync, void_$2, try_$1, promise$1, tryPromise$1, withFiberId, callbackOptions, asyncFinalizer, callback$2, never, gen$1, fnUntraced$1, defineFunctionLength, fnStackCleaner, fn$1, makeFn, fnUntracedEager$1, fromIteratorEagerUnsafe, fromIteratorUnsafe, as$1, asSome, andThen$1, tap$1, asVoid$1, raceAllFirst, raceFirst$1, flatMap$1, OnSuccessProto, effectIsExit, flatMapEager$1, map$2, mapEager$1, exitInterrupt$1, exitIsSuccess, exitFilterCause, exitHasInterrupts, exitVoid, exitMap, exitAsVoidAll, updateContext, updateService, contextWith$1, provideContext, provideService, provideServiceImpl, when$1, forever$2, catchCause$1, OnFailureProto, catchCauseFilter, catch_, catchIf, catchTag$1, mapError$1, orElseSucceed$1, ignore$1, option$2, result, matchCauseEffect, OnSuccessAndFailureProto, matchEffect$1, match, matchEager, exit$1, exitPrimitive, ScopeTypeId, ScopeCloseableTypeId, scopeTag, scopeClose, scopeCloseUnsafe, scopeCloseFinalizers, scopeForkUnsafe, scopeAddFinalizerExit, scopeAddFinalizer, scopeAddFinalizerUnsafe, scopeRemoveFinalizerUnsafe, scopeMakeUnsafe, constScopeEmpty, scope, provideScope, scopedWith, acquireRelease$1, onExitPrimitive, onExit$1, ensuring$1, onExitFilter, onError$1, onErrorFilter, onInterrupt$1, acquireUseRelease$1, interrupt$2, uninterruptible$1, setInterruptible, setInterruptibleTrue, setInterruptibleFalse, setFiberInterruptible, interruptible, uninterruptibleMask, all$1, whileLoop$1, forEach$1, forEachSequential, iterateEagerImpl, iterateEager, forEachConcurrent, forkUnsafe$1, forkDetach$1, forkIn$1, runForkWith, runFork$1, runPromiseExitWith, runPromiseWith, runPromise$1, runSyncExitWith, runSyncExit$1, runSyncWith, runSync$1, succeedTrue, succeedFalse, Latch, makeLatchUnsafe, bigint0, NoopSpanProto, noopSpan, filterDisablePropagation, makeSpanUnsafe, provideSpanStackFrame, endSpan, useSpan, provideParentSpan, withParentSpan, withSpan$1, ClockRef, MAX_TIMER_MILLIS, ClockImpl, nanosPerMilli, monotonicNowNanos, wallTimeNanos, clockWith, sleep$1, AsyncFiberErrorTypeId, AsyncFiberError, UnknownErrorTypeId, UnknownError, ConsoleRef, logLevelToOrder, LogLevelOrder, isLogLevelGreaterThan, CurrentLoggers, LogToStderr, LoggerTypeId, LoggerProto, loggerMake, formatLabel, formatLogSpan, logWithLevel, colors, defaultDateFormat, defaultLogger, tracerLogger, init_effect = __esmMin((() => {
2598
2651
  init_Array();
2599
2652
  init_Context();
2600
2653
  init_Duration();
@@ -2850,7 +2903,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
2850
2903
  return this._dispatcher ??= this.currentScheduler.makeDispatcher();
2851
2904
  }
2852
2905
  getRef(ref) {
2853
- return get(this.context, ref);
2906
+ return get$2(this.context, ref);
2854
2907
  }
2855
2908
  addObserver(cb) {
2856
2909
  if (this._exit) {
@@ -2866,7 +2919,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
2866
2919
  interruptUnsafe(fiberId, annotations) {
2867
2920
  if (this._exit) return;
2868
2921
  let cause = causeInterrupt(fiberId);
2869
- if (this.currentStackFrame) cause = causeAnnotate(cause, make$13(StackTraceKey, this.currentStackFrame));
2922
+ if (this.currentStackFrame) cause = causeAnnotate(cause, make$15(StackTraceKey, this.currentStackFrame));
2870
2923
  if (annotations) cause = causeAnnotate(cause, annotations);
2871
2924
  this._interruptedCause = this._interruptedCause ? causeCombine(this._interruptedCause, cause) : cause;
2872
2925
  if (this.interruptible) if (this._running) this._deferredInterrupt = true;
@@ -2892,7 +2945,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
2892
2945
  this._observers.length = 0;
2893
2946
  this._stack.length = 0;
2894
2947
  this._children = void 0;
2895
- this.context = empty();
2948
+ this.context = empty$1();
2896
2949
  }
2897
2950
  runLoop(effect) {
2898
2951
  const prevFiber = globalThis[currentFiberTypeId];
@@ -3032,6 +3085,14 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3032
3085
  loop();
3033
3086
  return sync$2(() => cancel?.());
3034
3087
  });
3088
+ fiberJoin = (self) => {
3089
+ const impl = self;
3090
+ if (impl._exit) return impl._exit;
3091
+ return callback$2((resume) => {
3092
+ if (impl._exit) return resume(impl._exit);
3093
+ return sync$2(self.addObserver(resume));
3094
+ });
3095
+ };
3035
3096
  fiberInterrupt = (self) => withFiber$1((fiber) => fiberInterruptAs(self, fiber.id));
3036
3097
  fiberInterruptAs = /*#__PURE__*/ dual((args) => hasProperty(args[0], FiberTypeId), (self, fiberId, annotations) => withFiber$1((parent) => {
3037
3098
  let ann = fiberStackAnnotations(parent);
@@ -3041,7 +3102,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3041
3102
  }));
3042
3103
  fiberInterruptAll = (fibers) => withFiber$1((parent) => {
3043
3104
  const annotations = fiberStackAnnotations(parent);
3044
- let fiberArr = empty$1();
3105
+ let fiberArr = empty$2();
3045
3106
  for (const fiber of fibers) {
3046
3107
  fiber.interruptUnsafe(parent.id, annotations);
3047
3108
  fiberArr.push(fiber);
@@ -3320,6 +3381,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3320
3381
  exitInterrupt$1 = (fiberId) => exitFailCause(causeInterrupt(fiberId));
3321
3382
  exitIsSuccess = (self) => self._tag === "Success";
3322
3383
  exitFilterCause = (self) => self._tag === "Failure" ? succeed$6(self.cause) : fail$3(self);
3384
+ exitHasInterrupts = (self) => self._tag === "Failure" && hasInterrupts(self.cause);
3323
3385
  exitVoid = /*#__PURE__*/ exitSucceed(void 0);
3324
3386
  exitMap = /*#__PURE__*/ dual(2, (self, f) => self._tag === "Success" ? exitSucceed(f(self.value)) : self);
3325
3387
  exitAsVoidAll = (exits) => {
@@ -3638,7 +3700,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3638
3700
  const concurrencyOption = options?.concurrency ?? 1;
3639
3701
  const concurrency = concurrencyOption === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrencyOption);
3640
3702
  if (concurrency === 1) return forEachSequential(iterable, f, options);
3641
- const items = fromIterable(iterable);
3703
+ const items = fromIterable$1(iterable);
3642
3704
  let length = items.length;
3643
3705
  if (length === 0) return options?.discard ? void_$2 : succeed$5([]);
3644
3706
  const out = options?.discard ? void 0 : new Array(length);
@@ -3835,7 +3897,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3835
3897
  if (options?.onFiberStart) options.onFiberStart(fiber);
3836
3898
  return fiber;
3837
3899
  };
3838
- runFork$1 = /*#__PURE__*/ runForkWith(/*#__PURE__*/ empty());
3900
+ runFork$1 = /*#__PURE__*/ runForkWith(/*#__PURE__*/ empty$1());
3839
3901
  runPromiseExitWith = (context) => {
3840
3902
  const runFork = runForkWith(context);
3841
3903
  return (effect, options) => {
@@ -3852,7 +3914,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3852
3914
  return exit.value;
3853
3915
  });
3854
3916
  };
3855
- runPromise$1 = /*#__PURE__*/ runPromiseWith(/*#__PURE__*/ empty());
3917
+ runPromise$1 = /*#__PURE__*/ runPromiseWith(/*#__PURE__*/ empty$1());
3856
3918
  runSyncExitWith = (context) => {
3857
3919
  const runFork = runForkWith(context);
3858
3920
  return (effect) => {
@@ -3863,7 +3925,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3863
3925
  return fiber._exit ?? exitDie(new AsyncFiberError(fiber));
3864
3926
  };
3865
3927
  };
3866
- runSyncExit$1 = /*#__PURE__*/ runSyncExitWith(/*#__PURE__*/ empty());
3928
+ runSyncExit$1 = /*#__PURE__*/ runSyncExitWith(/*#__PURE__*/ empty$1());
3867
3929
  runSyncWith = (context) => {
3868
3930
  const runSyncExit = runSyncExitWith(context);
3869
3931
  return (effect) => {
@@ -3872,7 +3934,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3872
3934
  return exit.value;
3873
3935
  };
3874
3936
  };
3875
- runSync$1 = /*#__PURE__*/ runSyncWith(/*#__PURE__*/ empty());
3937
+ runSync$1 = /*#__PURE__*/ runSyncWith(/*#__PURE__*/ empty$1());
3876
3938
  succeedTrue = /*#__PURE__*/ succeed$5(true);
3877
3939
  succeedFalse = /*#__PURE__*/ succeed$5(false);
3878
3940
  Latch = class {
@@ -3962,16 +4024,16 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3962
4024
  noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
3963
4025
  filterDisablePropagation = (span) => {
3964
4026
  if (!span) return none();
3965
- return get(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some(span);
4027
+ return get$2(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some(span);
3966
4028
  };
3967
4029
  makeSpanUnsafe = (fiber, name, options) => {
3968
- const disablePropagation = !fiber.getRef(TracerEnabled) || options?.annotations && get(options.annotations, DisablePropagation);
4030
+ const disablePropagation = !fiber.getRef(TracerEnabled) || options?.annotations && get$2(options.annotations, DisablePropagation);
3969
4031
  const parent = options?.parent !== void 0 ? some(options.parent) : options?.root ? none() : filterDisablePropagation(fiber.currentSpan);
3970
4032
  let span;
3971
4033
  if (disablePropagation) span = noopSpan({
3972
4034
  name,
3973
4035
  parent,
3974
- annotations: add$1(options?.annotations ?? empty(), DisablePropagation, true)
4036
+ annotations: add$1(options?.annotations ?? empty$1(), DisablePropagation, true)
3975
4037
  });
3976
4038
  else {
3977
4039
  const tracer = fiber.getRef(Tracer);
@@ -3984,7 +4046,7 @@ var CurrentStackFrame, TracerEnabled, TracerTimingEnabled, TracerSpanAnnotations
3984
4046
  span = tracer.span({
3985
4047
  name,
3986
4048
  parent,
3987
- annotations: options?.annotations ?? empty(),
4049
+ annotations: options?.annotations ?? empty$1(),
3988
4050
  links,
3989
4051
  startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0),
3990
4052
  kind: options?.kind ?? "internal",
@@ -4250,14 +4312,14 @@ var succeed$4, failCause$2, fail$1, void_$1, isSuccess, init_Exit = __esmMin((()
4250
4312
  fail$1 = exitFail;
4251
4313
  void_$1 = exitVoid;
4252
4314
  isSuccess = exitIsSuccess;
4253
- })), TypeId$13, DeferredProto, makeUnsafe$4, _await, completeWith, done, failCause$1, interruptWith, succeed$3, doneUnsafe, init_Deferred = __esmMin((() => {
4315
+ })), TypeId$15, DeferredProto, makeUnsafe$4, _await, completeWith, done, failCause$1, interruptWith, succeed$3, doneUnsafe, init_Deferred = __esmMin((() => {
4254
4316
  init_Function();
4255
4317
  init_core();
4256
4318
  init_effect();
4257
4319
  init_Pipeable();
4258
- TypeId$13 = "~effect/Deferred";
4320
+ TypeId$15 = "~effect/Deferred";
4259
4321
  DeferredProto = {
4260
- [TypeId$13]: {
4322
+ [TypeId$15]: {
4261
4323
  _A: identity,
4262
4324
  _E: identity
4263
4325
  },
@@ -4305,7 +4367,7 @@ var succeed$4, failCause$2, fail$1, void_$1, isSuccess, init_Exit = __esmMin((()
4305
4367
  addFinalizer = scopeAddFinalizer;
4306
4368
  forkUnsafe = scopeForkUnsafe;
4307
4369
  close = scopeClose;
4308
- })), TypeId$12, MemoMapTypeId, memoMapReuse, LayerProto, fromBuildUnsafe, fromBuild, fromBuildMemo, memoMapBuild, MemoMapImpl, makeMemoMapUnsafe, forkMemoMapUnsafe, CurrentMemoMap, buildWithMemoMap, buildWithScope, succeed$2, succeedContext, sync$1, syncContext, mergeAllEffect, mergeAll, init_Layer = __esmMin((() => {
4370
+ })), TypeId$14, MemoMapTypeId, memoMapReuse, LayerProto, fromBuildUnsafe, fromBuild, fromBuildMemo, memoMapBuild, MemoMapImpl, makeMemoMapUnsafe, forkMemoMapUnsafe, CurrentMemoMap, buildWithMemoMap, buildWithScope, succeed$2, succeedContext, sync$1, syncContext, effect, effectImpl, effectContext, mergeAllEffect, mergeAll, init_Layer = __esmMin((() => {
4309
4371
  init_Context();
4310
4372
  init_Deferred();
4311
4373
  init_Function();
@@ -4313,14 +4375,14 @@ var succeed$4, failCause$2, fail$1, void_$1, isSuccess, init_Exit = __esmMin((()
4313
4375
  init_effect();
4314
4376
  init_Pipeable();
4315
4377
  init_Scope();
4316
- TypeId$12 = "~effect/Layer";
4378
+ TypeId$14 = "~effect/Layer";
4317
4379
  MemoMapTypeId = "~effect/Layer/MemoMap";
4318
4380
  memoMapReuse = (entry, scope) => {
4319
4381
  entry.observers++;
4320
4382
  return andThen$1(scopeAddFinalizerExit(scope, (exit) => entry.finalizer(exit)), entry.effect);
4321
4383
  };
4322
4384
  LayerProto = {
4323
- [TypeId$12]: {
4385
+ [TypeId$14]: {
4324
4386
  _ROut: identity,
4325
4387
  _E: identity,
4326
4388
  _RIn: identity
@@ -4396,15 +4458,21 @@ var succeed$4, failCause$2, fail$1, void_$1, isSuccess, init_Exit = __esmMin((()
4396
4458
  buildWithMemoMap = /*#__PURE__*/ dual(3, (self, memoMap, scope) => provideService(map$2(self.build(memoMap, scope), add$1(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
4397
4459
  buildWithScope = /*#__PURE__*/ dual(2, (self, scope) => withFiber$1((fiber) => buildWithMemoMap(self, CurrentMemoMap.forkOrCreate(fiber.context), scope)));
4398
4460
  succeed$2 = function() {
4399
- if (arguments.length === 1) return (resource) => succeedContext(make$13(arguments[0], resource));
4400
- return succeedContext(make$13(arguments[0], arguments[1]));
4461
+ if (arguments.length === 1) return (resource) => succeedContext(make$15(arguments[0], resource));
4462
+ return succeedContext(make$15(arguments[0], arguments[1]));
4401
4463
  };
4402
4464
  succeedContext = (context) => fromBuildUnsafe(constant(succeed$5(context)));
4403
4465
  sync$1 = function() {
4404
- if (arguments.length === 1) return (evaluate) => syncContext(() => make$13(arguments[0], evaluate()));
4405
- return syncContext(() => make$13(arguments[0], arguments[1]()));
4466
+ if (arguments.length === 1) return (evaluate) => syncContext(() => make$15(arguments[0], evaluate()));
4467
+ return syncContext(() => make$15(arguments[0], arguments[1]()));
4406
4468
  };
4407
4469
  syncContext = (evaluate) => fromBuildMemo(constant(sync$2(evaluate)));
4470
+ effect = function() {
4471
+ if (arguments.length === 1) return (effect) => effectImpl(arguments[0], effect);
4472
+ return effectImpl(arguments[0], arguments[1]);
4473
+ };
4474
+ effectImpl = (service, effect) => effectContext(map$2(effect, (value) => make$15(service, value)));
4475
+ effectContext = (effect) => fromBuildMemo((_, scope) => provide$2(effect, scope));
4408
4476
  mergeAllEffect = (layers, memoMap, scope) => {
4409
4477
  const parentScope = forkUnsafe(scope, "parallel");
4410
4478
  return forEach$1(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$2((context) => mergeAll$1(...context)));
@@ -4413,7 +4481,7 @@ var succeed$4, failCause$2, fail$1, void_$1, isSuccess, init_Exit = __esmMin((()
4413
4481
  })), Clock, init_Clock = __esmMin((() => {
4414
4482
  init_effect();
4415
4483
  Clock = ClockRef;
4416
- })), TypeId$11, TimeZoneTypeId, Proto$1, ProtoTimeZone, toDateUtc$1;
4484
+ })), TypeId$13, TimeZoneTypeId, Proto$2, ProtoTimeZone, toDateUtc$1;
4417
4485
  var init_dateTime = __esmMin((() => {
4418
4486
  init_Cause();
4419
4487
  init_Equal();
@@ -4424,10 +4492,10 @@ var init_dateTime = __esmMin((() => {
4424
4492
  init_Order();
4425
4493
  init_Pipeable();
4426
4494
  init_Predicate();
4427
- TypeId$11 = "~effect/time/DateTime";
4495
+ TypeId$13 = "~effect/time/DateTime";
4428
4496
  TimeZoneTypeId = "~effect/time/DateTime/TimeZone";
4429
- Proto$1 = {
4430
- [TypeId$11]: TypeId$11,
4497
+ Proto$2 = {
4498
+ [TypeId$13]: TypeId$13,
4431
4499
  pipe() {
4432
4500
  return pipeArguments(this, arguments);
4433
4501
  },
@@ -4438,8 +4506,8 @@ var init_dateTime = __esmMin((() => {
4438
4506
  return toDateUtc$1(this).toJSON();
4439
4507
  }
4440
4508
  };
4441
- ({ ...Proto$1 });
4442
- ({ ...Proto$1 });
4509
+ ({ ...Proto$2 });
4510
+ ({ ...Proto$2 });
4443
4511
  ProtoTimeZone = {
4444
4512
  [TimeZoneTypeId]: TimeZoneTypeId,
4445
4513
  [NodeInspectSymbol]() {
@@ -4474,7 +4542,7 @@ var init_Pull = __esmMin((() => {
4474
4542
  }));
4475
4543
  //#endregion
4476
4544
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Schedule.js
4477
- var TypeId$10, CurrentMetadata, ScheduleProto, isSchedule, fromStep, metadataFn, fromStepWithMetadata, toStep, toStepWithMetadata, passthrough$2, spaced, while_, forever$1;
4545
+ var TypeId$12, CurrentMetadata, ScheduleProto, isSchedule, fromStep, metadataFn, fromStepWithMetadata, toStep, toStepWithMetadata, passthrough$2, spaced, while_, forever$1;
4478
4546
  var init_Schedule = __esmMin((() => {
4479
4547
  init_Cause();
4480
4548
  init_Context();
@@ -4485,11 +4553,11 @@ var init_Schedule = __esmMin((() => {
4485
4553
  init_Pipeable();
4486
4554
  init_Predicate();
4487
4555
  init_Pull();
4488
- TypeId$10 = "~effect/Schedule";
4556
+ TypeId$12 = "~effect/Schedule";
4489
4557
  CurrentMetadata = /*#__PURE__*/ Reference("effect/Schedule/CurrentMetadata", { defaultValue: /*#__PURE__*/ constant({
4490
4558
  input: void 0,
4491
4559
  output: void 0,
4492
- duration: zero,
4560
+ duration: zero$1,
4493
4561
  attempt: 0,
4494
4562
  start: 0,
4495
4563
  now: 0,
@@ -4497,7 +4565,7 @@ var init_Schedule = __esmMin((() => {
4497
4565
  elapsedSincePrevious: 0
4498
4566
  }) });
4499
4567
  ScheduleProto = {
4500
- [TypeId$10]: {
4568
+ [TypeId$12]: {
4501
4569
  _Out: identity,
4502
4570
  _In: identity,
4503
4571
  _Env: identity
@@ -4506,7 +4574,7 @@ var init_Schedule = __esmMin((() => {
4506
4574
  return pipeArguments(this, arguments);
4507
4575
  }
4508
4576
  };
4509
- isSchedule = (u) => hasProperty(u, TypeId$10);
4577
+ isSchedule = (u) => hasProperty(u, TypeId$12);
4510
4578
  fromStep = (step) => {
4511
4579
  const self = Object.create(ScheduleProto);
4512
4580
  self.step = step;
@@ -4569,7 +4637,7 @@ var init_Schedule = __esmMin((() => {
4569
4637
  return flatMap$1(isEffect(eff) ? eff : succeed$5(eff), (check) => check ? succeed$5(result) : done$1(output));
4570
4638
  });
4571
4639
  })));
4572
- forever$1 = /*#__PURE__*/ spaced(zero);
4640
+ forever$1 = /*#__PURE__*/ spaced(zero$1);
4573
4641
  }));
4574
4642
  //#endregion
4575
4643
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/layer.js
@@ -4582,7 +4650,10 @@ var init_layer = __esmMin((() => {
4582
4650
  init_effect();
4583
4651
  provideLayer = (self, layer, options) => scopedWith((scope) => flatMap$1(options?.local ? buildWithMemoMap(layer, makeMemoMapUnsafe(), scope) : buildWithScope(layer, scope), (context) => provideContext(self, context)));
4584
4652
  provide$1 = /*#__PURE__*/ dual((args) => isEffect(args[0]), (self, source, options) => isContext(source) ? provideContext(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll(...source) : source, options));
4585
- })), retryOrElse, retry$1, passthroughForever, buildFromOptions, init_schedule = __esmMin((() => {
4653
+ }));
4654
+ //#endregion
4655
+ //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/internal/schedule.js
4656
+ var retryOrElse, retry$1, passthroughForever, buildFromOptions, init_schedule = __esmMin((() => {
4586
4657
  init_Function();
4587
4658
  init_Pull();
4588
4659
  init_Schedule();
@@ -4619,7 +4690,7 @@ var init_layer = __esmMin((() => {
4619
4690
  if (options.times !== void 0) schedule = while_(schedule, ({ attempt }) => succeed$5(attempt <= options.times));
4620
4691
  return schedule;
4621
4692
  };
4622
- })), all, forEach, whileLoop, promise, tryPromise, succeed$1, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, try_, withFiber, flatMap, andThen, tap, option$1, exit, map, as, asVoid, catchTag, catchCause, mapError, retry, ignore, orElseSucceed, sleep, raceFirst, when, contextWith, provide, acquireRelease, acquireUseRelease, ensuring, onError, onExit, interrupt$1, onInterrupt, uninterruptible, forever, withSpan, forkIn, forkDetach, runFork, runPromise, runSync, runSyncExit, fnUntraced, fn, mapEager, flatMapEager, fnUntracedEager;
4693
+ })), all, forEach, whileLoop, promise, tryPromise, succeed$1, succeedNone, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, try_, withFiber, flatMap, andThen, tap, option$1, exit, map, as, asVoid, catchTag, catchCause, mapError, retry, ignore, orElseSucceed, sleep, raceFirst, when, contextWith, provide, acquireRelease, acquireUseRelease, ensuring, onError, onExit, interrupt$1, onInterrupt, uninterruptible, forever, withSpan, forkIn, forkDetach, runFork, runPromise, runSync, runSyncExit, fnUntraced, fn, mapEager, flatMapEager, fnUntracedEager;
4623
4694
  var init_Effect = __esmMin((() => {
4624
4695
  init_Context();
4625
4696
  init_core();
@@ -4632,6 +4703,7 @@ var init_Effect = __esmMin((() => {
4632
4703
  promise = promise$1;
4633
4704
  tryPromise = tryPromise$1;
4634
4705
  succeed$1 = succeed$5;
4706
+ succeedNone = succeedNone$1;
4635
4707
  suspend = suspend$1;
4636
4708
  sync = sync$2;
4637
4709
  void_ = void_$2;
@@ -4746,7 +4818,7 @@ var init_parser = __esmMin((() => {
4746
4818
  * @since 4.0.0
4747
4819
  */
4748
4820
  function isIssue(u) {
4749
- return hasProperty(u, TypeId$9) && u[TypeId$9] === TypeId$9;
4821
+ return hasProperty(u, TypeId$11) && u[TypeId$11] === TypeId$11;
4750
4822
  }
4751
4823
  /**
4752
4824
  * Returns `true` when an issue contains an input reported by the schema parser.
@@ -4891,16 +4963,16 @@ function findMessage(issue) {
4891
4963
  const message = (issue._tag === "Filter" ? issue.filter.annotations : "annotations" in issue ? issue.annotations : issue.ast.annotations)?.[issue._tag === "MissingKey" ? "messageMissingKey" : issue._tag === "UnexpectedKey" ? "messageUnexpectedKey" : "message"];
4892
4964
  if (typeof message === "string") return message;
4893
4965
  }
4894
- var TypeId$9, Base$1, Filter$1, Encoding, Pointer, MissingKey, UnexpectedKey, Composite, InvalidType, InvalidValue, AnyOf, OneOf, defaultLeafHook, defaultCheckHook, defaultFormatter;
4966
+ var TypeId$11, Base$1, Filter$1, Encoding, Pointer, MissingKey, UnexpectedKey, Composite, InvalidType, InvalidValue, AnyOf, OneOf, defaultLeafHook, defaultCheckHook, defaultFormatter;
4895
4967
  var init_SchemaIssue = __esmMin((() => {
4896
4968
  init_Array();
4897
4969
  init_Formatter();
4898
4970
  init_annotations();
4899
4971
  init_parser();
4900
4972
  init_Predicate();
4901
- TypeId$9 = "~effect/SchemaIssue/Issue";
4973
+ TypeId$11 = "~effect/SchemaIssue/Issue";
4902
4974
  Base$1 = class {
4903
- [TypeId$9] = TypeId$9;
4975
+ [TypeId$11] = TypeId$11;
4904
4976
  constructor(input, options) {
4905
4977
  if (options?.reportInput === true && input !== missing$2) this.input = input;
4906
4978
  }
@@ -5179,6 +5251,72 @@ function transformOptional(f) {
5179
5251
  return new Getter((oe) => succeed$1(f(oe)));
5180
5252
  }
5181
5253
  /**
5254
+ * Creates a getter that always returns `None`, effectively omitting the value from output.
5255
+ *
5256
+ * **When to use**
5257
+ *
5258
+ * Use when you need a schema getter to exclude a field during decoding or
5259
+ * encoding.
5260
+ *
5261
+ * **Details**
5262
+ *
5263
+ * - Always returns `Option.None` regardless of input.
5264
+ * - Never fails.
5265
+ *
5266
+ * **Example** (Omitting a field during encoding)
5267
+ *
5268
+ * ```ts import.meta.vitest
5269
+ * import { Effect, Option, SchemaGetter } from "effect"
5270
+ *
5271
+ * const omitField = SchemaGetter.omit<string>()
5272
+ * await Effect.runPromise(omitField.run(Option.some("hidden"), {})) // => Option.none()
5273
+ * ```
5274
+ *
5275
+ * @see {@link transformOptional} when you want conditional omission
5276
+ * @see {@link forbidden} when you want to fail instead of silently omit
5277
+ *
5278
+ * @category filtering
5279
+ * @since 4.0.0
5280
+ */
5281
+ function omit() {
5282
+ return new Getter(() => succeedNone);
5283
+ }
5284
+ /**
5285
+ * Creates a getter that replaces `undefined` values with a default.
5286
+ *
5287
+ * **When to use**
5288
+ *
5289
+ * Use when you need a schema getter to provide a fallback for a field that may
5290
+ * be `undefined` in the encoded input.
5291
+ *
5292
+ * **Details**
5293
+ *
5294
+ * - If the input is `Some(undefined)` or `None`, produces `Some(T)`.
5295
+ * - If the input is `Some(value)` where value is not `undefined`, passes it through.
5296
+ * - `defaultValue` is an `Effect` that will be executed each time a default is needed.
5297
+ *
5298
+ * **Example** (Providing a default value for an optional field)
5299
+ *
5300
+ * ```ts import.meta.vitest
5301
+ * import { Effect, Option, SchemaGetter } from "effect"
5302
+ *
5303
+ * const withZero = SchemaGetter.withDefault(Effect.succeed(0))
5304
+ * await Effect.runPromise(withZero.run(Option.some(undefined), {})) // => Option.some(0)
5305
+ * ```
5306
+ *
5307
+ * @see {@link onNone} to handle only absent keys (not `undefined` values)
5308
+ * @see {@link required} when absent input should fail instead of using a default
5309
+ *
5310
+ * @category transforming
5311
+ * @since 4.0.0
5312
+ */
5313
+ function withDefault(defaultValue) {
5314
+ return new Getter((o) => {
5315
+ const filtered = filter$1(o, isNotUndefined);
5316
+ return isSome(filtered) ? succeed$1(filtered) : mapEager(defaultValue, some);
5317
+ });
5318
+ }
5319
+ /**
5182
5320
  * Coerces any value to a `string` using the global `String()` constructor.
5183
5321
  *
5184
5322
  * **When to use**
@@ -5294,12 +5432,12 @@ var init_SchemaGetter = __esmMin((() => {
5294
5432
  * @since 4.0.0
5295
5433
  */
5296
5434
  function isTransformation(u) {
5297
- return hasProperty(u, TypeId$8) && u[TypeId$8] === TypeId$8;
5435
+ return hasProperty(u, TypeId$10) && u[TypeId$10] === TypeId$10;
5298
5436
  }
5299
5437
  function passthrough() {
5300
5438
  return passthrough_;
5301
5439
  }
5302
- var TypeId$8, Transformation, make$8, passthrough_, numberFromString;
5440
+ var TypeId$10, Transformation, make$10, passthrough_, numberFromString;
5303
5441
  var init_SchemaTransformation = __esmMin((() => {
5304
5442
  init_DateTime();
5305
5443
  init_Effect();
@@ -5308,9 +5446,9 @@ var init_SchemaTransformation = __esmMin((() => {
5308
5446
  init_Predicate();
5309
5447
  init_SchemaGetter();
5310
5448
  init_SchemaIssue();
5311
- TypeId$8 = "~effect/SchemaTransformation/Transformation";
5449
+ TypeId$10 = "~effect/SchemaTransformation/Transformation";
5312
5450
  Transformation = class Transformation {
5313
- [TypeId$8] = TypeId$8;
5451
+ [TypeId$10] = TypeId$10;
5314
5452
  _tag = "Transformation";
5315
5453
  decode;
5316
5454
  encode;
@@ -5325,7 +5463,7 @@ var init_SchemaTransformation = __esmMin((() => {
5325
5463
  return new Transformation(this.decode.compose(other.decode), other.encode.compose(this.encode));
5326
5464
  }
5327
5465
  };
5328
- make$8 = (options) => {
5466
+ make$10 = (options) => {
5329
5467
  if (isTransformation(options)) return options;
5330
5468
  return new Transformation(options.decode, options.encode);
5331
5469
  };
@@ -5365,7 +5503,7 @@ function getIndexSignatureKeys(input, parameter, options = defaultParseOptions)
5365
5503
  default: return [];
5366
5504
  }
5367
5505
  }
5368
- return go(parameterFromPropertyKey(toEncoded(parameter)));
5506
+ return go(parameterFromPropertyKey(toEncoded$1(parameter)));
5369
5507
  }
5370
5508
  function isIndexSignatureParameterSide(ast) {
5371
5509
  switch (ast._tag) {
@@ -5378,7 +5516,7 @@ function isIndexSignatureParameterSide(ast) {
5378
5516
  }
5379
5517
  }
5380
5518
  function isIndexSignatureParameter(ast) {
5381
- return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
5519
+ return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded$1(ast));
5382
5520
  }
5383
5521
  function combineChecks(a, b) {
5384
5522
  if (!a) return b;
@@ -5932,7 +6070,7 @@ function getConstructorDescriptor(ast) {
5932
6070
  const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];
5933
6071
  return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
5934
6072
  }
5935
- var isDeclaration, isNever, isLiteral, isUniqueSymbol, isArrays, isObjects, isSuspend, Link, defaultParseOptions, Context, TypeId$7, Base, Null, null_, Undefined$1, undefinedToNull, undefined_, Unknown, unknown$1, Literal$1, String$2, string, Number$2, number, Boolean$1, boolean, Arrays, parseArray, resolveConcurrency, wrapPropertyKeyIssue, FINITE_PATTERN, PropertySignature, IndexSignature, Objects, parseProperties, toCandidate, candidateIndexCache, emptyCandidates, Union$1, parseUnion, nonFiniteLiterals, Filter, FilterGroup, finite, contextOwners, optionalKey$1, optionalKeyLastLink, toType, toEncoded, flip, parameterFromPropertyKey, isStringFiniteRegExp, isStringNumberRegExp, finiteString, finiteToString, numberToString;
6073
+ var isDeclaration, isNever, isLiteral, isUniqueSymbol, isArrays, isObjects, isSuspend, Link, defaultParseOptions, Context, TypeId$9, Base, Null, null_, Undefined$1, undefinedToNull, undefined_, Unknown, unknown$1, Literal$1, String$2, string, Number$2, number, Boolean$1, boolean, Arrays, parseArray, resolveConcurrency, wrapPropertyKeyIssue, FINITE_PATTERN, PropertySignature, IndexSignature, Objects, parseProperties, toCandidate, candidateIndexCache, emptyCandidates, Union$1, parseUnion, nonFiniteLiterals, Filter, FilterGroup, finite, contextOwners, optionalKey$1, optionalKeyLastLink, toType, toEncoded$1, flip, parameterFromPropertyKey, isStringFiniteRegExp, isStringNumberRegExp, finiteString, finiteToString, numberToString;
5936
6074
  var init_SchemaAST = __esmMin((() => {
5937
6075
  init_Array();
5938
6076
  init_Cause();
@@ -5979,9 +6117,9 @@ var init_SchemaAST = __esmMin((() => {
5979
6117
  this.annotations = annotations;
5980
6118
  }
5981
6119
  };
5982
- TypeId$7 = "~effect/Schema";
6120
+ TypeId$9 = "~effect/Schema";
5983
6121
  Base = class {
5984
- [TypeId$7] = TypeId$7;
6122
+ [TypeId$9] = TypeId$9;
5985
6123
  annotations;
5986
6124
  checks;
5987
6125
  encoding;
@@ -6385,7 +6523,7 @@ var init_SchemaAST = __esmMin((() => {
6385
6523
  }
6386
6524
  }
6387
6525
  else if (parseIndexes) {
6388
- const keyPairs = empty$1();
6526
+ const keyPairs = empty$2();
6389
6527
  for (let i = 0; i < indexCount; i++) {
6390
6528
  const index = indexes[i];
6391
6529
  const keys = getIndexSignatureKeys(record, index.is.parameter, options);
@@ -6539,7 +6677,7 @@ var init_SchemaAST = __esmMin((() => {
6539
6677
  if (typeof expected === "string") return expected;
6540
6678
  if (this.types.length === 0) return "never";
6541
6679
  const types = this.types.map((type) => {
6542
- const encoded = toEncoded(type);
6680
+ const encoded = toEncoded$1(type);
6543
6681
  switch (encoded._tag) {
6544
6682
  case "Arrays": {
6545
6683
  const literals = encoded.elements.filter(isLiteral);
@@ -6650,7 +6788,7 @@ var init_SchemaAST = __esmMin((() => {
6650
6788
  }
6651
6789
  return type;
6652
6790
  });
6653
- toEncoded = /*#__PURE__*/ memoizeIdempotent((ast) => {
6791
+ toEncoded$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
6654
6792
  return toType(flip(ast));
6655
6793
  });
6656
6794
  flip = /*#__PURE__*/ memoize((ast) => {
@@ -6672,6 +6810,216 @@ var init_SchemaAST = __esmMin((() => {
6672
6810
  numberToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finiteString, nonFiniteLiterals], "anyOf"), numberFromString);
6673
6811
  }));
6674
6812
  //#endregion
6813
+ //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/MutableHashMap.js
6814
+ var TypeId$8, MutableHashMapProto, empty, make$9, fromIterable, get$1, referentialKeysCache, isSimpleKey, getFromBucket, set$3, getRefKey, remove$1, size;
6815
+ var init_MutableHashMap = __esmMin((() => {
6816
+ init_Equal();
6817
+ init_Formatter();
6818
+ init_Function();
6819
+ init_Hash();
6820
+ init_Inspectable();
6821
+ init_Option();
6822
+ init_Pipeable();
6823
+ TypeId$8 = "~effect/collections/MutableHashMap";
6824
+ MutableHashMapProto = {
6825
+ [TypeId$8]: TypeId$8,
6826
+ [Symbol.iterator]() {
6827
+ return this.backing[Symbol.iterator]();
6828
+ },
6829
+ toString() {
6830
+ return `MutableHashMap(${format$1(Array.from(this))})`;
6831
+ },
6832
+ toJSON() {
6833
+ return {
6834
+ _id: "MutableHashMap",
6835
+ values: toJson(Array.from(this))
6836
+ };
6837
+ },
6838
+ [NodeInspectSymbol]() {
6839
+ return this.toJSON();
6840
+ },
6841
+ pipe() {
6842
+ return pipeArguments(this, arguments);
6843
+ }
6844
+ };
6845
+ empty = () => {
6846
+ const self = Object.create(MutableHashMapProto);
6847
+ self.backing = /* @__PURE__ */ new Map();
6848
+ self.buckets = /* @__PURE__ */ new Map();
6849
+ return self;
6850
+ };
6851
+ make$9 = (...entries) => fromIterable(entries);
6852
+ fromIterable = (entries) => {
6853
+ const self = empty();
6854
+ for (const [key, value] of entries) set$3(self, key, value);
6855
+ return self;
6856
+ };
6857
+ get$1 = /*#__PURE__*/ dual(2, (self, key) => {
6858
+ if (self.backing.has(key)) return some(self.backing.get(key));
6859
+ else if (isSimpleKey(key)) return none();
6860
+ const refKey = referentialKeysCache.get(self);
6861
+ if (refKey !== void 0) return self.backing.has(refKey) ? some(self.backing.get(refKey)) : none();
6862
+ const hash$1 = hash(key);
6863
+ const bucket = self.buckets.get(hash$1);
6864
+ if (bucket === void 0) return none();
6865
+ return getFromBucket(self, bucket, key);
6866
+ });
6867
+ referentialKeysCache = /*#__PURE__*/ new WeakMap();
6868
+ isSimpleKey = (u) => typeof u !== "object" && typeof u !== "function";
6869
+ getFromBucket = (self, bucket, key) => {
6870
+ for (let i = 0, len = bucket.length; i < len; i++) if (equals$2(key, bucket[i])) {
6871
+ const refKey = bucket[i];
6872
+ referentialKeysCache.set(key, refKey);
6873
+ return some(self.backing.get(refKey));
6874
+ }
6875
+ return none();
6876
+ };
6877
+ set$3 = /*#__PURE__*/ dual(3, (self, key, value) => {
6878
+ if (self.backing.has(key) || isSimpleKey(key)) {
6879
+ self.backing.set(key, value);
6880
+ return self;
6881
+ }
6882
+ let refKey = referentialKeysCache.get(self);
6883
+ if (refKey !== void 0 && self.backing.has(refKey)) {
6884
+ self.backing.set(refKey, value);
6885
+ return self;
6886
+ }
6887
+ const hash$2 = hash(key);
6888
+ const bucket = self.buckets.get(hash$2);
6889
+ if (bucket === void 0) {
6890
+ self.buckets.set(hash$2, [key]);
6891
+ self.backing.set(key, value);
6892
+ return self;
6893
+ }
6894
+ refKey = getRefKey(bucket, key);
6895
+ if (refKey === void 0) {
6896
+ bucket.push(key);
6897
+ refKey = key;
6898
+ }
6899
+ self.backing.set(refKey, value);
6900
+ return self;
6901
+ });
6902
+ getRefKey = (bucket, key) => {
6903
+ for (let i = 0, len = bucket.length; i < len; i++) if (equals$2(key, bucket[i])) {
6904
+ referentialKeysCache.set(key, bucket[i]);
6905
+ return bucket[i];
6906
+ }
6907
+ };
6908
+ remove$1 = /*#__PURE__*/ dual(2, (self, key_) => {
6909
+ if (isSimpleKey(key_)) {
6910
+ self.backing.delete(key_);
6911
+ return self;
6912
+ }
6913
+ const key = referentialKeysCache.get(self) ?? key_;
6914
+ const hash$4 = hash(key);
6915
+ const bucket = self.buckets.get(hash$4);
6916
+ if (bucket === void 0) return self;
6917
+ for (let i = 0, len = bucket.length; i < len; i++) {
6918
+ const bkey = bucket[i];
6919
+ if (bkey === key || equals$2(key, bkey)) {
6920
+ self.backing.delete(bkey);
6921
+ bucket.splice(i, 1);
6922
+ break;
6923
+ }
6924
+ }
6925
+ if (bucket.length === 0) self.buckets.delete(hash$4);
6926
+ return self;
6927
+ });
6928
+ size = (self) => self.backing.size;
6929
+ }));
6930
+ //#endregion
6931
+ //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Cache.js
6932
+ var TypeId$7, makeWith, make$8, Proto$1, defaultTimeToLive, get, EntryImpl, hasExpired, checkCapacity;
6933
+ var init_Cache = __esmMin((() => {
6934
+ init_Context();
6935
+ init_Duration();
6936
+ init_Function();
6937
+ init_core();
6938
+ init_effect();
6939
+ init_MutableHashMap();
6940
+ init_Option();
6941
+ TypeId$7 = "~effect/Cache";
6942
+ makeWith = (lookup, options) => contextWith$1((context) => {
6943
+ const self = Object.create(Proto$1);
6944
+ self.lookup = (key) => updateContext(lookup(key), (input) => merge(context, input));
6945
+ self.map = make$9();
6946
+ self.capacity = options.capacity;
6947
+ self.timeToLive = options.timeToLive ? (exit, key) => fromInputUnsafe(options.timeToLive(exit, key)) : defaultTimeToLive;
6948
+ return succeed$5(self);
6949
+ });
6950
+ make$8 = (options) => makeWith(options.lookup, {
6951
+ ...options,
6952
+ timeToLive: options.timeToLive !== void 0 ? () => options.timeToLive : defaultTimeToLive
6953
+ });
6954
+ Proto$1 = {
6955
+ ...PipeInspectableProto,
6956
+ [TypeId$7]: TypeId$7,
6957
+ toJSON() {
6958
+ return {
6959
+ _id: "Cache",
6960
+ capacity: this.capacity,
6961
+ map: this.map
6962
+ };
6963
+ }
6964
+ };
6965
+ defaultTimeToLive = (_, _key) => infinity;
6966
+ get = /*#__PURE__*/ dual(2, (self, key) => withFiber$1((fiber) => {
6967
+ const oentry = get$1(self.map, key);
6968
+ if (isSome(oentry) && !hasExpired(oentry.value, fiber)) {
6969
+ remove$1(self.map, key);
6970
+ set$3(self.map, key, oentry.value);
6971
+ return oentry.value.await();
6972
+ }
6973
+ const entry = new EntryImpl(fiber, self.lookup(key));
6974
+ entry.fiber.addObserver((exit) => {
6975
+ if (exitHasInterrupts(exit)) {
6976
+ const current = get$1(self.map, key);
6977
+ if (isSome(current) && current.value === entry) remove$1(self.map, key);
6978
+ return;
6979
+ }
6980
+ const ttl = self.timeToLive(exit, key);
6981
+ if (isFinite$1(ttl)) entry.expiresAt = fiber.getRef(ClockRef).currentTimeMillisUnsafe() + toMillis(ttl);
6982
+ else if (isZero(ttl)) remove$1(self.map, key);
6983
+ });
6984
+ set$3(self.map, key, entry);
6985
+ if (Number.isFinite(self.capacity)) checkCapacity(self);
6986
+ return entry.await();
6987
+ }));
6988
+ EntryImpl = class {
6989
+ expiresAt;
6990
+ awaiters;
6991
+ fiber;
6992
+ constructor(parent, valueEffect) {
6993
+ this.fiber = forkUnsafe$1(parent, valueEffect, true, true);
6994
+ this.awaiters = 0;
6995
+ this.expiresAt = void 0;
6996
+ }
6997
+ await() {
6998
+ const exit = this.fiber.pollUnsafe();
6999
+ if (exit) return exit;
7000
+ this.awaiters++;
7001
+ return onExit$1(fiberJoin(this.fiber), () => {
7002
+ this.awaiters--;
7003
+ if (this.awaiters > 0 || this.fiber.pollUnsafe()) return void_$2;
7004
+ return fiberInterrupt(this.fiber);
7005
+ });
7006
+ }
7007
+ };
7008
+ hasExpired = (entry, fiber) => {
7009
+ if (entry.expiresAt === void 0) return false;
7010
+ return fiber.getRef(ClockRef).currentTimeMillisUnsafe() >= entry.expiresAt;
7011
+ };
7012
+ checkCapacity = (self) => {
7013
+ let diff = size(self.map) - self.capacity;
7014
+ if (diff <= 0) return;
7015
+ for (const [key] of self.map) {
7016
+ remove$1(self.map, key);
7017
+ diff--;
7018
+ if (diff === 0) return;
7019
+ }
7020
+ };
7021
+ }));
7022
+ //#endregion
6675
7023
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Fiber.js
6676
7024
  var await_, interrupt;
6677
7025
  var init_Fiber = __esmMin((() => {
@@ -6848,7 +7196,7 @@ var init_PubSub = __esmMin((() => {
6848
7196
  return false;
6849
7197
  });
6850
7198
  subscribe = (self) => uninterruptible(contextWith((services) => {
6851
- const localScope = get(services, Scope);
7199
+ const localScope = get$2(services, Scope);
6852
7200
  const scope = forkUnsafe(self.scope);
6853
7201
  const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy);
6854
7202
  return addFinalizer(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
@@ -7658,6 +8006,35 @@ function decodeUnknownEffect$1(schema, options) {
7658
8006
  return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
7659
8007
  }
7660
8008
  /** @internal */
8009
+ function decodeUnknownOption$1(schema, options) {
8010
+ return asOption(decodeUnknownEffect$1(schema, options));
8011
+ }
8012
+ /**
8013
+ * Creates an effectful encoder for `unknown` input.
8014
+ *
8015
+ * **When to use**
8016
+ *
8017
+ * Use when you need to encode untyped boundary input in an `Effect` whose
8018
+ * failure channel is `SchemaIssue.Issue`, while preserving service
8019
+ * requirements.
8020
+ *
8021
+ * **Details**
8022
+ *
8023
+ * The returned function succeeds with the schema's `Encoded` value or fails with a
8024
+ * `SchemaIssue.Issue`. Encoding service requirements are preserved in the returned
8025
+ * `Effect`. Parse options may be provided when creating the encoder and overridden
8026
+ * when applying it.
8027
+ *
8028
+ * @see {@link encodeEffect} for the typed-input variant when the value is already typed as the schema's decoded `Type`
8029
+ *
8030
+ * @category encoding
8031
+ * @since 4.0.0
8032
+ */
8033
+ function encodeUnknownEffect$1(schema, options) {
8034
+ const parser = run$1(flip(schema.ast));
8035
+ return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
8036
+ }
8037
+ /** @internal */
7661
8038
  function run$1(ast) {
7662
8039
  return runWithCompiler(normalCompiler, ast);
7663
8040
  }
@@ -7670,6 +8047,19 @@ function runWithCompiler(compiler, ast) {
7670
8047
  return result[args] === missing$2 ? getValue(missing$2) : result;
7671
8048
  };
7672
8049
  }
8050
+ function asExit(parser) {
8051
+ return (input, options) => runSyncExit(parser(input, options));
8052
+ }
8053
+ /** @internal */
8054
+ function asOption(parser) {
8055
+ const parserExit = asExit(parser);
8056
+ return (input, options) => {
8057
+ const exit = parserExit(input, options);
8058
+ if (isSuccess(exit)) return some(exit.value);
8059
+ getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
8060
+ return none();
8061
+ };
8062
+ }
7673
8063
  function compileConstructorDefault(ast) {
7674
8064
  return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);
7675
8065
  }
@@ -7862,6 +8252,43 @@ function fromIssueEffect(self) {
7862
8252
  return catchCause(self, (cause) => failCauseSync(() => map$1(cause, (issue) => new SchemaError(issue))));
7863
8253
  }
7864
8254
  /**
8255
+ * Encodes an `unknown` input against a schema, returning an `Effect` that
8256
+ * succeeds with the encoded value or fails with a {@link SchemaError}.
8257
+ *
8258
+ * **When to use**
8259
+ *
8260
+ * Use when you need to encode unknown input in an `Effect` whose failure
8261
+ * channel is `SchemaError`.
8262
+ *
8263
+ * **Details**
8264
+ *
8265
+ * Prefer {@link encodeEffect} when the value is already typed as the schema's
8266
+ * `Type`.
8267
+ * Options may be provided either when creating the encoder or when applying it;
8268
+ * application options override creation options.
8269
+ *
8270
+ * **Example** (Encoding a value to a string)
8271
+ *
8272
+ * ```ts import.meta.vitest
8273
+ * import { Effect, Schema } from "effect"
8274
+ *
8275
+ * const NumberFromString = Schema.NumberFromString
8276
+ *
8277
+ * await Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42)) // => "42"
8278
+ * ```
8279
+ *
8280
+ * @see {@link SchemaParser.encodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
8281
+ *
8282
+ * @category encoding
8283
+ * @since 4.0.0
8284
+ */
8285
+ function encodeUnknownEffect(schema, options) {
8286
+ const parser = encodeUnknownEffect$1(schema, options);
8287
+ return (input, options) => {
8288
+ return fromIssueEffect(parser(input, options));
8289
+ };
8290
+ }
8291
+ /**
7865
8292
  * Creates a schema for a single literal value (string, number, bigint, boolean, or null).
7866
8293
  *
7867
8294
  * **Example** (Defining a string literal)
@@ -8048,12 +8475,57 @@ function Literals(literals) {
8048
8475
  }
8049
8476
  function decodeTo(to, transformation) {
8050
8477
  return (from) => {
8051
- return make$1(decodeTo$1(from.ast, to.ast, transformation ? make$8(transformation) : passthrough()), {
8478
+ return make$1(decodeTo$1(from.ast, to.ast, transformation ? make$10(transformation) : passthrough()), {
8052
8479
  from,
8053
8480
  to
8054
8481
  });
8055
8482
  };
8056
8483
  }
8484
+ function toIssueEffect(self) {
8485
+ return catchCause(self, (cause) => failCauseSync(() => map$1(cause, (error) => error.issue)));
8486
+ }
8487
+ /**
8488
+ * Makes a struct key optional on the `Encoded` side and provides a default
8489
+ * `Encoded` value when the key is missing during decoding.
8490
+ *
8491
+ * **Details**
8492
+ *
8493
+ * The key uses `optionalKey` on the encoded side, so it may be absent from the
8494
+ * input object but **not** `undefined`. The default value is specified in terms
8495
+ * of the `Encoded` type (before any decoding transformations).
8496
+ *
8497
+ * Options:
8498
+ *
8499
+ * - `encodingStrategy`:
8500
+ * - `"passthrough"` (default): include the value in the encoded output.
8501
+ * - `"omit"`: omit the key from the encoded output.
8502
+ *
8503
+ * **Example** (Providing a default for a missing struct key)
8504
+ *
8505
+ * ```ts import.meta.vitest
8506
+ * import { Effect, Schema } from "effect"
8507
+ *
8508
+ * const MySchema = Schema.Struct({
8509
+ * name: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed("anonymous")))
8510
+ * })
8511
+ *
8512
+ * Schema.decodeUnknownSync(MySchema)({}).name // => "anonymous"
8513
+ * ```
8514
+ *
8515
+ * @see {@link withDecodingDefault} for the value-level variant (key absent **or** `undefined`)
8516
+ * @see {@link withDecodingDefaultTypeKey} for the variant where the default is a `Type` value
8517
+ * @category decoding
8518
+ * @since 4.0.0
8519
+ */
8520
+ function withDecodingDefaultKey(defaultValue, options) {
8521
+ const encode = options?.encodingStrategy === "omit" ? omit() : passthrough$1();
8522
+ return (self) => {
8523
+ return optionalKey(toEncoded(self)).pipe(decodeTo(self, {
8524
+ decode: withDefault(toIssueEffect(defaultValue)),
8525
+ encode
8526
+ }));
8527
+ };
8528
+ }
8057
8529
  /**
8058
8530
  * Validates that a number is a safe integer (within the safe integer range
8059
8531
  * that can be exactly represented in JavaScript).
@@ -8085,7 +8557,7 @@ function isInt(annotations) {
8085
8557
  ...annotations
8086
8558
  });
8087
8559
  }
8088
- var SchemaErrorTypeId, SchemaError, make$1, optionalKey, Undefined, String$1, Number$1, Boolean, ArraySchema, UndefinedOr, makeFilter, Int;
8560
+ var SchemaErrorTypeId, SchemaError, decodeUnknownOption, encodeEffect, make$1, optionalKey, toEncoded, Undefined, String$1, Number$1, Boolean, ArraySchema, UndefinedOr, makeFilter, Int;
8089
8561
  var init_Schema = __esmMin((() => {
8090
8562
  init_BigDecimal();
8091
8563
  init_Cause();
@@ -8116,8 +8588,11 @@ var init_Schema = __esmMin((() => {
8116
8588
  return `SchemaError(${this.message})`;
8117
8589
  }
8118
8590
  };
8591
+ decodeUnknownOption = decodeUnknownOption$1;
8592
+ encodeEffect = encodeUnknownEffect;
8119
8593
  make$1 = make$2;
8120
8594
  optionalKey = /*#__PURE__*/ lambda((schema) => make$1(optionalKey$1(schema.ast), { schema }));
8595
+ toEncoded = /*#__PURE__*/ lambda((schema) => make$1(toEncoded$1(schema.ast), { schema }));
8121
8596
  Undefined = /*#__PURE__*/ make$1(undefined_);
8122
8597
  String$1 = /*#__PURE__*/ make$1(string);
8123
8598
  Number$1 = /*#__PURE__*/ make$1(number);
@@ -8282,22 +8757,21 @@ var init_dist = __esmMin((() => {
8282
8757
  init_Result();
8283
8758
  init_SchemaAST();
8284
8759
  init_SchemaIssue();
8285
- init_Context();
8286
- init_Duration();
8287
- init_core();
8288
- init_effect();
8760
+ init_Cache();
8761
+ init_Cause();
8762
+ init_Channel();
8763
+ init_Effect();
8764
+ init_Schema();
8289
8765
  init_Equal();
8290
8766
  init_Formatter();
8291
8767
  init_Hash();
8292
8768
  init_Inspectable();
8293
8769
  init_Pipeable();
8294
- init_Cause();
8295
- init_Channel();
8296
- init_Effect();
8297
- init_Schema();
8298
8770
  init_Clock();
8771
+ init_Context();
8299
8772
  init_Data();
8300
8773
  init_Layer();
8774
+ init_Duration();
8301
8775
  init_Exit();
8302
8776
  init_stream();
8303
8777
  init_PubSub();
@@ -8305,8 +8779,10 @@ var init_dist = __esmMin((() => {
8305
8779
  init_Queue();
8306
8780
  init_Scope();
8307
8781
  init_Stream();
8782
+ init_core();
8308
8783
  init_array();
8309
8784
  init_Effectable();
8785
+ init_effect();
8310
8786
  init_references();
8311
8787
  init_Scheduler();
8312
8788
  init_Tracer();
@@ -8319,6 +8795,7 @@ var init_dist = __esmMin((() => {
8319
8795
  init_Encoding();
8320
8796
  init_Fiber();
8321
8797
  init_Filter();
8798
+ init_MutableHashMap();
8322
8799
  init_Latch();
8323
8800
  init_stackTraceLimit();
8324
8801
  init_Semaphore();
@@ -8342,7 +8819,7 @@ var init_error$3 = __esmMin((() => {
8342
8819
  }));
8343
8820
  //#endregion
8344
8821
  //#region src/service/forge/service.ts
8345
- var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode, stateOf$1, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named, head, sideName, commentBody, bodyFor, Landed, readLanded, landedIn, review, ForgeLive;
8822
+ var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named, head, sideName, commentBody, bodyFor, Landed, readLanded, landedIn, review, ForgeLive;
8346
8823
  var init_service$2 = __esmMin((() => {
8347
8824
  init_dist();
8348
8825
  init_error$3();
@@ -8357,15 +8834,25 @@ var init_service$2 = __esmMin((() => {
8357
8834
  state: String$1,
8358
8835
  isDraft: Boolean
8359
8836
  });
8360
- decode = decodeUnknownEffect(ArraySchema(Row));
8837
+ decode$1 = decodeUnknownEffect(ArraySchema(Row));
8838
+ SAID = [
8839
+ "OPEN",
8840
+ "MERGED",
8841
+ "CLOSED"
8842
+ ];
8361
8843
  stateOf$1 = (row) => {
8362
- if (row.isDraft && row.state === "OPEN") return "draft";
8363
- if (row.state === "MERGED") return "merged";
8364
- if (row.state === "CLOSED") return "closed";
8365
- return "open";
8844
+ const said = SAID.find((known) => known === row.state);
8845
+ switch (said) {
8846
+ case "OPEN": return row.isDraft ? "draft" : "open";
8847
+ case "MERGED": return "merged";
8848
+ case "CLOSED": return "closed";
8849
+ case void 0: return "open";
8850
+ default: return absurd(said);
8851
+ }
8366
8852
  };
8853
+ ended = (child) => sync(() => void child.kill());
8367
8854
  ask = (repo) => callback$1((resume) => {
8368
- execFile("gh", [
8855
+ const child = execFile("gh", [
8369
8856
  "pr",
8370
8857
  "list",
8371
8858
  "--state",
@@ -8385,9 +8872,10 @@ var init_service$2 = __esmMin((() => {
8385
8872
  reason: error.message
8386
8873
  })));
8387
8874
  });
8875
+ return ended(child);
8388
8876
  });
8389
8877
  show = (repo, branch) => callback$1((resume) => {
8390
- execFile("gh", [
8878
+ const child = execFile("gh", [
8391
8879
  "pr",
8392
8880
  "view",
8393
8881
  branch,
@@ -8403,6 +8891,7 @@ var init_service$2 = __esmMin((() => {
8403
8891
  reason: error.message
8404
8892
  })));
8405
8893
  });
8894
+ return ended(child);
8406
8895
  });
8407
8896
  read = fn("Forge.read")(function* (repo, raw) {
8408
8897
  const parsed = yield* try_({
@@ -8412,7 +8901,7 @@ var init_service$2 = __esmMin((() => {
8412
8901
  reason: String(cause)
8413
8902
  })
8414
8903
  });
8415
- return (yield* mapError(decode(parsed), (cause) => new ForgeUnavailable({
8904
+ return (yield* mapError(decode$1(parsed), (cause) => new ForgeUnavailable({
8416
8905
  repo,
8417
8906
  reason: String(cause)
8418
8907
  }))).map((row) => ({
@@ -8449,6 +8938,7 @@ var init_service$2 = __esmMin((() => {
8449
8938
  })));
8450
8939
  });
8451
8940
  if (input !== void 0) child.stdin?.end(input);
8941
+ return ended(child);
8452
8942
  });
8453
8943
  named = fn("Forge.named")(function* (repo, branch) {
8454
8944
  const raw = yield* gh(repo, [
@@ -8557,7 +9047,7 @@ var init_model$4 = __esmMin((() => {
8557
9047
  }));
8558
9048
  //#endregion
8559
9049
  //#region src/service/store/schema.ts
8560
- var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, BranchState, Settings, UpgradeCheck, Prose, Code, StoredLayer, StoredLayers;
9050
+ var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, noStamps, BranchState, Settings, UpgradeCheck, Prose, Code, StoredLayer, StoredLayers;
8561
9051
  var init_schema = __esmMin((() => {
8562
9052
  init_dist();
8563
9053
  Side = Literals(["old", "new"]);
@@ -8599,13 +9089,16 @@ var init_schema = __esmMin((() => {
8599
9089
  head: String$1,
8600
9090
  comments: ArraySchema(StoredComment)
8601
9091
  });
9092
+ Stamps = Record(String$1, String$1);
9093
+ Counts = Record(String$1, Int);
9094
+ noStamps = withDecodingDefaultKey(succeed$1({}));
8602
9095
  BranchState = Struct({
8603
- vouches: optionalKey(Record(String$1, String$1)),
8604
- consumed: optionalKey(Int),
8605
- settled: optionalKey(Record(String$1, String$1)),
8606
- removed: optionalKey(Record(String$1, String$1)),
8607
- base: optionalKey(String$1),
8608
- read: optionalKey(Record(String$1, Int))
9096
+ vouches: Stamps.pipe(noStamps),
9097
+ consumed: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
9098
+ settled: Stamps.pipe(noStamps),
9099
+ removed: Stamps.pipe(noStamps),
9100
+ base: String$1.pipe(withDecodingDefaultKey(succeed$1(""))),
9101
+ read: Counts.pipe(withDecodingDefaultKey(succeed$1({})))
8609
9102
  });
8610
9103
  Settings = Struct({
8611
9104
  wrap: optionalKey(Boolean),
@@ -8666,7 +9159,7 @@ var init_paths = __esmMin((() => {
8666
9159
  }));
8667
9160
  //#endregion
8668
9161
  //#region src/service/store/service.ts
8669
- var Store, ensureDir, readOptional, missing$1, damaged, jsonOf, decoded, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, keyOf$2, wasKeyOf, there, adopted, moved, adopt, keyIn, answerOps, draftsOps, layersOps, inboxOps, LOCK_TRIES, LOCK_WAIT_MS, LOCK_STALE_MS, held$1, stale$1, stolen, taken, freed, stateOps, makeStore, storeAt;
9162
+ var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, keyOf$2, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, draftsOps, layersOps, inboxOps, LOCK_TRIES, LOCK_WAIT_MS, LOCK_STALE_MS, held$1, stale$1, stolen, taken, freed, stateOps, makeStore, madeStore, storeAt;
8670
9163
  var init_service$1 = __esmMin((() => {
8671
9164
  init_dist();
8672
9165
  init_error$2();
@@ -8697,7 +9190,7 @@ var init_service$1 = __esmMin((() => {
8697
9190
  path,
8698
9191
  reason: String(reason)
8699
9192
  });
8700
- jsonOf = (path, raw) => try_({
9193
+ jsonOf$1 = (path, raw) => try_({
8701
9194
  try: () => JSON.parse(raw),
8702
9195
  catch: damaged(path)
8703
9196
  });
@@ -8705,6 +9198,39 @@ var init_service$1 = __esmMin((() => {
8705
9198
  const decode = decodeUnknownEffect(schema);
8706
9199
  return (path, value) => mapError(decode(value), damaged(path));
8707
9200
  };
9201
+ unwritable = (path) => (reason) => new StoreUnwritable({
9202
+ path,
9203
+ reason: String(reason)
9204
+ });
9205
+ wrote = (path, body) => tryPromise({
9206
+ try: () => writeFile(path, body, "utf8"),
9207
+ catch: unwritable(path)
9208
+ });
9209
+ added = (path, body) => tryPromise({
9210
+ try: () => appendFile(path, `${body}\n`, "utf8"),
9211
+ catch: unwritable(path)
9212
+ });
9213
+ INDENT = 2;
9214
+ DRAFTS_VERSION = 1;
9215
+ encoded = (schema) => {
9216
+ const encode = encodeEffect(schema);
9217
+ return (path, value) => mapError(encode(value), unwritable(path));
9218
+ };
9219
+ writes = (schema, space) => {
9220
+ const encode = encoded(schema);
9221
+ return (path, value) => flatMap(encode(path, value), (wire) => wrote(path, JSON.stringify(wire, void 0, space)));
9222
+ };
9223
+ appends = (schema) => {
9224
+ const encode = encoded(schema);
9225
+ return (path, value) => flatMap(encode(path, value), (wire) => added(path, JSON.stringify(wire)));
9226
+ };
9227
+ writeSettings = writes(Settings);
9228
+ writeUpgradeCheck = writes(UpgradeCheck, INDENT);
9229
+ writeState = writes(BranchState, INDENT);
9230
+ writeLayers = writes(StoredLayers, INDENT);
9231
+ writeDrafts = writes(Drafts, INDENT);
9232
+ writeBatch = appends(Batch);
9233
+ writeAnswer = appends(StoredAnswer);
8708
9234
  asSettings = decoded(Settings);
8709
9235
  asUpgradeCheck = decoded(UpgradeCheck);
8710
9236
  asBatch = decoded(Batch);
@@ -8713,30 +9239,20 @@ var init_service$1 = __esmMin((() => {
8713
9239
  asLayers = decoded(StoredLayers);
8714
9240
  asDrafts = decoded(Drafts);
8715
9241
  linesOf = (raw) => raw.split("\n").filter((line) => line.trim().length > 0);
8716
- readLines = (path, raw, as) => forEach(linesOf(raw), (line) => jsonOf(path, line).pipe(flatMap((value) => as(path, value))));
9242
+ readLines = (path, raw, as) => forEach(linesOf(raw), (line) => jsonOf$1(path, line).pipe(flatMap((value) => as(path, value))));
8717
9243
  parseSettings = fn("Store.parseSettings")(function* (path, raw) {
8718
- const value = yield* jsonOf(path, raw);
9244
+ const value = yield* jsonOf$1(path, raw);
8719
9245
  return yield* asSettings(path, value);
8720
9246
  });
8721
9247
  parseUpgradeCheck = fn("Store.parseUpgradeCheck")(function* (path, raw) {
8722
- const value = yield* jsonOf(path, raw);
9248
+ const value = yield* jsonOf$1(path, raw);
8723
9249
  return yield* asUpgradeCheck(path, value);
8724
9250
  });
8725
9251
  parseState = fn("Store.parseState")(function* (path, raw) {
8726
- const value = yield* jsonOf(path, raw);
8727
- const held = yield* asState(path, value);
8728
- return {
8729
- ...emptyBranchState,
8730
- ...held
8731
- };
9252
+ return yield* asState(path, yield* jsonOf$1(path, raw));
8732
9253
  });
8733
9254
  parseLayers = fn("Store.parseLayers")(function* (path, raw) {
8734
- const value = yield* jsonOf(path, raw);
8735
- const held = yield* asLayers(path, value);
8736
- return {
8737
- ...held,
8738
- parent: held.parent
8739
- };
9255
+ return yield* asLayers(path, yield* jsonOf$1(path, raw));
8740
9256
  });
8741
9257
  cursorOps = (state, inbox, spoken) => {
8742
9258
  return { take: fn("Store.take")(function* (worktreePath) {
@@ -8768,13 +9284,7 @@ var init_service$1 = __esmMin((() => {
8768
9284
  saveSettings: fn("Store.saveSettings")(function* (next) {
8769
9285
  const path = settingsPath(root);
8770
9286
  yield* ensureDir(root);
8771
- yield* tryPromise({
8772
- try: () => writeFile(path, JSON.stringify(next), "utf8"),
8773
- catch: (cause) => new StoreUnwritable({
8774
- path,
8775
- reason: String(cause)
8776
- })
8777
- });
9287
+ yield* writeSettings(path, next);
8778
9288
  })
8779
9289
  };
8780
9290
  };
@@ -8791,26 +9301,14 @@ var init_service$1 = __esmMin((() => {
8791
9301
  saveUpgradeCheck: fn("Store.saveUpgradeCheck")(function* (next) {
8792
9302
  const path = upgradePath(root);
8793
9303
  yield* ensureDir(root);
8794
- yield* tryPromise({
8795
- try: () => writeFile(path, JSON.stringify(next, void 0, 2), "utf8"),
8796
- catch: (cause) => new StoreUnwritable({
8797
- path,
8798
- reason: String(cause)
8799
- })
8800
- });
9304
+ yield* writeUpgradeCheck(path, next);
8801
9305
  })
8802
9306
  };
8803
9307
  };
8804
9308
  reportOps = (root) => fn("Store.saveReport")(function* (stamp, text) {
8805
9309
  const path = reportPath(root, stamp);
8806
9310
  yield* ensureDir(reportsDir(root));
8807
- yield* tryPromise({
8808
- try: () => writeFile(path, text, "utf8"),
8809
- catch: (cause) => new StoreUnwritable({
8810
- path,
8811
- reason: String(cause)
8812
- })
8813
- });
9311
+ yield* wrote(path, text);
8814
9312
  return path;
8815
9313
  });
8816
9314
  HEAD_REF = /^ref:\s*refs\/heads\/(.+)$/;
@@ -8826,40 +9324,33 @@ var init_service$1 = __esmMin((() => {
8826
9324
  keyOf$2 = (worktreePath) => map(all([promise(() => repoOf$2(worktreePath)), promise(() => headOf$1(worktreePath))], { concurrency: 2 }), ([repo, head]) => `${repo}#${head}`);
8827
9325
  wasKeyOf = (worktreePath) => promise(() => headOf$1(worktreePath).then((head) => `${worktreePath}#${head}`));
8828
9326
  there = (path) => stat(path).then(() => true, () => false);
8829
- adopted = /* @__PURE__ */ new Set();
8830
9327
  moved = (from, to) => rename(from, to).catch(() => void 0);
8831
9328
  adopt = fn("Store.adopt")(function* (root, key, was) {
8832
9329
  const here = branchDir(root, key);
8833
- if (yield* promise(() => there(here))) return key;
9330
+ if (yield* promise(() => there(here))) return;
8834
9331
  const older = branchDir(root, was);
8835
- if (!(yield* promise(() => there(older)))) return key;
9332
+ if (!(yield* promise(() => there(older)))) return;
8836
9333
  yield* promise(() => moved(older, here));
8837
- return key;
8838
9334
  });
8839
- keyIn = (root, worktreePath) => gen(function* () {
8840
- const key = yield* keyOf$2(worktreePath);
8841
- const mark = `${root}#${key}`;
8842
- if (adopted.has(mark)) return key;
8843
- adopted.add(mark);
9335
+ SPLIT$1 = "\0";
9336
+ ADOPT_SIZE = 256;
9337
+ adopting = (root) => fn("Store.adopting")(function* (mark) {
9338
+ const [key = "", worktreePath = ""] = mark.split(SPLIT$1);
8844
9339
  const was = yield* wasKeyOf(worktreePath);
8845
- return key === was ? key : yield* adopt(root, key, was);
9340
+ if (key !== was) yield* adopt(root, key, was);
9341
+ return key;
8846
9342
  });
8847
- answerOps = (root) => {
9343
+ keyIn = (adopted, worktreePath) => flatMap(keyOf$2(worktreePath), (key) => get(adopted, `${key}${SPLIT$1}${worktreePath}`));
9344
+ answerOps = (root, adopted) => {
8848
9345
  return {
8849
9346
  answer: fn("Store.answer")(function* (worktreePath, entry) {
8850
- const key = yield* keyIn(root, worktreePath);
9347
+ const key = yield* keyIn(adopted, worktreePath);
8851
9348
  const path = outboxPath(root, key);
8852
9349
  yield* ensureDir(branchDir(root, key));
8853
- yield* tryPromise({
8854
- try: () => appendFile(path, `${JSON.stringify(entry)}\n`, "utf8"),
8855
- catch: (cause) => new StoreUnwritable({
8856
- path,
8857
- reason: String(cause)
8858
- })
8859
- });
9350
+ yield* writeAnswer(path, entry);
8860
9351
  }),
8861
9352
  answers: fn("Store.answers")(function* (worktreePath) {
8862
- const key = yield* keyIn(root, worktreePath);
9353
+ const key = yield* keyIn(adopted, worktreePath);
8863
9354
  const path = outboxPath(root, key);
8864
9355
  const raw = yield* readOptional(path);
8865
9356
  return yield* match$3(raw, {
@@ -8869,73 +9360,54 @@ var init_service$1 = __esmMin((() => {
8869
9360
  })
8870
9361
  };
8871
9362
  };
8872
- draftsOps = (root) => {
9363
+ draftsOps = (root, adopted) => {
8873
9364
  return {
8874
9365
  drafts: fn("Store.drafts")(function* (worktreePath) {
8875
- const key = yield* keyIn(root, worktreePath);
9366
+ const key = yield* keyIn(adopted, worktreePath);
8876
9367
  const path = draftsPath(root, key);
8877
9368
  const raw = yield* readOptional(path);
8878
9369
  if (isNone(raw)) return [];
8879
- const value = yield* jsonOf(path, raw.value);
9370
+ const value = yield* jsonOf$1(path, raw.value);
8880
9371
  return (yield* asDrafts(path, value)).drafts;
8881
9372
  }),
8882
9373
  saveDrafts: fn("Store.saveDrafts")(function* (worktreePath, next) {
8883
- const key = yield* keyIn(root, worktreePath);
9374
+ const key = yield* keyIn(adopted, worktreePath);
8884
9375
  const path = draftsPath(root, key);
8885
9376
  yield* ensureDir(branchDir(root, key));
8886
- const body = JSON.stringify({
8887
- version: 1,
9377
+ yield* writeDrafts(path, {
9378
+ version: DRAFTS_VERSION,
8888
9379
  drafts: next
8889
- }, void 0, 2);
8890
- yield* tryPromise({
8891
- try: () => writeFile(path, body, "utf8"),
8892
- catch: (cause) => new StoreUnwritable({
8893
- path,
8894
- reason: String(cause)
8895
- })
8896
9380
  });
8897
9381
  })
8898
9382
  };
8899
9383
  };
8900
- layersOps = (root) => {
9384
+ layersOps = (root, adopted) => {
8901
9385
  return {
8902
9386
  layers: fn("Store.layers")(function* (worktreePath) {
8903
- const key = yield* keyIn(root, worktreePath);
9387
+ const key = yield* keyIn(adopted, worktreePath);
8904
9388
  const path = layersPath(root, key);
8905
9389
  const raw = yield* readOptional(path);
8906
9390
  if (isNone(raw)) return none();
8907
9391
  return some(yield* parseLayers(path, raw.value));
8908
9392
  }),
8909
9393
  saveLayers: fn("Store.saveLayers")(function* (worktreePath, next) {
8910
- const key = yield* keyIn(root, worktreePath);
9394
+ const key = yield* keyIn(adopted, worktreePath);
8911
9395
  const path = layersPath(root, key);
8912
9396
  yield* ensureDir(branchDir(root, key));
8913
- yield* tryPromise({
8914
- try: () => writeFile(path, JSON.stringify(next, void 0, 2), "utf8"),
8915
- catch: (cause) => new StoreUnwritable({
8916
- path,
8917
- reason: String(cause)
8918
- })
8919
- });
9397
+ yield* writeLayers(path, next);
8920
9398
  })
8921
9399
  };
8922
9400
  };
8923
- inboxOps = (root) => {
9401
+ inboxOps = (root, adopted) => {
8924
9402
  return {
8925
9403
  submit: fn("Store.submit")(function* (worktreePath, batch) {
8926
- const key = yield* keyIn(root, worktreePath);
9404
+ const key = yield* keyIn(adopted, worktreePath);
8927
9405
  const path = inboxPath(root, key);
8928
9406
  yield* ensureDir(branchDir(root, key));
8929
- yield* tryPromise({
8930
- try: () => appendFile(path, `${JSON.stringify(batch)}\n`, "utf8"),
8931
- catch: (cause) => new StoreUnwritable({
8932
- path,
8933
- reason: String(cause)
8934
- })
8935
- });
9407
+ yield* writeBatch(path, batch);
8936
9408
  }),
8937
9409
  inbox: fn("Store.inbox")(function* (worktreePath) {
8938
- const key = yield* keyIn(root, worktreePath);
9410
+ const key = yield* keyIn(adopted, worktreePath);
8939
9411
  const path = inboxPath(root, key);
8940
9412
  const raw = yield* readOptional(path);
8941
9413
  return yield* match$3(raw, {
@@ -8962,9 +9434,9 @@ var init_service$1 = __esmMin((() => {
8962
9434
  schedule: spaced(LOCK_WAIT_MS)
8963
9435
  });
8964
9436
  freed = (path) => promise(() => rm(path, { force: true }));
8965
- stateOps = (root) => {
9437
+ stateOps = (root, adopted) => {
8966
9438
  const state = fn("Store.state")(function* (worktreePath) {
8967
- const key = yield* keyIn(root, worktreePath);
9439
+ const key = yield* keyIn(adopted, worktreePath);
8968
9440
  const path = statePath(root, key);
8969
9441
  const raw = yield* readOptional(path);
8970
9442
  return yield* match$3(raw, {
@@ -8973,19 +9445,13 @@ var init_service$1 = __esmMin((() => {
8973
9445
  });
8974
9446
  });
8975
9447
  const saveState = fn("Store.saveState")(function* (worktreePath, next) {
8976
- const key = yield* keyIn(root, worktreePath);
9448
+ const key = yield* keyIn(adopted, worktreePath);
8977
9449
  const path = statePath(root, key);
8978
9450
  yield* ensureDir(branchDir(root, key));
8979
- yield* tryPromise({
8980
- try: () => writeFile(path, JSON.stringify(next, void 0, 2), "utf8"),
8981
- catch: (cause) => new StoreUnwritable({
8982
- path,
8983
- reason: String(cause)
8984
- })
8985
- });
9451
+ yield* writeState(path, next);
8986
9452
  });
8987
9453
  const changeState = fn("Store.changeState")(function* (worktreePath, change) {
8988
- const key = yield* keyIn(root, worktreePath);
9454
+ const key = yield* keyIn(adopted, worktreePath);
8989
9455
  yield* ensureDir(branchDir(root, key));
8990
9456
  const lock = `${statePath(root, key)}.lock`;
8991
9457
  yield* acquireUseRelease(taken(lock), () => under(worktreePath, change), () => freed(lock));
@@ -8999,10 +9465,10 @@ var init_service$1 = __esmMin((() => {
8999
9465
  changeState
9000
9466
  };
9001
9467
  };
9002
- makeStore = (root) => {
9003
- const { submit, inbox } = inboxOps(root);
9004
- const { state, saveState, changeState } = stateOps(root);
9005
- const talk = answerOps(root);
9468
+ makeStore = (root, adopted) => {
9469
+ const { submit, inbox } = inboxOps(root, adopted);
9470
+ const { state, saveState, changeState } = stateOps(root, adopted);
9471
+ const talk = answerOps(root, adopted);
9006
9472
  const cursors = cursorOps(state, inbox, talk.answers);
9007
9473
  return {
9008
9474
  root,
@@ -9016,12 +9482,19 @@ var init_service$1 = __esmMin((() => {
9016
9482
  ...settingsOps(root),
9017
9483
  ...upgradeOps(root),
9018
9484
  ...talk,
9019
- ...layersOps(root),
9020
- ...draftsOps(root),
9485
+ ...layersOps(root, adopted),
9486
+ ...draftsOps(root, adopted),
9021
9487
  ...cursors
9022
9488
  };
9023
9489
  };
9024
- storeAt = (root) => succeed$2(Store)(makeStore(root));
9490
+ madeStore = fn("Store.make")(function* (root) {
9491
+ const adopted = yield* make$8({
9492
+ capacity: ADOPT_SIZE,
9493
+ lookup: adopting(root)
9494
+ });
9495
+ return makeStore(root, adopted);
9496
+ });
9497
+ storeAt = (root) => effect(Store)(madeStore(root));
9025
9498
  }));
9026
9499
  //#endregion
9027
9500
  //#region src/service/store/index.ts
@@ -9233,10 +9706,11 @@ var init_run = __esmMin((() => {
9233
9706
  MAX_OUTPUT = 67108864;
9234
9707
  git = fn("Git.run")(function* (cwd, args) {
9235
9708
  return yield* tryPromise({
9236
- try: () => exec("git", [...args], {
9709
+ try: (signal) => exec("git", [...args], {
9237
9710
  cwd,
9238
9711
  maxBuffer: MAX_OUTPUT,
9239
- encoding: "utf8"
9712
+ encoding: "utf8",
9713
+ signal
9240
9714
  }),
9241
9715
  catch: (cause) => new GitCommandFailed({
9242
9716
  command: args,
@@ -9248,12 +9722,16 @@ var init_run = __esmMin((() => {
9248
9722
  gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
9249
9723
  return yield* git(cwd, args).pipe(catchTag("GitCommandFailed", () => succeed$1("")));
9250
9724
  });
9251
- })), GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, branchTips, parents, parentOf, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, shape, GitLive;
9725
+ })), GREP_CONTEXT, CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, findDefaultBranch, partsOf$1, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, findRepo, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
9252
9726
  var init_service = __esmMin((() => {
9253
9727
  init_dist();
9254
9728
  init_error$1();
9255
9729
  init_run();
9256
9730
  GREP_CONTEXT = 2;
9731
+ CACHE_SIZE = 256;
9732
+ NAME_TTL = "5 minutes";
9733
+ FRESH_TTL = "3 seconds";
9734
+ SPLIT = "\0";
9257
9735
  DEFAULT_BRANCH_CANDIDATES = [
9258
9736
  "origin/master",
9259
9737
  "origin/main",
@@ -9287,8 +9765,6 @@ var init_service = __esmMin((() => {
9287
9765
  }
9288
9766
  return entries;
9289
9767
  };
9290
- baseNames = /* @__PURE__ */ new Map();
9291
- mergeBases = /* @__PURE__ */ new Map();
9292
9768
  findDefaultBranch = fn("Git.findDefaultBranch")(function* (repo) {
9293
9769
  const symbolic = yield* gitOrEmpty(repo, ["symbolic-ref", "refs/remotes/origin/HEAD"]);
9294
9770
  if (symbolic.trim().length > 0) return symbolic.trim().replace("refs/remotes/", "");
@@ -9299,27 +9775,17 @@ var init_service = __esmMin((() => {
9299
9775
  ])).trim().length > 0) return candidate;
9300
9776
  return "HEAD";
9301
9777
  });
9302
- defaultBranch = fn("Git.defaultBranch")(function* (repo) {
9303
- const known = baseNames.get(repo);
9304
- if (known !== void 0) return known;
9305
- const found = yield* findDefaultBranch(repo);
9306
- baseNames.set(repo, found);
9307
- return found;
9308
- });
9309
- mergeBaseOf = fn("Git.mergeBase")(function* (entry, base) {
9310
- const key = `${entry.path} ${entry.head} ${base}`;
9311
- const known = mergeBases.get(key);
9312
- if (known !== void 0) return known;
9313
- const found = (yield* gitOrEmpty(entry.path, [
9778
+ partsOf$1 = (key) => key.split(SPLIT);
9779
+ findMergeBase = fn("Git.mergeBase")(function* (key) {
9780
+ const [path = "", base = ""] = partsOf$1(key);
9781
+ return (yield* gitOrEmpty(path, [
9314
9782
  "merge-base",
9315
9783
  base,
9316
9784
  "HEAD"
9317
9785
  ])).trim();
9318
- mergeBases.set(key, found);
9319
- return found;
9320
9786
  });
9321
- toWorktree = fn("Git.toWorktree")(function* (entry, base, own) {
9322
- const mergeBase = yield* mergeBaseOf(entry, base);
9787
+ toWorktree = fn("Git.toWorktree")(function* (caches, entry, base, own) {
9788
+ const mergeBase = yield* get(caches.mergeBase, `${entry.path}${SPLIT}${base}`);
9323
9789
  return {
9324
9790
  path: entry.path,
9325
9791
  branch: entry.detached ? `(detached ${entry.head.slice(0, 8)})` : entry.branch,
@@ -9346,18 +9812,12 @@ var init_service = __esmMin((() => {
9346
9812
  }
9347
9813
  return tips;
9348
9814
  });
9349
- parents = /* @__PURE__ */ new Map();
9350
- parentOf = fn("Git.parentOf")(function* (repo, branch, fallback) {
9815
+ findParent = fn("Git.parentOf")(function* (key) {
9816
+ const [repo = "", branch = "", fallback = ""] = partsOf$1(key);
9351
9817
  const own = (yield* gitOrEmpty(repo, ["rev-list", `${fallback}..${branch}`])).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
9352
- const tip = own[0];
9353
- if (tip === void 0) return fallback;
9354
- const key = `${repo} ${branch} ${tip} ${fallback}`;
9355
- const known = parents.get(key);
9356
- if (known !== void 0) return known;
9818
+ if (own[0] === void 0) return fallback;
9357
9819
  const tips = yield* branchTips(repo);
9358
- const found = own.slice(1).flatMap((sha) => tips.get(sha) ?? []).find((name) => name !== branch);
9359
- parents.set(key, found ?? fallback);
9360
- return found ?? fallback;
9820
+ return own.slice(1).flatMap((sha) => tips.get(sha) ?? []).find((name) => name !== branch) ?? fallback;
9361
9821
  });
9362
9822
  splitLines = (text) => text.split("\n");
9363
9823
  absent = succeed$1(none());
@@ -9371,21 +9831,21 @@ var init_service = __esmMin((() => {
9371
9831
  }).pipe(map(some), catchTag("FileUnreadable", () => absent));
9372
9832
  });
9373
9833
  settled = (path) => promise(() => realpath(path).catch(() => resolve(path)));
9374
- seenAs = fn("Git.seenAs")(function* (entry, base, opened) {
9834
+ seenAs = fn("Git.seenAs")(function* (caches, entry, base, opened) {
9375
9835
  const path = yield* settled(entry.path);
9376
- return yield* toWorktree(entry, base, path === opened);
9836
+ return yield* toWorktree(caches, entry, base, path === opened);
9377
9837
  });
9378
- listWorktrees = fn("Git.worktrees")(function* (repo) {
9838
+ listWorktrees = fn("Git.worktrees")(function* (caches, repo) {
9379
9839
  const porcelain = yield* gitOrEmpty(repo, [
9380
9840
  "worktree",
9381
9841
  "list",
9382
9842
  "--porcelain"
9383
9843
  ]);
9384
9844
  if (porcelain.trim().length === 0) return yield* new NotARepository({ path: repo });
9385
- const base = yield* defaultBranch(repo);
9845
+ const base = yield* get(caches.baseName, repo);
9386
9846
  const entries = readEntries(porcelain);
9387
9847
  const opened = yield* settled(repo);
9388
- const read = (entry) => seenAs(entry, base, opened);
9848
+ const read = (entry) => seenAs(caches, entry, base, opened);
9389
9849
  return yield* forEach(entries, read, { concurrency: 8 });
9390
9850
  });
9391
9851
  readDiff = fn("Git.diff")(function* (worktree, context, only) {
@@ -9430,39 +9890,64 @@ var init_service = __esmMin((() => {
9430
9890
  term
9431
9891
  ]);
9432
9892
  });
9433
- shape = {
9434
- worktrees: listWorktrees,
9435
- repoOf: fn("Git.repoOf")(function* (worktree) {
9436
- const trimmed = (yield* gitOrEmpty(worktree, [
9437
- "rev-parse",
9438
- "--path-format=absolute",
9439
- "--git-common-dir"
9440
- ])).trim();
9441
- return trimmed.length === 0 ? resolve(worktree) : resolve(trimmed, "..");
9442
- }),
9893
+ findRepo = fn("Git.repoOf")(function* (worktree) {
9894
+ const trimmed = (yield* gitOrEmpty(worktree, [
9895
+ "rev-parse",
9896
+ "--path-format=absolute",
9897
+ "--git-common-dir"
9898
+ ])).trim();
9899
+ return trimmed.length === 0 ? resolve(worktree) : resolve(trimmed, "..");
9900
+ });
9901
+ refResolves = fn("Git.resolves")(function* (repo, ref) {
9902
+ return (yield* gitOrEmpty(repo, [
9903
+ "rev-parse",
9904
+ "--verify",
9905
+ `${ref}^{commit}`
9906
+ ])).trim().length > 0;
9907
+ });
9908
+ sharedCommit = fn("Git.sharedWith")(function* (repo, branch, ref) {
9909
+ return (yield* gitOrEmpty(repo, [
9910
+ "merge-base",
9911
+ branch,
9912
+ ref
9913
+ ])).trim();
9914
+ });
9915
+ makeCaches = fn("Git.caches")(function* () {
9916
+ return {
9917
+ baseName: yield* make$8({
9918
+ capacity: CACHE_SIZE,
9919
+ timeToLive: NAME_TTL,
9920
+ lookup: findDefaultBranch
9921
+ }),
9922
+ mergeBase: yield* make$8({
9923
+ capacity: CACHE_SIZE,
9924
+ timeToLive: FRESH_TTL,
9925
+ lookup: findMergeBase
9926
+ }),
9927
+ parent: yield* make$8({
9928
+ capacity: CACHE_SIZE,
9929
+ timeToLive: FRESH_TTL,
9930
+ lookup: findParent
9931
+ })
9932
+ };
9933
+ });
9934
+ shapeWith = (caches) => ({
9935
+ worktrees: (repo) => listWorktrees(caches, repo),
9936
+ repoOf: findRepo,
9443
9937
  diff: readDiff,
9444
9938
  stat: readStat,
9445
9939
  source: readSource,
9446
9940
  blob: readBlob,
9447
9941
  grep: readGrep,
9448
- defaultBranch,
9449
- stackParent: (repo, branch) => defaultBranch(repo).pipe(flatMap((fallback) => parentOf(repo, branch, fallback))),
9450
- resolves: fn("Git.resolves")(function* (repo, ref) {
9451
- return (yield* gitOrEmpty(repo, [
9452
- "rev-parse",
9453
- "--verify",
9454
- `${ref}^{commit}`
9455
- ])).trim().length > 0;
9456
- }),
9457
- sharedWith: fn("Git.sharedWith")(function* (repo, branch, ref) {
9458
- return (yield* gitOrEmpty(repo, [
9459
- "merge-base",
9460
- branch,
9461
- ref
9462
- ])).trim();
9463
- })
9464
- };
9465
- GitLive = succeed$2(Git)(shape);
9942
+ defaultBranch: (repo) => get(caches.baseName, repo),
9943
+ stackParent: (repo, branch) => get(caches.baseName, repo).pipe(flatMap((fallback) => get(caches.parent, `${repo}${SPLIT}${branch}${SPLIT}${fallback}`))),
9944
+ resolves: refResolves,
9945
+ sharedWith: sharedCommit
9946
+ });
9947
+ makeGit = fn("Git.make")(function* () {
9948
+ return shapeWith(yield* makeCaches());
9949
+ });
9950
+ GitLive = effect(Git)(makeGit());
9466
9951
  }));
9467
9952
  //#endregion
9468
9953
  //#region src/service/git/index.ts
@@ -9569,7 +10054,7 @@ var init_error = __esmMin((() => {
9569
10054
  }));
9570
10055
  //#endregion
9571
10056
  //#region src/cli/commands.ts
9572
- var CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, anchorIn, commentIn, submitComment, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
10057
+ var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, anchorIn, commentIn, submitComment, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
9573
10058
  var init_commands = __esmMin((() => {
9574
10059
  init_dist();
9575
10060
  init_patch();
@@ -9578,6 +10063,13 @@ var init_commands = __esmMin((() => {
9578
10063
  init_store();
9579
10064
  init_preferences();
9580
10065
  init_error();
10066
+ realOf = (worktree) => tryPromise({
10067
+ try: () => realpath(worktree),
10068
+ catch: () => new UnknownWorktree({
10069
+ worktree,
10070
+ known: []
10071
+ })
10072
+ });
9581
10073
  CONTEXT = 3;
9582
10074
  POLL = "500 millis";
9583
10075
  AUTO = "auto";
@@ -9911,7 +10403,7 @@ var init_commands = __esmMin((() => {
9911
10403
  };
9912
10404
  takeComments = fn("Cli.takeComments")(function* (worktree) {
9913
10405
  const store = yield* Store;
9914
- const resolved = yield* promise(() => realpath(worktree));
10406
+ const resolved = yield* realOf(worktree);
9915
10407
  const owed = flatten(yield* store.take(resolved));
9916
10408
  if (owed.every((one) => one.replyTo === void 0)) return owed;
9917
10409
  const held = flatten(yield* store.inbox(resolved));
@@ -9927,7 +10419,7 @@ var init_commands = __esmMin((() => {
9927
10419
  });
9928
10420
  branchAt = fn("Cli.branchAt")(function* (worktree) {
9929
10421
  const store = yield* Store;
9930
- const resolved = yield* promise(() => realpath(worktree));
10422
+ const resolved = yield* realOf(worktree);
9931
10423
  return yield* store.branchAt(resolved);
9932
10424
  });
9933
10425
  awaitComments = (worktree, deadline) => takeComments(worktree).pipe(flatMap((comments) => comments.length > 0 || Date.now() >= deadline ? succeed$1(comments) : sleep(POLL).pipe(flatMap(() => awaitComments(worktree, deadline)))));
@@ -10378,7 +10870,8 @@ var init_pane = __esmMin((() => {
10378
10870
  ];
10379
10871
  };
10380
10872
  ran = (binary, args) => callback$1((resume) => {
10381
- execFile(binary, [...args], { timeout: TIMEOUT_MS }, (cause) => resume(succeed$1(cause === null)));
10873
+ const child = execFile(binary, [...args], { timeout: TIMEOUT_MS }, (cause) => resume(succeed$1(cause === null)));
10874
+ return sync(() => void child.kill());
10382
10875
  });
10383
10876
  split = fn("Cli.split")(function* (chosen, repo, branch) {
10384
10877
  return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch)));
@@ -10403,10 +10896,10 @@ var init_pane = __esmMin((() => {
10403
10896
  init_drafts();
10404
10897
  init_init();
10405
10898
  init_pane();
10406
- var version$1 = "0.1.0-alpha.114";
10899
+ var version$1 = "0.1.0-alpha.115";
10407
10900
  //#endregion
10408
10901
  //#region src/cli/upgrade.ts
10409
- var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
10902
+ var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
10410
10903
  var init_upgrade$1 = __esmMin((() => {
10411
10904
  init_dist();
10412
10905
  PACKAGE = "@eliya-oss/agent-diff";
@@ -10513,24 +11006,35 @@ var init_upgrade$1 = __esmMin((() => {
10513
11006
  };
10514
11007
  }).pipe(withSpan("Cli.findUpgrade"));
10515
11008
  willUpgrade = (found, check) => !check && found.current !== true && RUNNABLE.has(found.route);
10516
- runUpgrade = (found, quiet) => callback$1((resume) => {
11009
+ ranChild = (spec, done, broke) => callback$1((resume) => {
11010
+ let said = "";
10517
11011
  let answered = false;
10518
- const settle = (worked) => {
11012
+ const settle = (value) => {
10519
11013
  if (answered) return;
10520
11014
  answered = true;
10521
- resume(succeed$1(worked));
11015
+ resume(succeed$1(value));
10522
11016
  };
10523
- const child = spawn("/bin/sh", ["-c", found.command], {
10524
- timeout: RUN_MS,
10525
- stdio: quiet ? "ignore" : [
10526
- "ignore",
10527
- "inherit",
10528
- "inherit"
10529
- ]
11017
+ const child = spawn(spec.command, [...spec.args], {
11018
+ timeout: spec.timeout,
11019
+ stdio: spec.stdio
11020
+ });
11021
+ child.stdout?.on("data", (chunk) => {
11022
+ said += chunk.toString("utf8");
10530
11023
  });
10531
- child.on("error", () => settle(false));
10532
- child.on("close", (code) => settle(code === 0));
10533
- }).pipe(withSpan("Cli.runUpgrade"));
11024
+ child.on("error", () => settle(broke));
11025
+ child.on("close", (code) => settle(done(code, said)));
11026
+ return sync(() => void child.kill());
11027
+ });
11028
+ runUpgrade = (found, quiet) => ranChild({
11029
+ command: "/bin/sh",
11030
+ args: ["-c", found.command],
11031
+ timeout: RUN_MS,
11032
+ stdio: quiet ? "ignore" : [
11033
+ "ignore",
11034
+ "inherit",
11035
+ "inherit"
11036
+ ]
11037
+ }, (code) => code === 0, false).pipe(withSpan("Cli.runUpgrade"));
10534
11038
  statusOf$1 = (found) => {
10535
11039
  if (!found.checked) return `adiff ${found.version} is installed. The registry did not answer.`;
10536
11040
  if (found.current === true) return `adiff ${found.version} is the newest build.`;
@@ -10553,32 +11057,20 @@ var init_upgrade$1 = __esmMin((() => {
10553
11057
  return `Ran \`${found.command}\`, and adiff ${found.latest} is installed now.`;
10554
11058
  };
10555
11059
  REFRESH_MS = 1e4;
10556
- refreshSkills = callback$1((resume) => {
10557
- let said = "";
10558
- let answered = false;
10559
- const settle = (paths) => {
10560
- if (answered) return;
10561
- answered = true;
10562
- resume(succeed$1(paths));
10563
- };
10564
- const child = spawn("adiff", [
11060
+ refreshSkills = ranChild({
11061
+ command: "adiff",
11062
+ args: [
10565
11063
  "skill",
10566
11064
  "refresh",
10567
11065
  "--json"
10568
- ], {
10569
- timeout: REFRESH_MS,
10570
- stdio: [
10571
- "ignore",
10572
- "pipe",
10573
- "ignore"
10574
- ]
10575
- });
10576
- child.stdout?.on("data", (chunk) => {
10577
- said += chunk.toString("utf8");
10578
- });
10579
- child.on("error", () => settle([]));
10580
- child.on("close", (code) => settle(code === 0 ? updatedIn(said) : []));
10581
- }).pipe(withSpan("Cli.refreshedSkill"));
11066
+ ],
11067
+ timeout: REFRESH_MS,
11068
+ stdio: [
11069
+ "ignore",
11070
+ "pipe",
11071
+ "ignore"
11072
+ ]
11073
+ }, (code, said) => code === 0 ? updatedIn(said) : [], []).pipe(withSpan("Cli.refreshedSkill"));
10582
11074
  updatedIn = (said) => {
10583
11075
  return (runSync(try_(() => JSON.parse(said)).pipe(orElseSucceed(() => ({})))).changes ?? []).filter((change) => change.action === "update").flatMap((change) => change.path === void 0 ? [] : [change.path]);
10584
11076
  };
@@ -13030,10 +13522,18 @@ var init_model = __esmMin((() => {
13030
13522
  //#region src/tui/report.ts
13031
13523
  var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, facts, fenced, fully, minimal, buildReport;
13032
13524
  var init_report = __esmMin((() => {
13525
+ init_dist();
13033
13526
  init_model();
13034
13527
  AROUND_CURSOR = 8;
13035
13528
  TREE_ROWS = 12;
13036
- sign = (kind) => kind === "added" ? "+" : kind === "removed" ? "-" : " ";
13529
+ sign = (kind) => {
13530
+ switch (kind) {
13531
+ case "added": return "+";
13532
+ case "removed": return "-";
13533
+ case "context": return " ";
13534
+ default: return absurd(kind);
13535
+ }
13536
+ };
13037
13537
  visibleRows = (state) => {
13038
13538
  const patch = selectedPatch(state);
13039
13539
  if (patch === void 0) return [];
@@ -13861,7 +14361,7 @@ var init_match = __esmMin((() => {
13861
14361
  }));
13862
14362
  //#endregion
13863
14363
  //#region src/tui/reduce.ts
13864
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
14364
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
13865
14365
  var init_reduce = __esmMin((() => {
13866
14366
  init_dist();
13867
14367
  init_patch();
@@ -14213,44 +14713,44 @@ var init_reduce = __esmMin((() => {
14213
14713
  anchorRow: state.selecting ? state.anchorRow : state.cursor
14214
14714
  };
14215
14715
  };
14716
+ outOfDiff = (state) => state.selecting ? {
14717
+ ...state,
14718
+ selecting: false,
14719
+ anchorRow: state.cursor
14720
+ } : {
14721
+ ...state,
14722
+ screen: "branches",
14723
+ selecting: false
14724
+ };
14216
14725
  goBack = (state) => {
14217
- if (state.screen === "search") return {
14218
- ...state,
14219
- screen: "review",
14220
- matches: [],
14221
- term: "",
14222
- query: ""
14223
- };
14224
- if (state.screen === "report") return {
14225
- ...state,
14226
- screen: state.returnTo,
14227
- draft: ""
14228
- };
14229
- if (state.screen === "palette") return {
14230
- ...state,
14231
- screen: state.returnTo,
14232
- query: ""
14233
- };
14234
- if (state.screen === "keys") return {
14235
- ...state,
14236
- screen: state.returnTo,
14237
- query: ""
14238
- };
14239
- if (state.screen === "compose") return {
14240
- ...state,
14241
- screen: "review",
14242
- replyTo: void 0
14243
- };
14244
- if (state.selecting) return {
14245
- ...state,
14246
- selecting: false,
14247
- anchorRow: state.cursor
14248
- };
14249
- return {
14250
- ...state,
14251
- screen: "branches",
14252
- selecting: false
14253
- };
14726
+ switch (state.screen) {
14727
+ case "search": return {
14728
+ ...state,
14729
+ screen: "review",
14730
+ matches: [],
14731
+ term: "",
14732
+ query: ""
14733
+ };
14734
+ case "report": return {
14735
+ ...state,
14736
+ screen: state.returnTo,
14737
+ draft: ""
14738
+ };
14739
+ case "palette":
14740
+ case "keys": return {
14741
+ ...state,
14742
+ screen: state.returnTo,
14743
+ query: ""
14744
+ };
14745
+ case "compose": return {
14746
+ ...state,
14747
+ screen: "review",
14748
+ replyTo: void 0
14749
+ };
14750
+ case "branches":
14751
+ case "review": return outOfDiff(state);
14752
+ default: return absurd(state.screen);
14753
+ }
14254
14754
  };
14255
14755
  walkMatches = (state, delta) => ({
14256
14756
  ...state,
@@ -15428,8 +15928,9 @@ var init_diffview = __esmMin((() => {
15428
15928
  }));
15429
15929
  //#endregion
15430
15930
  //#region src/tui/render.ts
15431
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerMark, layerLead, layerGutter, layerText, litRow, leftOver, titlePaint, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
15931
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, litRow, leftOver, titlePaint, titleMark, titleLook, fileLook, layerLook, layerGutter, layerText, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
15432
15932
  var init_render = __esmMin((() => {
15933
+ init_dist();
15433
15934
  init_command();
15434
15935
  init_layers$1();
15435
15936
  init_patch();
@@ -16109,26 +16610,6 @@ var init_render = __esmMin((() => {
16109
16610
  file: Math.max(4, whole - FILE_LEAD)
16110
16611
  };
16111
16612
  };
16112
- layerMark = (state, row) => {
16113
- if (row.kind === "file") return row.reviewed === true ? marks().reviewed : " ";
16114
- if (row.kind !== "title" || !row.lead) return " ";
16115
- if (layerDone(state, row.index)) return marks().reviewed;
16116
- if (leftOver(state, row.index)) return "·";
16117
- return `${row.index + 1}`;
16118
- };
16119
- layerLead = (row) => {
16120
- if (row.kind === "file") return FILE_LEAD;
16121
- if (row.kind === "dir") return DIR_LEAD;
16122
- return TITLE_LEAD;
16123
- };
16124
- layerGutter = (state, row) => {
16125
- return `${row.here === true ? "▎" : " "}${layerMark(state, row).padStart(2)}`;
16126
- };
16127
- layerText = (state, row, room) => {
16128
- if (row.kind === "gap") return "";
16129
- const lead = layerLead(row) - GUTTER;
16130
- return `${layerGutter(state, row)}${" ".repeat(lead)}${row.text}`.padEnd(room.title + TITLE_LEAD);
16131
- };
16132
16613
  litRow = (row, state, drawn) => row.here === true ? bg(restingOrHere(state.focus === "tree"))(drawn) : drawn;
16133
16614
  leftOver = (state, layerIndex) => state.layers[layerIndex]?.title === REMAINDER_TITLE;
16134
16615
  titlePaint = (state, layerIndex) => {
@@ -16137,11 +16618,44 @@ var init_render = __esmMin((() => {
16137
16618
  if (layerDone(state, layerIndex)) return palette.faint;
16138
16619
  return here ? palette.ink : palette.muted;
16139
16620
  };
16140
- layerPaint = (state, row) => {
16141
- if (row.kind === "file") return row.reviewed === true ? palette.added : palette.ink;
16142
- if (row.kind === "dir" || row.kind === "count") return palette.faint;
16143
- return titlePaint(state, row.index);
16621
+ titleMark = (state, row) => {
16622
+ if (!row.lead) return " ";
16623
+ if (layerDone(state, row.index)) return marks().reviewed;
16624
+ if (leftOver(state, row.index)) return "·";
16625
+ return `${row.index + 1}`;
16626
+ };
16627
+ titleLook = (state, row) => ({
16628
+ lead: TITLE_LEAD,
16629
+ mark: titleMark(state, row),
16630
+ paint: titlePaint(state, row.index)
16631
+ });
16632
+ fileLook = (row) => ({
16633
+ lead: FILE_LEAD,
16634
+ mark: row.reviewed === true ? marks().reviewed : " ",
16635
+ paint: row.reviewed === true ? palette.added : palette.ink
16636
+ });
16637
+ layerLook = (state, row) => {
16638
+ switch (row.kind) {
16639
+ case "file": return fileLook(row);
16640
+ case "dir": return {
16641
+ lead: DIR_LEAD,
16642
+ mark: " ",
16643
+ paint: palette.faint
16644
+ };
16645
+ case "count":
16646
+ case "gap": return {
16647
+ lead: TITLE_LEAD,
16648
+ mark: " ",
16649
+ paint: palette.faint
16650
+ };
16651
+ case "title": return titleLook(state, row);
16652
+ default: return absurd(row.kind);
16653
+ }
16144
16654
  };
16655
+ layerGutter = (row, look) => {
16656
+ return `${row.here === true ? "▎" : " "}${look.mark.padStart(2)}`;
16657
+ };
16658
+ layerText = (row, look, room) => row.kind === "gap" ? "" : `${layerGutter(row, look)}${" ".repeat(look.lead - GUTTER)}${row.text}`.padEnd(room.title + TITLE_LEAD);
16145
16659
  PANEL_TITLES = {
16146
16660
  asked: "Waiting on you",
16147
16661
  with: "With the agent",
@@ -16441,9 +16955,16 @@ var init_render = __esmMin((() => {
16441
16955
  return this.composeBody;
16442
16956
  }
16443
16957
  asking(screen) {
16444
- if (screen === "palette") return this.paletteQuery;
16445
- if (screen === "search") return this.foundQuery;
16446
- return screen === "keys" ? this.keysQuery : void 0;
16958
+ switch (screen) {
16959
+ case "palette": return this.paletteQuery;
16960
+ case "search": return this.foundQuery;
16961
+ case "keys": return this.keysQuery;
16962
+ case "branches":
16963
+ case "review":
16964
+ case "compose":
16965
+ case "report": return;
16966
+ default: return absurd(screen);
16967
+ }
16447
16968
  }
16448
16969
  railRows() {
16449
16970
  return this.listRoom();
@@ -16631,8 +17152,9 @@ var init_render = __esmMin((() => {
16631
17152
  ]);
16632
17153
  }
16633
17154
  layerLine(state, row, room) {
16634
- const drawn = layerText(state, row, room);
16635
- const body = fg(layerPaint(state, row))(`${drawn.slice(1)}\n`);
17155
+ const look = layerLook(state, row);
17156
+ const drawn = layerText(row, look, room);
17157
+ const body = fg(look.paint)(`${drawn.slice(1)}\n`);
16636
17158
  return [fg(row.here === true ? palette.marker : palette.faint)(drawn.slice(0, 1)), litRow(row, state, body)];
16637
17159
  }
16638
17160
  railFitted(state, all, height) {
@@ -16992,19 +17514,19 @@ var init_intent = __esmMin((() => {
16992
17514
  }));
16993
17515
  //#endregion
16994
17516
  //#region src/tui/session.ts
16995
- var parse, saved, held, readSession, sessionOf, writeSession;
17517
+ var zero, Held, decode, jsonOf, parse, saved, held, readSession, sessionOf, writeSession;
16996
17518
  var init_session = __esmMin((() => {
16997
17519
  init_dist();
16998
- parse = (raw) => {
16999
- const parsed = JSON.parse(raw);
17000
- if (typeof parsed.branchIndex !== "number") return none();
17001
- return some({
17002
- branchIndex: parsed.branchIndex,
17003
- patchIndex: parsed.patchIndex ?? 0,
17004
- cursor: parsed.cursor ?? 0,
17005
- top: parsed.top ?? 0
17006
- });
17007
- };
17520
+ zero = withDecodingDefaultKey(succeed$1(0));
17521
+ Held = Struct({
17522
+ branchIndex: Number$1,
17523
+ patchIndex: Number$1.pipe(zero),
17524
+ cursor: Number$1.pipe(zero),
17525
+ top: Number$1.pipe(zero)
17526
+ });
17527
+ decode = decodeUnknownOption(Held);
17528
+ jsonOf = liftThrowable((raw) => JSON.parse(raw));
17529
+ parse = (raw) => flatMap$2(jsonOf(raw), decode);
17008
17530
  saved = (path, session) => writeFile(path, JSON.stringify(session), "utf8").catch(() => void 0);
17009
17531
  held = (path) => readFile(path, "utf8").then((raw) => some(raw)).catch(() => none());
17010
17532
  readSession = fn("Tui.readSession")(function* (path) {