clanka 0.10.1 → 0.12.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/README.md +75 -0
- package/dist/Acp.d.ts +1 -1
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +112 -7
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +178 -0
- package/dist/Acp.test.js.map +1 -1
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +26 -8
- package/dist/Agent.js.map +1 -1
- package/dist/AgentExecutor.js +15 -1
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +24 -4
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentSkills.test.js +0 -1
- package/dist/AgentSkills.test.js.map +1 -1
- package/dist/AgentSubagents.test.js +16 -6
- package/dist/AgentSubagents.test.js.map +1 -1
- package/dist/AgentTools.d.ts +7 -0
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +7 -0
- package/dist/AgentTools.js.map +1 -1
- package/dist/McpConfig.d.ts +36 -0
- package/dist/McpConfig.d.ts.map +1 -0
- package/dist/McpConfig.js +182 -0
- package/dist/McpConfig.js.map +1 -0
- package/dist/McpConfig.test.d.ts +2 -0
- package/dist/McpConfig.test.d.ts.map +1 -0
- package/dist/McpConfig.test.js +163 -0
- package/dist/McpConfig.test.js.map +1 -0
- package/dist/McpServers.d.ts +176 -0
- package/dist/McpServers.d.ts.map +1 -0
- package/dist/McpServers.js +707 -0
- package/dist/McpServers.js.map +1 -0
- package/dist/McpServers.test.d.ts +2 -0
- package/dist/McpServers.test.d.ts.map +1 -0
- package/dist/McpServers.test.js +717 -0
- package/dist/McpServers.test.js.map +1 -0
- package/dist/TypeBuilder.d.ts +9 -0
- package/dist/TypeBuilder.d.ts.map +1 -1
- package/dist/TypeBuilder.js +24 -11
- package/dist/TypeBuilder.js.map +1 -1
- package/dist/TypeBuilder.test.js +33 -0
- package/dist/TypeBuilder.test.js.map +1 -1
- package/dist/bin/{Effect-2jPlJ8eu.mjs → Effect-DuThyCJ1.mjs} +155 -74
- package/dist/bin/Effect-DuThyCJ1.mjs.map +1 -0
- package/dist/bin/McpClient-CIiPyMDJ.mjs +36 -0
- package/dist/bin/McpClient-CIiPyMDJ.mjs.map +1 -0
- package/dist/bin/{OutputFormatter-BFAv48k9.mjs → OutputFormatter-BvIjvUmT.mjs} +3 -3
- package/dist/bin/{OutputFormatter-BFAv48k9.mjs.map → OutputFormatter-BvIjvUmT.mjs.map} +1 -1
- package/dist/bin/{Schema-D-7VuCiC.mjs → Schema-DcXUXpRg.mjs} +1069 -124
- package/dist/bin/Schema-DcXUXpRg.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-Cb8aqvGv.mjs → SemanticSearch-CdGA4CIC.mjs} +27 -21
- package/dist/bin/SemanticSearch-CdGA4CIC.mjs.map +1 -0
- package/dist/bin/{Stream-DEu2tfCV.mjs → Stream-I9SRMlLj.mjs} +60 -45
- package/dist/bin/Stream-I9SRMlLj.mjs.map +1 -0
- package/dist/bin/cli.mjs +27217 -10325
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{index.min-CI3qqohw.mjs → index.min-Bkz7vIWv.mjs} +7 -7
- package/dist/bin/index.min-Bkz7vIWv.mjs.map +1 -0
- package/dist/bin/rolldown-runtime-zY4HT0JA.mjs +30 -0
- package/dist/bin/{turndown.cjs-DK29wZw3.mjs → turndown.cjs-LntFxFyd.mjs} +2 -2
- package/dist/bin/{turndown.cjs-DK29wZw3.mjs.map → turndown.cjs-LntFxFyd.mjs.map} +1 -1
- package/dist/cli.js +46 -7
- package/dist/cli.js.map +1 -1
- package/dist/fixtures/McpFakeServer.d.ts +47 -0
- package/dist/fixtures/McpFakeServer.d.ts.map +1 -0
- package/dist/fixtures/McpFakeServer.js +112 -0
- package/dist/fixtures/McpFakeServer.js.map +1 -0
- package/dist/fixtures/McpStdioServer.d.ts +2 -0
- package/dist/fixtures/McpStdioServer.d.ts.map +1 -0
- package/dist/fixtures/McpStdioServer.js +53 -0
- package/dist/fixtures/McpStdioServer.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/Acp.test.ts +242 -0
- package/src/Acp.ts +141 -5
- package/src/Agent.ts +38 -10
- package/src/AgentExecutor.test.ts +31 -5
- package/src/AgentExecutor.ts +14 -1
- package/src/AgentSkills.test.ts +0 -1
- package/src/AgentSubagents.test.ts +20 -6
- package/src/AgentTools.ts +8 -0
- package/src/McpConfig.test.ts +238 -0
- package/src/McpConfig.ts +255 -0
- package/src/McpServers.test.ts +1050 -0
- package/src/McpServers.ts +1072 -0
- package/src/TypeBuilder.test.ts +70 -0
- package/src/TypeBuilder.ts +41 -14
- package/src/cli.ts +92 -8
- package/src/fixtures/McpFakeServer.ts +162 -0
- package/src/fixtures/McpStdioServer.ts +60 -0
- package/src/index.ts +5 -0
- package/dist/bin/Effect-2jPlJ8eu.mjs.map +0 -1
- package/dist/bin/McpClient-1W508adc.mjs +0 -14179
- package/dist/bin/McpClient-1W508adc.mjs.map +0 -1
- package/dist/bin/Schema-D-7VuCiC.mjs.map +0 -1
- package/dist/bin/SemanticSearch-Cb8aqvGv.mjs.map +0 -1
- package/dist/bin/Stream-DEu2tfCV.mjs.map +0 -1
- package/dist/bin/index.min-CI3qqohw.mjs.map +0 -1
|
@@ -1,34 +1,15 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1
|
+
import { $i as sync$1, $r as interruptWith, $t as tryPromise, Ai as fiberAwait, Ba as isFailure, Br as addFinalizerExit, D as contextWith, Da as map$3, Di as exitInterrupt$1, Dt as provideService$2, E as context, Et as provideContext$2, Fa as fail$4, Fi as fiberJoin, Fn as catchDone, G as forkChild, Gr as makeUnsafe$2, Gt as succeedSome, Hi as makeLatch, Hn as nextPow2, Ii as fiberRunIn, In as doneExitFromCause, Io as map$4, Jt as tap$1, K as forkIn, Kr as provide, Kt as suspend$2, L as flatMap$2, Li as flatMap$3, Ln as filterDone, M as exit, Mi as fiberInterruptAll, N as fail$3, Na as headUnsafe, Ni as fiberInterruptAllAs, Oi as exitVoid, Ot as raceFirst, P as failCause$3, Pi as fiberInterruptAs, Po as isSome, Pt as runForkWith, Q as interrupt$2, Qi as suspend$3, Qr as doneUnsafe, R as flatMapEager, Rn as isDoneCause, Ro as none, Rr as Scope, Sa as isReadonlyArrayNonEmpty, Ss as toJson, Ta as lastNonEmpty, Tc as pipeArguments, U as forEach, Ui as makeLatchUnsafe, Ur as forkUnsafe, Ut as succeed$3, V as fnUntraced, Va as isSuccess$1, Vo as some, Vr as close, W as forever, Wa as succeed$5, Ws as hasProperty, Wt as succeedNone$1, X as gen, Xi as succeed$4, Zi as succeedNone, _c as dual, _t as onError, a as andThen, ai as asVoidAll, ba as isArrayNonEmpty, bi as asSome, bt as onInterrupt, c as as, cc as isTagged, ci as failCause$4, cn as when, cs as evaluate, di as isExit$1, do as get$1, ds as exitSucceed, ea as uninterruptibleMask, er as die$2, fi as isFailure$1, fs as isExit, gc as constant, gt as never, hc as constVoid, hi as void_$2, ii as makeUnsafe$3, ir as findError, is as PipeInspectableProto, j as ensuring$2, ji as fiberInterrupt, ka as of, ki as exitZipRight, ln as whileLoop, ls as exitFail, m as catchCause$1, mi as succeed$2, mn as yieldNow, ms as withFiber$1, mt as matchCauseEffect, na as void_$1, nn as uninterruptible, ns as Done, oc as isString$1, os as args, p as callback$1, pc as constTrue, pi as isSuccess, ps as makePrimitive, q as forkScoped, qi as onExitPrimitive, qt as sync, si as fail$5, sn as void_, ss as causeFail, st as map$2, t as acquireRelease, tr as done, u as asVoid, ui as interrupt$1, un as withFiber, us as exitFailCause, va as fromIterable$1, vt as onExit$1, w as catch_$2, wt as promise, xi as callback$2, yc as identity, yi as andThen$1, yt as onExitPrimitive$1, z as flatten$1, zi as getCurrentFiber, zn as matchEffect, zr as addFinalizer, zt as scopedWith } from "./Effect-DuThyCJ1.mjs";
|
|
2
|
+
//#region node_modules/.pnpm/effect@4.0.5/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.
|
|
7
|
-
const Number$1 = globalThis.Number;
|
|
8
|
-
const nextPow2 = (n) => {
|
|
9
|
-
const nextPow = Math.ceil(Math.log(n) / Math.log(2));
|
|
10
|
-
return Math.max(Math.pow(2, nextPow), 2);
|
|
11
|
-
};
|
|
12
|
-
const parse = (s) => {
|
|
13
|
-
if (s === "NaN") return some(NaN);
|
|
14
|
-
if (s === "Infinity") return some(Infinity);
|
|
15
|
-
if (s === "-Infinity") return some(-Infinity);
|
|
16
|
-
if (s.trim() === "") return none();
|
|
17
|
-
const n = Number$1(s);
|
|
18
|
-
return Number$1.isNaN(n) ? none() : some(n);
|
|
19
|
-
};
|
|
20
|
-
const round = dual(2, (self, precision) => {
|
|
21
|
-
const factor = Math.pow(10, precision);
|
|
22
|
-
return Math.round(self * factor) / factor;
|
|
23
|
-
});
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/String.js
|
|
6
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/String.js
|
|
26
7
|
const String = globalThis.String;
|
|
27
8
|
const isString = isString$1;
|
|
28
9
|
const toLowerCase = (self) => self.toLowerCase();
|
|
29
10
|
const camelToSnake = (self) => self.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
30
11
|
//#endregion
|
|
31
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
12
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Fiber.js
|
|
32
13
|
const await_ = fiberAwait;
|
|
33
14
|
const join = fiberJoin;
|
|
34
15
|
const interrupt = fiberInterrupt;
|
|
@@ -38,11 +19,11 @@ const interruptAllAs = fiberInterruptAllAs;
|
|
|
38
19
|
const getCurrent = getCurrentFiber;
|
|
39
20
|
const runIn = fiberRunIn;
|
|
40
21
|
//#endregion
|
|
41
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
22
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Latch.js
|
|
42
23
|
const makeUnsafe$1 = makeLatchUnsafe;
|
|
43
24
|
const make$5 = makeLatch;
|
|
44
25
|
//#endregion
|
|
45
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
26
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/MutableRef.js
|
|
46
27
|
const TypeId$5 = "~effect/MutableRef";
|
|
47
28
|
const MutableRefProto = {
|
|
48
29
|
[TypeId$5]: TypeId$5,
|
|
@@ -66,7 +47,7 @@ const set = dual(2, (self, value) => {
|
|
|
66
47
|
});
|
|
67
48
|
const update = dual(2, (self, f) => set(self, f(get(self))));
|
|
68
49
|
//#endregion
|
|
69
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
50
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/MutableList.js
|
|
70
51
|
const Empty = Symbol.for("effect/MutableList/Empty");
|
|
71
52
|
const make$3 = () => ({
|
|
72
53
|
head: void 0,
|
|
@@ -190,7 +171,7 @@ const filter$1 = (self, f) => {
|
|
|
190
171
|
};
|
|
191
172
|
const remove = (self, value) => filter$1(self, (v) => v !== value);
|
|
192
173
|
//#endregion
|
|
193
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
174
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/PubSub.js
|
|
194
175
|
const TypeId$4 = "~effect/PubSub";
|
|
195
176
|
const SubscriptionTypeId = "~effect/PubSub/Subscription";
|
|
196
177
|
const make$2 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), new Map(), makeUnsafe$2(), makeUnsafe$1(false), make$4(false), options.strategy(), make$4(none())));
|
|
@@ -1176,7 +1157,7 @@ const emptyReplayWindow = {
|
|
|
1176
1157
|
close: () => void 0
|
|
1177
1158
|
};
|
|
1178
1159
|
//#endregion
|
|
1179
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1160
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Queue.js
|
|
1180
1161
|
const TypeId$3 = "~effect/Queue";
|
|
1181
1162
|
const EnqueueTypeId = "~effect/Queue/Enqueue";
|
|
1182
1163
|
const DequeueTypeId = "~effect/Queue/Dequeue";
|
|
@@ -1440,7 +1421,7 @@ const finalize = (self, exit) => {
|
|
|
1440
1421
|
openState.awaiters.clear();
|
|
1441
1422
|
};
|
|
1442
1423
|
//#endregion
|
|
1443
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1424
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Semaphore.js
|
|
1444
1425
|
const makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
1445
1426
|
const waitForPermits = (self, n, effect) => callback$2((resume) => {
|
|
1446
1427
|
if (self.free >= n) return resume(effect);
|
|
@@ -1531,10 +1512,10 @@ var SemaphoreImpl = class {
|
|
|
1531
1512
|
};
|
|
1532
1513
|
const make = (permits) => sync$1(() => new SemaphoreImpl(permits));
|
|
1533
1514
|
//#endregion
|
|
1534
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1515
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Take.js
|
|
1535
1516
|
const toPull = (take) => isExit$1(take) ? isSuccess(take) ? done(take.value) : take : succeed$3(take);
|
|
1536
1517
|
//#endregion
|
|
1537
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1518
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Channel.js
|
|
1538
1519
|
const TypeId$2 = "~effect/Channel";
|
|
1539
1520
|
const isChannel = (u) => hasProperty(u, TypeId$2);
|
|
1540
1521
|
const ChannelProto = {
|
|
@@ -1574,15 +1555,15 @@ const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => {
|
|
|
1574
1555
|
const size = normalizeNonEmpty(chunkSize);
|
|
1575
1556
|
return fromPull$1(sync(() => {
|
|
1576
1557
|
const iter = iterator();
|
|
1577
|
-
let done$
|
|
1558
|
+
let done$15 = none();
|
|
1578
1559
|
return suspend$2(() => {
|
|
1579
|
-
if (done$
|
|
1560
|
+
if (done$15._tag === "Some") return done(done$15.value);
|
|
1580
1561
|
const buffer = [];
|
|
1581
1562
|
while (buffer.length < size) {
|
|
1582
1563
|
const state = iter.next();
|
|
1583
1564
|
if (state.done) {
|
|
1584
1565
|
if (buffer.length === 0) return done(state.value);
|
|
1585
|
-
done$
|
|
1566
|
+
done$15 = some(state.value);
|
|
1586
1567
|
break;
|
|
1587
1568
|
}
|
|
1588
1569
|
buffer.push(state.value);
|
|
@@ -1634,12 +1615,28 @@ const readableStreamToPullUnsafe = (options) => {
|
|
|
1634
1615
|
});
|
|
1635
1616
|
return as(addFinalizer(options.scope, options.releaseLockOnEnd ? sync(() => reader.releaseLock()) : promise(() => reader.cancel().catch(constVoid))), pull);
|
|
1636
1617
|
};
|
|
1618
|
+
const fromAsyncIterable$1 = (iterable, onError) => fromTransform(fnUntraced(function* (_, scope) {
|
|
1619
|
+
const iter = iterable[Symbol.asyncIterator]();
|
|
1620
|
+
let pulling = false;
|
|
1621
|
+
if (iter.return) yield* addFinalizer(scope, suspend$2(() => pulling ? sync(() => void iter.return().catch(constVoid)) : promise(() => iter.return())));
|
|
1622
|
+
return flatMap$2(tryPromise({
|
|
1623
|
+
try: () => {
|
|
1624
|
+
const promise = iter.next();
|
|
1625
|
+
pulling = true;
|
|
1626
|
+
return promise.finally(() => {
|
|
1627
|
+
pulling = false;
|
|
1628
|
+
});
|
|
1629
|
+
},
|
|
1630
|
+
catch: onError
|
|
1631
|
+
}), (result) => result.done ? done(result.value) : succeed$3(result.value));
|
|
1632
|
+
}));
|
|
1633
|
+
const fromAsyncIterableArray = (iterable, onError) => map$1(fromAsyncIterable$1(iterable, onError), of);
|
|
1637
1634
|
const map$1 = dual(2, (self, f) => transformPull$1(self, (pull) => sync(() => {
|
|
1638
1635
|
let i = 0;
|
|
1639
1636
|
return map$2(pull, (o) => f(o, i++));
|
|
1640
1637
|
})));
|
|
1641
1638
|
const mapDone = dual(2, (self, f) => mapDoneEffect(self, (o) => succeed$3(f(o))));
|
|
1642
|
-
const mapDoneEffect = dual(2, (self, f) => transformPull$1(self, (pull) => succeed$3(catchDone(pull, (done$
|
|
1639
|
+
const mapDoneEffect = dual(2, (self, f) => transformPull$1(self, (pull) => succeed$3(catchDone(pull, (done$13) => flatMap$2(f(done$13), done)))));
|
|
1643
1640
|
const concurrencyIsSequential = (concurrency) => concurrency === void 0 || concurrency !== "unbounded" && concurrency <= 1;
|
|
1644
1641
|
const mapEffect$1 = dual((args) => isChannel(args[0]), (self, f, options) => concurrencyIsSequential(options?.concurrency) ? mapEffectSequential(self, f) : mapEffectConcurrent(self, f, options));
|
|
1645
1642
|
const mapEffectSequential = (self, f) => fromTransform((upstream, scope) => {
|
|
@@ -1708,7 +1705,7 @@ const flatMapSequential = (self, f) => fromTransform((upstream, scope) => map$2(
|
|
|
1708
1705
|
return suspend$2(() => childPull ?? makePull);
|
|
1709
1706
|
}));
|
|
1710
1707
|
const flatMapConcurrent = (self, f, options) => self.pipe(map$1(f), mergeAll$1(options));
|
|
1711
|
-
const flattenArray = (self) => transformPull$1(self, (pull) => {
|
|
1708
|
+
const flattenArray$1 = (self) => transformPull$1(self, (pull) => {
|
|
1712
1709
|
let array;
|
|
1713
1710
|
let index = 0;
|
|
1714
1711
|
const pump = suspend$2(function loop() {
|
|
@@ -1853,7 +1850,7 @@ const merge$1 = dual((args) => isChannel(args[0]) && isChannel(args[1]), (left,
|
|
|
1853
1850
|
const splitLines$1 = () => fromTransform((upstream, _scope) => sync(() => {
|
|
1854
1851
|
let stringBuilder = "";
|
|
1855
1852
|
let midCRLF = false;
|
|
1856
|
-
let done$
|
|
1853
|
+
let done$12 = none();
|
|
1857
1854
|
function splitLinesArray(chunk) {
|
|
1858
1855
|
const chunkBuilder = [];
|
|
1859
1856
|
function pushLine(segment) {
|
|
@@ -1898,12 +1895,12 @@ const splitLines$1 = () => fromTransform((upstream, _scope) => sync(() => {
|
|
|
1898
1895
|
return isReadonlyArrayNonEmpty(chunkBuilder) ? chunkBuilder : null;
|
|
1899
1896
|
}
|
|
1900
1897
|
const pullOrFlush = suspend$2(() => {
|
|
1901
|
-
if (done$
|
|
1898
|
+
if (done$12._tag === "Some") return done(done$12.value);
|
|
1902
1899
|
return matchEffect(upstream, {
|
|
1903
1900
|
onSuccess: loop,
|
|
1904
1901
|
onFailure: failCause$3,
|
|
1905
1902
|
onDone: (leftover) => {
|
|
1906
|
-
done$
|
|
1903
|
+
done$12 = some(leftover);
|
|
1907
1904
|
if (stringBuilder.length > 0) {
|
|
1908
1905
|
const last = stringBuilder;
|
|
1909
1906
|
stringBuilder = "";
|
|
@@ -1967,7 +1964,7 @@ const toPubSubTake$1 = dual(2, fnUntraced(function* (self, options) {
|
|
|
1967
1964
|
return pubsub;
|
|
1968
1965
|
}));
|
|
1969
1966
|
//#endregion
|
|
1970
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1967
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/stream.js
|
|
1971
1968
|
const TypeId$1 = "~effect/Stream";
|
|
1972
1969
|
const streamVariance = {
|
|
1973
1970
|
_R: identity,
|
|
@@ -1985,7 +1982,7 @@ Stream.prototype = {
|
|
|
1985
1982
|
};
|
|
1986
1983
|
const fromChannel$1 = (channel) => new Stream(channel);
|
|
1987
1984
|
//#endregion
|
|
1988
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1985
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Stream.js
|
|
1989
1986
|
const TypeId = "~effect/Stream";
|
|
1990
1987
|
const isStream = (u) => hasProperty(u, TypeId);
|
|
1991
1988
|
const fromChannel = fromChannel$1;
|
|
@@ -2007,17 +2004,19 @@ const fromQueue = (queue) => fromChannel(fromQueueArray(queue));
|
|
|
2007
2004
|
const fromPubSub = (pubsub) => fromChannel(fromPubSubArray(pubsub));
|
|
2008
2005
|
const fromPubSubTake = (pubsub) => fromChannel(fromPubSubTake$1(pubsub));
|
|
2009
2006
|
const fromReadableStream = (options) => fromChannel(fromReadableStream$1(options));
|
|
2007
|
+
const fromAsyncIterable = (iterable, onError) => fromChannel(fromAsyncIterableArray(iterable, onError));
|
|
2010
2008
|
const unwrap = (effect) => fromChannel(unwrap$1(map$2(effect, toChannel)));
|
|
2011
2009
|
const map = dual(2, (self, f) => suspend(() => {
|
|
2012
2010
|
let i = 0;
|
|
2013
2011
|
return fromChannel(map$1(self.channel, map$3((o) => f(o, i++))));
|
|
2014
2012
|
}));
|
|
2015
2013
|
const mapArray = dual(2, (self, f) => fromChannel(map$1(self.channel, f)));
|
|
2016
|
-
const mapEffect = dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray, mapEffect$1(f, options), map$1(of), fromChannel));
|
|
2014
|
+
const mapEffect = dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray$1, mapEffect$1(f, options), map$1(of), fromChannel));
|
|
2017
2015
|
const mapArrayEffect = dual(2, (self, f) => fromChannel(mapEffect$1(self.channel, f)));
|
|
2018
2016
|
const tap = dual((args) => isStream(args[0]), (self, f, options) => mapEffect(self, (a) => as(f(a), a), options));
|
|
2019
|
-
const flatMap = dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray, flatMap$1((a) => f(a).channel, options), fromChannel));
|
|
2017
|
+
const flatMap = dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray$1, flatMap$1((a) => f(a).channel, options), fromChannel));
|
|
2020
2018
|
const flatten = dual((args) => isStream(args[0]), (self, options) => flatMap(self, identity, options));
|
|
2019
|
+
const flattenArray = (self) => fromChannel(flattenArray$1(self.channel));
|
|
2021
2020
|
const flattenIterable = (self) => flatMap(self, fromIterable);
|
|
2022
2021
|
const merge = dual((args) => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(merge$1(toChannel(self), toChannel(that), options)));
|
|
2023
2022
|
const mergeAll = dual(2, (streams, options) => flatten(fromIterable(streams), options));
|
|
@@ -2053,6 +2052,22 @@ const takeUntil = dual((args) => isStream(args[0]), (self, predicate, options) =
|
|
|
2053
2052
|
return succeed$3(chunk);
|
|
2054
2053
|
});
|
|
2055
2054
|
})));
|
|
2055
|
+
const takeWhile = dual(2, (self, predicate) => transformPull(self, (pull, _scope) => sync(() => {
|
|
2056
|
+
let i = 0;
|
|
2057
|
+
let done$7 = false;
|
|
2058
|
+
const pump = flatMap$2(suspend$2(() => done$7 ? done() : pull), (chunk) => {
|
|
2059
|
+
const out = [];
|
|
2060
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
2061
|
+
if (!predicate(chunk[j], i++)) {
|
|
2062
|
+
done$7 = true;
|
|
2063
|
+
break;
|
|
2064
|
+
}
|
|
2065
|
+
out.push(chunk[j]);
|
|
2066
|
+
}
|
|
2067
|
+
return isReadonlyArrayNonEmpty(out) ? succeed$3(out) : done$7 ? done() : pump;
|
|
2068
|
+
});
|
|
2069
|
+
return pump;
|
|
2070
|
+
})));
|
|
2056
2071
|
const drop = dual(2, (self, n) => {
|
|
2057
2072
|
const count = normalize(n);
|
|
2058
2073
|
if (count === 0) return self;
|
|
@@ -2122,6 +2137,6 @@ const mkString = (self) => runFold$1(self.channel, () => "", (acc, chunk) => acc
|
|
|
2122
2137
|
const runIntoPubSub = dual((args) => isStream(args[0]), (self, pubsub, options) => runIntoPubSubArray(self.channel, pubsub, options));
|
|
2123
2138
|
const toPubSubTake = dual(2, (self, options) => toPubSubTake$1(self.channel, options));
|
|
2124
2139
|
//#endregion
|
|
2125
|
-
export {
|
|
2140
|
+
export { take as $, mapArray as A, makeUnsafe$1 as At, provideContext as B, toLowerCase as Bt, fromEffect as C, shutdownUnsafe as Ct, fromReadableStream as D, make$4 as Dt, fromQueue as E, unbounded$1 as Et, mergeAll as F, interruptAllAs as Ft, runFold as G, run as H, mkString as I, interruptAs as It, runIntoPubSub as J, runForEach as K, onEnd as L, join as Lt, mapEffect as M, getCurrent as Mt, mapError as N, interrupt as Nt, isStream as O, set as Ot, merge as P, interruptAll as Pt, suspend as Q, orDie as R, runIn as Rt, fromChannel as S, poll as St, fromPull as T, unbounded as Tt, runCollect as U, provideService as V, normalizeNonEmpty as Vt, runDrain as W, splitLines as X, runLast as Y, succeed as Z, flattenArray as _, make$1 as _t, catchTags as a, fromTransform as at, fromArrayEffect as b, offerAllUnsafe as bt, die as c, unwrap$1 as ct, ensuring as d, bounded as dt, takeUntil as et, fail as f, end as ft, flatMap as g, failCauseUnsafe as gt, filterMap as h, failCause$2 as ht, catchReason as i, unwrap as it, mapArrayEffect as j, await_ as jt, map as k, update as kt, drop as l, make as lt, filter as m, fail$2 as mt, callback as n, tap as nt, catch_ as o, mapDone as ot, failCause as p, endUnsafe as pt, runForEachArray as q, catchIf as r, transduce as rt, decodeText as s, toTransform as st, broadcast as t, takeWhile as tt, empty as u, makeUnsafe as ut, flattenIterable as v, offer as vt, fromPubSub as w, take$1 as wt, fromAsyncIterable as x, offerUnsafe as xt, fromArray as y, offerAll as yt, pipeThroughChannel as z, camelToSnake as zt };
|
|
2126
2141
|
|
|
2127
|
-
//# sourceMappingURL=Stream-
|
|
2142
|
+
//# sourceMappingURL=Stream-I9SRMlLj.mjs.map
|