clanka 0.25.3 → 0.26.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 (38) hide show
  1. package/dist/Acp.d.ts +5 -37
  2. package/dist/Acp.d.ts.map +1 -1
  3. package/dist/Acp.js +33 -48
  4. package/dist/Acp.js.map +1 -1
  5. package/dist/Acp.test.js +62 -1
  6. package/dist/Acp.test.js.map +1 -1
  7. package/dist/AcpImage.test.js +3 -2
  8. package/dist/AcpImage.test.js.map +1 -1
  9. package/dist/AcpSessionStore.d.ts +114 -0
  10. package/dist/AcpSessionStore.d.ts.map +1 -0
  11. package/dist/AcpSessionStore.js +327 -0
  12. package/dist/AcpSessionStore.js.map +1 -0
  13. package/dist/AcpSessionStore.test.d.ts +2 -0
  14. package/dist/AcpSessionStore.test.d.ts.map +1 -0
  15. package/dist/AcpSessionStore.test.js +135 -0
  16. package/dist/AcpSessionStore.test.js.map +1 -0
  17. package/dist/bin/{AiError-CsvdOsKR.mjs → AiError-DBaKz35C.mjs} +2 -2
  18. package/dist/bin/{Latch-B3e9629m.mjs → Latch-DOdbsGMQ.mjs} +1 -1
  19. package/dist/bin/{McpClient-BCxZZgnA.mjs → McpClient-B-FFG6Pg.mjs} +1 -1
  20. package/dist/bin/{OutputFormatter-ByMjyBhe.mjs → OutputFormatter-DhhP2i-7.mjs} +2 -2
  21. package/dist/bin/{Schema-BfUmMefy.mjs → Schema-CFdSO6iH.mjs} +11 -1
  22. package/dist/bin/{SemanticSearch-Cw10ozz8.mjs → SemanticSearch-C3a7LAQr.mjs} +2 -2
  23. package/dist/bin/cli.mjs +346 -142
  24. package/dist/bin/{upgrade-t590zYhO.mjs → upgrade-C4aOEWJH.mjs} +2 -2
  25. package/dist/cli.js +10 -3
  26. package/dist/cli.js.map +1 -1
  27. package/dist/index.d.ts +4 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4 -0
  30. package/dist/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/Acp.test.ts +120 -1
  33. package/src/Acp.ts +41 -55
  34. package/src/AcpImage.test.ts +7 -2
  35. package/src/AcpSessionStore.test.ts +220 -0
  36. package/src/AcpSessionStore.ts +455 -0
  37. package/src/cli.ts +20 -9
  38. package/src/index.ts +5 -0
package/dist/bin/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env -S node --optimize-for-size
2
2
  import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-CXhmmSW5.mjs";
