@pmelab/gtd 23.0.0 → 23.2.0

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.
@@ -299,7 +299,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
299
299
  * @category constructors
300
300
  * @since 2.0.0
301
301
  */
302
- const make$51 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
302
+ const make$49 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
303
303
  const isStrictEquivalent = (x, y) => x === y;
304
304
  /**
305
305
  * Return an `Equivalence` that uses strict equality (===) to compare values.
@@ -317,7 +317,7 @@ const number$2 = /*#__PURE__*/ strict();
317
317
  * @category mapping
318
318
  * @since 2.0.0
319
319
  */
320
- const mapInput$1 = /*#__PURE__*/ dual(2, (self, f) => make$51((x, y) => self(f(x), f(y))));
320
+ const mapInput$1 = /*#__PURE__*/ dual(2, (self, f) => make$49((x, y) => self(f(x), f(y))));
321
321
  /**
322
322
  * @category instances
323
323
  * @since 2.0.0
@@ -329,7 +329,7 @@ const Date$1 = /*#__PURE__*/ mapInput$1(number$2, (date) => date.getTime());
329
329
  * @category combinators
330
330
  * @since 2.0.0
331
331
  */
332
- const array$1 = (item) => make$51((self, that) => {
332
+ const array$1 = (item) => make$49((self, that) => {
333
333
  if (self.length !== that.length) return false;
334
334
  for (let i = 0; i < self.length; i++) if (!item(self[i], that[i])) return false;
335
335
  return true;
@@ -1588,19 +1588,19 @@ const StructuralPrototype = {
1588
1588
  }
1589
1589
  };
1590
1590
  /** @internal */
1591
- const CommitPrototype$1 = {
1591
+ const CommitPrototype = {
1592
1592
  ...EffectPrototype$1,
1593
1593
  _op: OP_COMMIT
1594
1594
  };
1595
1595
  /** @internal */
1596
1596
  const StructuralCommitPrototype = {
1597
- ...CommitPrototype$1,
1597
+ ...CommitPrototype,
1598
1598
  ...StructuralPrototype
1599
1599
  };
1600
1600
  /** @internal */
1601
1601
  const Base$1 = /*#__PURE__*/ function() {
1602
1602
  function Base() {}
1603
- Base.prototype = CommitPrototype$1;
1603
+ Base.prototype = CommitPrototype;
1604
1604
  return Base;
1605
1605
  }();
1606
1606
  //#endregion
@@ -1880,7 +1880,7 @@ const match$9 = /*#__PURE__*/ dual(2, (self, { onLeft, onRight }) => isLeft(self
1880
1880
  * @category getters
1881
1881
  * @since 2.0.0
1882
1882
  */
1883
- const merge$5 = /*#__PURE__*/ match$9({
1883
+ const merge$3 = /*#__PURE__*/ match$9({
1884
1884
  onLeft: identity$1,
1885
1885
  onRight: identity$1
1886
1886
  });
@@ -1974,17 +1974,17 @@ const isNonEmptyArray$1 = (self) => self.length > 0;
1974
1974
  * @category constructors
1975
1975
  * @since 2.0.0
1976
1976
  */
1977
- const make$50 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
1977
+ const make$48 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
1978
1978
  /**
1979
1979
  * @category instances
1980
1980
  * @since 2.0.0
1981
1981
  */
1982
- const number = /*#__PURE__*/ make$50((self, that) => self < that ? -1 : 1);
1982
+ const number = /*#__PURE__*/ make$48((self, that) => self < that ? -1 : 1);
1983
1983
  /**
1984
1984
  * @category mapping
1985
1985
  * @since 2.0.0
1986
1986
  */
1987
- const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$50((b1, b2) => self(f(b1), f(b2))));
1987
+ const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$48((b1, b2) => self(f(b1), f(b2))));
1988
1988
  /**
1989
1989
  * Test whether one value is _strictly greater than_ another.
1990
1990
  *
@@ -2632,7 +2632,7 @@ const filter$3 = /*#__PURE__*/ dual(2, (self, predicate) => filterMap$1(self, (b
2632
2632
  * @category Equivalence
2633
2633
  * @since 2.0.0
2634
2634
  */
2635
- const getEquivalence$3 = (isEquivalent) => make$51((x, y) => isNone(x) ? isNone(y) : isNone(y) ? false : isEquivalent(x.value, y.value));
2635
+ const getEquivalence$3 = (isEquivalent) => make$49((x, y) => isNone(x) ? isNone(y) : isNone(y) ? false : isEquivalent(x.value, y.value));
2636
2636
  /**
2637
2637
  * Returns a function that checks if an `Option` contains a specified value,
2638
2638
  * using a provided equivalence function.
@@ -2759,7 +2759,7 @@ const mergeWith$1 = (f) => (o1, o2) => {
2759
2759
  * @category constructors
2760
2760
  * @since 2.0.0
2761
2761
  */
2762
- const make$49 = (...elements) => elements;
2762
+ const make$47 = (...elements) => elements;
2763
2763
  //#endregion
2764
2764
  //#region node_modules/effect/dist/esm/Iterable.js
2765
2765
  const constEmpty = { [Symbol.iterator]() {
@@ -3165,7 +3165,7 @@ const sort = /*#__PURE__*/ dual(2, (self, O) => {
3165
3165
  * @category zipping
3166
3166
  * @since 2.0.0
3167
3167
  */
3168
- const zip$4 = /*#__PURE__*/ dual(2, (self, that) => zipWith$3(self, that, make$49));
3168
+ const zip$4 = /*#__PURE__*/ dual(2, (self, that) => zipWith$2(self, that, make$47));
3169
3169
  /**
3170
3170
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
3171
3171
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
@@ -3182,7 +3182,7 @@ const zip$4 = /*#__PURE__*/ dual(2, (self, that) => zipWith$3(self, that, make$4
3182
3182
  * @category zipping
3183
3183
  * @since 2.0.0
3184
3184
  */
3185
- const zipWith$3 = /*#__PURE__*/ dual(3, (self, that, f) => {
3185
+ const zipWith$2 = /*#__PURE__*/ dual(3, (self, that, f) => {
3186
3186
  const as = fromIterable$6(self);
3187
3187
  const bs = fromIterable$6(that);
3188
3188
  if (isNonEmptyReadonlyArray(as) && isNonEmptyReadonlyArray(bs)) {
@@ -3341,7 +3341,7 @@ const flatMap$8 = /*#__PURE__*/ dual(2, (self, f) => {
3341
3341
  * @category sequencing
3342
3342
  * @since 2.0.0
3343
3343
  */
3344
- const flatten$9 = /*#__PURE__*/ flatMap$8(identity$1);
3344
+ const flatten$8 = /*#__PURE__*/ flatMap$8(identity$1);
3345
3345
  /**
3346
3346
  * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`.
3347
3347
  * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
@@ -3492,7 +3492,7 @@ const emptyArray = [];
3492
3492
  * @category equivalence
3493
3493
  * @since 2.0.0
3494
3494
  */
3495
- const getEquivalence$1 = (isEquivalent) => make$51((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet$2(that, i))));
3495
+ const getEquivalence$1 = (isEquivalent) => make$49((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet$2(that, i))));
3496
3496
  const _equivalence$1 = /*#__PURE__*/ getEquivalence$1(equals$2);
3497
3497
  const ChunkProto = {
3498
3498
  [TypeId$22]: { _A: (_) => _ },
@@ -3581,7 +3581,7 @@ const empty$25 = () => _empty$6;
3581
3581
  * @category constructors
3582
3582
  * @since 2.0.0
3583
3583
  */
3584
- const make$48 = (...as) => unsafeFromNonEmptyArray(as);
3584
+ const make$46 = (...as) => unsafeFromNonEmptyArray(as);
3585
3585
  /**
3586
3586
  * Builds a `NonEmptyChunk` from a single element.
3587
3587
  *
@@ -4028,7 +4028,7 @@ function fromBitmap(bitmap, bit) {
4028
4028
  }
4029
4029
  //#endregion
4030
4030
  //#region node_modules/effect/dist/esm/internal/stack.js
4031
- const make$47 = (value, previous) => ({
4031
+ const make$45 = (value, previous) => ({
4032
4032
  value,
4033
4033
  previous
4034
4034
  });
@@ -4297,7 +4297,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
4297
4297
  while (true) {
4298
4298
  const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
4299
4299
  if (typeof res === "function") {
4300
- stack = make$47(res, stack);
4300
+ stack = make$45(res, stack);
4301
4301
  currentShift = currentShift + 5;
4302
4302
  } else {
4303
4303
  let final = res;
@@ -4574,7 +4574,7 @@ const fromIterable$3 = (elements) => {
4574
4574
  return endMutation(set);
4575
4575
  };
4576
4576
  /** @internal */
4577
- const make$46 = (...elements) => {
4577
+ const make$44 = (...elements) => {
4578
4578
  const set = beginMutation(empty$23());
4579
4579
  for (const value of elements) add$3(set, value);
4580
4580
  return endMutation(set);
@@ -5077,7 +5077,7 @@ const fromIterable$2 = fromIterable$3;
5077
5077
  *
5078
5078
  * @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
5079
5079
  */
5080
- const make$45 = make$46;
5080
+ const make$43 = make$44;
5081
5081
  /**
5082
5082
  * Checks if the specified value exists in the `HashSet`.
5083
5083
  *
@@ -5561,17 +5561,17 @@ const evaluateCause = (self) => {
5561
5561
  cause = stack.pop();
5562
5562
  break;
5563
5563
  case OP_FAIL$2:
5564
- _parallel = add$2(_parallel, make$48(cause._tag, cause.error));
5564
+ _parallel = add$2(_parallel, make$46(cause._tag, cause.error));
5565
5565
  if (stack.length === 0) return [_parallel, _sequential];
5566
5566
  cause = stack.pop();
5567
5567
  break;
5568
5568
  case "Die":
5569
- _parallel = add$2(_parallel, make$48(cause._tag, cause.defect));
5569
+ _parallel = add$2(_parallel, make$46(cause._tag, cause.defect));
5570
5570
  if (stack.length === 0) return [_parallel, _sequential];
5571
5571
  cause = stack.pop();
5572
5572
  break;
5573
5573
  case OP_INTERRUPT:
5574
- _parallel = add$2(_parallel, make$48(cause._tag, cause.fiberId));
5574
+ _parallel = add$2(_parallel, make$46(cause._tag, cause.fiberId));
5575
5575
  if (stack.length === 0) return [_parallel, _sequential];
5576
5576
  cause = stack.pop();
5577
5577
  break;
@@ -5850,7 +5850,7 @@ const TagProto = {
5850
5850
  return self;
5851
5851
  },
5852
5852
  context(self) {
5853
- return make$44(this, self);
5853
+ return make$42(this, self);
5854
5854
  }
5855
5855
  };
5856
5856
  const ReferenceProto = {
@@ -5964,7 +5964,7 @@ const _empty$3 = /*#__PURE__*/ makeContext(/*#__PURE__*/ new Map());
5964
5964
  /** @internal */
5965
5965
  const empty$20 = () => _empty$3;
5966
5966
  /** @internal */
5967
- const make$44 = (tag, service) => makeContext(/* @__PURE__ */ new Map([[tag.key, service]]));
5967
+ const make$42 = (tag, service) => makeContext(/* @__PURE__ */ new Map([[tag.key, service]]));
5968
5968
  /** @internal */
5969
5969
  const add$1 = /*#__PURE__*/ dual(3, (self, tag, service) => {
5970
5970
  const map = new Map(self.unsafeMap);
@@ -5998,7 +5998,7 @@ const getOption$1 = /*#__PURE__*/ dual(2, (self, tag) => {
5998
5998
  return some$1(self.unsafeMap.get(tag.key));
5999
5999
  });
6000
6000
  /** @internal */
6001
- const merge$4 = /*#__PURE__*/ dual(2, (self, that) => {
6001
+ const merge$2 = /*#__PURE__*/ dual(2, (self, that) => {
6002
6002
  const map = new Map(self.unsafeMap);
6003
6003
  for (const [tag, s] of that.unsafeMap) map.set(tag, s);
6004
6004
  return makeContext(map);
@@ -6097,7 +6097,7 @@ const empty$19 = empty$20;
6097
6097
  * @since 2.0.0
6098
6098
  * @category constructors
6099
6099
  */
6100
- const make$43 = make$44;
6100
+ const make$41 = make$42;
6101
6101
  /**
6102
6102
  * Adds a service to a given `Context`.
6103
6103
  *
@@ -6214,7 +6214,7 @@ const getOption = getOption$1;
6214
6214
  *
6215
6215
  * @since 2.0.0
6216
6216
  */
6217
- const merge$3 = merge$4;
6217
+ const merge$1 = merge$2;
6218
6218
  /**
6219
6219
  * Merges any number of `Context`s, returning a new `Context` containing the services of all.
6220
6220
  *
@@ -6412,7 +6412,7 @@ const DurationProto = {
6412
6412
  return pipeArguments(this, arguments);
6413
6413
  }
6414
6414
  };
6415
- const make$42 = (input) => {
6415
+ const make$40 = (input) => {
6416
6416
  const duration = Object.create(DurationProto);
6417
6417
  if (isNumber(input)) if (isNaN(input) || input <= 0) duration.value = zeroValue;
6418
6418
  else if (!Number.isFinite(input)) duration.value = infinityValue;
@@ -6456,52 +6456,52 @@ const isZero$1 = (self) => {
6456
6456
  * @since 2.0.0
6457
6457
  * @category constructors
6458
6458
  */
6459
- const zero$1 = /*#__PURE__*/ make$42(0);
6459
+ const zero$1 = /*#__PURE__*/ make$40(0);
6460
6460
  /**
6461
6461
  * @since 2.0.0
6462
6462
  * @category constructors
6463
6463
  */
6464
- const infinity = /*#__PURE__*/ make$42(Infinity);
6464
+ const infinity = /*#__PURE__*/ make$40(Infinity);
6465
6465
  /**
6466
6466
  * @since 2.0.0
6467
6467
  * @category constructors
6468
6468
  */
6469
- const nanos = (nanos) => make$42(nanos);
6469
+ const nanos = (nanos) => make$40(nanos);
6470
6470
  /**
6471
6471
  * @since 2.0.0
6472
6472
  * @category constructors
6473
6473
  */
6474
- const micros = (micros) => make$42(micros * bigint1e3);
6474
+ const micros = (micros) => make$40(micros * bigint1e3);
6475
6475
  /**
6476
6476
  * @since 2.0.0
6477
6477
  * @category constructors
6478
6478
  */
6479
- const millis = (millis) => make$42(millis);
6479
+ const millis = (millis) => make$40(millis);
6480
6480
  /**
6481
6481
  * @since 2.0.0
6482
6482
  * @category constructors
6483
6483
  */
6484
- const seconds = (seconds) => make$42(seconds * 1e3);
6484
+ const seconds = (seconds) => make$40(seconds * 1e3);
6485
6485
  /**
6486
6486
  * @since 2.0.0
6487
6487
  * @category constructors
6488
6488
  */
6489
- const minutes = (minutes) => make$42(minutes * 6e4);
6489
+ const minutes = (minutes) => make$40(minutes * 6e4);
6490
6490
  /**
6491
6491
  * @since 2.0.0
6492
6492
  * @category constructors
6493
6493
  */
6494
- const hours = (hours) => make$42(hours * 36e5);
6494
+ const hours = (hours) => make$40(hours * 36e5);
6495
6495
  /**
6496
6496
  * @since 2.0.0
6497
6497
  * @category constructors
6498
6498
  */
6499
- const days = (days) => make$42(days * 864e5);
6499
+ const days = (days) => make$40(days * 864e5);
6500
6500
  /**
6501
6501
  * @since 2.0.0
6502
6502
  * @category constructors
6503
6503
  */
6504
- const weeks = (weeks) => make$42(weeks * 6048e5);
6504
+ const weeks = (weeks) => make$40(weeks * 6048e5);
6505
6505
  /**
6506
6506
  * @since 2.0.0
6507
6507
  * @category getters
@@ -6594,8 +6594,8 @@ const Equivalence$3 = (self, that) => matchWith(self, that, {
6594
6594
  * @category math
6595
6595
  */
6596
6596
  const sum = /*#__PURE__*/ dual(2, (self, that) => matchWith(self, that, {
6597
- onMillis: (self, that) => make$42(self + that),
6598
- onNanos: (self, that) => make$42(self + that)
6597
+ onMillis: (self, that) => make$40(self + that),
6598
+ onNanos: (self, that) => make$40(self + that)
6599
6599
  }));
6600
6600
  /**
6601
6601
  * @since 2.0.0
@@ -6704,7 +6704,7 @@ const MutableRefProto = {
6704
6704
  * @since 2.0.0
6705
6705
  * @category constructors
6706
6706
  */
6707
- const make$41 = (value) => {
6707
+ const make$39 = (value) => {
6708
6708
  const ref = Object.create(MutableRefProto);
6709
6709
  ref.current = value;
6710
6710
  return ref;
@@ -6860,13 +6860,13 @@ const combineAll$1 = (fiberIds) => {
6860
6860
  const ids$1 = (self) => {
6861
6861
  switch (self._tag) {
6862
6862
  case OP_NONE: return empty$22();
6863
- case OP_RUNTIME: return make$45(self.id);
6863
+ case OP_RUNTIME: return make$43(self.id);
6864
6864
  case OP_COMPOSITE: return pipe(ids$1(self.left), union(ids$1(self.right)));
6865
6865
  }
6866
6866
  };
6867
- const _fiberCounter = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$41(0));
6867
+ const _fiberCounter = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$39(0));
6868
6868
  /** @internal */
6869
- const make$40 = (id, startTimeSeconds) => {
6869
+ const make$38 = (id, startTimeSeconds) => {
6870
6870
  return new Runtime(id, startTimeSeconds);
6871
6871
  };
6872
6872
  /** @internal */
@@ -6931,7 +6931,7 @@ const ids = ids$1;
6931
6931
  * @since 2.0.0
6932
6932
  * @category constructors
6933
6933
  */
6934
- const make$39 = make$40;
6934
+ const make$37 = make$38;
6935
6935
  /**
6936
6936
  * Creates a string representing the name of the current thread of execution
6937
6937
  * represented by the specified `FiberId`.
@@ -7601,7 +7601,7 @@ const DifferProto = {
7601
7601
  }
7602
7602
  };
7603
7603
  /** @internal */
7604
- const make$38 = (params) => {
7604
+ const make$36 = (params) => {
7605
7605
  const differ = Object.create(DifferProto);
7606
7606
  differ.empty = params.empty;
7607
7607
  differ.diff = params.diff;
@@ -7610,21 +7610,21 @@ const make$38 = (params) => {
7610
7610
  return differ;
7611
7611
  };
7612
7612
  /** @internal */
7613
- const environment = () => make$38({
7613
+ const environment = () => make$36({
7614
7614
  empty: empty$16(),
7615
7615
  combine: (first, second) => combine$4(second)(first),
7616
7616
  diff: (oldValue, newValue) => diff$6(oldValue, newValue),
7617
7617
  patch: (patch, oldValue) => patch$7(oldValue)(patch)
7618
7618
  });
7619
7619
  /** @internal */
7620
- const hashSet = () => make$38({
7620
+ const hashSet = () => make$36({
7621
7621
  empty: empty$15(),
7622
7622
  combine: (first, second) => combine$3(second)(first),
7623
7623
  diff: (oldValue, newValue) => diff$5(oldValue, newValue),
7624
7624
  patch: (patch, oldValue) => patch$6(oldValue)(patch)
7625
7625
  });
7626
7626
  /** @internal */
7627
- const readonlyArray = (differ) => make$38({
7627
+ const readonlyArray = (differ) => make$36({
7628
7628
  empty: empty$14(),
7629
7629
  combine: (first, second) => combine$2(first, second),
7630
7630
  diff: (oldValue, newValue) => diff$4({
@@ -7637,7 +7637,7 @@ const readonlyArray = (differ) => make$38({
7637
7637
  /** @internal */
7638
7638
  const update$3 = () => updateWith((_, a) => a);
7639
7639
  /** @internal */
7640
- const updateWith = (f) => make$38({
7640
+ const updateWith = (f) => make$36({
7641
7641
  empty: identity$1,
7642
7642
  combine: (first, second) => {
7643
7643
  if (first === identity$1) return second;
@@ -7661,15 +7661,15 @@ const active = (patch) => patch & BIT_MASK;
7661
7661
  /** @internal */
7662
7662
  const enabled = (patch) => patch >> BIT_SHIFT & BIT_MASK;
7663
7663
  /** @internal */
7664
- const make$37 = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
7664
+ const make$35 = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
7665
7665
  /** @internal */
7666
- const empty$13 = /*#__PURE__*/ make$37(0, 0);
7666
+ const empty$13 = /*#__PURE__*/ make$35(0, 0);
7667
7667
  /** @internal */
7668
- const enable$2 = (flag) => make$37(flag, flag);
7668
+ const enable$2 = (flag) => make$35(flag, flag);
7669
7669
  /** @internal */
7670
- const disable$3 = (flag) => make$37(flag, 0);
7670
+ const disable$3 = (flag) => make$35(flag, 0);
7671
7671
  /** @internal */
7672
- const exclude$1 = /*#__PURE__*/ dual(2, (self, flag) => make$37(active(self) & ~flag, enabled(self)));
7672
+ const exclude$1 = /*#__PURE__*/ dual(2, (self, flag) => make$35(active(self) & ~flag, enabled(self)));
7673
7673
  /** @internal */
7674
7674
  const andThen$2 = /*#__PURE__*/ dual(2, (self, that) => self | that);
7675
7675
  /** @internal */
@@ -7687,18 +7687,18 @@ const interruption = (self) => isEnabled(self, 1);
7687
7687
  /** @internal */
7688
7688
  const isEnabled = /*#__PURE__*/ dual(2, (self, flag) => (self & flag) !== 0);
7689
7689
  /** @internal */
7690
- const make$36 = (...flags) => flags.reduce((a, b) => a | b, 0);
7690
+ const make$34 = (...flags) => flags.reduce((a, b) => a | b, 0);
7691
7691
  /** @internal */
7692
- const none$1 = /*#__PURE__*/ make$36(0);
7692
+ const none$1 = /*#__PURE__*/ make$34(0);
7693
7693
  /** @internal */
7694
7694
  const runtimeMetrics = (self) => isEnabled(self, 4);
7695
7695
  const windDown = (self) => isEnabled(self, 16);
7696
7696
  /** @internal */
7697
- const diff$3 = /*#__PURE__*/ dual(2, (self, that) => make$37(self ^ that, that));
7697
+ const diff$3 = /*#__PURE__*/ dual(2, (self, that) => make$35(self ^ that, that));
7698
7698
  /** @internal */
7699
7699
  const patch$4 = /*#__PURE__*/ dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
7700
7700
  /** @internal */
7701
- const differ$1 = /*#__PURE__*/ make$38({
7701
+ const differ$1 = /*#__PURE__*/ make$36({
7702
7702
  empty: empty$13,
7703
7703
  diff: (oldValue, newValue) => diff$3(oldValue, newValue),
7704
7704
  combine: (first, second) => andThen$2(second)(first),
@@ -7758,7 +7758,7 @@ const seq = (self, that) => ({
7758
7758
  *
7759
7759
  * @internal
7760
7760
  */
7761
- const flatten$8 = (self) => {
7761
+ const flatten$7 = (self) => {
7762
7762
  let current = of(self);
7763
7763
  let updated = empty$17();
7764
7764
  while (1) {
@@ -7766,7 +7766,7 @@ const flatten$8 = (self) => {
7766
7766
  const [par, seq] = step$1(blockedRequest);
7767
7767
  return [parallelCollectionCombine(parallel, par), appendAll(sequential, seq)];
7768
7768
  });
7769
- updated = merge$2(updated, parallel);
7769
+ updated = merge(updated, parallel);
7770
7770
  if (isNil(sequential)) return reverse(updated);
7771
7771
  current = sequential;
7772
7772
  }
@@ -7834,7 +7834,7 @@ const step$1 = (requests) => {
7834
7834
  * are both from the same single data source then the requests can be
7835
7835
  * pipelined while preserving ordering guarantees.
7836
7836
  */
7837
- const merge$2 = (sequential, parallel) => {
7837
+ const merge = (sequential, parallel) => {
7838
7838
  if (isNil(sequential)) return of(parallelCollectionToSequentialCollection(parallel));
7839
7839
  if (parallelCollectionIsEmpty(parallel)) return sequential;
7840
7840
  const seqHeadKeys = sequentialCollectionKeys(sequential.head);
@@ -8251,7 +8251,7 @@ const step = (self) => {
8251
8251
  effect.effect_instruction_i0 = self;
8252
8252
  return effect;
8253
8253
  };
8254
- const flatten$7 = (self) => flatMap$6(self, identity$1);
8254
+ const flatten$6 = (self) => flatMap$6(self, identity$1);
8255
8255
  const matchCause$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$2(self, {
8256
8256
  onFailure: (cause) => succeed$8(options.onFailure(cause)),
8257
8257
  onSuccess: (a) => succeed$8(options.onSuccess(a))
@@ -8440,7 +8440,7 @@ const yieldNow$2 = (options) => {
8440
8440
  const zip$3 = /*#__PURE__*/ dual(2, (self, that) => flatMap$6(self, (a) => map$8(that, (b) => [a, b])));
8441
8441
  const zipLeft$1 = /*#__PURE__*/ dual(2, (self, that) => flatMap$6(self, (a) => as$1(that, a)));
8442
8442
  const zipRight$3 = /*#__PURE__*/ dual(2, (self, that) => flatMap$6(self, () => that));
8443
- const zipWith$2 = /*#__PURE__*/ dual(3, (self, that, f) => flatMap$6(self, (a) => map$8(that, (b) => f(a, b))));
8443
+ const zipWith$1 = /*#__PURE__*/ dual(3, (self, that, f) => flatMap$6(self, (a) => map$8(that, (b) => f(a, b))));
8444
8444
  const interruptFiber = (self) => flatMap$6(fiberId, (fiberId) => pipe(self, interruptAsFiber(fiberId)));
8445
8445
  const interruptAsFiber = /*#__PURE__*/ dual(2, (self, fiberId) => flatMap$6(self.interruptAsFork(fiberId), () => self.await));
8446
8446
  /** @internal */
@@ -8571,7 +8571,7 @@ const fiberRefUnsafeMakeContext = (initial) => {
8571
8571
  /** @internal */
8572
8572
  const fiberRefUnsafeMakePatch = (initial, options) => {
8573
8573
  return {
8574
- ...CommitPrototype$1,
8574
+ ...CommitPrototype,
8575
8575
  [FiberRefTypeId]: fiberRefVariance,
8576
8576
  initial,
8577
8577
  commit() {
@@ -8750,15 +8750,6 @@ const exitFailCause$1 = (cause) => {
8750
8750
  return effect;
8751
8751
  };
8752
8752
  /** @internal */
8753
- const exitFlatMap = /*#__PURE__*/ dual(2, (self, f) => {
8754
- switch (self._tag) {
8755
- case OP_FAILURE: return exitFailCause$1(self.effect_instruction_i0);
8756
- case OP_SUCCESS: return f(self.effect_instruction_i0);
8757
- }
8758
- });
8759
- /** @internal */
8760
- const exitFlatten = (self) => pipe(self, exitFlatMap(identity$1));
8761
- /** @internal */
8762
8753
  const exitInterrupt$1 = (fiberId) => exitFailCause$1(interrupt$5(fiberId));
8763
8754
  /** @internal */
8764
8755
  const exitMap = /*#__PURE__*/ dual(2, (self, f) => {
@@ -8830,9 +8821,9 @@ const exitCollectAllInternal = (exits, combineCauses) => {
8830
8821
  /** @internal */
8831
8822
  const deferredUnsafeMake = (fiberId) => {
8832
8823
  return {
8833
- ...CommitPrototype$1,
8824
+ ...CommitPrototype,
8834
8825
  [DeferredTypeId$1]: deferredVariance,
8835
- state: make$41(pending([])),
8826
+ state: make$39(pending([])),
8836
8827
  commit() {
8837
8828
  return deferredAwait(this);
8838
8829
  },
@@ -8887,7 +8878,7 @@ const constContext = /*#__PURE__*/ withFiberRuntime$1((fiber) => exitSucceed$1(f
8887
8878
  const context$1 = () => constContext;
8888
8879
  const contextWithEffect = (f) => flatMap$6(context$1(), f);
8889
8880
  const provideContext$1 = /*#__PURE__*/ dual(2, (self, context) => fiberRefLocally(currentContext$1, context)(self));
8890
- const provideSomeContext = /*#__PURE__*/ dual(2, (self, context) => fiberRefLocallyWith(currentContext$1, (parent) => merge$3(parent, context))(self));
8881
+ const provideSomeContext = /*#__PURE__*/ dual(2, (self, context) => fiberRefLocallyWith(currentContext$1, (parent) => merge$1(parent, context))(self));
8891
8882
  const mapInputContext = /*#__PURE__*/ dual(2, (self, f) => contextWithEffect((context) => provideContext$1(self, f(context))));
8892
8883
  /** @internal */
8893
8884
  const currentSpanFromFiber = (fiber) => {
@@ -9202,7 +9193,7 @@ const DeferredTypeId = DeferredTypeId$1;
9202
9193
  * @since 2.0.0
9203
9194
  * @category constructors
9204
9195
  */
9205
- const make$35 = deferredMake;
9196
+ const make$33 = deferredMake;
9206
9197
  const _await$2 = deferredAwait;
9207
9198
  /**
9208
9199
  * Completes the deferred with the result of the specified effect. If the
@@ -9320,7 +9311,7 @@ var ClockImpl = class {
9320
9311
  }
9321
9312
  };
9322
9313
  /** @internal */
9323
- const make$34 = () => new ClockImpl();
9314
+ const make$32 = () => new ClockImpl();
9324
9315
  //#endregion
9325
9316
  //#region node_modules/effect/dist/esm/Number.js
9326
9317
  /**
@@ -9543,7 +9534,7 @@ const OP_SEQUENCE = "Sequence";
9543
9534
  /** @internal */
9544
9535
  const OP_HASHMAP = "HashMap";
9545
9536
  /** @internal */
9546
- const OP_ZIP_WITH$1 = "ZipWith";
9537
+ const OP_ZIP_WITH = "ZipWith";
9547
9538
  //#endregion
9548
9539
  //#region node_modules/effect/dist/esm/internal/configProvider.js
9549
9540
  const concat = (l, r) => [...l, ...r];
@@ -9554,7 +9545,7 @@ const configProviderTag = /*#__PURE__*/ GenericTag("effect/ConfigProvider");
9554
9545
  /** @internal */
9555
9546
  const FlatConfigProviderTypeId = /*#__PURE__*/ Symbol.for("effect/ConfigProviderFlat");
9556
9547
  /** @internal */
9557
- const make$33 = (options) => ({
9548
+ const make$31 = (options) => ({
9558
9549
  [ConfigProviderTypeId]: ConfigProviderTypeId,
9559
9550
  pipe() {
9560
9551
  return pipeArguments(this, arguments);
@@ -9569,7 +9560,7 @@ const makeFlat = (options) => ({
9569
9560
  enumerateChildren: options.enumerateChildren
9570
9561
  });
9571
9562
  /** @internal */
9572
- const fromFlat = (flat) => make$33({
9563
+ const fromFlat = (flat) => make$31({
9573
9564
  load: (config) => flatMap$6(fromFlatLoop(flat, empty$26(), config, false), (chunk) => match$8(head$2(chunk), {
9574
9565
  onNone: () => fail$12(MissingData(empty$26(), `Expected a single value having structure: ${config}`)),
9575
9566
  onSome: succeed$8
@@ -9648,7 +9639,7 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9648
9639
  case OP_SEQUENCE: return pipe(patch$3(prefix, flat.patch), flatMap$6((patchedPrefix) => pipe(flat.enumerateChildren(patchedPrefix), flatMap$6(indicesFrom), flatMap$6((indices) => {
9649
9640
  if (indices.length === 0) return suspend$7(() => map$8(fromFlatLoop(flat, prefix, op.config, true), of$2));
9650
9641
  return pipe(forEachSequential(indices, (index) => fromFlatLoop(flat, append$2(prefix, `[${index}]`), op.config, true)), map$8((chunkChunk) => {
9651
- const flattened = flatten$9(chunkChunk);
9642
+ const flattened = flatten$8(chunkChunk);
9652
9643
  if (flattened.length === 0) return of$2(empty$26());
9653
9644
  return of$2(flattened);
9654
9645
  }));
@@ -9659,7 +9650,7 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9659
9650
  return pipe(transpose(matrix), map$13((values) => fromIterable$1(zip$4(fromIterable$6(keys), values))));
9660
9651
  }));
9661
9652
  })))));
9662
- case OP_ZIP_WITH$1: return suspend$7(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either$1, flatMap$6((left) => pipe(fromFlatLoop(flat, prefix, op.right, split), either$1, flatMap$6((right$9) => {
9653
+ case OP_ZIP_WITH: return suspend$7(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either$1, flatMap$6((left) => pipe(fromFlatLoop(flat, prefix, op.right, split), either$1, flatMap$6((right$9) => {
9663
9654
  if (isLeft(left) && isLeft(right$9)) return fail$12(And(left.left, right$9.left));
9664
9655
  if (isLeft(left) && isRight(right$9)) return fail$12(left.left);
9665
9656
  if (isRight(left) && isLeft(right$9)) return fail$12(right$9.left);
@@ -9690,7 +9681,7 @@ const transpose = (array) => {
9690
9681
  const indicesFrom = (quotedIndices) => pipe(forEachSequential(quotedIndices, parseQuotedIndex), mapBoth$3({
9691
9682
  onFailure: () => empty$26(),
9692
9683
  onSuccess: sort(Order$1)
9693
- }), either$1, map$8(merge$5));
9684
+ }), either$1, map$8(merge$3));
9694
9685
  const QUOTED_INDEX_REGEX = /^(\[(\d+)\])$/;
9695
9686
  const parseQuotedIndex = (str) => {
9696
9687
  const match = str.match(QUOTED_INDEX_REGEX);
@@ -9840,7 +9831,7 @@ const swap = (buffer, index1, index2) => {
9840
9831
  buffer[index2] = tmp;
9841
9832
  return buffer;
9842
9833
  };
9843
- const make$32 = (seed) => new RandomImpl(hash(seed));
9834
+ const make$30 = (seed) => new RandomImpl(hash(seed));
9844
9835
  //#endregion
9845
9836
  //#region node_modules/effect/dist/esm/internal/tracer.js
9846
9837
  /**
@@ -9849,7 +9840,7 @@ const make$32 = (seed) => new RandomImpl(hash(seed));
9849
9840
  /** @internal */
9850
9841
  const TracerTypeId = /*#__PURE__*/ Symbol.for("effect/Tracer");
9851
9842
  /** @internal */
9852
- const make$31 = (options) => ({
9843
+ const make$29 = (options) => ({
9853
9844
  [TracerTypeId]: TracerTypeId,
9854
9845
  ...options
9855
9846
  });
@@ -9921,7 +9912,7 @@ var NativeSpan = class {
9921
9912
  //#endregion
9922
9913
  //#region node_modules/effect/dist/esm/internal/defaultServices.js
9923
9914
  /** @internal */
9924
- const liveServices = /*#__PURE__*/ pipe(/*#__PURE__*/ empty$19(), /*#__PURE__*/ add(clockTag, /*#__PURE__*/ make$34()), /*#__PURE__*/ add(consoleTag, defaultConsole), /*#__PURE__*/ add(randomTag, /*#__PURE__*/ make$32(/*#__PURE__*/ Math.random())), /*#__PURE__*/ add(configProviderTag, /*#__PURE__*/ fromEnv()), /*#__PURE__*/ add(tracerTag, /* @__PURE__ */ make$31({
9915
+ const liveServices = /*#__PURE__*/ pipe(/*#__PURE__*/ empty$19(), /*#__PURE__*/ add(clockTag, /*#__PURE__*/ make$32()), /*#__PURE__*/ add(consoleTag, defaultConsole), /*#__PURE__*/ add(randomTag, /*#__PURE__*/ make$30(/*#__PURE__*/ Math.random())), /*#__PURE__*/ add(configProviderTag, /*#__PURE__*/ fromEnv()), /*#__PURE__*/ add(tracerTag, /* @__PURE__ */ make$29({
9925
9916
  span: (name, parent, context, links, startTime, kind) => new NativeSpan(name, parent, context, links, startTime, kind),
9926
9917
  context: (f) => f()
9927
9918
  })));
@@ -9968,11 +9959,6 @@ const not = (self) => !self;
9968
9959
  * @category prototypes
9969
9960
  */
9970
9961
  const EffectPrototype = EffectPrototype$1;
9971
- /**
9972
- * @since 2.0.0
9973
- * @category prototypes
9974
- */
9975
- const CommitPrototype = CommitPrototype$1;
9976
9962
  const Base = Base$1;
9977
9963
  /**
9978
9964
  * @since 2.0.0
@@ -10942,7 +10928,7 @@ const updateContext$2 = /*#__PURE__*/ dual(2, (self, f) => withMicroFiber((fiber
10942
10928
  * @experimental
10943
10929
  * @category environment
10944
10930
  */
10945
- const provideContext = /*#__PURE__*/ dual(2, (self, provided) => updateContext$2(self, merge$3(provided)));
10931
+ const provideContext = /*#__PURE__*/ dual(2, (self, provided) => updateContext$2(self, merge$1(provided)));
10946
10932
  /**
10947
10933
  * @since 3.11.0
10948
10934
  * @experimental
@@ -11159,9 +11145,9 @@ var RefImpl = class extends Class {
11159
11145
  }
11160
11146
  };
11161
11147
  /** @internal */
11162
- const unsafeMake$6 = (value) => new RefImpl(make$41(value));
11148
+ const unsafeMake$6 = (value) => new RefImpl(make$39(value));
11163
11149
  /** @internal */
11164
- const make$30 = (value) => sync$2(() => unsafeMake$6(value));
11150
+ const make$28 = (value) => sync$2(() => unsafeMake$6(value));
11165
11151
  /** @internal */
11166
11152
  const get$4 = (self) => self.get;
11167
11153
  /** @internal */
@@ -11176,7 +11162,7 @@ const update$2 = /*#__PURE__*/ dual(2, (self, f) => self.modify((a) => [void 0,
11176
11162
  * @since 2.0.0
11177
11163
  * @category constructors
11178
11164
  */
11179
- const make$29 = make$30;
11165
+ const make$27 = make$28;
11180
11166
  /**
11181
11167
  * @since 2.0.0
11182
11168
  * @category getters
@@ -11392,7 +11378,7 @@ var MetricLabelImpl = class {
11392
11378
  }
11393
11379
  };
11394
11380
  /** @internal */
11395
- const make$28 = (key, value) => {
11381
+ const make$26 = (key, value) => {
11396
11382
  return new MetricLabelImpl(key, value);
11397
11383
  };
11398
11384
  /** @internal */
@@ -11581,11 +11567,6 @@ const fail$8 = exitFail;
11581
11567
  */
11582
11568
  const failCause$3 = exitFailCause$1;
11583
11569
  /**
11584
- * @since 2.0.0
11585
- * @category sequencing
11586
- */
11587
- const flatten$6 = exitFlatten;
11588
- /**
11589
11570
  * Maps over the `Success` value of the specified exit using the provided
11590
11571
  * function.
11591
11572
  *
@@ -11734,8 +11715,8 @@ const interruptAllAs$1 = /*#__PURE__*/ dual(2, /*#__PURE__*/ fnUntraced$1(functi
11734
11715
  }
11735
11716
  }));
11736
11717
  /** @internal */
11737
- const join$3 = (self) => zipLeft$1(flatten$7(self.await), self.inheritAll);
11738
- ({ ...CommitPrototype$1 }), { ...fiberProto };
11718
+ const join$3 = (self) => zipLeft$1(flatten$6(self.await), self.inheritAll);
11719
+ ({ ...CommitPrototype }), { ...fiberProto };
11739
11720
  /** @internal */
11740
11721
  const currentFiberURI = "effect/FiberCurrent";
11741
11722
  /** @internal */
@@ -12380,7 +12361,7 @@ const metricHookVariance = {
12380
12361
  _Out: (_) => _
12381
12362
  };
12382
12363
  /** @internal */
12383
- const make$27 = (options) => ({
12364
+ const make$25 = (options) => ({
12384
12365
  [MetricHookTypeId]: metricHookVariance,
12385
12366
  pipe() {
12386
12367
  return pipeArguments(this, arguments);
@@ -12395,7 +12376,7 @@ const counter$1 = (key) => {
12395
12376
  const update = (value) => {
12396
12377
  if (canUpdate(value)) sum = sum + value;
12397
12378
  };
12398
- return make$27({
12379
+ return make$25({
12399
12380
  get: () => counter$2(sum),
12400
12381
  update,
12401
12382
  modify: update
@@ -12409,7 +12390,7 @@ const frequency = (key) => {
12409
12390
  const slotCount = values.get(word) ?? 0;
12410
12391
  values.set(word, slotCount + 1);
12411
12392
  };
12412
- return make$27({
12393
+ return make$25({
12413
12394
  get: () => frequency$1(values),
12414
12395
  update,
12415
12396
  modify: update
@@ -12418,7 +12399,7 @@ const frequency = (key) => {
12418
12399
  /** @internal */
12419
12400
  const gauge = (_key, startAt) => {
12420
12401
  let value = startAt;
12421
- return make$27({
12402
+ return make$25({
12422
12403
  get: () => gauge$1(value),
12423
12404
  update: (v) => {
12424
12405
  value = v;
@@ -12468,7 +12449,7 @@ const histogram$1 = (key) => {
12468
12449
  }
12469
12450
  return builder;
12470
12451
  };
12471
- return make$27({
12452
+ return make$25({
12472
12453
  get: () => histogram$2({
12473
12454
  buckets: getBuckets(),
12474
12455
  count,
@@ -12515,7 +12496,7 @@ const summary = (key) => {
12515
12496
  count = count + 1;
12516
12497
  sum = sum + value;
12517
12498
  };
12518
- return make$27({
12499
+ return make$25({
12519
12500
  get: () => summary$1({
12520
12501
  error,
12521
12502
  quantiles: snapshot(Date.now()),
@@ -12724,7 +12705,7 @@ var MetricRegistryImpl = class {
12724
12705
  }
12725
12706
  };
12726
12707
  /** @internal */
12727
- const make$26 = () => {
12708
+ const make$24 = () => {
12728
12709
  return new MetricRegistryImpl();
12729
12710
  };
12730
12711
  /** @internal */
@@ -12738,9 +12719,9 @@ const metricVariance = {
12738
12719
  _Out: (_) => _
12739
12720
  };
12740
12721
  /** @internal */
12741
- const globalMetricRegistry = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/Metric/globalMetricRegistry"), () => make$26());
12722
+ const globalMetricRegistry = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/Metric/globalMetricRegistry"), () => make$24());
12742
12723
  /** @internal */
12743
- const make$25 = function(keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12724
+ const make$23 = function(keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12744
12725
  const metric = Object.assign((effect) => tap$1(effect, (a) => update(metric, a)), {
12745
12726
  [MetricTypeId]: metricVariance,
12746
12727
  keyType,
@@ -12775,15 +12756,15 @@ const fromMetricKey = (key) => {
12775
12756
  hookCache.set(extraTags, hook);
12776
12757
  return hook;
12777
12758
  };
12778
- return make$25(key.keyType, (input, extraTags) => hook(extraTags).update(input), (extraTags) => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
12759
+ return make$23(key.keyType, (input, extraTags) => hook(extraTags).update(input), (extraTags) => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
12779
12760
  };
12780
12761
  /** @internal */
12781
12762
  const histogram = (name, boundaries, description) => fromMetricKey(histogram$3(name, boundaries, description));
12782
12763
  /** @internal */
12783
- const tagged$1 = /*#__PURE__*/ dual(3, (self, key, value) => taggedWithLabels(self, [make$28(key, value)]));
12764
+ const tagged$1 = /*#__PURE__*/ dual(3, (self, key, value) => taggedWithLabels(self, [make$26(key, value)]));
12784
12765
  /** @internal */
12785
12766
  const taggedWithLabels = /*#__PURE__*/ dual(2, (self, extraTags) => {
12786
- return make$25(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), (extraTags1) => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
12767
+ return make$23(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), (extraTags1) => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
12787
12768
  });
12788
12769
  const update = /*#__PURE__*/ dual(2, (self, input) => fiberRefGetWith(currentMetricLabels, (tags) => sync$2(() => self.unsafeUpdate(input, tags))));
12789
12770
  ({ ...StructuralPrototype });
@@ -12918,7 +12899,7 @@ const none = /*#__PURE__*/ globalValue("effect/Supervisor/none", () => fromEffec
12918
12899
  * @since 2.0.0
12919
12900
  * @category constructors
12920
12901
  */
12921
- const make$24 = make$38;
12902
+ const make$22 = make$36;
12922
12903
  //#endregion
12923
12904
  //#region node_modules/effect/dist/esm/internal/supervisor/patch.js
12924
12905
  /** @internal */
@@ -12991,7 +12972,7 @@ const removeSupervisor = (self, that) => {
12991
12972
  const toSet = (self) => {
12992
12973
  if (equals$2(self, none)) return empty$22();
12993
12974
  else if (isZip(self)) return pipe(toSet(self.left), union(toSet(self.right)));
12994
- else return make$45(self);
12975
+ else return make$43(self);
12995
12976
  };
12996
12977
  /** @internal */
12997
12978
  const diff = (oldValue, newValue) => {
@@ -13009,7 +12990,7 @@ const diff = (oldValue, newValue) => {
13009
12990
  return combine(added, removed);
13010
12991
  };
13011
12992
  /** @internal */
13012
- const differ = /*#__PURE__*/ make$24({
12993
+ const differ = /*#__PURE__*/ make$22({
13013
12994
  empty: empty$6,
13014
12995
  patch,
13015
12996
  combine,
@@ -13102,7 +13083,7 @@ const drainQueueWhileRunningTable = {
13102
13083
  /**
13103
13084
  * Executes all requests, submitting requests to each data source in parallel.
13104
13085
  */
13105
- const runBlockedRequests = (self) => forEachSequentialDiscard(flatten$8(self), (requestsByRequestResolver) => forEachConcurrentDiscard(sequentialCollectionToChunk(requestsByRequestResolver), ([dataSource, sequential]) => {
13086
+ const runBlockedRequests = (self) => forEachSequentialDiscard(flatten$7(self), (requestsByRequestResolver) => forEachConcurrentDiscard(sequentialCollectionToChunk(requestsByRequestResolver), ([dataSource, sequential]) => {
13106
13087
  const map = /* @__PURE__ */ new Map();
13107
13088
  const arr = [];
13108
13089
  for (const block of sequential) {
@@ -13977,7 +13958,7 @@ const tracerLogger = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/
13977
13958
  span.value.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clockService.unsafeCurrentTimeNanos(), attributes);
13978
13959
  }));
13979
13960
  /** @internal */
13980
- const currentLoggers$1 = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$45(defaultLogger$1, tracerLogger)));
13961
+ const currentLoggers$1 = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$43(defaultLogger$1, tracerLogger)));
13981
13962
  const acquireRelease$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (acquire, release) => uninterruptible$1(tap$1(acquire, (a) => addFinalizer$2((exit) => release(a, exit)))));
13982
13963
  const addFinalizer$2 = (finalizer) => withFiberRuntime$1((runtime) => {
13983
13964
  const acquireRefs = runtime.getFiberRefs();
@@ -14157,7 +14138,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
14157
14138
  };
14158
14139
  for (let i = 0; i < fibersCount; i++) next();
14159
14140
  }));
14160
- return asVoid$1(onExit$1(flatten$7(restore(join$3(processingFiber))), exitMatch({
14141
+ return asVoid$1(onExit$1(flatten$6(restore(join$3(processingFiber))), exitMatch({
14161
14142
  onFailure: (cause) => {
14162
14143
  onInterruptSignal();
14163
14144
  const target = residual.length + 1;
@@ -14336,7 +14317,7 @@ const scopeUnsafeMake = (strategy = sequential$1) => {
14336
14317
  return scope;
14337
14318
  };
14338
14319
  const scopeMake = (strategy = sequential$1) => sync$2(() => scopeUnsafeMake(strategy));
14339
- const scopeExtend = /*#__PURE__*/ dual(2, (effect, scope) => mapInputContext(effect, merge$3(make$43(scopeTag, scope))));
14320
+ const scopeExtend = /*#__PURE__*/ dual(2, (effect, scope) => mapInputContext(effect, merge$1(make$41(scopeTag, scope))));
14340
14321
  const scopeUse = /*#__PURE__*/ dual(2, (effect, scope) => pipe(effect, scopeExtend(scope), onExit$1((exit) => scope.close(exit))));
14341
14322
  /** @internal */
14342
14323
  const fiberRefUnsafeMakeSupervisor = (initial) => fiberRefUnsafeMakePatch(initial, {
@@ -14376,7 +14357,7 @@ const race$1 = /*#__PURE__*/ dual(2, (self, that) => fiberIdWith$1((parentFiberI
14376
14357
  /** @internal */
14377
14358
  const raceFibersWith = /*#__PURE__*/ dual(3, (self, other, options) => withFiberRuntime$1((parentFiber, parentStatus) => {
14378
14359
  const parentRuntimeFlags = parentStatus.runtimeFlags;
14379
- const raceIndicator = make$41(true);
14360
+ const raceIndicator = make$39(true);
14380
14361
  const leftFiber = unsafeMakeChildFiber(self, parentFiber, parentRuntimeFlags, options.selfScope);
14381
14362
  const rightFiber = unsafeMakeChildFiber(other, parentFiber, parentRuntimeFlags, options.otherScope);
14382
14363
  return async_((cb) => {
@@ -14445,7 +14426,7 @@ const empty$5 = {
14445
14426
  endMillis: 0
14446
14427
  };
14447
14428
  /** @internal */
14448
- const make$23 = (startMillis, endMillis) => {
14429
+ const make$21 = (startMillis, endMillis) => {
14449
14430
  if (startMillis > endMillis) return empty$5;
14450
14431
  return {
14451
14432
  [IntervalTypeId]: IntervalTypeId,
@@ -14472,7 +14453,7 @@ const isEmpty$3 = (self) => {
14472
14453
  const intersect$4 = /*#__PURE__*/ dual(2, (self, that) => {
14473
14454
  const start = Math.max(self.startMillis, that.startMillis);
14474
14455
  const end = Math.min(self.endMillis, that.endMillis);
14475
- return make$23(start, end);
14456
+ return make$21(start, end);
14476
14457
  });
14477
14458
  /** @internal */
14478
14459
  const size$3 = (self) => {
@@ -14480,7 +14461,7 @@ const size$3 = (self) => {
14480
14461
  };
14481
14462
  /** @internal */
14482
14463
  const after$1 = (startMilliseconds) => {
14483
- return make$23(startMilliseconds, Number.POSITIVE_INFINITY);
14464
+ return make$21(startMilliseconds, Number.POSITIVE_INFINITY);
14484
14465
  };
14485
14466
  //#endregion
14486
14467
  //#region node_modules/effect/dist/esm/ScheduleInterval.js
@@ -14492,7 +14473,7 @@ const after$1 = (startMilliseconds) => {
14492
14473
  * @since 2.0.0
14493
14474
  * @category constructors
14494
14475
  */
14495
- const make$22 = make$23;
14476
+ const make$20 = make$21;
14496
14477
  /**
14497
14478
  * An `Interval` of zero-width.
14498
14479
  *
@@ -14542,7 +14523,7 @@ const after = after$1;
14542
14523
  /** @internal */
14543
14524
  const IntervalsTypeId = /*#__PURE__*/ Symbol.for("effect/ScheduleIntervals");
14544
14525
  /** @internal */
14545
- const make$21 = (intervals) => {
14526
+ const make$19 = (intervals) => {
14546
14527
  return {
14547
14528
  [IntervalsTypeId]: IntervalsTypeId,
14548
14529
  intervals
@@ -14562,7 +14543,7 @@ const intersectLoop = (_left, _right, _acc) => {
14562
14543
  else right = tailNonEmpty(right);
14563
14544
  acc = intervals;
14564
14545
  }
14565
- return make$21(reverse$1(acc));
14546
+ return make$19(reverse$1(acc));
14566
14547
  };
14567
14548
  /** @internal */
14568
14549
  const start$2 = (self) => {
@@ -14586,7 +14567,7 @@ const isNonEmpty$3 = (self) => {
14586
14567
  * @since 2.0.0
14587
14568
  * @category constructors
14588
14569
  */
14589
- const make$20 = make$21;
14570
+ const make$18 = make$19;
14590
14571
  /**
14591
14572
  * Produces the intersection of this `Intervals` and that `Intervals`.
14592
14573
  *
@@ -14640,7 +14621,7 @@ const _continue$1 = (intervals) => {
14640
14621
  const continueWith$1 = (interval) => {
14641
14622
  return {
14642
14623
  _tag: OP_CONTINUE$1,
14643
- intervals: make$20(of$1(interval))
14624
+ intervals: make$18(of$1(interval))
14644
14625
  };
14645
14626
  };
14646
14627
  /** @internal */
@@ -14747,7 +14728,7 @@ const fork = scopeFork;
14747
14728
  * @since 2.0.0
14748
14729
  * @category constructors
14749
14730
  */
14750
- const make$19 = scopeMake;
14731
+ const make$17 = scopeMake;
14751
14732
  //#endregion
14752
14733
  //#region node_modules/effect/dist/esm/internal/effect/circular.js
14753
14734
  /** @internal */
@@ -14890,7 +14871,7 @@ const timeout$1 = /*#__PURE__*/ dual(2, (self, duration) => timeoutFail(self, {
14890
14871
  duration
14891
14872
  }));
14892
14873
  /** @internal */
14893
- const timeoutFail = /*#__PURE__*/ dual(2, (self, { duration, onTimeout }) => flatten$7(timeoutTo(self, {
14874
+ const timeoutFail = /*#__PURE__*/ dual(2, (self, { duration, onTimeout }) => flatten$6(timeoutTo(self, {
14894
14875
  onTimeout: () => failSync(onTimeout),
14895
14876
  onSuccess: succeed$8,
14896
14877
  duration
@@ -14963,8 +14944,6 @@ const OP_PROVIDE$1 = "Provide";
14963
14944
  const OP_PROVIDE_MERGE = "ProvideMerge";
14964
14945
  /** @internal */
14965
14946
  const OP_MERGE_ALL = "MergeAll";
14966
- /** @internal */
14967
- const OP_ZIP_WITH = "ZipWith";
14968
14947
  //#endregion
14969
14948
  //#region node_modules/effect/dist/esm/Fiber.js
14970
14949
  const _await = _await$1;
@@ -15046,17 +15025,6 @@ const unsafeFork = /*#__PURE__*/ makeDual((runtime, self, options) => {
15046
15025
  return fiberRuntime;
15047
15026
  });
15048
15027
  /** @internal */
15049
- const unsafeRunCallback = /*#__PURE__*/ makeDual((runtime, effect, options = {}) => {
15050
- const fiberRuntime = unsafeFork(runtime, effect, options);
15051
- if (options.onExit) fiberRuntime.addObserver((exit) => {
15052
- options.onExit(exit);
15053
- });
15054
- return (id, cancelOptions) => unsafeRunCallback(runtime)(pipe(fiberRuntime, interruptAs(id ?? none$2)), {
15055
- ...cancelOptions,
15056
- onExit: cancelOptions?.onExit ? (exit) => cancelOptions.onExit(flatten$6(exit)) : void 0
15057
- });
15058
- });
15059
- /** @internal */
15060
15028
  const unsafeRunSync = /*#__PURE__*/ makeDual((runtime, effect) => {
15061
15029
  const result = unsafeRunSyncExit(runtime)(effect);
15062
15030
  if (result._tag === "Failure") throw fiberFailure(result.effect_instruction_i0);
@@ -15138,13 +15106,6 @@ const unsafeRunSyncExit = /*#__PURE__*/ makeDual((runtime, effect) => {
15138
15106
  return exitDie$1(capture(asyncFiberException(fiberRuntime), currentSpanFromFiber(fiberRuntime)));
15139
15107
  });
15140
15108
  /** @internal */
15141
- const unsafeRunPromise = /*#__PURE__*/ makeDual((runtime, effect, options) => unsafeRunPromiseExit(runtime, effect, options).then((result) => {
15142
- switch (result._tag) {
15143
- case OP_SUCCESS: return result.effect_instruction_i0;
15144
- case OP_FAILURE: throw fiberFailure(result.effect_instruction_i0);
15145
- }
15146
- }));
15147
- /** @internal */
15148
15109
  const unsafeRunPromiseExit = /*#__PURE__*/ makeDual((runtime, effect, options) => new Promise((resolve) => {
15149
15110
  const op = fastPath(effect);
15150
15111
  if (op) resolve(op);
@@ -15172,17 +15133,17 @@ var RuntimeImpl = class {
15172
15133
  }
15173
15134
  };
15174
15135
  /** @internal */
15175
- const make$18 = (options) => new RuntimeImpl(options.context, options.runtimeFlags, options.fiberRefs);
15136
+ const make$16 = (options) => new RuntimeImpl(options.context, options.runtimeFlags, options.fiberRefs);
15176
15137
  /** @internal */
15177
15138
  const runtime$1 = () => withFiberRuntime$1((state, status) => succeed$8(new RuntimeImpl(state.getFiberRef(currentContext$1), status.runtimeFlags, state.getFiberRefs())));
15178
15139
  /** @internal */
15179
- const defaultRuntime = /*#__PURE__*/ make$18({
15140
+ const defaultRuntime = /*#__PURE__*/ make$16({
15180
15141
  context: /*#__PURE__*/ empty$19(),
15181
- runtimeFlags: /* @__PURE__ */ make$36(1, 32, 4),
15142
+ runtimeFlags: /* @__PURE__ */ make$34(1, 32, 4),
15182
15143
  fiberRefs: /*#__PURE__*/ empty$9()
15183
15144
  });
15184
15145
  /** @internal */
15185
- const updateContext$1 = /*#__PURE__*/ dual(2, (self, f) => make$18({
15146
+ const updateContext$1 = /*#__PURE__*/ dual(2, (self, f) => make$16({
15186
15147
  context: f(self.context),
15187
15148
  runtimeFlags: self.runtimeFlags,
15188
15149
  fiberRefs: self.fiberRefs
@@ -15190,13 +15151,7 @@ const updateContext$1 = /*#__PURE__*/ dual(2, (self, f) => make$18({
15190
15151
  /** @internal */
15191
15152
  const unsafeForkEffect = /*#__PURE__*/ unsafeFork(defaultRuntime);
15192
15153
  /** @internal */
15193
- const unsafeRunPromiseEffect = /*#__PURE__*/ unsafeRunPromise(defaultRuntime);
15194
- /** @internal */
15195
- const unsafeRunPromiseExitEffect = /*#__PURE__*/ unsafeRunPromiseExit(defaultRuntime);
15196
- /** @internal */
15197
15154
  const unsafeRunSyncEffect = /*#__PURE__*/ unsafeRunSync(defaultRuntime);
15198
- /** @internal */
15199
- const unsafeRunSyncExitEffect = /*#__PURE__*/ unsafeRunSyncExit(defaultRuntime);
15200
15155
  //#endregion
15201
15156
  //#region node_modules/effect/dist/esm/internal/synchronizedRef.js
15202
15157
  /** @internal */
@@ -15252,7 +15207,7 @@ var MemoMapImpl = class {
15252
15207
  })));
15253
15208
  return succeed$8([cached, map]);
15254
15209
  }
15255
- return pipe(make$30(0), flatMap$6((observers) => pipe(deferredMake(), flatMap$6((deferred) => pipe(make$30(() => void_$4), map$8((finalizerRef) => {
15210
+ return pipe(make$28(0), flatMap$6((observers) => pipe(deferredMake(), flatMap$6((deferred) => pipe(make$28(() => void_$4), map$8((finalizerRef) => {
15256
15211
  const resource = uninterruptibleMask$2((restore) => pipe(scopeMake(), flatMap$6((innerScope) => pipe(restore(flatMap$6(makeBuilder(layer, innerScope, true), (f) => diffFiberRefs(f(this)))), exit$2, flatMap$6((exit) => {
15257
15212
  switch (exit._tag) {
15258
15213
  case OP_FAILURE: return pipe(deferredFailCause(deferred, exit.effect_instruction_i0), zipRight$3(scopeClose(innerScope, exit)), zipRight$3(failCause$6(exit.effect_instruction_i0)));
@@ -15265,7 +15220,7 @@ var MemoMapImpl = class {
15265
15220
  }))), (exit) => pipe(get$4(finalizerRef), flatMap$6((finalizer) => finalizer(exit)))];
15266
15221
  return [resource, isFresh(layer) ? map : map.set(layer, memoized)];
15267
15222
  }))))));
15268
- }), flatten$7);
15223
+ }), flatten$6);
15269
15224
  }
15270
15225
  };
15271
15226
  /** @internal */
@@ -15290,7 +15245,7 @@ const makeBuilder = (self, scope, inMemoMap = false) => {
15290
15245
  case "Provide": return sync$2(() => (memoMap) => pipe(memoMap.getOrElseMemoize(op.first, scope), flatMap$6((env) => pipe(memoMap.getOrElseMemoize(op.second, scope), provideContext$1(env)))));
15291
15246
  case "Scoped": return inMemoMap ? sync$2(() => (_) => scopeExtend(op.effect, scope)) : sync$2(() => (memoMap) => memoMap.getOrElseMemoize(self, scope));
15292
15247
  case "Suspend": return sync$2(() => (memoMap) => memoMap.getOrElseMemoize(op.evaluate(), scope));
15293
- case "ProvideMerge": return sync$2(() => (memoMap) => pipe(memoMap.getOrElseMemoize(op.first, scope), zipWith$2(memoMap.getOrElseMemoize(op.second, scope), op.zipK)));
15248
+ case "ProvideMerge": return sync$2(() => (memoMap) => pipe(memoMap.getOrElseMemoize(op.first, scope), zipWith$1(memoMap.getOrElseMemoize(op.second, scope), op.zipK)));
15294
15249
  case "ZipWith": return gen$1(function* () {
15295
15250
  const parallelScope = yield* scopeFork(scope, parallel$1);
15296
15251
  const firstScope = yield* scopeFork(parallelScope, sequential$1);
@@ -15316,7 +15271,7 @@ const context = () => fromEffectContext(context$1());
15316
15271
  const fromEffect$5 = /*#__PURE__*/ dual(2, (a, b) => {
15317
15272
  const tagFirst = isTag(a);
15318
15273
  const tag = tagFirst ? a : b;
15319
- return fromEffectContext(map$8(tagFirst ? b : a, (service) => make$43(tag, service)));
15274
+ return fromEffectContext(map$8(tagFirst ? b : a, (service) => make$41(tag, service)));
15320
15275
  });
15321
15276
  /** @internal */
15322
15277
  function fromEffectContext(effect) {
@@ -15326,8 +15281,6 @@ function fromEffectContext(effect) {
15326
15281
  return fromEffect;
15327
15282
  }
15328
15283
  /** @internal */
15329
- const merge$1 = /*#__PURE__*/ dual(2, (self, that) => zipWith$1(self, that, (a, b) => merge$3(a, b)));
15330
- /** @internal */
15331
15284
  const mergeAll$2 = (...layers) => {
15332
15285
  const mergeAll = Object.create(proto$8);
15333
15286
  mergeAll._op_layer = OP_MERGE_ALL;
@@ -15338,7 +15291,7 @@ const mergeAll$2 = (...layers) => {
15338
15291
  const scoped$4 = /*#__PURE__*/ dual(2, (a, b) => {
15339
15292
  const tagFirst = isTag(a);
15340
15293
  const tag = tagFirst ? a : b;
15341
- return scopedContext(map$8(tagFirst ? b : a, (service) => make$43(tag, service)));
15294
+ return scopedContext(map$8(tagFirst ? b : a, (service) => make$41(tag, service)));
15342
15295
  });
15343
15296
  /** @internal */
15344
15297
  const scopedContext = (effect) => {
@@ -15350,7 +15303,7 @@ const scopedContext = (effect) => {
15350
15303
  /** @internal */
15351
15304
  const succeed$4 = /*#__PURE__*/ dual(2, (a, b) => {
15352
15305
  const tagFirst = isTag(a);
15353
- return fromEffectContext(succeed$8(make$43(tagFirst ? a : b, tagFirst ? b : a)));
15306
+ return fromEffectContext(succeed$8(make$41(tagFirst ? a : b, tagFirst ? b : a)));
15354
15307
  });
15355
15308
  /** @internal */
15356
15309
  const suspend$6 = (evaluate) => {
@@ -15360,9 +15313,7 @@ const suspend$6 = (evaluate) => {
15360
15313
  return suspend;
15361
15314
  };
15362
15315
  /** @internal */
15363
- const toRuntimeWithMemoMap = /*#__PURE__*/ dual(2, (self, memoMap) => flatMap$6(scopeWith$1((scope) => buildWithMemoMap(self, memoMap, scope)), (context) => pipe(runtime$1(), provideContext$1(context))));
15364
- /** @internal */
15365
- const provide$3 = /*#__PURE__*/ dual(2, (self, that) => suspend$6(() => {
15316
+ const provide$2 = /*#__PURE__*/ dual(2, (self, that) => suspend$6(() => {
15366
15317
  const provideTo = Object.create(proto$8);
15367
15318
  provideTo._op_layer = OP_PROVIDE$1;
15368
15319
  provideTo.first = Object.create(proto$8, {
@@ -15375,7 +15326,7 @@ const provide$3 = /*#__PURE__*/ dual(2, (self, that) => suspend$6(() => {
15375
15326
  enumerable: true
15376
15327
  },
15377
15328
  second: { value: Array.isArray(that) ? mergeAll$2(...that) : that },
15378
- zipK: { value: (a, b) => pipe(a, merge$3(b)) }
15329
+ zipK: { value: (a, b) => pipe(a, merge$1(b)) }
15379
15330
  });
15380
15331
  provideTo.second = self;
15381
15332
  return provideTo;
@@ -15385,21 +15336,12 @@ const provideMerge$1 = /*#__PURE__*/ dual(2, (that, self) => {
15385
15336
  const zipWith = Object.create(proto$8);
15386
15337
  zipWith._op_layer = OP_PROVIDE_MERGE;
15387
15338
  zipWith.first = self;
15388
- zipWith.second = provide$3(that, self);
15339
+ zipWith.second = provide$2(that, self);
15389
15340
  zipWith.zipK = (a, b) => {
15390
- return pipe(a, merge$3(b));
15341
+ return pipe(a, merge$1(b));
15391
15342
  };
15392
15343
  return zipWith;
15393
15344
  });
15394
- /** @internal */
15395
- const zipWith$1 = /*#__PURE__*/ dual(3, (self, that, f) => suspend$6(() => {
15396
- const zipWith = Object.create(proto$8);
15397
- zipWith._op_layer = OP_ZIP_WITH;
15398
- zipWith.first = self;
15399
- zipWith.second = that;
15400
- zipWith.zipK = f;
15401
- return zipWith;
15402
- }));
15403
15345
  const provideSomeLayer = /*#__PURE__*/ dual(2, (self, layer) => scopedWith$2((scope) => flatMap$6(buildWithScope(layer, scope), (context) => provideSomeContext(self, context))));
15404
15346
  const provideSomeRuntime = /*#__PURE__*/ dual(2, (self, rt) => {
15405
15347
  const patchRefs = diff$1(defaultRuntime.fiberRefs, rt.fiberRefs);
@@ -15414,7 +15356,7 @@ const provideSomeRuntime = /*#__PURE__*/ dual(2, (self, rt) => {
15414
15356
  const rollbackFlags = diff$3(newFlags, oldFlags);
15415
15357
  fiber.setFiberRefs(newRefs);
15416
15358
  fiber.currentRuntimeFlags = newFlags;
15417
- return ensuring$3(provideSomeContext(restore(self), merge$3(oldContext, rt.context)), withFiberRuntime$1((fiber) => {
15359
+ return ensuring$3(provideSomeContext(restore(self), merge$1(oldContext, rt.context)), withFiberRuntime$1((fiber) => {
15418
15360
  fiber.setFiberRefs(patch$1(fiber.id(), fiber.getFiberRefs())(rollbackRefs));
15419
15361
  fiber.currentRuntimeFlags = patch$4(rollbackFlags)(fiber.currentRuntimeFlags);
15420
15362
  return void_$4;
@@ -15643,7 +15585,7 @@ const isUtc$1 = (self) => self._tag === "Utc";
15643
15585
  /** @internal */
15644
15586
  const isZoned$1 = (self) => self._tag === "Zoned";
15645
15587
  /** @internal */
15646
- const Equivalence$2 = /*#__PURE__*/ make$51((a, b) => a.epochMillis === b.epochMillis);
15588
+ const Equivalence$2 = /*#__PURE__*/ make$49((a, b) => a.epochMillis === b.epochMillis);
15647
15589
  const makeUtc = (epochMillis) => {
15648
15590
  const self = Object.create(ProtoUtc);
15649
15591
  self.epochMillis = epochMillis;
@@ -16049,11 +15991,11 @@ const checkEffect = /*#__PURE__*/ dual(2, (self, test) => makeWithState(self.ini
16049
15991
  ]);
16050
15992
  })));
16051
15993
  /** @internal */
16052
- const driver = (self) => pipe(make$30([none$4(), self.initial]), map$8((ref) => new ScheduleDriverImpl(self, ref)));
15994
+ const driver = (self) => pipe(make$28([none$4(), self.initial]), map$8((ref) => new ScheduleDriverImpl(self, ref)));
16053
15995
  /** @internal */
16054
15996
  const intersect = /*#__PURE__*/ dual(2, (self, that) => intersectWith(self, that, intersect$1));
16055
15997
  /** @internal */
16056
- const intersectWith = /*#__PURE__*/ dual(3, (self, that, f) => makeWithState([self.initial, that.initial], (now, input, state) => pipe(zipWith$2(self.step(now, input, state[0]), that.step(now, input, state[1]), (a, b) => [a, b]), flatMap$6(([[lState, out, lDecision], [rState, out2, rDecision]]) => {
15998
+ const intersectWith = /*#__PURE__*/ dual(3, (self, that, f) => makeWithState([self.initial, that.initial], (now, input, state) => pipe(zipWith$1(self.step(now, input, state[0]), that.step(now, input, state[1]), (a, b) => [a, b]), flatMap$6(([[lState, out, lDecision], [rState, out2, rDecision]]) => {
16057
15999
  if (isContinue(lDecision) && isContinue(rDecision)) return intersectWithLoop(self, that, input, lState, out, lDecision.intervals, rState, out2, rDecision.intervals, f);
16058
16000
  return succeed$8([
16059
16001
  [lState, rState],
@@ -16102,14 +16044,14 @@ const modifyDelayEffect = /*#__PURE__*/ dual(2, (self, f) => makeWithState(self.
16102
16044
  decision
16103
16045
  ]);
16104
16046
  const intervals = decision.intervals;
16105
- const delay = size$2(make$22(now, start$1(intervals)));
16047
+ const delay = size$2(make$20(now, start$1(intervals)));
16106
16048
  return map$8(f(out, delay), (durationInput) => {
16107
16049
  const duration = decode$2(durationInput);
16108
16050
  const oldStart = start$1(intervals);
16109
16051
  const newStart = now + toMillis(duration);
16110
16052
  const delta = newStart - oldStart;
16111
16053
  const newEnd = Math.max(0, end$2(intervals) + delta);
16112
- const newInterval = make$22(newStart, newEnd);
16054
+ const newInterval = make$20(newStart, newEnd);
16113
16055
  return [
16114
16056
  state,
16115
16057
  out,
@@ -16386,7 +16328,7 @@ const MutableQueueProto = {
16386
16328
  return pipeArguments(this, arguments);
16387
16329
  }
16388
16330
  };
16389
- const make$17 = (capacity) => {
16331
+ const make$15 = (capacity) => {
16390
16332
  const queue = Object.create(MutableQueueProto);
16391
16333
  queue.queue = empty$3();
16392
16334
  queue.capacity = capacity;
@@ -16398,14 +16340,14 @@ const make$17 = (capacity) => {
16398
16340
  * @since 2.0.0
16399
16341
  * @category constructors
16400
16342
  */
16401
- const bounded$2 = (capacity) => make$17(capacity);
16343
+ const bounded$2 = (capacity) => make$15(capacity);
16402
16344
  /**
16403
16345
  * Creates a new unbounded `MutableQueue`.
16404
16346
  *
16405
16347
  * @since 2.0.0
16406
16348
  * @category constructors
16407
16349
  */
16408
- const unbounded$2 = () => make$17(void 0);
16350
+ const unbounded$2 = () => make$15(void 0);
16409
16351
  /**
16410
16352
  * Returns the current number of elements in the queue.
16411
16353
  *
@@ -18759,7 +18701,7 @@ const timeout = timeout$1;
18759
18701
  * @since 2.0.0
18760
18702
  * @category Context
18761
18703
  */
18762
- const provide$2 = effect_provide;
18704
+ const provide$1 = effect_provide;
18763
18705
  /**
18764
18706
  * Provides an implementation for a service in the context of an effect.
18765
18707
  *
@@ -19226,7 +19168,7 @@ const andThen = andThen$1;
19226
19168
  * @since 2.0.0
19227
19169
  * @category Sequencing
19228
19170
  */
19229
- const flatten$5 = flatten$7;
19171
+ const flatten$5 = flatten$6;
19230
19172
  /**
19231
19173
  * Races two effects and returns the result of the first successful one.
19232
19174
  *
@@ -20391,13 +20333,6 @@ const currentLoggers = currentLoggers$1;
20391
20333
  */
20392
20334
  const effect$1 = fromEffect$5;
20393
20335
  /**
20394
- * Merges this layer with the specified layer concurrently, producing a new layer with combined input and output types.
20395
- *
20396
- * @since 2.0.0
20397
- * @category zipping
20398
- */
20399
- const merge = merge$1;
20400
- /**
20401
20336
  * Combines all the provided layers concurrently, creating a new layer with merged input, error, and output types.
20402
20337
  *
20403
20338
  * @since 2.0.0
@@ -20426,7 +20361,7 @@ const succeed$2 = succeed$4;
20426
20361
  * @since 2.0.0
20427
20362
  * @category utils
20428
20363
  */
20429
- const provide$1 = provide$3;
20364
+ const provide = provide$2;
20430
20365
  /**
20431
20366
  * Feeds the output services of this layer into the input of the specified
20432
20367
  * layer, resulting in a new layer with the inputs of this layer, and the
@@ -20611,19 +20546,19 @@ const takeRemainderLoop = (self, min, max, acc) => {
20611
20546
  }));
20612
20547
  };
20613
20548
  /** @internal */
20614
- const bounded$1 = (requestedCapacity) => pipe(sync$2(() => bounded$2(requestedCapacity)), flatMap$6((queue) => make$16(backingQueueFromMutableQueue(queue), backPressureStrategy())));
20549
+ const bounded$1 = (requestedCapacity) => pipe(sync$2(() => bounded$2(requestedCapacity)), flatMap$6((queue) => make$14(backingQueueFromMutableQueue(queue), backPressureStrategy())));
20615
20550
  /** @internal */
20616
- const dropping$1 = (requestedCapacity) => pipe(sync$2(() => bounded$2(requestedCapacity)), flatMap$6((queue) => make$16(backingQueueFromMutableQueue(queue), droppingStrategy())));
20551
+ const dropping$1 = (requestedCapacity) => pipe(sync$2(() => bounded$2(requestedCapacity)), flatMap$6((queue) => make$14(backingQueueFromMutableQueue(queue), droppingStrategy())));
20617
20552
  /** @internal */
20618
- const sliding$1 = (requestedCapacity) => pipe(sync$2(() => bounded$2(requestedCapacity)), flatMap$6((queue) => make$16(backingQueueFromMutableQueue(queue), slidingStrategy())));
20553
+ const sliding$1 = (requestedCapacity) => pipe(sync$2(() => bounded$2(requestedCapacity)), flatMap$6((queue) => make$14(backingQueueFromMutableQueue(queue), slidingStrategy())));
20619
20554
  /** @internal */
20620
- const unbounded$1 = () => pipe(sync$2(() => unbounded$2()), flatMap$6((queue) => make$16(backingQueueFromMutableQueue(queue), droppingStrategy())));
20555
+ const unbounded$1 = () => pipe(sync$2(() => unbounded$2()), flatMap$6((queue) => make$14(backingQueueFromMutableQueue(queue), droppingStrategy())));
20621
20556
  /** @internal */
20622
20557
  const unsafeMake$2 = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
20623
20558
  return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
20624
20559
  };
20625
20560
  /** @internal */
20626
- const make$16 = (queue, strategy) => pipe(deferredMake(), map$8((deferred) => unsafeMake$2(queue, unbounded$2(), deferred, make$41(false), strategy)));
20561
+ const make$14 = (queue, strategy) => pipe(deferredMake(), map$8((deferred) => unsafeMake$2(queue, unbounded$2(), deferred, make$39(false), strategy)));
20627
20562
  /** @internal */
20628
20563
  var BackingQueueFromMutableQueue = class {
20629
20564
  mutable;
@@ -21489,7 +21424,7 @@ var ChannelExecutor = class ChannelExecutor {
21489
21424
  this._currentChannel = this._currentChannel.channel;
21490
21425
  break;
21491
21426
  case OP_FROM_EFFECT$1: {
21492
- const effect = this._providedEnv === void 0 ? this._currentChannel.effect() : pipe(this._currentChannel.effect(), provide$2(this._providedEnv));
21427
+ const effect = this._providedEnv === void 0 ? this._currentChannel.effect() : pipe(this._currentChannel.effect(), provide$1(this._providedEnv));
21493
21428
  result = fromEffect$3(matchCauseEffect(effect, {
21494
21429
  onFailure: (cause) => {
21495
21430
  const state = this.doneHalt(cause);
@@ -21680,7 +21615,7 @@ var ChannelExecutor = class ChannelExecutor {
21680
21615
  }
21681
21616
  provide(effect) {
21682
21617
  if (this._providedEnv === void 0) return effect;
21683
- return pipe(effect, provide$2(this._providedEnv));
21618
+ return pipe(effect, provide$1(this._providedEnv));
21684
21619
  }
21685
21620
  runEnsuring(ensuring) {
21686
21621
  this.addFinalizer(ensuring.finalizer);
@@ -21916,8 +21851,8 @@ const runIn = /*#__PURE__*/ dual(2, (self, scope) => {
21916
21851
  });
21917
21852
  return uninterruptibleMask((restore) => all$1([
21918
21853
  fork(scope, sequential),
21919
- make$35(),
21920
- make$35()
21854
+ make$33(),
21855
+ make$33()
21921
21856
  ]).pipe(flatMap$4(([child, channelDeferred, scopeDeferred]) => restore(run(channelDeferred, scopeDeferred, child)).pipe(forkIn(scope), flatMap$4((fiber) => scope.addFinalizer((exit) => {
21922
21857
  const interruptors$2 = isFailure(exit) ? interruptors(exit.cause) : void 0;
21923
21858
  return isDone$4(channelDeferred).pipe(flatMap$4((isDone) => isDone ? succeed$7(scopeDeferred, void 0).pipe(zipRight$1(_await(fiber)), zipRight$1(inheritAll(fiber))) : succeed$7(scopeDeferred, void 0).pipe(zipRight$1(interruptors$2 && size$5(interruptors$2) > 0 ? interruptAs(fiber, combineAll(interruptors$2)) : interrupt$1(fiber)), zipRight$1(inheritAll(fiber)))));
@@ -22066,7 +22001,7 @@ var SingleProducerAsyncInputImpl = class {
22066
22001
  }));
22067
22002
  }
22068
22003
  emit(element) {
22069
- return flatMap$4(make$35(), (deferred) => flatten$5(modify(this.ref, (state) => {
22004
+ return flatMap$4(make$33(), (deferred) => flatten$5(modify(this.ref, (state) => {
22070
22005
  switch (state._tag) {
22071
22006
  case OP_STATE_EMPTY: return [_await$2(state.notifyProducer), state];
22072
22007
  case OP_STATE_EMIT: {
@@ -22094,7 +22029,7 @@ var SingleProducerAsyncInputImpl = class {
22094
22029
  return this.takeWith((cause) => failCause$3(map$7(cause, left)), (elem) => succeed$5(elem), (done) => fail$8(right(done)));
22095
22030
  }
22096
22031
  takeWith(onError, onElement, onDone) {
22097
- return flatMap$4(make$35(), (deferred) => flatten$5(modify(this.ref, (state) => {
22032
+ return flatMap$4(make$33(), (deferred) => flatten$5(modify(this.ref, (state) => {
22098
22033
  switch (state._tag) {
22099
22034
  case OP_STATE_EMPTY: return [zipRight$1(succeed$7(state.notifyProducer, void 0), matchCause(_await$2(deferred), {
22100
22035
  onFailure: onError,
@@ -22117,11 +22052,11 @@ var SingleProducerAsyncInputImpl = class {
22117
22052
  }
22118
22053
  };
22119
22054
  /** @internal */
22120
- const make$15 = () => pipe(make$35(), flatMap$4((deferred) => make$29(stateEmpty$1(deferred))), map$4((ref) => new SingleProducerAsyncInputImpl(ref)));
22055
+ const make$13 = () => pipe(make$33(), flatMap$4((deferred) => make$27(stateEmpty$1(deferred))), map$4((ref) => new SingleProducerAsyncInputImpl(ref)));
22121
22056
  //#endregion
22122
22057
  //#region node_modules/effect/dist/esm/internal/channel.js
22123
22058
  /** @internal */
22124
- const acquireUseRelease$1 = (acquire, use, release) => flatMap$3(fromEffect$4(make$29(() => _void)), (ref) => pipe(fromEffect$4(uninterruptible(tap(acquire, (a) => set$1(ref, (exit) => release(a, exit))))), flatMap$3(use), ensuringWith((exit) => flatMap$4(get$3(ref), (f) => f(exit)))));
22059
+ const acquireUseRelease$1 = (acquire, use, release) => flatMap$3(fromEffect$4(make$27(() => _void)), (ref) => pipe(fromEffect$4(uninterruptible(tap(acquire, (a) => set$1(ref, (exit) => release(a, exit))))), flatMap$3(use), ensuringWith((exit) => flatMap$4(get$3(ref), (f) => f(exit)))));
22125
22060
  /** @internal */
22126
22061
  const concatMap = /*#__PURE__*/ dual(2, (self, f) => concatMapWith(self, f, () => void 0, () => void 0));
22127
22062
  /** @internal */
@@ -22172,14 +22107,14 @@ const mergeAll = (options) => {
22172
22107
  /** @internal */
22173
22108
  const mergeAllWith = ({ bufferSize = 16, concurrency, mergeStrategy = BackPressure() }) => (channels, f) => unwrapScopedWith((scope) => gen(function* () {
22174
22109
  const concurrencyN = concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : concurrency;
22175
- const input = yield* make$15();
22110
+ const input = yield* make$13();
22176
22111
  const queueReader = fromInput(input);
22177
22112
  const queue = yield* bounded(bufferSize);
22178
22113
  yield* addFinalizer$1(scope, shutdown(queue));
22179
22114
  const cancelers = yield* unbounded();
22180
22115
  yield* addFinalizer$1(scope, shutdown(cancelers));
22181
- const lastDone = yield* make$29(none$4());
22182
- const errorSignal = yield* make$35();
22116
+ const lastDone = yield* make$27(none$4());
22117
+ const errorSignal = yield* make$33();
22183
22118
  const withPermits = (yield* makeSemaphore(concurrencyN)).withPermits;
22184
22119
  const pull = yield* toPullIn(pipeTo$1(queueReader, channels), scope);
22185
22120
  function evaluatePull(pull) {
@@ -22203,15 +22138,15 @@ const mergeAllWith = ({ bufferSize = 16, concurrency, mergeStrategy = BackPressu
22203
22138
  }),
22204
22139
  onRight: (channel) => match$1(mergeStrategy, {
22205
22140
  onBackPressure: () => gen(function* () {
22206
- const latch = yield* make$35();
22141
+ const latch = yield* make$33();
22207
22142
  const raceEffects = scopedWith$1((scope) => toPullIn(pipeTo$1(queueReader, channel), scope).pipe(flatMap$4((pull) => race(exit$1(evaluatePull(pull)), exit$1(interruptible(_await$2(errorSignal))))), flatMap$4(identity$1)));
22208
22143
  yield* succeed$7(latch, void 0).pipe(zipRight$1(raceEffects), withPermits(1), forkIn(scope));
22209
22144
  yield* _await$2(latch);
22210
22145
  return !(yield* isDone$4(errorSignal));
22211
22146
  }),
22212
22147
  onBufferSliding: () => gen(function* () {
22213
- const canceler = yield* make$35();
22214
- const latch = yield* make$35();
22148
+ const canceler = yield* make$33();
22149
+ const latch = yield* make$33();
22215
22150
  const size$8 = yield* size(cancelers);
22216
22151
  yield* take(cancelers).pipe(flatMap$4((canceler) => succeed$7(canceler, void 0)), when(() => size$8 >= concurrencyN));
22217
22152
  yield* offer(cancelers, canceler);
@@ -22238,7 +22173,7 @@ const mergeMap = /*#__PURE__*/ dual(3, (self, f, options) => mergeAll(options)(m
22238
22173
  const mergeWith = /*#__PURE__*/ dual(2, (self, options) => {
22239
22174
  function merge(scope) {
22240
22175
  return gen(function* () {
22241
- const input = yield* make$15();
22176
+ const input = yield* make$13();
22242
22177
  const queueReader = fromInput(input);
22243
22178
  const pullL = yield* toPullIn(pipeTo$1(queueReader, self), scope);
22244
22179
  const pullR = yield* toPullIn(pipeTo$1(queueReader, options.other), scope);
@@ -22322,13 +22257,13 @@ const pipeToOrFail = /*#__PURE__*/ dual(2, (self, that) => suspend$4(() => {
22322
22257
  return pipeTo$1(pipeTo$1(pipeTo$1(self, reader), that), writer);
22323
22258
  }));
22324
22259
  /** @internal */
22325
- const run$6 = (self) => scopedWith$1((scope) => runIn(self, scope));
22260
+ const run$7 = (self) => scopedWith$1((scope) => runIn(self, scope));
22326
22261
  /** @internal */
22327
- const runDrain = (self) => run$6(drain$2(self));
22262
+ const runDrain = (self) => run$7(drain$2(self));
22328
22263
  /** @internal */
22329
22264
  const runScoped = (self) => scopeWith((scope) => runIn(self, scope));
22330
22265
  /** @internal */
22331
- const scoped$1 = (effect) => unwrap$2(uninterruptibleMask((restore) => map$4(make$19(), (scope) => acquireReleaseOut(tapErrorCause(restore(extend$1(effect, scope)), (cause) => close(scope, failCause$3(cause))), (_, exit) => close(scope, exit)))));
22266
+ const scoped$1 = (effect) => unwrap$2(uninterruptibleMask((restore) => map$4(make$17(), (scope) => acquireReleaseOut(tapErrorCause(restore(extend$1(effect, scope)), (cause) => close(scope, failCause$3(cause))), (_, exit) => close(scope, exit)))));
22332
22267
  /** @internal */
22333
22268
  const scopedWith = (f) => unwrapScoped$4(map$4(scope$1, (scope) => flatMap$3(fromEffect$4(f(scope)), write$1)));
22334
22269
  /** @internal */
@@ -22392,7 +22327,7 @@ const splitLines$2 = () => suspend$4(() => {
22392
22327
  /** @internal */
22393
22328
  const toPullIn = /*#__PURE__*/ dual(2, (self, scope) => zip$1(sync$1(() => new ChannelExecutor(self, void 0, identity$1)), runtime()).pipe(tap(([executor, runtime]) => addFinalizerExit(scope, (exit) => {
22394
22329
  const finalizer = executor.close(exit);
22395
- return finalizer !== void 0 ? provide$2(finalizer, runtime) : _void;
22330
+ return finalizer !== void 0 ? provide$1(finalizer, runtime) : _void;
22396
22331
  })), uninterruptible, map$4(([executor]) => suspend$5(() => interpretToPull(executor.run(), executor)))));
22397
22332
  /** @internal */
22398
22333
  const interpretToPull = (channelState, exec) => {
@@ -22550,7 +22485,7 @@ var RcRefImpl = class extends Class {
22550
22485
  }
22551
22486
  };
22552
22487
  /** @internal */
22553
- const make$14 = (options) => withFiberRuntime$1((fiber) => {
22488
+ const make$12 = (options) => withFiberRuntime$1((fiber) => {
22554
22489
  const context = fiber.getFiberRef(currentContext$1);
22555
22490
  const scope = get$8(context, scopeTag);
22556
22491
  const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive ? decode$2(options.idleTimeToLive) : void 0);
@@ -22636,7 +22571,7 @@ const get$1 = (self_) => {
22636
22571
  * })
22637
22572
  * ```
22638
22573
  */
22639
- const make$13 = make$14;
22574
+ const make$11 = make$12;
22640
22575
  /**
22641
22576
  * @since 3.5.0
22642
22577
  * @category combinators
@@ -22689,7 +22624,7 @@ const spaced = spaced$1;
22689
22624
  //#endregion
22690
22625
  //#region node_modules/effect/dist/esm/internal/stream/emit.js
22691
22626
  /** @internal */
22692
- const make$12 = (emit) => {
22627
+ const make$10 = (emit) => {
22693
22628
  return Object.assign(emit, {
22694
22629
  chunk(as) {
22695
22630
  return this(succeed$3(as));
@@ -22807,11 +22742,11 @@ const queueFromBufferOptions = (bufferSize) => {
22807
22742
  }
22808
22743
  };
22809
22744
  /** @internal */
22810
- const asyncScoped$1 = (register, bufferSize) => pipe(acquireRelease(queueFromBufferOptions(bufferSize), (queue) => shutdown(queue)), flatMap$4((output) => pipe(runtime(), flatMap$4((runtime) => pipe(register(make$12((k) => pipe(fromPull(k), flatMap$4((take) => offer(output, take)), asVoid, runPromiseExit(runtime)).then((exit) => {
22745
+ const asyncScoped$1 = (register, bufferSize) => pipe(acquireRelease(queueFromBufferOptions(bufferSize), (queue) => shutdown(queue)), flatMap$4((output) => pipe(runtime(), flatMap$4((runtime) => pipe(register(make$10((k) => pipe(fromPull(k), flatMap$4((take) => offer(output, take)), asVoid, runPromiseExit(runtime)).then((exit) => {
22811
22746
  if (isFailure(exit)) {
22812
22747
  if (!isInterrupted(exit.cause)) throw squash(exit.cause);
22813
22748
  }
22814
- }))), zipRight$1(make$29(false)), flatMap$4((ref) => pipe(get$3(ref), map$4((isDone) => isDone ? end() : pipe(take(output), flatMap$4(done), onError(() => pipe(set$1(ref, true), zipRight$1(shutdown(output)))))))))))), scoped, flatMap$2(repeatEffectChunkOption));
22749
+ }))), zipRight$1(make$27(false)), flatMap$4((ref) => pipe(get$3(ref), map$4((isDone) => isDone ? end() : pipe(take(output), flatMap$4(done), onError(() => pipe(set$1(ref, true), zipRight$1(shutdown(output)))))))))))), scoped, flatMap$2(repeatEffectChunkOption));
22815
22750
  /** @internal */
22816
22751
  const bufferChunks$1 = /*#__PURE__*/ dual(2, (self, options) => {
22817
22752
  if (options.strategy === "dropping") return bufferChunksDropping(self, options.capacity);
@@ -22836,9 +22771,9 @@ const bufferChunksSliding = /*#__PURE__*/ dual(2, (self, capacity) => {
22836
22771
  });
22837
22772
  const bufferSignal = (scoped, bufferChannel) => {
22838
22773
  const producer = (queue, ref) => {
22839
- const terminate = (take) => pipe(get$3(ref), tap(_await$2), zipRight$1(make$35()), flatMap$4((deferred) => pipe(offer(queue, [take, deferred]), zipRight$1(set$1(ref, deferred)), zipRight$1(_await$2(deferred)))), asVoid, fromEffect$4);
22774
+ const terminate = (take) => pipe(get$3(ref), tap(_await$2), zipRight$1(make$33()), flatMap$4((deferred) => pipe(offer(queue, [take, deferred]), zipRight$1(set$1(ref, deferred)), zipRight$1(_await$2(deferred)))), asVoid, fromEffect$4);
22840
22775
  return readWithCause({
22841
- onInput: (input) => pipe(make$35(), flatMap$4((deferred) => pipe(offer(queue, [chunk(input), deferred]), flatMap$4((added) => pipe(set$1(ref, deferred), when(() => added))))), asVoid, fromEffect$4, flatMap$3(() => producer(queue, ref))),
22776
+ onInput: (input) => pipe(make$33(), flatMap$4((deferred) => pipe(offer(queue, [chunk(input), deferred]), flatMap$4((added) => pipe(set$1(ref, deferred), when(() => added))))), asVoid, fromEffect$4, flatMap$3(() => producer(queue, ref))),
22842
22777
  onFailure: (error) => terminate(failCause(error)),
22843
22778
  onDone: () => terminate(end$1)
22844
22779
  });
@@ -22851,7 +22786,7 @@ const bufferSignal = (scoped, bufferChannel) => {
22851
22786
  }))));
22852
22787
  return process;
22853
22788
  };
22854
- return unwrapScoped$4(pipe(scoped, flatMap$4((queue) => pipe(make$35(), tap((start) => succeed$7(start, void 0)), flatMap$4((start) => pipe(make$29(start), flatMap$4((ref) => pipe(bufferChannel, pipeTo$1(producer(queue, ref)), runScoped, forkScoped)), as(consumer(queue))))))));
22789
+ return unwrapScoped$4(pipe(scoped, flatMap$4((queue) => pipe(make$33(), tap((start) => succeed$7(start, void 0)), flatMap$4((start) => pipe(make$27(start), flatMap$4((ref) => pipe(bufferChannel, pipeTo$1(producer(queue, ref)), runScoped, forkScoped)), as(consumer(queue))))))));
22855
22790
  };
22856
22791
  /** @internal */
22857
22792
  const flatMap$2 = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, f, options) => {
@@ -22897,7 +22832,7 @@ const map$1 = /*#__PURE__*/ dual(2, (self, f) => new StreamImpl(pipe(toChannel$2
22897
22832
  /** @internal */
22898
22833
  const mapChunks$1 = /*#__PURE__*/ dual(2, (self, f) => new StreamImpl(pipe(toChannel$2(self), mapOut(f))));
22899
22834
  /** @internal */
22900
- const mkString$1 = (self) => run$5(self, mkString$2);
22835
+ const mkString$1 = (self) => run$6(self, mkString$2);
22901
22836
  /** @internal */
22902
22837
  const pipeThroughChannel = /*#__PURE__*/ dual(2, (self, channel) => new StreamImpl(pipeTo$1(toChannel$2(self), channel)));
22903
22838
  /** @internal */
@@ -22906,9 +22841,9 @@ const repeatEffectChunkOption = (effect) => unfoldChunkEffect(effect, (effect) =
22906
22841
  onSome: fail$7
22907
22842
  }))));
22908
22843
  /** @internal */
22909
- const run$5 = /*#__PURE__*/ dual(2, (self, sink) => toChannel$2(self).pipe(pipeToOrFail(toChannel$3(sink)), runDrain));
22844
+ const run$6 = /*#__PURE__*/ dual(2, (self, sink) => toChannel$2(self).pipe(pipeToOrFail(toChannel$3(sink)), runDrain));
22910
22845
  /** @internal */
22911
- const runCollect$1 = (self) => run$5(self, collectAll());
22846
+ const runCollect$1 = (self) => run$6(self, collectAll());
22912
22847
  /** @internal */
22913
22848
  const runIntoQueueScoped = /*#__PURE__*/ dual(2, (self, queue) => {
22914
22849
  const writer = readWithCause({
@@ -23100,7 +23035,7 @@ const isBigDecimal = (u) => hasProperty(u, TypeId$8);
23100
23035
  * @since 2.0.0
23101
23036
  * @category constructors
23102
23037
  */
23103
- const make$11 = (value, scale) => {
23038
+ const make$9 = (value, scale) => {
23104
23039
  const o = Object.create(BigDecimalProto);
23105
23040
  o.value = value;
23106
23041
  o.scale = scale;
@@ -23113,7 +23048,7 @@ const make$11 = (value, scale) => {
23113
23048
  */
23114
23049
  const unsafeMakeNormalized = (value, scale) => {
23115
23050
  if (value !== bigint0 && value % bigint10 === bigint0) throw new RangeError("Value must be normalized");
23116
- const o = make$11(value, scale);
23051
+ const o = make$9(value, scale);
23117
23052
  o.normalized = o;
23118
23053
  return o;
23119
23054
  };
@@ -23160,8 +23095,8 @@ const normalize = (self) => {
23160
23095
  * @category scaling
23161
23096
  */
23162
23097
  const scale = /*#__PURE__*/ dual(2, (self, scale) => {
23163
- if (scale > self.scale) return make$11(self.value * bigint10 ** BigInt(scale - self.scale), scale);
23164
- if (scale < self.scale) return make$11(self.value / bigint10 ** BigInt(self.scale - scale), scale);
23098
+ if (scale > self.scale) return make$9(self.value * bigint10 ** BigInt(scale - self.scale), scale);
23099
+ if (scale < self.scale) return make$9(self.value / bigint10 ** BigInt(self.scale - scale), scale);
23165
23100
  return self;
23166
23101
  });
23167
23102
  /**
@@ -23180,12 +23115,12 @@ const scale = /*#__PURE__*/ dual(2, (self, scale) => {
23180
23115
  * @since 2.0.0
23181
23116
  * @category math
23182
23117
  */
23183
- const abs = (n) => n.value < bigint0 ? make$11(-n.value, n.scale) : n;
23118
+ const abs = (n) => n.value < bigint0 ? make$9(-n.value, n.scale) : n;
23184
23119
  /**
23185
23120
  * @category instances
23186
23121
  * @since 2.0.0
23187
23122
  */
23188
- const Equivalence$1 = /*#__PURE__*/ make$51((self, that) => {
23123
+ const Equivalence$1 = /*#__PURE__*/ make$49((self, that) => {
23189
23124
  if (self.scale > that.scale) return scale(that, self.scale).value === self.value;
23190
23125
  if (self.scale < that.scale) return scale(self, that.scale).value === that.value;
23191
23126
  return self.value === that.value;
@@ -23244,7 +23179,7 @@ const safeFromNumber = (n) => {
23244
23179
  const string = `${n}`;
23245
23180
  if (string.includes("e")) return fromString$1(string);
23246
23181
  const [lead, trail = ""] = string.split(".");
23247
- return some(make$11(BigInt(`${lead}${trail}`), trail.length));
23182
+ return some(make$9(BigInt(`${lead}${trail}`), trail.length));
23248
23183
  };
23249
23184
  /**
23250
23185
  * Parses a numerical `string` into a `BigDecimal`.
@@ -23291,7 +23226,7 @@ const fromString$1 = (s) => {
23291
23226
  if (!FINITE_INT_REGEX.test(digits)) return none$4();
23292
23227
  const scale = offset - exp;
23293
23228
  if (!Number.isSafeInteger(scale)) return none$4();
23294
- return some(make$11(BigInt(digits), scale));
23229
+ return some(make$9(BigInt(digits), scale));
23295
23230
  };
23296
23231
  /**
23297
23232
  * Formats a given `BigDecimal` as a `string`.
@@ -26389,12 +26324,12 @@ const TypeId$7 = /*#__PURE__*/ Symbol.for("effect/Schema");
26389
26324
  * @category constructors
26390
26325
  * @since 3.10.0
26391
26326
  */
26392
- function make$10(ast) {
26327
+ function make$8(ast) {
26393
26328
  return class SchemaClass {
26394
26329
  [TypeId$7] = variance;
26395
26330
  static ast = ast;
26396
26331
  static annotations(annotations) {
26397
- return make$10(mergeSchemaAnnotations(this.ast, annotations));
26332
+ return make$8(mergeSchemaAnnotations(this.ast, annotations));
26398
26333
  }
26399
26334
  static pipe() {
26400
26335
  return pipeArguments(this, arguments);
@@ -26467,7 +26402,7 @@ const format = (schema) => String(schema.ast);
26467
26402
  *
26468
26403
  * @since 3.10.0
26469
26404
  */
26470
- const encodedSchema = (schema) => make$10(encodedAST(schema.ast));
26405
+ const encodedSchema = (schema) => make$8(encodedAST(schema.ast));
26471
26406
  /**
26472
26407
  * The `typeSchema` function allows you to extract the `Type` portion of a
26473
26408
  * schema, creating a new schema that conforms to the properties defined in the
@@ -26476,7 +26411,7 @@ const encodedSchema = (schema) => make$10(encodedAST(schema.ast));
26476
26411
  *
26477
26412
  * @since 3.10.0
26478
26413
  */
26479
- const typeSchema = (schema) => make$10(typeAST(schema.ast));
26414
+ const typeSchema = (schema) => make$8(typeAST(schema.ast));
26480
26415
  /**
26481
26416
  * @category decoding
26482
26417
  * @since 3.10.0
@@ -26504,7 +26439,7 @@ function getDefaultLiteralAST(literals) {
26504
26439
  return isMembers(literals) ? Union$1.make(mapMembers(literals, (literal) => new Literal$1(literal))) : new Literal$1(literals[0]);
26505
26440
  }
26506
26441
  function makeLiteralClass(literals, ast = getDefaultLiteralAST(literals)) {
26507
- return class LiteralClass extends make$10(ast) {
26442
+ return class LiteralClass extends make$8(ast) {
26508
26443
  static annotations(annotations) {
26509
26444
  return makeLiteralClass(this.literals, mergeSchemaAnnotations(this.ast, annotations));
26510
26445
  }
@@ -26514,13 +26449,13 @@ function makeLiteralClass(literals, ast = getDefaultLiteralAST(literals)) {
26514
26449
  function Literal(...literals) {
26515
26450
  return isNonEmptyReadonlyArray(literals) ? makeLiteralClass(literals) : Never;
26516
26451
  }
26517
- const declareConstructor = (typeParameters, options, annotations) => makeDeclareClass(typeParameters, new Declaration(typeParameters.map((tp) => tp.ast), (...typeParameters) => options.decode(...typeParameters.map(make$10)), (...typeParameters) => options.encode(...typeParameters.map(make$10)), toASTAnnotations(annotations)));
26452
+ const declareConstructor = (typeParameters, options, annotations) => makeDeclareClass(typeParameters, new Declaration(typeParameters.map((tp) => tp.ast), (...typeParameters) => options.decode(...typeParameters.map(make$8)), (...typeParameters) => options.encode(...typeParameters.map(make$8)), toASTAnnotations(annotations)));
26518
26453
  const declarePrimitive = (is, annotations) => {
26519
26454
  const decodeUnknown = () => (input, _, ast) => is(input) ? succeed(input) : fail$5(new Type(ast, input));
26520
26455
  return makeDeclareClass([], new Declaration([], decodeUnknown, decodeUnknown, toASTAnnotations(annotations)));
26521
26456
  };
26522
26457
  function makeDeclareClass(typeParameters, ast) {
26523
- return class DeclareClass extends make$10(ast) {
26458
+ return class DeclareClass extends make$8(ast) {
26524
26459
  static annotations(annotations) {
26525
26460
  return makeDeclareClass(this.typeParameters, mergeSchemaAnnotations(this.ast, annotations));
26526
26461
  }
@@ -26566,41 +26501,41 @@ const instanceOf = (constructor, annotations) => declare((u) => u instanceof con
26566
26501
  * @category primitives
26567
26502
  * @since 3.10.0
26568
26503
  */
26569
- var Undefined = class extends make$10(undefinedKeyword) {};
26504
+ var Undefined = class extends make$8(undefinedKeyword) {};
26570
26505
  /**
26571
26506
  * @category primitives
26572
26507
  * @since 3.10.0
26573
26508
  */
26574
- var Null = class extends make$10($null) {};
26509
+ var Null = class extends make$8($null) {};
26575
26510
  /**
26576
26511
  * @category primitives
26577
26512
  * @since 3.10.0
26578
26513
  */
26579
- var Never = class extends make$10(neverKeyword) {};
26514
+ var Never = class extends make$8(neverKeyword) {};
26580
26515
  /**
26581
26516
  * @category primitives
26582
26517
  * @since 3.10.0
26583
26518
  */
26584
- var Unknown = class extends make$10(unknownKeyword) {};
26519
+ var Unknown = class extends make$8(unknownKeyword) {};
26585
26520
  /**
26586
26521
  * @category primitives
26587
26522
  * @since 3.10.0
26588
26523
  */
26589
- var BigIntFromSelf = class extends make$10(bigIntKeyword) {};
26524
+ var BigIntFromSelf = class extends make$8(bigIntKeyword) {};
26590
26525
  /**
26591
26526
  * @category primitives
26592
26527
  * @since 3.10.0
26593
26528
  */
26594
- var SymbolFromSelf = class extends make$10(symbolKeyword) {};
26529
+ var SymbolFromSelf = class extends make$8(symbolKeyword) {};
26595
26530
  /** @ignore */
26596
- var String$ = class extends make$10(stringKeyword) {};
26531
+ var String$ = class extends make$8(stringKeyword) {};
26597
26532
  /** @ignore */
26598
- var Number$ = class extends make$10(numberKeyword) {};
26533
+ var Number$ = class extends make$8(numberKeyword) {};
26599
26534
  /** @ignore */
26600
- var Boolean$ = class extends make$10(booleanKeyword) {};
26535
+ var Boolean$ = class extends make$8(booleanKeyword) {};
26601
26536
  const getDefaultUnionAST = (members) => Union$1.make(members.map((m) => m.ast));
26602
26537
  function makeUnionClass(members, ast = getDefaultUnionAST(members)) {
26603
- return class UnionClass extends make$10(ast) {
26538
+ return class UnionClass extends make$8(ast) {
26604
26539
  static annotations(annotations) {
26605
26540
  return makeUnionClass(this.members, mergeSchemaAnnotations(this.ast, annotations));
26606
26541
  }
@@ -26645,7 +26580,7 @@ var ElementImpl = class ElementImpl {
26645
26580
  };
26646
26581
  const getDefaultTupleTypeAST = (elements, rest) => new TupleType(elements.map((el) => isSchema(el) ? new OptionalType(el.ast, false) : el.ast), rest.map((el) => isSchema(el) ? new Type$1(el.ast) : el.ast), true);
26647
26582
  function makeTupleTypeClass(elements, rest, ast = getDefaultTupleTypeAST(elements, rest)) {
26648
- return class TupleTypeClass extends make$10(ast) {
26583
+ return class TupleTypeClass extends make$8(ast) {
26649
26584
  static annotations(annotations) {
26650
26585
  return makeTupleTypeClass(this.elements, this.rest, mergeSchemaAnnotations(this.ast, annotations));
26651
26586
  }
@@ -26895,7 +26830,7 @@ const lazilyMergeDefaults = (fields, out) => {
26895
26830
  return out;
26896
26831
  };
26897
26832
  function makeTypeLiteralClass(fields, records, ast = getDefaultTypeLiteralAST(fields, records)) {
26898
- return class TypeLiteralClass extends make$10(ast) {
26833
+ return class TypeLiteralClass extends make$8(ast) {
26899
26834
  static annotations(annotations) {
26900
26835
  return makeTypeLiteralClass(this.fields, this.records, mergeSchemaAnnotations(this.ast, annotations));
26901
26836
  }
@@ -27107,19 +27042,19 @@ const intersectUnionMembers = (xs, ys, path) => flatMap$8(xs, (x) => flatMap$8(y
27107
27042
  * @category combinators
27108
27043
  * @since 3.10.0
27109
27044
  */
27110
- const extend = /*#__PURE__*/ dual(2, (self, that) => make$10(extendAST(self.ast, that.ast, [])));
27045
+ const extend = /*#__PURE__*/ dual(2, (self, that) => make$8(extendAST(self.ast, that.ast, [])));
27111
27046
  /**
27112
27047
  * @category constructors
27113
27048
  * @since 3.10.0
27114
27049
  */
27115
- const suspend = (f) => make$10(new Suspend(() => f().ast));
27050
+ const suspend = (f) => make$8(new Suspend(() => f().ast));
27116
27051
  /**
27117
27052
  * @since 3.10.0
27118
27053
  * @category symbol
27119
27054
  */
27120
27055
  const RefineSchemaId = /*#__PURE__*/ Symbol.for("effect/SchemaId/Refine");
27121
27056
  function makeRefineClass(from, filter, ast) {
27122
- return class RefineClass extends make$10(ast) {
27057
+ return class RefineClass extends make$8(ast) {
27123
27058
  static annotations(annotations) {
27124
27059
  return makeRefineClass(this.from, this.filter, mergeSchemaAnnotations(this.ast, annotations));
27125
27060
  }
@@ -27158,7 +27093,7 @@ function filter(predicate, annotations) {
27158
27093
  };
27159
27094
  }
27160
27095
  function makeTransformationClass(from, to, ast) {
27161
- return class TransformationClass extends make$10(ast) {
27096
+ return class TransformationClass extends make$8(ast) {
27162
27097
  static annotations(annotations) {
27163
27098
  return makeTransformationClass(this.from, this.to, mergeSchemaAnnotations(this.ast, annotations));
27164
27099
  }
@@ -28085,7 +28020,7 @@ const bigDecimalPretty = () => (val) => `BigDecimal(${format$1(normalize(val))})
28085
28020
  const bigDecimalArbitrary = () => (fc) => fc.tuple(fc.bigInt(), fc.integer({
28086
28021
  min: -18,
28087
28022
  max: 18
28088
- })).map(([value, scale]) => make$11(value, scale));
28023
+ })).map(([value, scale]) => make$9(value, scale));
28089
28024
  /**
28090
28025
  * @category BigDecimal constructors
28091
28026
  * @since 3.10.0
@@ -28247,7 +28182,7 @@ const makeClass = ({ Base, annotations, disableToString, fields, identifier, kin
28247
28182
  return pipeArguments(this, arguments);
28248
28183
  }
28249
28184
  static annotations(annotations) {
28250
- return make$10(this.ast).annotations(annotations);
28185
+ return make$8(this.ast).annotations(annotations);
28251
28186
  }
28252
28187
  static toString() {
28253
28188
  return `(${String(encodedSide)} <-> ${identifier})`;
@@ -28625,7 +28560,7 @@ const mkString = mkString$1;
28625
28560
  * @since 2.0.0
28626
28561
  * @category destructors
28627
28562
  */
28628
- const run$4 = run$5;
28563
+ const run$5 = run$6;
28629
28564
  /**
28630
28565
  * Runs the stream and collects all of its elements to a chunk.
28631
28566
  *
@@ -28772,7 +28707,7 @@ const makeExecutor$1 = (start) => {
28772
28707
  stream,
28773
28708
  string: (command, encoding = "utf-8") => {
28774
28709
  const decoder = new TextDecoder(encoding);
28775
- return pipe(start(command), flatMap$4((process) => run$4(process.stdout, collectUint8Array)), map$4((bytes) => decoder.decode(bytes)), scoped$3);
28710
+ return pipe(start(command), flatMap$4((process) => run$5(process.stdout, collectUint8Array)), map$4((bytes) => decoder.decode(bytes)), scoped$3);
28776
28711
  },
28777
28712
  lines: (command, encoding = "utf-8") => {
28778
28713
  return pipe(streamLines(command, encoding), runCollect, map$4(toArray$1));
@@ -28838,7 +28773,7 @@ const PipedProto = {
28838
28773
  };
28839
28774
  const makePiped = (options) => Object.assign(Object.create(PipedProto), options);
28840
28775
  /** @internal */
28841
- const make$9 = (command, ...args) => makeStandard({
28776
+ const make$7 = (command, ...args) => makeStandard({
28842
28777
  command,
28843
28778
  args,
28844
28779
  env: empty$18(),
@@ -28924,7 +28859,7 @@ const flatten = flatten$1;
28924
28859
  * @since 1.0.0
28925
28860
  * @category constructors
28926
28861
  */
28927
- const make$8 = make$9;
28862
+ const make$6 = make$7;
28928
28863
  /**
28929
28864
  * Specify the standard error stream for a command.
28930
28865
  *
@@ -29073,7 +29008,7 @@ const Size$1 = (bytes) => typeof bytes === "bigint" ? bytes : BigInt(bytes);
29073
29008
  const bigint1024 = /*#__PURE__*/ BigInt(1024);
29074
29009
  bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
29075
29010
  /** @internal */
29076
- const make$7 = (impl) => {
29011
+ const make$5 = (impl) => {
29077
29012
  return tag$1.of({
29078
29013
  ...impl,
29079
29014
  exists: (path) => pipe(impl.access(path), as(true), catchTag("SystemError", (e) => e.reason === "NotFound" ? succeed$3(false) : fail$7(e))),
@@ -29135,7 +29070,7 @@ const FileSystem = tag$1;
29135
29070
  * @since 1.0.0
29136
29071
  * @category constructor
29137
29072
  */
29138
- const make$6 = make$7;
29073
+ const make$4 = make$5;
29139
29074
  /**
29140
29075
  * @since 1.0.0
29141
29076
  * @category type id
@@ -29499,7 +29434,7 @@ var MailboxImpl = class extends Class {
29499
29434
  }
29500
29435
  };
29501
29436
  /** @internal */
29502
- const make$5 = (capacity) => withFiberRuntime$1((fiber) => succeed$8(new MailboxImpl(fiber.currentScheduler, typeof capacity === "number" ? capacity : capacity?.capacity ?? Number.POSITIVE_INFINITY, typeof capacity === "number" ? "suspend" : capacity?.strategy ?? "suspend")));
29437
+ const make$3 = (capacity) => withFiberRuntime$1((fiber) => succeed$8(new MailboxImpl(fiber.currentScheduler, typeof capacity === "number" ? capacity : capacity?.capacity ?? Number.POSITIVE_INFINITY, typeof capacity === "number" ? "suspend" : capacity?.strategy ?? "suspend")));
29503
29438
  /** @internal */
29504
29439
  const toChannel$1 = (self) => {
29505
29440
  const loop = flatMap$3(self.takeAll, ([messages, done]) => done ? messages.length === 0 ? void_$1 : write$1(messages) : zipRight(write$1(messages), loop));
@@ -29554,7 +29489,7 @@ const isMailbox = (u) => hasProperty(u, TypeId$3);
29554
29489
  * })
29555
29490
  * ```
29556
29491
  */
29557
- const make$4 = make$5;
29492
+ const make$2 = make$3;
29558
29493
  /**
29559
29494
  * Create a `Channel` from a `Mailbox`.
29560
29495
  *
@@ -29657,7 +29592,7 @@ const unsafeMake = (backing, deferred) => {
29657
29592
  * @since 2.0.0
29658
29593
  * @categories constructors
29659
29594
  */
29660
- const make$3 = () => acquireRelease(map$4(make$35(), (deferred) => unsafeMake(/* @__PURE__ */ new Set(), deferred)), (set) => withFiberRuntime((parent) => {
29595
+ const make$1 = () => acquireRelease(map$4(make$33(), (deferred) => unsafeMake(/* @__PURE__ */ new Set(), deferred)), (set) => withFiberRuntime((parent) => {
29661
29596
  const state = set.state;
29662
29597
  if (state._tag === "Closed") return _void;
29663
29598
  set.state = { _tag: "Closed" };
@@ -29665,7 +29600,7 @@ const make$3 = () => acquireRelease(map$4(make$35(), (deferred) => unsafeMake(/*
29665
29600
  return interruptAllAs(fibers, combine$5(parent.id(), internalFiberId)).pipe(intoDeferred(set.deferred));
29666
29601
  }));
29667
29602
  const internalFiberIdId = -1;
29668
- const internalFiberId = /*#__PURE__*/ make$39(internalFiberIdId, 0);
29603
+ const internalFiberId = /*#__PURE__*/ make$37(internalFiberIdId, 0);
29669
29604
  const isInternalInterruption = /*#__PURE__*/ reduceWithContext(void 0, {
29670
29605
  emptyCase: constFalse,
29671
29606
  failCase: constFalse,
@@ -29876,7 +29811,7 @@ const layerManager$3 = /*#__PURE__*/ effect$1(WorkerManager, /* @__PURE__ */ gen
29876
29811
  const requestMap = /* @__PURE__ */ new Map();
29877
29812
  const collector = unsafeMakeCollector();
29878
29813
  const wrappedEncode = encode ? (message) => zipRight$1(collector.clear, provideService(encode(message), Collector, collector)) : succeed$3;
29879
- const readyLatch = yield* make$35();
29814
+ const readyLatch = yield* make$33();
29880
29815
  const backing = yield* platform.spawn(id);
29881
29816
  yield* backing.run((message) => {
29882
29817
  if (message[0] === 0) return complete$1(readyLatch, _void);
@@ -29927,8 +29862,8 @@ const layerManager$3 = /*#__PURE__*/ effect$1(WorkerManager, /* @__PURE__ */ gen
29927
29862
  const release = sync$1(() => requestMap.delete(id));
29928
29863
  return isFailure(exit) ? zipRight$1(orDie(backing.send([id, 1])), release) : release;
29929
29864
  };
29930
- const execute = (request) => fromChannel$1(acquireUseRelease(executeAcquire(request, make$4()), ({ mailbox }) => toChannel(mailbox), executeRelease));
29931
- const executeEffect = (request) => acquireUseRelease$2(executeAcquire(request, make$35()), ({ mailbox }) => _await$2(mailbox), executeRelease);
29865
+ const execute = (request) => fromChannel$1(acquireUseRelease(executeAcquire(request, make$2()), ({ mailbox }) => toChannel(mailbox), executeRelease));
29866
+ const executeEffect = (request) => acquireUseRelease$2(executeAcquire(request, make$33()), ({ mailbox }) => _await$2(mailbox), executeRelease);
29932
29867
  yield* _await$2(readyLatch);
29933
29868
  if (initialMessage) yield* sync$1(initialMessage).pipe(flatMap$4(executeEffect), mapError$1((cause) => new WorkerError({
29934
29869
  reason: "spawn",
@@ -29962,7 +29897,7 @@ const makePlatform$1 = () => (options) => PlatformWorker$1.of({
29962
29897
  currentPort = void 0;
29963
29898
  }));
29964
29899
  const runtime$5 = (yield* runtime()).pipe(updateContext(omit$1(Scope)));
29965
- const fiberSet = yield* make$3();
29900
+ const fiberSet = yield* make$1();
29966
29901
  const runFork$3 = runFork(runtime$5);
29967
29902
  yield* options.listen({
29968
29903
  port,
@@ -30340,7 +30275,7 @@ const writeFile$1 = (path, data, options) => async((resume, signal) => {
30340
30275
  * @since 1.0.0
30341
30276
  * @category layer
30342
30277
  */
30343
- const layer$7 = /* @__PURE__ */ effect$1(FileSystem, /* @__PURE__ */ map$4(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$6({
30278
+ const layer$7 = /* @__PURE__ */ effect$1(FileSystem, /* @__PURE__ */ map$4(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$4({
30344
30279
  access,
30345
30280
  chmod,
30346
30281
  chown,
@@ -30373,7 +30308,7 @@ const layer$7 = /* @__PURE__ */ effect$1(FileSystem, /* @__PURE__ */ map$4(/*#__
30373
30308
  /** @internal */
30374
30309
  const fromReadable = (evaluate, onError, options) => fromChannel$1(fromReadableChannel(evaluate, onError, options));
30375
30310
  /** @internal */
30376
- const fromReadableChannel = (evaluate, onError, options) => suspend$1(() => unsafeReadableRead(evaluate(), onError, make$41(void 0), options));
30311
+ const fromReadableChannel = (evaluate, onError, options) => suspend$1(() => unsafeReadableRead(evaluate(), onError, make$39(void 0), options));
30377
30312
  /** @internal */
30378
30313
  const writeInput = (writable, onFailure, { encoding, endOnDone = true } = {}, onDone = _void) => {
30379
30314
  const write = writeEffect(writable, encoding);
@@ -30449,7 +30384,7 @@ const unsafeReadableRead = (readable, onError, exit, options) => {
30449
30384
  /** @internal */
30450
30385
  const fromWritable = (evaluate, onError, options) => fromChannel(fromWritableChannel(evaluate, onError, options));
30451
30386
  /** @internal */
30452
- const fromWritableChannel = (writable, onError, options) => flatMap$1(zip$1(sync$1(() => writable()), make$35()), ([writable, deferred]) => embedInput(writableOutput(writable, deferred, onError), writeInput(writable, (cause) => failCause$5(deferred, cause), options, complete$1(deferred, _void))));
30387
+ const fromWritableChannel = (writable, onError, options) => flatMap$1(zip$1(sync$1(() => writable()), make$33()), ([writable, deferred]) => embedInput(writableOutput(writable, deferred, onError), writeInput(writable, (cause) => failCause$5(deferred, cause), options, complete$1(deferred, _void))));
30453
30388
  const writableOutput = (writable, deferred, onError) => suspend$5(() => {
30454
30389
  function handleError(err) {
30455
30390
  unsafeDone(deferred, fail$7(onError(err)));
@@ -30484,7 +30419,7 @@ const ProcessProto = {
30484
30419
  const runCommand$1 = (fileSystem) => (command) => {
30485
30420
  switch (command._tag) {
30486
30421
  case "StandardCommand": {
30487
- const spawn = flatMap$4(make$35(), (exitCode) => async((resume) => {
30422
+ const spawn = flatMap$4(make$33(), (exitCode) => async((resume) => {
30488
30423
  const handle = ChildProcess.spawn(command.command, command.args, {
30489
30424
  stdio: [
30490
30425
  inputToStdioOption(command.stdin),
@@ -30553,7 +30488,7 @@ const runCommand$1 = (fileSystem) => (command) => {
30553
30488
  stderr,
30554
30489
  stdout
30555
30490
  });
30556
- }), typeof command.stdin === "string" ? identity$1 : tap((process) => forkDaemon(run$4(command.stdin, process.stdin))));
30491
+ }), typeof command.stdin === "string" ? identity$1 : tap((process) => forkDaemon(run$5(command.stdin, process.stdin))));
30557
30492
  }
30558
30493
  case "PipedCommand": {
30559
30494
  const flattened = flatten(command);
@@ -30626,7 +30561,7 @@ const defaultShouldQuit = (input) => input.key.ctrl && (input.key.name === "c" |
30626
30561
  const layer = /*#__PURE__*/ pipe(/*#__PURE__*/ mergeAll$1(layer$3, layer$5, /* @__PURE__ */ scoped$2(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
30627
30562
  const stdin = process.stdin;
30628
30563
  const stdout = process.stdout;
30629
- const rlRef = yield* make$13({ acquire: acquireRelease(sync$1(() => {
30564
+ const rlRef = yield* make$11({ acquire: acquireRelease(sync$1(() => {
30630
30565
  const rl = readline.createInterface({
30631
30566
  input: stdin,
30632
30567
  escapeCodeTimeout: 50
@@ -30643,7 +30578,7 @@ const layer = /*#__PURE__*/ pipe(/*#__PURE__*/ mergeAll$1(layer$3, layer$5, /* @
30643
30578
  const isTTY = sync$1(() => Boolean(stdout.isTTY));
30644
30579
  const readInput = gen(function* () {
30645
30580
  yield* get(rlRef);
30646
- const mailbox = yield* make$4();
30581
+ const mailbox = yield* make$2();
30647
30582
  const handleKeypress = (s, k) => {
30648
30583
  const userInput = {
30649
30584
  input: fromNullable(s),
@@ -30682,9 +30617,9 @@ const layer = /*#__PURE__*/ pipe(/*#__PURE__*/ mergeAll$1(layer$3, layer$5, /* @
30682
30617
  readLine,
30683
30618
  display
30684
30619
  });
30685
- }))(defaultShouldQuit)), /* @__PURE__ */ provide$1(layerManager$2, /* @__PURE__ */ succeed$2(PlatformWorker, /* @__PURE__ */ makePlatform()({
30620
+ }))(defaultShouldQuit)), /* @__PURE__ */ provide(layerManager$2, /* @__PURE__ */ succeed$2(PlatformWorker, /* @__PURE__ */ makePlatform()({
30686
30621
  setup({ scope, worker }) {
30687
- return flatMap$4(make$35(), (exitDeferred) => {
30622
+ return flatMap$4(make$33(), (exitDeferred) => {
30688
30623
  const thing = "postMessage" in worker ? {
30689
30624
  postMessage(msg, t) {
30690
30625
  worker.postMessage(msg, t);
@@ -30764,105 +30699,6 @@ const runMain = /* @__PURE__ */ makeRunMain(({ fiber, teardown }) => {
30764
30699
  process.on("SIGTERM", onSigint);
30765
30700
  });
30766
30701
  //#endregion
30767
- //#region node_modules/effect/dist/esm/internal/managedRuntime.js
30768
- function provide(managed, effect) {
30769
- return flatMap$6(managed.runtimeEffect, (rt) => withFiberRuntime$1((fiber) => {
30770
- fiber.setFiberRefs(rt.fiberRefs);
30771
- fiber.currentRuntimeFlags = rt.runtimeFlags;
30772
- return provideContext$1(effect, rt.context);
30773
- }));
30774
- }
30775
- const ManagedRuntimeProto = {
30776
- ...CommitPrototype,
30777
- [TypeId$13]: TypeId$13,
30778
- pipe() {
30779
- return pipeArguments(this, arguments);
30780
- },
30781
- commit() {
30782
- return this.runtimeEffect;
30783
- }
30784
- };
30785
- /** @internal */
30786
- const make$1 = (layer, memoMap) => {
30787
- memoMap = memoMap ?? unsafeMakeMemoMap();
30788
- const scope = unsafeRunSyncEffect(scopeMake());
30789
- let buildFiber;
30790
- const runtimeEffect = withFiberRuntime$1((fiber) => {
30791
- if (!buildFiber) buildFiber = unsafeForkEffect(tap$1(extend$1(toRuntimeWithMemoMap(layer, memoMap), scope), (rt) => {
30792
- self.cachedRuntime = rt;
30793
- }), {
30794
- scope,
30795
- scheduler: fiber.currentScheduler
30796
- });
30797
- return flatten$7(buildFiber.await);
30798
- });
30799
- const self = Object.assign(Object.create(ManagedRuntimeProto), {
30800
- memoMap,
30801
- scope,
30802
- runtimeEffect,
30803
- cachedRuntime: void 0,
30804
- runtime() {
30805
- return self.cachedRuntime === void 0 ? unsafeRunPromiseEffect(self.runtimeEffect) : Promise.resolve(self.cachedRuntime);
30806
- },
30807
- dispose() {
30808
- return unsafeRunPromiseEffect(self.disposeEffect);
30809
- },
30810
- disposeEffect: suspend$7(() => {
30811
- self.runtimeEffect = die$3("ManagedRuntime disposed");
30812
- self.cachedRuntime = void 0;
30813
- return close(self.scope, exitVoid$1);
30814
- }),
30815
- runFork(effect, options) {
30816
- return self.cachedRuntime === void 0 ? unsafeForkEffect(provide(self, effect), options) : unsafeFork(self.cachedRuntime)(effect, options);
30817
- },
30818
- runSyncExit(effect) {
30819
- return self.cachedRuntime === void 0 ? unsafeRunSyncExitEffect(provide(self, effect)) : unsafeRunSyncExit(self.cachedRuntime)(effect);
30820
- },
30821
- runSync(effect) {
30822
- return self.cachedRuntime === void 0 ? unsafeRunSyncEffect(provide(self, effect)) : unsafeRunSync(self.cachedRuntime)(effect);
30823
- },
30824
- runPromiseExit(effect, options) {
30825
- return self.cachedRuntime === void 0 ? unsafeRunPromiseExitEffect(provide(self, effect), options) : unsafeRunPromiseExit(self.cachedRuntime)(effect, options);
30826
- },
30827
- runCallback(effect, options) {
30828
- return self.cachedRuntime === void 0 ? unsafeRunCallback(defaultRuntime)(provide(self, effect), options) : unsafeRunCallback(self.cachedRuntime)(effect, options);
30829
- },
30830
- runPromise(effect, options) {
30831
- return self.cachedRuntime === void 0 ? unsafeRunPromiseEffect(provide(self, effect), options) : unsafeRunPromise(self.cachedRuntime)(effect, options);
30832
- }
30833
- });
30834
- return self;
30835
- };
30836
- //#endregion
30837
- //#region node_modules/effect/dist/esm/ManagedRuntime.js
30838
- /**
30839
- * Convert a Layer into an ManagedRuntime, that can be used to run Effect's using
30840
- * your services.
30841
- *
30842
- * @since 2.0.0
30843
- * @category runtime class
30844
- * @example
30845
- * ```ts
30846
- * import { Console, Effect, Layer, ManagedRuntime } from "effect"
30847
- *
30848
- * class Notifications extends Effect.Tag("Notifications")<
30849
- * Notifications,
30850
- * { readonly notify: (message: string) => Effect.Effect<void> }
30851
- * >() {
30852
- * static Live = Layer.succeed(this, { notify: (message) => Console.log(message) })
30853
- * }
30854
- *
30855
- * async function main() {
30856
- * const runtime = ManagedRuntime.make(Notifications.Live)
30857
- * await runtime.runPromise(Notifications.notify("Hello, world!"))
30858
- * await runtime.dispose()
30859
- * }
30860
- *
30861
- * main()
30862
- * ```
30863
- */
30864
- const make = make$1;
30865
- //#endregion
30866
30702
  //#region src/platform/Host.ts
30867
30703
  const toError$1 = (e) => e instanceof Error ? e : new Error(String(e));
30868
30704
  const makeHostOps = (opts) => ({
@@ -30994,8 +30830,8 @@ const classifyUntracked = (exec, ref, untrackedPaths) => gen(function* () {
30994
30830
  * `git add`. Callers that expect a probe to fail handle it with an explicit
30995
30831
  * `catchAll`.
30996
30832
  */
30997
- const run$3 = (root, ...args) => scoped$3(gen(function* () {
30998
- const process = yield* (yield* CommandExecutor).start(make$8(...args).pipe(workingDirectory(root), stdout("pipe"), stderr("pipe")));
30833
+ const run$4 = (root, ...args) => scoped$3(gen(function* () {
30834
+ const process = yield* (yield* CommandExecutor).start(make$6(...args).pipe(workingDirectory(root), stdout("pipe"), stderr("pipe")));
30999
30835
  const collect = (stream) => stream.pipe(decodeText(), mkString);
31000
30836
  const [stdout$3, stderr$3, exitCode] = yield* all$1([
31001
30837
  collect(process.stdout),
@@ -31028,7 +30864,7 @@ var InvalidRefError = class extends Error {
31028
30864
  */
31029
30865
  const resolvedRefOrCorrupted = (ref, hash) => /^[0-9a-f]{40}$/.test(hash) ? succeed$3(hash) : fail$7(new InvalidRefError(`Invalid ref: ${ref}`, [`ref: ${ref}`]));
31030
30866
  const makeGitImpl = (executor, root) => {
31031
- const exec = (...args) => run$3(root, ...args).pipe(provide$2(succeed$2(CommandExecutor, executor)));
30867
+ const exec = (...args) => run$4(root, ...args).pipe(provide$1(succeed$2(CommandExecutor, executor)));
31032
30868
  return {
31033
30869
  lastCommitSubject: (ref = "HEAD") => exec("git", "log", "-1", "--pretty=%s", ref).pipe(map$4((s) => s.trim())),
31034
30870
  lastCommitMessage: () => exec("git", "log", "-1", "--pretty=%B").pipe(map$4((s) => s.trim())),
@@ -31053,7 +30889,7 @@ const makeGitImpl = (executor, root) => {
31053
30889
  }),
31054
30890
  resolveRef: (ref) => exec("git", "rev-parse", "--verify", ref).pipe(map$4((s) => s.trim()), flatMap$4((hash) => resolvedRefOrCorrupted(ref, hash))),
31055
30891
  readRefOption: (ref) => exec("git", "rev-parse", "--verify", "--quiet", ref).pipe(map$4((s) => some(s.trim())), catchAll(() => succeed$3(none$4()))),
31056
- isAncestor: (a, b) => run$3(root, "git", "merge-base", "--is-ancestor", a, b).pipe(provide$2(succeed$2(CommandExecutor, executor)), map$4(() => true), catchAll(() => succeed$3(false))),
30892
+ isAncestor: (a, b) => run$4(root, "git", "merge-base", "--is-ancestor", a, b).pipe(provide$1(succeed$2(CommandExecutor, executor)), map$4(() => true), catchAll(() => succeed$3(false))),
31057
30893
  mergeBase: (a, b) => exec("git", "merge-base", a, b).pipe(map$4((s) => some(s.trim())), catchAll(() => succeed$3(none$4()))),
31058
30894
  defaultBranch: () => exec("git", "symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD").pipe(map$4((s) => s.trim()), catchAll(() => succeed$3("")), map$4((name) => name === "" ? "main" : name)),
31059
30895
  topLevel: () => exec("git", "rev-parse", "--show-toplevel").pipe(map$4((s) => s.trim())),
@@ -31647,7 +31483,7 @@ var CommandRunner = class CommandRunner extends Tag("CommandRunner")() {
31647
31483
  const { root } = yield* Host;
31648
31484
  const executor = yield* CommandExecutor;
31649
31485
  return { bash: (command) => scoped$3(gen(function* () {
31650
- const process = yield* executor.start(make$8("bash", "-c", command).pipe(workingDirectory(root), stdout("pipe"), stderr("pipe")));
31486
+ const process = yield* executor.start(make$6("bash", "-c", command).pipe(workingDirectory(root), stdout("pipe"), stderr("pipe")));
31651
31487
  const collect = (stream) => stream.pipe(decodeText(), mkString);
31652
31488
  const [stdout$2, stderr$2, status] = yield* all$1([
31653
31489
  collect(process.stdout),
@@ -32395,7 +32231,7 @@ const human = (name, options = {}) => ctx().step({
32395
32231
  options
32396
32232
  });
32397
32233
  /** A check: `body` runs at the edge and its effect on the tree is committed. */
32398
- const run$2 = (name, body, options = {}) => ctx().step({
32234
+ const run$3 = (name, body, options = {}) => ctx().step({
32399
32235
  kind: "run",
32400
32236
  name,
32401
32237
  body,
@@ -32599,7 +32435,7 @@ const wrote = (path) => changes(path).some((c) => c.status !== "deleted");
32599
32435
  */
32600
32436
  const check = async (name, command, options) => {
32601
32437
  const { report, label, sweep, sweepOnGreen, preamble } = options;
32602
- await run$2(name, checkScript(command, {
32438
+ await run$3(name, checkScript(command, {
32603
32439
  report,
32604
32440
  stamp: head().slice(0, 7),
32605
32441
  sweep,
@@ -32855,7 +32691,7 @@ var flows_exports = /* @__PURE__ */ __exportAll({
32855
32691
  restart: () => restart,
32856
32692
  restoreScript: () => restoreScript,
32857
32693
  revertScript: () => revertScript,
32858
- run: () => run$2,
32694
+ run: () => run$3,
32859
32695
  scope: () => scope,
32860
32696
  sectionBodies: () => sectionBodies,
32861
32697
  sections: () => sections,
@@ -49222,6 +49058,13 @@ const parseJson$1 = (raw) => {
49222
49058
  const TRAILER_RE = /^(Gtd-[A-Za-z-]+):[ \t]*(.*?)[ \t]*$/gm;
49223
49059
  const COST_RE = /^([0-9]+(?:\.[0-9]+)?)(?:[ \t]+(.+))?$/;
49224
49060
  const VAR_RE = /^([^=\s]+)=(.*)$/;
49061
+ const CONFIG_RE = /^([0-9a-f]{16}) (.+)$/;
49062
+ const CONTROL_CHARACTER$1 = /[\x00-\x1f\x7f-\x9f]/;
49063
+ const encodePath = (path) => path.trim() !== path || path.startsWith("\"") || CONTROL_CHARACTER$1.test(path) ? JSON.stringify(path) : path;
49064
+ const decodePath = (raw) => {
49065
+ const path = raw.startsWith("\"") ? parseJson$1(raw) : raw;
49066
+ return typeof path === "string" && path !== "" && !CONTROL_CHARACTER$1.test(path) ? path : void 0;
49067
+ };
49225
49068
  const FORMAT_RE = /^[1-9][0-9]*$/;
49226
49069
  const TRAILER_READERS = {
49227
49070
  "Gtd-Step": (value, into) => {
@@ -49238,6 +49081,11 @@ const TRAILER_READERS = {
49238
49081
  const kv = VAR_RE.exec(value);
49239
49082
  if (kv !== null) into.vars[kv[1]] = kv[2];
49240
49083
  },
49084
+ "Gtd-Config": (value, into) => {
49085
+ const entry = CONFIG_RE.exec(value);
49086
+ const path = entry === null ? void 0 : decodePath(entry[2]);
49087
+ if (path !== void 0) into.config[path] = entry[1];
49088
+ },
49241
49089
  "Gtd-Review-Base": (value, into) => {
49242
49090
  into.reviewBase ??= value.split(/\s/)[0];
49243
49091
  },
@@ -49261,6 +49109,7 @@ const parseCommitMessage = (message) => {
49261
49109
  reviewBase: void 0,
49262
49110
  judge: [],
49263
49111
  vars: {},
49112
+ config: {},
49264
49113
  cost: [],
49265
49114
  format: void 0
49266
49115
  };
@@ -49272,13 +49121,15 @@ const parseCommitMessage = (message) => {
49272
49121
  format: trailers.format ?? 1
49273
49122
  };
49274
49123
  };
49124
+ const sortedEntries = (record = {}) => Object.entries(record).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
49275
49125
  /** Trailer order is fixed so the same spec always yields the same bytes. */
49276
49126
  const formatCommitMessage = (spec) => {
49277
49127
  const lines = [];
49278
49128
  if (spec.step !== void 0) lines.push(`Gtd-Step: ${formatStepId(spec.step)}`);
49279
49129
  if (spec.workflow !== void 0) lines.push(`Gtd-Workflow: ${spec.workflow}`);
49280
49130
  if (spec.reviewBase !== void 0) lines.push(`Gtd-Review-Base: ${spec.reviewBase}`);
49281
- for (const [name, value] of Object.entries(spec.vars ?? {}).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) lines.push(`Gtd-Var: ${name}=${value}`);
49131
+ for (const [name, value] of sortedEntries(spec.vars)) lines.push(`Gtd-Var: ${name}=${value}`);
49132
+ for (const [path, hash] of sortedEntries(spec.config)) lines.push(`Gtd-Config: ${hash} ${encodePath(path)}`);
49282
49133
  if (spec.cost !== void 0) lines.push(`Gtd-Cost: ${spec.cost.cost}${spec.cost.model !== void 0 ? ` ${spec.cost.model}` : ""}`);
49283
49134
  for (const verdict of spec.judge ?? []) lines.push(`Gtd-Judge: ${JSON.stringify(verdict)}`);
49284
49135
  lines.push(`Gtd-Format: 1`);
@@ -50438,6 +50289,35 @@ const resolveScopeAccess = (def, skills, vars) => gen(function* () {
50438
50289
  //#region src/workflow/Workflow.ts
50439
50290
  const knownModes = (def) => Object.keys(def.modes);
50440
50291
  //#endregion
50292
+ //#region src/workflow/fingerprint.ts
50293
+ const HASH_LENGTH = 16;
50294
+ const CONTROL_CHARACTER = /[\x00-\x1f\x7f-\x9f]/;
50295
+ const contentHash = (content) => createHash("sha256").update(content).digest("hex").slice(0, HASH_LENGTH);
50296
+ const realOr = (path) => {
50297
+ try {
50298
+ return realpathSync(path);
50299
+ } catch {
50300
+ return path;
50301
+ }
50302
+ };
50303
+ const configFingerprint = (files, root) => {
50304
+ const fingerprint = {};
50305
+ const realRoot = realOr(root);
50306
+ for (const file of files) {
50307
+ const path = relative(realRoot, realOr(file)).split(sep).join("/");
50308
+ if (CONTROL_CHARACTER.test(path)) continue;
50309
+ let content;
50310
+ try {
50311
+ content = readFileSync(file);
50312
+ } catch {
50313
+ continue;
50314
+ }
50315
+ fingerprint[path] = contentHash(content);
50316
+ }
50317
+ return fingerprint;
50318
+ };
50319
+ const changedConfigFiles = (recorded, current) => [.../* @__PURE__ */ new Set([...Object.keys(recorded), ...Object.keys(current)])].filter((path) => recorded[path] !== current[path]).sort();
50320
+ //#endregion
50441
50321
  //#region src/judges/providers/fixed.ts
50442
50322
  const fail$3 = (message) => {
50443
50323
  throw new Error(`gtd judge run: ${message}`);
@@ -50689,7 +50569,7 @@ const toLlmVerdicts = (questions, stdout) => {
50689
50569
  if (missing.length > 0) return fail$1(`claude answered ${questions.length - missing.length} of ${questions.length} questions; missing ${missing.map((q) => q.id).join(", ")}`);
50690
50570
  return questions.map((q) => toVerdict(q, out[q.id]));
50691
50571
  };
50692
- const run$1 = (argv, stdin, { env, cwd, timeoutMs }) => new Promise((resolve, reject) => {
50572
+ const run$2 = (argv, stdin, { env, cwd, timeoutMs }) => new Promise((resolve, reject) => {
50693
50573
  const child = execFile("claude", argv, {
50694
50574
  cwd,
50695
50575
  env,
@@ -50707,7 +50587,7 @@ const run$1 = (argv, stdin, { env, cwd, timeoutMs }) => new Promise((resolve, re
50707
50587
  const llm = ({ env, cwd, model = DEFAULT_MODEL, timeoutMs = TIMEOUT_MS }) => async (questions, state) => {
50708
50588
  const schema = JSON.stringify(toSchema(questions));
50709
50589
  const prompt = toPrompt(questions, state);
50710
- const stdout = await run$1([
50590
+ const stdout = await run$2([
50711
50591
  "-p",
50712
50592
  "--model",
50713
50593
  model,
@@ -50871,7 +50751,7 @@ function isAsyncIterable(value) {
50871
50751
  /**
50872
50752
  * Run an IIFE
50873
50753
  */
50874
- const run = (fn) => fn();
50754
+ const run$1 = (fn) => fn();
50875
50755
  function identity(it) {
50876
50756
  return it;
50877
50757
  }
@@ -52807,7 +52687,7 @@ const sseHeaders = {
52807
52687
  var import_wrapAsyncGenerator = __toESM(require_wrapAsyncGenerator(), 1);
52808
52688
  var import_objectSpread2$4 = __toESM(require_objectSpread2(), 1);
52809
52689
  function errorToAsyncIterable(err) {
52810
- return run((0, import_wrapAsyncGenerator.default)(function* () {
52690
+ return run$1((0, import_wrapAsyncGenerator.default)(function* () {
52811
52691
  throw err;
52812
52692
  }));
52813
52693
  }
@@ -52903,7 +52783,7 @@ async function resolveResponse(opts) {
52903
52783
  if (req.method === "HEAD") return new Response(null, { status: 204 });
52904
52784
  const allowBatching = (_ref = (_opts$allowBatching = opts.allowBatching) !== null && _opts$allowBatching !== void 0 ? _opts$allowBatching : (_opts$batching = opts.batching) === null || _opts$batching === void 0 ? void 0 : _opts$batching.enabled) !== null && _ref !== void 0 ? _ref : true;
52905
52785
  const allowMethodOverride = ((_opts$allowMethodOver = opts.allowMethodOverride) !== null && _opts$allowMethodOver !== void 0 ? _opts$allowMethodOver : false) && req.method === "POST";
52906
- const infoTuple = await run(async () => {
52786
+ const infoTuple = await run$1(async () => {
52907
52787
  try {
52908
52788
  return [void 0, await getRequestInfo({
52909
52789
  req,
@@ -52918,7 +52798,7 @@ async function resolveResponse(opts) {
52918
52798
  return [getTRPCErrorFromUnknown(cause), void 0];
52919
52799
  }
52920
52800
  });
52921
- const ctxManager = run(() => {
52801
+ const ctxManager = run$1(() => {
52922
52802
  let result = void 0;
52923
52803
  return {
52924
52804
  valueOrUndefined: () => {
@@ -53049,7 +52929,7 @@ async function resolveResponse(opts) {
53049
52929
  });
53050
52930
  }
53051
52931
  case "subscription": {
53052
- const iterable = run(() => {
52932
+ const iterable = run$1(() => {
53053
52933
  if (error) return errorToAsyncIterable(error);
53054
52934
  if (!experimentalSSE) return errorToAsyncIterable(new TRPCError({
53055
52935
  code: "METHOD_NOT_SUPPORTED",
@@ -53767,7 +53647,7 @@ async function nodeHTTPRequestHandler(opts) {
53767
53647
  resolve();
53768
53648
  });
53769
53649
  return handleViaMiddleware(opts.req, opts.res, (err) => {
53770
- run(async () => {
53650
+ run$1(async () => {
53771
53651
  var _opts$maxBodySize;
53772
53652
  const request = incomingMessageToRequest(opts.req, opts.res, { maxBodySize: (_opts$maxBodySize = opts.maxBodySize) !== null && _opts$maxBodySize !== void 0 ? _opts$maxBodySize : null });
53773
53653
  const createContext = async (innerOpts) => {
@@ -53799,7 +53679,7 @@ function createHandler(opts) {
53799
53679
  const sliceLength = ((_opts$basePath = opts.basePath) !== null && _opts$basePath !== void 0 ? _opts$basePath : "/").length;
53800
53680
  return (req, res) => {
53801
53681
  let path = "";
53802
- run(async () => {
53682
+ run$1(async () => {
53803
53683
  path = createURL(req).pathname.slice(sliceLength);
53804
53684
  await nodeHTTPRequestHandler((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
53805
53685
  req,
@@ -55478,7 +55358,7 @@ const runUiCommand = (options, config, out, root) => gen(function* () {
55478
55358
  headSha: liveHeadSha,
55479
55359
  readFile: liveReadFile
55480
55360
  };
55481
- const handoffDeferred = yield* make$35();
55361
+ const handoffDeferred = yield* make$33();
55482
55362
  const endServer = () => {
55483
55363
  runFork(runtime$4)(succeed$7(handoffDeferred, void 0));
55484
55364
  };
@@ -56082,7 +55962,8 @@ const checkOverrides = (commandLabel, varOverrides, declaredNames, envNames) =>
56082
55962
  * `gtd --workflow <name>`: start a brand NEW process on a workflow, writing an
56083
55963
  * opening commit that names the workflow's first step and carries a
56084
55964
  * `Gtd-Workflow:` trailer, every process setting as a `Gtd-Var:` trailer, plus
56085
- * a `Gtd-Review-Base:` trailer when the workflow fixes the process's diff base.
55965
+ * a `Gtd-Review-Base:` trailer when the workflow fixes the process's diff base,
55966
+ * and a `Gtd-Config:` trailer per config file.
56086
55967
  * All validation is a REFUSAL, not an Effect failure.
56087
55968
  */
56088
55969
  const planStart = (current, actor, start) => gen(function* () {
@@ -56117,7 +55998,8 @@ const planStart = (current, actor, start) => gen(function* () {
56117
55998
  to: firstStep,
56118
55999
  workflow: name,
56119
56000
  ...base !== void 0 ? { reviewBase: base } : {},
56120
- vars
56001
+ vars,
56002
+ config: start.config
56121
56003
  })
56122
56004
  }
56123
56005
  }, {
@@ -56218,6 +56100,15 @@ const runOf = (history, location, closingHash = void 0) => {
56218
56100
  const fault = historyFormatFault(history, location);
56219
56101
  return fault === void 0 ? succeed$3(buildRun(history, location, closingHash)) : fail$7(new Error(fault));
56220
56102
  };
56103
+ const pinnedConfigOf = (history) => {
56104
+ for (let i = history.length - 1; i >= 0; i--) {
56105
+ const files = parseCommitMessage(history[i].message).config;
56106
+ if (Object.keys(files).length > 0) return {
56107
+ commit: history[i].hash,
56108
+ files
56109
+ };
56110
+ }
56111
+ };
56221
56112
  const buildRun = (history, location, closingHash) => {
56222
56113
  const processCommits = history.slice(location.processStart);
56223
56114
  const parsed = processCommits.map((c) => parseCommitMessage(c.message));
@@ -56234,6 +56125,7 @@ const buildRun = (history, location, closingHash) => {
56234
56125
  costEntries: parsed.flatMap(costEntriesOf),
56235
56126
  judgeVerdicts: parsed.flatMap((m) => m.judge),
56236
56127
  pinnedVars: { ...first?.vars },
56128
+ pinnedConfig: pinnedConfigOf(history.slice(Math.max(location.baseIndex, 0))),
56237
56129
  headTurn: headTurnOf(head),
56238
56130
  closingHash,
56239
56131
  episode: {
@@ -56322,6 +56214,18 @@ const findBoundaryBase = (git, def, head) => gen(function* () {
56322
56214
  });
56323
56215
  const historyUpTo = (git, def, head) => flatMap$4(findBoundaryBase(git, def, head), ({ base, head: resolvedHead }) => git.commitHistory(base, resolvedHead));
56324
56216
  const computeProcessRun = (git, def, head) => flatMap$4(historyUpTo(git, def, head), (history) => runOf(history, locateEpisode(def, history)));
56217
+ const changedSinceStart = (pinned, current, workspace) => {
56218
+ if (pinned === void 0) return [];
56219
+ return changedConfigFiles(pinned.files, current).filter((path) => {
56220
+ const committed = workspace.readCommittedSync(path, pinned.commit);
56221
+ return current[path] === void 0 || committed === void 0 || contentHash(committed) !== current[path];
56222
+ });
56223
+ };
56224
+ const warnConfigChanges = (run, current, workspace) => gen(function* () {
56225
+ const changed = changedSinceStart(run.pinnedConfig, current, workspace);
56226
+ if (changed.length === 0) return;
56227
+ yield* (yield* Narrator).warn(`gtd: warning: the config changed since this process started (${changed.join(", ")}) — the rest of the process replays under the changed config`);
56228
+ });
56325
56229
  /** The run alone, never replaying — `gtd abandon` must work even when replay would refuse, short of a history it cannot read. */
56326
56230
  const currentRun = gen(function* () {
56327
56231
  const git = yield* GitService;
@@ -56621,6 +56525,8 @@ const restAt = (ref, startOverrides = {}) => gen(function* () {
56621
56525
  path: e.path
56622
56526
  })) : [];
56623
56527
  const memory = memoryOf(outcome.trace, run);
56528
+ const configNow = configFingerprint(config.workflowFiles, host.root);
56529
+ if (ref === void 0) yield* warnConfigChanges(run, configNow, workspace);
56624
56530
  return {
56625
56531
  def,
56626
56532
  workflowName: resolved.name,
@@ -56632,6 +56538,7 @@ const restAt = (ref, startOverrides = {}) => gen(function* () {
56632
56538
  run,
56633
56539
  vars,
56634
56540
  env,
56541
+ config: configNow,
56635
56542
  changes,
56636
56543
  memory: memory.key,
56637
56544
  memoryResumed: memory.resumed,
@@ -56763,7 +56670,10 @@ const landingTo = (rest, to) => {
56763
56670
  from: rest.state,
56764
56671
  to,
56765
56672
  step: rest.step.id,
56766
- ...starts ? { vars: rest.vars } : {}
56673
+ ...starts ? {
56674
+ vars: rest.vars,
56675
+ config: rest.config
56676
+ } : {}
56767
56677
  }
56768
56678
  };
56769
56679
  };
@@ -67826,410 +67736,6 @@ function getWellformedEdit(textEdit) {
67826
67736
  return textEdit;
67827
67737
  }
67828
67738
  //#endregion
67829
- //#region src/emit/GitScript.ts
67830
- const shellQuote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
67831
- /**
67832
- * `--allow-empty` because gtd's workflow commits may be empty on purpose.
67833
- * Mirrors `Git.ts`'s retry: only re-tries without hooks on the specific
67834
- * "empty git commit" rejection message, discriminated from the captured
67835
- * output rather than the exit code, so a genuinely rejected commit (a lint
67836
- * error, a commit-msg hook) still fails.
67837
- */
67838
- const commitAllowEmpty = (message) => {
67839
- const m = shellQuote(message);
67840
- return [
67841
- `if ! out=$(git commit --allow-empty -m ${m} 2>&1); then`,
67842
- ` case "$out" in`,
67843
- ` *"empty git commit"*) git commit --allow-empty --no-verify -m ${m} ;;`,
67844
- ` *) printf '%s\\n' "$out" >&2; exit 1 ;;`,
67845
- ` esac`,
67846
- `fi`
67847
- ].join("\n");
67848
- };
67849
- /** `git add -A` then `commitAllowEmpty`, joined with `&&` so a failing `git add` never reaches the commit. */
67850
- const commitAll = (message) => `git add -A &&\n${commitAllowEmpty(message)}`;
67851
- const mixedResetTo = (ref) => `git reset --mixed ${shellQuote(ref)}`;
67852
- const hardResetTo = (ref) => `git reset --hard ${shellQuote(ref)}`;
67853
- const updateRef = (ref, hash) => `git update-ref ${shellQuote(ref)} ${shellQuote(hash)}`;
67854
- /** `git update-ref -d <ref>` — idempotent: deleting a missing ref is already a no-op in real git. */
67855
- const deleteRef = (ref) => `git update-ref -d ${shellQuote(ref)}`;
67856
- /** Marks an emitted block as print-only — mirrors `OutcomeScript.ts`'s `OUTCOME_MARKER` verbatim, so `src/testing/EmittedScriptRecognizer.ts` recognizes either path's output identically. */
67857
- const OUTCOME_MARKER$1 = "# gtd: outcome (print-only)";
67858
- const printfLine$1 = (fmt, args) => `${OUTCOME_MARKER$1}\nprintf ${shellQuote(fmt.replace(/\n/g, "\\n"))} ${args.join(" ")}`;
67859
- const renderOutcome = (outcome) => {
67860
- switch (outcome.kind) {
67861
- case "transition": return printfLine$1("%s %s → %s\n", [
67862
- "'->'",
67863
- shellQuote(outcome.from),
67864
- shellQuote(outcome.to)
67865
- ]);
67866
- case "commit": return printfLine$1("%s %s\n", ["'[commit]'", shellQuote(outcome.subject)]);
67867
- case "note": return printfLine$1("%s\n", [shellQuote(outcome.text)]);
67868
- }
67869
- };
67870
- const renderGitWrite = (write) => {
67871
- switch (write.kind) {
67872
- case "commitAll": return commitAll(write.message);
67873
- }
67874
- };
67875
- /**
67876
- * Wraps `command` so a non-zero exit prints `prompt` plus the command's
67877
- * captured output before propagating that exit code — mirrors `Emit.ts`'s
67878
- * `failurePromptWrapper` (same reverse-import concern as `renderOutcome`
67879
- * above: `Emit.ts` imports `shellQuote` from here already).
67880
- */
67881
- const failurePromptWrapper$1 = (command, prompt) => {
67882
- return [
67883
- `gtd_validate_status=0`,
67884
- `gtd_validate_out="$( {`,
67885
- command,
67886
- `} 2>&1 )" || gtd_validate_status=$?`,
67887
- `if [ "$gtd_validate_status" -ne 0 ]; then`,
67888
- ` printf '%s\\n\\n%s\\n' ${shellQuote(prompt)} "$gtd_validate_out"`,
67889
- ` exit "$gtd_validate_status"`,
67890
- `fi`
67891
- ].join("\n");
67892
- };
67893
- const renderLandStep = (step) => {
67894
- if (step.kind === "gitWrite") return renderGitWrite(step.write);
67895
- if (step.kind === "outcome") return renderOutcome(step.outcome);
67896
- if (step.kind === "uncheck") return `gtd uncheck ${shellQuote(step.file)}`;
67897
- return step.onFailure !== void 0 ? failurePromptWrapper$1(step.command, step.onFailure) : step.command;
67898
- };
67899
- const ScriptSurface = { render: (steps) => {
67900
- const rendered = steps.map(renderLandStep);
67901
- return rendered.length === 0 ? "" : ["set -eu", ...rendered].join("\n\n");
67902
- } };
67903
- //#endregion
67904
- //#region src/emit/Emit.ts
67905
- /** Exits 0 when the declared steering file is absent — nothing to format or validate yet. An OR list, not `if`: its left side failing never trips `set -e`. */
67906
- const fileExistsGuard = (file) => `[ -f ${shellQuote(file)} ] || exit 0`;
67907
- /** A mode or `ui.format` command finds the file it works on in `$GTD_FILE`. */
67908
- const withFileVar = (command, file) => `export GTD_FILE=${shellQuote(file)}\n${command}`;
67909
- const SIMPLE_LEADING_WORD_RE = /^[A-Za-z0-9_./-]+(?=[ \t]|$)/;
67910
- const SHELL_METACHARACTER_RE = /[|&;$<>(){}`]/;
67911
- const FILE_VAR_RE = /"\$GTD_FILE"|"\$\{GTD_FILE\}"|\$GTD_FILE\b|\$\{GTD_FILE\}/g;
67912
- /** `command` with `file` written in for `$GTD_FILE` — one line an agent can copy, equivalent to running it under `withFileVar`. */
67913
- const commandForFile = (command, file) => command.replace(FILE_VAR_RE, shellQuote(file));
67914
- /**
67915
- * The leading word of a rendered `format:`/`validate:` command, when the
67916
- * command has exactly one unambiguous binary to probe — `undefined` for
67917
- * anything a shell metacharacter could hide a second command behind. A missing
67918
- * guard degrades to a raw exit; a wrong guard would refuse a working command.
67919
- */
67920
- const extractLeadingBinary = (command) => {
67921
- if (command.includes("\n")) return void 0;
67922
- if (SHELL_METACHARACTER_RE.test(command.replace(FILE_VAR_RE, ""))) return void 0;
67923
- const match = SIMPLE_LEADING_WORD_RE.exec(command);
67924
- return match === null ? void 0 : match[0];
67925
- };
67926
- /**
67927
- * Names a typo'd or uninstalled binary and the `$PATH` it was looked up on.
67928
- * `$PATH` is a shell word the DRIVER's shell expands at run time, so gtd never
67929
- * resolves it in-process. Exits 127, matching bash's "command not found".
67930
- */
67931
- const binaryGuard = (binary, mode, key) => {
67932
- const messageQ = shellQuote(`gtd: mode "${mode}": "${key}" command not found: ${binary}`);
67933
- return [
67934
- `command -v ${shellQuote(binary)} >/dev/null 2>&1 || {`,
67935
- ` printf '%s\\n%s\\n' ${messageQ} '$PATH: '"$PATH"`,
67936
- ` exit 127`,
67937
- `}`
67938
- ].join("\n");
67939
- };
67940
- /**
67941
- * Prints `prompt` plus the captured output on a non-zero exit, then propagates
67942
- * it. The `{ … }` group inlines a multi-line `command` verbatim; the
67943
- * assignment sits left of `||` so `set -e` never trips on the failure itself.
67944
- */
67945
- const failurePromptWrapper = (command, prompt) => {
67946
- return [
67947
- `gtd_validate_status=0`,
67948
- `gtd_validate_out="$( {`,
67949
- command,
67950
- `} 2>&1 )" || gtd_validate_status=$?`,
67951
- `if [ "$gtd_validate_status" -ne 0 ]; then`,
67952
- ` printf '%s\\n\\n%s\\n' ${shellQuote(prompt)} "$gtd_validate_out"`,
67953
- ` exit "$gtd_validate_status"`,
67954
- `fi`
67955
- ].join("\n");
67956
- };
67957
- const renderStep = (step) => {
67958
- if (step.kind === "command" && step.onFailure !== void 0) return failurePromptWrapper(step.command, step.onFailure);
67959
- return step.command;
67960
- };
67961
- const assembleScript = (steps) => steps.length === 0 ? "" : ["set -eu", ...steps.map(renderStep)].join("\n\n");
67962
- /** Build both halves from already-rendered command strings; an empty (or omitted) array produces the empty-string result, so a driver checking `if [ -n "$required" ]` never has to special-case a bare preamble. */
67963
- const emitScripts = (required = [], optional = []) => ({
67964
- required: assembleScript(required),
67965
- optional: assembleScript(optional)
67966
- });
67967
- /** Exported so `src/testing/EmittedScriptRecognizer.ts` can recognize these by exact string comparison. `printf`, not `echo`, avoids shell-specific backslash-escape quirks. */
67968
- const DID_NOT_RUN_COMMENT = "# gtd emitted this and did NOT run it — pipe it into `sh` to land the turn";
67969
- const PRESENTATION_ONLY_COMMENT = "# presentation only — safe to skip";
67970
- const PRESENTATION_FAILURE_WARNING = "printf 'gtd: presentation-only follow-up failed — continuing\\n' >&2";
67971
- /**
67972
- * A write command's single pasteable script (`gtd abandon | sh`,
67973
- * `gtd land --json=script`'s own field). `optional`, when non-empty, is
67974
- * wrapped in a subshell whose failure is swallowed — presentation-only, so it
67975
- * must never turn a landed turn into a non-zero exit.
67976
- */
67977
- const combinedScript = (required, optional) => {
67978
- if (required.length === 0) return "";
67979
- if (optional.length === 0) return `${DID_NOT_RUN_COMMENT}\n\n${required}`;
67980
- return [
67981
- DID_NOT_RUN_COMMENT,
67982
- "",
67983
- required,
67984
- "",
67985
- PRESENTATION_ONLY_COMMENT,
67986
- `(\n${optional}\n) || ${PRESENTATION_FAILURE_WARNING}`
67987
- ].join("\n");
67988
- };
67989
- //#endregion
67990
- //#region src/emit/OutcomeScript.ts
67991
- /**
67992
- * A `printf '<fmt>' <args...>` bash statement — `args` are already-valid bash
67993
- * tokens (a `shellQuote`d literal, a `"$(git …)"` substitution), never
67994
- * re-quoted here: a value reaches the script as a printf ARGUMENT, never
67995
- * interpolated into the format itself, so a subject or state name containing
67996
- * `%` can never be read as a conversion spec. Markers like `->` are arguments
67997
- * too, keeping every format string free of a leading `-` that a shell's
67998
- * `printf` could mistake for an option. A real newline in `fmt` is emitted as
67999
- * the two-character `\n` escape `printf` itself expands, keeping every emitted
68000
- * statement on one line.
68001
- */
68002
- const printfLine = (fmt, args) => `${OUTCOME_MARKER}\nprintf ${shellQuote(fmt.replace(/\n/g, "\\n"))} ${args.join(" ")}`;
68003
- /**
68004
- * Marks an emitted block as print-only. Load-bearing beyond documentation:
68005
- * `src/testing/EmittedScriptRecognizer.ts` recognizes an outcome block by
68006
- * this line, and a bare `printf` would be ambiguous with a workflow
68007
- * `script:` command that happens to start the same way.
68008
- */
68009
- const OUTCOME_MARKER = "# gtd: outcome (print-only)";
68010
- const FMT_ABANDON_NOOP = "no gtd process is underway (resting at \"%s\") — nothing to abandon\n";
68011
- const FMT_ABANDONED = "abandoned the process resting at \"%s\" — HEAD is back at %s (\"%s\"), resting at \"%s\".\nEverything the process produced is kept as uncommitted changes (`git status`); discard them with `git checkout -- . && git clean -fd .gtd` for a clean tree.\n";
68012
- const FMT_RESTORED = "restored the retained history — HEAD is back at %s (\"%s\"), resting at \"%s\". Resume with the loop, or `git reset` to any earlier turn to restart from there.\n";
68013
- /** `no gtd process is underway (resting at "<initial>") — nothing to abandon` — `gtd abandon`'s no-op plain-text line. */
68014
- const abandonNoopText = (initial) => renderFormat(FMT_ABANDON_NOOP, initial);
68015
- /** One already-rendered plain line. */
68016
- const noteOutcome = (text) => printfLine("%s\n", [shellQuote(text)]);
68017
- /**
68018
- * Resolves the post-hoc short hash/subject from `head` (a commitish) in-script
68019
- * — this line runs AFTER the reset that made `head` the new HEAD, so neither
68020
- * value is knowable when gtd generates it.
68021
- */
68022
- const abandonedOutcome = (from, head, state) => printfLine(FMT_ABANDONED, [
68023
- shellQuote(from),
68024
- `"$(git rev-parse --short ${shellQuote(head)})"`,
68025
- `"$(git log -1 --format=%s ${shellQuote(head)})"`,
68026
- shellQuote(state)
68027
- ]);
68028
- /** `gtd abandon`'s no-op outcome — the same wording `abandonNoopText` renders. */
68029
- const abandonNoopOutcome = (initial) => noteOutcome(abandonNoopText(initial));
68030
- /** Resolves the post-hoc short hash/subject from `to` (a commitish) in-script, for the same reason `abandonedOutcome` does. */
68031
- const restoredOutcome = (to, state) => printfLine(FMT_RESTORED, [
68032
- `"$(git rev-parse --short ${shellQuote(to)})"`,
68033
- `"$(git log -1 --format=%s ${shellQuote(to)})"`,
68034
- shellQuote(state)
68035
- ]);
68036
- //#endregion
68037
- //#region src/emit/ModeContradiction.ts
68038
- /**
68039
- * Written for two readers at once, since gtd validate's exit code carries no
68040
- * second meaning to distinguish them: the agent (this is a CONFIGURATION BUG,
68041
- * not the steering file — stop, don't edit it, or a fix-retry loop will
68042
- * thrash on the document) and the human (which mode, and the exact rendered
68043
- * `format:` command, to fix `gtd.config.ts` without reproducing the failure).
68044
- */
68045
- const contradictionMessage = (mode, formatCommand) => `gtd: mode "${mode}"'s format: command breaks its own validator — this is a CONFIGURATION BUG, not a problem with the steering file. Do NOT edit the steering file — stop and end your turn now.\nThe rendered format: command that ran:\n${formatCommand}\nWhat it turned mode "${mode}"'s own canonical sample into:`;
68046
- /**
68047
- * Formats a copy of the mode's own canonical sample and re-validates it with
68048
- * `gtd check <mode>`, failing loudly when the round-trip breaks it — detects a
68049
- * mode whose `format:` contradicts its own `validate:` without ever touching
68050
- * the real steering file. `printf '%s'` over a `shellQuote`d sample, never a
68051
- * heredoc, since no delimiter chosen ahead of time can collide with the
68052
- * sample's own bytes. One bash fragment with no blank lines (so
68053
- * `src/emit/Emit.ts`'s `assembleScript` never splits it from a sibling step), meant
68054
- * to run BEFORE `[ -f <file> ] || exit 0` in the emitted validate script so it
68055
- * still fires at a first-write beat where the real steering file doesn't
68056
- * exist yet.
68057
- */
68058
- const buildModeContradictionCheck = (inputs) => {
68059
- const { mode, samplePath, sample, formatCommand } = inputs;
68060
- const pathQ = shellQuote(samplePath);
68061
- const messageQ = shellQuote(contradictionMessage(mode, formatCommand));
68062
- return [
68063
- `printf '%s' ${shellQuote(sample)} > ${pathQ}`,
68064
- formatCommand,
68065
- `gtd check ${mode} ${pathQ} >/dev/null 2>&1 || {`,
68066
- ` printf '%s\\n' ${messageQ} >&2`,
68067
- ` cat ${pathQ} >&2`,
68068
- ` rm -f ${pathQ}`,
68069
- ` exit 1`,
68070
- `}`,
68071
- `rm -f ${pathQ}`
68072
- ].join("\n");
68073
- };
68074
- /**
68075
- * Skip notice for a mode whose validator is EXTERNAL (a user `validate:`
68076
- * command, not one of the two built-in modes) — there's no in-process parser
68077
- * to round-trip a sample through. Printed to stderr since silence would read
68078
- * as a clean bill of health.
68079
- */
68080
- const modeContradictionSkipNotice = (mode) => {
68081
- return `printf '%s\\n' ${shellQuote(`gtd: mode "${mode}" has an external validate: command — skipping the format/validate contradiction check`)} >&2`;
68082
- };
68083
- //#endregion
68084
- //#region src/emit/SteeringMode.ts
68085
- /**
68086
- * `format` alone (no live/external verdict) when there's no validator at
68087
- * all; a live in-process validator for a `"builtin"` validate OR a command
68088
- * that is exactly the format's own seeded string; `externalValidate` for any
68089
- * other command. Each arm returns directly — a flat sequence, not nested
68090
- * ternaries — so the four outcomes stay each their own case to read, not a
68091
- * boolean expression to re-derive.
68092
- */
68093
- const capabilitiesFor = (mode, format, validate) => {
68094
- if (format === void 0) return validate?.kind === "command" ? { externalValidate: true } : {};
68095
- if (validate?.kind === "builtin") return {
68096
- format,
68097
- liveValidate: format.validate
68098
- };
68099
- if (validate === void 0) return { format };
68100
- if (isSeededValidateCommand(mode, validate.command)) return {
68101
- format,
68102
- liveValidate: format.validate
68103
- };
68104
- return {
68105
- format,
68106
- externalValidate: true
68107
- };
68108
- };
68109
- /**
68110
- * Resolve a `mode:` name against `def.modes` plus the built-in registry
68111
- * (`src/workflow/SteeringFormats.ts`) — half by half: a declared `format:`/`validate:`
68112
- * wins, and an undeclared `validate:` falls back to the built-in format's own
68113
- * parser when the name is registered. `format` is set from the registry
68114
- * ALONE, independent of which half of `validate` wins — a declared validator
68115
- * overrides validation, not the format identity.
68116
- *
68117
- * `def: undefined` is the LSP's built-in-only fallback — resolving `mode`
68118
- * against the registry alone, with no workflow definition in hand (e.g. the
68119
- * basename dispatch for a `REVIEW.md` no config maps).
68120
- *
68121
- * The `"unknown"` arm carries the whole refusal message, naming what IS known
68122
- * when `def` is given — this is the one place that message is built, so it
68123
- * can never drift from what actually resolved.
68124
- */
68125
- const resolveMode = (def, state, mode) => {
68126
- const declared = def?.modes?.[mode];
68127
- const format = steeringFormatFor(mode);
68128
- if (declared === void 0 && format === void 0) return {
68129
- kind: "unknown",
68130
- message: def !== void 0 ? `state "${state}": mode "${mode}" is not defined by the active workflow (known modes: ${knownModes(def).join(", ")})` : `mode "${mode}" is not a built-in steering format`
68131
- };
68132
- const validate = declared?.validate !== void 0 ? {
68133
- kind: "command",
68134
- command: declared.validate
68135
- } : format !== void 0 ? {
68136
- kind: "builtin",
68137
- format
68138
- } : void 0;
68139
- return {
68140
- kind: "resolved",
68141
- mode,
68142
- ...format !== void 0 ? { format } : {},
68143
- ...declared?.format !== void 0 ? { formatCommand: declared.format } : {},
68144
- ...validate !== void 0 ? { validate } : {},
68145
- capabilities: capabilitiesFor(mode, format, validate)
68146
- };
68147
- };
68148
- /** `gtd next`'s fix-retry instruction, printed ahead of the failing command's captured output. */
68149
- const fixPromptInstruction = (file) => `Your last turn does not pass its own validation script. Fix these format violations in ${file}, then finish:`;
68150
- /**
68151
- * Pushes a `binaryGuard` step ahead of `command` when its own leading word
68152
- * is unambiguous — BEFORE, not wrapped around: a guard that fails must stop
68153
- * the script on its own `exit 127`, without touching `failurePromptWrapper`'s
68154
- * captured-output path. Each command guards on its OWN leading word — a
68155
- * guard naming the wrong binary is worse than none.
68156
- */
68157
- const pushGuardedCommand = (steps, mode, key, command, file, onFailure) => {
68158
- const binary = extractLeadingBinary(command);
68159
- if (binary !== void 0) steps.push({
68160
- kind: "command",
68161
- command: binaryGuard(binary, mode, key)
68162
- });
68163
- steps.push({
68164
- kind: "command",
68165
- command: withFileVar(command, file),
68166
- ...onFailure !== void 0 ? { onFailure } : {}
68167
- });
68168
- };
68169
- /**
68170
- * `resolved`'s `format:`/`validate:` as `EmitStep[]` — format first,
68171
- * validate last, the last one wrapped with `onFailure` when the validator is
68172
- * a command (a built-in's own in-process parser has no shell step to wrap:
68173
- * `gtd check`'s seeded command carries that instead). Each command gets its
68174
- * own `binaryGuard` immediately ahead of it.
68175
- */
68176
- const modeCommandSteps = (resolved, file) => {
68177
- const steps = [];
68178
- if (resolved.formatCommand !== void 0) pushGuardedCommand(steps, resolved.mode, "format", resolved.formatCommand, file, void 0);
68179
- if (resolved.validate?.kind === "command") pushGuardedCommand(steps, resolved.mode, "validate", resolved.validate.command, file, fixPromptInstruction(file));
68180
- return steps;
68181
- };
68182
- /** `<Host.scratchDir>/gtd-mode-sample-<mode>-<pid>.md` — an absolute literal baked in at emit time, never a shell variable. `<pid>` avoids collisions between concurrent `gtd` processes. Never a `/tmp` literal or `mktemp` (`tests/tooling/no-tmp-assumption.test.ts` scans for both). */
68183
- const scratchSamplePath = (scratchDir, mode) => join(scratchDir, `gtd-mode-sample-${mode}-${process.pid}.md`);
68184
- /**
68185
- * The contradiction round-trip/skip-notice steps for `resolved`'s `mode:`.
68186
- * No `formatCommand` means nothing to round-trip: empty. Otherwise: a live
68187
- * built-in validator runs the round-trip against that format's own canonical
68188
- * sample; an external validator prints a one-line skip notice instead, since
68189
- * silence there would read as a clean bill of health; a format-only mode with
68190
- * neither has nothing to round-trip either.
68191
- */
68192
- const modeContradictionSteps = (resolved) => gen(function* () {
68193
- if (resolved.formatCommand === void 0) return [];
68194
- const { capabilities } = resolved;
68195
- if (capabilities.format !== void 0 && capabilities.liveValidate !== void 0) {
68196
- const { scratchDir } = yield* Host;
68197
- const samplePath = scratchSamplePath(scratchDir, resolved.mode);
68198
- const formatCommand = withFileVar(resolved.formatCommand, samplePath);
68199
- return [{
68200
- kind: "command",
68201
- command: buildModeContradictionCheck({
68202
- mode: resolved.mode,
68203
- samplePath,
68204
- sample: capabilities.format.sample,
68205
- formatCommand
68206
- })
68207
- }];
68208
- }
68209
- if (capabilities.externalValidate === true) return [{
68210
- kind: "command",
68211
- command: modeContradictionSkipNotice(resolved.mode)
68212
- }];
68213
- return [];
68214
- });
68215
- /**
68216
- * Renders `resolved`'s complete validate script for `file`: the mode's
68217
- * format/validate contradiction check, a guard for a not-yet-written file,
68218
- * then the format/validate commands themselves (format first). gtd never
68219
- * runs this script itself — `resolveMode`+`validateScriptFor` only render
68220
- * text for a driver to execute (`gtd renders; the driver executes`).
68221
- */
68222
- const validateScriptFor = (resolved, file) => gen(function* () {
68223
- return { script: emitScripts([
68224
- ...yield* modeContradictionSteps(resolved),
68225
- {
68226
- kind: "command",
68227
- command: fileExistsGuard(file)
68228
- },
68229
- ...modeCommandSteps(resolved, file)
68230
- ]).required };
68231
- });
68232
- //#endregion
68233
67739
  //#region src/lsp/Lsp.ts
68234
67740
  /** A `SteeringOutlineNode` tree → `DocumentSymbol` tree: `leaf: true` maps to `SymbolKind.Boolean`, a container to `SymbolKind.Package` — an outline icon distinction only, no protocol contract. */
68235
67741
  const toDocumentSymbol = (node) => ({
@@ -68330,83 +67836,27 @@ const toDiagnostic = (lines) => (finding) => ({
68330
67836
  severity: import_main.DiagnosticSeverity.Warning,
68331
67837
  source: "gtd"
68332
67838
  });
68333
- /** The one `Information` diagnostic a shell-`validate:`d mode gets instead of live findings. */
68334
- const externalValidatorNotice = (mode, command) => ({
68335
- range: {
68336
- start: {
68337
- line: 0,
68338
- character: 0
68339
- },
68340
- end: {
68341
- line: 0,
68342
- character: 0
68343
- }
68344
- },
68345
- message: `mode "${mode}" is validated by a shell command (\`${command}\`) — run \`gtd validate\`; no live diagnostics`,
68346
- severity: import_main.DiagnosticSeverity.Information,
68347
- source: "gtd"
68348
- });
68349
- /** Diagnostics for one document, given its resolved mode (or `undefined` — an unmapped path): a live built-in `validate` when one applies, the external-validator notice when a command displaced it, or none. */
68350
- const diagnosticsFor = (resolved, content) => {
68351
- const caps = resolved?.capabilities ?? {};
67839
+ const diagnosticsFor = (format, content) => {
67840
+ if (format === void 0) return [];
68352
67841
  const lines = content.split(/\r?\n/);
68353
- const open = () => openThreadFindings(content).map((f) => ({
67842
+ return [...format.validate(content).map(toDiagnostic(lines)), ...openThreadFindings(content).map((f) => ({
68354
67843
  ...toDiagnostic(lines)(f),
68355
67844
  severity: import_main.DiagnosticSeverity.Information
68356
- }));
68357
- if (caps.liveValidate !== void 0) return [...caps.liveValidate(content).map(toDiagnostic(lines)), ...open()];
68358
- if (caps.externalValidate === true && resolved?.validate?.kind === "command") return [externalValidatorNotice(resolved.mode, resolved.validate.command), ...open()];
68359
- return [];
67845
+ }))];
68360
67846
  };
68361
67847
  /** A `SteeringLink` → a `DocumentLink`, resolving its target file against `root` — same resolution `toLocation` already does for a foreign `pointerAt` jump. `line` is 0-based; the target URI's `#L<line+1>` fragment names the 1-based line, mirroring a familiar (GitHub-style) file-link convention. */
68362
67848
  const toDocumentLink = (root) => (link) => ({
68363
67849
  range: link.range,
68364
67850
  target: `${pathToFileURL(resolve(root, link.path)).toString()}#L${link.line + 1}`
68365
67851
  });
68366
- /** Document links for one document, given its resolved mode and `root` (needed to resolve each link's target path). `undefined` mode, or a format declaring no `documentLinks` (`qa`), yields none. */
68367
- const documentLinksFor = (resolved, content, root) => {
68368
- const format = resolved?.capabilities.format;
68369
- if (format === void 0) return [];
68370
- return viewOf(format, content).documentLinks.map(toDocumentLink(root));
67852
+ const documentLinksFor = (format, content, root) => format === void 0 ? [] : viewOf(format, content).documentLinks.map(toDocumentLink(root));
67853
+ /** Fallback for any path the current rest doesn't name. `TODO.md` is intentionally not mapped — the bundled `idle` step declares no `mode` for it. */
67854
+ const basenameFallbackFormat = (name) => name === "REVIEW.md" ? steeringFormatFor("review") : void 0;
67855
+ const formatForDocument = (uri, rest, root) => {
67856
+ const path = fileURLToPath(uri);
67857
+ if (rest?.file !== void 0 && rest.mode !== void 0 && resolve(root, rest.file) === path) return steeringFormatFor(rest.mode);
67858
+ return basenameFallbackFormat(basename(path));
68371
67859
  };
68372
- /** Fallback for any path the workflow's `file:` map doesn't cover. `TODO.md` is intentionally not mapped — the bundled `idle` state declares no `mode:` for it. */
68373
- const basenameFallbackMode = (name) => {
68374
- if (name !== "REVIEW.md") return void 0;
68375
- const resolved = resolveMode(void 0, "", "review");
68376
- return resolved.kind === "resolved" ? resolved : void 0;
68377
- };
68378
- /**
68379
- * The `file:`/`mode:` pairs of the steps the current process has reached, as
68380
- * an absolute-path → `ResolvedMode` map. A flow is code, so only a step replay
68381
- * reached is known; a path two steps both declare keeps the first one's mode,
68382
- * warning.
68383
- */
68384
- const buildSteeringMap = (def, steps, root) => {
68385
- const map = /* @__PURE__ */ new Map();
68386
- const warnings = [];
68387
- for (const node of steps) {
68388
- const { file, mode } = node;
68389
- if (file === void 0 || mode === void 0) continue;
68390
- const absolute = resolve(root, file);
68391
- const existing = map.get(absolute);
68392
- if (existing !== void 0) {
68393
- if (existing.mode !== mode) warnings.push(`"${absolute}" is already mapped to mode "${existing.mode}" by an earlier step; step "${node.name}"'s mode ("${mode}") is ignored`);
68394
- continue;
68395
- }
68396
- const resolved = resolveMode(def, node.name, mode);
68397
- if (resolved.kind === "unknown") {
68398
- warnings.push(`${resolved.message}, skipped`);
68399
- continue;
68400
- }
68401
- map.set(absolute, resolved);
68402
- }
68403
- return {
68404
- map,
68405
- warnings
68406
- };
68407
- };
68408
- const resolvedModeForDocument = (uri, steeringMap) => steeringMap.get(fileURLToPath(uri)) ?? basenameFallbackMode(basename(fileURLToPath(uri)));
68409
- const capabilitiesForDocument = (uri, steeringMap) => resolvedModeForDocument(uri, steeringMap)?.capabilities ?? {};
68410
67860
  const resolveWorkspaceRoot = (params) => {
68411
67861
  const uri = params.workspaceFolders?.[0]?.uri ?? params.rootUri ?? void 0;
68412
67862
  return uri === void 0 || uri === null ? void 0 : fileURLToPath(uri);
@@ -68439,20 +67889,15 @@ const revealPositionArgs = (args) => {
68439
67889
  };
68440
67890
  /**
68441
67891
  * Builds the whole `SteeringLanguageService` over `env`. Every `env` call is
68442
- * wrapped in a try/catch that warns and degrades gracefully — an unmapped or
68443
- * failed lookup behaves like "no config resolved" (empty results), never a
68444
- * rejected request.
67892
+ * wrapped in a try/catch that degrades gracefully — a failed lookup behaves
67893
+ * like a document no rest names (basename dispatch), never a rejected request.
68445
67894
  */
68446
67895
  const makeSteeringLanguageService = (env, warn) => {
68447
67896
  let workspaceRoot;
68448
- const rootFor = (uri) => workspaceRoot ?? dirname(fileURLToPath(uri));
68449
- const safeSteeringMap = async (root) => {
68450
- try {
68451
- return await env.steeringMapFor(root);
68452
- } catch (e) {
68453
- warn(`failed to load gtd config at "${root}" — falling back to basename dispatch: ${errorText(e)}`);
68454
- return /* @__PURE__ */ new Map();
68455
- }
67897
+ let lastWarning;
67898
+ const warnOnce = (message) => {
67899
+ if (message !== lastWarning) warn(message);
67900
+ lastWarning = message;
68456
67901
  };
68457
67902
  const safeGitTopLevel = async (dir) => {
68458
67903
  try {
@@ -68461,10 +67906,28 @@ const makeSteeringLanguageService = (env, warn) => {
68461
67906
  return;
68462
67907
  }
68463
67908
  };
68464
- const capabilitiesFor = async (uri) => capabilitiesForDocument(uri, await safeSteeringMap(rootFor(uri)));
67909
+ const repoRootFor = async (uri) => await safeGitTopLevel(dirname(fileURLToPath(uri))) ?? workspaceRoot;
67910
+ let workspaceRepo;
67911
+ const trusted = async (root) => {
67912
+ if (workspaceRoot === void 0) return true;
67913
+ const ws = workspaceRoot;
67914
+ workspaceRepo ??= safeGitTopLevel(ws).then((top) => top ?? ws);
67915
+ return root === await workspaceRepo;
67916
+ };
67917
+ const formatFor = async (uri) => {
67918
+ const root = await repoRootFor(uri);
67919
+ if (root === void 0 || !await trusted(root)) return formatForDocument(uri, void 0, "");
67920
+ try {
67921
+ return formatForDocument(uri, await env.currentRest(root), root);
67922
+ } catch (e) {
67923
+ warnOnce(`failed to read the current rest at "${root}" — falling back to basename dispatch: ${errorText(e)}`);
67924
+ return formatForDocument(uri, void 0, root);
67925
+ }
67926
+ };
68465
67927
  return {
68466
67928
  initialize: (params) => {
68467
67929
  workspaceRoot = resolveWorkspaceRoot(params);
67930
+ workspaceRepo = void 0;
68468
67931
  return { capabilities: {
68469
67932
  textDocumentSync: import_main.TextDocumentSyncKind.Incremental,
68470
67933
  documentSymbolProvider: true,
@@ -68475,32 +67938,27 @@ const makeSteeringLanguageService = (env, warn) => {
68475
67938
  } };
68476
67939
  },
68477
67940
  documentSymbol: async (uri, text) => {
68478
- const caps = await capabilitiesFor(uri);
68479
- if (caps.format === void 0) return [];
68480
- return viewOf(caps.format, text).outline.map(toDocumentSymbol);
67941
+ const format = await formatFor(uri);
67942
+ return format === void 0 ? [] : viewOf(format, text).outline.map(toDocumentSymbol);
68481
67943
  },
68482
67944
  codeAction: async (uri, text, range) => {
68483
- const caps = await capabilitiesFor(uri);
68484
- if (caps.format === void 0) return [];
68485
- return viewOf(caps.format, text).actionsAt(range).map(toCodeAction(uri, text));
67945
+ const format = await formatFor(uri);
67946
+ if (format === void 0) return [];
67947
+ return viewOf(format, text).actionsAt(range).map(toCodeAction(uri, text));
68486
67948
  },
68487
67949
  definition: async (uri, text, position) => {
68488
- const caps = await capabilitiesFor(uri);
68489
- const pointer = caps.format !== void 0 ? viewOf(caps.format, text).pointerAt(position) : void 0;
67950
+ const format = await formatFor(uri);
67951
+ const pointer = format !== void 0 ? viewOf(format, text).pointerAt(position) : void 0;
68490
67952
  if (pointer === void 0) return [];
68491
67953
  if (pointer.path === void 0) return [toLocation("", uri)(pointer)];
68492
- const root = await safeGitTopLevel(dirname(fileURLToPath(uri))) ?? workspaceRoot;
67954
+ const root = await repoRootFor(uri);
68493
67955
  return root === void 0 ? [] : [toLocation(root, uri)(pointer)];
68494
67956
  },
68495
- diagnostics: async (uri, text) => {
68496
- const map = await safeSteeringMap(rootFor(uri));
68497
- return diagnosticsFor(resolvedModeForDocument(uri, map), text);
68498
- },
67957
+ diagnostics: async (uri, text) => diagnosticsFor(await formatFor(uri), text),
68499
67958
  documentLink: async (uri, text) => {
68500
- const map = await safeSteeringMap(rootFor(uri));
68501
- const root = await safeGitTopLevel(dirname(fileURLToPath(uri))) ?? workspaceRoot;
67959
+ const root = await repoRootFor(uri);
68502
67960
  if (root === void 0) return [];
68503
- return documentLinksFor(resolvedModeForDocument(uri, map), text, root);
67961
+ return documentLinksFor(await formatFor(uri), text, root);
68504
67962
  },
68505
67963
  executeCommand: async (command, args) => {
68506
67964
  if (command === REVEAL_POSITION_COMMAND) {
@@ -68519,9 +67977,10 @@ const makeSteeringLanguageService = (env, warn) => {
68519
67977
  };
68520
67978
  }
68521
67979
  if (command !== OPEN_STEERING_FILE_COMMAND) return { kind: "unknown" };
68522
- const root = workspaceRoot ?? env.cwd;
67980
+ const start = workspaceRoot ?? env.cwd;
67981
+ const root = await safeGitTopLevel(start) ?? start;
68523
67982
  try {
68524
- const { state, file } = await env.currentSteeringFile(root);
67983
+ const { state, file } = await env.currentRest(root);
68525
67984
  const outcome = steeringFileOutcome(state, file, root);
68526
67985
  return outcome.kind === "inform" ? {
68527
67986
  kind: "inform",
@@ -68586,124 +68045,55 @@ const bindSteeringServer = (connection, documents, service) => {
68586
68045
  documents.listen(connection);
68587
68046
  connection.listen();
68588
68047
  };
68589
- /**
68590
- * `Host.Live`'s own home/env, resolved ONCE — the only place this module
68591
- * reaches for the real environment; every per-root layer below overrides just
68592
- * `root`, never touching `process.cwd()`/`process.env` itself.
68593
- */
68594
- const liveHost = runSync(provide$2(Host, Host.Live));
68595
- const hostLayerForRoot = (root) => Host.layer({
68596
- ...liveHost,
68597
- root
68048
+ const run = (command, args, cwd) => new Promise((resolve, reject) => {
68049
+ execFile(command, [...args], {
68050
+ cwd,
68051
+ maxBuffer: 16 * 1024 * 1024
68052
+ }, (error, stdout, stderr) => {
68053
+ if (error === null) resolve(stdout);
68054
+ else reject(new Error(stderr.trim() !== "" ? stderr.trim() : error.message));
68055
+ });
68598
68056
  });
68599
- /** `GitService.Live` scoped to `root`, with the Node command executor it needs to shell out to `git`. */
68600
- const gitLayerForRoot = (root) => GitService.Live.pipe(provide$1(merge(hostLayerForRoot(root), layer)));
68601
- const workspaceLayerForRoot = (root) => Workspace.Live.pipe(provide$1(merge(hostLayerForRoot(root), gitLayerForRoot(root))));
68602
- /** The layers `LspEnv`'s Effects run against. `Narrator` is a permanent no-op — the LSP talks stdio JSON-RPC, with nothing to narrate onto — provided only so the shared `Narrator` requirement typechecks. */
68603
- const layersForRoot = (root) => mergeAll$1(gitLayerForRoot(root), ConfigService.Live, ConfigDiscovery.Live, workspaceLayerForRoot(root), hostLayerForRoot(root), Narrator.layer(() => {}, false));
68604
- /**
68605
- * One `ManagedRuntime` per root, memoised — caches the runtime (the
68606
- * constructed service layer), not the config: `currentSteeringFile` and a
68607
- * `steeringMapFor` cache miss still call `ConfigService.load` fresh through
68608
- * it. A `steeringMapFor` hit skips that load entirely, but its own memo (see
68609
- * `makeNodeLspEnv`) is keyed on the `(path, size, mtimeMs)` of every file the
68610
- * LAST such load reported touching, so an edit to a leftover rc file, `gtd.config.ts`,
68611
- * or a module `gtd.config.ts` imports still forces the next request to
68612
- * reload — only an unrelated repeat request skips it.
68613
- */
68614
- const runtimeCache = /* @__PURE__ */ new Map();
68615
- const runtimeFor = (root) => {
68616
- const cached = runtimeCache.get(root);
68617
- if (cached !== void 0) return cached;
68618
- const runtime = make(layersForRoot(root));
68619
- runtimeCache.set(root, runtime);
68620
- return runtime;
68621
- };
68622
- /** The current state/actor and its rendered `file:` (`undefined` when the state declares none), exactly like the CLI's `currentRest`. Carries its requirements rather than providing them — the caller runs it through the memoised `runtimeFor(root)`. */
68623
- const resolveSteeringFile = currentRest.pipe(map$4((rest) => ({
68624
- state: rest.state,
68625
- file: rest.hints.file
68626
- })));
68627
- const reachedSteeringSteps = gen(function* () {
68628
- const config = yield* (yield* ConfigService).load;
68629
- const rest = yield* either(currentRest);
68630
- const reached = rest._tag === "Left" ? [] : rest.right.trace.map((step) => ({
68631
- name: step.name,
68632
- file: step.request.options.file,
68633
- mode: step.request.options.mode
68634
- }));
68635
- const declared = Object.entries(config.workflow.steering).map(([file, mode]) => ({
68636
- name: "the steering export",
68637
- file,
68638
- mode
68639
- }));
68057
+ const optionalString = (value) => typeof value === "string" ? value : void 0;
68058
+ const parseCurrentRest = (stdout) => {
68059
+ const parsed = JSON.parse(stdout);
68060
+ const state = optionalString(parsed?.["state"]);
68061
+ if (state === void 0) throw new Error(`not a gtd next --json document: ${stdout}`);
68640
68062
  return {
68641
- def: config.workflow,
68642
- steps: [...reached, ...declared],
68643
- dependencyFiles: config.workflowFiles
68644
- };
68645
- });
68646
- /** A cheap `(size, mtimeMs)` fingerprint of `path` — a stat, never a read. `"missing"` when it doesn't exist, so a file's creation OR deletion still changes the identity. */
68647
- const fingerprintOf = (path) => {
68648
- try {
68649
- const stat = statSync(path);
68650
- return `${stat.size}:${stat.mtimeMs}`;
68651
- } catch {
68652
- return "missing";
68653
- }
68654
- };
68655
- /** `paths`' identity, sorted so the same set always reads the same regardless of build order. `known`'s fingerprint wins over a fresh `fingerprintOf` stat where it has one — see `steeringMapFor`'s miss path for why that matters. */
68656
- const identityOf = (paths, known) => paths.map((path) => `${path}:${known?.get(path) ?? fingerprintOf(path)}`).sort().join("|");
68657
- /**
68658
- * Every path a `gtd.config.ts` — or a removed rc file a load refuses — COULD
68659
- * live at for `root`, computed from path strings alone, no filesystem access.
68660
- * Unlike `ConfigOperations.workflowFiles` (which names only what a load
68661
- * actually FOUND), this list is complete whether or not any of it exists yet,
68662
- * so `identityOf` on it catches a file appearing or disappearing, not just an
68663
- * edit to one that already existed.
68664
- */
68665
- const candidateConfigPaths = (root) => [...walkUp(root, liveHost.home).map((dir) => resolve(dir, WORKFLOW_MODULE)), ...legacyRcDirs(root, liveHost.home).flatMap((dir) => LEGACY_RC_FILES.map((name) => resolve(dir, name)))];
68666
- /** The Node adapter: the only place `LspEnv`'s Effects/layers get built and run. `startLspServer` is its production caller; most `Lsp.test.ts` coverage exercises a fake `LspEnv` instead, but this is exported so the real wiring (real git/config/repo-files layers) gets exercised against a real temp repo too. */
68667
- const makeNodeLspEnv = (warn) => {
68668
- const stepsMemo = /* @__PURE__ */ new Map();
68669
- const headHashFor = (root) => runtimeFor(root).runPromise(flatMap$4(GitService, (git) => git.resolveRef("HEAD"))).catch(() => "no-head");
68670
- /** `result.dependencyFiles` beyond `candidateConfigPaths(root)` — a genuine import elsewhere (e.g. a split workflow's sibling module), never `gtd.config.ts` or a leftover rc file, which the static set already names. */
68671
- const dynamicOnlyPaths = (root, result) => {
68672
- const staticSet = new Set(candidateConfigPaths(root));
68673
- return result.dependencyFiles.filter((path) => !staticSet.has(path));
68674
- };
68675
- const queues = /* @__PURE__ */ new Map();
68676
- const serialized = (root, task) => {
68677
- const settled = (queues.get(root) ?? Promise.resolve()).then(task, task);
68678
- queues.set(root, settled.then(() => void 0, () => void 0));
68679
- return settled;
68063
+ state,
68064
+ file: optionalString(parsed?.["file"]),
68065
+ mode: optionalString(parsed?.["mode"])
68680
68066
  };
68067
+ };
68068
+ /**
68069
+ * The Node adapter: process state comes from spawning `gtd` (the same build
68070
+ * serving the LSP), the way any driver reads it. A rest only moves when HEAD
68071
+ * does, so one `gtd next --json` per root and HEAD serves every request in
68072
+ * between — the diagnostics and the outline of the same keystroke included.
68073
+ */
68074
+ const makeNodeLspEnv = (gtd, retryAfterMs = 5e3) => {
68075
+ const memo = /* @__PURE__ */ new Map();
68681
68076
  return {
68682
- cwd: liveHost.root,
68683
- steeringMapFor: (root) => serialized(root, async () => {
68684
- const headHash = await headHashFor(root);
68685
- const cached = stepsMemo.get(root);
68686
- if (cached !== void 0 && cached.headHash === headHash && identityOf([...candidateConfigPaths(root), ...dynamicOnlyPaths(root, cached.result)]) === cached.configIdentity) {
68687
- const { map, warnings } = buildSteeringMap(cached.result.def, cached.result.steps, root);
68688
- for (const warning of warnings) warn(warning);
68689
- return map;
68690
- }
68691
- const staticPaths = candidateConfigPaths(root);
68692
- const knownDynamic = cached !== void 0 ? dynamicOnlyPaths(root, cached.result) : [];
68693
- const before = new Map([...staticPaths, ...knownDynamic].map((path) => [path, fingerprintOf(path)]));
68694
- const result = await runtimeFor(root).runPromise(reachedSteeringSteps);
68695
- const configIdentity = identityOf([...staticPaths, ...dynamicOnlyPaths(root, result)], before);
68696
- stepsMemo.set(root, {
68697
- headHash,
68698
- configIdentity,
68699
- result
68077
+ cwd: process.cwd(),
68078
+ gitTopLevel: async (dir) => resolve(dir, (await run("git", ["rev-parse", "--show-cdup"], dir)).trim()),
68079
+ currentRest: async (root) => {
68080
+ const head = await run("git", ["rev-parse", "HEAD"], root).then((out) => out.trim(), () => "no-head");
68081
+ const cached = memo.get(root);
68082
+ if (cached?.head === head && (cached.failedAt === void 0 || Date.now() - cached.failedAt < retryAfterMs)) return cached.rest;
68083
+ const entry = {
68084
+ head,
68085
+ rest: run(gtd[0], [
68086
+ ...gtd.slice(1),
68087
+ "next",
68088
+ "--json"
68089
+ ], root).then(parseCurrentRest)
68090
+ };
68091
+ memo.set(root, entry);
68092
+ entry.rest.catch(() => {
68093
+ entry.failedAt = Date.now();
68700
68094
  });
68701
- const { map, warnings } = buildSteeringMap(result.def, result.steps, root);
68702
- for (const warning of warnings) warn(warning);
68703
- return map;
68704
- }),
68705
- gitTopLevel: (dir) => runtimeFor(dir).runPromise(flatMap$4(GitService, (git) => git.topLevel())),
68706
- currentSteeringFile: (root) => runtimeFor(root).runPromise(resolveSteeringFile)
68095
+ return entry.rest;
68096
+ }
68707
68097
  };
68708
68098
  };
68709
68099
  /**
@@ -68711,11 +68101,11 @@ const makeNodeLspEnv = (warn) => {
68711
68101
  * the client disconnects (`exit` notification), so the process exits cleanly
68712
68102
  * rather than blocking forever.
68713
68103
  */
68714
- const startLspServer = () => gen(function* () {
68104
+ const startLspServer = (options) => gen(function* () {
68715
68105
  const connection = (0, import_main.createConnection)(import_main.ProposedFeatures.all, process.stdin, process.stdout);
68716
68106
  const documents = new import_main.TextDocuments(TextDocument);
68717
68107
  const warn = (message) => connection.console.warn(`gtd lsp: ${message}`);
68718
- const service = makeSteeringLanguageService(makeNodeLspEnv(warn), warn);
68108
+ const service = makeSteeringLanguageService(makeNodeLspEnv(options.gtd), warn);
68719
68109
  bindSteeringServer(connection, documents, service);
68720
68110
  yield* async((resume) => {
68721
68111
  connection.onExit(() => resume(_void));
@@ -69164,6 +68554,410 @@ const runLoop = (options) => gen(function* () {
69164
68554
  }
69165
68555
  });
69166
68556
  //#endregion
68557
+ //#region src/emit/GitScript.ts
68558
+ const shellQuote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
68559
+ /**
68560
+ * `--allow-empty` because gtd's workflow commits may be empty on purpose.
68561
+ * Mirrors `Git.ts`'s retry: only re-tries without hooks on the specific
68562
+ * "empty git commit" rejection message, discriminated from the captured
68563
+ * output rather than the exit code, so a genuinely rejected commit (a lint
68564
+ * error, a commit-msg hook) still fails.
68565
+ */
68566
+ const commitAllowEmpty = (message) => {
68567
+ const m = shellQuote(message);
68568
+ return [
68569
+ `if ! out=$(git commit --allow-empty -m ${m} 2>&1); then`,
68570
+ ` case "$out" in`,
68571
+ ` *"empty git commit"*) git commit --allow-empty --no-verify -m ${m} ;;`,
68572
+ ` *) printf '%s\\n' "$out" >&2; exit 1 ;;`,
68573
+ ` esac`,
68574
+ `fi`
68575
+ ].join("\n");
68576
+ };
68577
+ /** `git add -A` then `commitAllowEmpty`, joined with `&&` so a failing `git add` never reaches the commit. */
68578
+ const commitAll = (message) => `git add -A &&\n${commitAllowEmpty(message)}`;
68579
+ const mixedResetTo = (ref) => `git reset --mixed ${shellQuote(ref)}`;
68580
+ const hardResetTo = (ref) => `git reset --hard ${shellQuote(ref)}`;
68581
+ const updateRef = (ref, hash) => `git update-ref ${shellQuote(ref)} ${shellQuote(hash)}`;
68582
+ /** `git update-ref -d <ref>` — idempotent: deleting a missing ref is already a no-op in real git. */
68583
+ const deleteRef = (ref) => `git update-ref -d ${shellQuote(ref)}`;
68584
+ /** Marks an emitted block as print-only — mirrors `OutcomeScript.ts`'s `OUTCOME_MARKER` verbatim, so `src/testing/EmittedScriptRecognizer.ts` recognizes either path's output identically. */
68585
+ const OUTCOME_MARKER$1 = "# gtd: outcome (print-only)";
68586
+ const printfLine$1 = (fmt, args) => `${OUTCOME_MARKER$1}\nprintf ${shellQuote(fmt.replace(/\n/g, "\\n"))} ${args.join(" ")}`;
68587
+ const renderOutcome = (outcome) => {
68588
+ switch (outcome.kind) {
68589
+ case "transition": return printfLine$1("%s %s → %s\n", [
68590
+ "'->'",
68591
+ shellQuote(outcome.from),
68592
+ shellQuote(outcome.to)
68593
+ ]);
68594
+ case "commit": return printfLine$1("%s %s\n", ["'[commit]'", shellQuote(outcome.subject)]);
68595
+ case "note": return printfLine$1("%s\n", [shellQuote(outcome.text)]);
68596
+ }
68597
+ };
68598
+ const renderGitWrite = (write) => {
68599
+ switch (write.kind) {
68600
+ case "commitAll": return commitAll(write.message);
68601
+ }
68602
+ };
68603
+ /**
68604
+ * Wraps `command` so a non-zero exit prints `prompt` plus the command's
68605
+ * captured output before propagating that exit code — mirrors `Emit.ts`'s
68606
+ * `failurePromptWrapper` (same reverse-import concern as `renderOutcome`
68607
+ * above: `Emit.ts` imports `shellQuote` from here already).
68608
+ */
68609
+ const failurePromptWrapper$1 = (command, prompt) => {
68610
+ return [
68611
+ `gtd_validate_status=0`,
68612
+ `gtd_validate_out="$( {`,
68613
+ command,
68614
+ `} 2>&1 )" || gtd_validate_status=$?`,
68615
+ `if [ "$gtd_validate_status" -ne 0 ]; then`,
68616
+ ` printf '%s\\n\\n%s\\n' ${shellQuote(prompt)} "$gtd_validate_out"`,
68617
+ ` exit "$gtd_validate_status"`,
68618
+ `fi`
68619
+ ].join("\n");
68620
+ };
68621
+ const renderLandStep = (step) => {
68622
+ if (step.kind === "gitWrite") return renderGitWrite(step.write);
68623
+ if (step.kind === "outcome") return renderOutcome(step.outcome);
68624
+ if (step.kind === "uncheck") return `gtd uncheck ${shellQuote(step.file)}`;
68625
+ return step.onFailure !== void 0 ? failurePromptWrapper$1(step.command, step.onFailure) : step.command;
68626
+ };
68627
+ const ScriptSurface = { render: (steps) => {
68628
+ const rendered = steps.map(renderLandStep);
68629
+ return rendered.length === 0 ? "" : ["set -eu", ...rendered].join("\n\n");
68630
+ } };
68631
+ //#endregion
68632
+ //#region src/emit/Emit.ts
68633
+ /** Exits 0 when the declared steering file is absent — nothing to format or validate yet. An OR list, not `if`: its left side failing never trips `set -e`. */
68634
+ const fileExistsGuard = (file) => `[ -f ${shellQuote(file)} ] || exit 0`;
68635
+ /** A mode or `ui.format` command finds the file it works on in `$GTD_FILE`. */
68636
+ const withFileVar = (command, file) => `export GTD_FILE=${shellQuote(file)}\n${command}`;
68637
+ const SIMPLE_LEADING_WORD_RE = /^[A-Za-z0-9_./-]+(?=[ \t]|$)/;
68638
+ const SHELL_METACHARACTER_RE = /[|&;$<>(){}`]/;
68639
+ const FILE_VAR_RE = /"\$GTD_FILE"|"\$\{GTD_FILE\}"|\$GTD_FILE\b|\$\{GTD_FILE\}/g;
68640
+ /** `command` with `file` written in for `$GTD_FILE` — one line an agent can copy, equivalent to running it under `withFileVar`. */
68641
+ const commandForFile = (command, file) => command.replace(FILE_VAR_RE, shellQuote(file));
68642
+ /**
68643
+ * The leading word of a rendered `format:`/`validate:` command, when the
68644
+ * command has exactly one unambiguous binary to probe — `undefined` for
68645
+ * anything a shell metacharacter could hide a second command behind. A missing
68646
+ * guard degrades to a raw exit; a wrong guard would refuse a working command.
68647
+ */
68648
+ const extractLeadingBinary = (command) => {
68649
+ if (command.includes("\n")) return void 0;
68650
+ if (SHELL_METACHARACTER_RE.test(command.replace(FILE_VAR_RE, ""))) return void 0;
68651
+ const match = SIMPLE_LEADING_WORD_RE.exec(command);
68652
+ return match === null ? void 0 : match[0];
68653
+ };
68654
+ /**
68655
+ * Names a typo'd or uninstalled binary and the `$PATH` it was looked up on.
68656
+ * `$PATH` is a shell word the DRIVER's shell expands at run time, so gtd never
68657
+ * resolves it in-process. Exits 127, matching bash's "command not found".
68658
+ */
68659
+ const binaryGuard = (binary, mode, key) => {
68660
+ const messageQ = shellQuote(`gtd: mode "${mode}": "${key}" command not found: ${binary}`);
68661
+ return [
68662
+ `command -v ${shellQuote(binary)} >/dev/null 2>&1 || {`,
68663
+ ` printf '%s\\n%s\\n' ${messageQ} '$PATH: '"$PATH"`,
68664
+ ` exit 127`,
68665
+ `}`
68666
+ ].join("\n");
68667
+ };
68668
+ /**
68669
+ * Prints `prompt` plus the captured output on a non-zero exit, then propagates
68670
+ * it. The `{ … }` group inlines a multi-line `command` verbatim; the
68671
+ * assignment sits left of `||` so `set -e` never trips on the failure itself.
68672
+ */
68673
+ const failurePromptWrapper = (command, prompt) => {
68674
+ return [
68675
+ `gtd_validate_status=0`,
68676
+ `gtd_validate_out="$( {`,
68677
+ command,
68678
+ `} 2>&1 )" || gtd_validate_status=$?`,
68679
+ `if [ "$gtd_validate_status" -ne 0 ]; then`,
68680
+ ` printf '%s\\n\\n%s\\n' ${shellQuote(prompt)} "$gtd_validate_out"`,
68681
+ ` exit "$gtd_validate_status"`,
68682
+ `fi`
68683
+ ].join("\n");
68684
+ };
68685
+ const renderStep = (step) => {
68686
+ if (step.kind === "command" && step.onFailure !== void 0) return failurePromptWrapper(step.command, step.onFailure);
68687
+ return step.command;
68688
+ };
68689
+ const assembleScript = (steps) => steps.length === 0 ? "" : ["set -eu", ...steps.map(renderStep)].join("\n\n");
68690
+ /** Build both halves from already-rendered command strings; an empty (or omitted) array produces the empty-string result, so a driver checking `if [ -n "$required" ]` never has to special-case a bare preamble. */
68691
+ const emitScripts = (required = [], optional = []) => ({
68692
+ required: assembleScript(required),
68693
+ optional: assembleScript(optional)
68694
+ });
68695
+ /** Exported so `src/testing/EmittedScriptRecognizer.ts` can recognize these by exact string comparison. `printf`, not `echo`, avoids shell-specific backslash-escape quirks. */
68696
+ const DID_NOT_RUN_COMMENT = "# gtd emitted this and did NOT run it — pipe it into `sh` to land the turn";
68697
+ const PRESENTATION_ONLY_COMMENT = "# presentation only — safe to skip";
68698
+ const PRESENTATION_FAILURE_WARNING = "printf 'gtd: presentation-only follow-up failed — continuing\\n' >&2";
68699
+ /**
68700
+ * A write command's single pasteable script (`gtd abandon | sh`,
68701
+ * `gtd land --json=script`'s own field). `optional`, when non-empty, is
68702
+ * wrapped in a subshell whose failure is swallowed — presentation-only, so it
68703
+ * must never turn a landed turn into a non-zero exit.
68704
+ */
68705
+ const combinedScript = (required, optional) => {
68706
+ if (required.length === 0) return "";
68707
+ if (optional.length === 0) return `${DID_NOT_RUN_COMMENT}\n\n${required}`;
68708
+ return [
68709
+ DID_NOT_RUN_COMMENT,
68710
+ "",
68711
+ required,
68712
+ "",
68713
+ PRESENTATION_ONLY_COMMENT,
68714
+ `(\n${optional}\n) || ${PRESENTATION_FAILURE_WARNING}`
68715
+ ].join("\n");
68716
+ };
68717
+ //#endregion
68718
+ //#region src/emit/OutcomeScript.ts
68719
+ /**
68720
+ * A `printf '<fmt>' <args...>` bash statement — `args` are already-valid bash
68721
+ * tokens (a `shellQuote`d literal, a `"$(git …)"` substitution), never
68722
+ * re-quoted here: a value reaches the script as a printf ARGUMENT, never
68723
+ * interpolated into the format itself, so a subject or state name containing
68724
+ * `%` can never be read as a conversion spec. Markers like `->` are arguments
68725
+ * too, keeping every format string free of a leading `-` that a shell's
68726
+ * `printf` could mistake for an option. A real newline in `fmt` is emitted as
68727
+ * the two-character `\n` escape `printf` itself expands, keeping every emitted
68728
+ * statement on one line.
68729
+ */
68730
+ const printfLine = (fmt, args) => `${OUTCOME_MARKER}\nprintf ${shellQuote(fmt.replace(/\n/g, "\\n"))} ${args.join(" ")}`;
68731
+ /**
68732
+ * Marks an emitted block as print-only. Load-bearing beyond documentation:
68733
+ * `src/testing/EmittedScriptRecognizer.ts` recognizes an outcome block by
68734
+ * this line, and a bare `printf` would be ambiguous with a workflow
68735
+ * `script:` command that happens to start the same way.
68736
+ */
68737
+ const OUTCOME_MARKER = "# gtd: outcome (print-only)";
68738
+ const FMT_ABANDON_NOOP = "no gtd process is underway (resting at \"%s\") — nothing to abandon\n";
68739
+ const FMT_ABANDONED = "abandoned the process resting at \"%s\" — HEAD is back at %s (\"%s\"), resting at \"%s\".\nEverything the process produced is kept as uncommitted changes (`git status`); discard them with `git checkout -- . && git clean -fd .gtd` for a clean tree.\n";
68740
+ const FMT_RESTORED = "restored the retained history — HEAD is back at %s (\"%s\"), resting at \"%s\". Resume with the loop, or `git reset` to any earlier turn to restart from there.\n";
68741
+ /** `no gtd process is underway (resting at "<initial>") — nothing to abandon` — `gtd abandon`'s no-op plain-text line. */
68742
+ const abandonNoopText = (initial) => renderFormat(FMT_ABANDON_NOOP, initial);
68743
+ /** One already-rendered plain line. */
68744
+ const noteOutcome = (text) => printfLine("%s\n", [shellQuote(text)]);
68745
+ /**
68746
+ * Resolves the post-hoc short hash/subject from `head` (a commitish) in-script
68747
+ * — this line runs AFTER the reset that made `head` the new HEAD, so neither
68748
+ * value is knowable when gtd generates it.
68749
+ */
68750
+ const abandonedOutcome = (from, head, state) => printfLine(FMT_ABANDONED, [
68751
+ shellQuote(from),
68752
+ `"$(git rev-parse --short ${shellQuote(head)})"`,
68753
+ `"$(git log -1 --format=%s ${shellQuote(head)})"`,
68754
+ shellQuote(state)
68755
+ ]);
68756
+ /** `gtd abandon`'s no-op outcome — the same wording `abandonNoopText` renders. */
68757
+ const abandonNoopOutcome = (initial) => noteOutcome(abandonNoopText(initial));
68758
+ /** Resolves the post-hoc short hash/subject from `to` (a commitish) in-script, for the same reason `abandonedOutcome` does. */
68759
+ const restoredOutcome = (to, state) => printfLine(FMT_RESTORED, [
68760
+ `"$(git rev-parse --short ${shellQuote(to)})"`,
68761
+ `"$(git log -1 --format=%s ${shellQuote(to)})"`,
68762
+ shellQuote(state)
68763
+ ]);
68764
+ //#endregion
68765
+ //#region src/emit/ModeContradiction.ts
68766
+ /**
68767
+ * Written for two readers at once, since gtd validate's exit code carries no
68768
+ * second meaning to distinguish them: the agent (this is a CONFIGURATION BUG,
68769
+ * not the steering file — stop, don't edit it, or a fix-retry loop will
68770
+ * thrash on the document) and the human (which mode, and the exact rendered
68771
+ * `format:` command, to fix `gtd.config.ts` without reproducing the failure).
68772
+ */
68773
+ const contradictionMessage = (mode, formatCommand) => `gtd: mode "${mode}"'s format: command breaks its own validator — this is a CONFIGURATION BUG, not a problem with the steering file. Do NOT edit the steering file — stop and end your turn now.\nThe rendered format: command that ran:\n${formatCommand}\nWhat it turned mode "${mode}"'s own canonical sample into:`;
68774
+ /**
68775
+ * Formats a copy of the mode's own canonical sample and re-validates it with
68776
+ * `gtd check <mode>`, failing loudly when the round-trip breaks it — detects a
68777
+ * mode whose `format:` contradicts its own `validate:` without ever touching
68778
+ * the real steering file. `printf '%s'` over a `shellQuote`d sample, never a
68779
+ * heredoc, since no delimiter chosen ahead of time can collide with the
68780
+ * sample's own bytes. One bash fragment with no blank lines (so
68781
+ * `src/emit/Emit.ts`'s `assembleScript` never splits it from a sibling step), meant
68782
+ * to run BEFORE `[ -f <file> ] || exit 0` in the emitted validate script so it
68783
+ * still fires at a first-write beat where the real steering file doesn't
68784
+ * exist yet.
68785
+ */
68786
+ const buildModeContradictionCheck = (inputs) => {
68787
+ const { mode, samplePath, sample, formatCommand } = inputs;
68788
+ const pathQ = shellQuote(samplePath);
68789
+ const messageQ = shellQuote(contradictionMessage(mode, formatCommand));
68790
+ return [
68791
+ `printf '%s' ${shellQuote(sample)} > ${pathQ}`,
68792
+ formatCommand,
68793
+ `gtd check ${mode} ${pathQ} >/dev/null 2>&1 || {`,
68794
+ ` printf '%s\\n' ${messageQ} >&2`,
68795
+ ` cat ${pathQ} >&2`,
68796
+ ` rm -f ${pathQ}`,
68797
+ ` exit 1`,
68798
+ `}`,
68799
+ `rm -f ${pathQ}`
68800
+ ].join("\n");
68801
+ };
68802
+ /**
68803
+ * Skip notice for a mode whose validator is EXTERNAL (a user `validate:`
68804
+ * command, not one of the two built-in modes) — there's no in-process parser
68805
+ * to round-trip a sample through. Printed to stderr since silence would read
68806
+ * as a clean bill of health.
68807
+ */
68808
+ const modeContradictionSkipNotice = (mode) => {
68809
+ return `printf '%s\\n' ${shellQuote(`gtd: mode "${mode}" has an external validate: command — skipping the format/validate contradiction check`)} >&2`;
68810
+ };
68811
+ //#endregion
68812
+ //#region src/emit/SteeringMode.ts
68813
+ /**
68814
+ * `format` alone (no live/external verdict) when there's no validator at
68815
+ * all; a live in-process validator for a `"builtin"` validate OR a command
68816
+ * that is exactly the format's own seeded string; `externalValidate` for any
68817
+ * other command. Each arm returns directly — a flat sequence, not nested
68818
+ * ternaries — so the four outcomes stay each their own case to read, not a
68819
+ * boolean expression to re-derive.
68820
+ */
68821
+ const capabilitiesFor = (mode, format, validate) => {
68822
+ if (format === void 0) return validate?.kind === "command" ? { externalValidate: true } : {};
68823
+ if (validate?.kind === "builtin") return {
68824
+ format,
68825
+ liveValidate: format.validate
68826
+ };
68827
+ if (validate === void 0) return { format };
68828
+ if (isSeededValidateCommand(mode, validate.command)) return {
68829
+ format,
68830
+ liveValidate: format.validate
68831
+ };
68832
+ return {
68833
+ format,
68834
+ externalValidate: true
68835
+ };
68836
+ };
68837
+ /**
68838
+ * Resolve a `mode:` name against `def.modes` plus the built-in registry
68839
+ * (`src/workflow/SteeringFormats.ts`) — half by half: a declared `format:`/`validate:`
68840
+ * wins, and an undeclared `validate:` falls back to the built-in format's own
68841
+ * parser when the name is registered. `format` is set from the registry
68842
+ * ALONE, independent of which half of `validate` wins — a declared validator
68843
+ * overrides validation, not the format identity.
68844
+ *
68845
+ * `def: undefined` is the LSP's built-in-only fallback — resolving `mode`
68846
+ * against the registry alone, with no workflow definition in hand (e.g. the
68847
+ * basename dispatch for a `REVIEW.md` no config maps).
68848
+ *
68849
+ * The `"unknown"` arm carries the whole refusal message, naming what IS known
68850
+ * when `def` is given — this is the one place that message is built, so it
68851
+ * can never drift from what actually resolved.
68852
+ */
68853
+ const resolveMode = (def, state, mode) => {
68854
+ const declared = def?.modes?.[mode];
68855
+ const format = steeringFormatFor(mode);
68856
+ if (declared === void 0 && format === void 0) return {
68857
+ kind: "unknown",
68858
+ message: def !== void 0 ? `state "${state}": mode "${mode}" is not defined by the active workflow (known modes: ${knownModes(def).join(", ")})` : `mode "${mode}" is not a built-in steering format`
68859
+ };
68860
+ const validate = declared?.validate !== void 0 ? {
68861
+ kind: "command",
68862
+ command: declared.validate
68863
+ } : format !== void 0 ? {
68864
+ kind: "builtin",
68865
+ format
68866
+ } : void 0;
68867
+ return {
68868
+ kind: "resolved",
68869
+ mode,
68870
+ ...format !== void 0 ? { format } : {},
68871
+ ...declared?.format !== void 0 ? { formatCommand: declared.format } : {},
68872
+ ...validate !== void 0 ? { validate } : {},
68873
+ capabilities: capabilitiesFor(mode, format, validate)
68874
+ };
68875
+ };
68876
+ /** `gtd next`'s fix-retry instruction, printed ahead of the failing command's captured output. */
68877
+ const fixPromptInstruction = (file) => `Your last turn does not pass its own validation script. Fix these format violations in ${file}, then finish:`;
68878
+ /**
68879
+ * Pushes a `binaryGuard` step ahead of `command` when its own leading word
68880
+ * is unambiguous — BEFORE, not wrapped around: a guard that fails must stop
68881
+ * the script on its own `exit 127`, without touching `failurePromptWrapper`'s
68882
+ * captured-output path. Each command guards on its OWN leading word — a
68883
+ * guard naming the wrong binary is worse than none.
68884
+ */
68885
+ const pushGuardedCommand = (steps, mode, key, command, file, onFailure) => {
68886
+ const binary = extractLeadingBinary(command);
68887
+ if (binary !== void 0) steps.push({
68888
+ kind: "command",
68889
+ command: binaryGuard(binary, mode, key)
68890
+ });
68891
+ steps.push({
68892
+ kind: "command",
68893
+ command: withFileVar(command, file),
68894
+ ...onFailure !== void 0 ? { onFailure } : {}
68895
+ });
68896
+ };
68897
+ /**
68898
+ * `resolved`'s `format:`/`validate:` as `EmitStep[]` — format first,
68899
+ * validate last, the last one wrapped with `onFailure` when the validator is
68900
+ * a command (a built-in's own in-process parser has no shell step to wrap:
68901
+ * `gtd check`'s seeded command carries that instead). Each command gets its
68902
+ * own `binaryGuard` immediately ahead of it.
68903
+ */
68904
+ const modeCommandSteps = (resolved, file) => {
68905
+ const steps = [];
68906
+ if (resolved.formatCommand !== void 0) pushGuardedCommand(steps, resolved.mode, "format", resolved.formatCommand, file, void 0);
68907
+ if (resolved.validate?.kind === "command") pushGuardedCommand(steps, resolved.mode, "validate", resolved.validate.command, file, fixPromptInstruction(file));
68908
+ return steps;
68909
+ };
68910
+ /** `<Host.scratchDir>/gtd-mode-sample-<mode>-<pid>.md` — an absolute literal baked in at emit time, never a shell variable. `<pid>` avoids collisions between concurrent `gtd` processes. Never a `/tmp` literal or `mktemp` (`tests/tooling/no-tmp-assumption.test.ts` scans for both). */
68911
+ const scratchSamplePath = (scratchDir, mode) => join(scratchDir, `gtd-mode-sample-${mode}-${process.pid}.md`);
68912
+ /**
68913
+ * The contradiction round-trip/skip-notice steps for `resolved`'s `mode:`.
68914
+ * No `formatCommand` means nothing to round-trip: empty. Otherwise: a live
68915
+ * built-in validator runs the round-trip against that format's own canonical
68916
+ * sample; an external validator prints a one-line skip notice instead, since
68917
+ * silence there would read as a clean bill of health; a format-only mode with
68918
+ * neither has nothing to round-trip either.
68919
+ */
68920
+ const modeContradictionSteps = (resolved) => gen(function* () {
68921
+ if (resolved.formatCommand === void 0) return [];
68922
+ const { capabilities } = resolved;
68923
+ if (capabilities.format !== void 0 && capabilities.liveValidate !== void 0) {
68924
+ const { scratchDir } = yield* Host;
68925
+ const samplePath = scratchSamplePath(scratchDir, resolved.mode);
68926
+ const formatCommand = withFileVar(resolved.formatCommand, samplePath);
68927
+ return [{
68928
+ kind: "command",
68929
+ command: buildModeContradictionCheck({
68930
+ mode: resolved.mode,
68931
+ samplePath,
68932
+ sample: capabilities.format.sample,
68933
+ formatCommand
68934
+ })
68935
+ }];
68936
+ }
68937
+ if (capabilities.externalValidate === true) return [{
68938
+ kind: "command",
68939
+ command: modeContradictionSkipNotice(resolved.mode)
68940
+ }];
68941
+ return [];
68942
+ });
68943
+ /**
68944
+ * Renders `resolved`'s complete validate script for `file`: the mode's
68945
+ * format/validate contradiction check, a guard for a not-yet-written file,
68946
+ * then the format/validate commands themselves (format first). gtd never
68947
+ * runs this script itself — `resolveMode`+`validateScriptFor` only render
68948
+ * text for a driver to execute (`gtd renders; the driver executes`).
68949
+ */
68950
+ const validateScriptFor = (resolved, file) => gen(function* () {
68951
+ return { script: emitScripts([
68952
+ ...yield* modeContradictionSteps(resolved),
68953
+ {
68954
+ kind: "command",
68955
+ command: fileExistsGuard(file)
68956
+ },
68957
+ ...modeCommandSteps(resolved, file)
68958
+ ]).required };
68959
+ });
68960
+ //#endregion
69167
68961
  //#region src/program.ts
69168
68962
  /**
69169
68963
  * A command-level failure that should exit like a CLI usage error (2), not a
@@ -69180,8 +68974,13 @@ const writeSelection = (out, fields, path) => gen(function* () {
69180
68974
  if (selection.kind === "value") out.write(`${selection.text}\n`);
69181
68975
  else if (selection.kind === "unknown") return yield* fail$7(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
69182
68976
  });
68977
+ /** How to run THIS gtd — a driver (the loop, the LSP) never reads a different version's state than the one it ships with. */
68978
+ const selfGtd = () => {
68979
+ const script = process.argv[1];
68980
+ return script === void 0 ? ["gtd"] : [process.execPath, script];
68981
+ };
69183
68982
  /** `needs: "none"` skips the repo-root guard — the server is keyed on file name, not workflow state. */
69184
- const runLspCommand = () => startLspServer();
68983
+ const runLspCommand = () => startLspServer({ gtd: selfGtd() });
69185
68984
  /**
69186
68985
  * Prints the briefing, emitted by the binary itself so it's always current.
69187
68986
  * At a repository root no `gtd.config.ts` governs yet, it also writes one
@@ -69199,10 +68998,7 @@ const runInstallCommand = (out) => gen(function* () {
69199
68998
  yield* (yield* Workspace).write(WORKFLOW_MODULE, CONFIG_SCAFFOLD);
69200
68999
  yield* (yield* Narrator).warn(`gtd install: wrote ${WORKFLOW_MODULE}, importing gtd's shipped workflows — commit it before your first \`gtd land\``);
69201
69000
  });
69202
- const runLoopCommand = () => {
69203
- const script = process.argv[1];
69204
- return runLoop({ gtd: script === void 0 ? ["gtd"] : [process.execPath, script] }).pipe(provide$2(liveLoopHost));
69205
- };
69001
+ const runLoopCommand = () => runLoop({ gtd: selfGtd() }).pipe(provide$1(liveLoopHost));
69206
69002
  /**
69207
69003
  * Exactly one trailing newline — duplicated from `Cli.ts`'s own
69208
69004
  * `normalizeTrailingNewline` rather than imported, to avoid a circular value
@@ -69222,8 +69018,8 @@ const normalizeScriptNewline = (script) => script.length === 0 ? script : `${scr
69222
69018
  const landingScript = (required) => combinedScript(required, "");
69223
69019
  const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
69224
69020
  /** Decides `gtd land`'s one transition without performing it. Refusals fail the Effect; a no-op returns `subject: null` and empty scripts. */
69225
- const planLanding = (opts = {}) => gen(function* () {
69226
- const rest = yield* currentRest;
69021
+ const planLanding = (opts = {}, current) => gen(function* () {
69022
+ const rest = current ?? (yield* currentRest);
69227
69023
  const outcome = planStep(yield* snapshotFromRest(rest, opts.judge), opts);
69228
69024
  if (outcome.kind === "refusal") return yield* fail$7(new Error(outcome.message));
69229
69025
  if (outcome.kind === "noop") {
@@ -69358,7 +69154,7 @@ const runJudgeAnswerCommand = (json, out) => gen(function* () {
69358
69154
  catch: () => new SelectorUsageError("gtd judge answer: stdin is not valid JSON")
69359
69155
  });
69360
69156
  const verdict = yield* decodeUnknown(verdictSchemaFor(ids))(parsed).pipe(mapError$1((e) => new SelectorUsageError(`gtd judge answer: the verdict on stdin does not match the pending questions — ${e.message}`)));
69361
- const built = landFields(yield* planLanding({ judge: verdict }));
69157
+ const built = landFields(yield* planLanding({ judge: verdict }, rest));
69362
69158
  if (json.kind === "document") out.write(renderLandJson(built));
69363
69159
  else if (json.kind === "select") yield* writeSelection(out, built, json.path);
69364
69160
  else out.write(renderLandPlain(built, "judge answer"));
@@ -69398,7 +69194,8 @@ const runStartCommand = (actor, workflow, varOverrides, out, commandLabel) => ge
69398
69194
  workflow: resolved,
69399
69195
  first: started,
69400
69196
  commandLabel,
69401
- vars: varOverrides
69197
+ vars: varOverrides,
69198
+ config: rest.config
69402
69199
  });
69403
69200
  if (plan.kind === "refusal") return yield* fail$7(new Error(plan.message));
69404
69201
  out.write(landingScript(ScriptSurface.render(plan.steps)));
@@ -70721,7 +70518,7 @@ const runCli = (argv, io) => {
70721
70518
  return runCommand(plan.command, plan.json, out).pipe(map$4(() => {
70722
70519
  out.flush();
70723
70520
  io.exit(0);
70724
- }), provide$2(io.layers(plan.verbose)), sandbox, catchAll((cause) => isInterruptedOnly(cause) ? failCause$2(cause) : report(io, plan.json.kind !== "off")(cause)));
70521
+ }), provide$1(io.layers(plan.verbose)), sandbox, catchAll((cause) => isInterruptedOnly(cause) ? failCause$2(cause) : report(io, plan.json.kind !== "off")(cause)));
70725
70522
  };
70726
70523
  //#endregion
70727
70524
  //#region src/main.ts