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.
Files changed (103) hide show
  1. package/README.md +75 -0
  2. package/dist/Acp.d.ts +1 -1
  3. package/dist/Acp.d.ts.map +1 -1
  4. package/dist/Acp.js +112 -7
  5. package/dist/Acp.js.map +1 -1
  6. package/dist/Acp.test.js +178 -0
  7. package/dist/Acp.test.js.map +1 -1
  8. package/dist/Agent.d.ts.map +1 -1
  9. package/dist/Agent.js +26 -8
  10. package/dist/Agent.js.map +1 -1
  11. package/dist/AgentExecutor.js +15 -1
  12. package/dist/AgentExecutor.js.map +1 -1
  13. package/dist/AgentExecutor.test.js +24 -4
  14. package/dist/AgentExecutor.test.js.map +1 -1
  15. package/dist/AgentSkills.test.js +0 -1
  16. package/dist/AgentSkills.test.js.map +1 -1
  17. package/dist/AgentSubagents.test.js +16 -6
  18. package/dist/AgentSubagents.test.js.map +1 -1
  19. package/dist/AgentTools.d.ts +7 -0
  20. package/dist/AgentTools.d.ts.map +1 -1
  21. package/dist/AgentTools.js +7 -0
  22. package/dist/AgentTools.js.map +1 -1
  23. package/dist/McpConfig.d.ts +36 -0
  24. package/dist/McpConfig.d.ts.map +1 -0
  25. package/dist/McpConfig.js +182 -0
  26. package/dist/McpConfig.js.map +1 -0
  27. package/dist/McpConfig.test.d.ts +2 -0
  28. package/dist/McpConfig.test.d.ts.map +1 -0
  29. package/dist/McpConfig.test.js +163 -0
  30. package/dist/McpConfig.test.js.map +1 -0
  31. package/dist/McpServers.d.ts +176 -0
  32. package/dist/McpServers.d.ts.map +1 -0
  33. package/dist/McpServers.js +707 -0
  34. package/dist/McpServers.js.map +1 -0
  35. package/dist/McpServers.test.d.ts +2 -0
  36. package/dist/McpServers.test.d.ts.map +1 -0
  37. package/dist/McpServers.test.js +717 -0
  38. package/dist/McpServers.test.js.map +1 -0
  39. package/dist/TypeBuilder.d.ts +9 -0
  40. package/dist/TypeBuilder.d.ts.map +1 -1
  41. package/dist/TypeBuilder.js +24 -11
  42. package/dist/TypeBuilder.js.map +1 -1
  43. package/dist/TypeBuilder.test.js +33 -0
  44. package/dist/TypeBuilder.test.js.map +1 -1
  45. package/dist/bin/{Effect-2jPlJ8eu.mjs → Effect-DuThyCJ1.mjs} +155 -74
  46. package/dist/bin/Effect-DuThyCJ1.mjs.map +1 -0
  47. package/dist/bin/McpClient-CIiPyMDJ.mjs +36 -0
  48. package/dist/bin/McpClient-CIiPyMDJ.mjs.map +1 -0
  49. package/dist/bin/{OutputFormatter-BFAv48k9.mjs → OutputFormatter-BvIjvUmT.mjs} +3 -3
  50. package/dist/bin/{OutputFormatter-BFAv48k9.mjs.map → OutputFormatter-BvIjvUmT.mjs.map} +1 -1
  51. package/dist/bin/{Schema-D-7VuCiC.mjs → Schema-DcXUXpRg.mjs} +1069 -124
  52. package/dist/bin/Schema-DcXUXpRg.mjs.map +1 -0
  53. package/dist/bin/{SemanticSearch-Cb8aqvGv.mjs → SemanticSearch-CdGA4CIC.mjs} +27 -21
  54. package/dist/bin/SemanticSearch-CdGA4CIC.mjs.map +1 -0
  55. package/dist/bin/{Stream-DEu2tfCV.mjs → Stream-I9SRMlLj.mjs} +60 -45
  56. package/dist/bin/Stream-I9SRMlLj.mjs.map +1 -0
  57. package/dist/bin/cli.mjs +27217 -10325
  58. package/dist/bin/cli.mjs.map +1 -1
  59. package/dist/bin/{index.min-CI3qqohw.mjs → index.min-Bkz7vIWv.mjs} +7 -7
  60. package/dist/bin/index.min-Bkz7vIWv.mjs.map +1 -0
  61. package/dist/bin/rolldown-runtime-zY4HT0JA.mjs +30 -0
  62. package/dist/bin/{turndown.cjs-DK29wZw3.mjs → turndown.cjs-LntFxFyd.mjs} +2 -2
  63. package/dist/bin/{turndown.cjs-DK29wZw3.mjs.map → turndown.cjs-LntFxFyd.mjs.map} +1 -1
  64. package/dist/cli.js +46 -7
  65. package/dist/cli.js.map +1 -1
  66. package/dist/fixtures/McpFakeServer.d.ts +47 -0
  67. package/dist/fixtures/McpFakeServer.d.ts.map +1 -0
  68. package/dist/fixtures/McpFakeServer.js +112 -0
  69. package/dist/fixtures/McpFakeServer.js.map +1 -0
  70. package/dist/fixtures/McpStdioServer.d.ts +2 -0
  71. package/dist/fixtures/McpStdioServer.d.ts.map +1 -0
  72. package/dist/fixtures/McpStdioServer.js +53 -0
  73. package/dist/fixtures/McpStdioServer.js.map +1 -0
  74. package/dist/index.d.ts +4 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +4 -0
  77. package/dist/index.js.map +1 -1
  78. package/package.json +14 -14
  79. package/src/Acp.test.ts +242 -0
  80. package/src/Acp.ts +141 -5
  81. package/src/Agent.ts +38 -10
  82. package/src/AgentExecutor.test.ts +31 -5
  83. package/src/AgentExecutor.ts +14 -1
  84. package/src/AgentSkills.test.ts +0 -1
  85. package/src/AgentSubagents.test.ts +20 -6
  86. package/src/AgentTools.ts +8 -0
  87. package/src/McpConfig.test.ts +238 -0
  88. package/src/McpConfig.ts +255 -0
  89. package/src/McpServers.test.ts +1050 -0
  90. package/src/McpServers.ts +1072 -0
  91. package/src/TypeBuilder.test.ts +70 -0
  92. package/src/TypeBuilder.ts +41 -14
  93. package/src/cli.ts +92 -8
  94. package/src/fixtures/McpFakeServer.ts +162 -0
  95. package/src/fixtures/McpStdioServer.ts +60 -0
  96. package/src/index.ts +5 -0
  97. package/dist/bin/Effect-2jPlJ8eu.mjs.map +0 -1
  98. package/dist/bin/McpClient-1W508adc.mjs +0 -14179
  99. package/dist/bin/McpClient-1W508adc.mjs.map +0 -1
  100. package/dist/bin/Schema-D-7VuCiC.mjs.map +0 -1
  101. package/dist/bin/SemanticSearch-Cb8aqvGv.mjs.map +0 -1
  102. package/dist/bin/Stream-DEu2tfCV.mjs.map +0 -1
  103. package/dist/bin/index.min-CI3qqohw.mjs.map +0 -1