3
- import { $ as URLFromString, $c as sync$1, $i as ignore, $l as fromInputUnsafe$1, $n as optionalKey$1, $r as stripCrlf, $s as TracerTimingEnabled, $t as isPattern, A as Null, Aa as provideServiceEffect, Ad as isTagged, An as escapeToken, Ar as fromBody, As as empty$10, At as isGreaterThan, Au as fromUndefinedOr, B as String$7, Ba as scope, Bd as identity, Bi as flatMapEager, Bl as headUnsafe, Bn as Objects, Br as retryAfterDelay, Bs as suspend$2, Bt as isLessThanDate, Bu as orElse$1, C as Literal, Ca as option$1, Cc as LogToStderr$1, Cd as isNotNullish, Cl as headNonEmpty, Cr as jsonSchemaAnnotationKeys, Cs as reasonAnnotations, Ct as isBetweenCodePoints, Cu as all$1, D as Never, Da as provide$1, Dd as isObject$1, Di as catch_, Dl as isReadonlyArrayNonEmpty, Dn as fromSchemaDraft07, Dr as redactUrl, Ds as effect, Dt as isBetweenSize, Du as flatMapNullishOr, E as Natural, Ea as promise, Ed as isNullish, Ei as catchTags, El as isCanonicalArrayIndex, En as errorWithPath, Er as fromInput, Es as buildWithScope, Et as isBetweenProperties, Eu as flatMap$2, F as OptionFromOptional, Fa as retry, Fd as constUndefined, Fi as fail$1, Fl as sort, Fn as encodeEffect, Fo as jittered, Fr as fromRecordUnsafe, Fs as orDie$1, Ft as isGreaterThanOrEqualToDate, Fu as isNone, G as TaggedClass$1, Ga as sleep, Gi as forever, Gl as isFailure$1, Gn as decodeTo, Gr as formatIso, Gs as close, Gt as isMaxLength, Gu as String$6, H as Struct, Hd as pipe, Hi as fn, Hl as failVoid, Hn as Suspend, Ho as isDoneCause, Hr as setAll, Hs as Scope, Ht as isLessThanOrEqualToBigInt, Hu as some, I as Record, Ia as runFork, Id as constVoid, Ii as failCause, Il as span, In as Arrays, Io as min, Ir as isRedactedName, Is as provide$3, It as isIncluding, Iu as isSome, J as TaggedUnion, Ji as forkIn, Jl as succeed$2, Jn as isJson, Jo as Clock, Js as make$44, Jt as isMinCodePoints, Ju as Prototype, K as TaggedError$1, Ka as succeed$1, Ki as forkChild, Kl as isSuccess$1, Kn as defaultParseOptions, Ko as parse$1, Ks as fork, Kt as isMaxProperties, L as Redacted$4, La as runForkWith, Li as failSync, Ll as assignProperty$1, Ln as Filter, Lo as spaced, Lr as merge$3, Ls as provideMerge, Lt as isInt, Lu as map$8, M as Number$2, Ma as repeat, Md as or, Mi as effectify, Ml as match$3, Mn as getSubschemaKind, Mo as forever$1, Mr as CurrentRedactedNames$1, Ms as merge$2, Mt as isGreaterThanDate, Mu as getOrNull, N as Option, Na as request, Nd as constFalse, Ni as ensuring, Nl as of, Nn as decodeEffect$1, No as fromStep, Nr as empty$6, Ns as mergeAll, Nt as isGreaterThanOrEqualTo, Nu as getOrThrow$1, O as NonEmptyArray, Oa as provideContext, Od as isObjectKeyword, Oi as context, Ol as join$2, On as fromSchemaDraft2020_12, Or as setAll$1, Os as effectContext, Ot as isEndingWith, Pa as result, Pd as constTrue, Pi as exit, Pl as reduce, Pn as decodeUnknownEffect, Po as isSchedule, Pr as fromInput$1, Ps as mock, Pt as isGreaterThanOrEqualToBigInt, Pu as getOrUndefined, Q as URL$1, Qa as tapCause, Qi as gen, Ql as format$1, Qn as null_, Qo as IllegalArgumentError, Qr as decodeNative, Qs as MinimumLogLevel, Qt as isMultipleOf, R as RedactedFromValue, Rd as dual, Ri as filterOrFail, Rl as map$10, Rn as FilterGroup, Ro as toStep, Rr as parseRetryAfter$1, Rs as succeed$4, Rt as isLessThan, Ru as match$2, S as JsonObject$1, Sa as onInterrupt, Sc as ConsoleRef, Sd as isNotNull, Si as catchIf, Sl as fromIterable, Sn as withDecodingDefaultKey, So as TaggedClass$2, Sr as annotationExcludedKeys, Ss as pretty, St as isBetweenBigInt, Ta as orElseSucceed, Td as isNull, Ti as catchTag, Tl as isArrayNonEmpty, Tn as pick, Tr as empty$5, Ts as build, Tt as isBetweenLength, Tu as filter$1, U as StructWithRest, Ua as service, Ud as pipeArguments, Ui as fnUntraced, Ul as getOrThrow, Un as Union$1, Ur as empty$7, Us as addFinalizer, Ut as isLessThanOrEqualToDate, Uu as toArray, V as StringForLiteralAutocomplete, Va as scoped, Vc as forkUnsafe, Vd as memoize, Vl as fail$2, Vn as PropertySignature, Vr as set, Vs as unwrap$4, Vt as isLessThanOrEqualTo, Vu as orElseSome, W as Symbol$1, Wa as serviceOption, Wi as forEach$1, Wl as getOrUndefined$2, Wn as applyToSelfOrLastLinkEncoding, Wo as Random$1, Wr as fromSetCookie, Ws as addFinalizerExit, Wt as isMaxCodePoints, X as Tuple, Xa as sync, Xi as fromOption, Xn as isOptional, Xr as decode$3, Xs as provide$2, Xt as isMinProperties, Xu as PipeInspectableProto, Y as TrueLiterals, Ya as suspend, Yi as forkScoped, Yl as try_$1, Yn as isNever, Yo as currentTimeMillis, Ys as makeUnsafe$2, Yt as isMinLength, Z as TupleWithRest, Za as tap, Zi as fromResult, Zl as normalizeNonEmpty, Zn as mapOrSame, Zo as Done, Zr as encode, Zs as CurrentLogAnnotations, Zt as isMinSize, _ as Exit, _a as matchEffect, _c as isFailure, _i as catchCause, _n as toEncoded$1, _o as withSpan$1, _r as transform$3, _s as isFailReason, _t as encodeUnknownEffect, _u as getOrUndefinedUnsafe, aa as logError, ac as isDone, ad as withFiber$1, al as ParentSpan, an as isUnique, ao as undefined_, ar as toEncoded, at as Void, au as millis, b as Int$5, ba as onExit, bc as void_$1, bd as hasProperty, bi as catchEager, bl as findLast, bn as withConstructorDefault, bo as equalBatchKeys, br as InvalidValue$1, bs as makeFailReason, bt as is, bu as makeUnsafe$3, c as Date$2, ca as logWarning, cc as makeUnsafe$1, cd as setStackTraceLimit, ci as andThen, cl as TaggedClass, cn as makeFilter$1, co as updateContext, cr as Transformation, cs as filterInterruptors, ct as declare, cu as toMillis, da as mapBothEager, dc as die$1, dd as NodeInspectSymbol, di as as, dl as compose, dn as optional$2, do as void_, dr as transformEffect$1, ds as hasInterrupts, dt as decodeTo$1, du as Service, ea as ignoreCause, ec as _await, ei as isRedacted, en as isPropertyNames, eo as timeout, er as replaceChecks, es as StackTrace, et as Uint8Array$2, eu as hours, f as DateTimeUtcFromString, fa as mapEager, fc as fail$3, fi as asSome, fl as has, fn as optionalKey, fr as transformOptional$1, fs as hasInterruptsOnly, ft as decodeUnknownEffect$1, fu as add, g as Error$2, ga as matchCauseEffect, gi as callback, gl as empty$4, gn as toCodecStringTree, go as withParentSpan, gr as passthroughSubtype, gt as encodeTo, gu as getOrUndefined$1, h as DurationFromMillis, hc as interrupt$1, hi as cachedWithTTL, hl as appendAll, hn as toCodecJson, hr as passthrough, hs as isDieReason, ht as encodeEffect$1, hu as getOption, i as Boolean$4, ia as logDebug, ic as into, ii as acquireRelease, il as DisablePropagation, in as isUUID, io as try_, ir as string$1, it as Unknown, iu as max, j as NullOr, ja as raceFirst, jd as isUndefined, ji as die, jl as map$7, jn as parseUriFragment, jo as exponential, jr as unwrap$3, js as fresh, jt as isGreaterThanBigInt, ju as getOrElse, k as NonEmptyString$1, ka as provideService, kd as isString, ki as contextWith, kl as last$1, kn as getReferenceKey, kr as toString, kt as isFinite$1, ku as fromNullishOr, la as makeSpanScoped, lc as succeed$5, ld as BaseProto, li as annotateCurrentSpan, ll as TaggedError, ln as makeFilterGroup, lo as updateService, lr as passthrough$1, ls as findErrorOption, lt as decodeEffect, lu as zero, m as Duration, ma as match$4, mc as findErrorOption$1, md as redact, mi as cached, ml as Array$1, mn as tag, mo as withFiber, mt as decodeUnknownSync, mu as get$2, n as ArraySchema, na as interruptible, nc as fail$4, ni as value, nn as isSchemaError, no as timeoutOrElse, nr as resolveDescription, ns as UnknownError, nt as UndefinedOr, nu as isFinite, o as BooleanLiterals, oa as logFatal, oc as isDoneUnsafe, od as assignProperty, oi as addFinalizer$1, ol as EncodingError, on as link$1, oo as uninterruptible, or as toType$1, os as done, ou as minutes, p as Defect, pa as mapError, pc as failCause$1, pd as format, pi as asVoid, pl as toPredicate, pn as suspend$1, po as whileLoop, ps as interruptors, pt as decodeUnknownOption, pu as empty$8, q as TaggedStruct, qa as succeedNone, qi as forkDetach, ql as map$6, qn as getIndexSignatureKeys, qo as round, qr as fromDateUnsafe, qt as isMaxSize, qu as mapInput, r as BigInt$2, ra as isEffect, ri as stringOrRedacted, rn as isStartingWith, ro as tryPromise, rr as resolveIdentifier, rs as annotate$1, rt as Union, s as Class$1, sa as logInfo, sc as make$43, sd as getStackTraceLimit, si as all, sl as Error$1, sn as make$41, so as uninterruptibleMask, sr as unknown$1, ss as fail$5, st as check, su as seconds, t as Any, ta as interrupt, tc as doneUnsafe, ti as make$40, tn as isSchema, to as timeoutOption, tr as resolveAt, ts as TimeoutError, tt as Uint8ArrayFromBase64, tu as infinity, ua as map$5, ud as Class, ui as annotateLogs, ul as taggedEnum, un as mutable, uo as useSpan, ur as transform$2, us as fromReasons, ut as decodeSync, uu as Reference, v as FalseLiterals, va as never$1, vc as isSuccess, vi as catchCauseIf, vl as findFirst, vn as toJsonSchemaDocument, vo as yieldNow, vr as transformEffect, vs as isTimeoutError, vt as fromJsonString, vu as getUnsafe, w as Literals$2, wa as orDie, wd as isNotUndefined, wi as catchReason, wl as isArray, wn as omit, wr as CurrentRedactedNames, ws as squash, wt as isBetweenDate, wu as exists, x as Json, xd as isIterable, xi as catchFilter, xn as withDecodingDefault, xr as Pointer, xs as map$9, xt as isBetween, xu as merge$1, y as Finite, ya as onError, yc as succeed$3, yl as findFirstIndex, yn as toType, yo as zipWith, yr as transformOptional, ys as makeDieReason, yt as instanceOf, yu as make$42, z as SchemaError, za as runSync, zd as flow, zi as flatMap$1, zl as empty$9, zn as Literal$1, zo as catchDone, zr as remove$1, zs as succeedContext, zt as isLessThanBigInt, zu as none } from "./Schema-BfUmMefy.mjs";
4
- import { $t as offerUnsafe, A as catchTags$1, At as takeUntil, B as failCause$3, Bt as unwrap$5, C as make$47, D as catchCause$1, Dt as succeed$6, E as callback$1, Et as splitLines, F as drainFork, Ft as transduce, G as flattenArray, Gt as endUnsafe, H as filterMap, Ht as makeUnsafe$4, I as drop, It as unwrap$6, Jt as failCauseUnsafe, K as flattenIterable, Kt as fail$7, L as empty$11, Lt as fromTransform$1, M as concat$1, Mt as tap$1, N as decodeText, Nt as tapError, Ot as suspend$3, P as die$2, Pt as toAsyncIterable, Qt as offerAllUnsafe, R as ensuring$1, Rt as mapDone, S as isAiErrorReason, St as runForEachArray, T as broadcast, Tt as scoped$1, Ut as bounded, V as filter$2, Vt as make$48, W as flatten, Wt as end, X as fromChannel$1, Xt as offer, Y as fromAsyncIterable, Yt as make$46, Z as fromEffect, Zt as offerAll, _ as ToolkitRequiredError, _n as toLowerCase, _t as run$4, a as InvalidOutputError, at as mapArray, b as buildErrorDescription, bt as runFold, c as InvalidToolResultError, cn as update, ct as mapError$1, d as RateLimitError, dn as interrupt$2, dt as mkString, en as poll, et as fromPull, f as StructuredOutputError, fn as interruptAll, ft as onExit$1, g as ToolResultEncodingError, gn as camelToSnake, gt as provideService$1, h as ToolParameterValidationError, hn as runIn, ht as provideContext$1, i as InternalProviderError, in as unbounded, it as map$11, j as catch_$1, jt as takeWhile, k as catchReason$1, kt as take$1, l as NetworkError, ln as await_, lt as merge$4, m as ToolNotFoundError, mn as join$3, mt as pipeThroughChannel, n as AuthenticationError, nn as sliding, nt as fromReadableStream, o as InvalidRequestError$1, on as make$45, ot as mapArrayEffect, p as ToolConfigurationError, pn as interruptAllAs, pt as orDie$2, q as fromArray, qt as failCause$2, r as HttpResponseDetails$1, rn as take, rt as isStream, s as InvalidResponseError, sn as set$1, st as mapEffect$1, t as AiError, tn as shutdownUnsafe, tt as fromQueue, u as QuotaExhaustedError, un as getCurrent, ut as mergeAll$1, v as UnknownError$1, vt as runCollect, w as reasonFromHttpStatus, wt as runLast, x as isAiError, xt as runForEach, y as UnsupportedSchemaError, yt as runDrain, z as fail$6, zt as toTransform } from "./AiError-CsvdOsKR.mjs";
5
- import { n as makeUnsafe$5 } from "./Latch-B3e9629m.mjs";
3
+ import { $ as URLFromString, $a as tapCause, $i as gen, $l as format$1, $n as null_, $o as IllegalArgumentError, $r as decodeNative, $s as MinimumLogLevel, $t as isMultipleOf, A as Null, Aa as provideService, Ad as isString, Ai as contextWith, Al as last$1, An as getReferenceKey, Ar as toString, At as isFinite$1, Au as fromNullishOr, B as String$7, Ba as runSync, Bd as flow, Bi as flatMap$1, Bl as empty$9, Bn as Literal$1, Bo as catchDone, Br as remove$1, Bs as succeedContext, Bt as isLessThanBigInt, Bu as none, C as Literal, Ca as onInterrupt, Cc as ConsoleRef, Cd as isNotNull, Ci as catchIf, Cl as fromIterable, Cn as withDecodingDefaultKey, Co as TaggedClass$2, Cr as annotationExcludedKeys, Cs as pretty, Ct as isBetweenBigInt, D as Never, Da as promise, Dd as isNullish, Di as catchTags, Dl as isCanonicalArrayIndex, Dn as errorWithPath, Dr as fromInput, Ds as buildWithScope, Dt as isBetweenProperties, Du as flatMap$2, E as Natural, Ea as orElseSucceed, Ed as isNull, Ei as catchTag, El as isArrayNonEmpty, En as pick, Er as empty$5, Es as build, Et as isBetweenLength, Eu as filter$1, F as OptionFromOptional, Fa as result, Fd as constTrue, Fi as exit, Fl as reduce, Fn as decodeUnknownEffect, Fo as isSchedule, Fr as fromInput$1, Fs as mock, Ft as isGreaterThanOrEqualToBigInt, Fu as getOrUndefined, G as TaggedClass$1, Ga as serviceOption, Gi as forEach$1, Gl as getOrUndefined$2, Gn as applyToSelfOrLastLinkEncoding, Go as Random$1, Gr as fromSetCookie, Gs as addFinalizerExit, Gt as isMaxCodePoints, H as Struct, Ha as scoped, Hc as forkUnsafe, Hd as memoize, Hl as fail$2, Hn as PropertySignature, Hr as set, Hs as unwrap$4, Ht as isLessThanOrEqualTo, Hu as orElseSome, I as Record, Ia as retry, Id as constUndefined, Ii as fail$1, Il as sort, In as encodeEffect, Io as jittered, Ir as fromRecordUnsafe, Is as orDie$1, It as isGreaterThanOrEqualToDate, Iu as isNone, J as TaggedUnion, Ja as succeedNone, Ji as forkDetach, Jl as map$6, Jn as getIndexSignatureKeys, Jo as round, Jr as fromDateUnsafe, Jt as isMaxSize, Ju as mapInput, K as TaggedError$1, Ka as sleep, Ki as forever, Kl as isFailure$1, Kn as decodeTo, Kr as formatIso, Ks as close, Kt as isMaxLength, Ku as String$6, L as Redacted$4, La as runFork, Ld as constVoid, Li as failCause, Ll as span, Ln as Arrays, Lo as min, Lr as isRedactedName, Ls as provide$3, Lt as isIncluding, Lu as isSome, M as Number$2, Ma as raceFirst, Md as isUndefined, Mi as die, Ml as map$7, Mn as parseUriFragment, Mo as exponential, Mr as unwrap$3, Ms as fresh, Mt as isGreaterThanBigInt, Mu as getOrElse, N as Option, Na as repeat, Nd as or, Ni as effectify, Nl as match$3, Nn as getSubschemaKind, No as forever$1, Nr as CurrentRedactedNames$1, Ns as merge$3, Nt as isGreaterThanDate, Nu as getOrNull, O as NonEmptyArray, Oa as provide$1, Od as isObject$1, Oi as catch_, Ol as isReadonlyArrayNonEmpty, On as fromSchemaDraft07, Or as redactUrl, Os as effect, Ot as isBetweenSize, Ou as flatMapNullishOr, Pa as request, Pd as constFalse, Pi as ensuring, Pl as of, Pn as decodeEffect$1, Po as fromStep, Pr as empty$6, Ps as mergeAll, Pt as isGreaterThanOrEqualTo, Pu as getOrThrow$1, Q as URL$1, Qa as tap, Qi as fromResult, Ql as normalizeNonEmpty, Qn as mapOrSame, Qo as Done, Qr as encode, Qs as CurrentLogAnnotations, Qt as isMinSize, R as RedactedFromValue, Ra as runForkWith, Ri as failSync, Rl as assignProperty$1, Rn as Filter, Ro as spaced, Rr as merge$2, Rs as provideMerge, Rt as isInt, Ru as map$8, S as JsonObject$1, Sd as isIterable, Si as catchFilter, Sn as withDecodingDefault, Sr as Pointer, Ss as map$9, St as isBetween, Su as merge$1, Ta as orDie, Td as isNotUndefined, Ti as catchReason, Tl as isArray, Tn as omit, Tr as CurrentRedactedNames, Ts as squash, Tt as isBetweenDate, Tu as exists, U as StructWithRest, Ud as pipe, Ui as fn, Ul as failVoid, Un as Suspend, Uo as isDoneCause, Ur as setAll, Us as Scope, Ut as isLessThanOrEqualToBigInt, Uu as some, V as StringForLiteralAutocomplete, Va as scope, Vd as identity, Vi as flatMapEager, Vl as headUnsafe, Vn as Objects, Vr as retryAfterDelay, Vs as suspend$2, Vt as isLessThanDate, Vu as orElse$1, W as Symbol$1, Wa as service, Wd as pipeArguments, Wi as fnUntraced, Wl as getOrThrow, Wn as Union$1, Wr as empty$7, Ws as addFinalizer, Wt as isLessThanOrEqualToDate, Wu as toArray, X as Tuple, Xa as suspend, Xi as forkScoped, Xl as try_$1, Xn as isNever, Xo as currentTimeMillis, Xs as makeUnsafe$2, Xt as isMinLength, Y as TrueLiterals, Yi as forkIn, Yl as succeed$2, Yn as isJson, Yo as Clock, Ys as make$44, Yt as isMinCodePoints, Yu as Prototype, Z as TupleWithRest, Za as sync, Zi as fromOption, Zn as isOptional, Zr as decode$3, Zs as provide$2, Zt as isMinProperties, Zu as PipeInspectableProto, _ as Exit, _a as matchCauseEffect, _i as callback, _l as empty$4, _n as toCodecStringTree, _o as withParentSpan, _r as passthroughSubtype, _t as encodeTo, _u as getOrUndefined$1, aa as logDebug, ac as into, ai as acquireRelease, al as DisablePropagation, an as isUUID, ao as try_, ar as string$1, at as Void, au as max, b as Int$5, ba as onError, bc as succeed$3, bl as findFirstIndex, bn as toType, bo as zipWith, br as transformOptional, bs as makeDieReason, bt as instanceOf, bu as make$42, c as Date$2, ca as logInfo, cc as make$43, cd as getStackTraceLimit, ci as all, cl as Error$1, cn as make$41, co as uninterruptibleMask, cr as unknown$1, cs as fail$5, ct as declare, cu as seconds, da as map$5, dd as Class, di as annotateLogs, dl as taggedEnum, dn as mutable, do as useSpan, dr as transform$2, ds as fromReasons, dt as decodeSync, du as Reference, ea as ignore, ec as TracerTimingEnabled, ei as stripCrlf, el as sync$1, en as isPattern, er as optionalKey$1, et as Uint8Array$2, eu as fromInputUnsafe$1, f as DateTimeUtcFromString, fa as mapBothEager, fc as die$1, fd as NodeInspectSymbol, fi as as, fl as compose, fn as optional$2, fo as void_, fr as transformEffect$1, fs as hasInterrupts, ft as decodeTo$1, fu as Service, g as Error$2, gc as interrupt$1, gi as cachedWithTTL, gl as appendAll, gn as toCodecJson, gr as passthrough, gs as isDieReason, gt as encodeEffect$1, gu as getOption, h as DurationFromMillis, ha as match$4, hc as findErrorOption$1, hd as redact, hi as cached, hl as Array$1, hn as tag, ho as withFiber, ht as decodeUnknownSync, hu as get$2, i as Boolean$4, ia as isEffect, ii as stringOrRedacted, in as isStartingWith, io as tryPromise, ir as resolveIdentifier, is as annotate$1, it as Unknown, j as NullOr, ja as provideServiceEffect, jd as isTagged, jn as escapeToken, jr as fromBody, js as empty$10, jt as isGreaterThan, ju as fromUndefinedOr, k as NonEmptyString$1, ka as provideContext, kd as isObjectKeyword, ki as context, kl as join$2, kn as fromSchemaDraft2020_12, kr as setAll$1, ks as effectContext, kt as isEndingWith, la as logWarning, lc as makeUnsafe$1, ld as setStackTraceLimit, li as andThen, ll as TaggedClass, ln as makeFilter$1, lo as updateContext, lr as Transformation, ls as filterInterruptors, lt as decodeEffect, lu as toMillis, m as Duration, ma as mapError, mc as failCause$1, md as format, mi as asVoid, ml as toPredicate, mn as suspend$1, mo as whileLoop, ms as interruptors, mt as decodeUnknownOption, mu as empty$8, n as ArraySchema, na as interrupt, nc as doneUnsafe, ni as make$40, nn as isSchema, no as timeoutOption, nr as resolveAt, ns as TimeoutError, nt as UndefinedOr, nu as infinity, o as BooleanLiterals, oa as logError, oc as isDone, od as withFiber$1, ol as ParentSpan, on as isUnique, oo as undefined_, or as toEncoded, ou as millis, p as Defect, pa as mapEager, pc as fail$3, pi as asSome, pl as has, pn as optionalKey, pr as transformOptional$1, ps as hasInterruptsOnly, pt as decodeUnknownEffect$1, pu as add, q as TaggedStruct, qa as succeed$1, qi as forkChild, ql as isSuccess$1, qn as defaultParseOptions, qo as parse$1, qs as fork, qt as isMaxProperties, r as BigInt$2, ra as interruptible, rc as fail$4, ri as value, rn as isSchemaError, ro as timeoutOrElse, rr as resolveDescription, rs as UnknownError, rt as Union, ru as isFinite, s as Class$1, sa as logFatal, sc as isDoneUnsafe, sd as assignProperty, si as addFinalizer$1, sl as EncodingError, sn as link$1, so as uninterruptible, sr as toType$1, ss as done, st as check, su as minutes, t as Any, ta as ignoreCause, tc as _await, ti as isRedacted, tn as isPropertyNames, to as timeout, tr as replaceChecks, ts as StackTrace, tt as Uint8ArrayFromBase64, tu as hours, ua as makeSpanScoped, uc as succeed$5, ud as BaseProto, ui as annotateCurrentSpan, ul as TaggedError, un as makeFilterGroup, uo as updateService, ur as passthrough$1, us as findErrorOption, ut as decodeExit, uu as zero, v as FalseLiterals, va as matchEffect, vc as isFailure, vi as catchCause, vn as toEncoded$1, vo as withSpan$1, vr as transform$3, vs as isFailReason, vt as encodeUnknownEffect, vu as getOrUndefinedUnsafe, w as Literals$2, wa as option$1, wc as LogToStderr$1, wd as isNotNullish, wl as headNonEmpty, wr as jsonSchemaAnnotationKeys, ws as reasonAnnotations, wt as isBetweenCodePoints, wu as all$1, x as Json, xa as onExit, xc as void_$1, xd as hasProperty, xi as catchEager, xl as findLast, xn as withConstructorDefault, xo as equalBatchKeys, xr as InvalidValue$1, xs as makeFailReason, xt as is, xu as makeUnsafe$3, y as Finite, ya as never$1, yc as isSuccess, yi as catchCauseIf, yl as findFirst, yn as toJsonSchemaDocument, yo as yieldNow, yr as transformEffect, ys as isTimeoutError, yt as fromJsonString, yu as getUnsafe, z as SchemaError, zd as dual, zi as filterOrFail, zl as map$10, zn as FilterGroup, zo as toStep, zr as parseRetryAfter$1, zs as succeed$4, zt as isLessThan, zu as match$2 } from "./Schema-CFdSO6iH.mjs";
4
+ import { $t as offerUnsafe, A as catchTags$1, At as takeUntil, B as failCause$3, Bt as unwrap$5, C as make$47, D as catchCause$1, Dt as succeed$6, E as callback$1, Et as splitLines, F as drainFork, Ft as transduce, G as flattenArray, Gt as endUnsafe, H as filterMap, Ht as makeUnsafe$4, I as drop, It as unwrap$6, Jt as failCauseUnsafe, K as flattenIterable, Kt as fail$7, L as empty$11, Lt as fromTransform$1, M as concat$1, Mt as tap$1, N as decodeText, Nt as tapError, Ot as suspend$3, P as die$2, Pt as toAsyncIterable, Qt as offerAllUnsafe, R as ensuring$1, Rt as mapDone, S as isAiErrorReason, St as runForEachArray, T as broadcast, Tt as scoped$1, Ut as bounded, V as filter$2, Vt as make$48, W as flatten, Wt as end, X as fromChannel$1, Xt as offer, Y as fromAsyncIterable, Yt as make$46, Z as fromEffect, Zt as offerAll, _ as ToolkitRequiredError, _n as toLowerCase, _t as run$4, a as InvalidOutputError, at as mapArray, b as buildErrorDescription, bt as runFold, c as InvalidToolResultError, cn as update, ct as mapError$1, d as RateLimitError, dn as interrupt$2, dt as mkString, en as poll, et as fromPull, f as StructuredOutputError, fn as interruptAll, ft as onExit$1, g as ToolResultEncodingError, gn as camelToSnake, gt as provideService$1, h as ToolParameterValidationError, hn as runIn, ht as provideContext$1, i as InternalProviderError, in as unbounded, it as map$11, j as catch_$1, jt as takeWhile, k as catchReason$1, kt as take$1, l as NetworkError, ln as await_, lt as merge$4, m as ToolNotFoundError, mn as join$3, mt as pipeThroughChannel, n as AuthenticationError, nn as sliding, nt as fromReadableStream, o as InvalidRequestError$1, on as make$45, ot as mapArrayEffect, p as ToolConfigurationError, pn as interruptAllAs, pt as orDie$2, q as fromArray, qt as failCause$2, r as HttpResponseDetails$1, rn as take, rt as isStream, s as InvalidResponseError, sn as set$1, st as mapEffect$1, t as AiError, tn as shutdownUnsafe, tt as fromQueue, u as QuotaExhaustedError, un as getCurrent, ut as mergeAll$1, v as UnknownError$1, vt as runCollect, w as reasonFromHttpStatus, wt as runLast, x as isAiError, xt as runForEach, y as UnsupportedSchemaError, yt as runDrain, z as fail$6, zt as toTransform } from "./AiError-DBaKz35C.mjs";
5
+ import { n as makeUnsafe$5 } from "./Latch-DOdbsGMQ.mjs";
6
6
  import { a as mergeCapabilities, c as safeParse, i as Protocol$1, n as assertToolsCallTaskCapability, o as getLiteralValue, r as AjvJsonSchemaValidator, s as getObjectShape, t as assertClientRequestTaskCapability } from "./helpers-Bb68A2Sv.mjs";
