clanka 0.16.1 → 0.17.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 +61 -0
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +5 -1
- package/dist/Agent.js.map +1 -1
- package/dist/ClaudeAgent.d.ts +111 -0
- package/dist/ClaudeAgent.d.ts.map +1 -0
- package/dist/ClaudeAgent.js +772 -0
- package/dist/ClaudeAgent.js.map +1 -0
- package/dist/ClaudeAgent.test.d.ts +2 -0
- package/dist/ClaudeAgent.test.d.ts.map +1 -0
- package/dist/ClaudeAgent.test.js +416 -0
- package/dist/ClaudeAgent.test.js.map +1 -0
- package/dist/ModelLayer.d.ts +2 -2
- package/dist/ModelLayer.d.ts.map +1 -1
- package/dist/ModelLayer.js +13 -7
- package/dist/ModelLayer.js.map +1 -1
- package/dist/ModelLayer.test.js +3 -0
- package/dist/ModelLayer.test.js.map +1 -1
- package/dist/ModelsRepo.d.ts +7 -6
- package/dist/ModelsRepo.d.ts.map +1 -1
- package/dist/ModelsRepo.js +44 -27
- package/dist/ModelsRepo.js.map +1 -1
- package/dist/ModelsRepo.test.js +47 -3
- package/dist/ModelsRepo.test.js.map +1 -1
- package/dist/bin/{Effect-4B1lzxy4.mjs → Effect-On-1ks2z.mjs} +50 -2
- package/dist/bin/Effect-On-1ks2z.mjs.map +1 -0
- package/dist/bin/{McpClient-DMfHHEx3.mjs → McpClient-iwrW83Si.mjs} +3 -3
- package/dist/bin/{McpClient-DMfHHEx3.mjs.map → McpClient-iwrW83Si.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-DRycCEdr.mjs → OutputFormatter-DeNaqhQM.mjs} +3 -3
- package/dist/bin/{OutputFormatter-DRycCEdr.mjs.map → OutputFormatter-DeNaqhQM.mjs.map} +1 -1
- package/dist/bin/{Schema-D4fxUgEU.mjs → Schema-B3pFcw4E.mjs} +2 -2
- package/dist/bin/{Schema-D4fxUgEU.mjs.map → Schema-B3pFcw4E.mjs.map} +1 -1
- package/dist/bin/{SemanticSearch-BcLFv9qz.mjs → SemanticSearch-BZIXkWYz.mjs} +4 -4
- package/dist/bin/{SemanticSearch-BcLFv9qz.mjs.map → SemanticSearch-BZIXkWYz.mjs.map} +1 -1
- package/dist/bin/{Stream-i37nF1ep.mjs → Stream-DCB3_nIX.mjs} +91 -12
- package/dist/bin/Stream-DCB3_nIX.mjs.map +1 -0
- package/dist/bin/cli.mjs +1256 -12867
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/helpers-BPLUsjsL.mjs +7191 -0
- package/dist/bin/helpers-BPLUsjsL.mjs.map +1 -0
- package/dist/bin/{rolldown-runtime-zY4HT0JA.mjs → rolldown-runtime-Cjv6nE1W.mjs} +14 -1
- package/dist/bin/server-CBmuybpI.mjs +321 -0
- package/dist/bin/server-CBmuybpI.mjs.map +1 -0
- package/dist/bin/{turndown.cjs-LntFxFyd.mjs → turndown.cjs-cie0BXQQ.mjs} +2 -2
- package/dist/bin/{turndown.cjs-LntFxFyd.mjs.map → turndown.cjs-cie0BXQQ.mjs.map} +1 -1
- package/dist/bin/types-RT_9fFNm.mjs +5278 -0
- package/dist/bin/types-RT_9fFNm.mjs.map +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- 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 +9 -1
- package/src/Agent.ts +7 -1
- package/src/ClaudeAgent.test.ts +526 -0
- package/src/ClaudeAgent.ts +1113 -0
- package/src/ModelLayer.test.ts +4 -0
- package/src/ModelLayer.ts +21 -15
- package/src/ModelsRepo.test.ts +69 -3
- package/src/ModelsRepo.ts +24 -8
- package/src/cli.ts +4 -0
- package/src/index.ts +5 -0
- package/dist/bin/Effect-4B1lzxy4.mjs.map +0 -1
- package/dist/bin/Stream-i37nF1ep.mjs.map +0 -1
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { $i as
|
|
2
|
-
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/count.js
|
|
3
|
-
const normalize = (n) => n > 0 ? Math.floor(n) : 0;
|
|
4
|
-
const normalizeNonEmpty = (n) => Math.max(1, normalize(n));
|
|
5
|
-
//#endregion
|
|
1
|
+
import { $i as suspend$3, $r as doneUnsafe, Ai as exitZipRight, Bi as getCurrentFiber, Bn as matchEffect, Bo as isSome, Br as addFinalizer, Bt as scopedWith, Cc as dual, D as contextWith, Da as lastNonEmpty, Dt as provideService$2, E as context, Et as provideContext$2, Fi as fiberInterruptAs, Ft as runPromiseWith, G as forkChild, Gt as succeedNone$1, Ho as map$4, Hr as close, Ia as headUnsafe, Ii as fiberJoin, In as catchDone, Ji as onExitPrimitive, Jt as sync, K as forkIn, Kr as makeUnsafe$2, Kt as succeedSome, L as flatMap$2, Li as fiberRunIn, Ln as doneExitFromCause, M as exit, Mi as fiberInterrupt, N as fail$3, Ni as fiberInterruptAll, Oi as exitInterrupt$1, Os as toJson, Ot as raceFirst, P as failCause$3, Pi as fiberInterruptAllAs, Pt as runForkWith, Q as interrupt$2, Qi as succeedNone, R as flatMapEager, Ra as fail$4, Ri as flatMap$3, Rn as filterDone, Sa as isArrayNonEmpty, Sc as constant, Si as callback$2, Sr as squash, Tc as identity, U as forEach, Ua as isFailure, Ui as makeLatch, Un as nextPow2, V as fnUntraced, Vr as addFinalizerExit, W as forever, Wa as isSuccess$1, Wi as makeLatchUnsafe, Wo as none, Wr as forkUnsafe, Wt as succeed$3, X as gen, Xa as normalizeNonEmpty, Xs as hasProperty, Ya as normalize, Yt as tap$1, Zi as succeed$4, _o as get$1, _s as exitSucceed, _t as onError, a as andThen, ai as makeUnsafe$3, ar as findError, bi as andThen$1, bs as withFiber$1, bt as onInterrupt, c as as, ci as fail$5, cn as void_, cs as Done, di as interrupt$1, dn as withFiber, ea as sync$1, ei as interruptWith, en as tryPromise, fc as isString$1, fi as isExit$1, fs as args, gi as void_$2, go as empty$2, gs as exitFailCause, gt as never, hi as succeed$2, hn as yieldNow, hs as exitFail, j as ensuring$2, ja as of, jc as pipeArguments, ji as fiberAwait, ka as map$3, ki as exitVoid, li as failCause$4, ln as when, lr as hasInterruptsOnly, m as catchCause$1, mc as isTagged, mi as isSuccess, ms as evaluate, mt as matchCauseEffect, nr as done, nt as logError, oi as asVoidAll, p as callback$1, pi as isFailure$1, ps as causeFail, q as forkScoped, qa as succeed$5, qo as some, qr as provide, qt as suspend$2, ra as void_$1, rn as uninterruptible, si as die$3, st as map$2, t as acquireRelease, ta as uninterruptibleMask, tr as die$2, u as asVoid, un as whileLoop, us as PipeInspectableProto, vs as isExit, vt as onExit$2, w as catch_$2, wa as isReadonlyArrayNonEmpty, wt as promise, xc as constVoid, xi as asSome, ya as fromIterable$1, yc as constTrue, ys as makePrimitive, yt as onExitPrimitive$1, z as flatten$2, zn as isDoneCause, zr as Scope } from "./Effect-On-1ks2z.mjs";
|
|
6
2
|
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/String.js
|
|
7
3
|
const String = globalThis.String;
|
|
8
4
|
const isString = isString$1;
|
|
@@ -1551,6 +1547,13 @@ const asyncQueue = (scope, f, options) => make$1({
|
|
|
1551
1547
|
}).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))));
|
|
1552
1548
|
const callbackArray = (f, options) => fromTransform((_, scope) => map$2(asyncQueue(scope, f, options), takeAll));
|
|
1553
1549
|
const suspend$1 = (evaluate) => fromTransform((upstream, scope) => suspend$2(() => toTransform(evaluate())(upstream, scope)));
|
|
1550
|
+
const fromIterator = (iterator) => fromPull$1(sync(() => {
|
|
1551
|
+
const iter = iterator();
|
|
1552
|
+
return suspend$2(() => {
|
|
1553
|
+
const state = iter.next();
|
|
1554
|
+
return state.done ? done(state.value) : succeed$3(state.value);
|
|
1555
|
+
});
|
|
1556
|
+
}));
|
|
1554
1557
|
const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => {
|
|
1555
1558
|
const size = normalizeNonEmpty(chunkSize);
|
|
1556
1559
|
return fromPull$1(sync(() => {
|
|
@@ -1666,7 +1669,7 @@ const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntrace
|
|
|
1666
1669
|
} else {
|
|
1667
1670
|
const effects = yield* bounded(concurrencyN - 2);
|
|
1668
1671
|
yield* addFinalizer(forkedScope, shutdown(effects));
|
|
1669
|
-
yield* take$1(effects).pipe(flatten$
|
|
1672
|
+
yield* take$1(effects).pipe(flatten$2, flatMap$2((value) => offer(queue, value)), forever({ disableYield: true }), catchCause$1((cause) => failCause$2(queue, cause)), forkIn(forkedScope));
|
|
1670
1673
|
let errorCause;
|
|
1671
1674
|
const onExit = (exit) => {
|
|
1672
1675
|
if (exit._tag === "Success") return;
|
|
@@ -1705,6 +1708,7 @@ const flatMapSequential = (self, f) => fromTransform((upstream, scope) => map$2(
|
|
|
1705
1708
|
return suspend$2(() => childPull ?? makePull);
|
|
1706
1709
|
}));
|
|
1707
1710
|
const flatMapConcurrent = (self, f, options) => self.pipe(map$1(f), mergeAll$1(options));
|
|
1711
|
+
const flatten$1 = (channels) => flatMap$1(channels, identity);
|
|
1708
1712
|
const flattenArray$1 = (self) => transformPull$1(self, (pull) => {
|
|
1709
1713
|
let array;
|
|
1710
1714
|
let index = 0;
|
|
@@ -1925,13 +1929,14 @@ const unwrap$1 = (channel) => fromTransform((upstream, scope) => {
|
|
|
1925
1929
|
return channel.pipe(provide(scope), flatMap$2((channel) => toTransform(channel)(upstream, scope)), flatMap$2((pull_) => pull = pull_));
|
|
1926
1930
|
}));
|
|
1927
1931
|
});
|
|
1928
|
-
const
|
|
1932
|
+
const scoped$1 = (self) => fromTransformBracket((upstream, scope, forkedScope) => map$2(provide(toTransform(self)(upstream, scope), forkedScope), provide(forkedScope)));
|
|
1933
|
+
const onExit$1 = dual(2, (self, finalizer) => fromTransformBracket((upstream, scope, forkedScope) => addFinalizerExit(forkedScope, finalizer).pipe(andThen(toTransform(self)(upstream, scope)))));
|
|
1929
1934
|
const onEnd$1 = dual(2, (self, onEnd) => transformPull$1(self, (pull) => succeed$3(catchDone(pull, (leftover) => flatMap$2(onEnd, () => done(leftover))))));
|
|
1930
|
-
const ensuring$1 = dual(2, (self, finalizer) => onExit(self, (_) => finalizer));
|
|
1935
|
+
const ensuring$1 = dual(2, (self, finalizer) => onExit$1(self, (_) => finalizer));
|
|
1931
1936
|
const runWith = (self, f, onHalt) => suspend$2(() => {
|
|
1932
1937
|
const scope = makeUnsafe$2();
|
|
1933
1938
|
const makePull = toTransform(self)(done(), scope);
|
|
1934
|
-
return catchDone(flatMap$2(makePull, f), onHalt ? onHalt : succeed$3).pipe(onExit$
|
|
1939
|
+
return catchDone(flatMap$2(makePull, f), onHalt ? onHalt : succeed$3).pipe(onExit$2((exit) => close(scope, exit)));
|
|
1935
1940
|
});
|
|
1936
1941
|
const provideContext$1 = dual(2, (self, context) => fromTransform((upstream, scope) => map$2(provideContext$2(toTransform(self)(upstream, scope), context), provideContext$2(context))));
|
|
1937
1942
|
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))));
|
|
@@ -1960,7 +1965,7 @@ const makePubSub = (options) => acquireRelease(options.capacity === "unbounded"
|
|
|
1960
1965
|
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));
|
|
1961
1966
|
const toPubSubTake$1 = dual(2, fnUntraced(function* (self, options) {
|
|
1962
1967
|
const pubsub = yield* makePubSub(options);
|
|
1963
|
-
yield* runForEach$1(self, (value) => publish(pubsub, value)).pipe(onExit$
|
|
1968
|
+
yield* runForEach$1(self, (value) => publish(pubsub, value)).pipe(onExit$2((exit) => end$1(pubsub, exit)), forkScoped);
|
|
1964
1969
|
return pubsub;
|
|
1965
1970
|
}));
|
|
1966
1971
|
//#endregion
|
|
@@ -2006,6 +2011,7 @@ const fromPubSubTake = (pubsub) => fromChannel(fromPubSubTake$1(pubsub));
|
|
|
2006
2011
|
const fromReadableStream = (options) => fromChannel(fromReadableStream$1(options));
|
|
2007
2012
|
const fromAsyncIterable = (iterable, onError) => fromChannel(fromAsyncIterableArray(iterable, onError));
|
|
2008
2013
|
const unwrap = (effect) => fromChannel(unwrap$1(map$2(effect, toChannel)));
|
|
2014
|
+
const scoped = (self) => fromChannel(scoped$1(self.channel));
|
|
2009
2015
|
const map = dual(2, (self, f) => suspend(() => {
|
|
2010
2016
|
let i = 0;
|
|
2011
2017
|
return fromChannel(map$1(self.channel, map$3((o) => f(o, i++))));
|
|
@@ -2018,6 +2024,21 @@ const flatMap = dual((args) => isStream(args[0]), (self, f, options) => self.cha
|
|
|
2018
2024
|
const flatten = dual((args) => isStream(args[0]), (self, options) => flatMap(self, identity, options));
|
|
2019
2025
|
const flattenArray = (self) => fromChannel(flattenArray$1(self.channel));
|
|
2020
2026
|
const flattenIterable = (self) => flatMap(self, fromIterable);
|
|
2027
|
+
const concat = dual(2, (self, that) => {
|
|
2028
|
+
const stream = fromChannel(flatten$1(fromIterator(() => concatChannels(self, that))));
|
|
2029
|
+
concatParts.set(stream, [self, that]);
|
|
2030
|
+
return stream;
|
|
2031
|
+
});
|
|
2032
|
+
const concatParts = new WeakMap();
|
|
2033
|
+
function* concatChannels(self, that) {
|
|
2034
|
+
const stack = [that, self];
|
|
2035
|
+
while (stack.length > 0) {
|
|
2036
|
+
const stream = stack.pop();
|
|
2037
|
+
const parts = concatParts.get(stream);
|
|
2038
|
+
if (parts === void 0) yield stream.channel;
|
|
2039
|
+
else stack.push(parts[1], parts[0]);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2021
2042
|
const merge = dual((args) => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(merge$1(toChannel(self), toChannel(that), options)));
|
|
2022
2043
|
const mergeAll = dual(2, (streams, options) => flatten(fromIterable(streams), options));
|
|
2023
2044
|
const filter = dual(2, (self, predicate) => fromChannel(filterArray(toChannel(self), predicate)));
|
|
@@ -2109,6 +2130,7 @@ const decodeText = dual((args) => isStream(args[0]), (self, options) => suspend(
|
|
|
2109
2130
|
return map(self, (chunk) => decoder.decode(chunk, { stream: true }));
|
|
2110
2131
|
}));
|
|
2111
2132
|
const splitLines = (self) => self.channel.pipe(pipeTo(splitLines$1()), fromChannel);
|
|
2133
|
+
const onExit = dual(2, (self, finalizer) => fromChannel(onExit$1(self.channel, finalizer)));
|
|
2112
2134
|
const onEnd = dual(2, (self, onEnd) => fromChannel(onEnd$1(self.channel, onEnd)));
|
|
2113
2135
|
const ensuring = dual(2, (self, finalizer) => fromChannel(ensuring$1(self.channel, finalizer)));
|
|
2114
2136
|
const provideContext = dual(2, (self, context) => fromChannel(provideContext$1(self.channel, context)));
|
|
@@ -2134,9 +2156,66 @@ const runForEach = dual(2, (self, f) => runForEach$1(self.channel, (arr) => {
|
|
|
2134
2156
|
const runForEachArray = dual(2, (self, f) => runForEach$1(self.channel, f));
|
|
2135
2157
|
const runDrain = (self) => runDrain$1(self.channel);
|
|
2136
2158
|
const mkString = (self) => runFold$1(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
|
|
2159
|
+
const toAsyncIterableWith = dual(2, (self, context) => ({ [Symbol.asyncIterator]() {
|
|
2160
|
+
const runPromise = runPromiseWith(context);
|
|
2161
|
+
const runFork = runForkWith(context);
|
|
2162
|
+
const scope = makeUnsafe$2();
|
|
2163
|
+
let pull;
|
|
2164
|
+
let currentIter;
|
|
2165
|
+
let currentFiber;
|
|
2166
|
+
let closePromise;
|
|
2167
|
+
const close$1 = (exit) => {
|
|
2168
|
+
if (closePromise) return closePromise;
|
|
2169
|
+
const fiber = currentFiber;
|
|
2170
|
+
closePromise = runPromise(as(andThen(fiber ? interrupt(fiber) : void_, close(scope, exit)), {
|
|
2171
|
+
done: true,
|
|
2172
|
+
value: void 0
|
|
2173
|
+
}));
|
|
2174
|
+
return closePromise;
|
|
2175
|
+
};
|
|
2176
|
+
const closeAndReportError = async (exit) => {
|
|
2177
|
+
try {
|
|
2178
|
+
await close$1(exit);
|
|
2179
|
+
} catch (error) {
|
|
2180
|
+
await runPromise(logError("Suppressed error while closing Stream async iterator", error));
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
return {
|
|
2184
|
+
async next() {
|
|
2185
|
+
if (closePromise) return closePromise;
|
|
2186
|
+
if (currentIter) {
|
|
2187
|
+
const next = currentIter.next();
|
|
2188
|
+
if (!next.done) return next;
|
|
2189
|
+
currentIter = void 0;
|
|
2190
|
+
}
|
|
2191
|
+
const fiber = runFork(pull ?? flatMap$2(toPullScoped(self.channel, scope), (nextPull) => {
|
|
2192
|
+
pull = nextPull;
|
|
2193
|
+
return nextPull;
|
|
2194
|
+
}));
|
|
2195
|
+
currentFiber = fiber;
|
|
2196
|
+
const exit = await runPromise(await_(fiber));
|
|
2197
|
+
if (currentFiber === fiber) currentFiber = void 0;
|
|
2198
|
+
if (isSuccess(exit)) {
|
|
2199
|
+
currentIter = exit.value[Symbol.iterator]();
|
|
2200
|
+
return currentIter.next();
|
|
2201
|
+
} else if (isDoneCause(exit.cause)) return close$1(void_$2);
|
|
2202
|
+
if (closePromise && hasInterruptsOnly(exit.cause)) return closePromise;
|
|
2203
|
+
await closeAndReportError(exit);
|
|
2204
|
+
throw squash(exit.cause);
|
|
2205
|
+
},
|
|
2206
|
+
return() {
|
|
2207
|
+
return close$1(void_$2);
|
|
2208
|
+
},
|
|
2209
|
+
async throw(error) {
|
|
2210
|
+
await closeAndReportError(die$3(error));
|
|
2211
|
+
throw error;
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
} }));
|
|
2215
|
+
const toAsyncIterable = (self) => toAsyncIterableWith(self, empty$2());
|
|
2137
2216
|
const runIntoPubSub = dual((args) => isStream(args[0]), (self, pubsub, options) => runIntoPubSubArray(self.channel, pubsub, options));
|
|
2138
2217
|
const toPubSubTake = dual(2, (self, options) => toPubSubTake$1(self.channel, options));
|
|
2139
2218
|
//#endregion
|
|
2140
|
-
export {
|
|
2219
|
+
export { splitLines as $, map as A, unbounded$1 as At, orDie as B, interruptAs as Bt, fromChannel as C, offerAll as Ct, fromQueue as D, shutdownUnsafe as Dt, fromPull as E, poll as Et, merge as F, await_ as Ft, runCollect as G, provideContext as H, runIn as Ht, mergeAll as I, getCurrent as It, runForEach as J, runDrain as K, mkString as L, interrupt as Lt, mapArrayEffect as M, set as Mt, mapEffect as N, update as Nt, fromReadableStream as O, take$1 as Ot, mapError as P, makeUnsafe$1 as Pt, scoped as Q, onEnd as R, interruptAll as Rt, fromAsyncIterable as S, offer as St, fromPubSub as T, offerUnsafe as Tt, provideService as U, camelToSnake as Ut, pipeThroughChannel as V, join as Vt, run as W, toLowerCase as Wt, runIntoPubSub as X, runForEachArray as Y, runLast as Z, flatMap as _, endUnsafe as _t, catchTags as a, tap as at, fromArray as b, failCauseUnsafe as bt, decodeText as c, unwrap as ct, empty as d, toTransform as dt, succeed as et, ensuring as f, unwrap$1 as ft, filterMap as g, end as gt, filter as h, bounded as ht, catchReason as i, takeWhile as it, mapArray as j, make$4 as jt, isStream as k, unbounded as kt, die as l, fromTransform as lt, failCause as m, makeUnsafe as mt, callback as n, take as nt, catch_ as o, toAsyncIterable as ot, fail as p, make as pt, runFold as q, catchIf as r, takeUntil as rt, concat as s, transduce as st, broadcast as t, suspend as tt, drop as u, mapDone as ut, flattenArray as v, fail$2 as vt, fromEffect as w, offerAllUnsafe as wt, fromArrayEffect as x, make$1 as xt, flattenIterable as y, failCause$2 as yt, onExit as z, interruptAllAs as zt };
|
|
2141
2220
|
|
|
2142
|
-
//# sourceMappingURL=Stream-
|
|
2221
|
+
//# sourceMappingURL=Stream-DCB3_nIX.mjs.map
|