clanka 0.8.4 → 0.8.6

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 (36) hide show
  1. package/dist/AgentSkills.test.js +1 -0
  2. package/dist/AgentSkills.test.js.map +1 -1
  3. package/dist/AgentTools.d.ts.map +1 -1
  4. package/dist/AgentTools.js +2 -1
  5. package/dist/AgentTools.js.map +1 -1
  6. package/dist/Compaction.test.js +1 -0
  7. package/dist/Compaction.test.js.map +1 -1
  8. package/dist/CompactionTransport.test.js +1 -1
  9. package/dist/CompactionTransport.test.js.map +1 -1
  10. package/dist/bin/{Effect-BmOuzEIp.mjs → Effect-rADALOOD.mjs} +477 -267
  11. package/dist/bin/Effect-rADALOOD.mjs.map +1 -0
  12. package/dist/bin/{McpClient-CLpFJSre.mjs → McpClient-NazR2OwL.mjs} +219 -63
  13. package/dist/bin/McpClient-NazR2OwL.mjs.map +1 -0
  14. package/dist/bin/{OutputFormatter-C_gdNUl1.mjs → OutputFormatter-BVHbgF2b.mjs} +8 -8
  15. package/dist/bin/OutputFormatter-BVHbgF2b.mjs.map +1 -0
  16. package/dist/bin/{Schema-C7W9nQug.mjs → Schema-C7NXAOWA.mjs} +642 -88
  17. package/dist/bin/Schema-C7NXAOWA.mjs.map +1 -0
  18. package/dist/bin/{SemanticSearch-cqSnq90g.mjs → SemanticSearch-4Jes3jCl.mjs} +135 -90
  19. package/dist/bin/SemanticSearch-4Jes3jCl.mjs.map +1 -0
  20. package/dist/bin/{Stream-BI6Fx9yq.mjs → Stream-CSLA1_GD.mjs} +69 -48
  21. package/dist/bin/Stream-CSLA1_GD.mjs.map +1 -0
  22. package/dist/bin/cli.mjs +2865 -5333
  23. package/dist/bin/cli.mjs.map +1 -1
  24. package/dist/bin/{turndown.cjs-usmCKZ4b.mjs → turndown.cjs-DK29wZw3.mjs} +2 -2
  25. package/dist/bin/{turndown.cjs-usmCKZ4b.mjs.map → turndown.cjs-DK29wZw3.mjs.map} +1 -1
  26. package/package.json +15 -15
  27. package/src/AgentSkills.test.ts +1 -0
  28. package/src/AgentTools.ts +2 -1
  29. package/src/Compaction.test.ts +1 -0
  30. package/src/CompactionTransport.test.ts +1 -1
  31. package/dist/bin/Effect-BmOuzEIp.mjs.map +0 -1
  32. package/dist/bin/McpClient-CLpFJSre.mjs.map +0 -1
  33. package/dist/bin/OutputFormatter-C_gdNUl1.mjs.map +0 -1
  34. package/dist/bin/Schema-C7W9nQug.mjs.map +0 -1
  35. package/dist/bin/SemanticSearch-cqSnq90g.mjs.map +0 -1
  36. package/dist/bin/Stream-BI6Fx9yq.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
