@duang-ai/cli 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +7 -4
  2. package/dist/duang.mjs +773 -361
  3. package/package.json +4 -4
package/dist/duang.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  import { homedir, hostname } from "node:os";
20
20
  import { join as join2 } from "node:path";
21
21
 
22
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Pipeable.js
22
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Pipeable.js
23
23
  var pipeArguments = (self, args2) => {
24
24
  switch (args2.length) {
25
25
  case 0:
@@ -63,7 +63,7 @@ var Class = /* @__PURE__ */ (function() {
63
63
  return PipeableBase;
64
64
  })();
65
65
 
66
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Function.js
66
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Function.js
67
67
  var dual = function(arity, body) {
68
68
  if (typeof arity === "function") {
69
69
  return function() {
@@ -177,7 +177,7 @@ function memoizeIdempotent(f) {
177
177
  };
178
178
  }
179
179
 
180
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/equal.js
180
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/equal.js
181
181
  var errorSiteKeys = ["line", "column", "sourceURL", "originalLine", "originalColumn"];
182
182
  var getAllObjectKeys = (obj) => {
183
183
  const keys3 = new Set(Reflect.ownKeys(obj));
@@ -213,13 +213,13 @@ var bufferBytes = (buffer3) => {
213
213
  }
214
214
  };
215
215
 
216
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/hash.js
216
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/hash.js
217
217
  var backEdges = 0;
218
218
  var addBackEdge = () => {
219
219
  backEdges++;
220
220
  };
221
221
 
222
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/record.js
222
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/record.js
223
223
  function ownEnumerableKeys(self) {
224
224
  const keys3 = Object.keys(self);
225
225
  for (const key5 of Object.getOwnPropertySymbols(self)) {
@@ -252,7 +252,7 @@ function assignProperties(self, source) {
252
252
  }
253
253
  }
254
254
 
255
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Predicate.js
255
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Predicate.js
256
256
  function isString(input) {
257
257
  return typeof input === "string";
258
258
  }
@@ -305,7 +305,7 @@ function isIterable(input) {
305
305
  }
306
306
  var or = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) || that(a));
307
307
 
308
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Hash.js
308
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Hash.js
309
309
  var symbol = "~effect/Hash";
310
310
  var hash = (self) => {
311
311
  switch (typeof self) {
@@ -433,7 +433,7 @@ var randomHashCache = /* @__PURE__ */ new WeakMap();
433
433
  var hashCache = /* @__PURE__ */ new WeakMap();
434
434
  var visitedObjects = /* @__PURE__ */ new WeakSet();
435
435
 
436
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Equal.js
436
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Equal.js
437
437
  var symbol2 = "~effect/Equal";
438
438
  function equals() {
439
439
  if (arguments.length === 1) {
@@ -610,7 +610,7 @@ var byReferenceUnsafe = (obj) => {
610
610
  return obj;
611
611
  };
612
612
 
613
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Redactable.js
613
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Redactable.js
614
614
  var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Redactable");
615
615
  var isRedactable = (u) => hasProperty(u, symbolRedactable);
616
616
  function redact(u) {
@@ -632,7 +632,7 @@ var emptyContext = {
632
632
  }
633
633
  };
634
634
 
635
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Formatter.js
635
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Formatter.js
636
636
  function format(input, options4) {
637
637
  const space = options4?.space ?? 0;
638
638
  const ancestors = /* @__PURE__ */ new WeakSet();
@@ -797,7 +797,7 @@ function isJsonPrimitiveWrapper(object2) {
797
797
  return false;
798
798
  }
799
799
 
800
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Inspectable.js
800
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Inspectable.js
801
801
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
802
802
  var toJson = (input) => {
803
803
  try {
@@ -864,7 +864,7 @@ var Class2 = class {
864
864
  }
865
865
  };
866
866
 
867
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/stackTraceLimit.js
867
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/stackTraceLimit.js
868
868
  var isStackTraceLimitWritable = () => {
869
869
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
870
870
  if (desc === void 0) {
@@ -881,7 +881,7 @@ var setStackTraceLimit = (value3) => {
881
881
  }
882
882
  };
883
883
 
884
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Utils.js
884
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Utils.js
885
885
  var SingleShotGen = class {
886
886
  constructor(self) {
887
887
  this.value = self;
@@ -933,7 +933,7 @@ var pickInternalCall = () => {
933
933
  };
934
934
  var internalCall = /* @__PURE__ */ pickInternalCall();
935
935
 
936
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/core.js
936
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/core.js
937
937
  var EffectTypeId = `~effect/Effect`;
938
938
  var ExitTypeId = `~effect/Exit`;
939
939
  var effectVariance = {
@@ -1347,13 +1347,13 @@ var done = (value3) => {
1347
1347
  return exitFail(Done(value3));
1348
1348
  };
1349
1349
 
1350
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Effectable.js
1350
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Effectable.js
1351
1351
  var Prototype2 = (options4) => makePrimitiveProto({
1352
1352
  op: options4.label,
1353
1353
  [evaluate]: options4.evaluate
1354
1354
  });
1355
1355
 
1356
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Equivalence.js
1356
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Equivalence.js
1357
1357
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
1358
1358
  var isStrictEquivalent = (x, y) => x === y;
1359
1359
  var strictEqual = () => isStrictEquivalent;
@@ -1380,7 +1380,7 @@ function Array_(item) {
1380
1380
  });
1381
1381
  }
1382
1382
 
1383
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/doNotation.js
1383
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/doNotation.js
1384
1384
  var let_ = (map14) => dual(3, (self, name, f) => map14(self, (a) => ({
1385
1385
  ...a,
1386
1386
  [name]: f(a)
@@ -1393,7 +1393,7 @@ var bind = (map14, flatMap8) => dual(3, (self, name, f) => flatMap8(self, (a) =>
1393
1393
  [name]: b
1394
1394
  }))));
1395
1395
 
1396
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/option.js
1396
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/option.js
1397
1397
  var TypeId = "~effect/Option";
1398
1398
  var CommonProto = {
1399
1399
  [TypeId]: {
@@ -1459,7 +1459,7 @@ var SomeImpl = function(value3) {
1459
1459
  SomeImpl.prototype = SomeProto;
1460
1460
  var some = (value3) => new SomeImpl(value3);
1461
1461
 
1462
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/result.js
1462
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/result.js
1463
1463
  var TypeId2 = "~effect/Result";
1464
1464
  var CommonProto2 = {
1465
1465
  [TypeId2]: {
@@ -1529,7 +1529,7 @@ var getFailure = (self) => isSuccess(self) ? none : some(self.failure);
1529
1529
  var getSuccess = (self) => isFailure(self) ? none : some(self.success);
1530
1530
  var fromOption = /* @__PURE__ */ dual(2, (self, onNone) => isNone(self) ? fail(onNone()) : succeed(self.value));
1531
1531
 
1532
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Order.js
1532
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Order.js
1533
1533
  function make2(compare2) {
1534
1534
  return (self, that) => self === that ? 0 : compare2(self, that);
1535
1535
  }
@@ -1549,7 +1549,7 @@ var isLessThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== 1);
1549
1549
  var isGreaterThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== -1);
1550
1550
  var max = (O) => dual(2, (self, that) => self === that || O(self, that) > -1 ? self : that);
1551
1551
 
1552
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Option.js
1552
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Option.js
1553
1553
  var none2 = () => none;
1554
1554
  var some2 = some;
1555
1555
  var isOption2 = isOption;
@@ -1583,7 +1583,7 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(s
1583
1583
  var flatten = /* @__PURE__ */ flatMap(identity);
1584
1584
  var filter = /* @__PURE__ */ dual(2, (self, predicate) => isNone2(self) ? none2() : predicate(self.value) ? some2(self.value) : none2());
1585
1585
 
1586
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Context.js
1586
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Context.js
1587
1587
  var ServiceTypeId = "~effect/Context/Service";
1588
1588
  var Service = function() {
1589
1589
  function KeyClass() {
@@ -1794,13 +1794,13 @@ var mergeAll = (...ctxs) => {
1794
1794
  };
1795
1795
  var Reference = Service;
1796
1796
 
1797
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/array.js
1797
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/array.js
1798
1798
  var isArrayNonEmpty = (self) => self.length > 0;
1799
1799
 
1800
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/count.js
1800
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/count.js
1801
1801
  var normalize = (n) => n > 0 ? Math.floor(n) : 0;
1802
1802
 
1803
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Result.js
1803
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Result.js
1804
1804
  var Result_exports = {};
1805
1805
  __export(Result_exports, {
1806
1806
  Do: () => Do,
@@ -1956,10 +1956,10 @@ var tap = /* @__PURE__ */ dual(2, (self, f) => {
1956
1956
  return self;
1957
1957
  });
1958
1958
 
1959
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Tuple.js
1959
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Tuple.js
1960
1960
  var makeEquivalence2 = Tuple;
1961
1961
 
1962
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Iterable.js
1962
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Iterable.js
1963
1963
  var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
1964
1964
  let i = 0;
1965
1965
  for (const a of self) {
@@ -2002,7 +2002,7 @@ var filter2 = /* @__PURE__ */ dual(2, (self, predicate) => ({
2002
2002
  }
2003
2003
  }));
2004
2004
 
2005
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Record.js
2005
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Record.js
2006
2006
  var has = /* @__PURE__ */ dual(2, (self, key5) => Object.hasOwn(self, key5));
2007
2007
  var map3 = /* @__PURE__ */ dual(2, (self, f) => {
2008
2008
  const out = {
@@ -2027,7 +2027,7 @@ var makeEquivalence3 = (equivalence) => {
2027
2027
  return (self, that) => is3(self, that) && is3(that, self);
2028
2028
  };
2029
2029
 
2030
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Array.js
2030
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Array.js
2031
2031
  var Array2 = globalThis.Array;
2032
2032
  var fromIterable = (collection) => Array2.isArray(collection) ? collection : Array2.from(collection);
2033
2033
  var ensure = (self) => Array2.isArray(self) ? self : [self];
@@ -2108,7 +2108,7 @@ var dedupe = (self) => {
2108
2108
  return out;
2109
2109
  };
2110
2110
 
2111
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Duration.js
2111
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Duration.js
2112
2112
  var TypeId4 = "~effect/Duration";
2113
2113
  var bigint0 = /* @__PURE__ */ BigInt(0);
2114
2114
  var bigint1 = /* @__PURE__ */ BigInt(1);
@@ -2583,7 +2583,7 @@ var fromIso = (input) => {
2583
2583
  return some2(signed % bigint1e6 === bigint0 && Number.isSafeInteger(ms) ? millis(ms) : nanos(signed));
2584
2584
  };
2585
2585
 
2586
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Scheduler.js
2586
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Scheduler.js
2587
2587
  var Scheduler = /* @__PURE__ */ Reference("effect/Scheduler", {
2588
2588
  fiberCached: true,
2589
2589
  defaultValue: () => new MixedScheduler()
@@ -2727,7 +2727,7 @@ var PreventSchedulerYield = /* @__PURE__ */ Reference("effect/Scheduler/PreventS
2727
2727
  defaultValue: () => false
2728
2728
  });
2729
2729
 
2730
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Data.js
2730
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Data.js
2731
2731
  var Class3 = class extends Class {
2732
2732
  constructor(props) {
2733
2733
  super();
@@ -2742,7 +2742,7 @@ var TaggedClass = (tag2) => class extends Class3 {
2742
2742
  var Error3 = Error2;
2743
2743
  var TaggedError2 = TaggedError;
2744
2744
 
2745
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/EncodingError.js
2745
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/EncodingError.js
2746
2746
  var EncodingErrorTypeId = "~effect/encoding/EncodingError";
2747
2747
  var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
2748
2748
  /**
@@ -2757,7 +2757,7 @@ var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")
2757
2757
  [EncodingErrorTypeId] = EncodingErrorTypeId;
2758
2758
  };
2759
2759
 
2760
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Hex.js
2760
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Hex.js
2761
2761
  var encode = (input) => typeof input === "string" ? hexEncodeUint8Array(encoder.encode(input)) : hexEncodeUint8Array(input);
2762
2762
  var random2 = (length2) => {
2763
2763
  switch (length2) {
@@ -2852,7 +2852,7 @@ for (let i = 0; i < 16; i++) {
2852
2852
  }
2853
2853
  var hexCode = (charCode) => charCode < 256 ? hexCodes[charCode] : 255;
2854
2854
 
2855
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Tracer.js
2855
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Tracer.js
2856
2856
  var ParentSpanKey = "effect/Tracer/ParentSpan";
2857
2857
  var ParentSpan = class extends (/* @__PURE__ */ Service()(ParentSpanKey, {
2858
2858
  fiberCached: true
@@ -2938,10 +2938,10 @@ var NativeSpan = class {
2938
2938
  }
2939
2939
  };
2940
2940
 
2941
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/metric.js
2941
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/metric.js
2942
2942
  var FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics";
2943
2943
 
2944
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/references.js
2944
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/references.js
2945
2945
  var CurrentErrorReporters = /* @__PURE__ */ Reference("effect/ErrorReporter/CurrentErrorReporters", {
2946
2946
  defaultValue: () => /* @__PURE__ */ new Set()
2947
2947
  });
@@ -2980,7 +2980,7 @@ var CurrentLogSpans = /* @__PURE__ */ Reference("effect/References/CurrentLogSpa
2980
2980
  defaultValue: () => []
2981
2981
  });
2982
2982
 
2983
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/tracer.js
2983
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/tracer.js
2984
2984
  var addSpanStackTrace = (options4) => {
2985
2985
  if (options4?.captureStackTrace === false) {
2986
2986
  return options4;
@@ -3017,7 +3017,7 @@ var makeStackCleaner = (line) => (stack) => {
3017
3017
  };
3018
3018
  var spanCleaner = /* @__PURE__ */ makeStackCleaner(3);
3019
3019
 
3020
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/effect.js
3020
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/effect.js
3021
3021
  var Interrupt = class extends ReasonBase {
3022
3022
  constructor(fiberId3, annotations2 = constEmptyAnnotations) {
3023
3023
  super("Interrupt", annotations2, "Interrupted");
@@ -5728,7 +5728,7 @@ var reportCauseUnsafe = (fiber3, cause, defectsOnly) => {
5728
5728
  reporters.forEach((reporter) => reporter.report(opts));
5729
5729
  };
5730
5730
 
5731
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Cause.js
5731
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Cause.js
5732
5732
  var isCause2 = isCause;
5733
5733
  var isReason = isCauseReason;
5734
5734
  var isFailReason2 = isFailReason;
@@ -5749,7 +5749,7 @@ var isTimeoutError2 = isTimeoutError;
5749
5749
  var TimeoutError2 = TimeoutError;
5750
5750
  var IllegalArgumentError2 = IllegalArgumentError;
5751
5751
 
5752
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Effect.js
5752
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Effect.js
5753
5753
  var Effect_exports = {};
5754
5754
  __export(Effect_exports, {
5755
5755
  Do: () => Do3,
@@ -5983,7 +5983,7 @@ __export(Effect_exports, {
5983
5983
  zipWith: () => zipWith2
5984
5984
  });
5985
5985
 
5986
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Exit.js
5986
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Exit.js
5987
5987
  var isExit2 = isExit;
5988
5988
  var succeed4 = exitSucceed;
5989
5989
  var failCause2 = exitFailCause;
@@ -5992,7 +5992,7 @@ var void_3 = exitVoid;
5992
5992
  var isSuccess4 = exitIsSuccess;
5993
5993
  var isFailure4 = exitIsFailure;
5994
5994
 
5995
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Layer.js
5995
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Layer.js
5996
5996
  var Layer_exports = {};
5997
5997
  __export(Layer_exports, {
5998
5998
  CurrentMemoMap: () => CurrentMemoMap,
@@ -6041,7 +6041,7 @@ __export(Layer_exports, {
6041
6041
  withSpan: () => withSpan2
6042
6042
  });
6043
6043
 
6044
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Deferred.js
6044
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Deferred.js
6045
6045
  var TypeId5 = "~effect/Deferred";
6046
6046
  var DeferredProto = {
6047
6047
  [TypeId5]: {
@@ -6082,14 +6082,14 @@ var doneUnsafe = (self, effect2) => {
6082
6082
  return true;
6083
6083
  };
6084
6084
 
6085
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/References.js
6085
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/References.js
6086
6086
  var CurrentLogAnnotations2 = CurrentLogAnnotations;
6087
6087
  var CurrentLogSpans2 = CurrentLogSpans;
6088
6088
  var CurrentStackFrame2 = CurrentStackFrame;
6089
6089
  var TracerEnabled2 = TracerEnabled;
6090
6090
  var TracerTimingEnabled2 = TracerTimingEnabled;
6091
6091
 
6092
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Scope.js
6092
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Scope.js
6093
6093
  var Scope = scopeTag;
6094
6094
  var makeUnsafe3 = scopeMakeUnsafe;
6095
6095
  var provide = provideScope;
@@ -6098,7 +6098,7 @@ var addFinalizer2 = scopeAddFinalizer;
6098
6098
  var forkUnsafe2 = scopeForkUnsafe;
6099
6099
  var close = scopeClose;
6100
6100
 
6101
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Layer.js
6101
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Layer.js
6102
6102
  var TypeId6 = "~effect/Layer";
6103
6103
  var MemoMapTypeId = "~effect/Layer/MemoMap";
6104
6104
  var makeMemoMapEntry = (memoMap, layer2) => {
@@ -6326,10 +6326,10 @@ var provideSpanStackFrame2 = (name, stack) => {
6326
6326
  }));
6327
6327
  };
6328
6328
 
6329
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Clock.js
6329
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Clock.js
6330
6330
  var Clock = ClockRef;
6331
6331
 
6332
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/dateTime.js
6332
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/dateTime.js
6333
6333
  var TypeId7 = "~effect/DateTime";
6334
6334
  var TimeZoneTypeId = "~effect/DateTime/TimeZone";
6335
6335
  var Proto2 = {
@@ -6770,7 +6770,7 @@ var formatIsoOffset = (self) => {
6770
6770
  };
6771
6771
  var formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
6772
6772
 
6773
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Number.js
6773
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Number.js
6774
6774
  var Number3 = globalThis.Number;
6775
6775
  var remainder = /* @__PURE__ */ dual(2, (self, divisor) => {
6776
6776
  if (!globalThis.Number.isFinite(self) || !globalThis.Number.isFinite(divisor) || divisor === 0) {
@@ -6802,7 +6802,7 @@ function toScientificInteger(n) {
6802
6802
  return [coefficient, globalThis.Number(scientific.slice(eIndex + 1)) - digits.length + 1];
6803
6803
  }
6804
6804
 
6805
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/String.js
6805
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/String.js
6806
6806
  var String3 = globalThis.String;
6807
6807
  var trim = (self) => self.trim();
6808
6808
  var loneSurrogate = /[\uD800-\uDFFF]/u;
@@ -6811,7 +6811,7 @@ var SPLIT_LOWER_UPPER_REGEXP = new RegExp("([\\p{Ll}\\p{N}]\\p{M}*)(\\p{Lu})", "
6811
6811
  var SPLIT_UPPER_UPPER_REGEXP = new RegExp("(\\p{Lu}\\p{M}*)(\\p{Lu}\\p{M}*\\p{Ll})", "gu");
6812
6812
  var SPLIT_REGEXP = [SPLIT_LOWER_UPPER_REGEXP, SPLIT_UPPER_UPPER_REGEXP, new RegExp("(\\p{L}\\p{M}*)(\\p{N})", "gu"), new RegExp("(\\p{N}\\p{M}*)(\\p{L})", "gu")];
6813
6813
 
6814
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Pull.js
6814
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Pull.js
6815
6815
  var catchDone = /* @__PURE__ */ dual(2, (effect2, f) => catchCauseFilter(effect2, filterDoneLeftover, (l) => f(l)));
6816
6816
  var isDoneCause = (cause) => cause.reasons.some(isDoneFailure);
6817
6817
  var isDoneFailure = (failure2) => failure2._tag === "Fail" && isDone2(failure2.error);
@@ -6844,7 +6844,7 @@ var matchEffect2 = /* @__PURE__ */ dual(2, (self, options4) => matchCauseEffect(
6844
6844
  }
6845
6845
  }));
6846
6846
 
6847
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Schedule.js
6847
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Schedule.js
6848
6848
  var TypeId8 = "~effect/Schedule";
6849
6849
  var CurrentMetadata = /* @__PURE__ */ Reference("effect/Schedule/CurrentMetadata", {
6850
6850
  defaultValue: /* @__PURE__ */ constant({
@@ -6936,7 +6936,7 @@ var while_ = /* @__PURE__ */ dual(2, (self, predicate) => fromStep(map5(toStep(s
6936
6936
  })));
6937
6937
  var forever2 = /* @__PURE__ */ spaced(zero);
6938
6938
 
6939
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/ExecutionPlan.js
6939
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/ExecutionPlan.js
6940
6940
  var TypeId9 = "~effect/ExecutionPlan";
6941
6941
  var Proto3 = {
6942
6942
  [TypeId9]: TypeId9,
@@ -6965,11 +6965,11 @@ var CurrentMetadata2 = /* @__PURE__ */ Reference("effect/ExecutionPlan/CurrentMe
6965
6965
  })
6966
6966
  });
6967
6967
 
6968
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/layer.js
6968
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/layer.js
6969
6969
  var provideLayer = (self, layer2, options4) => scopedWith((scope3) => flatMap3(options4?.local ? buildWithMemoMap(layer2, makeMemoMapUnsafe(), scope3) : buildWithScope(layer2, scope3), (context3) => provideContext(self, context3)));
6970
6970
  var provide3 = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, source, options4) => isContext(source) ? provideContext(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll2(...source) : source, options4));
6971
6971
 
6972
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schedule.js
6972
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schedule.js
6973
6973
  var repeatOrElse = /* @__PURE__ */ dual(3, (self, schedule3, orElse2) => flatMap3(toStepWithMetadata(schedule3), (step) => {
6974
6974
  let meta = CurrentMetadata.defaultValue();
6975
6975
  const loop = (input) => matchEffect2(step(input), {
@@ -7037,7 +7037,7 @@ var buildFromOptions = (options4) => {
7037
7037
  return schedule3;
7038
7038
  };
7039
7039
 
7040
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/executionPlan.js
7040
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/executionPlan.js
7041
7041
  var makeEventEmitter = (onEvent, currentMetadata) => {
7042
7042
  let lastStepIndex = -1;
7043
7043
  let stepAttempt = 0;
@@ -7142,7 +7142,7 @@ var scheduleFromStep = (step, first) => {
7142
7142
  };
7143
7143
  var scheduleOnce = /* @__PURE__ */ recurs(1);
7144
7144
 
7145
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/MutableHashMap.js
7145
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/MutableHashMap.js
7146
7146
  var TypeId10 = "~effect/MutableHashMap";
7147
7147
  var MutableHashMapProto = {
7148
7148
  [TypeId10]: TypeId10,
@@ -7246,7 +7246,7 @@ var remove = /* @__PURE__ */ dual(2, (self, key_) => {
7246
7246
  return self;
7247
7247
  });
7248
7248
 
7249
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Request.js
7249
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Request.js
7250
7250
  var TypeId11 = "~effect/Request";
7251
7251
  var requestVariance = /* @__PURE__ */ byReferenceUnsafe({
7252
7252
  /* c8 ignore next */
@@ -7262,7 +7262,7 @@ var RequestPrototype = {
7262
7262
  };
7263
7263
  var makeEntry = (options4) => options4;
7264
7264
 
7265
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/request.js
7265
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/request.js
7266
7266
  var request = /* @__PURE__ */ dual(2, (self, resolver) => {
7267
7267
  const withResolver = (resolver2) => callback((resume) => {
7268
7268
  const entry = addEntry(resolver2, self, resume, getCurrentFiber());
@@ -7384,7 +7384,7 @@ function runBatch(batch) {
7384
7384
  return batch.run;
7385
7385
  }
7386
7386
 
7387
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Metric.js
7387
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Metric.js
7388
7388
  var CurrentMetricAttributesKey = "effect/Metric/CurrentMetricAttributes";
7389
7389
  var CurrentMetricAttributes = /* @__PURE__ */ Reference(CurrentMetricAttributesKey, {
7390
7390
  defaultValue: () => ({})
@@ -7493,7 +7493,7 @@ function attributesToRecord(attributes) {
7493
7493
  return attributes;
7494
7494
  }
7495
7495
 
7496
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Effect.js
7496
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Effect.js
7497
7497
  var TypeId13 = EffectTypeId;
7498
7498
  var isEffect2 = isEffect;
7499
7499
  var all3 = all2;
@@ -7893,13 +7893,13 @@ var flatMapEager2 = flatMapEager;
7893
7893
  var catchEager2 = catchEager;
7894
7894
  var fnUntracedEager2 = fnUntracedEager;
7895
7895
 
7896
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Fiber.js
7896
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Fiber.js
7897
7897
  var join = fiberJoin;
7898
7898
  var interrupt3 = fiberInterrupt;
7899
7899
  var getCurrent = getCurrentFiber;
7900
7900
  var runIn = fiberRunIn;
7901
7901
 
7902
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/MutableList.js
7902
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/MutableList.js
7903
7903
  var Empty = /* @__PURE__ */ Symbol.for("effect/MutableList/Empty");
7904
7904
  var make7 = () => ({
7905
7905
  head: void 0,
@@ -7980,7 +7980,7 @@ var take = (self) => {
7980
7980
  return message;
7981
7981
  };
7982
7982
 
7983
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Queue.js
7983
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Queue.js
7984
7984
  var TypeId14 = "~effect/Queue";
7985
7985
  var EnqueueTypeId = "~effect/Queue/Enqueue";
7986
7986
  var DequeueTypeId = "~effect/Queue/Dequeue";
@@ -8229,16 +8229,16 @@ var finalize = (self, exit3, deferNotify = false) => {
8229
8229
  else notify();
8230
8230
  };
8231
8231
 
8232
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/WebCrypto.js
8232
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/WebCrypto.js
8233
8233
  var WebCrypto = /* @__PURE__ */ Reference("effect/crypto/WebCrypto", {
8234
8234
  defaultValue: () => globalThis.crypto
8235
8235
  });
8236
8236
 
8237
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/SecureRandom.js
8237
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/SecureRandom.js
8238
8238
  var SecureRandom = class extends (/* @__PURE__ */ Service()("effect/crypto/SecureRandom")) {
8239
8239
  };
8240
8240
 
8241
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Semaphore.js
8241
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Semaphore.js
8242
8242
  var makeUnsafe5 = (permits) => new SemaphoreImpl(permits);
8243
8243
  var firstAvailableWaiter = (self) => {
8244
8244
  if (self.free < self.waiterPermitsLowerBound) return void 0;
@@ -8361,7 +8361,7 @@ var SemaphoreImpl = class {
8361
8361
  }
8362
8362
  };
8363
8363
 
8364
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/BigDecimal.js
8364
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/BigDecimal.js
8365
8365
  var MAX_SCALE = 1e4;
8366
8366
  var MAX_SCALE_ALIGNMENT = 2 * MAX_SCALE;
8367
8367
  var FINITE_INT_REGEXP = /^[+-]?\d+$/;
@@ -8525,7 +8525,7 @@ var toExponential = (n) => {
8525
8525
  };
8526
8526
  var isZero2 = (n) => n.value === bigint03;
8527
8527
 
8528
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Schema.js
8528
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Schema.js
8529
8529
  var Schema_exports = {};
8530
8530
  __export(Schema_exports, {
8531
8531
  AeadKey: () => AeadKey,
@@ -8939,7 +8939,7 @@ __export(Schema_exports, {
8939
8939
  withDecodingDefaultTypeKey: () => withDecodingDefaultTypeKey
8940
8940
  });
8941
8941
 
8942
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/BigInt.js
8942
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/BigInt.js
8943
8943
  var BigInt3 = globalThis.BigInt;
8944
8944
  var bigint04 = /* @__PURE__ */ BigInt3(0);
8945
8945
  var abs2 = (n) => n < bigint04 ? -n : n;
@@ -8958,7 +8958,7 @@ var toNumber = (b) => {
8958
8958
  return some2(Number(b));
8959
8959
  };
8960
8960
 
8961
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/ByteSize.js
8961
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/ByteSize.js
8962
8962
  var bigint05 = /* @__PURE__ */ BigInt(0);
8963
8963
  var bigint13 = /* @__PURE__ */ BigInt(1);
8964
8964
  var decimalBase = /* @__PURE__ */ BigInt(1e3);
@@ -9111,7 +9111,7 @@ var toBigInt = (self) => self;
9111
9111
  var toNumber2 = toNumber;
9112
9112
  var toNumberUnsafe = (self) => getOrThrowWith(toNumber2(self), () => new Error(`ByteSize exceeds Number.MAX_SAFE_INTEGER: ${self}`));
9113
9113
 
9114
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Chunk.js
9114
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Chunk.js
9115
9115
  var TypeId16 = "~effect/Chunk";
9116
9116
  function copy(src, srcPos, dest, destPos, len) {
9117
9117
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
@@ -9274,7 +9274,7 @@ var fromArrayUnsafe = (self) => self.length === 0 ? empty5() : self.length === 1
9274
9274
  });
9275
9275
  var size = (self) => self.length;
9276
9276
 
9277
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Aead.js
9277
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Aead.js
9278
9278
  var Aead_exports = {};
9279
9279
  __export(Aead_exports, {
9280
9280
  Aead: () => Aead,
@@ -9290,7 +9290,7 @@ __export(Aead_exports, {
9290
9290
  xchacha20Poly1305: () => xchacha20Poly13052
9291
9291
  });
9292
9292
 
9293
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/CryptoError.js
9293
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/CryptoError.js
9294
9294
  var TypeId17 = "~effect/crypto/CryptoError";
9295
9295
  var ReasonTypeId = "~effect/crypto/CryptoError/Reason";
9296
9296
  var InvalidArgument = class extends (/* @__PURE__ */ TaggedError2("InvalidArgument")) {
@@ -9366,7 +9366,7 @@ var CryptoError = class extends (/* @__PURE__ */ TaggedError2("CryptoError")) {
9366
9366
  }
9367
9367
  };
9368
9368
 
9369
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/chacha.js
9369
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/chacha.js
9370
9370
  function isBytes(a) {
9371
9371
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
9372
9372
  }
@@ -10042,7 +10042,7 @@ var _poly1305_aead = (xorStream) => (key5, nonce, AAD) => {
10042
10042
  var chacha20Poly1305 = /* @__PURE__ */ _poly1305_aead(chacha20);
10043
10043
  var xchacha20Poly1305 = /* @__PURE__ */ _poly1305_aead(xchacha20);
10044
10044
 
10045
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/webCrypto.js
10045
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/webCrypto.js
10046
10046
  var subtleUnavailable = () => new Error("crypto.subtle is unavailable; browsers expose it only in secure contexts");
10047
10047
  var fail7 = (module, method, reason) => fail6(new CryptoError({
10048
10048
  module,
@@ -10106,7 +10106,7 @@ var run = (module, method, algorithm, crypto2, f, onError4 = (cause) => webCrypt
10106
10106
  });
10107
10107
  var runWithReference = (module, method, algorithm, f) => WebCrypto.use((crypto2) => run(module, method, algorithm, crypto2, f, (cause) => toCryptoError(module, method, "crypto.subtle", algorithm, cause)));
10108
10108
 
10109
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/key.js
10109
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/key.js
10110
10110
  var MaterialId = /* @__PURE__ */ Symbol("~effect/crypto/Key/material");
10111
10111
  var copyBytes2 = (bytes2) => new Uint8Array(bytes2);
10112
10112
  var material = (key5) => key5[MaterialId];
@@ -10203,7 +10203,7 @@ var makeCache = (importKey) => {
10203
10203
  };
10204
10204
  };
10205
10205
 
10206
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Aead.js
10206
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Aead.js
10207
10207
  var TypeId18 = "~effect/crypto/Aead/Key";
10208
10208
  var aes128Gcm = {
10209
10209
  name: "aes128Gcm",
@@ -10318,7 +10318,7 @@ var fromCryptoKey2 = (algorithm, cryptoKey) => algorithm.implementation !== void
10318
10318
  });
10319
10319
  var toBytes2 = (key5) => toBytes("Aead", key5, exportRaw);
10320
10320
 
10321
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Cipher.js
10321
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Cipher.js
10322
10322
  var Cipher_exports = {};
10323
10323
  __export(Cipher_exports, {
10324
10324
  Cipher: () => Cipher,
@@ -10399,7 +10399,7 @@ var fromCryptoKey3 = (algorithm, cryptoKey) => fromCryptoKey("Cipher", "fromCryp
10399
10399
  });
10400
10400
  var toBytes3 = (key5) => toBytes("Cipher", key5, exportRaw);
10401
10401
 
10402
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/asymmetric.js
10402
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/asymmetric.js
10403
10403
  var seedPrefix = (oid) => Uint8Array.of(48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, oid, 4, 34, 4, 32);
10404
10404
  var ed25519Prefix = /* @__PURE__ */ seedPrefix(112);
10405
10405
  var x25519Prefix = /* @__PURE__ */ seedPrefix(110);
@@ -10452,7 +10452,7 @@ var exportPublic = async (subtle, cryptoKey, spec) => new Uint8Array(await subtl
10452
10452
  var exportKey = (subtle, cryptoKey, spec, role) => role === "private" ? exportPrivate(subtle, cryptoKey, spec) : exportPublic(subtle, cryptoKey, spec);
10453
10453
  var toBytes4 = (family4, key5) => toBytes(family4.module, key5, (subtle, cryptoKey) => exportKey(subtle, cryptoKey, family4.specOf(key5.algorithm), family4.isPrivateKey(key5) ? "private" : "public"));
10454
10454
 
10455
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/KeyAgreement.js
10455
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/KeyAgreement.js
10456
10456
  var PrivateKeyTypeId = "~effect/crypto/KeyAgreement/PrivateKey";
10457
10457
  var PublicKeyTypeId = "~effect/crypto/KeyAgreement/PublicKey";
10458
10458
  var PrivateKeyProto = /* @__PURE__ */ redactedProto(PrivateKeyTypeId, "KeyAgreement.PrivateKey");
@@ -10491,7 +10491,7 @@ var privateKey = (algorithm, bytes2) => fromBytes("KeyAgreement", "privateKey",
10491
10491
  var publicKey = (algorithm, bytes2) => fromBytes("KeyAgreement", "publicKey", PublicKeyProto, algorithm, bytes2, algorithm._tag === "Ecdh" ? checkPoint(algorithm.namedCurve) : checkSeedLength("X25519", "public"));
10492
10492
  var toBytes5 = (key5) => toBytes4(family, key5);
10493
10493
 
10494
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/base64.js
10494
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/base64.js
10495
10495
  var decodeNative = (str, decodedLength, options4) => {
10496
10496
  if (str.length < 128) return void 0;
10497
10497
  const NativeUint8Array = Uint8Array;
@@ -10505,7 +10505,7 @@ var decodeNative = (str, decodedLength, options4) => {
10505
10505
  };
10506
10506
  var stripCrlf = (str) => str.indexOf("\n") === -1 && str.indexOf("\r") === -1 ? str : str.replace(/[\n\r]/g, "");
10507
10507
 
10508
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Base64Url.js
10508
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Base64Url.js
10509
10509
  var encode2 = (input) => encodeBytes(toBytes6(input), false);
10510
10510
  var encodePadded = (input) => encodeBytes(toBytes6(input), true);
10511
10511
  var decode2 = (str) => {
@@ -10632,7 +10632,7 @@ var decoder2 = /* @__PURE__ */ new TextDecoder("utf-8", {
10632
10632
  ignoreBOM: true
10633
10633
  });
10634
10634
 
10635
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Base64.js
10635
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Base64.js
10636
10636
  var encode3 = (input) => encodeBytes2(typeof input === "string" ? encoder3.encode(input) : input);
10637
10637
  var decode3 = (str) => {
10638
10638
  const stripped = stripCrlf(str);
@@ -10760,7 +10760,7 @@ var getCode = (charCode) => {
10760
10760
  return codes2[charCode];
10761
10761
  };
10762
10762
 
10763
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/der.js
10763
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/internal/der.js
10764
10764
  var read = (bytes2, offset, end = bytes2.length) => {
10765
10765
  if (offset + 2 > end) return void 0;
10766
10766
  const tag2 = bytes2[offset];
@@ -10815,7 +10815,7 @@ var integer = 2;
10815
10815
  var objectIdentifier = 6;
10816
10816
  var equals3 = (a, b) => a.length === b.length && a.every((byte, i) => byte === b[i]);
10817
10817
 
10818
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Digest.js
10818
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Digest.js
10819
10819
  var sha1 = {
10820
10820
  name: "SHA-1",
10821
10821
  outputLength: 20,
@@ -10837,7 +10837,7 @@ var sha512 = {
10837
10837
  implementation: void 0
10838
10838
  };
10839
10839
 
10840
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Mac.js
10840
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Mac.js
10841
10841
  var Mac_exports = {};
10842
10842
  __export(Mac_exports, {
10843
10843
  Mac: () => Mac,
@@ -10928,7 +10928,7 @@ var timingSafeEqual = (a, b) => {
10928
10928
  return difference2 === 0;
10929
10929
  };
10930
10930
 
10931
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/KeyWrap.js
10931
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/KeyWrap.js
10932
10932
  var KeyTypeId = "~effect/crypto/KeyWrap/Key";
10933
10933
  var PrivateKeyTypeId2 = "~effect/crypto/KeyWrap/PrivateKey";
10934
10934
  var PublicKeyTypeId2 = "~effect/crypto/KeyWrap/PublicKey";
@@ -10964,7 +10964,7 @@ var secretFamily = (algorithm) => "nonceLength" in algorithm ? Aead_exports : "m
10964
10964
  var key4 = (algorithm, bytes2) => fromBytes("KeyWrap", "key", KeyProto4, algorithm, bytes2, checkKeyLength(algorithm));
10965
10965
  var toBytes8 = (key5) => isKey4(key5) ? toBytes("KeyWrap", key5, exportRaw) : toBytes4(family2, key5);
10966
10966
 
10967
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Signature.js
10967
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/Signature.js
10968
10968
  var PrivateKeyTypeId3 = "~effect/crypto/Signature/PrivateKey";
10969
10969
  var PublicKeyTypeId3 = "~effect/crypto/Signature/PublicKey";
10970
10970
  var PrivateKeyProto3 = /* @__PURE__ */ redactedProto(PrivateKeyTypeId3, "Signature.PrivateKey");
@@ -11027,7 +11027,7 @@ var privateKey2 = (algorithm, bytes2) => fromBytes("Signature", "privateKey", Pr
11027
11027
  var publicKey2 = (algorithm, bytes2) => fromBytes("Signature", "publicKey", PublicKeyProto3, algorithm, bytes2, algorithm._tag === "Ecdsa" ? checkPoint(algorithm.namedCurve) : checkSeedLength("Ed25519", "public"));
11028
11028
  var toBytes9 = (key5) => toBytes4(family3, key5);
11029
11029
 
11030
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/KeyFormat.js
11030
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/crypto/KeyFormat.js
11031
11031
  var invalidKey2 = (method, description) => invalidKey("KeyFormat", method, description);
11032
11032
  var unsupported = (method, description) => fail7("KeyFormat", method, new Unsupported({
11033
11033
  description
@@ -11343,7 +11343,7 @@ var encode5 = (format10, key5) => {
11343
11343
  return generic.pem ? map7(encoded, (der) => toPem(labels[generic._tag], der)) : encoded;
11344
11344
  };
11345
11345
 
11346
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/DateTime.js
11346
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/DateTime.js
11347
11347
  var isDateTime2 = isDateTime;
11348
11348
  var isTimeZone2 = isTimeZone;
11349
11349
  var isTimeZoneOffset2 = isTimeZoneOffset;
@@ -11366,7 +11366,7 @@ var toEpochMillis2 = toEpochMillis;
11366
11366
  var formatIso3 = formatIso2;
11367
11367
  var formatIsoZoned2 = formatIsoZoned;
11368
11368
 
11369
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/hashMap.js
11369
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/hashMap.js
11370
11370
  var HashMapTypeId = "~effect/HashMap";
11371
11371
  var SHIFT = 5;
11372
11372
  var BUCKET_SIZE = 1 << SHIFT;
@@ -12001,14 +12001,14 @@ var keys2 = (self) => new HashMapIterator(self._root, identity);
12001
12001
  var entries = (self) => self[Symbol.iterator]();
12002
12002
  var size2 = (self) => self.size;
12003
12003
 
12004
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/HashMap.js
12004
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/HashMap.js
12005
12005
  var isHashMap2 = isHashMap;
12006
12006
  var fromIterable3 = fromIterable2;
12007
12007
  var entries2 = entries;
12008
12008
  var toEntries = (self) => Array.from(entries2(self));
12009
12009
  var size3 = size2;
12010
12010
 
12011
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/hashSet.js
12011
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/hashSet.js
12012
12012
  var HashSetTypeId = "~effect/HashSet";
12013
12013
  var hashSetSeed = /* @__PURE__ */ string(HashSetTypeId);
12014
12014
  var HashSetProto = {
@@ -12063,12 +12063,12 @@ var every2 = (self, predicate) => {
12063
12063
  return true;
12064
12064
  };
12065
12065
 
12066
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/HashSet.js
12066
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/HashSet.js
12067
12067
  var fromIterable5 = fromIterable4;
12068
12068
  var isHashSet2 = isHashSet;
12069
12069
  var size5 = size4;
12070
12070
 
12071
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/Cookies.js
12071
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/Cookies.js
12072
12072
  var TypeId21 = "~effect/http/Cookies";
12073
12073
  var isCookies = (u) => hasProperty(u, TypeId21);
12074
12074
  var CookieTypeId = "~effect/http/Cookies/Cookie";
@@ -12477,7 +12477,7 @@ var tryDecodeURIComponent = (str) => {
12477
12477
  }
12478
12478
  };
12479
12479
 
12480
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/redacted.js
12480
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/redacted.js
12481
12481
  var redactedRegistry = /* @__PURE__ */ new WeakMap();
12482
12482
  var value = (self) => {
12483
12483
  if (redactedRegistry.has(self)) {
@@ -12488,7 +12488,7 @@ var value = (self) => {
12488
12488
  };
12489
12489
  var stringOrRedacted = (val) => typeof val === "string" ? val : value(val);
12490
12490
 
12491
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Redacted.js
12491
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Redacted.js
12492
12492
  var TypeId22 = "~effect/Redacted";
12493
12493
  var isRedacted = (u) => hasProperty(u, TypeId22);
12494
12494
  var make15 = (value3, options4) => {
@@ -12521,7 +12521,7 @@ var Proto5 = {
12521
12521
  var value2 = value;
12522
12522
  var makeEquivalence6 = (isEquivalent) => make((x, y) => isEquivalent(value2(x), value2(y)));
12523
12523
 
12524
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/Headers.js
12524
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/Headers.js
12525
12525
  var TypeId23 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
12526
12526
  var isHeaders = (u) => hasProperty(u, TypeId23);
12527
12527
  var Proto6 = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
@@ -12739,7 +12739,7 @@ var parseRetryAfter = (input) => {
12739
12739
  var formatRetryAfter = (self) => self._tag === "Duration" ? String((toNanosUnsafe(self.duration) + nanosPerSecond - BigInt(1)) / nanosPerSecond) : formatHttpDate(self.dateTime);
12740
12740
  var retryAfterDelay = (self, now2) => self._tag === "Duration" ? self.duration : millis(Math.max(0, toEpochMillis2(self.dateTime) - now2));
12741
12741
 
12742
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/urlParams.js
12742
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/urlParams.js
12743
12743
  var unwrap2 = (value3) => typeof value3 === "string" ? value3 : value2(value3);
12744
12744
  var bodyDecoder = /* @__PURE__ */ new TextDecoder("utf-8", {
12745
12745
  ignoreBOM: true
@@ -12749,7 +12749,7 @@ var fromBody = (bytes2) => (
12749
12749
  new URLSearchParams(bodyDecoder.decode(bytes2).replace(/^\?/, "%3F"))
12750
12750
  );
12751
12751
 
12752
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/UrlParams.js
12752
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/UrlParams.js
12753
12753
  var TypeId24 = "~effect/http/UrlParams";
12754
12754
  var isUrlParams = (u) => hasProperty(u, TypeId24);
12755
12755
  var Proto7 = {
@@ -12908,7 +12908,7 @@ var CurrentRedactedNames2 = /* @__PURE__ */ Reference("effect/http/UrlParams/Cur
12908
12908
  defaultValue: () => ["X-Amz-Signature", "X-Amz-Credential", "X-Amz-Security-Token", "AWSAccessKeyId", "Signature", "sig", "X-Goog-Signature"]
12909
12909
  });
12910
12910
 
12911
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/graph.js
12911
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/graph.js
12912
12912
  var TypeId25 = "~effect/Graph";
12913
12913
  var isGraph = (u) => hasProperty(u, TypeId25);
12914
12914
  var toImpl = (graph) => graph;
@@ -13032,7 +13032,7 @@ var hydrate = (snapshot2) => {
13032
13032
  return graph;
13033
13033
  };
13034
13034
 
13035
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/annotations.js
13035
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/annotations.js
13036
13036
  function resolve(ast) {
13037
13037
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
13038
13038
  }
@@ -13055,7 +13055,7 @@ var getExpected = /* @__PURE__ */ memoize((ast) => {
13055
13055
  });
13056
13056
  var annotationExcludedKeys = /* @__PURE__ */ new Set([SENTINELS_ANNOTATION_KEY, STRUCTURAL_ANNOTATION_KEY, "representation", "arbitraryConstraint", "toJsonSchema", "toCode", "toEquivalence", "toFormatter", "toCodec", "toCodecJson", "toCodecStringTree", "toCodecIso", "toCodecArbitrary"]);
13057
13057
 
13058
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/parser.js
13058
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/parser.js
13059
13059
  var missing = /* @__PURE__ */ Symbol.for("effect/schema/parser/missing");
13060
13060
  var succeed7 = succeed4;
13061
13061
  var missingExit = /* @__PURE__ */ succeed7(missing);
@@ -13066,7 +13066,7 @@ var isSameExit = (result3) => result3[missing] === true;
13066
13066
  var toOption = (value3) => value3 === missing ? none2() : some2(value3);
13067
13067
  var fromOptionExit = (option3) => option3._tag === "None" ? missingExit : succeed7(option3.value);
13068
13068
 
13069
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaIssue.js
13069
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaIssue.js
13070
13070
  var TypeId26 = "~effect/SchemaIssue/Issue";
13071
13071
  function isIssue(u) {
13072
13072
  return hasProperty(u, TypeId26) && u[TypeId26] === TypeId26;
@@ -13388,7 +13388,7 @@ function findMessage(issue) {
13388
13388
  if (typeof message === "string") return message;
13389
13389
  }
13390
13390
 
13391
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/cause.js
13391
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/cause.js
13392
13392
  function getSchemaIssue(cause) {
13393
13393
  let issue;
13394
13394
  for (const reason of cause.reasons) {
@@ -13409,7 +13409,7 @@ function getSchemaIssueOrThrow(cause, message) {
13409
13409
  return issue;
13410
13410
  }
13411
13411
 
13412
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaGetter.js
13412
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaGetter.js
13413
13413
  var makeGetter = (fields) => Object.assign(Object.create(Prototype), fields);
13414
13414
  function fail10(f) {
13415
13415
  return transformOptionalEffect((oe, options4) => fail6(f(oe, options4)));
@@ -13709,7 +13709,7 @@ function collectBracketPathEntries(isLeaf) {
13709
13709
  };
13710
13710
  }
13711
13711
 
13712
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/content.js
13712
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/content.js
13713
13713
  var ContentTypeId = /* @__PURE__ */ Symbol.for("~effect/Schema/content");
13714
13714
  function setContent(operation, content) {
13715
13715
  Object.defineProperty(operation, ContentTypeId, {
@@ -13721,7 +13721,7 @@ function getContent(operation) {
13721
13721
  return operation[ContentTypeId];
13722
13722
  }
13723
13723
 
13724
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaTransformation.js
13724
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaTransformation.js
13725
13725
  var Middleware = class extends Class {
13726
13726
  _tag = "Middleware";
13727
13727
  decode;
@@ -13917,7 +13917,7 @@ function fromJsonString(options4) {
13917
13917
  var fromFormData = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeFormData(), /* @__PURE__ */ encodeFormData());
13918
13918
  var fromURLSearchParams = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeURLSearchParams(), /* @__PURE__ */ encodeURLSearchParams());
13919
13919
 
13920
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaAST.js
13920
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaAST.js
13921
13921
  function makeGuard(tag2) {
13922
13922
  return (ast) => ast._tag === tag2;
13923
13923
  }
@@ -16070,7 +16070,7 @@ var StringTree = /* @__PURE__ */ new Declaration([], () => (input, ast, options4
16070
16070
  });
16071
16071
  var unknownToStringTree = /* @__PURE__ */ new Link(StringTree, /* @__PURE__ */ passthrough3());
16072
16072
 
16073
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/interpreter.js
16073
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/interpreter.js
16074
16074
  var flatMapTransformation = (result3, current, f) => isSameExit(result3) ? f(current) : flatMapEager2(result3, f);
16075
16075
  function compileTransformation(transformation) {
16076
16076
  const apply2 = compileTransformationUnsafe(transformation);
@@ -16241,7 +16241,7 @@ function compile(ast, compile2, compileField2, base, specialize) {
16241
16241
  };
16242
16242
  }
16243
16243
 
16244
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/compilerRegistry.js
16244
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/compilerRegistry.js
16245
16245
  var invalid3 = /* @__PURE__ */ Symbol();
16246
16246
  var cache = /* @__PURE__ */ new WeakMap();
16247
16247
  var compiler;
@@ -16338,7 +16338,7 @@ function resolve2(ast) {
16338
16338
  return entry;
16339
16339
  }
16340
16340
 
16341
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaParser.js
16341
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SchemaParser.js
16342
16342
  function makeEffect(schema) {
16343
16343
  const ast = schema.ast;
16344
16344
  let parser;
@@ -16621,7 +16621,7 @@ function makeClassSync(ast, input, options4, construct) {
16621
16621
  var normalCompiler = (ast) => resolve2(ast).parser;
16622
16622
  var constructorCompiler = (ast) => resolve2(ast).makeEffect;
16623
16623
 
16624
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/make.js
16624
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/make.js
16625
16625
  var TypeId29 = "~effect/Schema/Schema";
16626
16626
  var RebuildOptions = /* @__PURE__ */ Symbol();
16627
16627
  var SchemaProto = {
@@ -16682,7 +16682,7 @@ function make20(ast, options4) {
16682
16682
  return self;
16683
16683
  }
16684
16684
 
16685
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/jsonSchema.js
16685
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/jsonSchema.js
16686
16686
  function getSubschemaKind(keyword) {
16687
16687
  switch (keyword) {
16688
16688
  case "$defs":
@@ -16710,7 +16710,7 @@ function getSubschemaKind(keyword) {
16710
16710
  }
16711
16711
  }
16712
16712
 
16713
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/JsonPointer.js
16713
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/JsonPointer.js
16714
16714
  function escapeToken(token) {
16715
16715
  return token.replace(/~/g, "~0").replace(/\//g, "~1");
16716
16716
  }
@@ -16740,7 +16740,7 @@ function formatUriFragment(path) {
16740
16740
  return path.reduce((fragment, token) => `${fragment}/${formatUriFragmentToken(token)}`, "#");
16741
16741
  }
16742
16742
 
16743
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/JsonSchema.js
16743
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/JsonSchema.js
16744
16744
  var META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema#";
16745
16745
  var META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
16746
16746
  function isMetaSchemaUri(value3, uri) {
@@ -17156,7 +17156,7 @@ function convertLegacyId(source, out, targetKey, dialect) {
17156
17156
  }
17157
17157
  }
17158
17158
 
17159
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toCodec.js
17159
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toCodec.js
17160
17160
  function toCodecJson(schema) {
17161
17161
  return make20(toCodecJsonAST(schema.ast), {
17162
17162
  schema
@@ -17432,11 +17432,11 @@ function toCodecArrayFromSingleASTStep(ast) {
17432
17432
  return ast._tag === "Declaration" || ast._tag === "Arrays" || ast._tag === "Objects" || ast._tag === "Union" || ast._tag === "Suspend" ? ast.recur(toCodecArrayFromSingleAST) : ast;
17433
17433
  }
17434
17434
 
17435
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/RegExp.js
17435
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/RegExp.js
17436
17436
  var RegExp2 = globalThis.RegExp;
17437
17437
  var escape = (string3) => string3.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
17438
17438
 
17439
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/errors.js
17439
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/errors.js
17440
17440
  function errorWithPath(message, path) {
17441
17441
  if (path.length > 0) {
17442
17442
  message += `
@@ -17445,7 +17445,7 @@ function errorWithPath(message, path) {
17445
17445
  return new Error(message);
17446
17446
  }
17447
17447
 
17448
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
17448
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
17449
17449
  function formatDefinitionReference(key5) {
17450
17450
  return `#/$defs/${formatUriFragmentToken(key5)}`;
17451
17451
  }
@@ -18184,7 +18184,7 @@ function toJsonSchemaMultiDocument(document, options4) {
18184
18184
  return compileJsonSchema(document.representations, document.representations.map((_, index2) => ["representations", index2]), document.references, options4);
18185
18185
  }
18186
18186
 
18187
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toRepresentation.js
18187
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toRepresentation.js
18188
18188
  var defaultReferencePolicy = ({
18189
18189
  identifier: identifier2
18190
18190
  }) => identifier2;
@@ -18477,7 +18477,7 @@ function toRepresentations(asts, options4) {
18477
18477
  }
18478
18478
  }
18479
18479
 
18480
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/standardSchema.js
18480
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/standardSchema.js
18481
18481
  function makeStandardResult(exit3) {
18482
18482
  return isSuccess4(exit3) ? exit3.value : {
18483
18483
  issues: [{
@@ -18583,7 +18583,7 @@ function toStandardJSONSchemaV1(self) {
18583
18583
  });
18584
18584
  }
18585
18585
 
18586
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/JsonPatch.js
18586
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/JsonPatch.js
18587
18587
  function get4(oldValue, newValue) {
18588
18588
  const patches = [];
18589
18589
  getLoop(oldValue, newValue, "", patches);
@@ -18767,7 +18767,7 @@ function rebuildFromStack(stack, newParent) {
18767
18767
  return acc;
18768
18768
  }
18769
18769
 
18770
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js
18770
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js
18771
18771
  function toDifferJsonPatch(schema) {
18772
18772
  const serializer = toCodecJson(schema);
18773
18773
  const get9 = encodeSync(serializer);
@@ -18784,7 +18784,7 @@ function toDifferJsonPatch(schema) {
18784
18784
  };
18785
18785
  }
18786
18786
 
18787
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toEncoderXml.js
18787
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toEncoderXml.js
18788
18788
  function toEncoderXml(codec, options4) {
18789
18789
  const rootName = resolveIdentifier(codec.ast) ?? resolveTitle(codec.ast);
18790
18790
  const serialize = encodeEffect(toCodecStringTree(codec));
@@ -18883,7 +18883,7 @@ var xml = {
18883
18883
  }
18884
18884
  };
18885
18885
 
18886
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toEquivalence.js
18886
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toEquivalence.js
18887
18887
  var recurMemo = /* @__PURE__ */ memoize(recur);
18888
18888
  var toEquivalence = (ast) => {
18889
18889
  return recurMemo(toType(ast));
@@ -19068,7 +19068,7 @@ function causeEquivalence(error, defect) {
19068
19068
  return (a, b) => reasons(a.reasons, b.reasons);
19069
19069
  }
19070
19070
 
19071
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toFormatter.js
19071
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toFormatter.js
19072
19072
  function causeReasonToFormatter(error, defect) {
19073
19073
  return (reason) => {
19074
19074
  switch (reason._tag) {
@@ -19284,7 +19284,7 @@ function toFormatter(ast, options4) {
19284
19284
  }
19285
19285
  }
19286
19286
 
19287
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Struct.js
19287
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Struct.js
19288
19288
  var pick2 = /* @__PURE__ */ dual(2, (self, keys3) => {
19289
19289
  return buildStruct(self, (k, v) => hasPropertyKey(keys3, k) ? [k, v] : void 0);
19290
19290
  });
@@ -19319,7 +19319,7 @@ function buildStruct(source, f) {
19319
19319
  return out;
19320
19320
  }
19321
19321
 
19322
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Optic.js
19322
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Optic.js
19323
19323
  function makeIso(get9, set6) {
19324
19324
  return make21(primitiveNode("Iso", get9, set6));
19325
19325
  }
@@ -19665,7 +19665,7 @@ function id() {
19665
19665
  return identityIso;
19666
19666
  }
19667
19667
 
19668
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toIso.js
19668
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schema/toIso.js
19669
19669
  function toIso(schema) {
19670
19670
  const serializer = toCodecIso(schema);
19671
19671
  return makeIso(encodeSync(serializer), decodeSync(serializer));
@@ -19677,13 +19677,13 @@ function toIsoFocus(_) {
19677
19677
  return id();
19678
19678
  }
19679
19679
 
19680
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schemaError.js
19680
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/schemaError.js
19681
19681
  var SchemaErrorTypeId = "~effect/Schema/SchemaError";
19682
19682
  function isSchemaError(u) {
19683
19683
  return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;
19684
19684
  }
19685
19685
 
19686
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Bytes.js
19686
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Bytes.js
19687
19687
  var Equivalence7 = /* @__PURE__ */ make((self, that) => {
19688
19688
  if (self.length !== that.length) {
19689
19689
  return false;
@@ -19696,7 +19696,7 @@ var Equivalence7 = /* @__PURE__ */ make((self, that) => {
19696
19696
  return true;
19697
19697
  });
19698
19698
 
19699
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/NetAddress.js
19699
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/NetAddress.js
19700
19700
  var TypeId30 = "~effect/net/NetAddress";
19701
19701
  var ipv4Value = (self) => self.value;
19702
19702
  var ipv6Words = (self) => self;
@@ -20133,7 +20133,7 @@ var unixPathAddress = (path) => {
20133
20133
  return Object.freeze(self);
20134
20134
  };
20135
20135
 
20136
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/Host.js
20136
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/Host.js
20137
20137
  var TypeId31 = "~effect/net/Host";
20138
20138
  var hostError = (input, message) => fail2(new NetAddressError({
20139
20139
  input,
@@ -20240,7 +20240,7 @@ var formatHostPort = (self) => {
20240
20240
  return host.includes(":") ? `[${host}]:${self.port}` : `${host}:${self.port}`;
20241
20241
  };
20242
20242
 
20243
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/Dns.js
20243
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/Dns.js
20244
20244
  var RecordTypeId = "~effect/net/Dns/DnsRecord";
20245
20245
  var isUint8 = (u) => Number.isInteger(u) && u >= 0 && u <= 255;
20246
20246
  var isUint16 = (u) => Number.isInteger(u) && u >= 0 && u <= 65535;
@@ -20407,7 +20407,7 @@ var formatRecord = (self) => {
20407
20407
  }
20408
20408
  };
20409
20409
 
20410
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/IpInterface.js
20410
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/IpInterface.js
20411
20411
  var TypeId32 = "~effect/net/IpInterface";
20412
20412
  var isIpv4Interface = (u) => isIpInterface(u) && isIpv4Address(u.address);
20413
20413
  var isIpv6Interface = (u) => isIpInterface(u) && isIpv6Address(u.address);
@@ -20469,7 +20469,7 @@ var ipv6FromString2 = (input, options4) => flatMap2(parseAddressWithPrefix(input
20469
20469
  var fromString3 = (input, options4) => flatMap2(parseAddressWithPrefix(input, options4), (parts2) => flatMap2(ipFromString(parts2.address), (address) => make22(address, parts2.prefixLength ?? width(address))));
20470
20470
  var format5 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
20471
20471
 
20472
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/IpNetwork.js
20472
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/net/IpNetwork.js
20473
20473
  var TypeId33 = "~effect/net/IpNetwork";
20474
20474
  var isIpv4Network = (u) => isIpNetwork(u) && isIpv4Address(u.address);
20475
20475
  var isIpv6Network = (u) => isIpNetwork(u) && isIpv6Address(u.address);
@@ -20538,7 +20538,7 @@ var fromString4 = (input) => {
20538
20538
  };
20539
20539
  var format6 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
20540
20540
 
20541
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Rational.js
20541
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Rational.js
20542
20542
  var TypeId34 = "~effect/Rational";
20543
20543
  var bigint06 = /* @__PURE__ */ BigInt(0);
20544
20544
  var bigint14 = /* @__PURE__ */ BigInt(1);
@@ -20600,7 +20600,7 @@ var fromString5 = (s) => {
20600
20600
  var Equivalence8 = /* @__PURE__ */ make((self, that) => self.numerator === that.numerator && self.denominator === that.denominator);
20601
20601
  var format7 = (n) => `${n.numerator}/${n.denominator}`;
20602
20602
 
20603
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SemVer.js
20603
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SemVer.js
20604
20604
  var TypeId35 = "~effect/SemVer";
20605
20605
  var SemVerErrorTypeId = "~effect/SemVer/SemVerError";
20606
20606
  var SemVerError = class extends (/* @__PURE__ */ TaggedError2("SemVerError")) {
@@ -20714,7 +20714,7 @@ var format8 = (self) => {
20714
20714
  var identifiersEqual = /* @__PURE__ */ Array_(/* @__PURE__ */ strictEqual());
20715
20715
  var Equivalence9 = /* @__PURE__ */ make((self, that) => self.major === that.major && self.minor === that.minor && self.patch === that.patch && identifiersEqual(self.prerelease, that.prerelease) && identifiersEqual(self.build, that.build));
20716
20716
 
20717
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SemVerRange.js
20717
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/SemVerRange.js
20718
20718
  var TypeId36 = "~effect/SemVerRange";
20719
20719
  var SemVerRangeProto = {
20720
20720
  [TypeId36]: TypeId36,
@@ -20822,7 +20822,7 @@ var formatPartial = (self) => {
20822
20822
  var formatComparator = (self) => self._tag === "Hyphen" ? `${formatPartial(self.from)} - ${formatPartial(self.to)}` : `${self.operator === "=" ? "" : self.operator}${formatPartial(self.version)}`;
20823
20823
  var format9 = (self) => self.sets.map((set6) => set6.map(formatComparator).join(" ")).join(" || ");
20824
20824
 
20825
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Schema.js
20825
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Schema.js
20826
20826
  var TypeId37 = TypeId29;
20827
20827
  function declareConstructor() {
20828
20828
  return (typeParameters, run4, annotations2) => {
@@ -24932,10 +24932,10 @@ function resolveAnnotationsKey(schema) {
24932
24932
  return schema.ast.context?.annotations;
24933
24933
  }
24934
24934
 
24935
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Latch.js
24935
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Latch.js
24936
24936
  var makeUnsafe9 = makeLatchUnsafe;
24937
24937
 
24938
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/MutableRef.js
24938
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/MutableRef.js
24939
24939
  var TypeId38 = "~effect/MutableRef";
24940
24940
  var MutableRefProto = {
24941
24941
  [TypeId38]: TypeId38,
@@ -24953,7 +24953,7 @@ var make27 = (value3) => {
24953
24953
  return ref;
24954
24954
  };
24955
24955
 
24956
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Channel.js
24956
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Channel.js
24957
24957
  var TypeId39 = "~effect/Channel";
24958
24958
  var isChannel = (u) => hasProperty(u, TypeId39);
24959
24959
  var ChannelProto = {
@@ -25219,13 +25219,13 @@ var runFold = /* @__PURE__ */ dual(3, (self, initial, f) => suspend3(() => {
25219
25219
  }));
25220
25220
  var toPullScoped = (self, scope3) => toTransform(self)(done2(), scope3);
25221
25221
 
25222
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/ChannelSchema.js
25222
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/ChannelSchema.js
25223
25223
  var decode5 = (schema, options4) => () => {
25224
25224
  const decode8 = decodeEffect2(NonEmptyArray(schema), options4);
25225
25225
  return fromTransform((upstream, _scope) => succeed6(flatMap5(upstream, (chunk) => decode8(chunk))));
25226
25226
  };
25227
25227
 
25228
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/PlatformError.js
25228
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/PlatformError.js
25229
25229
  var TypeId40 = "~effect/PlatformError";
25230
25230
  var BadArgument = class extends (/* @__PURE__ */ TaggedError2("BadArgument")) {
25231
25231
  /**
@@ -25270,7 +25270,7 @@ var PlatformError = class extends (/* @__PURE__ */ TaggedError2("PlatformError")
25270
25270
  };
25271
25271
  var badArgument = (options4) => new PlatformError(new BadArgument(options4));
25272
25272
 
25273
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/stream.js
25273
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/internal/stream.js
25274
25274
  var TypeId41 = "~effect/Stream";
25275
25275
  var streamVariance = {
25276
25276
  _R: identity,
@@ -25288,7 +25288,7 @@ Stream.prototype = {
25288
25288
  };
25289
25289
  var fromChannel = (channel) => new Stream(channel);
25290
25290
 
25291
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Stream.js
25291
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Stream.js
25292
25292
  var TypeId42 = "~effect/Stream";
25293
25293
  var isStream = (u) => hasProperty(u, TypeId42);
25294
25294
  var fromChannel2 = fromChannel;
@@ -25366,10 +25366,10 @@ var toReadableStreamWith = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (
25366
25366
  var toReadableStream = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, options4) => toReadableStreamWith(self, empty(), options4));
25367
25367
  var toReadableStreamEffect = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, options4) => map7(context2(), (context3) => toReadableStreamWith(self, context3, options4)));
25368
25368
 
25369
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/FileSystem.js
25369
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/FileSystem.js
25370
25370
  var FileSystem = /* @__PURE__ */ Service("effect/FileSystem");
25371
25371
 
25372
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Ref.js
25372
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/Ref.js
25373
25373
  var TypeId43 = "~effect/Ref";
25374
25374
  var RefProto = {
25375
25375
  [TypeId43]: {
@@ -25388,7 +25388,7 @@ var update2 = /* @__PURE__ */ dual(2, (self, f) => sync3(() => {
25388
25388
  self.ref.current = f(self.ref.current);
25389
25389
  }));
25390
25390
 
25391
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/UndefinedOr.js
25391
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/UndefinedOr.js
25392
25392
  var map13 = /* @__PURE__ */ dual(2, (self, f) => self === void 0 ? void 0 : f(self));
25393
25393
 
25394
25394
  // src/credentials.ts
@@ -25458,17 +25458,24 @@ var Credentials = class {
25458
25458
  }
25459
25459
  /** Reads what is kept, lets `change` derive the next origin entry, and writes it back whole. */
25460
25460
  async #update(origin, change) {
25461
- const all4 = await this.#load();
25462
- const kept = all4.origins[origin] ?? { tickets: {} };
25463
- const next = change(kept);
25464
- const empty13 = next.device === void 0 && Object.keys(next.tickets).length === 0;
25465
- const origins = { ...all4.origins };
25466
- if (empty13) delete origins[origin];
25467
- else origins[origin] = next;
25468
- await this.#file.write(
25469
- `${JSON.stringify({ version: 1, origins }, null, 2)}
25461
+ const apply2 = async () => {
25462
+ const all4 = await this.#load();
25463
+ const kept = all4.origins[origin] ?? { tickets: {} };
25464
+ const next = change(kept);
25465
+ const empty13 = next.device === void 0 && Object.keys(next.tickets).length === 0;
25466
+ const origins = { ...all4.origins };
25467
+ if (empty13) delete origins[origin];
25468
+ else origins[origin] = next;
25469
+ await this.#file.write(
25470
+ `${JSON.stringify({ version: 1, origins }, null, 2)}
25470
25471
  `
25471
- );
25472
+ );
25473
+ };
25474
+ if (this.#file.withLock !== void 0) {
25475
+ await this.#file.withLock(apply2);
25476
+ return;
25477
+ }
25478
+ await apply2();
25472
25479
  }
25473
25480
  async device(origin) {
25474
25481
  return (await this.#load()).origins[origin]?.device;
@@ -25505,8 +25512,16 @@ var Credentials = class {
25505
25512
  };
25506
25513
 
25507
25514
  // src/node.ts
25508
- function credentialFile(directory) {
25515
+ var LOCK_TIMEOUT_MS = 5e3;
25516
+ var STALE_LOCK_MS = 3e4;
25517
+ var LOCK_RETRY_MIN_MS = 15;
25518
+ var LOCK_RETRY_MAX_MS = 80;
25519
+ function credentialFile(directory, options4) {
25509
25520
  const path = join2(directory, "credentials.json");
25521
+ const lockPath = join2(directory, "credentials.lock");
25522
+ const reclaimPath = join2(directory, "credentials.lock.reclaim");
25523
+ const lockTimeoutMs = options4?.lockTimeoutMs ?? LOCK_TIMEOUT_MS;
25524
+ const staleLockMs = options4?.staleLockMs ?? STALE_LOCK_MS;
25510
25525
  const posix = process.platform !== "win32";
25511
25526
  async function refuseIfShared(target, mask2, what) {
25512
25527
  if (!posix) return;
@@ -25518,6 +25533,90 @@ function credentialFile(directory) {
25518
25533
  `${what} can be read by others; run chmod to make it yours alone (${target})`
25519
25534
  );
25520
25535
  }
25536
+ async function tryReclaimStaleLock() {
25537
+ let handle;
25538
+ try {
25539
+ handle = await open(reclaimPath, "wx", 384);
25540
+ } catch (error) {
25541
+ if (error.code === "EEXIST") {
25542
+ const info = await stat(reclaimPath).catch(() => void 0);
25543
+ if (info !== void 0 && Date.now() - info.mtimeMs >= staleLockMs) {
25544
+ await rm(reclaimPath, { force: true }).catch(() => void 0);
25545
+ }
25546
+ }
25547
+ return false;
25548
+ }
25549
+ try {
25550
+ await handle.close();
25551
+ handle = void 0;
25552
+ const info = await stat(lockPath).catch(() => void 0);
25553
+ if (info !== void 0 && Date.now() - info.mtimeMs >= staleLockMs) {
25554
+ await rm(lockPath, { force: true }).catch(() => void 0);
25555
+ return true;
25556
+ }
25557
+ return false;
25558
+ } finally {
25559
+ if (handle !== void 0) await handle.close().catch(() => void 0);
25560
+ await rm(reclaimPath, { force: true }).catch(() => void 0);
25561
+ }
25562
+ }
25563
+ async function acquireLock() {
25564
+ await mkdir(directory, { recursive: true, mode: 448 });
25565
+ await refuseIfShared(directory, 63, "The credentials directory");
25566
+ const deadline = Date.now() + lockTimeoutMs;
25567
+ let delay3 = LOCK_RETRY_MIN_MS;
25568
+ for (; ; ) {
25569
+ try {
25570
+ const token = crypto.randomUUID();
25571
+ const handle = await open(lockPath, "wx", 384);
25572
+ try {
25573
+ await handle.writeFile(
25574
+ `${JSON.stringify({ pid: process.pid, token, at: Date.now() })}
25575
+ `,
25576
+ "utf8"
25577
+ );
25578
+ } catch (writeError) {
25579
+ await handle.close().catch(() => void 0);
25580
+ await rm(lockPath, { force: true }).catch(() => void 0);
25581
+ throw writeError;
25582
+ }
25583
+ await handle.close();
25584
+ return async () => {
25585
+ const current = await readFile(lockPath, "utf8").catch(
25586
+ () => void 0
25587
+ );
25588
+ if (current === void 0) return;
25589
+ try {
25590
+ const parsed = JSON.parse(current);
25591
+ if (parsed.token !== token) return;
25592
+ } catch {
25593
+ return;
25594
+ }
25595
+ await rm(lockPath, { force: true }).catch(() => void 0);
25596
+ };
25597
+ } catch (error) {
25598
+ if (error.code !== "EEXIST") {
25599
+ if (error instanceof StorageError) throw error;
25600
+ throw new StorageError("The credentials file could not be locked");
25601
+ }
25602
+ try {
25603
+ const info = await stat(lockPath);
25604
+ if (Date.now() - info.mtimeMs >= staleLockMs) {
25605
+ if (await tryReclaimStaleLock()) continue;
25606
+ }
25607
+ } catch (statError) {
25608
+ if (statError.code === "ENOENT") continue;
25609
+ }
25610
+ if (Date.now() >= deadline) {
25611
+ throw new StorageError(
25612
+ "The credentials file is locked by another process; try again"
25613
+ );
25614
+ }
25615
+ await new Promise((resolve3) => setTimeout(resolve3, delay3));
25616
+ delay3 = Math.min(delay3 * 2, LOCK_RETRY_MAX_MS);
25617
+ }
25618
+ }
25619
+ }
25521
25620
  return {
25522
25621
  async read() {
25523
25622
  try {
@@ -25532,7 +25631,7 @@ function credentialFile(directory) {
25532
25631
  }
25533
25632
  },
25534
25633
  async write(contents) {
25535
- const temporary = `${path}.${process.pid}.tmp`;
25634
+ const temporary = `${path}.${process.pid}.${crypto.randomUUID()}.tmp`;
25536
25635
  try {
25537
25636
  await mkdir(directory, { recursive: true, mode: 448 });
25538
25637
  await refuseIfShared(directory, 63, "The credentials directory");
@@ -25550,6 +25649,14 @@ function credentialFile(directory) {
25550
25649
  if (error instanceof StorageError) throw error;
25551
25650
  throw new StorageError("The credentials file could not be written");
25552
25651
  }
25652
+ },
25653
+ async withLock(run4) {
25654
+ const release = await acquireLock();
25655
+ try {
25656
+ return await run4();
25657
+ } finally {
25658
+ await release();
25659
+ }
25553
25660
  }
25554
25661
  };
25555
25662
  }
@@ -25577,8 +25684,16 @@ function openInBrowser(url) {
25577
25684
  }
25578
25685
  });
25579
25686
  }
25687
+ var stdoutEpipeHandled = false;
25580
25688
  function nodeIo() {
25581
25689
  const env = process.env;
25690
+ if (!stdoutEpipeHandled) {
25691
+ stdoutEpipeHandled = true;
25692
+ process.stdout.on("error", (error) => {
25693
+ if (error.code === "EPIPE") process.exit(0);
25694
+ throw error;
25695
+ });
25696
+ }
25582
25697
  return {
25583
25698
  env,
25584
25699
  stdout: {
@@ -25591,7 +25706,21 @@ function nodeIo() {
25591
25706
  },
25592
25707
  fetch: (input, init) => fetch(input, init),
25593
25708
  now: () => Date.now(),
25594
- sleep: (milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds)),
25709
+ sleep: (milliseconds, signal) => new Promise((resolve3) => {
25710
+ if (signal?.aborted) {
25711
+ resolve3();
25712
+ return;
25713
+ }
25714
+ const onAbort = () => {
25715
+ clearTimeout(timer);
25716
+ resolve3();
25717
+ };
25718
+ const timer = setTimeout(() => {
25719
+ signal?.removeEventListener("abort", onAbort);
25720
+ resolve3();
25721
+ }, milliseconds);
25722
+ signal?.addEventListener("abort", onAbort, { once: true });
25723
+ }),
25595
25724
  credentials: credentialFile(configDirectory(env)),
25596
25725
  open: openInBrowser,
25597
25726
  readText: async (source) => {
@@ -25600,7 +25729,13 @@ function nodeIo() {
25600
25729
  for await (const chunk of process.stdin) chunks.push(chunk);
25601
25730
  return Buffer.concat(chunks).toString("utf8");
25602
25731
  },
25603
- hostname
25732
+ hostname,
25733
+ onSignal: (signal, listener) => {
25734
+ process.on(signal, listener);
25735
+ return () => {
25736
+ process.off(signal, listener);
25737
+ };
25738
+ }
25604
25739
  };
25605
25740
  }
25606
25741
 
@@ -25627,12 +25762,21 @@ function parseArguments(argv, specs) {
25627
25762
  positionals.push(...argv.slice(index2 + 1));
25628
25763
  break;
25629
25764
  }
25630
- const short = /^-([A-Za-z])$/.exec(word)?.[1];
25631
- if (short !== void 0) {
25765
+ const shortMatch = /^-([A-Za-z])(.*)$/.exec(word);
25766
+ if (shortMatch !== null) {
25767
+ const short = shortMatch[1];
25768
+ const attached = shortMatch[2];
25632
25769
  const name2 = shorts.get(short);
25633
25770
  if (name2 === void 0)
25634
25771
  throw new UnknownOption(`Unknown option -${short}`);
25635
- index2 = take3(name2, argv[index2 + 1], index2 + 1);
25772
+ const spec2 = specs[name2];
25773
+ if (spec2.type === "boolean") {
25774
+ if (attached !== "") throw new UnknownOption(`Unknown option ${word}`);
25775
+ if (name2 in options4) throw new UsageError(`--${name2} is given twice`);
25776
+ options4[name2] = true;
25777
+ continue;
25778
+ }
25779
+ index2 = attached === "" ? take3(name2, argv[index2 + 1], index2 + 1) : take3(name2, attached, index2);
25636
25780
  continue;
25637
25781
  }
25638
25782
  if (!word.startsWith("--") || word.length === 2) {
@@ -25666,6 +25810,52 @@ function parseArguments(argv, specs) {
25666
25810
  return at;
25667
25811
  }
25668
25812
  }
25813
+ function splitLeadingGlobals(argv, globals) {
25814
+ const shorts = new Map(
25815
+ Object.values(globals).flatMap(
25816
+ (spec) => spec.short === void 0 ? [] : [[spec.short, spec]]
25817
+ )
25818
+ );
25819
+ const leading = [];
25820
+ let index2 = 0;
25821
+ while (index2 < argv.length) {
25822
+ const word = argv[index2];
25823
+ if (word === "--" || !word.startsWith("-") || word === "-") break;
25824
+ if (word.startsWith("--")) {
25825
+ const equals4 = word.indexOf("=");
25826
+ const name = word.slice(2, equals4 === -1 ? void 0 : equals4);
25827
+ const spec2 = globals[name];
25828
+ if (spec2 === void 0) break;
25829
+ if (spec2.type === "string" && equals4 === -1) {
25830
+ const next = argv[index2 + 1];
25831
+ if (next === void 0) break;
25832
+ leading.push(word, next);
25833
+ index2 += 2;
25834
+ continue;
25835
+ }
25836
+ leading.push(word);
25837
+ index2++;
25838
+ continue;
25839
+ }
25840
+ const shortMatch = /^-([A-Za-z])(.*)$/.exec(word);
25841
+ if (shortMatch === null) break;
25842
+ const short = shortMatch[1];
25843
+ const attached = shortMatch[2];
25844
+ const spec = shorts.get(short);
25845
+ if (spec === void 0) break;
25846
+ if (spec.type === "boolean" && attached !== "") break;
25847
+ if (spec.type === "string" && attached === "") {
25848
+ const next = argv[index2 + 1];
25849
+ if (next === void 0) break;
25850
+ leading.push(word, next);
25851
+ index2 += 2;
25852
+ continue;
25853
+ }
25854
+ leading.push(word);
25855
+ index2++;
25856
+ }
25857
+ return { leading, rest: argv.slice(index2) };
25858
+ }
25669
25859
  function stringOption(parsed, name) {
25670
25860
  const value3 = parsed.options[name];
25671
25861
  return typeof value3 === "string" ? value3 : void 0;
@@ -25714,7 +25904,7 @@ var CapabilityIdSchema = Schema_exports.String.check(
25714
25904
  var isCapabilityId = Schema_exports.is(CapabilityIdSchema);
25715
25905
  var decodeCapabilityId = Schema_exports.decodeUnknownResult(CapabilityIdSchema);
25716
25906
 
25717
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApi.js
25907
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApi.js
25718
25908
  var HttpApi_exports = {};
25719
25909
  __export(HttpApi_exports, {
25720
25910
  AdditionalSchemas: () => AdditionalSchemas,
@@ -25734,7 +25924,7 @@ __export(HttpApi_exports, {
25734
25924
  reflect: () => reflect
25735
25925
  });
25736
25926
 
25737
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiEndpoint.js
25927
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiEndpoint.js
25738
25928
  var HttpApiEndpoint_exports = {};
25739
25929
  __export(HttpApiEndpoint_exports, {
25740
25930
  delete: () => del3,
@@ -25752,13 +25942,13 @@ __export(HttpApiEndpoint_exports, {
25752
25942
  query: () => query3
25753
25943
  });
25754
25944
 
25755
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpMethod.js
25945
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpMethod.js
25756
25946
  function hasBody(method) {
25757
25947
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE";
25758
25948
  }
25759
25949
  var allShort = [["GET", "get"], ["POST", "post"], ["PUT", "put"], ["DELETE", "del"], ["PATCH", "patch"], ["HEAD", "head"], ["OPTIONS", "options"], ["TRACE", "trace"], ["QUERY", "query"]];
25760
25950
 
25761
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/FindMyWay/internal/router.js
25951
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/FindMyWay/internal/router.js
25762
25952
  function getClosingParenthensePosition(path, idx) {
25763
25953
  let parentheses = 1;
25764
25954
  while (idx < path.length) {
@@ -25777,7 +25967,7 @@ function getClosingParenthensePosition(path, idx) {
25777
25967
  throw new TypeError('Invalid regexp expression in "' + path + '"');
25778
25968
  }
25779
25969
 
25780
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpBody.js
25970
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpBody.js
25781
25971
  var TypeId44 = "~effect/http/HttpBody";
25782
25972
  var isHttpBody = (u) => hasProperty(u, TypeId44);
25783
25973
  var HttpBodyErrorTypeId = "~effect/http/HttpBody/HttpBodyError";
@@ -25985,7 +26175,7 @@ var fileContentLength = /* @__PURE__ */ fnUntraced2(function* (size6, method, op
25985
26175
  });
25986
26176
  var file = (path, options4) => flatMap5(FileSystem, (fs) => flatMap5(fs.stat(path), (info) => map7(fileContentLength(info.size, "file", options4), (contentLength) => stream(fs.stream(path, options4), options4?.contentType, contentLength))));
25987
26177
 
25988
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientError.js
26178
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientError.js
25989
26179
  var HttpClientError_exports = {};
25990
26180
  __export(HttpClientError_exports, {
25991
26181
  DecodeError: () => DecodeError,
@@ -26250,7 +26440,7 @@ var HttpClientErrorSchema = class _HttpClientErrorSchema extends (/* @__PURE__ *
26250
26440
  }
26251
26441
  };
26252
26442
 
26253
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientRequest.js
26443
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientRequest.js
26254
26444
  var HttpClientRequest_exports = {};
26255
26445
  __export(HttpClientRequest_exports, {
26256
26446
  accept: () => accept,
@@ -26305,7 +26495,7 @@ __export(HttpClientRequest_exports, {
26305
26495
  upgrade: () => upgrade
26306
26496
  });
26307
26497
 
26308
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/compressionBody.js
26498
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/compressionBody.js
26309
26499
  var compressionTransformWeb = (format10) => (stream2) => stream2.pipeThrough(new CompressionStream(format10));
26310
26500
  var singleChunkStream = (data) => new ReadableStream({
26311
26501
  start(controller) {
@@ -26329,7 +26519,7 @@ var compressBody = (body, algorithm, options4) => {
26329
26519
  }), body.contentType));
26330
26520
  };
26331
26521
 
26332
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/httpBody.js
26522
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/httpBody.js
26333
26523
  var updateHeaders = (headers, body) => {
26334
26524
  if (body._tag === "Empty" || body._tag === "FormData") {
26335
26525
  return remove5(remove5(headers, "content-type"), "content-length");
@@ -26349,7 +26539,7 @@ var parseContentLength = (contentLength) => {
26349
26539
  return Number.isSafeInteger(parsed) ? parsed : void 0;
26350
26540
  };
26351
26541
 
26352
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/Url.js
26542
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/Url.js
26353
26543
  var UrlError = class extends (/* @__PURE__ */ TaggedError2("UrlError")) {
26354
26544
  };
26355
26545
  var make28 = (url, params2, hash2) => try_({
@@ -26386,7 +26576,7 @@ var fromString6 = (url, base) => try_({
26386
26576
  catch: () => new IllegalArgumentError2(`Invalid URL: "${url}"${base !== void 0 ? ` with base "${base}"` : ""}`)
26387
26577
  });
26388
26578
 
26389
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientRequest.js
26579
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientRequest.js
26390
26580
  var TypeId46 = "~effect/http/HttpClientRequest";
26391
26581
  var isHttpClientRequest = (u) => hasProperty(u, TypeId46);
26392
26582
  var Proto9 = {
@@ -26602,7 +26792,7 @@ var toWeb = (self, options4) => contextWith2((context3) => fromResult2(toWebResu
26602
26792
  signal: options4?.signal
26603
26793
  })));
26604
26794
 
26605
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpIncomingMessage.js
26795
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpIncomingMessage.js
26606
26796
  var TypeId47 = "~effect/http/HttpIncomingMessage";
26607
26797
  var inspect = (self, that) => {
26608
26798
  return {
@@ -26612,11 +26802,11 @@ var inspect = (self, that) => {
26612
26802
  };
26613
26803
  };
26614
26804
 
26615
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/webResponse.js
26805
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/webResponse.js
26616
26806
  var WebSourceSymbol = "~effect/http/HttpClientResponse/WebSource";
26617
26807
  var getWebSource = (self) => self[WebSourceSymbol]?.();
26618
26808
 
26619
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientResponse.js
26809
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClientResponse.js
26620
26810
  var TypeId48 = "~effect/http/HttpClientResponse";
26621
26811
  var fromWeb2 = (request3, source) => new WebHttpClientResponse(request3, source);
26622
26812
  var filterStatus = /* @__PURE__ */ dual(2, (self, f) => suspend3(() => f(self.status) ? succeed6(self) : fail6(new HttpClientError({
@@ -26768,14 +26958,14 @@ var WebHttpClientResponse = class extends Class2 {
26768
26958
  }
26769
26959
  };
26770
26960
 
26771
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/mediaType.js
26961
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/mediaType.js
26772
26962
  function normalize3(contentType2) {
26773
26963
  const normalized = contentType2.toLowerCase().trim();
26774
26964
  const index2 = normalized.indexOf(";");
26775
26965
  return index2 === -1 ? normalized : normalized.slice(0, index2).trim();
26776
26966
  }
26777
26967
 
26778
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/socket/Socket.js
26968
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/socket/Socket.js
26779
26969
  var TypeId49 = "~effect/socket/Socket";
26780
26970
  var isSocket = (u) => hasProperty(u, TypeId49);
26781
26971
  var CloseEventTypeId = "~effect/socket/Socket/CloseEvent";
@@ -26911,7 +27101,7 @@ var SocketError = class extends (/* @__PURE__ */ TaggedError3(SocketErrorTypeId)
26911
27101
  };
26912
27102
  var defaultHighWaterMark = 64 * 1024;
26913
27103
 
26914
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpTraceContext.js
27104
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpTraceContext.js
26915
27105
  var toHeaders = (span2) => fromRecordUnsafe({
26916
27106
  b3: `${span2.traceId}-${span2.spanId}-${span2.sampled ? "1" : "0"}${match(span2.parent, {
26917
27107
  onNone: () => "",
@@ -26920,10 +27110,10 @@ var toHeaders = (span2) => fromRecordUnsafe({
26920
27110
  traceparent: `00-${span2.traceId.padStart(32, "0")}-${span2.spanId}-${span2.sampled ? "01" : "00"}`
26921
27111
  });
26922
27112
 
26923
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/requestState.js
27113
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/requestState.js
26924
27114
  var CurrentRequestState = /* @__PURE__ */ Service("effect/http/HttpEffect/CurrentRequestState");
26925
27115
 
26926
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/tracing.js
27116
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/internal/tracing.js
26927
27117
  var defaultPorts = {
26928
27118
  "http:": 80,
26929
27119
  "https:": 443,
@@ -26957,14 +27147,14 @@ var addHeaderAttributes = (span2, phase, headers, filter9, redactedNames2) => {
26957
27147
  }
26958
27148
  };
26959
27149
 
26960
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpMiddleware.js
27150
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpMiddleware.js
26961
27151
  var withLoggerDisabled = (self) => withFiber2((fiber3) => {
26962
27152
  const state = getOrUndefined2(fiber3.context, CurrentRequestState);
26963
27153
  if (state !== void 0) state.loggerDisabled = true;
26964
27154
  return self;
26965
27155
  });
26966
27156
 
26967
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClient.js
27157
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpClient.js
26968
27158
  var HttpClient_exports = {};
26969
27159
  __export(HttpClient_exports, {
26970
27160
  HttpClient: () => HttpClient,
@@ -27660,7 +27850,7 @@ var withRetryAfter = (schedule3) => fromStep(map7(toStep(schedule3), (step) => (
27660
27850
  var isTooManyRequestsHttpClientError = (error) => isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429;
27661
27851
  var isTransientResponse = (response) => response.status === 408 || response.status === 429 || response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504;
27662
27852
 
27663
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpRouter.js
27853
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpRouter.js
27664
27854
  var HttpRouter = /* @__PURE__ */ Service("effect/http/HttpRouter");
27665
27855
  var removeTrailingSlash = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
27666
27856
  var prefixPath = /* @__PURE__ */ dual(2, (self, prefix) => {
@@ -27742,7 +27932,7 @@ var getMiddleware = (context3) => {
27742
27932
  };
27743
27933
  var disableLogger = middleware(withLoggerDisabled).layer;
27744
27934
 
27745
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiSchema.js
27935
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiSchema.js
27746
27936
  var HttpApiSchema_exports = {};
27747
27937
  __export(HttpApiSchema_exports, {
27748
27938
  Accepted: () => Accepted,
@@ -27790,7 +27980,7 @@ __export(HttpApiSchema_exports, {
27790
27980
  withHeaders: () => withHeaders
27791
27981
  });
27792
27982
 
27793
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Sse.js
27983
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Sse.js
27794
27984
  var SseErrorTypeId = "~effect/encoding/Sse/SseError";
27795
27985
  var EventTooLarge = class extends (/* @__PURE__ */ TaggedError2("EventTooLarge")) {
27796
27986
  get message() {
@@ -28026,7 +28216,7 @@ var Retry = class _Retry extends (/* @__PURE__ */ TaggedClass("Retry")) {
28026
28216
  }
28027
28217
  };
28028
28218
 
28029
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpStatus.js
28219
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/HttpStatus.js
28030
28220
  var codeByLiteral = {
28031
28221
  Continue: 100,
28032
28222
  SwitchingProtocols: 101,
@@ -28093,13 +28283,13 @@ var codeByLiteral = {
28093
28283
  };
28094
28284
  var fromLiteral = (literal) => codeByLiteral[literal];
28095
28285
 
28096
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/ProblemDetails.js
28286
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/ProblemDetails.js
28097
28287
  var contentType = "application/problem+json";
28098
28288
  var blankType = "about:blank";
28099
28289
  var withFallback = (schema, value3) => withDecodingDefaultKey(succeed6(value3))(schema).pipe(catchDecoding(() => succeedSome3(value3)));
28100
28290
  var fixedMember = (value3) => withFallback(tag(value3), value3);
28101
28291
 
28102
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiSchema.js
28292
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiSchema.js
28103
28293
  var StreamSchemaTypeId = "~effect/http-api/HttpApiSchema/Stream";
28104
28294
  function status(code) {
28105
28295
  const statusCode = typeof code === "string" ? fromLiteral(code) : code;
@@ -28439,7 +28629,7 @@ function getStatusErrorSchema(schema) {
28439
28629
  return getStatusError(schema.ast);
28440
28630
  }
28441
28631
 
28442
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/internal/toCodecHttpProperties.js
28632
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/internal/toCodecHttpProperties.js
28443
28633
  function toCodecHttpProperties(schema) {
28444
28634
  const codec = toCodecStringTree2(schema);
28445
28635
  return codec.rebuild(normalizeProperties(codec.ast));
@@ -28469,7 +28659,7 @@ var normalizeProperties = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempoten
28469
28659
  return properties === ast.propertySignatures ? ast : new Objects(properties, ast.indexSignatures, ast.annotations, ast.checks, void 0, ast.context, ast.encodingChecks);
28470
28660
  });
28471
28661
 
28472
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiEndpoint.js
28662
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiEndpoint.js
28473
28663
  var TypeId51 = "~effect/http-api/HttpApiEndpoint";
28474
28664
  var isHttpApiEndpoint = (u) => hasProperty(u, TypeId51);
28475
28665
  function getPayloadSchemas(endpoint2) {
@@ -28858,7 +29048,7 @@ var del3 = /* @__PURE__ */ make31("DELETE");
28858
29048
  var head5 = /* @__PURE__ */ make31("HEAD");
28859
29049
  var options3 = /* @__PURE__ */ make31("OPTIONS");
28860
29050
 
28861
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApi.js
29051
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApi.js
28862
29052
  var TypeId52 = "~effect/http-api/HttpApi";
28863
29053
  var isHttpApi = (u) => hasProperty(u, TypeId52);
28864
29054
  var Proto12 = {
@@ -29021,7 +29211,7 @@ var getEndpointRedactedNames = (api, group2, endpoint2) => {
29021
29211
  };
29022
29212
  var getEndpointRedactedParams = (api, group2, endpoint2) => [api.annotations, group2.annotations, endpoint2.annotations].flatMap((annotations2) => getOrUndefined2(annotations2, RedactedNames)?.params ?? []);
29023
29213
 
29024
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Ndjson.js
29214
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/encoding/Ndjson.js
29025
29215
  var NdjsonErrorTypeId = "~effect/encoding/Ndjson/NdjsonError";
29026
29216
  var encoder6 = /* @__PURE__ */ new TextEncoder();
29027
29217
  var utf8Decoder = /* @__PURE__ */ new TextDecoder("utf-8", {
@@ -29183,11 +29373,11 @@ var decode7 = (options4) => fromTransform((upstream, _scope) => sync3(() => {
29183
29373
  return makeDecodePull(upstream, step, flush);
29184
29374
  }));
29185
29375
 
29186
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiMiddleware.js
29376
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiMiddleware.js
29187
29377
  var SecurityTypeId = "~effect/http-api/HttpApiMiddleware/Security";
29188
29378
  var isSecurity = (u) => hasProperty(u, SecurityTypeId);
29189
29379
 
29190
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/internal/path.js
29380
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/internal/path.js
29191
29381
  var emptyParamNames = /* @__PURE__ */ new Set();
29192
29382
  function getParamNames(schema) {
29193
29383
  if (schema === void 0) return emptyParamNames;
@@ -29215,7 +29405,7 @@ function replaceParams(path, paramNames, replace) {
29215
29405
  return out + path.slice(last);
29216
29406
  }
29217
29407
 
29218
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/OpenApi.js
29408
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/OpenApi.js
29219
29409
  var OpenApi_exports = {};
29220
29410
  __export(OpenApi_exports, {
29221
29411
  Deprecated: () => Deprecated,
@@ -29942,7 +30132,7 @@ var securitySchemeForComparison = (scheme) => {
29942
30132
  return scheme;
29943
30133
  };
29944
30134
 
29945
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiClient.js
30135
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiClient.js
29946
30136
  var HttpApiClient_exports = {};
29947
30137
  __export(HttpApiClient_exports, {
29948
30138
  UpgradedTypeId: () => UpgradedTypeId,
@@ -30574,7 +30764,7 @@ function getEncodePayloadSchemaFromBody(schema, method) {
30574
30764
  return out;
30575
30765
  }
30576
30766
 
30577
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiGroup.js
30767
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http-api/HttpApiGroup.js
30578
30768
  var HttpApiGroup_exports = {};
30579
30769
  __export(HttpApiGroup_exports, {
30580
30770
  isHttpApiGroup: () => isHttpApiGroup,
@@ -30872,9 +31062,6 @@ var RoutingSchema = Schema_exports.Struct({
30872
31062
  fallback: Schema_exports.optionalKey(Schema_exports.Boolean),
30873
31063
  allow_ignored_filters: Schema_exports.optionalKey(
30874
31064
  Schema_exports.Array(Schema_exports.NonEmptyString).check(Schema_exports.isUnique())
30875
- ),
30876
- connections: Schema_exports.optionalKey(
30877
- Schema_exports.Record(Schema_exports.String, Schema_exports.NonEmptyString)
30878
31065
  )
30879
31066
  }).annotate({ identifier: "Routing" });
30880
31067
  var CommonCallFields = {
@@ -30905,7 +31092,9 @@ var CapabilityCallSchema = Schema_exports.Struct({
30905
31092
  var NativeCallSchema = Schema_exports.Struct({
30906
31093
  ...CommonCallFields,
30907
31094
  request: NativeRequestSchema,
30908
- connection: Schema_exports.optionalKey(Schema_exports.NonEmptyString)
31095
+ account: Schema_exports.optionalKey(Schema_exports.NonEmptyString).annotate({
31096
+ description: "The team account id to use for this provider. Omit when the team has one account or a manually chosen default."
31097
+ })
30909
31098
  }).annotate({ identifier: "NativeCall" });
30910
31099
  var CallRequestSchema = Schema_exports.Union([
30911
31100
  CapabilityCallSchema,
@@ -31370,27 +31559,21 @@ var PriceSchema = Schema_exports.Union([
31370
31559
  identifier: "Price",
31371
31560
  description: "What a call to it costs the team here. `null`: nothing is charged here, because the team's own connection serves it and the provider charges that account, or because the team has to connect one first. Otherwise, for each of the `examples` given beside it (by its place among them), what a call made with it holds before it is sent: `0` for one that is free. A call is charged what it used, which is most often what it held."
31372
31561
  });
31373
- var DefaultConnectionSchema = Schema_exports.Union([
31374
- Schema_exports.Struct({ state: Schema_exports.Literal("none") }),
31375
- Schema_exports.Struct({ state: Schema_exports.Literal("not_needed") }),
31376
- Schema_exports.Struct({
31377
- state: Schema_exports.Literals(["active", "needs_authorization"]),
31378
- id: Schema_exports.NonEmptyString,
31379
- name: Schema_exports.NonEmptyString
31380
- })
31381
- ]).annotate({
31382
- identifier: "DefaultConnection",
31383
- description: "The connection a call without `connection` would use. For a capability, the first provider the team has a connection to. `not_needed` is an operation that works with no credential, for a team that has no connection to its provider: a call goes without one, and a connection the team has is still the one used."
31384
- });
31385
- var TeamConnectionSchema = Schema_exports.Struct({
31562
+ var TeamAccountSchema = Schema_exports.Struct({
31386
31563
  id: Schema_exports.NonEmptyString,
31387
31564
  name: Schema_exports.NonEmptyString,
31388
31565
  provider: Schema_exports.NonEmptyString,
31389
31566
  state: Schema_exports.Literals(["active", "needs_authorization"]),
31390
31567
  default: Schema_exports.Boolean
31391
31568
  }).annotate({
31392
- identifier: "TeamConnection",
31393
- description: "A connection of the team to a provider. A call names one by its `id`."
31569
+ identifier: "TeamAccount",
31570
+ description: "An external account the team connected to a provider. A request call names one by its `id` in `account`."
31571
+ });
31572
+ var AccountListSchema = Schema_exports.Struct({
31573
+ accounts: Schema_exports.Array(TeamAccountSchema)
31574
+ }).annotate({
31575
+ identifier: "AccountList",
31576
+ description: "Accounts the team has connected to external providers, oldest first within each provider."
31394
31577
  });
31395
31578
  var ProviderSummaryRefSchema = Schema_exports.Struct({
31396
31579
  name: Schema_exports.NonEmptyString,
@@ -31403,7 +31586,7 @@ var MapOperationSchema = Schema_exports.Struct({
31403
31586
  summary: Schema_exports.String
31404
31587
  }).annotate({
31405
31588
  identifier: "MapOperation",
31406
- description: "An operation, by its address and method. `inspect` gives what it takes and gives, its price and the team's connection for it."
31589
+ description: "An operation, by its address and method. `inspect` gives what it takes and gives, its price and any connected accounts."
31407
31590
  });
31408
31591
  var MapGroupSchema = Schema_exports.Struct({
31409
31592
  name: Schema_exports.NonEmptyString,
@@ -31419,7 +31602,9 @@ var MapProviderSchema = Schema_exports.Struct({
31419
31602
  name: Schema_exports.NonEmptyString,
31420
31603
  title: Schema_exports.NonEmptyString,
31421
31604
  summary: Schema_exports.optionalKey(Schema_exports.String),
31422
- connection: DefaultConnectionSchema,
31605
+ account_count: Schema_exports.optionalKey(
31606
+ Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(1))
31607
+ ),
31423
31608
  group_count: Schema_exports.optionalKey(
31424
31609
  Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0))
31425
31610
  ),
@@ -31430,17 +31615,16 @@ var MapProviderSchema = Schema_exports.Struct({
31430
31615
  operations: Schema_exports.optionalKey(Schema_exports.Array(MapOperationSchema))
31431
31616
  }).annotate({
31432
31617
  identifier: "MapProvider",
31433
- description: "A provider. `connection` is the team's default connection to it; `not_needed` is a provider none of whose operations needs one. It has one of `groups`, `group_count`, `operations` and `operation_count`: `discover` with the `provider` lists what it has."
31618
+ description: "A provider. `account_count` is present when the team has connected one or more accounts to it. It has one of `groups`, `group_count`, `operations` and `operation_count`: `discover` with `provider` lists what it has."
31434
31619
  });
31435
31620
  var MapCapabilitySchema = Schema_exports.Struct({
31436
31621
  id: Schema_exports.NonEmptyString,
31437
31622
  title: Schema_exports.NonEmptyString,
31438
31623
  summary: Schema_exports.String,
31439
- providers: Schema_exports.Array(Schema_exports.NonEmptyString),
31440
- connection: DefaultConnectionSchema
31624
+ providers: Schema_exports.Array(Schema_exports.NonEmptyString)
31441
31625
  }).annotate({
31442
31626
  identifier: "MapCapability",
31443
- description: "A capability, which a call names with its input: `inspect` gives what it takes and gives. `connection` is the one a call would meet first: the first provider the team has a connection to."
31627
+ description: "A capability, which a call names with its input: `inspect` gives what it takes and gives."
31444
31628
  });
31445
31629
  var MapTopicSchema = Schema_exports.Struct({
31446
31630
  topic: TopicSchema,
@@ -31482,7 +31666,7 @@ var PublicProviderDetailSchema = Schema_exports.Struct({
31482
31666
  documentation: Schema_exports.optionalKey(HttpsUrlSchema2),
31483
31667
  hosts: Schema_exports.Array(HttpsUrlSchema2),
31484
31668
  health: HealthSchema,
31485
- connections: Schema_exports.Array(TeamConnectionSchema),
31669
+ accounts: Schema_exports.Array(TeamAccountSchema),
31486
31670
  key_source: Schema_exports.optionalKey(
31487
31671
  Schema_exports.Struct({
31488
31672
  url: HttpsUrlSchema2,
@@ -31492,7 +31676,7 @@ var PublicProviderDetailSchema = Schema_exports.Struct({
31492
31676
  limits: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
31493
31677
  }).annotate({
31494
31678
  identifier: "ProviderDetail",
31495
- description: "What a provider is: where its calls go, the team's connections to it, and where a person gets its key."
31679
+ description: "What a provider is: where its calls go, the team's connected accounts for it, and where a person gets its key."
31496
31680
  });
31497
31681
  var DiscoverProviderSchema = Schema_exports.Struct({
31498
31682
  provider: PublicProviderDetailSchema,
@@ -31531,8 +31715,7 @@ var OperationMethodSchema = Schema_exports.Struct({
31531
31715
  examples: Schema_exports.Array(Schema_exports.Struct({ request: PageRequestSchema })),
31532
31716
  paginated: Schema_exports.Boolean,
31533
31717
  price: PriceSchema,
31534
- health: HealthSchema,
31535
- connection: DefaultConnectionSchema
31718
+ health: HealthSchema
31536
31719
  }).annotate({
31537
31720
  identifier: "OperationMethod",
31538
31721
  description: "One method at an operation's address: an operation of its own."
@@ -31542,15 +31725,14 @@ var PublicOperationDetailSchema = Schema_exports.Struct({
31542
31725
  id: Schema_exports.NonEmptyString,
31543
31726
  provider: ProviderSummaryRefSchema,
31544
31727
  methods: Schema_exports.Array(OperationMethodSchema),
31545
- connections: Schema_exports.Array(TeamConnectionSchema)
31728
+ accounts: Schema_exports.Array(TeamAccountSchema)
31546
31729
  }).annotate({ identifier: "OperationDetail" });
31547
31730
  var ServingOperationSchema = Schema_exports.Struct({
31548
31731
  id: Schema_exports.NonEmptyString,
31549
31732
  method: HttpMethodSchema,
31550
31733
  provider: ProviderSummaryRefSchema,
31551
31734
  price: PriceSchema,
31552
- health: HealthSchema,
31553
- connection: DefaultConnectionSchema
31735
+ health: HealthSchema
31554
31736
  }).annotate({
31555
31737
  identifier: "ServingOperation",
31556
31738
  description: "An operation that serves a capability."
@@ -31569,8 +31751,7 @@ var PublicCapabilityDetailSchema = Schema_exports.Struct({
31569
31751
  input_schema: JsonObjectSchema,
31570
31752
  output_schema: JsonObjectSchema,
31571
31753
  examples: Schema_exports.Array(Schema_exports.Struct({ input: JsonObjectSchema })),
31572
- operations: Schema_exports.Array(ServingOperationSchema),
31573
- connections: Schema_exports.Array(TeamConnectionSchema)
31754
+ operations: Schema_exports.Array(ServingOperationSchema)
31574
31755
  }).annotate({ identifier: "CapabilityDetail" });
31575
31756
  var InspectResultSchema = Schema_exports.Union([
31576
31757
  PublicCapabilityDetailSchema,
@@ -31697,9 +31878,25 @@ var discoveryGroup = HttpApiGroup_exports.make("discovery").add(
31697
31878
  ]
31698
31879
  })
31699
31880
  );
31700
- var DuangApi = HttpApi_exports.make("duang").add(callsGroup).add(discoveryGroup).annotate(OpenApi_exports.Title, "duang").annotate(OpenApi_exports.Version, "0.1.0");
31881
+ var accountsGroup = HttpApiGroup_exports.make("accounts").add(
31882
+ HttpApiEndpoint_exports.get("list", "/v1/accounts", {
31883
+ query: {
31884
+ provider: Schema_exports.optionalKey(
31885
+ Schema_exports.String.check(pattern(PROVIDER_ID_PATTERN))
31886
+ ).annotate({
31887
+ description: "Only list accounts connected to this provider."
31888
+ })
31889
+ },
31890
+ success: AccountListSchema,
31891
+ error: [
31892
+ UnauthenticatedErrorSchema.pipe(HttpApiSchema_exports.status(401)),
31893
+ ProblemDetailsJson.pipe(HttpApiSchema_exports.status(422))
31894
+ ]
31895
+ })
31896
+ );
31897
+ var DuangApi = HttpApi_exports.make("duang").add(callsGroup).add(discoveryGroup).add(accountsGroup).annotate(OpenApi_exports.Title, "duang").annotate(OpenApi_exports.Version, "0.1.0");
31701
31898
 
31702
- // ../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/FetchHttpClient.js
31899
+ // ../../../../node_modules/.bun/effect@4.1.5/node_modules/effect/dist/http/FetchHttpClient.js
31703
31900
  var FetchHttpClient_exports = {};
31704
31901
  __export(FetchHttpClient_exports, {
31705
31902
  Fetch: () => Fetch,
@@ -31926,7 +32123,9 @@ var EXIT = {
31926
32123
  /** Trying again, or elsewhere, may do. */
31927
32124
  retry: 5,
31928
32125
  /** Waiting ran out while the work is still going. */
31929
- waiting: 6
32126
+ waiting: 6,
32127
+ /** Interrupted by SIGINT / SIGTERM while waiting. */
32128
+ interrupted: 130
31930
32129
  };
31931
32130
  function failure(exit3, code, message, more = {}) {
31932
32131
  return { exit: exit3, value: { error: { code, message, ...more } }, text: message };
@@ -32409,7 +32608,7 @@ var accountCommands = [
32409
32608
  ];
32410
32609
 
32411
32610
  // src/data-commands.ts
32412
- var DEFAULT_TIMEOUT_S = 60;
32611
+ var DEFAULT_WAIT_S = 60;
32413
32612
  var MIN_POLL_MS = 1e3;
32414
32613
  var isTopic = Schema_exports.is(TopicSchema);
32415
32614
  var decodeCallRequest = Schema_exports.decodeUnknownResult(CallRequestSchema);
@@ -32450,19 +32649,17 @@ function listOf(value3) {
32450
32649
  return item === void 0 ? [] : [item];
32451
32650
  }) : [];
32452
32651
  }
32453
- function connectedText(connection) {
32454
- if (connection === void 0 || connection.state === "none") return "";
32455
- return connection.state === "not_needed" ? " [no connection needed]" : " [connected]";
32456
- }
32457
32652
  function countText(item) {
32458
32653
  const counts = [
32459
- ["capability_count", "capabilities"],
32460
- ["provider_count", "providers"],
32461
- ["group_count", "groups"],
32462
- ["operation_count", "operations"]
32463
- ].flatMap(
32464
- ([field2, name]) => typeof item[field2] === "number" ? [`${item[field2]} ${name}`] : []
32465
- );
32654
+ ["capability_count", "capability", "capabilities"],
32655
+ ["provider_count", "provider", "providers"],
32656
+ ["group_count", "group", "groups"],
32657
+ ["operation_count", "operation", "operations"],
32658
+ ["account_count", "account", "accounts"]
32659
+ ].flatMap(([field2, singular, plural]) => {
32660
+ const value3 = item[field2];
32661
+ return typeof value3 === "number" ? [`${value3} ${value3 === 1 ? singular : plural}`] : [];
32662
+ });
32466
32663
  return counts.length === 0 ? "" : ` (${counts.join(", ")})`;
32467
32664
  }
32468
32665
  function operationLines(operations, indent) {
@@ -32472,7 +32669,7 @@ function operationLines(operations, indent) {
32472
32669
  }
32473
32670
  function providerLines(provider, indent) {
32474
32671
  return [
32475
- `${indent}${provider.name} ${provider.title}${countText(provider)}${connectedText(object(provider.connection))}`,
32672
+ `${indent}${provider.name} ${provider.title}${countText(provider)}`,
32476
32673
  ...listOf(provider.groups).map(
32477
32674
  (group2) => `${indent} ${group2.name}${countText(group2)}`
32478
32675
  ),
@@ -32482,7 +32679,7 @@ function providerLines(provider, indent) {
32482
32679
  function discoverText(result3) {
32483
32680
  const raw2 = result3;
32484
32681
  const lines = [];
32485
- const capabilityLine = (capability, indent) => `${indent}${capability.id} ${capability.title}${connectedText(object(capability.connection))}`;
32682
+ const capabilityLine = (capability, indent) => `${indent}${capability.id} ${capability.title}`;
32486
32683
  if (Array.isArray(raw2.topics)) {
32487
32684
  for (const topic of listOf(raw2.topics)) {
32488
32685
  lines.push(`${topic.topic}${countText(topic)}`);
@@ -32685,7 +32882,14 @@ function callText(body) {
32685
32882
  const http = object(body.http);
32686
32883
  if (typeof http?.status === "number") lines.push(`HTTP ${http.status}`);
32687
32884
  const error = object(body.error);
32688
- if (error !== void 0) lines.push(`${error.code} \u2014 ${error.recovery}`);
32885
+ if (error !== void 0) {
32886
+ lines.push(`${error.code} \u2014 ${error.recovery}`);
32887
+ if (Array.isArray(error.alternatives) && error.alternatives.length > 0) {
32888
+ lines.push(
32889
+ `Available accounts: ${error.alternatives.map(String).join(", ")} (run \`duang accounts list\` to see names)`
32890
+ );
32891
+ }
32892
+ }
32689
32893
  const action = object(body.user_action);
32690
32894
  if (action !== void 0) lines.push(`${action.kind}: ${action.url}`);
32691
32895
  for (const name of ["output", "data"])
@@ -32709,38 +32913,61 @@ function callOutcome(body, idempotent) {
32709
32913
  }
32710
32914
  async function waitFor(context3, first, deadline, idempotent) {
32711
32915
  let latest = first;
32712
- while (latest.state === "pending") {
32713
- const remaining = deadline - context3.io.now();
32714
- if (remaining <= 0) break;
32715
- const pause = Math.min(
32716
- Math.max(latest.poll_after_s * 1e3, MIN_POLL_MS),
32717
- remaining
32718
- );
32719
- await context3.io.sleep(pause);
32720
- const callId = latest.call_id;
32721
- const asked = await asTeamApi(
32722
- context3,
32723
- (client) => client.calls.get({
32724
- params: { call_id: callId },
32725
- query: { include: "next_step" }
32726
- })
32727
- );
32728
- if (asked.kind === "outcome") return asked.outcome;
32729
- if (asked.kind === "invalid_input") throw new UsageError(asked.message);
32730
- if (asked.kind === "unreachable")
32916
+ let interrupted = false;
32917
+ const controller = new AbortController();
32918
+ const onStop = () => {
32919
+ interrupted = true;
32920
+ controller.abort();
32921
+ };
32922
+ const offInt = context3.io.onSignal?.("SIGINT", onStop);
32923
+ const offTerm = context3.io.onSignal?.("SIGTERM", onStop);
32924
+ try {
32925
+ while (latest.state === "pending" && !interrupted) {
32926
+ const remaining = deadline - context3.io.now();
32927
+ if (remaining <= 0) break;
32928
+ const pause = Math.min(
32929
+ Math.max(latest.poll_after_s * 1e3, MIN_POLL_MS),
32930
+ remaining
32931
+ );
32932
+ await context3.io.sleep(pause, controller.signal);
32933
+ if (interrupted) break;
32934
+ const callId = latest.call_id;
32935
+ const asked = await asTeamApi(
32936
+ context3,
32937
+ (client) => client.calls.get({
32938
+ params: { call_id: callId },
32939
+ query: { include: "next_step" }
32940
+ })
32941
+ );
32942
+ if (asked.kind === "outcome") return asked.outcome;
32943
+ if (asked.kind === "invalid_input") throw new UsageError(asked.message);
32944
+ if (asked.kind === "unreachable")
32945
+ return failure(
32946
+ EXIT.retry,
32947
+ "unreachable",
32948
+ "The server cannot be reached. The call continues; read it again with `duang calls get`.",
32949
+ {
32950
+ call_id: latest.call_id
32951
+ }
32952
+ );
32953
+ if (asked.kind === "unexpected") return unexpected(asked.status);
32954
+ if (asked.kind === "error") return apiRefusal(asked.status, asked.error);
32955
+ latest = asked.value;
32956
+ }
32957
+ if (interrupted && latest.state === "pending") {
32731
32958
  return failure(
32732
- EXIT.retry,
32733
- "unreachable",
32734
- "The server cannot be reached. The call continues; read it again with `duang calls get`.",
32735
- {
32736
- call_id: latest.call_id
32737
- }
32959
+ EXIT.interrupted,
32960
+ "interrupted",
32961
+ `Interrupted while waiting. The call continues; read it again with \`duang calls get ${latest.call_id}\`.`,
32962
+ { call_id: latest.call_id }
32738
32963
  );
32739
- if (asked.kind === "unexpected") return unexpected(asked.status);
32740
- if (asked.kind === "error") return apiRefusal(asked.status, asked.error);
32741
- latest = asked.value;
32964
+ }
32965
+ return callOutcome(latest, idempotent);
32966
+ } finally {
32967
+ offInt?.();
32968
+ offTerm?.();
32969
+ controller.abort();
32742
32970
  }
32743
- return callOutcome(latest, idempotent);
32744
32971
  }
32745
32972
  async function textOf(context3, said, option3) {
32746
32973
  if (said === "-") return context3.io.readText({ stdin: true });
@@ -32772,10 +32999,10 @@ var CAPABILITY_ONLY = [
32772
32999
  "allow-ignored-filters",
32773
33000
  "include"
32774
33001
  ];
32775
- var NATIVE_ONLY = ["method", "header", "data"];
33002
+ var NATIVE_ONLY = ["method", "header", "data", "account"];
32776
33003
  var givenOf = (parsed, names) => names.find((name) => name in parsed.options);
32777
33004
  async function targetOf(context3, parsed) {
32778
- const connection = stringOption(parsed, "connection");
33005
+ const account = stringOption(parsed, "account");
32779
33006
  if (parsed.positionals.length === 0)
32780
33007
  throw new UsageError(
32781
33008
  "call needs what to call: a capability (people.email.find), or a provider's address (https://\u2026)"
@@ -32791,7 +33018,7 @@ async function targetOf(context3, parsed) {
32791
33018
  throw new UsageError(`--${misplaced} is not for a request`);
32792
33019
  return {
32793
33020
  request: await nativeRequest(context3, parsed, id2),
32794
- ...connection === void 0 ? {} : { connection }
33021
+ ...account === void 0 ? {} : { account }
32795
33022
  };
32796
33023
  }
32797
33024
  const native = givenOf(parsed, NATIVE_ONLY);
@@ -32811,10 +33038,8 @@ async function targetOf(context3, parsed) {
32811
33038
  const providers = list(stringOption(parsed, "provider"));
32812
33039
  const ignored = list(stringOption(parsed, "allow-ignored-filters"));
32813
33040
  const noFallback = flag(parsed, "no-fallback");
32814
- const connections = connectionsOf(connection);
32815
- const routing = providers === void 0 && ignored === void 0 && connections === void 0 && !noFallback ? void 0 : {
33041
+ const routing = providers === void 0 && ignored === void 0 && !noFallback ? void 0 : {
32816
33042
  ...providers === void 0 ? {} : { providers },
32817
- ...connections === void 0 ? {} : { connections },
32818
33043
  ...noFallback ? { fallback: false } : {},
32819
33044
  ...ignored === void 0 ? {} : { allow_ignored_filters: ignored }
32820
33045
  };
@@ -32829,18 +33054,6 @@ async function targetOf(context3, parsed) {
32829
33054
  include: [...included, "next_step"]
32830
33055
  };
32831
33056
  }
32832
- function connectionsOf(given) {
32833
- if (given === void 0) return void 0;
32834
- const pairs = (list(given) ?? []).map((pair) => {
32835
- const equals4 = pair.indexOf("=");
32836
- if (equals4 <= 0 || equals4 === pair.length - 1)
32837
- throw new UsageError(
32838
- "For a capability, --connection is provider=connection, separated by commas"
32839
- );
32840
- return [pair.slice(0, equals4), pair.slice(equals4 + 1)];
32841
- });
32842
- return Object.fromEntries(pairs);
32843
- }
32844
33057
  async function nativeRequest(context3, parsed, url) {
32845
33058
  const headers = {};
32846
33059
  for (const line of listOption(parsed, "header")) {
@@ -32878,7 +33091,7 @@ var INPUT_HINT = "A capability's input is a JSON object, given with --input '<js
32878
33091
  var callCommand = {
32879
33092
  name: "call",
32880
33093
  unknownOptionHint: INPUT_HINT,
32881
- summary: "Call a capability, or send a request to a provider's API, and wait for what became of it. Waits at most --timeout seconds; --submit returns at once.",
33094
+ summary: "Call a capability, or send a request to a provider's API, and wait for what became of it. Waits at most --wait seconds (60 by default); --submit returns at once.",
32882
33095
  options: {
32883
33096
  input: {
32884
33097
  type: "string",
@@ -32899,10 +33112,10 @@ var callCommand = {
32899
33112
  value: "a,b",
32900
33113
  description: "A capability: filters a provider may leave out."
32901
33114
  },
32902
- connection: {
33115
+ account: {
32903
33116
  type: "string",
32904
- value: "id|provider=id,\u2026",
32905
- description: "The team connection to use. For a capability, the connection at each provider, as provider=id separated by commas."
33117
+ value: "id",
33118
+ description: "A request: the team account id to use for this provider (see `duang accounts list`)."
32906
33119
  },
32907
33120
  "max-cost": {
32908
33121
  type: "string",
@@ -32947,20 +33160,24 @@ var callCommand = {
32947
33160
  type: "boolean",
32948
33161
  description: "Return as soon as the call is accepted, without waiting."
32949
33162
  },
32950
- timeout: {
33163
+ wait: {
32951
33164
  type: "string",
32952
33165
  value: "seconds",
32953
- description: "How long to wait; 60 by default."
33166
+ description: "How long to wait for a pending call to finish; 60 by default."
32954
33167
  }
32955
33168
  },
32956
33169
  positionals: "<capability> | <url>",
32957
33170
  examples: [
32958
- "duang call people.email.find --input @person.json --provider hunter,findymail --connection hunter=hunter-sales --max-cost 0.05",
33171
+ "duang call people.email.find --input @person.json --provider hunter,findymail --max-cost 0.05",
32959
33172
  "duang call 'https://api.hunter.io/v2/email-finder?domain=reddit.com&full_name=Alexis+Ohanian'",
32960
- `duang call https://google.serper.dev/search -d '{"q":"duang"}'`
33173
+ `duang call https://google.serper.dev/search -d '{"q":"duang"}'`,
33174
+ "duang call 'https://api.supabase.com/v1/projects' --account supabase_prod"
32961
33175
  ],
32962
33176
  async run(context3, parsed) {
32963
- const timeout4 = integer2(parsed, "timeout", 0, 86400) ?? DEFAULT_TIMEOUT_S;
33177
+ const explicitWait = integer2(parsed, "wait", 0, 86400);
33178
+ if (flag(parsed, "submit") && explicitWait !== void 0)
33179
+ throw new UsageError("--submit and --wait cannot be used together");
33180
+ const waitSeconds = explicitWait ?? DEFAULT_WAIT_S;
32964
33181
  const metadata = stringOption(parsed, "metadata");
32965
33182
  let metadataObject;
32966
33183
  if (metadata !== void 0) {
@@ -33011,7 +33228,12 @@ var callCommand = {
33011
33228
  // Asked to return at once, a call that is going on is a call that was accepted.
33012
33229
  ...asked.value.state === "pending" && flag(parsed, "submit") ? { exit: EXIT.ok } : {}
33013
33230
  };
33014
- return waitFor(context3, asked.value, started + timeout4 * 1e3, idempotent);
33231
+ return waitFor(
33232
+ context3,
33233
+ asked.value,
33234
+ started + waitSeconds * 1e3,
33235
+ idempotent
33236
+ );
33015
33237
  }
33016
33238
  };
33017
33239
  var callsGetCommand = {
@@ -33104,7 +33326,45 @@ var callsListCommand = {
33104
33326
  };
33105
33327
  }
33106
33328
  };
33329
+ var accountsListCommand = {
33330
+ name: "accounts list",
33331
+ summary: "List the external accounts connected to this team, optionally filtered by provider.",
33332
+ options: {
33333
+ provider: {
33334
+ type: "string",
33335
+ value: "name",
33336
+ description: "Only list accounts connected to this provider."
33337
+ }
33338
+ },
33339
+ positionals: "",
33340
+ examples: ["duang accounts list", "duang accounts list --provider supabase"],
33341
+ async run(context3, parsed) {
33342
+ noExtra(parsed, 0, "accounts list");
33343
+ const provider = stringOption(parsed, "provider");
33344
+ const asked = await asTeamApi(
33345
+ context3,
33346
+ (client) => client.accounts.list({
33347
+ query: provider === void 0 ? {} : { provider }
33348
+ })
33349
+ );
33350
+ if (asked.kind === "outcome") return asked.outcome;
33351
+ if (asked.kind === "invalid_input") throw new UsageError(asked.message);
33352
+ if (asked.kind === "unreachable")
33353
+ return unreachable(new NetworkFailure("The server cannot be reached"));
33354
+ if (asked.kind === "unexpected") return unexpected(asked.status);
33355
+ if (asked.kind === "error") return apiRefusal(asked.status, asked.error);
33356
+ const lines = asked.value.accounts.map(
33357
+ (account) => `${account.id} ${account.provider} ${account.name}${account.default ? " [default]" : ""}${account.state === "needs_authorization" ? " [needs_authorization]" : ""}`
33358
+ );
33359
+ return {
33360
+ exit: EXIT.ok,
33361
+ value: asked.value,
33362
+ text: lines.length === 0 ? "No accounts connected." : lines.join("\n")
33363
+ };
33364
+ }
33365
+ };
33107
33366
  var dataCommands = [
33367
+ accountsListCommand,
33108
33368
  discoverCommand,
33109
33369
  inspectCommand,
33110
33370
  callCommand,
@@ -33271,7 +33531,11 @@ function written(values2) {
33271
33531
  var LOOPBACK = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
33272
33532
  var DEFAULT_ORIGIN = "https://api.duang.ai";
33273
33533
  function apiOrigin(env, given) {
33274
- const said = given ?? (env.DUANG_API_BASE === "" ? void 0 : env.DUANG_API_BASE);
33534
+ if (given === "")
33535
+ throw new UsageError(
33536
+ "Say which server to use with DUANG_API_URL, or --api-url."
33537
+ );
33538
+ const said = given ?? (env.DUANG_API_URL === "" ? void 0 : env.DUANG_API_URL);
33275
33539
  if (said === void 0) return DEFAULT_ORIGIN;
33276
33540
  let url;
33277
33541
  try {
@@ -33291,27 +33555,36 @@ function apiOrigin(env, given) {
33291
33555
  }
33292
33556
 
33293
33557
  // src/run.ts
33294
- var VERSION = true ? "0.1.0" : "0.0.0-source";
33558
+ var VERSION = true ? "0.1.1" : "0.0.0-source";
33295
33559
  var GLOBAL = {
33296
33560
  json: {
33297
33561
  type: "boolean",
33298
33562
  description: "Write one JSON object even at a terminal."
33299
33563
  },
33300
- "api-base": {
33564
+ "api-url": {
33301
33565
  type: "string",
33302
- value: "origin",
33303
- description: `The server to use; DUANG_API_BASE otherwise, and ${DEFAULT_ORIGIN} when neither is given.`
33566
+ value: "url",
33567
+ description: `The server URL to use (origin only, no path); DUANG_API_URL otherwise, and ${DEFAULT_ORIGIN} when neither is given.`
33304
33568
  },
33305
33569
  jq: {
33306
33570
  type: "string",
33307
33571
  value: "selector",
33308
- description: "Write only what the selector picks from the result, a line to each (strings as they are); on failure the whole result goes to stderr."
33572
+ description: "Write only what the selector picks from the result on exit 0, a line to each (strings as they are); on failure the whole result goes to stderr."
33309
33573
  },
33310
33574
  verbose: {
33311
33575
  type: "boolean",
33312
33576
  description: "Also write what the command did to stderr."
33313
33577
  },
33314
- help: { type: "boolean", description: "Say how a command is used." }
33578
+ help: {
33579
+ type: "boolean",
33580
+ short: "h",
33581
+ description: "Say how a command is used."
33582
+ },
33583
+ version: {
33584
+ type: "boolean",
33585
+ short: "V",
33586
+ description: "Print the CLI version."
33587
+ }
33315
33588
  };
33316
33589
  function manifest() {
33317
33590
  const options4 = (specs) => Object.entries(specs).map(([name, spec]) => ({
@@ -33325,9 +33598,14 @@ function manifest() {
33325
33598
  return {
33326
33599
  name: "duang",
33327
33600
  version: VERSION,
33601
+ default_api_url: DEFAULT_ORIGIN,
33602
+ streams: {
33603
+ stdout: "Structured result on exit 0 only (single JSON object when non-TTY or --json, selected lines with --jq, readable text at a TTY). Empty on non-zero exit.",
33604
+ stderr: "All errors on non-zero exit (single JSON object when non-TTY, --json, or --jq; readable text at a TTY), plus interactive progress and --verbose diagnostics."
33605
+ },
33328
33606
  global_options: options4(GLOBAL),
33329
33607
  environment: {
33330
- DUANG_API_BASE: `The origin of the server to use; ${DEFAULT_ORIGIN} when it is not given.`,
33608
+ DUANG_API_URL: `The server URL (origin only) to use; ${DEFAULT_ORIGIN} when it is not given.`,
33331
33609
  DUANG_API_KEY: "A team key to use instead of what `duang login` saved; when it is given and the server does not accept it, nothing else is tried."
33332
33610
  },
33333
33611
  exit_codes: {
@@ -33337,9 +33615,10 @@ function manifest() {
33337
33615
  "3": "The input must be fixed.",
33338
33616
  "4": "A person has to act: sign in, connect an account, or approve.",
33339
33617
  "5": "Trying again, or another provider, may work.",
33340
- "6": "Waiting ran out while the work goes on."
33618
+ "6": "Waiting ran out while the work goes on.",
33619
+ "130": "Interrupted while waiting; the remote call continues."
33341
33620
  },
33342
- commands: [...commands, manifestCommand].map((command) => ({
33621
+ commands: allCommands().map((command) => ({
33343
33622
  name: command.name,
33344
33623
  summary: command.summary,
33345
33624
  usage: `duang ${command.name}${command.positionals === "" ? "" : ` ${command.positionals}`}`,
@@ -33362,9 +33641,57 @@ var manifestCommand = {
33362
33641
  };
33363
33642
  }
33364
33643
  };
33644
+ function allCommands() {
33645
+ return [...commands, manifestCommand];
33646
+ }
33647
+ function formatOptionLines(specs) {
33648
+ return Object.entries(specs).map(
33649
+ ([name, spec]) => ` ${spec.short === void 0 ? "" : `-${spec.short}, `}--${name}${spec.value === void 0 ? "" : ` <${spec.value}>`}${spec.repeatable ? " ..." : ""} ${spec.description}`
33650
+ ).join("\n");
33651
+ }
33652
+ function formatCommandHelp(command) {
33653
+ const sections = [
33654
+ `Usage: duang ${command.name}${command.positionals === "" ? "" : ` ${command.positionals}`}
33655
+ ${command.summary}`
33656
+ ];
33657
+ if (Object.keys(command.options).length > 0) {
33658
+ sections.push(`Options:
33659
+ ${formatOptionLines(command.options)}`);
33660
+ }
33661
+ sections.push(`Global options:
33662
+ ${formatOptionLines(GLOBAL)}`);
33663
+ if (command.examples.length > 0) {
33664
+ sections.push(
33665
+ `Examples:
33666
+ ${command.examples.map((example) => ` ${example}`).join("\n")}`
33667
+ );
33668
+ }
33669
+ return `${sections.join("\n\n")}
33670
+ `;
33671
+ }
33672
+ function groupCommands(prefix) {
33673
+ return allCommands().filter(
33674
+ (command) => command.name.startsWith(`${prefix} `)
33675
+ );
33676
+ }
33677
+ function formatGroupHelp(prefix, group2) {
33678
+ const width2 = Math.max(...group2.map((command) => command.name.length)) + 2;
33679
+ const lines = group2.map(
33680
+ (command) => ` ${command.name.padEnd(width2)}${command.summary.split(". ")[0]}`
33681
+ );
33682
+ return `Usage: duang ${prefix} <subcommand> [options]
33683
+
33684
+ Subcommands:
33685
+ ${lines.join("\n")}
33686
+
33687
+ Run \`duang ${prefix} <subcommand> --help\` for options and examples.
33688
+ `;
33689
+ }
33365
33690
  function usage() {
33366
- const lines = [...commands, manifestCommand].map(
33367
- (command) => ` ${command.name.padEnd(10)} ${command.summary.split(". ")[0]}`
33691
+ const all4 = allCommands();
33692
+ const width2 = Math.max(...all4.map((command) => command.name.length)) + 2;
33693
+ const lines = all4.map(
33694
+ (command) => ` ${command.name.padEnd(width2)}${command.summary.split(". ")[0]}`
33368
33695
  );
33369
33696
  return `Usage: duang <command> [options]
33370
33697
  duang --version
@@ -33372,12 +33699,10 @@ function usage() {
33372
33699
  Commands:
33373
33700
  ${lines.join("\n")}
33374
33701
 
33375
- Global options: ${Object.keys(
33376
- GLOBAL
33377
- ).map((name) => `--${name}`).join(
33378
- " "
33379
- )}
33380
- Run \`duang manifest\` for everything, in a form a program reads.
33702
+ Global options:
33703
+ ${formatOptionLines(GLOBAL)}
33704
+
33705
+ Run \`duang <command> --help\` for details, or \`duang manifest\` for machine-readable output.
33381
33706
  `;
33382
33707
  }
33383
33708
  function render(outcome, human) {
@@ -33386,7 +33711,7 @@ function render(outcome, human) {
33386
33711
  `;
33387
33712
  }
33388
33713
  function find(argv) {
33389
- const all4 = [...commands, manifestCommand];
33714
+ const all4 = allCommands();
33390
33715
  const two = all4.find((one2) => one2.name === `${argv[0]} ${argv[1]}`);
33391
33716
  if (two !== void 0)
33392
33717
  return { command: two, rest: argv.slice(2) };
@@ -33398,12 +33723,11 @@ async function run3(argv, io) {
33398
33723
  let verbose = false;
33399
33724
  let select;
33400
33725
  const finish = (outcome) => {
33726
+ if (outcome.exit !== EXIT.ok) {
33727
+ io.stderr.write(render(outcome, human));
33728
+ return outcome.exit;
33729
+ }
33401
33730
  if (select !== void 0) {
33402
- if (outcome.exit !== EXIT.ok) {
33403
- io.stderr.write(`${JSON.stringify(outcome.value)}
33404
- `);
33405
- return outcome.exit;
33406
- }
33407
33731
  try {
33408
33732
  io.stdout.write(written(select(outcome.value)));
33409
33733
  } catch (error) {
@@ -33419,21 +33743,118 @@ async function run3(argv, io) {
33419
33743
  io.stdout.write(render(outcome, human));
33420
33744
  return outcome.exit;
33421
33745
  };
33746
+ const versionOutcome = () => ({
33747
+ exit: EXIT.ok,
33748
+ value: { version: VERSION },
33749
+ text: `duang ${VERSION}`
33750
+ });
33422
33751
  try {
33423
- const [word] = argv;
33424
- if (word === void 0 || word === "--help" || word === "help") {
33752
+ const { leading, rest: afterGlobals } = splitLeadingGlobals(argv, GLOBAL);
33753
+ const leadingParsed = parseArguments(leading, GLOBAL);
33754
+ if (leadingParsed.options.json === true) human = false;
33755
+ verbose = leadingParsed.options.verbose === true;
33756
+ const leadingSelector = stringOption(leadingParsed, "jq");
33757
+ if (leadingSelector !== void 0) {
33758
+ select = compileSelector(leadingSelector);
33759
+ human = false;
33760
+ }
33761
+ const [word] = afterGlobals;
33762
+ if (word === void 0) {
33763
+ if (leadingParsed.options.version === true) {
33764
+ return finish(versionOutcome());
33765
+ }
33425
33766
  io.stdout.write(usage());
33426
33767
  return EXIT.ok;
33427
33768
  }
33428
- if (word === "--version" || word === "-v" || word === "version") {
33429
- io.stdout.write(`${VERSION}
33430
- `);
33431
- return EXIT.ok;
33769
+ if (word === "version") {
33770
+ const versionParsed = parseArguments(
33771
+ [...leading, ...afterGlobals.slice(1)],
33772
+ GLOBAL
33773
+ );
33774
+ if (versionParsed.positionals.length > 0)
33775
+ throw new UsageError("version takes no arguments");
33776
+ if (versionParsed.options.json === true) human = false;
33777
+ verbose = versionParsed.options.verbose === true;
33778
+ const selector2 = stringOption(versionParsed, "jq");
33779
+ if (selector2 !== void 0) {
33780
+ select = compileSelector(selector2);
33781
+ human = false;
33782
+ }
33783
+ if (versionParsed.options.help === true) {
33784
+ io.stdout.write(
33785
+ `Usage: duang version [options]
33786
+ Print the CLI version.
33787
+
33788
+ Global options:
33789
+ ${formatOptionLines(GLOBAL)}
33790
+ `
33791
+ );
33792
+ return EXIT.ok;
33793
+ }
33794
+ return finish(versionOutcome());
33795
+ }
33796
+ if (word.startsWith("-") && word !== "-") {
33797
+ parseArguments(afterGlobals, GLOBAL);
33798
+ }
33799
+ if (word === "help") {
33800
+ if (leadingParsed.options.version === true)
33801
+ throw new UsageError("--version is used without a command");
33802
+ const target = afterGlobals.slice(1);
33803
+ if (target.length === 0) {
33804
+ io.stdout.write(usage());
33805
+ return EXIT.ok;
33806
+ }
33807
+ const matched = find(target);
33808
+ if (matched !== void 0 && matched.rest.length === 0) {
33809
+ io.stdout.write(formatCommandHelp(matched.command));
33810
+ return EXIT.ok;
33811
+ }
33812
+ if (target.length === 1) {
33813
+ const group2 = groupCommands(target[0]);
33814
+ if (group2.length > 0) {
33815
+ io.stdout.write(formatGroupHelp(target[0], group2));
33816
+ return EXIT.ok;
33817
+ }
33818
+ }
33819
+ throw new UsageError(`${target.join(" ")} is not a command`);
33820
+ }
33821
+ let found = find(afterGlobals);
33822
+ let extraGlobals = [];
33823
+ if (found === void 0) {
33824
+ const group2 = groupCommands(word);
33825
+ if (group2.length > 0) {
33826
+ const { leading: groupGlobals, rest: groupRest } = splitLeadingGlobals(
33827
+ afterGlobals.slice(1),
33828
+ GLOBAL
33829
+ );
33830
+ const combined = parseArguments([...leading, ...groupGlobals], GLOBAL);
33831
+ if (combined.options.json === true) human = false;
33832
+ verbose = combined.options.verbose === true;
33833
+ if (combined.options.version === true)
33834
+ throw new UsageError("--version is used without a command");
33835
+ if (groupRest.length === 0) {
33836
+ io.stdout.write(formatGroupHelp(word, group2));
33837
+ return EXIT.ok;
33838
+ }
33839
+ const next = groupRest[0];
33840
+ if (next.startsWith("-") && next !== "-") {
33841
+ parseArguments(groupRest, GLOBAL);
33842
+ }
33843
+ const resolved = find([word, ...groupRest]);
33844
+ if (resolved !== void 0) {
33845
+ found = resolved;
33846
+ extraGlobals = groupGlobals;
33847
+ } else {
33848
+ throw new UsageError(
33849
+ `${word} ${next} is not a command. Available: ${group2.map((command2) => command2.name).join(", ")}`
33850
+ );
33851
+ }
33852
+ } else {
33853
+ throw new UsageError(`${word} is not a command`);
33854
+ }
33432
33855
  }
33433
- const found = find(argv);
33434
- if (found === void 0) throw new UsageError(`${word} is not a command`);
33435
33856
  const { command, rest } = found;
33436
- const parsed = parsedFor(command, rest);
33857
+ const parsed = parsedFor(command, [...leading, ...extraGlobals, ...rest]);
33437
33858
  if (parsed.options.json === true) human = false;
33438
33859
  verbose = parsed.options.verbose === true;
33439
33860
  const selector = stringOption(parsed, "jq");
@@ -33441,25 +33862,16 @@ async function run3(argv, io) {
33441
33862
  select = compileSelector(selector);
33442
33863
  human = false;
33443
33864
  }
33865
+ if (parsed.options.version === true)
33866
+ throw new UsageError("--version is used without a command");
33444
33867
  if (parsed.options.help === true) {
33445
- io.stdout.write(
33446
- `duang ${command.name}${command.positionals === "" ? "" : ` ${command.positionals}`}
33447
- ${command.summary}
33448
-
33449
- Options:
33450
- ${Object.entries(
33451
- command.options
33452
- ).map(
33453
- ([name, spec]) => ` ${spec.short === void 0 ? "" : `-${spec.short}, `}--${name}${spec.value === void 0 ? "" : ` <${spec.value}>`}${spec.repeatable ? " ..." : ""} ${spec.description}`
33454
- ).join("\n")}
33455
- `
33456
- );
33868
+ io.stdout.write(formatCommandHelp(command));
33457
33869
  return EXIT.ok;
33458
33870
  }
33459
33871
  const context3 = {
33460
33872
  io,
33461
33873
  credentials: new Credentials(io.credentials),
33462
- origin: () => apiOrigin(io.env, stringOption(parsed, "api-base")),
33874
+ origin: () => apiOrigin(io.env, stringOption(parsed, "api-url")),
33463
33875
  human
33464
33876
  };
33465
33877
  return finish(await command.run(context3, parsed));