@deslop/deploy 0.1.1345 → 0.1.1348

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
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
2
2
  import { createRequire } from "node:module";
3
- import { cwd, execPath, pid, platform } from "node:process";
3
+ import { arch, cwd, execPath, pid, platform } from "node:process";
4
4
  import * as OS from "node:os";
5
5
  import { cpus, hostname, loadavg, totalmem, userInfo } from "node:os";
6
6
  import * as NodeChildProcess from "node:child_process";
@@ -4989,7 +4989,7 @@ const ServiceProto = {
4989
4989
  .../*#__PURE__*/ Prototype({
4990
4990
  label: "Service",
4991
4991
  evaluate(fiber) {
4992
- return exitSucceed(get$13(fiber.context, this));
4992
+ return exitSucceed(get$14(fiber.context, this));
4993
4993
  }
4994
4994
  }),
4995
4995
  toJSON() {
@@ -5005,10 +5005,10 @@ const ServiceProto = {
5005
5005
  return make$93(this, self);
5006
5006
  },
5007
5007
  use(f) {
5008
- return withFiber$1((fiber) => f(get$13(fiber.context, this)));
5008
+ return withFiber$1((fiber) => f(get$14(fiber.context, this)));
5009
5009
  },
5010
5010
  useSync(f) {
5011
- return withFiber$1((fiber) => exitSucceed(f(get$13(fiber.context, this))));
5011
+ return withFiber$1((fiber) => exitSucceed(f(get$14(fiber.context, this))));
5012
5012
  }
5013
5013
  };
5014
5014
  const cacheKeys = /*#__PURE__*/ new Set();
@@ -5387,7 +5387,7 @@ const getUnsafe$1 = /*#__PURE__*/ dual(2, (self, service) => {
5387
5387
  * @category getters
5388
5388
  * @since 2.0.0
5389
5389
  */
5390
- const get$13 = getUnsafe$1;
5390
+ const get$14 = getUnsafe$1;
5391
5391
  const defaultValueCacheKey = "~effect/Context/defaultValue";
5392
5392
  const getDefaultValue = (ref) => {
5393
5393
  if (defaultValueCacheKey in ref) return ref[defaultValueCacheKey];
@@ -6506,7 +6506,7 @@ const has$6 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key));
6506
6506
  * @category getters
6507
6507
  * @since 2.0.0
6508
6508
  */
6509
- const get$12 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key) ? some$1(self[key]) : none());
6509
+ const get$13 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key) ? some$1(self[key]) : none());
6510
6510
  /**
6511
6511
  * Maps a record into another record by applying a transformation function to each of its values.
6512
6512
  *
@@ -7098,7 +7098,7 @@ function isOutOfBounds(i, as) {
7098
7098
  * @category getters
7099
7099
  * @since 2.0.0
7100
7100
  */
7101
- const get$11 = /*#__PURE__*/ dual(2, (self, index) => {
7101
+ const get$12 = /*#__PURE__*/ dual(2, (self, index) => {
7102
7102
  const i = Math.floor(index);
7103
7103
  return isOutOfBounds(i, self) ? none() : some$1(self[i]);
7104
7104
  });
@@ -7159,7 +7159,7 @@ const getUnsafe = /*#__PURE__*/ dual(2, (self, index) => {
7159
7159
  * @category getters
7160
7160
  * @since 2.0.0
7161
7161
  */
7162
- const head = /*#__PURE__*/ get$11(0);
7162
+ const head = /*#__PURE__*/ get$12(0);
7163
7163
  /**
7164
7164
  * Returns the first element of a `NonEmptyReadonlyArray` directly (no `Option`
7165
7165
  * wrapper).
@@ -10673,7 +10673,7 @@ var FiberImpl = class {
10673
10673
  return this._dispatcher ??= this.cache.scheduler.makeDispatcher();
10674
10674
  }
10675
10675
  getRef(ref) {
10676
- return get$13(this.context, ref);
10676
+ return get$14(this.context, ref);
10677
10677
  }
10678
10678
  addObserver(cb) {
10679
10679
  if (this._exit) {
@@ -10855,17 +10855,17 @@ var FiberImpl = class {
10855
10855
  const makeFiberContextCache = (context) => {
10856
10856
  const currentTracer = getOrUndefinedUnsafe(context, TracerKey);
10857
10857
  return {
10858
- scheduler: get$13(context, Scheduler),
10858
+ scheduler: get$14(context, Scheduler),
10859
10859
  tracer: currentTracer,
10860
10860
  tracerContext: currentTracer ? currentTracer["context"] : void 0,
10861
- tracerEnabled: get$13(context, TracerEnabled),
10861
+ tracerEnabled: get$14(context, TracerEnabled),
10862
10862
  span: getOrUndefinedUnsafe(context, ParentSpanKey),
10863
- logLevel: get$13(context, CurrentLogLevel$1),
10864
- minimumLogLevel: get$13(context, MinimumLogLevel$1),
10865
- stackFrame: get$13(context, CurrentStackFrame),
10863
+ logLevel: get$14(context, CurrentLogLevel$1),
10864
+ minimumLogLevel: get$14(context, MinimumLogLevel$1),
10865
+ stackFrame: get$14(context, CurrentStackFrame),
10866
10866
  runtimeMetrics: getOrUndefinedUnsafe(context, FiberRuntimeMetricsKey),
10867
- maxOpsBeforeYield: get$13(context, MaxOpsBeforeYield),
10868
- preventYield: get$13(context, PreventSchedulerYield)
10867
+ maxOpsBeforeYield: get$14(context, MaxOpsBeforeYield),
10868
+ preventYield: get$14(context, PreventSchedulerYield)
10869
10869
  };
10870
10870
  };
10871
10871
  const deferredInterruptCont = {
@@ -11521,7 +11521,7 @@ const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$4(s
11521
11521
  /** @internal */
11522
11522
  const tapError$4 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findError$1, (e) => f(e)));
11523
11523
  /** @internal */
11524
- const catchIf$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$4(self, (cause) => {
11524
+ const catchIf$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$4(self, (cause) => {
11525
11525
  const error = findRecoverableError(cause);
11526
11526
  if (isFailure$1(error)) return failCause$6(error.failure);
11527
11527
  if (!predicate(error.success)) return orElse ? orElse(error.success) : failCause$6(cause);
@@ -11538,7 +11538,7 @@ const catchFilter$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, f
11538
11538
  /** @internal */
11539
11539
  const catchTag$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, k, f, orElse) => {
11540
11540
  const pred = Array.isArray(k) ? (e) => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
11541
- return catchIf$1(self, pred, f, orElse);
11541
+ return catchIf$3(self, pred, f, orElse);
11542
11542
  });
11543
11543
  /** @internal */
11544
11544
  const catchTags$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, cases, orElse) => {
@@ -11549,7 +11549,7 @@ const catchTags$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, cas
11549
11549
  }, (e) => cases[e["_tag"]](e), orElse);
11550
11550
  });
11551
11551
  /** @internal */