- import { $i as fail$4, $o as hasProperty, $r as exitInterrupt$1, A as ensuring$2, B as fnUntraced, Bi as isArrayNonEmpty, Br as succeed$2, C as catch_$2, Ci as suspend$3, Cn as isDoneCause, Co as causeFail, Cs as constVoid, Ct as promise, Da as get$1, Di as void_$1, Do as withFiber$1, Dr as doneUnsafe, Ds as identity, Dt as raceFirst, E as contextWith, Eo as exitSucceed, Et as provideService$2, Fn as done, Fo as toJson, Fr as failCause$4, G as forkIn, Gr as andThen$1, Gt as tap$1, H as forEach, Hi as isReadonlyArrayNonEmpty, I as flatMap$2, Ir as interrupt$1, Ji as of, K as forkScoped, Ki as map$3, Kr as asSome, L as flatMapEager, Lr as isExit, M as fail$3, Mr as makeUnsafe$3, N as failCause$3, Ns as pipeArguments, Nt as runForkWith, Or as interruptWith, Pn as die$2, Pr as fail$5, Qi as headUnsafe, Qt as uninterruptible, R as flatten$1, Ri as fromIterable$1, Rn as findError, Rt as scopedWith, Si as succeedNone, Sn as filterDone, T as context, Ti as uninterruptibleMask, To as exitFailCause, Ts as dual, Tt as provideContext$2, U as forever, Ut as suspend$2, Vr as void_$2, Vt as succeed$3, W as forkChild, Wt as sync, Xa as isSome, Y as gen, Yt as tryPromise, Z as interrupt$2, _r as close, _t as onExit$1, a as andThen, ai as fiberInterruptAllAs, an as whileLoop, bn as catchDone, bo as PipeInspectableProto, br as makeUnsafe$2, c as as, ci as fiberRunIn, di as getCurrentFiber, ei as exitVoid, eo as none, gr as addFinalizerExit, gs as isTagged, gt as onError, hi as makeLatchUnsafe, hr as addFinalizer, hs as isString$1, ht as never, ia as isSuccess$1, ii as fiberInterruptAll, in as when, j as exit, li as flatMap$3, m as catchCause$1, mi as makeLatch, mr as Scope, ni as fiberAwait, oi as fiberInterruptAs, on as withFiber, ot as map$2, p as callback$1, pt as matchCauseEffect, qr as callback$2, ra as isFailure, ri as fiberInterrupt, rn as void_, ro as some, sa as succeed$5, si as fiberJoin, t as acquireRelease, ti as exitZipRight, u as asVoid, un as yieldNow, vo as Done, vr as forkUnsafe, wi as sync$1, wn as matchEffect, wo as exitFail, ws as constant, xi as succeed$4, xn as doneExitFromCause, xr as provide, xs as constTrue, yi as onExitPrimitive, yt as onInterrupt, zr as isSuccess } from "./Effect-BmOuzEIp.mjs";
2
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/count.js
1
+ import { $o as makePrimitive, $r as interrupt$1, $s as constant, $t as uninterruptible, Aa as succeed$5, Ar as Scope, Bi as succeedNone, Ci as fiberInterruptAs, D as contextWith, Da as isSuccess$1, Do as some, Dt as provideService$2, E as context, Ea as isFailure, Ei as flatMap$3, Et as provideContext$2, Fn as isDoneCause, G as forkChild, Gi as void_$1, Gs as isTagged, Gt as sync, Hi as sync$1, Ho as Done, Ht as succeed$3, Ii as onExitPrimitive, In as matchEffect, Ir as makeUnsafe$2, Jn as done, Jo as evaluate, Jr as makeUnsafe$3, K as forkIn, Ko as args, Kt as tap$1, L as flatMap$2, Lr as provide, M as exit, Mi as makeLatchUnsafe, Mn as catchDone, Mr as addFinalizerExit, N as fail$3, Nn as doneExitFromCause, Nr as close, Oi as getCurrentFiber, Os as hasProperty, Ot as raceFirst, P as failCause$3, Pn as filterDone, Pr as forkUnsafe, Pt as runForkWith, Q as interrupt$2, Qo as isExit, Qr as failCause$4, Qs as constVoid, R as flatMapEager, Si as fiberInterruptAllAs, Ti as fiberRunIn, U as forEach, Ui as uninterruptibleMask, Ur as doneUnsafe, V as fnUntraced, Vi as suspend$3, W as forever, Wo as PipeInspectableProto, Wr as interruptWith, Ws as isString$1, Wt as suspend$2, X as gen, Xo as exitFailCause, Xs as constTrue, Xt as tryPromise, Yo as exitFail, Yr as asVoidAll, Za as get$1, Zn as findError, Zo as exitSucceed, Zr as fail$5, _i as exitVoid, _t as onError, a as andThen, an as when, ba as headUnsafe, bi as fiberInterrupt, bo as isSome, bt as onInterrupt, c as as, ca as isArrayNonEmpty, cc as pipeArguments, ci as andThen$1, cs as toJson, dn as yieldNow, ec as dual, ei as isExit$1, es as withFiber$1, ga as of, gi as exitInterrupt$1, gt as never, ii as void_$2, in as void_, j as ensuring$2, ji as makeLatch, jr as addFinalizer, li as asSome, m as catchCause$1, ma as map$3, mt as matchCauseEffect, nc as identity, ni as isSuccess, oa as fromIterable$1, on as whileLoop, p as callback$1, q as forkScoped, qn as die$2, qo as causeFail, ri as succeed$2, sn as withFiber, st as map$2, t as acquireRelease, ti as isFailure$1, u as asVoid, ua as isReadonlyArrayNonEmpty, ui as callback$2, vi as exitZipRight, vt as onExit$1, w as catch_$2, wi as fiberJoin, wo as none, wt as promise, xa as fail$4, xi as fiberInterruptAll, yi as fiberAwait, yt as onExitPrimitive$1, z as flatten$1, zi as succeed$4, zt as scopedWith } from "./Effect-rADALOOD.mjs";
2
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/internal/count.js
3
3
  const normalize = (n) => n > 0 ? Math.floor(n) : 0;
