lalph 0.3.113 → 0.3.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -7858,7 +7858,7 @@ var FiberImpl = class {
7858
7858
  if (this.currentStackFrame) cause = causeAnnotate(cause, make$89(StackTraceKey, this.currentStackFrame));
7859
7859
  if (annotations) cause = causeAnnotate(cause, annotations);
7860
7860
  this._interruptedCause = this._interruptedCause ? causeCombine(this._interruptedCause, cause) : cause;
7861
- if (this.interruptible) this.evaluate(failCause$6(this._interruptedCause));
7861
+ if (this.interruptible) this.evaluate(failCause$5(this._interruptedCause));
7862
7862
  }
7863
7863
  pollUnsafe() {
7864
7864
  return this._exit;
@@ -8049,7 +8049,7 @@ const fiberInterruptAll = (fibers) => withFiber$1((parent) => {
8049
8049
  /** @internal */
8050
8050
  const succeed$8 = exitSucceed;
8051
8051
  /** @internal */
8052
- const failCause$6 = exitFailCause;
8052
+ const failCause$5 = exitFailCause;
8053
8053
  /** @internal */
8054
8054
  const fail$9 = exitFail;
8055
8055
  /** @internal */
@@ -8159,7 +8159,7 @@ const asyncFinalizer = /* @__PURE__ */ makePrimitive$1({
8159
8159
  }
8160
8160
  },
8161
8161
  [contE](cause, _fiber) {
8162
- return hasInterrupts$2(cause) ? flatMap$7(this[args](), () => failCause$6(cause)) : failCause$6(cause);
8162
+ return hasInterrupts$2(cause) ? flatMap$7(this[args](), () => failCause$5(cause)) : failCause$5(cause);
8163
8163
  }
8164
8164
  });
8165
8165
  /** @internal */
@@ -8289,6 +8289,8 @@ const tap$2 = /* @__PURE__ */ dual(2, (self, f) => flatMap$7(self, (a) => as$2(i
8289
8289
  /** @internal */
8290
8290
  const asVoid$2 = (self) => flatMap$7(self, (_) => exitVoid);
8291
8291
  /** @internal */
8292
+ const sandbox$1 = (self) => catchCause$3(self, fail$9);
8293
+ /** @internal */
8292
8294
  const raceAllFirst$1 = (all, options) => withFiber$1((parent) => callback$2((resume) => {
8293
8295
  let done = false;
8294
8296
  const fibers = /* @__PURE__ */ new Set();
@@ -8459,7 +8461,7 @@ const forever$2 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, opt
8459
8461
  step: constVoid
8460
8462
  }));
8461
8463
  /** @internal */
8462
- const catchCause$4 = /* @__PURE__ */ dual(2, (self, f) => {
8464
+ const catchCause$3 = /* @__PURE__ */ dual(2, (self, f) => {
8463
8465
  const onFailure = Object.create(OnFailureProto);
8464
8466
  onFailure[args] = self;
8465
8467
  onFailure[contE] = f.length !== 1 ? (cause) => f(cause) : f;
@@ -8473,9 +8475,9 @@ const OnFailureProto = /* @__PURE__ */ makePrimitiveProto({
8473
8475
  }
8474
8476
  });
8475
8477
  /** @internal */
8476
- const catchCauseFilter$2 = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause$4(self, (cause) => {
8478
+ const catchCauseFilter$2 = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause$3(self, (cause) => {
8477
8479
  const eb = filter(cause);
8478
- return isFailure$4(eb) ? failCause$6(eb.failure) : internalCall(() => f(eb.success, cause));
8480
+ return isFailure$4(eb) ? failCause$5(eb.failure) : internalCall(() => f(eb.success, cause));
8479
8481
  }));
8480
8482
  /** @internal */
8481
8483
  const catch_$3 = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter$2(self, findError$2, (e) => f(e)));
@@ -8487,12 +8489,12 @@ const catchNoSuchElement$1 = (self) => matchEffect$2(self, {
8487
8489
  /** @internal */
8488
8490
  const catchDefect$1 = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter$2(self, findDefect$2, f));
8489
8491
  /** @internal */
8490
- const tapCause$2 = /* @__PURE__ */ dual(2, (self, f) => catchCause$4(self, (cause) => andThen$1(internalCall(() => f(cause)), failCause$6(cause))));
8492
+ const tapCause$2 = /* @__PURE__ */ dual(2, (self, f) => catchCause$3(self, (cause) => andThen$1(internalCall(() => f(cause)), failCause$5(cause))));
8491
8493
  /** @internal */
8492
- const tapCauseFilter$1 = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause$4(self, (cause) => {
8494
+ const tapCauseFilter$1 = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause$3(self, (cause) => {
8493
8495
  const result = filter(cause);
8494
- if (isFailure$4(result)) return failCause$6(cause);
8495
- return andThen$1(internalCall(() => f(result.success, cause)), failCause$6(cause));
8496
+ if (isFailure$4(result)) return failCause$5(cause);
8497
+ return andThen$1(internalCall(() => f(result.success, cause)), failCause$5(cause));
8496
8498
  }));
8497
8499
  /** @internal */
8498
8500
  const tapError$1 = /* @__PURE__ */ dual(2, (self, f) => tapCauseFilter$1(self, findError$2, (e) => f(e)));
@@ -8502,18 +8504,18 @@ const tapErrorTag$1 = /* @__PURE__ */ dual(3, (self, k, f) => {
8502
8504
  return tapError$1(self, (error) => predicate(error) ? f(error) : void_$4);
8503
8505
  });
8504
8506
  /** @internal */
8505
- const catchIf$3 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$4(self, (cause) => {
8507
+ const catchIf$3 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$3(self, (cause) => {
8506
8508
  const error = findError$2(cause);
8507
- if (isFailure$4(error)) return failCause$6(error.failure);
8508
- if (!predicate(error.success)) return orElse ? internalCall(() => orElse(error.success)) : failCause$6(cause);
8509
+ if (isFailure$4(error)) return failCause$5(error.failure);
8510
+ if (!predicate(error.success)) return orElse ? internalCall(() => orElse(error.success)) : failCause$5(cause);
8509
8511
  return internalCall(() => f(error.success));
8510
8512
  }));
8511
8513
  /** @internal */
8512
- const catchFilter$3 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$4(self, (cause) => {
8514
+ const catchFilter$3 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$3(self, (cause) => {
8513
8515
  const error = findError$2(cause);
8514
- if (isFailure$4(error)) return failCause$6(error.failure);
8516
+ if (isFailure$4(error)) return failCause$5(error.failure);
8515
8517
  const result = filter(error.success);
8516
- if (isFailure$4(result)) return orElse ? internalCall(() => orElse(result.failure)) : failCause$6(cause);
8518
+ if (isFailure$4(result)) return orElse ? internalCall(() => orElse(result.failure)) : failCause$5(cause);
8517
8519
  return internalCall(() => f(result.success));
8518
8520
  }));
8519
8521
  /** @internal */
@@ -8556,24 +8558,12 @@ const ignore$2 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, opti
8556
8558
  return matchCauseEffect$1(self, {
8557
8559
  onFailure(cause) {
8558
8560
  const failure = findFail$1(cause);
8559
- return isFailure$4(failure) ? failCause$6(failure.failure) : options.message === void 0 ? logEffect(cause) : logEffect(options.message, cause);
8561
+ return isFailure$4(failure) ? failCause$5(failure.failure) : options.message === void 0 ? logEffect(cause) : logEffect(options.message, cause);
8560
8562
  },
8561
8563
  onSuccess: (_) => void_$4
8562
8564
  });
8563
8565
  });
8564
8566
  /** @internal */
8565
- const ignoreCause$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, options) => {
8566
- if (!options?.log) return matchCauseEffect$1(self, {
8567
- onFailure: (_) => void_$4,
8568
- onSuccess: (_) => void_$4
8569
- });
8570
- const logEffect = logWithLevel$1(options.log === true ? void 0 : options.log);
8571
- return matchCauseEffect$1(self, {
8572
- onFailure: (cause) => options.message === void 0 ? logEffect(cause) : logEffect(options.message, cause),
8573
- onSuccess: (_) => void_$4
8574
- });
8575
- });
8576
- /** @internal */
8577
8567
  const option$2 = (self) => match$6(self, {
8578
8568
  onFailure: none$4,
8579
8569
  onSuccess: some$2
@@ -8607,7 +8597,7 @@ const matchCause$1 = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect
8607
8597
  const matchEffect$2 = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect$1(self, {
8608
8598
  onFailure: (cause) => {
8609
8599
  const fail = cause.reasons.find(isFailReason$1);
8610
- return fail ? internalCall(() => options.onFailure(fail.error)) : failCause$6(cause);
8600
+ return fail ? internalCall(() => options.onFailure(fail.error)) : failCause$5(cause);
8611
8601
  },
8612
8602
  onSuccess: options.onSuccess
8613
8603
  }));
@@ -8652,9 +8642,9 @@ const exitPrimitive = /* @__PURE__ */ makePrimitive$1({
8652
8642
  /** @internal */
8653
8643
  const delay$1 = /* @__PURE__ */ dual(2, (self, duration) => andThen$1(sleep$1(duration), self));
8654
8644
  /** @internal */
8655
- const timeoutOrElse$2 = /* @__PURE__ */ dual(2, (self, options) => raceFirst$1(self, flatMap$7(sleep$1(options.duration), options.orElse)));
8645
+ const timeoutOrElse$1 = /* @__PURE__ */ dual(2, (self, options) => raceFirst$1(self, flatMap$7(sleep$1(options.duration), options.orElse)));
8656
8646
  /** @internal */
8657
- const timeout$1 = /* @__PURE__ */ dual(2, (self, duration) => timeoutOrElse$2(self, {
8647
+ const timeout$1 = /* @__PURE__ */ dual(2, (self, duration) => timeoutOrElse$1(self, {
8658
8648
  duration,
8659
8649
  orElse: () => fail$9(new TimeoutError$1())
8660
8650
  }));
@@ -8842,7 +8832,7 @@ const cachedWithTTL$1 = /* @__PURE__ */ dual(2, (self, timeToLive) => map$13(cac
8842
8832
  /** @internal */
8843
8833
  const cached$2 = (self) => cachedWithTTL$1(self, infinity);
8844
8834
  /** @internal */
8845
- const interrupt$4 = /* @__PURE__ */ withFiber$1((fiber) => failCause$6(causeInterrupt(fiber.id)));
8835
+ const interrupt$4 = /* @__PURE__ */ withFiber$1((fiber) => failCause$5(causeInterrupt(fiber.id)));
8846
8836
  /** @internal */
8847
8837
  const uninterruptible$1 = (self) => withFiber$1((fiber) => {
8848
8838
  if (!fiber.interruptible) return self;
@@ -8854,7 +8844,7 @@ const setInterruptible = /* @__PURE__ */ makePrimitive$1({
8854
8844
  op: "SetInterruptible",
8855
8845
  [contAll](fiber) {
8856
8846
  fiber.interruptible = this[args];
8857
- if (fiber._interruptedCause && fiber.interruptible) return () => failCause$6(fiber._interruptedCause);
8847
+ if (fiber._interruptedCause && fiber.interruptible) return () => failCause$5(fiber._interruptedCause);
8858
8848
  }
8859
8849
  });
8860
8850
  const setInterruptibleTrue = /* @__PURE__ */ setInterruptible(true);
@@ -8864,7 +8854,7 @@ const interruptible$1 = (self) => withFiber$1((fiber) => {
8864
8854
  if (fiber.interruptible) return self;
8865
8855
  fiber.interruptible = true;
8866
8856
  fiber._stack.push(setInterruptibleFalse);
8867
- if (fiber._interruptedCause) return failCause$6(fiber._interruptedCause);
8857
+ if (fiber._interruptedCause) return failCause$5(fiber._interruptedCause);
8868
8858
  return self;
8869
8859
  });
8870
8860
  /** @internal */
@@ -9640,7 +9630,7 @@ const succeed$7 = exitSucceed;
9640
9630
  * @category constructors
9641
9631
  * @since 2.0.0
9642
9632
  */
9643
- const failCause$5 = exitFailCause;
9633
+ const failCause$4 = exitFailCause;
9644
9634
  /**
9645
9635
  * Creates a failed Exit from a typed error value.
9646
9636
  *
@@ -9962,7 +9952,7 @@ const done$1 = completeWith;
9962
9952
  * @since 2.0.0
9963
9953
  * @category utils
9964
9954
  */
9965
- const failCause$4 = /* @__PURE__ */ dual(2, (self, cause) => done$1(self, exitFailCause(cause)));
9955
+ const failCause$3 = /* @__PURE__ */ dual(2, (self, cause) => done$1(self, exitFailCause(cause)));
9966
9956
  /**
9967
9957
  * Completes the `Deferred` with interruption. This will interrupt all fibers
9968
9958
  * waiting on the value of the `Deferred` with the specified `FiberId`.
@@ -9981,7 +9971,7 @@ const failCause$4 = /* @__PURE__ */ dual(2, (self, cause) => done$1(self, exitFa
9981
9971
  * @since 2.0.0
9982
9972
  * @category utils
9983
9973
  */
9984
- const interruptWith = /* @__PURE__ */ dual(2, (self, fiberId) => failCause$4(self, causeInterrupt(fiberId)));
9974
+ const interruptWith = /* @__PURE__ */ dual(2, (self, fiberId) => failCause$3(self, causeInterrupt(fiberId)));
9985
9975
  /**
9986
9976
  * Returns `true` if this `Deferred` has already been completed with a value or
9987
9977
  * an error, `false` otherwise.
@@ -11434,7 +11424,7 @@ const flatMap$6 = /* @__PURE__ */ dual(2, (self, f) => fromBuild((memoMap, scope
11434
11424
  * @since 4.0.0
11435
11425
  * @category sequencing
11436
11426
  */
11437
- const tapCause$1 = /* @__PURE__ */ dual(2, (self, f) => fromBuild((memoMap, scope) => catchCause$4(self.build(memoMap, scope), (cause) => provide$4(andThen$1(f(cause), failCause$6(cause)), scope))));
11427
+ const tapCause$1 = /* @__PURE__ */ dual(2, (self, f) => fromBuild((memoMap, scope) => catchCause$3(self.build(memoMap, scope), (cause) => provide$4(andThen$1(f(cause), failCause$5(cause)), scope))));
11438
11428
  /**
11439
11429
  * Translates effect failure into death of the fiber, making all failures
11440
11430
  * unchecked and not a part of the type of the layer.
@@ -11538,7 +11528,7 @@ const orDie$3 = (self) => fromBuildUnsafe((memoMap, scope) => orDie$4(self.build
11538
11528
  * @since 2.0.0
11539
11529
  * @category error handling
11540
11530
  */
11541
- const catchCause$3 = /* @__PURE__ */ dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => catchCause$4(self.build(memoMap, scope), (cause) => onError(cause).build(memoMap, scope))));
11531
+ const catchCause$2 = /* @__PURE__ */ dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => catchCause$3(self.build(memoMap, scope), (cause) => onError(cause).build(memoMap, scope))));
11542
11532
  /**
11543
11533
  * Creates a fresh version of this layer that will not be shared.
11544
11534
  *
@@ -12796,7 +12786,7 @@ const filterDoneLeftover = /* @__PURE__ */ composePassthrough(findError, (e) =>
12796
12786
  */
12797
12787
  const doneExitFromCause = (cause) => {
12798
12788
  const halt = filterDone(cause);
12799
- return !isFailure$4(halt) ? succeed$7(halt.success.value) : failCause$5(halt.failure);
12789
+ return !isFailure$4(halt) ? succeed$7(halt.success.value) : failCause$4(halt.failure);
12800
12790
  };
12801
12791
  /**
12802
12792
  * Pattern matches on a Pull, handling success, failure, and done cases.
@@ -13003,7 +12993,7 @@ const fromStepWithMetadata = (step) => fromStep(map$13(step, (f) => {
13003
12993
  * @since 4.0.0
13004
12994
  * @category destructors
13005
12995
  */
13006
- const toStep = (schedule) => catchCause$4(schedule.step, (cause) => succeed$8(() => failCause$6(cause)));
12996
+ const toStep = (schedule) => catchCause$3(schedule.step, (cause) => succeed$8(() => failCause$5(cause)));
13007
12997
  /**
13008
12998
  * Extracts a step function from a Schedule that provides metadata about each
13009
12999
  * execution. It will also handle sleeping for the computed delay.
@@ -13136,7 +13126,7 @@ const either = /* @__PURE__ */ dual(2, (self, other) => eitherWith(self, other,
13136
13126
  */
13137
13127
  const eitherWith = /* @__PURE__ */ dual(3, (self, other, combine) => fromStep(map$13(zip$1(toStep(self), toStep(other)), ([stepLeft, stepRight]) => (now, input) => matchEffect$1(stepLeft(now, input), {
13138
13128
  onSuccess: (leftResult) => stepRight(now, input).pipe(map$13((rightResult) => [combine(leftResult[0], rightResult[0]), min$2(leftResult[1], rightResult[1])]), catchDone((rightDone) => succeed$8([combine(leftResult[0], rightDone), leftResult[1]]))),
13139
- onFailure: failCause$6,
13129
+ onFailure: failCause$5,
13140
13130
  onDone: (leftDone) => stepRight(now, input).pipe(map$13((rightResult) => [combine(leftDone, rightResult[0]), rightResult[1]]), catchDone((rightDone) => done(combine(leftDone, rightDone))))
13141
13131
  }))));
13142
13132
  /**
@@ -13269,7 +13259,7 @@ const jittered = (self) => modifyDelay(self, (_, delay) => map$13(randomNext, (r
13269
13259
  */
13270
13260
  const passthrough$2 = (self) => fromStep(map$13(toStep(self), (step) => (now, input) => matchEffect$1(step(now, input), {
13271
13261
  onSuccess: (result) => succeed$8([input, result[1]]),
13272
- onFailure: failCause$6,
13262
+ onFailure: failCause$5,
13273
13263
  onDone: () => done(input)
13274
13264
  })));
13275
13265
  /**
@@ -14306,7 +14296,7 @@ const fail$6 = fail$9;
14306
14296
  * @since 2.0.0
14307
14297
  * @category Creating Effects
14308
14298
  */
14309
- const failCause$3 = failCause$6;
14299
+ const failCause$2 = failCause$5;
14310
14300
  /**
14311
14301
  * Creates an effect that terminates a fiber with a specified error.
14312
14302
  *
@@ -15105,7 +15095,7 @@ const catchReason$2 = catchReason$3;
15105
15095
  * @since 4.0.0
15106
15096
  * @category Error Handling
15107
15097
  */
15108
- const catchCause$2 = catchCause$4;
15098
+ const catchCause$1 = catchCause$3;
15109
15099
  /**
15110
15100
  * Recovers from all defects using a provided recovery function.
15111
15101
  *
@@ -15464,6 +15454,41 @@ const tapCause = tapCause$2;
15464
15454
  */
15465
15455
  const retry$1 = retry$2;
15466
15456
  /**
15457
+ * The `sandbox` function transforms an effect by exposing the full cause
15458
+ * of any error, defect, or fiber interruption that might occur during its
15459
+ * execution. It changes the error channel of the effect to include detailed
15460
+ * information about the cause, which is wrapped in a `Cause<E>` type.
15461
+ *
15462
+ * This function is useful when you need access to the complete underlying cause
15463
+ * of failures, defects, or interruptions, enabling more detailed error
15464
+ * handling. Once you apply `sandbox`, you can use operators like
15465
+ * {@link catchAll} and {@link catchTags} to handle specific error conditions.
15466
+ * If necessary, you can revert the sandboxing operation with {@link unsandbox}
15467
+ * to return to the original error handling behavior.
15468
+ *
15469
+ * @example
15470
+ * ```ts
15471
+ * import { Cause, Effect } from "effect"
15472
+ *
15473
+ * const task = Effect.fail("Something went wrong")
15474
+ *
15475
+ * // Sandbox exposes the full cause as the error type
15476
+ * const program = Effect.gen(function*() {
15477
+ * const result = yield* Effect.flip(Effect.sandbox(task))
15478
+ * return `Caught cause: ${Cause.squash(result)}`
15479
+ * })
15480
+ *
15481
+ * Effect.runPromise(program).then(console.log)
15482
+ * // Output: "Caught cause: Something went wrong"
15483
+ * ```
15484
+ *
15485
+ * @see {@link unsandbox} to restore the original error handling.
15486
+ *
15487
+ * @since 2.0.0
15488
+ * @category Error Handling
15489
+ */
15490
+ const sandbox = sandbox$1;
15491
+ /**
15467
15492
  * Discards both the success and failure values of an effect.
15468
15493
  *
15469
15494
  * **When to Use**
@@ -15511,26 +15536,6 @@ const retry$1 = retry$2;
15511
15536
  */
15512
15537
  const ignore$1 = ignore$2;
15513
15538
  /**
15514
- * Ignores the effect's failure cause, including defects and interruptions.
15515
- *
15516
- * Use the `log` option to emit the full {@link Cause} when the effect fails,
15517
- * and `message` to prepend a custom log message.
15518
- *
15519
- * @example
15520
- * ```ts
15521
- * import { Effect } from "effect"
15522
- *
15523
- * const task = Effect.fail("boom")
15524
- *
15525
- * const program = task.pipe(Effect.ignoreCause)
15526
- * const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
15527
- * ```
15528
- *
15529
- * @since 4.0.0
15530
- * @category Error Handling
15531
- */
15532
- const ignoreCause = ignoreCause$1;
15533
- /**
15534
15539
  * Replaces the original failure with a success value, ensuring the effect
15535
15540
  * cannot fail.
15536
15541
  *
@@ -15655,7 +15660,7 @@ const timeout = timeout$1;
15655
15660
  * @since 3.1.0
15656
15661
  * @category Delays & Timeouts
15657
15662
  */
15658
- const timeoutOrElse$1 = timeoutOrElse$2;
15663
+ const timeoutOrElse = timeoutOrElse$1;
15659
15664
  /**
15660
15665
  * Returns an effect that is delayed from this effect by the specified
15661
15666
  * `Duration`.
@@ -26761,7 +26766,7 @@ const offerAllUnsafe = (self, messages) => {
26761
26766
  * @category Completion
26762
26767
  * @since 4.0.0
26763
26768
  */
26764
- const fail$4 = (self, error) => failCause$2(self, causeFail(error));
26769
+ const fail$4 = (self, error) => failCause$1(self, causeFail(error));
26765
26770
  /**
26766
26771
  * Fail the queue with a cause. If the queue is already done, `false` is
26767
26772
  * returned.
@@ -26788,7 +26793,7 @@ const fail$4 = (self, error) => failCause$2(self, causeFail(error));
26788
26793
  * @category Completion
26789
26794
  * @since 4.0.0
26790
26795
  */
26791
- const failCause$2 = /* @__PURE__ */ dual(2, (self, cause) => sync$2(() => failCauseUnsafe(self, cause)));
26796
+ const failCause$1 = /* @__PURE__ */ dual(2, (self, cause) => sync$2(() => failCauseUnsafe(self, cause)));
26792
26797
  /**
26793
26798
  * Fail the queue with a cause synchronously. If the queue is already done, `false` is
26794
26799
  * returned.
@@ -26865,7 +26870,7 @@ const failCauseUnsafe = (self, cause) => {
26865
26870
  * @category Completion
26866
26871
  * @since 4.0.0
26867
26872
  */
26868
- const end = (self) => failCause$2(self, causeFail(Done$1()));
26873
+ const end = (self) => failCause$1(self, causeFail(Done$1()));
26869
26874
  /**
26870
26875
  * Signal that the queue is complete synchronously. If the queue is already done, `false` is
26871
26876
  * returned.
@@ -27509,7 +27514,7 @@ const ChannelProto = {
27509
27514
  */
27510
27515
  const fromTransform$1 = (transform) => {
27511
27516
  const self = Object.create(ChannelProto);
27512
- self.transform = (upstream, scope) => catchCause$2(transform(upstream, scope), (cause) => succeed$4(failCause$3(cause)));
27517
+ self.transform = (upstream, scope) => catchCause$1(transform(upstream, scope), (cause) => succeed$4(failCause$2(cause)));
27513
27518
  return self;
27514
27519
  };
27515
27520
  /**
@@ -27801,7 +27806,7 @@ const fail$3 = (error) => fromPull$1(succeed$4(fail$6(error)));
27801
27806
  * @since 2.0.0
27802
27807
  * @category constructors
27803
27808
  */
27804
- const failCause$1 = (cause) => fromPull$1(failCause$3(cause));
27809
+ const failCause = (cause) => fromPull$1(failCause$2(cause));
27805
27810
  /**
27806
27811
  * Constructs a channel that fails immediately with the specified defect.
27807
27812
  *
@@ -27825,7 +27830,7 @@ const failCause$1 = (cause) => fromPull$1(failCause$3(cause));
27825
27830
  * @since 2.0.0
27826
27831
  * @category constructors
27827
27832
  */
27828
- const die$1 = (defect) => failCause$1(die$3(defect));
27833
+ const die$1 = (defect) => failCause(die$3(defect));
27829
27834
  /**
27830
27835
  * Use an effect to write a single value to the channel.
27831
27836
  *
@@ -28284,17 +28289,17 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
28284
28289
  const semaphore = makeUnsafe$9(concurrencyN);
28285
28290
  const release = constant(semaphore.release(1));
28286
28291
  const handle = matchCauseEffect({
28287
- onFailure: (cause) => flatMap$5(failCause$2(queue, cause), release),
28292
+ onFailure: (cause) => flatMap$5(failCause$1(queue, cause), release),
28288
28293
  onSuccess: (value) => flatMap$5(offer(queue, value), release)
28289
28294
  });
28290
28295
  yield* semaphore.take(1).pipe(flatMap$5(() => pull), flatMap$5((value) => {
28291
28296
  trackFiber(runFork(handle(f(value, i++))));
28292
28297
  return void_$2;
28293
- }), forever({ disableYield: true }), catchCause$2((cause) => semaphore.withPermits(concurrencyN - 1)(failCause$2(queue, cause))), forkIn(forkedScope));
28298
+ }), forever({ disableYield: true }), catchCause$1((cause) => semaphore.withPermits(concurrencyN - 1)(failCause$1(queue, cause))), forkIn(forkedScope));
28294
28299
  } else {
28295
28300
  const effects = yield* bounded(concurrencyN - 2);
28296
28301
  yield* addFinalizer$1(forkedScope, shutdown(queue));
28297
- yield* take$1(effects).pipe(flatten$1, flatMap$5((value) => offer(queue, value)), forever({ disableYield: true }), catchCause$2((cause) => failCause$2(queue, cause)), forkIn(forkedScope));
28302
+ yield* take$1(effects).pipe(flatten$1, flatMap$5((value) => offer(queue, value)), forever({ disableYield: true }), catchCause$1((cause) => failCause$1(queue, cause)), forkIn(forkedScope));
28298
28303
  let errorCause;
28299
28304
  const onExit = (exit) => {
28300
28305
  if (exit._tag === "Success") return;
@@ -28302,12 +28307,12 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
28302
28307
  failCauseUnsafe(queue, exit.cause);
28303
28308
  };
28304
28309
  yield* pull.pipe(flatMap$5((value) => {
28305
- if (errorCause) return failCause$3(errorCause);
28310
+ if (errorCause) return failCause$2(errorCause);
28306
28311
  const fiber = runFork(f(value, i++));
28307
28312
  trackFiber(fiber);
28308
28313
  fiber.addObserver(onExit);
28309
28314
  return offer(effects, join$2(fiber));
28310
- }), forever({ disableYield: true }), catchCause$2((cause) => offer(effects, failCause$5(cause)).pipe(andThen(failCause$2(effects, cause)))), forkIn(forkedScope));
28315
+ }), forever({ disableYield: true }), catchCause$1((cause) => offer(effects, failCause$4(cause)).pipe(andThen(failCause$1(effects, cause)))), forkIn(forkedScope));
28311
28316
  }
28312
28317
  return take$1(queue);
28313
28318
  }));
@@ -28506,14 +28511,14 @@ const filterMapArrayEffect = /* @__PURE__ */ dual(2, (self, filter) => transform
28506
28511
  * @since 4.0.0
28507
28512
  * @category Error handling
28508
28513
  */
28509
- const catchCause$1 = /* @__PURE__ */ dual(2, (self, f) => fromTransform$1((upstream, scope) => {
28514
+ const catchCause = /* @__PURE__ */ dual(2, (self, f) => fromTransform$1((upstream, scope) => {
28510
28515
  let forkedScope = forkUnsafe(scope);
28511
28516
  return map$10(toTransform(self)(upstream, forkedScope), (pull) => {
28512
- let currentPull = pull.pipe(catchCause$2((cause) => {
28513
- if (isDoneCause(cause)) return failCause$3(cause);
28517
+ let currentPull = pull.pipe(catchCause$1((cause) => {
28518
+ if (isDoneCause(cause)) return failCause$2(cause);
28514
28519
  const toClose = forkedScope;
28515
28520
  forkedScope = forkUnsafe(scope);
28516
- return close(toClose, failCause$5(cause)).pipe(andThen(toTransform(f(cause))(upstream, forkedScope)), flatMap$5((childPull) => {
28521
+ return close(toClose, failCause$4(cause)).pipe(andThen(toTransform(f(cause))(upstream, forkedScope)), flatMap$5((childPull) => {
28517
28522
  currentPull = childPull;
28518
28523
  return childPull;
28519
28524
  }));
@@ -28525,9 +28530,9 @@ const catchCause$1 = /* @__PURE__ */ dual(2, (self, f) => fromTransform$1((upstr
28525
28530
  * @since 4.0.0
28526
28531
  * @category Error handling
28527
28532
  */
28528
- const catchCauseFilter = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause$1(self, (cause) => {
28533
+ const catchCauseFilter = /* @__PURE__ */ dual(3, (self, filter, f) => catchCause(self, (cause) => {
28529
28534
  const result = filter(cause);
28530
- return isFailure$4(result) ? failCause$1(result.failure) : f(result.success, cause);
28535
+ return isFailure$4(result) ? failCause(result.failure) : f(result.success, cause);
28531
28536
  }));
28532
28537
  const catch_$1 = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter(self, findError, (e) => f(e)));
28533
28538
  /**
@@ -28707,18 +28712,18 @@ const mergeAll$1 = /* @__PURE__ */ dual(2, (channels, { bufferSize = 16, concurr
28707
28712
  }
28708
28713
  const fiber = yield* childPull.pipe(tap$1(() => yieldNow), flatMap$5((value) => offer(queue, value)), forever({ disableYield: true }), onError(fnUntraced(function* (cause) {
28709
28714
  const halt = filterDone(cause);
28710
- yield* exit(close(childScope, !isFailure$4(halt) ? succeed$7(halt.success.value) : failCause$5(halt.failure)));
28715
+ yield* exit(close(childScope, !isFailure$4(halt) ? succeed$7(halt.success.value) : failCause$4(halt.failure)));
28711
28716
  if (!fibers.has(fiber)) return;
28712
28717
  fibers.delete(fiber);
28713
28718
  if (semaphore) yield* semaphore.release(1);
28714
28719
  if (fibers.size === 0) yield* doneLatch.open;
28715
28720
  if (isSuccess$5(halt)) return;
28716
- return yield* failCause$2(queue, cause);
28721
+ return yield* failCause$1(queue, cause);
28717
28722
  })), forkChild);
28718
28723
  doneLatch.closeUnsafe();
28719
28724
  fibers.add(fiber);
28720
28725
  }
28721
- }).pipe(catchCause$2((cause) => doneLatch.whenOpen(failCause$2(queue, cause))), forkIn(forkedScope));
28726
+ }).pipe(catchCause$1((cause) => doneLatch.whenOpen(failCause$1(queue, cause))), forkIn(forkedScope));
28722
28727
  return take$1(queue);
28723
28728
  })));
28724
28729
  /**
@@ -28756,12 +28761,12 @@ const merge$5 = /* @__PURE__ */ dual((args) => isChannel(args[0]) && isChannel(a
28756
28761
  let done = 0;
28757
28762
  function onExit(side, cause) {
28758
28763
  done++;
28759
- if (!isDoneCause(cause)) return failCause$2(queue, cause);
28764
+ if (!isDoneCause(cause)) return failCause$1(queue, cause);
28760
28765
  switch (strategy) {
28761
- case "both": return done === 2 ? failCause$2(queue, cause) : void_$2;
28766
+ case "both": return done === 2 ? failCause$1(queue, cause) : void_$2;
28762
28767
  case "left":
28763
- case "right": return side === strategy ? failCause$2(queue, cause) : void_$2;
28764
- case "either": return failCause$2(queue, cause);
28768
+ case "right": return side === strategy ? failCause$1(queue, cause) : void_$2;
28769
+ case "either": return failCause$1(queue, cause);
28765
28770
  }
28766
28771
  }
28767
28772
  const runSide = (side, channel, scope) => toTransform(channel)(upstream, scope).pipe(flatMap$5((pull) => pull.pipe(flatMap$5((value) => offer(queue, value)), forever)), onError((cause) => andThen(close(scope, doneExitFromCause(cause)), onExit(side, cause))), forkIn(forkedScope));
@@ -29101,7 +29106,7 @@ const toPull$1 = /* @__PURE__ */ fnUntraced(function* (self) {
29101
29106
  const context = yield* services();
29102
29107
  const scope = get$16(context, Scope);
29103
29108
  return (yield* toTransform(self)(done(), scope)).pipe(provideServices$2(context), semaphore.withPermits(1));
29104
- }, /* @__PURE__ */ catchCause$2((cause) => succeed$4(failCause$3(cause))));
29109
+ }, /* @__PURE__ */ catchCause$1((cause) => succeed$4(failCause$2(cause))));
29105
29110
  /**
29106
29111
  * Converts a channel to a Pull within an existing scope.
29107
29112
  *
@@ -30376,30 +30381,6 @@ const suspend$1 = (stream) => fromChannel(suspend$2(() => stream().channel));
30376
30381
  */
30377
30382
  const fail$2 = (error) => fromChannel(fail$3(error));
30378
30383
  /**
30379
- * Creates a stream that fails with the specified `Cause`.
30380
- *
30381
- * @example
30382
- * ```ts
30383
- * import { Cause, Console, Effect, Stream } from "effect"
30384
- *
30385
- * const stream = Stream.failCause(Cause.fail("Database connection failed")).pipe(
30386
- * Stream.catchCause(() => Stream.succeed("recovered"))
30387
- * )
30388
- *
30389
- * const program = Effect.gen(function*() {
30390
- * const values = yield* Stream.runCollect(stream)
30391
- * yield* Console.log(values)
30392
- * // Output: [ "recovered" ]
30393
- * })
30394
- *
30395
- * Effect.runPromise(program)
30396
- * ```
30397
- *
30398
- * @since 2.0.0
30399
- * @category Constructors
30400
- */
30401
- const failCause = (cause) => fromChannel(failCause$1(cause));
30402
- /**
30403
30384
  * The stream that dies with the specified defect.
30404
30385
  *
30405
30386
  * @example
@@ -30931,43 +30912,6 @@ const switchMap = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, f, op
30931
30912
  */
30932
30913
  const flatten = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, options) => flatMap$3(self, identity, options));
30933
30914
  /**
30934
- * @since 2.0.0
30935
- * @category Rate Limiting
30936
- */
30937
- const timeoutOrElse = /* @__PURE__ */ dual(2, (self, options) => {
30938
- const duration = fromInputUnsafe(options.duration);
30939
- if (!isFinite$2(duration)) return self;
30940
- if (isZero$1(duration)) return suspend$1(options.orElse);
30941
- const timeoutSymbol = Symbol();
30942
- return catchCause(suspend$1(() => {
30943
- const clock = getCurrent().getRef(Clock);
30944
- const durationMs = toMillis(duration);
30945
- let deadline = void 0;
30946
- const latch = makeUnsafe$10(false);
30947
- return merge$4(transformPull(self, (pull, _scope) => suspend$3(() => {
30948
- deadline = clock.currentTimeMillisUnsafe() + durationMs;
30949
- latch.openUnsafe();
30950
- return pull;
30951
- }).pipe(map$10((arr) => {
30952
- latch.closeUnsafe();
30953
- deadline = void 0;
30954
- return arr;
30955
- }), succeed$4)), fromEffectDrain(gen(function* () {
30956
- while (true) {
30957
- yield* latch.await;
30958
- if (deadline === void 0) continue;
30959
- yield* sleep(deadline - clock.currentTimeMillisUnsafe());
30960
- if (deadline === void 0) continue;
30961
- if (deadline - clock.currentTimeMillisUnsafe() > 0) continue;
30962
- return yield* die$2(timeoutSymbol);
30963
- }
30964
- })), { haltStrategy: "left" });
30965
- }), (cause) => {
30966
- if (cause.reasons.find((r) => r._tag === "Die" && r.defect === timeoutSymbol)) return options.orElse();
30967
- return failCause(cause);
30968
- });
30969
- });
30970
- /**
30971
30915
  * Submerges the iterables emitted by this stream into the stream's structure.
30972
30916
  *
30973
30917
  * **Previously Known As**
@@ -31137,43 +31081,6 @@ const filterMap$2 = /* @__PURE__ */ dual(2, (self, filter) => fromChannel(filter
31137
31081
  * @category Filtering
31138
31082
  */
31139
31083
  const filterMapEffect = /* @__PURE__ */ dual(2, (self, filter) => fromChannel(filterMapArrayEffect(toChannel(self), filter)));
31140
- /**
31141
- * Switches over to the stream produced by the provided function in case this
31142
- * one fails. Allows recovery from all causes of failure, including
31143
- * interruption if the stream is uninterruptible.
31144
- *
31145
- * **Previously Known As**
31146
- *
31147
- * This API replaces the following from Effect 3.x:
31148
- *
31149
- * - `Stream.catchAllCause`
31150
- *
31151
- * @example
31152
- * ```ts
31153
- * import { Console, Effect, Stream } from "effect"
31154
- *
31155
- * const stream = Stream.make(1, 2).pipe(
31156
- * Stream.concat(Stream.fail("Oops!")),
31157
- * Stream.concat(Stream.make(3, 4))
31158
- * )
31159
- *
31160
- * const recovered = stream.pipe(
31161
- * Stream.catchCause(() => Stream.make(999))
31162
- * )
31163
- *
31164
- * const program = Effect.gen(function*() {
31165
- * const values = yield* Stream.runCollect(recovered)
31166
- * yield* Console.log(values)
31167
- * })
31168
- *
31169
- * Effect.runPromise(program)
31170
- * // Output: [ 1, 2, 999 ]
31171
- * ```
31172
- *
31173
- * @since 4.0.0
31174
- * @category Error Handling
31175
- */
31176
- const catchCause = /* @__PURE__ */ dual(2, (self, f) => self.channel.pipe(catchCause$1((cause) => f(cause).channel), fromChannel));
31177
31084
  const catch_ = /* @__PURE__ */ dual(2, (self, f) => fromChannel(catch_$1(self.channel, (error) => f(error).channel)));
31178
31085
  /**
31179
31086
  * Recovers from errors that match a predicate by switching to a recovery stream.
@@ -31581,7 +31488,7 @@ const debounce = /* @__PURE__ */ dual(2, (self, duration) => transformPull(self,
31581
31488
  const eff = succeed$4(of$1(lastNonEmpty(lastArr)));
31582
31489
  lastArr = void 0;
31583
31490
  return eff;
31584
- } else if (cause) return failCause$3(cause);
31491
+ } else if (cause) return failCause$2(cause);
31585
31492
  return loop();
31586
31493
  });
31587
31494
  });
@@ -31592,7 +31499,7 @@ const debounce = /* @__PURE__ */ dual(2, (self, duration) => transformPull(self,
31592
31499
  lastArr = void 0;
31593
31500
  return eff;
31594
31501
  }
31595
- return failCause$3(cause);
31502
+ return failCause$2(cause);
31596
31503
  }
31597
31504
  pullLatch.openUnsafe();
31598
31505
  return emitLatch.whenOpen(sleepLoop);
@@ -36812,7 +36719,7 @@ function Exit(value, error, defect) {
36812
36719
  onFailure: (issue) => new Composite(ast, some$2(input), [new Pointer(["value"], issue)])
36813
36720
  });
36814
36721
  case "Failure": return mapBothEager(decodeUnknownEffect$1(cause)(input.cause, options), {
36815
- onSuccess: failCause$5,
36722
+ onSuccess: failCause$4,
36816
36723
  onFailure: (issue) => new Composite(ast, some$2(input), [new Pointer(["cause"], issue)])
36817
36724
  });
36818
36725
  }
@@ -36832,7 +36739,7 @@ function Exit(value, error, defect) {
36832
36739
  _tag: Literal("Failure"),
36833
36740
  cause: Cause(error, defect)
36834
36741
  })]), transform$3({
36835
- decode: (e) => e._tag === "Success" ? succeed$7(e.value) : failCause$5(e.cause),
36742
+ decode: (e) => e._tag === "Success" ? succeed$7(e.value) : failCause$4(e.cause),
36836
36743
  encode: (exit) => isSuccess$3(exit) ? {
36837
36744
  _tag: "Success",
36838
36745
  value: exit.value
@@ -36844,7 +36751,7 @@ function Exit(value, error, defect) {
36844
36751
  toArbitrary: ([value, error, defect]) => (fc, ctx) => fc.oneof(ctx?.isSuspend ? {
36845
36752
  maxDepth: 2,
36846
36753
  depthIdentifier: "Exit"
36847
- } : {}, value.map((v) => succeed$7(v)), causeToArbitrary(error, defect)(fc, ctx).map((cause) => failCause$5(cause))),
36754
+ } : {}, value.map((v) => succeed$7(v)), causeToArbitrary(error, defect)(fc, ctx).map((cause) => failCause$4(cause))),
36848
36755
  toEquivalence: ([value, error, defect]) => {
36849
36756
  const cause = causeToEquivalence(error, defect);
36850
36757
  return (a, b) => {
@@ -57063,7 +56970,7 @@ const makeUnsafe = (scope, value) => {
57063
56970
  */
57064
56971
  const fromAcquire = /* @__PURE__ */ fnUntraced(function* (acquire) {
57065
56972
  const scope = makeUnsafe$13();
57066
- const self = makeUnsafe(scope, yield* acquire.pipe(provide$4(scope), tapCause((cause) => close(scope, failCause$5(cause)))));
56973
+ const self = makeUnsafe(scope, yield* acquire.pipe(provide$4(scope), tapCause((cause) => close(scope, failCause$4(cause)))));
57067
56974
  yield* addFinalizer((exit) => close(self.backing.backing.ref.current[0], exit));
57068
56975
  return self;
57069
56976
  }, uninterruptible);
@@ -57095,7 +57002,7 @@ const get$7 = (self) => sync(() => getUnsafe(self));
57095
57002
  const set$4 = /* @__PURE__ */ dual(2, /* @__PURE__ */ fnUntraced(function* (self, acquire) {
57096
57003
  yield* close(self.backing.backing.ref.current[0], void_$3);
57097
57004
  const scope = makeUnsafe$13();
57098
- const value = yield* acquire.pipe(provide$4(scope), tapCause((cause) => close(scope, failCause$5(cause))));
57005
+ const value = yield* acquire.pipe(provide$4(scope), tapCause((cause) => close(scope, failCause$4(cause))));
57099
57006
  self.backing.backing.ref.current = [scope, value];
57100
57007
  }, uninterruptible, (effect, self) => self.backing.semaphore.withPermit(effect)));
57101
57008
  //#endregion
@@ -59538,7 +59445,7 @@ const layer$30 = /* @__PURE__ */ effect$1(ChildProcessSpawner, /* @__PURE__ */ g
59538
59445
  });
59539
59446
  const withTimeout = (childProcess, command, options) => (kill) => {
59540
59447
  const killSignal = options?.killSignal ?? "SIGTERM";
59541
- return isUndefined(options?.forceKillAfter) ? kill(command, childProcess, killSignal) : timeoutOrElse$1(kill(command, childProcess, killSignal), {
59448
+ return isUndefined(options?.forceKillAfter) ? kill(command, childProcess, killSignal) : timeoutOrElse(kill(command, childProcess, killSignal), {
59542
59449
  duration: options.forceKillAfter,
59543
59450
  orElse: () => kill(command, childProcess, "SIGKILL")
59544
59451
  });
@@ -61087,7 +60994,7 @@ const make$40 = (f) => makeWith((effect) => flatMap$5(effect, (request) => withF
61087
60994
  },
61088
60995
  onFailure(cause) {
61089
60996
  if (hasInterrupts(cause)) controller.abort();
61090
- return failCause$3(cause);
60997
+ return failCause$2(cause);
61091
60998
  }
61092
60999
  }));
61093
61000
  }
@@ -61115,7 +61022,7 @@ const make$40 = (f) => makeWith((effect) => flatMap$5(effect, (request) => withF
61115
61022
  },
61116
61023
  onFailure(cause) {
61117
61024
  if (!scopedController && hasInterrupts(cause)) controller.abort();
61118
- return failCause$3(cause);
61025
+ return failCause$2(cause);
61119
61026
  }
61120
61027
  })));
61121
61028
  });
@@ -62037,7 +61944,7 @@ const notFound = /* @__PURE__ */ empty$2({ status: 404 });
62037
61944
  */
62038
61945
  const toResponseOrElse = (u, orElse) => {
62039
61946
  if (isHttpServerResponse(u)) return succeed$4(u);
62040
- else if (isRespondable(u)) return catchCause$2(u[symbol](), () => succeed$4(orElse));
61947
+ else if (isRespondable(u)) return catchCause$1(u[symbol](), () => succeed$4(orElse));
62041
61948
  else if (isSchemaError(u)) return succeed$4(badRequest);
62042
61949
  else if (isNoSuchElementError(u)) return succeed$4(notFound);
62043
61950
  return succeed$4(orElse);
@@ -62048,7 +61955,7 @@ const toResponseOrElse = (u, orElse) => {
62048
61955
  */
62049
61956
  const toResponseOrElseDefect = (u, orElse) => {
62050
61957
  if (isHttpServerResponse(u)) return succeed$4(u);
62051
- else if (isRespondable(u)) return catchCause$2(u[symbol](), () => succeed$4(orElse));
61958
+ else if (isRespondable(u)) return catchCause$1(u[symbol](), () => succeed$4(orElse));
62052
61959
  return succeed$4(orElse);
62053
61960
  };
62054
61961
  //#endregion
@@ -62419,7 +62326,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
62419
62326
  open = true;
62420
62327
  doneUnsafe(openDeferred, void_$2);
62421
62328
  }, { once: true });
62422
- yield* _await(openDeferred).pipe(timeoutOrElse$1({
62329
+ yield* _await(openDeferred).pipe(timeoutOrElse({
62423
62330
  duration: options?.openTimeout ?? 1e4,
62424
62331
  orElse: () => fail$6(new SocketError({ reason: new SocketOpenError({
62425
62332
  kind: "Timeout",
@@ -63626,7 +63533,7 @@ const toHandled = (self, handleResponse, middleware) => {
63626
63533
  reportCauseUnsafe(fiber, cause);
63627
63534
  const request = getUnsafe$4(fiber.services, HttpServerRequest);
63628
63535
  const handler = requestPreResponseHandlers.get(request.source);
63629
- const cont = cause.reasons.length === 0 ? succeed$4(response) : failCause$3(cause);
63536
+ const cont = cause.reasons.length === 0 ? succeed$4(response) : failCause$2(cause);
63630
63537
  if (handler === void 0) {
63631
63538
  request[handledSymbol] = true;
63632
63539
  return flatMapEager(handleResponse(request, response), () => cont);
@@ -64418,7 +64325,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
64418
64325
  const clearEntries = fnUntraced(function* (exit) {
64419
64326
  for (const [id, entry] of entries) {
64420
64327
  entries.delete(id);
64421
- if (entry._tag === "Queue") yield* exit._tag === "Success" ? end(entry.queue) : failCause$2(entry.queue, exit.cause);
64328
+ if (entry._tag === "Queue") yield* exit._tag === "Success" ? end(entry.queue) : failCause$1(entry.queue, exit.cause);
64422
64329
  else entry.resume(exit);
64423
64330
  }
64424
64331
  });
@@ -64514,7 +64421,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
64514
64421
  sampled: span.sampled
64515
64422
  } : {},
64516
64423
  headers: merge$3(fiber.getRef(CurrentHeaders), headers)
64517
- }).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, catchCause$2((error) => failCause$2(queue, error)), interruptible, forkIn(scope, { startImmediately: true }));
64424
+ }).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, catchCause$1((error) => failCause$1(queue, error)), interruptible, forkIn(scope, { startImmediately: true }));
64518
64425
  return queue;
64519
64426
  });
64520
64427
  const getRpcClientMiddleware = (rpc) => {
@@ -64563,7 +64470,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
64563
64470
  },
64564
64471
  context: entry.context,
64565
64472
  discard: false
64566
- })) : identity, catchCause$2((cause) => failCause$2(entry.queue, cause)));
64473
+ })) : identity, catchCause$1((cause) => failCause$1(entry.queue, cause)));
64567
64474
  }
64568
64475
  case "Exit": {
64569
64476
  const requestId = message.requestId;
@@ -64574,7 +64481,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
64574
64481
  entry.resume(message.exit);
64575
64482
  return void_$2;
64576
64483
  }
64577
- return message.exit._tag === "Success" ? end(entry.queue) : failCause$2(entry.queue, message.exit.cause);
64484
+ return message.exit._tag === "Success" ? end(entry.queue) : failCause$1(entry.queue, message.exit.cause);
64578
64485
  }
64579
64486
  case "Defect": return clearEntries(die$4(message.defect));
64580
64487
  case "ClientEnd": return void_$2;
@@ -64663,7 +64570,7 @@ const make$27 = /* @__PURE__ */ fnUntraced(function* (group, options) {
64663
64570
  _tag: "Exit",
64664
64571
  clientId: 0,
64665
64572
  requestId: RequestId(message.requestId),
64666
- exit: failCause$5(cause)
64573
+ exit: failCause$4(cause)
64667
64574
  })));
64668
64575
  }
64669
64576
  case "Exit": {
@@ -64682,7 +64589,7 @@ const make$27 = /* @__PURE__ */ fnUntraced(function* (group, options) {
64682
64589
  _tag: "Exit",
64683
64590
  clientId: 0,
64684
64591
  requestId,
64685
- exit: failCause$5(cause)
64592
+ exit: failCause$4(cause)
64686
64593
  })
64687
64594
  }));
64688
64595
  }
@@ -64702,7 +64609,7 @@ const make$27 = /* @__PURE__ */ fnUntraced(function* (group, options) {
64702
64609
  }
64703
64610
  default: return void_$2;
64704
64611
  }
64705
- }).pipe(catchCause$2(logError), interruptible, forkScoped);
64612
+ }).pipe(catchCause$1(logError), interruptible, forkScoped);
64706
64613
  return client;
64707
64614
  });
64708
64615
  const rpcSchemasCache = /* @__PURE__ */ new WeakMap();
@@ -64953,7 +64860,7 @@ const make$25 = ({ dumpSchema = () => void_$2 }) => ({ loader, schemaDirectory,
64953
64860
  });
64954
64861
  yield* ensureMigrationsTable;
64955
64862
  const completed = yield* pipe$1(sql.withTransaction(run), catchTag$1("MigrationError", (_) => _.kind === "Locked" ? as$1(logDebug(_.message), []) : fail$6(_)));
64956
- if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause$2((cause) => logInfo("Could not dump schema", cause)));
64863
+ if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause$1((cause) => logInfo("Could not dump schema", cause)));
64957
64864
  return completed;
64958
64865
  });
64959
64866
  const migrationOrder = /* @__PURE__ */ make$91(([a], [b]) => Number$5(a, b));
@@ -90910,7 +90817,7 @@ const make$20 = /* @__PURE__ */ fnUntraced(function* (evaluate, options) {
90910
90817
  else resume(void_$2);
90911
90818
  });
90912
90819
  }).pipe(cached$1);
90913
- const preemptiveShutdown = options.disablePreemptiveShutdown ? void_$2 : timeoutOrElse$1(shutdown, {
90820
+ const preemptiveShutdown = options.disablePreemptiveShutdown ? void_$2 : timeoutOrElse(shutdown, {
90914
90821
  duration: options.gracefulShutdownTimeout ?? seconds(20),
90915
90822
  orElse: () => void_$2
90916
90823
  });
@@ -91182,7 +91089,7 @@ const handleCause = (nodeResponse, originalResponse) => (originalCause) => flatM
91182
91089
  const headersSent = nodeResponse.headersSent;
91183
91090
  if (!headersSent) nodeResponse.writeHead(response.status);
91184
91091
  if (!nodeResponse.writableEnded) nodeResponse.end();
91185
- return failCause$3(headersSent ? combine$1(originalCause, die$3(originalResponse)) : cause);
91092
+ return failCause$2(headersSent ? combine$1(originalCause, die$3(originalResponse)) : cause);
91186
91093
  });
91187
91094
  //#endregion
91188
91095
  //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.40_effect@4.0.0-beta.40_ioredis@5.10.0/node_modules/@effect/platform-node/dist/NodeRuntime.js
@@ -91778,7 +91685,7 @@ const getOrThrow = (self) => getOrThrowWith$1(value(self), () => new NoSuchEleme
91778
91685
  const toExit = (self) => {
91779
91686
  switch (self._tag) {
91780
91687
  case "Success": return succeed$7(self.value);
91781
- case "Failure": return failCause$5(self.cause);
91688
+ case "Failure": return failCause$4(self.cause);
91782
91689
  default: return fail$8(new NoSuchElementError());
91783
91690
  }
91784
91691
  };
@@ -92206,7 +92113,7 @@ const LifetimeProto = {
92206
92113
  if (options?.suspendOnWaiting && result.waiting) return never$5;
92207
92114
  switch (result._tag) {
92208
92115
  case "Initial": return never$5;
92209
- case "Failure": return failCause$5(result.cause);
92116
+ case "Failure": return failCause$4(result.cause);
92210
92117
  case "Success": return succeed$4(result.value);
92211
92118
  }
92212
92119
  },
@@ -92282,7 +92189,7 @@ const LifetimeProto = {
92282
92189
  }));
92283
92190
  },
