@deslop/deploy 0.1.1279 → 0.1.1287

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/server.js CHANGED
@@ -1465,7 +1465,7 @@ const mix = (h) => {
1465
1465
  * @category hashing
1466
1466
  * @since 2.0.0
1467
1467
  */
1468
- const combine$2 = /*#__PURE__*/ dual(2, (self, b) => mix(Math.imul(self, 2654435761) + Math.imul(b, 2246822507)));
1468
+ const combine$3 = /*#__PURE__*/ dual(2, (self, b) => mix(Math.imul(self, 2654435761) + Math.imul(b, 2246822507)));
1469
1469
  /**
1470
1470
  * Applies bit manipulation techniques to optimize a hash value.
1471
1471
  *
@@ -1558,7 +1558,7 @@ const number$2 = (n) => {
1558
1558
  const h = n | 0;
1559
1559
  if (h === n) return optimize(h);
1560
1560
  float64.setFloat64(0, n !== n ? NaN : n);
1561
- return optimize(combine$2(float64.getInt32(0), float64.getInt32(4)));
1561
+ return optimize(combine$3(float64.getInt32(0), float64.getInt32(4)));
1562
1562
  };
1563
1563
  /**
1564
1564
  * Computes a hash value for a string using the djb2 algorithm.
@@ -1631,7 +1631,7 @@ const string$2 = (str) => {
1631
1631
  */
1632
1632
  const structureKeys = (o, keys) => {
1633
1633
  let h = 12289;
1634
- for (const key of keys) h ^= combine$2(hash(key), hash(o[key]));
1634
+ for (const key of keys) h ^= combine$3(hash(key), hash(o[key]));
1635
1635
  return optimize(h);
1636
1636
  };
1637
1637
  /**
@@ -1708,12 +1708,12 @@ const unordered = (seed, f) => (iter) => {
1708
1708
  */
1709
1709
  const array = (arr) => {
1710
1710
  let h = 6151;
1711
- for (const element of arr) h = combine$2(h, hash(element));
1711
+ for (const element of arr) h = combine$3(h, hash(element));
1712
1712
  return optimize(h);
1713
1713
  };
1714
- const hashMap = /*#__PURE__*/ unordered(/*#__PURE__*/ string$2("Map"), ([k, v]) => combine$2(hash(k), hash(v)));
1714
+ const hashMap = /*#__PURE__*/ unordered(/*#__PURE__*/ string$2("Map"), ([k, v]) => combine$3(hash(k), hash(v)));
1715
1715
  const setSeed = /*#__PURE__*/ string$2("Set");
1716
- const hashSet = /*#__PURE__*/ unordered(setSeed, (element) => combine$2(setSeed, hash(element)));
1716
+ const hashSet = /*#__PURE__*/ unordered(setSeed, (element) => combine$3(setSeed, hash(element)));
1717
1717
  const randomHashCache = /*#__PURE__*/ new WeakMap();
1718
1718
  const hashCache = /*#__PURE__*/ new WeakMap();
1719
1719
  const visitedObjects = /*#__PURE__*/ new WeakSet();
@@ -2907,7 +2907,7 @@ var Fail = class extends ReasonBase {
2907
2907
  return isFailReason$1(that) && equals$2(this.error, that.error) && equals$2(this.annotations, that.annotations);
2908
2908
  }
2909
2909
  [symbol$3]() {
2910
- return combine$2(string$2(this._tag))(combine$2(hash(this.error))(hash(this.annotations)));
2910
+ return combine$3(string$2(this._tag))(combine$3(hash(this.error))(hash(this.annotations)));
2911
2911
  }
2912
2912
  };
2913
2913
  /** @internal */
@@ -2967,7 +2967,7 @@ var Die = class extends ReasonBase {
2967
2967
  return isDieReason$1(that) && equals$2(this.defect, that.defect) && equals$2(this.annotations, that.annotations);
2968
2968
  }
2969
2969
  [symbol$3]() {
2970
- return combine$2(string$2(this._tag))(combine$2(hash(this.defect))(hash(this.annotations)));
2970
+ return combine$3(string$2(this._tag))(combine$3(hash(this.defect))(hash(this.annotations)));
2971
2971
  }
2972
2972
  };
2973
2973
  /** @internal */
@@ -3029,7 +3029,7 @@ const makeExit = (options) => {
3029
3029
  return isExit$1(that) && that._tag === this._tag && equals$2(this["~effect/Effect/args"], that["~effect/Effect/args"]);
3030
3030
  },
3031
3031
  [symbol$3]() {
3032
- return combine$2(string$2(options.op), hash(this[args]));
3032
+ return combine$3(string$2(options.op), hash(this[args]));
3033
3033
  }
3034
3034
  };
