clanka 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentExecutor.js +1 -1
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.d.ts +2 -0
- package/dist/AgentExecutor.test.d.ts.map +1 -0
- package/dist/AgentExecutor.test.js +87 -0
- package/dist/AgentExecutor.test.js.map +1 -0
- package/dist/bin/{Effect-BCeySOy1.mjs → Effect-BmOuzEIp.mjs} +243 -215
- package/dist/bin/Effect-BmOuzEIp.mjs.map +1 -0
- package/dist/bin/{McpClient-DP4jlaD1.mjs → McpClient-CLpFJSre.mjs} +3 -3
- package/dist/bin/{McpClient-DP4jlaD1.mjs.map → McpClient-CLpFJSre.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-Ch8yFytV.mjs → OutputFormatter-C_gdNUl1.mjs} +3 -3
- package/dist/bin/{OutputFormatter-Ch8yFytV.mjs.map → OutputFormatter-C_gdNUl1.mjs.map} +1 -1
- package/dist/bin/{Schema-C9JQ5hI0.mjs → Schema-C7W9nQug.mjs} +477 -382
- package/dist/bin/Schema-C7W9nQug.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-BJGnYhFt.mjs → SemanticSearch-cqSnq90g.mjs} +269 -228
- package/dist/bin/SemanticSearch-cqSnq90g.mjs.map +1 -0
- package/dist/bin/{Stream-CgH3SuLu.mjs → Stream-BI6Fx9yq.mjs} +179 -171
- package/dist/bin/Stream-BI6Fx9yq.mjs.map +1 -0
- package/dist/bin/cli.mjs +169 -201
- package/dist/bin/cli.mjs.map +1 -1
- package/package.json +12 -12
- package/src/AgentExecutor.test.ts +133 -0
- package/src/AgentExecutor.ts +1 -2
- package/dist/bin/Effect-BCeySOy1.mjs.map +0 -1
- package/dist/bin/Schema-C9JQ5hI0.mjs.map +0 -1
- package/dist/bin/SemanticSearch-BJGnYhFt.mjs.map +0 -1
- package/dist/bin/Stream-CgH3SuLu.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $i as
|
|
2
|
-
//#region node_modules/.pnpm/effect@
|
|
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
|
|
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@
|
|
6
|
+
//#region node_modules/.pnpm/effect@4.0.0/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@
|
|
25
|
+
//#region node_modules/.pnpm/effect@4.0.0/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@
|
|
31
|
+
//#region node_modules/.pnpm/effect@4.0.0/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@
|
|
41
|
+
//#region node_modules/.pnpm/effect@4.0.0/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@
|
|
45
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/MutableRef.js
|
|
46
46
|
const TypeId$5 = "~effect/MutableRef";
|
|
47
47
|
const MutableRefProto = {
|
|
48
48
|
[TypeId$5]: TypeId$5,
|
|
@@ -66,13 +66,22 @@ 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@
|
|
69
|
+
//#region node_modules/.pnpm/effect@4.0.0/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,
|
|
73
73
|
tail: void 0,
|
|
74
74
|
length: 0
|
|
75
75
|
});
|
|
76
|
+
const compactHead = (self) => {
|
|
77
|
+
const head = self.head;
|
|
78
|
+
if (head.offset >= 1024 && head === self.tail && head.mutable && (head.array.length - head.offset) * 8 <= head.offset) self.head = self.tail = {
|
|
79
|
+
array: head.array.slice(head.offset),
|
|
80
|
+
mutable: true,
|
|
81
|
+
offset: 0,
|
|
82
|
+
next: void 0
|
|
83
|
+
};
|
|
84
|
+
};
|
|
76
85
|
const emptyBucket = () => ({
|
|
77
86
|
array: [],
|
|
78
87
|
mutable: true,
|
|
@@ -134,9 +143,10 @@ const takeN = (self, n) => {
|
|
|
134
143
|
if (chunk.mutable) chunk.array[chunk.offset] = void 0;
|
|
135
144
|
chunk.offset++;
|
|
136
145
|
if (index === n) {
|
|
137
|
-
self.head = chunk;
|
|
146
|
+
self.head = chunk.offset === chunk.array.length && chunk.next ? chunk.next : chunk;
|
|
138
147
|
self.length -= n;
|
|
139
148
|
if (self.length === 0) clear(self);
|
|
149
|
+
else compactHead(self);
|
|
140
150
|
return array;
|
|
141
151
|
}
|
|
142
152
|
}
|
|
@@ -155,14 +165,15 @@ const take$3 = (self) => {
|
|
|
155
165
|
if (self.head.offset === self.head.array.length) {
|
|
156
166
|
if (self.head.next) self.head = self.head.next;
|
|
157
167
|
else clear(self);
|
|
158
|
-
}
|
|
168
|
+
} else compactHead(self);
|
|
159
169
|
return message;
|
|
160
170
|
};
|
|
161
171
|
const filter$1 = (self, f) => {
|
|
162
172
|
const array = [];
|
|
163
173
|
let chunk = self.head;
|
|
174
|
+
let index = 0;
|
|
164
175
|
while (chunk) {
|
|
165
|
-
for (let i = chunk.offset; i < chunk.array.length; i++) if (f(chunk.array[i],
|
|
176
|
+
for (let i = chunk.offset; i < chunk.array.length; i++) if (f(chunk.array[i], index++)) array.push(chunk.array[i]);
|
|
166
177
|
chunk = chunk.next;
|
|
167
178
|
}
|
|
168
179
|
if (array.length === 0) {
|
|
@@ -179,10 +190,10 @@ const filter$1 = (self, f) => {
|
|
|
179
190
|
};
|
|
180
191
|
const remove = (self, value) => filter$1(self, (v) => v !== value);
|
|
181
192
|
//#endregion
|
|
182
|
-
//#region node_modules/.pnpm/effect@
|
|
193
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/PubSub.js
|
|
183
194
|
const TypeId$4 = "~effect/PubSub";
|
|
184
195
|
const SubscriptionTypeId = "~effect/PubSub/Subscription";
|
|
185
|
-
const make$2 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), new Map(), makeUnsafe$2(), makeUnsafe$1(false), make$4(false), options.strategy()));
|
|
196
|
+
const make$2 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), new Map(), makeUnsafe$2(), makeUnsafe$1(false), make$4(false), options.strategy(), make$4(none())));
|
|
186
197
|
const bounded$1 = (capacity) => make$2({
|
|
187
198
|
atomicPubSub: () => makeAtomicBounded(capacity),
|
|
188
199
|
strategy: () => new BackPressureStrategy()
|
|
@@ -202,6 +213,7 @@ const unbounded$1 = (options) => make$2({
|
|
|
202
213
|
const makeAtomicBounded = (capacity) => {
|
|
203
214
|
const options = typeof capacity === "number" ? { capacity } : capacity;
|
|
204
215
|
ensureCapacity(options.capacity);
|
|
216
|
+
if (options.capacity === Infinity) return makeAtomicUnbounded(options);
|
|
205
217
|
const replayBuffer = options.replay && options.replay > 0 ? new ReplayBuffer(Math.ceil(options.replay)) : void 0;
|
|
206
218
|
if (options.capacity === 1) return new BoundedPubSubSingle(replayBuffer);
|
|
207
219
|
else if (nextPow2(options.capacity) === options.capacity) return new BoundedPubSubPow2(options.capacity, replayBuffer);
|
|
@@ -215,25 +227,40 @@ const shutdown$1 = (self) => uninterruptible(withFiber((fiber) => {
|
|
|
215
227
|
set(self.shutdownFlag, true);
|
|
216
228
|
return close(self.scope, interrupt$1(fiber.id)).pipe(andThen(self.strategy.shutdown), when(self.shutdownHook.open), asVoid);
|
|
217
229
|
}));
|
|
230
|
+
const end$1 = dual(2, (self, value) => sync(() => endUnsafe$1(self, value)));
|
|
231
|
+
const endUnsafe$1 = dual(2, (self, value) => {
|
|
232
|
+
if (self.shutdownFlag.current || isSome(self.ended.current)) return false;
|
|
233
|
+
set(self.ended, some(value));
|
|
234
|
+
if (self.strategy instanceof BackPressureStrategy) {
|
|
235
|
+
for (const [_, deferred, last] of takeAll$2(self.strategy.publishers)) if (last) doneUnsafe(deferred, succeed$2(false));
|
|
236
|
+
}
|
|
237
|
+
const exit = succeed$2(value);
|
|
238
|
+
for (const pollersSet of self.subscribers.values()) for (const pollers of pollersSet) {
|
|
239
|
+
let poller;
|
|
240
|
+
while ((poller = take$3(pollers)) !== Empty) doneUnsafe(poller, exit);
|
|
241
|
+
}
|
|
242
|
+
self.subscribers.clear();
|
|
243
|
+
return true;
|
|
244
|
+
});
|
|
218
245
|
const publish = dual(2, (self, value) => suspend$2(() => {
|
|
219
|
-
if (self.shutdownFlag.current) return succeed$
|
|
246
|
+
if (self.shutdownFlag.current || isSome(self.ended.current)) return succeed$3(false);
|
|
220
247
|
if (self.pubsub.publish(value)) {
|
|
221
248
|
self.strategy.completeSubscribersUnsafe(self.pubsub, self.subscribers);
|
|
222
|
-
return succeed$
|
|
249
|
+
return succeed$3(true);
|
|
223
250
|
}
|
|
224
251
|
return self.strategy.handleSurplus(self.pubsub, self.subscribers, [value], self.shutdownFlag);
|
|
225
252
|
}));
|
|
226
253
|
const publishAll = dual(2, (self, elements) => suspend$2(() => {
|
|
227
|
-
if (self.shutdownFlag.current) return succeed$
|
|
254
|
+
if (self.shutdownFlag.current || isSome(self.ended.current)) return succeed$3(false);
|
|
228
255
|
const surplus = self.pubsub.publishAll(elements);
|
|
229
256
|
self.strategy.completeSubscribersUnsafe(self.pubsub, self.subscribers);
|
|
230
|
-
if (surplus.length === 0) return succeed$
|
|
257
|
+
if (surplus.length === 0) return succeed$3(true);
|
|
231
258
|
return self.strategy.handleSurplus(self.pubsub, self.subscribers, surplus, self.shutdownFlag);
|
|
232
259
|
}));
|
|
233
260
|
const subscribe = (self) => uninterruptible(contextWith((services) => {
|
|
234
261
|
const localScope = get$1(services, Scope);
|
|
235
262
|
const scope = forkUnsafe(self.scope);
|
|
236
|
-
const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy);
|
|
263
|
+
const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy, self.ended);
|
|
237
264
|
return addFinalizer(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
|
|
238
265
|
}));
|
|
239
266
|
const unsubscribe = (self) => uninterruptible(withFiber((state) => {
|
|
@@ -252,13 +279,13 @@ const take$2 = (self) => suspend$2(() => {
|
|
|
252
279
|
if (self.shutdownFlag.current) return interrupt$2;
|
|
253
280
|
if (self.replayWindow.remaining > 0) {
|
|
254
281
|
const message = self.replayWindow.take();
|
|
255
|
-
return succeed$
|
|
282
|
+
return succeed$3(message);
|
|
256
283
|
}
|
|
257
284
|
const message = self.pollers.length === 0 ? self.subscription.poll() : Empty;
|
|
258
285
|
if (message === Empty) return pollForItem(self);
|
|
259
286
|
else {
|
|
260
287
|
self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers);
|
|
261
|
-
return succeed$
|
|
288
|
+
return succeed$3(message);
|
|
262
289
|
}
|
|
263
290
|
});
|
|
264
291
|
const takeAll$1 = (self) => suspend$2(function loop(value) {
|
|
@@ -266,11 +293,13 @@ const takeAll$1 = (self) => suspend$2(function loop(value) {
|
|
|
266
293
|
let as = self.pollers.length === 0 ? self.subscription.pollUpTo(Number.POSITIVE_INFINITY) : [];
|
|
267
294
|
if (value) as = value.concat(as);
|
|
268
295
|
self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers);
|
|
269
|
-
if (self.replayWindow.remaining > 0) return succeed$
|
|
296
|
+
if (self.replayWindow.remaining > 0) return succeed$3(self.replayWindow.takeAll().concat(as));
|
|
270
297
|
else if (!isArrayNonEmpty(as)) return flatMap$2(pollForItem(self), (item) => loop([item]));
|
|
271
|
-
return succeed$
|
|
298
|
+
return succeed$3(as);
|
|
272
299
|
});
|
|
273
|
-
const pollForItem = (self) => {
|
|
300
|
+
const pollForItem = (self) => callback$1((resume) => {
|
|
301
|
+
if (self.shutdownFlag.current) return resume(interrupt$2);
|
|
302
|
+
if (isSome(self.ended.current)) return resume(succeed$3(self.ended.current.value));
|
|
274
303
|
const deferred = makeUnsafe$3();
|
|
275
304
|
let set = self.subscribers.get(self.subscription);
|
|
276
305
|
if (!set) {
|
|
@@ -280,11 +309,10 @@ const pollForItem = (self) => {
|
|
|
280
309
|
set.add(self.pollers);
|
|
281
310
|
append(self.pollers, deferred);
|
|
282
311
|
self.strategy.completePollersUnsafe(self.pubsub, self.subscribers, self.subscription, self.pollers);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
};
|
|
312
|
+
if (deferred.effect) return resume(deferred.effect);
|
|
313
|
+
deferred.resumes = [resume];
|
|
314
|
+
return sync(() => remove(self.pollers, deferred));
|
|
315
|
+
});
|
|
288
316
|
const AbsentValue = Symbol.for("effect/PubSub/AbsentValue");
|
|
289
317
|
const addSubscribers = (subscribers, subscription, pollers) => {
|
|
290
318
|
if (!subscribers.has(subscription)) subscribers.set(subscription, new Set());
|
|
@@ -296,7 +324,7 @@ const removeSubscribers = (subscribers, subscription, pollers) => {
|
|
|
296
324
|
set.delete(pollers);
|
|
297
325
|
if (set.size === 0) subscribers.delete(subscription);
|
|
298
326
|
};
|
|
299
|
-
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$3(), makeUnsafe$1(false), make$4(false), strategy, pubsub.replayWindow());
|
|
327
|
+
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$3(), makeUnsafe$1(false), make$4(false), strategy, pubsub.replayWindow(), ended);
|
|
300
328
|
var BoundedPubSubArb = class {
|
|
301
329
|
array;
|
|
302
330
|
replayIndices;
|
|
@@ -853,7 +881,8 @@ var SubscriptionImpl = class {
|
|
|
853
881
|
shutdownFlag;
|
|
854
882
|
strategy;
|
|
855
883
|
replayWindow;
|
|
856
|
-
|
|
884
|
+
ended;
|
|
885
|
+
constructor(pubsub, subscribers, subscription, pollers, shutdownHook, shutdownFlag, strategy, replayWindow, ended) {
|
|
857
886
|
this.pubsub = pubsub;
|
|
858
887
|
this.subscribers = subscribers;
|
|
859
888
|
this.subscription = subscription;
|
|
@@ -862,6 +891,7 @@ var SubscriptionImpl = class {
|
|
|
862
891
|
this.shutdownFlag = shutdownFlag;
|
|
863
892
|
this.strategy = strategy;
|
|
864
893
|
this.replayWindow = replayWindow;
|
|
894
|
+
this.ended = ended;
|
|
865
895
|
}
|
|
866
896
|
pipe() {
|
|
867
897
|
return pipeArguments(this, arguments);
|
|
@@ -875,19 +905,21 @@ var PubSubImpl = class {
|
|
|
875
905
|
shutdownHook;
|
|
876
906
|
shutdownFlag;
|
|
877
907
|
strategy;
|
|
878
|
-
|
|
908
|
+
ended;
|
|
909
|
+
constructor(pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy, ended) {
|
|
879
910
|
this.pubsub = pubsub;
|
|
880
911
|
this.subscribers = subscribers;
|
|
881
912
|
this.scope = scope;
|
|
882
913
|
this.shutdownHook = shutdownHook;
|
|
883
914
|
this.shutdownFlag = shutdownFlag;
|
|
884
915
|
this.strategy = strategy;
|
|
916
|
+
this.ended = ended;
|
|
885
917
|
}
|
|
886
918
|
pipe() {
|
|
887
919
|
return pipeArguments(this, arguments);
|
|
888
920
|
}
|
|
889
921
|
};
|
|
890
|
-
const makePubSubUnsafe = (pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy) => new PubSubImpl(pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy);
|
|
922
|
+
const makePubSubUnsafe = (pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy, ended) => new PubSubImpl(pubsub, subscribers, scope, shutdownHook, shutdownFlag, strategy, ended);
|
|
891
923
|
const ensureCapacity = (capacity) => {
|
|
892
924
|
if (capacity <= 0) throw new Error(`Cannot construct PubSub with capacity of ${capacity}`);
|
|
893
925
|
};
|
|
@@ -900,15 +932,18 @@ var BackPressureStrategy = class {
|
|
|
900
932
|
}));
|
|
901
933
|
}
|
|
902
934
|
handleSurplus(pubsub, subscribers, elements, isShutdown) {
|
|
903
|
-
return
|
|
935
|
+
return callback$1((resume) => {
|
|
904
936
|
const deferred = makeUnsafe$3();
|
|
905
937
|
this.offerUnsafe(elements, deferred);
|
|
906
938
|
this.onPubSubEmptySpaceUnsafe(pubsub, subscribers);
|
|
907
939
|
this.completeSubscribersUnsafe(pubsub, subscribers);
|
|
908
|
-
|
|
940
|
+
if (get(isShutdown)) {
|
|
909
941
|
this.removeUnsafe(deferred);
|
|
910
|
-
return
|
|
911
|
-
}
|
|
942
|
+
return resume(interrupt$2);
|
|
943
|
+
}
|
|
944
|
+
if (deferred.effect) return resume(deferred.effect);
|
|
945
|
+
deferred.resumes = [resume];
|
|
946
|
+
return sync(() => this.removeUnsafe(deferred));
|
|
912
947
|
});
|
|
913
948
|
}
|
|
914
949
|
onPubSubEmptySpaceUnsafe(pubsub, subscribers) {
|
|
@@ -919,7 +954,7 @@ var BackPressureStrategy = class {
|
|
|
919
954
|
else {
|
|
920
955
|
const [value, deferred] = publisher;
|
|
921
956
|
const published = pubsub.publish(value);
|
|
922
|
-
if (published && publisher[2]) doneUnsafe(deferred, succeed$
|
|
957
|
+
if (published && publisher[2]) doneUnsafe(deferred, succeed$2(true));
|
|
923
958
|
else if (!published) prepend(this.publishers, publisher);
|
|
924
959
|
this.completeSubscribersUnsafe(pubsub, subscribers);
|
|
925
960
|
}
|
|
@@ -961,7 +996,7 @@ var DroppingStrategy = class {
|
|
|
961
996
|
return void_;
|
|
962
997
|
}
|
|
963
998
|
handleSurplus(_pubsub, _subscribers, _elements, _isShutdown) {
|
|
964
|
-
return succeed$
|
|
999
|
+
return succeed$3(false);
|
|
965
1000
|
}
|
|
966
1001
|
onPubSubEmptySpaceUnsafe(_pubsub, _subscribers) {}
|
|
967
1002
|
completePollersUnsafe(pubsub, subscribers, subscription, pollers) {
|
|
@@ -1016,7 +1051,7 @@ const strategyCompletePollersUnsafe = (strategy, pubsub, subscribers, subscripti
|
|
|
1016
1051
|
const pollResult = subscription.poll();
|
|
1017
1052
|
if (pollResult === Empty) prepend(pollers, poller);
|
|
1018
1053
|
else {
|
|
1019
|
-
doneUnsafe(poller, succeed$
|
|
1054
|
+
doneUnsafe(poller, succeed$2(pollResult));
|
|
1020
1055
|
strategy.onPubSubEmptySpaceUnsafe(pubsub, subscribers);
|
|
1021
1056
|
}
|
|
1022
1057
|
}
|
|
@@ -1132,7 +1167,7 @@ const emptyReplayWindow = {
|
|
|
1132
1167
|
close: () => void 0
|
|
1133
1168
|
};
|
|
1134
1169
|
//#endregion
|
|
1135
|
-
//#region node_modules/.pnpm/effect@
|
|
1170
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Queue.js
|
|
1136
1171
|
const TypeId$3 = "~effect/Queue";
|
|
1137
1172
|
const EnqueueTypeId = "~effect/Queue/Enqueue";
|
|
1138
1173
|
const DequeueTypeId = "~effect/Queue/Dequeue";
|
|
@@ -1170,26 +1205,7 @@ const make$1 = (options) => withFiber$1((fiber) => {
|
|
|
1170
1205
|
});
|
|
1171
1206
|
const bounded = (capacity) => make$1({ capacity });
|
|
1172
1207
|
const unbounded = () => make$1();
|
|
1173
|
-
const offer = dual(2, (self, message) => suspend$3(() =>
|
|
1174
|
-
if (self.state._tag !== "Open") return exitFalse;
|
|
1175
|
-
else if (self.messages.length >= self.capacity) switch (self.strategy) {
|
|
1176
|
-
case "dropping": return exitFalse;
|
|
1177
|
-
case "suspend":
|
|
1178
|
-
if (self.capacity <= 0 && self.state.takers.size > 0) {
|
|
1179
|
-
append(self.messages, message);
|
|
1180
|
-
releaseTakers(self);
|
|
1181
|
-
return exitTrue;
|
|
1182
|
-
}
|
|
1183
|
-
return offerRemainingSingle(self, message);
|
|
1184
|
-
case "sliding":
|
|
1185
|
-
take$3(self.messages);
|
|
1186
|
-
append(self.messages, message);
|
|
1187
|
-
return exitTrue;
|
|
1188
|
-
}
|
|
1189
|
-
append(self.messages, message);
|
|
1190
|
-
scheduleReleaseTaker(self);
|
|
1191
|
-
return exitTrue;
|
|
1192
|
-
}));
|
|
1208
|
+
const offer = dual(2, (self, message) => suspend$3(() => offerUnsafe(self, message) ? exitTrue : self.state._tag === "Open" && self.strategy === "suspend" ? offerOrWait(self, message) : exitFalse));
|
|
1193
1209
|
const offerUnsafe = (self, message) => {
|
|
1194
1210
|
if (self.state._tag !== "Open") return false;
|
|
1195
1211
|
else if (self.messages.length >= self.capacity) {
|
|
@@ -1208,12 +1224,15 @@ const offerUnsafe = (self, message) => {
|
|
|
1208
1224
|
scheduleReleaseTaker(self);
|
|
1209
1225
|
return true;
|
|
1210
1226
|
};
|
|
1211
|
-
const offerAll = dual(2, (self, messages) =>
|
|
1212
|
-
if (self.state._tag !== "Open") return succeed$4(fromIterable$1(messages));
|
|
1227
|
+
const offerAll = dual(2, (self, messages) => callback$2((resume) => {
|
|
1213
1228
|
const remaining = offerAllUnsafe(self, messages);
|
|
1214
|
-
if (remaining.length === 0) return exitSucceed(
|
|
1215
|
-
|
|
1216
|
-
|
|
1229
|
+
if (remaining.length === 0 || self.strategy === "dropping") return resume(exitSucceed(remaining));
|
|
1230
|
+
return waitToOffer(self, {
|
|
1231
|
+
_tag: "Array",
|
|
1232
|
+
remaining,
|
|
1233
|
+
offset: 0,
|
|
1234
|
+
resume
|
|
1235
|
+
});
|
|
1217
1236
|
}));
|
|
1218
1237
|
const offerAllUnsafe = (self, messages) => {
|
|
1219
1238
|
if (self.state._tag !== "Open") return fromIterable$1(messages);
|
|
@@ -1250,6 +1269,7 @@ const failCauseUnsafe = (self, cause) => {
|
|
|
1250
1269
|
_tag: "Closing",
|
|
1251
1270
|
exit: fail
|
|
1252
1271
|
};
|
|
1272
|
+
scheduleReleaseTaker(self);
|
|
1253
1273
|
return true;
|
|
1254
1274
|
};
|
|
1255
1275
|
const end = (self) => failCause$2(self, causeFail(Done()));
|
|
@@ -1260,17 +1280,16 @@ const shutdownUnsafe = (self) => {
|
|
|
1260
1280
|
clear(self.messages);
|
|
1261
1281
|
const offers = self.state.offers;
|
|
1262
1282
|
finalize(self, self.state._tag === "Open" ? exitInterrupt : self.state.exit);
|
|
1263
|
-
for (const entry of offers)
|
|
1264
|
-
else entry.resume(exitSucceed(entry.remaining.slice(entry.offset)));
|
|
1283
|
+
for (const entry of offers) resumeUnoffered(entry);
|
|
1265
1284
|
return true;
|
|
1266
1285
|
};
|
|
1267
1286
|
const takeAll = (self) => takeBetween(self, 1, Number.POSITIVE_INFINITY);
|
|
1268
1287
|
const takeBetween = dual(3, (self, min, max) => {
|
|
1269
1288
|
min = normalize(min);
|
|
1270
1289
|
max = normalize(max);
|
|
1271
|
-
return suspend$3(() => takeBetweenUnsafe(self, min, max) ?? andThen$1(awaitTake(self), takeBetween(self,
|
|
1290
|
+
return suspend$3(() => takeBetweenUnsafe(self, min, max) ?? andThen$1(awaitTake(self, () => canTake(self, min)), takeBetween(self, min, max)));
|
|
1272
1291
|
});
|
|
1273
|
-
const take$1 = (self) => suspend$3(() => takeUnsafe(self) ?? andThen$1(awaitTake(self), take$1(self)));
|
|
1292
|
+
const take$1 = (self) => suspend$3(() => takeUnsafe(self) ?? andThen$1(awaitTake(self, () => canTake(self, 1)), take$1(self)));
|
|
1274
1293
|
const poll = (self) => suspend$3(() => {
|
|
1275
1294
|
const result = takeUnsafe(self);
|
|
1276
1295
|
if (result === void 0) return succeed$4(none());
|
|
@@ -1297,8 +1316,9 @@ const exitInterrupt = exitInterrupt$1();
|
|
|
1297
1316
|
const releaseTakers = (self) => {
|
|
1298
1317
|
if (self.state._tag === "Done" || self.state.takers.size === 0) return;
|
|
1299
1318
|
for (const taker of self.state.takers) {
|
|
1319
|
+
if (!taker.ready()) continue;
|
|
1300
1320
|
self.state.takers.delete(taker);
|
|
1301
|
-
taker(exitVoid);
|
|
1321
|
+
taker.resume(exitVoid);
|
|
1302
1322
|
if (self.messages.length === 0) break;
|
|
1303
1323
|
}
|
|
1304
1324
|
};
|
|
@@ -1313,47 +1333,40 @@ const scheduleReleaseTaker = (self) => {
|
|
|
1313
1333
|
const takeBetweenUnsafe = (self, min, max) => {
|
|
1314
1334
|
if (self.state._tag === "Done") return self.state.exit;
|
|
1315
1335
|
else if (max <= 0 || min <= 0) return exitSucceed([]);
|
|
1316
|
-
else if (self
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
}
|
|
1321
|
-
min = Math.min(min, self.capacity || 1);
|
|
1322
|
-
if (min <= self.messages.length) {
|
|
1323
|
-
const messages = takeN(self.messages, max);
|
|
1324
|
-
releaseCapacity(self);
|
|
1325
|
-
return exitSucceed(messages);
|
|
1326
|
-
}
|
|
1336
|
+
else if (!canTake(self, min)) return;
|
|
1337
|
+
const messages = self.messages.length > 0 ? takeN(self.messages, max) : [takeOfferUnsafe(self.state.offers)];
|
|
1338
|
+
releaseCapacity(self);
|
|
1339
|
+
return exitSucceed(messages);
|
|
1327
1340
|
};
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
});
|
|
1341
|
+
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
|
+
const awaitTake = (self, ready) => callback$2((resume) => {
|
|
1343
|
+
if (self.state._tag === "Done") return resume(self.state.exit);
|
|
1344
|
+
if (ready()) return resume(exitVoid);
|
|
1345
|
+
const taker = {
|
|
1346
|
+
ready,
|
|
1347
|
+
resume
|
|
1348
|
+
};
|
|
1349
|
+
self.state.takers.add(taker);
|
|
1350
|
+
return sync$1(() => {
|
|
1351
|
+
if (self.state._tag !== "Done") self.state.takers.delete(taker);
|
|
1340
1352
|
});
|
|
1341
|
-
};
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1353
|
+
});
|
|
1354
|
+
const offerOrWait = (self, message) => callback$2((resume) => offerUnsafe(self, message) ? resume(exitTrue) : waitToOffer(self, {
|
|
1355
|
+
_tag: "Single",
|
|
1356
|
+
message,
|
|
1357
|
+
resume
|
|
1358
|
+
}));
|
|
1359
|
+
const waitToOffer = (self, entry) => {
|
|
1360
|
+
if (self.state._tag !== "Open") return resumeUnoffered(entry);
|
|
1361
|
+
const offers = self.state.offers;
|
|
1362
|
+
offers.add(entry);
|
|
1363
|
+
return sync$1(() => {
|
|
1364
|
+
if (self.state._tag === "Done") return;
|
|
1365
|
+
offers.delete(entry);
|
|
1366
|
+
if (self.state._tag === "Closing" && offers.size === 0 && self.messages.length === 0) finalize(self, self.state.exit);
|
|
1355
1367
|
});
|
|
1356
1368
|
};
|
|
1369
|
+
const resumeUnoffered = (entry) => entry._tag === "Single" ? entry.resume(exitFalse) : entry.resume(exitSucceed(entry.remaining.slice(entry.offset)));
|
|
1357
1370
|
const takeOfferUnsafe = (offers) => {
|
|
1358
1371
|
const entry = offers.values().next().value;
|
|
1359
1372
|
if (entry._tag === "Single") {
|
|
@@ -1396,13 +1409,6 @@ const releaseCapacity = (self) => {
|
|
|
1396
1409
|
}
|
|
1397
1410
|
return false;
|
|
1398
1411
|
};
|
|
1399
|
-
const awaitTake = (self) => callback$1((resume) => {
|
|
1400
|
-
if (self.state._tag === "Done") return resume(self.state.exit);
|
|
1401
|
-
self.state.takers.add(resume);
|
|
1402
|
-
return sync$1(() => {
|
|
1403
|
-
if (self.state._tag !== "Done") self.state.takers.delete(resume);
|
|
1404
|
-
});
|
|
1405
|
-
});
|
|
1406
1412
|
const finalize = (self, exit) => {
|
|
1407
1413
|
if (self.state._tag === "Done") return;
|
|
1408
1414
|
const openState = self.state;
|
|
@@ -1410,15 +1416,15 @@ const finalize = (self, exit) => {
|
|
|
1410
1416
|
_tag: "Done",
|
|
1411
1417
|
exit
|
|
1412
1418
|
};
|
|
1413
|
-
for (const taker of openState.takers) taker(exit);
|
|
1419
|
+
for (const taker of openState.takers) taker.resume(exit);
|
|
1414
1420
|
openState.takers.clear();
|
|
1415
1421
|
for (const awaiter of openState.awaiters) awaiter(exit);
|
|
1416
1422
|
openState.awaiters.clear();
|
|
1417
1423
|
};
|
|
1418
1424
|
//#endregion
|
|
1419
|
-
//#region node_modules/.pnpm/effect@
|
|
1425
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Semaphore.js
|
|
1420
1426
|
const makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
1421
|
-
const waitForPermits = (self, n, effect) => callback$
|
|
1427
|
+
const waitForPermits = (self, n, effect) => callback$2((resume) => {
|
|
1422
1428
|
if (self.free >= n) return resume(effect);
|
|
1423
1429
|
const observer = () => {
|
|
1424
1430
|
if (self.free < n) return;
|
|
@@ -1507,10 +1513,10 @@ var SemaphoreImpl = class {
|
|
|
1507
1513
|
};
|
|
1508
1514
|
const make = (permits) => sync$1(() => new SemaphoreImpl(permits));
|
|
1509
1515
|
//#endregion
|
|
1510
|
-
//#region node_modules/.pnpm/effect@
|
|
1511
|
-
const toPull = (take) => isExit(take) ? isSuccess(take) ? done(take.value) : take : succeed$
|
|
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);
|
|
1512
1518
|
//#endregion
|
|
1513
|
-
//#region node_modules/.pnpm/effect@
|
|
1519
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Channel.js
|
|
1514
1520
|
const TypeId$2 = "~effect/Channel";
|
|
1515
1521
|
const isChannel = (u) => hasProperty(u, TypeId$2);
|
|
1516
1522
|
const ChannelProto = {
|
|
@@ -1527,7 +1533,7 @@ const ChannelProto = {
|
|
|
1527
1533
|
};
|
|
1528
1534
|
const fromTransform = (transform) => {
|
|
1529
1535
|
const self = Object.create(ChannelProto);
|
|
1530
|
-
self.transform = (upstream, scope) => catchCause$1(transform(upstream, scope), (cause) => succeed$
|
|
1536
|
+
self.transform = (upstream, scope) => catchCause$1(transform(upstream, scope), (cause) => succeed$3(failCause$3(cause)));
|
|
1531
1537
|
return self;
|
|
1532
1538
|
};
|
|
1533
1539
|
const transformPull$1 = (self, f) => fromTransform((upstream, scope) => flatMap$2(toTransform(self)(upstream, scope), (pull) => f(pull, scope)));
|
|
@@ -1550,40 +1556,40 @@ const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => {
|
|
|
1550
1556
|
const size = normalizeNonEmpty(chunkSize);
|
|
1551
1557
|
return fromPull$1(sync(() => {
|
|
1552
1558
|
const iter = iterator();
|
|
1553
|
-
let done$
|
|
1559
|
+
let done$11 = none();
|
|
1554
1560
|
return suspend$2(() => {
|
|
1555
|
-
if (done$
|
|
1561
|
+
if (done$11._tag === "Some") return done(done$11.value);
|
|
1556
1562
|
const buffer = [];
|
|
1557
1563
|
while (buffer.length < size) {
|
|
1558
1564
|
const state = iter.next();
|
|
1559
1565
|
if (state.done) {
|
|
1560
1566
|
if (buffer.length === 0) return done(state.value);
|
|
1561
|
-
done$
|
|
1567
|
+
done$11 = some(state.value);
|
|
1562
1568
|
break;
|
|
1563
1569
|
}
|
|
1564
1570
|
buffer.push(state.value);
|
|
1565
1571
|
}
|
|
1566
|
-
return succeed$
|
|
1572
|
+
return succeed$3(buffer);
|
|
1567
1573
|
});
|
|
1568
1574
|
}));
|
|
1569
1575
|
};
|
|
1570
1576
|
const fromIterableArray = (iterable, chunkSize = DefaultChunkSize) => fromIteratorArray(() => iterable[Symbol.iterator](), chunkSize);
|
|
1571
|
-
const succeed$1 = (value) => fromEffect$1(succeed$
|
|
1572
|
-
const empty$1 = fromPull$1(succeed$
|
|
1573
|
-
const fail$1 = (error) => fromPull$1(succeed$
|
|
1577
|
+
const succeed$1 = (value) => fromEffect$1(succeed$3(value));
|
|
1578
|
+
const empty$1 = fromPull$1(succeed$3(done()));
|
|
1579
|
+
const fail$1 = (error) => fromPull$1(succeed$3(fail$3(error)));
|
|
1574
1580
|
const failCause$1 = (cause) => fromPull$1(failCause$3(cause));
|
|
1575
1581
|
const die$1 = (defect) => failCause$1(die$2(defect));
|
|
1576
1582
|
const fromEffect$1 = (effect) => fromPull$1(sync(() => {
|
|
1577
|
-
let done$
|
|
1583
|
+
let done$14 = false;
|
|
1578
1584
|
return suspend$2(() => {
|
|
1579
|
-
if (done$
|
|
1580
|
-
done$
|
|
1585
|
+
if (done$14) return done();
|
|
1586
|
+
done$14 = true;
|
|
1581
1587
|
return effect;
|
|
1582
1588
|
});
|
|
1583
1589
|
}));
|
|
1584
|
-
const fromEffectTake = (effect) => fromPull$1(succeed$
|
|
1585
|
-
const fromQueueArray = (queue) => fromPull$1(succeed$
|
|
1586
|
-
const fromSubscriptionArray = (subscription) => fromPull$1(succeed$
|
|
1590
|
+
const fromEffectTake = (effect) => fromPull$1(succeed$3(flatMap$2(effect, toPull)));
|
|
1591
|
+
const fromQueueArray = (queue) => fromPull$1(succeed$3(takeAll(queue)));
|
|
1592
|
+
const fromSubscriptionArray = (subscription) => fromPull$1(succeed$3(onInterrupt(takeAll$1(subscription), () => done())));
|
|
1587
1593
|
const fromPubSubArray = (pubsub) => unwrap$1(map$2(subscribe(pubsub), fromSubscriptionArray));
|
|
1588
1594
|
const fromPubSubTake$1 = (pubsub) => unwrap$1(map$2(subscribe(pubsub), (sub) => fromEffectTake(take$2(sub))));
|
|
1589
1595
|
const fromReadableStream$1 = (options) => fromTransform((_, scope) => readableStreamToPullUnsafe({
|
|
@@ -1602,9 +1608,9 @@ const readableStreamToPullUnsafe = (options) => {
|
|
|
1602
1608
|
catch: options.onError
|
|
1603
1609
|
}), {
|
|
1604
1610
|
onFailure: (cause) => exit.current ?? failCause$3(cause),
|
|
1605
|
-
onSuccess: ({ done: done$
|
|
1611
|
+
onSuccess: ({ done: done$15, value }) => {
|
|
1606
1612
|
if (exit.current) return exit.current;
|
|
1607
|
-
return done$
|
|
1613
|
+
return done$15 ? done() : succeed$3(of(value));
|
|
1608
1614
|
}
|
|
1609
1615
|
});
|
|
1610
1616
|
});
|
|
@@ -1614,8 +1620,8 @@ const map$1 = dual(2, (self, f) => transformPull$1(self, (pull) => sync(() => {
|
|
|
1614
1620
|
let i = 0;
|
|
1615
1621
|
return map$2(pull, (o) => f(o, i++));
|
|
1616
1622
|
})));
|
|
1617
|
-
const mapDone = dual(2, (self, f) => mapDoneEffect(self, (o) => succeed$
|
|
1618
|
-
const mapDoneEffect = dual(2, (self, f) => transformPull$1(self, (pull) => succeed$
|
|
1623
|
+
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)))));
|
|
1619
1625
|
const concurrencyIsSequential = (concurrency) => concurrency === void 0 || concurrency !== "unbounded" && concurrency <= 1;
|
|
1620
1626
|
const mapEffect$1 = dual((args) => isChannel(args[0]), (self, f, options) => concurrencyIsSequential(options?.concurrency) ? mapEffectSequential(self, f) : mapEffectConcurrent(self, f, options));
|
|
1621
1627
|
const mapEffectSequential = (self, f) => fromTransform((upstream, scope) => {
|
|
@@ -1638,7 +1644,8 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
|
|
|
1638
1644
|
onSuccess: (value) => flatMap$2(offer(queue, value), release)
|
|
1639
1645
|
});
|
|
1640
1646
|
yield* semaphore.take(1).pipe(flatMap$2(() => pull), flatMap$2((value) => {
|
|
1641
|
-
|
|
1647
|
+
const index = i++;
|
|
1648
|
+
trackFiber(runFork(handle(suspend$2(() => f(value, index)))));
|
|
1642
1649
|
return void_;
|
|
1643
1650
|
}), forever({ disableYield: true }), catchCause$1((cause) => semaphore.withPermits(concurrencyN - 1)(failCause$2(queue, cause))), forkIn(forkedScope));
|
|
1644
1651
|
} else {
|
|
@@ -1653,7 +1660,8 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
|
|
|
1653
1660
|
};
|
|
1654
1661
|
yield* pull.pipe(flatMap$2((value) => {
|
|
1655
1662
|
if (errorCause) return failCause$3(errorCause);
|
|
1656
|
-
const
|
|
1663
|
+
const index = i++;
|
|
1664
|
+
const fiber = runFork(suspend$2(() => f(value, index)));
|
|
1657
1665
|
trackFiber(fiber);
|
|
1658
1666
|
fiber.addObserver(onExit);
|
|
1659
1667
|
return offer(effects, join(fiber));
|
|
@@ -1674,7 +1682,7 @@ const flatMapSequential = (self, f) => fromTransform((upstream, scope) => map$2(
|
|
|
1674
1682
|
});
|
|
1675
1683
|
const catchHalt = catchDone((_) => {
|
|
1676
1684
|
childPull = void 0;
|
|
1677
|
-
if (childScope.state._tag === "
|
|
1685
|
+
if (childScope.state._tag === "Empty") return makePull;
|
|
1678
1686
|
const close$2 = close(childScope, void_$2);
|
|
1679
1687
|
childScope = void 0;
|
|
1680
1688
|
return flatMap$2(close$2, () => makePull);
|
|
@@ -1689,10 +1697,10 @@ const flattenArray = (self) => transformPull$1(self, (pull) => {
|
|
|
1689
1697
|
if (array === void 0) return flatMap$2(pull, (array_) => {
|
|
1690
1698
|
switch (array_.length) {
|
|
1691
1699
|
case 0: return loop();
|
|
1692
|
-
case 1: return succeed$
|
|
1700
|
+
case 1: return succeed$3(array_[0]);
|
|
1693
1701
|
default:
|
|
1694
1702
|
array = array_;
|
|
1695
|
-
return succeed$
|
|
1703
|
+
return succeed$3(array_[index++]);
|
|
1696
1704
|
}
|
|
1697
1705
|
});
|
|
1698
1706
|
const next = array[index++];
|
|
@@ -1700,22 +1708,22 @@ const flattenArray = (self) => transformPull$1(self, (pull) => {
|
|
|
1700
1708
|
array = void 0;
|
|
1701
1709
|
index = 0;
|
|
1702
1710
|
}
|
|
1703
|
-
return succeed$
|
|
1711
|
+
return succeed$3(next);
|
|
1704
1712
|
});
|
|
1705
|
-
return succeed$
|
|
1713
|
+
return succeed$3(pump);
|
|
1706
1714
|
});
|
|
1707
|
-
const filterArray = dual(2, (self, predicate) => transformPull$1(self, (pull) => succeed$
|
|
1715
|
+
const filterArray = dual(2, (self, predicate) => transformPull$1(self, (pull) => succeed$3(flatMap$2(pull, function loop(arr) {
|
|
1708
1716
|
const passes = [];
|
|
1709
1717
|
for (let i = 0; i < arr.length; i++) if (predicate(arr[i])) passes.push(arr[i]);
|
|
1710
|
-
return isReadonlyArrayNonEmpty(passes) ? succeed$
|
|
1718
|
+
return isReadonlyArrayNonEmpty(passes) ? succeed$3(passes) : flatMap$2(pull, loop);
|
|
1711
1719
|
}))));
|
|
1712
|
-
const filterMapArray = dual(2, (self, filter) => transformPull$1(self, (pull) => succeed$
|
|
1720
|
+
const filterMapArray = dual(2, (self, filter) => transformPull$1(self, (pull) => succeed$3(flatMap$2(pull, function loop(arr) {
|
|
1713
1721
|
const passes = [];
|
|
1714
1722
|
for (let i = 0; i < arr.length; i++) {
|
|
1715
1723
|
const result = filter(arr[i]);
|
|
1716
1724
|
if (isSuccess$1(result)) passes.push(result.success);
|
|
1717
1725
|
}
|
|
1718
|
-
return isReadonlyArrayNonEmpty(passes) ? succeed$
|
|
1726
|
+
return isReadonlyArrayNonEmpty(passes) ? succeed$3(passes) : flatMap$2(pull, loop);
|
|
1719
1727
|
}))));
|
|
1720
1728
|
const catchCause = dual(2, (self, f) => fromTransform((upstream, scope) => {
|
|
1721
1729
|
let forkedScope = forkUnsafe(scope);
|
|
@@ -1783,7 +1791,7 @@ const mergeAll$1 = dual(2, (channels, { bufferSize = 16, concurrency, switch: sw
|
|
|
1783
1791
|
}
|
|
1784
1792
|
const fiber = yield* childPull.pipe(tap$1(() => yieldNow), flatMap$2((value) => offer(queue, value)), forever({ disableYield: true }), onError(fnUntraced(function* (cause) {
|
|
1785
1793
|
const halt = filterDone(cause);
|
|
1786
|
-
yield* exit(close(childScope, !isFailure(halt) ? succeed$
|
|
1794
|
+
yield* exit(close(childScope, !isFailure(halt) ? succeed$2(halt.success.value) : failCause$4(halt.failure)));
|
|
1787
1795
|
if (!fibers.has(fiber)) return;
|
|
1788
1796
|
fibers.delete(fiber);
|
|
1789
1797
|
if (semaphore) yield* semaphore.release(1);
|
|
@@ -1879,7 +1887,7 @@ const splitLines$1 = () => fromTransform((upstream, _scope) => sync(() => {
|
|
|
1879
1887
|
const last = stringBuilder;
|
|
1880
1888
|
stringBuilder = "";
|
|
1881
1889
|
midCRLF = false;
|
|
1882
|
-
return succeed$
|
|
1890
|
+
return succeed$3([last]);
|
|
1883
1891
|
}
|
|
1884
1892
|
return done(leftover);
|
|
1885
1893
|
}
|
|
@@ -1887,25 +1895,25 @@ const splitLines$1 = () => fromTransform((upstream, _scope) => sync(() => {
|
|
|
1887
1895
|
});
|
|
1888
1896
|
function loop(chunk) {
|
|
1889
1897
|
const lines = splitLinesArray(chunk);
|
|
1890
|
-
return lines !== null ? succeed$
|
|
1898
|
+
return lines !== null ? succeed$3(lines) : pullOrFlush;
|
|
1891
1899
|
}
|
|
1892
1900
|
return pullOrFlush;
|
|
1893
1901
|
}));
|
|
1894
1902
|
const pipeTo = dual(2, (self, that) => fromTransform((upstream, scope) => flatMap$2(toTransform(self)(upstream, scope), (upstream) => toTransform(that)(upstream, scope))));
|
|
1895
1903
|
const unwrap$1 = (channel) => fromTransform((upstream, scope) => {
|
|
1896
1904
|
let pull;
|
|
1897
|
-
return succeed$
|
|
1905
|
+
return succeed$3(suspend$2(() => {
|
|
1898
1906
|
if (pull) return pull;
|
|
1899
1907
|
return channel.pipe(provide(scope), flatMap$2((channel) => toTransform(channel)(upstream, scope)), flatMap$2((pull_) => pull = pull_));
|
|
1900
1908
|
}));
|
|
1901
1909
|
});
|
|
1902
1910
|
const onExit = dual(2, (self, finalizer) => fromTransformBracket((upstream, scope, forkedScope) => addFinalizerExit(forkedScope, finalizer).pipe(andThen(toTransform(self)(upstream, scope)))));
|
|
1903
|
-
const onEnd$1 = dual(2, (self, onEnd) => transformPull$1(self, (pull) => succeed$
|
|
1911
|
+
const onEnd$1 = dual(2, (self, onEnd) => transformPull$1(self, (pull) => succeed$3(catchDone(pull, (leftover) => flatMap$2(onEnd, () => done(leftover))))));
|
|
1904
1912
|
const ensuring$1 = dual(2, (self, finalizer) => onExit(self, (_) => finalizer));
|
|
1905
1913
|
const runWith = (self, f, onHalt) => suspend$2(() => {
|
|
1906
1914
|
const scope = makeUnsafe$2();
|
|
1907
1915
|
const makePull = toTransform(self)(done(), scope);
|
|
1908
|
-
return catchDone(flatMap$2(makePull, f), onHalt ? onHalt : succeed$
|
|
1916
|
+
return catchDone(flatMap$2(makePull, f), onHalt ? onHalt : succeed$3).pipe(onExit$1((exit) => close(scope, exit)));
|
|
1909
1917
|
});
|
|
1910
1918
|
const provideContext$1 = dual(2, (self, context) => fromTransform((upstream, scope) => map$2(provideContext$2(toTransform(self)(upstream, scope), context), provideContext$2(context))));
|
|
1911
1919
|
const provideService$1 = dual(3, (self, key, service) => fromTransform((upstream, scope) => map$2(provideService$2(toTransform(self)(upstream, scope), key, service), provideService$2(key, service))));
|
|
@@ -1919,18 +1927,18 @@ const runFold$1 = dual(3, (self, initial, f) => suspend$2(() => {
|
|
|
1919
1927
|
step: (value) => {
|
|
1920
1928
|
state = f(state, value);
|
|
1921
1929
|
}
|
|
1922
|
-
}), () => succeed$
|
|
1930
|
+
}), () => succeed$3(state));
|
|
1923
1931
|
}));
|
|
1924
1932
|
const toPullScoped = (self, scope) => toTransform(self)(done(), scope);
|
|
1925
1933
|
const makePubSub = (options) => acquireRelease(options.capacity === "unbounded" ? unbounded$1(options) : options.strategy === "dropping" ? dropping(options) : options.strategy === "sliding" ? sliding(options) : bounded$1(options), shutdown$1);
|
|
1926
1934
|
const runIntoPubSubArray = dual((args) => isChannel(args[0]), (self, pubsub, options) => runForEach$1(self, (value) => publishAll(pubsub, value)).pipe(options?.shutdownOnEnd === true ? ensuring$2(shutdown$1(pubsub)) : identity));
|
|
1927
1935
|
const toPubSubTake$1 = dual(2, fnUntraced(function* (self, options) {
|
|
1928
1936
|
const pubsub = yield* makePubSub(options);
|
|
1929
|
-
yield* runForEach$1(self, (value) => publish(pubsub, value)).pipe(onExit$1((exit) =>
|
|
1937
|
+
yield* runForEach$1(self, (value) => publish(pubsub, value)).pipe(onExit$1((exit) => end$1(pubsub, exit)), forkScoped);
|
|
1930
1938
|
return pubsub;
|
|
1931
1939
|
}));
|
|
1932
1940
|
//#endregion
|
|
1933
|
-
//#region node_modules/.pnpm/effect@
|
|
1941
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/stream.js
|
|
1934
1942
|
const TypeId$1 = "~effect/Stream";
|
|
1935
1943
|
const streamVariance = {
|
|
1936
1944
|
_R: identity,
|
|
@@ -1948,7 +1956,7 @@ Stream.prototype = {
|
|
|
1948
1956
|
};
|
|
1949
1957
|
const fromChannel$1 = (channel) => new Stream(channel);
|
|
1950
1958
|
//#endregion
|
|
1951
|
-
//#region node_modules/.pnpm/effect@
|
|
1959
|
+
//#region node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Stream.js
|
|
1952
1960
|
const TypeId = "~effect/Stream";
|
|
1953
1961
|
const isStream = (u) => hasProperty(u, TypeId);
|
|
1954
1962
|
const fromChannel = fromChannel$1;
|
|
@@ -2005,15 +2013,15 @@ const take = dual(2, (self, n) => {
|
|
|
2005
2013
|
});
|
|
2006
2014
|
const takeUntil = dual((args) => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => sync(() => {
|
|
2007
2015
|
let i = 0;
|
|
2008
|
-
let done$
|
|
2009
|
-
return flatMap$2(suspend$2(() => done$
|
|
2016
|
+
let done$6 = false;
|
|
2017
|
+
return flatMap$2(suspend$2(() => done$6 ? done() : pull), (chunk) => {
|
|
2010
2018
|
const index = chunk.findIndex((a) => predicate(a, i++));
|
|
2011
2019
|
if (index >= 0) {
|
|
2012
|
-
done$
|
|
2020
|
+
done$6 = true;
|
|
2013
2021
|
const arr = chunk.slice(0, options?.excludeLast ? index : index + 1);
|
|
2014
|
-
return isReadonlyArrayNonEmpty(arr) ? succeed$
|
|
2022
|
+
return isReadonlyArrayNonEmpty(arr) ? succeed$3(arr) : done();
|
|
2015
2023
|
}
|
|
2016
|
-
return succeed$
|
|
2024
|
+
return succeed$3(chunk);
|
|
2017
2025
|
});
|
|
2018
2026
|
})));
|
|
2019
2027
|
const drop = dual(2, (self, n) => {
|
|
@@ -2022,33 +2030,33 @@ const drop = dual(2, (self, n) => {
|
|
|
2022
2030
|
return transformPull(self, (pull, _scope) => sync(() => {
|
|
2023
2031
|
let dropped = 0;
|
|
2024
2032
|
const pump = pull.pipe(flatMap$2((chunk) => {
|
|
2025
|
-
if (dropped >= count) return succeed$
|
|
2033
|
+
if (dropped >= count) return succeed$3(chunk);
|
|
2026
2034
|
dropped += chunk.length;
|
|
2027
2035
|
if (dropped <= count) return pump;
|
|
2028
|
-
return succeed$
|
|
2036
|
+
return succeed$3(chunk.slice(count - dropped));
|
|
2029
2037
|
}));
|
|
2030
2038
|
return pump;
|
|
2031
2039
|
}));
|
|
2032
2040
|
});
|
|
2033
2041
|
const transduce = dual(2, (self, sink) => transformPull(self, (upstream, scope) => sync(() => {
|
|
2034
|
-
let done$
|
|
2042
|
+
let done$8;
|
|
2035
2043
|
let leftover;
|
|
2036
2044
|
const upstreamWithLeftover = suspend$2(() => {
|
|
2037
2045
|
if (leftover !== void 0) {
|
|
2038
2046
|
const chunk = leftover;
|
|
2039
2047
|
leftover = void 0;
|
|
2040
|
-
return succeed$
|
|
2048
|
+
return succeed$3(chunk);
|
|
2041
2049
|
}
|
|
2042
2050
|
return upstream;
|
|
2043
2051
|
}).pipe(catch_$2((error) => {
|
|
2044
|
-
done$
|
|
2052
|
+
done$8 = fail$5(error);
|
|
2045
2053
|
return done();
|
|
2046
2054
|
}));
|
|
2047
2055
|
const pull = map$2(suspend$2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
|
|
2048
2056
|
leftover = leftover_;
|
|
2049
2057
|
return of(value);
|
|
2050
2058
|
});
|
|
2051
|
-
return suspend$2(() => done$
|
|
2059
|
+
return suspend$2(() => done$8 ? done$8 : pull);
|
|
2052
2060
|
})));
|
|
2053
2061
|
const broadcast = dual(2, (self, options) => map$2(toPubSubTake(self, options), fromPubSubTake));
|
|
2054
2062
|
const pipeThroughChannel = dual(2, (self, channel) => fromChannel(pipeTo(self.channel, channel)));
|
|
@@ -2086,4 +2094,4 @@ const toPubSubTake = dual(2, (self, options) => toPubSubTake$1(self.channel, opt
|
|
|
2086
2094
|
//#endregion
|
|
2087
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 };
|
|
2088
2096
|
|
|
2089
|
-
//# sourceMappingURL=Stream-
|
|
2097
|
+
//# sourceMappingURL=Stream-BI6Fx9yq.mjs.map
|