clanka 0.24.2 → 0.24.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/Agent.d.ts.map +1 -1
  2. package/dist/Agent.js +23 -10
  3. package/dist/Agent.js.map +1 -1
  4. package/dist/Agent.test.js +137 -0
  5. package/dist/Agent.test.js.map +1 -1
  6. package/dist/ClaudeAgent.d.ts.map +1 -1
  7. package/dist/ClaudeAgent.js +5 -1
  8. package/dist/ClaudeAgent.js.map +1 -1
  9. package/dist/ClaudeAgent.test.js +45 -0
  10. package/dist/ClaudeAgent.test.js.map +1 -1
  11. package/dist/OutputFormatter.d.ts +1 -1
  12. package/dist/OutputFormatter.d.ts.map +1 -1
  13. package/dist/OutputFormatter.js +42 -2
  14. package/dist/OutputFormatter.js.map +1 -1
  15. package/dist/OutputFormatter.test.d.ts +2 -0
  16. package/dist/OutputFormatter.test.d.ts.map +1 -0
  17. package/dist/OutputFormatter.test.js +93 -0
  18. package/dist/OutputFormatter.test.js.map +1 -0
  19. package/dist/bin/{Stream-C51usiew.mjs → AiError-fiHIiGOy.mjs} +469 -34
  20. package/dist/bin/{Latch-BnrpWMd1.mjs → Latch-D1909CI6.mjs} +1 -1
  21. package/dist/bin/{McpClient-DoPNaNzW.mjs → McpClient-CXwyRd_3.mjs} +2 -3
  22. package/dist/bin/{OutputFormatter-U02YKTfy.mjs → OutputFormatter-B8yF7iiq.mjs} +40 -4
  23. package/dist/bin/{Schema-Box_9VZG.mjs → Schema-D629S5yu.mjs} +5459 -278
  24. package/dist/bin/{SemanticSearch-CH125AHH.mjs → SemanticSearch-BlcfFvPr.mjs} +14 -15
  25. package/dist/bin/cli.mjs +393 -819
  26. package/dist/bin/{upgrade-HMRGSqq8.mjs → upgrade-E_f-q2h8.mjs} +3 -4
  27. package/package.json +1 -1
  28. package/src/Agent.test.ts +198 -0
  29. package/src/Agent.ts +27 -10
  30. package/src/ClaudeAgent.test.ts +62 -0
  31. package/src/ClaudeAgent.ts +7 -1
  32. package/src/OutputFormatter.test.ts +158 -0
  33. package/src/OutputFormatter.ts +56 -1
  34. package/dist/bin/Effect-5XYMLOiB.mjs +0 -5183