4
4
  const normalizeNonEmpty = (n) => Math.max(1, normalize(n));
5
5
  //#endregion
6
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Number.js
6
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Number.js
7
7
  const Number$1 = globalThis.Number;
8
8
  const nextPow2 = (n) => {
9
9
  const nextPow = Math.ceil(Math.log(n) / Math.log(2));
@@ -22,13 +22,13 @@ const round = dual(2, (self, precision) => {
22
22
  return Math.round(self * factor) / factor;
23
23
  });
24
24
  //#endregion
25
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/String.js
25
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/String.js
26
26
  const String = globalThis.String;
27
27
  const isString = isString$1;
28
28
  const toLowerCase = (self) => self.toLowerCase();
29
29
  const camelToSnake = (self) => self.replace(/([A-Z])/g, "_$1").toLowerCase();
30
30
  //#endregion
31
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Fiber.js
31
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Fiber.js
32
32
  const await_ = fiberAwait;
33
33
  const join = fiberJoin;
34
34
  const interrupt = fiberInterrupt;
@@ -38,11 +38,11 @@ const interruptAllAs = fiberInterruptAllAs;
38
38
  const getCurrent = getCurrentFiber;
39
39
  const runIn = fiberRunIn;
40
40
  //#endregion
41
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Latch.js
41
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Latch.js
42
42
  const makeUnsafe$1 = makeLatchUnsafe;
43
43
  const make$5 = makeLatch;
44
44
  //#endregion
45
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/MutableRef.js
45
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/MutableRef.js
46
46
  const TypeId$5 = "~effect/MutableRef";
47
47
  const MutableRefProto = {
48
48
  [TypeId$5]: TypeId$5,
@@ -66,7 +66,7 @@ const set = dual(2, (self, value) => {
66
66
  });
67
67
  const update = dual(2, (self, f) => set(self, f(get(self))));
68
68
  //#endregion
69
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/MutableList.js
69
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/MutableList.js
70
70
  const Empty = Symbol.for("effect/MutableList/Empty");
71
71
  const make$3 = () => ({
72
72
  head: void 0,
@@ -190,7 +190,7 @@ const filter$1 = (self, f) => {
190
190
  };
191
191
  const remove = (self, value) => filter$1(self, (v) => v !== value);
192
192
  //#endregion
193
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/PubSub.js
193
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/PubSub.js
194
194
  const TypeId$4 = "~effect/PubSub";
195
195
  const SubscriptionTypeId = "~effect/PubSub/Subscription";
196
196
  const make$2 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), new Map(), makeUnsafe$2(), makeUnsafe$1(false), make$4(false), options.strategy(), make$4(none())));
@@ -248,14 +248,14 @@ const publish = dual(2, (self, value) => suspend$2(() => {
248
248
  self.strategy.completeSubscribersUnsafe(self.pubsub, self.subscribers);
249
249
  return succeed$3(true);
250
250
  }
251
- return self.strategy.handleSurplus(self.pubsub, self.subscribers, [value], self.shutdownFlag);
251
+ return self.strategy.handleSurplus(self.pubsub, self.subscribers, [value], self.shutdownFlag, self.ended);
252
252
  }));
253
253
  const publishAll = dual(2, (self, elements) => suspend$2(() => {
254
254
  if (self.shutdownFlag.current || isSome(self.ended.current)) return succeed$3(false);
255
255
  const surplus = self.pubsub.publishAll(elements);
256
256
  self.strategy.completeSubscribersUnsafe(self.pubsub, self.subscribers);
257
257
  if (surplus.length === 0) return succeed$3(true);
258
- return self.strategy.handleSurplus(self.pubsub, self.subscribers, surplus, self.shutdownFlag);
258
+ return self.strategy.handleSurplus(self.pubsub, self.subscribers, surplus, self.shutdownFlag, self.ended);
259
259
  }));
