@deslop/deploy 0.1.1239 → 0.1.1242

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
@@ -3822,7 +3822,7 @@ const isGreaterThanOrEqualTo$3 = (O) => dual(2, (self, that) => O(self, that) !=
3822
3822
  * @category comparisons
3823
3823
  * @since 2.0.0
3824
3824
  */
3825
- const min$2 = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
3825
+ const min$3 = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
3826
3826
  /**
3827
3827
  * Returns the maximum of two values according to the given order. If they are equal, returns the first argument.
3828
3828
  *
@@ -3854,7 +3854,7 @@ const min$2 = (O) => dual(2, (self, that) => self === that || O(self, that) < 1
3854
3854
  * @category comparisons
3855
3855
  * @since 2.0.0
3856
3856
  */
3857
- const max$1 = (O) => dual(2, (self, that) => self === that || O(self, that) > -1 ? self : that);
3857
+ const max$2 = (O) => dual(2, (self, that) => self === that || O(self, that) > -1 ? self : that);
3858
3858
  /**
3859
3859
  * Restricts a value between a minimum and a maximum according to the given order.
3860
3860
  *
@@ -3889,7 +3889,7 @@ const max$1 = (O) => dual(2, (self, that) => self === that || O(self, that) > -1
3889
3889
  * @category comparisons
3890
3890
  * @since 2.0.0
3891
3891
  */
3892
- const clamp$1 = (O) => dual(2, (self, options) => min$2(O)(options.maximum, max$1(O)(options.minimum, self)));
3892
+ const clamp$1 = (O) => dual(2, (self, options) => min$3(O)(options.maximum, max$2(O)(options.minimum, self)));
3893
3893
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Option.js
3894
3894
  /**
3895
3895
  * Creates an `Option` representing the absence of a value.
@@ -4323,44 +4323,6 @@ const liftThrowable = (f) => (...a) => {
4323
4323
  }
4324
4324
  };
4325
4325
  /**
4326
- * Extracts the value from a `Some`, or throws a default `Error` for `None`.
4327
- *
4328
- * **When to use**
4329
- *
4330
- * Use when you need quick fail-fast unwrapping of an `Option` and a generic
4331
- * error is acceptable.
4332
- *
4333
- * **Details**
4334
- *
4335
- * - `Some` → returns the inner value
4336
- * - `None` → throws `new Error("getOrThrow called on a None")`
4337
- *
4338
- * **Example** (Throwing a default error)
4339
- *
4340
- * ```ts import.meta.vitest
4341
- * import { Option, Result } from "effect"
4342
- *
4343
- * Option.getOrThrow(Option.some(1)) // => 1
4344
- *
4345
- * const failure = Result.try({
4346
- * try: () => Option.getOrThrow(Option.none()),
4347
- * catch: (error) => (error as Error).message
4348
- * })
4349
- * Result.getFailure(failure).pipe(Option.getOrElse(() => "no error")) // => "getOrThrow called on a None"
4350
- * ```
4351
- *
4352
- * @see {@link getOrThrowWith} for a custom error
4353
- * @see {@link getOrElse} for a non-throwing alternative
4354
- *
4355
- * @stability stable
4356
- * @category converting
4357
- * @since 2.0.0
4358
- */
4359
- const getOrThrow$1 = /*#__PURE__*/ (/* @__PURE__ */ dual(2, (self, onNone) => {
4360
- if (isSome(self)) return self.value;
4361
- throw onNone();
4362
- }))(() => /* @__PURE__ */ new Error("getOrThrow called on a None"));
4363
- /**
4364
4326
  * Transforms the value inside a `Some` using the provided function, leaving
4365
4327
  * `None` unchanged.
4366
4328
  *
@@ -4436,6 +4398,35 @@ const map$11 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some$1
4436
4398
  */
4437
4399
  const flatMap$7 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : f(self.value));