92284
92191
  streamResult(atom, options) {
92285
- return this.stream(atom, options).pipe(filter$3(isNotInitial), mapEffect$1((result) => result._tag === "Success" ? succeed$4(result.value) : failCause$3(result.cause)));
92192
+ return this.stream(atom, options).pipe(filter$3(isNotInitial), mapEffect$1((result) => result._tag === "Success" ? succeed$4(result.value) : failCause$2(result.cause)));
92286
92193
  },
92287
92194
  dispose() {
92288
92195
  this.disposed = true;
@@ -92625,7 +92532,7 @@ function makeStream(ctx, stream, initialValue, services = empty$16()) {
92625
92532
  step(arr) {
92626
92533
  ctx.setSelf(success(lastNonEmpty(arr), { waiting: true }));
92627
92534
  }
92628
- }))).pipe(catchCause$2((cause) => {
92535
+ }))).pipe(catchCause$1((cause) => {
92629
92536
  if (isDoneCause(cause)) pipe$1(ctx.self(), flatMap$9(value), match$10({
92630
92537
  onNone: () => ctx.setSelf(failWithPrevious(new NoSuchElementError(), { previous: ctx.self() })),
92631
92538
  onSome: (a) => ctx.setSelf(success(a))
@@ -92725,7 +92632,7 @@ const makeStreamPullEffect = (get, pullSignal, create, options) => flatMap$5(toP
92725
92632
  items: acc
92726
92633
  });
92727
92634
  }
92728
- return failCause$3(cause);
92635
+ return failCause$2(cause);
92729
92636
  },
92730
92637
  onSuccess(chunk) {
92731
92638
  let items;
@@ -179460,7 +179367,7 @@ var IssueSource = class IssueSource extends Service$1()("lalph/IssueSource") {
179460
179367
  const refs = yield* make$48({
179461
179368
  lookup: fnUntraced(function* (projectId) {
179462
179369
  const ref = yield* make$47(IssuesChange.Internal({ issues: yield* pipe$1(impl.issues(projectId), orElseSucceed(empty$17)) }));
179463
- yield* changes(ref).pipe(switchMap((_) => impl.issues(projectId).pipe(tap$1((issues) => set$3(ref, IssuesChange.External({ issues }))), ignoreCause, delay(seconds(30)), fromEffectDrain)), runDrain, forkScoped);
179370
+ yield* changes(ref).pipe(switchMap((_) => impl.issues(projectId).pipe(tap$1((issues) => set$3(ref, IssuesChange.External({ issues }))), delay(seconds(30)), sandbox, retry$1(forever$1), fromEffectDrain)), runDrain, forkScoped);
179464
179371
  return ref;
179465
179372
  }),
179466
179373
  capacity: Number.MAX_SAFE_INTEGER
@@ -182830,7 +182737,7 @@ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(e
182830
182737
  });
182831
182738
  Ze.glob = Ze;
182832
182739
  //#endregion
182833
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/ApplyPatch.js
182740
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/ApplyPatch.js
182834
182741
  /**
182835
182742
  * @since 1.0.0
182836
182743
  */
@@ -183286,10 +183193,7 @@ function assignProp(target, prop, value) {
183286
183193
  }
183287
183194
  function mergeDefs(...defs) {
183288
183195
  const mergedDescriptors = {};
183289
- for (const def of defs) {
183290
- const descriptors = Object.getOwnPropertyDescriptors(def);
183291
- Object.assign(mergedDescriptors, descriptors);
183292
- }
183196
+ for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
183293
183197
  return Object.defineProperties({}, mergedDescriptors);
183294
183198
  }
183295
183199
  function esc(str) {
@@ -186496,7 +186400,7 @@ const optionalProcessor = (schema, ctx, _json, params) => {
186496
186400
  seen.ref = def.innerType;
186497
186401
  };
186498
186402
  //#endregion
186499
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
186403
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
186500
186404
  function isZ4Schema(s) {
186501
186405
  return !!s._zod;
186502
186406
  }
@@ -187270,7 +187174,7 @@ function number(params) {
187270
187174
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
187271
187175
  }
187272
187176
  //#endregion
187273
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
187177
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
187274
187178
  const LATEST_PROTOCOL_VERSION = "2025-11-25";
187275
187179
  const SUPPORTED_PROTOCOL_VERSIONS = [
187276
187180
  LATEST_PROTOCOL_VERSION,
@@ -188463,7 +188367,7 @@ var UrlElicitationRequiredError = class extends McpError {
188463
188367
  }
188464
188368
  };
188465
188369
  //#endregion
188466
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
188370
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
188467
188371
  /**
188468
188372
  * Experimental task interfaces for MCP SDK.
188469
188373
  * WARNING: These APIs are experimental and may change without notice.
@@ -188480,7 +188384,7 @@ function isTerminal(status) {
188480
188384
  return status === "completed" || status === "failed" || status === "cancelled";
188481
188385
  }
188482
188386
  //#endregion
188483
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
188387
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
188484
188388
  function getMethodLiteral(schema) {
188485
188389
  const methodSchema = getObjectShape(schema)?.method;
188486
188390
  if (!methodSchema) throw new Error("Schema is missing a method literal");
@@ -188674,6 +188578,8 @@ var Protocol = class {
188674
188578
  this._progressHandlers.clear();
188675
188579
  this._taskProgressTokens.clear();
188676
188580
  this._pendingDebouncedNotifications.clear();
188581
+ for (const info of this._timeoutInfo.values()) clearTimeout(info.timeoutId);
188582
+ this._timeoutInfo.clear();
188677
188583
  for (const controller of this._requestHandlerAbortControllers.values()) controller.abort();
188678
188584
  this._requestHandlerAbortControllers.clear();
188679
188585
  const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
@@ -188777,7 +188683,7 @@ var Protocol = class {
188777
188683
  }, capturedTransport?.sessionId);
188778
188684
  else await capturedTransport?.send(errorResponse);
188779
188685
  }).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send response: ${error}`))).finally(() => {
188780
- this._requestHandlerAbortControllers.delete(request.id);
188686
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) this._requestHandlerAbortControllers.delete(request.id);
188781
188687
  });
188782
188688
  }
188783
188689
  _onprogress(notification) {
@@ -195411,7 +195317,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
195411
195317
  exports.default = formatsPlugin;
195412
195318
  }));
195413
195319
  //#endregion
195414
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
195320
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
195415
195321
  var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
195416
195322
  var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
195417
195323
  function createDefaultAjvInstance() {
@@ -195487,7 +195393,7 @@ var AjvJsonSchemaValidator = class {
195487
195393
  }
195488
195394
  };
195489
195395
  //#endregion
195490
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
195396
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
195491
195397
  /**
195492
195398
  * Experimental client task features for MCP SDK.
195493
195399
  * WARNING: These APIs are experimental and may change without notice.
@@ -195660,7 +195566,7 @@ var ExperimentalClientTasks = class {
195660
195566
  }
195661
195567
  };
195662
195568
  //#endregion
195663
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
195569
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
195664
195570
  /**
195665
195571
  * Experimental task capability assertion helpers.
195666
195572
  * WARNING: These APIs are experimental and may change without notice.
@@ -195711,7 +195617,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
195711
195617
  }
195712
195618
  }
195713
195619
  //#endregion
195714
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
195620
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
195715
195621
  /**
195716
195622
  * Elicitation default application helper. Applies defaults to the data based on the schema.
195717
195623
  *
@@ -196191,7 +196097,7 @@ var Client = class extends Protocol {
196191
196097
  }
196192
196098
  };
196193
196099
  //#endregion
196194
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
196100
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
196195
196101
  /**
196196
196102
  * Normalizes HeadersInit to a plain Record<string, string> for manipulation.
196197
196103
  * Handles Headers objects, arrays of tuples, and plain objects.
@@ -196278,7 +196184,7 @@ async function pkceChallenge(length) {
196278
196184
  };
196279
196185
  }
196280
196186
  //#endregion
196281
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
196187
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
196282
196188
  /**
196283
196189
  * Reusable URL validation that disallows javascript: scheme
196284
196190
  */
@@ -196450,7 +196356,7 @@ object({
196450
196356
  token_type_hint: string().optional()
196451
196357
  }).strip();
196452
196358
  //#endregion
196453
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
196359
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
196454
196360
  /**
196455
196361
  * Utilities for handling OAuth resource URIs.
196456
196362
  */
@@ -196483,7 +196389,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
196483
196389
  return requestedPath.startsWith(configuredPath);
196484
196390
  }
196485
196391
  //#endregion
196486
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
196392
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
196487
196393
  /**
196488
196394
  * Base class for all OAuth errors
196489
196395
  */
@@ -196633,7 +196539,7 @@ const OAUTH_ERRORS = {
196633
196539
  [InvalidTargetError.errorCode]: InvalidTargetError
196634
196540
  };
196635
196541
  //#endregion
196636
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
196542
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
196637
196543
  var UnauthorizedError = class extends Error {
196638
196544
  constructor(message) {
196639
196545
  super(message ?? "Unauthorized");
@@ -196662,8 +196568,8 @@ const AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
196662
196568
  */
196663
196569
  function selectClientAuthMethod(clientInformation, supportedMethods) {
196664
196570
  const hasClientSecret = clientInformation.client_secret !== void 0;
196665
- if (supportedMethods.length === 0) return hasClientSecret ? "client_secret_post" : "none";
196666
- if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && supportedMethods.includes(clientInformation.token_endpoint_auth_method)) return clientInformation.token_endpoint_auth_method;
196571
+ if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && (supportedMethods.length === 0 || supportedMethods.includes(clientInformation.token_endpoint_auth_method))) return clientInformation.token_endpoint_auth_method;
196572
+ if (supportedMethods.length === 0) return hasClientSecret ? "client_secret_basic" : "none";
196667
196573
  if (hasClientSecret && supportedMethods.includes("client_secret_basic")) return "client_secret_basic";
196668
196574
  if (hasClientSecret && supportedMethods.includes("client_secret_post")) return "client_secret_post";
196669
196575
  if (supportedMethods.includes("none")) return "none";
@@ -196796,6 +196702,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
196796
196702
  });
196797
196703
  }
196798
196704
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
196705
+ const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
196799
196706
  let clientInformation = await Promise.resolve(provider.clientInformation());
196800
196707
  if (!clientInformation) {
196801
196708
  if (authorizationCode !== void 0) throw new Error("Existing OAuth client information is required when exchanging an authorization code");
@@ -196810,6 +196717,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
196810
196717
  const fullInformation = await registerClient(authorizationServerUrl, {
196811
196718
  metadata,
196812
196719
  clientMetadata: provider.clientMetadata,
196720
+ scope: resolvedScope,
196813
196721
  fetchFn
196814
196722
  });
196815
196723
  await provider.saveClientInformation(fullInformation);
@@ -196848,7 +196756,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
196848
196756
  clientInformation,
196849
196757
  state,
196850
196758
  redirectUrl: provider.redirectUrl,
196851
- scope: scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope,
196759
+ scope: resolvedScope,
196852
196760
  resource
196853
196761
  });
196854
196762
  await provider.saveCodeVerifier(codeVerifier);
@@ -197236,8 +197144,12 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
197236
197144
  }
197237
197145
  /**
197238
197146
  * Performs OAuth 2.0 Dynamic Client Registration according to RFC 7591.
197147
+ *
197148
+ * If `scope` is provided, it overrides `clientMetadata.scope` in the registration
197149
+ * request body. This allows callers to apply the Scope Selection Strategy (SEP-835)
197150
+ * consistently across both DCR and the subsequent authorization request.
197239
197151
  */
197240
- async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
197152
+ async function registerClient(authorizationServerUrl, { metadata, clientMetadata, scope, fetchFn }) {
197241
197153
  let registrationUrl;
197242
197154
  if (metadata) {
197243
197155
  if (!metadata.registration_endpoint) throw new Error("Incompatible auth server: does not support dynamic client registration");
@@ -197246,7 +197158,10 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
197246
197158
  const response = await (fetchFn ?? fetch)(registrationUrl, {
197247
197159
  method: "POST",
197248
197160
  headers: { "Content-Type": "application/json" },
197249
- body: JSON.stringify(clientMetadata)
197161
+ body: JSON.stringify({
197162
+ ...clientMetadata,
197163
+ ...scope !== void 0 ? { scope } : {}
197164
+ })
197250
197165
  });
197251
197166
  if (!response.ok) throw await parseErrorResponse(response);
197252
197167
  return OAuthClientInformationFullSchema.parse(await response.json());
@@ -197373,7 +197288,7 @@ var EventSourceParserStream = class extends TransformStream {
197373
197288
  }
197374
197289
  };
197375
197290
  //#endregion
197376
- //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
197291
+ //#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
197377
197292
  const DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
197378
197293
  initialReconnectionDelay: 1e3,
197379
197294
  maxReconnectionDelay: 3e4,
@@ -197703,7 +197618,7 @@ var StreamableHTTPClientTransport = class {
197703
197618
  }
197704
197619
  };
197705
197620
  //#endregion
197706
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/McpClient.js
197621
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/McpClient.js
197707
197622
  /**
197708
197623
  * @since 1.0.0
197709
197624
  */
@@ -197748,7 +197663,7 @@ const layer$13 = effect$1(McpClient, gen(function* () {
197748
197663
  });
197749
197664
  }));