3035
3035
  const ExitPrimitive = function(value) {
@@ -3243,7 +3243,7 @@ const Prototype = (options) => makePrimitiveProto({
3243
3243
  * @category constructors
3244
3244
  * @since 2.0.0
3245
3245
  */
3246
- const make$82 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
3246
+ const make$83 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
3247
3247
  const isStrictEquivalent = (x, y) => x === y;
3248
3248
  /**
3249
3249
  * Creates an equivalence relation that uses strict equality (`===`) to compare values.
@@ -3353,7 +3353,7 @@ const strictEqual = () => isStrictEquivalent;
3353
3353
  * @since 4.0.0
3354
3354
  */
3355
3355
  function Tuple$1(elements) {
3356
- return make$82((self, that) => {
3356
+ return make$83((self, that) => {
3357
3357
  if (self.length !== that.length) return false;
3358
3358
  for (let i = 0; i < self.length; i++) if (!elements[i](self[i], that[i])) return false;
3359
3359
  return true;
@@ -3363,7 +3363,7 @@ function Tuple$1(elements) {
3363
3363
  * @since 4.0.0
3364
3364
  */
3365
3365
  function Array_(item) {
3366
- return make$82((self, that) => {
3366
+ return make$83((self, that) => {
3367
3367
  if (self.length !== that.length) return false;
3368
3368
  for (let i = 0; i < self.length; i++) if (!item(self[i], that[i])) return false;
3369
3369
  return true;
@@ -3373,9 +3373,9 @@ function Array_(item) {
3373
3373
  /**
3374
3374
  * @since 2.0.0
3375
3375
  */
3376
- const TypeId$69 = "~effect/Option";
3376
+ const TypeId$70 = "~effect/Option";
3377
3377
  const CommonProto$1 = {
3378
- [TypeId$69]: { _A: (_) => _ },
3378
+ [TypeId$70]: { _A: (_) => _ },
3379
3379
  ...PipeInspectableProto,
3380
3380
  [Symbol.iterator]() {
3381
3381
  return new SingleShotGen(this);
@@ -3388,7 +3388,7 @@ const SomeProto = /*#__PURE__*/ Object.defineProperty(/*#__PURE__*/ Object.assig
3388
3388
  return isOption$1(that) && isSome$1(that) && equals$2(this.value, that.value);
3389
3389
  },
3390
3390
  [symbol$3]() {
3391
- return combine$2(hash(this._tag))(hash(this.value));
3391
+ return combine$3(hash(this._tag))(hash(this.value));
3392
3392
  },
3393
3393
  toString() {
3394
3394
  return `some(${format$2(this.value)})`;
@@ -3425,7 +3425,7 @@ const NoneProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Common
3425
3425
  }
3426
3426
  });
3427
3427
  /** @internal */
3428
- const isOption$1 = (input) => hasProperty(input, TypeId$69);
3428
+ const isOption$1 = (input) => hasProperty(input, TypeId$70);
3429
3429
  /** @internal */
3430
3430
  const isNone$1 = (fa) => fa._tag === "None";
3431
3431
  /** @internal */
@@ -3440,9 +3440,9 @@ SomeImpl.prototype = SomeProto;
3440
3440
  /** @internal */
3441
3441
  const some$2 = (value) => new SomeImpl(value);
3442
3442
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/result.js
3443
- const TypeId$68 = "~effect/Result";
3443
+ const TypeId$69 = "~effect/Result";
3444
3444
  const CommonProto = {
3445
- [TypeId$68]: {
3445
+ [TypeId$69]: {
3446
3446
  /* v8 ignore next 2 */
3447
3447
  _A: (_) => _,
3448
3448
  _E: (_) => _
@@ -3459,7 +3459,7 @@ const SuccessProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
3459
3459
  return isResult$1(that) && isSuccess$2(that) && equals$2(this.success, that.success);
3460
3460
  },
3461
3461
  [symbol$3]() {
3462
- return combine$2(hash(this._tag))(hash(this.success));
3462
+ return combine$3(hash(this._tag))(hash(this.success));
3463
3463
  },
3464
3464
  toString() {
3465
3465
  return `success(${format$2(this.success)})`;
@@ -3479,7 +3479,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
3479
3479
  return isResult$1(that) && isFailure$2(that) && equals$2(this.failure, that.failure);
3480
3480
  },
3481
3481
  [symbol$3]() {
3482
- return combine$2(hash(this._tag))(hash(this.failure));
3482
+ return combine$3(hash(this._tag))(hash(this.failure));
3483
3483
  },
3484
3484
  toString() {
3485
3485
  return `failure(${format$2(this.failure)})`;
@@ -3493,7 +3493,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
3493
3493
  }
3494
3494
  });
3495
3495
  /** @internal */
3496
- const isResult$1 = (input) => hasProperty(input, TypeId$68);
3496
+ const isResult$1 = (input) => hasProperty(input, TypeId$69);
3497
3497
  /** @internal */
3498
3498
  const isFailure$2 = (result) => result._tag === "Failure";
3499
3499
  /** @internal */
@@ -3564,7 +3564,7 @@ const getSuccess$1 = (self) => isFailure$2(self) ? none$1 : some$2(self.success)
3564
3564
  * @category constructors
3565
3565
  * @since 2.0.0
3566
3566
  */
3567
- function make$81(compare) {
3567
+ function make$82(compare) {
3568
3568
  return (self, that) => self === that ? 0 : compare(self, that);
3569
3569
  }
3570
3570
  /**
@@ -3595,7 +3595,7 @@ function make$81(compare) {
3595
3595
  * @category instances
3596
3596
  * @since 4.0.0
3597
3597
  */
3598
- const String$10 = /*#__PURE__*/ make$81((self, that) => self < that ? -1 : 1);
3598
+ const String$10 = /*#__PURE__*/ make$82((self, that) => self < that ? -1 : 1);
3599
3599
  /**
3600
3600
  * Order instance for numbers that compares them numerically.
3601
3601
  *
@@ -3628,7 +3628,7 @@ const String$10 = /*#__PURE__*/ make$81((self, that) => self < that ? -1 : 1);
3628
3628
  * @category instances
3629
3629
  * @since 4.0.0
3630
3630
  */
3631
- const Number$6 = /*#__PURE__*/ make$81((self, that) => {
3631
+ const Number$6 = /*#__PURE__*/ make$82((self, that) => {
3632
3632
  if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
3633
3633
  if (globalThis.Number.isNaN(self)) return -1;
3634
3634
  if (globalThis.Number.isNaN(that)) return 1;
@@ -3665,9 +3665,57 @@ const Number$6 = /*#__PURE__*/ make$81((self, that) => {
3665
3665
  * @since 4.0.0
3666
3666
  */
3667
3667
  function flip$1(O) {
3668
- return make$81((self, that) => O(that, self));
3668
+ return make$82((self, that) => O(that, self));
3669
3669
  }
3670
3670
  /**
3671
+ * Combines two `Order` instances to create a new `Order` that first compares using the first `Order`,
3672
+ * and if the values are equal, then compares using the second `Order`.
3673
+ *
3674
+ * **When to use**
3675
+ *
3676
+ * Use when you need tie-breaking with exactly two orders.
3677
+ *
3678
+ * **Details**
3679
+ *
3680
+ * First applies the first order. If the result is non-zero, that result is
3681
+ * returned; otherwise, the second order is applied. The result is the first
3682
+ * non-zero comparison result, or `0` if both orders return `0`.
3683
+ *
3684
+ * **Example** (Combining two Orders)
3685
+ *
3686
+ * ```ts import.meta.vitest
3687
+ * import { Order } from "effect"
3688
+ *
3689
+ * const byAge = Order.mapInput(
3690
+ * Order.Number,
3691
+ * (person: { name: string; age: number }) => person.age
3692
+ * )
3693
+ * const byName = Order.mapInput(
3694
+ * Order.String,
3695
+ * (person: { name: string; age: number }) => person.name
3696
+ * )
3697
+ * const byAgeAndName = Order.combine(byAge, byName)
3698
+ *
3699
+ * const person1 = { name: "Alice", age: 30 }
3700
+ * const person2 = { name: "Bob", age: 30 }
3701
+ * const person3 = { name: "Charlie", age: 25 }
3702
+ *
3703
+ * byAgeAndName(person1, person2) // => -1
3704
+ * byAgeAndName(person1, person3) // => 1
3705
+ * ```
3706
+ *
3707
+ * @see {@link combineAll} to combine multiple orders from a collection
3708
+ * @see {@link mapInput} to transform orders to work with different types
3709
+ * @stability stable
3710
+ * @category combining
3711
+ * @since 2.0.0
3712
+ */
3713
+ const combine$2 = /*#__PURE__*/ dual(2, (self, that) => make$82((a1, a2) => {
3714
+ const out = self(a1, a2);
3715
+ if (out !== 0) return out;
3716
+ return that(a1, a2);
3717
+ }));
3718
+ /**
3671
3719
  * Transforms an `Order` on type `A` into an `Order` on type `B` by providing a function that
3672
3720
  * maps values of type `B` to values of type `A`.
3673
3721
  *
@@ -3700,7 +3748,7 @@ function flip$1(O) {
3700
3748
  * @category mapping
3701
3749
  * @since 2.0.0
3702
3750
  */
3703
- const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$81((b1, b2) => self(f(b1), f(b2))));
3751
+ const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$82((b1, b2) => self(f(b1), f(b2))));
3704
3752
  /**
3705
3753
  * Checks whether one value is strictly less than another according to the given order.
3706
3754
  *
@@ -4358,6 +4406,44 @@ const liftThrowable = (f) => (...a) => {
4358
4406
  }
4359
4407
  };
4360
4408
  /**
4409
+ * Extracts the value from a `Some`, or throws a default `Error` for `None`.
4410
+ *
4411
+ * **When to use**
4412
+ *
4413
+ * Use when you need quick fail-fast unwrapping of an `Option` and a generic
4414
+ * error is acceptable.
4415
+ *
4416
+ * **Details**
4417
+ *
4418
+ * - `Some` → returns the inner value
4419
+ * - `None` → throws `new Error("getOrThrow called on a None")`
4420
+ *
4421
+ * **Example** (Throwing a default error)
4422
+ *
4423
+ * ```ts import.meta.vitest
4424
+ * import { Option, Result } from "effect"
4425
+ *
4426
+ * Option.getOrThrow(Option.some(1)) // => 1
4427
+ *
4428
+ * const failure = Result.try({
4429
+ * try: () => Option.getOrThrow(Option.none()),
4430
+ * catch: (error) => (error as Error).message
4431
+ * })
4432
+ * Result.getFailure(failure).pipe(Option.getOrElse(() => "no error")) // => "getOrThrow called on a None"
4433
+ * ```
4434
+ *
4435
+ * @see {@link getOrThrowWith} for a custom error
4436
+ * @see {@link getOrElse} for a non-throwing alternative
4437
+ *
4438
+ * @stability stable
4439
+ * @category converting
4440
+ * @since 2.0.0
4441
+ */
4442
+ const getOrThrow$1 = /*#__PURE__*/ (/* @__PURE__ */ dual(2, (self, onNone) => {
4443
+ if (isSome(self)) return self.value;
4444
+ throw onNone();
4445
+ }))(() => /* @__PURE__ */ new Error("getOrThrow called on a None"));
4446
+ /**
4361
4447
  * Transforms the value inside a `Some` using the provided function, leaving
4362
4448
  * `None` unchanged.
4363
4449
  *
@@ -4852,7 +4938,7 @@ const ServiceProto = {
4852
4938
  return self;
4853
4939
  },
4854
4940
  context(self) {
4855
- return make$80(this, self);
4941
+ return make$81(this, self);
4856
4942
  },
4857
4943
  use(f) {
4858
4944
  return withFiber$1((fiber) => f(get$12(fiber.context, this)));
@@ -4863,7 +4949,7 @@ const ServiceProto = {
4863
4949
  };
4864
4950
  const cacheKeys = /*#__PURE__*/ new Set();
4865
4951
  const ReferenceTypeId = "~effect/Context/Reference";
4866
- const TypeId$67 = "~effect/Context";
4952
+ const TypeId$68 = "~effect/Context";
4867
4953
  const FlattenAfterBaseHits = 8;
4868
4954
  const makeImpl$1 = (cacheRoot, base, overlay, depth, maxDepth) => {
4869
4955
  const self = Object.create(Proto$22);
@@ -4962,7 +5048,7 @@ const Proto$22 = {
4962
5048
  return flatten$4(this);
4963
5049
  },
4964
5050
  ...PipeInspectableProto,
4965
- [TypeId$67]: { _Services: (_) => _ },
5051
+ [TypeId$68]: { _Services: (_) => _ },
4966
5052
  toJSON() {
4967
5053
  return {
4968
5054
  _id: "Context",
@@ -5018,7 +5104,7 @@ const hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
5018
5104
  * @category guards
5019
5105
  * @since 2.0.0
5020
5106
  */
5021
- const isContext = (u) => hasProperty(u, TypeId$67);
5107
+ const isContext = (u) => hasProperty(u, TypeId$68);
5022
5108
  /**
5023
5109
  * Checks whether the provided argument is a `Reference`.
5024
5110
  *
@@ -5054,7 +5140,7 @@ const isReference = (u) => !!u[ReferenceTypeId];
5054
5140
  * @category constructors
5055
5141
  * @since 2.0.0
5056
5142
  */
5057
- const empty$14 = () => emptyContext;
5143
+ const empty$15 = () => emptyContext;
5058
5144
  const emptyContext = /*#__PURE__*/ makeUnsafe$9(/*#__PURE__*/ new Map());
5059
5145
  /**
5060
5146
  * Creates a new `Context` with a single service associated to the key.
@@ -5075,7 +5161,7 @@ const emptyContext = /*#__PURE__*/ makeUnsafe$9(/*#__PURE__*/ new Map());
5075
5161
  * @category constructors
5076
5162
  * @since 2.0.0
5077
5163
  */
5078
- const make$80 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key, service]]));
5164
+ const make$81 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key, service]]));
5079
5165
  /**
5080
5166
  * Adds a service to a given `Context`.
5081
5167
  *
@@ -5113,7 +5199,7 @@ const make$80 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key
5113
5199
  * @category combining
5114
5200
  * @since 2.0.0
5115
5201
  */
5116
- const add$1 = /*#__PURE__*/ dual(3, (self, key, service) => addUnsafe$1(self, key.key, service));
5202
+ const add$2 = /*#__PURE__*/ dual(3, (self, key, service) => addUnsafe$1(self, key.key, service));
5117
5203
  /**
5118
5204
  * Adds a service by key to a given `Context` using a string key.
5119
5205
  *
@@ -5379,6 +5465,41 @@ const mergeAll$2 = (...ctxs) => {
5379
5465
  return makeUnsafe$9(map);
5380
5466
  };
5381
5467
  /**
5468
+ * Returns a new `Context` with the specified service keys removed.
5469
+ *
5470
+ * **When to use**
5471
+ *
5472
+ * Use when you want to remove a denylist of services from a `Context`.
5473
+ *
5474
+ * **Example** (Omitting services from a context)
5475
+ *
5476
+ * ```ts import.meta.vitest
5477
+ * import { Context, Option, pipe } from "effect"
5478
+ *
5479
+ * const Port = Context.Service<{ PORT: number }>("Port")
5480
+ * const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
5481
+ *
5482
+ * const someContext = pipe(
5483
+ * Context.make(Port, { PORT: 8080 }),
5484
+ * Context.add(Timeout, { TIMEOUT: 5000 })
5485
+ * )
5486
+ *
5487
+ * const context = pipe(someContext, Context.omit(Timeout))
5488
+ *
5489
+ * Context.getOption(context, Port) // => Option.some({ PORT: 8080 })
5490
+ * Context.getOption(context, Timeout) // => Option.none()
5491
+ * ```
5492
+ *
5493
+ * @see {@link pick} for keeping selected services
5494
+ *
5495
+ * @stability stable
5496
+ * @category filtering
5497
+ * @since 2.0.0
5498
+ */
5499
+ const omit$2 = (...keys) => (self) => withFlat(self, (map) => {
5500
+ for (let i = 0; i < keys.length; i++) map.delete(keys[i].key);
5501
+ });
5502
+ /**
5382
5503
  * Creates a context key with a default value.
5383
5504
  *
5384
5505
  * **When to use**
@@ -5440,6 +5561,12 @@ const isArrayNonEmpty$1 = (self) => self.length > 0;
5440
5561
  * @internal
5441
5562
  */
5442
5563
  const normalize$2 = (n) => n > 0 ? Math.floor(n) : 0;
5564
+ /**
5565
+ * Normalizes a collection count to an integer greater than or equal to `1`.
5566
+ *
5567
+ * @internal
5568
+ */
5569
+ const normalizeNonEmpty = (n) => Math.max(1, normalize$2(n));
5443
5570
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Result.js
5444
5571
  /**
5445
5572
  * Creates a `Result` holding a `Success` value.
@@ -5856,6 +5983,34 @@ const all$3 = (input) => {
5856
5983
  };
5857
5984
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Tuple.js
5858
5985
  /**
5986
+ * Creates a tuple from the provided arguments.
5987
+ *
5988
+ * **When to use**
5989
+ *
5990
+ * Use when you need a properly typed tuple without writing `[a, b, c] as const`
5991
+ * or another manual cast.
5992
+ *
5993
+ * **Details**
5994
+ *
5995
+ * The returned value has the exact tuple type, with each element's literal type
5996
+ * preserved.
5997
+ *
5998
+ * **Example** (Creating a tuple)
5999
+ *
6000
+ * ```ts import.meta.vitest
6001
+ * import { Tuple } from "effect"
6002
+ *
6003
+ * Tuple.make(10, 20, "red") // => [10, 20, "red"]
6004
+ * ```
6005
+ *
6006
+ * @see {@link get} – access a single element by index
6007
+ * @see {@link appendElement} – append an element to a tuple
6008
+ * @stability stable
6009
+ * @category constructors
6010
+ * @since 2.0.0
6011
+ */
6012
+ const make$80 = (...elements) => elements;
6013
+ /**
5859
6014
  * Creates an `Equivalence` for tuples by comparing corresponding elements
5860
6015
  * using the provided per-position `Equivalence`s. Two tuples are equivalent
5861
6016
  * when all their corresponding elements are equivalent.
@@ -6055,7 +6210,7 @@ const constEmptyIterator = { next() {
6055
6210
  * @category constructors
6056
6211
  * @since 2.0.0
6057
6212
  */
6058
- const empty$13 = () => constEmpty;
6213
+ const empty$14 = () => constEmpty;
6059
6214
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Record.js
6060
6215
  /**
6061
6216
  * Creates a new, empty record.
@@ -6077,7 +6232,7 @@ const empty$13 = () => constEmpty;
6077
6232
  * @category constructors
6078
6233
  * @since 2.0.0
6079
6234
  */
6080
- const empty$12 = () => ({});
6235
+ const empty$13 = () => ({});
6081
6236
  /**
6082
6237
  * Determines if a mutable record is empty.
6083
6238
  *
@@ -6186,7 +6341,7 @@ const size$3 = (self) => keys$1(self).length;
6186
6341
  * @category predicates
6187
6342
  * @since 2.0.0
6188
6343
  */
6189
- const has$4 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key));
6344
+ const has$6 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key));
6190
6345
  /**
6191
6346
  * Retrieves a value at a particular key from a record safely, returning it wrapped in an `Option`.
6192
6347
  *
@@ -6231,7 +6386,7 @@ const get$11 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key) ? s
6231
6386
  * @since 2.0.0
6232
6387
  */
6233
6388
  const remove$4 = /*#__PURE__*/ dual(2, (self, key) => {
6234
- if (!has$4(self, key)) return { ...self };
6389
+ if (!has$6(self, key)) return { ...self };
6235
6390
  const out = { ...self };
6236
6391
  delete out[key];
6237
6392
  return out;
@@ -6279,7 +6434,7 @@ const map$9 = /*#__PURE__*/ dual(2, (self, f) => {
6279
6434
  * @since 2.0.0
6280
6435
  */
6281
6436
  const filter$4 = /*#__PURE__*/ dual(2, (self, predicate) => {
6282
- const out = empty$12();
6437
+ const out = empty$13();
6283
6438
  for (const key of keys$1(self)) if (predicate(self[key], key)) assignProperty(out, key, self[key]);
6284
6439
  return out;
6285
6440
  });
@@ -6300,7 +6455,7 @@ const filter$4 = /*#__PURE__*/ dual(2, (self, predicate) => {
6300
6455
  * @since 2.0.0
6301
6456
  */
6302
6457
  const getSomes$1 = (self) => {
6303
- const out = empty$12();
6458
+ const out = empty$13();
6304
6459
  for (const key of keys$1(self)) {
6305
6460
  const option = self[key];
6306
6461
  if (isSome(option)) assignProperty(out, key, option.value);
@@ -6390,7 +6545,7 @@ const set$6 = /*#__PURE__*/ dual(3, (self, key, value) => {
6390
6545
  * @since 2.0.0
6391
6546
  */
6392
6547
  const isSubrecordBy = (equivalence) => dual(2, (self, that) => {
6393
- for (const key of keys$1(self)) if (!has$4(that, key) || !equivalence(self[key], that[key])) return false;
6548
+ for (const key of keys$1(self)) if (!has$6(that, key) || !equivalence(self[key], that[key])) return false;
6394
6549
  return true;
6395
6550
  });
6396
6551
  /**
@@ -6451,6 +6606,40 @@ const makeEquivalence$3 = (equivalence) => {
6451
6606
  */
6452
6607
  const Array$2 = globalThis.Array;
6453
6608
  /**
6609
+ * Creates a `NonEmptyArray` of length `n` where element `i` is computed by `f(i)`.
6610
+ *
6611
+ * **When to use**
6612
+ *
6613
+ * Use when you need to compute each array element from its index.
6614
+ *
6615
+ * **Details**
6616
+ *
6617
+ * `n` is rounded down and normalized to an integer greater than or equal to 1.
6618
+ * `NaN` is treated as `1`, so this function always returns at least one
6619
+ * element. Supports both data-first and data-last usage.
6620
+ *
6621
+ * **Example** (Generating values from indices)
6622
+ *
6623
+ * ```ts import.meta.vitest
6624
+ * import { Array } from "effect"
6625
+ *
6626
+ * Array.makeBy(5, (n) => n * 2) // => [0, 2, 4, 6, 8]
6627
+ * ```
6628
+ *
6629
+ * @see {@link range} — create a range of integers
6630
+ * @see {@link replicate} — repeat a single value
6631
+ *
6632
+ * @stability stable
6633
+ * @category constructors
6634
+ * @since 2.0.0
6635
+ */
6636
+ const makeBy = /*#__PURE__*/ dual(2, (n, f) => {
6637
+ const max = normalizeNonEmpty(n);
6638
+ const out = new Array$2(max);
6639
+ for (let i = 0; i < max; i++) out[i] = f(i);
6640
+ return out;
6641
+ });
6642
+ /**
6454
6643
  * Converts an `Iterable` to an `Array`.
6455
6644
  *
6456
6645
  * **When to use**
@@ -6478,7 +6667,7 @@ const Array$2 = globalThis.Array;
6478
6667
  * @category constructors
6479
6668
  * @since 2.0.0
6480
6669
  */
6481
- const fromIterable$7 = (collection) => Array$2.isArray(collection) ? collection : Array$2.from(collection);
6670
+ const fromIterable$8 = (collection) => Array$2.isArray(collection) ? collection : Array$2.from(collection);
6482
6671
  /**
6483
6672
  * Normalizes a value that is either a single element or an array into an array.
6484
6673
  *
@@ -6893,7 +7082,7 @@ const clampCount = (n, length) => Math.min(normalize$2(n), length);
6893
7082
  * @since 2.0.0
6894
7083
  */
6895
7084
  const take$3 = /*#__PURE__*/ dual(2, (self, n) => {
6896
- const input = fromIterable$7(self);
7085
+ const input = fromIterable$8(self);
6897
7086
  return input.slice(0, clampCount(n, input.length));
6898
7087
  });
6899
7088
  /**
@@ -6926,7 +7115,7 @@ const take$3 = /*#__PURE__*/ dual(2, (self, n) => {
6926
7115
  * @since 2.0.0
6927
7116
  */
6928
7117
  const drop$1 = /*#__PURE__*/ dual(2, (self, n) => {
6929
- const input = fromIterable$7(self);
7118
+ const input = fromIterable$8(self);
6930
7119
  return input.slice(clampCount(n, input.length), input.length);
6931
7120
  });
6932
7121
  /**
@@ -6956,7 +7145,7 @@ const drop$1 = /*#__PURE__*/ dual(2, (self, n) => {
6956
7145
  * @since 2.0.0
6957
7146
  */
6958
7147
  const dropWhile = /*#__PURE__*/ dual(2, (self, predicate) => {
6959
- const input = fromIterable$7(self);
7148
+ const input = fromIterable$8(self);
6960
7149
  let i = 0;
6961
7150
  while (i < input.length) {
6962
7151
  if (!predicate(input[i], i)) break;
@@ -7020,7 +7209,7 @@ const findFirstIndex = /*#__PURE__*/ dual(2, (self, predicate) => {
7020
7209
  * @since 2.0.0
7021
7210
  */
7022
7211
  const findLastIndex = /*#__PURE__*/ dual(2, (self, predicate) => {
7023
- const input = fromIterable$7(self);
7212
+ const input = fromIterable$8(self);
7024
7213
  for (let i = input.length - 1; i >= 0; i--) if (predicate(input[i], i)) return some$1(i);
7025
7214
  return none();
7026
7215
  });
@@ -7085,7 +7274,7 @@ const findFirst = findFirst$1;
7085
7274
  * @since 2.0.0
7086
7275
  */
7087
7276
  const findLast = /*#__PURE__*/ dual(2, (self, f) => {
7088
- const input = fromIterable$7(self);
7277
+ const input = fromIterable$8(self);
7089
7278
  for (let i = input.length - 1; i >= 0; i--) {
7090
7279
  const a = input[i];
7091
7280
  const o = f(a, i);
@@ -7153,6 +7342,35 @@ const sort = /*#__PURE__*/ dual(2, (self, O) => {
7153
7342
  return out;
7154
7343
  });
7155
7344
  /**
7345
+ * Sorts an array by a derived key using a mapping function and an `Order` for
7346
+ * that key.
7347
+ *
7348
+ * **When to use**
7349
+ *
7350
+ * Use when you need to sort values by a derived key, such as a string length or
7351
+ * object field, while keeping the original values.
7352
+ *
7353
+ * **Details**
7354
+ *
7355
+ * Equivalent to `sort(Order.mapInput(order, f))`, but more convenient.
7356
+ *
7357
+ * **Example** (Sorting strings by length)
7358
+ *
7359
+ * ```ts import.meta.vitest
7360
+ * import { Array, Order } from "effect"
7361
+ *
7362
+ * Array.sortWith(["aaa", "b", "cc"], (s) => s.length, Order.Number) // => ["b", "cc", "aaa"]
7363
+ * ```
7364
+ *
7365
+ * @see {@link sort} for sorting with an `Order` that compares the elements directly
7366
+ * @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
7367
+ *
7368
+ * @stability stable
7369
+ * @category sorting
7370
+ * @since 2.0.0
7371
+ */
7372
+ const sortWith = /*#__PURE__*/ dual(3, (self, f, order) => Array$2.from(self).map((a) => [a, f(a)]).sort(([, a], [, b]) => order(a, b)).map(([_]) => _));
7373
+ /**
7156
7374
  * Returns a membership-test function using a custom equivalence.
7157
7375
  *
7158
7376
  * **When to use**
@@ -7302,8 +7520,8 @@ const hashBucketsHas = (buckets, value) => {
7302
7520
  * @since 2.0.0
7303
7521
  */
7304
7522
  const difference = /*#__PURE__*/ dual(2, (self, that) => {
7305
- const thatArray = fromIterable$7(that);
7306
- const selfArray = fromIterable$7(self);
7523
+ const thatArray = fromIterable$8(that);
7524
+ const selfArray = fromIterable$8(self);
7307
7525
  if (selfArray.length === 0) return [];
7308
7526
  if (thatArray.length === 0) return selfArray.filter(() => true);
7309
7527
  const buckets = makeHashBuckets(thatArray);
@@ -7331,7 +7549,7 @@ const difference = /*#__PURE__*/ dual(2, (self, that) => {
7331
7549
  * @category constructors
7332
7550
  * @since 2.0.0
7333
7551
  */
7334
- const empty$11 = () => [];
7552
+ const empty$12 = () => [];
7335
7553
  /**
7336
7554
  * Wraps a single value in a `NonEmptyArray`.
7337
7555
  *
@@ -7495,7 +7713,7 @@ const getSomes = (self) => {
7495
7713
  * @since 2.0.0
7496
7714
  */
7497
7715
  const filter$3 = /*#__PURE__*/ dual(2, (self, predicate) => {
7498
- const as = fromIterable$7(self);
7716
+ const as = fromIterable$8(self);
7499
7717
  const out = [];
7500
7718
  for (let i = 0; i < as.length; i++) if (predicate(as[i], i)) out.push(as[i]);
7501
7719
  return out;
@@ -7526,7 +7744,7 @@ const filter$3 = /*#__PURE__*/ dual(2, (self, predicate) => {
7526
7744
  * @category folding
7527
7745
  * @since 2.0.0
7528
7746
  */
7529
- const reduce = /*#__PURE__*/ dual(3, (self, b, f) => fromIterable$7(self).reduce((b, a, i) => f(b, a, i), b));
7747
+ const reduce = /*#__PURE__*/ dual(3, (self, b, f) => fromIterable$8(self).reduce((b, a, i) => f(b, a, i), b));
7530
7748
  /**
7531
7749
  * Checks whether all elements satisfy the predicate. Supports refinements for
7532
7750
  * type narrowing.
@@ -7596,6 +7814,38 @@ const some = /*#__PURE__*/ dual(2, (self, predicate) => self.some(predicate));
7596
7814
  */
7597
7815
  const makeEquivalence$2 = Array_;
7598
7816
  /**
7817
+ * Removes duplicates using a custom equivalence, preserving the order of the
7818
+ * first occurrence.
7819
+ *
7820
+ * **When to use**
7821
+ *
7822
+ * Use to remove all duplicate elements with a custom equivalence when default
7823
+ * equality is not appropriate.
7824
+ *
7825
+ * **Example** (Deduplicating with custom equality)
7826
+ *
7827
+ * ```ts import.meta.vitest
7828
+ * import { Array } from "effect"
7829
+ *
7830
+ * Array.dedupeWith([1, 2, 2, 3, 3, 3], (a, b) => a === b) // => [1, 2, 3]
7831
+ * ```
7832
+ *
7833
+ * @see {@link dedupe} — uses default equality
7834
+ * @see {@link dedupeAdjacentWith} — only dedupes consecutive elements
7835
+ *
7836
+ * @stability stable
7837
+ * @category deduplication
7838
+ * @since 2.0.0
7839
+ */
7840
+ const dedupeWith = /*#__PURE__*/ dual(2, (self, isEquivalent) => {
7841
+ const out = [];
7842
+ next: for (const r of fromIterable$8(self)) {
7843
+ for (let i = 0; i < out.length; i++) if (isEquivalent(r, out[i])) continue next;
7844
+ out.push(r);
7845
+ }
7846
+ return out;
7847
+ });
7848
+ /**
7599
7849
  * Removes duplicates using `Equal.asEquivalence()`, preserving the order of the
7600
7850
  * first occurrence.
7601
7851
  *
@@ -7620,7 +7870,7 @@ const makeEquivalence$2 = Array_;
7620
7870
  * @since 2.0.0
7621
7871
  */
7622
7872
  const dedupe = (self) => {
7623
- const input = fromIterable$7(self);
7873
+ const input = fromIterable$8(self);
7624
7874
  if (input.length < 2) return [...input];
7625
7875
  const buckets = /* @__PURE__ */ new Map();
7626
7876
  const out = [];
@@ -7644,9 +7894,9 @@ const dedupe = (self) => {
7644
7894
  * @category folding
7645
7895
  * @since 2.0.0
7646
7896
  */
7647
- const join$2 = /*#__PURE__*/ dual(2, (self, sep) => fromIterable$7(self).join(sep));
7897
+ const join$2 = /*#__PURE__*/ dual(2, (self, sep) => fromIterable$8(self).join(sep));
7648
7898
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Duration.js
7649
- const TypeId$66 = "~effect/Duration";
7899
+ const TypeId$67 = "~effect/Duration";
7650
7900
  const bigint0$3 = /*#__PURE__*/ BigInt(0);
7651
7901
  const bigint1$2 = /*#__PURE__*/ BigInt(1);
7652
7902
  const bigint2 = /*#__PURE__*/ BigInt(2);
@@ -7747,7 +7997,7 @@ const fromInputUnsafe$1 = (input) => {
7747
7997
  }
7748
7998
  case "object": {
7749
7999
  if (input === null) break;
7750
- if (TypeId$66 in input) return input;
8000
+ if (TypeId$67 in input) return input;
7751
8001
  if (Array.isArray(input)) {
7752
8002
  if (input.length !== 2 || !input.every(isNumber)) return invalid$3(input);
7753
8003
  if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero$2;
@@ -7818,7 +8068,7 @@ const zeroDurationValue = {
7818
8068
  const infinityDurationValue = { _tag: "Infinity" };
7819
8069
  const negativeInfinityDurationValue = { _tag: "NegativeInfinity" };
7820
8070
  const DurationProto = {
7821
- [TypeId$66]: TypeId$66,
8071
+ [TypeId$67]: TypeId$67,
7822
8072
  [symbol$3]() {
7823
8073
  switch (this.value._tag) {
7824
8074
  case "Millis": return hash(roundMillisToNanos(this.value.millis));
@@ -7902,7 +8152,7 @@ const make$79 = (input) => {
7902
8152
  * @category guards
7903
8153
  * @since 2.0.0
7904
8154
  */
7905
- const isDuration = (u) => hasProperty(u, TypeId$66);
8155
+ const isDuration = (u) => hasProperty(u, TypeId$67);
7906
8156
  /**
7907
8157
  * Checks whether a Duration is finite (not infinite).
7908
8158
  *
@@ -8255,7 +8505,7 @@ const matchPair = /*#__PURE__*/ dual(3, (self, that, options) => {
8255
8505
  * @category instances
8256
8506
  * @since 2.0.0
8257
8507
  */
8258
- const Order$4 = /*#__PURE__*/ make$81((self, that) => matchPair(self, that, {
8508
+ const Order$4 = /*#__PURE__*/ make$82((self, that) => matchPair(self, that, {
8259
8509
  onMillis: (self, that) => self < that ? -1 : self > that ? 1 : 0,
8260
8510
  onNanos: (self, that) => self < that ? -1 : self > that ? 1 : 0,
8261
8511
  onInfinity: (self, that) => {
@@ -8505,7 +8755,7 @@ const toPredicate = (self) => (input) => !isFailure$1(self(input));
8505
8755
  * @category constructors
8506
8756
  * @since 4.0.0
8507
8757
  */
8508
- const has$3 = (key) => (input) => input.has(key) ? succeed$10(input) : fail$12(input);
8758
+ const has$5 = (key) => (input) => input.has(key) ? succeed$10(input) : fail$12(input);
8509
8759
  /**
8510
8760
  * Composes two filters sequentially, feeding the output of the first into the second.
8511
8761
  *
@@ -9215,7 +9465,7 @@ const externalSpan = (options) => ({
9215
9465
  spanId: options.spanId,
9216
9466
  traceId: options.traceId,
9217
9467
  sampled: options.sampled ?? true,
9218
- annotations: options.annotations ?? empty$14()
9468
+ annotations: options.annotations ?? empty$15()
9219
9469
  });
9220
9470
  /**
9221
9471
  * Context reference for disabling trace propagation.
@@ -9793,7 +10043,7 @@ var FiberImpl = class {
9793
10043
  interruptUnsafe(fiberId, annotations) {
9794
10044
  if (this._exit) return;
9795
10045
  let cause = causeInterrupt(fiberId);
9796
- if (this.cache.stackFrame) cause = causeAnnotate(cause, make$80(StackTraceKey, this.cache.stackFrame));
10046
+ if (this.cache.stackFrame) cause = causeAnnotate(cause, make$81(StackTraceKey, this.cache.stackFrame));
9797
10047
  if (annotations) cause = causeAnnotate(cause, annotations);
9798
10048
  this._interruptedCause = this._interruptedCause ? causeAddInterrupts(this._interruptedCause, cause) : cause;
9799
10049
  if (this.interruptible) {
@@ -9839,7 +10089,7 @@ var FiberImpl = class {
9839
10089
  }
9840
10090
  this._stack.length = 0;
9841
10091
  this._children = void 0;
9842
- this.context = empty$14();
10092
+ this.context = empty$15();
9843
10093
  const cache = this.cache;
9844
10094
  if (cache.span !== void 0 || cache.stackFrame !== void 0) this.cache = {
9845
10095
  ...cache,
@@ -10029,7 +10279,7 @@ const fiberInterruptAs = /*#__PURE__*/ dual((args) => hasProperty(args[0], Fiber
10029
10279
  /** @internal */
10030
10280
  const fiberInterruptAll = (fibers) => withFiber$1((parent) => {
10031
10281
  const annotations = fiberStackAnnotations(parent);
10032
- let fiberArr = empty$11();
10282
+ let fiberArr = empty$12();
10033
10283
  for (const fiber of fibers) {
10034
10284
  fiber.interruptUnsafe(parent.id, annotations);
10035
10285
  fiberArr.push(fiber);
@@ -10053,7 +10303,7 @@ const sync$2 = /*#__PURE__*/ makePrimitive$1({
10053
10303
  }
10054
10304
  });
10055
10305
  /** @internal */
10056
- const suspend$3 = /*#__PURE__*/ makePrimitive$1({
10306
+ const suspend$4 = /*#__PURE__*/ makePrimitive$1({
10057
10307
  op: "Suspend",
10058
10308
  [evaluate](_fiber) {
10059
10309
  const thunk = this[args];
@@ -10088,18 +10338,18 @@ const succeedNone$1 = /*#__PURE__*/ succeed$9(/*#__PURE__*/ none());
10088
10338
  /** @internal */
10089
10339
  const transposeOption$1 = (self) => isNone(self) ? succeedNone$1 : map$7(self.value, some$1);
10090
10340
  /** @internal */
10091
- const failCauseSync$1 = (evaluate) => suspend$3(() => failCause$6(evaluate()));
10341
+ const failCauseSync$1 = (evaluate) => suspend$4(() => failCause$6(evaluate()));
10092
10342
  /** @internal */
10093
10343
  const die$5 = (defect) => exitDie(defect);
10094
10344
  /** @internal */
10095
- const failSync$1 = (error) => suspend$3(() => fail$11(error()));
10345
+ const failSync$1 = (error) => suspend$4(() => fail$11(error()));
10096
10346
  /** @internal */
10097
10347
  const void_$3 = /*#__PURE__*/ succeed$9(void 0);
10098
10348
  /** @internal */
10099
10349
  const try_$1 = (options) => {
10100
10350
  const evaluate = typeof options === "function" ? options : options.try;
10101
10351
  const catcher = typeof options === "function" ? (cause) => new UnknownError$2(cause, "An error occurred in Effect.try") : options.catch;
10102
- return suspend$3(() => {
10352
+ return suspend$4(() => {
10103
10353
  try {
10104
10354
  return succeed$9(evaluate());
10105
10355
  } catch (err) {
@@ -10116,7 +10366,7 @@ const tryPromise$1 = (options) => {
10116
10366
  const f = typeof options === "function" ? options : options.try;
10117
10367
  const catcher = typeof options === "function" ? (cause) => new UnknownError$2(cause, "An error occurred in Effect.tryPromise") : options.catch;
10118
10368
  return callbackOptions(function(resume, signal) {
10119
- const failWithCatch = (cause) => suspend$3(() => {
10369
+ const failWithCatch = (cause) => suspend$4(() => {
10120
10370
  try {
10121
10371
  return fail$11(internalCall(() => catcher(cause)));
10122
10372
  } catch (err) {
@@ -10186,19 +10436,19 @@ const never$2 = /*#__PURE__*/ callback$2(constVoid);
10186
10436
  const gen$1 = (...args) => {
10187
10437
  if (args.length === 1) {
10188
10438
  const body = args[0];
10189
- return suspend$3(() => fromIteratorUnsafe(body()));
10439
+ return suspend$4(() => fromIteratorUnsafe(body()));
10190
10440
  }
10191
10441
  const [options, body] = args;
10192
- return suspend$3(() => fromIteratorUnsafe(body.call(options.self)));
10442
+ return suspend$4(() => fromIteratorUnsafe(body.call(options.self)));
10193
10443
  };
10194
10444
  const fnBody = (bodyOrOptions, pipeables) => typeof bodyOrOptions === "function" ? bodyOrOptions : pipeables.shift().bind(bodyOrOptions.self);
10195
10445
  /** @internal */
10196
10446
  const fnUntraced$1 = (bodyOrOptions, ...pipeables) => {
10197
10447
  const body = fnBody(bodyOrOptions, pipeables);
10198
10448
  const fn = pipeables.length === 0 ? function() {
10199
- return suspend$3(() => fromIteratorUnsafe(body.apply(this, arguments)));
10449
+ return suspend$4(() => fromIteratorUnsafe(body.apply(this, arguments)));
10200
10450
  } : function() {
10201
- let effect = suspend$3(() => fromIteratorUnsafe(body.apply(this, arguments)));
10451
+ let effect = suspend$4(() => fromIteratorUnsafe(body.apply(this, arguments)));
10202
10452
  for (let i = 0; i < pipeables.length; i++) effect = pipeables[i](effect, ...arguments);
10203
10453
  return effect;
10204
10454
  };
@@ -10238,7 +10488,7 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions)
10238
10488
  }
10239
10489
  });
10240
10490
  return defineFunctionLength(body.length, function(...args) {
10241
- let result = suspend$3(() => {
10491
+ let result = suspend$4(() => {
10242
10492
  const iter = body.apply(this, arguments);
10243
10493
  return isEffect$1(iter) ? iter : fromIteratorUnsafe(iter);
10244
10494
  });
@@ -10279,11 +10529,11 @@ const fromIteratorEagerUnsafe = (evaluate) => {
10279
10529
  } else if (primitive && primitive._tag === "Failure") return state.value;
10280
10530
  else {
10281
10531
  let isFirstExecution = true;
10282
- return suspend$3(() => {
10532
+ return suspend$4(() => {
10283
10533
  if (isFirstExecution) {
10284
10534
  isFirstExecution = false;
10285
10535
  return flatMap$4(state.value, (value) => fromIteratorUnsafe(iterator, value));
10286
- } else return suspend$3(() => fromIteratorUnsafe(evaluate()));
10536
+ } else return suspend$4(() => fromIteratorUnsafe(evaluate()));
10287
10537
  });
10288
10538
  }
10289
10539
  }
@@ -10381,7 +10631,7 @@ const raceAll = (all, options) => withFiber$1((parent) => {
10381
10631
  const fibers = /* @__PURE__ */ new Set();
10382
10632
  onExitUnsafe(parent, () => fibers.size === 0 ? void 0 : fiberInterruptAll(fibers));
10383
10633
  return callback$2((resume) => {
10384
- const effects = fromIterable$7(all);
10634
+ const effects = fromIterable$8(all);
10385
10635
  const len = effects.length;
10386
10636
  let doneCount = 0;
10387
10637
  let done = false;
@@ -10527,7 +10777,7 @@ const updateService = /*#__PURE__*/ dual(3, (self, service, f) => updateContext$
10527
10777
  const prev = getUnsafe$1(s, service);
10528
10778
  const next = f(prev);
10529
10779
  if (prev === next) return s;
10530
- return add$1(s, service, next);
10780
+ return add$2(s, service, next);
10531
10781
  }));
10532
10782
  /** @internal */
10533
10783
  const context$1 = () => getContext;
@@ -10544,7 +10794,7 @@ const provideService$1 = function() {
10544
10794
  if (arguments.length === 1) return dual(2, (self, impl) => provideServiceImpl(self, arguments[0], impl));
10545
10795
  return dual(3, (self, service, impl) => provideServiceImpl(self, service, impl)).apply(this, arguments);
10546
10796
  };
10547
- const provideServiceImpl = (self, service, implementation) => updateContext$1(self, add$1(service, implementation));
10797
+ const provideServiceImpl = (self, service, implementation) => updateContext$1(self, add$2(service, implementation));
10548
10798
  /** @internal */
10549
10799
  const zipWith$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[1]), (self, that, f, options) => options?.concurrent ? map$7(all$2([self, that], { concurrency: 2 }), ([a, a2]) => f(a, a2)) : flatMap$4(self, (a) => map$7(that, (a2) => f(a, a2))));
10550
10800
  /** @internal */
@@ -10825,7 +11075,7 @@ const scopeForkUnsafe = (scope, finalizerStrategy) => {
10825
11075
  };
10826
11076
  /** @internal */
10827
11077
  const scopeAddFinalizerExit = (scope, finalizer) => {
10828
- return suspend$3(() => {
11078
+ return suspend$4(() => {
10829
11079
  if (scope.state._tag === "Closed") return finalizer(scope.state.exit);
10830
11080
  scopeAddFinalizerUnsafe(scope, {}, finalizer);
10831
11081
  return void_$3;
@@ -10881,7 +11131,7 @@ const provideScope = /*#__PURE__*/ provideService$1(scopeTag);
10881
11131
  const scoped$1 = (self) => withFiber$1((fiber) => {
10882
11132
  const prev = fiber.context;
10883
11133
  const scope = scopeMakeUnsafe();
10884
- fiber.setContext(add$1(fiber.context, scopeTag, scope));
11134
+ fiber.setContext(add$2(fiber.context, scopeTag, scope));
10885
11135
  onExitUnsafe(fiber, (exit) => {
10886
11136
  fiber.setContext(prev);
10887
11137
  return scopeCloseUnsafe(scope, exit);
@@ -10889,11 +11139,11 @@ const scoped$1 = (self) => withFiber$1((fiber) => {
10889
11139
  return self;
10890
11140
  });
10891
11141
  /** @internal */
10892
- const scopeUse = /*#__PURE__*/ dual(2, (self, scope) => onExit$2(provideScope(self, scope), (exit) => suspend$3(() => scopeCloseUnsafe(scope, exit) ?? void_$3)));
11142
+ const scopeUse = /*#__PURE__*/ dual(2, (self, scope) => onExit$2(provideScope(self, scope), (exit) => suspend$4(() => scopeCloseUnsafe(scope, exit) ?? void_$3)));
10893
11143
  /** @internal */
10894
- const scopedWith$1 = (f) => suspend$3(() => {
11144
+ const scopedWith$1 = (f) => suspend$4(() => {
10895
11145
  const scope = scopeMakeUnsafe();
10896
- return onExit$2(f(scope), (exit) => suspend$3(() => scopeCloseUnsafe(scope, exit) ?? void_$3));
11146
+ return onExit$2(f(scope), (exit) => suspend$4(() => scopeCloseUnsafe(scope, exit) ?? void_$3));
10897
11147
  });
10898
11148
  /** @internal */
10899
11149
  const acquireRelease$1 = (acquire, release, options) => contextWith$1((context) => uninterruptibleMask$1((restore) => flatMap$4(scope$1, (scope) => tap$2(options?.interruptible ? restore(acquire) : acquire, (a) => scopeAddFinalizerExit(scope, (exit) => provideContext$3(release(a, exit), context))))));
@@ -11075,7 +11325,7 @@ const uninterruptibleMask$1 = (f) => withFiber$1((fiber) => {
11075
11325
  const all$2 = (arg, options) => {
11076
11326
  if (isIterable(arg)) return options?.mode === "result" ? forEach$2(arg, result$2, options) : forEach$2(arg, identity, options);
11077
11327
  else if (options?.discard) return options.mode === "result" ? forEach$2(Object.values(arg), result$2, options) : forEach$2(Object.values(arg), identity, options);
11078
- return suspend$3(() => map$7(forEach$2(Object.entries(arg), ([key, effect]) => map$7(options?.mode === "result" ? result$2(effect) : effect, (value) => [key, value]), { concurrency: options?.concurrency }), Object.fromEntries));
11328
+ return suspend$4(() => map$7(forEach$2(Object.entries(arg), ([key, effect]) => map$7(options?.mode === "result" ? result$2(effect) : effect, (value) => [key, value]), { concurrency: options?.concurrency }), Object.fromEntries));
11079
11329
  };
11080
11330
  /** @internal */
11081
11331
  const whileLoop$1 = /*#__PURE__*/ makePrimitive$1({
@@ -11097,10 +11347,10 @@ const whileLoop$1 = /*#__PURE__*/ makePrimitive$1({
11097
11347
  }
11098
11348
  });
11099
11349
  /** @internal */
11100
- const forEach$2 = /*#__PURE__*/ dual((args) => typeof args[1] === "function", (iterable, f, options) => suspend$3(() => {
11350
+ const forEach$2 = /*#__PURE__*/ dual((args) => typeof args[1] === "function", (iterable, f, options) => suspend$4(() => {
11101
11351
  const concurrency = resolveConcurrency(options?.concurrency);
11102
11352
  if (concurrency === 1) return forEachSequential(iterable, f, options);
11103
- const items = fromIterable$7(iterable);
11353
+ const items = fromIterable$8(iterable);
11104
11354
  let length = items.length;
11105
11355
  if (length === 0) return options?.discard ? void_$3 : succeed$9([]);
11106
11356
  const out = options?.discard ? void 0 : new Array(length);
@@ -11110,7 +11360,7 @@ const forEach$2 = /*#__PURE__*/ dual((args) => typeof args[1] === "function", (i
11110
11360
  }, items, { concurrency });
11111
11361
  return eff ? as$1(eff, out) : succeed$9(out);
11112
11362
  }));
11113
- const forEachSequential = (iterable, f, options) => suspend$3(() => {
11363
+ const forEachSequential = (iterable, f, options) => suspend$4(() => {
11114
11364
  const out = options?.discard ? void 0 : [];
11115
11365
  const iterator = iterable[Symbol.iterator]();
11116
11366
  let state = iterator.next();
@@ -11181,7 +11431,7 @@ const iterateConcurrentImpl = (options) => {
11181
11431
  return cb(failDefect(error));
11182
11432
  }
11183
11433
  if (result) return cb(result);
11184
- return suspend$3(() => {
11434
+ return suspend$4(() => {
11185
11435
  terminal ??= exitVoid;
11186
11436
  return flatMap$4(fibers ? fiberInterruptAll(fibers) : void_$3, () => terminal?._tag === "Failure" ? terminal : void_$3);
11187
11437
  });
@@ -11300,7 +11550,7 @@ const forkIn$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, scope,
11300
11550
  const forkScoped$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, options) => flatMap$4(scope$1, (scope) => forkIn$1(self, scope, options)));
11301
11551
  /** @internal */
11302
11552
  const runForkWith$1 = (context) => (effect, options) => {
11303
- const fiber = new FiberImpl(options?.scheduler ? add$1(context, Scheduler, options.scheduler) : context, options?.uninterruptible !== true);
11553
+ const fiber = new FiberImpl(options?.scheduler ? add$2(context, Scheduler, options.scheduler) : context, options?.uninterruptible !== true);
11304
11554
  fiber.evaluate(effect);
11305
11555
  if (fiber._exit) return fiber;
11306
11556
  if (options?.signal) {
@@ -11327,7 +11577,7 @@ const fiberRunIn = /*#__PURE__*/ dual(2, (self, scope) => {
11327
11577
  return self;
11328
11578
  });
11329
11579
  /** @internal */
11330
- const runFork$1 = /*#__PURE__*/ runForkWith$1(/*#__PURE__*/ empty$14());
11580
+ const runFork$1 = /*#__PURE__*/ runForkWith$1(/*#__PURE__*/ empty$15());
11331
11581
  /** @internal */
11332
11582
  const runPromiseExitWith = (context) => {
11333
11583
  const runFork = runForkWith$1(context);
@@ -11347,7 +11597,7 @@ const runPromiseWith = (context) => {
11347
11597
  });
11348
11598
  };
11349
11599
  /** @internal */
11350
- const runPromise$1 = /*#__PURE__*/ runPromiseWith(/*#__PURE__*/ empty$14());
11600
+ const runPromise$1 = /*#__PURE__*/ runPromiseWith(/*#__PURE__*/ empty$15());
11351
11601
  /** @internal */
11352
11602
  const runSyncExitWith = (context) => {
11353
11603
  const runFork = runForkWith$1(context);
@@ -11360,7 +11610,7 @@ const runSyncExitWith = (context) => {
11360
11610
  };
11361
11611
  };
11362
11612
  /** @internal */
11363
- const runSyncExit$1 = /*#__PURE__*/ runSyncExitWith(/*#__PURE__*/ empty$14());
11613
+ const runSyncExit$1 = /*#__PURE__*/ runSyncExitWith(/*#__PURE__*/ empty$15());
11364
11614
  /** @internal */
11365
11615
  const runSyncWith = (context) => {
11366
11616
  const runSyncExit = runSyncExitWith(context);
@@ -11371,7 +11621,7 @@ const runSyncWith = (context) => {
11371
11621
  };
11372
11622
  };
11373
11623
  /** @internal */
11374
- const runSync$2 = /*#__PURE__*/ runSyncWith(/*#__PURE__*/ empty$14());
11624
+ const runSync$2 = /*#__PURE__*/ runSyncWith(/*#__PURE__*/ empty$15());
11375
11625
  const succeedTrue = /*#__PURE__*/ succeed$9(true);
11376
11626
  const succeedFalse = /*#__PURE__*/ succeed$9(false);
11377
11627
  var Latch = class {
@@ -11477,7 +11727,7 @@ const makeSpanUnsafe = (fiber, name, options) => {
11477
11727
  if (disablePropagation) span = noopSpan({
11478
11728
  name,
11479
11729
  parent,
11480
- annotations: add$1(options?.annotations ?? empty$14(), DisablePropagation, true)
11730
+ annotations: add$2(options?.annotations ?? empty$15(), DisablePropagation, true)
11481
11731
  });
11482
11732
  else {
11483
11733
  const tracer = fiber.cache.tracer ?? nativeTracer;
@@ -11490,7 +11740,7 @@ const makeSpanUnsafe = (fiber, name, options) => {
11490
11740
  span = tracer.span({
11491
11741
  name,
11492
11742
  parent,
11493
- annotations: options?.annotations ?? empty$14(),
11743
+ annotations: options?.annotations ?? empty$15(),
11494
11744
  links,
11495
11745
  startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : bigint0$2,
11496
11746
  kind: options?.kind ?? "internal",
@@ -11572,11 +11822,6 @@ const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
11572
11822
  return void_$3;
11573
11823
  });
11574
11824
  /** @internal */
11575
- const currentSpan$1 = /*#__PURE__*/ withFiber$1((fiber) => {
11576
- const span = fiber.currentSpanLocal;
11577
- return span ? succeed$9(span) : fail$11(new NoSuchElementError());
11578
- });
11579
- /** @internal */
11580
11825
  const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
11581
11826
  const MAX_TIMER_MILLIS = 2 ** 31 - 1;
11582
11827
  var ClockImpl = class {
@@ -12974,7 +13219,7 @@ const hasInterrupts = exitHasInterrupts;
12974
13219
  */
12975
13220
  const asVoidAll = exitAsVoidAll;
12976
13221
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Deferred.js
12977
- const TypeId$65 = "~effect/Deferred";
13222
+ const TypeId$66 = "~effect/Deferred";
12978
13223
  /**
12979
13224
  * Checks whether a value is a `Deferred`.
12980
13225
  *
@@ -12987,9 +13232,9 @@ const TypeId$65 = "~effect/Deferred";
12987
13232
  * @category guards
12988
13233
  * @since 4.0.0
12989
13234
  */
12990
- const isDeferred = (u) => hasProperty(u, TypeId$65);
13235
+ const isDeferred = (u) => hasProperty(u, TypeId$66);
12991
13236
  const DeferredProto = {
12992
- [TypeId$65]: {
13237
+ [TypeId$66]: {
12993
13238
  _A: identity,
12994
13239
  _E: identity
12995
13240
  },
@@ -13965,14 +14210,14 @@ const closeUnsafe = scopeCloseUnsafe;
13965
14210
  */
13966
14211
  const use$1 = scopeUse;
13967
14212
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Layer.js
13968
- const TypeId$64 = "~effect/Layer";
14213
+ const TypeId$65 = "~effect/Layer";
13969
14214
  const MemoMapTypeId = "~effect/Layer/MemoMap";
13970
14215
  const makeMemoMapEntry = (memoMap, layer) => {
13971
14216
  const entry = {
13972
14217
  observers: 0,
13973
14218
  deferred: makeUnsafe$8(),
13974
14219
  scope: makeUnsafe$7(),
13975
- finalizer: (exit) => suspend$3(() => {
14220
+ finalizer: (exit) => suspend$4(() => {
13976
14221
  if (--entry.observers > 0) return void_$3;
13977
14222
  memoMap.map.delete(layer);
13978
14223
  return close(entry.scope, exit);
@@ -13987,7 +14232,7 @@ const memoMapObserve = (entry, scope) => {
13987
14232
  return true;
13988
14233
  };
13989
14234
  const LayerProto = {
13990
- [TypeId$64]: {
14235
+ [TypeId$65]: {
13991
14236
  _ROut: identity,
13992
14237
  _E: identity,
13993
14238
  _RIn: identity
@@ -14095,9 +14340,9 @@ var MemoMapImpl = class {
14095
14340
  return this.parent?.get(layer, scope);
14096
14341
  }
14097
14342
  getOrElseMemoize(layer, scope, build) {
14098
- return suspend$3(() => {
14343
+ return suspend$4(() => {
14099
14344
  let deferred;
14100
- return onExitPrimitive$1(suspend$3(() => {
14345
+ return onExitPrimitive$1(suspend$4(() => {
14101
14346
  const existing = this.get(layer, scope);
14102
14347
  if (existing) return existing;
14103
14348
  const entry = makeMemoMapEntry(this, layer);
@@ -14244,7 +14489,7 @@ var CurrentMemoMap = class CurrentMemoMap extends (/*#__PURE__*/ Service$1()("ef
14244
14489
  * @category destructors
14245
14490
  * @since 2.0.0
14246
14491
  */
14247
- const buildWithMemoMap = /*#__PURE__*/ dual(3, (self, memoMap, scope) => provideService$1(map$7(suspend$3(() => self.build(memoMap, scope)), add$1(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
14492
+ const buildWithMemoMap = /*#__PURE__*/ dual(3, (self, memoMap, scope) => provideService$1(map$7(suspend$4(() => self.build(memoMap, scope)), add$2(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
14248
14493
  /**
14249
14494
  * Builds a layer into a scoped value.
14250
14495
  *
@@ -14366,8 +14611,8 @@ const buildWithScope = /*#__PURE__*/ dual(2, (self, scope) => withFiber$1((fiber
14366
14611
  * @since 2.0.0
14367
14612
  */
14368
14613
  const succeed$6 = function() {
14369
- if (arguments.length === 1) return (resource) => succeedContext(make$80(arguments[0], resource));
14370
- return succeedContext(make$80(arguments[0], arguments[1]));
14614
+ if (arguments.length === 1) return (resource) => succeedContext(make$81(arguments[0], resource));
14615
+ return succeedContext(make$81(arguments[0], arguments[1]));
14371
14616
  };
14372
14617
  /**
14373
14618
  * Constructs a layer that provides all services in an already available
@@ -14442,7 +14687,7 @@ const succeedContext = (context) => fromBuildUnsafe(constant(succeed$9(context))
14442
14687
  * @category constructors
14443
14688
  * @since 2.0.0
14444
14689
  */
14445
- const empty$10 = /*#__PURE__*/ succeedContext(/*#__PURE__*/ empty$14());
14690
+ const empty$11 = /*#__PURE__*/ succeedContext(/*#__PURE__*/ empty$15());
14446
14691
  /**
14447
14692
  * Constructs a layer lazily that provides a single service.
14448
14693
  *
@@ -14479,8 +14724,8 @@ const empty$10 = /*#__PURE__*/ succeedContext(/*#__PURE__*/ empty$14());
14479
14724
  * @since 2.0.0
14480
14725
  */
14481
14726
  const sync$1 = function() {
14482
- if (arguments.length === 1) return (evaluate) => syncContext(() => make$80(arguments[0], evaluate()));
14483
- return syncContext(() => make$80(arguments[0], arguments[1]()));
14727
+ if (arguments.length === 1) return (evaluate) => syncContext(() => make$81(arguments[0], evaluate()));
14728
+ return syncContext(() => make$81(arguments[0], arguments[1]()));
14484
14729
  };
14485
14730
  /**
14486
14731
  * Constructs a layer lazily that provides all services in a `Context`.
@@ -14564,7 +14809,7 @@ const effect = function() {
14564
14809
  if (arguments.length === 1) return (effect) => effectImpl(arguments[0], effect);
14565
14810
  return effectImpl(arguments[0], arguments[1]);
14566
14811
  };
14567
- const effectImpl = (service, effect) => effectContext(map$7(effect, (value) => make$80(service, value)));
14812
+ const effectImpl = (service, effect) => effectContext(map$7(effect, (value) => make$81(service, value)));
14568
14813
  /**
14569
14814
  * Constructs a layer from an effect that produces all services in a `Context`.
14570
14815
  *
@@ -14635,7 +14880,7 @@ const effectContext = (effect) => fromBuildMemo((_, scope) => provide$3(effect,
14635
14880
  * @category constructors
14636
14881
  * @since 2.0.0
14637
14882
  */
14638
- const effectDiscard = (effect) => effectContext(as$1(effect, empty$14()));
14883
+ const effectDiscard = (effect) => effectContext(as$1(effect, empty$15()));
14639
14884
  const unwrapKey = /*#__PURE__*/ Service$1("effect/Layer/unwrap");
14640
14885
  /**
14641
14886
  * Unwraps a `Layer` from an `Effect`, flattening the nested structure.
@@ -15248,11 +15493,11 @@ const currentTimeMillis = currentTimeMillis$1;
15248
15493
  const currentTimeNanos = currentTimeNanos$1;
15249
15494
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/dateTime.js
15250
15495
  /** @internal */
15251
- const TypeId$63 = "~effect/DateTime";
15496
+ const TypeId$64 = "~effect/DateTime";
15252
15497
  /** @internal */
15253
15498
  const TimeZoneTypeId = "~effect/DateTime/TimeZone";
15254
15499
  const Proto$21 = {
15255
- [TypeId$63]: TypeId$63,
15500
+ [TypeId$64]: TypeId$64,
15256
15501
  pipe() {
15257
15502
  return pipeArguments(this, arguments);
15258
15503
  },
@@ -15280,7 +15525,7 @@ const ProtoZoned = {
15280
15525
  ...Proto$21,
15281
15526
  _tag: "Zoned",
15282
15527
  [symbol$3]() {
15283
- return combine$2(number$2(this.epochMilliseconds))(hash(this.zone));
15528
+ return combine$3(number$2(this.epochMilliseconds))(hash(this.zone));
15284
15529
  },
15285
15530
  [symbol$2](that) {
15286
15531
  return isDateTime$1(that) && that._tag === "Zoned" && this.epochMilliseconds === that.epochMilliseconds && equals$2(this.zone, that.zone);
@@ -15379,7 +15624,7 @@ const makeZonedProto = (epochMillis, zone, partsUtc) => {
15379
15624
  return self;
15380
15625
  };
15381
15626
  /** @internal */
15382
- const isDateTime$1 = (u) => hasProperty(u, TypeId$63);
15627
+ const isDateTime$1 = (u) => hasProperty(u, TypeId$64);
15383
15628
  /** @internal */
15384
15629
  const isTimeZone = (u) => hasProperty(u, TimeZoneTypeId);
15385
15630
  /** @internal */
@@ -16359,7 +16604,7 @@ const matchEffect$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$
16359
16604
  }
16360
16605
  }));
16361
16606
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Schedule.js
16362
- const TypeId$62 = "~effect/Schedule";
16607
+ const TypeId$63 = "~effect/Schedule";
16363
16608
  /**
16364
16609
  * Context reference containing metadata for the currently running schedule step.
16365
16610
  *
@@ -16385,7 +16630,7 @@ const CurrentMetadata = /*#__PURE__*/ Reference("effect/Schedule/CurrentMetadata
16385
16630
  elapsedSincePrevious: 0
16386
16631
  }) });
16387
16632
  const ScheduleProto = {
16388
- [TypeId$62]: {
16633
+ [TypeId$63]: {
16389
16634
  _Out: identity,
16390
16635
  _In: identity,
16391
16636
  _Env: identity
@@ -16415,7 +16660,7 @@ const ScheduleProto = {
16415
16660
  * @category guards
16416
16661
  * @since 2.0.0
16417
16662
  */
16418
- const isSchedule = (u) => hasProperty(u, TypeId$62);
16663
+ const isSchedule = (u) => hasProperty(u, TypeId$63);
16419
16664
  /**
16420
16665
  * Creates a Schedule from a step function that returns a Pull.
16421
16666
  *
@@ -16560,7 +16805,7 @@ const toStep = (schedule) => catchCause$4(schedule.step, (cause) => succeed$9(()
16560
16805
  */
16561
16806
  const toStepWithMetadata = (schedule) => clockWith$1((clock) => map$7(toStep(schedule), (step) => {
16562
16807
  const metaFn = metadataFn();
16563
- return (input) => suspend$3(() => {
16808
+ return (input) => suspend$4(() => {
16564
16809
  const now = clock.currentTimeMillisUnsafe();
16565
16810
  return flatMap$4(step(now, input), ([output, duration]) => {
16566
16811
  const meta = metaFn(now, input);
@@ -16877,7 +17122,7 @@ const repeatOrElse = /*#__PURE__*/ dual(3, (self, schedule, orElse) => flatMap$4
16877
17122
  const retryOrElse$1 = /*#__PURE__*/ dual(3, (self, policy, orElse) => flatMap$4(toStepWithMetadata(policy), (step) => {
16878
17123
  let meta = CurrentMetadata.defaultValue();
16879
17124
  let lastError;
16880
- const loop = catchCauseFilter$1(suspend$3(() => provideService$1(self, CurrentMetadata, meta)), findRecoverableError, (error) => {
17125
+ const loop = catchCauseFilter$1(suspend$4(() => provideService$1(self, CurrentMetadata, meta)), findRecoverableError, (error) => {
16881
17126
  lastError = error;
16882
17127
  return flatMap$4(step(error), (meta_) => {
16883
17128
  meta = meta_;
@@ -16921,9 +17166,9 @@ const buildFromOptions = (options) => {
16921
17166
  return schedule;
16922
17167
  };
16923
17168
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/MutableHashMap.js
16924
- const TypeId$61 = "~effect/MutableHashMap";
17169
+ const TypeId$62 = "~effect/MutableHashMap";
16925
17170
  const MutableHashMapProto = {
16926
- [TypeId$61]: TypeId$61,
17171
+ [TypeId$62]: TypeId$62,
16927
17172
  [Symbol.iterator]() {
16928
17173
  return this.backing[Symbol.iterator]();
16929
17174
  },
@@ -16975,7 +17220,7 @@ const MutableHashMapProto = {
16975
17220
  * @category constructors
16976
17221
  * @since 2.0.0
16977
17222
  */
16978
- const empty$9 = () => {
17223
+ const empty$10 = () => {
16979
17224
  const self = Object.create(MutableHashMapProto);
16980
17225
  self.backing = /* @__PURE__ */ new Map();
16981
17226
  self.buckets = /* @__PURE__ */ new Map();
@@ -17010,7 +17255,7 @@ const empty$9 = () => {
17010
17255
  * @category constructors
17011
17256
  * @since 2.0.0
17012
17257
  */
17013
- const make$74 = (...entries) => fromIterable$6(entries);
17258
+ const make$74 = (...entries) => fromIterable$7(entries);
17014
17259
  /**
17015
17260
  * Creates a MutableHashMap from an iterable collection of key-value pairs.
17016
17261
  *
@@ -17046,8 +17291,8 @@ const make$74 = (...entries) => fromIterable$6(entries);
17046
17291
  * @category constructors
17047
17292
  * @since 2.0.0
17048
17293
  */
17049
- const fromIterable$6 = (entries) => {
17050
- const self = empty$9();
17294
+ const fromIterable$7 = (entries) => {
17295
+ const self = empty$10();
17051
17296
  for (const [key, value] of entries) set$5(self, key, value);
17052
17297
  return self;
17053
17298
  };
@@ -17101,6 +17346,35 @@ const getFromBucket = (self, bucket, key) => {
17101
17346
  return none();
17102
17347
  };
17103
17348
  /**
17349
+ * Checks whether the MutableHashMap contains the specified key.
17350
+ *
17351
+ * **When to use**
17352
+ *
17353
+ * Use to test whether a key is present in a `MutableHashMap` without reading
17354
+ * its value.
17355
+ *
17356
+ * **Example** (Checking for a key)
17357
+ *
17358
+ * ```ts import.meta.vitest
17359
+ * import { MutableHashMap } from "effect"
17360
+ *
17361
+ * const map = MutableHashMap.make(["key1", 42], ["key2", 100])
17362
+ *
17363
+ * MutableHashMap.has(map, "key1") // => true
17364
+ * MutableHashMap.has(map, "key3") // => false
17365
+ *
17366
+ * // Pipe-able version
17367
+ * MutableHashMap.has("key1")(map) // => true
17368
+ * ```
17369
+ *
17370
+ * @see {@link get} for reading the value as an `Option`
17371
+ *
17372
+ * @stability stable
17373
+ * @category predicates
17374
+ * @since 2.0.0
17375
+ */
17376
+ const has$4 = /*#__PURE__*/ dual(2, (self, key) => isSome(get$9(self, key)));
17377
+ /**
17104
17378
  * Sets a key-value pair in the MutableHashMap, mutating the map in place.
17105
17379
  * If the key already exists, its value is updated.
17106
17380
  *
@@ -17808,7 +18082,7 @@ const succeedSome = succeedSome$1;
17808
18082
  * @category constructors
17809
18083
  * @since 2.0.0
17810
18084
  */
17811
- const suspend$2 = suspend$3;
18085
+ const suspend$3 = suspend$4;
17812
18086
  /**
17813
18087
  * Creates an `Effect` that represents a synchronous side-effectful computation.
17814
18088
  *
@@ -21193,33 +21467,6 @@ const withTracerEnabled = withTracerEnabled$1;
21193
21467
  */
21194
21468
  const annotateCurrentSpan = annotateCurrentSpan$1;
21195
21469
  /**
21196
- * Returns the currently active local tracing span.
21197
- *
21198
- * **Details**
21199
- *
21200
- * The effect fails with `NoSuchElementError` when there is no active local
21201
- * `Span`.
21202
- *
21203
- * **Example** (Reading the current span)
21204
- *
21205
- * ```ts import.meta.vitest
21206
- * import { Effect } from "effect"
21207
- *
21208
- * const program = Effect.gen(function*() {
21209
- * const span = yield* Effect.currentSpan
21210
- * return span.name
21211
- * })
21212
- *
21213
- * const traced = Effect.withSpan(program, "my-span")
21214
- * Effect.runSync(traced) // => "my-span"
21215
- * ```
21216
- *
21217
- * @stability stable
21218
- * @category tracing
21219
- * @since 2.0.0
21220
- */
21221
- const currentSpan = currentSpan$1;
21222
- /**
21223
21470
  * Create a new span for tracing, and automatically close it when the Scope
21224
21471
  * finalizes.
21225
21472
  *
@@ -22185,7 +22432,7 @@ const effectify = (fn, onError, onSyncError) => (...args) => callback$1((resume)
22185
22432
  let pending;
22186
22433
  try {
22187
22434
  fn(...args, (err, result) => {
22188
- const effect = err ? onError ? suspend$2(() => fail$7(onError(err, args))) : fail$7(err) : succeed$5(result);
22435
+ const effect = err ? onError ? suspend$3(() => fail$7(onError(err, args))) : fail$7(err) : succeed$5(result);
22189
22436
  if (synchronous) pending ??= effect;
22190
22437
  else resume(effect);
22191
22438
  });
@@ -23064,7 +23311,7 @@ const remove$2 = (self, value) => filter(self, (v) => v !== value);
23064
23311
  * @stability stable
23065
23312
  * @since 3.8.0
23066
23313
  */
23067
- const TypeId$60 = "~effect/Queue";
23314
+ const TypeId$61 = "~effect/Queue";
23068
23315
  const EnqueueTypeId = "~effect/Queue/Enqueue";
23069
23316
  const DequeueTypeId = "~effect/Queue/Dequeue";
23070
23317
  const variance$1 = {
@@ -23072,7 +23319,7 @@ const variance$1 = {
23072
23319
  _E: identity
23073
23320
  };
23074
23321
  const QueueProto = {
23075
- [TypeId$60]: variance$1,
23322
+ [TypeId$61]: variance$1,
23076
23323
  [EnqueueTypeId]: variance$1,
23077
23324
  [DequeueTypeId]: variance$1,
23078
23325
  ...PipeInspectableProto,
@@ -23286,7 +23533,7 @@ const dropping$1 = (capacity) => make$72({
23286
23533
  * @category offering
23287
23534
  * @since 2.0.0
23288
23535
  */
23289
- const offer = /*#__PURE__*/ dual(2, (self, message) => suspend$3(() => offerUnsafe(self, message) ? exitTrue : self.state._tag === "Open" && self.strategy === "suspend" ? offerOrWait(self, message) : exitFalse));
23536
+ const offer = /*#__PURE__*/ dual(2, (self, message) => suspend$4(() => offerUnsafe(self, message) ? exitTrue : self.state._tag === "Open" && self.strategy === "suspend" ? offerOrWait(self, message) : exitFalse));
23290
23537
  /**
23291
23538
  * Adds a message to the queue synchronously. Returns `false` without adding the
23292
23539
  * message if the queue is closing or done, or if it is full with a non-sliding
@@ -23429,7 +23676,7 @@ const offerAll = /*#__PURE__*/ dual(2, (self, messages) => callback$2((resume) =
23429
23676
  * @since 4.0.0
23430
23677
  */
23431
23678
  const offerAllUnsafe = (self, messages) => {
23432
- if (self.state._tag !== "Open") return fromIterable$7(messages);
23679
+ if (self.state._tag !== "Open") return fromIterable$8(messages);
23433
23680
  else if (self.capacity === Number.POSITIVE_INFINITY || self.strategy === "sliding") {
23434
23681
  appendAll(self.messages, messages);
23435
23682
  if (self.strategy === "sliding") takeN(self.messages, self.messages.length - self.capacity);
@@ -23437,7 +23684,7 @@ const offerAllUnsafe = (self, messages) => {
23437
23684
  return [];
23438
23685
  }
23439
23686
  const free = self.capacity <= 0 ? self.state.takers.size : self.capacity - self.messages.length;
23440
- if (free === 0) return fromIterable$7(messages);
23687
+ if (free === 0) return fromIterable$8(messages);
23441
23688
  const remaining = [];
23442
23689
  let i = 0;
23443
23690
  for (const message of messages) {
@@ -23756,8 +24003,8 @@ const takeAll = (self) => takeBetween(self, 1, Number.POSITIVE_INFINITY);
23756
24003
  * @category taking
23757
24004
  * @since 4.0.0
23758
24005
  */
23759
- const collect$1 = (self) => suspend$3(() => {
23760
- const out = empty$11();
24006
+ const collect$1 = (self) => suspend$4(() => {
24007
+ const out = empty$12();
23761
24008
  return as$1(catchDone(whileLoop$1({
23762
24009
  while: constTrue,
23763
24010
  body: constant(takeAll(self)),
@@ -24553,7 +24800,7 @@ var SemaphoreImpl = class {
24553
24800
  return uninterruptibleMask$1((restore) => flatMap$4(scope$1, (scope) => takePermits(this, n, () => scopeAddFinalizer(scope, this.release(n)), restore)));
24554
24801
  }
24555
24802
  takeIfAvailable(n) {
24556
- return suspend$3(() => {
24803
+ return suspend$4(() => {
24557
24804
  if (this.free < n) return succeed$9(false);
24558
24805
  this.taken += n;
24559
24806
  return succeed$9(true);
@@ -24675,12 +24922,12 @@ const withPermit = (self, effect) => {
24675
24922
  * @stability stable
24676
24923
  * @since 2.0.0
24677
24924
  */
24678
- const TypeId$59 = "~effect/BigDecimal";
24925
+ const TypeId$60 = "~effect/BigDecimal";
24679
24926
  const BigDecimalProto = {
24680
- [TypeId$59]: TypeId$59,
24927
+ [TypeId$60]: TypeId$60,
24681
24928
  [symbol$3]() {
24682
24929
  const normalized = normalize$1(this);
24683
- return combine$2(string$2(String(normalized.value)), number$2(normalized.scale));
24930
+ return combine$3(string$2(String(normalized.value)), number$2(normalized.scale));
24684
24931
  },
24685
24932
  [symbol$2](that) {
24686
24933
  return isBigDecimal(that) && compare(this, that) === 0;
@@ -24725,7 +24972,7 @@ const BigDecimalProto = {
24725
24972
  * @category guards
24726
24973
  * @since 2.0.0
24727
24974
  */
24728
- const isBigDecimal = (u) => hasProperty(u, TypeId$59);
24975
+ const isBigDecimal = (u) => hasProperty(u, TypeId$60);
24729
24976
  /**
24730
24977
  * Creates a `BigDecimal` from a `bigint` value and a safe integer scale.
24731
24978
  *
@@ -25308,7 +25555,7 @@ const unitConstructor = (symbol) => (value) => fromQuantity(value, unitsBySymbol
25308
25555
  */
25309
25556
  const mebibytes = /*#__PURE__*/ unitConstructor("MiB");
25310
25557
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Chunk.js
25311
- const TypeId$58 = "~effect/Chunk";
25558
+ const TypeId$59 = "~effect/Chunk";
25312
25559
  function copy$2(src, srcPos, dest, destPos, len) {
25313
25560
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) dest[destPos + i - srcPos] = src[i];
25314
25561
  return dest;
@@ -25336,7 +25583,7 @@ const emptyArray = [];
25336
25583
  * @category instances
25337
25584
  * @since 4.0.0
25338
25585
  */
25339
- const makeEquivalence$1 = (isEquivalent) => make$82((self, that) => {
25586
+ const makeEquivalence$1 = (isEquivalent) => make$83((self, that) => {
25340
25587
  if (self.length !== that.length) return false;
25341
25588
  const as = toReadonlyArray(self);
25342
25589
  const bs = toReadonlyArray(that);
@@ -25345,7 +25592,7 @@ const makeEquivalence$1 = (isEquivalent) => make$82((self, that) => {
25345
25592
  });
25346
25593
  const _equivalence = /*#__PURE__*/ makeEquivalence$1(equals$2);
25347
25594
  const ChunkProto = {
25348
- [TypeId$58]: { _A: (_) => _ },
25595
+ [TypeId$59]: { _A: (_) => _ },
25349
25596
  toString() {
25350
25597
  return `Chunk(${format$2(toReadonlyArray(this))})`;
25351
25598
  },
@@ -25431,7 +25678,7 @@ const makeChunk = (backing) => {
25431
25678
  * @category guards
25432
25679
  * @since 2.0.0
25433
25680
  */
25434
- const isChunk = (u) => hasProperty(u, TypeId$58);
25681
+ const isChunk = (u) => hasProperty(u, TypeId$59);
25435
25682
  const _empty = /*#__PURE__*/ makeChunk({ _tag: "IEmpty" });
25436
25683
  const copyToArray = (self, array, initial) => {
25437
25684
  switch (self.backing._tag) {
@@ -25512,7 +25759,7 @@ const toReadonlyArray = toReadonlyArray_;
25512
25759
  * @stability unstable
25513
25760
  * @since 4.0.0
25514
25761
  */
25515
- const TypeId$57 = "~effect/crypto/CryptoError";
25762
+ const TypeId$58 = "~effect/crypto/CryptoError";
25516
25763
  const ReasonTypeId$2 = "~effect/crypto/CryptoError/Reason";
25517
25764
  /**
25518
25765
  * Reason for an argument that the operation rejects before using the key or
@@ -25665,7 +25912,7 @@ var CryptoError = class extends (/*#__PURE__*/ TaggedError$1("CryptoError")) {
25665
25912
  *
25666
25913
  * @since 4.0.0
25667
25914
  */
25668
- [TypeId$57] = TypeId$57;
25915
+ [TypeId$58] = TypeId$58;
25669
25916
  /**
25670
25917
  * The reason's cause, when it has one.
25671
25918
  *
@@ -26448,7 +26695,7 @@ const reasonFor = (method, provider, algorithm, cause, onOperationError) => {
26448
26695
  *
26449
26696
  * @internal
26450
26697
  */
26451
- const run$6 = (module, method, algorithm, crypto, f, onError = (cause) => webCryptoError(module, method, algorithm, cause)) => suspend$2(() => {
26698
+ const run$6 = (module, method, algorithm, crypto, f, onError = (cause) => webCryptoError(module, method, algorithm, cause)) => suspend$3(() => {
26452
26699
  const subtle = crypto?.subtle;
26453
26700
  if (subtle === void 0) return die$2(subtleUnavailable());
26454
26701
  return tryPromise({
@@ -26534,7 +26781,7 @@ const checkKeyLength = (algorithm) => (bytes) => bytes.length === algorithm.keyL
26534
26781
  *
26535
26782
  * @internal
26536
26783
  */
26537
- const fromBytes = (module, method, proto, algorithm, bytes, check) => suspend$2(() => {
26784
+ const fromBytes = (module, method, proto, algorithm, bytes, check) => suspend$3(() => {
26538
26785
  if (!(bytes instanceof Uint8Array)) return invalidKey$2(module, method, "Expected the key as a Uint8Array");
26539
26786
  const problem = check(bytes);
26540
26787
  return problem === void 0 ? succeed$5(makeBytes(proto, algorithm, copyBytes(bytes))) : invalidKey$2(module, method, problem);
@@ -26579,7 +26826,7 @@ const importedAlgorithm = (algorithm, cryptoKey) => {
26579
26826
  *
26580
26827
  * @internal
26581
26828
  */
26582
- const fromCryptoKey$3 = (module, method, proto, algorithm, cryptoKey, expected) => suspend$2(() => {
26829
+ const fromCryptoKey$3 = (module, method, proto, algorithm, cryptoKey, expected) => suspend$3(() => {
26583
26830
  const problem = checkCryptoKey(cryptoKey, expected);
26584
26831
  return problem === void 0 ? succeed$5(make$67(proto, importedAlgorithm(algorithm, cryptoKey), {
26585
26832
  _tag: "CryptoKey",
@@ -26594,7 +26841,7 @@ const exportRaw = async (subtle, cryptoKey) => new Uint8Array(await subtle.expor
26594
26841
  *
26595
26842
  * @internal
26596
26843
  */
26597
- const toBytes$5 = (module, key, exportKey) => suspend$2(() => {
26844
+ const toBytes$5 = (module, key, exportKey) => suspend$3(() => {
26598
26845
  const stored = material(key);
26599
26846
  if (stored._tag === "Bytes") return succeed$5(copyBytes(stored.bytes));
26600
26847
  if (!stored.cryptoKey.extractable) return notExtractable(module, "toBytes");
@@ -26661,7 +26908,7 @@ var Aead_exports = /* @__PURE__ */ __exportAll({
26661
26908
  toBytes: () => toBytes$4,
26662
26909
  xchacha20Poly1305: () => xchacha20Poly1305
26663
26910
  });
26664
- const TypeId$56 = "~effect/crypto/Aead/Key";
26911
+ const TypeId$57 = "~effect/crypto/Aead/Key";
26665
26912
  /**
26666
26913
  * AES-128-GCM, with a 16-byte key and a 12-byte nonce.
26667
26914
  *
@@ -26730,7 +26977,7 @@ const xchacha20Poly1305 = {
26730
26977
  nonceLength: 24,
26731
26978
  implementation: /* @__PURE__ */ chachaImplementation(xchacha20Poly1305$1)
26732
26979
  };
26733
- const KeyProto$3 = /*#__PURE__*/ redactedProto(TypeId$56, "Aead.Key");
26980
+ const KeyProto$3 = /*#__PURE__*/ redactedProto(TypeId$57, "Aead.Key");
26734
26981
  /**
26735
26982
  * Checks whether a value is a {@link Key}.
26736
26983
  *
@@ -26738,7 +26985,7 @@ const KeyProto$3 = /*#__PURE__*/ redactedProto(TypeId$56, "Aead.Key");
26738
26985
  * @category guards
26739
26986
  * @since 4.0.0
26740
26987
  */
26741
- const isKey$3 = (u) => hasProperty(u, TypeId$56);
26988
+ const isKey$3 = (u) => hasProperty(u, TypeId$57);
26742
26989
  /**
26743
26990
  * Service that generates keys, encrypts, and decrypts with authentication.
26744
26991
  *
@@ -26783,7 +27030,7 @@ const runImplementation = (method, implementation, key, data, options) => {
26783
27030
  if (stored._tag !== "Bytes") return fail$5(method, new InvalidKey$1({ description: `${key.algorithm.name} keys must hold bytes` }));
26784
27031
  const aad = options.aad ?? /* @__PURE__ */ new Uint8Array(0);
26785
27032
  if (method === "encrypt") return sync(() => implementation.encrypt(stored.bytes, options.nonce, data, aad));
26786
- return suspend$2(() => {
27033
+ return suspend$3(() => {
26787
27034
  const plaintext = implementation.decrypt(stored.bytes, options.nonce, data, aad);
26788
27035
  return plaintext === void 0 ? decryptionFailed() : succeed$5(plaintext);
26789
27036
  });
@@ -26847,7 +27094,7 @@ const layerWebCryptoWith$1 = (options) => effect(Aead, gen(function* () {
26847
27094
  };
26848
27095
  return run$6("Aead", method, key.algorithm.name, crypto, async (subtle) => new Uint8Array(await subtle[method](params, await cryptoKeyFor(subtle, key), data)), (cause) => webCryptoError("Aead", method, key.algorithm.name, cause, method === "decrypt" ? () => new DecryptionFailed() : void 0));
26849
27096
  };
26850
- const run = (method) => (key, data, options) => suspend$2(() => {
27097
+ const run = (method) => (key, data, options) => suspend$3(() => {
26851
27098
  const failure = checkArguments$1(method, key, data, options);
26852
27099
  if (failure !== void 0) return failure;
26853
27100
  const implementation = implementationFor(key);
@@ -26969,7 +27216,7 @@ var Cipher_exports = /* @__PURE__ */ __exportAll({
26969
27216
  layerWebCrypto: () => layerWebCrypto$5,
26970
27217
  toBytes: () => toBytes$3
26971
27218
  });
26972
- const TypeId$55 = "~effect/crypto/Cipher/Key";
27219
+ const TypeId$56 = "~effect/crypto/Cipher/Key";
26973
27220
  /**
26974
27221
  * AES-128-CTR, with a 16-byte key.
26975
27222
  *
@@ -27028,7 +27275,7 @@ const aes256Cbc = {
27028
27275
  mode: "AES-CBC",
27029
27276
  keyLength: 32
27030
27277
  };
27031
- const KeyProto$2 = /*#__PURE__*/ redactedProto(TypeId$55, "Cipher.Key");
27278
+ const KeyProto$2 = /*#__PURE__*/ redactedProto(TypeId$56, "Cipher.Key");
27032
27279
  /**
27033
27280
  * Checks whether a value is a {@link Key}.
27034
27281
  *
@@ -27036,7 +27283,7 @@ const KeyProto$2 = /*#__PURE__*/ redactedProto(TypeId$55, "Cipher.Key");
27036
27283
  * @category guards
27037
27284
  * @since 4.0.0
27038
27285
  */
27039
- const isKey$2 = (u) => hasProperty(u, TypeId$55);
27286
+ const isKey$2 = (u) => hasProperty(u, TypeId$56);
27040
27287
  /**
27041
27288
  * Service that generates keys, encrypts, and decrypts without
27042
27289
  * authentication.
@@ -27095,7 +27342,7 @@ const layerWebCrypto$5 = /*#__PURE__*/ effect(Cipher, /*#__PURE__*/ gen(function
27095
27342
  const random = yield* SecureRandom;
27096
27343
  const crypto = yield* WebCrypto;
27097
27344
  const cryptoKeyFor = makeCache((subtle, bytes, algorithm) => subtle.importKey("raw", bytes, algorithm.mode, false, ["encrypt", "decrypt"]));
27098
- const run = (method) => (key, data, options) => suspend$2(() => {
27345
+ const run = (method) => (key, data, options) => suspend$3(() => {
27099
27346
  if (options.iv.length !== blockLength) return fail$4(method, new InvalidArgument$1({ description: "IVs must contain exactly 16 bytes" }));
27100
27347
  const cbc = key.algorithm.mode === "AES-CBC";
27101
27348
  if (method === "decrypt" && cbc && (data.length === 0 || data.length % blockLength !== 0)) return fail$4(method, new DecryptionFailed());
@@ -27278,7 +27525,7 @@ const generateKeyPair = (family, crypto, random, algorithm, params) => {
27278
27525
  *
27279
27526
  * @internal
27280
27527
  */
27281
- const publicKeyOf = (family, crypto, privateKey) => suspend$2(() => {
27528
+ const publicKeyOf = (family, crypto, privateKey) => suspend$3(() => {
27282
27529
  const stored = material(privateKey);
27283
27530
  if (stored._tag === "CryptoKey" && !stored.cryptoKey.extractable) return notExtractable(family.module, "publicKeyOf");
27284
27531
  const spec = family.specOf(privateKey.algorithm);
@@ -27431,7 +27678,7 @@ const layerWebCrypto$4 = /*#__PURE__*/ effect(KeyAgreement, /*#__PURE__*/ gen(fu
27431
27678
  const caches = makeCaches(family$2);
27432
27679
  return KeyAgreement.of({
27433
27680
  generateKeyPair: (algorithm) => generateKeyPair(family$2, crypto, random, algorithm, specOf$2(algorithm).importParams),
27434
- deriveSharedSecret: (privateKey, publicKey) => suspend$2(() => {
27681
+ deriveSharedSecret: (privateKey, publicKey) => suspend$3(() => {
27435
27682
  const algorithm = privateKey.algorithm;
27436
27683
  if (algorithm.name !== publicKey.algorithm.name) return fail$7(invalidPeer(`Expected a ${algorithm.name} public key, not ${publicKey.algorithm.name}`));
27437
27684
  const onError = (cause) => publicKeyError("KeyAgreement", "deriveSharedSecret", publicKey, cause);
@@ -27919,7 +28166,7 @@ var Mac_exports = /* @__PURE__ */ __exportAll({
27919
28166
  timingSafeEqual: () => timingSafeEqual,
27920
28167
  toBytes: () => toBytes$1
27921
28168
  });
27922
- const TypeId$54 = "~effect/crypto/Mac/Key";
28169
+ const TypeId$55 = "~effect/crypto/Mac/Key";
27923
28170
  /**
27924
28171
  * HMAC with SHA-1, with a 20-byte tag.
27925
28172
  *
@@ -27969,7 +28216,7 @@ const hmacSha512 = {
27969
28216
  name: "hmacSha512",
27970
28217
  hash: sha512
27971
28218
  };
27972
- const KeyProto$1 = /*#__PURE__*/ redactedProto(TypeId$54, "Mac.Key");
28219
+ const KeyProto$1 = /*#__PURE__*/ redactedProto(TypeId$55, "Mac.Key");
27973
28220
  /**
27974
28221
  * Checks whether a value is a {@link Key}.
27975
28222
  *
@@ -27977,7 +28224,7 @@ const KeyProto$1 = /*#__PURE__*/ redactedProto(TypeId$54, "Mac.Key");
27977
28224
  * @category guards
27978
28225
  * @since 4.0.0
27979
28226
  */
27980
- const isKey$1 = (u) => hasProperty(u, TypeId$54);
28227
+ const isKey$1 = (u) => hasProperty(u, TypeId$55);
27981
28228
  const blockSizes = {
27982
28229
  "MD5": 64,
27983
28230
  "SHA-1": 64,
@@ -28350,7 +28597,7 @@ const layerWebCrypto$2 = /*#__PURE__*/ effect(KeyWrap, /*#__PURE__*/ gen(functio
28350
28597
  return KeyWrap.of({
28351
28598
  generateKey: (algorithm) => map$5(random.randomBytes(algorithm.keyLength), (bytes) => makeBytes(KeyProto, algorithm, bytes)),
28352
28599
  generateKeyPair: (algorithm) => generateKeyPair(family$1, crypto, random, algorithm, rsaGenerateParams(specOf$1(algorithm), algorithm.modulusLength)),
28353
- wrap: (wrapKey, key) => suspend$2(() => {
28600
+ wrap: (wrapKey, key) => suspend$3(() => {
28354
28601
  const stored = material(key);
28355
28602
  if (stored._tag === "CryptoKey" && !stored.cryptoKey.extractable) return notExtractable("KeyWrap", "wrap");
28356
28603
  return secretFamily(key.algorithm).toBytes(key).pipe(catch_$2(rehome("KeyWrap", "wrap")), flatMap$2((bytes) => wrapBytes(wrapKey, bytes)));
@@ -28941,7 +29188,7 @@ const checkJwk = (data, algorithm, role) => {
28941
29188
  };
28942
29189
  }
28943
29190
  };
28944
- const decodeAsymmetric = (method, role, format, algorithm, data) => suspend$2(() => {
29191
+ const decodeAsymmetric = (method, role, format, algorithm, data) => suspend$3(() => {
28945
29192
  const family = familyOf(algorithm);
28946
29193
  if (family === void 0) return invalidKey$1(method, "Expected an asymmetric algorithm");
28947
29194
  const spec = family.specOf(algorithm);
@@ -29270,7 +29517,7 @@ function mergeLeaves(edit, shift, hash1, node1, hash2, node2) {
29270
29517
  return new IndexedNode(edit, bit1 | bit2, bit1 >>> 0 < bit2 >>> 0 ? [node1, node2] : [node2, node1]);
29271
29518
  }
29272
29519
  const hashMapSeed = /*#__PURE__*/ string$2("HashMap");
29273
- const entryHash = (key, value) => combine$2(hash(key), hash(value));
29520
+ const entryHash = (key, value) => combine$3(hash(key), hash(value));
29274
29521
  const childrenHash = (children) => {
29275
29522
  let h = 0;
29276
29523
  for (let i = 0; i < children.length; i++) {
@@ -29751,9 +29998,9 @@ const emptyNode = /*#__PURE__*/ new EmptyNode();
29751
29998
  /** @internal */
29752
29999
  const isHashMap$1 = (u) => hasProperty(u, HashMapTypeId);
29753
30000
  /** @internal */
29754
- const empty$8 = () => new HashMapImpl(false, 0, emptyNode, 0);
30001
+ const empty$9 = () => new HashMapImpl(false, 0, emptyNode, 0);
29755
30002
  /** @internal */
29756
- const fromIterable$5 = (entries) => {
30003
+ const fromIterable$6 = (entries) => {
29757
30004
  let root = emptyNode;
29758
30005
  let size = 0;
29759
30006
  const added = { value: false };
@@ -29770,7 +30017,7 @@ const get$8 = /*#__PURE__*/ dual(2, (self, key) => {
29770
30017
  return self._root.get(0, hash(key), key);
29771
30018
  });
29772
30019
  /** @internal */
29773
- const has$2 = /*#__PURE__*/ dual(2, (self, key) => {
30020
+ const has$3 = /*#__PURE__*/ dual(2, (self, key) => {
29774
30021
  return self._root.has(0, hash(key), key);
29775
30022
  });
29776
30023
  const setHash$1 = (self, key, hash, value) => {
@@ -29844,7 +30091,7 @@ const isHashMap = isHashMap$1;
29844
30091
  * @category constructors
29845
30092
  * @since 2.0.0
29846
30093
  */
29847
- const fromIterable$4 = fromIterable$5;
30094
+ const fromIterable$5 = fromIterable$6;
29848
30095
  /**
29849
30096
  * Looks up the value for the specified key in the `HashMap` safely using the
29850
30097
  * internal hashing function.
@@ -29877,10 +30124,10 @@ const HashSetTypeId = "~effect/HashSet";
29877
30124
  const hashSetSeed = /*#__PURE__*/ string$2(HashSetTypeId);
29878
30125
  const HashSetProto = {
29879
30126
  [symbol$3]() {
29880
- return optimize(combine$2(hashSetSeed, hash(keyMap(this))));
30127
+ return optimize(combine$3(hashSetSeed, hash(keyMap(this))));
29881
30128
  },
29882
30129
  [symbol$2](that) {
29883
- return isHashSet$1(that) && size(this) === size(that) && every(this, (value) => has$1(that, value));
30130
+ return isHashSet$1(that) && size(this) === size(that) && every(this, (value) => has$2(that, value));
29884
30131
  },
29885
30132
  [Symbol.iterator]() {
29886
30133
  return keys(keyMap(this));
@@ -29912,13 +30159,13 @@ const isHashSet$1 = (u) => hasProperty(u, HashSetTypeId);
29912
30159
  /** @internal */
29913
30160
  const keyMap = (self) => self.keyMap;
29914
30161
  /** @internal */
29915
- const fromIterable$3 = (values) => {
29916
- let map = empty$8();
30162
+ const fromIterable$4 = (values) => {
30163
+ let map = empty$9();
29917
30164
  for (const value of values) map = set$4(map, value, true);
29918
30165
  return makeImpl(map);
29919
30166
  };
29920
30167
  /** @internal */
29921
- const has$1 = (self, value) => has$2(keyMap(self), value);
30168
+ const has$2 = (self, value) => has$3(keyMap(self), value);
29922
30169
  /** @internal */
29923
30170
  const size = (self) => size$1(keyMap(self));
29924
30171
  /** @internal */
@@ -29958,7 +30205,7 @@ const every = (self, predicate) => {
29958
30205
  * @category constructors
29959
30206
  * @since 2.0.0
29960
30207
  */
29961
- const fromIterable$2 = fromIterable$3;
30208
+ const fromIterable$3 = fromIterable$4;
29962
30209
  /**
29963
30210
  * Checks whether a value is a HashSet.
29964
30211
  *
@@ -30015,7 +30262,7 @@ const isHashSet = isHashSet$1;
30015
30262
  * @category predicates
30016
30263
  * @since 2.0.0
30017
30264
  */
30018
- const has = /*#__PURE__*/ dual(2, has$1);
30265
+ const has$1 = /*#__PURE__*/ dual(2, has$2);
30019
30266
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/Cookies.js
30020
30267
  /**
30021
30268
  * Models HTTP cookies and cookie collections for requests and responses.
@@ -30033,7 +30280,7 @@ const has = /*#__PURE__*/ dual(2, has$1);
30033
30280
  * @stability unstable
30034
30281
  * @since 4.0.0
30035
30282
  */
30036
- const TypeId$53 = "~effect/http/Cookies";
30283
+ const TypeId$54 = "~effect/http/Cookies";
30037
30284
  /**
30038
30285
  * Returns `true` when a value is a `Cookies` collection.
30039
30286
  *
@@ -30041,7 +30288,7 @@ const TypeId$53 = "~effect/http/Cookies";
30041
30288
  * @category guards
30042
30289
  * @since 4.0.0
30043
30290
  */
30044
- const isCookies = (u) => hasProperty(u, TypeId$53);
30291
+ const isCookies = (u) => hasProperty(u, TypeId$54);
30045
30292
  const CookieTypeId = "~effect/http/Cookies/Cookie";
30046
30293
  const CookieErrorTypeId = "~effect/http/Cookies/CookieError";
30047
30294
  /**
@@ -30095,7 +30342,7 @@ var CookiesError = class CookiesError extends (/*#__PURE__*/ TaggedError$1("Cook
30095
30342
  }
30096
30343
  };
30097
30344
  const Proto$20 = {
30098
- [TypeId$53]: TypeId$53,
30345
+ [TypeId$54]: TypeId$54,
30099
30346
  ...BaseProto,
30100
30347
  toJSON() {
30101
30348
  return {
@@ -30126,7 +30373,7 @@ const fromReadonlyRecord = (cookies) => {
30126
30373
  * @category constructors
30127
30374
  * @since 4.0.0
30128
30375
  */
30129
- const fromIterable$1 = (cookies) => {
30376
+ const fromIterable$2 = (cookies) => {
30130
30377
  const record = {};
30131
30378
  for (const cookie of cookies) assignProperty(record, cookie.name, cookie);
30132
30379
  return fromReadonlyRecord(record);
@@ -30145,7 +30392,7 @@ const fromSetCookie = (headers) => {
30145
30392
  const cookie = parseSetCookie(header.trim());
30146
30393
  if (cookie) cookies.push(cookie);
30147
30394
  }
30148
- return fromIterable$1(cookies);
30395
+ return fromIterable$2(cookies);
30149
30396
  };
30150
30397
  function parseSetCookie(header) {
30151
30398
  const parts = header.split(";").map((_) => _.trim()).filter((_) => _ !== "");
@@ -30236,7 +30483,7 @@ function parseSetCookie(header) {
30236
30483
  * @category constructors
30237
30484
  * @since 4.0.0
30238
30485
  */
30239
- const empty$7 = /*#__PURE__*/ fromIterable$1([]);
30486
+ const empty$8 = /*#__PURE__*/ fromIterable$2([]);
30240
30487
  /**
30241
30488
  * Returns `true` when the `Cookies` collection contains no cookies.
30242
30489
  *
@@ -30442,7 +30689,7 @@ const stringOrRedacted = (val) => typeof val === "string" ? val : value$3(val);
30442
30689
  * @stability stable
30443
30690
  * @since 3.3.0
30444
30691
  */
30445
- const TypeId$52 = "~effect/Redacted";
30692
+ const TypeId$53 = "~effect/Redacted";
30446
30693
  /**
30447
30694
  * Returns `true` if a value is a `Redacted` wrapper.
30448
30695
  *
@@ -30471,7 +30718,7 @@ const TypeId$52 = "~effect/Redacted";
30471
30718
  * @category guards
30472
30719
  * @since 3.3.0
30473
30720
  */
30474
- const isRedacted = (u) => hasProperty(u, TypeId$52);
30721
+ const isRedacted = (u) => hasProperty(u, TypeId$53);
30475
30722
  /**
30476
30723
  * Creates a `Redacted` wrapper for a sensitive value.
30477
30724
  *
@@ -30506,7 +30753,7 @@ const make$65 = (value, options) => {
30506
30753
  return self;
30507
30754
  };
30508
30755
  const Proto$19 = {
30509
- [TypeId$52]: { _A: (_) => _ },
30756
+ [TypeId$53]: { _A: (_) => _ },
30510
30757
  label: void 0,
30511
30758
  ...PipeInspectableProto,
30512
30759
  toJSON() {
@@ -30574,7 +30821,7 @@ const value$2 = value$3;
30574
30821
  * @category instances
30575
30822
  * @since 4.0.0
30576
30823
  */
30577
- const makeEquivalence = (isEquivalent) => make$82((x, y) => isEquivalent(value$2(x), value$2(y)));
30824
+ const makeEquivalence = (isEquivalent) => make$83((x, y) => isEquivalent(value$2(x), value$2(y)));
30578
30825
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/Headers.js
30579
30826
  /**
30580
30827
  * Models HTTP headers for the unstable HTTP client and server modules.
@@ -30599,9 +30846,9 @@ const makeEquivalence = (isEquivalent) => make$82((x, y) => isEquivalent(value$2
30599
30846
  * @category type IDs
30600
30847
  * @since 4.0.0
30601
30848
  */
30602
- const TypeId$51 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
30849
+ const TypeId$52 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
30603
30850
  const Proto$18 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
30604
- [TypeId$51]: { value: TypeId$51 },
30851
+ [TypeId$52]: { value: TypeId$52 },
30605
30852
  [symbolRedactable]: { value(context) {
30606
30853
  return redact$1(this, get$12(context, CurrentRedactedNames$1));
30607
30854
  } },
@@ -30634,7 +30881,7 @@ const Equivalence$2 = /*#__PURE__*/ makeEquivalence$3(/*#__PURE__*/ strictEqual(
30634
30881
  * @category constructors
30635
30882
  * @since 4.0.0
30636
30883
  */
30637
- const empty$6 = /*#__PURE__*/ Object.create(Proto$18);
30884
+ const empty$7 = /*#__PURE__*/ Object.create(Proto$18);
30638
30885
  /**
30639
30886
  * Creates `Headers` from a record or iterable of header entries.
30640
30887
  *
@@ -30647,7 +30894,7 @@ const empty$6 = /*#__PURE__*/ Object.create(Proto$18);
30647
30894
  * @since 4.0.0
30648
30895
  */
30649
30896
  const fromInput$1 = (input) => {
30650
- if (input === void 0) return empty$6;
30897
+ if (input === void 0) return empty$7;
30651
30898
  else if (Symbol.iterator in input) {
30652
30899
  const out = Object.create(Proto$18);
30653
30900
  for (const [k, v] of input) out[k.toLowerCase()] = v;
@@ -31008,7 +31255,7 @@ const toPath = (url) => {
31008
31255
  * @stability unstable
31009
31256
  * @since 4.0.0
31010
31257
  */
31011
- const TypeId$50 = "~effect/http/UrlParams";
31258
+ const TypeId$51 = "~effect/http/UrlParams";
31012
31259
  /**
31013
31260
  * Returns `true` when a value is a `UrlParams` instance.
31014
31261
  *
@@ -31016,10 +31263,10 @@ const TypeId$50 = "~effect/http/UrlParams";
31016
31263
  * @category guards
31017
31264
  * @since 4.0.0
31018
31265
  */
31019
- const isUrlParams = (u) => hasProperty(u, TypeId$50);
31266
+ const isUrlParams = (u) => hasProperty(u, TypeId$51);
31020
31267
  const Proto$17 = {
31021
31268
  ...PipeInspectableProto,
31022
- [TypeId$50]: TypeId$50,
31269
+ [TypeId$51]: TypeId$51,
31023
31270
  [Symbol.iterator]() {
31024
31271
  return this.params[Symbol.iterator]();
31025
31272
  },
@@ -31079,7 +31326,7 @@ const fromInput = (input) => {
31079
31326
  return make$63(out);
31080
31327
  };
31081
31328
  const fromInputNested = (input) => {
31082
- const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$7(input) : Object.entries(input);
31329
+ const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$8(input) : Object.entries(input);
31083
31330
  const out = [];
31084
31331
  for (const [key, value] of entries) if (Array.isArray(value)) {
31085
31332
  for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, coerce(value[i])]);
@@ -31102,7 +31349,7 @@ const coerce = (value) => isRedacted(value) ? value : String(value);
31102
31349
  * @category instances
31103
31350
  * @since 4.0.0
31104
31351
  */
31105
- const Equivalence$1 = /*#__PURE__*/ make$82((a, b) => arrayEquivalence(a.params, b.params));
31352
+ const Equivalence$1 = /*#__PURE__*/ make$83((a, b) => arrayEquivalence(a.params, b.params));
31106
31353
  const arrayEquivalence = /*#__PURE__*/ makeEquivalence$2(/*#__PURE__*/ makeEquivalence$4([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ asEquivalence()]));
31107
31354
  /**
31108
31355
  * An empty `UrlParams` value.
@@ -31111,7 +31358,7 @@ const arrayEquivalence = /*#__PURE__*/ makeEquivalence$2(/*#__PURE__*/ makeEquiv
31111
31358
  * @category constructors
31112
31359
  * @since 4.0.0
31113
31360
  */
31114
- const empty$5 = /*#__PURE__*/ make$63([]);
31361
+ const empty$6 = /*#__PURE__*/ make$63([]);
31115
31362
  /**
31116
31363
  * Sets multiple query parameters from input.
31117
31364
  *
@@ -31239,7 +31486,7 @@ const decodeQueryKey = (key) => {
31239
31486
  return key;
31240
31487
  }
31241
31488
  };
31242
- const currentRedactedNames = () => get$12(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$14(), CurrentRedactedNames);
31489
+ const currentRedactedNames = () => get$12(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$15(), CurrentRedactedNames);
31243
31490
  /**
31244
31491
  * Query parameter names or patterns to redact in inspection, spans and errors.
31245
31492
  *
@@ -31349,7 +31596,7 @@ const fromOptionExit = (option) => option._tag === "None" ? missingExit : succee
31349
31596
  * @stability stable
31350
31597
  * @since 4.0.0
31351
31598
  */
31352
- const TypeId$49 = "~effect/SchemaIssue/Issue";
31599
+ const TypeId$50 = "~effect/SchemaIssue/Issue";
31353
31600
  /**
31354
31601
  * Returns `true` if the given value is an {@link Issue}.
31355
31602
  *
@@ -31380,7 +31627,7 @@ const TypeId$49 = "~effect/SchemaIssue/Issue";
31380
31627
  * @since 4.0.0
31381
31628
  */
31382
31629
  function isIssue(u) {
31383
- return hasProperty(u, TypeId$49) && u[TypeId$49] === TypeId$49;
31630
+ return hasProperty(u, TypeId$50) && u[TypeId$50] === TypeId$50;
31384
31631
  }
31385
31632
  /**
31386
31633
  * Returns `true` when an issue contains an input reported by the schema parser.
@@ -31416,7 +31663,7 @@ function hasInput(issue) {
31416
31663
  return Object.hasOwn(issue, "input");
31417
31664
  }
31418
31665
  var IssueNodeImpl = class {
31419
- [TypeId$49] = TypeId$49;
31666
+ [TypeId$50] = TypeId$50;
31420
31667
  constructor(input, options) {
31421
31668
  if (options?.reportInput === true && input !== missing) this.input = input;
31422
31669
  }
@@ -32673,7 +32920,7 @@ const Middleware = class extends Class$3 {
32673
32920
  return new Middleware(this.encode, this.decode);
32674
32921
  }
32675
32922
  };
32676
- const TypeId$48 = "~effect/SchemaTransformation/Transformation";
32923
+ const TypeId$49 = "~effect/SchemaTransformation/Transformation";
32677
32924
  /**
32678
32925
  * Constructs a bidirectional schema transformation from its decode and encode getters.
32679
32926
  *
@@ -32682,7 +32929,7 @@ const TypeId$48 = "~effect/SchemaTransformation/Transformation";
32682
32929
  * @since 4.0.0
32683
32930
  */
32684
32931
  const Transformation = class extends Class$3 {
32685
- [TypeId$48] = TypeId$48;
32932
+ [TypeId$49] = TypeId$49;
32686
32933
  _tag = "Transformation";
32687
32934
  decode;
32688
32935
  encode;
@@ -32725,7 +32972,7 @@ const Transformation = class extends Class$3 {
32725
32972
  * @since 4.0.0
32726
32973
  */
32727
32974
  function isTransformation(u) {
32728
- return hasProperty(u, TypeId$48) && u[TypeId$48] === TypeId$48;
32975
+ return hasProperty(u, TypeId$49) && u[TypeId$49] === TypeId$49;
32729
32976
  }
32730
32977
  /**
32731
32978
  * Constructs a `Transformation` from an object with `decode` and `encode`
@@ -33303,9 +33550,9 @@ const Context = class {
33303
33550
  this.annotations = annotations;
33304
33551
  }
33305
33552
  };
33306
- const TypeId$47 = "~effect/Schema";
33553
+ const TypeId$48 = "~effect/Schema";
33307
33554
  var ASTNodeImpl = class {
33308
- [TypeId$47] = TypeId$47;
33555
+ [TypeId$48] = TypeId$48;
33309
33556
  annotations;
33310
33557
  checks;
33311
33558
  encoding;
@@ -33933,7 +34180,7 @@ const Arrays = class extends ASTNodeImpl {
33933
34180
  if (!eff) return finish(state);
33934
34181
  if (effectIsExit(eff)) return flatMapEager(eff, () => finish(state));
33935
34182
  let first = true;
33936
- return suspend$2(() => {
34183
+ return suspend$3(() => {
33937
34184
  if (!first) return parse(input, options);
33938
34185
  first = false;
33939
34186
  return flatMap$2(eff, () => finish(state));
@@ -34217,7 +34464,7 @@ const Objects = class extends ASTNodeImpl {
34217
34464
  }
34218
34465
  }
34219
34466
  else if (parseIndexes) {
34220
- const keyPairs = empty$11();
34467
+ const keyPairs = empty$12();
34221
34468
  for (let i = 0; i < indexCount; i++) {
34222
34469
  const index = indexes[i];
34223
34470
  const keys = indexKeys?.[i] ?? (index.is.parameter === string$1 ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
@@ -34683,7 +34930,7 @@ function parseUnionCandidates(ast, parser, candidates, input, options) {
34683
34930
  }
34684
34931
  if (effectIsExit(eff)) return resumeUnion(eff, state);
34685
34932
  let first = true;
34686
- return suspend$2(() => {
34933
+ return suspend$3(() => {
34687
34934
  if (!first) return parseUnionCandidates(ast, parser, candidates, input, options);
34688
34935
  first = false;
34689
34936
  return resumeUnion(eff, state);
@@ -34729,6 +34976,36 @@ function formatIsOptional(isOptional) {
34729
34976
  return isOptional ? "?" : "";
34730
34977
  }
34731
34978
  /**
34979
+ * Constructs a {@link Suspend}.
34980
+ *
34981
+ * @stability stable
34982
+ * @category constructors
34983
+ * @since 4.0.0
34984
+ */
34985
+ const Suspend = class extends ASTNodeImpl {
34986
+ _tag = "Suspend";
34987
+ thunk;
34988
+ constructor(thunk, annotations, checks, encoding, context) {
34989
+ if (checks) throw new Error("Cannot add checks to Suspend");
34990
+ super(annotations, void 0, encoding, context);
34991
+ let ast;
34992
+ this.thunk = () => ast ??= thunk();
34993
+ }
34994
+ /** @internal */
34995
+ getParser(compile) {
34996
+ let parser;
34997
+ return (input, options) => (parser ??= compile(this.thunk()))(input, options);
34998
+ }
34999
+ /** @internal */
35000
+ recur(recur) {
35001
+ return new Suspend(() => recur(this.thunk()), this.annotations, void 0, void 0, this.context);
35002
+ }
35003
+ /** @internal */
35004
+ getExpected(getExpected) {
35005
+ return getExpected(this.thunk());
35006
+ }
35007
+ };
35008
+ /**
34732
35009
  * Constructs a {@link Filter}.
34733
35010
  *
34734
35011
  * @stability stable
@@ -35970,10 +36247,10 @@ const normalCompiler = (ast) => resolve(ast).parser;
35970
36247
  const constructorCompiler = (ast) => resolve(ast).makeEffect;
35971
36248
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/schema/make.js
35972
36249
  /** @internal */
35973
- const TypeId$46 = "~effect/Schema/Schema";
36250
+ const TypeId$47 = "~effect/Schema/Schema";
35974
36251
  const RebuildOptions = /*#__PURE__*/ Symbol();
35975
36252
  const SchemaProto = {
35976
- [TypeId$46]: TypeId$46,
36253
+ [TypeId$47]: TypeId$47,
35977
36254
  get make() {
35978
36255
  const value = make$62(this);
35979
36256
  Object.defineProperty(this, "make", {
@@ -37442,13 +37719,13 @@ const concat$2 = (chunks) => {
37442
37719
  * @category instances
37443
37720
  * @since 4.0.6
37444
37721
  */
37445
- const Order$1 = /*#__PURE__*/ make$81((self, that) => {
37722
+ const Order$1 = /*#__PURE__*/ make$82((self, that) => {
37446
37723
  const length = Math.min(self.length, that.length);
37447
37724
  for (let i = 0; i < length; i++) if (self[i] !== that[i]) return self[i] < that[i] ? -1 : 1;
37448
37725
  return self.length < that.length ? -1 : self.length > that.length ? 1 : 0;
37449
37726
  });
37450
37727
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/net/NetAddress.js
37451
- const TypeId$45 = "~effect/net/NetAddress";
37728
+ const TypeId$46 = "~effect/net/NetAddress";
37452
37729
  const ipv4Value = (self) => self.value;
37453
37730
  const ipv6Words = (self) => self;
37454
37731
  /**
@@ -37466,7 +37743,7 @@ const ipv6Words = (self) => self;
37466
37743
  * @since 4.0.0
37467
37744
  */
37468
37745
  var NetAddressError = class extends (/*#__PURE__*/ TaggedError$1("NetAddressError")) {};
37469
- const isAddress = (u) => hasProperty(u, TypeId$45);
37746
+ const isAddress = (u) => hasProperty(u, TypeId$46);
37470
37747
  /**
37471
37748
  * Returns `true` when a value is an IPv4 address.
37472
37749
  *
@@ -37518,12 +37795,12 @@ const isUnixPathAddress = (u) => isAddress(u) && u._tag === "UnixPathAddress";
37518
37795
  const Ipv4Proto = {
37519
37796
  ...BaseProto,
37520
37797
  _tag: "Ipv4Address",
37521
- [TypeId$45]: TypeId$45,
37798
+ [TypeId$46]: TypeId$46,
37522
37799
  [symbol$2](that) {
37523
37800
  return isIpv4Address(that) && ipv4Value(this) === ipv4Value(that);
37524
37801
  },
37525
37802
  [symbol$3]() {
37526
- return optimize(combine$2(ipv4HashSeed, ipv4Value(this) | 0));
37803
+ return optimize(combine$3(ipv4HashSeed, ipv4Value(this) | 0));
37527
37804
  },
37528
37805
  toString() {
37529
37806
  return formatIp(this);
@@ -37535,7 +37812,7 @@ const Ipv4Proto = {
37535
37812
  const Ipv6Proto = {
37536
37813
  ...BaseProto,
37537
37814
  _tag: "Ipv6Address",
37538
- [TypeId$45]: TypeId$45,
37815
+ [TypeId$46]: TypeId$46,
37539
37816
  [symbol$2](that) {
37540
37817
  if (!isIpv6Address(that)) return false;
37541
37818
  const self = ipv6Words(this);
@@ -37544,10 +37821,10 @@ const Ipv6Proto = {
37544
37821
  },
37545
37822
  [symbol$3]() {
37546
37823
  const self = ipv6Words(this);
37547
- let h = combine$2(ipv6HashSeed, self.w0 | 0);
37548
- h = combine$2(h, self.w1 | 0);
37549
- h = combine$2(h, self.w2 | 0);
37550
- return optimize(combine$2(h, self.w3 | 0));
37824
+ let h = combine$3(ipv6HashSeed, self.w0 | 0);
37825
+ h = combine$3(h, self.w1 | 0);
37826
+ h = combine$3(h, self.w2 | 0);
37827
+ return optimize(combine$3(h, self.w3 | 0));
37551
37828
  },
37552
37829
  toString() {
37553
37830
  return formatIp(this);
@@ -37757,12 +38034,12 @@ const isIpv4Mapped = (self) => {
37757
38034
  const InetV4Proto = {
37758
38035
  ...BaseProto,
37759
38036
  _tag: "InetAddressV4",
37760
- [TypeId$45]: TypeId$45,
38037
+ [TypeId$46]: TypeId$46,
37761
38038
  [symbol$2](that) {
37762
38039
  return isInetAddressV4(that) && this.port === that.port && equals$2(this.address, that.address);
37763
38040
  },
37764
38041
  [symbol$3]() {
37765
- return combine$2(hash(this.address), number$2(this.port));
38042
+ return combine$3(hash(this.address), number$2(this.port));
37766
38043
  },
37767
38044
  toString() {
37768
38045
  return formatInet(this);
@@ -37774,12 +38051,12 @@ const InetV4Proto = {
37774
38051
  const InetV6Proto = {
37775
38052
  ...BaseProto,
37776
38053
  _tag: "InetAddressV6",
37777
- [TypeId$45]: TypeId$45,
38054
+ [TypeId$46]: TypeId$46,
37778
38055
  [symbol$2](that) {
37779
38056
  return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && equals$2(this.address, that.address);
37780
38057
  },
37781
38058
  [symbol$3]() {
37782
- return combine$2(combine$2(hash(this.address), number$2(this.port)), number$2(this.scopeId));
38059
+ return combine$3(combine$3(hash(this.address), number$2(this.port)), number$2(this.scopeId));
37783
38060
  },
37784
38061
  toString() {
37785
38062
  return formatInet(this);
@@ -37942,12 +38219,12 @@ const formatUrlUnsafe = (self, scheme = "http") => getOrThrow(formatUrl(self, sc
37942
38219
  const UnixPathProto = {
37943
38220
  ...BaseProto,
37944
38221
  _tag: "UnixPathAddress",
37945
- [TypeId$45]: TypeId$45,
38222
+ [TypeId$46]: TypeId$46,
37946
38223
  [symbol$2](that) {
37947
38224
  return isUnixPathAddress(that) && this.path === that.path;
37948
38225
  },
37949
38226
  [symbol$3]() {
37950
- return combine$2(string$2("UnixPathAddress"), string$2(this.path));
38227
+ return combine$3(string$2("UnixPathAddress"), string$2(this.path));
37951
38228
  },
37952
38229
  toString() {
37953
38230
  return this.path;
@@ -37984,7 +38261,7 @@ const formatUnixPath = (self) => `unix://${self.path}`;
37984
38261
  ({ ...BaseProto });
37985
38262
  ({ ...BaseProto });
37986
38263
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Schema.js
37987
- const TypeId$43 = TypeId$46;
38264
+ const TypeId$44 = TypeId$47;
37988
38265
  /**
37989
38266
  * Creates a schema for a **parametric** type (a generic container such as
37990
38267
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
@@ -38558,7 +38835,7 @@ const make$60 = make$61;
38558
38835
  * @since 3.10.0
38559
38836
  */
38560
38837
  function isSchema(u) {
38561
- return hasProperty(u, TypeId$43) && u[TypeId$43] === TypeId$43;
38838
+ return hasProperty(u, TypeId$44) && u[TypeId$44] === TypeId$44;
38562
38839
  }
38563
38840
  /**
38564
38841
  * Creates an exact optional key schema for struct fields. Unlike `optional`,
@@ -39113,6 +39390,35 @@ const NullOr = /*#__PURE__*/ lambda((self) => Union([self, Null]));
39113
39390
  * @since 3.10.0
39114
39391
  */
39115
39392
  const UndefinedOr = /*#__PURE__*/ lambda((self) => Union([self, Undefined]));
39393
+ /**
39394
+ * Creates a suspended schema that defers evaluation until needed. This is
39395
+ * essential for creating recursive schemas where a schema references itself,
39396
+ * preventing infinite recursion during schema definition.
39397
+ *
39398
+ * **Example** (Defining recursive tree schemas)
39399
+ *
39400
+ * ```ts import.meta.vitest
39401
+ * import { Schema } from "effect"
39402
+ *
39403
+ * interface Tree {
39404
+ * readonly value: number
39405
+ * readonly children: ReadonlyArray<Tree>
39406
+ * }
39407
+ *
39408
+ * const Tree = Schema.Struct({
39409
+ * value: Schema.Number,
39410
+ * children: Schema.Array(Schema.suspend((): Schema.Codec<Tree> => Tree))
39411
+ * })
39412
+ * Schema.decodeSync(Tree)({ value: 1, children: [] }) // => { value: 1, children: [] }
39413
+ * ```
39414
+ *
39415
+ * @stability stable
39416
+ * @category constructors
39417
+ * @since 3.10.0
39418
+ */
39419
+ function suspend$2(f) {
39420
+ return make$60(new Suspend(() => f().ast));
39421
+ }
39116
39422
  function decodeTo(to, transformation) {
39117
39423
  return (from) => {
39118
39424
  return make$60(decodeTo$1(from.ast, to.ast, transformation ? makeTransformation$1(transformation) : passthrough()), {
@@ -40540,7 +40846,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
40540
40846
  }
40541
40847
  });
40542
40848
  }
40543
- static [TypeId$43] = TypeId$43;
40849
+ static [TypeId$44] = TypeId$44;
40544
40850
  get [ClassTypeId]() {
40545
40851
  return ClassTypeId;
40546
40852
  }
@@ -41001,7 +41307,7 @@ function nominal() {
41001
41307
  * @stability stable
41002
41308
  * @since 4.0.0
41003
41309
  */
41004
- const TypeId$42 = "~effect/Cache";
41310
+ const TypeId$43 = "~effect/Cache";
41005
41311
  /**
41006
41312
  * Creates a cache with dynamic time-to-live based on the result and key.
41007
41313
  *
@@ -41131,7 +41437,7 @@ const make$59 = (options) => makeWith$2(options.lookup, {
41131
41437
  });
41132
41438
  const Proto$16 = {
41133
41439
  ...PipeInspectableProto,
41134
- [TypeId$42]: TypeId$42,
41440
+ [TypeId$43]: TypeId$43,
41135
41441
  toJSON() {
41136
41442
  return {
41137
41443
  _id: "Cache",
@@ -41380,9 +41686,9 @@ const makeUnsafe$3 = makeLatchUnsafe;
41380
41686
  */
41381
41687
  const make$58 = makeLatch;
41382
41688
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/MutableRef.js
41383
- const TypeId$41 = "~effect/MutableRef";
41689
+ const TypeId$42 = "~effect/MutableRef";
41384
41690
  const MutableRefProto = {
41385
- [TypeId$41]: TypeId$41,
41691
+ [TypeId$42]: TypeId$42,
41386
41692
  ...PipeInspectableProto,
41387
41693
  toJSON() {
41388
41694
  return {
@@ -41536,7 +41842,7 @@ const set$2 = /*#__PURE__*/ dual(2, (self, value) => {
41536
41842
  * @stability stable
41537
41843
  * @since 2.0.0
41538
41844
  */
41539
- const TypeId$40 = "~effect/PubSub";
41845
+ const TypeId$41 = "~effect/PubSub";
41540
41846
  const SubscriptionTypeId = "~effect/PubSub/Subscription";
41541
41847
  /**
41542
41848
  * Creates a PubSub with a custom atomic implementation and strategy.
@@ -41967,7 +42273,7 @@ const endUnsafe = /*#__PURE__*/ dual(2, (self, value) => {
41967
42273
  * @category publishing
41968
42274
  * @since 2.0.0
41969
42275
  */
41970
- const publish = /*#__PURE__*/ dual(2, (self, value) => suspend$2(() => {
42276
+ const publish = /*#__PURE__*/ dual(2, (self, value) => suspend$3(() => {
41971
42277
  if (self.shutdownFlag.current || isSome(self.ended.current)) return succeed$5(false);
41972
42278
  if (self.pubsub.publish(value)) {
41973
42279
  self.strategy.completeSubscribersUnsafe(self.pubsub, self.subscribers);
@@ -42120,7 +42426,7 @@ const unsubscribe = (self) => uninterruptible(withFiber((state) => {
42120
42426
  * @category subscriptions
42121
42427
  * @since 4.0.0
42122
42428
  */
42123
- const take = (self) => suspend$2(() => {
42429
+ const take = (self) => suspend$3(() => {
42124
42430
  if (self.shutdownFlag.current) return interrupt$1;
42125
42431
  if (self.replayWindow.remaining > 0) {
42126
42432
  const message = self.replayWindow.take();
@@ -42213,7 +42519,7 @@ var BoundedPubSubArb = class {
42213
42519
  if (this.replayBuffer) this.replayBuffer.offerAll(elements);
42214
42520
  return [];
42215
42521
  }
42216
- const chunk = fromIterable$7(elements);
42522
+ const chunk = fromIterable$8(elements);
42217
42523
  const n = chunk.length;
42218
42524
  const size = this.publisherIndex - this.subscribersIndex;
42219
42525
  const available = this.capacity - size;
@@ -42365,7 +42671,7 @@ var BoundedPubSubPow2 = class {
42365
42671
  if (this.replayBuffer) this.replayBuffer.offerAll(elements);
42366
42672
  return [];
42367
42673
  }
42368
- const chunk = fromIterable$7(elements);
42674
+ const chunk = fromIterable$8(elements);
42369
42675
  const n = chunk.length;
42370
42676
  const size = this.publisherIndex - this.subscribersIndex;
42371
42677
  const available = this.capacity - size;
@@ -42512,7 +42818,7 @@ var BoundedPubSubSingle = class {
42512
42818
  if (this.replayBuffer) this.replayBuffer.offerAll(elements);
42513
42819
  return [];
42514
42820
  }
42515
- const chunk = fromIterable$7(elements);
42821
+ const chunk = fromIterable$8(elements);
42516
42822
  if (chunk.length === 0) return chunk;
42517
42823
  if (this.publish(chunk[0])) return chunk.slice(1);
42518
42824
  else return chunk;
@@ -42741,7 +43047,7 @@ var SubscriptionImpl = class {
42741
43047
  }
42742
43048
  };
42743
43049
  var PubSubImpl = class {
42744
- [TypeId$40] = { _A: identity };
43050
+ [TypeId$41] = { _A: identity };
42745
43051
  pubsub;
42746
43052
  subscribers;
42747
43053
  scope;
@@ -43175,7 +43481,7 @@ const toPull = (take) => isExit(take) ? isSuccess(take) ? done$1(take.value) : t
43175
43481
  * @category type IDs
43176
43482
  * @since 4.0.0
43177
43483
  */
43178
- const TypeId$39 = "~effect/Channel";
43484
+ const TypeId$40 = "~effect/Channel";
43179
43485
  /**
43180
43486
  * Checks whether a value is a `Channel`.
43181
43487
  *
@@ -43193,9 +43499,9 @@ const TypeId$39 = "~effect/Channel";
43193
43499
  * @category guards
43194
43500
  * @since 3.5.4
43195
43501
  */
43196
- const isChannel = (u) => hasProperty(u, TypeId$39);
43502
+ const isChannel = (u) => hasProperty(u, TypeId$40);
43197
43503
  const ChannelProto = {
43198
- [TypeId$39]: {
43504
+ [TypeId$40]: {
43199
43505
  _Env: identity,
43200
43506
  _InErr: identity,
43201
43507
  _InElem: identity,
@@ -43361,7 +43667,7 @@ const callbackArray = (f, options) => fromTransform$1((_, scope) => map$5(asyncQ
43361
43667
  * @category constructors
43362
43668
  * @since 2.0.0
43363
43669
  */
43364
- const suspend$1 = (evaluate) => fromTransform$1((upstream, scope) => suspend$2(() => toTransform(evaluate())(upstream, scope)));
43670
+ const suspend$1 = (evaluate) => fromTransform$1((upstream, scope) => suspend$3(() => toTransform(evaluate())(upstream, scope)));
43365
43671
  /**
43366
43672
  * Creates a `Channel` from an iterator.
43367
43673
  *
@@ -43381,7 +43687,7 @@ const suspend$1 = (evaluate) => fromTransform$1((upstream, scope) => suspend$2((
43381
43687
  */
43382
43688
  const fromIterator = (iterator) => fromPull$1(sync(() => {
43383
43689
  const iter = iterator();
43384
- return suspend$2(() => {
43690
+ return suspend$3(() => {
43385
43691
  const state = iter.next();
43386
43692
  return state.done ? done$1(state.value) : succeed$5(state.value);
43387
43693
  });
@@ -43429,7 +43735,7 @@ const succeed$3 = (value) => fromEffect$1(succeed$5(value));
43429
43735
  * @category constructors
43430
43736
  * @since 4.0.0
43431
43737
  */
43432
- const empty$4 = /*#__PURE__*/ fromPull$1(/*#__PURE__*/ succeed$5(/*#__PURE__*/ done$1()));
43738
+ const empty$5 = /*#__PURE__*/ fromPull$1(/*#__PURE__*/ succeed$5(/*#__PURE__*/ done$1()));
43433
43739
  /**
43434
43740
  * Constructs a channel that fails immediately with the specified error.
43435
43741
  *
@@ -43508,7 +43814,7 @@ const die$1 = (defect) => failCause$1(die$4(defect));
43508
43814
  */
43509
43815
  const fromEffect$1 = (effect) => fromPull$1(sync(() => {
43510
43816
  let done = false;
43511
- return suspend$2(() => {
43817
+ return suspend$3(() => {
43512
43818
  if (done) return done$1();
43513
43819
  done = true;
43514
43820
  return effect;
@@ -43612,7 +43918,7 @@ const fromReadableStream$1 = (options) => fromTransform$1((_, scope) => readable
43612
43918
  const readableStreamToPullUnsafe = (options) => {
43613
43919
  const reader = options.readable.getReader();
43614
43920
  const exit = options.exit ?? make$57(void 0);
43615
- const pull = suspend$2(() => {
43921
+ const pull = suspend$3(() => {
43616
43922
  if (exit.current) return exit.current;
43617
43923
  return matchCauseEffect(tryPromise({
43618
43924
  try: () => reader.read(),
@@ -43749,7 +44055,7 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
43749
44055
  });
43750
44056
  yield* semaphore.take(1).pipe(flatMap$2(() => pull), flatMap$2((value) => {
43751
44057
  const index = i++;
43752
- trackFiber(runFork(handle(suspend$2(() => f(value, index)))));
44058
+ trackFiber(runFork(handle(suspend$3(() => f(value, index)))));
43753
44059
  return void_$1;
43754
44060
  }), forever({ disableYield: true }), catchCause$2((cause) => semaphore.withPermits(concurrencyN - 1)(failCause$2(queue, cause))), forkIn(forkedScope));
43755
44061
  } else {
@@ -43765,7 +44071,7 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
43765
44071
  yield* pull.pipe(flatMap$2((value) => {
43766
44072
  if (errorCause) return failCause$3(errorCause);
43767
44073
  const index = i++;
43768
- const fiber = runFork(suspend$2(() => f(value, index)));
44074
+ const fiber = runFork(suspend$3(() => f(value, index)));
43769
44075
  trackFiber(fiber);
43770
44076
  fiber.addObserver(onExit);
43771
44077
  return offer(effects, join$1(fiber));
@@ -43828,7 +44134,7 @@ const flatMapSequential = (self, f) => fromTransform$1((upstream, scope) => map$
43828
44134
  childScope = void 0;
43829
44135
  return flatMap$2(close$2, () => makePull);
43830
44136
  });
43831
- return suspend$2(() => childPull ?? makePull);
44137
+ return suspend$3(() => childPull ?? makePull);
43832
44138
  }));
43833
44139
  const flatMapConcurrent = (self, f, options) => self.pipe(map$4(f), mergeAll(options));
43834
44140
  /**
@@ -43893,7 +44199,7 @@ const flatten = (channels) => flatMap$1(channels, identity);
43893
44199
  const flattenArray = (self) => transformPull$1(self, (pull) => {
43894
44200
  let array;
43895
44201
  let index = 0;
43896
- const pump = suspend$2(function loop() {
44202
+ const pump = suspend$3(function loop() {
43897
44203
  if (array === void 0) return flatMap$2(pull, (array_) => {
43898
44204
  switch (array_.length) {
43899
44205
  case 0: return loop();
@@ -43984,7 +44290,7 @@ const catchCause$1 = /*#__PURE__*/ dual(2, (self, f) => fromTransform$1((upstrea
43984
44290
  return childPull;
43985
44291
  }));
43986
44292
  }));
43987
- return suspend$2(() => currentPull);
44293
+ return suspend$3(() => currentPull);
43988
44294
  });
43989
44295
  }));
43990
44296
  /**
@@ -44282,7 +44588,7 @@ const splitLines$1 = () => fromTransform$1((upstream, _scope) => sync(() => {
44282
44588
  }
44283
44589
  return isReadonlyArrayNonEmpty(chunkBuilder) ? chunkBuilder : null;
44284
44590
  }
44285
- const pullOrFlush = suspend$2(() => {
44591
+ const pullOrFlush = suspend$3(() => {
44286
44592
  if (done._tag === "Some") return done$1(done.value);
44287
44593
  return matchEffect$1(upstream, {
44288
44594
  onSuccess: loop,
@@ -44327,7 +44633,7 @@ const decodeText$2 = (encoding, options) => fromTransform$1((upstream, _scope) =
44327
44633
  const last = decoder.decode();
44328
44634
  return last.length > 0 ? succeed$5(of(last)) : pull;
44329
44635
  }));
44330
- return suspend$2(() => pull);
44636
+ return suspend$3(() => pull);
44331
44637
  }));
44332
44638
  /**
44333
44639
  * Returns a new channel that pipes the output of this channel into the
@@ -44433,7 +44739,7 @@ const restoreUpstreamFailure = (effect) => catchCause$2(effect, (cause) => failC
44433
44739
  */
44434
44740
  const unwrap$6 = (channel) => fromTransform$1((upstream, scope) => {
44435
44741
  let pull;
44436
- return succeed$5(suspend$2(() => {
44742
+ return succeed$5(suspend$3(() => {
44437
44743
  if (pull) return pull;
44438
44744
  return channel.pipe(provide$3(scope), flatMap$2((channel) => toTransform(channel)(upstream, scope)), flatMap$2((pull_) => pull = pull_));
44439
44745
  }));
@@ -44517,7 +44823,7 @@ const onExit = /*#__PURE__*/ dual(2, (self, finalizer) => fromTransformBracket((
44517
44823
  * @since 2.0.0
44518
44824
  */
44519
44825
  const ensuring$1 = /*#__PURE__*/ dual(2, (self, finalizer) => onExit(self, (_) => finalizer));
44520
- const runWith$1 = (self, f, onHalt) => suspend$2(() => {
44826
+ const runWith$1 = (self, f, onHalt) => suspend$3(() => {
44521
44827
  const scope = makeUnsafe$7();
44522
44828
  const makePull = toTransform(self)(done$1(), scope);
44523
44829
  return catchDone(flatMap$2(makePull, f), onHalt ? onHalt : succeed$5).pipe(onExit$1((exit) => close(scope, exit)));
@@ -44647,7 +44953,7 @@ const mkUint8Array$1 = (self) => map$5(runFold(self, () => ({
44647
44953
  * @category running
44648
44954
  * @since 4.0.0
44649
44955
  */
44650
- const runLast$1 = (self) => suspend$2(() => {
44956
+ const runLast$1 = (self) => suspend$3(() => {
44651
44957
  const absent = Symbol();
44652
44958
  let last = absent;
44653
44959
  return runWith$1(self, (pull) => forever(flatMap$2(pull, (item) => {
@@ -44680,7 +44986,7 @@ const runLast$1 = (self) => suspend$2(() => {
44680
44986
  * @category running
44681
44987
  * @since 4.0.0
44682
44988
  */
44683
- const runFold = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$2(() => {
44989
+ const runFold = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$3(() => {
44684
44990
  let state = initial();
44685
44991
  return runWith$1(self, (pull) => whileLoop({
44686
44992
  while: constTrue,
@@ -44708,7 +45014,7 @@ const runFold = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$2(() => {
44708
45014
  * @category running
44709
45015
  * @since 4.0.0
44710
45016
  */
44711
- const runFoldEffect$1 = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$2(() => {
45017
+ const runFoldEffect$1 = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$3(() => {
44712
45018
  let state = initial();
44713
45019
  return runWith$1(self, (pull) => whileLoop({
44714
45020
  while: constTrue,
@@ -45329,7 +45635,7 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
45329
45635
  * @stability unstable
45330
45636
  * @since 4.0.0
45331
45637
  */
45332
- const TypeId$38 = "~effect/PlatformError";
45638
+ const TypeId$39 = "~effect/PlatformError";
45333
45639
  /**
45334
45640
  * Error data for an invalid argument passed to a platform API.
45335
45641
  *
@@ -45442,7 +45748,7 @@ var PlatformError = class extends (/*#__PURE__*/ TaggedError$1("PlatformError"))
45442
45748
  *
45443
45749
  * @since 4.0.0
45444
45750
  */
45445
- [TypeId$38] = TypeId$38;
45751
+ [TypeId$39] = TypeId$39;
45446
45752
  get message() {
45447
45753
  return this.reason.message;
45448
45754
  }
@@ -45474,7 +45780,7 @@ const systemError = (options) => new PlatformError(new SystemError(options));
45474
45780
  */
45475
45781
  const badArgument = (options) => new PlatformError(new BadArgument(options));
45476
45782
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/stream.js
45477
- const TypeId$37 = "~effect/Stream";
45783
+ const TypeId$38 = "~effect/Stream";
45478
45784
  const streamVariance = {
45479
45785
  _R: identity,
45480
45786
  _E: identity,
@@ -45484,7 +45790,7 @@ const Stream$2 = function(channel) {
45484
45790
  this.channel = channel;
45485
45791
  };
45486
45792
  Stream$2.prototype = {
45487
- [TypeId$37]: streamVariance,
45793
+ [TypeId$38]: streamVariance,
45488
45794
  pipe() {
45489
45795
  return pipeArguments(this, arguments);
45490
45796
  }
@@ -45492,7 +45798,7 @@ Stream$2.prototype = {
45492
45798
  /** @internal */
45493
45799
  const fromChannel$2 = (channel) => new Stream$2(channel);
45494
45800
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Sink.js
45495
- const TypeId$36 = "~effect/Sink";
45801
+ const TypeId$37 = "~effect/Sink";
45496
45802
  const endVoid = /*#__PURE__*/ succeed$5([void 0]);
45497
45803
  const sinkVariance = {
45498
45804
  _A: identity,
@@ -45502,7 +45808,7 @@ const sinkVariance = {
45502
45808
  _R: identity
45503
45809
  };
45504
45810
  const SinkProto = {
45505
- [TypeId$36]: sinkVariance,
45811
+ [TypeId$37]: sinkVariance,
45506
45812
  pipe() {
45507
45813
  return pipeArguments(this, arguments);
45508
45814
  }
@@ -45526,7 +45832,7 @@ const SinkProto = {
45526
45832
  * @category guards
45527
45833
  * @since 4.0.0
45528
45834
  */
45529
- const isSink = (u) => hasProperty(u, TypeId$36);
45835
+ const isSink = (u) => hasProperty(u, TypeId$37);
45530
45836
  /**
45531
45837
  * Creates a sink from a `Channel`.
45532
45838
  *
@@ -45698,9 +46004,9 @@ const unwrap$5 = (effect) => fromChannel$1(unwrap$6(map$5(effect, toChannel$1)))
45698
46004
  * @stability stable
45699
46005
  * @since 3.5.0
45700
46006
  */
45701
- const TypeId$35 = "~effect/RcMap";
46007
+ const TypeId$36 = "~effect/RcMap";
45702
46008
  const makeUnsafe$2 = (options) => ({
45703
- [TypeId$35]: TypeId$35,
46009
+ [TypeId$36]: TypeId$36,
45704
46010
  lookup: options.lookup,
45705
46011
  context: options.context,
45706
46012
  scope: options.scope,
@@ -45708,7 +46014,7 @@ const makeUnsafe$2 = (options) => ({
45708
46014
  capacity: options.capacity,
45709
46015
  state: {
45710
46016
  _tag: "Open",
45711
- map: empty$9()
46017
+ map: empty$10()
45712
46018
  },
45713
46019
  pipe() {
45714
46020
  return pipeArguments(this, arguments);
@@ -45860,7 +46166,7 @@ const get$4 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore)
45860
46166
  });
45861
46167
  context.set(Scope.key, entry.scope);
45862
46168
  const lookupContext = makeUnsafe$9(context);
45863
- suspend$2(() => self.lookup(key)).pipe(runForkWith(lookupContext), runIn(entry.scope)).addObserver((exit) => {
46169
+ suspend$3(() => self.lookup(key)).pipe(runForkWith(lookupContext), runIn(entry.scope)).addObserver((exit) => {
45864
46170
  if (hasInterrupts(exit)) removeInterrupted(self, key, entry, lookupContext);
45865
46171
  doneUnsafe(entry.deferred, exit);
45866
46172
  });
@@ -45913,7 +46219,7 @@ const release$1 = (self, key, entry) => withFiber((fiber) => {
45913
46219
  return void_$1;
45914
46220
  });
45915
46221
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/rcRef.js
45916
- const TypeId$34 = "~effect/RcRef";
46222
+ const TypeId$35 = "~effect/RcRef";
45917
46223
  const stateEmpty = { _tag: "Empty" };
45918
46224
  const stateClosed = { _tag: "Closed" };
45919
46225
  const variance = {
@@ -45921,7 +46227,7 @@ const variance = {
45921
46227
  _E: identity
45922
46228
  };
45923
46229
  var RcRefImpl = class {
45924
- [TypeId$34] = variance;
46230
+ [TypeId$35] = variance;
45925
46231
  pipe() {
45926
46232
  return pipeArguments(this, arguments);
45927
46233
  }
@@ -45972,7 +46278,7 @@ const getState = (self, restore) => {
45972
46278
  };
45973
46279
  self.state = acquiring;
45974
46280
  const scope = makeUnsafe$7();
45975
- const acquire = provideContext$2(self.acquire, add$1(self.context, Scope, scope)).pipe(flatMap$2((value) => {
46281
+ const acquire = provideContext$2(self.acquire, add$2(self.context, Scope, scope)).pipe(flatMap$2((value) => {
45976
46282
  if (self.state !== acquiring) return interrupt$1;
45977
46283
  const state = {
45978
46284
  _tag: "Acquired",
@@ -46153,7 +46459,7 @@ const get$2 = get$3;
46153
46459
  * @category type IDs
46154
46460
  * @since 4.0.0
46155
46461
  */
46156
- const TypeId$33 = "~effect/Stream";
46462
+ const TypeId$34 = "~effect/Stream";
46157
46463
  /**
46158
46464
  * Checks whether a value is a Stream.
46159
46465
  *
@@ -46170,7 +46476,7 @@ const TypeId$33 = "~effect/Stream";
46170
46476
  * @category guards
46171
46477
  * @since 4.0.0
46172
46478
  */
46173
- const isStream = (u) => hasProperty(u, TypeId$33);
46479
+ const isStream = (u) => hasProperty(u, TypeId$34);
46174
46480
  /**
46175
46481
  * Creates a stream from a array-emitting `Channel`.
46176
46482
  *
@@ -46227,11 +46533,11 @@ const fromEffectSchedule = (effect, schedule) => fromPull(gen(function* () {
46227
46533
  const step = yield* toStepWithMetadata(schedule);
46228
46534
  let s = yield* provideService(effect, CurrentMetadata, CurrentMetadata.defaultValue());
46229
46535
  let initial = true;
46230
- const pull = suspend$2(() => step(s)).pipe(flatMap$2((meta) => provideService(effect, CurrentMetadata, meta)), map$5((next) => {
46536
+ const pull = suspend$3(() => step(s)).pipe(flatMap$2((meta) => provideService(effect, CurrentMetadata, meta)), map$5((next) => {
46231
46537
  s = next;
46232
46538
  return of(next);
46233
46539
  }));
46234
- return suspend$2(() => {
46540
+ return suspend$3(() => {
46235
46541
  if (initial) {
46236
46542
  initial = false;
46237
46543
  return succeed$5(of(s));
@@ -46259,7 +46565,7 @@ const tick = (interval) => fromPull(sync(() => {
46259
46565
  let first = true;
46260
46566
  const effect = succeed$5(of(void 0));
46261
46567
  const delayed = delay(effect, interval);
46262
- return suspend$2(() => {
46568
+ return suspend$3(() => {
46263
46569
  if (first) {
46264
46570
  first = false;
46265
46571
  return effect;
@@ -46386,7 +46692,7 @@ const callback = (f, options) => fromChannel(callbackArray(f, options));
46386
46692
  * @category constructors
46387
46693
  * @since 2.0.0
46388
46694
  */
46389
- const empty$3 = /*#__PURE__*/ fromChannel(empty$4);
46695
+ const empty$4 = /*#__PURE__*/ fromChannel(empty$5);
46390
46696
  /**
46391
46697
  * Creates a single-valued pure stream.
46392
46698
  *
@@ -46522,7 +46828,7 @@ const die = (defect) => fromChannel(die$1(defect));
46522
46828
  * @category constructors
46523
46829
  * @since 4.0.0
46524
46830
  */
46525
- const fromArray = (array) => isReadonlyArrayNonEmpty(array) ? fromChannel(succeed$3(array)) : empty$3;
46831
+ const fromArray = (array) => isReadonlyArrayNonEmpty(array) ? fromChannel(succeed$3(array)) : empty$4;
46526
46832
  /**
46527
46833
  * Creates a stream that pulls values from a `Queue.Dequeue`.
46528
46834
  *
@@ -46837,7 +47143,7 @@ function* concatChannels(self, that) {
46837
47143
  } catch (defect) {
46838
47144
  stack.push(die(defect));
46839
47145
  }
46840
- yield empty$4;
47146
+ yield empty$5;
46841
47147
  }
46842
47148
  }
46843
47149
  /**
@@ -47061,7 +47367,7 @@ const drop = /*#__PURE__*/ dual(2, (self, n) => {
47061
47367
  const transduce = /*#__PURE__*/ dual(2, (self, sink) => transformPull(self, (upstream, scope) => sync(() => {
47062
47368
  let done;
47063
47369
  let leftover;
47064
- const upstreamWithLeftover = suspend$2(() => {
47370
+ const upstreamWithLeftover = suspend$3(() => {
47065
47371
  if (leftover !== void 0) {
47066
47372
  const chunk = leftover;
47067
47373
  leftover = void 0;
@@ -47072,11 +47378,11 @@ const transduce = /*#__PURE__*/ dual(2, (self, sink) => transformPull(self, (ups
47072
47378
  done = fail$9(error);
47073
47379
  return done$1();
47074
47380
  }));
47075
- const pull = map$5(suspend$2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
47381
+ const pull = map$5(suspend$3(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
47076
47382
  leftover = leftover_;
47077
47383
  return of(value);
47078
47384
  });
47079
- return suspend$2(() => done ? done : pull);
47385
+ return suspend$3(() => done ? done : pull);
47080
47386
  })));
47081
47387
  /**
47082
47388
  * Creates a PubSub-backed stream that multicasts the source to all subscribers.
@@ -47695,7 +48001,7 @@ const toReadableStreamWith = /*#__PURE__*/ dual((args) => isStream(args[0]), (se
47695
48001
  * @category destructors
47696
48002
  * @since 2.0.0
47697
48003
  */
47698
- const toReadableStream = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, options) => toReadableStreamWith(self, empty$14(), options));
48004
+ const toReadableStream = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, options) => toReadableStreamWith(self, empty$15(), options));
47699
48005
  /**
47700
48006
  * Creates an Effect that builds a ReadableStream from the stream.
47701
48007
  *
@@ -47775,7 +48081,7 @@ const toPubSubTake = /*#__PURE__*/ dual(2, (self, options) => toPubSubTake$1(sel
47775
48081
  * @stability unstable
47776
48082
  * @since 4.0.0
47777
48083
  */
47778
- const TypeId$32 = "~effect/FileSystem";
48084
+ const TypeId$33 = "~effect/FileSystem";
47779
48085
  /**
47780
48086
  * Service tag for platform file-system operations.
47781
48087
  *
@@ -47845,7 +48151,7 @@ const FileSystem = /*#__PURE__*/ Service$1("effect/FileSystem");
47845
48151
  */
47846
48152
  const make$50 = (impl) => FileSystem.of({
47847
48153
  ...impl,
47848
- [TypeId$32]: TypeId$32,
48154
+ [TypeId$33]: TypeId$33,
47849
48155
  glob: make$55(impl),
47850
48156
  exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$5(false) : fail$7(e))),
47851
48157
  readFileString: (path, encoding) => flatMap$2(impl.readFile(path), (_) => try_({
@@ -47865,7 +48171,7 @@ const make$50 = (impl) => FileSystem.of({
47865
48171
  let totalBytesRead = BigInt(0);
47866
48172
  const chunkSize = Number(BigInt(options?.chunkSize ?? 65536));
47867
48173
  const readChunk = file.readAlloc(chunkSize);
47868
- return fromPull(succeed$5(flatMap$2(suspend$2(() => {
48174
+ return fromPull(succeed$5(flatMap$2(suspend$3(() => {
47869
48175
  if (bytesToRead !== void 0 && bytesToRead <= totalBytesRead) return done$1();
47870
48176
  return bytesToRead !== void 0 && bytesToRead - totalBytesRead < chunkSize ? file.readAlloc(Number(bytesToRead - totalBytesRead)) : readChunk;
47871
48177
  }), match$8({
@@ -47977,7 +48283,7 @@ var WatchBackend = class extends (/*#__PURE__*/ Service$1()("effect/FileSystem/W
47977
48283
  * @category type IDs
47978
48284
  * @since 4.0.0
47979
48285
  */
47980
- const TypeId$31 = "~effect/Path";
48286
+ const TypeId$32 = "~effect/Path";
47981
48287
  /**
47982
48288
  * Service tag for accessing the current `Path` implementation.
47983
48289
  *
@@ -48067,7 +48373,7 @@ const Path$1 = /*#__PURE__*/ Service$1("effect/Path");
48067
48373
  */
48068
48374
  const make$49 = (impl) => Path$1.of({
48069
48375
  ...impl,
48070
- [TypeId$31]: TypeId$31,
48376
+ [TypeId$32]: TypeId$32,
48071
48377
  resolveWithin(root, input) {
48072
48378
  if (impl.parse(input).root !== "") return none();
48073
48379
  const base = impl.resolve(root);
@@ -48606,7 +48912,7 @@ const isGreaterThanOrEqualTo = /*#__PURE__*/ isGreaterThanOrEqualTo$3(LogLevelOr
48606
48912
  * @stability stable
48607
48913
  * @since 4.0.0
48608
48914
  */
48609
- const TypeId$30 = "~effect/Config";
48915
+ const TypeId$31 = "~effect/Config";
48610
48916
  /**
48611
48917
  * Returns `true` if `u` is a `Config` instance.
48612
48918
  *
@@ -48628,7 +48934,7 @@ const TypeId$30 = "~effect/Config";
48628
48934
  * @category guards
48629
48935
  * @since 2.0.0
48630
48936
  */
48631
- const isConfig = (u) => hasProperty(u, TypeId$30);
48937
+ const isConfig = (u) => hasProperty(u, TypeId$31);
48632
48938
  /**
48633
48939
  * Represents the error type produced when config loading or validation fails.
48634
48940
  *
@@ -48671,7 +48977,7 @@ const Proto$14 = {
48671
48977
  return this.parse(fiber.getRef(ConfigProvider));
48672
48978
  }
48673
48979
  }),
48674
- [TypeId$30]: TypeId$30,
48980
+ [TypeId$31]: TypeId$31,
48675
48981
  toJSON() {
48676
48982
  return { _id: "Config" };
48677
48983
  }
@@ -49432,7 +49738,7 @@ const ignore = "~effect/ErrorReporter/ignore";
49432
49738
  * @stability stable
49433
49739
  * @since 2.0.0
49434
49740
  */
49435
- const TypeId$29 = "~effect/FiberSet";
49741
+ const TypeId$30 = "~effect/FiberSet";
49436
49742
  /**
49437
49743
  * Checks whether a value is a FiberSet.
49438
49744
  *
@@ -49455,11 +49761,11 @@ const TypeId$29 = "~effect/FiberSet";
49455
49761
  * @category guards
49456
49762
  * @since 2.0.0
49457
49763
  */
49458
- const isFiberSet = (u) => hasProperty(u, TypeId$29);
49764
+ const isFiberSet = (u) => hasProperty(u, TypeId$30);
49459
49765
  const Proto$13 = {
49460
- [TypeId$29]: TypeId$29,
49766
+ [TypeId$30]: TypeId$30,
49461
49767
  [Symbol.iterator]() {
49462
- if (this.state._tag === "Closed") return empty$13();
49768
+ if (this.state._tag === "Closed") return empty$14();
49463
49769
  return this.state.backing[Symbol.iterator]();
49464
49770
  },
49465
49771
  ...PipeInspectableProto,
@@ -49515,7 +49821,7 @@ const makeUnsafe$1 = (backing, deferred) => {
49515
49821
  * @category constructors
49516
49822
  * @since 2.0.0
49517
49823
  */
49518
- const make$46 = () => acquireRelease(sync(() => makeUnsafe$1(/* @__PURE__ */ new Set(), makeUnsafe$8())), (set) => suspend$2(() => {
49824
+ const make$46 = () => acquireRelease(sync(() => makeUnsafe$1(/* @__PURE__ */ new Set(), makeUnsafe$8())), (set) => suspend$3(() => {
49519
49825
  const state = set.state;
49520
49826
  if (state._tag === "Closed") return void_$1;
49521
49827
  set.state = { _tag: "Closed" };
@@ -49523,7 +49829,7 @@ const make$46 = () => acquireRelease(sync(() => makeUnsafe$1(/* @__PURE__ */ new
49523
49829
  return interruptAll(fibers).pipe(into(set.deferred));
49524
49830
  }));
49525
49831
  const internalFiberId = -1;
49526
- const isInternalInterruption = /*#__PURE__*/ toPredicate(/*#__PURE__*/ compose$1(filterInterruptors, /*#__PURE__*/ has$3(internalFiberId)));
49832
+ const isInternalInterruption = /*#__PURE__*/ toPredicate(/*#__PURE__*/ compose$1(filterInterruptors, /*#__PURE__*/ has$5(internalFiberId)));
49527
49833
  /**
49528
49834
  * Adds an existing fiber to the `FiberSet` using a synchronous, unsafe
49529
49835
  * mutation.
@@ -49846,9 +50152,9 @@ const layer$21 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntr
49846
50152
  })));
49847
50153
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/matcher.js
49848
50154
  /** @internal */
49849
- const TypeId$28 = "~effect/Match/Matcher";
50155
+ const TypeId$29 = "~effect/Match/Matcher";
49850
50156
  const TypeMatcherProto = {
49851
- [TypeId$28]: {
50157
+ [TypeId$29]: {
49852
50158
  _input: identity,
49853
50159
  _filters: identity,
49854
50160
  _remaining: identity,
@@ -49871,7 +50177,7 @@ function makeTypeMatcher(select, cases) {
49871
50177
  return matcher;
49872
50178
  }
49873
50179
  const ValueMatcherProto = {
49874
- [TypeId$28]: {
50180
+ [TypeId$29]: {
49875
50181
  _input: identity,
49876
50182
  _filters: identity,
49877
50183
  _result: identity,
@@ -50463,6 +50769,189 @@ const orElse = orElse$1;
50463
50769
  * @since 4.0.0
50464
50770
  */
50465
50771
  const exhaustive = exhaustive$1;
50772
+ // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/MutableHashSet.js
50773
+ /**
50774
+ * Stores unique values in a mutable hash set.
50775
+ *
50776
+ * `MutableHashSet` updates the same collection in place and supports fast
50777
+ * membership checks, insertion, removal, clearing, and iteration. It is built
50778
+ * on `MutableHashMap`: each set value is stored as a map key, so uniqueness
50779
+ * follows the same hashing and equality rules as the underlying mutable hash
50780
+ * map.
50781
+ *
50782
+ * @stability stable
50783
+ * @since 2.0.0
50784
+ */
50785
+ const TypeId$28 = "~effect/MutableHashSet";
50786
+ const MutableHashSetProto = {
50787
+ [TypeId$28]: TypeId$28,
50788
+ [Symbol.iterator]() {
50789
+ return Array.from(this.keyMap).map(([_]) => _)[Symbol.iterator]();
50790
+ },
50791
+ toString() {
50792
+ return `MutableHashSet(${format$2(Array.from(this))})`;
50793
+ },
50794
+ toJSON() {
50795
+ return {
50796
+ _id: "MutableHashSet",
50797
+ values: toJson(Array.from(this))
50798
+ };
50799
+ },
50800
+ [NodeInspectSymbol]() {
50801
+ return this.toJSON();
50802
+ },
50803
+ pipe() {
50804
+ return pipeArguments(this, arguments);
50805
+ }
50806
+ };
50807
+ const fromHashMap = (keyMap) => {
50808
+ const set = Object.create(MutableHashSetProto);
50809
+ set.keyMap = keyMap;
50810
+ return set;
50811
+ };
50812
+ /**
50813
+ * Creates an empty MutableHashSet.
50814
+ *
50815
+ * **When to use**
50816
+ *
50817
+ * Use to create a fresh mutable set before adding values over time.
50818
+ *
50819
+ * **Details**
50820
+ *
50821
+ * Each call returns a new empty set backed by an empty `MutableHashMap`.
50822
+ *
50823
+ * **Example** (Creating an empty set)
50824
+ *
50825
+ * ```ts import.meta.vitest
50826
+ * import { MutableHashSet } from "effect"
50827
+ *
50828
+ * const set = MutableHashSet.empty<string>()
50829
+ *
50830
+ * // Add some values
50831
+ * MutableHashSet.add(set, "apple")
50832
+ * MutableHashSet.add(set, "banana")
50833
+ * MutableHashSet.add(set, "apple") // Duplicate, no effect
50834
+ *
50835
+ * MutableHashSet.size(set) // => 2
50836
+ * Array.from(set) // => ["apple", "banana"]
50837
+ * ```
50838
+ *
50839
+ * @see {@link make} for creating a set from explicit values
50840
+ * @see {@link fromIterable} for creating a set from an iterable of values
50841
+ * @see {@link clear} for emptying an existing mutable set
50842
+ *
50843
+ * @stability stable
50844
+ * @category constructors
50845
+ * @since 2.0.0
50846
+ */
50847
+ const empty$3 = () => fromHashMap(empty$10());
50848
+ /**
50849
+ * Creates a MutableHashSet from an iterable collection of values.
50850
+ * Duplicates are automatically removed.
50851
+ *
50852
+ * **When to use**
50853
+ *
50854
+ * Use to build a mutable hash set from any iterable of values.
50855
+ *
50856
+ * **Example** (Creating a set from an iterable)
50857
+ *
50858
+ * ```ts import.meta.vitest
50859
+ * import { MutableHashSet } from "effect"
50860
+ *
50861
+ * const values = ["apple", "banana", "apple", "cherry", "banana"]
50862
+ * const set = MutableHashSet.fromIterable(values)
50863
+ *
50864
+ * MutableHashSet.size(set) // => 3
50865
+ * Array.from(set) // => ["apple", "banana", "cherry"]
50866
+ *
50867
+ * // Works with any iterable
50868
+ * MutableHashSet.size(MutableHashSet.fromIterable(new Set([1, 2, 3]))) // => 3
50869
+ *
50870
+ * // From string characters
50871
+ * Array.from(MutableHashSet.fromIterable("hello")) // => ["h", "e", "l", "o"]
50872
+ * ```
50873
+ *
50874
+ * @stability stable
50875
+ * @category constructors
50876
+ * @since 2.0.0
50877
+ */
50878
+ const fromIterable = (keys) => fromHashMap(fromIterable$7(Array.from(keys).map((k) => [k, true])));
50879
+ /**
50880
+ * Adds a value to the MutableHashSet, mutating the set in place.
50881
+ * If the value already exists, the set remains unchanged.
50882
+ *
50883
+ * **When to use**
50884
+ *
50885
+ * Use to insert a value into a mutable set while keeping uniqueness.
50886
+ *
50887
+ * **Example** (Adding values)
50888
+ *
50889
+ * ```ts import.meta.vitest
50890
+ * import { MutableHashSet } from "effect"
50891
+ *
50892
+ * const set = MutableHashSet.empty<string>()
50893
+ *
50894
+ * // Add new values
50895
+ * MutableHashSet.add(set, "apple")
50896
+ * MutableHashSet.add(set, "banana")
50897
+ *
50898
+ * MutableHashSet.size(set) // => 2
50899
+ * MutableHashSet.has(set, "apple") // => true
50900
+ *
50901
+ * // Add duplicate (no effect)
50902
+ * MutableHashSet.add(set, "apple")
50903
+ * MutableHashSet.size(set) // => 2
50904
+ *
50905
+ * // Pipe-able version
50906
+ * const addFruit = MutableHashSet.add("cherry")
50907
+ * addFruit(set)
50908
+ * MutableHashSet.size(set) // => 3
50909
+ * ```
50910
+ *
50911
+ * @stability stable
50912
+ * @category mutations
50913
+ * @since 2.0.0
50914
+ */
50915
+ const add$1 = /*#__PURE__*/ dual(2, (self, key) => (set$5(self.keyMap, key, true), self));
50916
+ /**
50917
+ * Checks whether the MutableHashSet contains the specified value.
50918
+ *
50919
+ * **When to use**
50920
+ *
50921
+ * Use to test whether a mutable set currently contains a value.
50922
+ *
50923
+ * **Details**
50924
+ *
50925
+ * Membership follows the same hashing and equality rules as the underlying
50926
+ * `MutableHashMap`.
50927
+ *
50928
+ * **Example** (Checking for a value)
50929
+ *
50930
+ * ```ts import.meta.vitest
50931
+ * import { MutableHashSet } from "effect"
50932
+ *
50933
+ * const set = MutableHashSet.make("apple", "banana", "cherry")
50934
+ *
50935
+ * MutableHashSet.has(set, "apple") // => true
50936
+ * MutableHashSet.has(set, "grape") // => false
50937
+ *
50938
+ * // Pipe-able version
50939
+ * const hasApple = MutableHashSet.has("apple")
50940
+ * hasApple(set) // => true
50941
+ *
50942
+ * // Check after adding
50943
+ * MutableHashSet.add(set, "grape")
50944
+ * MutableHashSet.has(set, "grape") // => true
50945
+ * ```
50946
+ *
50947
+ * @see {@link add} for adding a value to the set
50948
+ * @see {@link remove} for removing a value from the set
50949
+ *
50950
+ * @stability stable
50951
+ * @category predicates
50952
+ * @since 2.0.0
50953
+ */
50954
+ const has = /*#__PURE__*/ dual(2, (self, key) => has$4(self.keyMap, key));
50466
50955
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Ref.js
50467
50956
  /**
50468
50957
  * Stores fiber-safe mutable state inside Effect programs.
@@ -53055,7 +53544,7 @@ const Proto$11 = {
53055
53544
  return clone(this, { needsApproval });
53056
53545
  },
53057
53546
  annotate(tag, value) {
53058
- return clone(this, { annotations: add$1(this.annotations, tag, value) });
53547
+ return clone(this, { annotations: add$2(this.annotations, tag, value) });
53059
53548
  },
53060
53549
  annotateMerge(context) {
53061
53550
  return clone(this, { annotations: merge$5(this.annotations, context) });
@@ -53108,7 +53597,7 @@ const make$38 = (name, options) => {
53108
53597
  successSchema,
53109
53598
  failureSchema,
53110
53599
  failureMode: options?.failureMode ?? "error",
53111
- annotations: empty$14(),
53600
+ annotations: empty$15(),
53112
53601
  needsApproval: options?.needsApproval,
53113
53602
  toModelOutput: options?.toModelOutput
53114
53603
  });
@@ -53505,7 +53994,7 @@ const FailureOrigin = /*#__PURE__*/ Reference("effect/ai/Toolkit/FailureOrigin",
53505
53994
  * @since 4.1.0
53506
53995
  */
53507
53996
  const PreliminaryBuffer = /*#__PURE__*/ Reference("effect/ai/Toolkit/PreliminaryBuffer", { defaultValue: () => "unbounded" });
53508
- const failureCause = (error, origin) => annotate$2(fail$10(error), make$80(FailureOrigin, origin));
53997
+ const failureCause = (error, origin) => annotate$2(fail$10(error), make$81(FailureOrigin, origin));
53509
53998
  const failureOrigin = (error) => isSchemaError(error) ? "result" : "handler";
53510
53999
  const Proto$10 = {
53511
54000
  .../*#__PURE__*/ Prototype({
@@ -53611,7 +54100,7 @@ const Proto$10 = {
53611
54100
  reason: error
53612
54101
  }) : error;
53613
54102
  };
53614
- return fromQueue(queue).pipe(tool.failureMode === "error" ? catchCause((cause) => failCause(map$6(fromReasons(cause.reasons.map((reason) => isFailReason(reason) ? reason.annotate(make$80(FailureOrigin, failureOrigin(reason.error)), { overwrite: true }) : reason)), normalizeError))) : catch_((error) => succeed$2({
54103
+ return fromQueue(queue).pipe(tool.failureMode === "error" ? catchCause((cause) => failCause(map$6(fromReasons(cause.reasons.map((reason) => isFailReason(reason) ? reason.annotate(make$81(FailureOrigin, failureOrigin(reason.error)), { overwrite: true }) : reason)), normalizeError))) : catch_((error) => succeed$2({
53615
54104
  result: normalizeError(error),
53616
54105
  isFailure: true,
53617
54106
  failureOrigin: failureOrigin(error),
@@ -54486,7 +54975,7 @@ function makeWith$1(method, url, urlParams, hash, headers, body) {
54486
54975
  * @category constructors
54487
54976
  * @since 4.0.0
54488
54977
  */
54489
- const empty$1 = /*#__PURE__*/ makeWith$1("GET", "", empty$5, /*#__PURE__*/ none(), empty$6, empty$2);
54978
+ const empty$1 = /*#__PURE__*/ makeWith$1("GET", "", empty$6, /*#__PURE__*/ none(), empty$7, empty$2);
54490
54979
  /**
54491
54980
  * Creates a request constructor for the specified HTTP method.
54492
54981
  *
@@ -55469,7 +55958,7 @@ var InterruptibleResponse = class {
55469
55958
  [TypeId$16] = TypeId$16;
55470
55959
  [TypeId$17] = TypeId$17;
55471
55960
  applyInterrupt(effect) {
55472
- return suspend$2(() => {
55961
+ return suspend$3(() => {
55473
55962
  responseRegistry.unregister(this.original);
55474
55963
  return onInterrupt(effect, () => sync(() => {
55475
55964
  this.controller.abort();
@@ -56112,7 +56601,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
56112
56601
  upgrade: SocketUpgradeError.unsupported
56113
56602
  };
56114
56603
  }).pipe(updateContext((input) => merge$5(acquireContext, input)));
56115
- const write = (chunk) => suspend$2(() => {
56604
+ const write = (chunk) => suspend$3(() => {
56116
56605
  const ws = currentWS;
56117
56606
  if (ws === void 0) return latch.whenOpen(write(chunk));
56118
56607
  try {
@@ -56123,7 +56612,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
56123
56612
  return fail$7(new SocketError({ reason: new SocketWriteError({ cause }) }));
56124
56613
  }
56125
56614
  });
56126
- const writeAll = (chunks) => suspend$2(() => {
56615
+ const writeAll = (chunks) => suspend$3(() => {
56127
56616
  const ws = currentWS;
56128
56617
  if (ws === void 0) return latch.whenOpen(writeAll(chunks));
56129
56618
  try {
@@ -56333,7 +56822,7 @@ function Stream(success, error) {
56333
56822
  * @since 4.0.0
56334
56823
  */
56335
56824
  var ClientAbort$1 = class extends (/*#__PURE__*/ Service$1()("effect/rpc/RpcSchema/ClientAbort")) {
56336
- static annotation = /*#__PURE__*/ this.context(true).pipe(/*#__PURE__*/ add$1(StackTrace, {
56825
+ static annotation = /*#__PURE__*/ this.context(true).pipe(/*#__PURE__*/ add$2(StackTrace, {
56337
56826
  name: "ClientAbort",
56338
56827
  stack: constUndefined,
56339
56828
  parent: void 0
@@ -56363,10 +56852,10 @@ var ServerClient = class {
56363
56852
  annotations;
56364
56853
  constructor(id) {
56365
56854
  this.id = id;
56366
- this.annotations = empty$14();
56855
+ this.annotations = empty$15();
56367
56856
  }
56368
56857
  annotate(tag, value) {
56369
- this.annotations = add$1(this.annotations, tag, value);
56858
+ this.annotations = add$2(this.annotations, tag, value);
56370
56859
  return this;
56371
56860
  }
56372
56861
  };
@@ -56438,7 +56927,7 @@ const Proto$6 = {
56438
56927
  errorSchema: this.errorSchema,
56439
56928
  defectSchema: this.defectSchema,
56440
56929
  middlewares: this.middlewares,
56441
- annotations: add$1(this.annotations, tag, value)
56930
+ annotations: add$2(this.annotations, tag, value)
56442
56931
  });
56443
56932
  },
56444
56933
  annotateMerge(context) {
@@ -56491,7 +56980,7 @@ const make$31 = (tag, options) => {
56491
56980
  successSchema: options?.stream ? Stream(successSchema, errorSchema) : successSchema,
56492
56981
  errorSchema: options?.stream ? Never : errorSchema,
56493
56982
  defectSchema,
56494
- annotations: empty$14(),
56983
+ annotations: empty$15(),
56495
56984
  middlewares: /* @__PURE__ */ new Set()
56496
56985
  });
56497
56986
  };
@@ -57049,7 +57538,7 @@ function makeParser$1(layout, mode, parseOptions, maxFrameSize, decodeEncoded, d
57049
57538
  release();
57050
57539
  if (input !== void 0) return failSync("complete value", input);
57051
57540
  },
57052
- feed: (chunk) => suspend$2(() => {
57541
+ feed: (chunk) => suspend$3(() => {
57053
57542
  try {
57054
57543
  return succeed$5(self.feedSync(chunk));
57055
57544
  } catch (e) {
@@ -57057,7 +57546,7 @@ function makeParser$1(layout, mode, parseOptions, maxFrameSize, decodeEncoded, d
57057
57546
  throw e;
57058
57547
  }
57059
57548
  }),
57060
- end: suspend$2(() => {
57549
+ end: suspend$3(() => {
57061
57550
  try {
57062
57551
  self.endSync();
57063
57552
  return void_$1;
@@ -60834,7 +61323,7 @@ const layerSchemaBinary = (options) => sync$1(RpcSerialization)(() => makeSchema
60834
61323
  * @category services
60835
61324
  * @since 4.0.0
60836
61325
  */
60837
- const withRun = () => (f) => suspend$2(() => {
61326
+ const withRun = () => (f) => suspend$3(() => {
60838
61327
  const semaphore = makeUnsafe$5(1);
60839
61328
  let buffer = [];
60840
61329
  let write = (...args) => contextWith((context) => {
@@ -60846,7 +61335,7 @@ const withRun = () => (f) => suspend$2(() => {
60846
61335
  run(f) {
60847
61336
  return semaphore.withPermits(1)(gen(function* () {
60848
61337
  const prev = write;
60849
- for (const [args, context] of buffer) yield* provideContext$2(suspend$2(() => f(...args)), context);
61338
+ for (const [args, context] of buffer) yield* provideContext$2(suspend$3(() => f(...args)), context);
60850
61339
  buffer = [];
60851
61340
  write = f;
60852
61341
  return yield* onExit$1(never$1, () => {
@@ -60866,7 +61355,7 @@ const withRun = () => (f) => suspend$2(() => {
60866
61355
  * @category services
60867
61356
  * @since 4.0.0
60868
61357
  */
60869
- const withRunClient = (f) => suspend$2(() => {
61358
+ const withRunClient = (f) => suspend$3(() => {
60870
61359
  const clientIds = /* @__PURE__ */ new Set();
60871
61360
  const clientBuffers = /* @__PURE__ */ new Map();
60872
61361
  const clientWrites = /* @__PURE__ */ new Map();
@@ -60892,7 +61381,7 @@ const withRunClient = (f) => suspend$2(() => {
60892
61381
  const buffer = clientBuffers.get(clientId);
60893
61382
  if (buffer) {
60894
61383
  clientBuffers.delete(clientId);
60895
- for (const [args, context] of buffer) yield* provideContext$2(suspend$2(() => f(args)), context);
61384
+ for (const [args, context] of buffer) yield* provideContext$2(suspend$3(() => f(args)), context);
60896
61385
  }
60897
61386
  return yield* onExit$1(never$1, () => {
60898
61387
  clientIds.delete(clientId);
@@ -60937,8 +61426,8 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
60937
61426
  const isStream = isStreamSchema(rpc.successSchema);
60938
61427
  const middleware = getRpcClientMiddleware(rpc);
60939
61428
  return (payload, opts) => {
60940
- const headers = opts?.headers ? fromInput$1(opts.headers) : empty$6;
60941
- const context = opts?.context ?? empty$14();
61429
+ const headers = opts?.headers ? fromInput$1(opts.headers) : empty$7;
61430
+ const context = opts?.context ?? empty$15();
60942
61431
  if (!isStream) {
60943
61432
  const onRequest = (span) => onEffectRequest(rpc, middleware, span, rpc.payloadSchema.make(payload), headers, context, opts?.discard ?? false);
60944
61433
  return disableTracing ? onRequest(void 0) : useSpan(spanName(spanPrefix, rpc._tag), {
@@ -61163,7 +61652,7 @@ const make$30 = /*#__PURE__*/ fnUntraced(function* (group, options) {
61163
61652
  const fiber = getCurrent();
61164
61653
  const entry = {
61165
61654
  rpc,
61166
- context: collector ? add$1(fiber.context, Collector, collector) : fiber.context,
61655
+ context: collector ? add$2(fiber.context, Collector, collector) : fiber.context,
61167
61656
  schemas: rpcSchemas(rpc),
61168
61657
  discard: message.discard === true
61169
61658
  };
@@ -61293,7 +61782,7 @@ const makeRpcSchemas = (codecFor) => {
61293
61782
  * @category services
61294
61783
  * @since 4.0.0
61295
61784
  */
61296
- const CurrentHeaders = /*#__PURE__*/ Reference("effect/rpc/RpcClient/CurrentHeaders", { defaultValue: () => empty$6 });
61785
+ const CurrentHeaders = /*#__PURE__*/ Reference("effect/rpc/RpcClient/CurrentHeaders", { defaultValue: () => empty$7 });
61297
61786
  /**
61298
61787
  * Defines the service interface for an RPC client transport, responsible for running the
61299
61788
  * receive loop and sending encoded client messages.
@@ -61348,7 +61837,7 @@ const makeProtocolSocket = (options) => Protocol$1.make(fnUntraced(function* (wr
61348
61837
  const requestClientMap = /* @__PURE__ */ new Map();
61349
61838
  const writer = yield* socket.writer;
61350
61839
  let parser = serialization.makeUnsafe();
61351
- const pinger = yield* makePinger(suspend$2(() => writer.write(parser.encode(constPing))), options);
61840
+ const pinger = yield* makePinger(suspend$3(() => writer.write(parser.encode(constPing))), options);
61352
61841
  const onPingTimeout = ignoreCause(options?.onPingTimeout ?? void_$1, {
61353
61842
  log: true,
61354
61843
  message: "RpcClient onPingTimeout hook failed"
@@ -61400,7 +61889,7 @@ const makeProtocolSocket = (options) => Protocol$1.make(fnUntraced(function* (wr
61400
61889
  });
61401
61890
  }
61402
61891
  };
61403
- yield* suspend$2(() => {
61892
+ yield* suspend$3(() => {
61404
61893
  parser = serialization.makeUnsafe();
61405
61894
  pinger.reset();
61406
61895
  let connected = false;
@@ -61430,7 +61919,7 @@ const makeProtocolSocket = (options) => Protocol$1.make(fnUntraced(function* (wr
61430
61919
  module: "RpcClient",
61431
61920
  method: "makeProtocolSocket"
61432
61921
  }), forkScoped);
61433
- const write = (request) => suspend$2(() => {
61922
+ const write = (request) => suspend$3(() => {
61434
61923
  const encoded = parser.encode(request);
61435
61924
  return encoded === void 0 ? void_$1 : orDie$2(writer.write(encoded));
61436
61925
  });
@@ -61463,7 +61952,7 @@ const makePinger = /*#__PURE__*/ fnUntraced(function* (writePing, options) {
61463
61952
  onFrame();
61464
61953
  latch.closeUnsafe();
61465
61954
  };
61466
- yield* suspend$2(() => {
61955
+ yield* suspend$3(() => {
61467
61956
  if (awaitingResponse && clock.currentTimeMillisUnsafe() - lastSeen > timeoutMillis) return latch.open;
61468
61957
  awaitingResponse = true;
61469
61958
  return writePing;
@@ -61602,11 +62091,11 @@ const RpcGroupProto = {
61602
62091
  annotate(service, value) {
61603
62092
  return makeProto({
61604
62093
  requests: this.requests,
61605
- annotations: add$1(this.annotations, service, value)
62094
+ annotations: add$2(this.annotations, service, value)
61606
62095
  });
61607
62096
  },
61608
62097
  annotateRpcs(service, value) {
61609
- return this.annotateRpcsMerge(make$80(service, value));
62098
+ return this.annotateRpcsMerge(make$81(service, value));
61610
62099
  },
61611
62100
  annotateMerge(context) {
61612
62101
  return makeProto({
@@ -61636,7 +62125,7 @@ const makeProto = (options) => Object.assign(function() {}, RpcGroupProto, {
61636
62125
  */
61637
62126
  const make$29 = (...rpcs) => makeProto({
61638
62127
  requests: new Map(rpcs.map((rpc) => [rpc._tag, rpc])),
61639
- annotations: empty$14()
62128
+ annotations: empty$15()
61640
62129
  });
61641
62130
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/rpc/RpcMiddleware.js
61642
62131
  /**
@@ -61688,6 +62177,20 @@ const Service = () => (id, options) => {
61688
62177
  ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
61689
62178
  return ServiceClass;
61690
62179
  };
62180
+ /**
62181
+ * Provides the client-side implementation for an RPC middleware service,
62182
+ * capturing the layer's environment and merging it into each middleware
62183
+ * invocation.
62184
+ *
62185
+ * @stability unstable
62186
+ * @category layers
62187
+ * @since 4.0.0
62188
+ */
62189
+ const layerClient = (tag, service) => effectContext(gen(function* () {
62190
+ const services = (yield* context()).pipe(omit$2(Scope));
62191
+ const middleware = isEffect(service) ? yield* service : service;
62192
+ return makeUnsafe$9(/* @__PURE__ */ new Map([[`${tag.key}/Client`, (options) => updateContext(middleware(options), (requestContext) => merge$5(services, requestContext))]]));
62193
+ }));
61691
62194
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/ai/McpSchema.js
61692
62195
  /**
61693
62196
  * Defines schemas for Model Context Protocol messages.
@@ -63767,7 +64270,7 @@ const make$28 = /*#__PURE__*/ sync(() => {
63767
64270
  const registration = registrations.get(name);
63768
64271
  return registration !== void 0 && registration.isVisible(profile) ? registration.descriptor : void 0;
63769
64272
  },
63770
- call: (call, invocation) => suspend$2(() => {
64273
+ call: (call, invocation) => suspend$3(() => {
63771
64274
  const registration = registrations.get(call.name);
63772
64275
  if (registration === void 0) return new ToolNotFound({ name: call.name });
63773
64276
  if (!registration.isVisible(invocation.protocol)) return new ToolNotFound({ name: call.name });
@@ -63826,7 +64329,7 @@ const make$28 = /*#__PURE__*/ sync(() => {
63826
64329
  })
63827
64330
  },
63828
64331
  skills: {
63829
- register: (registration) => suspend$2(() => {
64332
+ register: (registration) => suspend$3(() => {
63830
64333
  const { uri, resources } = registration.entry;
63831
64334
  const fail = (reason) => fail$7(new IllegalArgumentError(`Skill ${uri}: ${reason}`));
63832
64335
  for (const other of skillRegistrations.keys()) if (skillsOverlap(uri, other)) return fail(`its directory overlaps the skill ${other}`);
@@ -63842,7 +64345,7 @@ const make$28 = /*#__PURE__*/ sync(() => {
63842
64345
  isVisible: registration.isVisible,
63843
64346
  visible: registration.visible
63844
64347
  })), invocation),
63845
- get: (uri, invocation) => suspend$2(() => {
64348
+ get: (uri, invocation) => suspend$3(() => {
63846
64349
  const registration = skillRegistrations.get(uri);
63847
64350
  return registration !== void 0 && registration.isVisible(invocation.protocol) ? registration.get(invocation) : fail$7(new SkillNotFound({ uri }));
63848
64351
  }),
@@ -67043,7 +67546,7 @@ const layerWeak = /*#__PURE__*/ succeed$6(Generator)({
67043
67546
  }
67044
67547
  });
67045
67548
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/internal/headers.js
67046
- const Proto$5 = /*#__PURE__*/ Object.getPrototypeOf(empty$6);
67549
+ const Proto$5 = /*#__PURE__*/ Object.getPrototypeOf(empty$7);
67047
67550
  /**
67048
67551
  * @internal
67049
67552
  */
@@ -67093,7 +67596,7 @@ const redirect = (location, options) => {
67093
67596
  status: options?.status ?? 302,
67094
67597
  statusText: options?.statusText,
67095
67598
  headers: options?.headers ? merge$3(headers, fromInput$1(options.headers)) : headers,
67096
- cookies: options?.cookies ?? empty$7
67599
+ cookies: options?.cookies ?? empty$8
67097
67600
  });
67098
67601
  };
67099
67602
  /**
@@ -67104,12 +67607,12 @@ const redirect = (location, options) => {
67104
67607
  * @since 4.0.0
67105
67608
  */
67106
67609
  const uint8Array = (body, options) => {
67107
- const headers = options?.headers ? fromInput$1(options.headers) : empty$6;
67610
+ const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
67108
67611
  return makeResponse({
67109
67612
  status: options?.status ?? 200,
67110
67613
  statusText: options?.statusText,
67111
67614
  headers,
67112
- cookies: options?.cookies ?? empty$7,
67615
+ cookies: options?.cookies ?? empty$8,
67113
67616
  body: uint8Array$1(body, getContentType(options, headers))
67114
67617
  });
67115
67618
  };
@@ -67125,12 +67628,12 @@ const getContentType = (options, headers) => {
67125
67628
  * @since 4.0.0
67126
67629
  */
67127
67630
  const text = (body, options) => {
67128
- const headers = options?.headers ? fromInput$1(options.headers) : empty$6;
67631
+ const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
67129
67632
  return makeResponse({
67130
67633
  status: options?.status ?? 200,
67131
67634
  statusText: options?.statusText,
67132
67635
  headers,
67133
- cookies: options?.cookies ?? empty$7,
67636
+ cookies: options?.cookies ?? empty$8,
67134
67637
  body: text$1(body, getContentType(options, headers))
67135
67638
  });
67136
67639
  };
@@ -67150,7 +67653,7 @@ const text = (body, options) => {
67150
67653
  const schemaJson = (schema, options) => {
67151
67654
  const encode = jsonSchema(schema, options);
67152
67655
  return (body, options) => {
67153
- const headers = options?.headers ? fromInput$1(options.headers) : empty$6;
67656
+ const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
67154
67657
  return map$5(encode(body, getContentType(options, headers)), (body) => makeResponse({
67155
67658
  status: options?.status ?? 200,
67156
67659
  statusText: options?.statusText,
@@ -67178,7 +67681,7 @@ const schemaJson = (schema, options) => {
67178
67681
  * @since 4.0.0
67179
67682
  */
67180
67683
  const jsonUnsafe = (body, options) => {
67181
- const headers = options?.headers ? fromInput$1(options.headers) : empty$6;
67684
+ const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
67182
67685
  return makeResponse({
67183
67686
  status: options?.status ?? 200,
67184
67687
  statusText: options?.statusText,
@@ -67223,7 +67726,7 @@ const raw = (body, options) => makeResponse({
67223
67726
  * @since 4.0.0
67224
67727
  */
67225
67728
  const stream$1 = (body, options) => {
67226
- const headers = options?.headers ? fromInput$1(options.headers) : empty$6;
67729
+ const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
67227
67730
  return makeResponse({
67228
67731
  status: options?.status ?? 200,
67229
67732
  statusText: options?.statusText,
@@ -67353,15 +67856,15 @@ const makeResponse = (options, ownedHeaders) => {
67353
67856
  const self = Object.create(Proto$4);
67354
67857
  self.status = options.status;
67355
67858
  self.statusText = options.statusText;
67356
- self.cookies = options.cookies ?? empty$7;
67859
+ self.cookies = options.cookies ?? empty$8;
67357
67860
  self.body = options.body ?? empty$2;
67358
67861
  if (self.body._tag !== "Empty" && (self.body.contentType || self.body.contentLength !== void 0)) {
67359
67862
  const owned = ownedHeaders !== void 0;
67360
- const newHeaders = owned ? ownedHeaders : options.headers === void 0 || options.headers === empty$6 ? emptyMutableUnsafe() : fromRecordUnsafe({ ...options.headers });
67863
+ const newHeaders = owned ? ownedHeaders : options.headers === void 0 || options.headers === empty$7 ? emptyMutableUnsafe() : fromRecordUnsafe({ ...options.headers });
67361
67864
  if (self.body.contentType && (!owned || newHeaders["content-type"] === void 0)) newHeaders["content-type"] = self.body.contentType;
67362
67865
  if (self.body.contentLength !== void 0 && (!owned || newHeaders["content-length"] === void 0)) newHeaders["content-length"] = self.body.contentLength.toString();
67363
67866
  self.headers = newHeaders;
67364
- } else self.headers = ownedHeaders ?? options.headers ?? empty$6;
67867
+ } else self.headers = ownedHeaders ?? options.headers ?? empty$7;
67365
67868
  return self;
67366
67869
  };
67367
67870
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/internal/compression.js
@@ -67453,7 +67956,7 @@ const make$26 = /*#__PURE__*/ fnUntraced(function* (impl) {
67453
67956
  });
67454
67957
  });
67455
67958
  const optionHeaders = (options) => {
67456
- const headers = options?.headers ? fromInput$1(options.headers) : empty$6;
67959
+ const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
67457
67960
  return options?.contentType ? set$3(headers, "content-type", options.contentType) : headers;
67458
67961
  };
67459
67962
  const fileResponseSize = (input, field) => {
@@ -67738,7 +68241,7 @@ var ServeError = class extends (/*#__PURE__*/ TaggedError$1("ServeError")) {};
67738
68241
  * @since 4.0.0
67739
68242
  */
67740
68243
  var ClientAbort = class extends (/*#__PURE__*/ Service$1()("effect/http/HttpServerError/ClientAbort")) {
67741
- static annotation = /*#__PURE__*/ this.context(true).pipe(/*#__PURE__*/ add$1(StackTrace, {
68244
+ static annotation = /*#__PURE__*/ this.context(true).pipe(/*#__PURE__*/ add$2(StackTrace, {
67742
68245
  name: "ClientAbort",
67743
68246
  stack: constUndefined,
67744
68247
  parent: void 0
@@ -68973,7 +69476,7 @@ const tracer = /*#__PURE__*/ make$21((httpApp) => withFiber((fiber) => {
68973
69476
  kind: "server"
68974
69477
  });
68975
69478
  const prevServices = fiber.context;
68976
- fiber.setContext(add$1(fiber.context, ParentSpan, span));
69479
+ fiber.setContext(add$2(fiber.context, ParentSpan, span));
68977
69480
  onExitUnsafe(fiber, (exit) => {
68978
69481
  fiber.setContext(prevServices);
68979
69482
  const endTime = fiber.getRef(Clock).currentTimeNanosUnsafe();
@@ -69109,7 +69612,7 @@ const toHandled = (self, handleResponse, middleware) => {
69109
69612
  fiberEnterUninterruptibleUnsafe(fiber);
69110
69613
  const scope = makeUnsafe$7();
69111
69614
  const frame = new RequestFrame(scope, fiber.context, getUnsafe$1(fiber.context, HttpServerRequest));
69112
- fiber.setContext(add$1(add$1(frame.prev, Scope, scope), CurrentRequestState, frame));
69615
+ fiber.setContext(add$2(add$2(frame.prev, Scope, scope), CurrentRequestState, frame));
69113
69616
  const currentTracer = fiber.cache.tracer;
69114
69617
  if (middleware === void 0 && (currentTracer === void 0 || currentTracer === nativeTracer || isTracerDisabledUnsafe(fiber, frame.request))) {
69115
69618
  fiber._stack.push(frame);
@@ -69508,7 +70011,7 @@ const make$18 = /*#__PURE__*/ fnUntraced(function* (protocols) {
69508
70011
  },
69509
70012
  effectLogLevel: (clientId, headers, fallback) => stateful?.effectLogLevel(clientId, headers, fallback) ?? fallback,
69510
70013
  disconnect: (clientId) => stateful?.disconnect(clientId),
69511
- terminateHttpSession: (headers) => suspend$2(() => {
70014
+ terminateHttpSession: (headers) => suspend$3(() => {
69512
70015
  const sessionId = headers[MCP_SESSION_ID_HEADER$1];
69513
70016
  if (sessionId === void 0) return succeed$5(empty({ status: 400 }));
69514
70017
  const selection = selectHttpSession(headers, false);
@@ -70337,7 +70840,7 @@ const makeHandlers = (core, _lifecycle, context) => {
70337
70840
  };
70338
70841
  if (!(yield* offer(pending, projected))) break;
70339
70842
  }
70340
- }).pipe(use$1(eventsScope), andThen(suspend$2(() => context.markSubscriptionCancelled?.(client.id, requestId) ?? void_$1)), andThen(succeed$7(overflowed, void 0)), forkScoped);
70843
+ }).pipe(use$1(eventsScope), andThen(suspend$3(() => context.markSubscriptionCancelled?.(client.id, requestId) ?? void_$1)), andThen(succeed$7(overflowed, void 0)), forkScoped);
70341
70844
  yield* sendNotification(protocolVersion, client.id, {
70342
70845
  tag: SubscriptionsAcknowledgedNotification._tag,
70343
70846
  payload: SubscriptionsAcknowledgedNotification.payloadSchema.make({
@@ -71506,9 +72009,9 @@ const make$14 = /*#__PURE__*/ gen(function* () {
71506
72009
  description: `path parameter is longer than maxParamLength (${paramLimit})`
71507
72010
  }) }));
71508
72011
  const { route, prefixSegments } = result.handler;
71509
- if (prefixSegments !== void 0) context = add$1(context, HttpServerRequest, sliceRequestUrl(request, prefixSegments, ignoreDuplicateSlashes));
71510
- context = add$1(context, ParsedSearchParams, result.searchParams);
71511
- context = add$1(context, RouteContext, {
72012
+ if (prefixSegments !== void 0) context = add$2(context, HttpServerRequest, sliceRequestUrl(request, prefixSegments, ignoreDuplicateSlashes));
72013
+ context = add$2(context, ParsedSearchParams, result.searchParams);
72014
+ context = add$2(context, RouteContext, {
71512
72015
  route,
71513
72016
  params: result.params
71514
72017
  });
@@ -71813,7 +72316,7 @@ const middlewareCache = /*#__PURE__*/ new WeakMap();
71813
72316
  const getMiddleware$1 = (context) => {
71814
72317
  let arr = middlewareCache.get(context);
71815
72318
  if (arr) return arr;
71816
- const topLevel = empty$11();
72319
+ const topLevel = empty$12();
71817
72320
  let maxLength = 0;
71818
72321
  for (const [key, value] of context.mapUnsafe) if (key.startsWith("effect/http/HttpRouter/Middleware-")) {
71819
72322
  topLevel.push(value);
@@ -71823,7 +72326,7 @@ const getMiddleware$1 = (context) => {
71823
72326
  else {
71824
72327
  const middleware = /* @__PURE__ */ new Set();
71825
72328
  for (let i = maxLength - 1; i >= 0; i--) for (const arr of topLevel) if (i < arr.length) middleware.add(arr[i]);
71826
- arr = fromIterable$7(middleware).reverse();
72329
+ arr = fromIterable$8(middleware).reverse();
71827
72330
  }
71828
72331
  middlewareCache.set(context, arr);
71829
72332
  return arr;
@@ -72008,7 +72511,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
72008
72511
  let handler = isStream && !constructionFailed ? streamEffect(client, request, streamOrEffect, (cause) => {
72009
72512
  writeFailure = cause;
72010
72513
  }) : streamOrEffect;
72011
- if (isDiscard && !constructionFailed) handler = andThen(suspend$2(() => {
72514
+ if (isDiscard && !constructionFailed) handler = andThen(suspend$3(() => {
72012
72515
  const ack = respond(void_$2);
72013
72516
  acknowledged = true;
72014
72517
  return ack;
@@ -72051,7 +72554,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
72051
72554
  });
72052
72555
  }
72053
72556
  if (!isFork && concurrencySemaphore) effect = concurrencySemaphore.withPermit(effect);
72054
- const runFork = runForkWith(add$1(handlerContext(entry, requestFiber.context), Scope, scope));
72557
+ const runFork = runForkWith(add$2(handlerContext(entry, requestFiber.context), Scope, scope));
72055
72558
  trackFiber(runFork(withFiber((fiber) => {
72056
72559
  client.fibers.set(request.id, fiber);
72057
72560
  return effect;
@@ -72110,7 +72613,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
72110
72613
  return andThen(write, latch.await);
72111
72614
  });
72112
72615
  };
72113
- const sendDefect = (client, defect) => suspend$2(() => {
72616
+ const sendDefect = (client, defect) => suspend$3(() => {
72114
72617
  const shouldEnd = client.ended && client.fibers.size === 0;
72115
72618
  const write = options.onFromServer({
72116
72619
  _tag: "Defect",
@@ -72224,7 +72727,7 @@ const make$13 = /*#__PURE__*/ fnUntraced(function* (group, options) {
72224
72727
  }
72225
72728
  }).pipe(provide$3(scope));
72226
72729
  const onDisconnect = options?.onDisconnect;
72227
- const handleDisconnect = onDisconnect ? (clientId) => andThen(server.disconnect(clientId), ignoreCause(suspend$2(() => onDisconnect(clientId)), {
72730
+ const handleDisconnect = onDisconnect ? (clientId) => andThen(server.disconnect(clientId), ignoreCause(suspend$3(() => onDisconnect(clientId)), {
72228
72731
  log: "Unhandled",
72229
72732
  message: "RpcServer onDisconnect hook failed"
72230
72733
  }).pipe(forkIn(scope))) : server.disconnect;
@@ -72778,7 +73281,7 @@ const getMiddleware = (context) => {
72778
73281
  };
72779
73282
  const isMcpError = (error) => hasProperty(error, "code") && typeof error.code === "number" && hasProperty(error, "message") && typeof error.message === "string";
72780
73283
  const HandlerFailure = /*#__PURE__*/ Reference("effect/ai/McpServer/HandlerFailure", { defaultValue: () => false });
72781
- const handlerFailure = /*#__PURE__*/ make$80(HandlerFailure, true);
73284
+ const handlerFailure = /*#__PURE__*/ make$81(HandlerFailure, true);
72782
73285
  const internalError = /*#__PURE__*/ new InternalError$1({ message: "Internal error" });
72783
73286
  const rejectWith = (error) => fail$7(new RequestRejected({
72784
73287
  code: error.code,
@@ -72808,7 +73311,7 @@ const middlewareStack = (localMiddleware, globalMiddleware) => {
72808
73311
  };
72809
73312
  const runMiddleware = (handler, middleware, invocation, request) => {
72810
73313
  const effect = middleware.length === 0 ? handler : withFiber((fiber) => {
72811
- const headers = getOrUndefined(fiber.context, HttpServerRequest)?.headers ?? empty$6;
73314
+ const headers = getOrUndefined(fiber.context, HttpServerRequest)?.headers ?? empty$7;
72812
73315
  const options = {
72813
73316
  ...request,
72814
73317
  requestContext: invocation.requestContext,
@@ -72831,7 +73334,7 @@ const runMiddleware = (handler, middleware, invocation, request) => {
72831
73334
  }));
72832
73335
  };
72833
73336
  const makeInvoke = (context, globalMiddleware) => {
72834
- const services = context === void 0 ? empty$14() : omitRequestServices(context);
73337
+ const services = context === void 0 ? empty$15() : omitRequestServices(context);
72835
73338
  const localMiddleware = context === void 0 ? [] : getMiddleware(context);
72836
73339
  const invoke = (handler, invocation, request) => runMiddleware(services.mapUnsafe.size === 0 ? handler : updateContext(handler, (context) => merge$5(services, context)), middlewareStack(localMiddleware, globalMiddleware), invocation, request).pipe(catchHidden(() => fail$7(notFound(request.method, request.target))));
72837
73340
  const visible = (method, target) => (invocation) => {
@@ -72880,7 +73383,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
72880
73383
  */
72881
73384
  static make = /*#__PURE__*/ gen(function* () {
72882
73385
  const internalCore = yield* make$28;
72883
- const tools = empty$11();
73386
+ const tools = empty$12();
72884
73387
  const resources = [];
72885
73388
  const resourceTemplates = [];
72886
73389
  const prompts = [];
@@ -72907,7 +73410,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
72907
73410
  requestContext: getOrUndefined(fiber.context, McpRequestContext),
72908
73411
  requestHeaders: getOrUndefined(fiber.context, HttpServerRequest)?.headers
72909
73412
  };
72910
- const acknowledge = suspend$2(() => notifications.write({
73413
+ const acknowledge = suspend$3(() => notifications.write({
72911
73414
  clientId: 0,
72912
73415
  requestId: message.id,
72913
73416
  _tag: "Exit",
@@ -72940,7 +73443,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
72940
73443
  return enqueued && queued.requestContext !== void 0 && notificationDelivery.consumers > 0 ? andThen(_await(delivered), acknowledge) : acknowledge;
72941
73444
  })))
72942
73445
  });
72943
- const addResource = (options, checkOwnership) => suspend$2(() => {
73446
+ const addResource = (options, checkOwnership) => suspend$3(() => {
72944
73447
  if (checkOwnership && internalCore.skills.ownsFile(options.resource.uri)) return die$2(new IllegalArgumentError(`Resource ${options.resource.uri} is a file of a registered skill`));
72945
73448
  const existingIndex = resources.findIndex(({ resource }) => resource.uri === options.resource.uri);
72946
73449
  if (existingIndex === -1) resources.push(options);
@@ -72964,7 +73467,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
72964
73467
  notification: ServerNotification.ElicitationComplete({ elicitationId }),
72965
73468
  targetClientId: clientId,
72966
73469
  delivered
72967
- }).pipe(andThen(suspend$2(() => notificationDelivery.consumers > 0 ? _await(delivered) : void_$1))))),
73470
+ }).pipe(andThen(suspend$3(() => notificationDelivery.consumers > 0 ? _await(delivered) : void_$1))))),
72968
73471
  get tools() {
72969
73472
  return tools;
72970
73473
  },
@@ -73210,7 +73713,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
73210
73713
  else reverseRequestClients.set(requestId, remaining);
73211
73714
  };
73212
73715
  const serverNotifications = yield* unbounded();
73213
- const sendNotification = (protocolVersion, clientId, notification) => suspend$2(() => {
73716
+ const sendNotification = (protocolVersion, clientId, notification) => suspend$3(() => {
73214
73717
  const selectedProtocol = runtime.selectProtocol(protocolVersion);
73215
73718
  const rpc = selectedProtocol.serverNotificationRpcs.requests.get(notification.tag);
73216
73719
  if (rpc === void 0) return die$2(`MCP protocol ${protocolVersion} does not define server notification ${notification.tag}`);
@@ -73234,7 +73737,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
73234
73737
  });
73235
73738
  return true;
73236
73739
  };
73237
- const terminateSubscription = (protocolVersion, clientId, requestId, reason) => suspend$2(() => {
73740
+ const terminateSubscription = (protocolVersion, clientId, requestId, reason) => suspend$3(() => {
73238
73741
  if (!cancelRequest(clientId, requestId)) return void_$1;
73239
73742
  return isHttp ? protocol.end(clientId) : sendNotification(protocolVersion, clientId, {
73240
73743
  tag: "notifications/cancelled",
@@ -73542,7 +74045,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
73542
74045
  const metadata = requestContext?.requestMetadata;
73543
74046
  const level = hasProperty(metadata, "io.modelcontextprotocol/logLevel") ? metadata["io.modelcontextprotocol/logLevel"] : void 0;
73544
74047
  if (requestContext?.clientId !== clientId || !isLoggingLevel(level) || LoggingLevel$2.literals.indexOf(notification.level) < LoggingLevel$2.literals.indexOf(level)) return;
73545
- } else if (!runtime.canDeliver(clientId, (requestContext?.clientId === clientId ? requestHeaders : void 0) ?? clientStates.get(clientId)?.sessionHeaders ?? empty$6, notification, defaultLogLevel, listChangeRevision)) return;
74048
+ } else if (!runtime.canDeliver(clientId, (requestContext?.clientId === clientId ? requestHeaders : void 0) ?? clientStates.get(clientId)?.sessionHeaders ?? empty$7, notification, defaultLogLevel, listChangeRevision)) return;
73546
74049
  const rpc = selectedProtocol.serverNotificationRpcs.requests.get(projected.tag);
73547
74050
  if (!rpc) return;
73548
74051
  const encoded = yield* selectedProtocol.payloadCodecs(rpc).encode(projected.payload);
@@ -73578,7 +74081,7 @@ const layerWithRuntime = (options, transport) => effectDiscard(gen(function* ()
73578
74081
  ...options,
73579
74082
  cacheHints
73580
74083
  }, runtime, transport));
73581
- })).pipe(provide$2(options.registrations ?? empty$10), provideMerge(McpServer.layer));
74084
+ })).pipe(provide$2(options.registrations ?? empty$11), provideMerge(McpServer.layer));
73582
74085
  /**
73583
74086
  * Registers a Streamable HTTP MCP endpoint at `options.path`.
73584
74087
  *
@@ -73683,7 +74186,7 @@ const addMcpHttpRoutes = /*#__PURE__*/ fnUntraced(function* (options, httpEffect
73683
74186
  if (admission.acknowledge) return yield* catchCause$2(map$5(httpEffect, toResponse), () => succeed$5(empty({ status: 202 })));
73684
74187
  return yield* flatMap$2(httpEffect, (response) => {
73685
74188
  if (response.body._tag !== "Uint8Array" || response.body.body.length > 0) return succeed$5(toResponse(response));
73686
- return httpPostResponses.get(request)?.expected === 0 ? succeed$5(stream$1(empty$3, { contentType: "text/event-stream" })) : die$2(/* @__PURE__ */ new Error("MCP request ended without writing its response"));
74189
+ return httpPostResponses.get(request)?.expected === 0 ? succeed$5(stream$1(empty$4, { contentType: "text/event-stream" })) : die$2(/* @__PURE__ */ new Error("MCP request ended without writing its response"));
73687
74190
  });
73688
74191
  });
73689
74192
  });
@@ -73902,7 +74405,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
73902
74405
  isError: false,
73903
74406
  content: []
73904
74407
  })) : successResult(result.encodedResult);
73905
- return result.failureOrigin === "handler" ? map$5(encodeReturnedFailure(result.encodedResult), failureResult) : failCause$3(annotate$2(fail$10(result.result), make$80(FailureOrigin, result.failureOrigin ?? "result")));
74408
+ return result.failureOrigin === "handler" ? map$5(encodeReturnedFailure(result.encodedResult), failureResult) : failCause$3(annotate$2(fail$10(result.result), make$81(FailureOrigin, result.failureOrigin ?? "result")));
73906
74409
  }), catchCause$2(handleCause));
73907
74410
  },
73908
74411
  services
@@ -74803,7 +75306,7 @@ const readableToPullUnsafe = (options) => {
74803
75306
  exit.current ??= fail$9(error ? options.onError(error) : Done());
74804
75307
  latch.openUnsafe();
74805
75308
  });
74806
- const pull = suspend$2(function loop() {
75309
+ const pull = suspend$3(function loop() {
74807
75310
  let item = options.readable.read(options.readSize);
74808
75311
  if (item === null) {
74809
75312
  if (exit.current) return exit.current;
@@ -74964,11 +75467,11 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
74964
75467
  const setupAdditionalFds = fnUntraced(function* (command, childProcess, additionalFds, inputFailure) {
74965
75468
  if (additionalFds.length === 0) return {
74966
75469
  getInputFd: () => drain$1,
74967
- getOutputFd: () => empty$3
75470
+ getOutputFd: () => empty$4
74968
75471
  };
74969
75472
  const inputSinks = /* @__PURE__ */ new Map();
74970
75473
  const outputStreams = /* @__PURE__ */ new Map();
74971
- const setupInput = (fd, nodeStream, stream) => suspend$2(() => {
75474
+ const setupInput = (fd, nodeStream, stream) => suspend$3(() => {
74972
75475
  let sink = drain$1;
74973
75476
  if (nodeStream && "write" in nodeStream) {
74974
75477
  handleInputErrors(nodeStream);
@@ -74984,7 +75487,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
74984
75487
  return void_$1;
74985
75488
  });
74986
75489
  const setupOutput = (fd, nodeStream, sink) => {
74987
- let stream = empty$3;
75490
+ let stream = empty$4;
74988
75491
  if (nodeStream && "read" in nodeStream) {
74989
75492
  const passThrough = new PassThrough();
74990
75493
  let error = void 0;
@@ -75019,10 +75522,10 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
75019
75522
  }
75020
75523
  return {
75021
75524
  getInputFd: (fd) => inputSinks.get(fd) ?? drain$1,
75022
- getOutputFd: (fd) => outputStreams.get(fd) ?? empty$3
75525
+ getOutputFd: (fd) => outputStreams.get(fd) ?? empty$4
75023
75526
  };
75024
75527
  });
75025
- const setupChildStdin = (command, childProcess, config, inputFailure) => suspend$2(() => {
75528
+ const setupChildStdin = (command, childProcess, config, inputFailure) => suspend$3(() => {
75026
75529
  let sink = drain$1;
75027
75530
  if (isNotNull(childProcess.stdin)) {
75028
75531
  handleInputErrors(childProcess.stdin);
@@ -75045,7 +75548,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
75045
75548
  evaluate: () => passThrough,
75046
75549
  onError: (error) => toPlatformError("fromReadable(stdout)", toError(error), command)
75047
75550
  });
75048
- })() : empty$3;
75551
+ })() : empty$4;
75049
75552
  let stderr = childProcess.stderr ? (() => {
75050
75553
  const passThrough = new PassThrough();
75051
75554
  childProcess.stderr.on("error", (error) => passThrough.destroy(error));
@@ -75054,7 +75557,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
75054
75557
  evaluate: () => passThrough,
75055
75558
  onError: (error) => toPlatformError("fromReadable(stderr)", toError(error), command)
75056
75559
  });
75057
- })() : empty$3;
75560
+ })() : empty$4;
75058
75561
  if (isSink(stdoutConfig.stream)) stdout = transduce(stdout, stdoutConfig.stream);
75059
75562
  if (isSink(stderrConfig.stream)) stderr = transduce(stderr, stderrConfig.stream);
75060
75563
  const all = merge$1(stdout, stderr);
@@ -75104,7 +75607,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
75104
75607
  globalThis.process.kill(-childProcess.pid, signal);
75105
75608
  } catch {}
75106
75609
  };
75107
- const killProcess = (command, childProcess, signal) => suspend$2(() => {
75610
+ const killProcess = (command, childProcess, signal) => suspend$3(() => {
75108
75611
  if (!childProcess.kill(signal)) {
75109
75612
  const error = new globalThis.Error("Failed to kill child process");
75110
75613
  return fail$7(toPlatformError("kill", error, command));
@@ -75486,7 +75989,7 @@ const fromDuplex = (open, options) => withFiber((fiber) => {
75486
75989
  if (waiter === resume) waiter = void 0;
75487
75990
  });
75488
75991
  });
75489
- const upgrade = (upgradeOptions = {}) => suspend$2(() => {
75992
+ const upgrade = (upgradeOptions = {}) => suspend$3(() => {
75490
75993
  if (!upgradeAvailable) return fail$7(new SocketError({ reason: new SocketUpgradeError({ cause: /* @__PURE__ */ new Error("socket is already upgraded or closed") }) }));
75491
75994
  const hasKey = upgradeOptions.key !== void 0;
75492
75995
  const hasCert = upgradeOptions.cert !== void 0;
@@ -75581,7 +76084,7 @@ const fromDuplex = (open, options) => withFiber((fiber) => {
75581
76084
  conn.on("close", onClose);
75582
76085
  return sync(cleanup);
75583
76086
  });
75584
- const write = (chunk) => suspend$2(() => {
76087
+ const write = (chunk) => suspend$3(() => {
75585
76088
  const conn = currentSocket;
75586
76089
  if (conn === void 0) return latch.whenOpen(write(chunk));
75587
76090
  if (isCloseEvent(chunk)) {
@@ -75594,7 +76097,7 @@ const fromDuplex = (open, options) => withFiber((fiber) => {
75594
76097
  return fail$7(new SocketError({ reason: new SocketWriteError({ cause }) }));
75595
76098
  }
75596
76099
  });
75597
- const writeAll = (chunks) => suspend$2(() => {
76100
+ const writeAll = (chunks) => suspend$3(() => {
75598
76101
  const conn = currentSocket;
75599
76102
  if (conn === void 0) return latch.whenOpen(writeAll(chunks));
75600
76103
  let needsDrain = false;
@@ -79291,7 +79794,7 @@ const webCryptoParams = (algorithm, options) => algorithm._tag === "Hkdf" ? {
79291
79794
  * @category layers
79292
79795
  * @since 4.0.0
79293
79796
  */
79294
- const layerWebCrypto = /*#__PURE__*/ effect(Kdf, /*#__PURE__*/ WebCrypto.use((crypto) => succeed$5(Kdf.of({ derive: (algorithm, secret, options) => suspend$2(() => {
79797
+ const layerWebCrypto = /*#__PURE__*/ effect(Kdf, /*#__PURE__*/ WebCrypto.use((crypto) => succeed$5(Kdf.of({ derive: (algorithm, secret, options) => suspend$3(() => {
79295
79798
  const failure = checkArguments(algorithm, options);
79296
79799
  if (failure !== void 0) return failure;
79297
79800
  if (algorithm._tag === "Argon2id") return fail$6("Kdf", "derive", new Unsupported({ description: "Kdf.layerWebCrypto does not provide argon2id" }));
@@ -79559,7 +80062,7 @@ const makeDirectory = /*#__PURE__*/ (() => {
79559
80062
  })();
79560
80063
  const makeTempDirectoryFactory = (method) => {
79561
80064
  const nodeMkdtemp = effectify(NFS.mkdtemp, handleErrnoException("FileSystem", method), handleBadArgument(method));
79562
- return (options) => suspend$2(() => {
80065
+ return (options) => suspend$3(() => {
79563
80066
  const prefix = options?.prefix ?? "";
79564
80067
  const directory = typeof options?.directory === "string" ? Path.join(options.directory, ".") : OS.tmpdir();
79565
80068
  return nodeMkdtemp(prefix ? Path.join(directory, prefix) : directory + "/");
@@ -79597,7 +80100,7 @@ const openFlagBits = (flag) => {
79597
80100
  case "ax+": return O_APPEND | O_CREAT | O_RDWR | O_EXCL;
79598
80101
  }
79599
80102
  };
79600
- const noFollowFlags = (method, flag) => suspend$2(() => {
80103
+ const noFollowFlags = (method, flag) => suspend$3(() => {
79601
80104
  const { O_NOFOLLOW } = NFS.constants;
79602
80105
  if (process.platform === "win32" || typeof O_NOFOLLOW !== "number" || O_NOFOLLOW === 0) return fail$7(badArgument({
79603
80106
  module: "FileSystem",
@@ -79644,7 +80147,7 @@ const makeFile = /*#__PURE__*/ (() => {
79644
80147
  return nodeSync(this.fd);
79645
80148
  }
79646
80149
  seek(offset, from) {
79647
- return suspend$2(() => {
80150
+ return suspend$3(() => {
79648
80151
  const position = from === "start" ? offset : this.position + offset;
79649
80152
  if (position < BigInt(0)) return fail$7(badArgument({
79650
80153
  module: "FileSystem",
@@ -79656,7 +80159,7 @@ const makeFile = /*#__PURE__*/ (() => {
79656
80159
  });
79657
80160
  }
79658
80161
  read(buffer, options) {
79659
- return suspend$2(() => {
80162
+ return suspend$3(() => {
79660
80163
  const explicit = options?.position;
79661
80164
  if (explicit !== void 0) return explicit < BigInt(0) ? fail$7(negativePosition("read")) : nodeRead(this.fd, {
79662
80165
  buffer,
@@ -79673,7 +80176,7 @@ const makeFile = /*#__PURE__*/ (() => {
79673
80176
  });
79674
80177
  }
79675
80178
  readAlloc(size, options) {
79676
- return suspend$2(() => {
80179
+ return suspend$3(() => {
79677
80180
  try {
79678
80181
  if (!Number.isInteger(size) || size < 0) throw new RangeError("size must be a non-negative integer");
79679
80182
  const explicit = options?.position;
@@ -79705,7 +80208,7 @@ const makeFile = /*#__PURE__*/ (() => {
79705
80208
  });
79706
80209
  }
79707
80210
  write(buffer) {
79708
- return suspend$2(() => {
80211
+ return suspend$3(() => {
79709
80212
  const position = this.position;
79710
80213
  return flatMap$2(this.append ? succeed$5(void 0) : positionToNumber(position, "write"), (nodePosition) => map$5(nodeWrite(this.fd, buffer, void 0, void 0, nodePosition), (bytesWritten) => {
79711
80214
  if (!this.append) this.position = position + BigInt(bytesWritten);
@@ -79714,7 +80217,7 @@ const makeFile = /*#__PURE__*/ (() => {
79714
80217
  });
79715
80218
  }
79716
80219
  writeAllChunk(buffer) {
79717
- return suspend$2(() => {
80220
+ return suspend$3(() => {
79718
80221
  const position = this.position;
79719
80222
  return flatMap$2(this.append ? succeed$5(void 0) : positionToNumber(position, "writeAll"), (nodePosition) => flatMap$2(nodeWriteAll(this.fd, buffer, void 0, void 0, nodePosition), (bytesWritten) => {
79720
80223
  if (bytesWritten === 0) return fail$7(systemError({
@@ -80256,7 +80759,7 @@ const layerWebSocket = /*#__PURE__*/ flow(makeWebSocket, /*#__PURE__*/ effect(So
80256
80759
  *
80257
80760
  * @internal
80258
80761
  */
80259
- const toSocket = (conn, open = void_$1) => fromDuplex(acquireRelease(suspend$2(() => conn.destroyed ? fail$7(openError("The upgraded connection closed before it was read")) : as(open, conn)), (conn) => sync(() => {
80762
+ const toSocket = (conn, open = void_$1) => fromDuplex(acquireRelease(suspend$3(() => conn.destroyed ? fail$7(openError("The upgraded connection closed before it was read")) : as(open, conn)), (conn) => sync(() => {
80260
80763
  if (conn.destroyed) return;
80261
80764
  if ("destroySoon" in conn) conn.destroySoon();
80262
80765
  else conn.destroy();
@@ -81029,7 +81532,7 @@ const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
81029
81532
  }
81030
81533
  return queue;
81031
81534
  });
81032
- const readLine = suspend$2(() => poll(lines).pipe(flatMap$2(match$8({
81535
+ const readLine = suspend$3(() => poll(lines).pipe(flatMap$2(match$8({
81033
81536
  onNone: () => scoped(andThen(get$2(rlRef), take$1(lines))),
81034
81537
  onSome: succeed$5
81035
81538
  })), mapError$2(() => new QuitError({}))));
@@ -81229,7 +81732,7 @@ const makeHandler = (httpEffect, options) => {
81229
81732
  const nodeRequest = request;
81230
81733
  const nodeResponse = response;
81231
81734
  if (nodeRequest.httpVersionMajor === 1) nodeResponse.prependListener("finish", () => teardownBody(nodeRequest, nodeResponse));
81232
- const context = add$1(services, HttpServerRequest, new ServerRequestImpl(nodeRequest, nodeResponse));
81735
+ const context = add$2(services, HttpServerRequest, new ServerRequestImpl(nodeRequest, nodeResponse));
81233
81736
  const fiber = runIn(runForkWith(context)(handled), options.scope);
81234
81737
  if (fiber.pollUnsafe() === void 0) nodeResponse.on("close", () => {
81235
81738
  if (!nodeResponse.writableEnded) fiber.interruptUnsafe(parent.id, ClientAbort.annotation);
@@ -81335,7 +81838,7 @@ const makeUpgradeHandler = (lazyWss, httpEffect, options) => {
81335
81838
  }
81336
81839
  };
81337
81840
  const request = new ServerRequestImpl(nodeRequest, nodeResponse, state);
81338
- const context = add$1(services, HttpServerRequest, request);
81841
+ const context = add$2(services, HttpServerRequest, request);
81339
81842
  const fiber = runIn(runForkWith(context)(handledApp), options.scope);
81340
81843
  socket.on("error", () => {});
81341
81844
  socket.on("close", () => {
@@ -81449,7 +81952,7 @@ var ServerRequestImpl = class ServerRequestImpl extends NodeHttpIncomingMessage
81449
81952
  });
81450
81953
  }
81451
81954
  get arrayBuffer() {
81452
- return suspend$2(() => {
81955
+ return suspend$3(() => {
81453
81956
  this.writeContinue();
81454
81957
  return super.arrayBuffer;
81455
81958
  });
@@ -81478,7 +81981,7 @@ var ServerRequestImpl = class ServerRequestImpl extends NodeHttpIncomingMessage
81478
81981
  multipartEffect;
81479
81982
  get multipart() {
81480
81983
  if (this.multipartEffect) return this.multipartEffect;
81481
- this.multipartEffect = runSync$1(cached(suspend$2(() => {
81984
+ this.multipartEffect = runSync$1(cached(suspend$3(() => {
81482
81985
  this.writeContinue();
81483
81986
  return persisted(this.bodySource, this.source.headers);
81484
81987
  })));
@@ -83233,7 +83736,7 @@ const proto = {
83233
83736
  }),
83234
83737
  [TypeId$3]: { _Output: (_) => _ }
83235
83738
  };
83236
- const runWithInput = (prompt, terminal, input) => suspend$2(() => {
83739
+ const runWithInput = (prompt, terminal, input) => suspend$3(() => {
83237
83740
  const op = prompt;
83238
83741
  switch (op._tag) {
83239
83742
  case "Loop": return flatMap$2(input, (queue) => runLoop(op, terminal, queue));
@@ -83568,7 +84071,7 @@ const makeDateParts = (dateMask, date, locales) => {
83568
84071
  if (element.isToken() && lastElement !== void 0 && lastElement.isToken()) lastElement.setValue(element.token);
83569
84072
  else array.push(element);
83570
84073
  return array;
83571
- }, empty$11());
84074
+ }, empty$12());
83572
84075
  parts.splice(0, parts.length, ...orderedParts);
83573
84076
  return parts;
83574
84077
  };
@@ -85657,7 +86160,7 @@ const makeCommand = (options) => {
85657
86160
  const config = options.config;
85658
86161
  const contextConfig = options.contextConfig ?? emptyConfig;
85659
86162
  const service = options.service ?? Service$1(`~effect/cli/Command/${options.name}`);
85660
- const annotations = options.annotations ?? empty$14();
86163
+ const annotations = options.annotations ?? empty$15();
85661
86164
  const globalFlags = options.globalFlags ?? [];
85662
86165
  const subcommands = options.subcommands ?? [];
85663
86166
  const resolveExamples = options.resolveExamples ?? noExamples;
@@ -89010,8 +89513,8 @@ const runWith = (command, config) => {
89010
89513
  program = provideService(program, flag, value);
89011
89514
  }
89012
89515
  const services = match$8(logLevel, {
89013
- onNone: () => empty$14(),
89014
- onSome: (level) => make$80(MinimumLogLevel, level)
89516
+ onNone: () => empty$15(),
89517
+ onSome: (level) => make$81(MinimumLogLevel, level)
89015
89518
  });
89016
89519
  yield* provideContext$2(program, services);
89017
89520
  }, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$10(error) : fail$12(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail$7(error))), catchFilter((error) => {
@@ -89384,7 +89887,12 @@ var AuthError = class extends TaggedError()("AuthError", {
89384
89887
  "temporarily_unavailable"
89385
89888
  ])),
89386
89889
  message: String$6
89387
- }) {};
89890
+ }) {
89891
+ get name() {
89892
+ if (this.error === "temporarily_unavailable") return "AuthUnavailable";
89893
+ return "AuthError";
89894
+ }
89895
+ };
89388
89896
  const User = Struct({
89389
89897
  id: NonEmptyString,
89390
89898
  name: NonEmptyString
@@ -89443,6 +89951,16 @@ const PackageMetadata = Struct({
89443
89951
  name: String$6,
89444
89952
  version: AppVersion
89445
89953
  });
89954
+ // ../../packages/runtime/src/rpc.ts
89955
+ var RpcStream = class extends Service()("@deslop/runtime/rpc/RpcStream") {};
89956
+ const layerRpcStream = succeed$6(RpcStream, RpcStream.of((effect, options) => {
89957
+ if (!isStreamSchema(options.rpc.successSchema)) return effect;
89958
+ return andThen(annotateCurrentSpan("rpc.stream", true), effect);
89959
+ }));
89960
+ const layerRpcStreamClient = layerClient(RpcStream, (options) => gen(function* () {
89961
+ if (isStreamSchema(options.rpc.successSchema)) yield* annotateCurrentSpan("rpc.stream", true);
89962
+ return yield* options.next(options.request);
89963
+ }));
89446
89964
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/observability/OtlpExporter.js
89447
89965
  /**
89448
89966
  * Shared batch exporter for OTLP/HTTP observability modules.
@@ -89506,7 +90024,7 @@ var Flusher = class extends (/*#__PURE__*/ Service$1()("effect/observability/Otl
89506
90024
  const layerFlusher = /*#__PURE__*/ sync$1(Flusher, () => {
89507
90025
  const registry = /* @__PURE__ */ new Set();
89508
90026
  return {
89509
- flush: suspend$2(() => {
90027
+ flush: suspend$3(() => {
89510
90028
  if (registry.size === 0) return void_$1;
89511
90029
  return forEach$1(registry, identity, {
89512
90030
  concurrency: "unbounded",
@@ -89566,7 +90084,7 @@ const make$3 = /*#__PURE__*/ fnUntraced(function* (options) {
89566
90084
  disabledUntil = void 0;
89567
90085
  return false;
89568
90086
  };
89569
- const runExport = suspend$2(() => {
90087
+ const runExport = suspend$3(() => {
89570
90088
  if (isDisabled() || buffer.length === 0 && !exportsEmpty) return void_$1;
89571
90089
  const items = buffer;
89572
90090
  buffer = [];
@@ -89584,7 +90102,7 @@ const make$3 = /*#__PURE__*/ fnUntraced(function* (options) {
89584
90102
  }));
89585
90103
  const exportFibers = yield* make$46();
89586
90104
  const runExportFork = yield* runtime$1(exportFibers)();
89587
- yield* addFinalizer$1(scope, suspend$2(() => {
90105
+ yield* addFinalizer$1(scope, suspend$3(() => {
89588
90106
  if (disabledUntil !== void 0) return void_$1;
89589
90107
  runExportFork(runExport);
89590
90108
  return awaitEmpty(exportFibers);
@@ -90915,7 +91433,7 @@ const makeRemote = /*#__PURE__*/ fnUntraced(function* (options) {
90915
91433
  duration: timeout,
90916
91434
  orElse: () => fail$7(unavailable$1("The key set request timed out"))
90917
91435
  }));
90918
- const refresh = (now, stale) => uninterruptibleMask((restore) => suspend$2(() => {
91436
+ const refresh = (now, stale) => uninterruptibleMask((restore) => suspend$3(() => {
90919
91437
  if (closed) return closedExit;
90920
91438
  if (cache !== void 0 && cache !== stale && cache.expiresAt > now) return succeed$5(cache);
90921
91439
  if (pending !== void 0) return restore(_await(pending));
@@ -91171,8 +91689,8 @@ var Sessions = class Sessions extends Service$1()("@deslop/runtime/auth/sessions
91171
91689
  const digest = yield* Digest;
91172
91690
  const random = yield* SecureRandom;
91173
91691
  const client = yield* HttpClient;
91174
- const locks = empty$9();
91175
- const bearers = empty$9();
91692
+ const locks = empty$10();
91693
+ const bearers = empty$10();
91176
91694
  const app = yield* String$5("APP_URL");
91177
91695
  function keyOf(id) {
91178
91696
  return digest.digestHex(sha256, new TextEncoder().encode(id));
@@ -91295,10 +91813,7 @@ const unavailable = text("The authorization service is temporarily unavailable;
91295
91813
  status: 503
91296
91814
  });
91297
91815
  var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
91298
- static makeContext = (auth) => pipe(make$80(Auth, auth), add$1(RpcAuth, RpcAuth.of((effect, request) => pipe(auth.user(request.headers), tap$1(() => {
91299
- if (isStreamSchema(request.rpc.successSchema)) return annotateCurrentSpan("rpc.stream", true);
91300
- return void_$1;
91301
- }), flatMap$2((user) => raceFirst(provideService(effect, CurrentUser, user), pipe(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
91816
+ static makeContext = (auth) => pipe(make$81(Auth, auth), add$2(RpcAuth, RpcAuth.of((effect, request) => pipe(auth.user(request.headers), flatMap$2((user) => raceFirst(provideService(effect, CurrentUser, user), pipe(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
91302
91817
  static layer = unwrap$8(gen(function* () {
91303
91818
  if (yield* localAuth) return succeedContext(Auth.makeContext(Auth.of({
91304
91819
  token: () => fail$7(AuthError.make({ message: "There is no sign-in without --auth" })),
@@ -91497,7 +92012,7 @@ const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(meb
91497
92012
  const layerTelemetry = unwrap$8(gen(function* () {
91498
92013
  const metadata = yield* packageMetadata;
91499
92014
  return match$8(yield* option(String$5("OTEL_URL")), {
91500
- onNone: () => empty$10,
92015
+ onNone: () => empty$11,
91501
92016
  onSome: (url) => layerOtlp(`${metadata.name}-server`, url, "server", metadata.version)
91502
92017
  });
91503
92018
  }));
@@ -91552,7 +92067,7 @@ function layerIcon(icon) {
91552
92067
  }
91553
92068
  const layerWeb = unwrap$8(gen(function* () {
91554
92069
  const client = fileURLToPath(new URL("./client", import.meta.url));
91555
- if (!(yield* (yield* FileSystem).exists((yield* Path$1).join(client, "index.html")))) return empty$10;
92070
+ if (!(yield* (yield* FileSystem).exists((yield* Path$1).join(client, "index.html")))) return empty$11;
91556
92071
  const name = capitalize(yield* appName);
91557
92072
  return mergeAll$1(add("GET", MANIFEST_PATH, succeed$5(jsonUnsafe({
91558
92073
  background_color: "#0d0c0c",
@@ -91585,10 +92100,10 @@ const layerWeb = unwrap$8(gen(function* () {
91585
92100
  function layerRpc(options) {
91586
92101
  return pipe(layerHttp$1({
91587
92102
  disableTracing: options.disableTracing,
91588
- group: options.group,
92103
+ group: options.group.middleware(RpcStream),
91589
92104
  path: RPC_PATH,
91590
92105
  protocol: "websocket"
91591
- }), provide$2(options.handlers));
92106
+ }), provide$2(options.handlers), provide$2(layerRpcStream));
91592
92107
  }
91593
92108
  function layerMcp(options) {
91594
92109
  return unwrap$8(gen(function* () {
@@ -91759,7 +92274,7 @@ function layerSignIn(issuer) {
91759
92274
  }
91760
92275
  const layerSessionRoutes = unwrap$8(gen(function* () {
91761
92276
  return match$8(yield* option(String$5("AUTH_URL")), {
91762
- onNone: () => empty$10,
92277
+ onNone: () => empty$11,
91763
92278
  onSome: layerSignIn
91764
92279
  });
91765
92280
  }));
@@ -91830,7 +92345,7 @@ const uninstall = fnUntraced(function* (name) {
91830
92345
  yield* systemctl("daemon-reload");
91831
92346
  return `deslop-${name}.service removed; application data preserved\n`;
91832
92347
  });
91833
- function status(name) {
92348
+ function status$1(name) {
91834
92349
  return systemctl("show", `deslop-${name}.service`, "--property=LoadState,ActiveState,SubState,MainPID");
91835
92350
  }
91836
92351
  function restart(name) {
@@ -91930,7 +92445,7 @@ const configProvider = fnUntraced(function* (given, defaultPort) {
91930
92445
  const layerPlatform = mergeAll$1(layer$4, layer$12, layer$15);
91931
92446
  function server(app) {
91932
92447
  const routes = pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(match$8(fromUndefinedOr(app.middleware), {
91933
- onNone: () => empty$10,
92448
+ onNone: () => empty$11,
91934
92449
  onSome: (middleware$1) => middleware()(middleware$1).layer
91935
92450
  })));
91936
92451
  return pipe(serve(pipe(match$8(fromUndefinedOr(app.auth), {
@@ -91941,7 +92456,7 @@ function server(app) {
91941
92456
  middleware: guard
91942
92457
  }), provide$2(mergeAll$1(layerProtocol, match$1(app.telemetry === false, {
91943
92458
  onFalse: () => layerTelemetry,
91944
- onTrue: () => empty$10
92459
+ onTrue: () => empty$11
91945
92460
  }))), provide$2(layerNodeHttpServer), provide$2(layerPlatform), launch);
91946
92461
  }
91947
92462
  function output(text) {
@@ -91982,7 +92497,7 @@ function runApp(app) {
91982
92497
  "update"
91983
92498
  ]);
91984
92499
  })),
91985
- make$5("status", {}, () => flatMap$2(status(name), output)),
92500
+ make$5("status", {}, () => flatMap$2(status$1(name), output)),
91986
92501
  make$5("uninstall", {}, () => flatMap$2(uninstall(name), output)),
91987
92502
  make$5("update", {}, () => flatMap$2(update(name), output))
91988
92503
  ]))]), run({ version: metadata.version }));
@@ -92102,6 +92617,49 @@ const RunRequest = Struct({
92102
92617
  scope: Literals(["system", "user"]),
92103
92618
  target: optionalKey(String$6)
92104
92619
  });
92620
+ const RunJobInput = Struct({
92621
+ job: String$6.annotate({ description: "A scheduled job name as list_apps shows it." }),
92622
+ worker: optionalKey(String$6.annotate({ description: "The worker running the job, when both do." }))
92623
+ });
92624
+ const ListAppsInput = Struct({
92625
+ app: optionalKey(String$6.annotate({ description: "A substring of an app or unit name; returns that app's process tree." })),
92626
+ failing: optionalKey(Boolean$5.annotate({ description: "Only failed or warning items." })),
92627
+ worker: optionalKey(String$6.annotate({ description: "A configured worker name." }))
92628
+ });
92629
+ const ProcessSummary = Struct({
92630
+ children: optionalKey(ArraySchema(suspend$2(() => ProcessSummary))),
92631
+ cpu: optionalKey(Finite),
92632
+ detail: optionalKey(String$6),
92633
+ mib: Int$1,
92634
+ name: String$6
92635
+ });
92636
+ const ListApp = Struct({
92637
+ failure: optionalKey(String$6),
92638
+ name: String$6,
92639
+ ports: optionalKey(ArraySchema(Int$1)),
92640
+ processes: optionalKey(ArraySchema(ProcessSummary)),
92641
+ since: optionalKey(String$6),
92642
+ state: String$6,
92643
+ url: optionalKey(String$6)
92644
+ });
92645
+ const ListJob = Struct({
92646
+ failure: optionalKey(String$6),
92647
+ name: String$6,
92648
+ next: optionalKey(String$6),
92649
+ since: optionalKey(String$6)
92650
+ });
92651
+ const ListExposure = Struct({
92652
+ access: Literals(["tailnet", "public"]),
92653
+ port: optionalKey(Int$1),
92654
+ url: String$6
92655
+ });
92656
+ const ListApps = ArraySchema(Struct({
92657
+ apps: ArraySchema(ListApp),
92658
+ errors: optionalKey(ArraySchema(String$6)),
92659
+ exposures: optionalKey(ArraySchema(ListExposure)),
92660
+ jobs: optionalKey(ArraySchema(ListJob)),
92661
+ worker: String$6
92662
+ }));
92105
92663
  const Timer = Struct({
92106
92664
  activates: NullOr(String$6),
92107
92665
  next: NullOr(Finite)
@@ -92128,6 +92686,36 @@ const HistoryQuery = Struct({ minutes: Literals([
92128
92686
  1440,
92129
92687
  10080
92130
92688
  ]) });
92689
+ const HistoryToolInput = Struct({
92690
+ ...HistoryQuery.fields,
92691
+ worker: optionalKey(String$6.annotate({ description: "A configured worker name." }))
92692
+ });
92693
+ const Series = ArraySchema(OptionFromNullOr(Finite));
92694
+ const AppUsage = Struct({
92695
+ cpu: optionalKey(Finite),
92696
+ mib: Int$1,
92697
+ name: String$6
92698
+ });
92699
+ const MachineNow = Struct({
92700
+ cpuPct: optionalKey(Finite),
92701
+ diskGiB: optionalKey(Finite),
92702
+ diskTotalGiB: optionalKey(Finite),
92703
+ load: optionalKey(ArraySchema(Finite)),
92704
+ memoryGiB: Finite,
92705
+ memoryTotalGiB: Finite
92706
+ });
92707
+ const ResourceHistory = ArraySchema(Struct({
92708
+ apps: ArraySchema(AppUsage),
92709
+ cpuPct: Series,
92710
+ diskPct: Series,
92711
+ error: optionalKey(String$6),
92712
+ from: String$6,
92713
+ memoryPct: Series,
92714
+ now: optionalKey(MachineNow),
92715
+ stale: optionalKey(Literal(true)),
92716
+ stepSeconds: Finite,
92717
+ worker: String$6
92718
+ }));
92131
92719
  const Counters = Struct({
92132
92720
  cores: optionalKey(ArraySchema(Struct({
92133
92721
  id: String$6,
@@ -92184,27 +92772,6 @@ const MachineHistory = Struct({
92184
92772
  time: Finite,
92185
92773
  worker: String$6
92186
92774
  });
92187
- const MachineSummary = Struct({
92188
- cpuModel: optionalKey(String$6),
92189
- current: optionalKey(Sample),
92190
- error: String$6,
92191
- intervalSeconds: Finite,
92192
- recordedSince: optionalKey(Finite),
92193
- series: Struct({
92194
- cpu: ArraySchema(OptionFromNullOr(Finite)),
92195
- diskRead: ArraySchema(OptionFromNullOr(Finite)),
92196
- diskWrite: ArraySchema(OptionFromNullOr(Finite)),
92197
- memoryUsed: ArraySchema(Finite),
92198
- networkReceive: ArraySchema(OptionFromNullOr(Finite)),
92199
- networkSend: ArraySchema(OptionFromNullOr(Finite)),
92200
- storageUsed: ArraySchema(Finite),
92201
- swapUsed: ArraySchema(Finite),
92202
- time: ArraySchema(Finite)
92203
- }),
92204
- stale: Boolean$5,
92205
- time: Finite,
92206
- worker: String$6
92207
- });
92208
92775
  // src/rpcs/contracts.ts
92209
92776
  var RpcContracts = class extends make$29(make$31("deploy.metrics", {
92210
92777
  error: Union([AuthError, DeployError]),
@@ -92278,7 +92845,7 @@ var Exposures = class Exposures extends Service$1()("@deslop/deploy/services/exp
92278
92845
  ]), flatMap$2(decodeUnknownEffect(fromJsonString(Serve))));
92279
92846
  const checkTailnet = fnUntraced(function* (input) {
92280
92847
  const current = yield* status;
92281
- if (has$4(current.TCP ?? {}, `${input.port}`) || current.AllowFunnel?.[`${input.hostname}:${input.port}`] === true) return yield* DeployError.make({ message: "This Tailscale port or Funnel permission already exists and is not owned by Deploy" });
92848
+ if (has$6(current.TCP ?? {}, `${input.port}`) || current.AllowFunnel?.[`${input.hostname}:${input.port}`] === true) return yield* DeployError.make({ message: "This Tailscale port or Funnel permission already exists and is not owned by Deploy" });
92282
92849
  const tailnet = yield* pipe(run("tailscale", ["status", "--json"]), flatMap$2(decodeEffect(fromJsonString(Tailnet))));
92283
92850
  if (replace(/\.$/u, "")(tailnet.Self?.DNSName ?? "") !== input.hostname) return yield* DeployError.make({ message: "Use this worker’s Tailscale DNS name; Deploy never publishes another worker’s hostname" });
92284
92851
  });
@@ -92328,7 +92895,7 @@ var Exposures = class Exposures extends Service$1()("@deslop/deploy/services/exp
92328
92895
  return Exposures.of({
92329
92896
  expose: fnUntraced(function* (input) {
92330
92897
  const rows = yield* get(state);
92331
- if (has$4(rows, input.name)) return yield* DeployError.make({ message: "Remove the existing owned exposure before changing it" });
92898
+ if (has$6(rows, input.name)) return yield* DeployError.make({ message: "Remove the existing owned exposure before changing it" });
92332
92899
  if (some(values(rows), (row) => row.hostname === input.hostname && (row.kind === "public" || row.port === input.port))) return yield* DeployError.make({ message: "This hostname or port already has an owned exposure" });
92333
92900
  if (input.kind === "public" && !input.publicAccess) return yield* DeployError.make({ message: "Explicitly confirm public access before publishing a port" });
92334
92901
  if (input.kind === "tailnet") yield* checkTailnet(input);
@@ -92355,7 +92922,7 @@ var Exposures = class Exposures extends Service$1()("@deslop/deploy/services/exp
92355
92922
  const next = remove$4(rows, name);
92356
92923
  if (owned.kind === "tailnet") {
92357
92924
  const current = yield* status;
92358
- if (has$4(current.TCP ?? {}, `${owned.port}`)) {
92925
+ if (has$6(current.TCP ?? {}, `${owned.port}`)) {
92359
92926
  if (!ownsMapping(current, owned)) return yield* DeployError.make({ message: "This mapping was changed outside Deploy; refusing to remove it" });
92360
92927
  yield* run("tailscale", [
92361
92928
  "serve",
@@ -92506,7 +93073,7 @@ function unwrapTokens(tokens, cwd) {
92506
93073
  onNone: () => {
92507
93074
  const tail = drop$1(tokens, 1);
92508
93075
  return pipe(findFirstIndex(tail, (token) => !isFlag(token) && !assignment(token)), match$8({
92509
- onNone: () => empty$11(),
93076
+ onNone: () => empty$12(),
92510
93077
  onSome: (start) => filter$3(tail, (token, index) => index >= start && !isFlag(token) && !assignment(token))
92511
93078
  }));
92512
93079
  },
@@ -92577,7 +93144,7 @@ function scan(name, subject, args, words, values) {
92577
93144
  function commandLabel(argv, cwd) {
92578
93145
  const [head = "", ...args] = unwrap(argv, cwd);
92579
93146
  const name = alias(basename(head));
92580
- const subject = getOrElse(get$11(SUBJECT, name), () => empty$11());
93147
+ const subject = getOrElse(get$11(SUBJECT, name), () => empty$12());
92581
93148
  const scanned = scan(name, subject, args, [], {});
92582
93149
  if (contains(SHELLS, name) && isReadonlyArrayEmpty(scanned.words)) return {
92583
93150
  detail: getOrElse(map$11(cwd, basename), () => ""),
@@ -92616,10 +93183,226 @@ function processOwner(cgroup) {
92616
93183
  });
92617
93184
  }
92618
93185
  // src/services/inventory/lib/utils.ts
93186
+ function loopbackPort(item) {
93187
+ return item.kind === "port" && item.protocol === "tcp" && item.port !== void 0 && item.port >= 1024 && isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(item.address ?? ""));
93188
+ }
93189
+ function appPort(item) {
93190
+ return loopbackPort(item) && item.process !== void 0 && item.process !== "" && !contains([5353, 5355], item.port ?? 0) && isNone(match$3(/^(?:ssh|cloudflared|tailscaled|caddy)$/u)(item.process ?? ""));
93191
+ }
93192
+ function important(item) {
93193
+ if (includes("failed")(item.state) || includes("unhealthy")(item.detail)) return true;
93194
+ if (item.kind === "exposure") return item.owned === true || item.publicAccess === true;
93195
+ if (item.kind === "container") return isSome(match$3(/^(?:stale · )?(?:running|restarting|paused)$/u)(item.state)) || isSome(match$3(/Exited \([1-9]/u)(item.detail));
93196
+ if (item.kind === "port") return appPort(item);
93197
+ if (item.kind !== "service") return false;
93198
+ if (isSome(match$3(/^(?:deslop-|preview-|t3code)/u)(item.name))) return true;
93199
+ return item.scope === "user" && isSome(match$3(/(?:^| · )active · /u)(item.state)) && isNone(match$3(/^(?:dbus|dirmngr|gpg-|keyboxd|gcr-|gnome-|secret-service|ssh-agent|openvpn3-)/u)(item.name));
93200
+ }
93201
+ function ports(items) {
93202
+ return pipe(items, filter$3((item) => appPort(item) && item.http === true && !startsWith("stale")(item.state)), sort(mapInput(String$10, (item) => `${item.worker}:${item.port}:${item.address}`)), dedupeWith((a, b) => a.worker === b.worker && a.port === b.port));
93203
+ }
92619
93204
  function itemOwner(item) {
92620
93205
  if (item.kind === "container") return `container:${slice$1(0, 12)(getOrElse(last(split$2(item.id, ":docker:")), () => ""))}`;
92621
93206
  return `service:${item.scope ?? "system"}:${item.name}`;
92622
93207
  }
93208
+ function fullName(item) {
93209
+ if (item.kind === "port") return item.process ?? item.name;
93210
+ if (item.kind === "container" && startsWith("deslop-")(item.name)) return replace(/-[0-9]+$/u, "")(slice$1(7)(item.name));
93211
+ if (startsWith("preview-")(item.name)) return match$8(match$3(/@deslop\/([a-z0-9-]+)/u)(item.detail), {
93212
+ onNone: () => `Preview ${replace(/\.service$/u, "")(slice$1(8)(item.name))}`,
93213
+ onSome: (app) => `${app[1]} preview`
93214
+ });
93215
+ return replaceAll(/^deslop-|\.service$/gu, "")(item.name);
93216
+ }
93217
+ function workloadName(item) {
93218
+ return pipe(fullName(item), replaceAll(/\b([a-f0-9]{7})[a-f0-9]+\b/giu, "$1"), replaceAll(/\b(?=[a-z0-9]{10,}\b)(?=[a-z0-9]*[0-9])([a-z0-9]{7})[a-z0-9]+\b/giu, "$1"));
93219
+ }
93220
+ function sameSocket(listener, binding) {
93221
+ if (listener.address === "container" || binding.address === "container") return false;
93222
+ if (listener.port !== binding.port || listener.protocol !== binding.protocol) return false;
93223
+ if (listener.address === binding.address) return true;
93224
+ return isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(listener.address ?? "")) && isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(binding.address));
93225
+ }
93226
+ function socket(worker, binding) {
93227
+ const loopback = isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(binding.address ?? ""));
93228
+ return make$80(worker, binding.protocol, binding.port, loopback, match$1(loopback, {
93229
+ onFalse: () => binding.address,
93230
+ onTrue: () => ""
93231
+ }));
93232
+ }
93233
+ function workloads(items) {
93234
+ const listeners = filter$3(items, (item) => item.kind === "port");
93235
+ const byUnit = map$9(groupBy(listeners, (listener) => listener.worker), (worker) => groupBy(worker, (listener) => listener.unit ?? ""));
93236
+ const bySocket = fromIterable$5(map$8(reverse(filter$3(listeners, (listener) => listener.address !== "container")), (listener) => [socket(listener.worker, listener), listener]));
93237
+ const grouped = map$8(filter$3(items, (item) => item.kind === "service" || item.kind === "container"), (item) => {
93238
+ const attached = filter$3(byUnit[item.worker]?.[item.name] ?? [], (listener) => listener.unit === item.name);
93239
+ const bindings = map$8(item.bindings ?? [], (binding) => ({
93240
+ ...item,
93241
+ ...getOrElse(filter$5(get$7(bySocket, socket(item.worker, binding)), () => binding.address !== "container"), () => ({})),
93242
+ ...binding,
93243
+ bindings: [],
93244
+ id: `${item.id}:port:${binding.address}`,
93245
+ kind: "port",
93246
+ process: item.name,
93247
+ unit: item.name,
93248
+ url: ""
93249
+ }));
93250
+ return {
93251
+ item,
93252
+ listeners: [...attached, ...bindings]
93253
+ };
93254
+ });
93255
+ const services = fromIterable$3(map$8(filter$3(grouped, (row) => row.item.kind === "service"), (row) => make$80(row.item.worker, row.item.name)));
93256
+ const represented = fromIterable$3(flatMap$5(grouped, (row) => map$8(filter$3(row.listeners, (binding) => binding.address !== "container"), (binding) => socket(row.item.worker, {
93257
+ address: binding.address ?? "",
93258
+ port: binding.port ?? 0,
93259
+ protocol: binding.protocol ?? "tcp"
93260
+ }))));
93261
+ const loose = filter$3(listeners, (listener) => !has$1(services, make$80(listener.worker, listener.unit)) && (listener.address === "container" || !has$1(represented, socket(listener.worker, listener))));
93262
+ const rows = [...grouped, ...map$8(loose, (item) => ({
93263
+ item,
93264
+ listeners: [item]
93265
+ }))];
93266
+ const exposures = [...filter$3(items, (item) => item.kind === "exposure" && item.owned === true), ...filter$3(items, (item) => item.kind === "exposure" && item.owned !== true)];
93267
+ const exposuresBySocket = groupBy(map$8(exposures, (item, index) => ({
93268
+ index,
93269
+ item
93270
+ })), (entry) => `${entry.item.worker}:${entry.item.port ?? 0}`);
93271
+ const linked = map$8(rows, (row) => {
93272
+ const reachable = dedupe(map$8(filter$3(row.listeners, (listener) => sameSocket(listener, {
93273
+ address: `127.0.0.1:${listener.port}`,
93274
+ port: listener.port ?? 0,
93275
+ protocol: "tcp"
93276
+ })), (listener) => listener.port ?? 0));
93277
+ const exposed = pipe(flatMap$5(reachable, (port) => exposuresBySocket[`${row.item.worker}:${port}`] ?? []), sortWith((entry) => entry.index, Number$6), map$8((entry) => entry.item));
93278
+ return {
93279
+ ...row,
93280
+ exposures: dedupeWith([...map$8(row.item.links ?? [], (url) => ({
93281
+ ...row.item,
93282
+ id: `${row.item.id}:url:${url}`,
93283
+ kind: "exposure",
93284
+ owned: false,
93285
+ publicAccess: true,
93286
+ url
93287
+ })), ...exposed], (a, b) => a.url === b.url)
93288
+ };
93289
+ });
93290
+ const linkedIds = fromIterable$3(flatMap$5(linked, (row) => map$8(row.exposures, (exposure) => exposure.id)));
93291
+ const linkedUrls = fromIterable$3(flatMap$5(linked, (row) => map$8(row.exposures, (exposure) => make$80(exposure.worker, exposure.url))));
93292
+ const remaining = map$8(filter$3(exposures, (item) => !has$1(linkedIds, item.id) && !has$1(linkedUrls, make$80(item.worker, item.url))), (item) => ({
93293
+ exposures: [item],
93294
+ item,
93295
+ listeners: []
93296
+ }));
93297
+ return map$8(filter$3([...linked, ...remaining], (row) => important(row.item) && (row.item.kind !== "port" || row.item.http === true && row.item.process !== "" && row.item.process !== "node")), (row) => {
93298
+ if (row.item.kind === "container") return row;
93299
+ const candidates = ports(row.listeners);
93300
+ const hasUi = some(candidates, (candidate) => candidate.ui === true);
93301
+ const exposedPorts = fromIterable$3(map$8(row.exposures, (exposure) => exposure.port));
93302
+ return {
93303
+ ...row,
93304
+ listeners: filter$3(candidates, (listener) => !hasUi || listener.ui === true || has$1(exposedPorts, listener.port))
93305
+ };
93306
+ });
93307
+ }
93308
+ new Intl.RelativeTimeFormat("en", {
93309
+ numeric: "auto",
93310
+ style: "narrow"
93311
+ });
93312
+ function status(item) {
93313
+ if (startsWith("stale")(item.state)) return "stale";
93314
+ if (includes("unhealthy")(item.detail)) return "unhealthy";
93315
+ if (item.kind === "port") return "listening";
93316
+ if (item.kind === "exposure" && item.owned === true) return "configured";
93317
+ if (item.kind === "exposure" && item.publicAccess === true) return "public permission";
93318
+ return replace(/^active · /u, "")(toLowerCase(item.state));
93319
+ }
93320
+ function dot(item, state) {
93321
+ if (isSome(match$3(/failed|unhealthy|Exited \([1-9]/u)(item.state + item.detail))) return "error";
93322
+ if (state === "stale" || state === "public permission" || state === "restarting") return "warning";
93323
+ return "quiet";
93324
+ }
93325
+ function usage(nodes) {
93326
+ const cpus = getSomes(map$8(nodes, (node) => fromUndefinedOr(node.cpu)));
93327
+ return {
93328
+ ...match$1(isReadonlyArrayNonEmpty(cpus), {
93329
+ onFalse: () => ({}),
93330
+ onTrue: () => ({ cpu: sumAll(cpus) })
93331
+ }),
93332
+ memory: sumAll(map$8(nodes, (node) => node.memory))
93333
+ };
93334
+ }
93335
+ const byUsage = combine$2(mapInput(flip$1(Number$6), (node) => node.memory), mapInput(flip$1(Number$6), (node) => node.cpu ?? 0));
93336
+ function settle(children, appMemory) {
93337
+ return map$8(sort(children, byUsage), (node) => ({
93338
+ ...node,
93339
+ small: node.memory < appMemory * .02 && (node.cpu ?? 0) < .5
93340
+ }));
93341
+ }
93342
+ function sameLabel(first, second) {
93343
+ return first.name === second.name && first.detail === second.detail;
93344
+ }
93345
+ function absorb(label, children) {
93346
+ const matching = filter$3(children, (child) => sameLabel(child.label, label));
93347
+ if (isArrayEmpty(matching)) return children;
93348
+ return [...filter$3(children, (child) => !sameLabel(child.label, label)), ...absorb(label, flatMap$5(matching, (child) => child.children))];
93349
+ }
93350
+ function fold(node) {
93351
+ return {
93352
+ ...node,
93353
+ children: absorb(node.label, map$8(node.children, fold))
93354
+ };
93355
+ }
93356
+ function processTree(rows) {
93357
+ const pids = fromIterable(map$8(rows, (row) => row.pid));
93358
+ const children = groupBy(rows, (row) => `${row.parent}`);
93359
+ const visited = empty$3();
93360
+ function build(row) {
93361
+ add$1(visited, row.pid);
93362
+ const below = map$8(filter$3(children[`${row.pid}`] ?? [], (child) => !has(visited, child.pid)), build);
93363
+ const self = {
93364
+ children: [],
93365
+ ...match$8(fromUndefinedOr(row.command), {
93366
+ onNone: () => ({}),
93367
+ onSome: (command) => ({ command })
93368
+ }),
93369
+ ...match$8(fromUndefinedOr(row.cpu), {
93370
+ onNone: () => ({}),
93371
+ onSome: (cpu) => ({ cpu })
93372
+ }),
93373
+ label: row.label,
93374
+ memory: row.memory,
93375
+ pid: row.pid,
93376
+ small: false
93377
+ };
93378
+ return {
93379
+ ...self,
93380
+ ...usage([self, ...below]),
93381
+ children: below
93382
+ };
93383
+ }
93384
+ const roots = pipe(filter$3(rows, (row) => !has(pids, row.parent)), match$6({
93385
+ onEmpty: () => take$3(rows, 1),
93386
+ onNonEmpty: identity
93387
+ }), map$8((node) => fold(build(node))));
93388
+ const appMemory = usage(roots).memory;
93389
+ function place(node) {
93390
+ return {
93391
+ ...node,
93392
+ children: settle(map$8(node.children, place), appMemory)
93393
+ };
93394
+ }
93395
+ return settle(map$8(roots, place), appMemory);
93396
+ }
93397
+ function appUsage(rows) {
93398
+ return {
93399
+ cpu: match$6(getSomes(map$8(rows, (row) => fromUndefinedOr(row.cpu))), {
93400
+ onEmpty: () => void 0,
93401
+ onNonEmpty: (values) => round(sumAll(values), 2)
93402
+ }),
93403
+ memory: sumAll(map$8(rows, (row) => row.memory))
93404
+ };
93405
+ }
92623
93406
  // src/services/inventory/lib/processes.ts
92624
93407
  const PROCESS_INTERVAL = 2e3;
92625
93408
  const SECRET = /(?:token|secret|passw(?:or)?d|key|auth|credential|cookie|session)/iu;
@@ -92784,10 +93567,15 @@ function portItems(text, worker, fs, http) {
92784
93567
  const response = yield* match$1(probeSocket(socket, process), {
92785
93568
  onFalse: () => succeed$5(none()),
92786
93569
  onTrue: fnUntraced(function* () {
92787
- return yield* pipe(option$1(currentSpan), flatMap$2((parent) => http.head(`http://127.0.0.1:${socket.port}/`, { headers: match$8(parent, {
92788
- onNone: () => ({}),
92789
- onSome: toHeaders
92790
- }) })), map$5((value) => ({
93570
+ return yield* pipe(http.head(`http://127.0.0.1:${socket.port}/`, { headers: toHeaders(new NativeSpan({
93571
+ annotations: empty$15(),
93572
+ kind: "internal",
93573
+ links: [],
93574
+ name: "Deploy.probe",
93575
+ parent: none(),
93576
+ sampled: false,
93577
+ startTime: 0n
93578
+ })) }), map$5((value) => ({
92791
93579
  http: true,
92792
93580
  ui: value.status >= 200 && value.status < 400 && includes("text/html")(value.headers["content-type"] ?? "")
92793
93581
  })), provideService(RequestInit, { redirect: "manual" }), provideService(TracerDisabledWhen$1, () => true), timeout$1("700 millis"), option$1);
@@ -92819,7 +93607,7 @@ function portItems(text, worker, fs, http) {
92819
93607
  function collect(name, effect) {
92820
93608
  return pipe(effect, timeout$1("10 seconds"), match$2({
92821
93609
  onFailure: (cause) => ({
92822
- items: empty$11(),
93610
+ items: empty$12(),
92823
93611
  source: {
92824
93612
  error: cause.message,
92825
93613
  name
@@ -92856,7 +93644,7 @@ var Inventory = class Inventory extends Service$1()("@deslop/deploy/services/inv
92856
93644
  onFalse: () => ["--user"],
92857
93645
  onTrue: () => []
92858
93646
  });
92859
- const scheduled = fromIterable$4(getSomes(map$8(yield* pipe(command("systemctl", [
93647
+ const scheduled = fromIterable$5(getSomes(map$8(yield* pipe(command("systemctl", [
92860
93648
  ...manager,
92861
93649
  "list-timers",
92862
93650
  "--all",
@@ -92950,11 +93738,11 @@ var Inventory = class Inventory extends Service$1()("@deslop/deploy/services/inv
92950
93738
  "--format",
92951
93739
  "{{json .}}"
92952
93740
  ]), flatMap$2((text) => forEach$1(filter$3(split$2(text, "\n"), isNonEmpty$1), (line) => decodeEffect(fromJsonString(Container))(line), { concurrency: 1 })), map$5((rows) => map$8(rows, (row) => InventoryItem.make({
92953
- bindings: [...map$8(fromIterable$7(matchAll(/traefik\.http\.services\.[^=,]+\.loadbalancer\.server\.port=([0-9]+)/gu)(row.Labels ?? "")), (match) => ({
93741
+ bindings: [...map$8(fromIterable$8(matchAll(/traefik\.http\.services\.[^=,]+\.loadbalancer\.server\.port=([0-9]+)/gu)(row.Labels ?? "")), (match) => ({
92954
93742
  address: "container",
92955
93743
  port: getOrElse(parse$3(match[1] ?? ""), () => 0),
92956
93744
  protocol: "tcp"
92957
- })), ...map$8(fromIterable$7(matchAll(/((?:[0-9.]+|\[::\])):([0-9]+)->[0-9]+\/(tcp|udp)/gu)(row.Ports)), (match) => ({
93745
+ })), ...map$8(fromIterable$8(matchAll(/((?:[0-9.]+|\[::\])):([0-9]+)->[0-9]+\/(tcp|udp)/gu)(row.Ports)), (match) => ({
92958
93746
  address: `${match[1]}:${match[2]}`,
92959
93747
  port: getOrElse(parse$3(match[2] ?? ""), () => 0),
92960
93748
  protocol: match$1(match[3] === "udp", {
@@ -92965,7 +93753,7 @@ var Inventory = class Inventory extends Service$1()("@deslop/deploy/services/inv
92965
93753
  detail: row.Status,
92966
93754
  id: `${worker}:docker:${row.ID}`,
92967
93755
  kind: "container",
92968
- links: dedupe(map$8(fromIterable$7(matchAll(/Host\(`([^`]+)`\)/gu)(row.Labels ?? "")), (match) => `https://${match[1]}`)),
93756
+ links: dedupe(map$8(fromIterable$8(matchAll(/Host\(`([^`]+)`\)/gu)(row.Labels ?? "")), (match) => `https://${match[1]}`)),
92969
93757
  name: row.Names,
92970
93758
  state: row.State,
92971
93759
  url: "",
@@ -93237,28 +94025,10 @@ function history(samples, minutes, now) {
93237
94025
  };
93238
94026
  });
93239
94027
  }
93240
- function compactHistory(machine, minutes) {
93241
- return {
93242
- ...getSomes$1({ cpuModel: fromUndefinedOr(machine.cpuModel) }),
93243
- ...getSomes$1({ current: last(machine.samples) }),
93244
- error: machine.error,
93245
- intervalSeconds: resolution(minutes) / 1e3,
93246
- ...getSomes$1({ recordedSince: fromUndefinedOr(machine.samples[0]?.since ?? machine.samples[0]?.time) }),
93247
- series: {
93248
- cpu: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.cpu), round(1))),
93249
- diskRead: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.diskRead), round(0))),
93250
- diskWrite: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.diskWrite), round(0))),
93251
- memoryUsed: map$8(machine.samples, (value) => value.memoryUsed),
93252
- networkReceive: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.networkReceive), round(0))),
93253
- networkSend: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.networkSend), round(0))),
93254
- storageUsed: map$8(machine.samples, usedStorage),
93255
- swapUsed: map$8(machine.samples, (value) => value.swapUsed),
93256
- time: map$8(machine.samples, (value) => value.time)
93257
- },
93258
- stale: machine.stale,
93259
- time: machine.time,
93260
- worker: machine.worker
93261
- };
94028
+ function bandName(id, labels) {
94029
+ if (id === "other") return "Low impact";
94030
+ if (id === "system") return "System";
94031
+ return getOrElse(get$11(labels, id), () => replaceAll(/^service:[a-z]+:(?:deslop-)?|\.service$/gu, "")(replace(/^container:/u, "container ")(id)));
93262
94032
  }
93263
94033
  function appCgroup(path, siblings) {
93264
94034
  const name = getOrElse(last(split$2(path, "/")), () => "");
@@ -93316,7 +94086,7 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
93316
94086
  const previous = yield* make$44(none());
93317
94087
  const lastApps = yield* make$44(none());
93318
94088
  const storage = yield* make$44("");
93319
- const dirty = yield* make$44(empty$11());
94089
+ const dirty = yield* make$44(empty$12());
93320
94090
  const collectError = yield* make$44("");
93321
94091
  const persistError = yield* make$44("");
93322
94092
  function walk(pending, found) {
@@ -93410,12 +94180,12 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
93410
94180
  const before = yield* get$1(state);
93411
94181
  const samples = compact([...before, value], time);
93412
94182
  yield* set$1(state, samples);
93413
- const retained = fromIterable$2(map$8(samples, (entry) => entry.time));
94183
+ const retained = fromIterable$3(map$8(samples, (entry) => entry.time));
93414
94184
  const hour = Math.floor(time / 36e5);
93415
94185
  yield* update$1(dirty, (buckets) => dedupe([
93416
94186
  ...filter$3(buckets, (bucket) => bucket >= hour - 168),
93417
94187
  hour,
93418
- ...map$8(filter$3(before, (entry) => !has(retained, entry.time) && entry.time >= time - 6048e5), (entry) => Math.floor(entry.time / 36e5))
94188
+ ...map$8(filter$3(before, (entry) => !has$1(retained, entry.time) && entry.time >= time - 6048e5), (entry) => Math.floor(entry.time / 36e5))
93419
94189
  ]));
93420
94190
  yield* set$1(collectError, "");
93421
94191
  }), catch_$2((cause) => set$1(collectError, cause.message)));
@@ -93458,7 +94228,7 @@ const PEER = {
93458
94228
  id: "deploy:peer",
93459
94229
  name: "deploy"
93460
94230
  };
93461
- const makeRemoteClient = make$30(RpcContracts, { flatten: true });
94231
+ const makeRemoteClient = make$30(RpcContracts.middleware(RpcStream), { flatten: true });
93462
94232
  const layerPeerAuth = effectContext(gen(function* () {
93463
94233
  const auth = yield* Auth;
93464
94234
  const digest = yield* Digest;
@@ -93520,7 +94290,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
93520
94290
  const url = new URL(RPC_PATH, worker.url);
93521
94291
  url.protocol = "wss:";
93522
94292
  if (new URL(worker.url).protocol === "http:") url.protocol = "ws:";
93523
- return yield* pipe(flatMap$2(makeRemoteClient, (client) => use(client, peerHeaders)), provide(pipe(layerProtocolSocket({ pingTimeout: "15 seconds" }), provide$2(layerWebSocket(url.href)), provide$2(layerSchemaBinary()))));
94293
+ return yield* pipe(flatMap$2(makeRemoteClient, (client) => use(client, peerHeaders)), provide(pipe(layerProtocolSocket({ pingTimeout: "15 seconds" }), provide$2(layerWebSocket(url.href)), provide$2(layerSchemaBinary()), provideMerge(layerRpcStreamClient))));
93524
94294
  }, scoped, timeout$1("15 seconds"));
93525
94295
  function selectedWorker(target) {
93526
94296
  return pipe(fromOption(findFirst(workers, (worker) => worker.name === target)), mapError$2((cause) => DeployError.make({
@@ -93648,32 +94418,269 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
93648
94418
  });
93649
94419
  }));
93650
94420
  // src/tools/contracts.ts
93651
- const Tools = make$37(make$38("resource_history", {
93652
- description: "Compact resource history for every worker: current detail once plus at most 60 aligned numeric points for any selected range. intervalSeconds gives the bucket width. Null rates mean no baseline or a sampling gap, never zero. No invented recordings for unavailable workers.",
94421
+ const Tools = make$37(make$38("list_apps", {
94422
+ description: "Start here to see what runs on the workers: apps, their state, ports and failures. Pass app to get its process tree, worker to choose a machine, failing for only failed or warning items.",
93653
94423
  failure: DeployError,
93654
- parameters: HistoryQuery,
93655
- success: ArraySchema(MachineSummary)
93656
- }).annotate(Readonly, true), make$38("inventory", {
93657
- description: "Current systemd services, Docker containers, listening ports and source errors. Observing a listener does not prove external reachability.",
94424
+ parameters: ListAppsInput,
94425
+ success: ListApps
94426
+ }).annotate(Readonly, true), make$38("resource_history", {
94427
+ description: "Use to see memory, CPU or disk over time, or which app uses the most: 60 points at a fixed interval, the machine’s current figures and the heaviest apps. worker chooses a machine.",
93658
94428
  failure: DeployError,
93659
- success: Snapshot
94429
+ parameters: HistoryToolInput,
94430
+ success: ResourceHistory
93660
94431
  }).annotate(Readonly, true), make$38("expose_port", {
93661
- description: "Publish a loopback backend through private Tailscale Serve or owned public Caddy HTTPS. Public exposure requires explicit publicAccess=true; this adds no backend authentication and starts no application. target must name a configured worker or be omitted for this worker.",
94432
+ description: "Use to give a local port an HTTPS URL on the tailnet or the public internet; publicAccess=true is required for public, and target names another configured worker. Returns {url}; it adds no authentication and starts no application.",
93662
94433
  failure: DeployError,
93663
94434
  parameters: ExposeRequest,
93664
- success: String$6
94435
+ success: Struct({ url: String$6 })
93665
94436
  }).annotate(Destructive, true), make$38("hide_exposure", {
93666
- description: "Remove only an exposure Deploy owns, on this worker or a configured target. Stops its URL, not the backend process. Refuses externally changed Tailscale mappings.",
94437
+ description: "Use to remove an HTTPS URL Deploy owns, stopping only the URL, not the backend. target names another configured worker; externally changed Tailscale mappings are refused.",
93667
94438
  failure: DeployError,
93668
94439
  parameters: HideRequest
93669
- }).annotate(Destructive, true));
94440
+ }).annotate(Destructive, true), make$38("run_job", {
94441
+ description: "Use to run a scheduled job now, by the name list_apps shows. Pass worker when both machines run the same job; returns {started: true}.",
94442
+ failure: DeployError,
94443
+ parameters: RunJobInput,
94444
+ success: Struct({ started: Literal(true) })
94445
+ }));
94446
+ // src/services/inventory/lib/tools.ts
94447
+ function workerNames(snapshot) {
94448
+ return dedupe([...snapshot.workers ?? [], ...map$8(snapshot.items, (item) => item.worker)]);
94449
+ }
94450
+ function sourceWorker(source, workers, local) {
94451
+ return getOrElse(findFirst(workers, (worker) => startsWith(`${worker} · `)(source.name)), () => local);
94452
+ }
94453
+ function errorsOf(sources, workers, worker) {
94454
+ const local = match$8(head(workers), {
94455
+ onNone: () => "",
94456
+ onSome: identity
94457
+ });
94458
+ return map$8(filter$3(sources, (source) => source.error !== "" && sourceWorker(source, workers, local) === worker), (source) => `${replace(`${worker} · `, "")(source.name)}: ${source.error}`);
94459
+ }
94460
+ function portsOf(row) {
94461
+ return pipe([...row.listeners, ...row.exposures], filter$3((item) => item.address !== "container"), map$8((item) => fromUndefinedOr(item.port)), getSomes, dedupe, sort(Number$6));
94462
+ }
94463
+ function iso(milliseconds) {
94464
+ return formatIso(makeUnsafe$4(milliseconds));
94465
+ }
94466
+ function failureOf(item) {
94467
+ if (dot(item, status(item)) === "quiet") return {};
94468
+ return {
94469
+ failure: match$8(fromUndefinedOr(item.failure), {
94470
+ onNone: () => status(item),
94471
+ onSome: (stop) => stop.reason
94472
+ }),
94473
+ ...match$8(fromUndefinedOr(item.failure?.at), {
94474
+ onNone: () => ({}),
94475
+ onSome: (at) => ({ since: iso(at) })
94476
+ })
94477
+ };
94478
+ }
94479
+ function summaryOf(node) {
94480
+ return {
94481
+ ...match$1(isReadonlyArrayNonEmpty(node.children), {
94482
+ onFalse: () => ({}),
94483
+ onTrue: () => ({ children: map$8(node.children, summaryOf) })
94484
+ }),
94485
+ ...getSomes$1({ cpu: map$11(fromUndefinedOr(node.cpu), (cpu) => round(cpu, 1)) }),
94486
+ ...match$8(filter$5(fromUndefinedOr(node.label.detail), isNonEmpty$1), {
94487
+ onNone: () => ({}),
94488
+ onSome: (detail) => ({ detail })
94489
+ }),
94490
+ mib: round(node.memory / 1024 ** 2, 0),
94491
+ name: node.label.name
94492
+ };
94493
+ }
94494
+ function appOf(row, withProcesses) {
94495
+ const ports = portsOf(row);
94496
+ const url = map$11(head(row.exposures), (exposure) => exposure.url);
94497
+ return {
94498
+ ...failureOf(row.item),
94499
+ name: workloadName(row.item),
94500
+ ...match$1(isReadonlyArrayNonEmpty(ports), {
94501
+ onFalse: () => ({}),
94502
+ onTrue: () => ({ ports })
94503
+ }),
94504
+ ...match$1(withProcesses && isReadonlyArrayNonEmpty(row.item.processes ?? []), {
94505
+ onFalse: () => ({}),
94506
+ onTrue: () => ({ processes: map$8(processTree(row.item.processes ?? []), summaryOf) })
94507
+ }),
94508
+ state: row.item.state,
94509
+ ...getSomes$1({ url })
94510
+ };
94511
+ }
94512
+ function jobOf(row) {
94513
+ return {
94514
+ ...failureOf(row.item),
94515
+ name: workloadName(row.item),
94516
+ ...getSomes$1({ next: map$11(fromUndefinedOr(row.item.next), iso) })
94517
+ };
94518
+ }
94519
+ function exposureOf(item) {
94520
+ return {
94521
+ access: match$1(item.publicAccess === true, {
94522
+ onFalse: () => "tailnet",
94523
+ onTrue: () => "public"
94524
+ }),
94525
+ ...getSomes$1({ port: fromUndefinedOr(item.port) }),
94526
+ url: item.url
94527
+ };
94528
+ }
94529
+ function matches(row, app) {
94530
+ const needle = toLowerCase(app);
94531
+ return some([
94532
+ workloadName(row.item),
94533
+ row.item.name,
94534
+ row.item.unit ?? ""
94535
+ ], (name) => includes(needle)(toLowerCase(name)));
94536
+ }
94537
+ function rank(row) {
94538
+ const light = dot(row.item, status(row.item));
94539
+ if (light === "error") return 0;
94540
+ if (light === "warning") return 1;
94541
+ return 2;
94542
+ }
94543
+ const appOrder = combine$2(mapInput(Number$6, rank), mapInput(flip$1(Number$6), (row) => appUsage(row.item.processes ?? []).memory));
94544
+ const jobOrder = combine$2(mapInput(Number$6, rank), mapInput(Number$6, (row) => row.item.next ?? 0));
94545
+ function listApps(snapshot, input) {
94546
+ const app = getOrUndefined$1(filter$5(fromUndefinedOr(input.app), isNonEmpty$1));
94547
+ const onlyFailing = input.failing === true;
94548
+ return pipe(filter$3(workerNames(snapshot), (worker) => input.worker === void 0 || input.worker === worker), map$8((worker) => {
94549
+ const own = filter$3(workloads(snapshot.items), (row) => row.item.worker === worker);
94550
+ const apps = pipe(filter$3(own, (row) => (row.item.kind === "service" || row.item.kind === "container") && row.item.scheduled !== true && (app === void 0 || matches(row, app)) && (!onlyFailing || dot(row.item, status(row.item)) !== "quiet")), sort(appOrder), map$8((row) => appOf(row, app !== void 0)));
94551
+ const jobs = pipe(filter$3(own, (row) => row.item.scheduled === true && (!onlyFailing || dot(row.item, status(row.item)) !== "quiet")), sort(jobOrder), map$8((row) => jobOf(row)));
94552
+ const exposures = pipe(filter$3(own, (row) => row.item.kind === "exposure" && !onlyFailing), map$8((row) => exposureOf(row.item)), sort(mapInput(String$10, (exposure) => exposure.url)));
94553
+ const errors = errorsOf(snapshot.sources, workerNames(snapshot), worker);
94554
+ return {
94555
+ apps,
94556
+ ...match$1(isReadonlyArrayNonEmpty(errors), {
94557
+ onFalse: () => ({}),
94558
+ onTrue: () => ({ errors })
94559
+ }),
94560
+ ...match$1(isReadonlyArrayNonEmpty(exposures), {
94561
+ onFalse: () => ({}),
94562
+ onTrue: () => ({ exposures })
94563
+ }),
94564
+ ...match$1(isReadonlyArrayNonEmpty(jobs), {
94565
+ onFalse: () => ({}),
94566
+ onTrue: () => ({ jobs })
94567
+ }),
94568
+ worker
94569
+ };
94570
+ }));
94571
+ }
94572
+ function ownerNames(snapshot) {
94573
+ return fromEntries(map$8(workerNames(snapshot), (worker) => [worker, fromEntries(flatMap$5(filter$3(snapshot.items, (item) => item.worker === worker && (item.kind === "service" || item.kind === "container")), (item) => [[itemOwner(item), workloadName(item)]]))]));
94574
+ }
94575
+ const jobRequest = fnUntraced(function* (snapshot, input) {
94576
+ const matching = filter$3(workloads(snapshot.items), (row) => row.item.scheduled === true && (input.worker === void 0 || row.item.worker === input.worker) && (workloadName(row.item) === input.job || row.item.name === input.job));
94577
+ if (isArrayEmpty(matching)) return yield* DeployError.make({ message: `No scheduled job named ${input.job}; list_apps shows the jobs.` });
94578
+ if (matching.length > 1) return yield* DeployError.make({ message: `${input.job} runs on more than one worker; pass its worker.` });
94579
+ const item = getOrThrow$1(head(matching)).item;
94580
+ return {
94581
+ name: item.name,
94582
+ scope: item.scope ?? "system",
94583
+ ...match$1(startsWith("remote:")(item.id), {
94584
+ onFalse: () => ({}),
94585
+ onTrue: () => ({ target: item.worker })
94586
+ })
94587
+ };
94588
+ });
94589
+ // src/services/metrics/lib/tools.ts
94590
+ function rounded(value) {
94591
+ return round(value, 1);
94592
+ }
94593
+ function diskUsed(sample) {
94594
+ const recorded = fromUndefinedOr(sample.storageUsed);
94595
+ if (isSome(recorded)) return recorded;
94596
+ if (isReadonlyArrayNonEmpty(sample.disks)) return some$1(reduce(sample.disks, 0, (sum, disk) => sum + disk.used));
94597
+ return none();
94598
+ }
94599
+ function diskTotal(machine) {
94600
+ return map$11(findLast(machine.samples, (sample) => isReadonlyArrayNonEmpty(sample.disks)), (sample) => reduce(sample.disks, 0, (sum, disk) => sum + disk.total));
94601
+ }
94602
+ function series(machine, minutes, read) {
94603
+ const start = chartWindow(minutes, machine.time).start;
94604
+ const slot = resolution(minutes);
94605
+ const bySlot = fromEntries(map$8(machine.samples, (sample) => [`${clamp(Math.ceil((sample.time - start) / slot) - 1, {
94606
+ maximum: 59,
94607
+ minimum: 0
94608
+ })}`, sample]));
94609
+ return makeBy(60, (index) => map$11(flatMap$7(fromUndefinedOr(bySlot[`${index}`]), read), rounded));
94610
+ }
94611
+ function appsOf(labels, latest) {
94612
+ const sorted = sort(map$8(latest.apps ?? [], (app) => ({
94613
+ cpu: getOrUndefined$1(map$11(fromUndefinedOr(app.cpu), rounded)),
94614
+ mib: round(app.memory / 1024 ** 2, 0),
94615
+ name: bandName(app.id, labels)
94616
+ })), combine$2(mapInput(flip$1(Number$6), (app) => app.mib), mapInput(String$10, (app) => app.name)));
94617
+ if (sorted.length <= 15) return sorted;
94618
+ const rest = drop$1(sorted, 15);
94619
+ const cpus = getSomes(map$8(rest, (app) => fromUndefinedOr(app.cpu)));
94620
+ return [...take$3(sorted, 15), {
94621
+ ...match$1(isReadonlyArrayNonEmpty(cpus), {
94622
+ onFalse: () => ({}),
94623
+ onTrue: () => ({ cpu: rounded(sumAll(cpus)) })
94624
+ }),
94625
+ mib: sumAll(map$8(rest, (app) => app.mib)),
94626
+ name: "other"
94627
+ }];
94628
+ }
94629
+ function workerHistory(machine, minutes, labels) {
94630
+ const latest = last(machine.samples);
94631
+ const storageTotal = diskTotal(machine);
94632
+ return {
94633
+ apps: match$8(latest, {
94634
+ onNone: () => [],
94635
+ onSome: (sample) => appsOf(labels, sample)
94636
+ }),
94637
+ cpuPct: series(machine, minutes, (sample) => fromUndefinedOr(sample.cpu)),
94638
+ diskPct: series(machine, minutes, (sample) => flatMap$7(diskUsed(sample), (used) => map$11(storageTotal, (total) => used / total * 100))),
94639
+ ...match$1(isNonEmpty$1(machine.error), {
94640
+ onFalse: () => ({}),
94641
+ onTrue: () => ({ error: machine.error })
94642
+ }),
94643
+ from: formatIso(makeUnsafe$4(chartWindow(minutes, machine.time).start)),
94644
+ memoryPct: series(machine, minutes, (sample) => some$1(sample.memoryUsed / sample.memoryTotal * 100)),
94645
+ ...match$8(latest, {
94646
+ onNone: () => ({}),
94647
+ onSome: (sample) => ({ now: {
94648
+ ...getSomes$1({ cpuPct: map$11(fromUndefinedOr(sample.cpu), rounded) }),
94649
+ ...getSomes$1({
94650
+ diskGiB: map$11(diskUsed(sample), (used) => rounded(used / 1024 ** 3)),
94651
+ diskTotalGiB: map$11(storageTotal, (total) => rounded(total / 1024 ** 3))
94652
+ }),
94653
+ ...getSomes$1({ load: filter$5(fromUndefinedOr(sample.load), isReadonlyArrayNonEmpty) }),
94654
+ memoryGiB: rounded(sample.memoryUsed / 1024 ** 3),
94655
+ memoryTotalGiB: rounded(sample.memoryTotal / 1024 ** 3)
94656
+ } })
94657
+ }),
94658
+ ...match$1(machine.stale, {
94659
+ onFalse: () => ({}),
94660
+ onTrue: () => ({ stale: true })
94661
+ }),
94662
+ stepSeconds: resolution(minutes) / 1e3,
94663
+ worker: machine.worker
94664
+ };
94665
+ }
94666
+ function resourceHistory(machines, input, names) {
94667
+ return pipe(filter$3(machines, (machine) => input.worker === void 0 || machine.worker === input.worker), map$8((machine) => workerHistory(machine, input.minutes, names[machine.worker] ?? {})));
94668
+ }
93670
94669
  // src/tools/handlers.ts
93671
94670
  const ToolHandlers = Tools.toLayer(map$5(Fleet, (fleet) => Tools.of({
93672
- expose_port: fleet.expose,
94671
+ expose_port: (input) => map$5(fleet.expose(input), (url) => ({ url })),
93673
94672
  hide_exposure: fleet.hide,
93674
- inventory: () => fleet.snapshot,
93675
- resource_history: fnUntraced(function* (query) {
93676
- return map$8(yield* fleet.metrics(query), (machine) => compactHistory(machine, query.minutes));
94673
+ list_apps: (input) => map$5(fleet.snapshot, (snapshot) => listApps(snapshot, input)),
94674
+ resource_history: fnUntraced(function* (input) {
94675
+ const value = yield* all$1({
94676
+ machines: fleet.metrics({ minutes: input.minutes }),
94677
+ snapshot: fleet.snapshot
94678
+ }, { concurrency: "unbounded" });
94679
+ return resourceHistory(value.machines, input, ownerNames(value.snapshot));
94680
+ }),
94681
+ run_job: fnUntraced(function* (input) {
94682
+ yield* fleet.run(yield* jobRequest(yield* fleet.snapshot, input));
94683
+ return { started: true };
93677
94684
  })
93678
94685
  })));
93679
94686
  // src/main.server.ts
@@ -93684,7 +94691,7 @@ runApp({
93684
94691
  group: RpcContracts,
93685
94692
  handlers: RpcHandlers
93686
94693
  }), layerMcp({
93687
- instructions: "Deploy observes services, containers and ports and manages explicitly owned HTTPS exposure.",
94694
+ instructions: "Start with list_apps to see what runs on the workers; Deploy also shows resource history, manages explicitly owned HTTPS exposure and starts scheduled jobs.",
93688
94695
  registrations: pipe(toolkit(Tools), provide$2(ToolHandlers))
93689
94696
  })), provide$2(layerServices), provide$2(layerPeerAuth)),
93690
94697
  settings: { DEPLOY_WORKERS: {