7
7
  import { $ as array, B as SUPPORTED_PROTOCOL_VERSIONS, C as LATEST_PROTOCOL_VERSION, D as ListResourcesResultSchema, E as ListResourceTemplatesResultSchema, I as PromptListChangedNotificationSchema, J as isJSONRPCResultResponse, N as McpError, Q as any, R as ReadResourceResultSchema, S as JSONRPCMessageSchema, T as ListPromptsResultSchema, U as ToolListChangedNotificationSchema, W as isInitializedNotification, Z as ZodNumber, at as string$2, b as InitializeResultSchema, c as CreateMessageResultSchema, d as ElicitRequestSchema, et as boolean, f as ElicitResultSchema, h as GetPromptResultSchema, it as object, j as ListToolsResultSchema, l as CreateMessageResultWithToolsSchema, lt as NEVER, m as ErrorCode, n as CallToolResultSchema, nt as looseObject, o as CompleteResultSchema, ot as url, p as EmptyResultSchema, q as isJSONRPCRequest, rt as number$1, s as CreateMessageRequestSchema, st as _coercedNumber, tt as literal, u as CreateTaskResultSchema, w as ListChangedOptionsBaseSchema, z as ResourceListChangedNotificationSchema } from "./types-N9Z-HYP0.mjs";
8
8
  import { createRequire } from "node:module";
@@ -1101,8 +1101,8 @@ const nativeDecodeOptions = { alphabet: "base64url" };
1101
1101
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
1102
1102
  const codes = new Uint8Array(128);
1103
1103
  for (let i = 0; i < 64; i++) codes[alphabet.charCodeAt(i)] = i;