197750
197665
  //#endregion
197751
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/ExaSearch.js
197666
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/ExaSearch.js
197752
197667
  /**
197753
197668
  * @since 1.0.0
197754
197669
  */
@@ -212698,7 +212613,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin$1(((exports) => {
212698
212613
  exports.impl = impl;
212699
212614
  }));
212700
212615
  //#endregion
212701
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/WebToMarkdown.js
212616
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/WebToMarkdown.js
212702
212617
  /**
212703
212618
  * @since 1.0.0
212704
212619
  */
@@ -215281,7 +215196,7 @@ const Proto$2 = {
215281
215196
  isFailure: false,
215282
215197
  preliminary: false
215283
215198
  })), updateServices((input) => merge$7(schemas.services, input)), matchCauseEffect({
215284
- onFailure: (cause) => failCause$2(queue, cause),
215199
+ onFailure: (cause) => failCause$1(queue, cause),
215285
215200
  onSuccess: () => end(queue)
215286
215201
  }), forkChild);
215287
215202
  const encodeResult = (result) => schemas.encodeResult(result).pipe(mapError$2((cause) => make$15({
@@ -215837,7 +215752,7 @@ function isEmptyParamsRecord(indexSignature) {
215837
215752
  return indexSignature.parameter === string$3 && isNever(indexSignature.type);
215838
215753
  }
215839
215754
  //#endregion
215840
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/SemanticSearch/Service.js
215755
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/SemanticSearch/Service.js
215841
215756
  /**
215842
215757
  * @since 1.0.0
215843
215758
  */
@@ -215863,7 +215778,7 @@ const maybeRemoveFile = (path) => serviceOption(SemanticSearch).pipe(flatMap$5(m
215863
215778
  onSome: (service) => service.removeFile(path)
215864
215779
  })));
215865
215780
  //#endregion
215866
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/AgentTools.js
215781
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/AgentTools.js
215867
215782
  /**
215868
215783
  * @since 1.0.0
215869
215784
  */
@@ -216135,7 +216050,7 @@ const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(gen(function* () {
216135
216050
  return yield* execute(make$45("bash", ["-c", options.command], {
216136
216051
  cwd,
216137
216052
  stdin: "ignore"
216138
- })).pipe(timeoutOrElse$1({
216053
+ })).pipe(timeoutOrElse({
216139
216054
  duration: timeoutMs,
216140
216055
  orElse: () => die$2(/* @__PURE__ */ new Error(`Command timed out after ${timeoutMs}ms`))
216141
216056
  }));
@@ -216266,7 +216181,7 @@ const AgentToolHandlers = AgentToolHandlersNoDeps.pipe(provide$3([layer$12, laye
216266
216181
  AgentToolHandlersNoDeps.pipe(provide$3([mock(ExaSearch)({}), mock(WebToMarkdown)({})]));
216267
216182
  var ApplyPatchError = class extends TaggedClass$2("ApplyPatchError") {};
216268
216183
  //#endregion
216269
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/TypeBuilder.js
216184
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/TypeBuilder.js
216270
216185
  const resolveDocumentation = resolveAt("documentation");
216271
216186
  const identifierPattern = /^[$A-Z_a-z][$0-9A-Z_a-z]*$/u;
216272
216187
  const Precedence = {
@@ -216539,7 +216454,7 @@ const render = (schema, options) => {
216539
216454
  return printNode({ text: documentation === void 0 ? rendered.text : `${renderJsDoc(documentation, 0, printerOptions)}${printerOptions.newLine}${rendered.text}` }, printerOptions);
216540
216455
  };
216541
216456
  //#endregion
216542
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/ToolkitRenderer.js
216457
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/ToolkitRenderer.js
216543
216458
  /**
216544
216459
  * @since 1.0.0
216545
216460
  */
@@ -216561,7 +216476,7 @@ declare function ${name}(${params}): Promise<${render(tool.successSchema)}>`);
216561
216476
  }) });
216562
216477
  };
216563
216478
  //#endregion
216564
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/ScriptPreprocessing.js
216479
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/ScriptPreprocessing.js
216565
216480
  const callTemplateTargets = ["applyPatch", "taskComplete"];
216566
216481
  const objectPropertyTargets = [{
216567
216482
  functionName: "writeFile",
@@ -216634,6 +216549,14 @@ const findTemplateEnd = (text, start, isTerminator) => {
216634
216549
  }
216635
216550
  return end;
216636
216551
  };
216552
+ const findTemplateEndFirst = (text, start, isTerminator) => {
216553
+ for (let index = start + 1; index < text.length; index++) {
216554
+ if (text[index] !== "`" || isEscaped(text, index)) continue;
216555
+ if (isTerminator(text[index + 1])) return index;
216556
+ if (isTerminator(text[skipWhitespace(text, index + 1)])) return index;
216557
+ }
216558
+ return -1;
216559
+ };
216637
216560
  const findTypeAnnotationAssignment = (text, start) => {
216638
216561
  let index = start;
216639
216562
  while (index < text.length) {
@@ -216869,6 +216792,23 @@ const escapeTemplateLiteralContent = (text) => {
216869
216792
  return out;
216870
216793
  };
216871
216794
  const normalizeObjectLiteralTemplateMarkers = (text) => text.replace(/\\{2,}(?=`|\$\{)/g, "\\");
216795
+ const escapeTaggedTemplateLiteralContent = (text) => {
216796
+ if (!needsTemplateEscaping(text)) return text;
216797
+ let out = "";
216798
+ for (let index = 0; index < text.length; index++) {
216799
+ const char = text[index];
216800
+ if (char === "`" && !isEscaped(text, index)) {
216801
+ out += "\\`";
216802
+ continue;
216803
+ }
216804
+ if (char === "$" && text[index + 1] === "{" && !isEscaped(text, index)) {
216805
+ out += "\\$";
216806
+ continue;
216807
+ }
216808
+ out += char;
216809
+ }
216810
+ return out;
216811
+ };
216872
216812
  const replaceSlice = (text, start, end, replacement) => `${text.slice(0, start)}${replacement}${text.slice(end)}`;
216873
216813
  const rewriteTemplateContents = (script, findNext, rewrite) => {
216874
216814
  let out = script;
@@ -216961,6 +216901,28 @@ const findObjectPropertyTemplate = (text, target, from) => {
216961
216901
  };
216962
216902
  }
216963
216903
  };
216904
+ const findTaggedTemplate = (text, tag, from) => {
216905
+ let cursor = from;
216906
+ while (cursor < text.length) {
216907
+ const tagStart = findNextIdentifier(text, tag, cursor);
216908
+ if (tagStart === -1) return;
216909
+ const templateStart = skipWhitespace(text, tagStart + tag.length);
216910
+ if (text[templateStart] !== "`") {
216911
+ cursor = tagStart + tag.length;
216912
+ continue;
216913
+ }
216914
+ const templateEnd = findTemplateEndFirst(text, templateStart, (char) => char === void 0 || char === "+" || char === "," || char === ";" || char === ")" || char === "}" || char === "]");
216915
+ if (templateEnd === -1) {
216916
+ cursor = templateStart + 1;
216917
+ continue;
216918
+ }
216919
+ return {
216920
+ contentStart: templateStart + 1,
216921
+ contentEnd: templateEnd,
216922
+ nextCursor: templateEnd + 1
216923
+ };
216924
+ }
216925
+ };
216964
216926
  const collectCallArgumentIdentifiers = (script, functionName) => {
216965
216927
  const identifiers = /* @__PURE__ */ new Set();
216966
216928
  let cursor = 0;
@@ -217098,6 +217060,7 @@ const collectObjectEntryMapSources = (script, valueIdentifier) => {
217098
217060
  };
217099
217061
  const rewriteDirectTemplates = (script) => {
217100
217062
  let out = script;
217063
+ out = rewriteTemplateContents(out, (text, from) => findTaggedTemplate(text, "String.raw", from), escapeTaggedTemplateLiteralContent);
217101
217064
  for (const target of objectPropertyTargets) out = rewriteTemplateContents(out, (text, from) => findObjectPropertyTemplate(text, target, from), escapeTemplateLiteralContent);
217102
217065
  for (const functionName of callTemplateTargets) out = rewriteTemplateContents(out, (text, from) => findDirectCallTemplate(text, functionName, from), escapeTemplateLiteralContent);
217103
217066
  return out;
@@ -217123,7 +217086,7 @@ const rewriteAssignedTargets = (script) => {
217123
217086
  };
217124
217087
  const preprocessScript = (script) => rewriteAssignedTargets(rewriteDirectTemplates(script));
217125
217088
  //#endregion
217126
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/AgentExecutor.js
217089
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/AgentExecutor.js
217127
217090
  /**
217128
217091
  * @since 1.0.0
217129
217092
  */
@@ -217202,7 +217165,7 @@ const makeLocal = fnUntraced(function* (options) {
217202
217165
  yield* yieldNow;
217203
217166
  if (running === 0) break;
217204
217167
  }
217205
- }).pipe(ensuring$2(close(handlerScope, void_$3)), catchCause$2(logFatal), provideService$2(Console$1, console), ensuring$2(end(output)), forkScoped);
217168
+ }).pipe(ensuring$2(close(handlerScope, void_$3)), catchCause$1(logFatal), provideService$2(Console$1, console), ensuring$2(end(output)), forkScoped);
217206
217169
  return fromQueue(output);
217207
217170
  }, unwrap);
217208
217171
  return AgentExecutor.of({
@@ -217308,7 +217271,7 @@ var QueueWriteStream = class extends Writable {
217308
217271
  }
217309
217272
  };
217310
217273
  //#endregion
217311
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/ScriptExtraction.js
217274
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/ScriptExtraction.js
217312
217275
  const stripWrappingCodeFence = (script) => {
217313
217276
  const lines = script.split(/\r?\n/);
217314
217277
  if (lines.length < 2) return script;
@@ -218638,7 +218601,7 @@ const make$10 = /* @__PURE__ */ fnUntraced(function* (params) {
218638
218601
  else immediateParts.push(part);
218639
218602
  if (immediateParts.length > 0) yield* offerAll(queue, immediateParts);
218640
218603
  for (const part of chunk) if (part.type === "tool-call" && part.providerExecuted !== true) yield* run$2(toolCallFibers, handleToolCall(part));
218641
- })), andThen(raceFirst(join$1(toolCallFibers), awaitEmpty(toolCallFibers))), andThen(offerAll(queue, deferredFinishParts)), andThen(end(queue)), tapCause((cause) => failCause$2(queue, cause)), forkScoped);
218604
+ })), andThen(raceFirst(join$1(toolCallFibers), awaitEmpty(toolCallFibers))), andThen(offerAll(queue, deferredFinishParts)), andThen(end(queue)), tapCause((cause) => failCause$1(queue, cause)), forkScoped);
218642
218605
  return fromQueue(queue);