@@ -1,14 +1,14 @@
1
- import { $a as Service, $i as compose, $t as try_, At as request$1, B as fn, Br as provide, Bs as isNotNull, C as catchTags, Ca as sort, Cn as remove, Co as isNone, Cs as symbol, Ct as orElseSucceed, D as contextWith, Do as map$1, Dt as provideService, E as context, Es as hash, Et as provideContext, Ga as minutes, Gr as done, Ha as isZero, Ho as make$10, 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, Ms as symbol$1, Mt as retry, N as fail, Nr as Scope, Ns as hasProperty, Nt as runFork, O as delay, Oi as fiberJoin, Oo as match, Or as provide$1, P as failCause$1, Pr as addFinalizer, 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, Ss as equals, St as orDie, Tn as size, To as isSome, 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, ac as dual, ai as isFailure, an as useSpan, as as withFiber$1, b as catchNoSuchElement, bn as get$2, br as effectContext, c as as, ci as void_$3, ea as has, eo as add, et as isEffect, fa as isArrayNonEmpty, fn as withSpan, fo as filter, g as catchDefect, gn as Class$1, hi as contextWith$1, ho as flatten, hr as reasonAnnotations, i as all, io as getOrUndefined, it as logInfo, ji as forkUnsafe, k as die, ko as none, kr as provideMerge, la as flatMapNullishOr, li as ClockRef, ln as withFiber, lo as merge, m as catchCause, mt as matchCauseEffect, n as acquireUseRelease, nc as constUndefined, ni as failCause, nn as uninterruptibleMask, no as get$1, o as annotateCurrentSpan, oc as flow, oi as isSuccess, on as void_$1, oo as getUnsafe, ot as makeSpanScoped, pc as pipeArguments, pt as matchCauseEager, q as forkScoped, qt as sync, ro as getOption, rr as hasInterruptsOnly, s as annotateLogs, sc as identity, 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, uc as pipe, 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, xn as isEmpty, xr as effectDiscard, xs as byReferenceUnsafe, y as catchIf, ya as map$2, yi as exitHasInterrupts, yn as forEach, yr as effect, yt as onExitPrimitive, za as infinity } from "./Effect-2jPlJ8eu.mjs";
2
- import { B as provideService$1, H as runCollect, It as interruptAs, Lt as join$1, Rt as runIn, T as fromQueue, U as runDrain, _t as make$11, c as die$1, et as tap$1, g as flatMap$1, gt as failCauseUnsafe, lt as make$12, nt as unwrap, ut as makeUnsafe$3, v as fromArray, xt as offerUnsafe, y as fromArrayEffect } from "./Stream-DEu2tfCV.mjs";
3
- import { A as Option, At as optionalKey, B as TaggedError, Bn as now, C as Natural, Cn as map$3, I as String$1, Kn as Clock, L as Struct$2, Lt as toType, O as NullOr, Ot as mutable, Q as brand, Rn as formatIsoDate, Rt as withConstructorDefault, Sn as dateTimeUtcFromInput, Tn as transform, Vn as removeTime, Vt as evolve, Y as Union$2, Zn as TaggedError$1, c as DateTimeUtcFromDate, d as Defect, dt as instanceOf, i as BooleanFromBit, it as decodeUnknownEffect, j as OptionFromNullOr, k as Number$2, kt as optional, l as DateTimeUtcFromMillis, n as ArraySchema, o as Class$2, qn as monotonicTimeNanos, r as Boolean, rt as decodeTo, s as DateTimeUtc, st as encodeEffect, u as DateTimeUtcFromString, wt as isSchema, xn as transformOptional, yn as transform$1 } from "./Schema-D-7VuCiC.mjs";
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";
1
+ import { $a as millis, $n as combine, $t as tryPromise, At as request$1, B as fn, C as catchTags, Cn as make$8, Ct as orElseSucceed, D as contextWith, Da as map$2, Dt as provideService, E as context, Ei as exitHasInterrupts, En as size, Eo as fromNullishOr, Er as effectDiscard, Et as provideContext, Fi as fiberJoin, Go as Number$1, I as filterOrFail, Io as map$1, Ja as infinity, Ji as onExitUnsafe, Jn as NoSuchElementError, Jt as tap, Kr as provide, Kt as suspend, L as flatMap, Lo as match, Ls as hash, Lt as scope, Mo as isNone, Ms as byReferenceUnsafe, Mt as retry, N as fail, Nn as spaced, Nr as provide$1, Ns as equals, Nt as runFork, O as delay, P as failCause$1, Po as isSome, Pr as provideMerge, Ps as symbol, Pt as runForkWith, Q as interrupt, Qr as doneUnsafe, Ri as forkUnsafe, Ro as none, Rr as Scope, Rt as scoped, S as catchTag, Sc as pipe, Si as contextWith$1, Sn as isEmpty, St as orDie, Tc as pipeArguments, Ti as endSpan, Tn as set, Tr as effectContext, U as forEach$1, Us as symbol$1, Ut as succeed, V as fnUntraced, Vo as some, Vr as close, Vt as serviceOption, W as forever, Wi as makeSpanUnsafe, Wr as make$7, Ws as hasProperty, X as gen, Xa as isFinite, Xi as succeed$1, Yr as TracerTimingEnabled, Yt as tapCause, Z as ignore, Za as isZero, Zo as make$10, Zr as done, Zs as isNotNull, _a as flatMapNullishOr, _c as dual, _n as Class$1, _t as onError, a as andThen, b as catchNoSuchElement, ba as isArrayNonEmpty, bn as forEach, br as reasonAnnotations, c as as, ca as toPredicate, ci as failCause, co as Service, cr as hasInterruptsOnly, dn as withLogSpan, do as get$1, ei as into, en as try_, eo as minutes, et as isEffect, fi as isFailure, fo as getOption, fr as isFailReason, g as catchDefect, gi as ClockRef, go as make$9, gs as assignProperty, hi as void_$3, ho as getUnsafe, hr as makeDieReason, i as all, ia as ParentSpan, ii as makeUnsafe$2, io as toMillis, is as PipeInspectableProto, it as logInfo, ja as sort, ji as fiberInterrupt, k as die, lo as add, m as catchCause, mc as constUndefined, mi as succeed$2, ms as withFiber$1, mt as matchCauseEffect, n as acquireUseRelease, na as void_$2, o as annotateCurrentSpan, oa as compose, on as useSpan, oo as zero, or as fromReasons, ot as makeSpanScoped, pa as empty, pi as isSuccess, pn as withSpan, po as getOrUndefined, pt as matchCauseEager, q as forkScoped, qa as fromInputUnsafe, qt as sync, rn as uninterruptibleMask, ro as seconds, rr as filterInterruptors, s as annotateLogs, sa as has, si as fail$1, sn as void_$1, so as Reference, st as map, t as acquireRelease, ta as updateContext, ts as Prototype, tt as logDebug, u as asVoid, un as withFiber, ut as mapError, va as fromIterable, vc as flow, vo as merge, vt as onExit, w as catch_, wn as remove, wo as flatten, wr as effect, xn as get$2, xo as filter, y as catchIf, yc as identity, yn as empty$1, yt as onExitPrimitive, zr as addFinalizer } from "./Effect-DuThyCJ1.mjs";
2
+ import { E as fromQueue, It as interruptAs, Lt as join$1, Rt as runIn, U as runCollect, V as provideService$1, W as runDrain, _t as make$11, b as fromArrayEffect, c as die$1, g as flatMap$1, gt as failCauseUnsafe, it as unwrap, lt as make$12, nt as tap$1, ut as makeUnsafe$3, xt as offerUnsafe, y as fromArray } from "./Stream-I9SRMlLj.mjs";
3
+ import { $r as monotonicTimeNanos, Cn as toType, Ct as instanceOf, D as Natural, Dn as evolve, F as Option, H as String$1, I as OptionFromNullOr, J as TaggedError, Kr as now, M as NullOr, N as Number$2, Qr as Clock, W as Struct$2, Wr as formatIsoDate, a as BooleanFromBit, an as isSchema, d as DateTimeUtcFromMillis, dr as transform$1, f as DateTimeUtcFromString, gn as optionalKey, gt as decodeUnknownEffect, hn as optional, hr as map$3, ht as decodeTo, i as Boolean, l as DateTimeUtc, mr as dateTimeUtcFromInput, n as ArraySchema, ot as Union$2, p as Defect, pn as mutable, pr as transformOptional, qr as removeTime, ri as TaggedError$1, s as Class$2, u as DateTimeUtcFromDate, ut as brand, vr as transform, wn as withConstructorDefault, yt as encodeEffect } from "./Schema-DcXUXpRg.mjs";
4
+ import { _ as Path, a as makeGrouped, d as maybeRemoveFile, f as maybeUpdateFile, g as Console, h as ChildProcessSpawner, i as batchN, m as make$13, n as EmbeddingModel, o as setDelay, p as map$4, r as EmbeddingRequest, s as withSpan$1, t as Dimensions, u as SemanticSearch, v as FileSystem } from "./cli.mjs";
5
5
  import { createHash } from "node:crypto";
6
6
  import { DatabaseSync, backup } from "node:sqlite";
7
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.4/node_modules/effect/dist/reactivity/Reactivity.js
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.4/node_modules/effect/dist/sql/SqlError.js
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.4/node_modules/effect/dist/sql/Statement.js
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.4/node_modules/effect/dist/sql/SqlClient.js
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.4/node_modules/effect/dist/Cache.js
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.4/node_modules/effect/dist/schema/VariantSchema.js
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.4/node_modules/effect/dist/schema/Model.js
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.4/node_modules/effect/dist/sql/SqlResolver.js
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.4/node_modules/effect/dist/sql/SqlSchema.js
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.4/node_modules/effect/dist/sql/SqlModel.js
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.4/node_modules/effect/dist/FiberHandle.js
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.4_effect@4.0.4/node_modules/@effect/sql-sqlite-node/dist/SqliteClient.js
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(exec("PRAGMA journal_mode = WAL")), retry({
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.4/node_modules/effect/dist/sql/Migrator.js
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.4_effect@4.0.4/node_modules/@effect/sql-sqlite-node/dist/SqliteMigrator.js
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-Cb8aqvGv.mjs.map
2455
+ //# sourceMappingURL=SemanticSearch-CdGA4CIC.mjs.map