clanka 0.8.5 → 0.9.0
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/Acp.d.ts.map +1 -1
- package/dist/Acp.js +9 -3
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +72 -1
- package/dist/Acp.test.js.map +1 -1
- package/dist/AcpImage.test.js +1 -0
- package/dist/AcpImage.test.js.map +1 -1
- package/dist/Agent.d.ts +65 -8
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +481 -113
- package/dist/Agent.js.map +1 -1
- package/dist/Agent.test.js +77 -4
- package/dist/Agent.test.js.map +1 -1
- package/dist/AgentCallerConfig.test.d.ts +2 -0
- package/dist/AgentCallerConfig.test.d.ts.map +1 -0
- package/dist/AgentCallerConfig.test.js +327 -0
- package/dist/AgentCallerConfig.test.js.map +1 -0
- package/dist/AgentExecutor.d.ts +254 -54
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentExecutor.js +416 -99
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +201 -31
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentExecutorImage.test.js +2 -1
- package/dist/AgentExecutorImage.test.js.map +1 -1
- package/dist/AgentImage.test.js +5 -1
- package/dist/AgentImage.test.js.map +1 -1
- package/dist/AgentOutput.d.ts +54 -2
- package/dist/AgentOutput.d.ts.map +1 -1
- package/dist/AgentOutput.js +52 -0
- package/dist/AgentOutput.js.map +1 -1
- package/dist/AgentSkills.d.ts +22 -0
- package/dist/AgentSkills.d.ts.map +1 -1
- package/dist/AgentSkills.js +36 -0
- package/dist/AgentSkills.js.map +1 -1
- package/dist/AgentSkills.test.js +2 -0
- package/dist/AgentSkills.test.js.map +1 -1
- package/dist/AgentSubagents.test.d.ts +2 -0
- package/dist/AgentSubagents.test.d.ts.map +1 -0
- package/dist/AgentSubagents.test.js +452 -0
- package/dist/AgentSubagents.test.js.map +1 -0
- package/dist/AgentTools.d.ts +356 -14
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +213 -34
- package/dist/AgentTools.js.map +1 -1
- package/dist/CompactionTransport.test.js +1 -1
- package/dist/CompactionTransport.test.js.map +1 -1
- package/dist/OutputFormatter.d.ts.map +1 -1
- package/dist/OutputFormatter.js +16 -2
- package/dist/OutputFormatter.js.map +1 -1
- package/dist/ToolkitRenderer.d.ts.map +1 -1
- package/dist/ToolkitRenderer.js +6 -1
- package/dist/ToolkitRenderer.js.map +1 -1
- package/dist/bin/{Effect-BEUn4I5E.mjs → Effect-2jPlJ8eu.mjs} +399 -207
- package/dist/bin/Effect-2jPlJ8eu.mjs.map +1 -0
- package/dist/bin/{McpClient-C0FVuDj2.mjs → McpClient-1W508adc.mjs} +4 -4
- package/dist/bin/{McpClient-C0FVuDj2.mjs.map → McpClient-1W508adc.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-DffD5oxX.mjs → OutputFormatter-DXXKo4E8.mjs} +16 -5
- package/dist/bin/{OutputFormatter-DffD5oxX.mjs.map → OutputFormatter-DXXKo4E8.mjs.map} +1 -1
- package/dist/bin/{Schema-CjUGw2Xh.mjs → Schema-D-7VuCiC.mjs} +640 -87
- package/dist/bin/Schema-D-7VuCiC.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-CFB73IPb.mjs → SemanticSearch-Cb8aqvGv.mjs} +89 -56
- package/dist/bin/SemanticSearch-Cb8aqvGv.mjs.map +1 -0
- package/dist/bin/{Stream-Cu6P7ZHo.mjs → Stream-DEu2tfCV.mjs} +81 -51
- package/dist/bin/Stream-DEu2tfCV.mjs.map +1 -0
- package/dist/bin/cli.mjs +3632 -5538
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{turndown.cjs-usmCKZ4b.mjs → turndown.cjs-DK29wZw3.mjs} +2 -2
- package/dist/bin/{turndown.cjs-usmCKZ4b.mjs.map → turndown.cjs-DK29wZw3.mjs.map} +1 -1
- package/package.json +7 -7
- package/src/Acp.test.ts +121 -2
- package/src/Acp.ts +10 -3
- package/src/AcpImage.test.ts +1 -0
- package/src/Agent.test.ts +100 -3
- package/src/Agent.ts +752 -142
- package/src/AgentCallerConfig.test.ts +514 -0
- package/src/AgentExecutor.test.ts +297 -37
- package/src/AgentExecutor.ts +707 -159
- package/src/AgentExecutorImage.test.ts +2 -1
- package/src/AgentImage.test.ts +11 -2
- package/src/AgentOutput.ts +74 -1
- package/src/AgentSkills.test.ts +2 -0
- package/src/AgentSkills.ts +43 -0
- package/src/AgentSubagents.test.ts +758 -0
- package/src/AgentTools.ts +376 -52
- package/src/CompactionTransport.test.ts +1 -1
- package/src/OutputFormatter.ts +16 -2
- package/src/ToolkitRenderer.ts +7 -1
- package/dist/bin/Effect-BEUn4I5E.mjs.map +0 -1
- package/dist/bin/Schema-CjUGw2Xh.mjs.map +0 -1
- package/dist/bin/SemanticSearch-CFB73IPb.mjs.map +0 -1
- package/dist/bin/Stream-Cu6P7ZHo.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1
|
+
import { $n as findError, $o as evaluate, $r as asVoidAll, Ai as flatMap$3, Bi as onExitPrimitive, Br as provide, Ci as fiberAwait, D as contextWith, Di as fiberInterruptAs, Do as map$4, Dt as provideService$2, E as context, Ea as fail$4, Ei as fiberInterruptAllAs, Et as provideContext$2, Fa as succeed$5, Fi as makeLatch, Fn as doneExitFromCause, Fr as addFinalizerExit, G as forkChild, Gi as suspend$3, Gt as succeedSome, Ii as makeLatchUnsafe, In as filterDone, Ir as close, Jt as tap$1, K as forkIn, Ki as sync$1, Kr as doneUnsafe, Kt as suspend$2, L as flatMap$2, Ln as isDoneCause, Lr as forkUnsafe, M as exit, Ma as isSuccess$1, Mi as getCurrentFiber, Mo as some, N as fail$3, Nr as Scope, Ns as hasProperty, Oi as fiberJoin, Ot as raceFirst, P as failCause$3, Pn as catchDone, Pr as addFinalizer, Pt as runForkWith, Q as interrupt$2, Qo as causeFail, Qr as makeUnsafe$3, Qt as tryPromise, R as flatMapEager, Rn as matchEffect, Si as exitZipRight, Ta as headUnsafe, Ti as fiberInterruptAll, To as isSome, U as forEach, Ui as succeed$4, Ut as succeed$3, V as fnUntraced, W as forever, Wi as succeedNone, Wt as succeedNone$1, X as gen, Xn as done, Xs as isTagged, Yi as void_$1, Yn as die$2, Yo as PipeInspectableProto, Ys as isString$1, Zo as args, _a as lastNonEmpty, _t as onError, a as andThen, ac as dual, ai as isFailure$1, as as withFiber$1, bi as exitInterrupt$1, bt as onInterrupt, c as as, ci as void_$2, cn as whileLoop, es as exitFail, fa as isArrayNonEmpty, fi as andThen$1, gt as never, ic as constant, ii as isExit$1, is as makePrimitive, j as ensuring$2, ja as isFailure, ki as fiberRunIn, ko as none, ln as withFiber, m as catchCause$1, ma as isReadonlyArrayNonEmpty, mi as callback$2, mt as matchCauseEffect, ni as failCause$4, no as get$1, ns as exitSucceed, oi as isSuccess, on as void_, p as callback$1, pc as pipeArguments, pi as asSome, pn as yieldNow, ps as toJson, q as forkScoped, qi as uninterruptibleMask, qo as Done, qr as interruptWith, qt as sync, rc as constVoid, ri as interrupt$1, rs as isExit, sc as identity, si as succeed$2, sn as when, st as map$2, t as acquireRelease, tc as constTrue, ti as fail$5, tn as uninterruptible, ts as exitFailCause, u as asVoid, ua as fromIterable$1, vt as onExit$1, w as catch_$2, wi as fiberInterrupt, wt as promise, xa as of, xi as exitVoid, ya as map$3, yt as onExitPrimitive$1, z as flatten$1, zr as makeUnsafe$2, zt as scopedWith } from "./Effect-2jPlJ8eu.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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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))
|
|
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.
|
|
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
|
|
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) =>
|
|
1293
|
-
const poll = (self) =>
|
|
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.
|
|
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.
|
|
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.
|
|
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) =>
|
|
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$
|
|
1577
|
+
let done$14 = none();
|
|
1560
1578
|
return suspend$2(() => {
|
|
1561
|
-
if (done$
|
|
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$
|
|
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$
|
|
1601
|
+
let done$16 = false;
|
|
1584
1602
|
return suspend$2(() => {
|
|
1585
|
-
if (done$
|
|
1586
|
-
done$
|
|
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$
|
|
1629
|
+
onSuccess: ({ done: done$10, value }) => {
|
|
1612
1630
|
if (exit.current) return exit.current;
|
|
1613
|
-
return done$
|
|
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$
|
|
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
|
|
1794
|
-
yield* exit(close(childScope,
|
|
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) =>
|
|
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$
|
|
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$
|
|
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$
|
|
1906
|
+
done$11 = some(leftover);
|
|
1886
1907
|
if (stringBuilder.length > 0) {
|
|
1887
1908
|
const last = stringBuilder;
|
|
1888
1909
|
stringBuilder = "";
|
|
@@ -1919,6 +1940,14 @@ const provideContext$1 = dual(2, (self, context) => fromTransform((upstream, sco
|
|
|
1919
1940
|
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))));
|
|
1920
1941
|
const runDrain$1 = (self) => runWith(self, (pull) => forever(pull, { disableYield: true }));
|
|
1921
1942
|
const runForEach$1 = dual(2, (self, f) => runWith(self, (pull) => forever(flatMap$2(pull, f), { disableYield: true })));
|
|
1943
|
+
const runLast$1 = (self) => suspend$2(() => {
|
|
1944
|
+
const absent = Symbol();
|
|
1945
|
+
let last = absent;
|
|
1946
|
+
return runWith(self, (pull) => forever(flatMap$2(pull, (item) => {
|
|
1947
|
+
last = item;
|
|
1948
|
+
return void_;
|
|
1949
|
+
}), { disableYield: true }), () => last === absent ? succeedNone$1 : succeedSome(last));
|
|
1950
|
+
});
|
|
1922
1951
|
const runFold$1 = dual(3, (self, initial, f) => suspend$2(() => {
|
|
1923
1952
|
let state = initial();
|
|
1924
1953
|
return runWith(self, (pull) => whileLoop({
|
|
@@ -1938,7 +1967,7 @@ const toPubSubTake$1 = dual(2, fnUntraced(function* (self, options) {
|
|
|
1938
1967
|
return pubsub;
|
|
1939
1968
|
}));
|
|
1940
1969
|
//#endregion
|
|
1941
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1970
|
+
//#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/internal/stream.js
|
|
1942
1971
|
const TypeId$1 = "~effect/Stream";
|
|
1943
1972
|
const streamVariance = {
|
|
1944
1973
|
_R: identity,
|
|
@@ -1956,7 +1985,7 @@ Stream.prototype = {
|
|
|
1956
1985
|
};
|
|
1957
1986
|
const fromChannel$1 = (channel) => new Stream(channel);
|
|
1958
1987
|
//#endregion
|
|
1959
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1988
|
+
//#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Stream.js
|
|
1960
1989
|
const TypeId = "~effect/Stream";
|
|
1961
1990
|
const isStream = (u) => hasProperty(u, TypeId);
|
|
1962
1991
|
const fromChannel = fromChannel$1;
|
|
@@ -2013,11 +2042,11 @@ const take = dual(2, (self, n) => {
|
|
|
2013
2042
|
});
|
|
2014
2043
|
const takeUntil = dual((args) => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => sync(() => {
|
|
2015
2044
|
let i = 0;
|
|
2016
|
-
let done$
|
|
2017
|
-
return flatMap$2(suspend$2(() => done$
|
|
2045
|
+
let done$6 = false;
|
|
2046
|
+
return flatMap$2(suspend$2(() => done$6 ? done() : pull), (chunk) => {
|
|
2018
2047
|
const index = chunk.findIndex((a) => predicate(a, i++));
|
|
2019
2048
|
if (index >= 0) {
|
|
2020
|
-
done$
|
|
2049
|
+
done$6 = true;
|
|
2021
2050
|
const arr = chunk.slice(0, options?.excludeLast ? index : index + 1);
|
|
2022
2051
|
return isReadonlyArrayNonEmpty(arr) ? succeed$3(arr) : done();
|
|
2023
2052
|
}
|
|
@@ -2039,7 +2068,7 @@ const drop = dual(2, (self, n) => {
|
|
|
2039
2068
|
}));
|
|
2040
2069
|
});
|
|
2041
2070
|
const transduce = dual(2, (self, sink) => transformPull(self, (upstream, scope) => sync(() => {
|
|
2042
|
-
let done$
|
|
2071
|
+
let done$1;
|
|
2043
2072
|
let leftover;
|
|
2044
2073
|
const upstreamWithLeftover = suspend$2(() => {
|
|
2045
2074
|
if (leftover !== void 0) {
|
|
@@ -2049,14 +2078,14 @@ const transduce = dual(2, (self, sink) => transformPull(self, (upstream, scope)
|
|
|
2049
2078
|
}
|
|
2050
2079
|
return upstream;
|
|
2051
2080
|
}).pipe(catch_$2((error) => {
|
|
2052
|
-
done$
|
|
2081
|
+
done$1 = fail$5(error);
|
|
2053
2082
|
return done();
|
|
2054
2083
|
}));
|
|
2055
2084
|
const pull = map$2(suspend$2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
|
|
2056
2085
|
leftover = leftover_;
|
|
2057
2086
|
return of(value);
|
|
2058
2087
|
});
|
|
2059
|
-
return suspend$2(() => done$
|
|
2088
|
+
return suspend$2(() => done$1 ? done$1 : pull);
|
|
2060
2089
|
})));
|
|
2061
2090
|
const broadcast = dual(2, (self, options) => map$2(toPubSubTake(self, options), fromPubSubTake));
|
|
2062
2091
|
const pipeThroughChannel = dual(2, (self, channel) => fromChannel(pipeTo(self.channel, channel)));
|
|
@@ -2078,6 +2107,7 @@ const runFold = dual(3, (self, initial, f) => runFold$1(self.channel, initial, (
|
|
|
2078
2107
|
for (let i = 0; i < arr.length; i++) acc = f(acc, arr[i]);
|
|
2079
2108
|
return acc;
|
|
2080
2109
|
}));
|
|
2110
|
+
const runLast = (self) => map$2(runLast$1(self.channel), map$4(lastNonEmpty));
|
|
2081
2111
|
const runForEach = dual(2, (self, f) => runForEach$1(self.channel, (arr) => {
|
|
2082
2112
|
let i = 0;
|
|
2083
2113
|
return whileLoop({
|
|
@@ -2092,6 +2122,6 @@ const mkString = (self) => runFold$1(self.channel, () => "", (acc, chunk) => acc
|
|
|
2092
2122
|
const runIntoPubSub = dual((args) => isStream(args[0]), (self, pubsub, options) => runIntoPubSubArray(self.channel, pubsub, options));
|
|
2093
2123
|
const toPubSubTake = dual(2, (self, options) => toPubSubTake$1(self.channel, options));
|
|
2094
2124
|
//#endregion
|
|
2095
|
-
export {
|
|
2125
|
+
export { takeUntil as $, mapArrayEffect as A, makeUnsafe$1 as At, provideService as B, toLowerCase as Bt, fromPubSub as C, shutdownUnsafe as Ct, isStream as D, make$4 as Dt, fromReadableStream as E, unbounded$1 as Et, mkString as F, interruptAllAs as Ft, runForEach as G, runCollect as H, round as Ht, onEnd as I, interruptAs as It, runLast as J, runForEachArray as K, orDie as L, join as Lt, mapError as M, getCurrent as Mt, merge as N, interrupt as Nt, map as O, set as Ot, mergeAll as P, interruptAll as Pt, take as Q, pipeThroughChannel as R, runIn as Rt, fromIterable as S, poll as St, fromQueue as T, unbounded as Tt, runDrain as U, normalizeNonEmpty as Ut, run as V, parse as Vt, runFold as W, succeed as X, splitLines as Y, suspend as Z, flattenIterable as _, make$1 as _t, catchTags as a, mapDone as at, fromChannel as b, offerAllUnsafe as bt, die as c, unwrap$1 as ct, ensuring as d, bounded as dt, tap as et, fail as f, end as ft, flatMap as g, failCauseUnsafe as gt, filterMap as h, failCause$2 as ht, catchReason as i, map$1 as it, mapEffect as j, await_ as jt, mapArray as k, update as kt, drop as l, make as lt, filter as m, fail$2 as mt, callback as n, unwrap as nt, catch_ as o, pipeTo as ot, failCause as p, endUnsafe as pt, runIntoPubSub as q, catchIf as r, fromTransform as rt, decodeText as s, toTransform as st, broadcast as t, transduce as tt, empty as u, makeUnsafe as ut, fromArray as v, offer as vt, fromPull as w, take$1 as wt, fromEffect as x, offerUnsafe as xt, fromArrayEffect as y, offerAll as yt, provideContext as z, camelToSnake as zt };
|
|
2096
2126
|
|
|
2097
|
-
//# sourceMappingURL=Stream-
|
|
2127
|
+
//# sourceMappingURL=Stream-DEu2tfCV.mjs.map
|