@codeforbreakfast/commy-mcp 0.12.0 → 0.14.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 (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +903 -657
package/server.js CHANGED
@@ -2006,12 +2006,12 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
2006
2006
  if (a && b && typeof a == "object" && typeof b == "object") {
2007
2007
  if (a.constructor !== b.constructor)
2008
2008
  return false;
2009
- var length5, i, keys6;
2009
+ var length6, i, keys6;
2010
2010
  if (Array.isArray(a)) {
2011
- length5 = a.length;
2012
- if (length5 != b.length)
2011
+ length6 = a.length;
2012
+ if (length6 != b.length)
2013
2013
  return false;
2014
- for (i = length5;i-- !== 0; )
2014
+ for (i = length6;i-- !== 0; )
2015
2015
  if (!equal(a[i], b[i]))
2016
2016
  return false;
2017
2017
  return true;
@@ -2023,13 +2023,13 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
2023
2023
  if (a.toString !== Object.prototype.toString)
2024
2024
  return a.toString() === b.toString();
2025
2025
  keys6 = Object.keys(a);
2026
- length5 = keys6.length;
2027
- if (length5 !== Object.keys(b).length)
2026
+ length6 = keys6.length;
2027
+ if (length6 !== Object.keys(b).length)
2028
2028
  return false;
2029
- for (i = length5;i-- !== 0; )
2029
+ for (i = length6;i-- !== 0; )
2030
2030
  if (!Object.prototype.hasOwnProperty.call(b, keys6[i]))
2031
2031
  return false;
2032
- for (i = length5;i-- !== 0; ) {
2032
+ for (i = length6;i-- !== 0; ) {
2033
2033
  var key = keys6[i];
2034
2034
  if (!equal(a[key], b[key]))
2035
2035
  return false;
@@ -2193,8 +2193,8 @@ var require_resolve = __commonJS((exports) => {
2193
2193
  }
2194
2194
  return count4;
2195
2195
  }
2196
- function getFullPath(resolver, id3 = "", normalize2) {
2197
- if (normalize2 !== false)
2196
+ function getFullPath(resolver, id3 = "", normalize3) {
2197
+ if (normalize3 !== false)
2198
2198
  id3 = normalizeId(id3);
2199
2199
  const p = resolver.parse(id3);
2200
2200
  return _getFullPath(resolver, p);
@@ -3481,7 +3481,7 @@ var require_schemes = __commonJS((exports, module) => {
3481
3481
  var require_fast_uri = __commonJS((exports, module) => {
3482
3482
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
3483
3483
  var { SCHEMES, getSchemeHandler } = require_schemes();
3484
- function normalize2(uri, options5) {
3484
+ function normalize3(uri, options5) {
3485
3485
  if (typeof uri === "string") {
3486
3486
  uri = serialize2(parse7(uri, options5), options5);
3487
3487
  } else if (typeof uri === "object") {
@@ -3716,7 +3716,7 @@ var require_fast_uri = __commonJS((exports, module) => {
3716
3716
  }
3717
3717
  var fastUri = {
3718
3718
  SCHEMES,
3719
- normalize: normalize2,
3719
+ normalize: normalize3,
3720
3720
  resolve: resolve3,
3721
3721
  resolveComponent,
3722
3722
  equal,
@@ -4537,11 +4537,11 @@ var require_ucs2length = __commonJS((exports) => {
4537
4537
  Object.defineProperty(exports, "__esModule", { value: true });
4538
4538
  function ucs2length(str) {
4539
4539
  const len = str.length;
4540
- let length5 = 0;
4540
+ let length6 = 0;
4541
4541
  let pos = 0;
4542
4542
  let value5;
4543
4543
  while (pos < len) {
4544
- length5++;
4544
+ length6++;
4545
4545
  value5 = str.charCodeAt(pos++);
4546
4546
  if (value5 >= 55296 && value5 <= 56319 && pos < len) {
4547
4547
  value5 = str.charCodeAt(pos);
@@ -4549,7 +4549,7 @@ var require_ucs2length = __commonJS((exports) => {
4549
4549
  pos++;
4550
4550
  }
4551
4551
  }
4552
- return length5;
4552
+ return length6;
4553
4553
  }
4554
4554
  exports.default = ucs2length;
4555
4555
  ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
@@ -6844,6 +6844,7 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
6844
6844
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
6845
6845
  var isStrictEquivalent = (x, y) => x === y;
6846
6846
  var strict = () => isStrictEquivalent;
6847
+ var string = /* @__PURE__ */ strict();
6847
6848
  var number = /* @__PURE__ */ strict();
6848
6849
  var mapInput = /* @__PURE__ */ dual(2, (self, f) => make((x, y) => self(f(x), f(y))));
6849
6850
  var Date2 = /* @__PURE__ */ mapInput(number, (date) => date.getTime());
@@ -7238,22 +7239,22 @@ var hash = (self) => {
7238
7239
  case "number":
7239
7240
  return number2(self);
7240
7241
  case "bigint":
7241
- return string(self.toString(10));
7242
+ return string2(self.toString(10));
7242
7243
  case "boolean":
7243
- return string(String(self));
7244
+ return string2(String(self));
7244
7245
  case "symbol":
7245
- return string(String(self));
7246
+ return string2(String(self));
7246
7247
  case "string":
7247
- return string(self);
7248
+ return string2(self);
7248
7249
  case "undefined":
7249
- return string("undefined");
7250
+ return string2("undefined");
7250
7251
  case "function":
7251
7252
  case "object": {
7252
7253
  if (self === null) {
7253
- return string("null");
7254
+ return string2("null");
7254
7255
  } else if (self instanceof Date) {
7255
7256
  if (Number.isNaN(self.getTime())) {
7256
- return string("Invalid Date");
7257
+ return string2("Invalid Date");
7257
7258
  }
7258
7259
  return hash(self.toISOString());
7259
7260
  } else if (self instanceof URL) {
@@ -7290,7 +7291,7 @@ var number2 = (n) => {
7290
7291
  }
7291
7292
  return optimize(h);
7292
7293
  };
7293
- var string = (str) => {
7294
+ var string2 = (str) => {
7294
7295
  let h = 5381, i = str.length;
7295
7296
  while (i) {
7296
7297
  h = h * 33 ^ str.charCodeAt(--i);
@@ -7300,7 +7301,7 @@ var string = (str) => {
7300
7301
  var structureKeys = (o, keys) => {
7301
7302
  let h = 12289;
7302
7303
  for (let i = 0;i < keys.length; i++) {
7303
- h ^= pipe(string(keys[i]), combine(hash(o[keys[i]])));
7304
+ h ^= pipe(string2(keys[i]), combine(hash(o[keys[i]])));
7304
7305
  }
7305
7306
  return optimize(h);
7306
7307
  };
@@ -7990,7 +7991,7 @@ var exports_Order = {};
7990
7991
  __export(exports_Order, {
7991
7992
  tuple: () => tuple2,
7992
7993
  struct: () => struct2,
7993
- string: () => string2,
7994
+ string: () => string3,
7994
7995
  reverse: () => reverse,
7995
7996
  productMany: () => productMany2,
7996
7997
  product: () => product2,
@@ -8016,7 +8017,7 @@ __export(exports_Order, {
8016
8017
  Date: () => Date3
8017
8018
  });
8018
8019
  var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
8019
- var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
8020
+ var string3 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
8020
8021
  var number3 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
8021
8022
  var boolean = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
8022
8023
  var bigint = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
@@ -12215,7 +12216,7 @@ var FiberIdTypeId = /* @__PURE__ */ Symbol.for(FiberIdSymbolKey);
12215
12216
  var OP_NONE = "None";
12216
12217
  var OP_RUNTIME = "Runtime";
12217
12218
  var OP_COMPOSITE = "Composite";
12218
- var emptyHash = /* @__PURE__ */ string(`${FiberIdSymbolKey}-${OP_NONE}`);
12219
+ var emptyHash = /* @__PURE__ */ string2(`${FiberIdSymbolKey}-${OP_NONE}`);
12219
12220
 
12220
12221
  class None {
12221
12222
  [FiberIdTypeId] = FiberIdTypeId;
@@ -12252,7 +12253,7 @@ class Runtime {
12252
12253
  this.startTimeMillis = startTimeMillis;
12253
12254
  }
12254
12255
  [symbol]() {
12255
- return cached(this, string(`${FiberIdSymbolKey}-${this._tag}-${this.id}-${this.startTimeMillis}`));
12256
+ return cached(this, string2(`${FiberIdSymbolKey}-${this._tag}-${this.id}-${this.startTimeMillis}`));
12256
12257
  }
12257
12258
  [symbol2](that) {
12258
12259
  return isFiberId(that) && that._tag === OP_RUNTIME && this.id === that.id && this.startTimeMillis === that.startTimeMillis;
@@ -12284,7 +12285,7 @@ class Composite {
12284
12285
  }
12285
12286
  _hash;
12286
12287
  [symbol]() {
12287
- return pipe(string(`${FiberIdSymbolKey}-${this._tag}`), combine(hash(this.left)), combine(hash(this.right)), cached(this));
12288
+ return pipe(string2(`${FiberIdSymbolKey}-${this._tag}`), combine(hash(this.left)), combine(hash(this.right)), cached(this));
12288
12289
  }
12289
12290
  [symbol2](that) {
12290
12291
  return isFiberId(that) && that._tag === OP_COMPOSITE && equals(this.left, that.left) && equals(this.right, that.right);
@@ -12538,7 +12539,7 @@ var makeCons = (head3, tail3) => {
12538
12539
  cons.tail = tail3;
12539
12540
  return cons;
12540
12541
  };
12541
- var NilHash = /* @__PURE__ */ string("Nil");
12542
+ var NilHash = /* @__PURE__ */ string2("Nil");
12542
12543
  var NilProto = {
12543
12544
  [TypeId9]: TypeId9,
12544
12545
  _tag: "Nil",
@@ -13397,7 +13398,7 @@ class EffectPrimitiveFailure {
13397
13398
  return exitIsExit(that) && that._op === "Failure" && equals(this.effect_instruction_i0, that.effect_instruction_i0);
13398
13399
  }
13399
13400
  [symbol]() {
13400
- return pipe(string(this._tag), combine(hash(this.effect_instruction_i0)), cached(this));
13401
+ return pipe(string2(this._tag), combine(hash(this.effect_instruction_i0)), cached(this));
13401
13402
  }
13402
13403
  get cause() {
13403
13404
  return this.effect_instruction_i0;
@@ -13438,7 +13439,7 @@ class EffectPrimitiveSuccess {
13438
13439
  return exitIsExit(that) && that._op === "Success" && equals(this.effect_instruction_i0, that.effect_instruction_i0);
13439
13440
  }
13440
13441
  [symbol]() {
13441
- return pipe(string(this._tag), combine(hash(this.effect_instruction_i0)), cached(this));
13442
+ return pipe(string2(this._tag), combine(hash(this.effect_instruction_i0)), cached(this));
13442
13443
  }
13443
13444
  get value() {
13444
13445
  return this.effect_instruction_i0;
@@ -14664,7 +14665,9 @@ var make20 = () => new ClockImpl;
14664
14665
 
14665
14666
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Number.js
14666
14667
  var Order2 = number3;
14668
+ var greaterThanOrEqualTo3 = /* @__PURE__ */ greaterThanOrEqualTo(Order2);
14667
14669
  var clamp4 = /* @__PURE__ */ clamp(Order2);
14670
+ var sign = (n) => Order2(n, 0);
14668
14671
  var remainder = /* @__PURE__ */ dual(2, (dividend, divisor) => {
14669
14672
  const selfDecCount = (dividend.toString().split(".")[1] || "").length;
14670
14673
  const divisorDecCount = (divisor.toString().split(".")[1] || "").length;
@@ -14695,7 +14698,7 @@ var parse = (s) => {
14695
14698
  };
14696
14699
 
14697
14700
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/RegExp.js
14698
- var escape2 = (string3) => string3.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
14701
+ var escape2 = (string4) => string4.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
14699
14702
 
14700
14703
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/opCodes/configError.js
14701
14704
  var OP_AND = "And";
@@ -15760,7 +15763,7 @@ __export(exports_Config, {
15760
15763
  sync: () => sync3,
15761
15764
  suspend: () => suspend3,
15762
15765
  succeed: () => succeed3,
15763
- string: () => string4,
15766
+ string: () => string5,
15764
15767
  secret: () => secret2,
15765
15768
  repeat: () => repeat2,
15766
15769
  redacted: () => redacted2,
@@ -16013,7 +16016,7 @@ var literal = (...literals) => (name) => {
16013
16016
  return name === undefined ? config2 : nested3(config2, name);
16014
16017
  };
16015
16018
  var logLevel = (name) => {
16016
- const config2 = mapOrFail(string3(), (value2) => {
16019
+ const config2 = mapOrFail(string4(), (value2) => {
16017
16020
  const label = value2.toUpperCase();
16018
16021
  const level = allLogLevels.find((level2) => level2.label === label);
16019
16022
  return level === undefined ? left2(InvalidData([], `Expected a log level but received ${formatUnknown(value2)}`)) : right2(level);
@@ -16021,7 +16024,7 @@ var logLevel = (name) => {
16021
16024
  return name === undefined ? config2 : nested3(config2, name);
16022
16025
  };
16023
16026
  var duration = (name) => {
16024
- const config2 = mapOrFail(string3(), (value2) => {
16027
+ const config2 = mapOrFail(string4(), (value2) => {
16025
16028
  const duration2 = decodeUnknown(value2);
16026
16029
  return fromOption2(duration2, () => InvalidData([], `Expected a duration but received ${formatUnknown(value2)}`));
16027
16030
  });
@@ -16089,11 +16092,11 @@ var secret = (name) => {
16089
16092
  return name === undefined ? config2 : nested3(config2, name);
16090
16093
  };
16091
16094
  var redacted = (nameOrConfig) => {
16092
- const config2 = isConfig(nameOrConfig) ? nameOrConfig : string3(nameOrConfig);
16095
+ const config2 = isConfig(nameOrConfig) ? nameOrConfig : string4(nameOrConfig);
16093
16096
  return map13(config2, make25);
16094
16097
  };
16095
16098
  var branded = /* @__PURE__ */ dual(2, (nameOrConfig, constructor) => {
16096
- const config2 = isConfig(nameOrConfig) ? nameOrConfig : string3(nameOrConfig);
16099
+ const config2 = isConfig(nameOrConfig) ? nameOrConfig : string4(nameOrConfig);
16097
16100
  return mapOrFail(config2, (a) => constructor.either(a).pipe(mapLeft((brandErrors) => InvalidData([], brandErrors.map((brandError) => brandError.message).join(`
16098
16101
  `)))));
16099
16102
  });
@@ -16101,7 +16104,7 @@ var hashSet2 = (config2, name) => {
16101
16104
  const newConfig = map13(chunk(config2), fromIterable6);
16102
16105
  return name === undefined ? newConfig : nested3(newConfig, name);
16103
16106
  };
16104
- var string3 = (name) => {
16107
+ var string4 = (name) => {
16105
16108
  const config2 = primitive("a text property", right2);
16106
16109
  return name === undefined ? config2 : nested3(config2, name);
16107
16110
  };
@@ -16236,7 +16239,7 @@ var secret2 = secret;
16236
16239
  var redacted2 = redacted;
16237
16240
  var branded2 = branded;
16238
16241
  var hashSet3 = hashSet2;
16239
- var string4 = string3;
16242
+ var string5 = string4;
16240
16243
  var nonEmptyString2 = nonEmptyString;
16241
16244
  var succeed3 = succeed2;
16242
16245
  var suspend3 = suspend2;
@@ -16559,7 +16562,7 @@ __export(exports_Effect, {
16559
16562
  replicate: () => replicate3,
16560
16563
  repeatOrElse: () => repeatOrElse,
16561
16564
  repeatN: () => repeatN2,
16562
- repeat: () => repeat3,
16565
+ repeat: () => repeat4,
16563
16566
  reduceWhile: () => reduceWhile2,
16564
16567
  reduceRight: () => reduceRight4,
16565
16568
  reduceEffect: () => reduceEffect3,
@@ -16599,7 +16602,7 @@ __export(exports_Effect, {
16599
16602
  matchEffect: () => matchEffect3,
16600
16603
  matchCauseEffect: () => matchCauseEffect3,
16601
16604
  matchCause: () => matchCause3,
16602
- match: () => match15,
16605
+ match: () => match16,
16603
16606
  mapInputContext: () => mapInputContext3,
16604
16607
  mapErrorCause: () => mapErrorCause3,
16605
16608
  mapError: () => mapError4,
@@ -17075,7 +17078,7 @@ var FiberStatusTypeId = /* @__PURE__ */ Symbol.for(FiberStatusSymbolKey);
17075
17078
  var OP_DONE = "Done";
17076
17079
  var OP_RUNNING = "Running";
17077
17080
  var OP_SUSPENDED = "Suspended";
17078
- var DoneHash = /* @__PURE__ */ string(`${FiberStatusSymbolKey}-${OP_DONE}`);
17081
+ var DoneHash = /* @__PURE__ */ string2(`${FiberStatusSymbolKey}-${OP_DONE}`);
17079
17082
 
17080
17083
  class Done {
17081
17084
  [FiberStatusTypeId] = FiberStatusTypeId;
@@ -17437,7 +17440,7 @@ var makeExit = (options) => {
17437
17440
  return isMicroExit(that) && that._tag === options.op && equals(this[args], that[args]);
17438
17441
  },
17439
17442
  [symbol]() {
17440
- return cached(this, combine(string(options.op))(hash(this[args])));
17443
+ return cached(this, combine(string2(options.op))(hash(this[args])));
17441
17444
  }
17442
17445
  };
17443
17446
  return function(value2) {
@@ -17926,7 +17929,7 @@ class MetricLabelImpl {
17926
17929
  constructor(key, value2) {
17927
17930
  this.key = key;
17928
17931
  this.value = value2;
17929
- this._hash = string(MetricLabelSymbolKey + this.key + this.value);
17932
+ this._hash = string2(MetricLabelSymbolKey + this.key + this.value);
17930
17933
  }
17931
17934
  [symbol]() {
17932
17935
  return this._hash;
@@ -19231,7 +19234,7 @@ class MetricBoundariesImpl {
19231
19234
  [MetricBoundariesTypeId] = MetricBoundariesTypeId;
19232
19235
  constructor(values6) {
19233
19236
  this.values = values6;
19234
- this._hash = pipe(string(MetricBoundariesSymbolKey), combine(array2(this.values)));
19237
+ this._hash = pipe(string2(MetricBoundariesSymbolKey), combine(array2(this.values)));
19235
19238
  }
19236
19239
  _hash;
19237
19240
  [symbol]() {
@@ -19277,7 +19280,7 @@ class CounterKeyType {
19277
19280
  constructor(incremental, bigint2) {
19278
19281
  this.incremental = incremental;
19279
19282
  this.bigint = bigint2;
19280
- this._hash = string(CounterKeyTypeSymbolKey);
19283
+ this._hash = string2(CounterKeyTypeSymbolKey);
19281
19284
  }
19282
19285
  _hash;
19283
19286
  [symbol]() {
@@ -19296,7 +19299,7 @@ class HistogramKeyType {
19296
19299
  [HistogramKeyTypeTypeId] = HistogramKeyTypeTypeId;
19297
19300
  constructor(boundaries) {
19298
19301
  this.boundaries = boundaries;
19299
- this._hash = pipe(string(HistogramKeyTypeSymbolKey), combine(hash(this.boundaries)));
19302
+ this._hash = pipe(string2(HistogramKeyTypeSymbolKey), combine(hash(this.boundaries)));
19300
19303
  }
19301
19304
  _hash;
19302
19305
  [symbol]() {
@@ -19338,7 +19341,7 @@ class MetricKeyImpl {
19338
19341
  this.keyType = keyType;
19339
19342
  this.description = description;
19340
19343
  this.tags = tags;
19341
- this._hash = pipe(string(this.name + this.description), combine(hash(this.keyType)), combine(array2(this.tags)));
19344
+ this._hash = pipe(string2(this.name + this.description), combine(hash(this.keyType)), combine(array2(this.tags)));
19342
19345
  }
19343
19346
  _hash;
19344
19347
  [symbol]() {
@@ -19549,7 +19552,7 @@ class FrequencyState {
19549
19552
  }
19550
19553
  _hash;
19551
19554
  [symbol]() {
19552
- return pipe(string(FrequencyStateSymbolKey), combine(array2(fromIterable2(this.occurrences.entries()))), cached(this));
19555
+ return pipe(string2(FrequencyStateSymbolKey), combine(array2(fromIterable2(this.occurrences.entries()))), cached(this));
19553
19556
  }
19554
19557
  [symbol2](that) {
19555
19558
  return isFrequencyState(that) && arrayEquals(fromIterable2(this.occurrences.entries()), fromIterable2(that.occurrences.entries()));
@@ -24044,7 +24047,7 @@ var ProtoTimeZoneNamed = {
24044
24047
  ...ProtoTimeZone,
24045
24048
  _tag: "Named",
24046
24049
  [symbol]() {
24047
- return cached(this, string(`Named:${this.id}`));
24050
+ return cached(this, string2(`Named:${this.id}`));
24048
24051
  },
24049
24052
  [symbol2](that) {
24050
24053
  return isTimeZone(that) && that._tag === "Named" && this.id === that.id;
@@ -24064,7 +24067,7 @@ var ProtoTimeZoneOffset = {
24064
24067
  ...ProtoTimeZone,
24065
24068
  _tag: "Offset",
24066
24069
  [symbol]() {
24067
- return cached(this, string(`Offset:${this.offset}`));
24070
+ return cached(this, string2(`Offset:${this.offset}`));
24068
24071
  },
24069
24072
  [symbol2](that) {
24070
24073
  return isTimeZone(that) && that._tag === "Offset" && this.offset === that.offset;
@@ -24383,8 +24386,8 @@ var parseOffset = (offset) => {
24383
24386
  if (match14 === null) {
24384
24387
  return null;
24385
24388
  }
24386
- const [, sign, hours2, minutes2] = match14;
24387
- return (sign === "+" ? 1 : -1) * (Number(hours2) * 60 + Number(minutes2)) * 60 * 1000;
24389
+ const [, sign2, hours2, minutes2] = match14;
24390
+ return (sign2 === "+" ? 1 : -1) * (Number(hours2) * 60 + Number(minutes2)) * 60 * 1000;
24388
24391
  };
24389
24392
  var calculateNamedOffset = (utcMillis, adjustedMillis, zone) => {
24390
24393
  const offset = zone.format.formatToParts(utcMillis).find((_) => _.type === "timeZoneName")?.value ?? "";
@@ -24418,6 +24421,65 @@ var formatIsoOffset = (self) => {
24418
24421
  var formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
24419
24422
 
24420
24423
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/String.js
24424
+ var exports_String = {};
24425
+ __export(exports_String, {
24426
+ uncapitalize: () => uncapitalize,
24427
+ trimStart: () => trimStart,
24428
+ trimEnd: () => trimEnd,
24429
+ trim: () => trim,
24430
+ toUpperCase: () => toUpperCase,
24431
+ toLowerCase: () => toLowerCase,
24432
+ toLocaleUpperCase: () => toLocaleUpperCase,
24433
+ toLocaleLowerCase: () => toLocaleLowerCase,
24434
+ takeRight: () => takeRight3,
24435
+ takeLeft: () => takeLeft,
24436
+ substring: () => substring,
24437
+ stripMarginWith: () => stripMarginWith,
24438
+ stripMargin: () => stripMargin,
24439
+ startsWith: () => startsWith,
24440
+ split: () => split3,
24441
+ snakeToPascal: () => snakeToPascal,
24442
+ snakeToKebab: () => snakeToKebab,
24443
+ snakeToCamel: () => snakeToCamel,
24444
+ slice: () => slice,
24445
+ search: () => search,
24446
+ replaceAll: () => replaceAll,
24447
+ replace: () => replace5,
24448
+ repeat: () => repeat3,
24449
+ pascalToSnake: () => pascalToSnake,
24450
+ padStart: () => padStart,
24451
+ padEnd: () => padEnd,
24452
+ normalize: () => normalize,
24453
+ matchAll: () => matchAll,
24454
+ match: () => match14,
24455
+ localeCompare: () => localeCompare,
24456
+ linesWithSeparators: () => linesWithSeparators,
24457
+ linesIterator: () => linesIterator,
24458
+ length: () => length2,
24459
+ lastIndexOf: () => lastIndexOf,
24460
+ kebabToSnake: () => kebabToSnake,
24461
+ isString: () => isString2,
24462
+ isNonEmpty: () => isNonEmpty6,
24463
+ isEmpty: () => isEmpty9,
24464
+ indexOf: () => indexOf,
24465
+ includes: () => includes,
24466
+ endsWith: () => endsWith,
24467
+ empty: () => empty33,
24468
+ concat: () => concat2,
24469
+ codePointAt: () => codePointAt,
24470
+ charCodeAt: () => charCodeAt,
24471
+ charAt: () => charAt,
24472
+ capitalize: () => capitalize,
24473
+ camelToSnake: () => camelToSnake,
24474
+ at: () => at,
24475
+ Order: () => Order6,
24476
+ Equivalence: () => Equivalence3
24477
+ });
24478
+ var isString2 = isString;
24479
+ var Equivalence3 = string;
24480
+ var Order6 = string3;
24481
+ var empty33 = "";
24482
+ var concat2 = /* @__PURE__ */ dual(2, (self, that) => self + that);
24421
24483
  var toUpperCase = (self) => self.toUpperCase();
24422
24484
  var toLowerCase = (self) => self.toLowerCase();
24423
24485
  var capitalize = (self) => {
@@ -24430,7 +24492,128 @@ var uncapitalize = (self) => {
24430
24492
  return self;
24431
24493
  return toLowerCase(self[0]) + self.slice(1);
24432
24494
  };
24495
+ var replace5 = (searchValue, replaceValue) => (self) => self.replace(searchValue, replaceValue);
24496
+ var trim = (self) => self.trim();
24497
+ var trimStart = (self) => self.trimStart();
24498
+ var trimEnd = (self) => self.trimEnd();
24499
+ var slice = (start3, end3) => (self) => self.slice(start3, end3);
24500
+ var isEmpty9 = (self) => self.length === 0;
24433
24501
  var isNonEmpty6 = (self) => self.length > 0;
24502
+ var length2 = (self) => self.length;
24503
+ var split3 = /* @__PURE__ */ dual(2, (self, separator) => {
24504
+ const out = self.split(separator);
24505
+ return isNonEmptyArray(out) ? out : [self];
24506
+ });
24507
+ var includes = (searchString, position) => (self) => self.includes(searchString, position);
24508
+ var startsWith = (searchString, position) => (self) => self.startsWith(searchString, position);
24509
+ var endsWith = (searchString, position) => (self) => self.endsWith(searchString, position);
24510
+ var charCodeAt = /* @__PURE__ */ dual(2, (self, index) => filter(some3(self.charCodeAt(index)), (charCode) => !isNaN(charCode)));
24511
+ var substring = (start3, end3) => (self) => self.substring(start3, end3);
24512
+ var at = /* @__PURE__ */ dual(2, (self, index) => fromNullable2(self.at(index)));
24513
+ var charAt = /* @__PURE__ */ dual(2, (self, index) => filter(some3(self.charAt(index)), isNonEmpty6));
24514
+ var codePointAt = /* @__PURE__ */ dual(2, (self, index) => fromNullable2(self.codePointAt(index)));
24515
+ var indexOf = (searchString) => (self) => filter(some3(self.indexOf(searchString)), greaterThanOrEqualTo3(0));
24516
+ var lastIndexOf = (searchString) => (self) => filter(some3(self.lastIndexOf(searchString)), greaterThanOrEqualTo3(0));
24517
+ var localeCompare = (that, locales, options) => (self) => sign(self.localeCompare(that, locales, options));
24518
+ var match14 = (regexp) => (self) => fromNullable2(self.match(regexp));
24519
+ var matchAll = (regexp) => (self) => self.matchAll(regexp);
24520
+ var normalize = (form) => (self) => self.normalize(form);
24521
+ var padEnd = (maxLength, fillString) => (self) => self.padEnd(maxLength, fillString);
24522
+ var padStart = (maxLength, fillString) => (self) => self.padStart(maxLength, fillString);
24523
+ var repeat3 = (count) => (self) => self.repeat(count);
24524
+ var replaceAll = (searchValue, replaceValue) => (self) => self.replaceAll(searchValue, replaceValue);
24525
+ var search = /* @__PURE__ */ dual(2, (self, regexp) => filter(some3(self.search(regexp)), greaterThanOrEqualTo3(0)));
24526
+ var toLocaleLowerCase = (locale) => (self) => self.toLocaleLowerCase(locale);
24527
+ var toLocaleUpperCase = (locale) => (self) => self.toLocaleUpperCase(locale);
24528
+ var takeLeft = /* @__PURE__ */ dual(2, (self, n) => self.slice(0, Math.max(n, 0)));
24529
+ var takeRight3 = /* @__PURE__ */ dual(2, (self, n) => self.slice(Math.max(0, self.length - Math.floor(n)), Infinity));
24530
+ var CR = 13;
24531
+ var LF = 10;
24532
+ var linesIterator = (self) => linesSeparated(self, true);
24533
+ var linesWithSeparators = (s) => linesSeparated(s, false);
24534
+ var stripMarginWith = /* @__PURE__ */ dual(2, (self, marginChar) => {
24535
+ let out = "";
24536
+ for (const line of linesWithSeparators(self)) {
24537
+ let index = 0;
24538
+ while (index < line.length && line.charAt(index) <= " ") {
24539
+ index = index + 1;
24540
+ }
24541
+ const stripped = index < line.length && line.charAt(index) === marginChar ? line.substring(index + 1) : line;
24542
+ out = out + stripped;
24543
+ }
24544
+ return out;
24545
+ });
24546
+ var stripMargin = (self) => stripMarginWith(self, "|");
24547
+ var snakeToCamel = (self) => {
24548
+ let str = self[0];
24549
+ for (let i = 1;i < self.length; i++) {
24550
+ str += self[i] === "_" ? self[++i].toUpperCase() : self[i];
24551
+ }
24552
+ return str;
24553
+ };
24554
+ var snakeToPascal = (self) => {
24555
+ let str = self[0].toUpperCase();
24556
+ for (let i = 1;i < self.length; i++) {
24557
+ str += self[i] === "_" ? self[++i].toUpperCase() : self[i];
24558
+ }
24559
+ return str;
24560
+ };
24561
+ var snakeToKebab = (self) => self.replace(/_/g, "-");
24562
+ var camelToSnake = (self) => self.replace(/([A-Z])/g, "_$1").toLowerCase();
24563
+ var pascalToSnake = (self) => (self.slice(0, 1) + self.slice(1).replace(/([A-Z])/g, "_$1")).toLowerCase();
24564
+ var kebabToSnake = (self) => self.replace(/-/g, "_");
24565
+
24566
+ class LinesIterator {
24567
+ s;
24568
+ stripped;
24569
+ index;
24570
+ length;
24571
+ constructor(s, stripped = false) {
24572
+ this.s = s;
24573
+ this.stripped = stripped;
24574
+ this.index = 0;
24575
+ this.length = s.length;
24576
+ }
24577
+ next() {
24578
+ if (this.done) {
24579
+ return {
24580
+ done: true,
24581
+ value: undefined
24582
+ };
24583
+ }
24584
+ const start3 = this.index;
24585
+ while (!this.done && !isLineBreak(this.s[this.index])) {
24586
+ this.index = this.index + 1;
24587
+ }
24588
+ let end3 = this.index;
24589
+ if (!this.done) {
24590
+ const char = this.s[this.index];
24591
+ this.index = this.index + 1;
24592
+ if (!this.done && isLineBreak2(char, this.s[this.index])) {
24593
+ this.index = this.index + 1;
24594
+ }
24595
+ if (!this.stripped) {
24596
+ end3 = this.index;
24597
+ }
24598
+ }
24599
+ return {
24600
+ done: false,
24601
+ value: this.s.substring(start3, end3)
24602
+ };
24603
+ }
24604
+ [Symbol.iterator]() {
24605
+ return new LinesIterator(this.s, this.stripped);
24606
+ }
24607
+ get done() {
24608
+ return this.index >= this.length;
24609
+ }
24610
+ }
24611
+ var isLineBreak = (char) => {
24612
+ const code = char.charCodeAt(0);
24613
+ return code === CR || code === LF;
24614
+ };
24615
+ var isLineBreak2 = (char0, char1) => char0.charCodeAt(0) === CR && char1.charCodeAt(0) === LF;
24616
+ var linesSeparated = (self, stripped) => new LinesIterator(self, stripped);
24434
24617
 
24435
24618
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Cron.js
24436
24619
  var TypeId17 = /* @__PURE__ */ Symbol.for("effect/Cron");
@@ -24570,7 +24753,7 @@ var parse2 = (cron, tz) => {
24570
24753
  weekdays: parseSegment(weekdays, weekdayOptions)
24571
24754
  }).pipe(map(make45));
24572
24755
  };
24573
- var match14 = (cron, date3) => {
24756
+ var match15 = (cron, date3) => {
24574
24757
  const parts2 = unsafeMakeZoned(date3, {
24575
24758
  timeZone: getOrUndefined2(cron.tz)
24576
24759
  }).pipe(toParts);
@@ -24734,10 +24917,10 @@ var stepCron = (cron, startFrom, direction) => {
24734
24917
  });
24735
24918
  return toDateUtc(result);
24736
24919
  };
24737
- var Equivalence3 = /* @__PURE__ */ make((self, that) => restrictionsEquals(self.seconds, that.seconds) && restrictionsEquals(self.minutes, that.minutes) && restrictionsEquals(self.hours, that.hours) && restrictionsEquals(self.days, that.days) && restrictionsEquals(self.months, that.months) && restrictionsEquals(self.weekdays, that.weekdays));
24920
+ var Equivalence4 = /* @__PURE__ */ make((self, that) => restrictionsEquals(self.seconds, that.seconds) && restrictionsEquals(self.minutes, that.minutes) && restrictionsEquals(self.hours, that.hours) && restrictionsEquals(self.days, that.days) && restrictionsEquals(self.months, that.months) && restrictionsEquals(self.weekdays, that.weekdays));
24738
24921
  var restrictionsArrayEquals = /* @__PURE__ */ array(number);
24739
24922
  var restrictionsEquals = (self, that) => restrictionsArrayEquals(fromIterable2(self), fromIterable2(that));
24740
- var equals3 = /* @__PURE__ */ dual(2, (self, that) => Equivalence3(self, that));
24923
+ var equals3 = /* @__PURE__ */ dual(2, (self, that) => Equivalence4(self, that));
24741
24924
  var secondOptions = {
24742
24925
  min: 0,
24743
24926
  max: 59
@@ -25035,7 +25218,7 @@ var cron = (expression, tz) => {
25035
25218
  const cron2 = parsed.right;
25036
25219
  const date3 = new Date(now);
25037
25220
  let next4;
25038
- if (initial && match14(cron2, date3)) {
25221
+ if (initial && match15(cron2, date3)) {
25039
25222
  next4 = now;
25040
25223
  }
25041
25224
  next4 = next2(cron2, date3).getTime();
@@ -25632,15 +25815,15 @@ var makeNode = (value2) => ({
25632
25815
  prev: undefined,
25633
25816
  next: undefined
25634
25817
  });
25635
- var empty33 = () => {
25818
+ var empty34 = () => {
25636
25819
  const list = Object.create(MutableListProto);
25637
25820
  list.head = undefined;
25638
25821
  list.tail = undefined;
25639
25822
  list._length = 0;
25640
25823
  return list;
25641
25824
  };
25642
- var isEmpty9 = (self) => length2(self) === 0;
25643
- var length2 = (self) => self._length;
25825
+ var isEmpty10 = (self) => length3(self) === 0;
25826
+ var length3 = (self) => self._length;
25644
25827
  var append3 = /* @__PURE__ */ dual(2, (self, value2) => {
25645
25828
  const node = makeNode(value2);
25646
25829
  if (self.head === undefined) {
@@ -25713,17 +25896,17 @@ var MutableQueueProto = {
25713
25896
  };
25714
25897
  var make46 = (capacity) => {
25715
25898
  const queue = Object.create(MutableQueueProto);
25716
- queue.queue = empty33();
25899
+ queue.queue = empty34();
25717
25900
  queue.capacity = capacity;
25718
25901
  return queue;
25719
25902
  };
25720
25903
  var bounded = (capacity) => make46(capacity);
25721
25904
  var unbounded = () => make46(undefined);
25722
- var length3 = (self) => length2(self.queue);
25723
- var isEmpty10 = (self) => isEmpty9(self.queue);
25905
+ var length4 = (self) => length3(self.queue);
25906
+ var isEmpty11 = (self) => isEmpty10(self.queue);
25724
25907
  var capacity = (self) => self.capacity === undefined ? Infinity : self.capacity;
25725
25908
  var offer = /* @__PURE__ */ dual(2, (self, value2) => {
25726
- const queueLength = length2(self.queue);
25909
+ const queueLength = length3(self.queue);
25727
25910
  if (self.capacity !== undefined && queueLength === self.capacity) {
25728
25911
  return false;
25729
25912
  }
@@ -25745,7 +25928,7 @@ var offerAll = /* @__PURE__ */ dual(2, (self, values7) => {
25745
25928
  return reverse3(remainder2);
25746
25929
  });
25747
25930
  var poll4 = /* @__PURE__ */ dual(2, (self, def) => {
25748
- if (isEmpty9(self.queue)) {
25931
+ if (isEmpty10(self.queue)) {
25749
25932
  return def;
25750
25933
  }
25751
25934
  return shift(self.queue);
@@ -26472,7 +26655,7 @@ var tapErrorCause3 = tapErrorCause;
26472
26655
  var forever3 = forever;
26473
26656
  var iterate2 = iterate;
26474
26657
  var loop2 = loop;
26475
- var repeat3 = repeat_combined;
26658
+ var repeat4 = repeat_combined;
26476
26659
  var repeatN2 = repeatN;
26477
26660
  var repeatOrElse = repeatOrElse_Effect;
26478
26661
  var schedule = schedule_Effect;
@@ -26490,7 +26673,7 @@ var setFiberRefs2 = setFiberRefs;
26490
26673
  var updateFiberRefs2 = updateFiberRefs;
26491
26674
  var isFailure5 = isFailure3;
26492
26675
  var isSuccess3 = isSuccess;
26493
- var match15 = match9;
26676
+ var match16 = match9;
26494
26677
  var matchCause3 = matchCause;
26495
26678
  var matchCauseEffect3 = matchCauseEffect;
26496
26679
  var matchEffect3 = matchEffect;
@@ -26784,9 +26967,9 @@ var fn = function(nameOrBody, ...pipeables) {
26784
26967
  }
26785
26968
  }[name]);
26786
26969
  };
26787
- function defineLength(length4, fn2) {
26970
+ function defineLength(length5, fn2) {
26788
26971
  return Object.defineProperty(fn2, "length", {
26789
- value: length4,
26972
+ value: length5,
26790
26973
  configurable: true
26791
26974
  });
26792
26975
  }
@@ -26901,21 +27084,21 @@ var decoder = /* @__PURE__ */ new TextDecoder;
26901
27084
 
26902
27085
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/encoding/base64.js
26903
27086
  var encode = (bytes) => {
26904
- const length4 = bytes.length;
27087
+ const length5 = bytes.length;
26905
27088
  let result = "";
26906
27089
  let i;
26907
- for (i = 2;i < length4; i += 3) {
27090
+ for (i = 2;i < length5; i += 3) {
26908
27091
  result += base64abc[bytes[i - 2] >> 2];
26909
27092
  result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
26910
27093
  result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
26911
27094
  result += base64abc[bytes[i] & 63];
26912
27095
  }
26913
- if (i === length4 + 1) {
27096
+ if (i === length5 + 1) {
26914
27097
  result += base64abc[bytes[i - 2] >> 2];
26915
27098
  result += base64abc[(bytes[i - 2] & 3) << 4];
26916
27099
  result += "==";
26917
27100
  }
26918
- if (i === length4) {
27101
+ if (i === length5) {
26919
27102
  result += base64abc[bytes[i - 2] >> 2];
26920
27103
  result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
26921
27104
  result += base64abc[(bytes[i - 1] & 15) << 2];
@@ -26925,18 +27108,18 @@ var encode = (bytes) => {
26925
27108
  };
26926
27109
  var decode2 = (str) => {
26927
27110
  const stripped = stripCrlf(str);
26928
- const length4 = stripped.length;
26929
- if (length4 % 4 !== 0) {
26930
- return left2(DecodeException(stripped, `Length must be a multiple of 4, but is ${length4}`));
27111
+ const length5 = stripped.length;
27112
+ if (length5 % 4 !== 0) {
27113
+ return left2(DecodeException(stripped, `Length must be a multiple of 4, but is ${length5}`));
26931
27114
  }
26932
27115
  const index = stripped.indexOf("=");
26933
- if (index !== -1 && (index < length4 - 2 || index === length4 - 2 && stripped[length4 - 1] !== "=")) {
27116
+ if (index !== -1 && (index < length5 - 2 || index === length5 - 2 && stripped[length5 - 1] !== "=")) {
26934
27117
  return left2(DecodeException(stripped, "Found a '=' character, but it is not at the end"));
26935
27118
  }
26936
27119
  try {
26937
27120
  const missingOctets = stripped.endsWith("==") ? 2 : stripped.endsWith("=") ? 1 : 0;
26938
- const result = new Uint8Array(3 * (length4 / 4) - missingOctets);
26939
- for (let i = 0, j = 0;i < length4; i += 4, j += 3) {
27121
+ const result = new Uint8Array(3 * (length5 / 4) - missingOctets);
27122
+ for (let i = 0, j = 0;i < length5; i += 4, j += 3) {
26940
27123
  const buffer = getBase64Code(stripped.charCodeAt(i)) << 18 | getBase64Code(stripped.charCodeAt(i + 1)) << 12 | getBase64Code(stripped.charCodeAt(i + 2)) << 6 | getBase64Code(stripped.charCodeAt(i + 3));
26941
27124
  result[j] = buffer >> 16;
26942
27125
  result[j + 1] = buffer >> 8 & 255;
@@ -26965,14 +27148,14 @@ var base64codes = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 2
26965
27148
  var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
26966
27149
  var decode3 = (str) => {
26967
27150
  const stripped = stripCrlf(str);
26968
- const length4 = stripped.length;
26969
- if (length4 % 4 === 1) {
26970
- return left2(DecodeException(stripped, `Length should be a multiple of 4, but is ${length4}`));
27151
+ const length5 = stripped.length;
27152
+ if (length5 % 4 === 1) {
27153
+ return left2(DecodeException(stripped, `Length should be a multiple of 4, but is ${length5}`));
26971
27154
  }
26972
27155
  if (!/^[-_A-Z0-9]*?={0,2}$/i.test(stripped)) {
26973
27156
  return left2(DecodeException(stripped, "Invalid input"));
26974
27157
  }
26975
- let sanitized = length4 % 4 === 2 ? `${stripped}==` : length4 % 4 === 3 ? `${stripped}=` : stripped;
27158
+ let sanitized = length5 % 4 === 2 ? `${stripped}==` : length5 % 4 === 3 ? `${stripped}=` : stripped;
26976
27159
  sanitized = sanitized.replace(/-/g, "+").replace(/_/g, "/");
26977
27160
  return decode2(sanitized);
26978
27161
  };
@@ -26991,9 +27174,9 @@ var decode4 = (str) => {
26991
27174
  return left2(DecodeException(str, `Length must be a multiple of 2, but is ${bytes.length}`));
26992
27175
  }
26993
27176
  try {
26994
- const length4 = bytes.length / 2;
26995
- const result = new Uint8Array(length4);
26996
- for (let i = 0;i < length4; i++) {
27177
+ const length5 = bytes.length / 2;
27178
+ const result = new Uint8Array(length5);
27179
+ for (let i = 0;i < length5; i++) {
26997
27180
  const a = fromHexChar(bytes[i * 2]);
26998
27181
  const b = fromHexChar(bytes[i * 2 + 1]);
26999
27182
  result[i] = a << 4 | b;
@@ -27091,7 +27274,7 @@ __export(exports_Layer, {
27091
27274
  merge: () => merge8,
27092
27275
  memoize: () => memoize3,
27093
27276
  matchCause: () => matchCause4,
27094
- match: () => match16,
27277
+ match: () => match17,
27095
27278
  mapError: () => mapError5,
27096
27279
  map: () => map22,
27097
27280
  makeMemoMap: () => makeMemoMap2,
@@ -27115,7 +27298,7 @@ __export(exports_Layer, {
27115
27298
  ensureSuccessType: () => ensureSuccessType2,
27116
27299
  ensureRequirementsType: () => ensureRequirementsType2,
27117
27300
  ensureErrorType: () => ensureErrorType2,
27118
- empty: () => empty34,
27301
+ empty: () => empty35,
27119
27302
  effectDiscard: () => effectDiscard,
27120
27303
  effectContext: () => effectContext,
27121
27304
  effect: () => effect,
@@ -27172,7 +27355,7 @@ var discard2 = discard;
27172
27355
  var effect = fromEffect4;
27173
27356
  var effectDiscard = fromEffectDiscard;
27174
27357
  var effectContext = fromEffectContext;
27175
- var empty34 = empty32;
27358
+ var empty35 = empty32;
27176
27359
  var extendScope2 = extendScope;
27177
27360
  var fail13 = fail10;
27178
27361
  var failSync5 = failSync3;
@@ -27186,7 +27369,7 @@ var fromFunction3 = fromFunction;
27186
27369
  var launch2 = launch;
27187
27370
  var map22 = map19;
27188
27371
  var mapError5 = mapError3;
27189
- var match16 = match13;
27372
+ var match17 = match13;
27190
27373
  var matchCause4 = matchCause2;
27191
27374
  var memoize3 = memoize2;
27192
27375
  var merge8 = merge6;
@@ -27264,7 +27447,7 @@ __export(exports_Logger, {
27264
27447
  simple: () => simple2,
27265
27448
  replaceScoped: () => replaceScoped,
27266
27449
  replaceEffect: () => replaceEffect,
27267
- replace: () => replace5,
27450
+ replace: () => replace6,
27268
27451
  remove: () => remove10,
27269
27452
  prettyLoggerDefault: () => prettyLoggerDefault2,
27270
27453
  prettyLogger: () => prettyLogger3,
@@ -27317,7 +27500,7 @@ var withLeveledConsole = loggerWithLeveledLog;
27317
27500
  var withConsoleError = loggerWithConsoleError;
27318
27501
  var none10 = none7;
27319
27502
  var remove10 = removeLogger;
27320
- var replace5 = replaceLogger;
27503
+ var replace6 = replaceLogger;
27321
27504
  var replaceEffect = replaceLoggerEffect;
27322
27505
  var replaceScoped = replaceLoggerScoped;
27323
27506
  var simple2 = simple;
@@ -27337,10 +27520,10 @@ var prettyLogger3 = prettyLogger;
27337
27520
  var prettyLoggerDefault2 = prettyLoggerDefault;
27338
27521
  var structuredLogger3 = structuredLogger;
27339
27522
  var tracerLogger2 = tracerLogger;
27340
- var json = /* @__PURE__ */ replace5(defaultLogger, jsonLogger2);
27341
- var logFmt = /* @__PURE__ */ replace5(defaultLogger, logFmtLogger);
27342
- var pretty5 = /* @__PURE__ */ replace5(defaultLogger, prettyLogger2);
27343
- var structured = /* @__PURE__ */ replace5(defaultLogger, structuredLogger2);
27523
+ var json = /* @__PURE__ */ replace6(defaultLogger, jsonLogger2);
27524
+ var logFmt = /* @__PURE__ */ replace6(defaultLogger, logFmtLogger);
27525
+ var pretty5 = /* @__PURE__ */ replace6(defaultLogger, prettyLogger2);
27526
+ var structured = /* @__PURE__ */ replace6(defaultLogger, structuredLogger2);
27344
27527
  var minimumLogLevel2 = minimumLogLevel;
27345
27528
  var isLogger2 = isLogger;
27346
27529
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Match.js
@@ -27360,7 +27543,7 @@ __export(exports_Match, {
27360
27543
  tagStartsWith: () => tagStartsWith2,
27361
27544
  tag: () => tag2,
27362
27545
  symbol: () => symbol3,
27363
- string: () => string5,
27546
+ string: () => string6,
27364
27547
  record: () => record,
27365
27548
  orElseAbsurd: () => orElseAbsurd2,
27366
27549
  orElse: () => orElse14,
@@ -27513,12 +27696,12 @@ var makeAndPredicate = (patterns) => {
27513
27696
  var type = () => makeTypeMatcher([]);
27514
27697
  var value2 = (i) => makeValueMatcher(i, left2(i));
27515
27698
  var valueTags = /* @__PURE__ */ dual(2, (input, fields) => {
27516
- const match17 = tagsExhaustive(fields)(makeTypeMatcher([]));
27517
- return match17(input);
27699
+ const match18 = tagsExhaustive(fields)(makeTypeMatcher([]));
27700
+ return match18(input);
27518
27701
  });
27519
27702
  var typeTags = () => (fields) => {
27520
- const match17 = tagsExhaustive(fields)(makeTypeMatcher([]));
27521
- return (input) => match17(input);
27703
+ const match18 = tagsExhaustive(fields)(makeTypeMatcher([]));
27704
+ return (input) => match18(input);
27522
27705
  };
27523
27706
  var withReturnType = () => (self) => self;
27524
27707
  var when3 = (pattern, f) => (self) => self.add(makeWhen(makePredicate(pattern), f));
@@ -27663,7 +27846,7 @@ var tagsExhaustive2 = tagsExhaustive;
27663
27846
  var not4 = not3;
27664
27847
  var nonEmptyString4 = nonEmptyString3;
27665
27848
  var is2 = is;
27666
- var string5 = isString;
27849
+ var string6 = isString;
27667
27850
  var number6 = isNumber;
27668
27851
  var any2 = any;
27669
27852
  var defined2 = defined;
@@ -30811,9 +30994,9 @@ __export(exports_Schema, {
30811
30994
  symbolSerializable: () => symbolSerializable,
30812
30995
  suspend: () => suspend7,
30813
30996
  successSchema: () => successSchema,
30814
- startsWith: () => startsWith,
30997
+ startsWith: () => startsWith2,
30815
30998
  standardSchemaV1: () => standardSchemaV1,
30816
- split: () => split3,
30999
+ split: () => split4,
30817
31000
  serializeSuccess: () => serializeSuccess,
30818
31001
  serializeFailure: () => serializeFailure,
30819
31002
  serializeExit: () => serializeExit,
@@ -30870,7 +31053,7 @@ __export(exports_Schema, {
30870
31053
  lessThanBigInt: () => lessThanBigInt,
30871
31054
  lessThanBigDecimal: () => lessThanBigDecimal,
30872
31055
  lessThan: () => lessThan9,
30873
- length: () => length4,
31056
+ length: () => length5,
30874
31057
  keyof: () => keyof2,
30875
31058
  itemsCount: () => itemsCount,
30876
31059
  isSchema: () => isSchema,
@@ -30878,7 +31061,7 @@ __export(exports_Schema, {
30878
31061
  is: () => is3,
30879
31062
  int: () => int,
30880
31063
  instanceOf: () => instanceOf3,
30881
- includes: () => includes,
31064
+ includes: () => includes2,
30882
31065
  headOrElse: () => headOrElse,
30883
31066
  headNonEmpty: () => headNonEmpty3,
30884
31067
  head: () => head5,
@@ -30886,7 +31069,7 @@ __export(exports_Schema, {
30886
31069
  greaterThanOrEqualToDate: () => greaterThanOrEqualToDate,
30887
31070
  greaterThanOrEqualToBigInt: () => greaterThanOrEqualToBigInt,
30888
31071
  greaterThanOrEqualToBigDecimal: () => greaterThanOrEqualToBigDecimal,
30889
- greaterThanOrEqualTo: () => greaterThanOrEqualTo5,
31072
+ greaterThanOrEqualTo: () => greaterThanOrEqualTo6,
30890
31073
  greaterThanDuration: () => greaterThanDuration,
30891
31074
  greaterThanDate: () => greaterThanDate,
30892
31075
  greaterThanBigInt: () => greaterThanBigInt,
@@ -30904,7 +31087,7 @@ __export(exports_Schema, {
30904
31087
  extend: () => extend4,
30905
31088
  exitSchema: () => exitSchema,
30906
31089
  equivalence: () => equivalence2,
30907
- endsWith: () => endsWith,
31090
+ endsWith: () => endsWith2,
30908
31091
  encodedSchema: () => encodedSchema,
30909
31092
  encodedBoundSchema: () => encodedBoundSchema,
30910
31093
  encodeUnknownSync: () => encodeUnknownSync,
@@ -31179,7 +31362,7 @@ var TypeId21 = /* @__PURE__ */ Symbol.for("effect/BigDecimal");
31179
31362
  var BigDecimalProto = {
31180
31363
  [TypeId21]: TypeId21,
31181
31364
  [symbol]() {
31182
- const normalized = normalize(this);
31365
+ const normalized = normalize2(this);
31183
31366
  return pipe(hash(normalized.value), combine(number2(normalized.scale)), cached(this));
31184
31367
  },
31185
31368
  [symbol2](that) {
@@ -31220,7 +31403,7 @@ var unsafeMakeNormalized = (value5, scale) => {
31220
31403
  var bigint04 = /* @__PURE__ */ BigInt(0);
31221
31404
  var bigint10 = /* @__PURE__ */ BigInt(10);
31222
31405
  var zero2 = /* @__PURE__ */ unsafeMakeNormalized(bigint04, 0);
31223
- var normalize = (self) => {
31406
+ var normalize2 = (self) => {
31224
31407
  if (self.normalized === undefined) {
31225
31408
  if (self.value === bigint04) {
31226
31409
  self.normalized = zero2;
@@ -31253,8 +31436,8 @@ var scale = /* @__PURE__ */ dual(2, (self, scale2) => {
31253
31436
  }
31254
31437
  return self;
31255
31438
  });
31256
- var Order6 = /* @__PURE__ */ make2((self, that) => {
31257
- const scmp = number3(sign(self), sign(that));
31439
+ var Order7 = /* @__PURE__ */ make2((self, that) => {
31440
+ const scmp = number3(sign2(self), sign2(that));
31258
31441
  if (scmp !== 0) {
31259
31442
  return scmp;
31260
31443
  }
@@ -31266,15 +31449,15 @@ var Order6 = /* @__PURE__ */ make2((self, that) => {
31266
31449
  }
31267
31450
  return bigint(self.value, that.value);
31268
31451
  });
31269
- var lessThan7 = /* @__PURE__ */ lessThan(Order6);
31270
- var lessThanOrEqualTo3 = /* @__PURE__ */ lessThanOrEqualTo(Order6);
31271
- var greaterThan4 = /* @__PURE__ */ greaterThan(Order6);
31272
- var greaterThanOrEqualTo3 = /* @__PURE__ */ greaterThanOrEqualTo(Order6);
31273
- var between3 = /* @__PURE__ */ between(Order6);
31274
- var clamp5 = /* @__PURE__ */ clamp(Order6);
31275
- var sign = (n) => n.value === bigint04 ? 0 : n.value < bigint04 ? -1 : 1;
31452
+ var lessThan7 = /* @__PURE__ */ lessThan(Order7);
31453
+ var lessThanOrEqualTo3 = /* @__PURE__ */ lessThanOrEqualTo(Order7);
31454
+ var greaterThan4 = /* @__PURE__ */ greaterThan(Order7);
31455
+ var greaterThanOrEqualTo4 = /* @__PURE__ */ greaterThanOrEqualTo(Order7);
31456
+ var between3 = /* @__PURE__ */ between(Order7);
31457
+ var clamp5 = /* @__PURE__ */ clamp(Order7);
31458
+ var sign2 = (n) => n.value === bigint04 ? 0 : n.value < bigint04 ? -1 : 1;
31276
31459
  var abs = (n) => n.value < bigint04 ? make49(-n.value, n.scale) : n;
31277
- var Equivalence4 = /* @__PURE__ */ make((self, that) => {
31460
+ var Equivalence5 = /* @__PURE__ */ make((self, that) => {
31278
31461
  if (self.scale > that.scale) {
31279
31462
  return scale(that, self.scale).value === self.value;
31280
31463
  }
@@ -31283,17 +31466,17 @@ var Equivalence4 = /* @__PURE__ */ make((self, that) => {
31283
31466
  }
31284
31467
  return self.value === that.value;
31285
31468
  });
31286
- var equals5 = /* @__PURE__ */ dual(2, (self, that) => Equivalence4(self, that));
31469
+ var equals5 = /* @__PURE__ */ dual(2, (self, that) => Equivalence5(self, that));
31287
31470
  var unsafeFromNumber = (n) => getOrThrowWith2(safeFromNumber(n), () => new RangeError(`Number must be finite, got ${n}`));
31288
31471
  var safeFromNumber = (n) => {
31289
31472
  if (!Number.isFinite(n)) {
31290
31473
  return none2();
31291
31474
  }
31292
- const string6 = `${n}`;
31293
- if (string6.includes("e")) {
31294
- return fromString2(string6);
31475
+ const string7 = `${n}`;
31476
+ if (string7.includes("e")) {
31477
+ return fromString2(string7);
31295
31478
  }
31296
- const [lead, trail = ""] = string6.split(".");
31479
+ const [lead, trail = ""] = string7.split(".");
31297
31480
  return some3(make49(BigInt(`${lead}${trail}`), trail.length));
31298
31481
  };
31299
31482
  var fromString2 = (s) => {
@@ -31336,7 +31519,7 @@ var fromString2 = (s) => {
31336
31519
  return some3(make49(BigInt(digits), scale2));
31337
31520
  };
31338
31521
  var format4 = (n) => {
31339
- const normalized = normalize(n);
31522
+ const normalized = normalize2(n);
31340
31523
  if (Math.abs(normalized.scale) >= 16) {
31341
31524
  return toExponential(normalized);
31342
31525
  }
@@ -31365,7 +31548,7 @@ var toExponential = (n) => {
31365
31548
  if (isZero2(n)) {
31366
31549
  return "0e+0";
31367
31550
  }
31368
- const normalized = normalize(n);
31551
+ const normalized = normalize2(n);
31369
31552
  const digits = `${abs(normalized).value}`;
31370
31553
  const head5 = digits.slice(0, 1);
31371
31554
  const tail3 = digits.slice(1);
@@ -31382,8 +31565,8 @@ var isNegative = (n) => n.value < bigint04;
31382
31565
  var isPositive = (n) => n.value > bigint04;
31383
31566
 
31384
31567
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/BigInt.js
31385
- var Order7 = bigint;
31386
- var clamp6 = /* @__PURE__ */ clamp(Order7);
31568
+ var Order8 = bigint;
31569
+ var clamp6 = /* @__PURE__ */ clamp(Order8);
31387
31570
  var toNumber = (b) => {
31388
31571
  if (b > BigInt(Number.MAX_SAFE_INTEGER) || b < BigInt(Number.MIN_SAFE_INTEGER)) {
31389
31572
  return none2();
@@ -31414,7 +31597,7 @@ var isTimeZoneOffset2 = isTimeZoneOffset;
31414
31597
  var isTimeZoneNamed2 = isTimeZoneNamed;
31415
31598
  var isUtc2 = isUtc;
31416
31599
  var isZoned2 = isZoned;
31417
- var Equivalence5 = Equivalence2;
31600
+ var Equivalence6 = Equivalence2;
31418
31601
  var unsafeFromDate2 = unsafeFromDate;
31419
31602
  var unsafeMake11 = unsafeMake10;
31420
31603
  var unsafeMakeZoned2 = unsafeMakeZoned;
@@ -32147,8 +32330,8 @@ class SlicedBasedGenerator {
32147
32330
  if (targetLength !== 0 && this.mrng.nextInt(1, this.biasFactor) === 1) {
32148
32331
  const eligibleIndices = [];
32149
32332
  for (let index = 0;index !== this.slices.length; ++index) {
32150
- const slice = this.slices[index];
32151
- if (slice.length === targetLength) {
32333
+ const slice2 = this.slices[index];
32334
+ if (slice2.length === targetLength) {
32152
32335
  safePush(eligibleIndices, index);
32153
32336
  }
32154
32337
  }
@@ -32168,17 +32351,17 @@ class SlicedBasedGenerator {
32168
32351
  return this.arb.generate(this.mrng, this.biasFactor);
32169
32352
  }
32170
32353
  this.activeSliceIndex = this.mrng.nextInt(0, this.slices.length - 1);
32171
- const slice = this.slices[this.activeSliceIndex];
32354
+ const slice2 = this.slices[this.activeSliceIndex];
32172
32355
  if (this.mrng.nextInt(1, this.biasFactor) !== 1) {
32173
32356
  this.nextIndexInSlice = 1;
32174
- this.lastIndexInSlice = slice.length - 1;
32175
- return new Value(slice[0], undefined);
32357
+ this.lastIndexInSlice = slice2.length - 1;
32358
+ return new Value(slice2[0], undefined);
32176
32359
  }
32177
- const rangeBoundaryA = this.mrng.nextInt(0, slice.length - 1);
32178
- const rangeBoundaryB = this.mrng.nextInt(0, slice.length - 1);
32360
+ const rangeBoundaryA = this.mrng.nextInt(0, slice2.length - 1);
32361
+ const rangeBoundaryB = this.mrng.nextInt(0, slice2.length - 1);
32179
32362
  this.nextIndexInSlice = safeMathMin(rangeBoundaryA, rangeBoundaryB);
32180
32363
  this.lastIndexInSlice = safeMathMax(rangeBoundaryA, rangeBoundaryB);
32181
- return new Value(slice[this.nextIndexInSlice++], undefined);
32364
+ return new Value(slice2[this.nextIndexInSlice++], undefined);
32182
32365
  }
32183
32366
  }
32184
32367
 
@@ -32770,8 +32953,8 @@ var TemplateLiteralParser = (...params) => {
32770
32953
  return class TemplateLiteralParserClass extends transformOrFail(from, to, {
32771
32954
  strict: false,
32772
32955
  decode: (i, _, ast) => {
32773
- const match18 = re.exec(i);
32774
- return match18 ? succeed16(match18.slice(1, params.length + 1)) : fail14(new Type2(ast, i, `${re.source}: no match for ${JSON.stringify(i)}`));
32956
+ const match19 = re.exec(i);
32957
+ return match19 ? succeed16(match19.slice(1, params.length + 1)) : fail14(new Type2(ast, i, `${re.source}: no match for ${JSON.stringify(i)}`));
32775
32958
  },
32776
32959
  encode: (tuple5) => succeed16(tuple5.join(""))
32777
32960
  }) {
@@ -33623,9 +33806,9 @@ var minLength = (minLength2, annotations3) => (self) => self.pipe(filter13((a) =
33623
33806
  ...annotations3
33624
33807
  }));
33625
33808
  var LengthSchemaId2 = LengthSchemaId;
33626
- var length4 = (length5, annotations3) => (self) => {
33627
- const minLength2 = isObject(length5) ? Math.max(0, Math.floor(length5.min)) : Math.max(0, Math.floor(length5));
33628
- const maxLength2 = isObject(length5) ? Math.max(minLength2, Math.floor(length5.max)) : minLength2;
33809
+ var length5 = (length6, annotations3) => (self) => {
33810
+ const minLength2 = isObject(length6) ? Math.max(0, Math.floor(length6.min)) : Math.max(0, Math.floor(length6));
33811
+ const maxLength2 = isObject(length6) ? Math.max(minLength2, Math.floor(length6.max)) : minLength2;
33629
33812
  if (minLength2 !== maxLength2) {
33630
33813
  return self.pipe(filter13((a) => a.length >= minLength2 && a.length <= maxLength2, {
33631
33814
  schemaId: LengthSchemaId2,
@@ -33668,39 +33851,39 @@ var pattern = (regex, annotations3) => (self) => {
33668
33851
  }));
33669
33852
  };
33670
33853
  var StartsWithSchemaId = /* @__PURE__ */ Symbol.for("effect/SchemaId/StartsWith");
33671
- var startsWith = (startsWith2, annotations3) => (self) => {
33672
- const formatted = JSON.stringify(startsWith2);
33673
- return self.pipe(filter13((a) => a.startsWith(startsWith2), {
33854
+ var startsWith2 = (startsWith3, annotations3) => (self) => {
33855
+ const formatted = JSON.stringify(startsWith3);
33856
+ return self.pipe(filter13((a) => a.startsWith(startsWith3), {
33674
33857
  schemaId: StartsWithSchemaId,
33675
33858
  [StartsWithSchemaId]: {
33676
- startsWith: startsWith2
33859
+ startsWith: startsWith3
33677
33860
  },
33678
33861
  title: `startsWith(${formatted})`,
33679
33862
  description: `a string starting with ${formatted}`,
33680
33863
  jsonSchema: {
33681
- pattern: `^${startsWith2}`
33864
+ pattern: `^${startsWith3}`
33682
33865
  },
33683
33866
  ...annotations3
33684
33867
  }));
33685
33868
  };
33686
33869
  var EndsWithSchemaId = /* @__PURE__ */ Symbol.for("effect/SchemaId/EndsWith");
33687
- var endsWith = (endsWith2, annotations3) => (self) => {
33688
- const formatted = JSON.stringify(endsWith2);
33689
- return self.pipe(filter13((a) => a.endsWith(endsWith2), {
33870
+ var endsWith2 = (endsWith3, annotations3) => (self) => {
33871
+ const formatted = JSON.stringify(endsWith3);
33872
+ return self.pipe(filter13((a) => a.endsWith(endsWith3), {
33690
33873
  schemaId: EndsWithSchemaId,
33691
33874
  [EndsWithSchemaId]: {
33692
- endsWith: endsWith2
33875
+ endsWith: endsWith3
33693
33876
  },
33694
33877
  title: `endsWith(${formatted})`,
33695
33878
  description: `a string ending with ${formatted}`,
33696
33879
  jsonSchema: {
33697
- pattern: `^.*${endsWith2}$`
33880
+ pattern: `^.*${endsWith3}$`
33698
33881
  },
33699
33882
  ...annotations3
33700
33883
  }));
33701
33884
  };
33702
33885
  var IncludesSchemaId = /* @__PURE__ */ Symbol.for("effect/SchemaId/Includes");
33703
- var includes = (searchString, annotations3) => (self) => {
33886
+ var includes2 = (searchString, annotations3) => (self) => {
33704
33887
  const formatted = JSON.stringify(searchString);
33705
33888
  return self.pipe(filter13((a) => a.includes(searchString), {
33706
33889
  schemaId: IncludesSchemaId,
@@ -33776,7 +33959,7 @@ class Uncapitalized extends (/* @__PURE__ */ String$.pipe(/* @__PURE__ */ uncapi
33776
33959
  }))) {
33777
33960
  }
33778
33961
 
33779
- class Char extends (/* @__PURE__ */ String$.pipe(/* @__PURE__ */ length4(1, {
33962
+ class Char extends (/* @__PURE__ */ String$.pipe(/* @__PURE__ */ length5(1, {
33780
33963
  identifier: "Char"
33781
33964
  }))) {
33782
33965
  }
@@ -33850,7 +34033,7 @@ class Trim extends (/* @__PURE__ */ transform2(String$.annotations({
33850
34033
  identifier: "Trim"
33851
34034
  })) {
33852
34035
  }
33853
- var split3 = (separator) => transform2(String$.annotations({
34036
+ var split4 = (separator) => transform2(String$.annotations({
33854
34037
  description: "a string that will be split"
33855
34038
  }), Array$(String$), {
33856
34039
  strict: true,
@@ -33948,7 +34131,7 @@ var greaterThan6 = (exclusiveMinimum, annotations3) => (self) => self.pipe(filte
33948
34131
  ...annotations3
33949
34132
  }));
33950
34133
  var GreaterThanOrEqualToSchemaId2 = GreaterThanOrEqualToSchemaId;
33951
- var greaterThanOrEqualTo5 = (minimum, annotations3) => (self) => self.pipe(filter13((a) => a >= minimum, {
34134
+ var greaterThanOrEqualTo6 = (minimum, annotations3) => (self) => self.pipe(filter13((a) => a >= minimum, {
33952
34135
  schemaId: GreaterThanOrEqualToSchemaId2,
33953
34136
  title: `greaterThanOrEqualTo(${minimum})`,
33954
34137
  description: minimum === 0 ? "a non-negative number" : `a number greater than or equal to ${minimum}`,
@@ -34030,7 +34213,7 @@ var nonPositive = (annotations3) => lessThanOrEqualTo5(0, {
34030
34213
  title: "nonPositive",
34031
34214
  ...annotations3
34032
34215
  });
34033
- var nonNegative = (annotations3) => greaterThanOrEqualTo5(0, {
34216
+ var nonNegative = (annotations3) => greaterThanOrEqualTo6(0, {
34034
34217
  title: "nonNegative",
34035
34218
  ...annotations3
34036
34219
  });
@@ -34697,7 +34880,7 @@ class DateTimeUtcFromSelf extends (/* @__PURE__ */ declare((u) => isDateTime2(u)
34697
34880
  arbitrary: () => (fc) => fc.date({
34698
34881
  noInvalidDate: true
34699
34882
  }).map((date4) => unsafeFromDate2(date4)),
34700
- equivalence: () => Equivalence5
34883
+ equivalence: () => Equivalence6
34701
34884
  })) {
34702
34885
  }
34703
34886
  var decodeDateTimeUtc = (input, ast) => _try({
@@ -34821,7 +35004,7 @@ class DateTimeZonedFromSelf extends (/* @__PURE__ */ declare((u) => isDateTime2(
34821
35004
  }), timeZoneArbitrary(fc)).map(([millis2, timeZone]) => unsafeMakeZoned2(millis2, {
34822
35005
  timeZone
34823
35006
  })),
34824
- equivalence: () => Equivalence5
35007
+ equivalence: () => Equivalence6
34825
35008
  })) {
34826
35009
  }
34827
35010
 
@@ -35166,7 +35349,7 @@ function set8(value5) {
35166
35349
  encode: (a) => Array.from(a)
35167
35350
  });
35168
35351
  }
35169
- var bigDecimalPretty = () => (val) => `BigDecimal(${format4(normalize(val))})`;
35352
+ var bigDecimalPretty = () => (val) => `BigDecimal(${format4(normalize2(val))})`;
35170
35353
  var bigDecimalArbitrary = () => (fc) => fc.tuple(fc.bigInt(), fc.integer({
35171
35354
  min: -18,
35172
35355
  max: 18
@@ -35179,7 +35362,7 @@ class BigDecimalFromSelf extends (/* @__PURE__ */ declare(isBigDecimal, {
35179
35362
  identifier: "BigDecimalFromSelf",
35180
35363
  pretty: bigDecimalPretty,
35181
35364
  arbitrary: bigDecimalArbitrary,
35182
- equivalence: () => Equivalence4
35365
+ equivalence: () => Equivalence5
35183
35366
  })) {
35184
35367
  }
35185
35368
 
@@ -35189,9 +35372,9 @@ class BigDecimal extends (/* @__PURE__ */ transformOrFail(String$.annotations({
35189
35372
  strict: true,
35190
35373
  decode: (i, _, ast) => fromString2(i).pipe(match2({
35191
35374
  onNone: () => fail14(new Type2(ast, i, `Unable to decode ${JSON.stringify(i)} into a BigDecimal`)),
35192
- onSome: (val) => succeed16(normalize(val))
35375
+ onSome: (val) => succeed16(normalize2(val))
35193
35376
  })),
35194
- encode: (a) => succeed16(format4(normalize(a)))
35377
+ encode: (a) => succeed16(format4(normalize2(a)))
35195
35378
  }).annotations({
35196
35379
  identifier: "BigDecimal"
35197
35380
  })) {
@@ -35223,7 +35406,7 @@ var greaterThanBigDecimal = (min7, annotations3) => (self) => {
35223
35406
  var GreaterThanOrEqualToBigDecimalSchemaId = /* @__PURE__ */ Symbol.for("effect/schema/GreaterThanOrEqualToBigDecimal");
35224
35407
  var greaterThanOrEqualToBigDecimal = (min7, annotations3) => (self) => {
35225
35408
  const formatted = format4(min7);
35226
- return self.pipe(filter13((a) => greaterThanOrEqualTo3(a, min7), {
35409
+ return self.pipe(filter13((a) => greaterThanOrEqualTo4(a, min7), {
35227
35410
  schemaId: GreaterThanOrEqualToBigDecimalSchemaId,
35228
35411
  [GreaterThanOrEqualToBigDecimalSchemaId]: {
35229
35412
  min: min7
@@ -36161,7 +36344,7 @@ class BooleanFromString extends (/* @__PURE__ */ transform2(Literal2("true", "fa
36161
36344
  }
36162
36345
  var Config = (name, schema) => {
36163
36346
  const decodeUnknownEither3 = decodeUnknownEither(schema);
36164
- return string4(name).pipe(mapOrFail2((s) => decodeUnknownEither3(s).pipe(mapLeft((error) => InvalidData2([], TreeFormatter.formatIssueSync(error))))));
36347
+ return string5(name).pipe(mapOrFail2((s) => decodeUnknownEither3(s).pipe(mapLeft((error) => InvalidData2([], TreeFormatter.formatIssueSync(error))))));
36165
36348
  };
36166
36349
  var symbolSerializable = /* @__PURE__ */ Symbol.for("effect/Schema/Serializable/symbol");
36167
36350
  var asSerializable = (serializable) => serializable;
@@ -36490,14 +36673,14 @@ __export(exports_Stream, {
36490
36673
  takeWhile: () => takeWhile6,
36491
36674
  takeUntilEffect: () => takeUntilEffect2,
36492
36675
  takeUntil: () => takeUntil4,
36493
- takeRight: () => takeRight4,
36676
+ takeRight: () => takeRight5,
36494
36677
  take: () => take9,
36495
36678
  sync: () => sync15,
36496
36679
  suspend: () => suspend13,
36497
36680
  succeed: () => succeed22,
36498
36681
  splitOnChunk: () => splitOnChunk2,
36499
36682
  splitLines: () => splitLines3,
36500
- split: () => split5,
36683
+ split: () => split6,
36501
36684
  someOrFail: () => someOrFail2,
36502
36685
  someOrElse: () => someOrElse2,
36503
36686
  some: () => some12,
@@ -36550,7 +36733,7 @@ __export(exports_Stream, {
36550
36733
  repeatEffectChunkOption: () => repeatEffectChunkOption2,
36551
36734
  repeatEffectChunk: () => repeatEffectChunk2,
36552
36735
  repeatEffect: () => repeatEffect2,
36553
- repeat: () => repeat5,
36736
+ repeat: () => repeat6,
36554
36737
  refineOrDieWith: () => refineOrDieWith2,
36555
36738
  refineOrDie: () => refineOrDie2,
36556
36739
  rechunk: () => rechunk2,
@@ -36675,7 +36858,7 @@ __export(exports_Stream, {
36675
36858
  ensuringWith: () => ensuringWith3,
36676
36859
  ensuring: () => ensuring8,
36677
36860
  encodeText: () => encodeText2,
36678
- empty: () => empty36,
36861
+ empty: () => empty37,
36679
36862
  either: () => either9,
36680
36863
  dropWhileEffect: () => dropWhileEffect2,
36681
36864
  dropWhile: () => dropWhile6,
@@ -36701,7 +36884,7 @@ __export(exports_Stream, {
36701
36884
  contextWith: () => contextWith4,
36702
36885
  context: () => context6,
36703
36886
  concatAll: () => concatAll3,
36704
- concat: () => concat3,
36887
+ concat: () => concat4,
36705
36888
  combineChunks: () => combineChunks2,
36706
36889
  combine: () => combine11,
36707
36890
  chunksWith: () => chunksWith2,
@@ -36795,7 +36978,7 @@ class QueueImpl extends Class3 {
36795
36978
  if (get7(this.shutdownFlag)) {
36796
36979
  return none2();
36797
36980
  }
36798
- return some3(this.queue.length() - length3(this.takers) + this.strategy.surplusSize());
36981
+ return some3(this.queue.length() - length4(this.takers) + this.strategy.surplusSize());
36799
36982
  }
36800
36983
  get isEmpty() {
36801
36984
  return map11(this.size, (size14) => size14 <= 0);
@@ -36974,14 +37157,14 @@ class BackingQueueFromMutableQueue {
36974
37157
  return capacity(this.mutable);
36975
37158
  }
36976
37159
  length() {
36977
- return length3(this.mutable);
37160
+ return length4(this.mutable);
36978
37161
  }
36979
37162
  }
36980
37163
  var backingQueueFromMutableQueue = (mutable3) => new BackingQueueFromMutableQueue(mutable3);
36981
37164
  var capacity2 = (self) => self.capacity();
36982
37165
  var size14 = (self) => self.size;
36983
37166
  var isFull = (self) => self.isFull;
36984
- var isEmpty11 = (self) => self.isEmpty;
37167
+ var isEmpty12 = (self) => self.isEmpty;
36985
37168
  var isShutdown = (self) => self.isShutdown;
36986
37169
  var awaitShutdown = (self) => self.awaitShutdown;
36987
37170
  var shutdown = (self) => self.shutdown;
@@ -37001,10 +37184,10 @@ class BackPressureStrategy {
37001
37184
  [QueueStrategyTypeId] = queueStrategyVariance;
37002
37185
  putters = /* @__PURE__ */ unbounded();
37003
37186
  surplusSize() {
37004
- return length3(this.putters);
37187
+ return length4(this.putters);
37005
37188
  }
37006
37189
  onCompleteTakersWithEmptyQueue(takers) {
37007
- while (!isEmpty10(this.putters) && !isEmpty10(takers)) {
37190
+ while (!isEmpty11(this.putters) && !isEmpty11(takers)) {
37008
37191
  const taker = poll4(takers, undefined);
37009
37192
  const putter = poll4(this.putters, undefined);
37010
37193
  if (putter[2]) {
@@ -37137,7 +37320,7 @@ var unsafeCompleteTakers = (strategy, queue, takers) => {
37137
37320
  keepPolling = false;
37138
37321
  }
37139
37322
  }
37140
- if (keepPolling && queue.length() === 0 && !isEmpty10(takers)) {
37323
+ if (keepPolling && queue.length() === 0 && !isEmpty11(takers)) {
37141
37324
  strategy.onCompleteTakersWithEmptyQueue(takers);
37142
37325
  }
37143
37326
  };
@@ -37150,7 +37333,7 @@ var sliding2 = sliding;
37150
37333
  var unbounded3 = unbounded2;
37151
37334
  var capacity3 = capacity2;
37152
37335
  var size15 = size14;
37153
- var isEmpty12 = isEmpty11;
37336
+ var isEmpty13 = isEmpty12;
37154
37337
  var isFull2 = isFull;
37155
37338
  var isShutdown2 = isShutdown;
37156
37339
  var awaitShutdown2 = awaitShutdown;
@@ -37779,14 +37962,14 @@ class UnboundedPubSubSubscription {
37779
37962
  if (this.unsubscribed) {
37780
37963
  return true;
37781
37964
  }
37782
- let empty35 = true;
37965
+ let empty36 = true;
37783
37966
  let loop3 = true;
37784
37967
  while (loop3) {
37785
37968
  if (this.subscriberHead === this.self.publisherTail) {
37786
37969
  loop3 = false;
37787
37970
  } else {
37788
37971
  if (this.subscriberHead.next.value !== AbsentValue) {
37789
- empty35 = false;
37972
+ empty36 = false;
37790
37973
  loop3 = false;
37791
37974
  } else {
37792
37975
  this.subscriberHead = this.subscriberHead.next;
@@ -37794,7 +37977,7 @@ class UnboundedPubSubSubscription {
37794
37977
  }
37795
37978
  }
37796
37979
  }
37797
- return empty35;
37980
+ return empty36;
37798
37981
  }
37799
37982
  size() {
37800
37983
  if (this.unsubscribed) {
@@ -37936,7 +38119,7 @@ class SubscriptionImpl extends Class3 {
37936
38119
  const message2 = this.replayWindow.take();
37937
38120
  return succeed(message2);
37938
38121
  }
37939
- const message = isEmpty10(this.pollers) ? this.subscription.poll(EmptyMutableQueue) : EmptyMutableQueue;
38122
+ const message = isEmpty11(this.pollers) ? this.subscription.poll(EmptyMutableQueue) : EmptyMutableQueue;
37940
38123
  if (message === EmptyMutableQueue) {
37941
38124
  const deferred = deferredUnsafeMake(state.id());
37942
38125
  return pipe(suspend(() => {
@@ -37956,7 +38139,7 @@ class SubscriptionImpl extends Class3 {
37956
38139
  if (get7(this.shutdownFlag)) {
37957
38140
  return interrupt2;
37958
38141
  }
37959
- const as9 = isEmpty10(this.pollers) ? unsafePollAllSubscription(this.subscription) : empty5();
38142
+ const as9 = isEmpty11(this.pollers) ? unsafePollAllSubscription(this.subscription) : empty5();
37960
38143
  this.strategy.unsafeOnPubSubEmptySpace(this.pubsub, this.subscribers);
37961
38144
  if (this.replayWindow.remaining > 0) {
37962
38145
  return succeed(appendAll2(this.replayWindow.takeAll(), as9));
@@ -37977,7 +38160,7 @@ class SubscriptionImpl extends Class3 {
37977
38160
  replay = this.replayWindow.takeAll();
37978
38161
  max9 = max9 - replay.length;
37979
38162
  }
37980
- const as9 = isEmpty10(this.pollers) ? unsafePollN2(this.subscription, max9) : empty5();
38163
+ const as9 = isEmpty11(this.pollers) ? unsafePollN2(this.subscription, max9) : empty5();
37981
38164
  this.strategy.unsafeOnPubSubEmptySpace(this.pubsub, this.subscribers);
37982
38165
  return replay ? succeed(appendAll2(replay, as9)) : succeed(as9);
37983
38166
  });
@@ -38247,7 +38430,7 @@ var unsafeStrategyCompletePollers = (strategy, pubsub, subscribers, subscription
38247
38430
  const poller = pipe(pollers, poll4(EmptyMutableQueue));
38248
38431
  if (poller === EmptyMutableQueue) {
38249
38432
  pipe(subscribers, removeSubscribers(subscription, pollers));
38250
- if (isEmpty10(pollers)) {
38433
+ if (isEmpty11(pollers)) {
38251
38434
  keepPolling = false;
38252
38435
  } else {
38253
38436
  pipe(subscribers, addSubscribers(subscription, pollers));
@@ -39528,7 +39711,7 @@ var BufferSliding = (_) => {
39528
39711
  op._tag = OP_BUFFER_SLIDING;
39529
39712
  return op;
39530
39713
  };
39531
- var match18 = /* @__PURE__ */ dual(2, (self, {
39714
+ var match19 = /* @__PURE__ */ dual(2, (self, {
39532
39715
  onBackPressure,
39533
39716
  onBufferSliding
39534
39717
  }) => {
@@ -39802,7 +39985,7 @@ var mergeAllWith = ({
39802
39985
  return pull2.pipe(flatMap15(match({
39803
39986
  onLeft: (done9) => succeed13(some3(done9)),
39804
39987
  onRight: (outElem) => as7(offer3(queue, succeed13(right2(outElem))), none2())
39805
- })), repeat3({
39988
+ })), repeat4({
39806
39989
  until: (_) => isSome2(_)
39807
39990
  }), flatMap15((outDone) => update3(lastDone, match2({
39808
39991
  onNone: () => some3(outDone.value),
@@ -39819,7 +40002,7 @@ var mergeAllWith = ({
39819
40002
  onSome: (lastDone2) => offer3(queue, succeed13(left2(f(lastDone2, outDone))))
39820
40003
  })), as7(false)))
39821
40004
  }),
39822
- onRight: (channel) => match18(mergeStrategy, {
40005
+ onRight: (channel) => match19(mergeStrategy, {
39823
40006
  onBackPressure: () => gen4(function* () {
39824
40007
  const latch = yield* make28();
39825
40008
  const raceEffects = scopedWith2((scope6) => toPullIn(pipeTo(queueReader, channel), scope6).pipe(flatMap15((pull2) => race2(exit2(evaluatePull(pull2)), exit2(interruptible4(_await(errorSignal))))), flatMap15(identity)));
@@ -39842,7 +40025,7 @@ var mergeAllWith = ({
39842
40025
  })
39843
40026
  })
39844
40027
  })
39845
- }), repeat3({
40028
+ }), repeat4({
39846
40029
  while: (_) => _
39847
40030
  }), forkIn2(scope5));
39848
40031
  const consumer = pipe(take4(queue), flatten10, matchCause3({
@@ -40320,13 +40503,13 @@ var foldReader = (s, contFn, f) => {
40320
40503
  onDone: () => succeedNow(s)
40321
40504
  });
40322
40505
  };
40323
- var foldChunkSplit = (s, chunk4, contFn, f, index, length5) => {
40324
- if (index === length5) {
40506
+ var foldChunkSplit = (s, chunk4, contFn, f, index, length6) => {
40507
+ if (index === length6) {
40325
40508
  return [s, empty5()];
40326
40509
  }
40327
40510
  const s1 = f(s, pipe(chunk4, unsafeGet2(index)));
40328
40511
  if (contFn(s1)) {
40329
- return foldChunkSplit(s1, chunk4, contFn, f, index + 1, length5);
40512
+ return foldChunkSplit(s1, chunk4, contFn, f, index + 1, length6);
40330
40513
  }
40331
40514
  return [s1, pipe(chunk4, drop2(index + 1))];
40332
40515
  };
@@ -40375,11 +40558,11 @@ var foldEffectReader = (s, contFn, f) => {
40375
40558
  });
40376
40559
  };
40377
40560
  var foldChunkSplitEffect = (s, chunk4, contFn, f) => foldChunkSplitEffectInternal(s, chunk4, 0, chunk4.length, contFn, f);
40378
- var foldChunkSplitEffectInternal = (s, chunk4, index, length5, contFn, f) => {
40379
- if (index === length5) {
40561
+ var foldChunkSplitEffectInternal = (s, chunk4, index, length6, contFn, f) => {
40562
+ if (index === length6) {
40380
40563
  return succeed13([s, none2()]);
40381
40564
  }
40382
- return pipe(f(s, pipe(chunk4, unsafeGet2(index))), flatMap15((s1) => contFn(s1) ? foldChunkSplitEffectInternal(s1, chunk4, index + 1, length5, contFn, f) : succeed13([s1, some3(pipe(chunk4, drop2(index + 1)))])));
40565
+ return pipe(f(s, pipe(chunk4, unsafeGet2(index))), flatMap15((s1) => contFn(s1) ? foldChunkSplitEffectInternal(s1, chunk4, index + 1, length6, contFn, f) : succeed13([s1, some3(pipe(chunk4, drop2(index + 1)))])));
40383
40566
  };
40384
40567
  var foldLeftChunks = (s, f) => foldChunks(s, constTrue, f);
40385
40568
  var flatMap19 = /* @__PURE__ */ dual(2, (self, f) => foldSink(self, {
@@ -40412,11 +40595,11 @@ var forEachWhile = (f) => {
40412
40595
  });
40413
40596
  return new SinkImpl(process2);
40414
40597
  };
40415
- var forEachWhileReader = (f, input, index, length5, cont) => {
40416
- if (index === length5) {
40598
+ var forEachWhileReader = (f, input, index, length6, cont) => {
40599
+ if (index === length6) {
40417
40600
  return cont;
40418
40601
  }
40419
- return pipe(fromEffect5(f(pipe(input, unsafeGet2(index)))), flatMap18((bool) => bool ? forEachWhileReader(f, input, index + 1, length5, cont) : write(pipe(input, drop2(index)))), catchAll5((error) => pipe(write(pipe(input, drop2(index))), zipRight10(fail15(error)))));
40602
+ return pipe(fromEffect5(f(pipe(input, unsafeGet2(index)))), flatMap18((bool) => bool ? forEachWhileReader(f, input, index + 1, length6, cont) : write(pipe(input, drop2(index)))), catchAll5((error) => pipe(write(pipe(input, drop2(index))), zipRight10(fail15(error)))));
40420
40603
  };
40421
40604
  var fromChannel = (channel) => new SinkImpl(channel);
40422
40605
  var fromEffect7 = (effect3) => new SinkImpl(fromEffect5(effect3));
@@ -41984,7 +42167,7 @@ var fromPull = (pull) => matchCause3(pull, {
41984
42167
  }),
41985
42168
  onSuccess: chunk4
41986
42169
  });
41987
- var match21 = /* @__PURE__ */ dual(2, (self, {
42170
+ var match22 = /* @__PURE__ */ dual(2, (self, {
41988
42171
  onEnd,
41989
42172
  onFailure,
41990
42173
  onSuccess
@@ -42182,7 +42365,7 @@ var _async = (register, bufferSize) => acquireRelease2(queueFromBufferOptions(bu
42182
42365
  })));
42183
42366
  return canceler;
42184
42367
  })), map21((value5) => {
42185
- const loop3 = take4(output).pipe(flatMap15((take8) => done11(take8)), match15({
42368
+ const loop3 = take4(output).pipe(flatMap15((take8) => done11(take8)), match16({
42186
42369
  onFailure: (maybeError) => fromEffect5(shutdown2(output)).pipe(zipRight10(match2(maybeError, {
42187
42370
  onNone: () => void_8,
42188
42371
  onSome: (error) => fail15(error)
@@ -42198,7 +42381,7 @@ var asyncEffect3 = (register, bufferSize) => pipe(acquireRelease2(queueFromBuffe
42198
42381
  }
42199
42382
  }
42200
42383
  }))), map21(() => {
42201
- const loop3 = pipe(take4(output), flatMap15(done11), match15({
42384
+ const loop3 = pipe(take4(output), flatMap15(done11), match16({
42202
42385
  onFailure: (maybeError) => pipe(fromEffect5(shutdown2(output)), zipRight10(match2(maybeError, {
42203
42386
  onNone: () => void_8,
42204
42387
  onSome: fail15
@@ -42285,7 +42468,7 @@ var bufferChunks = /* @__PURE__ */ dual(2, (self, options) => {
42285
42468
  }
42286
42469
  const queue = toQueue2(self, options);
42287
42470
  return new StreamImpl(unwrapScoped3(map21(queue, (queue2) => {
42288
- const process2 = pipe(fromEffect5(take4(queue2)), flatMap18(match21({
42471
+ const process2 = pipe(fromEffect5(take4(queue2)), flatMap18(match22({
42289
42472
  onEnd: () => void_8,
42290
42473
  onFailure: failCause11,
42291
42474
  onSuccess: (value5) => pipe(write(value5), flatMap18(() => process2))
@@ -42314,7 +42497,7 @@ var bufferUnbounded = (self) => {
42314
42497
  strategy: "unbounded"
42315
42498
  });
42316
42499
  return new StreamImpl(unwrapScoped3(map21(queue, (queue2) => {
42317
- const process2 = pipe(fromEffect5(take4(queue2)), flatMap18(match21({
42500
+ const process2 = pipe(fromEffect5(take4(queue2)), flatMap18(match22({
42318
42501
  onEnd: () => void_8,
42319
42502
  onFailure: failCause11,
42320
42503
  onSuccess: (value5) => flatMap18(write(value5), () => process2)
@@ -42332,7 +42515,7 @@ var bufferSignal = (scoped6, bufferChannel) => {
42332
42515
  });
42333
42516
  };
42334
42517
  const consumer = (queue) => {
42335
- const process2 = pipe(fromEffect5(take4(queue)), flatMap18(([take8, deferred]) => zipRight10(fromEffect5(succeed4(deferred, undefined)), match21(take8, {
42518
+ const process2 = pipe(fromEffect5(take4(queue)), flatMap18(([take8, deferred]) => zipRight10(fromEffect5(succeed4(deferred, undefined)), match22(take8, {
42336
42519
  onEnd: () => void_8,
42337
42520
  onFailure: failCause11,
42338
42521
  onSuccess: (value5) => pipe(write(value5), flatMap18(() => process2))
@@ -42422,8 +42605,8 @@ var combineChunks = /* @__PURE__ */ dual(4, (self, that, s, f) => {
42422
42605
  return toChannel2(unfoldChunkEffect(s, (s2) => flatMap15(f(s2, pullLeft, pullRight), unsome)));
42423
42606
  }))));
42424
42607
  });
42425
- var concat2 = /* @__PURE__ */ dual(2, (self, that) => new StreamImpl(pipe(toChannel2(self), zipRight10(toChannel2(that)))));
42426
- var concatAll2 = (streams) => suspend12(() => pipe(streams, reduce3(empty35, (x, y) => concat2(y)(x))));
42608
+ var concat3 = /* @__PURE__ */ dual(2, (self, that) => new StreamImpl(pipe(toChannel2(self), zipRight10(toChannel2(that)))));
42609
+ var concatAll2 = (streams) => suspend12(() => pipe(streams, reduce3(empty36, (x, y) => concat3(y)(x))));
42427
42610
  var cross = /* @__PURE__ */ dual(2, (left3, right3) => pipe(left3, crossWith(right3, (a, a2) => [a, a2])));
42428
42611
  var crossLeft = /* @__PURE__ */ dual(2, (left3, right3) => pipe(left3, crossWith(right3, (a, _) => a)));
42429
42612
  var crossRight = /* @__PURE__ */ dual(2, (left3, right3) => flatMap21(left3, () => right3));
@@ -42638,7 +42821,7 @@ var dropWhileEffect = /* @__PURE__ */ dual(2, (self, predicate) => {
42638
42821
  return new StreamImpl(pipeToOrFail(toChannel2(self), loop3));
42639
42822
  });
42640
42823
  var either8 = (self) => pipe(self, map30(right2), catchAll7((error) => make61(left2(error))));
42641
- var empty35 = /* @__PURE__ */ new StreamImpl(void_8);
42824
+ var empty36 = /* @__PURE__ */ new StreamImpl(void_8);
42642
42825
  var ensuring7 = /* @__PURE__ */ dual(2, (self, finalizer) => new StreamImpl(pipe(toChannel2(self), ensuring5(finalizer))));
42643
42826
  var ensuringWith2 = /* @__PURE__ */ dual(2, (self, finalizer) => new StreamImpl(ensuringWith(toChannel2(self), finalizer)));
42644
42827
  var context5 = () => fromEffect8(context3());
@@ -42825,7 +43008,7 @@ var fromChunkPubSub = (pubsub, options) => {
42825
43008
  var fromChunkQueue = (queue, options) => pipe(take4(queue), catchAllCause3((cause3) => pipe(isShutdown2(queue), flatMap15((isShutdown7) => isShutdown7 && isInterrupted2(cause3) ? end5() : failCause13(cause3)))), repeatEffectChunkOption, options?.shutdown ? ensuring7(shutdown2(queue)) : identity);
42826
43009
  var fromChunks = (...chunks2) => pipe(fromIterable14(chunks2), flatMap21(fromChunk));
42827
43010
  var fromEffect8 = (effect4) => pipe(effect4, mapError4(some3), fromEffectOption);
42828
- var fromEffectOption = (effect4) => new StreamImpl(unwrap3(match15(effect4, {
43011
+ var fromEffectOption = (effect4) => new StreamImpl(unwrap3(match16(effect4, {
42829
43012
  onFailure: match2({
42830
43013
  onNone: () => void_8,
42831
43014
  onSome: fail15
@@ -42903,7 +43086,7 @@ var fromReadableStreamByob = (...args2) => {
42903
43086
  const releaseLockOnEnd = args2.length === 1 ? args2[0].releaseLockOnEnd === true : false;
42904
43087
  return unwrapScoped5(map21(acquireRelease2(sync8(() => evaluate2().getReader({
42905
43088
  mode: "byob"
42906
- })), (reader) => releaseLockOnEnd ? sync8(() => reader.releaseLock()) : promise2(() => reader.cancel())), (reader) => catchAll7(forever5(readChunkStreamByobReader(reader, onError3, allocSize)), (error) => error === EOF ? empty35 : fail19(error))));
43089
+ })), (reader) => releaseLockOnEnd ? sync8(() => reader.releaseLock()) : promise2(() => reader.cancel())), (reader) => catchAll7(forever5(readChunkStreamByobReader(reader, onError3, allocSize)), (error) => error === EOF ? empty36 : fail19(error))));
42907
43090
  };
42908
43091
  var EOF = /* @__PURE__ */ Symbol.for("effect/Stream/EOF");
42909
43092
  var readChunkStreamByobReader = (reader, onError3, size19) => {
@@ -43016,7 +43199,7 @@ var haltWhenDeferred = /* @__PURE__ */ dual(2, (self, deferred) => {
43016
43199
  onFailure: fail15,
43017
43200
  onDone: () => void_8
43018
43201
  }),
43019
- onSome: (effect4) => unwrap3(match15(effect4, {
43202
+ onSome: (effect4) => unwrap3(match16(effect4, {
43020
43203
  onFailure: fail15,
43021
43204
  onSuccess: () => void_8
43022
43205
  }))
@@ -43035,14 +43218,14 @@ var interleaveWith = /* @__PURE__ */ dual(3, (self, that, decider) => {
43035
43218
  const process2 = (leftDone, rightDone) => readWithCause({
43036
43219
  onInput: (bool) => {
43037
43220
  if (bool && !leftDone) {
43038
- return pipe(fromEffect5(take7(left3)), flatMap18(match21({
43221
+ return pipe(fromEffect5(take7(left3)), flatMap18(match22({
43039
43222
  onEnd: () => rightDone ? void_8 : process2(true, rightDone),
43040
43223
  onFailure: failCause11,
43041
43224
  onSuccess: (chunk5) => pipe(write(chunk5), flatMap18(() => process2(leftDone, rightDone)))
43042
43225
  })));
43043
43226
  }
43044
43227
  if (!bool && !rightDone) {
43045
- return pipe(fromEffect5(take7(right3)), flatMap18(match21({
43228
+ return pipe(fromEffect5(take7(right3)), flatMap18(match22({
43046
43229
  onEnd: () => leftDone ? void_8 : process2(leftDone, true),
43047
43230
  onFailure: failCause11,
43048
43231
  onSuccess: (chunk5) => pipe(write(chunk5), flatMap18(() => process2(leftDone, rightDone)))
@@ -43081,7 +43264,7 @@ var intersperseAffixes = /* @__PURE__ */ dual(2, (self, {
43081
43264
  end: end6,
43082
43265
  middle,
43083
43266
  start: start3
43084
- }) => pipe(make61(start3), concat2(pipe(self, intersperse2(middle))), concat2(make61(end6))));
43267
+ }) => pipe(make61(start3), concat3(pipe(self, intersperse2(middle))), concat3(make61(end6))));
43085
43268
  var interruptAfter = /* @__PURE__ */ dual(2, (self, duration5) => pipe(self, interruptWhen2(sleep2(duration5))));
43086
43269
  var interruptWhen2 = /* @__PURE__ */ dual(2, (self, effect4) => new StreamImpl(pipe(toChannel2(self), interruptWhen(effect4))));
43087
43270
  var interruptWhenDeferred2 = /* @__PURE__ */ dual(2, (self, deferred) => new StreamImpl(pipe(toChannel2(self), interruptWhenDeferred(deferred))));
@@ -43106,7 +43289,7 @@ var mapAccumEffect = /* @__PURE__ */ dual(3, (self, s, f) => suspend12(() => {
43106
43289
  const emit2 = (output) => sync8(() => {
43107
43290
  outputs.push(output);
43108
43291
  });
43109
- return pipe(input, reduce14(s2, (s3, a) => pipe(f(s3, a), flatMap15(([s4, a2]) => pipe(emit2(a2), as7(s4))))), match15({
43292
+ return pipe(input, reduce14(s2, (s3, a) => pipe(f(s3, a), flatMap15(([s4, a2]) => pipe(emit2(a2), as7(s4))))), match16({
43110
43293
  onFailure: (error) => {
43111
43294
  if (outputs.length !== 0) {
43112
43295
  return zipRight10(write(unsafeFromArray(outputs)), fail15(error));
@@ -43178,7 +43361,7 @@ var mergeWith3 = /* @__PURE__ */ dual(3, (self, other, options) => {
43178
43361
  });
43179
43362
  var mkString2 = (self) => run4(self, mkString);
43180
43363
  var never5 = /* @__PURE__ */ fromEffect8(never4);
43181
- var onEnd = /* @__PURE__ */ dual(2, (self, effect4) => concat2(self, drain3(fromEffect8(effect4))));
43364
+ var onEnd = /* @__PURE__ */ dual(2, (self, effect4) => concat3(self, drain3(fromEffect8(effect4))));
43182
43365
  var onError3 = /* @__PURE__ */ dual(2, (self, cleanup) => pipe(self, catchAllCause6((cause3) => fromEffect8(pipe(cleanup(cause3), zipRight7(failCause9(cause3)))))));
43183
43366
  var onDone = /* @__PURE__ */ dual(2, (self, cleanup) => new StreamImpl(pipe(toChannel2(self), ensuringWith((exit3) => isSuccess2(exit3) ? cleanup() : _void))));
43184
43367
  var onStart = /* @__PURE__ */ dual(2, (self, effect4) => unwrap4(as7(effect4, self)));
@@ -43301,7 +43484,7 @@ var mapInputContext6 = /* @__PURE__ */ dual(2, (self, f) => contextWithStream((e
43301
43484
  var provideSomeLayer2 = /* @__PURE__ */ dual(2, (self, layer) => pipe(self, provideLayer(pipe(context4(), merge8(layer)))));
43302
43485
  var range3 = (min7, max9, chunkSize = DefaultChunkSize) => suspend12(() => {
43303
43486
  if (min7 > max9) {
43304
- return empty35;
43487
+ return empty36;
43305
43488
  }
43306
43489
  const go3 = (min8, max10, chunkSize2) => {
43307
43490
  const remaining = max10 - min8 + 1;
@@ -43391,7 +43574,7 @@ var refineOrDieWith = /* @__PURE__ */ dual(3, (self, pf, f) => new StreamImpl(ca
43391
43574
  onNone: () => failCause11(die3(f(error))),
43392
43575
  onSome: fail15
43393
43576
  }))));
43394
- var repeat4 = /* @__PURE__ */ dual(2, (self, schedule2) => filterMap9(repeatEither(self, schedule2), (_) => match(_, {
43577
+ var repeat5 = /* @__PURE__ */ dual(2, (self, schedule2) => filterMap9(repeatEither(self, schedule2), (_) => match(_, {
43395
43578
  onLeft: none2,
43396
43579
  onRight: some3
43397
43580
  })));
@@ -43435,7 +43618,7 @@ var repeatWith = /* @__PURE__ */ dual(3, (self, schedule2, options) => {
43435
43618
  return pipe(driver2(schedule2), map21((driver3) => {
43436
43619
  const provideLastIterationInfo = provideServiceEffect3(CurrentIterationMetadata2, get12(driver3.iterationMeta));
43437
43620
  const process2 = pipe(self, provideLastIterationInfo, map30(options.onElement), toChannel2);
43438
- const loop3 = unwrap3(match15(driver3.next(undefined), {
43621
+ const loop3 = unwrap3(match16(driver3.next(undefined), {
43439
43622
  onFailure: () => void_8,
43440
43623
  onSuccess: (output) => flatMap18(process2, () => zipRight10(write(of2(options.onSchedule(output))), loop3))
43441
43624
  }));
@@ -43445,14 +43628,14 @@ var repeatWith = /* @__PURE__ */ dual(3, (self, schedule2, options) => {
43445
43628
  var repeatWithSchedule = (value5, schedule2) => repeatEffectWithSchedule(succeed13(value5), schedule2);
43446
43629
  var repeatEffectWithSchedule = (effect4, schedule2) => flatMap21(fromEffect8(zip10(effect4, driver2(schedule2))), ([a, driver3]) => {
43447
43630
  const provideLastIterationInfo = provideServiceEffect2(CurrentIterationMetadata2, get12(driver3.iterationMeta));
43448
- return concat2(succeed21(a), unfoldEffect(a, (s) => matchEffect3(driver3.next(s), {
43631
+ return concat3(succeed21(a), unfoldEffect(a, (s) => matchEffect3(driver3.next(s), {
43449
43632
  onFailure: succeed13,
43450
43633
  onSuccess: () => map21(provideLastIterationInfo(effect4), (nextA) => some3([nextA, nextA]))
43451
43634
  })));
43452
43635
  });
43453
43636
  var retry6 = /* @__PURE__ */ dual(2, (self, policy) => driver2(policy).pipe(map21((driver3) => {
43454
43637
  const provideLastIterationInfo = provideServiceEffect3(CurrentIterationMetadata2, get12(driver3.iterationMeta));
43455
- const loop3 = toChannel2(provideLastIterationInfo(self)).pipe(mapOutEffect((out) => as7(driver3.reset, out)), catchAll5((error) => driver3.next(error).pipe(match15({
43638
+ const loop3 = toChannel2(provideLastIterationInfo(self)).pipe(mapOutEffect((out) => as7(driver3.reset, out)), catchAll5((error) => driver3.next(error).pipe(match16({
43456
43639
  onFailure: () => fail15(error),
43457
43640
  onSuccess: () => loop3
43458
43641
  }), unwrap3)));
@@ -43618,16 +43801,16 @@ var slidingSize = /* @__PURE__ */ dual(3, (self, chunkSize, stepSize) => {
43618
43801
  return pipe(toChannel2(self), pipeTo(reader(0)));
43619
43802
  }));
43620
43803
  });
43621
- var split4 = /* @__PURE__ */ dual(2, (self, predicate) => {
43622
- const split5 = (leftovers, input) => {
43804
+ var split5 = /* @__PURE__ */ dual(2, (self, predicate) => {
43805
+ const split6 = (leftovers, input) => {
43623
43806
  const [chunk5, remaining] = pipe(leftovers, appendAll2(input), splitWhere2(predicate));
43624
43807
  if (isEmpty(chunk5) || isEmpty(remaining)) {
43625
43808
  return loop3(pipe(chunk5, appendAll2(pipe(remaining, drop2(1)))));
43626
43809
  }
43627
- return pipe(write(of2(chunk5)), flatMap18(() => split5(empty5(), pipe(remaining, drop2(1)))));
43810
+ return pipe(write(of2(chunk5)), flatMap18(() => split6(empty5(), pipe(remaining, drop2(1)))));
43628
43811
  };
43629
43812
  const loop3 = (leftovers) => readWith({
43630
- onInput: (input) => split5(leftovers, input),
43813
+ onInput: (input) => split6(leftovers, input),
43631
43814
  onFailure: fail15,
43632
43815
  onDone: () => {
43633
43816
  if (isEmpty(leftovers)) {
@@ -43636,7 +43819,7 @@ var split4 = /* @__PURE__ */ dual(2, (self, predicate) => {
43636
43819
  if (isNone2(pipe(leftovers, findFirst4(predicate)))) {
43637
43820
  return zipRight10(write(of2(leftovers)), void_8);
43638
43821
  }
43639
- return zipRight10(split5(empty5(), leftovers), void_8);
43822
+ return zipRight10(split6(empty5(), leftovers), void_8);
43640
43823
  }
43641
43824
  });
43642
43825
  return new StreamImpl(pipe(toChannel2(self), pipeTo(loop3(empty5()))));
@@ -43696,9 +43879,9 @@ var take8 = /* @__PURE__ */ dual(2, (self, n) => {
43696
43879
  });
43697
43880
  return new StreamImpl(pipe(toChannel2(self), pipeToOrFail(0 < n ? loop3(n) : void_8)));
43698
43881
  });
43699
- var takeRight3 = /* @__PURE__ */ dual(2, (self, n) => {
43882
+ var takeRight4 = /* @__PURE__ */ dual(2, (self, n) => {
43700
43883
  if (n <= 0) {
43701
- return empty35;
43884
+ return empty36;
43702
43885
  }
43703
43886
  return new StreamImpl(pipe(succeed13(new RingBuffer(n)), map21((queue) => {
43704
43887
  const reader = readWith({
@@ -44046,8 +44229,8 @@ var unwrapScopedWith3 = (f) => flatten15(scopedWith4((scope5) => f(scope5)));
44046
44229
  var updateService4 = /* @__PURE__ */ dual(3, (self, tag4, f) => pipe(self, mapInputContext6((context6) => pipe(context6, add4(tag4, f(pipe(context6, unsafeGet5(tag4))))))));
44047
44230
  var when5 = /* @__PURE__ */ dual(2, (self, test3) => pipe(self, whenEffect3(sync8(test3))));
44048
44231
  var whenCase = (evaluate2, pf) => whenCaseEffect(pf)(sync8(evaluate2));
44049
- var whenCaseEffect = /* @__PURE__ */ dual(2, (self, pf) => pipe(fromEffect8(self), flatMap21((a) => pipe(pf(a), getOrElse2(() => empty35)))));
44050
- var whenEffect3 = /* @__PURE__ */ dual(2, (self, effect4) => pipe(fromEffect8(effect4), flatMap21((bool) => bool ? self : empty35)));
44232
+ var whenCaseEffect = /* @__PURE__ */ dual(2, (self, pf) => pipe(fromEffect8(self), flatMap21((a) => pipe(pf(a), getOrElse2(() => empty36)))));
44233
+ var whenEffect3 = /* @__PURE__ */ dual(2, (self, effect4) => pipe(fromEffect8(effect4), flatMap21((bool) => bool ? self : empty36)));
44051
44234
  var withSpan6 = function() {
44052
44235
  const dataFirst = typeof arguments[0] !== "string";
44053
44236
  const name = dataFirst ? arguments[1] : arguments[0];
@@ -44103,13 +44286,13 @@ var zipAllSortedByKeyWith = /* @__PURE__ */ dual(2, (self, options) => {
44103
44286
  const pull = (state, pullLeft, pullRight) => {
44104
44287
  switch (state._tag) {
44105
44288
  case OP_DRAIN_LEFT: {
44106
- return pipe(pullLeft, match15({
44289
+ return pipe(pullLeft, match16({
44107
44290
  onFailure: fail7,
44108
44291
  onSuccess: (leftChunk) => succeed6([map5(leftChunk, ([k, a]) => [k, options.onSelf(a)]), DrainLeft])
44109
44292
  }));
44110
44293
  }
44111
44294
  case OP_DRAIN_RIGHT: {
44112
- return pipe(pullRight, match15({
44295
+ return pipe(pullRight, match16({
44113
44296
  onFailure: fail7,
44114
44297
  onSuccess: (rightChunk) => succeed6([map5(rightChunk, ([k, a2]) => [k, options.onOther(a2)]), DrainRight])
44115
44298
  }));
@@ -44347,7 +44530,7 @@ var zipAllWith = /* @__PURE__ */ dual(2, (self, options) => {
44347
44530
  var zipLatest = /* @__PURE__ */ dual(2, (left3, right3) => pipe(left3, zipLatestWith(right3, (a, a2) => [a, a2])));
44348
44531
  var zipLatestAll = (...streams) => {
44349
44532
  if (streams.length === 0) {
44350
- return empty35;
44533
+ return empty36;
44351
44534
  } else if (streams.length === 1) {
44352
44535
  return map30(streams[0], (x) => [x]);
44353
44536
  }
@@ -44359,7 +44542,7 @@ var zipLatestWith = /* @__PURE__ */ dual(3, (left3, right3, f) => {
44359
44542
  return pipe(toPull2(left3), map21(pullNonEmpty), zip10(pipe(toPull2(right3), map21(pullNonEmpty))), flatMap15(([left4, right4]) => pipe(fromEffectOption(raceWith2(left4, right4, {
44360
44543
  onSelfDone: (leftDone, rightFiber) => pipe(suspend5(() => leftDone), zipWith12(join4(rightFiber), (l, r) => [l, r, true])),
44361
44544
  onOtherDone: (rightDone, leftFiber) => pipe(suspend5(() => rightDone), zipWith12(join4(leftFiber), (l, r) => [r, l, false]))
44362
- })), flatMap21(([l, r, leftFirst]) => pipe(fromEffect8(make30([unsafeLast(l), unsafeLast(r)])), flatMap21((latest) => pipe(fromChunk(leftFirst ? pipe(r, map5((a2) => f(unsafeLast(l), a2))) : pipe(l, map5((a) => f(a, unsafeLast(r))))), concat2(pipe(repeatEffectOption(left4), mergeEither(repeatEffectOption(right4)), mapEffectSequential(match({
44545
+ })), flatMap21(([l, r, leftFirst]) => pipe(fromEffect8(make30([unsafeLast(l), unsafeLast(r)])), flatMap21((latest) => pipe(fromChunk(leftFirst ? pipe(r, map5((a2) => f(unsafeLast(l), a2))) : pipe(l, map5((a) => f(a, unsafeLast(r))))), concat3(pipe(repeatEffectOption(left4), mergeEither(repeatEffectOption(right4)), mapEffectSequential(match({
44363
44546
  onLeft: (leftChunk) => modify7(latest, ([_, rightLatest]) => [pipe(leftChunk, map5((a) => f(a, rightLatest))), [unsafeLast(leftChunk), rightLatest]]),
44364
44547
  onRight: (rightChunk) => modify7(latest, ([leftLatest, _]) => [pipe(rightChunk, map5((a2) => f(leftLatest, a2))), [leftLatest, unsafeLast(rightChunk)]])
44365
44548
  })), flatMap21(fromChunk))))))), toPull2)), fromPull2);
@@ -44584,7 +44767,7 @@ class MapDequeue extends Class3 {
44584
44767
  return isFull2(this.dequeue);
44585
44768
  }
44586
44769
  get isEmpty() {
44587
- return isEmpty12(this.dequeue);
44770
+ return isEmpty13(this.dequeue);
44588
44771
  }
44589
44772
  get take() {
44590
44773
  return pipe(take4(this.dequeue), map21((a) => this.f(a)));
@@ -44693,7 +44876,7 @@ var chunks2 = chunks;
44693
44876
  var chunksWith2 = chunksWith;
44694
44877
  var combine11 = combine10;
44695
44878
  var combineChunks2 = combineChunks;
44696
- var concat3 = concat2;
44879
+ var concat4 = concat3;
44697
44880
  var concatAll3 = concatAll2;
44698
44881
  var cross2 = cross;
44699
44882
  var crossLeft2 = crossLeft;
@@ -44714,7 +44897,7 @@ var dropUntilEffect2 = dropUntilEffect;
44714
44897
  var dropWhile6 = dropWhile5;
44715
44898
  var dropWhileEffect2 = dropWhileEffect;
44716
44899
  var either9 = either8;
44717
- var empty36 = empty35;
44900
+ var empty37 = empty36;
44718
44901
  var ensuring8 = ensuring7;
44719
44902
  var ensuringWith3 = ensuringWith2;
44720
44903
  var context6 = context5;
@@ -44841,7 +45024,7 @@ var range4 = range3;
44841
45024
  var rechunk2 = rechunk;
44842
45025
  var refineOrDie2 = refineOrDie;
44843
45026
  var refineOrDieWith2 = refineOrDieWith;
44844
- var repeat5 = repeat4;
45027
+ var repeat6 = repeat5;
44845
45028
  var repeatEffect2 = repeatEffect;
44846
45029
  var repeatEffectChunk2 = repeatEffectChunk;
44847
45030
  var repeatEffectChunkOption2 = repeatEffectChunkOption;
@@ -44894,14 +45077,14 @@ var slidingSize2 = slidingSize;
44894
45077
  var some12 = some11;
44895
45078
  var someOrElse2 = someOrElse;
44896
45079
  var someOrFail2 = someOrFail;
44897
- var split5 = split4;
45080
+ var split6 = split5;
44898
45081
  var splitOnChunk2 = splitOnChunk;
44899
45082
  var splitLines3 = splitLines2;
44900
45083
  var succeed22 = succeed21;
44901
45084
  var sync15 = sync14;
44902
45085
  var suspend13 = suspend12;
44903
45086
  var take9 = take8;
44904
- var takeRight4 = takeRight3;
45087
+ var takeRight5 = takeRight4;
44905
45088
  var takeUntil4 = takeUntil3;
44906
45089
  var takeUntilEffect2 = takeUntilEffect;
44907
45090
  var takeWhile6 = takeWhile5;
@@ -45104,7 +45287,7 @@ class HistoryError extends exports_Data.TaggedError("HistoryError") {
45104
45287
  var exports_Command = {};
45105
45288
  __export(exports_Command, {
45106
45289
  workingDirectory: () => workingDirectory2,
45107
- string: () => string7,
45290
+ string: () => string8,
45108
45291
  streamLines: () => streamLines2,
45109
45292
  stream: () => stream3,
45110
45293
  stdout: () => stdout2,
@@ -45324,7 +45507,7 @@ var stdout = /* @__PURE__ */ dual(2, (self, output) => {
45324
45507
  var start3 = (command) => flatMap15(CommandExecutor, (executor) => executor.start(command));
45325
45508
  var stream2 = (command) => flatMap22(CommandExecutor, (executor) => executor.stream(command));
45326
45509
  var streamLines = (command, encoding) => flatMap22(CommandExecutor, (executor) => executor.streamLines(command, encoding));
45327
- var string6 = /* @__PURE__ */ dual((args2) => isCommand(args2[0]), (command, encoding) => flatMap15(CommandExecutor, (executor) => executor.string(command, encoding)));
45510
+ var string7 = /* @__PURE__ */ dual((args2) => isCommand(args2[0]), (command, encoding) => flatMap15(CommandExecutor, (executor) => executor.string(command, encoding)));
45328
45511
  var workingDirectory = /* @__PURE__ */ dual(2, (self, cwd) => {
45329
45512
  switch (self._tag) {
45330
45513
  case "StandardCommand": {
@@ -45353,7 +45536,7 @@ var runInShell2 = runInShell;
45353
45536
  var start4 = start3;
45354
45537
  var stream3 = stream2;
45355
45538
  var streamLines2 = streamLines;
45356
- var string7 = string6;
45539
+ var string8 = string7;
45357
45540
  var stderr2 = stderr;
45358
45541
  var stdin2 = stdin;
45359
45542
  var stdout2 = stdout;
@@ -45391,10 +45574,10 @@ var Proto4 = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null),
45391
45574
  }
45392
45575
  });
45393
45576
  var make67 = (input) => Object.assign(Object.create(Proto4), input);
45394
- var empty37 = /* @__PURE__ */ Object.create(Proto4);
45577
+ var empty38 = /* @__PURE__ */ Object.create(Proto4);
45395
45578
  var fromInput3 = (input) => {
45396
45579
  if (input === undefined) {
45397
- return empty37;
45580
+ return empty38;
45398
45581
  } else if (Symbol.iterator in input) {
45399
45582
  const out2 = Object.create(Proto4);
45400
45583
  for (const [k, v] of input) {
@@ -45709,7 +45892,7 @@ function parseSetCookie(header) {
45709
45892
  options: Object.keys(options).length > 0 ? options : undefined
45710
45893
  }));
45711
45894
  }
45712
- var isEmpty16 = (self) => isEmptyRecord(self.cookies);
45895
+ var isEmpty17 = (self) => isEmptyRecord(self.cookies);
45713
45896
  var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
45714
45897
  var CookieProto = {
45715
45898
  [CookieTypeId]: CookieTypeId,
@@ -45987,7 +46170,7 @@ var fromInputNested = (input) => {
45987
46170
  }
45988
46171
  return out;
45989
46172
  };
45990
- var empty38 = [];
46173
+ var empty39 = [];
45991
46174
  var set12 = /* @__PURE__ */ dual(3, (self, key, value5) => append(filter3(self, ([k]) => k !== key), [key, String(value5)]));
45992
46175
  var setAll4 = /* @__PURE__ */ dual(2, (self, input) => {
45993
46176
  const out = fromInput4(input);
@@ -46091,7 +46274,7 @@ class EmptyImpl extends BodyBase {
46091
46274
  };
46092
46275
  }
46093
46276
  }
46094
- var empty39 = /* @__PURE__ */ new EmptyImpl;
46277
+ var empty40 = /* @__PURE__ */ new EmptyImpl;
46095
46278
 
46096
46279
  class RawImpl extends BodyBase {
46097
46280
  body;
@@ -46247,8 +46430,8 @@ function makeInternal(method, url3, urlParams2, hash2, headers, body) {
46247
46430
  return self;
46248
46431
  }
46249
46432
  var isClientRequest = (u) => typeof u === "object" && u !== null && (TypeId32 in u);
46250
- var empty40 = /* @__PURE__ */ makeInternal("GET", "", empty38, /* @__PURE__ */ none2(), empty37, empty39);
46251
- var make70 = (method) => (url3, options) => modify10(empty40, {
46433
+ var empty41 = /* @__PURE__ */ makeInternal("GET", "", empty39, /* @__PURE__ */ none2(), empty38, empty40);
46434
+ var make70 = (method) => (url3, options) => modify10(empty41, {
46252
46435
  method,
46253
46436
  url: url3,
46254
46437
  ...options ?? undefined
@@ -46765,7 +46948,7 @@ var retryTransient = /* @__PURE__ */ dual(2, (self, options3) => {
46765
46948
  const schedule4 = isOnlySchedule ? options3 : options3.schedule;
46766
46949
  const passthroughSchedule = schedule4 && passthrough4(schedule4);
46767
46950
  const times2 = isOnlySchedule ? undefined : options3.times;
46768
- return transformResponse(self, flow(mode === "errors-only" ? identity : repeat3({
46951
+ return transformResponse(self, flow(mode === "errors-only" ? identity : repeat4({
46769
46952
  schedule: passthroughSchedule,
46770
46953
  times: times2,
46771
46954
  while: isTransientResponse
@@ -46786,7 +46969,7 @@ var tapRequest = /* @__PURE__ */ dual(2, (self, f) => {
46786
46969
  });
46787
46970
  var withCookiesRef = /* @__PURE__ */ dual(2, (self, ref) => {
46788
46971
  const client = self;
46789
- return makeWith((request2) => tap4(client.postprocess(request2), (response) => update3(ref, (cookies) => merge12(cookies, response.cookies))), (request2) => flatMap15(client.preprocess(request2), (request3) => map21(get12(ref), (cookies) => isEmpty16(cookies) ? request3 : setHeader(request3, "cookie", toCookieHeader(cookies)))));
46972
+ return makeWith((request2) => tap4(client.postprocess(request2), (response) => update3(ref, (cookies) => merge12(cookies, response.cookies))), (request2) => flatMap15(client.preprocess(request2), (request3) => map21(get12(ref), (cookies) => isEmpty17(cookies) ? request3 : setHeader(request3, "cookie", toCookieHeader(cookies)))));
46790
46973
  });
46791
46974
  var followRedirects = /* @__PURE__ */ dual((args2) => isClient(args2[0]), (self, maxRedirects) => {
46792
46975
  const client = self;
@@ -46857,7 +47040,7 @@ __export(exports_HttpBody, {
46857
47040
  fileWeb: () => fileWeb2,
46858
47041
  fileInfo: () => fileInfo2,
46859
47042
  file: () => file2,
46860
- empty: () => empty41,
47043
+ empty: () => empty42,
46861
47044
  TypeId: () => TypeId35,
46862
47045
  HttpBodyError: () => HttpBodyError2,
46863
47046
  ErrorTypeId: () => ErrorTypeId2
@@ -46866,7 +47049,7 @@ var TypeId35 = TypeId31;
46866
47049
  var isHttpBody = (u) => hasProperty(u, TypeId35);
46867
47050
  var ErrorTypeId2 = ErrorTypeId;
46868
47051
  var HttpBodyError2 = HttpBodyError;
46869
- var empty41 = empty39;
47052
+ var empty42 = empty40;
46870
47053
  var raw2 = raw;
46871
47054
  var uint8Array2 = uint8Array;
46872
47055
  var text2 = text;
@@ -47082,12 +47265,42 @@ var wrapBotHttp = (inner, resolveDirectory, selfUserId) => ({
47082
47265
  get: (path, schema, params) => inner.get(path, schema, params),
47083
47266
  post: (path, schema, body) => {
47084
47267
  const guard = path === "/messages" ? checkNotBotToBotDirect(body, resolveDirectory, selfUserId) : exports_Effect.void;
47085
- return guard.pipe(exports_Effect.flatMap(() => inner.post(path, schema, body)), exports_Effect.catchTag("BotToBotDirectMessageError", (cause3) => exports_Effect.die(cause3)));
47268
+ return guard.pipe(exports_Effect.andThen(inner.post(path, schema, body)), exports_Effect.catchTag("BotToBotDirectMessageError", (cause3) => exports_Effect.die(cause3)));
47086
47269
  },
47087
47270
  patch: (path, schema, body) => inner.patch(path, schema, body),
47088
47271
  delete: (path, schema, body) => inner.delete(path, schema, body)
47089
47272
  });
47090
47273
 
47274
+ // packages/zulip/permalink.ts
47275
+ var HASH_REPLACEMENTS = {
47276
+ "%": ".",
47277
+ "!": ".21",
47278
+ "'": ".27",
47279
+ "(": ".28",
47280
+ ")": ".29",
47281
+ "*": ".2A",
47282
+ ".": ".2E"
47283
+ };
47284
+ var encodeHashComponent = (value5) => encodeURIComponent(value5).replace(/[%!'()*.]/g, (matched) => HASH_REPLACEMENTS[matched] ?? matched);
47285
+ var permalinkBase = (config2) => config2.hostHeader === undefined ? config2.realmUrl.replace(/\/+$/, "") : `https://${config2.hostHeader}`;
47286
+ var channelSlug = (channel) => `${channel.id}-${encodeHashComponent(channel.name.replaceAll(" ", "-"))}`;
47287
+ var channelPermalink = (base, channel) => `${base}/#narrow/channel/${channelSlug(channel)}`;
47288
+ var topicPermalink = (base, channel, topic) => `${channelPermalink(base, channel)}/topic/${encodeHashComponent(topic)}`;
47289
+ var messagePermalink = (base, channel, id3, topic) => topic === undefined ? `${channelPermalink(base, channel)}/near/${id3}` : `${topicPermalink(base, channel, topic)}/near/${id3}`;
47290
+ var withChannelPermalink = (base, channel) => ({ ...channel, permalink: channelPermalink(base, channel) });
47291
+ var buildMessageRef = (base, id3, channel, threadName3) => {
47292
+ const decoratedChannel = withChannelPermalink(base, channel);
47293
+ return threadName3 === undefined ? { id: id3, channel: decoratedChannel, permalink: messagePermalink(base, decoratedChannel, id3) } : {
47294
+ id: id3,
47295
+ channel: decoratedChannel,
47296
+ thread: {
47297
+ name: threadName3,
47298
+ permalink: topicPermalink(base, decoratedChannel, threadName3)
47299
+ },
47300
+ permalink: messagePermalink(base, decoratedChannel, id3, threadName3)
47301
+ };
47302
+ };
47303
+
47091
47304
  // packages/zulip/events.ts
47092
47305
  var createMessageRefCache = (maxSize = 1e4) => {
47093
47306
  const map32 = new Map;
@@ -47104,11 +47317,11 @@ var createMessageRefCache = (maxSize = 1e4) => {
47104
47317
  },
47105
47318
  get(id3) {
47106
47319
  const ref = map32.get(id3);
47107
- if (ref === undefined)
47108
- return;
47109
- map32.delete(id3);
47110
- map32.set(id3, ref);
47111
- return ref;
47320
+ if (ref !== undefined) {
47321
+ map32.delete(id3);
47322
+ map32.set(id3, ref);
47323
+ }
47324
+ return exports_Option.fromNullable(ref);
47112
47325
  }
47113
47326
  };
47114
47327
  };
@@ -47163,8 +47376,8 @@ var MENTION_PATTERN = /@\*\*([^*]+)\*\*/g;
47163
47376
  var extractMentions = (content, byName) => {
47164
47377
  const results = [];
47165
47378
  const seen = new Set;
47166
- for (const match22 of content.matchAll(MENTION_PATTERN)) {
47167
- const name = match22[1];
47379
+ for (const match23 of content.matchAll(MENTION_PATTERN)) {
47380
+ const name = match23[1];
47168
47381
  if (name === undefined)
47169
47382
  continue;
47170
47383
  const ident = byName.get(name);
@@ -47177,16 +47390,12 @@ var extractMentions = (content, byName) => {
47177
47390
  }
47178
47391
  return results;
47179
47392
  };
47180
- var decodeMessageRef = (message) => exports_Effect.gen(function* () {
47393
+ var decodeMessageRef = (message, base) => exports_Effect.gen(function* () {
47181
47394
  const id3 = yield* decodeMessageId(String(message.id));
47182
47395
  const channelId = yield* decodeChannelId(String(message.stream_id));
47183
47396
  const channelName = yield* decodeChannelName(message.display_recipient);
47184
47397
  const threadName3 = yield* decodeThreadName(message.subject);
47185
- return {
47186
- id: id3,
47187
- channel: { id: channelId, name: channelName },
47188
- thread: { name: threadName3 }
47189
- };
47398
+ return buildMessageRef(base, id3, { id: channelId, name: channelName }, threadName3);
47190
47399
  });
47191
47400
  var decodeSenderIdentity = (message, directory) => {
47192
47401
  const cached4 = directory.byId.get(message.sender_id);
@@ -47198,9 +47407,9 @@ var decodeSenderIdentity = (message, directory) => {
47198
47407
  return { id: id3, name, kind: "human" };
47199
47408
  });
47200
47409
  };
47201
- var messageToInboundEvents = (message, directory, boundIdentity) => exports_Effect.gen(function* () {
47410
+ var messageToInboundEvents = (message, directory, boundIdentity, base) => exports_Effect.gen(function* () {
47202
47411
  const sender = yield* decodeSenderIdentity(message, directory);
47203
- const ref = yield* decodeMessageRef(message);
47412
+ const ref = yield* decodeMessageRef(message, base);
47204
47413
  const body = yield* decodeMessageBody(message.content);
47205
47414
  const ts = yield* decodeTimestamp(message.timestamp);
47206
47415
  const portMessage = {
@@ -47223,12 +47432,12 @@ var messageToInboundEvents = (message, directory, boundIdentity) => exports_Effe
47223
47432
  });
47224
47433
  var channelShapeSchema = exports_Schema.Struct({ stream_id: exports_Schema.Number });
47225
47434
  var decodeChannelShape = exports_Schema.decodeUnknownEither(channelShapeSchema);
47226
- var mapMessageEvent = (raw3, directory, boundIdentity) => {
47435
+ var mapMessageEvent = (raw3, directory, boundIdentity, base) => {
47227
47436
  const message = raw3["message"];
47228
47437
  if (exports_Either.isLeft(decodeChannelShape(message))) {
47229
47438
  return exports_Effect.succeed([]);
47230
47439
  }
47231
- return decodeZulipMessageContent(message).pipe(exports_Effect.flatMap((parsed) => messageToInboundEvents(parsed, directory, boundIdentity)));
47440
+ return decodeZulipMessageContent(message).pipe(exports_Effect.flatMap((parsed) => messageToInboundEvents(parsed, directory, boundIdentity, base)));
47232
47441
  };
47233
47442
  var reactionKind = (op) => op === "add" ? "reaction-added" : "reaction-removed";
47234
47443
  var decodeReactionIdentity = (reaction, directory) => {
@@ -47267,7 +47476,7 @@ var singleMessageResponseSchema = exports_Schema.Struct({
47267
47476
  result: exports_Schema.Literal("success"),
47268
47477
  messages: exports_Schema.Array(zulipMessageContentSchema)
47269
47478
  });
47270
- var fetchMessageRef = (http, messageId) => http.get("/messages", singleMessageResponseSchema, {
47479
+ var fetchMessageRef = (http, messageId, base) => http.get("/messages", singleMessageResponseSchema, {
47271
47480
  anchor: messageId,
47272
47481
  num_before: 0,
47273
47482
  num_after: 0,
@@ -47277,7 +47486,7 @@ var fetchMessageRef = (http, messageId) => http.get("/messages", singleMessageRe
47277
47486
  const message = res.messages[0];
47278
47487
  if (message === undefined || message.id !== messageId)
47279
47488
  return exports_Effect.succeed(exports_Option.none());
47280
- return decodeMessageRef(message).pipe(exports_Effect.map(exports_Option.some));
47489
+ return decodeMessageRef(message, base).pipe(exports_Effect.map(exports_Option.some));
47281
47490
  }));
47282
47491
  var describeError = (err) => messageOf(err);
47283
47492
  var markReplayed = (events) => events.map((ev) => {
@@ -47290,7 +47499,7 @@ var defaultRetrySchedule = exports_Schedule.exponential(exports_Duration.seconds
47290
47499
  var skipWithLog = (line) => exports_Effect.logInfo(line).pipe(exports_Effect.as([]));
47291
47500
  var processSingleEvent = (evt, directory, config2) => {
47292
47501
  if (evt.type === "message") {
47293
- return mapMessageEvent(evt, directory, config2.boundIdentity).pipe(exports_Effect.tap((events) => exports_Effect.sync(() => {
47502
+ return mapMessageEvent(evt, directory, config2.boundIdentity, config2.permalinkBase).pipe(exports_Effect.tap((events) => exports_Effect.sync(() => {
47294
47503
  if (config2.messageRefCache !== undefined) {
47295
47504
  populateCacheFromInboundEvents(config2.messageRefCache, events);
47296
47505
  }
@@ -47303,18 +47512,18 @@ var processSingleEvent = (evt, directory, config2) => {
47303
47512
  return skipWithLog(`commy zulip events: skipping malformed reaction event id=${evt.id}: ${parsedReaction.left.message}`);
47304
47513
  }
47305
47514
  const reaction = parsedReaction.right;
47306
- const cachedTarget = cache.get(String(reaction.message_id));
47307
47515
  const eventsForTarget = (target) => reactionToInboundEvent(reaction, directory, target).pipe(exports_Effect.map((ev) => [ev]));
47308
- if (cachedTarget !== undefined) {
47309
- return eventsForTarget(cachedTarget).pipe(exports_Effect.catchTag("ParseError", (err) => skipWithLog(`commy zulip events: skipping reaction event id=${evt.id}: ${describeError(err)}`)));
47310
- }
47311
- return fetchMessageRef(config2.http, reaction.message_id).pipe(exports_Effect.flatMap(exports_Option.match({
47312
- onNone: () => exports_Effect.succeed([]),
47313
- onSome: (target) => {
47314
- cache.set(target.id, target);
47315
- return eventsForTarget(target);
47316
- }
47317
- })), exports_Effect.catchTag("ParseError", (err) => skipWithLog(`commy zulip events: skipping reaction event id=${evt.id}: ${describeError(err)}`)));
47516
+ const resolveTarget = cache.get(String(reaction.message_id)).pipe(exports_Option.match({
47517
+ onSome: eventsForTarget,
47518
+ onNone: () => fetchMessageRef(config2.http, reaction.message_id, config2.permalinkBase).pipe(exports_Effect.flatMap(exports_Option.match({
47519
+ onNone: () => exports_Effect.succeed([]),
47520
+ onSome: (target) => {
47521
+ cache.set(target.id, target);
47522
+ return eventsForTarget(target);
47523
+ }
47524
+ })))
47525
+ }));
47526
+ return resolveTarget.pipe(exports_Effect.catchTag("ParseError", (err) => skipWithLog(`commy zulip events: skipping reaction event id=${evt.id}: ${describeError(err)}`)));
47318
47527
  }
47319
47528
  return exports_Effect.succeed([]);
47320
47529
  };
@@ -47416,8 +47625,8 @@ var envelopeSchema = exports_Schema.Struct({
47416
47625
  var decodeEnvelope = exports_Schema.decodeUnknownEither(exports_Schema.parseJson(envelopeSchema), {
47417
47626
  onExcessProperty: "preserve"
47418
47627
  });
47419
- var UserUploadPathSchema = exports_Schema.NonEmptyString.pipe(exports_Schema.pattern(/^\/user_uploads\//));
47420
- var decodeUserUploadPath = (raw3) => exports_Schema.decodeUnknown(UserUploadPathSchema)(raw3).pipe(exports_Effect.map((v) => v));
47628
+ var UserUploadPathSchema = exports_Schema.NonEmptyString.pipe(exports_Schema.pattern(/^\/user_uploads\//), exports_Schema.brand("UserUploadPath"));
47629
+ var decodeUserUploadPath = (raw3) => exports_Schema.decodeUnknown(UserUploadPathSchema)(raw3);
47421
47630
  var uploadResponseSchema = exports_Schema.Struct({
47422
47631
  url: exports_Schema.String,
47423
47632
  filename: exports_Schema.String
@@ -47441,38 +47650,26 @@ var rateLimitSchedule = () => exports_Schedule.makeWithState({ waitedMs: 0 }, (n
47441
47650
  ]);
47442
47651
  });
47443
47652
  var parseEnvelope = (text3) => {
47444
- if (text3.length === 0)
47445
- return;
47446
- return exports_Either.getOrUndefined(decodeEnvelope(text3));
47653
+ if (exports_String.isEmpty(text3))
47654
+ return exports_Option.none();
47655
+ return exports_Either.getRight(decodeEnvelope(text3));
47447
47656
  };
47448
47657
  var classifyEnvelope = (text3, status3, url3) => {
47449
- const env3 = parseEnvelope(text3);
47450
- if (env3 !== undefined && env3.result === "error") {
47451
- return exports_Either.left(new ZulipApiError({
47452
- message: env3.msg ?? `HTTP ${status3}`,
47453
- status: status3,
47454
- code: env3.code,
47455
- retryAfter: env3["retry-after"]
47456
- }));
47457
- }
47458
- if (status3 < 200 || status3 >= 300) {
47459
- const message = env3?.msg ?? (text3.length > 0 ? text3 : `HTTP ${status3}`);
47460
- return exports_Either.left(new ZulipApiError({
47461
- message,
47462
- status: status3,
47463
- code: env3?.code,
47464
- retryAfter: env3?.["retry-after"]
47465
- }));
47466
- }
47467
- if (env3 === undefined) {
47468
- return exports_Either.left(new ZulipApiError({
47469
- message: `non-JSON response from ${url3}`,
47658
+ const outOfRange = status3 < 200 || status3 >= 300;
47659
+ return exports_Option.match(parseEnvelope(text3), {
47660
+ onNone: () => exports_Either.left(new ZulipApiError({
47661
+ message: outOfRange ? text3.length > 0 ? text3 : `HTTP ${status3}` : `non-JSON response from ${url3}`,
47470
47662
  status: status3,
47471
47663
  code: undefined,
47472
47664
  retryAfter: undefined
47473
- }));
47474
- }
47475
- return exports_Either.right(text3);
47665
+ })),
47666
+ onSome: (env3) => env3.result === "error" || outOfRange ? exports_Either.left(new ZulipApiError({
47667
+ message: env3.result === "error" ? env3.msg ?? `HTTP ${status3}` : env3.msg ?? text3,
47668
+ status: status3,
47669
+ code: env3.code,
47670
+ retryAfter: env3["retry-after"]
47671
+ })) : exports_Either.right(text3)
47672
+ });
47476
47673
  };
47477
47674
  var transportError = (url3, cause3) => new ZulipApiError({
47478
47675
  message: messageOf(cause3, `transport failure for ${url3}`),
@@ -47554,6 +47751,12 @@ class ReactivateForbidden extends exports_Data.TaggedError("ReactivateForbidden"
47554
47751
  return `cannot reactivate deactivated bot ${this.userId}: the minter is not an ` + `organization administrator, and POST /users/{id}/reactivate is admin-only. ` + `Pin this identity with COMMY_BOT_NAME so it is never deactivated on ` + `release, or grant the minter admin rights. Underlying realm ` + `error: ${this.cause.message}`;
47555
47752
  }
47556
47753
  }
47754
+
47755
+ class AttachIdentityNotFound extends exports_Data.TaggedError("AttachIdentityNotFound") {
47756
+ get message() {
47757
+ return `attach mode: no provisioned bot named '${this.name}' on the realm. ` + `Provision the persona once and supply its stable api key before attaching.`;
47758
+ }
47759
+ }
47557
47760
  var SHORT_NAME_PATTERN = /[^a-z0-9._-]/g;
47558
47761
  var sanitiseShortName = (name) => {
47559
47762
  const collapsed = name.toLowerCase().replace(SHORT_NAME_PATTERN, "-");
@@ -47597,14 +47800,14 @@ var historicalMessageRawSchema = exports_Schema.Struct({
47597
47800
  timestamp: exports_Schema.NonNegative,
47598
47801
  reactions: exports_Schema.optional(exports_Schema.Array(historicalReactionSchema))
47599
47802
  });
47600
- var toHistoricalReaction = (r) => ({ userId: r.user_id, emojiName: r.emoji_name });
47803
+ var toHistoricalReaction = (r) => ({ userId: ZulipUserRef(r.user_id), emojiName: r.emoji_name });
47601
47804
  var toHistoricalMessage = (m) => exports_Effect.all({
47602
47805
  id: decodeMessageId(String(m.id)),
47603
47806
  subject: decodeThreadName(m.subject),
47604
47807
  ts: decodeTimestamp(m.timestamp)
47605
47808
  }).pipe(exports_Effect.map(({ id: id3, subject, ts }) => ({
47606
47809
  id: id3,
47607
- senderId: m.sender_id,
47810
+ senderId: ZulipUserRef(m.sender_id),
47608
47811
  senderFullName: m.sender_full_name,
47609
47812
  subject,
47610
47813
  content: m.content,
@@ -47686,7 +47889,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47686
47889
  const byIdentityId = new Map;
47687
47890
  for (const u of members) {
47688
47891
  const ident = yield* toIdentity(u);
47689
- byId.set(u.user_id, ident);
47892
+ byId.set(ZulipUserRef(u.user_id), ident);
47690
47893
  byName.set(u.full_name, ident);
47691
47894
  byIdentityId.set(ident.id, ZulipUserRef(u.user_id));
47692
47895
  }
@@ -47699,8 +47902,8 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47699
47902
  const extractMentions2 = (content, byName) => {
47700
47903
  const results = [];
47701
47904
  const seen = new Set;
47702
- for (const match22 of content.matchAll(MENTION_PATTERN2)) {
47703
- const name = match22[1];
47905
+ for (const match23 of content.matchAll(MENTION_PATTERN2)) {
47906
+ const name = match23[1];
47704
47907
  if (name === undefined)
47705
47908
  continue;
47706
47909
  const ident = byName.get(name);
@@ -47741,7 +47944,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47741
47944
  const body = yield* decodeMessageBody(m.content);
47742
47945
  const reactions = yield* mapHistoricalReactions(m.reactions, directory2);
47743
47946
  return {
47744
- ref: { id: m.id, channel, thread: { name: m.subject } },
47947
+ ref: decorateMessageRef(m.id, channel, m.subject),
47745
47948
  sender,
47746
47949
  body,
47747
47950
  ts: m.ts,
@@ -47760,6 +47963,9 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47760
47963
  })
47761
47964
  ], { concurrency: 2 }).pipe(exports_Effect.flatMap(([directory2, res]) => exports_Effect.forEach(res.messages, toHistoricalMessage).pipe(exports_Effect.map((historical) => historical.filter(inRange(range5))), exports_Effect.flatMap((inRangeMessages) => exports_Effect.forEach(inRangeMessages, (m) => mapHistoricalMessage(m, channel, directory2))))));
47762
47965
  const realmHost = new URL(config2.realmUrl).hostname;
47966
+ const base = permalinkBase(config2);
47967
+ const decorateChannel = (channel) => withChannelPermalink(base, channel);
47968
+ const decorateMessageRef = (id3, channel, threadName3) => buildMessageRef(base, id3, channel, threadName3);
47763
47969
  const buildBotEmail = (shortName) => BotEmail(`${shortName}-bot@${realmHost}`);
47764
47970
  const findAnyBotByName = (name) => minterHttp.get("/users", usersSchema).pipe(exports_Effect.map((res) => exports_Option.fromNullable(res.members.find((u) => u.full_name === name && u.is_bot))));
47765
47971
  const mintBot = (name) => {
@@ -47790,9 +47996,21 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47790
47996
  onNone: () => mintBot(name),
47791
47997
  onSome: (existing) => {
47792
47998
  const reactivate = existing.is_active ? exports_Effect.void : reactivateBot(existing);
47793
- return reactivate.pipe(exports_Effect.flatMap(() => regenerateBotKey(existing)));
47999
+ return reactivate.pipe(exports_Effect.andThen(regenerateBotKey(existing)));
47794
48000
  }
47795
48001
  })));
48002
+ const attachBot = (name, apiKey) => findAnyBotByName(name).pipe(exports_Effect.flatMap(exports_Option.match({
48003
+ onNone: () => exports_Effect.fail(new AttachIdentityNotFound({ name })),
48004
+ onSome: (existing) => BotEmail(existing.email).pipe(exports_Effect.map((email) => ({
48005
+ userId: ZulipUserRef(existing.user_id),
48006
+ apiKey,
48007
+ email
48008
+ })))
48009
+ })));
48010
+ const provideMintedFor = (name) => {
48011
+ const attach = config2.attachIdentity;
48012
+ return attach !== undefined && attach.name === name ? attachBot(name, exports_Redacted.value(attach.apiKey)) : acquireBot(name);
48013
+ };
47796
48014
  const identity6 = {
47797
48015
  currentIdentity: () => requireBound().pipe(exports_Effect.map((b) => b.identity)),
47798
48016
  acquire: (name) => exports_SynchronizedRef.modifyEffect(boundRef, (current2) => exports_Option.match(current2, {
@@ -47805,7 +48023,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47805
48023
  }
47806
48024
  return exports_Effect.die(new Error(`zulipAdapter: already bound to ${existing.acquiredName} — release() before acquiring ${name}`));
47807
48025
  },
47808
- onNone: () => acquireBot(name).pipe(exports_Effect.flatMap((minted) => exports_Effect.gen(function* () {
48026
+ onNone: () => provideMintedFor(name).pipe(exports_Effect.flatMap((minted) => exports_Effect.gen(function* () {
47809
48027
  const innerHttp = yield* makeZulipHttp(buildHttpConfig(config2.realmUrl, minted.email, minted.apiKey, config2.hostHeader)).pipe(exports_Effect.provideService(exports_HttpClient.HttpClient, httpClient));
47810
48028
  const http = wrapBotHttp(innerHttp, recipientDirectory, minted.userId);
47811
48029
  const ident = {
@@ -47826,7 +48044,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47826
48044
  userId: minted.userId,
47827
48045
  http
47828
48046
  };
47829
- yield* exports_Ref.update(inboxRef, (state) => ({
48047
+ yield* exports_SynchronizedRef.update(inboxRef, (state) => ({
47830
48048
  ...state,
47831
48049
  mentionsSubscribed: true
47832
48050
  }));
@@ -47839,7 +48057,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47839
48057
  })).pipe(exports_Effect.asVoid),
47840
48058
  resolve: (name) => minterHttp.get("/users", usersSchema).pipe(exports_Effect.flatMap((res) => exports_Array.findFirst(res.members, (u) => u.is_active && u.full_name === name).pipe(exports_Option.match({
47841
48059
  onNone: () => exports_Effect.succeed(exports_Option.none()),
47842
- onSome: (match22) => toIdentity(match22).pipe(exports_Effect.map(exports_Option.some))
48060
+ onSome: (match23) => toIdentity(match23).pipe(exports_Effect.map(exports_Option.some))
47843
48061
  }))), exports_Effect.mapError((cause3) => new IdentityError({ operation: "resolve", cause: cause3 })))
47844
48062
  };
47845
48063
  const directory = {
@@ -47891,10 +48109,10 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47891
48109
  }).pipe(exports_Effect.flatMap((res) => exports_Effect.gen(function* () {
47892
48110
  const map32 = new Map;
47893
48111
  for (const s of res.streams) {
47894
- map32.set(s.name, {
48112
+ map32.set(s.name, decorateChannel({
47895
48113
  id: yield* decodeChannelId(String(s.stream_id)),
47896
48114
  name: yield* decodeChannelName(s.name)
47897
- });
48115
+ }));
47898
48116
  }
47899
48117
  return map32;
47900
48118
  })));
@@ -47916,7 +48134,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47916
48134
  to: effective.name,
47917
48135
  content: body,
47918
48136
  topic: thread === undefined ? "(no topic)" : thread.name
47919
- }).pipe(exports_Effect.flatMap((sent) => decodeMessageId(String(sent.id)).pipe(exports_Effect.map((id3) => thread === undefined ? { id: id3, channel: effective } : { id: id3, channel: effective, thread }))))))), exports_Effect.mapError((cause3) => cause3 instanceof UnknownChannel ? cause3 : new PublisherError({ operation: "post", cause: cause3 })));
48137
+ }).pipe(exports_Effect.flatMap((sent) => decodeMessageId(String(sent.id)).pipe(exports_Effect.map((id3) => decorateMessageRef(id3, effective, thread?.name)))))))), exports_Effect.mapError((cause3) => cause3 instanceof UnknownChannel ? cause3 : new PublisherError({ operation: "post", cause: cause3 })));
47920
48138
  },
47921
48139
  edit: (message, body) => boundHttp().pipe(exports_Effect.flatMap((http) => http.patch(`/messages/${encodeURIComponent(message.id)}`, successSchema2, {
47922
48140
  content: body
@@ -47928,13 +48146,12 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47928
48146
  emoji_name: emoji
47929
48147
  })), exports_Effect.asVoid, exports_Effect.mapError((cause3) => new PublisherError({ operation: "unreact", cause: cause3 })))
47930
48148
  };
47931
- const inboxRef = yield* exports_Ref.make({
48149
+ const inboxRef = yield* exports_SynchronizedRef.make({
47932
48150
  mentionsSubscribed: false,
47933
48151
  subscribedChannels: exports_HashSet.empty(),
47934
48152
  newTopicsChannels: exports_HashSet.empty(),
47935
48153
  seenTopicsByChannel: exports_HashMap.empty(),
47936
- registeredQueue: exports_Option.none(),
47937
- registeredMode: exports_Option.none()
48154
+ registration: exports_Option.none()
47938
48155
  });
47939
48156
  const messageRefCache = createMessageRefCache();
47940
48157
  const watermarkStore = yield* createWatermarkStore();
@@ -47946,7 +48163,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47946
48163
  const thread = message.ref.thread;
47947
48164
  return exports_SynchronizedRef.get(boundRef).pipe(exports_Effect.flatMap((current2) => {
47948
48165
  const me = exports_Option.getOrUndefined(current2)?.identity;
47949
- return exports_Ref.modify(inboxRef, (state) => {
48166
+ return exports_SynchronizedRef.modify(inboxRef, (state) => {
47950
48167
  if (!exports_HashSet.has(state.newTopicsChannels, cid))
47951
48168
  return [true, state];
47952
48169
  const [isFirstOfTopic, ticked] = thread === undefined ? [false, state] : observeNewTopic(state, cid, thread.name);
@@ -47959,26 +48176,28 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47959
48176
  });
47960
48177
  }));
47961
48178
  };
47962
- const ensureQueueRegistered = () => exports_Ref.get(inboxRef).pipe(exports_Effect.flatMap((state) => {
48179
+ const ensureQueueRegistered = () => exports_SynchronizedRef.modifyEffect(inboxRef, (state) => {
47963
48180
  const mode = currentMode(state);
47964
- if (exports_Option.isSome(state.registeredQueue) && exports_Option.contains(state.registeredMode, mode)) {
47965
- return exports_Effect.void;
48181
+ if (exports_Option.exists(state.registration, (r) => r.mode === mode)) {
48182
+ return exports_Effect.succeed([undefined, state]);
47966
48183
  }
47967
- return registerQueue(minterHttp, mode).pipe(exports_Effect.flatMap((q) => exports_Ref.update(inboxRef, (current2) => ({
47968
- ...current2,
47969
- registeredQueue: exports_Option.some(q),
47970
- registeredMode: exports_Option.some(mode)
47971
- }))));
47972
- }));
48184
+ return registerQueue(minterHttp, mode).pipe(exports_Effect.map((q) => [
48185
+ undefined,
48186
+ { ...state, registration: exports_Option.some(exports_Data.struct({ queue: q, mode })) }
48187
+ ]));
48188
+ });
47973
48189
  const inbox = {
47974
48190
  subscribe: (target) => exports_Effect.suspend(() => {
47975
48191
  if (target === "mentions") {
47976
- return exports_Ref.update(inboxRef, (state) => ({ ...state, mentionsSubscribed: true })).pipe(exports_Effect.flatMap(() => ensureQueueRegistered()));
48192
+ return exports_SynchronizedRef.update(inboxRef, (state) => ({
48193
+ ...state,
48194
+ mentionsSubscribed: true
48195
+ })).pipe(exports_Effect.andThen(ensureQueueRegistered()));
47977
48196
  }
47978
48197
  const channel = channelOf(target);
47979
48198
  if (channel === undefined)
47980
48199
  return ensureQueueRegistered();
47981
- return exports_Ref.modify(inboxRef, (state) => {
48200
+ return exports_SynchronizedRef.modify(inboxRef, (state) => {
47982
48201
  const wasListening = streamIsListening(state, channel.id);
47983
48202
  const next4 = exports_Predicate.hasProperty(target, "kind") ? {
47984
48203
  ...state,
@@ -47992,17 +48211,20 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
47992
48211
  const subscribeRemote = wasListening ? exports_Effect.void : minterHttp.post("/users/me/subscriptions", subscriptionsResponseSchema, {
47993
48212
  subscriptions: JSON.stringify([{ name: channel.name }])
47994
48213
  }).pipe(exports_Effect.asVoid);
47995
- return subscribeRemote.pipe(exports_Effect.flatMap(() => ensureQueueRegistered()));
48214
+ return subscribeRemote.pipe(exports_Effect.andThen(ensureQueueRegistered()));
47996
48215
  }));
47997
48216
  }).pipe(exports_Effect.mapError((cause3) => new InboxError({ operation: "subscribe", cause: cause3 }))),
47998
48217
  unsubscribe: (target) => exports_Effect.suspend(() => {
47999
48218
  if (target === "mentions") {
48000
- return exports_Ref.update(inboxRef, (state) => ({ ...state, mentionsSubscribed: false }));
48219
+ return exports_SynchronizedRef.update(inboxRef, (state) => ({
48220
+ ...state,
48221
+ mentionsSubscribed: false
48222
+ }));
48001
48223
  }
48002
48224
  const channel = channelOf(target);
48003
48225
  if (channel === undefined)
48004
48226
  return exports_Effect.void;
48005
- return exports_Ref.modify(inboxRef, (state) => {
48227
+ return exports_SynchronizedRef.modify(inboxRef, (state) => {
48006
48228
  const next4 = exports_Predicate.hasProperty(target, "kind") ? {
48007
48229
  ...state,
48008
48230
  newTopicsChannels: exports_HashSet.remove(state.newTopicsChannels, channel.id),
@@ -48016,8 +48238,9 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
48016
48238
  subscriptions: JSON.stringify([channel.name])
48017
48239
  }).pipe(exports_Effect.asVoid)));
48018
48240
  }).pipe(exports_Effect.mapError((cause3) => new InboxError({ operation: "unsubscribe", cause: cause3 }))),
48019
- events: () => exports_Stream.unwrap(exports_Effect.all([exports_SynchronizedRef.get(boundRef), exports_Ref.get(inboxRef)]).pipe(exports_Effect.map(([current2, state]) => inboxEvents({
48241
+ events: () => exports_Stream.unwrap(exports_Effect.all([exports_SynchronizedRef.get(boundRef), exports_SynchronizedRef.get(inboxRef)]).pipe(exports_Effect.map(([current2, state]) => inboxEvents({
48020
48242
  http: minterHttp,
48243
+ permalinkBase: base,
48021
48244
  resolveDirectory: buildDirectoryLookup,
48022
48245
  mode: currentMode(state),
48023
48246
  messageRefCache,
@@ -48027,9 +48250,9 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
48027
48250
  onNone: () => ({}),
48028
48251
  onSome: (b) => ({ boundIdentity: b.identity })
48029
48252
  }),
48030
- ...exports_Option.match(state.registeredQueue, {
48253
+ ...exports_Option.match(state.registration, {
48031
48254
  onNone: () => ({}),
48032
- onSome: (q) => ({ initialQueue: q })
48255
+ onSome: (r) => ({ initialQueue: r.queue })
48033
48256
  })
48034
48257
  })))).pipe(exports_Stream.filterEffect(shouldDeliver)),
48035
48258
  replay: (since) => {
@@ -48046,7 +48269,7 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
48046
48269
  exports_SynchronizedRef.get(boundRef)
48047
48270
  ], { concurrency: 2 }).pipe(exports_Effect.flatMap(([directory2, res, current2]) => exports_Effect.forEach(res.messages.filter((raw3) => raw3.timestamp >= since), (raw3) => {
48048
48271
  const { flags: _flags, ...message } = raw3;
48049
- return messageToInboundEvents(message, directory2, exports_Option.getOrUndefined(current2)?.identity);
48272
+ return messageToInboundEvents(message, directory2, exports_Option.getOrUndefined(current2)?.identity, base);
48050
48273
  }).pipe(exports_Effect.map((perMessage) => {
48051
48274
  const out = [];
48052
48275
  for (const mapped of perMessage) {
@@ -48102,7 +48325,8 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
48102
48325
  return exports_Array.sort(threads, exports_Order.reverse(exports_Order.mapInput(exports_Order.number, (t) => t.lastPostTs)));
48103
48326
  })));
48104
48327
  }), exports_Effect.mapError((cause3) => new HistoryError({ operation: "recentThreads", cause: cause3 })));
48105
- }
48328
+ },
48329
+ messagePermalink: (id3, hint) => (hint === undefined ? fetchMessageRef(minterHttp, Number(id3), base).pipe(exports_Effect.map(exports_Option.flatMap((ref) => exports_Option.fromNullable(ref.permalink)))) : lookupChannel(hint.channel).pipe(exports_Effect.map(exports_Option.flatMap((channel) => exports_Option.fromNullable(buildMessageRef(base, id3, channel, hint.thread).permalink))))).pipe(exports_Effect.mapError((cause3) => new HistoryError({ operation: "messagePermalink", cause: cause3 })))
48106
48330
  };
48107
48331
  const reconcileMinter = () => reconcileMinterSubscriptions({
48108
48332
  listUnsubscribedPublicStreams: () => minterHttp.get("/streams", streamsListResponseSchema, {
@@ -48569,10 +48793,10 @@ var makeFile = /* @__PURE__ */ (() => {
48569
48793
  return some3(dst);
48570
48794
  })));
48571
48795
  }
48572
- truncate(length5) {
48573
- return this.semaphore.withPermits(1)(map21(nodeTruncate(this.fd, length5 ? Number(length5) : undefined), () => {
48796
+ truncate(length6) {
48797
+ return this.semaphore.withPermits(1)(map21(nodeTruncate(this.fd, length6 ? Number(length6) : undefined), () => {
48574
48798
  if (!this.append) {
48575
- const len = BigInt(length5 ?? 0);
48799
+ const len = BigInt(length6 ?? 0);
48576
48800
  if (this.position > len) {
48577
48801
  this.position = len;
48578
48802
  }
@@ -48684,7 +48908,7 @@ var symlink2 = /* @__PURE__ */ (() => {
48684
48908
  })();
48685
48909
  var truncate2 = /* @__PURE__ */ (() => {
48686
48910
  const nodeTruncate = /* @__PURE__ */ effectify2(NFS.truncate, /* @__PURE__ */ handleErrnoException("FileSystem", "truncate"), /* @__PURE__ */ handleBadArgument("truncate"));
48687
- return (path, length5) => nodeTruncate(path, length5 !== undefined ? Number(length5) : undefined);
48911
+ return (path, length6) => nodeTruncate(path, length6 !== undefined ? Number(length6) : undefined);
48688
48912
  })();
48689
48913
  var utimes2 = /* @__PURE__ */ (() => {
48690
48914
  const nodeUtimes = /* @__PURE__ */ effectify2(NFS.utimes, /* @__PURE__ */ handleErrnoException("FileSystem", "utime"), /* @__PURE__ */ handleBadArgument("utime"));
@@ -49021,18 +49245,18 @@ var posixImpl = /* @__PURE__ */ Path3.of({
49021
49245
  }
49022
49246
  const toEnd = to.length;
49023
49247
  const toLen = toEnd - toStart;
49024
- const length5 = fromLen < toLen ? fromLen : toLen;
49248
+ const length6 = fromLen < toLen ? fromLen : toLen;
49025
49249
  let lastCommonSep = -1;
49026
49250
  let i = 0;
49027
- for (;i <= length5; ++i) {
49028
- if (i === length5) {
49029
- if (toLen > length5) {
49251
+ for (;i <= length6; ++i) {
49252
+ if (i === length6) {
49253
+ if (toLen > length6) {
49030
49254
  if (to.charCodeAt(toStart + i) === 47) {
49031
49255
  return to.slice(toStart + i + 1);
49032
49256
  } else if (i === 0) {
49033
49257
  return to.slice(toStart + i);
49034
49258
  }
49035
- } else if (fromLen > length5) {
49259
+ } else if (fromLen > length6) {
49036
49260
  if (from.charCodeAt(fromStart + i) === 47) {
49037
49261
  lastCommonSep = i;
49038
49262
  } else if (i === 0) {
@@ -49321,11 +49545,11 @@ var Terminal2 = tag6;
49321
49545
  // node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/mailbox.js
49322
49546
  var TypeId40 = /* @__PURE__ */ Symbol.for("effect/Mailbox");
49323
49547
  var ReadonlyTypeId = /* @__PURE__ */ Symbol.for("effect/Mailbox/ReadonlyMailbox");
49324
- var empty42 = /* @__PURE__ */ empty5();
49325
- var exitEmpty = /* @__PURE__ */ exitSucceed(empty42);
49548
+ var empty43 = /* @__PURE__ */ empty5();
49549
+ var exitEmpty = /* @__PURE__ */ exitSucceed(empty43);
49326
49550
  var exitFalse = /* @__PURE__ */ exitSucceed(false);
49327
49551
  var exitTrue = /* @__PURE__ */ exitSucceed(true);
49328
- var constDone = [empty42, true];
49552
+ var constDone = [empty43, true];
49329
49553
 
49330
49554
  class MailboxImpl extends Class3 {
49331
49555
  scheduler;
@@ -49468,7 +49692,7 @@ class MailboxImpl extends Class3 {
49468
49692
  return true;
49469
49693
  }
49470
49694
  this.messages = [];
49471
- this.messagesChunk = empty42;
49695
+ this.messagesChunk = empty43;
49472
49696
  const offers = this.state.offers;
49473
49697
  this.finalize(this.state._tag === "Open" ? exitVoid : this.state.exit);
49474
49698
  if (offers.size > 0) {
@@ -49489,7 +49713,7 @@ class MailboxImpl extends Class3 {
49489
49713
  end = /* @__PURE__ */ this.done(exitVoid);
49490
49714
  clear = /* @__PURE__ */ suspend(() => {
49491
49715
  if (this.state._tag === "Done") {
49492
- return exitAs(this.state.exit, empty42);
49716
+ return exitAs(this.state.exit, empty43);
49493
49717
  }
49494
49718
  const messages = this.unsafeTakeAll();
49495
49719
  this.releaseCapacity();
@@ -49510,7 +49734,7 @@ class MailboxImpl extends Class3 {
49510
49734
  if (this.state._tag === "Done") {
49511
49735
  return exitAs(this.state.exit, constDone);
49512
49736
  } else if (n <= 0) {
49513
- return succeed([empty42, false]);
49737
+ return succeed([empty43, false]);
49514
49738
  }
49515
49739
  n = Math.min(n, this.capacity);
49516
49740
  let messages;
@@ -49693,7 +49917,7 @@ class MailboxImpl extends Class3 {
49693
49917
  unsafeTakeAll() {
49694
49918
  if (this.messagesChunk.length > 0) {
49695
49919
  const messages = this.messages.length > 0 ? appendAll2(this.messagesChunk, unsafeFromArray(this.messages)) : this.messagesChunk;
49696
- this.messagesChunk = empty42;
49920
+ this.messagesChunk = empty43;
49697
49921
  this.messages = [];
49698
49922
  return messages;
49699
49923
  } else if (this.messages.length > 0) {
@@ -49706,7 +49930,7 @@ class MailboxImpl extends Class3 {
49706
49930
  this.capacity = 0;
49707
49931
  return of2(this.messages.pop());
49708
49932
  }
49709
- return empty42;
49933
+ return empty43;
49710
49934
  }
49711
49935
  finalize(exit3) {
49712
49936
  if (this.state._tag === "Done") {
@@ -50460,10 +50684,10 @@ function promiseAllObject(promisesObj) {
50460
50684
  return resolvedObj;
50461
50685
  });
50462
50686
  }
50463
- function randomString(length5 = 10) {
50687
+ function randomString(length6 = 10) {
50464
50688
  const chars = "abcdefghijklmnopqrstuvwxyz";
50465
50689
  let str = "";
50466
- for (let i = 0;i < length5; i++) {
50690
+ for (let i = 0;i < length6; i++) {
50467
50691
  str += chars[Math.floor(Math.random() * chars.length)];
50468
50692
  }
50469
50693
  return str;
@@ -50995,7 +51219,7 @@ function datetime(args2) {
50995
51219
  const timeRegex = `${time2}(?:${opts.join("|")})`;
50996
51220
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
50997
51221
  }
50998
- var string8 = (params) => {
51222
+ var string9 = (params) => {
50999
51223
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
51000
51224
  return new RegExp(`^${regex}$`);
51001
51225
  };
@@ -51184,8 +51408,8 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
51184
51408
  });
51185
51409
  inst._zod.check = (payload) => {
51186
51410
  const input = payload.value;
51187
- const length5 = input.length;
51188
- if (length5 <= def.maximum)
51411
+ const length6 = input.length;
51412
+ if (length6 <= def.maximum)
51189
51413
  return;
51190
51414
  const origin = getLengthableOrigin(input);
51191
51415
  payload.issues.push({
@@ -51213,8 +51437,8 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
51213
51437
  });
51214
51438
  inst._zod.check = (payload) => {
51215
51439
  const input = payload.value;
51216
- const length5 = input.length;
51217
- if (length5 >= def.minimum)
51440
+ const length6 = input.length;
51441
+ if (length6 >= def.minimum)
51218
51442
  return;
51219
51443
  const origin = getLengthableOrigin(input);
51220
51444
  payload.issues.push({
@@ -51243,11 +51467,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
51243
51467
  });
51244
51468
  inst._zod.check = (payload) => {
51245
51469
  const input = payload.value;
51246
- const length5 = input.length;
51247
- if (length5 === def.length)
51470
+ const length6 = input.length;
51471
+ if (length6 === def.length)
51248
51472
  return;
51249
51473
  const origin = getLengthableOrigin(input);
51250
- const tooBig = length5 > def.length;
51474
+ const tooBig = length6 > def.length;
51251
51475
  payload.issues.push({
51252
51476
  origin,
51253
51477
  ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
@@ -51522,7 +51746,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51522
51746
  });
51523
51747
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
51524
51748
  $ZodType.init(inst, def);
51525
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string8(inst._zod.bag);
51749
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string9(inst._zod.bag);
51526
51750
  inst._zod.parse = (payload, _) => {
51527
51751
  if (def.coerce)
51528
51752
  try {
@@ -53170,11 +53394,11 @@ function _minLength(minimum, params) {
53170
53394
  minimum
53171
53395
  });
53172
53396
  }
53173
- function _length(length5, params) {
53397
+ function _length(length6, params) {
53174
53398
  return new $ZodCheckLengthEquals({
53175
53399
  check: "length_equals",
53176
53400
  ...normalizeParams(params),
53177
- length: length5
53401
+ length: length6
53178
53402
  });
53179
53403
  }
53180
53404
  function _regex(pattern2, params) {
@@ -53199,12 +53423,12 @@ function _uppercase(params) {
53199
53423
  ...normalizeParams(params)
53200
53424
  });
53201
53425
  }
53202
- function _includes(includes2, params) {
53426
+ function _includes(includes3, params) {
53203
53427
  return new $ZodCheckIncludes({
53204
53428
  check: "string_format",
53205
53429
  format: "includes",
53206
53430
  ...normalizeParams(params),
53207
- includes: includes2
53431
+ includes: includes3
53208
53432
  });
53209
53433
  }
53210
53434
  function _startsWith(prefix, params) {
@@ -53461,7 +53685,7 @@ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
53461
53685
  inst.time = (params) => inst.check(time2(params));
53462
53686
  inst.duration = (params) => inst.check(duration6(params));
53463
53687
  });
53464
- function string9(params) {
53688
+ function string10(params) {
53465
53689
  return _string(ZodString, params);
53466
53690
  }
53467
53691
  var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
@@ -53958,8 +54182,8 @@ var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-
53958
54182
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
53959
54183
  var JSONRPC_VERSION = "2.0";
53960
54184
  var AssertObjectSchema = custom3((v) => v !== null && (typeof v === "object" || typeof v === "function"));
53961
- var ProgressTokenSchema = union14([string9(), number8().int()]);
53962
- var CursorSchema = string9();
54185
+ var ProgressTokenSchema = union14([string10(), number8().int()]);
54186
+ var CursorSchema = string10();
53963
54187
  var TaskCreationParamsSchema = looseObject({
53964
54188
  ttl: number8().optional(),
53965
54189
  pollInterval: number8().optional()
@@ -53968,7 +54192,7 @@ var TaskMetadataSchema = object({
53968
54192
  ttl: number8().optional()
53969
54193
  });
53970
54194
  var RelatedTaskMetadataSchema = object({
53971
- taskId: string9()
54195
+ taskId: string10()
53972
54196
  });
53973
54197
  var RequestMetaSchema = looseObject({
53974
54198
  progressToken: ProgressTokenSchema.optional(),
@@ -53982,20 +54206,20 @@ var TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
53982
54206
  });
53983
54207
  var isTaskAugmentedRequestParams = (value5) => TaskAugmentedRequestParamsSchema.safeParse(value5).success;
53984
54208
  var RequestSchema = object({
53985
- method: string9(),
54209
+ method: string10(),
53986
54210
  params: BaseRequestParamsSchema.loose().optional()
53987
54211
  });
53988
54212
  var NotificationsParamsSchema = object({
53989
54213
  _meta: RequestMetaSchema.optional()
53990
54214
  });
53991
54215
  var NotificationSchema = object({
53992
- method: string9(),
54216
+ method: string10(),
53993
54217
  params: NotificationsParamsSchema.loose().optional()
53994
54218
  });
53995
54219
  var ResultSchema = looseObject({
53996
54220
  _meta: RequestMetaSchema.optional()
53997
54221
  });
53998
- var RequestIdSchema = union14([string9(), number8().int()]);
54222
+ var RequestIdSchema = union14([string10(), number8().int()]);
53999
54223
  var JSONRPCRequestSchema = object({
54000
54224
  jsonrpc: literal3(JSONRPC_VERSION),
54001
54225
  id: RequestIdSchema,
@@ -54029,7 +54253,7 @@ var JSONRPCErrorResponseSchema = object({
54029
54253
  id: RequestIdSchema.optional(),
54030
54254
  error: object({
54031
54255
  code: number8().int(),
54032
- message: string9(),
54256
+ message: string10(),
54033
54257
  data: unknown().optional()
54034
54258
  })
54035
54259
  }).strict();
@@ -54044,35 +54268,35 @@ var JSONRPCResponseSchema = union14([JSONRPCResultResponseSchema, JSONRPCErrorRe
54044
54268
  var EmptyResultSchema = ResultSchema.strict();
54045
54269
  var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
54046
54270
  requestId: RequestIdSchema.optional(),
54047
- reason: string9().optional()
54271
+ reason: string10().optional()
54048
54272
  });
54049
54273
  var CancelledNotificationSchema = NotificationSchema.extend({
54050
54274
  method: literal3("notifications/cancelled"),
54051
54275
  params: CancelledNotificationParamsSchema
54052
54276
  });
54053
54277
  var IconSchema = object({
54054
- src: string9(),
54055
- mimeType: string9().optional(),
54056
- sizes: array8(string9()).optional(),
54278
+ src: string10(),
54279
+ mimeType: string10().optional(),
54280
+ sizes: array8(string10()).optional(),
54057
54281
  theme: _enum(["light", "dark"]).optional()
54058
54282
  });
54059
54283
  var IconsSchema = object({
54060
54284
  icons: array8(IconSchema).optional()
54061
54285
  });
54062
54286
  var BaseMetadataSchema = object({
54063
- name: string9(),
54064
- title: string9().optional()
54287
+ name: string10(),
54288
+ title: string10().optional()
54065
54289
  });
54066
54290
  var ImplementationSchema = BaseMetadataSchema.extend({
54067
54291
  ...BaseMetadataSchema.shape,
54068
54292
  ...IconsSchema.shape,
54069
- version: string9(),
54070
- websiteUrl: string9().optional(),
54071
- description: string9().optional()
54293
+ version: string10(),
54294
+ websiteUrl: string10().optional(),
54295
+ description: string10().optional()
54072
54296
  });
54073
54297
  var FormElicitationCapabilitySchema = intersection7(object({
54074
54298
  applyDefaults: boolean6().optional()
54075
- }), record3(string9(), unknown()));
54299
+ }), record3(string10(), unknown()));
54076
54300
  var ElicitationCapabilitySchema = preprocess((value5) => {
54077
54301
  if (value5 && typeof value5 === "object" && !Array.isArray(value5)) {
54078
54302
  if (Object.keys(value5).length === 0) {
@@ -54083,7 +54307,7 @@ var ElicitationCapabilitySchema = preprocess((value5) => {
54083
54307
  }, intersection7(object({
54084
54308
  form: FormElicitationCapabilitySchema.optional(),
54085
54309
  url: AssertObjectSchema.optional()
54086
- }), record3(string9(), unknown()).optional()));
54310
+ }), record3(string10(), unknown()).optional()));
54087
54311
  var ClientTasksCapabilitySchema = looseObject({
54088
54312
  list: AssertObjectSchema.optional(),
54089
54313
  cancel: AssertObjectSchema.optional(),
@@ -54106,7 +54330,7 @@ var ServerTasksCapabilitySchema = looseObject({
54106
54330
  }).optional()
54107
54331
  });
54108
54332
  var ClientCapabilitiesSchema = object({
54109
- experimental: record3(string9(), AssertObjectSchema).optional(),
54333
+ experimental: record3(string10(), AssertObjectSchema).optional(),
54110
54334
  sampling: object({
54111
54335
  context: AssertObjectSchema.optional(),
54112
54336
  tools: AssertObjectSchema.optional()
@@ -54116,10 +54340,10 @@ var ClientCapabilitiesSchema = object({
54116
54340
  listChanged: boolean6().optional()
54117
54341
  }).optional(),
54118
54342
  tasks: ClientTasksCapabilitySchema.optional(),
54119
- extensions: record3(string9(), AssertObjectSchema).optional()
54343
+ extensions: record3(string10(), AssertObjectSchema).optional()
54120
54344
  });
54121
54345
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
54122
- protocolVersion: string9(),
54346
+ protocolVersion: string10(),
54123
54347
  capabilities: ClientCapabilitiesSchema,
54124
54348
  clientInfo: ImplementationSchema
54125
54349
  });
@@ -54128,7 +54352,7 @@ var InitializeRequestSchema = RequestSchema.extend({
54128
54352
  params: InitializeRequestParamsSchema
54129
54353
  });
54130
54354
  var ServerCapabilitiesSchema = object({
54131
- experimental: record3(string9(), AssertObjectSchema).optional(),
54355
+ experimental: record3(string10(), AssertObjectSchema).optional(),
54132
54356
  logging: AssertObjectSchema.optional(),
54133
54357
  completions: AssertObjectSchema.optional(),
54134
54358
  prompts: object({
@@ -54142,13 +54366,13 @@ var ServerCapabilitiesSchema = object({
54142
54366
  listChanged: boolean6().optional()
54143
54367
  }).optional(),
54144
54368
  tasks: ServerTasksCapabilitySchema.optional(),
54145
- extensions: record3(string9(), AssertObjectSchema).optional()
54369
+ extensions: record3(string10(), AssertObjectSchema).optional()
54146
54370
  });
54147
54371
  var InitializeResultSchema = ResultSchema.extend({
54148
- protocolVersion: string9(),
54372
+ protocolVersion: string10(),
54149
54373
  capabilities: ServerCapabilitiesSchema,
54150
54374
  serverInfo: ImplementationSchema,
54151
- instructions: string9().optional()
54375
+ instructions: string10().optional()
54152
54376
  });
54153
54377
  var InitializedNotificationSchema = NotificationSchema.extend({
54154
54378
  method: literal3("notifications/initialized"),
@@ -54161,7 +54385,7 @@ var PingRequestSchema = RequestSchema.extend({
54161
54385
  var ProgressSchema = object({
54162
54386
  progress: number8(),
54163
54387
  total: optional2(number8()),
54164
- message: optional2(string9())
54388
+ message: optional2(string10())
54165
54389
  });
54166
54390
  var ProgressNotificationParamsSchema = object({
54167
54391
  ...NotificationsParamsSchema.shape,
@@ -54183,13 +54407,13 @@ var PaginatedResultSchema = ResultSchema.extend({
54183
54407
  });
54184
54408
  var TaskStatusSchema = _enum(["working", "input_required", "completed", "failed", "cancelled"]);
54185
54409
  var TaskSchema = object({
54186
- taskId: string9(),
54410
+ taskId: string10(),
54187
54411
  status: TaskStatusSchema,
54188
54412
  ttl: union14([number8(), _null4()]),
54189
- createdAt: string9(),
54190
- lastUpdatedAt: string9(),
54413
+ createdAt: string10(),
54414
+ lastUpdatedAt: string10(),
54191
54415
  pollInterval: optional2(number8()),
54192
- statusMessage: optional2(string9())
54416
+ statusMessage: optional2(string10())
54193
54417
  });
54194
54418
  var CreateTaskResultSchema = ResultSchema.extend({
54195
54419
  task: TaskSchema
@@ -54202,14 +54426,14 @@ var TaskStatusNotificationSchema = NotificationSchema.extend({
54202
54426
  var GetTaskRequestSchema = RequestSchema.extend({
54203
54427
  method: literal3("tasks/get"),
54204
54428
  params: BaseRequestParamsSchema.extend({
54205
- taskId: string9()
54429
+ taskId: string10()
54206
54430
  })
54207
54431
  });
54208
54432
  var GetTaskResultSchema = ResultSchema.merge(TaskSchema);
54209
54433
  var GetTaskPayloadRequestSchema = RequestSchema.extend({
54210
54434
  method: literal3("tasks/result"),
54211
54435
  params: BaseRequestParamsSchema.extend({
54212
- taskId: string9()
54436
+ taskId: string10()
54213
54437
  })
54214
54438
  });
54215
54439
  var GetTaskPayloadResultSchema = ResultSchema.loose();
@@ -54222,19 +54446,19 @@ var ListTasksResultSchema = PaginatedResultSchema.extend({
54222
54446
  var CancelTaskRequestSchema = RequestSchema.extend({
54223
54447
  method: literal3("tasks/cancel"),
54224
54448
  params: BaseRequestParamsSchema.extend({
54225
- taskId: string9()
54449
+ taskId: string10()
54226
54450
  })
54227
54451
  });
54228
54452
  var CancelTaskResultSchema = ResultSchema.merge(TaskSchema);
54229
54453
  var ResourceContentsSchema = object({
54230
- uri: string9(),
54231
- mimeType: optional2(string9()),
54232
- _meta: record3(string9(), unknown()).optional()
54454
+ uri: string10(),
54455
+ mimeType: optional2(string10()),
54456
+ _meta: record3(string10(), unknown()).optional()
54233
54457
  });
54234
54458
  var TextResourceContentsSchema = ResourceContentsSchema.extend({
54235
- text: string9()
54459
+ text: string10()
54236
54460
  });
54237
- var Base64Schema = string9().refine((val) => {
54461
+ var Base64Schema = string10().refine((val) => {
54238
54462
  try {
54239
54463
  atob(val);
54240
54464
  return true;
@@ -54254,9 +54478,9 @@ var AnnotationsSchema = object({
54254
54478
  var ResourceSchema = object({
54255
54479
  ...BaseMetadataSchema.shape,
54256
54480
  ...IconsSchema.shape,
54257
- uri: string9(),
54258
- description: optional2(string9()),
54259
- mimeType: optional2(string9()),
54481
+ uri: string10(),
54482
+ description: optional2(string10()),
54483
+ mimeType: optional2(string10()),
54260
54484
  size: optional2(number8()),
54261
54485
  annotations: AnnotationsSchema.optional(),
54262
54486
  _meta: optional2(looseObject({}))
@@ -54264,9 +54488,9 @@ var ResourceSchema = object({
54264
54488
  var ResourceTemplateSchema = object({
54265
54489
  ...BaseMetadataSchema.shape,
54266
54490
  ...IconsSchema.shape,
54267
- uriTemplate: string9(),
54268
- description: optional2(string9()),
54269
- mimeType: optional2(string9()),
54491
+ uriTemplate: string10(),
54492
+ description: optional2(string10()),
54493
+ mimeType: optional2(string10()),
54270
54494
  annotations: AnnotationsSchema.optional(),
54271
54495
  _meta: optional2(looseObject({}))
54272
54496
  });
@@ -54283,7 +54507,7 @@ var ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({
54283
54507
  resourceTemplates: array8(ResourceTemplateSchema)
54284
54508
  });
54285
54509
  var ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
54286
- uri: string9()
54510
+ uri: string10()
54287
54511
  });
54288
54512
  var ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
54289
54513
  var ReadResourceRequestSchema = RequestSchema.extend({
@@ -54308,21 +54532,21 @@ var UnsubscribeRequestSchema = RequestSchema.extend({
54308
54532
  params: UnsubscribeRequestParamsSchema
54309
54533
  });
54310
54534
  var ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
54311
- uri: string9()
54535
+ uri: string10()
54312
54536
  });
54313
54537
  var ResourceUpdatedNotificationSchema = NotificationSchema.extend({
54314
54538
  method: literal3("notifications/resources/updated"),
54315
54539
  params: ResourceUpdatedNotificationParamsSchema
54316
54540
  });
54317
54541
  var PromptArgumentSchema = object({
54318
- name: string9(),
54319
- description: optional2(string9()),
54542
+ name: string10(),
54543
+ description: optional2(string10()),
54320
54544
  required: optional2(boolean6())
54321
54545
  });
54322
54546
  var PromptSchema = object({
54323
54547
  ...BaseMetadataSchema.shape,
54324
54548
  ...IconsSchema.shape,
54325
- description: optional2(string9()),
54549
+ description: optional2(string10()),
54326
54550
  arguments: optional2(array8(PromptArgumentSchema)),
54327
54551
  _meta: optional2(looseObject({}))
54328
54552
  });
@@ -54333,8 +54557,8 @@ var ListPromptsResultSchema = PaginatedResultSchema.extend({
54333
54557
  prompts: array8(PromptSchema)
54334
54558
  });
54335
54559
  var GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
54336
- name: string9(),
54337
- arguments: record3(string9(), string9()).optional()
54560
+ name: string10(),
54561
+ arguments: record3(string10(), string10()).optional()
54338
54562
  });
54339
54563
  var GetPromptRequestSchema = RequestSchema.extend({
54340
54564
  method: literal3("prompts/get"),
@@ -54342,36 +54566,36 @@ var GetPromptRequestSchema = RequestSchema.extend({
54342
54566
  });
54343
54567
  var TextContentSchema = object({
54344
54568
  type: literal3("text"),
54345
- text: string9(),
54569
+ text: string10(),
54346
54570
  annotations: AnnotationsSchema.optional(),
54347
- _meta: record3(string9(), unknown()).optional()
54571
+ _meta: record3(string10(), unknown()).optional()
54348
54572
  });
54349
54573
  var ImageContentSchema = object({
54350
54574
  type: literal3("image"),
54351
54575
  data: Base64Schema,
54352
- mimeType: string9(),
54576
+ mimeType: string10(),
54353
54577
  annotations: AnnotationsSchema.optional(),
54354
- _meta: record3(string9(), unknown()).optional()
54578
+ _meta: record3(string10(), unknown()).optional()
54355
54579
  });
54356
54580
  var AudioContentSchema = object({
54357
54581
  type: literal3("audio"),
54358
54582
  data: Base64Schema,
54359
- mimeType: string9(),
54583
+ mimeType: string10(),
54360
54584
  annotations: AnnotationsSchema.optional(),
54361
- _meta: record3(string9(), unknown()).optional()
54585
+ _meta: record3(string10(), unknown()).optional()
54362
54586
  });
54363
54587
  var ToolUseContentSchema = object({
54364
54588
  type: literal3("tool_use"),
54365
- name: string9(),
54366
- id: string9(),
54367
- input: record3(string9(), unknown()),
54368
- _meta: record3(string9(), unknown()).optional()
54589
+ name: string10(),
54590
+ id: string10(),
54591
+ input: record3(string10(), unknown()),
54592
+ _meta: record3(string10(), unknown()).optional()
54369
54593
  });
54370
54594
  var EmbeddedResourceSchema = object({
54371
54595
  type: literal3("resource"),
54372
54596
  resource: union14([TextResourceContentsSchema, BlobResourceContentsSchema]),
54373
54597
  annotations: AnnotationsSchema.optional(),
54374
- _meta: record3(string9(), unknown()).optional()
54598
+ _meta: record3(string10(), unknown()).optional()
54375
54599
  });
54376
54600
  var ResourceLinkSchema = ResourceSchema.extend({
54377
54601
  type: literal3("resource_link")
@@ -54388,7 +54612,7 @@ var PromptMessageSchema = object({
54388
54612
  content: ContentBlockSchema
54389
54613
  });
54390
54614
  var GetPromptResultSchema = ResultSchema.extend({
54391
- description: string9().optional(),
54615
+ description: string10().optional(),
54392
54616
  messages: array8(PromptMessageSchema)
54393
54617
  });
54394
54618
  var PromptListChangedNotificationSchema = NotificationSchema.extend({
@@ -54396,7 +54620,7 @@ var PromptListChangedNotificationSchema = NotificationSchema.extend({
54396
54620
  params: NotificationsParamsSchema.optional()
54397
54621
  });
54398
54622
  var ToolAnnotationsSchema = object({
54399
- title: string9().optional(),
54623
+ title: string10().optional(),
54400
54624
  readOnlyHint: boolean6().optional(),
54401
54625
  destructiveHint: boolean6().optional(),
54402
54626
  idempotentHint: boolean6().optional(),
@@ -54408,20 +54632,20 @@ var ToolExecutionSchema = object({
54408
54632
  var ToolSchema = object({
54409
54633
  ...BaseMetadataSchema.shape,
54410
54634
  ...IconsSchema.shape,
54411
- description: string9().optional(),
54635
+ description: string10().optional(),
54412
54636
  inputSchema: object({
54413
54637
  type: literal3("object"),
54414
- properties: record3(string9(), AssertObjectSchema).optional(),
54415
- required: array8(string9()).optional()
54638
+ properties: record3(string10(), AssertObjectSchema).optional(),
54639
+ required: array8(string10()).optional()
54416
54640
  }).catchall(unknown()),
54417
54641
  outputSchema: object({
54418
54642
  type: literal3("object"),
54419
- properties: record3(string9(), AssertObjectSchema).optional(),
54420
- required: array8(string9()).optional()
54643
+ properties: record3(string10(), AssertObjectSchema).optional(),
54644
+ required: array8(string10()).optional()
54421
54645
  }).catchall(unknown()).optional(),
54422
54646
  annotations: ToolAnnotationsSchema.optional(),
54423
54647
  execution: ToolExecutionSchema.optional(),
54424
- _meta: record3(string9(), unknown()).optional()
54648
+ _meta: record3(string10(), unknown()).optional()
54425
54649
  });
54426
54650
  var ListToolsRequestSchema = PaginatedRequestSchema.extend({
54427
54651
  method: literal3("tools/list")
@@ -54431,15 +54655,15 @@ var ListToolsResultSchema = PaginatedResultSchema.extend({
54431
54655
  });
54432
54656
  var CallToolResultSchema = ResultSchema.extend({
54433
54657
  content: array8(ContentBlockSchema).default([]),
54434
- structuredContent: record3(string9(), unknown()).optional(),
54658
+ structuredContent: record3(string10(), unknown()).optional(),
54435
54659
  isError: boolean6().optional()
54436
54660
  });
54437
54661
  var CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
54438
54662
  toolResult: unknown()
54439
54663
  }));
54440
54664
  var CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
54441
- name: string9(),
54442
- arguments: record3(string9(), unknown()).optional()
54665
+ name: string10(),
54666
+ arguments: record3(string10(), unknown()).optional()
54443
54667
  });
54444
54668
  var CallToolRequestSchema = RequestSchema.extend({
54445
54669
  method: literal3("tools/call"),
@@ -54463,7 +54687,7 @@ var SetLevelRequestSchema = RequestSchema.extend({
54463
54687
  });
54464
54688
  var LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
54465
54689
  level: LoggingLevelSchema,
54466
- logger: string9().optional(),
54690
+ logger: string10().optional(),
54467
54691
  data: unknown()
54468
54692
  });
54469
54693
  var LoggingMessageNotificationSchema = NotificationSchema.extend({
@@ -54471,7 +54695,7 @@ var LoggingMessageNotificationSchema = NotificationSchema.extend({
54471
54695
  params: LoggingMessageNotificationParamsSchema
54472
54696
  });
54473
54697
  var ModelHintSchema = object({
54474
- name: string9().optional()
54698
+ name: string10().optional()
54475
54699
  });
54476
54700
  var ModelPreferencesSchema = object({
54477
54701
  hints: array8(ModelHintSchema).optional(),
@@ -54484,11 +54708,11 @@ var ToolChoiceSchema = object({
54484
54708
  });
54485
54709
  var ToolResultContentSchema = object({
54486
54710
  type: literal3("tool_result"),
54487
- toolUseId: string9().describe("The unique identifier for the corresponding tool call."),
54711
+ toolUseId: string10().describe("The unique identifier for the corresponding tool call."),
54488
54712
  content: array8(ContentBlockSchema).default([]),
54489
54713
  structuredContent: object({}).loose().optional(),
54490
54714
  isError: boolean6().optional(),
54491
- _meta: record3(string9(), unknown()).optional()
54715
+ _meta: record3(string10(), unknown()).optional()
54492
54716
  });
54493
54717
  var SamplingContentSchema = discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]);
54494
54718
  var SamplingMessageContentBlockSchema = discriminatedUnion("type", [
@@ -54501,16 +54725,16 @@ var SamplingMessageContentBlockSchema = discriminatedUnion("type", [
54501
54725
  var SamplingMessageSchema = object({
54502
54726
  role: RoleSchema,
54503
54727
  content: union14([SamplingMessageContentBlockSchema, array8(SamplingMessageContentBlockSchema)]),
54504
- _meta: record3(string9(), unknown()).optional()
54728
+ _meta: record3(string10(), unknown()).optional()
54505
54729
  });
54506
54730
  var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
54507
54731
  messages: array8(SamplingMessageSchema),
54508
54732
  modelPreferences: ModelPreferencesSchema.optional(),
54509
- systemPrompt: string9().optional(),
54733
+ systemPrompt: string10().optional(),
54510
54734
  includeContext: _enum(["none", "thisServer", "allServers"]).optional(),
54511
54735
  temperature: number8().optional(),
54512
54736
  maxTokens: number8().int(),
54513
- stopSequences: array8(string9()).optional(),
54737
+ stopSequences: array8(string10()).optional(),
54514
54738
  metadata: AssertObjectSchema.optional(),
54515
54739
  tools: array8(ToolSchema).optional(),
54516
54740
  toolChoice: ToolChoiceSchema.optional()
@@ -54520,109 +54744,109 @@ var CreateMessageRequestSchema = RequestSchema.extend({
54520
54744
  params: CreateMessageRequestParamsSchema
54521
54745
  });
54522
54746
  var CreateMessageResultSchema = ResultSchema.extend({
54523
- model: string9(),
54524
- stopReason: optional2(_enum(["endTurn", "stopSequence", "maxTokens"]).or(string9())),
54747
+ model: string10(),
54748
+ stopReason: optional2(_enum(["endTurn", "stopSequence", "maxTokens"]).or(string10())),
54525
54749
  role: RoleSchema,
54526
54750
  content: SamplingContentSchema
54527
54751
  });
54528
54752
  var CreateMessageResultWithToolsSchema = ResultSchema.extend({
54529
- model: string9(),
54530
- stopReason: optional2(_enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string9())),
54753
+ model: string10(),
54754
+ stopReason: optional2(_enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string10())),
54531
54755
  role: RoleSchema,
54532
54756
  content: union14([SamplingMessageContentBlockSchema, array8(SamplingMessageContentBlockSchema)])
54533
54757
  });
54534
54758
  var BooleanSchemaSchema = object({
54535
54759
  type: literal3("boolean"),
54536
- title: string9().optional(),
54537
- description: string9().optional(),
54760
+ title: string10().optional(),
54761
+ description: string10().optional(),
54538
54762
  default: boolean6().optional()
54539
54763
  });
54540
54764
  var StringSchemaSchema = object({
54541
54765
  type: literal3("string"),
54542
- title: string9().optional(),
54543
- description: string9().optional(),
54766
+ title: string10().optional(),
54767
+ description: string10().optional(),
54544
54768
  minLength: number8().optional(),
54545
54769
  maxLength: number8().optional(),
54546
54770
  format: _enum(["email", "uri", "date", "date-time"]).optional(),
54547
- default: string9().optional()
54771
+ default: string10().optional()
54548
54772
  });
54549
54773
  var NumberSchemaSchema = object({
54550
54774
  type: _enum(["number", "integer"]),
54551
- title: string9().optional(),
54552
- description: string9().optional(),
54775
+ title: string10().optional(),
54776
+ description: string10().optional(),
54553
54777
  minimum: number8().optional(),
54554
54778
  maximum: number8().optional(),
54555
54779
  default: number8().optional()
54556
54780
  });
54557
54781
  var UntitledSingleSelectEnumSchemaSchema = object({
54558
54782
  type: literal3("string"),
54559
- title: string9().optional(),
54560
- description: string9().optional(),
54561
- enum: array8(string9()),
54562
- default: string9().optional()
54783
+ title: string10().optional(),
54784
+ description: string10().optional(),
54785
+ enum: array8(string10()),
54786
+ default: string10().optional()
54563
54787
  });
54564
54788
  var TitledSingleSelectEnumSchemaSchema = object({
54565
54789
  type: literal3("string"),
54566
- title: string9().optional(),
54567
- description: string9().optional(),
54790
+ title: string10().optional(),
54791
+ description: string10().optional(),
54568
54792
  oneOf: array8(object({
54569
- const: string9(),
54570
- title: string9()
54793
+ const: string10(),
54794
+ title: string10()
54571
54795
  })),
54572
- default: string9().optional()
54796
+ default: string10().optional()
54573
54797
  });
54574
54798
  var LegacyTitledEnumSchemaSchema = object({
54575
54799
  type: literal3("string"),
54576
- title: string9().optional(),
54577
- description: string9().optional(),
54578
- enum: array8(string9()),
54579
- enumNames: array8(string9()).optional(),
54580
- default: string9().optional()
54800
+ title: string10().optional(),
54801
+ description: string10().optional(),
54802
+ enum: array8(string10()),
54803
+ enumNames: array8(string10()).optional(),
54804
+ default: string10().optional()
54581
54805
  });
54582
54806
  var SingleSelectEnumSchemaSchema = union14([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
54583
54807
  var UntitledMultiSelectEnumSchemaSchema = object({
54584
54808
  type: literal3("array"),
54585
- title: string9().optional(),
54586
- description: string9().optional(),
54809
+ title: string10().optional(),
54810
+ description: string10().optional(),
54587
54811
  minItems: number8().optional(),
54588
54812
  maxItems: number8().optional(),
54589
54813
  items: object({
54590
54814
  type: literal3("string"),
54591
- enum: array8(string9())
54815
+ enum: array8(string10())
54592
54816
  }),
54593
- default: array8(string9()).optional()
54817
+ default: array8(string10()).optional()
54594
54818
  });
54595
54819
  var TitledMultiSelectEnumSchemaSchema = object({
54596
54820
  type: literal3("array"),
54597
- title: string9().optional(),
54598
- description: string9().optional(),
54821
+ title: string10().optional(),
54822
+ description: string10().optional(),
54599
54823
  minItems: number8().optional(),
54600
54824
  maxItems: number8().optional(),
54601
54825
  items: object({
54602
54826
  anyOf: array8(object({
54603
- const: string9(),
54604
- title: string9()
54827
+ const: string10(),
54828
+ title: string10()
54605
54829
  }))
54606
54830
  }),
54607
- default: array8(string9()).optional()
54831
+ default: array8(string10()).optional()
54608
54832
  });
54609
54833
  var MultiSelectEnumSchemaSchema = union14([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
54610
54834
  var EnumSchemaSchema = union14([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
54611
54835
  var PrimitiveSchemaDefinitionSchema = union14([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
54612
54836
  var ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
54613
54837
  mode: literal3("form").optional(),
54614
- message: string9(),
54838
+ message: string10(),
54615
54839
  requestedSchema: object({
54616
54840
  type: literal3("object"),
54617
- properties: record3(string9(), PrimitiveSchemaDefinitionSchema),
54618
- required: array8(string9()).optional()
54841
+ properties: record3(string10(), PrimitiveSchemaDefinitionSchema),
54842
+ required: array8(string10()).optional()
54619
54843
  })
54620
54844
  });
54621
54845
  var ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({
54622
54846
  mode: literal3("url"),
54623
- message: string9(),
54624
- elicitationId: string9(),
54625
- url: string9().url()
54847
+ message: string10(),
54848
+ elicitationId: string10(),
54849
+ url: string10().url()
54626
54850
  });
54627
54851
  var ElicitRequestParamsSchema = union14([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
54628
54852
  var ElicitRequestSchema = RequestSchema.extend({
@@ -54630,7 +54854,7 @@ var ElicitRequestSchema = RequestSchema.extend({
54630
54854
  params: ElicitRequestParamsSchema
54631
54855
  });
54632
54856
  var ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({
54633
- elicitationId: string9()
54857
+ elicitationId: string10()
54634
54858
  });
54635
54859
  var ElicitationCompleteNotificationSchema = NotificationSchema.extend({
54636
54860
  method: literal3("notifications/elicitation/complete"),
@@ -54638,24 +54862,24 @@ var ElicitationCompleteNotificationSchema = NotificationSchema.extend({
54638
54862
  });
54639
54863
  var ElicitResultSchema = ResultSchema.extend({
54640
54864
  action: _enum(["accept", "decline", "cancel"]),
54641
- content: preprocess((val) => val === null ? undefined : val, record3(string9(), union14([string9(), number8(), boolean6(), array8(string9())])).optional())
54865
+ content: preprocess((val) => val === null ? undefined : val, record3(string10(), union14([string10(), number8(), boolean6(), array8(string10())])).optional())
54642
54866
  });
54643
54867
  var ResourceTemplateReferenceSchema = object({
54644
54868
  type: literal3("ref/resource"),
54645
- uri: string9()
54869
+ uri: string10()
54646
54870
  });
54647
54871
  var PromptReferenceSchema = object({
54648
54872
  type: literal3("ref/prompt"),
54649
- name: string9()
54873
+ name: string10()
54650
54874
  });
54651
54875
  var CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
54652
54876
  ref: union14([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
54653
54877
  argument: object({
54654
- name: string9(),
54655
- value: string9()
54878
+ name: string10(),
54879
+ value: string10()
54656
54880
  }),
54657
54881
  context: object({
54658
- arguments: record3(string9(), string9()).optional()
54882
+ arguments: record3(string10(), string10()).optional()
54659
54883
  }).optional()
54660
54884
  });
54661
54885
  var CompleteRequestSchema = RequestSchema.extend({
@@ -54664,15 +54888,15 @@ var CompleteRequestSchema = RequestSchema.extend({
54664
54888
  });
54665
54889
  var CompleteResultSchema = ResultSchema.extend({
54666
54890
  completion: looseObject({
54667
- values: array8(string9()).max(100),
54891
+ values: array8(string10()).max(100),
54668
54892
  total: optional2(number8().int()),
54669
54893
  hasMore: optional2(boolean6())
54670
54894
  })
54671
54895
  });
54672
54896
  var RootSchema = object({
54673
- uri: string9().startsWith("file://"),
54674
- name: string9().optional(),
54675
- _meta: record3(string9(), unknown()).optional()
54897
+ uri: string10().startsWith("file://"),
54898
+ name: string10().optional(),
54899
+ _meta: record3(string10(), unknown()).optional()
54676
54900
  });
54677
54901
  var ListRootsRequestSchema = RequestSchema.extend({
54678
54902
  method: literal3("roots/list"),
@@ -54887,10 +55111,10 @@ var NEW_TOPICS_PREFIX = "new-topics:";
54887
55111
  var MENTIONS_LITERAL = "mentions";
54888
55112
  var asTokenError = (token, reason) => exports_Effect.mapError(() => new SubscribeTokenError({ token, reason }));
54889
55113
  var parseSubscribeTarget = (token) => exports_Effect.gen(function* () {
54890
- if (token.length === 0) {
55114
+ if (exports_String.isEmpty(token)) {
54891
55115
  return yield* new SubscribeTokenError({ token, reason: "token is empty" });
54892
55116
  }
54893
- if (token !== token.trim()) {
55117
+ if (token !== exports_String.trim(token)) {
54894
55118
  return yield* new SubscribeTokenError({
54895
55119
  token,
54896
55120
  reason: "leading/trailing whitespace is not allowed"
@@ -54947,14 +55171,8 @@ var envConfigError = (issues) => new EnvConfigError({
54947
55171
  - ${issues.join(`
54948
55172
  - `)}`
54949
55173
  });
54950
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
54951
- var parseSessionId = (raw3) => {
54952
- if (typeof raw3 !== "string")
54953
- return exports_Option.none();
54954
- if (!UUID_RE.test(raw3))
54955
- return exports_Option.none();
54956
- return exports_Option.some(raw3);
54957
- };
55174
+ var SessionIdSchema = exports_Schema.UUID.pipe(exports_Schema.brand("SessionId"));
55175
+ var parseSessionId = exports_Schema.decodeUnknownOption(SessionIdSchema);
54958
55176
  var BOT_NAME_RE = /^[a-z][a-z0-9_-]*$/;
54959
55177
  var parseBotName = (raw3) => {
54960
55178
  if (raw3.length === 0 || raw3.length > 40)
@@ -55019,34 +55237,43 @@ var optionalSessionId = (key) => exports_Config.option(exports_Config.string(key
55019
55237
  if (placeholderShape.test(value5)) {
55020
55238
  return exports_Either.left(exports_ConfigError.InvalidData([key], placeholderMessage(key, value5)));
55021
55239
  }
55022
- return exports_Option.match(parseSessionId(value5), {
55023
- onNone: () => exports_Either.left(exports_ConfigError.InvalidData([key], `${key} must be a UUID — received: ${value5}`)),
55024
- onSome: (sessionId) => exports_Either.right(sessionId)
55025
- });
55240
+ return exports_Either.fromOption(parseSessionId(value5), () => exports_ConfigError.InvalidData([key], `${key} must be a UUID — received: ${value5}`));
55026
55241
  })));
55027
55242
  var optionalBotName = (key) => optionalNonEmpty(key).pipe(exports_Config.mapOrFail((option7) => exports_Option.match(option7, {
55028
55243
  onNone: () => exports_Either.right(exports_Option.none()),
55029
- onSome: (raw3) => exports_Option.match(parseBotName(raw3), {
55030
- onNone: () => exports_Either.left(exports_ConfigError.InvalidData([key], `${key} must be substrate-safe (lowercase ASCII, digits, dashes, underscores; starts with letter; max 40 chars) — received: ${raw3}`)),
55031
- onSome: (botName) => exports_Either.right(exports_Option.some(botName))
55032
- })
55244
+ onSome: (raw3) => exports_Either.fromOption(parseBotName(raw3), () => exports_ConfigError.InvalidData([key], `${key} must be substrate-safe (lowercase ASCII, digits, dashes, underscores; starts with letter; max 40 chars) — received: ${raw3}`)).pipe(exports_Either.map(exports_Option.some))
55033
55245
  })));
55246
+ var optionalApiKey = (key) => {
55247
+ const decode7 = exports_ParseResult.decodeUnknownEither(apiKeySchema);
55248
+ return optionalNonEmpty(key).pipe(exports_Config.mapOrFail((option7) => exports_Option.match(option7, {
55249
+ onNone: () => exports_Either.right(exports_Option.none()),
55250
+ onSome: (raw3) => decode7(raw3).pipe(exports_Either.mapBoth({
55251
+ onLeft: (issue2) => exports_ConfigError.InvalidData([key], exports_ParseResult.TreeFormatter.formatIssueSync(issue2)),
55252
+ onRight: (value5) => exports_Option.some(exports_Redacted.make(value5))
55253
+ }))
55254
+ })));
55255
+ };
55034
55256
  var envConfig = exports_Config.all({
55035
55257
  realmUrl: requiredBrand("ZULIP_SITE", realmUrlSchema, (v) => v),
55036
55258
  minterEmail: requiredBrand("ZULIP_MINTER_EMAIL", botEmailSchema, (v) => v),
55037
55259
  minterApiKey: exports_Config.redacted(requiredBrand("ZULIP_MINTER_API_KEY", apiKeySchema, (v) => v)),
55038
55260
  botName: optionalBotName("COMMY_BOT_NAME"),
55261
+ botApiKey: optionalApiKey("COMMY_BOT_API_KEY"),
55039
55262
  subscribe: optionalUserConfig("COMMY_SUBSCRIBE"),
55040
55263
  project: optionalNonEmpty("COMMY_PROJECT"),
55041
55264
  catchupWindowSeconds: optionalNonNegativeInt("COMMY_CATCHUP_WINDOW_SECONDS"),
55042
55265
  sessionId: optionalSessionId("CLAUDE_CODE_SESSION_ID")
55043
- }).pipe(exports_Config.map((raw3) => {
55266
+ }).pipe(exports_Config.mapOrFail((raw3) => {
55267
+ if (exports_Option.isSome(raw3.botApiKey) && exports_Option.isNone(raw3.botName)) {
55268
+ return exports_Either.left(exports_ConfigError.InvalidData(["COMMY_BOT_API_KEY"], "COMMY_BOT_API_KEY requires COMMY_BOT_NAME — the key identifies which provisioned persona to attach to"));
55269
+ }
55044
55270
  const project3 = exports_Option.flatMap(raw3.project, sanitiseProjectSlug);
55045
- return {
55271
+ return exports_Either.right({
55046
55272
  realmUrl: raw3.realmUrl,
55047
55273
  minterEmail: raw3.minterEmail,
55048
55274
  minterApiKey: raw3.minterApiKey,
55049
55275
  ...exports_Option.match(raw3.botName, { onNone: () => ({}), onSome: (botName) => ({ botName }) }),
55276
+ ...exports_Option.isSome(raw3.botName) && exports_Option.isSome(raw3.botApiKey) ? { attachIdentity: { name: raw3.botName.value, apiKey: raw3.botApiKey.value } } : {},
55050
55277
  ...exports_Option.match(raw3.subscribe, {
55051
55278
  onNone: () => ({}),
55052
55279
  onSome: (subscribe4) => ({ subscribe: subscribe4 })
@@ -55060,7 +55287,7 @@ var envConfig = exports_Config.all({
55060
55287
  onNone: () => ({}),
55061
55288
  onSome: (catchupWindowSeconds) => ({ catchupWindowSeconds })
55062
55289
  })
55063
- };
55290
+ });
55064
55291
  }));
55065
55292
  var parseEnv = envConfig.pipe(exports_Effect.mapError((error2) => envConfigError(renderConfigError(error2))));
55066
55293
  var sanitiseProjectSlug = (raw3) => {
@@ -55069,10 +55296,10 @@ var sanitiseProjectSlug = (raw3) => {
55069
55296
  const filtered = dashed.replace(/[^a-z0-9-]/g, "-");
55070
55297
  const collapsed = filtered.replace(/-+/g, "-");
55071
55298
  const trimmed2 = collapsed.replace(/^-+|-+$/g, "");
55072
- if (trimmed2.length === 0)
55299
+ if (exports_String.isEmpty(trimmed2))
55073
55300
  return exports_Option.none();
55074
55301
  const truncated = trimmed2.slice(0, 12).replace(/-+$/, "");
55075
- if (truncated.length === 0)
55302
+ if (exports_String.isEmpty(truncated))
55076
55303
  return exports_Option.none();
55077
55304
  if (!/^[a-z]/.test(truncated))
55078
55305
  return exports_Option.none();
@@ -55121,7 +55348,8 @@ var ZulipAdapterLive = substrateAdapterLayer(exports_Effect.gen(function* () {
55121
55348
  return yield* zulipAdapter({
55122
55349
  realmUrl: parsed.realmUrl,
55123
55350
  minterEmail: parsed.minterEmail,
55124
- minterApiKey: parsed.minterApiKey
55351
+ minterApiKey: parsed.minterApiKey,
55352
+ ...parsed.attachIdentity === undefined ? {} : { attachIdentity: parsed.attachIdentity }
55125
55353
  });
55126
55354
  }));
55127
55355
  var subscribeFromEnv = (inbox, narrowSet, parsed) => {
@@ -55146,6 +55374,9 @@ var formatMessage = (event, botIdentityId) => {
55146
55374
  ["channel_name", ref.channel.name],
55147
55375
  ["thread", ref.thread?.name],
55148
55376
  ["message_id", ref.id],
55377
+ ["permalink", ref.permalink],
55378
+ ["channel_permalink", ref.channel.permalink],
55379
+ ["thread_permalink", ref.thread?.permalink],
55149
55380
  ["sender_id", sender.id],
55150
55381
  ["sender_name", sender.name],
55151
55382
  ["sender_kind", sender.kind],
@@ -55164,6 +55395,7 @@ var formatReaction = (event, observedAt) => {
55164
55395
  ["target_message_id", event.target.id],
55165
55396
  ["target_channel_name", event.target.channel.name],
55166
55397
  ["target_thread", event.target.thread?.name],
55398
+ ["target_permalink", event.target.permalink],
55167
55399
  ["reaction_emoji", event.emoji],
55168
55400
  ["reaction_action", action],
55169
55401
  ["by_id", event.by.id],
@@ -55174,7 +55406,7 @@ var formatReaction = (event, observedAt) => {
55174
55406
  return { content: `[reaction ${action}] ${event.emoji}`, meta };
55175
55407
  };
55176
55408
  var formatError2 = (kind, message) => {
55177
- const resolvedKind = kind.length === 0 ? "unknown" : kind;
55409
+ const resolvedKind = exports_String.isEmpty(kind) ? "unknown" : kind;
55178
55410
  const meta = buildMeta([["error_kind", resolvedKind]]);
55179
55411
  return { content: message, meta };
55180
55412
  };
@@ -55266,13 +55498,12 @@ var createFileCursorStore = (deps) => {
55266
55498
  return { read: read3, write: write4 };
55267
55499
  };
55268
55500
  var STATE_SEGMENT = "commy";
55269
- var stateBaseConfig = exports_Config.string("XDG_STATE_HOME").pipe(exports_Config.mapOrFail((value5) => value5.length === 0 ? exports_Either.left(exports_ConfigError.MissingData(["XDG_STATE_HOME"], "XDG_STATE_HOME is empty")) : exports_Either.right(value5)), exports_Config.withDefault(join7(homedir(), ".local", "state")));
55501
+ var stateBaseConfig = exports_Config.nonEmptyString("XDG_STATE_HOME").pipe(exports_Config.withDefault(join7(homedir(), ".local", "state")));
55270
55502
  var cursorDirConfig = stateBaseConfig.pipe(exports_Config.map((base) => join7(base, STATE_SEGMENT, "cursors")));
55271
55503
  var FileCursorStoreLive = exports_Layer.effect(CursorStoreTag, exports_Effect.all([exports_FileSystem.FileSystem, exports_Effect.orDie(cursorDirConfig)]).pipe(exports_Effect.map(([fs, dir]) => createFileCursorStore({ dir, fs }))));
55272
55504
 
55273
55505
  // packages/mcp/ensure-bound.ts
55274
- var createEnsureBound = (deps) => {
55275
- const stateRef = exports_Effect.runSync(exports_Ref.make({ kind: "idle" }));
55506
+ var createEnsureBound = (deps) => exports_Effect.map(exports_Ref.make({ kind: "idle" }), (stateRef) => {
55276
55507
  const acquire = exports_Effect.gen(function* () {
55277
55508
  const fresh3 = yield* exports_Deferred.make();
55278
55509
  const decision = yield* exports_Ref.modify(stateRef, (state) => {
@@ -55296,13 +55527,13 @@ var createEnsureBound = (deps) => {
55296
55527
  onSuccess: (identity6) => ({ kind: "acquired", identity: identity6 })
55297
55528
  })).pipe(exports_Effect.zipRight(exports_Deferred.done(decision.deferred, exit3)))));
55298
55529
  });
55299
- const ensureBound = () => exports_Effect.runPromiseExit(acquire).then((exit3) => exports_Exit.isSuccess(exit3) ? exit3.value : Promise.reject(exports_Cause.squash(exit3.cause)));
55530
+ const ensureBound = () => acquire;
55300
55531
  ensureBound.current = () => {
55301
55532
  const state = exports_Effect.runSync(exports_Ref.get(stateRef));
55302
55533
  return state.kind === "acquired" ? state.identity : undefined;
55303
55534
  };
55304
55535
  return ensureBound;
55305
- };
55536
+ });
55306
55537
 
55307
55538
  // packages/mcp/event-pump.ts
55308
55539
  var originatorId = (event) => exports_Match.value(event).pipe(exports_Match.discriminatorsExhaustive("kind")({
@@ -55406,77 +55637,50 @@ var createSingleIdentityCache = (deps) => {
55406
55637
  const current2 = ensureBound.current();
55407
55638
  return current2 === undefined ? new Set : new Set([current2.identity.id]);
55408
55639
  },
55409
- releaseAllBound: async () => {},
55410
- sweepIdle: async () => {}
55640
+ releaseAllBound: () => exports_Effect.void,
55641
+ sweepIdle: () => exports_Effect.void
55411
55642
  };
55412
55643
  };
55413
55644
 
55414
55645
  class UnboundEphemeralSession extends exports_Data.TaggedError("UnboundEphemeralSession") {
55415
55646
  }
55416
- var unboundStub = Object.assign(() => Promise.reject(new UnboundEphemeralSession({
55647
+ var unboundStub = Object.assign(() => exports_Effect.fail(new UnboundEphemeralSession({
55417
55648
  message: "commy: ephemeral mode requires a session_id; the plugin hook " + "should inject it from PreToolUse stdin. For non-CC clients, pass " + "session_id explicitly in the tool call arguments."
55418
55649
  })), { current: () => {
55419
55650
  return;
55420
55651
  } });
55421
- var createEphemeralIdentityCache = (deps) => {
55652
+ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_SynchronizedRef.make(undefined), (slotRef) => {
55422
55653
  const deriveBotName = (sessionId, project3) => composeBotName({
55423
55654
  sessionId,
55424
55655
  ...project3 !== undefined ? { project: project3 } : {}
55425
55656
  });
55426
- let slot;
55427
- const releaseBoundSlot = async () => {
55428
- if (slot === undefined)
55429
- return;
55430
- if (slot.ensureBound.current() !== undefined) {
55431
- await exports_Effect.runPromise(deps.release());
55432
- }
55433
- slot = undefined;
55434
- };
55435
55657
  const wrapWithOnAcquire = (project3) => (n) => deps.acquire(n).pipe(exports_Effect.tap((acquired) => deps.onAcquire !== undefined ? deps.onAcquire(acquired, project3) : exports_Effect.void));
55658
+ const acquireForTransition = (priorEnsure, project3) => (n) => priorEnsure.current() !== undefined ? deps.release().pipe(exports_Effect.zipRight(wrapWithOnAcquire(project3)(n))) : wrapWithOnAcquire(project3)(n);
55659
+ const mintSlot = (sessionId, project3, nowMs, prior) => {
55660
+ const name = deriveBotName(sessionId, project3);
55661
+ const acquire = prior !== undefined ? acquireForTransition(prior.ensureBound, project3) : wrapWithOnAcquire(project3);
55662
+ return createEnsureBound({ acquire, name }).pipe(exports_Effect.map((ensureBound) => [ensureBound, { sessionId, ensureBound, lastUsedMs: nowMs }]));
55663
+ };
55664
+ const releaseBoundSlot = exports_SynchronizedRef.updateEffect(slotRef, (slot) => exports_Effect.as(slot !== undefined && slot.ensureBound.current() !== undefined ? deps.release() : exports_Effect.void, undefined));
55436
55665
  return {
55437
- ensureBoundFor: (sessionId, project3) => exports_Clock.currentTimeMillis.pipe(exports_Effect.map((nowMs) => {
55438
- if (sessionId === undefined) {
55439
- return unboundStub;
55440
- }
55666
+ ensureBoundFor: (sessionId, project3) => sessionId === undefined ? exports_Effect.succeed(unboundStub) : exports_Clock.currentTimeMillis.pipe(exports_Effect.flatMap((nowMs) => exports_SynchronizedRef.modifyEffect(slotRef, (slot) => {
55441
55667
  if (slot !== undefined && slot.sessionId === sessionId) {
55442
- slot.lastUsedMs = nowMs;
55443
- return slot.ensureBound;
55444
- }
55445
- if (slot !== undefined) {
55446
- const priorEnsure = slot.ensureBound;
55447
- const name2 = deriveBotName(sessionId, project3);
55448
- const acquireWithDefaults = wrapWithOnAcquire(project3);
55449
- const acquire = (n) => priorEnsure.current() !== undefined ? deps.release().pipe(exports_Effect.zipRight(acquireWithDefaults(n))) : acquireWithDefaults(n);
55450
- const ensureBound2 = createEnsureBound({ acquire, name: name2 });
55451
- slot = { sessionId, ensureBound: ensureBound2, lastUsedMs: nowMs };
55452
- return ensureBound2;
55453
- }
55454
- const name = deriveBotName(sessionId, project3);
55455
- const ensureBound = createEnsureBound({
55456
- acquire: wrapWithOnAcquire(project3),
55457
- name
55458
- });
55459
- slot = { sessionId, ensureBound, lastUsedMs: nowMs };
55460
- return ensureBound;
55461
- })),
55668
+ const bumped = { ...slot, lastUsedMs: nowMs };
55669
+ return exports_Effect.succeed([slot.ensureBound, bumped]);
55670
+ }
55671
+ return mintSlot(sessionId, project3, nowMs, slot);
55672
+ }))),
55462
55673
  boundIdentityIds: () => {
55674
+ const slot = exports_Effect.runSync(exports_SynchronizedRef.get(slotRef));
55463
55675
  if (slot === undefined)
55464
55676
  return new Set;
55465
55677
  const current2 = slot.ensureBound.current();
55466
55678
  return current2 === undefined ? new Set : new Set([current2.identity.id]);
55467
55679
  },
55468
- releaseAllBound: releaseBoundSlot,
55469
- sweepIdle: async (nowMs) => {
55470
- if (slot === undefined)
55471
- return;
55472
- if (slot.ensureBound.current() === undefined)
55473
- return;
55474
- if (nowMs - slot.lastUsedMs <= deps.idleReleaseMs)
55475
- return;
55476
- await releaseBoundSlot();
55477
- }
55680
+ releaseAllBound: () => releaseBoundSlot,
55681
+ sweepIdle: (nowMs) => exports_SynchronizedRef.updateEffect(slotRef, (slot) => slot !== undefined && slot.ensureBound.current() !== undefined && nowMs - slot.lastUsedMs > deps.idleReleaseMs ? exports_Effect.as(deps.release(), undefined) : exports_Effect.succeed(slot))
55478
55682
  };
55479
- };
55683
+ });
55480
55684
  // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
55481
55685
  function isZ4Schema(s) {
55482
55686
  const schema = s;
@@ -56898,18 +57102,20 @@ class Server extends Protocol {
56898
57102
  }
56899
57103
 
56900
57104
  // packages/mcp/mcp-server.ts
56901
- var PLUGIN_VERSION = "0.12.0";
56902
- var COMMY_INSTRUCTIONS = `**Canonical substrate.** commy is the inter-agent channel on this workstation. Where you also see \`claude-peers\`, \`agent-mail\`, or Discord MCP tools, prefer commy — claude-peers and Discord are retiring (comms-sxf); agent-mail is a mail-shaped substrate kept for specific flows. Don't fan the same message across substrates.
57105
+ var PLUGIN_VERSION = "0.14.1";
57106
+ var COMMY_INSTRUCTIONS = `**Substrate.** commy is the inter-agent channel: agents and humans coordinate here. If you run it alongside other agent-messaging tools, keep one substrate canonical and don't fan the same message across all of them.
56903
57107
 
56904
57108
  **Channels.** Each project has one channel: \`#<project-slug>\` where the slug is resolved per session as \`COMMY_PROJECT\` env > git remote \`origin\` basename > git root basename. Sessions launched outside a git repo (e.g. \`/tmp\`, \`$HOME\`) have no project channel and should post to \`#general\` instead. Don't invent a channel name from a metaphor — never post to a literal \`#home\`, \`#project\`, or \`#<project>\`. Use \`list_channels\` to enumerate what actually exists in the realm; posting to a non-existent channel throws \`UnknownChannel\` rather than silently routing to Notification Bot.
56905
57109
 
56906
- **Topics.** A topic is a logical thread of conversation within a channel; the \`post\` tool's \`thread\` argument names it (Zulip calls these "topics"). Open a new topic when the work shifts — a fresh bead, a new question, a different incident — and reply into an existing one when you're continuing the same line of work. Name topics by the work, not the speaker: \`payments-migration\`, \`comms-tg6-policy\`, \`zulip-events-queue-expiry\` — not \`bot-debugging\` or \`graeme-asked\`. Top-level channel chatter (omit \`thread\`) is for terse status pings only; anything substantive deserves a topic.
57110
+ **Topics.** A topic is a logical thread of conversation within a channel; the \`post\` tool's \`thread\` argument names it (Zulip calls these "topics"). Open a new topic when the work shifts — a fresh task, a new question, a different incident — and reply into an existing one when you're continuing the same line of work. Name topics by the work, not the speaker: \`payments-migration\`, \`auth-token-refresh\`, \`events-queue-expiry\` — not \`bot-debugging\` or \`graeme-asked\`. Top-level channel chatter (omit \`thread\`) is for terse status pings only; anything substantive deserves a topic.
57111
+
57112
+ **Subscriptions.** Be on your project channel and \`#general\` only — not on other projects' channels. Boot-time defaults come from the plugin's \`COMMY_SUBSCRIBE\` userConfig (tokens: \`channel:<name>\`, \`thread:<channel>/<thread>\`, \`new-topics:<channel>\`, \`mentions\`); adjust the live set via \`subscribe\`/\`unsubscribe\` at runtime. Inbound matches arrive as \`<channel source="commy" ...>\` blocks. If one arrives from a channel you aren't subscribed to, treat it as background context and don't reply — only post into your project channel, into \`#general\`, or into threads you've explicitly joined. **Refer to peers by name** — the \`sender_name\` (and reaction \`by_name\`) in those blocks — never by a bare number; reserve numbers for message ids, which otherwise collide with identity in a thread.
56907
57113
 
56908
- **Subscriptions.** Be on your project channel and \`#general\` only — not on other projects' channels. The workstation's boot-time defaults come from the plugin's \`COMMY_SUBSCRIBE\` userConfig (tokens: \`channel:<name>\`, \`thread:<channel>/<thread>\`, \`new-topics:<channel>\`, \`mentions\`); adjust the live set via \`subscribe\`/\`unsubscribe\` at runtime. Inbound matches arrive as \`<channel source="commy" ...>\` blocks. If one arrives from a channel you aren't subscribed to, treat it as background context and don't reply — only post into your project channel, into \`#general\`, or into threads you've explicitly joined. **Refer to peers by name** — the \`sender_name\` (and reaction \`by_name\`) in those blocks — never by a bare number; reserve numbers for message and bead ids, which otherwise collide with identity in a thread.
57114
+ **Links.** Every ref the substrate hands you carries a ready-to-click \`permalink\` — on \`post\` results, \`read_channel\`/\`read_thread\` messages (message \`permalink\` plus \`channel.permalink\` and \`thread.permalink\`), \`list_channels\` (channel \`permalink\`), and inbound \`<channel source="commy">\` frames (\`permalink\` / \`channel_permalink\` / \`thread_permalink\` meta, \`target_permalink\` on reaction frames). **Whenever you show a human a message, channel, or topic reference, render it as that clickable permalink — never a bare name or numeric id.** A human can click a permalink straight to the message; a bare \`#channel > topic\` or message number makes them hunt. When you hold only a message id (e.g. one cited elsewhere, with no permalink to hand), \`message_link(message_id, channel_name?, thread?)\` returns its \`{permalink}\`.
56909
57115
 
56910
- **Tools.** \`post\` (channel; optionally thread or reply), \`react\`/\`unreact\` (emoji on a message), \`subscribe\`/\`unsubscribe\` (live target), \`read_channel\`/\`read_thread\` (history within a range), \`list_channels\` (enumerate channels in the realm), \`resolve\` (identity by name), \`current_identity\` (passive — never acquires), \`download_file\` (fetch a \`/user_uploads/...\` attachment to a temp file — use Read on the returned path to view images), \`upload_file\` (upload a local file by absolute path; returns a \`reference\` string to embed in a \`post\` body).
57116
+ **Tools.** \`post\` (channel; optionally thread or reply), \`react\`/\`unreact\` (emoji on a message), \`subscribe\`/\`unsubscribe\` (live target), \`read_channel\`/\`read_thread\` (history within a range), \`list_channels\` (enumerate channels in the realm), \`message_link\` (canonical permalink for a message id), \`resolve\` (identity by name), \`current_identity\` (passive — never acquires), \`download_file\` (fetch a \`/user_uploads/...\` attachment to a temp file — use Read on the returned path to view images), \`upload_file\` (upload a local file by absolute path; returns a \`reference\` string to embed in a \`post\` body).
56911
57117
 
56912
- **session_id.** Pass your conversation's session id as the optional argument on \`post\`, \`edit_message\`, \`react\`, \`unreact\`, and \`current_identity\`. **Must be a UUID** (e.g. \`crypto.randomUUID()\`); anything else is rejected as malformed and the call routes to the "missing session_id" error rather than silently minting a \`cc-<garbage>\` identity (comms-uqf). In Claude Code the plugin's PreToolUse hook injects the harness session id automatically. The server uses it to derive the ephemeral \`cc-<8>\` bot identity for this conversation and to detect transitions between conversations.`;
57118
+ **session_id.** Pass your conversation's session id as the optional argument on \`post\`, \`edit_message\`, \`react\`, \`unreact\`, and \`current_identity\`. **Must be a UUID** (e.g. \`crypto.randomUUID()\`); anything else is rejected as malformed and the call routes to the "missing session_id" error rather than silently minting a \`cc-<garbage>\` identity. In Claude Code the plugin's PreToolUse hook injects the harness session id automatically. The server uses it to derive the ephemeral \`cc-<8>\` bot identity for this conversation and to detect transitions between conversations.`;
56913
57119
  var buildMcpServer = () => new Server({ name: "commy", version: PLUGIN_VERSION }, {
56914
57120
  capabilities: {
56915
57121
  tools: {},
@@ -56922,54 +57128,52 @@ var buildMcpServer = () => new Server({ name: "commy", version: PLUGIN_VERSION }
56922
57128
  });
56923
57129
 
56924
57130
  // packages/mcp/narrow-set.ts
56925
- var MENTIONS_KEY = "mentions";
57131
+ var MENTIONS_KEY = exports_Data.struct({ kind: "mentions" });
57132
+ var channelKeyOf = (channelName) => exports_Data.struct({ kind: "channel", channelName });
57133
+ var threadKeyOf = (channelName, threadName3) => exports_Data.struct({ kind: "thread", channelName, threadName: threadName3 });
57134
+ var newTopicsKeyOf = (channelName) => exports_Data.struct({ kind: "new-topics", channelName });
56926
57135
  var intentKey = (intent) => exports_Match.value(intent).pipe(exports_Match.discriminatorsExhaustive("kind")({
56927
57136
  mentions: () => MENTIONS_KEY,
56928
- channel: (i) => `channel:${i.channelName}`,
56929
- thread: (i) => `thread:${i.channelName}/${i.threadName}`,
56930
- "new-topics-in-channel": (i) => `new-topics:${i.channelName}`
57137
+ channel: (i) => channelKeyOf(i.channelName),
57138
+ thread: (i) => threadKeyOf(i.channelName, i.threadName),
57139
+ "new-topics-in-channel": (i) => newTopicsKeyOf(i.channelName)
56931
57140
  }));
56932
- var channelKey = (ref) => `channel:${ref.channel.name}`;
56933
- var newTopicsKey = (ref) => `new-topics:${ref.channel.name}`;
56934
- var threadKey = (ref) => ref.thread === undefined ? undefined : `thread:${ref.channel.name}/${ref.thread.name}`;
56935
- var refMatches = (ref, intents) => {
56936
- if (intents.has(channelKey(ref)))
56937
- return true;
56938
- const tk = threadKey(ref);
56939
- return tk !== undefined && intents.has(tk);
56940
- };
56941
- var newTopicsMatches = (ref, intents, seenTopics) => {
56942
- const tk = threadKey(ref);
56943
- if (tk === undefined)
56944
- return false;
56945
- if (!intents.has(newTopicsKey(ref)))
56946
- return false;
56947
- if (seenTopics.has(tk))
56948
- return false;
56949
- seenTopics.add(tk);
56950
- return true;
56951
- };
56952
- var messagePostedMatches = (ref, intents, seenTopics) => refMatches(ref, intents) || newTopicsMatches(ref, intents, seenTopics);
57141
+ var channelKey = (ref) => channelKeyOf(ref.channel.name);
57142
+ var newTopicsKey = (ref) => newTopicsKeyOf(ref.channel.name);
57143
+ var threadKey = (ref) => exports_Option.fromNullable(ref.thread).pipe(exports_Option.map((thread) => threadKeyOf(ref.channel.name, thread.name)));
57144
+ var refMatches = (ref, intents) => exports_HashSet.has(intents, channelKey(ref)) || exports_Option.exists(threadKey(ref), (tk) => exports_HashSet.has(intents, tk));
56953
57145
  var mentionsMatches = (intents, mentions, botIdentityId) => {
56954
57146
  if (botIdentityId === undefined)
56955
57147
  return false;
56956
- if (!intents.has(MENTIONS_KEY))
57148
+ if (!exports_HashSet.has(intents, MENTIONS_KEY))
56957
57149
  return false;
56958
57150
  return mentions.some((m) => m.id === botIdentityId);
56959
57151
  };
56960
57152
  var createNarrowSet = () => {
56961
- const intents = new Set;
56962
- const seenTopics = new Set;
57153
+ let intents = exports_HashSet.empty();
57154
+ let seenTopics = exports_HashSet.empty();
57155
+ const newTopicsMatches = (ref) => exports_Option.match(threadKey(ref), {
57156
+ onNone: () => false,
57157
+ onSome: (tk) => {
57158
+ if (!exports_HashSet.has(intents, newTopicsKey(ref)))
57159
+ return false;
57160
+ if (exports_HashSet.has(seenTopics, tk))
57161
+ return false;
57162
+ seenTopics = exports_HashSet.add(seenTopics, tk);
57163
+ return true;
57164
+ }
57165
+ });
57166
+ const messagePostedMatches = (ref) => refMatches(ref, intents) || newTopicsMatches(ref);
56963
57167
  return {
56964
57168
  add: (intent) => {
56965
- intents.add(intentKey(intent));
57169
+ intents = exports_HashSet.add(intents, intentKey(intent));
56966
57170
  },
56967
57171
  remove: (intent) => {
56968
- intents.delete(intentKey(intent));
57172
+ intents = exports_HashSet.remove(intents, intentKey(intent));
56969
57173
  },
56970
- size: () => intents.size,
57174
+ size: () => exports_HashSet.size(intents),
56971
57175
  matches: (event, botIdentityId) => exports_Match.value(event).pipe(exports_Match.discriminatorsExhaustive("kind")({
56972
- "message-posted": (e) => messagePostedMatches(e.message.ref, intents, seenTopics) || mentionsMatches(intents, e.message.mentions, botIdentityId),
57176
+ "message-posted": (e) => messagePostedMatches(e.message.ref) || mentionsMatches(intents, e.message.mentions, botIdentityId),
56973
57177
  "mention-received": (e) => refMatches(e.message.ref, intents) || mentionsMatches(intents, e.mentions, botIdentityId),
56974
57178
  "reaction-added": (e) => refMatches(e.target, intents),
56975
57179
  "reaction-removed": (e) => refMatches(e.target, intents)
@@ -57001,7 +57205,8 @@ var identityShape = (identity6) => ({
57001
57205
  });
57002
57206
  var channelShape = (channel) => ({
57003
57207
  id: channel.id,
57004
- name: channel.name
57208
+ name: channel.name,
57209
+ permalink: channel.permalink ?? null
57005
57210
  });
57006
57211
  var createCache = () => {
57007
57212
  const identityById = new Map;
@@ -57058,8 +57263,13 @@ var resolveMentions = (cache, mentionIds) => exports_Effect.forEach(mentionIds,
57058
57263
  }));
57059
57264
  var messageShape = (m) => ({
57060
57265
  id: m.ref.id,
57061
- channel: { id: m.ref.channel.id, name: m.ref.channel.name },
57062
- thread: m.ref.thread === undefined ? null : { name: m.ref.thread.name },
57266
+ channel: {
57267
+ id: m.ref.channel.id,
57268
+ name: m.ref.channel.name,
57269
+ permalink: m.ref.channel.permalink ?? null
57270
+ },
57271
+ thread: m.ref.thread === undefined ? null : { name: m.ref.thread.name, permalink: m.ref.thread.permalink ?? null },
57272
+ permalink: m.ref.permalink ?? null,
57063
57273
  sender: identityShape(m.sender),
57064
57274
  body: m.body,
57065
57275
  ts: m.ts,
@@ -57124,6 +57334,11 @@ var ReadThreadArgs = exports_Schema.Struct({
57124
57334
  thread: exports_Schema.String,
57125
57335
  ...RangeArgs
57126
57336
  });
57337
+ var MessageLinkArgs = exports_Schema.Struct({
57338
+ message_id: exports_Schema.String,
57339
+ channel_name: exports_Schema.optional(exports_Schema.String),
57340
+ thread: exports_Schema.optional(exports_Schema.String)
57341
+ });
57127
57342
  var PresenceArgs = exports_Schema.Struct({ identity_id: exports_Schema.String });
57128
57343
  var DownloadFileArgs = exports_Schema.Struct({ url_path: exports_Schema.String });
57129
57344
  var UploadFileArgs = exports_Schema.Struct({ path: exports_Schema.String });
@@ -57141,7 +57356,7 @@ var buildToolDefs = (deps, cache) => {
57141
57356
  const readSessionId = (args2) => exports_Option.getOrUndefined(parseSessionId(args2["session_id"]));
57142
57357
  const readCwd = (args2) => {
57143
57358
  const raw3 = args2["cwd"];
57144
- return typeof raw3 === "string" ? raw3 : undefined;
57359
+ return exports_Predicate.isString(raw3) ? raw3 : undefined;
57145
57360
  };
57146
57361
  const projectForArgs = (args2) => projectForCwd(readCwd(args2));
57147
57362
  const stickyThreadEngagement = async (ref) => {
@@ -57235,7 +57450,7 @@ var buildToolDefs = (deps, cache) => {
57235
57450
  },
57236
57451
  {
57237
57452
  name: "list_channels",
57238
- description: "List every channel the substrate is aware of, returning {id, name} for each. Use this for discovery instead of guessing channel names — posting to a non-existent channel throws UnknownChannel.",
57453
+ description: "List every channel the substrate is aware of, returning {id, name, permalink} for each. Use this for discovery instead of guessing channel names — posting to a non-existent channel throws UnknownChannel. When you show a human a channel, link it by its permalink rather than a bare name.",
57239
57454
  inputSchema: emptyObjectSchema,
57240
57455
  handler: async () => {
57241
57456
  const channels = await runEdge(adapter4.directory.listChannels());
@@ -57246,7 +57461,7 @@ var buildToolDefs = (deps, cache) => {
57246
57461
  },
57247
57462
  {
57248
57463
  name: "post",
57249
- description: "Post a message to a channel by name. Optional thread (topic), mentions (identity ids the bot has seen), and reply_to (message id). To ping someone on Zulip, write the @**Name** markup inline in body where you want it rendered — the mentions array is notification metadata only and does NOT modify body. Returns {message_id, channel_id, channel_name, thread}.",
57464
+ description: "Post a message to a channel by name. Optional thread (topic), mentions (identity ids the bot has seen), and reply_to (message id). To ping someone on Zulip, write the @**Name** markup inline in body where you want it rendered — the mentions array is notification metadata only and does NOT modify body. Returns {message_id, channel_id, channel_name, thread, permalink}. When you show a human this message afterwards, link it by the returned permalink — never a bare name or message id.",
57250
57465
  inputSchema: {
57251
57466
  type: "object",
57252
57467
  properties: {
@@ -57272,8 +57487,7 @@ var buildToolDefs = (deps, cache) => {
57272
57487
  additionalProperties: false
57273
57488
  },
57274
57489
  handler: async (args2) => {
57275
- const ensureBound = await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)));
57276
- await ensureBound();
57490
+ await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)).pipe(exports_Effect.flatMap((ensureBound) => ensureBound())));
57277
57491
  const ref = await runEdge(exports_Effect.gen(function* () {
57278
57492
  const { channel_name, body, thread, mentions, reply_to } = yield* exports_Schema.decodeUnknown(PostArgs)(args2);
57279
57493
  const channel = yield* resolveChannel(cache, channel_name);
@@ -57296,7 +57510,8 @@ var buildToolDefs = (deps, cache) => {
57296
57510
  message_id: ref.id,
57297
57511
  channel_id: ref.channel.id,
57298
57512
  channel_name: ref.channel.name,
57299
- thread: ref.thread === undefined ? null : { name: ref.thread.name }
57513
+ thread: ref.thread === undefined ? null : { name: ref.thread.name },
57514
+ permalink: ref.permalink ?? null
57300
57515
  };
57301
57516
  }
57302
57517
  },
@@ -57323,8 +57538,7 @@ var buildToolDefs = (deps, cache) => {
57323
57538
  additionalProperties: false
57324
57539
  },
57325
57540
  handler: async (args2) => {
57326
- const ensureBound = await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)));
57327
- await ensureBound();
57541
+ await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)).pipe(exports_Effect.flatMap((ensureBound) => ensureBound())));
57328
57542
  const ref = await runEdge(exports_Effect.gen(function* () {
57329
57543
  const { message_id, body, channel_name, thread } = yield* exports_Schema.decodeUnknown(EditMessageArgs)(args2);
57330
57544
  const target = yield* reconstructMessageRef(cache, message_id, channel_name, thread);
@@ -57358,8 +57572,7 @@ var buildToolDefs = (deps, cache) => {
57358
57572
  additionalProperties: false
57359
57573
  },
57360
57574
  handler: async (args2) => {
57361
- const ensureBound = await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)));
57362
- await ensureBound();
57575
+ await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)).pipe(exports_Effect.flatMap((ensureBound) => ensureBound())));
57363
57576
  const ref = await runEdge(exports_Effect.gen(function* () {
57364
57577
  const { message_id, emoji: emoji2, channel_name, thread } = yield* exports_Schema.decodeUnknown(ReactArgs)(args2);
57365
57578
  const target = yield* reconstructMessageRef(cache, message_id, channel_name, thread);
@@ -57388,8 +57601,7 @@ var buildToolDefs = (deps, cache) => {
57388
57601
  additionalProperties: false
57389
57602
  },
57390
57603
  handler: async (args2) => {
57391
- const ensureBound = await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)));
57392
- await ensureBound();
57604
+ await runEdge(exports_Effect.flatMap(projectForArgs(args2), (project3) => identityCache.ensureBoundFor(readSessionId(args2), project3)).pipe(exports_Effect.flatMap((ensureBound) => ensureBound())));
57393
57605
  await runEdge(exports_Effect.gen(function* () {
57394
57606
  const { message_id, emoji: emoji2, channel_name, thread } = yield* exports_Schema.decodeUnknown(ReactArgs)(args2);
57395
57607
  const ref = yield* reconstructMessageRef(cache, message_id, channel_name, thread);
@@ -57450,7 +57662,7 @@ var buildToolDefs = (deps, cache) => {
57450
57662
  },
57451
57663
  {
57452
57664
  name: "read_channel",
57453
- description: "Read recent messages from a channel by name. Returns {messages: Message[]} bounded by optional since/until/limit.",
57665
+ description: "Read recent messages from a channel by name. Returns {messages: Message[]} bounded by optional since/until/limit. Each message carries a clickable permalink (and channel.permalink / thread.permalink) — when you cite one of these to a human, render it as that permalink, not a bare name or id.",
57454
57666
  inputSchema: {
57455
57667
  type: "object",
57456
57668
  properties: {
@@ -57475,7 +57687,7 @@ var buildToolDefs = (deps, cache) => {
57475
57687
  },
57476
57688
  {
57477
57689
  name: "read_thread",
57478
- description: "Read recent messages from a thread (topic) within a channel. Returns {messages: Message[]} bounded by optional since/until/limit.",
57690
+ description: "Read recent messages from a thread (topic) within a channel. Returns {messages: Message[]} bounded by optional since/until/limit. Each message carries a clickable permalink (and channel.permalink / thread.permalink) — when you cite one of these to a human, render it as that permalink, not a bare name or id.",
57479
57691
  inputSchema: {
57480
57692
  type: "object",
57481
57693
  properties: {
@@ -57499,6 +57711,41 @@ var buildToolDefs = (deps, cache) => {
57499
57711
  return { messages: messages.map(messageShape) };
57500
57712
  }
57501
57713
  },
57714
+ {
57715
+ name: "message_link",
57716
+ description: "Return the canonical clickable permalink for a message id: {permalink}. Use when you hold only an id (e.g. one cited elsewhere) and want the URL without re-deriving the narrow format — messages from post/read already carry a permalink. A message just posted or read is resolved from cache; otherwise pass channel_name (and thread) to build the link directly, or omit them to look the message up by id. Returns {permalink: null} when the message cannot be resolved.",
57717
+ inputSchema: {
57718
+ type: "object",
57719
+ properties: {
57720
+ message_id: { type: "string", description: "Message id to link to" },
57721
+ channel_name: {
57722
+ type: "string",
57723
+ description: "Channel the message lives in (lets the link be built without a lookup)"
57724
+ },
57725
+ thread: {
57726
+ type: "string",
57727
+ description: "Thread / topic the message lives in (sharpens the link to the topic)"
57728
+ }
57729
+ },
57730
+ required: ["message_id"],
57731
+ additionalProperties: false
57732
+ },
57733
+ handler: async (args2) => {
57734
+ const permalink = await runEdge(exports_Effect.gen(function* () {
57735
+ const parsed = yield* exports_Schema.decodeUnknown(MessageLinkArgs)(args2);
57736
+ const id3 = yield* decodeMessageId(parsed.message_id);
57737
+ const cached5 = cache.messageById.get(id3);
57738
+ if (cached5?.permalink !== undefined)
57739
+ return cached5.permalink;
57740
+ const hint = parsed.channel_name === undefined ? undefined : {
57741
+ channel: yield* decodeChannelName(parsed.channel_name),
57742
+ ...parsed.thread === undefined ? {} : { thread: yield* decodeThreadName(parsed.thread) }
57743
+ };
57744
+ return exports_Option.getOrNull(yield* adapter4.history.messagePermalink(id3, hint));
57745
+ }));
57746
+ return { permalink };
57747
+ }
57748
+ },
57502
57749
  {
57503
57750
  name: "presence",
57504
57751
  description: "Return presence for the given identity id: online/idle/offline for humans, or 'unknown' for agents (bots have no presence concept — Zulip presence is human-only). Identity must already be cached via list_agents, list_humans, resolve, or current_identity — call one of those first when given a name.",
@@ -57634,7 +57881,7 @@ var RELEASE_TIMEOUT_MS = 5000;
57634
57881
  var EPHEMERAL_IDLE_RELEASE_MS = 60 * 60 * 1000;
57635
57882
  var EPHEMERAL_IDLE_SWEEP_INTERVAL_MS = 5 * 60 * 1000;
57636
57883
  var forkIdleSweep = (cache, intervalMs) => {
57637
- const sweep = exports_Clock.currentTimeMillis.pipe(exports_Effect.flatMap((nowMs) => exports_Effect.promise(() => cache.sweepIdle(nowMs))));
57884
+ const sweep = exports_Clock.currentTimeMillis.pipe(exports_Effect.flatMap((nowMs) => cache.sweepIdle(nowMs)));
57638
57885
  return exports_Effect.asVoid(exports_Effect.forkScoped(exports_Effect.repeat(sweep, exports_Schedule.spaced(exports_Duration.millis(intervalMs)))));
57639
57886
  };
57640
57887
  var createType2DefaultsOnAcquire = (narrowSet, inbox) => {
@@ -57650,11 +57897,10 @@ var registerType1DefaultsOnBoot = (inbox, narrowSet, project3) => (project3 !==
57650
57897
  var DEFAULT_CATCHUP_WINDOW_SECONDS = 4 * 3600;
57651
57898
  var buildIdentityCache = (adapter4, botName, ephemeralOnAcquire) => {
57652
57899
  if (botName !== undefined) {
57653
- const ensureBound = createEnsureBound({
57900
+ return createEnsureBound({
57654
57901
  acquire: adapter4.identity.acquire,
57655
57902
  name: botName
57656
- });
57657
- return createSingleIdentityCache({ ensureBound });
57903
+ }).pipe(exports_Effect.map((ensureBound) => createSingleIdentityCache({ ensureBound })));
57658
57904
  }
57659
57905
  return createEphemeralIdentityCache({
57660
57906
  acquire: adapter4.identity.acquire,
@@ -57698,15 +57944,15 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
57698
57944
  identityId: acquired.identity.id,
57699
57945
  notifier
57700
57946
  }).pipe(exports_Effect.catchAllCause(logCatchUpFailure("ephemeral mentions")))), exports_Effect.provide(loggerLayer)) : undefined;
57701
- const identityCache = buildIdentityCache(adapter4, parsed.botName, ephemeralOnAcquire);
57947
+ const identityCache = yield* buildIdentityCache(adapter4, parsed.botName, ephemeralOnAcquire);
57702
57948
  let type1Intents = [];
57703
57949
  if (parsed.botName !== undefined) {
57704
57950
  const botName = parsed.botName;
57705
57951
  const ensureBound = yield* identityCache.ensureBoundFor(undefined);
57706
- type1Intents = yield* exports_Effect.tryPromise({
57707
- try: () => ensureBound(),
57708
- catch: (err) => new BootError({ message: exports_Predicate.isError(err) ? err.message : String(err) })
57709
- }).pipe(exports_Effect.matchEffect({
57952
+ type1Intents = yield* ensureBound().pipe(exports_Effect.catchAllCause((cause3) => {
57953
+ const err = exports_Cause.squash(cause3);
57954
+ return exports_Effect.fail(new BootError({ message: exports_Predicate.isError(err) ? err.message : String(err) }));
57955
+ }), exports_Effect.matchEffect({
57710
57956
  onFailure: (bootErr) => exports_Effect.logError(`commy plugin: acquire("${botName}") failed: ${bootErr.message}`).pipe(exports_Effect.zipRight(exports_Effect.fail(bootErr))),
57711
57957
  onSuccess: () => registerType1DefaultsOnBoot(adapter4.inbox, narrowSet, parsed.project)
57712
57958
  }));