@@ -1,7 +1,6 @@
1
- import { $ as ignoreCause, $i as onExitUnsafe, $r as TracerTimingEnabled, Ai as endSpan, An as size, Ao as merge, As as assignProperty, B as fn, Ba as sort, Bc as pipeArguments, C as catchTags, Cn as empty$1, Co as get$1, Cr as reasonAnnotations, D as delay, Di as contextWith$1, Dn as make$8, Do as getUnsafe, Dr as effect, E as contextWith, Ea as fromIterable, En as isEmpty, Ft as runFork, Go as isNone, Gr as close, Hr as Scope, I as filterOrFail, Ia as map$1, Ii as fiberInterrupt, Ir as provide$1, It as runForkWith, J as forkScoped, Jr as make$7, Js as symbol, Ks as byReferenceUnsafe, Kt as succeed, L as flatMap, Lc as pipe, Ln as spaced, Lo as flatten, Lr as provideMerge, M as fail, Mc as dual, Mt as request$1, N as failCause$1, Nc as flow, O as die, On as remove, Oo as make$9, Or as effectContext, Os as withFiber$1, Ot as provideContext, Pc as identity, Po as filter, Pt as retry, Q as ignore, Qt as tapCause, S as catchTag, T as context, Ta as flatMapNullishOr, Tn as get$2, To as getOrUndefined, Tt as orElseSucceed, U as forEach, Ui as forkUnsafe, Ur as addFinalizer, V as fnUntraced, Vt as scoped, W as forever, Wt as serviceOption, Xo as match, Xr as provide, Xt as sync, Yi as makeSpanUnsafe, Yo as map$2, Yt as suspend, Z as gen, Zn as NoSuchElementError, Zo as none, Zs as hash, Zt as tap, _i as isFailure, _n as withSpan, a as andThen, ac as hasProperty, b as catchNoSuchElement, ba as empty, bi as void_$3, bo as Service, bt as onExit, c as as, ca as updateContext, ci as makeUnsafe$2, co as isFinite, cr as fromReasons, ct as makeSpanScoped, da as ParentSpan, dn as void_$1, do as millis, es as some, et as interrupt, fc as isNotNull, fi as fail$1, fo as minutes, ft as mapError, g as catchDefect, go as toMillis, gt as matchCauseEffect, ha as toPredicate, hn as withLogSpan, ho as seconds, hr as isFailReason, hs as Prototype, ht as matchCauseEager, i as all, ic as symbol$1, ii as into, in as try_, io as fromInputUnsafe, is as Number$1, ji as exitHasInterrupts, jo as omit, ka as isArrayNonEmpty, kc as constUndefined, kn as set, kr as effectDiscard, kt as provideService, la as void_$2, lo as isZero, lt as map, m as catchCause, ma as has, mn as withFiber, n as acquireUseRelease, nr as combine, nt as isEffect, o as annotateCurrentSpan, oo as infinity, or as filterInterruptors, ot as logInfo, pa as compose, pi as failCause, qo as isSome, qs as equals, ra as succeed$1, rn as tryPromise, rt as logDebug, s as annotateLogs, sn as uninterruptibleMask, t as acquireRelease, ti as doneUnsafe, u as asVoid, un as useSpan, ur as hasInterruptsOnly, us as make$10, vi as isSuccess, vo as zero, vr as makeDieReason, vs as PipeInspectableProto, w as catch_, wn as forEach$1, wo as getOption, wt as orDie, xi as ClockRef, xn as Class$1, xo as add, xt as onExitPrimitive, y as catchIf, yi as succeed$2, yo as Reference, yt as onError, zi as fiberJoin, zo as fromNullishOr } from "./Effect-5XYMLOiB.mjs";
2
- import { B as String$1, Cn as evolve, E as Natural, H as Struct$2, Jr as now, K as TaggedError, Kr as formatIsoDate, M as Number$2, N as Option, P as OptionFromNullOr, Yr as removeTime, _r as transform, a as BooleanFromBit, bn as withConstructorDefault, ci as TaggedError$1, d as DateTimeUtcFromMillis, dn as optional, dt as decodeTo, f as DateTimeUtcFromString, fn as optionalKey, fr as transformOptional, ft as decodeUnknownEffect, ht as encodeEffect, i as Boolean, ii as monotonicTimeNanos, j as NullOr, l as DateTimeUtc, mr as map$3, n as ArraySchema, ni as Clock, ot as brand, p as Defect, pr as dateTimeUtcFromInput, rt as Union$2, s as Class$2, tn as isSchema, u as DateTimeUtcFromDate, un as mutable, ur as transform$1, yn as toType, yt as instanceOf } from "./Schema-Box_9VZG.mjs";
3
- import { C as ChildProcessSpawner, E as FileSystem, S as make$11, T as Path, a as makeGrouped, d as maybeRemoveFile, f as maybeUpdateFile, i as batchN, n as EmbeddingModel, o as setDelay, p as map$4, r as EmbeddingRequest, s as withSpan$1, t as Dimensions, u as SemanticSearch, w as Console } from "./cli.mjs";
4
- import { A as fromQueue, C as fromArray, Ct as failCauseUnsafe, G as provideService$1, Ht as interruptAllAs, J as runDrain, Ot as offerUnsafe, Ut as join$1, Wt as runIn, _t as makeUnsafe$3, dt as unwrap, gt as make$13, q as runCollect, st as tap$1, u as die$1, w as fromArrayEffect, wt as make$12, y as flatMap$1 } from "./Stream-C51usiew.mjs";
1
+ import { $c as void_$2, $i as interrupt, $l as isZero, Aa as request$1, B as String$1, Bd as pipeArguments, Bi as fn, Bs as addFinalizer, Bu as Number$2, Ca as orElseSucceed, Ci as catchTag, Cn as evolve, Co as isEmpty, Da as provideService, Di as contextWith, Dl as map$2, Do as size, E as Natural, Ea as provideContext, Ec as exitHasInterrupts, Ei as context, Eo as set, Es as effectDiscard, Fd as dual, Fu as none, Go as Clock, Gs as make$7, H as Struct$2, Hc as makeSpanUnsafe, Hi as forEach, Hs as close, Hu as make$10, Id as flow, Ii as filterOrFail, Ja as tap, Jr as now, K as TaggedError, Ka as suspend, Kr as formatIsoDate, Ku as PipeInspectableProto, Ld as identity, Li as flatMap, M as Number$1, Ma as retry, Md as constUndefined, Mu as isSome, N as Option, Na as runFork, Ni as fail, Ns as provide$1, Nu as map$3, Oi as delay, P as OptionFromNullOr, Pa as runForkWith, Pc as fiberJoin, Pi as failCause$1, Po as spaced, Ps as provideMerge, Pu as match, Qc as updateContext, Qi as ignoreCause, Ql as isFinite, Qs as doneUnsafe, Ra as scoped, Rc as forkUnsafe, Ru as some, Sa as orDie, So as get$2, Tc as endSpan, Ti as catch_, To as remove, Ts as effectContext, Tu as fromNullishOr, Ua as succeed, Ui as forever, Va as serviceOption, Vi as fnUntraced, Wc as onExitUnsafe, Wu as Prototype, Xi as gen, Xo as NoSuchElementError, Xs as TracerTimingEnabled, Ya as tapCause, Yl as fromInputUnsafe, Yr as removeTime, Zi as ignore, Zl as infinity, _a as onError, _c as void_$3, _d as hasProperty, _i as catchDefect, _l as flatMapNullishOr, _r as transform, _u as merge, a as BooleanFromBit, aa as logInfo, ac as makeUnsafe$2, ai as all, al as TaggedError$1, as as filterInterruptors, au as zero, bi as catchIf, bn as withConstructorDefault, bo as empty$1, bs as reasonAnnotations, ca as map, ci as annotateLogs, cl as has, co as void_$1, cu as add, d as DateTimeUtcFromMillis, da as mapError, dd as byReferenceUnsafe, di as asVoid, dn as optional, do as withFiber, dt as decodeTo, du as getOption, eo as tryPromise, f as DateTimeUtcFromString, fd as equals, fl as empty, fn as optionalKey, fo as withLogSpan, fr as transformOptional, ft as decodeUnknownEffect, fu as getOrUndefined, gc as succeed$2, gd as symbol$1, gs as makeDieReason, hc as isSuccess, hi as catchCause, ht as encodeEffect, hu as make$9, i as Boolean, io as uninterruptibleMask, iu as toMillis, j as NullOr, jc as fiberInterrupt, jl as sort, ju as isNone, ki as die, l as DateTimeUtc, lc as fail$1, li as as, ll as toPredicate, ls as hasInterruptsOnly, ma as matchCauseEffect, mc as isFailure, md as hash, mo as withSpan, mr as map$1, ms as isFailReason, mu as getUnsafe, n as ArraySchema, na as logDebug, nd as assignProperty, ni as acquireRelease, nu as minutes, oi as andThen, ot as brand, ou as Reference, p as Defect, pa as matchCauseEager, pd as symbol, pr as dateTimeUtcFromInput, qa as sync, qc as succeed$1, qi as forkScoped, qo as monotonicTimeNanos, qs as provide, ri as acquireUseRelease, rt as Union$2, ru as seconds, s as Class$1, sa as makeSpanScoped, si as annotateCurrentSpan, sl as compose, so as useSpan, ss as fromReasons, su as Service, ta as isEffect, tc as into, td as withFiber$1, tl as ParentSpan, tn as isSchema, to as try_, ts as combine, tu as millis, u as DateTimeUtcFromDate, uc as failCause, un as mutable, ur as transform$1, uu as get$1, va as onExit, vc as ClockRef, vl as fromIterable, vo as Class$2, vu as omit, wc as contextWith$1, wi as catchTags, wo as make$8, ws as effect, wu as flatten, xi as catchNoSuchElement, xl as isArrayNonEmpty, xo as forEach$1, xu as filter, ya as onExitPrimitive, yd as isNotNull, yn as toType, yt as instanceOf, zd as pipe, zs as Scope } from "./Schema-D629S5yu.mjs";
2
+ import { D as Path, E as Console, O as FileSystem, T as ChildProcessSpawner, a as makeGrouped, f as SemanticSearch, h as map$4, i as batchN, m as maybeUpdateFile, n as EmbeddingModel, o as setDelay, p as maybeRemoveFile, r as EmbeddingRequest, s as withSpan$1, t as Dimensions, w as make$11 } from "./cli.mjs";
3
+ import { $t as offerUnsafe, Ht as makeUnsafe$3, It as unwrap, J as fromArrayEffect, Jt as failCauseUnsafe, Mt as tap$1, P as die$1, U as flatMap$1, Vt as make$13, Yt as make$12, gt as provideService$1, hn as runIn, mn as join$1, pn as interruptAllAs, q as fromArray, tt as fromQueue, vt as runCollect, yt as runDrain } from "./AiError-fiHIiGOy.mjs";
5
4
  import { createHash } from "node:crypto";