218643
218606
  });
218644
218607
  return {
@@ -218857,7 +218820,7 @@ const applySpanTransformer = (transformer, response, options) => {
218857
218820
  });
218858
218821
  };
218859
218822
  //#endregion
218860
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/Agent.js
218823
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/Agent.js
218861
218824
  /**
218862
218825
  * @since 1.0.0
218863
218826
  */
@@ -218900,7 +218863,6 @@ ${content}
218900
218863
  const subagentModel = yield* SubagentModel;
218901
218864
  const modelConfig = yield* AgentModelConfig;
218902
218865
  const conversationMode = yield* ConversationMode;
218903
- const turnTimeout = yield* TurnTimeout;
218904
218866
  let finalSummary = none$4();
218905
218867
  const output = yield* make$75();
218906
218868
  let inputTokens = 0;
@@ -219022,13 +218984,10 @@ ${content}
219022
218984
  let reasoningStarted = false;
219023
218985
  let hadReasoningDelta = false;
219024
218986
  let hadToolCall = false;
219025
- yield* pipe$1(ai.streamText({
218987
+ yield* pipe$1(suspend$1(() => ai.streamText({
219026
218988
  prompt: prompt.current,
219027
218989
  toolkit: singleTool
219028
- }), timeoutOrElse({
219029
- duration: turnTimeout,
219030
- orElse: () => fail$2(new TimeoutError())
219031
- }), takeUntil((part) => {
218990
+ })), takeUntil((part) => {
219032
218991
  if ((part.type === "text-end" || part.type === "reasoning-end") && pendingMessages.size > 0) return true;
219033
218992
  return false;
219034
218993
  }), runForEachArray((parts) => {
@@ -219088,16 +219047,21 @@ ${content}
219088
219047
  return void_$2;
219089
219048
  }), retry$1({
219090
219049
  while: (err) => {
219050
+ if (err.isRetryable) {
219051
+ maybeSend({
219052
+ agentId,
219053
+ part: new ErrorRetry({ error: err })
219054
+ });
219055
+ switch (err.reason._tag) {
219056
+ case "ToolNotFoundError":
219057
+ case "InvalidOutputError": update$1(prompt, concat(fromResponseParts(response).pipe(concat(`There was an error, please try again using the "execute" tool:\n\n${pretty$1(fail$7(err))}`))));
219058
+ }
219059
+ }
219091
219060
  response = [];
219092
- if (err._tag === "TimeoutError") return true;
219093
- if (err.isRetryable) maybeSend({
219094
- agentId,
219095
- part: new ErrorRetry({ error: err })
219096
- });
219097
219061
  return err.isRetryable;
219098
219062
  },
219099
219063
  schedule: retryPolicy
219100
- }), catchTag$1("TimeoutError", die$2), modelConfig.systemPromptTransform ? (effect) => modelConfig.systemPromptTransform(system, effect) : identity);
219064
+ }), modelConfig.systemPromptTransform ? (effect) => modelConfig.systemPromptTransform(system, effect) : identity);
219101
219065
  update$1(prompt, concat(fromResponseParts(response)));