1104
- const decodeString = (str) => map$6(decode$2(str), (_) => decoder.decode(_));
1105
- const decoder = new TextDecoder("utf-8", { ignoreBOM: true });
1104
+ const decodeString = (str) => map$6(decode$2(str), (_) => decoder$1.decode(_));
1105
+ const decoder$1 = new TextDecoder("utf-8", { ignoreBOM: true });
1106
1106
  // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Terminal.js
1107
1107
  const TypeId$25 = "~effect/Terminal";
1108
1108
  const QuitErrorTypeId = "~effect/Terminal/QuitError";
@@ -2674,13 +2674,13 @@ var Uint8Array$1 = class extends Proto$14 {
2674
2674
  };
2675
2675
  }
2676
2676
  };
2677
- const encoder$1 = new TextEncoder();
2677
+ const encoder$2 = new TextEncoder();
2678
2678
  const buffer = globalThis.Buffer;
2679
- const encodeText = buffer !== void 0 ? (body) => buffer.from(body, "utf8") : (body) => encoder$1.encode(body);
2679
+ const encodeText = buffer !== void 0 ? (body) => buffer.from(body, "utf8") : (body) => encoder$2.encode(body);
2680
2680
  const text = (body, contentType) => {
2681
2681
  if (typeof body !== "string") body = body === void 0 ? "" : String(body);
2682
2682
  if (buffer !== void 0) return new Uint8Array$1(void 0, contentType ?? "text/plain", buffer.byteLength(body, "utf8"), body);
2683
- const bytes = encoder$1.encode(body);
2683
+ const bytes = encoder$2.encode(body);
2684
2684
  return new Uint8Array$1(bytes, contentType ?? "text/plain", bytes.length, body);
2685
2685
  };
2686
2686
  const jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?? "application/json");
@@ -3801,7 +3801,7 @@ var UndiciResponse = class extends Class {
3801
3801
  return pipeArguments(this, arguments);
3802
3802
  }
3803
3803
  };
3804
- const loadUpgrade = promise(() => import("./upgrade-t590zYhO.mjs"));
3804
+ const loadUpgrade = promise(() => import("./upgrade-C4aOEWJH.mjs"));
3805
3805
  const takeOver = (conn, head, signal) => {
3806
3806
  if (head !== void 0 && head.length > 0) conn.unshift(head);
3807
3807
  conn.on("error", constVoid);
@@ -9357,7 +9357,7 @@ const make$21 = (options) => Socket.of({
9357
9357
  reader: options.reader,
9358
9358
  writer: options.writer
9359
9359
  });
9360
- const encoder = new TextEncoder();
9360
+ const encoder$1 = new TextEncoder();
9361
9361
  const CloseEventTypeId = "~effect/socket/Socket/CloseEvent";
9362
9362
  const isCloseEvent = (u) => hasProperty(u, CloseEventTypeId);
9363
9363
  const SocketErrorTypeId = "~effect/socket/Socket/SocketError";
@@ -9478,7 +9478,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
9478
9478
  }
9479
9479
  function push(data) {
9480
9480
  buffer.push(data);
9481
- if (highWaterMark !== void 0) bufferSize += typeof data === "string" ? encoder.encode(data).byteLength : data.byteLength;
9481
+ if (highWaterMark !== void 0) bufferSize += typeof data === "string" ? encoder$1.encode(data).byteLength : data.byteLength;
9482
9482
  if (waiter !== void 0) deliver();
9483
9483
  if (pausable && bufferSize >= highWaterMark) pauseWebSocket();
9484
9484
  else if (!pausable && !waiter && highWaterMark !== void 0 && bufferSize > highWaterMark) fail(new SocketError({ reason: new SocketReadError({ cause: new Error(`Socket highWaterMark of ${highWaterMark} bytes exceeded`) }) }));
@@ -9952,7 +9952,7 @@ const prefix = dual(2, (self, prefix) => {
9952
9952
  modifyUint8Array: (key, f) => self.modifyUint8Array(`${prefix}${key}`, f)
9953
9953
  };
9954
9954
  });