4438
4400
  /**
4401
+ * Flattens a nested `Option<Option<A>>` into `Option<A>`.
4402
+ *
4403
+ * **When to use**
4404
+ *
4405
+ * Use when you need to remove one layer of nested `Option`.
4406
+ *
4407
+ * **Details**
4408
+ *
4409
+ * - `Some(Some(value))` → `Some(value)`
4410
+ * - `Some(None)` → `None`
4411
+ * - `None` → `None`
4412
+ *
4413
+ * **Example** (Flattening nested Options)
4414
+ *
4415
+ * ```ts import.meta.vitest
4416
+ * import { Option } from "effect"
4417
+ *
4418
+ * Option.flatten(Option.some(Option.some("value"))) // => Option.some("value")
4419
+ * Option.flatten(Option.some(Option.none())) // => Option.none()
4420
+ * ```
4421
+ *
4422
+ * @see {@link flatMap} which is `map` + `flatten`
4423
+ *
4424
+ * @stability stable
4425
+ * @category sequencing
4426
+ * @since 2.0.0
4427
+ */
4428
+ const flatten$5 = /*#__PURE__*/ flatMap$7(identity);
4429
+ /**
4439
4430
  * Converts an `Option` into an `Array`.
4440
4431
  *
4441
4432
  * **When to use**
@@ -5203,7 +5194,7 @@ const getOption = /*#__PURE__*/ dual(2, (self, service) => {
5203
5194
  * @category combining
5204
5195
  * @since 2.0.0
5205
5196
  */
5206
- const merge$4 = /*#__PURE__*/ dual(2, (self, that) => {
5197
+ const merge$5 = /*#__PURE__*/ dual(2, (self, that) => {
5207
5198
  if (self.mapUnsafe.size === 0) return that;
5208
5199
  if (that.mapUnsafe.size === 0) return self;
5209
5200
  return withFlat(self, (map) => that.mapUnsafe.forEach((value, key) => map.set(key, value)));
@@ -8013,7 +8004,7 @@ const Equivalence$3 = (self, that) => matchPair(self, that, {
8013
8004
  * @category ordering
8014
8005
  * @since 2.0.0
8015
8006
  */
8016
- const min$1 = /*#__PURE__*/ min$2(Order$4);
8007
+ const min$2 = /*#__PURE__*/ min$3(Order$4);
8017
8008
  /**
8018
8009
  * Returns the larger of two Durations.
8019
8010
  *
@@ -8029,7 +8020,7 @@ const min$1 = /*#__PURE__*/ min$2(Order$4);
8029
8020
  * @category ordering
8030
8021
  * @since 2.0.0
8031
8022
  */
8032
- const max = /*#__PURE__*/ max$1(Order$4);
8023
+ const max$1 = /*#__PURE__*/ max$2(Order$4);
8033
8024
  /**
8034
8025
  * Adds two Durations together.
8035
8026
  *
@@ -9734,7 +9725,7 @@ const fiberInterrupt = (self) => withFiber$1((fiber) => fiberInterruptAs(self, f
9734
9725
  /** @internal */
9735
9726
  const fiberInterruptAs = /*#__PURE__*/ dual((args) => hasProperty(args[0], FiberTypeId), (self, fiberId, annotations) => withFiber$1((parent) => {
9736
9727
  let ann = fiberStackAnnotations(parent);
9737
- ann = ann && annotations ? merge$4(ann, annotations) : ann ?? annotations;
9728
+ ann = ann && annotations ? merge$5(ann, annotations) : ann ?? annotations;
9738
9729
  self.interruptUnsafe(fiberId, ann);
9739
9730
  return asVoid$1(fiberAwait(self));
9740
9731
  }));
@@ -10249,7 +10240,7 @@ const contextWith$1 = (f) => withFiber$1((fiber) => f(fiber.context));
10249
10240
  /** @internal */
10250
10241
  const provideContext$3 = /*#__PURE__*/ dual(2, (self, context) => {
10251
10242
  if (effectIsExit(self)) return self;
10252
- return updateContext$1(self, merge$4(context));
10243
+ return updateContext$1(self, merge$5(context));
10253
10244
  });
10254
10245
  /** @internal */
10255
10246
  const provideService$1 = function() {
@@ -14467,7 +14458,7 @@ const mergeAll$1 = (...layers) => fromBuildMemo((memoMap, scope) => mergeAllEffe
14467
14458
  * @category zipping
14468
14459
  * @since 2.0.0
14469
14460
  */
14470
- const merge$3 = /*#__PURE__*/ dual(2, (self, that) => mergeAll$1(self, ...Array.isArray(that) ? that : [that]));
14461
+ const merge$4 = /*#__PURE__*/ dual(2, (self, that) => mergeAll$1(self, ...Array.isArray(that) ? that : [that]));
14471
14462
  const provideWith = (self, that, f) => fromBuildMemo((memoMap, scope) => flatMap$4(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), (context) => self.build(memoMap, scope).pipe(provideContext$3(context), map$7((merged) => f(merged, context)))));
14472
14463
  /**
14473
14464
  * Feeds the output services of the dependency layer into the requirements of
@@ -14638,7 +14629,7 @@ const provide$2 = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, that,
14638
14629
  * @category providing services
14639
14630
  * @since 2.0.0
14640
14631
  */
14641
- const provideMerge = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, that, (self, that) => merge$4(that, self)));
14632
+ const provideMerge = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, that, (self, that) => merge$5(that, self)));
14642
14633
  /**
14643
14634
  * Constructs a layer dynamically based on the output of this layer.
14644
14635
  *
@@ -15355,6 +15346,50 @@ const isGreaterThanOrEqualTo$2 = /*#__PURE__*/ isGreaterThanOrEqualTo$3(Order$3)
15355
15346
  */
15356
15347
  const clamp = /*#__PURE__*/ clamp$1(Order$3);
15357
15348
  /**
15349
+ * Returns the minimum between two `number`s.
15350
+ *
15351
+ * **When to use**
15352
+ *
15353
+ * Use to select the smaller of two numbers.
15354
+ *
15355
+ * **Example** (Finding the minimum)
15356
+ *
15357
+ * ```ts import.meta.vitest
15358
+ * import { Number } from "effect"
15359
+ *
15360
+ * Number.min(2, 3) // => 2
15361
+ * ```
15362
+ *
15363
+ * @see {@link max} for selecting the larger value
15364
+ *
15365
+ * @stability stable
15366
+ * @category math
15367
+ * @since 2.0.0
15368
+ */
15369
+ const min$1 = /*#__PURE__*/ min$3(Order$3);
15370
+ /**
15371
+ * Returns the maximum between two `number`s.
15372
+ *
15373
+ * **When to use**
15374
+ *
15375
+ * Use to select the larger of two numbers.
15376
+ *
15377
+ * **Example** (Finding the maximum)
15378
+ *
15379
+ * ```ts import.meta.vitest
15380
+ * import { Number } from "effect"
15381
+ *
15382
+ * Number.max(2, 3) // => 3
15383
+ * ```
15384
+ *
15385
+ * @see {@link min} for selecting the smaller value
15386
+ *
15387
+ * @stability stable
15388
+ * @category math
15389
+ * @since 2.0.0
15390
+ */
15391
+ const max = /*#__PURE__*/ max$2(Order$3);
15392
+ /**
15358
15393
  * Parses a `number` from a `string` safely using the `Number()` function.
15359
15394
  * The following special string values are supported: "NaN", "Infinity", "-Infinity".
15360
15395
  *
@@ -16123,7 +16158,7 @@ const minDuration = (results) => {
16123
16158
  let min = void 0;
16124
16159
  for (let i = 0; i < results.length; i++) {
16125
16160
  const duration = results[i];
16126
- if (duration !== void 0) min = min === void 0 ? duration : min$1(min, duration);
16161
+ if (duration !== void 0) min = min === void 0 ? duration : min$2(min, duration);
16127
16162
  }
16128
16163
  return min;
16129
16164
  };
@@ -16157,6 +16192,63 @@ const exponential = (base, factor = 2) => {
16157
16192
  }));
16158
16193
  };
16159
16194
  /**
16195
+ * Returns a `Schedule` that recurs on the specified fixed `interval` and
16196
+ * outputs the number of repetitions of the schedule so far.
16197
+ *
16198
+ * **When to use**
16199
+ *
16200
+ * Use when recurrences should stay aligned to a regular cadence.
16201
+ *
16202
+ * **Gotchas**
16203
+ *
16204
+ * If the action run between recurrences takes longer than the interval, the
16205
+ * next recurrence happens immediately, but missed intervals are not replayed.
16206
+ *
16207
+ * ```text
16208
+ * |-----interval-----|-----interval-----|-----interval-----|
16209
+ * |---------action--------||action|-----|action|-----------|
16210
+ * ```
16211
+ *
16212
+ * **Example** (Repeating on fixed intervals)
16213
+ *
16214
+ * ```ts import.meta.vitest
16215
+ * import { Duration, Effect, Schedule } from "effect"
16216
+ *
16217
+ * const program = Effect.gen(function*() {
16218
+ * const step = yield* Schedule.toStep(Schedule.fixed("1 second"))
16219
+ * return yield* step(0, undefined)
16220
+ * })
16221
+ *
16222
+ * await Effect.runPromise(program) // => [0, Duration.seconds(1)]
16223
+ * ```
16224
+ *
16225
+ * @see {@link spaced} for delaying after each action completes
16226
+ *
16227
+ * @stability stable
16228
+ * @category constructors
16229
+ * @since 2.0.0
16230
+ */
16231
+ const fixed = (interval) => {
16232
+ const window = toMillis(fromInputUnsafe$1(interval));
16233
+ return fromStepWithMetadata(sync$2(() => {
16234
+ let start = 0;
16235
+ let lastRun = 0;
16236
+ return (meta) => sync$2(() => {
16237
+ if (window === 0) return [meta.attempt - 1, zero$2];
16238
+ if (meta.attempt === 1) {
16239
+ start = meta.now;
16240
+ lastRun = meta.now + window;
16241
+ return [0, millis(window)];
16242
+ }
16243
+ const runningBehind = meta.now > lastRun + window;
16244
+ const boundary = window - (meta.now - start) % window;
16245
+ const delay = runningBehind ? 0 : isZero$1(millis(boundary)) ? window : boundary;
16246
+ lastRun = runningBehind ? meta.now : meta.now + delay;
16247
+ return [meta.attempt - 1, millis(delay)];
16248
+ });
16249
+ }));
16250
+ };
16251
+ /**
16160
16252
  * Returns a new `Schedule` that modifies the delay of the next recurrence
16161
16253
  * of the schedule using the specified effectful function.
16162
16254
  *
@@ -29353,7 +29445,7 @@ const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$63({
29353
29445
  * @category combinators
29354
29446
  * @since 4.0.0
29355
29447
  */
29356
- const merge$2 = /*#__PURE__*/ dual(2, (self, headers) => {
29448
+ const merge$3 = /*#__PURE__*/ dual(2, (self, headers) => {
29357
29449
  const out = make$63(self);
29358
29450
  Object.assign(out, headers);
29359
29451
  return out;
@@ -41192,6 +41284,29 @@ const flattenArray = (self) => transformPull$1(self, (pull) => {
41192
41284
  return succeed$5(pump);
41193
41285
  });
41194
41286
  /**
41287
+ * Creates a new channel that consumes all output from the source channel
41288
+ * but emits nothing, preserving only the completion value.
41289
+ *
41290
+ * **Example** (Draining channel output)
41291
+ *
41292
+ * ```ts import.meta.vitest
41293
+ * import { Channel, Effect } from "effect"
41294
+ *
41295
+ * // Create a channel that outputs values
41296
+ * const sourceChannel = Channel.fromIterable([1, 2, 3, 4, 5])
41297
+ *
41298
+ * // Drain all output, keeping only the completion
41299
+ * const drainedChannel = Channel.drain(sourceChannel)
41300
+ *
41301
+ * Effect.runSync(Channel.runCollect(drainedChannel)) // => []
41302
+ * ```
41303
+ *
41304
+ * @stability stable
41305
+ * @category constructors
41306
+ * @since 2.0.0
41307
+ */
41308
+ const drain$2 = (self) => transformPull$1(self, (pull) => succeed$5(forever(pull, { disableYield: true })));
41309
+ /**
41195
41310
  * Catches any cause of failure from the channel and allows recovery by
41196
41311
  * creating a new channel based on the caught cause.
41197
41312
  *
@@ -41422,7 +41537,7 @@ const mergeAll = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency
41422
41537
  * @category combining
41423
41538
  * @since 4.0.0
41424
41539
  */
41425
- const merge$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]) && isChannel(args[1]), (left, right, options) => fromTransformBracket(fnUntraced(function* (upstream, _scope, forkedScope) {
41540
+ const merge$2 = /*#__PURE__*/ dual((args) => isChannel(args[0]) && isChannel(args[1]), (left, right, options) => fromTransformBracket(fnUntraced(function* (upstream, _scope, forkedScope) {
41426
41541
  const strategy = options?.haltStrategy ?? "both";
41427
41542
  const queue = yield* bounded(0);
41428
41543
  yield* addFinalizer$1(forkedScope, shutdown(queue));
@@ -41463,7 +41578,7 @@ const merge$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]) && isChannel(arg
41463
41578
  * @category combining
41464
41579
  * @since 4.0.0
41465
41580
  */
41466
- const mergeEffect$1 = /*#__PURE__*/ dual(2, (self, effect) => merge$1(self, fromEffectDrain(effect), { haltStrategy: "left" }));
41581
+ const mergeEffect$1 = /*#__PURE__*/ dual(2, (self, effect) => merge$2(self, fromEffectDrain(effect), { haltStrategy: "left" }));
41467
41582
  /**
41468
41583
  * Splits upstream string chunks into lines, recognizing `\n`, `\r\n`, and
41469
41584
  * standalone `\r` as line terminators. The behavior matches
@@ -41712,7 +41827,7 @@ const unwrap$5 = (channel) => fromTransform$1((upstream, scope) => {
41712
41827
  * @category interruption
41713
41828
  * @since 2.0.0
41714
41829
  */
41715
- const interruptWhen$1 = /*#__PURE__*/ dual(2, (self, effect) => merge$1(self, fromPull$1(succeed$5(flatMap$2(effect, done$1))), { haltStrategy: "either" }));
41830
+ const interruptWhen$1 = /*#__PURE__*/ dual(2, (self, effect) => merge$2(self, fromPull$1(succeed$5(flatMap$2(effect, done$1))), { haltStrategy: "either" }));
41716
41831
  /**
41717
41832
  * Returns a channel with an exit-aware finalizer that is guaranteed to run once
41718
41833
  * the channel begins execution, whether it succeeds or fails.
@@ -42816,7 +42931,7 @@ const toChannel$1 = (self) => fromTransform$1((upstream, scope) => succeed$5(fla
42816
42931
  * @category constructors
42817
42932
  * @since 2.0.0
42818
42933
  */
42819
- const drain = /*#__PURE__*/ fromTransform((upstream) => catchDone(forever(upstream, { disableYield: true }), () => endVoid));
42934
+ const drain$1 = /*#__PURE__*/ fromTransform((upstream) => catchDone(forever(upstream, { disableYield: true }), () => endVoid));
42820
42935
  /**
42821
42936
  * A sink that executes the provided effectful function for every item fed
42822
42937
  * to it.
@@ -43916,6 +44031,27 @@ const mapArray = /*#__PURE__*/ dual(2, (self, f) => fromChannel(map$4(self.chann
43916
44031
  */
43917
44032
  const mapEffect$1 = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray, mapEffect$2(f, options), map$4(of), fromChannel));
43918
44033
  /**
44034
+ * Converts this stream to one that runs its effects but emits no elements.
44035
+ *
44036
+ * **Example** (Draining stream values)
44037
+ *
44038
+ * ```ts import.meta.vitest
44039
+ * import { Effect, Stream } from "effect"
44040
+ *
44041
+ * const program = Effect.gen(function*() {
44042
+ * const result = yield* Stream.range(1, 6).pipe(Stream.drain, Stream.runCollect)
44043
+ * result // => []
44044
+ * })
44045
+ *
44046
+ * await Effect.runPromise(program)
44047
+ * ```
44048
+ *
44049
+ * @stability stable
44050
+ * @category sequencing
44051
+ * @since 2.0.0
44052
+ */
44053
+ const drain = (self) => fromChannel(drain$2(self.channel));
44054
+ /**
43919
44055
  * Runs the provided stream in the background while this stream runs, interrupting it
43920
44056
  * when this stream completes and failing if the background stream fails or defects.
43921
44057
  *
@@ -44022,7 +44158,7 @@ function* concatChannels(self, that) {
44022
44158
  * @category merging
44023
44159
  * @since 2.0.0
44024
44160
  */
44025
- const merge = /*#__PURE__*/ dual((args) => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(merge$1(toChannel(self), toChannel(that), options)));
44161
+ const merge$1 = /*#__PURE__*/ dual((args) => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(merge$2(toChannel(self), toChannel(that), options)));
44026
44162
  /**
44027
44163
  * Merges this stream with a background effect, keeping the stream's elements.
44028
44164
  *
@@ -47600,6 +47736,41 @@ const get$1 = (self) => sync(() => self.ref.current);
47600
47736
  */
47601
47737
  const set$1 = /*#__PURE__*/ dual(2, (self, value) => sync(() => set$2(self.ref, value)));
47602
47738
  /**
47739
+ * Gets the current value of the Ref, sets it to the specified value, and returns the previous value atomically.
47740
+ *
47741
+ * **When to use**
47742
+ *
47743
+ * Use to replace a plain `Ref` value while returning the previous value.
47744
+ *
47745
+ * **Example** (Replacing a value atomically)
47746
+ *
47747
+ * ```ts import.meta.vitest
47748
+ * import { Effect, Ref } from "effect"
47749
+ *
47750
+ * const program = Effect.gen(function*() {
47751
+ * const ref = yield* Ref.make("initial")
47752
+ *
47753
+ * const previous = yield* Ref.getAndSet(ref, "updated")
47754
+ * const current = yield* Ref.get(ref)
47755
+ * return [previous, current]
47756
+ * })
47757
+ *
47758
+ * await Effect.runPromise(program) // => ["initial", "updated"]
47759
+ * ```
47760
+ *
47761
+ * @see {@link set} for setting without returning the previous value
47762
+ * @see {@link getAndUpdate} for deriving the new value from the previous value
47763
+ *
47764
+ * @stability stable
47765
+ * @category mutations
47766
+ * @since 2.0.0
47767
+ */
47768
+ const getAndSet = /*#__PURE__*/ dual(2, (self, value) => sync(() => {
47769
+ const current = self.ref.current;
47770
+ self.ref.current = value;
47771
+ return current;
47772
+ }));
47773
+ /**
47603
47774
  * Modifies the value of the Ref atomically using the given function.
47604
47775
  *
47605
47776
  * **When to use**
@@ -47692,37 +47863,6 @@ const modify$1 = /*#__PURE__*/ dual(2, (self, f) => sync(() => {
47692
47863
  const update$1 = /*#__PURE__*/ dual(2, (self, f) => sync(() => {
47693
47864
  self.ref.current = f(self.ref.current);
47694
47865
  }));
47695
- /**
47696
- * Updates the value of the Ref atomically using the given function and returns the new value.
47697
- *
47698
- * **When to use**
47699
- *
47700
- * Use to apply a `Ref` state transition and return the new stored value.
47701
- *
47702
- * **Example** (Updating and returning the new value)
47703
- *
47704
- * ```ts import.meta.vitest
47705
- * import { Effect, Ref } from "effect"
47706
- *
47707
- * const program = Effect.gen(function*() {
47708
- * const counter = yield* Ref.make(5)
47709
- *
47710
- * const newValue = yield* Ref.updateAndGet(counter, (n) => n * 3)
47711
- * const current = yield* Ref.get(counter)
47712
- * return [newValue, current]
47713
- * })
47714
- *
47715
- * await Effect.runPromise(program) // => [15, 15]
47716
- * ```
47717
- *
47718
- * @see {@link update} for updating without returning the new value
47719
- * @see {@link getAndUpdate} for returning the previous value instead
47720
- *
47721
- * @stability stable
47722
- * @category mutations
47723
- * @since 2.0.0
47724
- */
47725
- const updateAndGet = /*#__PURE__*/ dual(2, (self, f) => sync(() => self.ref.current = f(self.ref.current)));
47726
47866
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/UndefinedOr.js
47727
47867
  /**
47728
47868
  * Pattern matches on an `A | undefined` value, running `onDefined` when the
@@ -50013,7 +50153,7 @@ const Proto$11 = {
50013
50153
  return clone(this, { annotations: add$1(this.annotations, tag, value) });
50014
50154
  },
50015
50155
  annotateMerge(context) {
50016
- return clone(this, { annotations: merge$4(this.annotations, context) });
50156
+ return clone(this, { annotations: merge$5(this.annotations, context) });
50017
50157
  }
50018
50158
  };
50019
50159
  ({ ...Proto$11 });
@@ -50548,7 +50688,7 @@ const Proto$10 = {
50548
50688
  result,
50549
50689
  isFailure: false,
50550
50690
  preliminary: false
50551
- })), updateContext((input) => merge$4(schemas.context, input)), matchCauseEffect({
50691
+ })), updateContext((input) => merge$5(schemas.context, input)), matchCauseEffect({
50552
50692
  onFailure: (cause) => failCause$2(queue, cause),
50553
50693
  onSuccess: () => end$1(queue)
50554
50694
  }), forkChild);
@@ -52113,7 +52253,7 @@ const retryTransient = /*#__PURE__*/ dual(2, (self, options) => {
52113
52253
  const parseRetryAfter = (nowMillis, value) => {
52114
52254
  if (value === void 0) return;
52115
52255
  const retryAfter = parseRetryAfter$1(value);
52116
- return isSuccess$1(retryAfter) ? max(retryAfterDelay$1(retryAfter.success, nowMillis), millis(1)) : void 0;
52256
+ return isSuccess$1(retryAfter) ? max$1(retryAfterDelay$1(retryAfter.success, nowMillis), millis(1)) : void 0;
52117
52257
  };
52118
52258
  /**
52119
52259
  * Performs an additional effect after a successful request.
@@ -52191,7 +52331,7 @@ const SpanNameGenerator$1 = /*#__PURE__*/ Reference("effect/http/HttpClient/Span
52191
52331
  * @category layers
52192
52332
  * @since 4.0.0
52193
52333
  */
52194
- const layerMergedContext = (effect$1) => effect(HttpClient)(contextWith((context) => map$5(effect$1, (client) => transformResponse(client, updateContext((input) => merge$4(context, input))))));
52334
+ const layerMergedContext = (effect$1) => effect(HttpClient)(contextWith((context) => map$5(effect$1, (client) => transformResponse(client, updateContext((input) => merge$5(context, input))))));
52195
52335
  const responseRegistry = /*#__PURE__*/ (() => {
52196
52336
  if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
52197
52337
  const registry = /*#__PURE__*/ new FinalizationRegistry((controller) => {
@@ -52347,7 +52487,7 @@ const retryAfterOf = (input, nowMillis) => {
52347
52487
  const withRetryAfter = (schedule) => fromStep(map$5(toStep(schedule), (step) => (now, input) => {
52348
52488
  const retryAfter = retryAfterOf(input, now);
52349
52489
  if (retryAfter === void 0) return step(now, input);
52350
- return map$5(step(now, input), ([output, delay]) => [output, max(delay, retryAfter)]);
52490
+ return map$5(step(now, input), ([output, delay]) => [output, max$1(delay, retryAfter)]);
52351
52491
  }));
52352
52492
  /**
52353
52493
  * Returns `true` for a response whose status `retryTransient` retries by
@@ -52883,7 +53023,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
52883
53023
  }),
52884
53024
  upgrade: SocketUpgradeError.unsupported
52885
53025
  };
52886
- }).pipe(updateContext((input) => merge$4(acquireContext, input)));
53026
+ }).pipe(updateContext((input) => merge$5(acquireContext, input)));
52887
53027
  const write = (chunk) => suspend$2(() => {
52888
53028
  const ws = currentWS;
52889
53029
  if (ws === void 0) return latch.whenOpen(write(chunk));
@@ -53221,7 +53361,7 @@ const Proto$6 = {
53221
53361
  errorSchema: this.errorSchema,
53222
53362
  defectSchema: this.defectSchema,
53223
53363
  middlewares: this.middlewares,
53224
- annotations: merge$4(this.annotations, context)
53364
+ annotations: merge$5(this.annotations, context)
53225
53365
  });
53226
53366
  }
53227
53367
  };
@@ -57739,7 +57879,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
57739
57879
  spanId: span.spanId,
57740
57880
  sampled: span.sampled
57741
57881
  } : {},
57742
- headers: merge$2(parentFiber.getRef(CurrentHeaders), headers),
57882
+ headers: merge$3(parentFiber.getRef(CurrentHeaders), headers),
57743
57883
  ...discard ? { discard: true } : {}
57744
57884
  });
57745
57885
  let fiber;
@@ -57810,7 +57950,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
57810
57950
  spanId: span.spanId,
57811
57951
  sampled: span.sampled
57812
57952
  } : {},
57813
- headers: merge$2(fiber.getRef(CurrentHeaders), headers)
57953
+ headers: merge$3(fiber.getRef(CurrentHeaders), headers)
57814
57954
  }).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, onError((cause) => {
57815
57955
  if (!hasInterruptsOnly(cause)) entries.delete(id);
57816
57956
  return failCause$2(queue, cause);
@@ -58383,12 +58523,12 @@ const RpcGroupProto = {
58383
58523
  annotateMerge(context) {
58384
58524
  return makeProto({
58385
58525
  requests: this.requests,
58386
- annotations: merge$4(this.annotations, context)
58526
+ annotations: merge$5(this.annotations, context)
58387
58527
  });
58388
58528
  },
58389
58529
  annotateRpcsMerge(context) {
58390
58530
  const requests = /* @__PURE__ */ new Map();
58391
- for (const [tag, rpc] of this.requests) requests.set(tag, rpc.annotateMerge(merge$4(context, rpc.annotations)));
58531
+ for (const [tag, rpc] of this.requests) requests.set(tag, rpc.annotateMerge(merge$5(context, rpc.annotations)));
58392
58532
  return makeProto({
58393
58533
  requests,
58394
58534
  annotations: this.annotations
@@ -58472,7 +58612,7 @@ const Service = () => (id, options) => {
58472
58612
  const layerClient = (tag, service) => effectContext(gen(function* () {
58473
58613
  const services = (yield* context()).pipe(omit$2(Scope));
58474
58614
  const middleware = isEffect(service) ? yield* service : service;
58475
- return makeUnsafe$9(/* @__PURE__ */ new Map([[`${tag.key}/Client`, (options) => updateContext(middleware(options), (requestContext) => merge$4(services, requestContext))]]));
58615
+ return makeUnsafe$9(/* @__PURE__ */ new Map([[`${tag.key}/Client`, (options) => updateContext(middleware(options), (requestContext) => merge$5(services, requestContext))]]));
58476
58616
  }));
58477
58617
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/ai/McpSchema.js
58478
58618
  /**
@@ -63878,7 +64018,7 @@ const redirect = (location, options) => {
63878
64018
  return makeResponse({
63879
64019
  status: options?.status ?? 302,
63880
64020
  statusText: options?.statusText,
63881
- headers: options?.headers ? merge$2(headers, fromInput$1(options.headers)) : headers,
64021
+ headers: options?.headers ? merge$3(headers, fromInput$1(options.headers)) : headers,
63882
64022
  cookies: options?.cookies ?? empty$7
63883
64023
  });
63884
64024
  };
@@ -64195,7 +64335,7 @@ const make$26 = /*#__PURE__*/ fnUntraced(function* (impl) {
64195
64335
  }),
64196
64336
  fileWebResponse(file, options) {
64197
64337
  return map$5(etagGen.fromFileWeb(file), (etag) => {
64198
- const headers = merge$2(optionHeaders(options), fromRecordUnsafe({
64338
+ const headers = merge$3(optionHeaders(options), fromRecordUnsafe({
64199
64339
  etag: toString(etag),
64200
64340
  "last-modified": new Date(file.lastModified).toUTCString()
64201
64341
  }));
@@ -68580,7 +68720,7 @@ const serve = (appLayer, options) => {
68580
68720
  return buildWithMemoMap(layerWithRouter, memoMap, get$11(context, Scope));
68581
68721
  }).pipe(map$5((context) => {
68582
68722
  const handler = get$11(context, HttpRouter).asHttpEffect();
68583
- return merge$3(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
68723
+ return merge$4(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
68584
68724
  }), unwrap$7, options?.disableListenLog ? identity : withLogAddress);
68585
68725
  };
68586
68726
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/rpc/RpcServer.js
@@ -68882,7 +69022,7 @@ const handlerContext = (entry, fiberContext) => {
68882
69022
  }
68883
69023
  let merged = cache.get(fiberContext);
68884
69024
  if (merged === void 0) {
68885
- merged = merge$4(entry.context, fiberContext);
69025
+ merged = merge$5(entry.context, fiberContext);
68886
69026
  cache.set(fiberContext, merged);
68887
69027
  }
68888
69028
  return merged;
@@ -69558,7 +69698,7 @@ const runMiddleware = (handler, middleware, invocation, request) => {
69558
69698
  const makeInvoke = (context, globalMiddleware) => {
69559
69699
  const services = context === void 0 ? empty$14() : omitRequestServices(context);
69560
69700
  const localMiddleware = context === void 0 ? [] : getMiddleware(context);
69561
- const invoke = (handler, invocation, request) => runMiddleware(services.mapUnsafe.size === 0 ? handler : updateContext(handler, (context) => merge$4(services, context)), middlewareStack(localMiddleware, globalMiddleware), invocation, request).pipe(catchHidden(() => fail$6(notFound(request.method, request.target))));
69701
+ 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$6(notFound(request.method, request.target))));
69562
69702
  const visible = (method, target) => (invocation) => {
69563
69703
  const middleware = middlewareStack(localMiddleware, globalMiddleware);
69564
69704
  const innermost = middleware.findIndex((fn) => gates.has(fn));
@@ -70493,7 +70633,7 @@ const toServerSentEvents = (response, keepAlive) => {
70493
70633
  const events = response.body.stream.pipe(map$3(frame));
70494
70634
  if (!keepAlive) return stream$1(events, options);
70495
70635
  const keepAliveComments = tick("15 seconds").pipe(drop(1), map$3(() => encoder.encode(": keepalive\n\n")));
70496
- return stream$1(merge(events, keepAliveComments, { haltStrategy: "left" }), options);
70636
+ return stream$1(merge$1(events, keepAliveComments, { haltStrategy: "left" }), options);
70497
70637
  }
70498
70638
  if (response.body._tag === "Uint8Array") return uint8Array(frame(response.body.body), options);
70499
70639
  return setHeader(response, "content-type", "text/event-stream");
@@ -71688,13 +71828,13 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
71688
71828
  const runInputStream = (stream, sink, inputFailure) => forkScoped(run$4(tapError$1(stream, (error) => fail$7(inputFailure, error)), sink));
71689
71829
  const setupAdditionalFds = fnUntraced(function* (command, childProcess, additionalFds, inputFailure) {
71690
71830
  if (additionalFds.length === 0) return {
71691
- getInputFd: () => drain,
71831
+ getInputFd: () => drain$1,
71692
71832
  getOutputFd: () => empty$3
71693
71833
  };
71694
71834
  const inputSinks = /* @__PURE__ */ new Map();
71695
71835
  const outputStreams = /* @__PURE__ */ new Map();
71696
71836
  const setupInput = (fd, nodeStream, stream) => suspend$2(() => {
71697
- let sink = drain;
71837
+ let sink = drain$1;
71698
71838
  if (nodeStream && "write" in nodeStream) {
71699
71839
  handleInputErrors(nodeStream);
71700
71840
  sink = fromWritable({
@@ -71743,12 +71883,12 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
71743
71883
  }
71744
71884
  }
71745
71885
  return {
71746
- getInputFd: (fd) => inputSinks.get(fd) ?? drain,
71886
+ getInputFd: (fd) => inputSinks.get(fd) ?? drain$1,
71747
71887
  getOutputFd: (fd) => outputStreams.get(fd) ?? empty$3
71748
71888
  };
71749
71889
  });
71750
71890
  const setupChildStdin = (command, childProcess, config, inputFailure) => suspend$2(() => {
71751
- let sink = drain;
71891
+ let sink = drain$1;
71752
71892
  if (isNotNull(childProcess.stdin)) {
71753
71893
  handleInputErrors(childProcess.stdin);
71754
71894
  sink = fromWritable({
@@ -71782,7 +71922,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
71782
71922
  })() : empty$3;
71783
71923
  if (isSink(stdoutConfig.stream)) stdout = transduce(stdout, stdoutConfig.stream);
71784
71924
  if (isSink(stderrConfig.stream)) stderr = transduce(stderr, stderrConfig.stream);
71785
- const all = merge(stdout, stderr);
71925
+ const all = merge$1(stdout, stderr);
71786
71926
  return {
71787
71927
  stdout,
71788
71928
  stderr,
@@ -72282,7 +72422,7 @@ const fromDuplex = (open, options) => withFiber((fiber) => {
72282
72422
  pull,
72283
72423
  upgrade
72284
72424
  };
72285
- }).pipe(updateContext((input) => merge$4(openServices, input)));
72425
+ }).pipe(updateContext((input) => merge$5(openServices, input)));
72286
72426
  const awaitDrain = (conn) => callback$1((resume) => {
72287
72427
  function cleanup() {
72288
72428
  conn.off("drain", onDrain);
@@ -76885,7 +77025,7 @@ const layer$12 = /*#__PURE__*/ layerMergedContext(/*#__PURE__*/ succeed$5(/* @__
76885
77025
  }) }));
76886
77026
  const fetch = fiber.getRef(Fetch);
76887
77027
  const options = getOrUndefined(fiber.context, RequestInit) ?? {};
76888
- let headers = options.headers ? merge$2(fromInput$1(options.headers), request.headers) : request.headers;
77028
+ let headers = options.headers ? merge$3(fromInput$1(options.headers), request.headers) : request.headers;
76889
77029
  if (headers["content-length"]) headers = remove$1(headers, "content-length");
76890
77030
  let uploadController;
76891
77031
  const stopUpload = sync(() => uploadController?.abort());
@@ -77261,7 +77401,7 @@ const make$9 = /*#__PURE__*/ make$26({
77261
77401
  },
77262
77402
  fileWebResponse(file, status, statusText, headers, _options) {
77263
77403
  return raw(lazyReadable(() => Readable.fromWeb(file.stream())), {
77264
- headers: merge$2(headers, fromRecordUnsafe({
77404
+ headers: merge$3(headers, fromRecordUnsafe({
77265
77405
  "content-type": headers["content-type"] ?? (file.type === "" ? getOrElse(getType(file.name), () => "application/octet-stream") : file.type),
77266
77406
  "content-length": file.size.toString()
77267
77407
  })),
@@ -86257,7 +86397,7 @@ const make$3 = /*#__PURE__*/ fnUntraced(function* (options) {
86257
86397
  const services = yield* context();
86258
86398
  const clock = get$11(services, Clock);
86259
86399
  const scope = get$11(services, Scope);
86260
- const exportInterval = max(fromInputUnsafe$1(options.exportInterval), zero$2);
86400
+ const exportInterval = max$1(fromInputUnsafe$1(options.exportInterval), zero$2);
86261
86401
  const client = get$11(services, HttpClient).pipe(tap((response) => ignore$1(response.arrayBuffer)), tapError((error) => error.response ? ignore$1(error.response.arrayBuffer) : void_$1), filterStatusOk, transformResponse(provideService(TracerPropagationEnabled, false)), retryTransient({
86262
86402
  schedule: policy,
86263
86403
  times: 3
@@ -87296,6 +87436,7 @@ const update = fnUntraced(function* (name) {
87296
87436
  "--no-audit",
87297
87437
  "--no-fund",
87298
87438
  "--omit=dev",
87439
+ "--prefer-online",
87299
87440
  "--registry=https://registry.npmjs.org",
87300
87441
  `@deslop/${name}@${latest}`
87301
87442
  ]), timeout("5 minutes"));
@@ -87422,6 +87563,10 @@ const InventoryItem = Struct({
87422
87563
  protocol: Literals(["tcp", "udp"])
87423
87564
  }))),
87424
87565
  detail: String$6,
87566
+ failure: optionalKey(Struct({
87567
+ at: optionalKey(Finite),
87568
+ reason: String$6
87569
+ })),
87425
87570
  hostname: optionalKey(String$6),
87426
87571
  http: optionalKey(Boolean$5),
87427
87572
  id: String$6,
@@ -87522,10 +87667,12 @@ const Container = Struct({
87522
87667
  Status: String$6
87523
87668
  });
87524
87669
  // src/services/metrics/schema.ts
87525
- const HistoryQuery = Struct({ hours: Literals([
87670
+ const HistoryQuery = Struct({ minutes: Literals([
87526
87671
  1,
87527
- 24,
87528
- 168
87672
+ 10,
87673
+ 60,
87674
+ 1440,
87675
+ 10080
87529
87676
  ]) });
87530
87677
  const Counters = Struct({
87531
87678
  cores: optional$8(ArraySchema(Struct({
@@ -87781,16 +87928,50 @@ var Exposures = class Exposures extends Service$1()("@deslop/deploy/services/exp
87781
87928
  })), provide$2(layerKeyValueStore(directory)));
87782
87929
  };
87783
87930
  // src/services/inventory/lib/utils.ts
87931
+ const SIGNALS = {
87932
+ 1: "SIGHUP",
87933
+ 2: "SIGINT",
87934
+ 6: "SIGABRT",
87935
+ 9: "SIGKILL",
87936
+ 11: "SIGSEGV",
87937
+ 15: "SIGTERM"
87938
+ };
87939
+ function failureReason(result, status, ran) {
87940
+ if (result === "exit-code" && !ran) return "Failed before starting";
87941
+ const signal = SIGNALS[status] ?? `signal ${status}`;
87942
+ return pipe(value(result), when("exit-code", () => match$8(fromUndefinedOr(SIGNALS[status - 128]), {
87943
+ onNone: () => `Exited with code ${status}`,
87944
+ onSome: (name) => `Exited with code ${status} (${name})`
87945
+ })), when("signal", () => `Killed by ${signal}`), when("core-dump", () => `Crashed with ${signal}`), when("oom-kill", () => "Killed for running out of memory"), when("timeout", () => "Timed out"), when("watchdog", () => "Stopped answering its watchdog"), when("start-limit-hit", () => "Restarted too often"), orElse(() => `Failed: ${result}`));
87946
+ }
87947
+ function unitFailures(text) {
87948
+ return fromEntries(map$8(filter$3(split$1(trim(text), /\n\s*\n/u), isNonEmpty$1), (block) => {
87949
+ const fields = fromEntries(map$8(filter$3(split$1(block, "\n"), includes("=")), (line) => {
87950
+ const [key = "", ...value] = split$1(line, "=");
87951
+ return [key, join$2(value, "=")];
87952
+ }));
87953
+ return [fields["Id"] ?? "", {
87954
+ ...match$8(parse$2(replace(/^@/u, "")(fields["StateChangeTimestamp"] ?? "")), {
87955
+ onNone: () => ({}),
87956
+ onSome: (seconds) => ({ at: seconds * 1e3 })
87957
+ }),
87958
+ reason: failureReason(fields["Result"] ?? "", getOrElse(parse$2(fields["ExecMainStatus"] ?? ""), () => 0), fields["ExecMainCode"] !== "0")
87959
+ }];
87960
+ }));
87961
+ }
87784
87962
  function processOwner(cgroup) {
87785
87963
  const container = getOrUndefined$1(match$3(/\/(?:docker-|docker\/)([a-f0-9]{12,64})(?:\.scope)?(?:\/|\n|$)/u)(cgroup))?.[1];
87786
87964
  if (container !== void 0) return `container:${slice(0, 12)(container)}`;
87787
87965
  const segments = split$1(cgroup, /[/\n]/u);
87788
87966
  const service = getOrElse(findLastIndex(segments, endsWith(".service")), () => -1);
87789
87967
  const manager = getOrElse(findFirstIndex(segments, (segment) => isSome(match$3(/^user@[0-9]+\.service$/u)(segment))), () => Infinity);
87790
- return `service:${match$1(service > manager, {
87791
- onFalse: () => "system",
87792
- onTrue: () => "user"
87793
- })}:${segments[service] ?? ""}`;
87968
+ return match$8(flatMap$7(liftPredicate(drop$1(segments, manager + 1), () => service <= manager), (below) => findFirst(below, (segment) => match$3(/^app-(.+)\.slice$/u)(segment))), {
87969
+ onNone: () => `service:${match$1(service > manager, {
87970
+ onFalse: () => "system",
87971
+ onTrue: () => "user"
87972
+ })}:${segments[service] ?? ""}`,
87973
+ onSome: (match) => `service:user:${match[1]}.service`
87974
+ });
87794
87975
  }
87795
87976
  function itemOwner(item) {
87796
87977
  if (item.kind === "container") return `container:${slice(0, 12)(getOrElse(last(split$1(item.id, ":docker:")), () => ""))}`;
@@ -87897,20 +88078,6 @@ function attachProcesses(items, records) {
87897
88078
  }), (record) => record.process)
87898
88079
  }));
87899
88080
  }
87900
- function ownerUsage(records) {
87901
- return map$8(filter$3(toEntries(groupBy(records, (record) => processOwner(record.cgroup))), (entry) => !endsWith(":")(entry[0]) && reduce(entry[1], 0, (sum, record) => sum + record.process.memory) >= 1024 ** 2), (entry) => {
87902
- const [id, group] = entry;
87903
- const cpus = getSomes(map$8(group, (record) => fromUndefinedOr(record.process.cpu)));
87904
- return {
87905
- ...match$1(isReadonlyArrayNonEmpty(cpus), {
87906
- onFalse: () => ({}),
87907
- onTrue: () => ({ cpu: round(reduce(cpus, 0, (sum, cpu) => sum + cpu), 2) })
87908
- }),
87909
- id,
87910
- memory: round(reduce(group, 0, (sum, record) => sum + record.process.memory) / 1024, 0) * 1024
87911
- };
87912
- });
87913
- }
87914
88081
  // src/services/inventory/service.ts
87915
88082
  const execute = fnUntraced(function* (name, args) {
87916
88083
  const handle = yield* make$12(name, args, {
@@ -88026,15 +88193,29 @@ var Inventory = class Inventory extends Service$1()("@deslop/deploy/services/inv
88026
88193
  "--output=json",
88027
88194
  "--no-pager"
88028
88195
  ]), flatMap$2(decodeUnknownEffect(fromJsonString(ArraySchema(Timer))))), (timer) => map$11(fromNullishOr(timer.activates), (unit) => [unit, map$11(fromNullishOr(timer.next), (next) => Math.floor(next / 1e3))]))));
88029
- return yield* pipe(command("systemctl", [
88196
+ const rows = yield* pipe(command("systemctl", [
88030
88197
  ...manager,
88031
88198
  "list-units",
88032
88199
  "--all",
88033
88200
  "--type=service",
88034
88201
  "--output=json",
88035
88202
  "--no-pager"
88036
- ]), flatMap$2(decodeUnknownEffect(fromJsonString(ArraySchema(Unit)))), map$5((rows) => map$8(rows, (row) => InventoryItem.make({
88203
+ ]), flatMap$2(decodeUnknownEffect(fromJsonString(ArraySchema(Unit)))));
88204
+ const failed = map$8(filter$3(rows, (row) => row.active === "failed"), (row) => row.unit);
88205
+ const failures = getOrElse(flatten$5(yield* pipe(command("systemctl", [
88206
+ ...manager,
88207
+ "show",
88208
+ ...failed,
88209
+ "-p",
88210
+ "Id,Result,ExecMainCode,ExecMainStatus,StateChangeTimestamp",
88211
+ "--timestamp=unix"
88212
+ ]), map$5(unitFailures), option$1, when$2(succeed$5(isReadonlyArrayNonEmpty(failed))))), () => unitFailures(""));
88213
+ return map$8(rows, (row) => InventoryItem.make({
88037
88214
  detail: `${scope} · ${row.description}`,
88215
+ ...match$8(fromUndefinedOr(failures[row.unit]), {
88216
+ onNone: () => ({}),
88217
+ onSome: (failure) => ({ failure })
88218
+ }),
88038
88219
  id: `${worker}:${scope}:${row.unit}`,
88039
88220
  kind: "service",
88040
88221
  name: row.unit,
@@ -88052,7 +88233,7 @@ var Inventory = class Inventory extends Service$1()("@deslop/deploy/services/inv
88052
88233
  state: `${row.active} · ${row.sub}`,
88053
88234
  url: "",
88054
88235
  worker
88055
- }))));
88236
+ }));
88056
88237
  });
88057
88238
  return Inventory.of({
88058
88239
  run: fnUntraced(function* (input) {
@@ -88185,6 +88366,28 @@ var Inventory = class Inventory extends Service$1()("@deslop/deploy/services/inv
88185
88366
  }));
88186
88367
  };
88187
88368
  // src/services/metrics/lib/utils.ts
88369
+ const TIERS = [
88370
+ {
88371
+ every: 1e3,
88372
+ keep: 6e4
88373
+ },
88374
+ {
88375
+ every: 1e4,
88376
+ keep: 6e5
88377
+ },
88378
+ {
88379
+ every: 6e4,
88380
+ keep: 36e5
88381
+ },
88382
+ {
88383
+ every: 9e5,
88384
+ keep: 864e5
88385
+ },
88386
+ {
88387
+ every: 36e5,
88388
+ keep: 6048e5
88389
+ }
88390
+ ];
88188
88391
  function counters(stat, network, disk, uptime, time) {
88189
88392
  const cpu = pipe(stat, split$1("\n"), head, getOrElse(() => ""), trim, split$1(/\s+/u));
88190
88393
  const values = decodeSync(ArraySchema(FiniteFromString).check(isMinLength(5)))(take$3(drop$1(cpu, 1), 8));
@@ -88265,35 +88468,71 @@ function sample(current, memory, disk, previous, load) {
88265
88468
  uptime: current.uptime
88266
88469
  };
88267
88470
  }
88268
- function resolution(hours) {
88269
- return hours * 6e4;
88471
+ function resolution(minutes) {
88472
+ return minutes * 1e3;
88270
88473
  }
88271
- function chartWindow(hours, now) {
88272
- const end = Math.ceil(now / resolution(hours)) * resolution(hours);
88474
+ function chartWindow(minutes, now) {
88475
+ const end = Math.ceil(now / resolution(minutes)) * resolution(minutes);
88273
88476
  return {
88274
88477
  end,
88275
- start: end - hours * 36e5
88478
+ start: end - minutes * 6e4
88276
88479
  };
88277
88480
  }
88278
- function lastInBucket(bucket) {
88481
+ function mean(bucket, read) {
88482
+ const known = getSomes(map$8(bucket, (point) => map$11(liftPredicate(read(point), isNumber), (value) => ({
88483
+ value,
88484
+ weight: point.time - (point.since ?? point.time) + 1e3
88485
+ }))));
88486
+ if (isReadonlyArrayEmpty(known)) return;
88487
+ return reduce(known, 0, (sum, entry) => sum + entry.value * entry.weight) / reduce(known, 0, (sum, entry) => sum + entry.weight);
88488
+ }
88489
+ function appEntry(point, id) {
88490
+ return findFirst(point.apps ?? [], (app) => app.id === id);
88491
+ }
88492
+ function merge(bucket) {
88493
+ if (bucket.length === 1) return bucket[0];
88494
+ const reported = filter$3(bucket, (value) => value.apps !== void 0);
88495
+ const last = lastNonEmpty(bucket);
88279
88496
  return {
88280
- ...getOrThrow$1(last(bucket)),
88281
- since: bucket[0]?.since ?? bucket[0]?.time
88497
+ ...last,
88498
+ apps: match$6(reported, {
88499
+ onEmpty: () => void 0,
88500
+ onNonEmpty: () => map$8(dedupe(flatMap$5(reported, (value) => map$8(value.apps ?? [], (app) => app.id))), (id) => ({
88501
+ cpu: mean(reported, (point) => match$8(appEntry(point, id), {
88502
+ onNone: () => 0,
88503
+ onSome: (app) => app.cpu
88504
+ })),
88505
+ id,
88506
+ memory: round(mean(reported, (point) => match$8(appEntry(point, id), {
88507
+ onNone: () => 0,
88508
+ onSome: (app) => app.memory
88509
+ })) ?? 0, 0)
88510
+ }))
88511
+ }),
88512
+ cores: map$8(last.cores ?? [], (core) => ({
88513
+ id: core.id,
88514
+ usage: mean(bucket, (point) => getOrUndefined$1(findFirst(point.cores ?? [], (entry) => entry.id === core.id))?.usage)
88515
+ })),
88516
+ cpu: mean(bucket, (point) => point.cpu),
88517
+ diskRead: mean(bucket, (point) => point.diskRead),
88518
+ diskWrite: mean(bucket, (point) => point.diskWrite),
88519
+ memoryUsed: mean(bucket, (point) => point.memoryUsed) ?? last.memoryUsed,
88520
+ networkReceive: mean(bucket, (point) => point.networkReceive),
88521
+ networkSend: mean(bucket, (point) => point.networkSend),
88522
+ since: bucket[0].since ?? bucket[0].time
88282
88523
  };
88283
88524
  }
88284
88525
  function compact(samples, now) {
88285
88526
  return pipe(samples, filter$3((value) => value.time >= now - 6048e5), groupBy((value) => {
88286
- const age = (now - value.time) / 36e5;
88287
- if (age <= 1) return `minute:${Math.floor(value.time / resolution(1))}`;
88288
- if (age <= 24) return `quarter:${Math.floor(value.time / 9e5)}`;
88289
- return `hour:${Math.floor(value.time / 36e5)}`;
88290
- }), values, map$8(lastInBucket), sort(mapInput(Number$6, (value) => value.time)));
88291
- }
88292
- function history(samples, hours, now) {
88293
- const selected = pipe(filter$3(samples, (value) => value.time > chartWindow(hours, now).start && value.time <= now), groupBy((value) => `${clamp(Math.ceil((value.time - chartWindow(hours, now).start) / resolution(hours)) - 1, {
88527
+ const tier = getOrElse(findLast(TIERS, (candidate, index) => now - (Math.floor(value.time / candidate.every) + 1) * candidate.every >= (TIERS[index - 1]?.keep ?? 0)), () => TIERS[0]);
88528
+ return `${tier.every}:${Math.floor(value.time / tier.every)}`;
88529
+ }), values, map$8(merge), sort(mapInput(Number$6, (value) => value.time)));
88530
+ }
88531
+ function history(samples, minutes, now) {
88532
+ const selected = pipe(filter$3(samples, (value) => value.time > chartWindow(minutes, now).start && value.time <= now), groupBy((value) => `${clamp(Math.ceil((value.time - chartWindow(minutes, now).start) / resolution(minutes)) - 1, {
88294
88533
  maximum: 59,
88295
88534
  minimum: 0
88296
- })}`), values, map$8(lastInBucket));
88535
+ })}`), values, map$8(merge));
88297
88536
  return map$8(selected, (value, index) => {
88298
88537
  if (index === selected.length - 1) return value;
88299
88538
  return {
@@ -88305,12 +88544,12 @@ function history(samples, hours, now) {
88305
88544
  };
88306
88545
  });
88307
88546
  }
88308
- function compactHistory(machine, hours) {
88547
+ function compactHistory(machine, minutes) {
88309
88548
  return {
88310
88549
  cpuModel: machine.cpuModel,
88311
88550
  current: getOrUndefined$1(last(machine.samples)),
88312
88551
  error: machine.error,
88313
- intervalSeconds: resolution(hours) / 1e3,
88552
+ intervalSeconds: resolution(minutes) / 1e3,
88314
88553
  recordedSince: machine.samples[0]?.since ?? machine.samples[0]?.time,
88315
88554
  series: {
88316
88555
  cpu: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.cpu), round(1))),
@@ -88328,7 +88567,42 @@ function compactHistory(machine, hours) {
88328
88567
  worker: machine.worker
88329
88568
  };
88330
88569
  }
88570
+ function appCgroup(path, siblings) {
88571
+ const name = getOrElse(last(split$1(path, "/")), () => "");
88572
+ if (isSome(match$3(/^docker-[a-f0-9]{12,64}\.scope$/u)(name))) return true;
88573
+ if (endsWith(".service")(name)) return isNone(match$3(/^user@[0-9]+\.service$/u)(name));
88574
+ return exists(match$3(/\/user@[0-9]+\.service\/app\.slice\/app-([^/]+)\.slice$/u)(path), (match) => contains(siblings, `${match[1]}.service`));
88575
+ }
88576
+ function statField(text, name) {
88577
+ return getOrElse(flatMap$7(match$3(new RegExp(`^${name} ([0-9]+)$`, "mu"))(text), (match) => parse$2(match[1] ?? "")), () => 0);
88578
+ }
88579
+ function cgroupUsage(cpuStat, memoryStat) {
88580
+ return {
88581
+ memory: statField(memoryStat, "anon") + statField(memoryStat, "shmem") + max(0, statField(memoryStat, "kernel") - statField(memoryStat, "slab_reclaimable")),
88582
+ usage: statField(cpuStat, "usage_usec")
88583
+ };
88584
+ }
88585
+ function appShares(current, previous) {
88586
+ const elapsed = current.total - (previous?.total ?? current.total);
88587
+ const measured = elapsed > 0 && current.time - (previous?.time ?? 0) <= 9e4;
88588
+ return map$8(filter$3(toEntries(groupBy(toEntries(current.cgroups), (entry) => entry[1].id)), (entry) => reduce(entry[1], 0, (sum, cgroup) => sum + cgroup[1].memory) >= 1024 ** 2), (entry) => {
88589
+ const [id, cgroups] = entry;
88590
+ const deltas = getSomes(map$8(cgroups, (cgroup) => map$11(filter$5(fromUndefinedOr(previous?.cgroups[cgroup[0]]), (old) => measured && cgroup[1].usage >= old.usage), (old) => cgroup[1].usage - old.usage)));
88591
+ return {
88592
+ ...match$6(deltas, {
88593
+ onEmpty: () => ({}),
88594
+ onNonEmpty: () => ({ cpu: round(clamp(reduce(deltas, 0, (sum, delta) => sum + delta) / 1e4 / elapsed * 100, {
88595
+ maximum: 100,
88596
+ minimum: 0
88597
+ }), 2) })
88598
+ }),
88599
+ id,
88600
+ memory: round(reduce(cgroups, 0, (sum, cgroup) => sum + cgroup[1].memory) / 1024, 0) * 1024
88601
+ };
88602
+ });
88603
+ }
88331
88604
  // src/services/metrics/service.ts
88605
+ const CGROUP = "/sys/fs/cgroup";
88332
88606
  var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics/service/Metrics") {
88333
88607
  static layer = (directory) => pipe(effect(Metrics, gen(function* () {
88334
88608
  const fs = yield* FileSystem;
@@ -88340,9 +88614,57 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
88340
88614
  const saved = yield* forEach$1(filter$3(yield* base.keys, (key) => startsWith("metrics-")(key) && !endsWith(".tmp")(key)), (key) => pipe(store.get(key), orElseSucceed(() => none())), { concurrency: 8 });
88341
88615
  const state = yield* make$44(sort(filter$3(flatten$3(getSomes(saved)), (value) => value.time >= now - 6048e5), mapInput(Number$6, (value) => value.time)));
88342
88616
  const previous = yield* make$44(none());
88343
- const processState = yield* make$44(none());
88617
+ const lastApps = yield* make$44(none());
88618
+ const storage = yield* make$44("");
88344
88619
  const dirty = yield* make$44(empty$11());
88345
- const error = yield* make$44("");
88620
+ const collectError = yield* make$44("");
88621
+ const persistError = yield* make$44("");
88622
+ const appCgroups = gen(function* () {
88623
+ const walk = yield* make$44({
88624
+ found: empty$11(),
88625
+ pending: [""]
88626
+ });
88627
+ return (yield* repeat(gen(function* () {
88628
+ const level = yield* get$1(walk);
88629
+ const children = flatMap$5(getSomes(yield* forEach$1(level.pending, (path) => option$1(map$5(fs.readDirectory(`${CGROUP}${path}`), (names) => map$8(filter$3(names, (name) => isSome(match$3(/\.(?:slice|scope|service)$/u)(name))), (name) => ({
88630
+ app: appCgroup(`${path}/${name}`, names),
88631
+ path: `${path}/${name}`
88632
+ })))), { concurrency: "unbounded" })), identity);
88633
+ const next = {
88634
+ found: [...level.found, ...map$8(filter$3(children, (child) => child.app), (child) => child.path)],
88635
+ pending: map$8(filter$3(children, (child) => !child.app && isSome(match$3(/(?:\.slice|\/user@[0-9]+\.service)$/u)(child.path))), (child) => child.path)
88636
+ };
88637
+ yield* set$1(walk, next);
88638
+ return next;
88639
+ }), { until: (next) => isReadonlyArrayEmpty(next.pending) })).found;
88640
+ });
88641
+ const apps = gen(function* () {
88642
+ const readings = yield* forEach$1(yield* appCgroups, (path) => pipe(all$1({
88643
+ cpu: fs.readFileString(`${CGROUP}${path}/cpu.stat`),
88644
+ memory: fs.readFileString(`${CGROUP}${path}/memory.stat`)
88645
+ }, { concurrency: "unbounded" }), map$5((stats) => [path, {
88646
+ id: processOwner(path),
88647
+ ...cgroupUsage(stats.cpu, stats.memory)
88648
+ }]), option$1), { concurrency: 8 });
88649
+ return fromEntries(getSomes(readings));
88650
+ });
88651
+ const refreshStorage = pipe(scoped(execute$1("df", [
88652
+ "-B1",
88653
+ "--output=target,size,used",
88654
+ "-x",
88655
+ "tmpfs",
88656
+ "-x",
88657
+ "devtmpfs",
88658
+ "-x",
88659
+ "overlay",
88660
+ "-x",
88661
+ "squashfs",
88662
+ "-x",
88663
+ "efivarfs"
88664
+ ])), flatMap$2((text) => set$1(storage, text)), ignore$1({
88665
+ log: "Warn",
88666
+ message: "The disk sizes were not read"
88667
+ }));
88346
88668
  const collect = pipe(gen(function* () {
88347
88669
  const time = yield* currentTimeMillis;
88348
88670
  const files = yield* all$1({
@@ -88351,20 +88673,6 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
88351
88673
  memory: fs.readFileString("/proc/meminfo"),
88352
88674
  network: fs.readFileString("/proc/net/dev"),
88353
88675
  stat: fs.readFileString("/proc/stat"),
88354
- storage: scoped(execute$1("df", [
88355
- "-B1",
88356
- "--output=target,size,used",
88357
- "-x",
88358
- "tmpfs",
88359
- "-x",
88360
- "devtmpfs",
88361
- "-x",
88362
- "overlay",
88363
- "-x",
88364
- "squashfs",
88365
- "-x",
88366
- "efivarfs"
88367
- ])),
88368
88676
  uptime: fs.readFileString("/proc/uptime")
88369
88677
  }, { concurrency: "unbounded" });
88370
88678
  const current = yield* pipe(try_({
@@ -88375,18 +88683,23 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
88375
88683
  try: () => counters(files.stat, files.network, files.disk, files.uptime, time)
88376
88684
  }), flatMap$2(decodeEffect(Counters)));
88377
88685
  const old = getOrUndefined$1(yield* get$1(previous));
88378
- const apps = yield* pipe(processes, provideService(FileSystem, fs), flatMap$2((readings) => modify$1(processState, (last) => {
88379
- const next = processReadings(readings, getOrUndefined$1(last));
88380
- return [next.readings, some$1(next)];
88381
- })), timeout("3 seconds"), map$5(ownerUsage), option$1);
88686
+ const shares = yield* pipe(apps, timeout("1 second"), flatMap$2((usage) => modify$1(lastApps, (last) => {
88687
+ const reading = {
88688
+ cgroups: usage,
88689
+ time,
88690
+ total: current.cpuTotal
88691
+ };
88692
+ return [appShares(reading, getOrUndefined$1(last)), some$1(reading)];
88693
+ })), option$1);
88694
+ const disks = yield* get$1(storage);
88382
88695
  const value = yield* pipe(try_({
88383
88696
  catch: (cause) => DeployError.make({
88384
88697
  cause,
88385
88698
  message: "The machine sample is unreadable."
88386
88699
  }),
88387
88700
  try: () => ({
88388
- ...sample(current, files.memory, files.storage, old, files.load),
88389
- ...match$8(apps, {
88701
+ ...sample(current, files.memory, disks, old, files.load),
88702
+ ...match$8(shares, {
88390
88703
  onNone: () => ({}),
88391
88704
  onSome: (usage) => ({ apps: usage })
88392
88705
  })
@@ -88398,29 +88711,40 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
88398
88711
  yield* set$1(state, samples);
88399
88712
  const retained = fromIterable$2(map$8(samples, (entry) => entry.time));
88400
88713
  const hour = Math.floor(time / 36e5);
88401
- yield* forEach$1(yield* updateAndGet(dirty, (buckets) => dedupe([
88714
+ yield* update$1(dirty, (buckets) => dedupe([
88402
88715
  ...filter$3(buckets, (bucket) => bucket >= hour - 168),
88403
88716
  hour,
88404
88717
  ...map$8(filter$3(before, (entry) => !has(retained, entry.time) && entry.time >= time - 6048e5), (entry) => Math.floor(entry.time / 36e5))
88405
- ])), (bucket) => pipe(store.set(`metrics-${bucket}`, filter$3(samples, (entry) => Math.floor(entry.time / 36e5) === bucket)), andThen(update$1(dirty, (buckets) => filter$3(buckets, (pending) => pending !== bucket)))), {
88718
+ ]));
88719
+ yield* set$1(collectError, "");
88720
+ }), catch_$2((cause) => set$1(collectError, `${cause}`)));
88721
+ const persist = pipe(gen(function* () {
88722
+ const time = yield* currentTimeMillis;
88723
+ const buckets = yield* getAndSet(dirty, []);
88724
+ const samples = yield* get$1(state);
88725
+ yield* pipe(forEach$1(buckets, (bucket) => store.set(`metrics-${bucket}`, filter$3(samples, (entry) => Math.floor(entry.time / 36e5) === bucket)), {
88406
88726
  concurrency: 1,
88407
88727
  discard: true
88408
- });
88409
- yield* forEach$1(filter$3(yield* base.keys, (key) => startsWith("metrics-")(key) && (endsWith(".tmp")(key) || exists(parse$2(slice(8)(key)), (bucket) => bucket < hour - 168))), (key) => base.remove(key), {
88728
+ }), onError(() => update$1(dirty, (pending) => dedupe([...pending, ...buckets]))));
88729
+ yield* forEach$1(filter$3(yield* base.keys, (key) => startsWith("metrics-")(key) && (endsWith(".tmp")(key) || exists(parse$2(slice(8)(key)), (bucket) => bucket < Math.floor(time / 36e5) - 168))), (key) => base.remove(key), {
88410
88730
  concurrency: 1,
88411
88731
  discard: true
88412
88732
  });
88413
- yield* set$1(error, "");
88414
- }), catch_$2((cause) => set$1(error, `${cause}`)));
88733
+ yield* set$1(persistError, "");
88734
+ }), catch_$2((cause) => set$1(persistError, `${cause}`)));
88735
+ yield* refreshStorage;
88415
88736
  yield* collect;
88416
- yield* pipe(collect, schedule(spaced("30 seconds")), forkScoped);
88737
+ yield* persist;
88738
+ yield* addFinalizer(() => persist);
88739
+ yield* pipe(collect, schedule(fixed("1 second")), forkScoped);
88740
+ yield* pipe(andThen(refreshStorage, persist), schedule(spaced("30 seconds")), forkScoped);
88417
88741
  return Metrics.of({ read: fnUntraced(function* (query) {
88418
88742
  const samples = yield* get$1(state);
88419
88743
  const time = yield* currentTimeMillis;
88420
88744
  return MachineHistory.make({
88421
88745
  cpuModel,
88422
- error: yield* get$1(error),
88423
- samples: history(samples, query.hours, time),
88746
+ error: join$2(filter$3([yield* get$1(collectError), yield* get$1(persistError)], isNonEmpty$1), "\n"),
88747
+ samples: history(samples, query.minutes, time),
88424
88748
  stale: time - getOrElse(map$11(last(samples), (value) => value.time), () => 0) > 9e4,
88425
88749
  time,
88426
88750
  worker
@@ -88502,11 +88826,11 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
88502
88826
  const time = yield* currentTimeMillis;
88503
88827
  const cached = yield* get$1(lastMetrics);
88504
88828
  return [own, ...map$8(workers, (worker) => {
88505
- const saved = cached[`${worker.name}:${query.hours}`];
88829
+ const saved = cached[`${worker.name}:${query.minutes}`];
88506
88830
  return {
88507
88831
  cpuModel: saved?.cpuModel,
88508
88832
  error: saved?.error ?? "Waiting for worker",
88509
- samples: history(saved?.samples ?? [], query.hours, time),
88833
+ samples: history(saved?.samples ?? [], query.minutes, time),
88510
88834
  stale: saved === void 0 || saved.stale || time - saved.time > 9e4,
88511
88835
  time,
88512
88836
  worker: worker.name
@@ -88531,14 +88855,14 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
88531
88855
  const time = yield* currentTimeMillis;
88532
88856
  const all = yield* get$1(lastMetrics);
88533
88857
  return {
88534
- cpuModel: all[`${worker.name}:${query.hours}`]?.cpuModel,
88858
+ cpuModel: all[`${worker.name}:${query.minutes}`]?.cpuModel,
88535
88859
  error: `${cause}`,
88536
- samples: history(all[`${worker.name}:${query.hours}`]?.samples ?? [], query.hours, time),
88860
+ samples: history(all[`${worker.name}:${query.minutes}`]?.samples ?? [], query.minutes, time),
88537
88861
  stale: true,
88538
88862
  time,
88539
88863
  worker: worker.name
88540
88864
  };
88541
- })), tap$1((value) => update$1(lastMetrics, (all) => set$6(all, `${worker.name}:${query.hours}`, value)))), { concurrency: "unbounded" })];
88865
+ })), tap$1((value) => update$1(lastMetrics, (all) => set$6(all, `${worker.name}:${query.minutes}`, value)))), { concurrency: "unbounded" })];
88542
88866
  }),
88543
88867
  run: fnUntraced(function* (input) {
88544
88868
  if (input.target === void 0 || input.target === "") return yield* inventory.run(omit(input, ["target"]));
@@ -88596,7 +88920,10 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
88596
88920
  "deploy.hide": fleet.hide,
88597
88921
  "deploy.history": fleet.history,
88598
88922
  "deploy.inventory": () => concat$1(fromEffect(fleet.local), fromEffectSchedule(fleet.snapshot, spaced("5 seconds"))),
88599
- "deploy.metrics": (query) => concat$1(fromEffect(fleet.current(query)), fromEffectSchedule(fleet.metrics(query), spaced("30 seconds"))),
88923
+ "deploy.metrics": (query) => concat$1(concat$1(fromEffect(fleet.current(query)), fromEffect(fleet.metrics(query))), merge$1(fromEffectSchedule(fleet.current(query), spaced(millis(min$1(resolution(query.minutes), 3e4)))), drain(fromEffectSchedule(fleet.metrics(query), spaced(millis(clamp(resolution(query.minutes), {
88924
+ maximum: 3e4,
88925
+ minimum: 5e3
88926
+ }))))))),
88600
88927
  "deploy.run": fleet.run,
88601
88928
  "deploy.snapshot": () => fleet.local
88602
88929
  });
@@ -88627,7 +88954,7 @@ const ToolHandlers = Tools.toLayer(map$5(Fleet, (fleet) => Tools.of({
88627
88954
  hide_exposure: fleet.hide,
88628
88955
  inventory: () => fleet.snapshot,
88629
88956
  resource_history: fnUntraced(function* (query) {
88630
- return map$8(yield* fleet.metrics(query), (machine) => compactHistory(machine, query.hours));
88957
+ return map$8(yield* fleet.metrics(query), (machine) => compactHistory(machine, query.minutes));
88631
88958
  })
88632
88959
  })));
88633
88960
  // src/main.server.ts