219102
219066
  if (conversationMode && !hadToolCall && pendingMessages.size === 0) finalSummary = some$2(responseToSummary(response));
219103
219067
  }
@@ -219111,7 +219075,7 @@ ${content}
219111
219075
  part: new ScriptDelta({ delta: script })
219112
219076
  });
219113
219077
  return executeScript(script);
219114
- }), catchCause$2((cause) => failCause$2(output, cause)), forkScoped);
219078
+ }), catchCause$1((cause) => failCause$1(output, cause)), forkScoped);
219115
219079
  yield* offer(output, new AgentStart({
219116
219080
  id: opts.agentId,
219117
219081
  prompt: opts.prompt,
@@ -219149,7 +219113,7 @@ ${options.toolInstructions}
219149
219113
 
219150
219114
  ${options.agentsMd}
219151
219115
  `;
219152
- const generateSystemTools = (capabilities, conversationMode) => `You only have one tool available: "execute", to run javascript code to do your work.
219116
+ const generateSystemTools = (capabilities, conversationMode) => `YOU ONLY HAVE ONE TOOL AVAILABLE: "execute", to run javascript code to do your work.
219153
219117
 
219154
219118
  - Use \`console.log\` to print any output you need.
219155
219119
  - Use top level await.${capabilities.supportsSearch ? `
@@ -219241,15 +219205,6 @@ var ConversationMode = class ConversationMode extends Reference("clanka/Agent/Co
219241
219205
  static layer = (enabled) => succeed$5(ConversationMode, enabled);
219242
219206
  };
219243
219207
  /**
219244
- * Specify an inactivity timeout before retrying a turn.
219245
- *
219246
- * @since 1.0.0
219247
- * @category Turn timeout
219248
- */
219249
- var TurnTimeout = class TurnTimeout extends Reference("clanka/Agent/TurnTimeout", { defaultValue: () => minutes(2) }) {
219250
- static layer = (timeout) => succeed$5(TurnTimeout, fromInputUnsafe(timeout));
219251
- };
219252
- /**
219253
219208
  * @since 1.0.0
219254
219209
  * @category System prompts
219255
219210
  */
@@ -228008,7 +227963,7 @@ const makeSocket = /* @__PURE__ */ gen(function* () {
228008
227963
  }
228009
227964
  offerUnsafe(currentQueue, event);
228010
227965
  } catch {}
228011
- }).pipe(catchCause$2((cause) => {
227966
+ }).pipe(catchCause$1((cause) => {
228012
227967
  tracker.clearUnsafe();
228013
227968
  return currentQueue ? fail$4(currentQueue, make$15({
228014
227969
  module: "OpenAiClient",
@@ -230377,7 +230332,7 @@ const transformToolCallParams = /* @__PURE__ */ fnUntraced(function* (tools, too
230377
230332
  })));
230378
230333
  });
230379
230334
  //#endregion
230380
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/CodexAuth.js
230335
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/CodexAuth.js
230381
230336
  /**
230382
230337
  * @since 1.0.0
230383
230338
  */
@@ -230597,7 +230552,7 @@ var CodexAuth = class CodexAuth extends Service$1()("clanka/CodexAuth") {
230597
230552
  static layerClient = this.layerClientNoDeps.pipe(provide$3(CodexAuth.layer));
230598
230553
  };
230599
230554
  //#endregion
230600
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/Codex.js
230555
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/Codex.js
230601
230556
  /**
230602
230557
  * @since 1.0.0
230603
230558
  */
@@ -230623,7 +230578,7 @@ const layerModel = (model, options) => layer$7({
230623
230578
  }
230624
230579
  }).pipe(merge$6(AgentModelConfig.layer({ systemPromptTransform: (system, effect) => withConfigOverride(effect, { instructions: system }) })));
230625
230580
  //#endregion
230626
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/CodeChunker.js
230581
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/CodeChunker.js
230627
230582
  /**
230628
230583
  * @since 1.0.0
230629
230584
  */
@@ -231166,7 +231121,7 @@ const mapStatusCodeError = /* @__PURE__ */ fnUntraced(function* (error, method)
231166
231121
  const status = response.status;
231167
231122
  const headers = response.headers;
231168
231123
  const requestId = headers["x-request-id"];
231169
- let body = yield* response.text.pipe(catchCause$2(() => succeed$4(description?.startsWith("{") ? description : void 0)));
231124
+ let body = yield* response.text.pipe(catchCause$1(() => succeed$4(description?.startsWith("{") ? description : void 0)));
231170
231125
  const decoded = OpenAiErrorBodyJson(body);
231171
231126
  return yield* make$15({
231172
231127
  module: "OpenAiClient",
@@ -232383,7 +232338,7 @@ const getUsageDetailNumber = (details, field) => {
232383
232338
  return typeof value === "number" ? value : void 0;
232384
232339
  };
232385
232340
  //#endregion
232386
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/CopilotAuth.js
232341
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/CopilotAuth.js
232387
232342
  /**
232388
232343
  * @since 1.0.0
232389
232344
  */
@@ -232574,7 +232529,7 @@ var GithubCopilotAuth = class GithubCopilotAuth extends Service$1()("clanka/Gith
232574
232529
  static layerClient = this.layerClientNoDeps.pipe(provide$3(GithubCopilotAuth.layer));
232575
232530
  };
232576
232531
  //#endregion
232577
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/Copilot.js
232532
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/Copilot.js
232578
232533
  /**
232579
232534
  * @since 1.0.0
232580
232535
  */
@@ -232994,7 +232949,7 @@ Object.defineProperties(createChalk.prototype, styles);
232994
232949
  const chalk = createChalk();
232995
232950
  createChalk({ level: stderrColor ? stderrColor.level : 0 });
232996
232951
  //#endregion
232997
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/OutputFormatter.js
232952
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/OutputFormatter.js
232998
232953
  /**
232999
232954
  * @since 1.0.0
233000
232955
  */
@@ -233601,7 +233556,7 @@ const partitionRequests = function* (requests, schema) {
233601
233556
  const encode = encodeEffect(schema);
233602
233557
  const handle = matchCauseEager({
233603
233558
  onFailure(cause) {
233604
- entry.completeUnsafe(failCause$5(cause));
233559
+ entry.completeUnsafe(failCause$4(cause));
233605
233560
  },
233606
233561
  onSuccess(value) {
233607
233562
  inputs.push(value);
@@ -233621,7 +233576,7 @@ const partitionRequestsById = function* (requests, schema) {
233621
233576
  const encode = encodeEffect(schema);
233622
233577
  const handle = matchCauseEager({
233623
233578
  onFailure(cause) {
233624
- entry.completeUnsafe(failCause$5(cause));
233579
+ entry.completeUnsafe(failCause$4(cause));
233625
233580
  },
233626
233581
  onSuccess(value) {
233627
233582
  inputs.push(value);
@@ -233702,7 +233657,7 @@ select * from ${sql(options.tableName)} where ${sql(idColumn)} = LAST_INSERT_ID(
233702
233657
  };
233703
233658
  });
233704
233659
  //#endregion
233705
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/ChunkRepo.js
233660
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/ChunkRepo.js
233706
233661
  /**
233707
233662
  * @since 1.0.0
233708
233663
  * @category Models
@@ -233968,7 +233923,7 @@ const run$1 = /* @__PURE__ */ make$25({});
233968
233923
  */
233969
233924
  const layer$1 = (options) => effectDiscard(run$1(options));
233970
233925
  //#endregion
233971
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/internal/sqlite-vector.js
233926
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/internal/sqlite-vector.js
233972
233927
  /**
233973
233928
  * Binary extension for each platform
233974
233929
  */
@@ -234085,7 +234040,7 @@ function getExtensionPath() {
234085
234040
  throw new ExtensionNotFoundError(`SQLite Vector extension not found for platform: ${getCurrentPlatform()}\n\nThe platform-specific package "${getPlatformPackageName()}" is not installed.\nThis usually happens when:\n 1. Your platform is not supported\n 2. npm failed to install optional dependencies\n 3. You're installing with --no-optional flag\n\nTry running: npm install --force`);
234086
234041
  }
234087
234042
  //#endregion
234088
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/Sqlite.js
234043
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/Sqlite.js
234089
234044
  /**
234090
234045
  * @since 1.0.0
234091
234046
  */
@@ -234113,7 +234068,7 @@ const SqliteLayer = (database) => layer$1({ loader: fromRecord({ "0001_create_ch
234113
234068
  yield* fs.makeDirectory(directory, { recursive: true });
234114
234069
  }))));
234115
234070
  //#endregion
234116
- //#region node_modules/.pnpm/clanka@0.2.38_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_8b26d89888c4b7e6bcb90ea99ae4f7cf/node_modules/clanka/dist/SemanticSearch.js
234071
+ //#region node_modules/.pnpm/clanka@0.2.41_@effect+ai-openai-compat@4.0.0-beta.40_effect@4.0.0-beta.40__@effect+ai-o_6376d741d1c21dc6594a81ad54906cf7/node_modules/clanka/dist/SemanticSearch.js
234117
234072
  /**
234118
234073
  * @since 1.0.0
234119
234074
  */
@@ -237979,10 +237934,9 @@ var import_light = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin$1(((ex
237979
237934
  }
237980
237935
  };
237981
237936
  var version = "2.19.5";
237982
- var version$1 = { version };
237983
237937
  var version$2 = /* @__PURE__ */ Object.freeze({
237984
237938
  version,
237985
- default: version$1
237939
+ default: { version }
237986
237940
  });
237987
237941
  var require$$2 = () => console.log("You must import the full version of Bottleneck in order to use this feature.");
237988
237942
  var require$$3 = () => console.log("You must import the full version of Bottleneck in order to use this feature.");
@@ -242326,7 +242280,7 @@ var Worktree = class extends Service$1()("lalph/Worktree", { make: gen(function*
242326
242280
  yield* copySharedBack({
242327
242281
  shared,
242328
242282
  worktreeShared
242329
- }).pipe(catchCause$2(logWarning));
242283
+ }).pipe(catchCause$1(logWarning));
242330
242284
  }));
242331
242285
  return {
242332
242286
  directory,
@@ -242346,7 +242300,7 @@ var Worktree = class extends Service$1()("lalph/Worktree", { make: gen(function*
242346
242300
  };
242347
242301
  }));
242348
242302
  };
242349
- const execIgnore = (spawner, command) => command.pipe(spawner.exitCode, catchCause$2(logWarning));
242303
+ const execIgnore = (spawner, command) => command.pipe(spawner.exitCode, catchCause$1(logWarning));
242350
242304
  const seedSetupScript = fnUntraced(function* (setupPath) {
242351
242305
  const fs = yield* FileSystem;
242352
242306
  const pathService = yield* Path$1;
@@ -242742,7 +242696,7 @@ const SemanticSearchLayer = unwrap$3(gen(function* () {
242742
242696
  return layer({
242743
242697
  directory: worktree.directory,
242744
242698
  database: pathService.join(worktree.directory, ".lalph", "shared", "search.sqlite")
242745
- }).pipe(orDie$3, provide$3(model$1("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$9({ apiKey: apiKey.value }).pipe(provide$3(layerUndici))), tapCause$1((cause) => logWarning(`Failed to create SemanticSearch layer`, cause)), catchCause$3(() => empty$15));
242699
+ }).pipe(orDie$3, provide$3(model$1("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$9({ apiKey: apiKey.value }).pipe(provide$3(layerUndici))), tapCause$1((cause) => logWarning(`Failed to create SemanticSearch layer`, cause)), catchCause$2(() => empty$15));
242746
242700
  }).pipe(orDie$2));
242747
242701
  const runClanka = fnUntraced(function* (options) {
242748
242702
  const muxer = yield* Muxer;
@@ -242756,7 +242710,7 @@ const runClanka = fnUntraced(function* (options) {
242756
242710
  yield* log$1(`Received steer message: ${message}`);
242757
242711
  yield* agent.steer(message);
242758
242712
  }, fromEffectDrain)), runDrain, forkScoped);
242759
- return yield* output.pipe(options.maxContext ? tap((part) => {
242713
+ return yield* (options.stallTimeout ? withStallTimeout(options.stallTimeout)(output) : output).pipe(options.maxContext ? tap((part) => {
242760
242714
  if (part._tag !== "Usage") return void_$2;
242761
242715
  if (part.contextTokens <= options.maxContext) return void_$2;
242762
242716
  return fail$6(new TimeoutError("Max context reached"));
@@ -242814,6 +242768,7 @@ ${research}`
242814
242768
  }),
242815
242769
  maxContext: options.maxContext,
242816
242770
  steer: options.steer,
242771
+ stallTimeout: options.stallTimeout,
242817
242772
  mode: CurrentTask.$match(options.currentTask, {
242818
242773
  task: () => "default",
242819
242774
  ralph: () => "ralph"
@@ -242970,7 +242925,8 @@ const agentChooser = fnUntraced(function* (options) {
242970
242925
  directory: worktree.directory,
242971
242926
  model: options.preset.extraArgs.join(" "),
242972
242927
  prompt: promptGen.promptChooseClanka({ gitFlow }),
242973
- mode: "choose"
242928
+ mode: "choose",
242929
+ stallTimeout: options.stallTimeout
242974
242930
  }).pipe(provideService$2(ChosenTaskDeferred, deferred), flatMap$5(() => fail$6(new ChosenTaskNotFound$1())), raceFirst(_await(deferred)));
242975
242931
  const prdTask = yield* source.findById(projectId, result.taskId);
242976
242932
  if (!prdTask) return yield* new ChosenTaskNotFound$1();
@@ -242985,7 +242941,7 @@ const agentChooser = fnUntraced(function* (options) {
242985
242941
  prompt: promptGen.promptChoose({ gitFlow }),
242986
242942
  prdFilePath: pathService.join(".lalph", "prd.yml"),
242987
242943
  extraArgs: options.preset.extraArgs
242988
- }), setCwd(worktree.directory), options.preset.withCommandPrefix, worktree.execWithWorkerOutput({ cliAgent: options.preset.cliAgent }), timeoutOrElse$1({
242944
+ }), setCwd(worktree.directory), options.preset.withCommandPrefix, worktree.execWithWorkerOutput({ cliAgent: options.preset.cliAgent }), timeoutOrElse({
242989
242945
  duration: options.stallTimeout,
242990
242946
  orElse: () => fail$6(new RunnerStalled())
242991
242947
  }), raceFirst(taskJsonCreated));
@@ -243031,6 +242987,7 @@ const agentReviewer = fnUntraced(function* (options) {
243031
242987
  prompt: options.instructions,
243032
242988
  gitFlow
243033
242989
  })),
242990
+ stallTimeout: options.stallTimeout,
243034
242991
  mode
243035
242992
  });
243036
242993
  return ExitCode(0);
@@ -243087,6 +243044,7 @@ const agentTimeout = fnUntraced(function* (options) {
243087
243044
  model: options.preset.extraArgs.join(" "),
243088
243045
  system: timeoutMode.system,
243089
243046
  prompt: timeoutMode.clankaPrompt,
243047
+ stallTimeout: options.stallTimeout,
243090
243048
  mode: timeoutMode.mode
243091
243049
  });
243092
243050
  return ExitCode(0);
@@ -243110,7 +243068,8 @@ const agentResearcher = fnUntraced(function* (options) {
243110
243068
  directory: worktree.directory,
243111
243069
  model: options.preset.extraArgs.join(" "),
243112
243070
  system: promptGen.systemClanka(options),
243113
- prompt: promptGen.promptResearch({ task: options.task })
243071
+ prompt: promptGen.promptResearch({ task: options.task }),
243072
+ stallTimeout: options.stallTimeout
243114
243073
  }).pipe(asSome);
243115
243074
  });
243116
243075
  //#endregion
@@ -243130,7 +243089,7 @@ const agentChooserRalph = fnUntraced(function* (options) {
243130
243089
  prompt: promptGen.promptChooseRalph({ specFile: options.specFile }),
243131
243090
  prdFilePath: void 0,
243132
243091
  extraArgs: options.preset.extraArgs
243133
- }), setCwd(worktree.directory), options.preset.withCommandPrefix, worktree.execWithWorkerOutput({ cliAgent: options.preset.cliAgent }), timeoutOrElse$1({
243092
+ }), setCwd(worktree.directory), options.preset.withCommandPrefix, worktree.execWithWorkerOutput({ cliAgent: options.preset.cliAgent }), timeoutOrElse({
243134
243093
  duration: options.stallTimeout,
243135
243094
  orElse: () => fail$6(new RunnerStalled())
243136
243095
  }));
@@ -243182,7 +243141,7 @@ const run = fnUntraced(function* (options) {
243182
243141
  });
243183
243142
  yield* prd.setChosenIssueId(taskId);
243184
243143
  yield* prd.setAutoMerge(chosenTask.prd.autoMerge);
243185
- yield* source.ensureInProgress(projectId, taskId).pipe(timeoutOrElse$1({
243144
+ yield* source.ensureInProgress(projectId, taskId).pipe(timeoutOrElse({
243186
243145
  duration: "1 minute",
243187
243146
  orElse: () => fail$6(new RunnerStalled())
243188
243147
  }));
@@ -243423,7 +243382,7 @@ const runProject = fnUntraced(function* (options) {
243423
243382
  quit = true;
243424
243383
  return void_$2;
243425
243384
  }
243426
- }), catchCause$2((cause) => logWarning(cause).pipe(andThen(sleep(seconds(10))))), ensuring$2(semaphore.release(1)), ensuring$2(completeWith(startedDeferred, void_$2)), run$2(fibers));
243385
+ }), catchCause$1((cause) => logWarning(cause).pipe(andThen(sleep(seconds(10))))), ensuring$2(semaphore.release(1)), ensuring$2(completeWith(startedDeferred, void_$2)), run$2(fibers));
243427
243386
  if (executionMode._tag === "ralph") {
243428
243387
  yield* await_(fiber);
243429
243388
  if (ralphDone) break;
@@ -243794,7 +243753,7 @@ const commandEdit = make$60("edit").pipe(withDescription("Open the selected proj
243794
243753
  const commandSource = make$60("source").pipe(withDescription("Select the issue source to use (e.g. GitHub Issues or Linear). This applies to all projects."), withHandler(() => selectIssueSource), provide(Settings.layer));
243795
243754
  //#endregion
243796
243755
  //#region package.json
243797
- var version = "0.3.113";
243756
+ var version = "0.3.115";
243798
243757
  //#endregion
243799
243758
  //#region src/Tracing.ts
243800
243759
  const TracingLayer = unwrap$3(gen(function* () {