9955
- const layerFileSystem = (directory) => effect(KeyValueStore)(gen(function* () {
9955
+ const layerFileSystem$1 = (directory) => effect(KeyValueStore)(gen(function* () {
9956
9956
  const fs = yield* FileSystem;
9957
9957
  const path = yield* Path$3;
9958
9958
  const withKeyPath = (method, key, f) => key.length === 0 || key === "." || key === ".." ? fail$1(new KeyValueStoreError({
@@ -10054,30 +10054,6 @@ const toSchemaStore = (self, schema) => {
10054
10054
  isEmpty: self.isEmpty
10055
10055
  };
10056
10056
  };
10057
- // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Model.js
10058
- const TypeId$8 = "~effect/ai/Model";
10059
- var ProviderName = class extends Service()("effect/ai/Model/ProviderName") {};
10060
- var ModelName = class extends Service()("effect/ai/Model/ModelName") {};
10061
- const Proto$4 = {
10062
- [TypeId$8]: TypeId$8,
10063
- ["~effect/Layer"]: {
10064
- _ROut: identity,
10065
- _E: identity,
10066
- _RIn: identity
10067
- },
10068
- get captureRequirements() {
10069
- const self = this;
10070
- return contextWith((context) => succeed$1(provide$3(self, succeedContext(context))));
10071
- },
10072
- ...PipeInspectableProto,
10073
- toJSON() {
10074
- return {
10075
- _id: "effect/ai/Model",
10076
- provider: this.provider
10077
- };
10078
- }
10079
- };
10080
- const make$18 = (provider, modelName, layer) => Object.assign(Object.create(Proto$4), { provider }, merge$2(layer, succeedContext(ProviderName.context(provider).pipe(add(ModelName, modelName)))));
10081
10057
  // src/ApplyPatch.ts
10082
10058
  const BEGIN = "*** Begin Patch";
10083
10059
  const END = "*** End Patch";
@@ -10421,7 +10397,7 @@ var ExaError = class extends TaggedError$1()("ExaError", { cause: Defect() }) {}
10421
10397
  const layer$8 = effect(ExaSearch, gen(function* () {
10422
10398
  const scope$5 = yield* scope;
10423
10399
  const getClient = yield* cachedWithTTL(gen(function* () {
10424
- const McpClient = yield* tryPromise(() => import("./McpClient-BCxZZgnA.mjs"));
10400
+ const McpClient = yield* tryPromise(() => import("./McpClient-B-FFG6Pg.mjs"));
10425
10401
  const context = yield* buildWithScope(McpClient.layer, scope$5);
10426
10402
  return get$2(context, McpClient.McpClient);
10427
10403
  }), (exit) => isSuccess(exit) ? infinity : zero);
@@ -10493,7 +10469,7 @@ const layer$7 = effect(WebToMarkdown, gen(function* () {
10493
10469
  });
10494
10470
  }));
10495
10471
  // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Tool.js
10496
- const TypeId$7 = "~effect/ai/Tool";
10472
+ const TypeId$8 = "~effect/ai/Tool";
10497
10473
  const ProviderDefinedTypeId = "~effect/ai/Tool/ProviderDefined";
10498
10474
  const DynamicTypeId = "~effect/ai/Tool/Dynamic";
10499
10475
  const isUserDefined = (u) => hasProperty(u, "~effect/ai/Tool") && !isProviderDefined(u) && !isDynamic(u);
@@ -10501,8 +10477,8 @@ const isProviderDefined = (u) => hasProperty(u, ProviderDefinedTypeId);
10501
10477
  const isDynamic = (u) => hasProperty(u, DynamicTypeId);
10502
10478
  const isClientExecuted = (tool) => tool.execution === "client";
10503
10479
  const clone = (self, overrides) => Object.assign(Object.create(Object.getPrototypeOf(self)), self, overrides);
10504
- const Proto$3 = {
10505
- [TypeId$7]: {
10480
+ const Proto$4 = {
10481
+ [TypeId$8]: {
10506
10482
  _Config: identity,
10507
10483
  _Requirements: identity
10508
10484
  },
@@ -10538,19 +10514,19 @@ const Proto$3 = {
10538
10514
  }
10539
10515
  };
10540
10516
  const ProviderDefinedProto = {
10541
- ...Proto$3,
10517
+ ...Proto$4,
10542
10518
  [ProviderDefinedTypeId]: ProviderDefinedTypeId
10543
10519
  };
10544
10520
  const DynamicProto = {
10545
- ...Proto$3,
10521
+ ...Proto$4,
10546
10522
  [DynamicTypeId]: DynamicTypeId
10547
10523
  };
10548
10524
  const userDefinedProto = (options) => {
10549
- const self = Object.assign(Object.create(Proto$3), options);
10525
+ const self = Object.assign(Object.create(Proto$4), options);
10550
10526
  self.id = `effect/ai/Tool/${options.name}`;
10551
10527
  return self;
10552
10528
  };
10553
- const make$17 = (name, options) => {
10529
+ const make$18 = (name, options) => {
10554
10530
  const successSchema = options?.success ?? Void;
10555
10531
  const failureSchema = options?.failure ?? Never;
10556
10532
  return userDefinedProto({
@@ -10652,7 +10628,7 @@ function isEmptyParamsRecord(indexSignature) {
10652
10628
  return indexSignature.parameter === string$1 && isNever(indexSignature.type);
10653
10629
  }
10654
10630
  // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Toolkit.js
10655
- const TypeId$6 = "~effect/ai/Toolkit";
10631
+ const TypeId$7 = "~effect/ai/Toolkit";
10656
10632
  const FailureOrigin = Reference("effect/ai/Toolkit/FailureOrigin", { defaultValue: () => "result" });
10657
10633
  const PreliminaryBuffer = Reference("effect/ai/Toolkit/PreliminaryBuffer", { defaultValue: () => "unbounded" });
10658
10634
  const RecordToolArguments = Reference("effect/ai/Toolkit/RecordToolArguments", { defaultValue: () => false });
@@ -10665,7 +10641,7 @@ const stringifyToolArguments = (params) => {
10665
10641
  };
10666
10642
  const failureCause = (error, origin) => annotate$1(fail$5(error), make$42(FailureOrigin, origin));
10667
10643
  const failureOrigin = (error) => isSchemaError(error) ? "result" : "handler";
10668
- const Proto$2 = {
10644
+ const Proto$3 = {
10669
10645
  ...Prototype({
10670
10646
  label: "Toolkit",
10671
10647
  evaluate: fnUntraced(function* (parent) {
@@ -10793,7 +10769,7 @@ const Proto$2 = {
10793
10769
  };
10794
10770
  })
10795
10771
  }),
10796
- [TypeId$6]: TypeId$6,
10772
+ [TypeId$7]: TypeId$7,
10797
10773
  of: identity,
10798
10774
  toHandlers(build) {
10799
10775
  return gen({ self: this }, function* () {
@@ -10821,14 +10797,14 @@ const Proto$2 = {
10821
10797
  };
10822
10798
  }
10823
10799
  };
10824
- const makeProto$2 = (tools) => Object.assign(function() {}, Proto$2, { tools });
10800
+ const makeProto$2 = (tools) => Object.assign(function() {}, Proto$3, { tools });
10825
10801
  const resolveInput = (...tools) => {
10826
10802
  const output = {};
10827
10803
  for (const tool of tools) assignProperty(output, tool.name, tool);
10828
10804
  return output;
10829
10805
  };
10830
10806
  const empty = makeProto$2({});
10831
- const make$16 = (...tools) => makeProto$2(resolveInput(...tools));
10807
+ const make$17 = (...tools) => makeProto$2(resolveInput(...tools));
10832
10808
  const merge = (...toolkits) => {
10833
10809
  const tools = {};
10834
10810
  for (const toolkit of toolkits) for (const [name, tool] of Object.entries(toolkit.tools)) assignProperty(tools, name, tool);
@@ -11222,7 +11198,7 @@ var CommandLimits = class extends Reference("clanka/AgentTools/CommandLimits", {
11222
11198
  timeout: void 0,
11223
11199
  outputChars: void 0
11224
11200
  }) }) {};
11225
- const makeBashTool = (timeout) => make$17("bash", {
11201
+ const makeBashTool = (timeout) => make$18("bash", {
11226
11202
  description: "Run a bash command and return a task.",
11227
11203
  parameters: Struct({
11228
11204
  command: String$7,
@@ -11233,12 +11209,12 @@ const makeBashTool = (timeout) => make$17("bash", {
11233
11209
  dependencies: [CurrentDirectory]
11234
11210
  });
11235
11211
  const globNamesDirectory = (glob) => glob.split("/").slice(0, -1).some((segment) => segment.length > 0 && !/[*?[\]{}]/.test(segment));
11236
- const AgentTools = make$16(make$17("changeDirectory", {
11212
+ const AgentTools = make$17(make$18("changeDirectory", {
11237
11213
  description: "Change the executor's working directory to an existing directory and return its absolute path. The change persists across your scripts.",
11238
11214
  parameters: String$7.annotate({ identifier: "directory" }),
11239
11215
  success: String$7,
11240
11216
  dependencies: [DirectoryChanger]
11241
- }), make$17("readFile", {
11217
+ }), make$18("readFile", {
11242
11218
  description: "Read a file and optionally filter the lines to return. Returns null if the file doesn't exist. For png/jpeg/gif/webp files the image itself is attached to your next turn.",
11243
11219
  parameters: Struct({
11244
11220
  path: String$7,
@@ -11248,12 +11224,12 @@ const AgentTools = make$16(make$17("changeDirectory", {
11248
11224
  }),
11249
11225
  success: NullOr(String$7),
11250
11226
  dependencies: [CurrentDirectory, ImageAttacher]
11251
- }), make$17("run", {
11227
+ }), make$18("run", {
11252
11228
  description: "Run a shell command and return its output. If it takes too long it will become a background task. Use 'bash' for more control.",
11253
11229
  parameters: String$7.annotate({ identifier: "command" }),
11254
11230
  success: String$7,
11255
11231
  dependencies: [CurrentDirectory]
11256
- }), make$17("rg", {
11232
+ }), make$18("rg", {
11257
11233
  description: "Search for a pattern in files using ripgrep",
11258
11234
  parameters: Struct({
11259
11235
  pattern: String$7,
@@ -11263,7 +11239,7 @@ const AgentTools = make$16(make$17("changeDirectory", {
11263
11239
  }),
11264
11240
  success: String$7,
11265
11241
  dependencies: [CurrentDirectory]
11266
- }), make$17("subagent", {
11242
+ }), make$18("subagent", {
11267
11243
  description: "Delegate a task to another software engineer / sub-agent. With `background: true` the sub-agent works in the background, and its result is sent to you when it finishes.",
11268
11244
  parameters: Struct({
11269
11245
  prompt: String$7,
@@ -11272,57 +11248,57 @@ const AgentTools = make$16(make$17("changeDirectory", {
11272
11248
  success: Task,
11273
11249
  failure: String$7,
11274
11250
  dependencies: [AgentTaskExecutor]
11275
- }), make$17("gh", {
11251
+ }), make$18("gh", {
11276
11252
  description: "Use the GitHub CLI to run a command - use this instead of the bash tool.",
11277
11253
  parameters: ArraySchema(String$7).annotate({ identifier: "args" }),
11278
11254
  success: String$7,
11279
11255
  dependencies: [CurrentDirectory]
11280
- }), makeBashTool(defaultBashTimeout), make$17("applyPatch", {
11256
+ }), makeBashTool(defaultBashTimeout), make$18("applyPatch", {
11281
11257
  description: "Add, update or remove multiple files with a git diff / unified diff / wrapped patch.",
11282
11258
  parameters: String$7.annotate({ identifier: "patch" }),
11283
11259
  success: String$7,
11284
11260
  dependencies: [CurrentDirectory]
11285
- }), make$17("writeFile", {
11261
+ }), make$18("writeFile", {
11286
11262
  description: "Write content to a file, creating parent directories if needed.",
11287
11263
  parameters: Struct({
11288
11264
  path: String$7,
11289
11265
  content: Union([String$7, Uint8Array$2.annotate({ identifier: "Uint8Array" })])
11290
11266
  }),
11291
11267
  dependencies: [CurrentDirectory]
11292
- }), make$17("removeFile", {
11268
+ }), make$18("removeFile", {
11293
11269
  description: "Remove a file.",
11294
11270
  parameters: String$7.annotate({ identifier: "path" }),
11295
11271
  dependencies: [CurrentDirectory]
11296
- }), make$17("renameFile", {
11272
+ }), make$18("renameFile", {
11297
11273
  description: "Rename or move a file, creating parent directories if needed.",
11298
11274
  parameters: Struct({
11299
11275
  from: String$7,
11300
11276
  to: String$7
11301
11277
  }),
11302
11278
  dependencies: [CurrentDirectory]
11303
- }), make$17("ls", {
11279
+ }), make$18("ls", {
11304
11280
  description: "List the contents of a directory",
11305
11281
  parameters: String$7.annotate({ identifier: "directory" }),
11306
11282
  success: ArraySchema(String$7),
11307
11283
  dependencies: [CurrentDirectory]
11308
- }), make$17("webSearch", {
11284
+ }), make$18("webSearch", {
11309
11285
  description: "Search the web for recent information.",
11310
11286
  parameters: ExaSearchOptions,
11311
11287
  success: String$7
11312
- }), make$17("fetchMarkdown", {
11288
+ }), make$18("fetchMarkdown", {
11313
11289
  description: "Fetch a web page and convert it to markdown.",
11314
11290
  parameters: String$7.annotate({ identifier: "url" }),
11315
11291
  success: String$7
11316
- }), make$17("sleep", {
11292
+ }), make$18("sleep", {
11317
11293
  description: "Sleep for a specified number of milliseconds",
11318
11294
  parameters: Finite.annotate({ identifier: "ms" })
11319
- }), make$17("taskOutput", {
11295
+ }), make$18("taskOutput", {
11320
11296
  description: "Return the status and output so far of one of your tasks: a background bash command or a sub-agent.",
11321
11297
  parameters: String$7.annotate({ identifier: "id" }),
11322
11298
  success: Task,
11323
11299
  failure: String$7,
11324
11300
  dependencies: [AgentTaskExecutor]
11325
- }), make$17("waitTasks", {
11301
+ }), make$18("waitTasks", {
11326
11302
  description: "Wait until the given tasks have ended and return them, in the order given.",
11327
11303
  parameters: Struct({
11328
11304
  ids: ArraySchema(String$7),
@@ -11331,17 +11307,17 @@ const AgentTools = make$16(make$17("changeDirectory", {
11331
11307
  success: ArraySchema(Task),
11332
11308
  failure: String$7,
11333
11309
  dependencies: [AgentTaskExecutor]
11334
- }), make$17("stopTask", {
11310
+ }), make$18("stopTask", {
11335
11311
  description: "Stop one of your tasks.",
11336
11312
  parameters: String$7.annotate({ identifier: "id" }),
11337
11313
  failure: String$7,
11338
11314
  dependencies: [AgentTaskExecutor]
11339
- }), make$17("listTasks", {
11315
+ }), make$18("listTasks", {
11340
11316
  description: "List the tasks you have started, with their status.",
11341
11317
  parameters: Void,
11342
11318
  success: ArraySchema(Task),
11343
11319
  dependencies: [AgentTaskExecutor]
11344
- }), make$17("messageAgent", {
11320
+ }), make$18("messageAgent", {
11345
11321
  description: "Send a message to one of your sub-agents.",
11346
11322
  parameters: Struct({
11347
11323
  id: String$7,
@@ -11349,13 +11325,13 @@ const AgentTools = make$16(make$17("changeDirectory", {
11349
11325
  }),
11350
11326
  failure: String$7,
11351
11327
  dependencies: [AgentTaskExecutor]
11352
- }), make$17("taskComplete", {
11328
+ }), make$18("taskComplete", {
11353
11329
  description: "Only call this when the task is fully complete and you have a final output message to send.",
11354
11330
  parameters: String$7.annotate({ identifier: "output" }),
11355
11331
  dependencies: [TaskCompleter],
11356
11332
  failure: String$7
11357
11333
  }));
11358
- const SearchTool = make$16(make$17("search", {
11334
+ const SearchTool = make$17(make$18("search", {
11359
11335
  description: "Semantic code search - you just need to describe what you are looking for",
11360
11336
  parameters: String$7.annotate({ identifier: "query" }),
11361
11337
  success: String$7,
@@ -12328,10 +12304,10 @@ const makeCollectorUnsafe = () => {
12328
12304
  });
12329
12305
  };
12330
12306
  // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/FiberSet.js
12331
- const TypeId$5 = "~effect/FiberSet";
12332
- const isFiberSet = (u) => hasProperty(u, TypeId$5);
12333
- const Proto$1 = {
12334
- [TypeId$5]: TypeId$5,
12307
+ const TypeId$6 = "~effect/FiberSet";
12308
+ const isFiberSet = (u) => hasProperty(u, TypeId$6);
12309
+ const Proto$2 = {
12310
+ [TypeId$6]: TypeId$6,
12335
12311
  [Symbol.iterator]() {
12336
12312
  if (this.state._tag === "Closed") return empty$9();
12337
12313
  return this.state.backing[Symbol.iterator]();
@@ -12345,7 +12321,7 @@ const Proto$1 = {
12345
12321
  }
12346
12322
  };
12347
12323
  const makeUnsafe = (backing, deferred) => {
12348
- const self = Object.create(Proto$1);
12324
+ const self = Object.create(Proto$2);
12349
12325
  self.state = {
12350
12326
  _tag: "Open",
12351
12327
  backing
@@ -12353,7 +12329,7 @@ const makeUnsafe = (backing, deferred) => {
12353
12329
  self.deferred = deferred;
12354
12330
  return self;
12355
12331
  };
12356
- const make$15 = () => acquireRelease(sync(() => makeUnsafe(new Set(), makeUnsafe$1())), (set) => suspend(() => {
12332
+ const make$16 = () => acquireRelease(sync(() => makeUnsafe(new Set(), makeUnsafe$1())), (set) => suspend(() => {
12357
12333
  const state = set.state;
12358
12334
  if (state._tag === "Closed") return void_;
12359
12335
  set.state = { _tag: "Closed" };
@@ -12441,9 +12417,9 @@ var ClientAbort = class extends Service()("effect/rpc/RpcSchema/ClientAbort") {
12441
12417
  }));
12442
12418
  };
12443
12419
  // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/Rpc.js
12444
- const TypeId$4 = "~effect/rpc/Rpc";
12445
- const Proto = {
12446
- [TypeId$4]: TypeId$4,
12420
+ const TypeId$5 = "~effect/rpc/Rpc";
12421
+ const Proto$1 = {
12422
+ [TypeId$5]: TypeId$5,
12447
12423
  pipe() {
12448
12424
  return pipeArguments(this, arguments);
12449
12425
  },
@@ -12527,12 +12503,12 @@ const Proto = {
12527
12503
  };
12528
12504
  const makeProto$1 = (options) => {
12529
12505
  function Rpc() {}
12530
- Object.setPrototypeOf(Rpc, Proto);
12506
+ Object.setPrototypeOf(Rpc, Proto$1);
12531
12507
  Object.assign(Rpc, options);
12532
12508
  Rpc.key = `effect/rpc/Rpc/${options._tag}`;
12533
12509
  return Rpc;
12534
12510
  };
12535
- const make$14 = (tag, options) => {
12511
+ const make$15 = (tag, options) => {
12536
12512
  const successSchema = options?.success ?? Void;
12537
12513
  const errorSchema = options?.error ?? Never;
12538
12514
  const defectSchema = options?.defect ?? Defect();
@@ -12704,7 +12680,7 @@ const makeNoSerialization = fnUntraced(function* (group, options) {
12704
12680
  spanId: span.spanId,
12705
12681
  sampled: span.sampled
12706
12682
  } : {},
12707
- headers: merge$3(parentFiber.getRef(CurrentHeaders), headers),
12683
+ headers: merge$2(parentFiber.getRef(CurrentHeaders), headers),
12708
12684
  ...discard ? { discard: true } : {}
12709
12685
  });
12710
12686
  let fiber;
@@ -12775,7 +12751,7 @@ const makeNoSerialization = fnUntraced(function* (group, options) {
12775
12751
  spanId: span.spanId,
12776
12752
  sampled: span.sampled
12777
12753
  } : {},
12778
- headers: merge$3(fiber.getRef(CurrentHeaders), headers)
12754
+ headers: merge$2(fiber.getRef(CurrentHeaders), headers)
12779
12755
  }).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, onError((cause) => {
12780
12756
  if (!hasInterruptsOnly(cause)) entries.delete(id);
12781
12757
  return failCause$2(queue, cause);
@@ -12866,7 +12842,7 @@ const makeNoSerialization = fnUntraced(function* (group, options) {
12866
12842
  };
12867
12843
  });
12868
12844
  let clientIdCounter = 0;
12869
- const make$13 = fnUntraced(function* (group, options) {
12845
+ const make$14 = fnUntraced(function* (group, options) {
12870
12846
  const clientId = clientIdCounter++;
12871
12847
  const { codecFor, run, send, supportsAck, supportsTransferables } = yield* Protocol;
12872
12848
  const rpcSchemas = makeRpcSchemas(codecFor);
@@ -13136,7 +13112,7 @@ const makeProto = (options) => Object.assign(function() {}, RpcGroupProto, {
13136
13112
  requests: options.requests,
13137
13113
  annotations: options.annotations
13138
13114
  });
13139
- const make$12 = (...rpcs) => makeProto({
13115
+ const make$13 = (...rpcs) => makeProto({
13140
13116
  requests: new Map(rpcs.map((rpc) => [rpc._tag, rpc])),
13141
13117
  annotations: empty$8()
13142
13118
  });
@@ -13854,7 +13830,7 @@ const makeLocalWith = fnUntraced(function* (options) {
13854
13830
  const excluded = excludedToolNames(options.excludeTools);
13855
13831
  const offersFetch = !excluded.has("fetch");
13856
13832
  const search = yield* serviceOption(SemanticSearch);
13857
- const BuiltInTools = make$16(...Object.values(merge(isSome(search) ? AgentToolsWithSearch : AgentTools, make$16(makeBashTool(commandLimits.timeout ?? defaultBashTimeout))).tools).filter((tool) => !excluded.has(tool.name)));
13833
+ const BuiltInTools = make$17(...Object.values(merge(isSome(search) ? AgentToolsWithSearch : AgentTools, make$17(makeBashTool(commandLimits.timeout ?? defaultBashTimeout))).tools).filter((tool) => !excluded.has(tool.name)));
13858
13834
  const hasSearch = "search" in BuiltInTools.tools;
13859
13835
  const AllTools = merge(BuiltInTools, options.tools ?? empty);
13860
13836
  const tools = yield* AllTools;
@@ -14031,7 +14007,7 @@ const makeLocalWith = fnUntraced(function* (options) {
14031
14007
  };
14032
14008
  });
14033
14009
  const makeRpc = gen(function* () {
14034
- const client = yield* make$13(Rpcs, { spanPrefix: "AgentExecutorClient" });
14010
+ const client = yield* make$14(Rpcs, { spanPrefix: "AgentExecutorClient" });
14035
14011
  return AgentExecutor.of({
14036
14012
  capabilities: orDie(client.capabilities()),
14037
14013
  execute: (opts) => Scope.useSync((scope) => {
@@ -14135,10 +14111,10 @@ const ExecuteOutput = TaggedUnion({
14135
14111
  kind: TaskKind
14136
14112
  }
14137
14113
  });
14138
- var Rpcs = class extends make$12(make$14("capabilities", { success: Capabilities }), make$14("respond", { payload: {
14114
+ var Rpcs = class extends make$13(make$15("capabilities", { success: Capabilities }), make$15("respond", { payload: {
14139
14115
  id: Finite,
14140
14116
  response: AgentResponse
14141
- } }), make$14("execute", {
14117
+ } }), make$15("execute", {
14142
14118
  payload: Struct({
14143
14119
  script: String$7,
14144
14120
  environment: ExecutionEnvironment,
@@ -14148,21 +14124,21 @@ var Rpcs = class extends make$12(make$14("capabilities", { success: Capabilities
14148
14124
  }),
14149
14125
  success: ExecuteOutput,
14150
14126
  stream: true
14151
- }), make$14("awaitTask", {
14127
+ }), make$15("awaitTask", {
14152
14128
  payload: { id: String$7 },
14153
14129
  success: Task,
14154
14130
  error: String$7
14155
- }), make$14("claimTask", {
14131
+ }), make$15("claimTask", {
14156
14132
  payload: { id: String$7 },
14157
14133
  success: Boolean$4,
14158
14134
  error: String$7
14159
- }), make$14("renderEnvironment", {
14135
+ }), make$15("renderEnvironment", {
14160
14136
  payload: {
14161
14137
  environment: ExecutionEnvironment,
14162
14138
  reset: Boolean$4
14163
14139
  },
14164
14140
  success: EnvironmentUpdate
14165
- }), make$14("executeUnsafe", {
14141
+ }), make$15("executeUnsafe", {
14166
14142
  payload: Struct({
14167
14143
  tool: String$7,
14168
14144
  params: optionalKey(Json),
@@ -14411,6 +14387,233 @@ var QueueWriteStream = class extends Writable {
14411
14387
  callback();
14412
14388
  }
14413
14389
  };
14390
+ // src/AcpSessionStore.ts
14391
+ const ThoughtLevel = Literals$2([
14392
+ "none",
14393
+ "minimal",
14394
+ "low",
14395
+ "medium",
14396
+ "high",
14397
+ "xhigh",
14398
+ "max"
14399
+ ]);
14400
+ var SessionRecord = class extends Class$1("clanka/Acp/SessionRecord")({
14401
+ cwd: String$7,
14402
+ model: String$7,
14403
+ thoughtLevel: ThoughtLevel,
14404
+ fastMode: optionalKey(Boolean$4),
14405
+ history: Prompt,
14406
+ environment: optionalKey(ExecutionEnvironment)
14407
+ }) {};
14408
+ var AcpSessionStoreError = class extends TaggedError$1()("AcpSessionStoreError", {
14409
+ message: String$7,
14410
+ cause: optional$2(Defect())
14411
+ }) {};
14412
+ var AcpSessionStore = class extends Service()("clanka/AcpSessionStore") {};
14413
+ const keyValueStore = (kvs) => {
14414
+ const store = toSchemaStore(prefix(kvs, "session-"), SessionRecord);
14415
+ return AcpSessionStore.of({
14416
+ get: (sessionId) => store.get(sessionId).pipe(mapError((cause) => new AcpSessionStoreError({
14417
+ message: cause.message,
14418
+ cause
14419
+ }))),
14420
+ set: (sessionId, record) => store.set(sessionId, record).pipe(mapError((cause) => new AcpSessionStoreError({
14421
+ message: cause.message,
14422
+ cause
14423
+ })))
14424
+ });
14425
+ };
14426
+ const layerKeyValueStore = effect(AcpSessionStore, gen(function* () {
14427
+ return keyValueStore(yield* KeyValueStore);
14428
+ }));
14429
+ const Snapshot = TaggedStruct("Snapshot", {
14430
+ record: SessionRecord,
14431
+ id: String$7
14432
+ });
14433
+ const Update = TaggedStruct("Update", {
14434
+ cwd: optionalKey(String$7),
14435
+ model: optionalKey(String$7),
14436
+ thoughtLevel: optionalKey(ThoughtLevel),
14437
+ fastMode: optionalKey(Boolean$4),
14438
+ environment: optionalKey(ExecutionEnvironment),
14439
+ messages: optionalKey(ArraySchema(Message)),
14440
+ parent: String$7,
14441
+ id: String$7
14442
+ });
14443
+ const Entry = Union([Snapshot, Update]);
14444
+ const EntryJson = fromJsonString(toCodecJson(Entry));
14445
+ const decodeEntry$2 = decodeExit(EntryJson);
14446
+ const encodeEntry = encodeEffect$1(EntryJson);
14447
+ const fieldKeys = [
14448
+ "cwd",
14449
+ "model",
14450
+ "thoughtLevel",
14451
+ "fastMode",
14452
+ "environment"
14453
+ ];
14454
+ const applyUpdate = (record, update) => {
14455
+ const { _tag, messages, parent: _parent, id: _id, ...fields } = update;
14456
+ return new SessionRecord({
14457
+ ...record,
14458
+ ...fields,
14459
+ history: messages === void 0 ? record.history : fromMessages([...record.history.content, ...messages])
14460
+ });
14461
+ };
14462
+ const diff = (previous, next) => {
14463
+ const before = previous.history.content;
14464
+ const after = next.history.content;
14465
+ if (after.length < before.length || before.some((message, index) => after[index] !== message)) return;
14466
+ const changes = {};
14467
+ for (const key of fieldKeys) {
14468
+ if (previous[key] === next[key]) continue;
14469
+ if (next[key] === void 0) return void 0;
14470
+ changes[key] = next[key];
14471
+ }
14472
+ if (after.length > before.length) changes.messages = after.slice(before.length);
14473
+ return changes;
14474
+ };
14475
+ const storeError = (message) => (cause) => new AcpSessionStoreError({
14476
+ message,
14477
+ cause
14478
+ });
14479
+ const encodeLine = (entry) => encodeEntry(entry).pipe(map$5((json) => encoder.encode(`${json}\n`)), mapError(storeError("Failed to encode session")));
14480
+ const newline = 10;
14481
+ const encoder = new TextEncoder();
14482
+ const decoder = new TextDecoder();
14483
+ const layerFileSystem = (directory) => effect(AcpSessionStore, gen(function* () {
14484
+ const fs = yield* FileSystem;
14485
+ const path = yield* Path$3;
14486
+ yield* fs.makeDirectory(directory, { recursive: true });
14487
+ const semaphore = yield* make$48(1);
14488
+ const files = new Map();
14489
+ const fileFor = (sessionId) => path.join(directory, `${encodeURIComponent(sessionId)}.jsonl`);
14490
+ const read = fnUntraced(function* (sessionId) {
14491
+ const file = fileFor(sessionId);
14492
+ files.delete(sessionId);
14493
+ const result = yield* fs.readFile(file).pipe(asSome, catchReason("PlatformError", "NotFound", () => succeedNone), mapError(storeError(`Failed to read session ${sessionId}`)));
14494
+ if (isNone(result)) return none();
14495
+ const bytes = result.value;
14496
+ let record;
14497
+ let id = "";
14498
+ let start = 0;
14499
+ while (start < bytes.length) {
14500
+ const end = bytes.indexOf(newline, start);
14501
+ if (end === -1) break;
14502
+ const entry = decodeEntry$2(decoder.decode(bytes.subarray(start, end)));
14503
+ start = end + 1;
14504
+ if (entry._tag === "Failure") continue;
14505
+ const line = entry.value;
14506
+ if (line._tag === "Snapshot") {
14507
+ if (record !== void 0) continue;
14508
+ record = line.record;
14509
+ } else {
14510
+ if (record === void 0 || line.parent !== id) continue;
14511
+ record = applyUpdate(record, line);
14512
+ }
14513
+ id = line.id;
14514
+ }
14515
+ if (record === void 0) return yield* new AcpSessionStoreError({ message: `Session file for ${sessionId} does not start with a snapshot` });
14516
+ if (start < bytes.length) yield* logWarning("Ignoring an incomplete end of an ACP session file").pipe(annotateLogs({
14517
+ sessionId,
14518
+ file
14519
+ }));
14520
+ else files.set(sessionId, {
14521
+ record,
14522
+ id,
14523
+ size: bytes.length,
14524
+ tail: bytes.slice(-64)
14525
+ });
14526
+ return some(record);
14527
+ });
14528
+ const writeSnapshot = fnUntraced(function* (sessionId, record) {
14529
+ const file = fileFor(sessionId);
14530
+ const temporary = `${file}.${crypto.randomUUID()}.tmp`;
14531
+ const id = crypto.randomUUID();
14532
+ const bytes = yield* encodeLine(Snapshot.make({
14533
+ record,
14534
+ id
14535
+ }));
14536
+ files.delete(sessionId);
14537
+ yield* fs.writeFile(temporary, bytes).pipe(andThen(fs.rename(temporary, file)), onError(() => ignore(fs.remove(temporary, { force: true }))), mapError(storeError(`Failed to write session ${sessionId}`)));
14538
+ files.set(sessionId, {
14539
+ record,
14540
+ id,
14541
+ size: bytes.length,
14542
+ tail: bytes.slice(-64)
14543
+ });
14544
+ });
14545
+ const append = fnUntraced(function* (sessionId, known, bytes) {
14546
+ const handle = yield* fs.open(fileFor(sessionId), { flag: "a+" });
14547
+ const info = yield* handle.stat;
14548
+ if (Number(info.size) !== known.size) return false;
14549
+ const tail = new Uint8Array(known.tail.length);
14550
+ if ((yield* handle.read(tail, { position: BigInt(known.size - tail.length) })) !== tail.length || tail.some((byte, index) => byte !== known.tail[index])) return false;
14551
+ if (bytes.length === 0) return true;
14552
+ files.delete(sessionId);
14553
+ yield* handle.writeAll(bytes);
14554
+ return true;
14555
+ }, scoped, (effect, sessionId) => mapError(effect, storeError(`Failed to write session ${sessionId}`)));
14556
+ const write = fnUntraced(function* (sessionId, record) {
14557
+ const known = files.get(sessionId);
14558
+ const changes = known && diff(known.record, record);
14559
+ if (known !== void 0 && changes !== void 0) {
14560
+ if (Object.keys(changes).length === 0) {
14561
+ if (yield* append(sessionId, known, new Uint8Array())) {
14562
+ files.set(sessionId, {
14563
+ ...known,
14564
+ record
14565
+ });
14566
+ return;
14567
+ }
14568
+ } else {
14569
+ const id = crypto.randomUUID();
14570
+ const bytes = yield* encodeLine(Update.make({
14571
+ ...changes,
14572
+ parent: known.id,
14573
+ id
14574
+ }));
14575
+ if (yield* append(sessionId, known, bytes)) {
14576
+ files.set(sessionId, {
14577
+ record,
14578
+ id,
14579
+ size: known.size + bytes.length,
14580
+ tail: bytes.slice(-64)
14581
+ });
14582
+ return;
14583
+ }
14584
+ }
14585
+ }
14586
+ yield* writeSnapshot(sessionId, record);
14587
+ });
14588
+ return AcpSessionStore.of({
14589
+ get: (sessionId) => semaphore.withPermit(read(sessionId)),
14590
+ set: (sessionId, record) => semaphore.withPermit(write(sessionId, record))
14591
+ });
14592
+ }));
14593
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Model.js
14594
+ const TypeId$4 = "~effect/ai/Model";
14595
+ var ProviderName = class extends Service()("effect/ai/Model/ProviderName") {};
14596
+ var ModelName = class extends Service()("effect/ai/Model/ModelName") {};
14597
+ const Proto = {
14598
+ [TypeId$4]: TypeId$4,
14599
+ ["~effect/Layer"]: {
14600
+ _ROut: identity,
14601
+ _E: identity,
14602
+ _RIn: identity
14603
+ },
14604
+ get captureRequirements() {
14605
+ const self = this;
14606
+ return contextWith((context) => succeed$1(provide$3(self, succeedContext(context))));
14607
+ },
14608
+ ...PipeInspectableProto,
14609
+ toJSON() {
14610
+ return {
14611
+ _id: "effect/ai/Model",
14612
+ provider: this.provider
14613
+ };
14614
+ }
14615
+ };
14616
+ const make$12 = (provider, modelName, layer) => Object.assign(Object.create(Proto), { provider }, merge$3(layer, succeedContext(ProviderName.context(provider).pipe(add(ModelName, modelName)))));
14414
14617
  // node_modules/.pnpm/zod@4.4.2/node_modules/zod/v4/classic/compat.js
14415
14618
  const ZodIssueCode = {
14416
14619
  invalid_type: "invalid_type",
@@ -19551,7 +19754,7 @@ const make$9 = fnUntraced(function* (params) {
19551
19754
  const queue = yield* make$46();
19552
19755
  const deferredFinishParts = [];
19553
19756
  if (preResolvedStreamParts.length > 0) yield* offerAll(queue, preResolvedStreamParts);
19554
- const toolCallFibers = yield* make$15();
19757
+ const toolCallFibers = yield* make$16();
19555
19758
  const toolCallSemaphore = concurrency === "unbounded" ? void 0 : yield* make$48(concurrency);
19556
19759
  const pendingToolCalls = new Map();
19557
19760
  const bufferedToolCalls = [];
@@ -19868,8 +20071,8 @@ const withParameterMode = (tool, mode) => {
19868
20071
  }
19869
20072
  return tools[mode] ??= tool.setParameters(mode === "opaque" ? Unknown : hasProviderParameters(tool) ? toEncoded$1(tool.parametersSchema) : toEncoded$1(toCodecJson(tool.parametersSchema)));
19870
20073
  };
19871
- const makeToolkitWithEncodedParameters = (toolkit) => make$16(...Object.values(toolkit.tools).map((tool) => withParameterMode(tool, "encoded")));
19872
- const makeToolkitWithOpaqueParameters = (toolkit) => make$16(...Object.values(toolkit.tools).map((tool) => withParameterMode(tool, "opaque")));
20074
+ const makeToolkitWithEncodedParameters = (toolkit) => make$17(...Object.values(toolkit.tools).map((tool) => withParameterMode(tool, "encoded")));
20075
+ const makeToolkitWithOpaqueParameters = (toolkit) => make$17(...Object.values(toolkit.tools).map((tool) => withParameterMode(tool, "opaque")));
19873
20076
  const isToolCallValidationDeferred = (options) => options.disableToolCallResolution === true && options.toolCallValidation === "deferred";
19874
20077
  const UndeclaredToolCallPart = ToolCallPart("", Unknown).mapFields((fields) => ({
19875
20078
  ...fields,
@@ -21259,7 +21462,7 @@ And then you will receive back the console output:
21259
21462
  files: [ 'package.json' ]
21260
21463
  package.json: { name: 'my-project', version: '1.0.0' }
21261
21464
  \`\`\``;
21262
- const ReadSkillTools = make$16(make$17("readSkill", {
21465
+ const ReadSkillTools = make$17(make$18("readSkill", {
21263
21466
  description: "Read the instructions of a skill listed under Skills, by its name.",
21264
21467
  parameters: String$7.annotate({ identifier: "name" }),
21265
21468
  success: String$7,
@@ -21294,7 +21497,7 @@ const makeLoopTools = fnUntraced(function* (options) {
21294
21497
  });
21295
21498
  const errorMessage = (error) => typeof error === "string" ? error : error instanceof Error ? error.message : JSON.stringify(error) ?? String(error);
21296
21499
  var ScriptExecutor = class extends Service()("clanka/Agent/ScriptExecutor") {};
21297
- const SingleTools = make$16(make$17("execute", {
21500
+ const SingleTools = make$17(make$18("execute", {
21298
21501
  description: "Execute javascript code and return the output",
21299
21502
  parameters: Struct({ script: String$7 }),
21300
21503
  success: String$7,
@@ -21339,23 +21542,6 @@ const responseToSummary = (response) => {
21339
21542
  return parts.join("\n\n");
21340
21543
  };
21341
21544
  // src/Acp.ts
21342
- const ThoughtLevel = Literals$2([
21343
- "none",
21344
- "minimal",
21345
- "low",
21346
- "medium",
21347
- "high",
21348
- "xhigh",
21349
- "max"
21350
- ]);
21351
- var SessionRecord = class extends Class$1("clanka/Acp/SessionRecord")({
21352
- cwd: String$7,
21353
- model: String$7,
21354
- thoughtLevel: ThoughtLevel,
21355
- fastMode: optionalKey(Boolean$4),
21356
- history: Prompt,
21357
- environment: optionalKey(ExecutionEnvironment)
21358
- }) {};
21359
21545
  var RpcError = class extends TaggedError$1()("AcpRpcError", {
21360
21546
  code: Number$2,
21361
21547
  message: String$7
@@ -21549,13 +21735,12 @@ const historyUpdates = (history) => {
21549
21735
  return updates;
21550
21736
  };
21551
21737
  const make$7 = fnUntraced(function* (options) {
21552
- const kvs = yield* KeyValueStore;
21738
+ const store = yield* AcpSessionStore;
21553
21739
  const { contextWindow } = yield* CompactionConfig;
21554
21740
  const size = Number.isFinite(contextWindow) ? Math.max(0, Math.round(contextWindow)) : 0;
21555
21741
  const http = yield* serviceOption(HttpClient);
21556
21742
  const fs = yield* serviceOption(FileSystem);
21557
21743
  const path = yield* serviceOption(Path$3);
21558
- const store = toSchemaStore(prefix(kvs, "session-"), SessionRecord);
21559
21744
  const scope$3 = yield* scope;
21560
21745
  const sessions = new Map();
21561
21746
  yield* addFinalizer$1(() => {
@@ -21616,14 +21801,24 @@ const make$7 = fnUntraced(function* (options) {
21616
21801
  configOptions: configOptions(session)
21617
21802
  };
21618
21803
  });
21619
- const persist = (session) => store.set(session.id, new SessionRecord({
21620
- cwd: session.cwd,
21621
- model: session.model,
21622
- thoughtLevel: session.thoughtLevel,
21623
- fastMode: session.fastMode,
21624
- history: session.agent.history.current,
21625
- environment: session.agent.environment.current
21626
- })).pipe(catch_((error) => logWarning("Failed to persist session", error)));
21804
+ const persist = (session) => {
21805
+ const history = session.agent.history.current;
21806
+ const environment = session.agent.environment.current;
21807
+ return store.set(session.id, new SessionRecord({
21808
+ cwd: session.cwd,
21809
+ model: session.model,
21810
+ thoughtLevel: session.thoughtLevel,
21811
+ fastMode: session.fastMode,
21812
+ history,
21813
+ environment
21814
+ })).pipe(tap(() => sync(() => {
21815
+ session.stored = {
21816
+ history,
21817
+ environment
21818
+ };
21819
+ })), catch_((error) => logWarning("Failed to persist session", error)));
21820
+ };
21821
+ const persistCommitted = (session) => suspend(() => session.stored?.history === session.agent.history.current && session.stored.environment === session.agent.environment.current ? void_ : persist(session));
21627
21822
  const openSession = fnUntraced(function* (id, record, mcpServers) {
21628
21823
  const sessionScope = yield* fork(scope$3);
21629
21824
  let makeAgent = options.makeAgent(record.cwd);
@@ -21650,7 +21845,8 @@ const make$7 = fnUntraced(function* (options) {
21650
21845
  toolCalls: 0,
21651
21846
  announcedSubagents: new Set(),
21652
21847
  scope: sessionScope,
21653
- mcpFailures
21848
+ mcpFailures,
21849
+ stored: void 0
21654
21850
  };
21655
21851
  sessions.set(id, session);
21656
21852
  return session;
@@ -21843,6 +22039,8 @@ const make$7 = fnUntraced(function* (options) {
21843
22039
  }]
21844
22040
  });
21845
22041
  }
22042
+ case "HistoryAppended":
22043
+ case "HistoryReplaced": return persistCommitted(session);
21846
22044
  default: return void_;
21847
22045
  }
21848
22046
  };
@@ -21989,7 +22187,7 @@ const make$7 = fnUntraced(function* (options) {
21989
22187
  session.running = yield* runPrompt(session, input).pipe(provide$1(model), forkChild);
21990
22188
  const exit$1 = yield* exit(join$3(session.running));
21991
22189
  session.running = void 0;
21992
- yield* persist(session);
22190
+ yield* persistCommitted(session);
21993
22191
  if (isSuccess(exit$1)) return { stopReason: "end_turn" };
21994
22192
  if (hasInterruptsOnly(exit$1.cause)) return { stopReason: "cancelled" };
21995
22193
  return yield* toRpcError(exit$1.cause);
@@ -26168,7 +26366,7 @@ const mapProviderResults = (inputLength, results) => {
26168
26366
  };
26169
26367
  // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiEmbeddingModel.js
26170
26368
  var Config$2 = class extends Service()("@effect/ai-openai/OpenAiEmbeddingModel/Config") {};
26171
- const model$5 = (model, options) => make$18("openai", model, merge$2(layer$3({
26369
+ const model$5 = (model, options) => make$12("openai", model, merge$3(layer$3({
26172
26370
  model,
26173
26371
  config: {
26174
26372
  ...options.config,
@@ -28366,7 +28564,7 @@ const transformToolCallParams$1 = fnUntraced(function* (options, toolName, toolP
28366
28564
  return yield* decodeEffect(codec)(toolParams).pipe(flatMap$1((decoded) => encodeUnknownEffect(toCodecJson(tool.parametersSchema))(decoded)), orElseSucceed(() => toolParams));
28367
28565
  });
28368
28566
  // package.json
28369
- var version$1 = "0.25.3";
28567
+ var version$1 = "0.26.0";
28370
28568
  // src/ClaudeAgent.ts
28371
28569
  const minimumClaudeCodeVersion = "2.1.248";
28372
28570
  const serverName = "clanka";
@@ -29040,7 +29238,7 @@ const toParts = (parts) => {
29040
29238
  }
29041
29239
  return result;
29042
29240
  };
29043
- const model$4 = (model, options) => make$18("claude", model, merge$2(layerLanguageModel(model, options), AgentModelConfig.layer({
29241
+ const model$4 = (model, options) => make$12("claude", model, merge$3(layerLanguageModel(model, options), AgentModelConfig.layer({
29044
29242
  supportsImages: options?.supportsImages,
29045
29243
  cutStreamOnSteering: false
29046
29244
  })));
@@ -29279,8 +29477,8 @@ var CodexAuth = class CodexAuth extends Service()("clanka/CodexAuth") {
29279
29477
  };
29280
29478
  // src/Codex.ts
29281
29479
  const layerClient$3 = layer$4({ apiUrl: "https://chatgpt.com/backend-api/codex" }).pipe(provide$3(CodexAuth.layerClient));
29282
- const model$3 = (model, options) => make$18("openai", model, layerModel(model, options));
29283
- const modelWebSocket$1 = (model, options) => make$18("openai", model, layerModel(model, options).pipe(merge$2(fresh(layerWebSocketMode))));
29480
+ const model$3 = (model, options) => make$12("openai", model, layerModel(model, options));
29481
+ const modelWebSocket$1 = (model, options) => make$12("openai", model, layerModel(model, options).pipe(merge$3(fresh(layerWebSocketMode))));
29284
29482
  const layerModel = (model, options) => suspend$2(() => layer$2({
29285
29483
  model,
29286
29484
  config: {
@@ -29293,7 +29491,7 @@ const layerModel = (model, options) => suspend$2(() => layer$2({
29293
29491
  ...options?.reasoning
29294
29492
  }
29295
29493
  }
29296
- })).pipe(merge$2(AgentModelConfig.layer({
29494
+ })).pipe(merge$3(AgentModelConfig.layer({
29297
29495
  ...pick(options ?? {}, AgentModelConfig.optionKeys),
29298
29496
  systemPromptTransform: (system, effect) => withConfigOverride$1(effect, { instructions: system })
29299
29497
  })));
@@ -30616,7 +30814,7 @@ var GithubCopilotAuth = class GithubCopilotAuth extends Service()("clanka/Github
30616
30814
  };
30617
30815
  // src/Copilot.ts
30618
30816
  const layerClient$2 = layer$1({ apiUrl: API_URL }).pipe(provide$3(GithubCopilotAuth.layerClient));
30619
- const model$2 = (model, options) => make$18("openai", model, mergeAll(layer({
30817
+ const model$2 = (model, options) => make$12("openai", model, mergeAll(layer({
30620
30818
  model,
30621
30819
  config: omit(options ?? {}, options?.reasoning === null ? ["reasoning", ...AgentModelConfig.optionKeys] : AgentModelConfig.optionKeys)
30622
30820
  }), AgentModelConfig.layer(pick(options ?? {}, AgentModelConfig.optionKeys)), succeed$4(SummarizerTransform, (effect) => withConfigOverride(effect, { max_output_tokens: summarizerMaxOutputTokens }))));
@@ -30753,7 +30951,7 @@ var ModelsRepo = class ModelsRepo extends Service()("clanka/ModelsRepo") {
30753
30951
  };
30754
30952
  // src/OpenAiCompat.ts
30755
30953
  const layerClient$1 = (options) => layer$1(options);
30756
- const model$1 = (model, options) => make$18("openai-compat", model, mergeAll(layer({
30954
+ const model$1 = (model, options) => make$12("openai-compat", model, mergeAll(layer({
30757
30955
  model,
30758
30956
  config: {
30759
30957
  ...omit(options ?? {}, ["reasoning", ...AgentModelConfig.optionKeys]),
@@ -30921,7 +31119,7 @@ var XaiAuth = class XaiAuth extends Service()("clanka/XaiAuth") {
30921
31119
  };
30922
31120
  // src/Xai.ts
30923
31121
  const layerClient = layer$4({ apiUrl: "https://api.x.ai/v1" }).pipe(provide$3(XaiAuth.layerClient));
30924
- const modelWebSocket = (model, options) => make$18("xai", model, mergeAll(layer$2({
31122
+ const modelWebSocket = (model, options) => make$12("xai", model, mergeAll(layer$2({
30925
31123
  model,
30926
31124
  config: {
30927
31125
  ...omit(options ?? {}, ["reasoning", ...AgentModelConfig.optionKeys]),
@@ -31126,10 +31324,16 @@ const fetch$1 = Boolean("fetch").pipe(withDescription$1("Expose the global Fetch
31126
31324
  const mcp = Boolean("mcp").pipe(withDescription$1("Start the MCP servers from ~/.config/clanka/mcp.json, ./.mcp.json and --mcp-config. Disable with --no-mcp or CLANKA_MCP=false."), withFallbackConfig(Boolean$3("CLANKA_MCP").pipe(withDefault$2(true))));
31127
31325
  const mcpConfig = String$1("mcp-config").pipe(withDescription$1("An MCP config file in the { \"mcpServers\": { ... } } format. Repeatable; a later file wins."), atLeast(0));
31128
31326
  const mcpSummary = (status) => `MCP: ${Object.entries(status).map(([name, server]) => server._tag === "Connected" ? `${name} (${server.tools.length} tools)` : `${name} failed: ${server.error.split("\n")[0]}`).join(", ")}`;
31129
- const Kvs = unwrap$4(gen(function* () {
31327
+ const configDirectory = gen(function* () {
31130
31328
  const path = yield* Path$3;
31131
31329
  const configHome = yield* NonEmptyString("XDG_CONFIG_HOME").pipe(orElse(() => NonEmptyString("HOME").pipe(map$3((home) => path.join(home, ".config")))));
31132
- return layerFileSystem(path.join(configHome, "clanka"));
31330
+ return path.join(configHome, "clanka");
31331
+ });
31332
+ const Kvs = unwrap$4(map$5(configDirectory, layerFileSystem$1)).pipe(provide$3(layer$9));
31333
+ const AcpSessions = unwrap$4(gen(function* () {
31334
+ const path = yield* Path$3;
31335
+ const directory = yield* configDirectory;
31336
+ return layerFileSystem(path.join(directory, "sessions"));
31133
31337
  })).pipe(provide$3(layer$9));
31134
31338
  const Search = (directory) => unwrap$4(gen(function* () {
31135
31339
  const apiKey = yield* Redacted$3("OPENAI_API_KEY").pipe(option);
@@ -31138,7 +31342,7 @@ const Search = (directory) => unwrap$4(gen(function* () {
31138
31342
  return empty$10;
31139
31343
  }
31140
31344
  const path = yield* Path$3;
31141
- return (yield* promise(() => import("./SemanticSearch-Cw10ozz8.mjs"))).layer({
31345
+ return (yield* promise(() => import("./SemanticSearch-C3a7LAQr.mjs"))).layer({
31142
31346
  directory: process.cwd(),
31143
31347
  database: path.join(directory, "search.sqlite")
31144
31348
  }).pipe(provide$3(model$5("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$4({ apiKey: apiKey.value })));
@@ -31186,7 +31390,7 @@ const acp = make$26("acp", {
31186
31390
  auxiliary: auxiliaryModels(flags)
31187
31391
  })
31188
31392
  });
31189
- })), provide((flags) => mergeAll(ConversationMode.layer(false), succeed$4(LogToStderr, true), layerLog, compactionConfig(flags), openAiCompatModels(flags))));
31393
+ })), provide((flags) => mergeAll(AcpSessions, ConversationMode.layer(false), succeed$4(LogToStderr, true), layerLog, compactionConfig(flags), openAiCompatModels(flags))));
31190
31394
  make$26("clanka", {
31191
31395
  provider,
31192
31396
  fetch: fetch$1,
@@ -31209,7 +31413,7 @@ make$26("clanka", {
31209
31413
  files: mcpConfig,
31210
31414
  enabled: mcp
31211
31415
  });
31212
- const OutputFormatter = yield* promise(() => import("./OutputFormatter-ByMjyBhe.mjs"));
31416
+ const OutputFormatter = yield* promise(() => import("./OutputFormatter-DhhP2i-7.mjs"));
31213
31417
  const { model, effort } = yield* match$2(modelRaw, {
31214
31418
  onSome: (selected) => succeed$1(parseModel(selected)),
31215
31419
  onNone: () => selectModel(provider)