11552
- const catchReason$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf$1(self, (e) => isTagged(e, errorTag) && hasProperty(e, "reason") && (orElse !== void 0 || isTagged(e.reason, reasonTag)), (e) => {
11552
+ const catchReason$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf$3(self, (e) => isTagged(e, errorTag) && hasProperty(e, "reason") && (orElse !== void 0 || isTagged(e.reason, reasonTag)), (e) => {
11553
11553
  const reason = e.reason;
11554
11554
  if (isTagged(reason, reasonTag)) return f(reason, e);
11555
11555
  return orElse ? orElse(reason, e) : fail$10(e);
@@ -12399,11 +12399,11 @@ const NoopSpanProto = {
12399
12399
  const noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
12400
12400
  const filterDisablePropagation = (span) => {
12401
12401
  if (!span) return none();
12402
- return get$13(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some$1(span);
12402
+ return get$14(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some$1(span);
12403
12403
  };
12404
12404
  /** @internal */
12405
12405
  const makeSpanUnsafe = (fiber, name, options) => {
12406
- const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$13(options.annotations, DisablePropagation);
12406
+ const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$14(options.annotations, DisablePropagation);
12407
12407
  const parent = options?.parent !== void 0 ? some$1(options.parent) : options?.root ? none() : filterDisablePropagation(fiber.cache.span);
12408
12408
  let span;
12409
12409
  if (disablePropagation) span = noopSpan({
@@ -15688,7 +15688,7 @@ const unwrapKey = /*#__PURE__*/ Service$1("effect/Layer/unwrap");
15688
15688
  * @category converting
15689
15689
  * @since 4.0.0
15690
15690
  */
15691
- const unwrap$8 = (self) => flatMap$4(effect(unwrapKey)(self), get$13(unwrapKey));
15691
+ const unwrap$8 = (self) => flatMap$4(effect(unwrapKey)(self), get$14(unwrapKey));
15692
15692
  const mergeAllEffect = (layers, memoMap, scope) => {
15693
15693
  const parentScope = forkUnsafe(scope, "parallel");
15694
15694
  return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$9((context) => mergeAll$3(...context)));
@@ -18184,7 +18184,7 @@ const fromIterable$7 = (entries) => {
18184
18184
  * @category getters
18185
18185
  * @since 2.0.0
18186
18186
  */
18187
- const get$10 = /*#__PURE__*/ dual(2, (self, key) => {
18187
+ const get$11 = /*#__PURE__*/ dual(2, (self, key) => {
18188
18188
  if (self.backing.has(key)) return some$1(self.backing.get(key));
18189
18189
  else if (isSimpleKey(key)) return none();
18190
18190
  const hash$3 = hash(key);
@@ -18228,7 +18228,7 @@ const getFromBucket = (self, bucket, key) => {
18228
18228
  * @category predicates
18229
18229
  * @since 2.0.0
18230
18230
  */
18231
- const has$4 = /*#__PURE__*/ dual(2, (self, key) => isSome(get$10(self, key)));
18231
+ const has$4 = /*#__PURE__*/ dual(2, (self, key) => isSome(get$11(self, key)));
18232
18232
  /**
18233
18233
  * Sets a key-value pair in the MutableHashMap, mutating the map in place.
18234
18234
  * If the key already exists, its value is updated.
@@ -20237,7 +20237,7 @@ const catchDefect = catchDefect$1;
20237
20237
  * @category error handling
20238
20238
  * @since 2.0.0
20239
20239
  */
20240
- const catchIf = catchIf$1;
20240
+ const catchIf$2 = catchIf$3;
20241
20241
  /**
20242
20242
  * Recovers from specific errors using a `Filter`.
20243
20243
  *
@@ -30815,7 +30815,7 @@ var HashMapImpl = class {
30815
30815
  const thatImpl = that;
30816
30816
  if (this.size !== thatImpl.size) return false;
30817
30817
  for (const [key, value] of this) {
30818
- const otherValue = pipe(that, get$9(key));
30818
+ const otherValue = pipe(that, get$10(key));
30819
30819
  if (isNone(otherValue) || !equals$1(value, otherValue.value)) return false;
30820
30820
  }
30821
30821
  return true;
@@ -30861,7 +30861,7 @@ const fromIterable$6 = (entries) => {
30861
30861
  return new HashMapImpl(false, 0, root, size);
30862
30862
  };
30863
30863
  /** @internal */
30864
- const get$9 = /*#__PURE__*/ dual(2, (self, key) => {
30864
+ const get$10 = /*#__PURE__*/ dual(2, (self, key) => {
30865
30865
  return self._root.get(0, hash(key), key);
30866
30866
  });
30867
30867
  /** @internal */
@@ -30978,7 +30978,7 @@ const fromIterable$5 = fromIterable$6;
30978
30978
  * @category getters
30979
30979
  * @since 2.0.0
30980
30980
  */
30981
- const get$8 = get$9;
30981
+ const get$9 = get$10;
30982
30982
  /**
30983
30983
  * Sets the specified key to the specified value using the internal hashing
30984
30984
  * function.
@@ -31697,7 +31697,7 @@ const TypeId$58 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
31697
31697
  const Proto$19 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
31698
31698
  [TypeId$58]: { value: TypeId$58 },
31699
31699
  [symbolRedactable]: { value(context) {
31700
- return redact$1(this, get$13(context, CurrentRedactedNames$1));
31700
+ return redact$1(this, get$14(context, CurrentRedactedNames$1));
31701
31701
  } },
31702
31702
  toJSON: { value() {
31703
31703
  return redact$2(this);
@@ -31772,6 +31772,18 @@ const fromInput$1 = (input) => {
31772
31772
  */
31773
31773
  const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$19);
31774
31774
  /**
31775
+ * Gets a header value by name safely.
31776
+ *
31777
+ * **Details**
31778
+ *
31779
+ * The lookup lowercases the provided header name and returns `Option.none()` when absent.
31780
+ *
31781
+ * @stability unstable
31782
+ * @category combinators
31783
+ * @since 4.0.0
31784
+ */
31785
+ const get$8 = /*#__PURE__*/ dual(2, (self, key) => fromUndefinedOr(self[key.toLowerCase()]));
31786
+ /**
31775
31787
  * Returns a new `Headers` collection with the given header set.
31776
31788
  *
31777
31789
  * **Details**
@@ -32127,7 +32139,7 @@ const Proto$18 = {
32127
32139
  [symbolRedactable](context) {
32128
32140
  return {
32129
32141
  _id: "UrlParams",
32130
- params: Object.fromEntries(redact(this, get$13(context, CurrentRedactedNames)))
32142
+ params: Object.fromEntries(redact(this, get$14(context, CurrentRedactedNames)))
32131
32143
  };
32132
32144
  },
32133
32145
  toJSON() {
@@ -32328,7 +32340,7 @@ const decodeQueryKey = (key) => {
32328
32340
  return key;
32329
32341
  }
32330
32342
  };
32331
- const currentRedactedNames = () => get$13(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$18(), CurrentRedactedNames);
32343
+ const currentRedactedNames = () => get$14(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$18(), CurrentRedactedNames);
32332
32344
  /**
32333
32345
  * Query parameter names or patterns to redact in inspection, spans and errors.
32334
32346
  *
@@ -43254,7 +43266,7 @@ const defaultTimeToLive = (_, _key) => infinity;
43254
43266
  * @since 4.0.0
43255
43267
  */
43256
43268
  const get$7 = /*#__PURE__*/ dual(2, (self, key) => withFiber$1((fiber) => {
43257
- const oentry = get$10(self.map, key);
43269
+ const oentry = get$11(self.map, key);
43258
43270
  if (isSome(oentry)) {
43259
43271
  remove$3(self.map, key);
43260
43272
  if (!hasExpired(oentry.value, fiber)) {
@@ -43307,7 +43319,7 @@ var EntryImpl = class {
43307
43319
  }
43308
43320
  };
43309
43321
  const removeEntry = (self, key, entry) => {
43310
- const current = get$10(self.map, key);
43322
+ const current = get$11(self.map, key);
43311
43323
  if (isSome(current) && current.value === entry) remove$3(self.map, key);
43312
43324
  };
43313
43325
  const hasExpired = (entry, fiber) => {
@@ -44087,7 +44099,7 @@ const publishUnsafe = /*#__PURE__*/ dual(2, (self, value) => {
44087
44099
  * @since 2.0.0
44088
44100
  */
44089
44101
  const subscribe = (self) => uninterruptible(contextWith((services) => {
44090
- const localScope = get$13(services, Scope);
44102
+ const localScope = get$14(services, Scope);
44091
44103
  const scope = forkUnsafe(self.scope);
44092
44104
  const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy, self.ended);
44093
44105
  return addFinalizer$1(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
@@ -46200,6 +46212,38 @@ const catch_$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findR
46200
46212
  */
46201
46213
  const tapError$2 = /*#__PURE__*/ dual(2, (self, f) => transformPull$1(self, (pull) => succeed$5(tapError$3(pull, (err) => isDone$1(err) ? void_$2 : asVoid(f(err))))));
46202
46214
  /**
46215
+ * Recovers from typed channel errors that match a predicate or refinement.
46216
+ *
46217
+ * **When to use**
46218
+ *
46219
+ * Use to recover from typed channel errors when a predicate or refinement
46220
+ * selects the failures that should switch to a recovery channel.
46221
+ *
46222
+ * **Details**
46223
+ *
46224
+ * Matching errors are handled by the recovery function. Non-matching errors
46225
+ * are handled by `orElse` when provided. Without `orElse`, non-matching errors
46226
+ * are re-failed.
46227
+ *
46228
+ * **Gotchas**
46229
+ *
46230
+ * If the cause contains a defect, the handler is skipped and every typed error
46231
+ * is converted to a defect, preserving reason order and interrupts. An
46232
+ * interruption alongside a typed error does not prevent recovery.
46233
+ *
46234
+ * @see {@link catch_ catch} for recovering from every typed channel error
46235
+ * @see {@link catchFilter} for selecting typed errors with a `Filter`
46236
+ * @see {@link catchTag} for selecting tagged typed errors
46237
+ * @see {@link catchCauseFilter} for selecting full causes with a `Filter`
46238
+ *
46239
+ * @stability stable
46240
+ * @category error handling
46241
+ * @since 4.0.0
46242
+ */
46243
+ const catchIf$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, predicate, f, orElse) => catch_$1(self, (err) => {
46244
+ return predicate(err) ? f(err) : orElse ? orElse(err) : fail$1(err);
46245
+ }));
46246
+ /**
46203
46247
  * Recovers from typed channel errors selected by a `Filter`.
46204
46248
  *
46205
46249
  * **When to use**
@@ -47496,7 +47540,7 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
47496
47540
  const isUnlisted = (value) => value === "." || value === ".." || isRoot(value);
47497
47541
  const probe = (parent, name, named) => {
47498
47542
  const path = toFsPath(join$2(parent, name));
47499
- return fs.stat(path).pipe(map$7((info) => info.type), catchReason$2("PlatformError", "NotFound", () => fs.readLink(path).pipe(as("SymbolicLink"), catchIf(isNotLink, () => succeed$5(void 0)))), catchIf(named ? isMissing : isIgnorable, () => succeed$5(void 0)), map$7((type) => type === void 0 ? void 0 : {
47543
+ return fs.stat(path).pipe(map$7((info) => info.type), catchReason$2("PlatformError", "NotFound", () => fs.readLink(path).pipe(as("SymbolicLink"), catchIf$2(isNotLink, () => succeed$5(void 0)))), catchIf$2(named ? isMissing : isIgnorable, () => succeed$5(void 0)), map$7((type) => type === void 0 ? void 0 : {
47500
47544
  name,
47501
47545
  type
47502
47546
  }));
@@ -47510,7 +47554,7 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
47510
47554
  else if (node._tag !== "End") listed = true;
47511
47555
  }
47512
47556
  const probed = listed ? [...literals].filter(isUnlisted) : [...literals];
47513
- return zipWith(listed ? catchIf(fs.readDirectoryEntries(toFsPath(relative)), named ? isMissing : isIgnorable, () => succeed$5([])) : succeed$5([]), forEach$1(probed, (name) => probe(relative, name, named), { concurrency: 16 }), (listing, found) => ({
47557
+ return zipWith(listed ? catchIf$2(fs.readDirectoryEntries(toFsPath(relative)), named ? isMissing : isIgnorable, () => succeed$5([])) : succeed$5([]), forEach$1(probed, (name) => probe(relative, name, named), { concurrency: 16 }), (listing, found) => ({
47514
47558
  entries: sort([...listing, ...found.filter(isNotUndefined)], byName),
47515
47559
  named: named && !listed
47516
47560
  }));
@@ -47535,10 +47579,10 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
47535
47579
  if (!descend && !needsDirectory(compiled, next) && !excludeNeedsDirectory) return child(false, false);
47536
47580
  if (type !== "Unknown" && type !== "SymbolicLink") return child(type === "Directory", false);
47537
47581
  const path = toFsPath(relative);
47538
- return fs.stat(path).pipe(map$7((info) => info.type === "Directory"), catchIf(isIgnorable, () => succeed$5(false)), flatMap$3((isDirectory) => {
47582
+ return fs.stat(path).pipe(map$7((info) => info.type === "Directory"), catchIf$2(isIgnorable, () => succeed$5(false)), flatMap$3((isDirectory) => {
47539
47583
  const resolved = child(isDirectory, type === "SymbolicLink");
47540
47584
  if (type === "SymbolicLink" || resolved?.next === void 0 || result.globstar.size === 0) return succeed$5(resolved);
47541
- return fs.readLink(path).pipe(as(child(isDirectory, true)), catchIf(isNotLink, () => succeed$5(resolved)));
47585
+ return fs.readLink(path).pipe(as(child(isDirectory, true)), catchIf$2(isNotLink, () => succeed$5(resolved)));
47542
47586
  }));
47543
47587
  };
47544
47588
  let slots = DIRECTORY_CONCURRENCY;
@@ -48082,7 +48126,7 @@ const makeUnsafe$3 = (options) => ({
48082
48126
  */
48083
48127
  const make$66 = (options) => withFiber((fiber) => {
48084
48128
  const context = fiber.context;
48085
- const scope = get$13(context, Scope);
48129
+ const scope = get$14(context, Scope);
48086
48130
  const self = makeUnsafe$3({
48087
48131
  lookup: options.lookup,
48088
48132
  context,
@@ -48149,7 +48193,7 @@ const get$5 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore)
48149
48193
  if (self.state._tag === "Closed") return interrupt$1;
48150
48194
  const state = self.state;
48151
48195
  const parent = getCurrent();
48152
- const o = get$10(state.map, key);
48196
+ const o = get$11(state.map, key);
48153
48197
  let entry;
48154
48198
  if (o._tag === "Some") {
48155
48199
  entry = o.value;
@@ -48183,7 +48227,7 @@ const get$5 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore)
48183
48227
  }));
48184
48228
  const removeInterrupted = (self, key, entry, context) => {
48185
48229
  if (self.state._tag === "Closed") return;
48186
- const o = get$10(self.state.map, key);
48230
+ const o = get$11(self.state.map, key);
48187
48231
  if (o._tag === "None" || o.value !== entry) return;
48188
48232
  remove$3(self.state.map, key);
48189
48233
  if (entry.refCount > 0) return;
@@ -48200,13 +48244,13 @@ const release$1 = (self, key, entry) => suspend$3(() => {
48200
48244
  entry.refCount--;
48201
48245
  if (entry.refCount > 0) return void_$2;
48202
48246
  else if (self.state._tag === "Closed") return closeEntry(entry);
48203
- const o = get$10(self.state.map, key);
48247
+ const o = get$11(self.state.map, key);
48204
48248
  if (o._tag === "None" || o.value !== entry) return closeEntry(entry);
48205
48249
  else if (isZero$1(entry.idleTimeToLive)) {
48206
48250
  remove$3(self.state.map, key);
48207
48251
  return closeEntry(entry);
48208
48252
  } else if (!isFinite$2(entry.idleTimeToLive)) return void_$2;
48209
- const clock = get$13(self.context, Clock);
48253
+ const clock = get$14(self.context, Clock);
48210
48254
  resetExpiresAt(entry, clock);
48211
48255
  if (entry.fiber) return void_$2;
48212
48256
  entry.fiber = uninterruptibleMask(function loop(restore) {
@@ -48214,7 +48258,7 @@ const release$1 = (self, key, entry) => suspend$3(() => {
48214
48258
  const remaining = entry.expiresAt - now;
48215
48259
  if (remaining <= 0) {
48216
48260
  if (self.state._tag === "Closed" || entry.refCount > 0) return void_$2;
48217
- const o = get$10(self.state.map, key);
48261
+ const o = get$11(self.state.map, key);
48218
48262
  if (o._tag === "None" || o.value !== entry) return void_$2;
48219
48263
  remove$3(self.state.map, key);
48220
48264
  return ignoreCause(close(entry.scope, void_$3), {
@@ -48256,7 +48300,7 @@ var RcRefImpl = class {
48256
48300
  /** @internal */
48257
48301
  const make$65 = (options) => withFiber((fiber) => {
48258
48302
  const context = fiber.context;
48259
- const scope = get$13(context, Scope);
48303
+ const scope = get$14(context, Scope);
48260
48304
  const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== void 0 ? fromInputUnsafe$1(options.idleTimeToLive) : void 0);
48261
48305
  return as(addFinalizerExit(scope, () => {
48262
48306
  const state = ref.state;
@@ -49529,6 +49573,47 @@ const catch_ = /*#__PURE__*/ dual(2, (self, f) => fromChannel(catch_$1(self.chan
49529
49573
  */
49530
49574
  const tapError$1 = /*#__PURE__*/ dual(2, (self, f) => self.channel.pipe(tapError$2(f), fromChannel));
49531
49575
  /**
49576
+ * Recovers from errors that match a predicate by switching to a recovery stream.
49577
+ *
49578
+ * **Details**
49579
+ *
49580
+ * When a failure matches the filter, the stream switches to the recovery
49581
+ * stream. Non-matching failures propagate downstream, so the error type is
49582
+ * preserved unless the filter narrows it.
49583
+ *
49584
+ * **Gotchas**
49585
+ *
49586
+ * If the cause contains a defect, the handler is skipped and every typed error
49587
+ * is converted to a defect, preserving reason order and interrupts. An
49588
+ * interruption alongside a typed error does not prevent recovery.
49589
+ *
49590
+ * **Example** (Catching matching failures)
49591
+ *
49592
+ * ```ts import.meta.vitest
49593
+ * import { Effect, Stream } from "effect"
49594
+ *
49595
+ * const stream = Stream.make(1, 2).pipe(
49596
+ * Stream.concat(Stream.fail(42)),
49597
+ * Stream.catchIf(
49598
+ * (error): error is 42 => error === 42,
49599
+ * () => Stream.make(999)
49600
+ * )
49601
+ * )
49602
+ *
49603
+ * const program = Effect.gen(function*() {
49604
+ * const values = yield* Stream.runCollect(stream)
49605
+ * values // => [ 1, 2, 999 ]
49606
+ * })
49607
+ *
49608
+ * await Effect.runPromise(program)
49609
+ * ```
49610
+ *
49611
+ * @stability stable
49612
+ * @category error handling
49613
+ * @since 4.0.0
49614
+ */
49615
+ const catchIf = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, predicate, f, orElse) => fromChannel(catchIf$1(toChannel(self), predicate, (e) => f(e).channel, orElse && ((e) => orElse(e).channel))));
49616
+ /**
49532
49617
  * Recovers from errors that match a `Filter` by switching to a recovery
49533
49618
  * stream.
49534
49619
  *
@@ -53863,7 +53948,7 @@ const make$55 = /*#__PURE__*/ sync(() => {
53863
53948
  };
53864
53949
  const query = (keys, effect) => gen(function* () {
53865
53950
  const services = yield* context();
53866
- const scope = get$13(services, Scope);
53951
+ const scope = get$14(services, Scope);
53867
53952
  const results = yield* make$84();
53868
53953
  const runFork = flow(runForkWith(services), runIn(scope));
53869
53954
  let running = false;
@@ -55253,7 +55338,7 @@ const makeSqliteAcquirers = (options) => {
55253
55338
  }) });
55254
55339
  const rollback = (conn) => {
55255
55340
  if (isTransaction) return isTransaction(conn) ? asVoid(conn.executeUnprepared("ROLLBACK", [], void 0)) : void_$2;
55256
- return conn.executeUnprepared("ROLLBACK", [], void 0).pipe(asVoid, catchIf(isNoTransactionError, () => void_$2));
55341
+ return conn.executeUnprepared("ROLLBACK", [], void 0).pipe(asVoid, catchIf$2(isNoTransactionError, () => void_$2));
55257
55342
  };
55258
55343
  const available = flatMap$3(options.connection, (conn) => {
55259
55344
  if (poisoned === void 0) return succeed$5(conn);
@@ -58304,6 +58389,14 @@ const updateContentLength = (headers, body) => {
58304
58389
  const contentLength = body._tag === "Empty" || body._tag === "FormData" ? void 0 : body.contentLength;
58305
58390
  return contentLength === void 0 ? remove$1(headers, "content-length") : set$2(headers, "content-length", contentLength.toString());
58306
58391
  };
58392
+ /**
58393
+ * @internal
58394
+ */
58395
+ const parseContentLength = (contentLength) => {
58396
+ if (contentLength === null || contentLength === void 0 || !/^\d+$/.test(contentLength)) return;
58397
+ const parsed = Number(contentLength);
58398
+ return Number.isSafeInteger(parsed) ? parsed : void 0;
58399
+ };
58307
58400
  // ../../node_modules/.pnpm/effect@4.1.4/node_modules/effect/dist/http/Url.js
58308
58401
  /**
58309
58402
  * Parses and edits platform `URL` values.
@@ -59176,6 +59269,28 @@ const setStatus = /*#__PURE__*/ dual((args) => isHttpServerResponse(args[0]), (s
59176
59269
  * @since 4.0.0
59177
59270
  */
59178
59271
  const omitsBody = (response, withoutBody = false) => withoutBody || response.status === 204 || response.status === 205 || response.status === 304;
59272
+ /**
59273
+ * Converts an `HttpClientResponse` to an `HttpServerResponse`.
59274
+ *
59275
+ * **Details**
59276
+ *
59277
+ * The response body is streamed from the client response. `Set-Cookie` headers are
59278
+ * removed from the header map and represented in the response cookie collection.
59279
+ *
59280
+ * @stability unstable
59281
+ * @category converting
59282
+ * @since 4.0.0
59283
+ */
59284
+ const fromClientResponse = (response) => {
59285
+ const headers = remove$1(response.headers, "set-cookie");
59286
+ return makeResponse$2({
59287
+ status: response.status,
59288
+ headers,
59289
+ cookies: response.cookies,
59290
+ body: stream$2(catchIf(response.stream, isEmptyBodyError, () => empty$6), getOrUndefined$1(get$8(headers, "content-type")), parseContentLength(headers["content-length"]))
59291
+ });
59292
+ };
59293
+ const isEmptyBodyError = (error) => isHttpClientError(error) && error.reason._tag === "EmptyBodyError";
59179
59294
  const Proto$8 = {
59180
59295
  ...PipeInspectableProto,
59181
59296
  [TypeId$20]: TypeId$20,
@@ -61403,7 +61518,7 @@ const isMultipartError = (u) => hasProperty(u, MultipartErrorTypeId);
61403
61518
  * @since 4.0.0
61404
61519
  */
61405
61520
  const makeConfig = (headers) => withFiber((fiber) => {
61406
- const mimeTypes = get$13(fiber.context, FieldMimeTypes);
61521
+ const mimeTypes = get$14(fiber.context, FieldMimeTypes);
61407
61522
  return succeed$5({
61408
61523
  headers,
61409
61524
  maxParts: fiber.getRef(MaxParts),
@@ -63189,7 +63304,7 @@ var MiddlewareImpl = class MiddlewareImpl {
63189
63304
  const stack = [getOrUndefinedUnsafe(context$4, fnContextKey)];
63190
63305
  if (this.dependencies) {
63191
63306
  const memoMap = yield* CurrentMemoMap;
63192
- const scope = get$13(context$4, Scope);
63307
+ const scope = get$14(context$4, Scope);
63193
63308
  const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope);
63194
63309
  stack.push(...getMiddleware$1(depsContext));
63195
63310
  }
@@ -63244,9 +63359,9 @@ const serve = (appLayer, options) => {
63244
63359
  const layerWithRouter = provideMerge(appLayer, options?.routerConfig ? provide$2(layer$20, succeed$6(RouterConfig)(options.routerConfig)) : layer$20);
63245
63360
  return contextWith((context) => {
63246
63361
  const memoMap = CurrentMemoMap.forkOrCreate(context);
63247
- return buildWithMemoMap(layerWithRouter, memoMap, get$13(context, Scope));
63362
+ return buildWithMemoMap(layerWithRouter, memoMap, get$14(context, Scope));
63248
63363
  }).pipe(map$7((context) => {
63249
- const handler = get$13(context, HttpRouter).asHttpEffect();
63364
+ const handler = get$14(context, HttpRouter).asHttpEffect();
63250
63365
  return merge$4(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
63251
63366
  }), unwrap$8, options?.disableListenLog ? identity : withLogAddress);
63252
63367
  };
@@ -65600,7 +65715,7 @@ const Strict = /*#__PURE__*/ Reference("effect/ai/Tool/Strict", { defaultValue:
65600
65715
  * @category getters
65601
65716
  * @since 4.0.0
65602
65717
  */
65603
- const getStrictMode = (tool) => get$13(tool.annotations, Strict);
65718
+ const getStrictMode = (tool) => get$14(tool.annotations, Strict);
65604
65719
  const suspectRx = /"__proto__"\s*:|"constructor"\s*:|\\u/;
65605
65720
  function _parse(text) {
65606
65721
  const obj = JSON.parse(text);
@@ -73028,7 +73143,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
73028
73143
  const disableTracing = options?.disableTracing ?? false;
73029
73144
  const generateRequestId = options?.generateRequestId ?? (() => requestIdCounter++);
73030
73145
  const services = yield* context();
73031
- const scope = get$13(services, Scope);
73146
+ const scope = get$14(services, Scope);
73032
73147
  const entries = /* @__PURE__ */ new Map();
73033
73148
  let isShutdown = false;
73034
73149
  yield* addFinalizer$1(scope, withFiber((parent) => {
@@ -73375,7 +73490,7 @@ const makeRpcSchemas = (codecFor) => {
73375
73490
  let entry = cache.get(rpc);
73376
73491
  if (entry !== void 0) return entry;
73377
73492
  const streamSchemas = getStreamSchemas(rpc.successSchema);
73378
- const parseOptions = get$13(rpc.annotations, ParseOptions);
73493
+ const parseOptions = get$14(rpc.annotations, ParseOptions);
73379
73494
  const exitSchema$2 = exitSchema(rpc);
73380
73495
  let decodeDiscardExit;
73381
73496
  entry = {
@@ -80029,7 +80144,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
80029
80144
  const concurrency = options.concurrency ?? "unbounded";
80030
80145
  const disableFatalDefects = options.disableFatalDefects ?? false;
80031
80146
  const services = yield* context();
80032
- const scope = get$13(services, Scope);
80147
+ const scope = get$14(services, Scope);
80033
80148
  const trackFiber = runIn(forkUnsafe(scope, "parallel"));
80034
80149
  const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$82(concurrency);
80035
80150
  const clients = /* @__PURE__ */ new Map();
@@ -80270,7 +80385,7 @@ const rpcCodecs = (codecFor, rpc) => {
80270
80385
  let codecs = shared ? sharedRpcCodecs.get(rpc) : void 0;
80271
80386
  if (codecs === void 0) {
80272
80387
  const streamSchemas = getStreamSchemas(rpc.successSchema);
80273
- const parseOptions = get$13(rpc.annotations, ParseOptions);
80388
+ const parseOptions = get$14(rpc.annotations, ParseOptions);
80274
80389
  codecs = {
80275
80390
  decode: decodeUnknownEffect(codecFor(rpc.payloadSchema), parseOptions),
80276
80391
  encodeChunk: encodeUnknownEffect(codecFor(NonEmptyArray(isSome(streamSchemas) ? streamSchemas.value.success : Any)), parseOptions),
@@ -80408,7 +80523,7 @@ const make$21 = /*#__PURE__*/ fnUntraced(function* (group, options) {
80408
80523
  const exitSchema$1 = exitSchema(rpc);
80409
80524
  discardSchemas = {
80410
80525
  ...schemas,
80411
- encodeExit: encodeUnknownEffect(codecFor(Exit(Void, exitSchema$1.error, exitSchema$1.defect)), get$13(rpc.annotations, ParseOptions))
80526
+ encodeExit: encodeUnknownEffect(codecFor(Exit(Void, exitSchema$1.error, exitSchema$1.defect)), get$14(rpc.annotations, ParseOptions))
80412
80527
  };
80413
80528
  discardSchemasCache.set(rpc, discardSchemas);
80414
80529
  }
@@ -80988,7 +81103,7 @@ const runMiddleware = (handler, middleware, invocation, request) => {
80988
81103
  if (isSuccess$1(failure) && !hasDies(cause)) {
80989
81104
  const error = failure.success.error;
80990
81105
  if (isHidden(error)) return fail$6(error);
80991
- if (middleware.length === 0 || get$13(reasonAnnotations(failure.success), HandlerFailure)) return failCause$3(cause);
81106
+ if (middleware.length === 0 || get$14(reasonAnnotations(failure.success), HandlerFailure)) return failCause$3(cause);
80992
81107
  if (isMcpError(error)) return rejectWith(error);
80993
81108
  }
80994
81109
  return logError(cause).pipe(andThen(report(cause)), andThen(rejectWith(internalError)));
@@ -81068,7 +81183,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
81068
81183
  const queued = {
81069
81184
  notification,
81070
81185
  delivered,
81071
- requestLiveness: get$13(fiber.context, RequestLiveness),
81186
+ requestLiveness: get$14(fiber.context, RequestLiveness),
81072
81187
  requestContext: getOrUndefined(fiber.context, McpRequestContext),
81073
81188
  requestHeaders: getOrUndefined(fiber.context, HttpServerRequest)?.headers
81074
81189
  };
@@ -81078,7 +81193,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
81078
81193
  _tag: "Exit",
81079
81194
  exit: void_$3
81080
81195
  }));
81081
- const requestQueue = get$13(fiber.context, RequestNotificationQueue);
81196
+ const requestQueue = get$14(fiber.context, RequestNotificationQueue);
81082
81197
  if (requestQueue !== void 0 && queued.requestContext !== void 0 && isRequestNotification(notification)) {
81083
81198
  offerUnsafe(requestQueue, queued);
81084
81199
  return andThen(_await(delivered), acknowledge);
@@ -82136,7 +82251,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
82136
82251
  const failure = findFail(cause);
82137
82252
  if (isSuccess$1(failure)) {
82138
82253
  const error = failure.success.error;
82139
- const origin = get$13(reasonAnnotations(failure.success), FailureOrigin);
82254
+ const origin = get$14(reasonAnnotations(failure.success), FailureOrigin);
82140
82255
  if (origin === "parameters" && isParameterValidationError(error)) return fail$6(new InvalidParams({ message: error.reason.message }));
82141
82256
  if (origin === "handler" && isDeclaredFailure(error)) return catchCause$2(declaredFailureResult(error), internalToolError);
82142
82257
  }
@@ -82151,10 +82266,10 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
82151
82266
  outputSchema,
82152
82267
  annotations: {
82153
82268
  ...getOption(tool.annotations, Title).pipe(map$13((title) => ({ title })), getOrUndefined$1),
82154
- readOnlyHint: get$13(tool.annotations, Readonly),
82155
- destructiveHint: get$13(tool.annotations, Destructive),
82156
- idempotentHint: get$13(tool.annotations, Idempotent),
82157
- openWorldHint: get$13(tool.annotations, OpenWorld)
82269
+ readOnlyHint: get$14(tool.annotations, Readonly),
82270
+ destructiveHint: get$14(tool.annotations, Destructive),
82271
+ idempotentHint: get$14(tool.annotations, Idempotent),
82272
+ openWorldHint: get$14(tool.annotations, OpenWorld)
82158
82273
  },
82159
82274
  _meta: toolMeta
82160
82275
  });
@@ -93914,7 +94029,7 @@ const Formatter = /*#__PURE__*/ Reference("effect/cli/CliOutput", { defaultValue
93914
94029
  */
93915
94030
  const defaultPresenter = { present: /*#__PURE__*/ fnUntraced(function* (event) {
93916
94031
  const context$2 = yield* context();
93917
- const formatter = getOrUndefined(context$2, Formatter) ?? defaultFormatter({ colors: get$13(context$2, TerminalCapabilities).canColor });
94032
+ const formatter = getOrUndefined(context$2, Formatter) ?? defaultFormatter({ colors: get$14(context$2, TerminalCapabilities).canColor });
93918
94033
  switch (event._tag) {
93919
94034
  case "Help": return yield* log(formatter.formatHelpDoc(event.helpDoc));
93920
94035
  case "InvalidInvocation":
@@ -96336,7 +96451,7 @@ const defaults = { builtIns: BuiltIns };
96336
96451
  *
96337
96452
  * @internal
96338
96453
  */
96339
- const resolveFormatter = /*#__PURE__*/ contextWith((context) => succeed$5(getOrUndefined(context, Formatter) ?? defaultFormatter({ colors: get$13(context, TerminalCapabilities).canColor })));
96454
+ const resolveFormatter = /*#__PURE__*/ contextWith((context) => succeed$5(getOrUndefined(context, Formatter) ?? defaultFormatter({ colors: get$14(context, TerminalCapabilities).canColor })));
96340
96455
  // ../../node_modules/.pnpm/effect@4.1.4/node_modules/effect/dist/cli/internal/lexer.js
96341
96456
  /**
96342
96457
  * @internal
@@ -98121,7 +98236,7 @@ const toInternalServerError = (request, cause) => new HttpServerError({ reason:
98121
98236
  request,
98122
98237
  cause
98123
98238
  }) });
98124
- const handlePlatformError = (request, self) => catchIf(self, (error) => error.reason._tag === "NotFound", () => fail$6(toRouteNotFoundError(request)), (error) => fail$6(toInternalServerError(request, error)));
98239
+ const handlePlatformError = (request, self) => catchIf$2(self, (error) => error.reason._tag === "NotFound", () => fail$6(toRouteNotFoundError(request)), (error) => fail$6(toInternalServerError(request, error)));
98125
98240
  const acceptsHtml = (accept) => accept !== void 0 && accept.toLowerCase().includes("text/html");
98126
98241
  const stripWeakEtagPrefix = (value) => {
98127
98242
  const trimmed = value.trim();
@@ -106054,7 +106169,7 @@ const prepareTools$1 = /*#__PURE__*/ fnUntraced(function* ({ betas, capabilities
106054
106169
  input_schema,
106055
106170
  ...isNotUndefined(description) ? { description } : void 0,
106056
106171
  ...isNotUndefined(strict) ? { strict } : void 0,
106057
- ...get$13(tool.annotations, DeferLoading) ? { defer_loading: true } : void 0
106172
+ ...get$14(tool.annotations, DeferLoading) ? { defer_loading: true } : void 0
106058
106173
  });
106059
106174
  if (capabilities.supportsStructuredOutput === true) betas.add("structured-outputs-2025-11-13");
106060
106175
  }
@@ -110846,10 +110961,10 @@ const layerFlusher = /*#__PURE__*/ sync$1(Flusher, () => {
110846
110961
  */
110847
110962
  const make$5 = /*#__PURE__*/ fnUntraced(function* (options) {
110848
110963
  const services = yield* context();
110849
- const clock = get$13(services, Clock);
110850
- const scope = get$13(services, Scope);
110964
+ const clock = get$14(services, Clock);
110965
+ const scope = get$14(services, Scope);
110851
110966
  const exportInterval = max$1(fromInputUnsafe$1(options.exportInterval), zero$2);
110852
- const client = get$13(services, HttpClient).pipe(tap((response) => ignore$1(response.arrayBuffer)), tapError((error) => error.response ? ignore$1(error.response.arrayBuffer) : void_$2), filterStatusOk, transformResponse(provideService$2(TracerPropagationEnabled, false)), retryTransient({
110967
+ const client = get$14(services, HttpClient).pipe(tap((response) => ignore$1(response.arrayBuffer)), tapError((error) => error.response ? ignore$1(error.response.arrayBuffer) : void_$2), filterStatusOk, transformResponse(provideService$2(TracerPropagationEnabled, false)), retryTransient({
110853
110968
  schedule: policy,
110854
110969
  times: 3
110855
110970
  }));
@@ -111520,7 +111635,20 @@ const layerRoutes = use((router) => gen(function* () {
111520
111635
  if (isFailure$1(account)) return empty$1(failureOptions(account.failure, 401));
111521
111636
  return yield* schemaJson(Account)(account.success, { headers: { "cache-control": "no-store" } });
111522
111637
  }));
111523
- for (const origin of toArray(issuer)) for (const step of ["sign-in", "sign-out"]) yield* router.add("GET", `/auth/${step}`, map$7(HttpServerRequest, (request) => redirect(`${new URL(`/${step}`, origin).href}?${new URLSearchParams({ next: new URL(request.url, "http://local").searchParams.get("next") ?? canonical })}`)));
111638
+ for (const origin of toArray(issuer)) {
111639
+ yield* router.add("GET", "/auth/sign-in", map$7(HttpServerRequest, (request) => redirect(`${new URL("/sign-in", origin).href}?${new URLSearchParams({ next: new URL(request.url, "http://local").searchParams.get("next") ?? canonical })}`)));
111640
+ const client = yield* HttpClient;
111641
+ yield* router.add("POST", "/auth/sign-out", gen(function* () {
111642
+ const request = yield* HttpServerRequest;
111643
+ if (request.headers["origin"] !== new URL(canonical).origin) return text("Invalid sign-out origin; no changes committed", { status: 403 });
111644
+ const target = new URL("/sign-out", origin);
111645
+ target.search = new URLSearchParams({ next: new URL(request.url, canonical).searchParams.get("next") ?? canonical }).toString();
111646
+ return yield* pipe(client.post(target.href, { headers: {
111647
+ cookie: request.headers["cookie"] ?? "",
111648
+ origin: new URL(origin).origin
111649
+ } }), provideService$2(RequestInit, { redirect: "manual" }), timeout("10 seconds"), map$7(fromClientResponse), tapError$3(() => logWarning("Auth did not confirm sign-out")), catch_$2(() => succeed$5(text("Auth sign-out was not confirmed; the shared session may remain", { status: 503 }))));
111650
+ }));
111651
+ }
111524
111652
  }));
111525
111653
  function layerIcon(icon) {
111526
111654
  const response = succeed$5(text(icon, {
@@ -111678,7 +111806,7 @@ const make$1 = (options) => gen(function* () {
111678
111806
  timeToLive: (exit) => isSuccess(exit) ? prepareCacheTTL : zero$2
111679
111807
  });
111680
111808
  const runStatement = (statement, params, raw) => withFiber((fiber) => {
111681
- const useSafeIntegers = get$13(fiber.context, SafeIntegers);
111809
+ const useSafeIntegers = get$14(fiber.context, SafeIntegers);
111682
111810
  return try_({
111683
111811
  try: () => {
111684
111812
  statement.setReadBigInts(useSafeIntegers);
@@ -111693,7 +111821,7 @@ const make$1 = (options) => gen(function* () {
111693
111821
  });
111694
111822
  });
111695
111823
  const runStatementValues = (statement, params) => withFiber((fiber) => {
111696
- const useSafeIntegers = get$13(fiber.context, SafeIntegers);
111824
+ const useSafeIntegers = get$14(fiber.context, SafeIntegers);
111697
111825
  return try_({
111698
111826
  try: () => {
111699
111827
  statement.setReadBigInts(useSafeIntegers);
@@ -111703,7 +111831,7 @@ const make$1 = (options) => gen(function* () {
111703
111831
  });
111704
111832
  });
111705
111833
  const runStatementValuesUnprepared = (statement, params) => withFiber((fiber) => {
111706
- const useSafeIntegers = get$13(fiber.context, SafeIntegers);
111834
+ const useSafeIntegers = get$14(fiber.context, SafeIntegers);
111707
111835
  return try_({
111708
111836
  try: () => {
111709
111837
  statement.setReadBigInts(useSafeIntegers);
@@ -111850,6 +111978,7 @@ const dataDirectory = gen(function* () {
111850
111978
  mode: 448,
111851
111979
  recursive: true
111852
111980
  });
111981
+ yield* (yield* FileSystem).chmod(directory, 448);
111853
111982
  return directory;
111854
111983
  });
111855
111984
  const retiredSessions = effectDiscard(make$18({})({
@@ -112924,7 +113053,7 @@ function caddyConfig(rows, storage) {
112924
113053
  return `{\n\tadmin 127.0.0.1:20219\n\tgrace_period 10s\n\tpersist_config off\n\tstorage file_system {\n\t\troot ${encodeSync(fromJsonString(String$6))(storage)}\n\t}\n}\n\n${pipe(rows, filter$5((row) => row.kind === "public"), map$10((row) => `${row.hostname} {\n\tencode\n\treverse_proxy 127.0.0.1:${row.port}\n}\n`), join$4("\n"))}`;
112925
113054
  }
112926
113055
  function ownsMapping(status, row) {
112927
- return !exists(status.AllowFunnel, (permissions) => permissions[`${row.hostname}:${row.port}`] === true) && pipe(status.Web, flatMap$8(get$12(`${row.hostname}:${row.port}`)), exists((value) => size$4(value.Handlers) === 1 && pipe(value.Handlers, get$12("/"), flatMap$8((handler) => handler.Proxy), exists((proxy) => proxy === `http://127.0.0.1:${row.port}`))));
113056
+ return !exists(status.AllowFunnel, (permissions) => permissions[`${row.hostname}:${row.port}`] === true) && pipe(status.Web, flatMap$8(get$13(`${row.hostname}:${row.port}`)), exists((value) => size$4(value.Handlers) === 1 && pipe(value.Handlers, get$13("/"), flatMap$8((handler) => handler.Proxy), exists((proxy) => proxy === `http://127.0.0.1:${row.port}`))));
112928
113057
  }
112929
113058
  function exposureUrl(row) {
112930
113059
  if (row.kind === "tailnet") return `https://${row.hostname}:${row.port}`;
@@ -113037,7 +113166,7 @@ var Exposures = class extends Service$1()("@deslop/deploy/services/exposures/ser
113037
113166
  if (some(current, (row) => row.name === input.name)) return yield* DeployError.make({ message: "Remove the existing owned exposure before changing it" });
113038
113167
  if (some(current, (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" });
113039
113168
  if (input.kind === "public" && !input.publicAccess) return yield* DeployError.make({ message: "Explicitly confirm public access before publishing a port" });
113040
- if (input.kind === "public" && platform !== "linux") return yield* DeployError.make({ message: "Public exposure needs a Linux worker; expose this port to the tailnet" });
113169
+ if (input.kind === "public" && (platform !== "linux" || arch !== "x64")) return yield* DeployError.make({ message: "Public exposure needs a Linux x64 worker; expose this port to the tailnet" });
113041
113170
  const exposure = Exposure.make(omit(input, ["publicAccess"]));
113042
113171
  if (exposure.kind === "tailnet") yield* checkTailnet(exposure);
113043
113172
  yield* asStorageDeployError(insertExposure(exposure));
@@ -113294,7 +113423,7 @@ function alias(value$4) {
113294
113423
  return pipe(value(value$4), when("vite-plus", constant("vp")), orElse(() => value$4));
113295
113424
  }
113296
113425
  function shellRest(tokens) {
113297
- const script = pipe(tokens, get$11(2), getOrElse$1(constant("")));
113426
+ const script = pipe(tokens, get$12(2), getOrElse$1(constant("")));
113298
113427
  const shifts = match$8(match$2(/\bshift\b/gu)(script), {
113299
113428
  onNone: constant(0),
113300
113429
  onSome: (matches) => matches.length
@@ -113315,11 +113444,11 @@ function unwrapTokens(tokens, cwd) {
113315
113444
  },
113316
113445
  onSome: (index) => drop$1(tokens, index + 1)
113317
113446
  })), cwd);
113318
- if (contains$1(SHELLS, name) && pipe(tokens, get$11(1), getOrElse$1(constant(""))) === "-c") return unwrapTokens(shellRest(tokens), cwd);
113447
+ if (contains$1(SHELLS, name) && pipe(tokens, get$12(1), getOrElse$1(constant(""))) === "-c") return unwrapTokens(shellRest(tokens), cwd);
113319
113448
  if (contains$1(RUNTIMES, name)) return pipe(tokens, findFirstIndex((token, index) => index > 0 && !isFlag(token)), match$8({
113320
113449
  onNone: () => tokens,
113321
113450
  onSome: (index) => {
113322
- const script = pipe(tokens, get$11(index), getOrElse$1(constant("")));
113451
+ const script = pipe(tokens, get$12(index), getOrElse$1(constant("")));
113323
113452
  const pkg = capture(/.*node_modules\/((?:@[^/]+\/)?[^/.][^/]*)\//u, script);
113324
113453
  const app = orElse$3(capture(/\.deslop\/([^/]+)\//u, script), () => flatMap$8(cwd, (value) => capture(/\/apps\/([^/]+)$/u, value)));
113325
113454
  return [pipe(pkg, orElse$3(() => app), getOrElse$1(() => basename(script))), ...drop$1(tokens, index + 1)];
@@ -113344,7 +113473,7 @@ function scan(name, subject, args, words, values) {
113344
113473
  onSome: (token) => {
113345
113474
  if (isFlag(token)) {
113346
113475
  const parsed = flagParts(token);
113347
- const next = pipe(args, get$11(1), filter$7((value) => !isFlag(value)));
113476
+ const next = pipe(args, get$12(1), filter$7((value) => !isFlag(value)));
113348
113477
  const value = orElse$3(parsed.inline, () => next);
113349
113478
  return scan(name, subject, match(isNone(parsed.inline) && isSome(next), {
113350
113479
  onFalse: () => drop$1(args, 1),
@@ -113380,7 +113509,7 @@ function scan(name, subject, args, words, values) {
113380
113509
  function commandLabel(argv, cwd) {
113381
113510
  const [head = "", ...args] = unwrap(argv, cwd);
113382
113511
  const name = alias(basename(head));
113383
- const subject = pipe(SUBJECT, get$12(name), getOrElse$1(() => empty$15()));
113512
+ const subject = pipe(SUBJECT, get$13(name), getOrElse$1(() => empty$15()));
113384
113513
  const scanned = scan(name, subject, args, [], {});
113385
113514
  if (contains$1(SHELLS, name) && isReadonlyArrayEmpty(scanned.words)) return {
113386
113515
  detail: pipe(cwd, map$13(basename), getOrElse$1(constant(""))),
@@ -113388,7 +113517,7 @@ function commandLabel(argv, cwd) {
113388
113517
  };
113389
113518
  return match$8(scanned.ssh, {
113390
113519
  onNone: () => ({
113391
- detail: join$4([...take$3(scanned.words, 2), ...filter$5(getSomes(map$10(subject, (flag) => get$12(scanned.values, flag))), isNonEmpty$1)], " "),
113520
+ detail: join$4([...take$3(scanned.words, 2), ...filter$5(getSomes(map$10(subject, (flag) => get$13(scanned.values, flag))), isNonEmpty$1)], " "),
113392
113521
  name
113393
113522
  }),
113394
113523
  onSome: (ssh) => {
@@ -113408,7 +113537,7 @@ function sourceBelongsToWorker(source, worker) {
113408
113537
  return source.name === worker || startsWith(`${worker} · `)(source.name);
113409
113538
  }
113410
113539
  function processOwner(cgroup) {
113411
- const container = pipe(cgroup, match$2(/\/(?:docker-|docker\/)([a-f0-9]{12,64})(?:\.scope)?(?:\/|\n|$)/u), flatMap$8((match) => get$11(match, 1)));
113540
+ const container = pipe(cgroup, match$2(/\/(?:docker-|docker\/)([a-f0-9]{12,64})(?:\.scope)?(?:\/|\n|$)/u), flatMap$8((match) => get$12(match, 1)));
113412
113541
  if (isSome(container)) return map$13(container, (id) => AppId.make(`container:${slice(0, 12)(id)}`));
113413
113542
  const segments = split$1(cgroup, /[/\n]/u);
113414
113543
  const service = findLastIndex(segments, endsWith(".service"));
@@ -113481,7 +113610,7 @@ function workloads(items) {
113481
113610
  const attached = filter$5(byUnit[item.worker]?.[`unit:${unit}`] ?? [], (listener) => contains$2(listener.unit, unit));
113482
113611
  const bindings = pipe(item.bindings, getOrElse$1(empty$15), map$10((binding) => ({
113483
113612
  ...item,
113484
- ...pipe(get$8(bySocket, socket(item.worker, {
113613
+ ...pipe(get$9(bySocket, socket(item.worker, {
113485
113614
  address: some$1(binding.address),
113486
113615
  port: some$1(binding.port),
113487
113616
  protocol: some$1(binding.protocol)
@@ -113597,7 +113726,7 @@ function processTree(rows) {
113597
113726
  const visited = empty$5();
113598
113727
  function build(row) {
113599
113728
  add$1(visited, row.pid);
113600
- const below = pipe(get$12(children, `${row.pid}`), getOrElse$1(empty$15), filter$5((child) => !has(visited, child.pid)), map$10(build));
113729
+ const below = pipe(get$13(children, `${row.pid}`), getOrElse$1(empty$15), filter$5((child) => !has(visited, child.pid)), map$10(build));
113601
113730
  const self = {
113602
113731
  children: [],
113603
113732
  command: row.command,
@@ -113754,7 +113883,7 @@ function processStatus(status) {
113754
113883
  return [slice(0, at)(line), trim(slice(at + 1)(line))];
113755
113884
  }));
113756
113885
  function field(name) {
113757
- return pipe(get$12(values, name), filter$7(isNonEmpty$1), getOrUndefined$1);
113886
+ return pipe(get$13(values, name), filter$7(isNonEmpty$1), getOrUndefined$1);
113758
113887
  }
113759
113888
  return {
113760
113889
  memory: decodeSync(ResidentMemoryFromKiB)(split$1(values["VmRSS"] ?? "", /\s+/u)[0] || "0"),
@@ -113827,7 +113956,7 @@ function processUsage(current, previous) {
113827
113956
  });
113828
113957
  const process = {
113829
113958
  ...record.process,
113830
- cpu: pipe(get$8(known, record.process.pid), filter$7((value) => equals$1(value.start, record.start) && isGreaterThan$3(elapsed, zero$2) && isGreaterThanOrEqualTo$3(record.ticks, value.ticks) && exists(previous, (old) => pipe(old.time, distance(current.time), isGreaterThanOrEqualTo$3(PROCESS_INTERVAL)) && pipe(old.time, distance(current.time), isLessThanOrEqualTo$3(seconds(90))))), map$13((value) => clamp(toMillis(subtract(record.ticks, value.ticks)) / toMillis(elapsed) * 100, {
113959
+ cpu: pipe(get$9(known, record.process.pid), filter$7((value) => equals$1(value.start, record.start) && isGreaterThan$3(elapsed, zero$2) && isGreaterThanOrEqualTo$3(record.ticks, value.ticks) && exists(previous, (old) => pipe(old.time, distance(current.time), isGreaterThanOrEqualTo$3(PROCESS_INTERVAL)) && pipe(old.time, distance(current.time), isLessThanOrEqualTo$3(seconds(90))))), map$13((value) => clamp(toMillis(subtract(record.ticks, value.ticks)) / toMillis(elapsed) * 100, {
113831
113960
  maximum: 100,
113832
113961
  minimum: 0
113833
113962
  })))
@@ -113859,7 +113988,7 @@ function launchdProcesses(text, agents) {
113859
113988
  function agent(pid, visited = empty$5()) {
113860
113989
  if (has(visited, pid)) return none();
113861
113990
  add$1(visited, pid);
113862
- return pipe(agents, get$8(pid), orElse$3(() => pipe(parents, get$8(pid), flatMap$8((parent) => agent(parent, visited)))));
113991
+ return pipe(agents, get$9(pid), orElse$3(() => pipe(parents, get$9(pid), flatMap$8((parent) => agent(parent, visited)))));
113863
113992
  }
113864
113993
  return getSomes(map$10(rows, (row) => flatMap$8(agent(row.pid), (unit) => map$13(all$4({
113865
113994
  start: make$78(row.start),
@@ -114034,7 +114163,7 @@ function portItems(sockets, worker, http, source) {
114034
114163
  }];
114035
114164
  }), { concurrency: 8 })));
114036
114165
  return yield* forEach$1(sockets, fnUntraced(function* (socket) {
114037
- const origin = flatMap$8(socket.process, (process) => get$8(metadata, process.pid));
114166
+ const origin = flatMap$8(socket.process, (process) => get$9(metadata, process.pid));
114038
114167
  const unit = flatMap$8(origin, (process) => process.unit);
114039
114168
  const process = flatMap$8(socket.process, (match) => {
114040
114169
  if (!startsWith("node")(match.name)) return liftPredicate(match.name, isNonEmpty$1);
@@ -114159,7 +114288,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
114159
114288
  return map$10(listed.rows, (row) => InventoryItem.make({
114160
114289
  active: row.active === "active",
114161
114290
  detail: `${scope} · ${row.description}`,
114162
- failure: get$12(failures, row.unit),
114291
+ failure: get$13(failures, row.unit),
114163
114292
  health: match(row.active === "failed", {
114164
114293
  onFalse: constant("quiet"),
114165
114294
  onTrue: constant("error")
@@ -114167,9 +114296,9 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
114167
114296
  id: ItemId.make(`${worker}:${scope}:${row.unit}`),
114168
114297
  kind: "service",
114169
114298
  name: row.unit,
114170
- next: flatten$6(get$8(scheduled, row.unit)),
114299
+ next: flatten$6(get$9(scheduled, row.unit)),
114171
114300
  running: row.active === "activating" || row.active === "deactivating" || row.active === "active" && row.sub === "running",
114172
- scheduled: pipe(scheduled, get$8(row.unit), map$13(constTrue)),
114301
+ scheduled: pipe(scheduled, get$9(row.unit), map$13(constTrue)),
114173
114302
  scope: some$1(scope),
114174
114303
  state: match(row.active === "active", {
114175
114304
  onFalse: () => `${row.active} · ${row.sub}`,
@@ -114306,7 +114435,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
114306
114435
  }
114307
114436
  const records = map$12(launchd.table, (text) => {
114308
114437
  const agents = fromIterable$5(map$10(apps, (app) => [app.pid, app.label]));
114309
- return filter$5(launchdProcesses(text, agents), (record) => record.process.pid === selfProcess || !pipe(agents, get$8(selfProcess), contains$2(record.unit)));
114438
+ return filter$5(launchdProcesses(text, agents), (record) => record.process.pid === selfProcess || !pipe(agents, get$9(selfProcess), contains$2(record.unit)));
114310
114439
  });
114311
114440
  const owned = getOrElse(records, empty$15);
114312
114441
  return {
@@ -114499,7 +114628,7 @@ const SERIES = {
114499
114628
  function counters(stat, uptime, time) {
114500
114629
  const values = decodeSync(CpuCounters)(pipe(stat, split$1("\n"), head, getOrElse$1(constant("")), trim, split$1(/\s+/u), drop$1(1), take$3(8)));
114501
114630
  return {
114502
- cpuIdle: millis((getOrThrow$1(get$11(values, 3)) + getOrThrow$1(get$11(values, 4))) * 10),
114631
+ cpuIdle: millis((getOrThrow$1(get$12(values, 3)) + getOrThrow$1(get$12(values, 4))) * 10),
114503
114632
  cpuTotal: millis(sumAll(values) * 10),
114504
114633
  time,
114505
114634
  uptime: seconds(decodeSync(FiniteFromString)(split$1(uptime, " ")[0]))
@@ -114526,7 +114655,7 @@ function cpuCounters(cpus, uptime, time) {
114526
114655
  }
114527
114656
  function vmStatMemory(text, total) {
114528
114657
  const pages = fromEntries(getSomes(pipe(text, split$1("\n"), map$10((line) => map$13(match$2(/^"?([^":]+)"?:\s+([0-9]+)\.$/u)(trim(line)), (match) => [match[1] ?? "", match[2] ?? ""])))));
114529
- const page = decodeUnknownSync(FiniteFromString)(pipe(match$2(/page size of ([0-9]+) bytes/u)(text), flatMap$8(get$11(1)), getOrUndefined$1));
114658
+ const page = decodeUnknownSync(FiniteFromString)(pipe(match$2(/page size of ([0-9]+) bytes/u)(text), flatMap$8(get$12(1)), getOrUndefined$1));
114530
114659
  const counts = decodeUnknownSync(VmStatPages)(pages);
114531
114660
  return {
114532
114661
  total,
@@ -114673,7 +114802,7 @@ function history(samples, minutes, now) {
114673
114802
  function bandName(id, labels) {
114674
114803
  if (id === "other") return "Low impact";
114675
114804
  if (id === "system") return "System";
114676
- return pipe(labels, get$12(id), getOrElse$1(() => replaceAll(/^service:[a-z]+:(?:deslop-)?|\.service$/gu, "")(replace(/^container:/u, "container ")(id))));
114805
+ return pipe(labels, get$13(id), getOrElse$1(() => replaceAll(/^service:[a-z]+:(?:deslop-)?|\.service$/gu, "")(replace(/^container:/u, "container ")(id))));
114677
114806
  }
114678
114807
  function appCgroup(path, siblings) {
114679
114808
  const name = getOrElse$1(last$1(split$1(path, "/")), constant(""));
@@ -114704,7 +114833,7 @@ function appShares(current, previous) {
114704
114833
  const measured = isGreaterThan$3(elapsed, zero$2) && exists(previous, (old) => pipe(old.time, distance(current.time), isLessThanOrEqualTo$3(seconds(90))));
114705
114834
  return pipe(toEntries(groupBy(toEntries(current.cgroups), (entry) => entry[1].id)), filter$5((entry) => sumAll(map$10(entry[1], (cgroup) => cgroup[1].memory)) >= 1024 ** 2), map$10((entry) => {
114706
114835
  const [id, cgroups] = entry;
114707
- const deltas = getSomes(map$10(cgroups, (cgroup) => pipe(flatMap$8(previous, (old) => get$12(old.cgroups, cgroup[0])), filter$7((old) => measured && isGreaterThanOrEqualTo$3(cgroup[1].usage, old.usage)), map$13((old) => toMicros(subtract(cgroup[1].usage, old.usage))))));
114836
+ const deltas = getSomes(map$10(cgroups, (cgroup) => pipe(flatMap$8(previous, (old) => get$13(old.cgroups, cgroup[0])), filter$7((old) => measured && isGreaterThanOrEqualTo$3(cgroup[1].usage, old.usage)), map$13((old) => toMicros(subtract(cgroup[1].usage, old.usage))))));
114708
114837
  return {
114709
114838
  cpu: match$6(deltas, {
114710
114839
  onEmpty: () => none(),
@@ -114992,7 +115121,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
114992
115121
  worker
114993
115122
  });
114994
115123
  const time = yield* now;
114995
- const step = getOrThrow$1(get$12(SERIES, `${toMinutes(query.minutes)}`));
115124
+ const step = getOrThrow$1(get$13(SERIES, `${toMinutes(query.minutes)}`));
114996
115125
  const samples = yield* asDeployError$1(listSeries({
114997
115126
  after: subtractDuration(chartWindow(query.minutes, time).start, step),
114998
115127
  step
@@ -115153,7 +115282,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
115153
115282
  };
115154
115283
  }), "Fleet.local");
115155
115284
  const remote = fnUntraced(function* (worker, use) {
115156
- const peer = getOrThrow$1(get$12(peers, worker.name));
115285
+ const peer = getOrThrow$1(get$13(peers, worker.name));
115157
115286
  if (!(yield* get$2(peer.connected))) return yield* DeployError.make({ message: "Worker is unreachable" });
115158
115287
  return yield* pipe(use(peer.client), timeout(seconds(15)), withSpan("Fleet.remote", { attributes: { worker: worker.name } }));
115159
115288
  });
@@ -115173,7 +115302,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
115173
115302
  const time = yield* now;
115174
115303
  const cached = yield* get$2(lastMetrics);
115175
115304
  return [own, ...map$10(workers, (worker) => {
115176
- const saved = get$8(cached, [worker.name, query.minutes]);
115305
+ const saved = get$9(cached, [worker.name, query.minutes]);
115177
115306
  return {
115178
115307
  ...cachedHistory(query, time, saved),
115179
115308
  error: match$8(saved, {
@@ -115219,7 +115348,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
115219
115348
  worker: worker.name
115220
115349
  })), tapError$3((cause) => logWarning("A worker history could not be read", cause)), catch_$2(fnUntraced(function* (cause) {
115221
115350
  return {
115222
- ...cachedHistory(query, yield* now, get$8(yield* get$2(lastMetrics), [worker.name, query.minutes])),
115351
+ ...cachedHistory(query, yield* now, get$9(yield* get$2(lastMetrics), [worker.name, query.minutes])),
115223
115352
  error: some$1(cause.message),
115224
115353
  stale: true,
115225
115354
  worker: worker.name