clanka 0.10.0 → 0.11.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 +26 -0
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +1 -0
- package/dist/Agent.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 +4 -0
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +6 -1
- package/dist/AgentTools.js.map +1 -1
- package/dist/AgentToolsReadFile.test.d.ts +2 -0
- package/dist/AgentToolsReadFile.test.d.ts.map +1 -0
- package/dist/AgentToolsReadFile.test.js +49 -0
- package/dist/AgentToolsReadFile.test.js.map +1 -0
- package/dist/bin/{Effect-2jPlJ8eu.mjs → Effect-zUBunSAW.mjs} +70 -67
- package/dist/bin/Effect-zUBunSAW.mjs.map +1 -0
- package/dist/bin/{McpClient-1W508adc.mjs → McpClient-CnP2P7c9.mjs} +19 -19
- package/dist/bin/{McpClient-1W508adc.mjs.map → McpClient-CnP2P7c9.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-BFAv48k9.mjs → OutputFormatter-BPdc6RmH.mjs} +3 -3
- package/dist/bin/{OutputFormatter-BFAv48k9.mjs.map → OutputFormatter-BPdc6RmH.mjs.map} +1 -1
- package/dist/bin/{Schema-D-7VuCiC.mjs → Schema-C2Y2y3tU.mjs} +243 -94
- package/dist/bin/Schema-C2Y2y3tU.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-Cb8aqvGv.mjs → SemanticSearch-BKZxP19F.mjs} +26 -20
- package/dist/bin/SemanticSearch-BKZxP19F.mjs.map +1 -0
- package/dist/bin/{Stream-DEu2tfCV.mjs → Stream-BvmRbTMu.mjs} +44 -27
- package/dist/bin/Stream-BvmRbTMu.mjs.map +1 -0
- package/dist/bin/cli.mjs +2874 -2820
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{index.min-CI3qqohw.mjs → index.min-DbZbUHX3.mjs} +3 -3
- package/dist/bin/index.min-DbZbUHX3.mjs.map +1 -0
- package/dist/bin/turndown.cjs-DK29wZw3.mjs.map +1 -1
- package/dist/cli.js +23 -6
- package/dist/cli.js.map +1 -1
- package/package.json +14 -14
- package/src/Agent.ts +1 -0
- package/src/AgentExecutor.test.ts +31 -5
- package/src/AgentSkills.test.ts +0 -1
- package/src/AgentSubagents.test.ts +20 -6
- package/src/AgentTools.ts +12 -0
- package/src/AgentToolsReadFile.test.ts +61 -0
- package/src/cli.ts +46 -8
- package/dist/bin/Effect-2jPlJ8eu.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,6 +1,6 @@
|
|
|
1
|
-
import { $a as Service, $i as compose, $t as try_, At as request$1, B as fn, Br as provide,
|
|
2
|
-
import { B as provideService$1,
|
|
3
|
-
import {
|
|
1
|
+
import { $a as Service, $i as compose, $t as try_, At as request$1, B as fn, Br as provide, C as catchTags, Ca as sort, Cn as remove, Co as isNone, Cs as byReferenceUnsafe, Ct as orElseSucceed, D as contextWith, Do as map$1, Dt as provideService, E as context, Et as provideContext, Fs as hasProperty, Ga as minutes, Gr as done, Ha as isZero, Ho as make$10, Hs as isNotNull, I as filterOrFail, Io as Number$1, Ir as close, Ja as seconds, Ji as updateContext, Jn as combine, Jr as into, Jt as tap, Ko as Prototype, Kr as doneUnsafe, Kt as suspend, L as flatMap, Li as makeSpanUnsafe, Lt as scope, Mn as spaced, Mo as some, Mt as retry, N as fail, Nr as Scope, Nt as runFork, O as delay, Oi as fiberJoin, Oo as match, Or as provide$1, Os as hash, P as failCause$1, Pr as addFinalizer, Ps as symbol$1, Pt as runForkWith, Q as interrupt, Qa as Reference, Qn as filterInterruptors, Qr as makeUnsafe$2, Qt as tryPromise, Ra as fromInputUnsafe, Rr as make$7, Rt as scoped, S as catchTag, Sn as make$8, St as orDie, Tn as size, To as isSome, Ts as symbol, U as forEach$1, Ui as succeed$1, Un as NoSuchElementError, Ur as TracerTimingEnabled, Ut as succeed, V as fnUntraced, Va as isFinite, Vi as onExitUnsafe, Vt as serviceOption, W as forever, Wa as millis, X as gen, Ya as toMillis, Yi as void_$2, Yo as PipeInspectableProto, Yt as tapCause, Z as ignore, Za as zero, Zi as ParentSpan, _o as fromNullishOr, _t as onError, a as andThen, aa as empty, ai as isFailure, an as useSpan, as as withFiber$1, b as catchNoSuchElement, bn as get$2, br as effectContext, c as as, cc as flow, ci as void_$3, ea as has, eo as add, et as isEffect, fa as isArrayNonEmpty, fc as pipe, fn as withSpan, fo as filter, g as catchDefect, gn as Class$1, hc as pipeArguments, hi as contextWith$1, ho as flatten, hr as reasonAnnotations, i as all, ic as constUndefined, io as getOrUndefined, it as logInfo, ji as forkUnsafe, k as die, ko as none, kr as provideMerge, la as flatMapNullishOr, lc as identity, li as ClockRef, ln as withFiber, lo as merge, m as catchCause, mt as matchCauseEffect, n as acquireUseRelease, ni as failCause, nn as uninterruptibleMask, no as get$1, o as annotateCurrentSpan, oi as isSuccess, on as void_$1, oo as getUnsafe, ot as makeSpanScoped, pt as matchCauseEager, q as forkScoped, qt as sync, ro as getOption, rr as hasInterruptsOnly, s as annotateLogs, sc as dual, si as succeed$2, so as make$9, sr as isFailReason, ss as assignProperty, st as map, t as acquireRelease, ta as toPredicate, ti as fail$1, tr as fromReasons, tt as logDebug, u as asVoid, ua as fromIterable, un as withLogSpan, ur as makeDieReason, ut as mapError, vi as endSpan, vn as empty$1, vt as onExit, w as catch_, wi as fiberInterrupt, wn as set, ws as equals, xn as isEmpty, xr as effectDiscard, y as catchIf, ya as map$2, yi as exitHasInterrupts, yn as forEach, yr as effect, yt as onExitPrimitive, za as infinity } from "./Effect-zUBunSAW.mjs";
|
|
2
|
+
import { B as provideService$1, Ft as interruptAs, H as runCollect, It as join$1, Lt as runIn, T as fromQueue, U as runDrain, b as fromArrayEffect, bt as offerUnsafe, c as die$1, ct as make$12, g as flatMap$1, gt as make$11, ht as failCauseUnsafe, lt as makeUnsafe$3, rt as unwrap, tt as tap$1, y as fromArray } from "./Stream-BvmRbTMu.mjs";
|
|
3
|
+
import { $ as brand, $n as now, A as Option, At as optional, C as Natural, Cn as dateTimeUtcFromInput, En as transform, Ht as evolve, I as String$1, O as NullOr, R as Struct$2, Rt as toType, Sn as transformOptional, Tt as isSchema, V as TaggedError, X as Union$2, Zn as formatIsoDate, ar as Clock, at as decodeUnknownEffect, bn as transform$1, c as DateTimeUtcFromDate, ct as encodeEffect, d as Defect, er as removeTime, ft as instanceOf, i as BooleanFromBit, it as decodeTo, j as OptionFromNullOr, jt as optionalKey, k as Number$2, kt as mutable, l as DateTimeUtcFromMillis, n as ArraySchema, o as Class$2, or as monotonicTimeNanos, r as Boolean, s as DateTimeUtc, u as DateTimeUtcFromString, ur as TaggedError$1, wn as map$3, zt as withConstructorDefault } from "./Schema-C2Y2y3tU.mjs";
|
|
4
4
|
import { a as makeGrouped, c as SemanticSearch, d as map$4, f as make$13, g as FileSystem, h as Path, i as batchN, l as maybeRemoveFile, m as Console, n as EmbeddingModel, o as setDelay, p as ChildProcessSpawner, r as EmbeddingRequest, s as withSpan$1, t as Dimensions, u as maybeUpdateFile } from "./cli.mjs";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { DatabaseSync, backup } from "node:sqlite";
|
|
@@ -8,7 +8,7 @@ import TreeSitter from "tree-sitter";
|
|
|
8
8
|
import TreeSitterJavaScript from "tree-sitter-javascript";
|
|
9
9
|
import TreeSitterTypeScript from "tree-sitter-typescript";
|
|
10
10
|
import { getLoadablePath } from "sqlite-vec";
|
|
11
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
11
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/reactivity/Reactivity.js
|
|
12
12
|
const TypeId$6 = "~effect/reactivity/Reactivity";
|
|
13
13
|
const Reactivity = Service("effect/reactivity/Reactivity");
|
|
14
14
|
const make$6 = sync(() => {
|
|
@@ -122,7 +122,7 @@ const keysToHashes = (keys, f) => {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
//#endregion
|
|
125
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
125
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/SqlError.js
|
|
126
126
|
const TypeId$5 = "~effect/sql/SqlError";
|
|
127
127
|
const ReasonTypeId = "~effect/sql/SqlError/Reason";
|
|
128
128
|
const ReasonFields = {
|
|
@@ -296,7 +296,7 @@ var ResultLengthMismatch = class extends TaggedError("effect/sql/ResultLengthMis
|
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
298
|
//#endregion
|
|
299
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
299
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/Statement.js
|
|
300
300
|
const FragmentTypeId = "~effect/sql/Statement/Fragment";
|
|
301
301
|
const fragment = (segments) => ({
|
|
302
302
|
[FragmentTypeId]: FragmentTypeId,
|
|
@@ -805,7 +805,7 @@ function in_() {
|
|
|
805
805
|
}
|
|
806
806
|
const neverFragment = fragment([literal("1=0")]);
|
|
807
807
|
//#endregion
|
|
808
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
808
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/SqlClient.js
|
|
809
809
|
const TypeId$4 = "~effect/sql/SqlClient";
|
|
810
810
|
const SqlClient = Service("effect/sql/SqlClient");
|
|
811
811
|
let clientIdCounter = 0;
|
|
@@ -889,6 +889,7 @@ const makeSqliteAcquirers = (options) => {
|
|
|
889
889
|
const lease = uninterruptibleMask((restore) => flatMap(scope, (scope) => restore(semaphore.take(1)).pipe(andThen(addFinalizer(scope, semaphore.release(1))), andThen(available))));
|
|
890
890
|
return {
|
|
891
891
|
acquirer: lease,
|
|
892
|
+
borrower: (f) => semaphore.withPermit(flatMap(available, f)),
|
|
892
893
|
transactionAcquirer: lease,
|
|
893
894
|
onCommitFailure: (conn) => tapCause(rollback(conn), (cause) => sync(() => poison(cause)))
|
|
894
895
|
};
|
|
@@ -935,7 +936,7 @@ const makeWithTransaction = (options) => {
|
|
|
935
936
|
const TransactionConnection = (clientId) => Service(`effect/sql/SqlClient/TransactionConnection/${clientId}`);
|
|
936
937
|
const SafeIntegers = Reference("effect/sql/SqlClient/SafeIntegers", { defaultValue: () => false });
|
|
937
938
|
//#endregion
|
|
938
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
939
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Cache.js
|
|
939
940
|
const TypeId$3 = "~effect/Cache";
|
|
940
941
|
const makeWith = (lookup, options) => contextWith$1((context) => {
|
|
941
942
|
const self = Object.create(Proto$1);
|
|
@@ -1028,7 +1029,7 @@ const checkCapacity = (self) => {
|
|
|
1028
1029
|
}
|
|
1029
1030
|
};
|
|
1030
1031
|
//#endregion
|
|
1031
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1032
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/schema/VariantSchema.js
|
|
1032
1033
|
const TypeId$2 = "~effect/schema/VariantSchema";
|
|
1033
1034
|
const cacheSymbol = Symbol.for(`${TypeId$2}/cache`);
|
|
1034
1035
|
const defaultCacheSymbol = Symbol.for(`${TypeId$2}/defaultCache`);
|
|
@@ -1133,7 +1134,7 @@ const Union$1 = (members, defaultVariant, variants) => {
|
|
|
1133
1134
|
return VariantUnion;
|
|
1134
1135
|
};
|
|
1135
1136
|
//#endregion
|
|
1136
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1137
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/schema/Model.js
|
|
1137
1138
|
const { Class, Field, FieldExcept, FieldOnly, Struct, Union, extract, fieldEvolve } = make$3({
|
|
1138
1139
|
variants: [
|
|
1139
1140
|
"select",
|
|
@@ -1207,7 +1208,7 @@ const DateTimeUpdateFromNumber = Field({
|
|
|
1207
1208
|
json: DateTimeUtcFromMillis
|
|
1208
1209
|
});
|
|
1209
1210
|
//#endregion
|
|
1210
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1211
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/SqlResolver.js
|
|
1211
1212
|
const SqlRequestProto = {
|
|
1212
1213
|
...Class$1.prototype,
|
|
1213
1214
|
[symbol](that) {
|
|
@@ -1338,14 +1339,14 @@ function transactionKey(entry) {
|
|
|
1338
1339
|
return byReferenceUnsafe(conn);
|
|
1339
1340
|
}
|
|
1340
1341
|
//#endregion
|
|
1341
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1342
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/SqlSchema.js
|
|
1342
1343
|
const findAll = (options) => {
|
|
1343
1344
|
const encodeRequest = encodeEffect(options.Request);
|
|
1344
1345
|
const decode = decodeUnknownEffect(mutable(ArraySchema(options.Result)));
|
|
1345
1346
|
return (request) => flatMap(flatMap(encodeRequest(request), options.execute), decode);
|
|
1346
1347
|
};
|
|
1347
1348
|
//#endregion
|
|
1348
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1349
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/SqlModel.js
|
|
1349
1350
|
const makeResolvers = (Model, options) => gen(function* () {
|
|
1350
1351
|
const sql = yield* SqlClient;
|
|
1351
1352
|
const idSchema = Model.fields[options.idColumn];
|
|
@@ -1959,7 +1960,7 @@ const layer$3 = effect(CodeChunker, gen(function* () {
|
|
|
1959
1960
|
});
|
|
1960
1961
|
}));
|
|
1961
1962
|
//#endregion
|
|
1962
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1963
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/FiberHandle.js
|
|
1963
1964
|
const TypeId$1 = "~effect/FiberHandle";
|
|
1964
1965
|
const isFiberHandle = (u) => hasProperty(u, TypeId$1);
|
|
1965
1966
|
const Proto = {
|
|
@@ -2030,7 +2031,7 @@ const runImpl = (self, effect, options) => withFiber((parent) => {
|
|
|
2030
2031
|
return succeed(fiber);
|
|
2031
2032
|
});
|
|
2032
2033
|
//#endregion
|
|
2033
|
-
//#region node_modules/.pnpm/@effect+sql-sqlite-node@4.0.
|
|
2034
|
+
//#region node_modules/.pnpm/@effect+sql-sqlite-node@4.0.5_effect@4.0.5/node_modules/@effect/sql-sqlite-node/dist/SqliteClient.js
|
|
2034
2035
|
const ATTR_DB_SYSTEM_NAME = "db.system.name";
|
|
2035
2036
|
const MAX_BUSY_TIMEOUT = 2147483647;
|
|
2036
2037
|
const NANOS_PER_MILLI = BigInt(1e6);
|
|
@@ -2055,9 +2056,13 @@ const make$1 = (options) => gen(function* () {
|
|
|
2055
2056
|
});
|
|
2056
2057
|
yield* exec(`PRAGMA busy_timeout = ${busyTimeout}`);
|
|
2057
2058
|
if (options.disableWAL !== true && !options.readonly) {
|
|
2059
|
+
const enableWAL = try_({
|
|
2060
|
+
try: () => db.prepare("PRAGMA journal_mode = WAL").get(),
|
|
2061
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to configure database", "connect") })
|
|
2062
|
+
});
|
|
2058
2063
|
const deadline = (yield* monotonicTimeNanos) + BigInt(busyTimeout) * NANOS_PER_MILLI;
|
|
2059
2064
|
const remainingMillis = map(monotonicTimeNanos, (now) => Math.max(0, Number((deadline - now) / NANOS_PER_MILLI)));
|
|
2060
|
-
yield* remainingMillis.pipe(flatMap((remaining) => exec(`PRAGMA busy_timeout = ${remaining}`)), andThen(
|
|
2065
|
+
yield* remainingMillis.pipe(flatMap((remaining) => exec(`PRAGMA busy_timeout = ${remaining}`)), andThen(enableWAL), retry({
|
|
2061
2066
|
while: (error) => error.reason._tag === "LockTimeoutError" && map(remainingMillis, (remaining) => remaining > 0),
|
|
2062
2067
|
schedule: spaced("10 millis")
|
|
2063
2068
|
}));
|
|
@@ -2157,13 +2162,14 @@ const make$1 = (options) => gen(function* () {
|
|
|
2157
2162
|
}
|
|
2158
2163
|
});
|
|
2159
2164
|
});
|
|
2160
|
-
const { acquirer, onCommitFailure, transactionAcquirer } = makeSqliteAcquirers({
|
|
2165
|
+
const { acquirer, borrower, onCommitFailure, transactionAcquirer } = makeSqliteAcquirers({
|
|
2161
2166
|
connection: succeed(connection),
|
|
2162
2167
|
semaphore: yield* make$12(1),
|
|
2163
2168
|
isTransaction: (conn) => conn.isTransaction()
|
|
2164
2169
|
});
|
|
2165
2170
|
return Object.assign(yield* make$4({
|
|
2166
2171
|
acquirer,
|
|
2172
|
+
borrower,
|
|
2167
2173
|
compiler,
|
|
2168
2174
|
transactionAcquirer,
|
|
2169
2175
|
onCommitFailure,
|
|
@@ -2193,7 +2199,7 @@ const setLoadExtensionEnabled = (db, enabled) => {
|
|
|
2193
2199
|
if (typeof db.enableLoadExtension === "function") db.enableLoadExtension(enabled);
|
|
2194
2200
|
};
|
|
2195
2201
|
//#endregion
|
|
2196
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
2202
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/sql/Migrator.js
|
|
2197
2203
|
var __rewriteRelativeImportExtension = void 0 && (void 0).__rewriteRelativeImportExtension || function(path, preserveJsx) {
|
|
2198
2204
|
if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
2199
2205
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
@@ -2302,7 +2308,7 @@ const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishO
|
|
|
2302
2308
|
succeed(migrations[key])
|
|
2303
2309
|
]), sort(migrationOrder), succeed);
|
|
2304
2310
|
//#endregion
|
|
2305
|
-
//#region node_modules/.pnpm/@effect+sql-sqlite-node@4.0.
|
|
2311
|
+
//#region node_modules/.pnpm/@effect+sql-sqlite-node@4.0.5_effect@4.0.5/node_modules/@effect/sql-sqlite-node/dist/SqliteMigrator.js
|
|
2306
2312
|
const run = make({});
|
|
2307
2313
|
const layer$1 = (options) => effectDiscard(run(options));
|
|
2308
2314
|
//#endregion
|
|
@@ -2446,4 +2452,4 @@ const layer = (options) => effect(SemanticSearch, gen(function* () {
|
|
|
2446
2452
|
//#endregion
|
|
2447
2453
|
export { SemanticSearch, chunkEmbeddingInput, layer, makeEmbeddingResolver, maybeRemoveFile, maybeUpdateFile };
|
|
2448
2454
|
|
|
2449
|
-
//# sourceMappingURL=SemanticSearch-
|
|
2455
|
+
//# sourceMappingURL=SemanticSearch-BKZxP19F.mjs.map
|