260
260
  const subscribe = (self) => uninterruptible(contextWith((services) => {
261
261
  const localScope = get$1(services, Scope);
@@ -299,7 +299,14 @@ const takeAll$1 = (self) => suspend$2(function loop(value) {
299
299
  });
300
300
  const pollForItem = (self) => callback$1((resume) => {
301
301
  if (self.shutdownFlag.current) return resume(interrupt$2);
302
- if (isSome(self.ended.current)) return resume(succeed$3(self.ended.current.value));
302
+ if (isSome(self.ended.current)) {
303
+ const message = self.pollers.length === 0 ? self.subscription.poll() : Empty;
304
+ if (message !== Empty) {
305
+ self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers);
306
+ return resume(succeed$3(message));
307
+ }
308
+ return resume(succeed$3(self.ended.current.value));
309
+ }
303
310
  const deferred = makeUnsafe$3();
304
311
  let set = self.subscribers.get(self.subscription);
305
312
  if (!set) {
@@ -921,7 +928,7 @@ var PubSubImpl = class {
921
928
  };
922
929
  const makePubSubUnsafe = (pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy, ended) => new PubSubImpl(pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy, ended);
923
930
  const ensureCapacity = (capacity) => {
924
- if (capacity <= 0) throw new Error(`Cannot construct PubSub with capacity of ${capacity}`);
931
+ if (capacity <= 0 || capacity !== Infinity && !Number.isInteger(capacity)) throw new Error(`Cannot construct PubSub with capacity of ${capacity}`);
925
932
  };
926
933
  var BackPressureStrategy = class {
927
934
  publishers = make$3();
@@ -931,8 +938,9 @@ var BackPressureStrategy = class {
931
938
  discard: true
932
939
  }));
933
940
  }
934
- handleSurplus(pubsub, subscribers, elements, isShutdown) {
941
+ handleSurplus(pubsub, subscribers, elements, isShutdown, ended) {
935
942
  return callback$1((resume) => {
943
+ if (isSome(ended.current)) return resume(succeed$3(false));
936
944
  const deferred = makeUnsafe$3();
937
945
  this.offerUnsafe(elements, deferred);
938
946
  this.onPubSubEmptySpaceUnsafe(pubsub, subscribers);
@@ -1010,8 +1018,9 @@ var SlidingStrategy = class {
1010
1018
  get shutdown() {
1011
1019
  return void_;
1012
1020
  }
1013
- handleSurplus(pubsub, subscribers, elements, _isShutdown) {
1021
+ handleSurplus(pubsub, subscribers, elements, _isShutdown, ended) {
1014
1022
  return sync(() => {
1023
+ if (isSome(ended.current)) return false;
1015
1024
  this.slidingPublishUnsafe(pubsub, elements);
1016
1025
  this.completeSubscribersUnsafe(pubsub, subscribers);
1017
1026
  return true;
@@ -1167,7 +1176,7 @@ const emptyReplayWindow = {
1167
1176
  close: () => void 0
1168
1177
  };
1169
1178
  //#endregion
1170
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Queue.js
1179
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Queue.js
1171
1180
  const TypeId$3 = "~effect/Queue";
1172
1181
  const EnqueueTypeId = "~effect/Queue/Enqueue";
1173
1182
  const DequeueTypeId = "~effect/Queue/Dequeue";
@@ -1287,10 +1296,10 @@ const takeAll = (self) => takeBetween(self, 1, Number.POSITIVE_INFINITY);
1287
1296
  const takeBetween = dual(3, (self, min, max) => {
1288
1297
  min = normalize(min);
1289
1298
  max = normalize(max);
1290
- return suspend$3(() => takeBetweenUnsafe(self, min, max) ?? andThen$1(awaitTake(self, () => canTake(self, min)), takeBetween(self, min, max)));
1299
+ return suspendTake(() => takeBetweenUnsafe(self, min, max) ?? andThen$1(awaitTake(self, () => canTake(self, min)), takeBetween(self, min, max)));
1291
1300
  });
1292
- const take$1 = (self) => suspend$3(() => takeUnsafe(self) ?? andThen$1(awaitTake(self, () => canTake(self, 1)), take$1(self)));
1293
- const poll = (self) => suspend$3(() => {
1301
+ const take$1 = (self) => suspendTake(() => takeUnsafe(self) ?? andThen$1(awaitTake(self, () => canTake(self, 1)), take$1(self)));
1302
+ const poll = (self) => suspendTake(() => {
1294
1303
  const result = takeUnsafe(self);
1295
1304
  if (result === void 0) return succeed$4(none());
1296
1305
  if (result._tag === "Success") return succeed$4(some(result.value));
@@ -1338,6 +1347,13 @@ const takeBetweenUnsafe = (self, min, max) => {
1338
1347
  releaseCapacity(self);
1339
1348
  return exitSucceed(messages);
1340
1349
  };
1350
+ const suspendTake = makePrimitive({
1351
+ op: "QueueTake",
1352
+ [evaluate](fiber) {
1353
+ const effect = this[args]();
1354
+ return isExit(effect) ? effect[evaluate](fiber) : effect;
1355
+ }
1356
+ });
1341
1357
  const canTake = (self, min) => self.messages.length >= (self.state._tag === "Closing" ? 1 : Math.min(min, self.capacity || 1)) || self.capacity <= 0 && self.state._tag !== "Done" && self.state.offers.size > 0;
1342
1358
  const awaitTake = (self, ready) => callback$2((resume) => {
1343
1359
  if (self.state._tag === "Done") return resume(self.state.exit);
@@ -1406,6 +1422,8 @@ const releaseCapacity = (self) => {
1406
1422
  self.state.offers.delete(entry);
1407
1423
  entry.resume(exitSucceed([]));
1408
1424
  }
1425
+ const state = self.state;
1426
+ if (state._tag === "Done") return isDoneCause(state.exit.cause);
1409
1427
  }
1410
1428
  return false;
1411
1429
  };
@@ -1422,7 +1440,7 @@ const finalize = (self, exit) => {
1422
1440
  openState.awaiters.clear();
1423
1441
  };
1424
1442
  //#endregion
1425
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Semaphore.js
1443
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Semaphore.js
1426
1444
  const makeUnsafe = (permits) => new SemaphoreImpl(permits);
1427
1445
  const waitForPermits = (self, n, effect) => callback$2((resume) => {
1428
1446
  if (self.free >= n) return resume(effect);
@@ -1513,10 +1531,10 @@ var SemaphoreImpl = class {
1513
1531
  };
1514
1532
  const make = (permits) => sync$1(() => new SemaphoreImpl(permits));
1515
1533
  //#endregion
1516
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Take.js
1517
- const toPull = (take) => isExit(take) ? isSuccess(take) ? done(take.value) : take : succeed$3(take);
1534
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Take.js
1535
+ const toPull = (take) => isExit$1(take) ? isSuccess(take) ? done(take.value) : take : succeed$3(take);
1518
1536
  //#endregion
1519
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Channel.js
1537
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Channel.js
1520
1538
  const TypeId$2 = "~effect/Channel";
1521
1539
  const isChannel = (u) => hasProperty(u, TypeId$2);
1522
1540
  const ChannelProto = {
@@ -1549,22 +1567,22 @@ const DefaultChunkSize = 4096;
1549
1567
  const asyncQueue = (scope, f, options) => make$1({
1550
1568
  capacity: options?.bufferSize,
1551
1569
  strategy: options?.strategy
1552
- }).pipe(tap$1((queue) => addFinalizer(scope, shutdown(queue))), tap$1((queue) => forkIn(provide(f(queue), scope), scope)));
1570
+ }).pipe(tap$1((queue) => addFinalizer(scope, shutdown(queue))), tap$1((queue) => provide(f(queue), scope).pipe(catchCause$1((cause) => failCause$2(queue, cause)), forkIn(scope))));
1553
1571
  const callbackArray = (f, options) => fromTransform((_, scope) => map$2(asyncQueue(scope, f, options), takeAll));
1554
1572
  const suspend$1 = (evaluate) => fromTransform((upstream, scope) => suspend$2(() => toTransform(evaluate())(upstream, scope)));
1555
1573
  const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => {
1556
1574
  const size = normalizeNonEmpty(chunkSize);
1557
1575
  return fromPull$1(sync(() => {
1558
1576
  const iter = iterator();
1559
- let done$11 = none();
1577
+ let done$14 = none();
1560
1578
  return suspend$2(() => {
1561
- if (done$11._tag === "Some") return done(done$11.value);
1579
+ if (done$14._tag === "Some") return done(done$14.value);
1562
1580
  const buffer = [];
1563
1581
  while (buffer.length < size) {
1564
1582
  const state = iter.next();
1565
1583
  if (state.done) {
1566
1584
  if (buffer.length === 0) return done(state.value);
1567
- done$11 = some(state.value);
1585
+ done$14 = some(state.value);
1568
1586
  break;
1569
1587
  }
1570
1588
  buffer.push(state.value);
@@ -1580,10 +1598,10 @@ const fail$1 = (error) => fromPull$1(succeed$3(fail$3(error)));
1580
1598
  const failCause$1 = (cause) => fromPull$1(failCause$3(cause));
1581
1599
  const die$1 = (defect) => failCause$1(die$2(defect));
1582
1600
  const fromEffect$1 = (effect) => fromPull$1(sync(() => {
1583
- let done$14 = false;
1601
+ let done$16 = false;
1584
1602
  return suspend$2(() => {
1585
- if (done$14) return done();
1586
- done$14 = true;
1603
+ if (done$16) return done();
1604
+ done$16 = true;
1587
1605
  return effect;
1588
1606
  });
1589
1607
  }));
@@ -1608,9 +1626,9 @@ const readableStreamToPullUnsafe = (options) => {
1608
1626
  catch: options.onError
1609
1627
  }), {
1610
1628
  onFailure: (cause) => exit.current ?? failCause$3(cause),
1611
- onSuccess: ({ done: done$15, value }) => {
1629
+ onSuccess: ({ done: done$10, value }) => {
1612
1630
  if (exit.current) return exit.current;
1613
- return done$15 ? done() : succeed$3(of(value));
1631
+ return done$10 ? done() : succeed$3(of(value));
1614
1632
  }
1615
1633
  });
1616
1634
  });
@@ -1621,7 +1639,7 @@ const map$1 = dual(2, (self, f) => transformPull$1(self, (pull) => sync(() => {
1621
1639
  return map$2(pull, (o) => f(o, i++));
1622
1640
  })));
1623
1641
  const mapDone = dual(2, (self, f) => mapDoneEffect(self, (o) => succeed$3(f(o))));
1624
- const mapDoneEffect = dual(2, (self, f) => transformPull$1(self, (pull) => succeed$3(catchDone(pull, (done$16) => flatMap$2(f(done$16), done)))));
1642
+ const mapDoneEffect = dual(2, (self, f) => transformPull$1(self, (pull) => succeed$3(catchDone(pull, (done$12) => flatMap$2(f(done$12), done)))));
1625
1643
  const concurrencyIsSequential = (concurrency) => concurrency === void 0 || concurrency !== "unbounded" && concurrency <= 1;
1626
1644
  const mapEffect$1 = dual((args) => isChannel(args[0]), (self, f, options) => concurrencyIsSequential(options?.concurrency) ? mapEffectSequential(self, f) : mapEffectConcurrent(self, f, options));
1627
1645
  const mapEffectSequential = (self, f) => fromTransform((upstream, scope) => {
@@ -1790,14 +1808,14 @@ const mergeAll$1 = dual(2, (channels, { bufferSize = 16, concurrency, switch: sw
1790
1808
  yield* interrupt(fiber);
1791
1809
  }
1792
1810
  const fiber = yield* childPull.pipe(tap$1(() => yieldNow), flatMap$2((value) => offer(queue, value)), forever({ disableYield: true }), onError(fnUntraced(function* (cause) {
1793
- const halt = filterDone(cause);
1794
- yield* exit(close(childScope, !isFailure(halt) ? succeed$2(halt.success.value) : failCause$4(halt.failure)));
1811
+ const exit$1 = doneExitFromCause(cause);
1812
+ const closeExit = yield* exit(close(childScope, exit$1));
1795
1813
  if (!fibers.has(fiber)) return;
1814
+ const failure = asVoidAll([exit$1, closeExit]);
1815
+ if (isFailure$1(failure)) yield* failCause$2(queue, failure.cause);
1796
1816
  fibers.delete(fiber);
1797
1817
  if (semaphore) yield* semaphore.release(1);
1798
1818
  if (fibers.size === 0) yield* doneLatch.open;
1799
- if (isSuccess$1(halt)) return;
1800
- return yield* failCause$2(queue, cause);
1801
1819
  })), forkChild);
1802
1820
  doneLatch.closeUnsafe();
1803
1821
  fibers.add(fiber);
@@ -1824,7 +1842,10 @@ const merge$1 = dual((args) => isChannel(args[0]) && isChannel(args[1]), (left,
1824
1842
  case "either": return failCause$2(queue, cause);
1825
1843
  }
1826
1844
  }
1827
- const runSide = (side, channel, scope) => toTransform(channel)(upstream, scope).pipe(flatMap$2((pull) => pull.pipe(flatMap$2((value) => offer(queue, value)), forever)), onError((cause) => andThen(close(scope, doneExitFromCause(cause)), onExit(side, cause))), forkIn(forkedScope));
1845
+ const runSide = (side, channel, scope) => toTransform(channel)(upstream, scope).pipe(flatMap$2((pull) => pull.pipe(flatMap$2((value) => offer(queue, value)), forever)), onError((cause) => onExitPrimitive$1(doneExitFromCause(cause), (exit) => close(scope, exit)).pipe(matchCauseEffect({
1846
+ onFailure: (cause) => onExit(side, cause),
1847
+ onSuccess: () => onExit(side, cause)
1848
+ }))), forkIn(forkedScope));
1828
1849
  yield* runSide("left", left, forkUnsafe(forkedScope));
1829
1850
  yield* runSide("right", right, forkUnsafe(forkedScope));
1830
1851
  return take$1(queue);
@@ -1832,7 +1853,7 @@ const merge$1 = dual((args) => isChannel(args[0]) && isChannel(args[1]), (left,
1832
1853
  const splitLines$1 = () => fromTransform((upstream, _scope) => sync(() => {
1833
1854
  let stringBuilder = "";
1834
1855
  let midCRLF = false;
1835
- let done$12 = none();
1856
+ let done$11 = none();
1836
1857
  function splitLinesArray(chunk) {
1837
1858
  const chunkBuilder = [];
1838
1859
  function pushLine(segment) {
@@ -1877,12 +1898,12 @@ const splitLines$1 = () => fromTransform((upstream, _scope) => sync(() => {
1877
1898
  return isReadonlyArrayNonEmpty(chunkBuilder) ? chunkBuilder : null;
1878
1899
  }
1879
1900
  const pullOrFlush = suspend$2(() => {
1880
- if (done$12._tag === "Some") return done(done$12.value);
1901
+ if (done$11._tag === "Some") return done(done$11.value);
1881
1902
  return matchEffect(upstream, {
1882
1903
  onSuccess: loop,
1883
1904
  onFailure: failCause$3,
1884
1905
  onDone: (leftover) => {
1885
- done$12 = some(leftover);
1906
+ done$11 = some(leftover);
1886
1907
  if (stringBuilder.length > 0) {
1887
1908
  const last = stringBuilder;
1888
1909
  stringBuilder = "";
@@ -1938,7 +1959,7 @@ const toPubSubTake$1 = dual(2, fnUntraced(function* (self, options) {
1938
1959
  return pubsub;
1939
1960
  }));
1940
1961
  //#endregion
1941
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/stream.js
1962
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/internal/stream.js
1942
1963
  const TypeId$1 = "~effect/Stream";
1943
1964
  const streamVariance = {
1944
1965
  _R: identity,
@@ -1956,7 +1977,7 @@ Stream.prototype = {
1956
1977
  };
1957
1978
  const fromChannel$1 = (channel) => new Stream(channel);
1958
1979
  //#endregion
1959
- //#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Stream.js
1980
+ //#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Stream.js
1960
1981
  const TypeId = "~effect/Stream";
1961
1982
  const isStream = (u) => hasProperty(u, TypeId);
1962
1983
  const fromChannel = fromChannel$1;
@@ -2039,7 +2060,7 @@ const drop = dual(2, (self, n) => {
2039
2060
  }));
2040
2061
  });
2041
2062
  const transduce = dual(2, (self, sink) => transformPull(self, (upstream, scope) => sync(() => {
2042
- let done$8;
2063
+ let done$1;
2043
2064
  let leftover;
2044
2065
  const upstreamWithLeftover = suspend$2(() => {
2045
2066
  if (leftover !== void 0) {
@@ -2049,14 +2070,14 @@ const transduce = dual(2, (self, sink) => transformPull(self, (upstream, scope)
2049
2070
  }
2050
2071
  return upstream;
2051
2072
  }).pipe(catch_$2((error) => {
2052
- done$8 = fail$5(error);
2073
+ done$1 = fail$5(error);
2053
2074
  return done();
2054
2075
  }));
2055
2076
  const pull = map$2(suspend$2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
2056
2077
  leftover = leftover_;
2057
2078
  return of(value);
2058
2079
  });
2059
- return suspend$2(() => done$8 ? done$8 : pull);
2080
+ return suspend$2(() => done$1 ? done$1 : pull);
2060
2081
  })));
2061
2082
  const broadcast = dual(2, (self, options) => map$2(toPubSubTake(self, options), fromPubSubTake));
2062
2083
  const pipeThroughChannel = dual(2, (self, channel) => fromChannel(pipeTo(self.channel, channel)));
@@ -2092,6 +2113,6 @@ const mkString = (self) => runFold$1(self.channel, () => "", (acc, chunk) => acc
2092
2113
  const runIntoPubSub = dual((args) => isStream(args[0]), (self, pubsub, options) => runIntoPubSubArray(self.channel, pubsub, options));
2093
2114
  const toPubSubTake = dual(2, (self, options) => toPubSubTake$1(self.channel, options));
2094
2115
  //#endregion
2095
- export { tap as $, mapArrayEffect as A, getCurrent as At, provideService as B, round as Bt, fromPubSub as C, unbounded as Ct, isStream as D, update as Dt, fromReadableStream as E, set as Et, mkString as F, join as Ft, runForEach as G, runCollect as H, onEnd as I, runIn as It, splitLines as J, runForEachArray as K, orDie as L, camelToSnake as Lt, mapError as M, interruptAll as Mt, merge as N, interruptAllAs as Nt, map as O, makeUnsafe$1 as Ot, mergeAll as P, interruptAs as Pt, takeUntil as Q, pipeThroughChannel as R, toLowerCase as Rt, fromIterable as S, take$1 as St, fromQueue as T, make$4 as Tt, runDrain as U, run as V, normalizeNonEmpty as Vt, runFold as W, suspend as X, succeed as Y, take as Z, flattenIterable as _, offer as _t, catchTags as a, pipeTo as at, fromChannel as b, offerUnsafe as bt, die as c, make as ct, ensuring as d, end as dt, transduce as et, fail as f, endUnsafe as ft, flatMap as g, make$1 as gt, filterMap as h, failCauseUnsafe as ht, catchReason as i, mapDone as it, mapEffect as j, interrupt as jt, mapArray as k, await_ as kt, drop as l, makeUnsafe as lt, filter as m, failCause$2 as mt, callback as n, fromTransform as nt, catch_ as o, toTransform as ot, failCause as p, fail$2 as pt, runIntoPubSub as q, catchIf as r, map$1 as rt, decodeText as s, unwrap$1 as st, broadcast as t, unwrap as tt, empty as u, bounded as ut, fromArray as v, offerAll as vt, fromPull as w, unbounded$1 as wt, fromEffect as x, poll as xt, fromArrayEffect as y, offerAllUnsafe as yt, provideContext as z, parse as zt };
2116
+ export { tap as $, mapArrayEffect as A, await_ as At, provideService as B, parse as Bt, fromPubSub as C, take$1 as Ct, isStream as D, set as Dt, fromReadableStream as E, make$4 as Et, mkString as F, interruptAs as Ft, runForEach as G, runCollect as H, normalizeNonEmpty as Ht, onEnd as I, join as It, splitLines as J, runForEachArray as K, orDie as L, runIn as Lt, mapError as M, interrupt as Mt, merge as N, interruptAll as Nt, map as O, update as Ot, mergeAll as P, interruptAllAs as Pt, takeUntil as Q, pipeThroughChannel as R, camelToSnake as Rt, fromIterable as S, shutdownUnsafe as St, fromQueue as T, unbounded$1 as Tt, runDrain as U, run as V, round as Vt, runFold as W, suspend as X, succeed as Y, take as Z, flattenIterable as _, offer as _t, catchTags as a, pipeTo as at, fromChannel as b, offerUnsafe as bt, die as c, make as ct, ensuring as d, end as dt, transduce as et, fail as f, endUnsafe as ft, flatMap as g, make$1 as gt, filterMap as h, failCauseUnsafe as ht, catchReason as i, mapDone as it, mapEffect as j, getCurrent as jt, mapArray as k, makeUnsafe$1 as kt, drop as l, makeUnsafe as lt, filter as m, failCause$2 as mt, callback as n, fromTransform as nt, catch_ as o, toTransform as ot, failCause as p, fail$2 as pt, runIntoPubSub as q, catchIf as r, map$1 as rt, decodeText as s, unwrap$1 as st, broadcast as t, unwrap as tt, empty as u, bounded as ut, fromArray as v, offerAll as vt, fromPull as w, unbounded as wt, fromEffect as x, poll as xt, fromArrayEffect as y, offerAllUnsafe as yt, provideContext as z, toLowerCase as zt };
2096
2117
 
2097
- //# sourceMappingURL=Stream-BI6Fx9yq.mjs.map
2118
+ //# sourceMappingURL=Stream-CSLA1_GD.mjs.map