6
5
  import { DatabaseSync, backup } from "node:sqlite";
7
6
  import TreeSitter from "tree-sitter";
@@ -1138,7 +1137,7 @@ const extract$1 = dual((args) => isStruct(args[0]), (self, variant, options) =>
1138
1137
  const make$3 = (options) => {
1139
1138
  function Class(identifier) {
1140
1139
  return function(fields, annotations) {
1141
- return makeClass(fields, (defaultFields) => Class$2(identifier)(defaultFields, annotations));
1140
+ return makeClass(fields, (defaultFields) => Class$1(identifier)(defaultFields, annotations));
1142
1141
  };
1143
1142
  }
1144
1143
  function makeClass(fields, makeSchemaClass) {
@@ -1255,7 +1254,7 @@ const BooleanSqlite = Field({
1255
1254
  jsonUpdate: Boolean
1256
1255
  });
1257
1256
  const Date$1 = String$1.pipe(decodeTo(DateTimeUtc, {
1258
- decode: map$3(dateTimeUtcFromInput(), removeTime),
1257
+ decode: map$1(dateTimeUtcFromInput(), removeTime),
1259
1258
  encode: transform(formatIsoDate)
1260
1259
  }));
1261
1260
  const DateWithNow = Overrideable(Date$1, { defaultValue: map(now, removeTime) });
@@ -1297,7 +1296,7 @@ const DateTimeUpdateFromNumber = Field({
1297
1296
  });
1298
1297
  // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/sql/SqlResolver.js
1299
1298
  const SqlRequestProto = {
1300
- ...Class$1.prototype,
1299
+ ...Class$2.prototype,
1301
1300
  [symbol](that) {
1302
1301
  return equals(this.payload, that.payload);
1303
1302
  },
@@ -1470,10 +1469,10 @@ select * from ${sql(options.tableName)} where ${withSoftDeleteFilter(sql`${sql(i
1470
1469
  };
1471
1470
  });
1472
1471
  // src/ChunkRepo.ts
1473
- const ChunkId = Number$2.pipe(brand("ChunkRepo/ChunkId"));
1472
+ const ChunkId = Number$1.pipe(brand("ChunkRepo/ChunkId"));
1474
1473
  const SyncId = String$1.pipe(brand("ChunkRepo/SyncId"));
1475
1474
  const Float32ArraySchema = instanceOf(Float32Array);
1476
- const Float32ArrayFromArray = ArraySchema(Number$2).pipe(decodeTo(Float32ArraySchema, transform$1({
1475
+ const Float32ArrayFromArray = ArraySchema(Number$1).pipe(decodeTo(Float32ArraySchema, transform$1({
1477
1476
  decode: (arr) => new Float32Array(arr),
1478
1477
  encode: (array) => Array.from(array)
1479
1478
  })));
@@ -1533,7 +1532,7 @@ const layer$4 = effect(ChunkRepo, gen(function* () {
1533
1532
  const search = findAll({
1534
1533
  Request: Struct$2({
1535
1534
  vector: Float32ArraySchema,
1536
- limit: Number$2
1535
+ limit: Number$1
1537
1536
  }),
1538
1537
  Result: Chunk,
1539
1538
  execute: ({ vector, limit }) => sql`
@@ -2326,11 +2325,11 @@ ORDER BY migration_id`,
2326
2325
  pg: () => flatMap(migrationsTableExists(sql, table), (exists) => exists ? void_$1 : asVoid(createMigrationsTable).pipe(catch_((error) => flatMap(migrationsTableExists(sql, table), (exists) => exists ? void_$1 : fail(error))))),
2327
2326
  orElse: () => createMigrationsTable
2328
2327
  });
2329
- const insertMigrations = (rows) => transformWrites(sql`INSERT INTO ${sql(table)} ${sql.insert(map$1(rows, ([migration_id, name]) => ({
2328
+ const insertMigrations = (rows) => transformWrites(sql`INSERT INTO ${sql(table)} ${sql.insert(map$2(rows, ([migration_id, name]) => ({
2330
2329
  migration_id,
2331
2330
  name
2332
2331
  })))}`.withoutTransform);
2333
- const latestMigration = map(sql`SELECT migration_id, name, created_at FROM ${sql(table)} ORDER BY migration_id DESC`.withoutTransform, (_) => map$2(fromNullishOr(_[0]), ({ created_at, migration_id, name }) => ({
2332
+ const latestMigration = map(sql`SELECT migration_id, name, created_at FROM ${sql(table)} ORDER BY migration_id DESC`.withoutTransform, (_) => map$3(fromNullishOr(_[0]), ({ created_at, migration_id, name }) => ({
2334
2333
  id: migration_id,
2335
2334
  name,
2336
2335
  createdAt: created_at
@@ -2377,7 +2376,7 @@ ORDER BY migration_id`,
2377
2376
  yield* loadMigration(resolved)
2378
2377
  ]);
2379
2378
  }
2380
- if (transactional && isArrayNonEmpty(required)) yield* pipe(insertMigrations(map$1(required, ([id, name]) => [id, name])), mapError((error) => isConstraintConflict(error) ? new MigrationError({
2379
+ if (transactional && isArrayNonEmpty(required)) yield* pipe(insertMigrations(map$2(required, ([id, name]) => [id, name])), mapError((error) => isConstraintConflict(error) ? new MigrationError({
2381
2380
  kind: "Locked",
2382
2381
  message: "Migrations already running"
2383
2382
  }) : error));
@@ -2397,9 +2396,9 @@ const migrationsTableExists = (sql, table) => {
2397
2396
  const quotedTable = sql`${sql(table)}`.compile(true)[0];
2398
2397
  return map(sql`SELECT 1 AS found WHERE to_regclass(${quotedTable}) IS NOT NULL`.withoutTransform, (rows) => rows.length > 0);
2399
2398
  };
2400
- const migrationOrder = make$10(([a], [b]) => Number$1(a, b));
2399
+ const migrationOrder = make$10(([a], [b]) => Number$2(a, b));
2401
2400
  const isConstraintConflict = (error) => error.reason._tag === "ConstraintError" || error.reason._tag === "UniqueViolation";
2402
- const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$1(([key, id, name]) => [
2401
+ const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$2(([key, id, name]) => [
2403
2402
  Number(id),
2404
2403
  name,
2405
2404
  succeed(migrations[key])