clanka 0.7.6 → 0.8.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 (51) hide show
  1. package/dist/Acp.d.ts +21 -2
  2. package/dist/Acp.d.ts.map +1 -1
  3. package/dist/Acp.js +68 -13
  4. package/dist/Acp.js.map +1 -1
  5. package/dist/Acp.test.js +118 -10
  6. package/dist/Acp.test.js.map +1 -1
  7. package/dist/AcpImage.test.js +1 -0
  8. package/dist/AcpImage.test.js.map +1 -1
  9. package/dist/Agent.d.ts.map +1 -1
  10. package/dist/Agent.js +10 -0
  11. package/dist/Agent.js.map +1 -1
  12. package/dist/Agent.test.js +47 -2
  13. package/dist/Agent.test.js.map +1 -1
  14. package/dist/AgentOutput.d.ts +8 -0
  15. package/dist/AgentOutput.d.ts.map +1 -1
  16. package/dist/AgentOutput.js +8 -0
  17. package/dist/AgentOutput.js.map +1 -1
  18. package/dist/AgentTools.d.ts.map +1 -1
  19. package/dist/AgentTools.js +22 -7
  20. package/dist/AgentTools.js.map +1 -1
  21. package/dist/AgentTools.test.d.ts +2 -0
  22. package/dist/AgentTools.test.d.ts.map +1 -0
  23. package/dist/AgentTools.test.js +63 -0
  24. package/dist/AgentTools.test.js.map +1 -0
  25. package/dist/bin/{Effect-DdkIoNCD.mjs → Effect-CeAMoJlg.mjs} +7 -2
  26. package/dist/bin/Effect-CeAMoJlg.mjs.map +1 -0
  27. package/dist/bin/{McpClient-0f-vTQC-.mjs → McpClient-zQibhsnA.mjs} +3 -3
  28. package/dist/bin/{McpClient-0f-vTQC-.mjs.map → McpClient-zQibhsnA.mjs.map} +1 -1
  29. package/dist/bin/{OutputFormatter-DN8OGwuK.mjs → OutputFormatter-C7Awn0DS.mjs} +3 -3
  30. package/dist/bin/{OutputFormatter-DN8OGwuK.mjs.map → OutputFormatter-C7Awn0DS.mjs.map} +1 -1
  31. package/dist/bin/{Schema-gTtf66A-.mjs → Schema-Bc06DxcV.mjs} +2 -2
  32. package/dist/bin/{Schema-gTtf66A-.mjs.map → Schema-Bc06DxcV.mjs.map} +1 -1
  33. package/dist/bin/{SemanticSearch-CBs6yELV.mjs → SemanticSearch-BPxQoRSC.mjs} +4 -4
  34. package/dist/bin/{SemanticSearch-CBs6yELV.mjs.map → SemanticSearch-BPxQoRSC.mjs.map} +1 -1
  35. package/dist/bin/{Stream-B5ebASRi.mjs → Stream-DlGXvw0L.mjs} +2 -2
  36. package/dist/bin/{Stream-B5ebASRi.mjs.map → Stream-DlGXvw0L.mjs.map} +1 -1
  37. package/dist/bin/cli.mjs +107 -40
  38. package/dist/bin/cli.mjs.map +1 -1
  39. package/dist/cli.js +17 -8
  40. package/dist/cli.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/Acp.test.ts +188 -9
  43. package/src/Acp.ts +92 -17
  44. package/src/AcpImage.test.ts +1 -0
  45. package/src/Agent.test.ts +54 -2
  46. package/src/Agent.ts +10 -0
  47. package/src/AgentOutput.ts +8 -0
  48. package/src/AgentTools.test.ts +116 -0
  49. package/src/AgentTools.ts +32 -12
  50. package/src/cli.ts +22 -9
  51. package/dist/bin/Effect-DdkIoNCD.mjs.map +0 -1
package/dist/bin/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env -S node --optimize-for-size
2
- import { $ as isEffect, $a as getOrUndefined, $n as effect, $t as uninterruptibleMask, A as ensuring, Aa as Reference, Ai as decodeBase64$1, An as StackTrace, Ar as isDoneUnsafe, As as identity, At as result, B as fnUntraced, Ba as makeUnsafe$3, Bi as appendAll, Bn as hasInterruptsOnly, Br as void_$1, Bt as sleep, C as catch_, Ca as minutes, Cs as constFalse, Ct as promise, Da as toMillis, Dn as Done, Dt as raceFirst, E as contextWith, Ea as seconds, En as nextBetween, Er as doneUnsafe, Es as constVoid, Et as provideService, F as filterOrFail, Fa as getOption, Fi as TaggedClass, Fn as fail$4, Fo as BaseProto, Fr as interrupt$1, Fs as pipeArguments, G as forkIn, Ga as flatMap$2, Gn as isTimeoutError, Go as symbolRedactable, Gt as tap, H as forEach$2, Ha as all, Hi as findFirst, Hr as ConsoleRef, Ht as succeedNone, I as flatMap$1, Ia as getOrUndefined$1, Ii as TaggedError, In as filterInterruptors, Io as Class, It as scope, Ji as isArrayNonEmpty, Jo as symbol$1, Jt as timeoutOrElse, K as forkScoped, Ka as flatMapNullishOr, Ki as fromIterable$1, Kt as tapCause, L as flatMapEager, La as getOrUndefinedUnsafe, Li as taggedEnum, Lo as NodeInspectSymbol, Lr as isFailure$1, Lt as scoped, M as fail$2, Ma as add, Mi as encodeBase64, Mn as UnknownError$1, Mo as assignProperty, Mr as die$1, Mt as runFork, N as failCause, Na as empty$7, No as getStackTraceLimit, Nr as fail$3, Ns as pipe, Nt as runForkWith, O as die, Oi as DisablePropagation, Or as into, Os as dual, Ot as repeat, Pa as get$3, Pi as Error$2, Pn as done, Po as setStackTraceLimit, Pr as failCause$1, Pt as runSync, Q as interruptible, Qa as getOrNull, Qi as last$1, Qn as buildWithScope, Qt as uninterruptible, Ra as getUnsafe, Ri as Array$1, Ro as toJson, Rr as isSuccess$1, S as catchTags, Sa as millis, So as Prototype, Sr as MinimumLogLevel, Ss as or, St as orElseSucceed, T as context, Tn as Random$1, To as PipeInspectableProto, Ts as constUndefined, Tt as provideContext, U as forever, Ua as exists, Ui as findFirstIndex, Ur as LogToStderr$1, Ut as suspend, Va as merge$2, Vi as empty$6, Vn as interruptors, Vt as succeed$2, W as forkChild, Wa as filter$1, Wi as findLast, Wo as redact$1, Wt as sync, X as ignore, Xa as fromUndefinedOr, Xi as isReadonlyArrayNonEmpty, Xn as pretty, Xt as try_, Y as gen, Ya as fromNullishOr, Yi as isCanonicalArrayIndex, Yt as tryPromise, Z as interrupt, Za as getOrElse, Zi as join$1, Zn as squash, Zo as hash, Zt as undefined_, _ as catchFilter, _a as fromInputUnsafe$1, _n as min, _t as onExit, a as andThen, aa as empty$8, an as whileLoop, ao as match$2, ar as mergeAll, at as makeSpanScoped, b as catchReason, ba as isFinite, bn as catchDone, br as provide$2, bs as isUndefined, bt as option$1, c as as, ca as failVoid, cn as withParentSpan, co as orElseSome, cr as provide$3, ct as mapEager, d as cached, da as isFailure, dn as zipWith, dr as succeedContext, ds as isNotUndefined, dt as match$4, ea as map$6, en as updateContext, eo as isNone, er as effectContext, es as structure, et as logDebug, f as cachedWithTTL, fa as isSuccess, fr as unwrap$1, fs as isNull, g as catchEager, ga as format$1, gn as jittered, gr as close, gt as onError, h as catchDefect, ha as try_$1, hn as isSchedule, hr as addFinalizerExit, hs as isObject, ht as never, i as all$1, io as map$7, ir as merge$3, it as logWarning, j as exit, ja as Service, ji as decodeBase64UrlString, jn as TimeoutError, jo as withFiber$1, jr as makeUnsafe$2, js as memoize, jt as retry, k as effectify, ka as zero, ki as ParentSpan, kr as isDone, ks as flow, kt as request, l as asSome, ln as withSpan$1, lo as some, lr as provideMerge, ls as isNotNull, lt as mapError, m as catchCause, ma as succeed$1, mn as exponential, mr as addFinalizer$1, mt as matchEffect, na as of, nn as useSpan, no as isSome, nr as empty$9, ns as hasProperty, nt as logFatal, o as annotateCurrentSpan, oa as headUnsafe, on as withFiber, oo as none, or as mock, ot as map$5, p as callback, pn as TaggedClass$1, pr as Scope, ps as isNullish, pt as matchCauseEffect, q as fromOption, qi as headNonEmpty, qo as equals, qt as timeout, r as addFinalizer, ra as reduce, rn as void_, rr as fresh, rt as logInfo, s as annotateLogs, sa as fail$1, so as orElse$1, sr as orDie$1, ss as isIterable, st as mapBothEager, t as acquireRelease, ta as match$3, tn as updateService, ts as symbol$2, tt as logError, u as asVoid, ua as getOrUndefined$2, un as yieldNow, uo as toArray, ur as succeed$4, us as isNotNullish, ut as mapErrorEager, v as catchIf, va as infinity, vn as passthrough, vs as isString, w as clockWith, wi as sync$1, wr as _await, ws as constTrue, wt as provide$1, x as catchTag, xo as strictEqual, xr as CurrentLogAnnotations, xt as orDie, yn as spaced, yr as makeUnsafe$1, ys as isTagged, yt as onInterrupt, z as fn, za as make$42, zn as hasInterrupts, zo as format, zr as succeed$3, zt as serviceOption } from "./Effect-DdkIoNCD.mjs";
3
- import { $ as transduce, A as mapEffect$1, At as interrupt$2, B as run$4, Bt as normalizeNonEmpty, C as fromPull, D as map$8, Dt as makeUnsafe$5, E as isStream, Et as update, F as onEnd, Ft as runIn, G as runForEachArray, I as orDie$2, It as camelToSnake, J as succeed$5, L as pipeThroughChannel, Lt as toLowerCase, M as merge$4, Mt as interruptAllAs, N as mergeAll$1, O as mapArray, Ot as await_, P as mkString, Pt as join$2, Q as tap$1, R as provideContext$1, Rt as parse$2, St as unbounded, T as fromReadableStream, Tt as set$2, U as runFold, V as runCollect, W as runForEach, X as take$1, Y as suspend$1, Z as takeUntil, _t as offerAll, a as catchTags$1, at as toTransform, b as fromEffect, bt as poll, c as die$2, ct as makeUnsafe$4, d as ensuring$1, dt as endUnsafe, et as unwrap$3, f as fail$5, ft as fail$6, g as flattenIterable, gt as offer, h as flatMap$3, ht as make$44, i as catchReason$1, it as pipeTo, j as mapError$1, jt as interruptAll, k as mapArrayEffect, kt as getCurrent, l as drop, lt as bounded, m as filterMap, mt as failCauseUnsafe, n as callback$1, nt as map$9, o as catch_$1, ot as unwrap$2, p as filter$2, pt as failCause$2, q as splitLines, rt as mapDone, s as decodeText, st as make$45, t as broadcast, tt as fromTransform$1, u as empty$10, ut as end, vt as offerAllUnsafe, w as fromQueue, wt as make$43, x as fromIterable$2, xt as take, y as fromChannel$1, yt as offerUnsafe, z as provideService$1, zt as round } from "./Stream-B5ebASRi.mjs";
4
- import { $ as declare, $t as Filter, An as InvalidValue$1, At as tag, B as TaggedUnion, Bn as stringOrRedacted, Bt as fromInput$1, C as Never, Cn as transform$3, Ct as isSchemaError, D as NullOr, Dn as passthrough$1, Dt as mutable, E as Null, Et as makeFilterGroup, F as String$5, Ft as toType, G as Uint8Array$2, H as Tuple, Hn as assignProperty$1, Ht as toString, I as Struct, It as withConstructorDefault, J as Union, Jt as _is, K as Uint8ArrayFromBase64, Kt as omit, L as StructWithRest, Ln as isRedacted, Lt as withDecodingDefault, M as Record, Mn as formatIso, Mt as toCodecStringTree, N as Redacted$1, Nt as toEncoded$1, O as Number$2, Ot as optional$2, P as SchemaError, Pn as fromDateUnsafe, Pt as toJsonSchemaDocument, Q as check, Qt as Arrays, R as TaggedClass$2, Rn as make$46, Rt as withDecodingDefaultKey, Sn as passthrough$2, St as isSchema, T as NonEmptyString$1, Tn as transformOptional, Tt as makeFilter, U as URL$1, Un as makeEquivalence, Ut as empty$12, V as TrueLiterals, Vn as Clock, Vt as setAll$1, W as URLFromString, Wn as map$10, Wt as fromSetCookie, X as Void, Xt as decodeUnknownEffect, Y as Unknown, Yt as decodeEffect$1, Zt as encodeEffect, _ as Int$1, _n as string, _t as isMaxLength, a as BooleanLiterals, an as Union$1, at as decodeUnknownSync, b as Literals$2, bn as unknown, bt as isPattern, cn as isNever, ct as encodeUnknownEffect, d as Defect, dn as null_, dt as is, en as FilterGroup, et as decodeEffect, f as Duration, fn as optionalKey$1, ft as isFinite$1, g as Finite, gn as resolveIdentifier, gt as isLessThanOrEqualTo, h as FalseLiterals, hn as resolveDescription, ht as isInt, in as Suspend, it as decodeUnknownOption, j as OptionFromOptional, jn as Pointer, jt as toCodecJson, k as Option, kn as transformEffect, kt as optionalKey, ln as isOptional, lt as fromJsonString, m as Exit, mn as resolveAt, mt as isGreaterThanOrEqualTo, n as ArraySchema, nn as Objects, nt as decodeTo$1, o as Class$1, on as applyToSelfOrLastLinkEncoding, ot as encodeEffect$1, p as Error$3, pn as replaceChecks, pt as isGreaterThan, q as UndefinedOr, qt as getReferenceKey, r as Boolean$4, rn as PropertySignature, rt as decodeUnknownEffect$1, s as DateTimeUtc, sn as decodeTo, st as encodeTo, t as Any, tn as Literal$1, tt as decodeSync, u as DateTimeUtcFromString, un as mapOrSame, v as Json, vn as toEncoded, vt as isMaxProperties, w as NonEmptyArray, wn as transformEffect$1, wt as make$47, x as MutableJson, xn as Transformation, xt as isPropertyNames, y as Literal, yn as toType$1, yt as isMinLength, z as TaggedError$1, zn as value, zt as empty$11 } from "./Schema-gTtf66A-.mjs";
2
+ import { $ as isEffect, $a as getOrThrow, $n as effect, $t as uninterruptibleMask, A as ensuring, Aa as Reference, Ai as decodeBase64$1, An as StackTrace, Ar as isDoneUnsafe, As as flow, At as result, B as fnUntraced, Ba as makeUnsafe$3, Bi as appendAll, Bn as hasInterruptsOnly, Bo as format, Br as void_$1, Bt as sleep, C as catch_, Ca as minutes, Co as Prototype, Cs as or, Ct as promise, Da as toMillis, Dn as Done, Ds as constVoid, Dt as raceFirst, E as contextWith, Ea as seconds, En as nextBetween, Eo as PipeInspectableProto, Er as doneUnsafe, Es as constUndefined, Et as provideService, F as filterOrFail, Fa as getOption, Fi as TaggedClass, Fn as fail$4, Fo as setStackTraceLimit, Fr as interrupt$1, G as forkIn, Ga as flatMap$2, Gn as isTimeoutError, Go as redact$1, Gt as tap, H as forEach$2, Ha as all, Hi as findFirst, Hr as ConsoleRef, Ht as succeedNone, I as flatMap$1, Ia as getOrUndefined$1, Ii as TaggedError, In as filterInterruptors, Io as BaseProto, Is as pipeArguments, It as scope, Ji as isArrayNonEmpty, Jo as equals, Jt as timeoutOrElse, K as forkScoped, Ka as flatMapNullishOr, Ki as fromIterable$1, Ko as symbolRedactable, Kt as tapCause, L as flatMapEager, La as getOrUndefinedUnsafe, Li as taggedEnum, Lo as Class, Lr as isFailure$1, Lt as scoped, M as fail$2, Ma as add, Mi as encodeBase64, Mn as UnknownError$1, Mo as withFiber$1, Mr as die$1, Ms as memoize, Mt as runFork, N as failCause, Na as empty$7, No as assignProperty, Nr as fail$3, Nt as runForkWith, O as die, Oi as DisablePropagation, Or as into, Ot as repeat, Pa as get$3, Pi as Error$2, Pn as done, Po as getStackTraceLimit, Pr as failCause$1, Ps as pipe, Pt as runSync, Q as interruptible, Qa as getOrNull, Qi as last$1, Qn as buildWithScope, Qo as hash, Qt as uninterruptible, Ra as getUnsafe, Ri as Array$1, Ro as NodeInspectSymbol, Rr as isSuccess$1, S as catchTags, Sa as millis, So as strictEqual, Sr as MinimumLogLevel, St as orElseSucceed, T as context, Tn as Random$1, Ts as constTrue, Tt as provideContext, U as forever, Ua as exists, Ui as findFirstIndex, Ur as LogToStderr$1, Ut as suspend, Va as merge$2, Vi as empty$6, Vn as interruptors, Vt as succeed$2, W as forkChild, Wa as filter$1, Wi as findLast, Wt as sync, X as ignore, Xa as fromUndefinedOr, Xi as isReadonlyArrayNonEmpty, Xn as pretty, Xt as try_, Y as gen, Ya as fromNullishOr, Yi as isCanonicalArrayIndex, Yo as symbol$1, Yt as tryPromise, Z as interrupt, Za as getOrElse, Zi as join$1, Zn as squash, Zt as undefined_, _ as catchFilter, _a as fromInputUnsafe$1, _n as min, _t as onExit, a as andThen, aa as empty$8, an as whileLoop, ao as map$7, ar as mergeAll, at as makeSpanScoped, b as catchReason, ba as isFinite, bn as catchDone, br as provide$2, bs as isTagged, bt as option$1, c as as, ca as failVoid, cn as withParentSpan, co as orElse$1, cr as provide$3, cs as isIterable, ct as mapEager, d as cached, da as isFailure, dn as zipWith, do as toArray, dr as succeedContext, ds as isNotNullish, dt as match$4, ea as map$6, en as updateContext, eo as getOrUndefined, er as effectContext, et as logDebug, f as cachedWithTTL, fa as isSuccess, fr as unwrap$1, fs as isNotUndefined, g as catchEager, ga as format$1, gn as jittered, gr as close, gs as isObject, gt as onError, h as catchDefect, ha as try_$1, hn as isSchedule, hr as addFinalizerExit, ht as never, i as all$1, ir as merge$3, it as logWarning, j as exit, ja as Service, ji as decodeBase64UrlString, jn as TimeoutError, jr as makeUnsafe$2, js as identity, jt as retry, k as effectify, ka as zero, ki as ParentSpan, kr as isDone, ks as dual, kt as request, l as asSome, ln as withSpan$1, lo as orElseSome, lr as provideMerge, lt as mapError, m as catchCause, ma as succeed$1, mn as exponential, mr as addFinalizer$1, ms as isNullish, mt as matchEffect, na as of, nn as useSpan, nr as empty$9, ns as symbol$2, nt as logFatal, o as annotateCurrentSpan, oa as headUnsafe, on as withFiber, oo as match$2, or as mock, ot as map$5, p as callback, pn as TaggedClass$1, pr as Scope, ps as isNull, pt as matchCauseEffect, q as fromOption, qi as headNonEmpty, qt as timeout, r as addFinalizer, ra as reduce, rn as void_, ro as isSome, rr as fresh, rs as hasProperty, rt as logInfo, s as annotateLogs, sa as fail$1, so as none, sr as orDie$1, st as mapBothEager, t as acquireRelease, ta as match$3, tn as updateService, to as isNone, ts as structure, tt as logError, u as asVoid, ua as getOrUndefined$2, un as yieldNow, uo as some, ur as succeed$4, us as isNotNull, ut as mapErrorEager, v as catchIf, va as infinity, vn as passthrough, w as clockWith, wi as sync$1, wr as _await, ws as constFalse, wt as provide$1, x as catchTag, xr as CurrentLogAnnotations, xs as isUndefined, xt as orDie, yn as spaced, yr as makeUnsafe$1, ys as isString, yt as onInterrupt, z as fn, za as make$42, zn as hasInterrupts, zo as toJson, zr as succeed$3, zt as serviceOption } from "./Effect-CeAMoJlg.mjs";
3
+ import { $ as transduce, A as mapEffect$1, At as interrupt$2, B as run$4, Bt as normalizeNonEmpty, C as fromPull, D as map$8, Dt as makeUnsafe$5, E as isStream, Et as update, F as onEnd, Ft as runIn, G as runForEachArray, I as orDie$2, It as camelToSnake, J as succeed$5, L as pipeThroughChannel, Lt as toLowerCase, M as merge$4, Mt as interruptAllAs, N as mergeAll$1, O as mapArray, Ot as await_, P as mkString, Pt as join$2, Q as tap$1, R as provideContext$1, Rt as parse$2, St as unbounded, T as fromReadableStream, Tt as set$2, U as runFold, V as runCollect, W as runForEach, X as take$1, Y as suspend$1, Z as takeUntil, _t as offerAll, a as catchTags$1, at as toTransform, b as fromEffect, bt as poll, c as die$2, ct as makeUnsafe$4, d as ensuring$1, dt as endUnsafe, et as unwrap$3, f as fail$5, ft as fail$6, g as flattenIterable, gt as offer, h as flatMap$3, ht as make$44, i as catchReason$1, it as pipeTo, j as mapError$1, jt as interruptAll, k as mapArrayEffect, kt as getCurrent, l as drop, lt as bounded, m as filterMap, mt as failCauseUnsafe, n as callback$1, nt as map$9, o as catch_$1, ot as unwrap$2, p as filter$2, pt as failCause$2, q as splitLines, rt as mapDone, s as decodeText, st as make$45, t as broadcast, tt as fromTransform$1, u as empty$10, ut as end, vt as offerAllUnsafe, w as fromQueue, wt as make$43, x as fromIterable$2, xt as take, y as fromChannel$1, yt as offerUnsafe, z as provideService$1, zt as round } from "./Stream-DlGXvw0L.mjs";
4
+ import { $ as declare, $t as Filter, An as InvalidValue$1, At as tag, B as TaggedUnion, Bn as stringOrRedacted, Bt as fromInput$1, C as Never, Cn as transform$3, Ct as isSchemaError, D as NullOr, Dn as passthrough$1, Dt as mutable, E as Null, Et as makeFilterGroup, F as String$5, Ft as toType, G as Uint8Array$2, H as Tuple, Hn as assignProperty$1, Ht as toString, I as Struct, It as withConstructorDefault, J as Union, Jt as _is, K as Uint8ArrayFromBase64, Kt as omit, L as StructWithRest, Ln as isRedacted, Lt as withDecodingDefault, M as Record, Mn as formatIso, Mt as toCodecStringTree, N as Redacted$1, Nt as toEncoded$1, O as Number$2, Ot as optional$2, P as SchemaError, Pn as fromDateUnsafe, Pt as toJsonSchemaDocument, Q as check, Qt as Arrays, R as TaggedClass$2, Rn as make$46, Rt as withDecodingDefaultKey, Sn as passthrough$2, St as isSchema, T as NonEmptyString$1, Tn as transformOptional, Tt as makeFilter, U as URL$1, Un as makeEquivalence, Ut as empty$12, V as TrueLiterals, Vn as Clock, Vt as setAll$1, W as URLFromString, Wn as map$10, Wt as fromSetCookie, X as Void, Xt as decodeUnknownEffect, Y as Unknown, Yt as decodeEffect$1, Zt as encodeEffect, _ as Int$1, _n as string, _t as isMaxLength, a as BooleanLiterals, an as Union$1, at as decodeUnknownSync, b as Literals$2, bn as unknown, bt as isPattern, cn as isNever, ct as encodeUnknownEffect, d as Defect, dn as null_, dt as is, en as FilterGroup, et as decodeEffect, f as Duration, fn as optionalKey$1, ft as isFinite$1, g as Finite, gn as resolveIdentifier, gt as isLessThanOrEqualTo, h as FalseLiterals, hn as resolveDescription, ht as isInt, in as Suspend, it as decodeUnknownOption, j as OptionFromOptional, jn as Pointer, jt as toCodecJson, k as Option, kn as transformEffect, kt as optionalKey, ln as isOptional, lt as fromJsonString, m as Exit, mn as resolveAt, mt as isGreaterThanOrEqualTo, n as ArraySchema, nn as Objects, nt as decodeTo$1, o as Class$1, on as applyToSelfOrLastLinkEncoding, ot as encodeEffect$1, p as Error$3, pn as replaceChecks, pt as isGreaterThan, q as UndefinedOr, qt as getReferenceKey, r as Boolean$4, rn as PropertySignature, rt as decodeUnknownEffect$1, s as DateTimeUtc, sn as decodeTo, st as encodeTo, t as Any, tn as Literal$1, tt as decodeSync, u as DateTimeUtcFromString, un as mapOrSame, v as Json, vn as toEncoded, vt as isMaxProperties, w as NonEmptyArray, wn as transformEffect$1, wt as make$47, x as MutableJson, xn as Transformation, xt as isPropertyNames, y as Literal, yn as toType$1, yt as isMinLength, z as TaggedError$1, zn as value, zt as empty$11 } from "./Schema-Bc06DxcV.mjs";
5
5
  import * as Http from "node:http";
6
6
  import * as Https from "node:https";
7
7
  import { PassThrough, Readable, Writable } from "node:stream";
@@ -11118,9 +11118,19 @@ const compactIfNeeded = fnUntraced(function* (options) {
11118
11118
  });
11119
11119
  //#endregion
11120
11120
  //#region src/Acp.ts
11121
+ const ThoughtLevel = Literals$2([
11122
+ "none",
11123
+ "minimal",
11124
+ "low",
11125
+ "medium",
11126
+ "high",
11127
+ "xhigh",
11128
+ "max"
11129
+ ]);
11121
11130
  var SessionRecord = class extends Class$1("clanka/Acp/SessionRecord")({
11122
11131
  cwd: String$5,
11123
11132
  model: String$5,
11133
+ thoughtLevel: ThoughtLevel,
11124
11134
  history: Prompt$1
11125
11135
  }) {};
11126
11136
  var RpcError = class extends TaggedError$1()("AcpRpcError", {
@@ -11148,6 +11158,11 @@ const SetModelParams = Struct({
11148
11158
  sessionId: String$5,
11149
11159
  modelId: String$5
11150
11160
  });
11161
+ const SetConfigOptionParams = Struct({
11162
+ sessionId: String$5,
11163
+ configId: Literal("thought_level"),
11164
+ value: ThoughtLevel
11165
+ });
11151
11166
  const TextBlock = Struct({
11152
11167
  type: Literal("text"),
11153
11168
  text: String$5
@@ -11260,20 +11275,35 @@ const make$12 = fnUntraced(function* (options) {
11260
11275
  update
11261
11276
  });
11262
11277
  const getSession = (sessionId) => fromOption(fromNullishOr(sessions.get(sessionId)), () => sessionNotFound(sessionId));
11263
- const requireModel = (modelId) => fromOption(options.makeModel(modelId), () => new RpcError({
11278
+ const requireModel = (modelId, thoughtLevel) => fromOption(options.makeModel(modelId, thoughtLevel), () => new RpcError({
11264
11279
  code: -32602,
11265
11280
  message: `Unknown model: ${modelId}`
11266
11281
  }));
11267
- const modelsInfo = (session) => ({
11268
- availableModels: [...new Set([session.model, options.defaultModel])].map((modelId) => ({
11269
- modelId,
11270
- name: modelId
11271
- })),
11272
- currentModelId: session.model
11282
+ const configOptions = (session) => [{
11283
+ id: "thought_level",
11284
+ name: "Thought level",
11285
+ category: "thought_level",
11286
+ type: "select",
11287
+ currentValue: session.thoughtLevel,
11288
+ options: ThoughtLevel.literals.map((value) => ({
11289
+ value,
11290
+ name: value
11291
+ }))
11292
+ }];
11293
+ const sessionState = (session) => ({
11294
+ models: {
11295
+ availableModels: [...new Set([session.model, options.defaultModel])].map((modelId) => ({
11296
+ modelId,
11297
+ name: modelId
11298
+ })),
11299
+ currentModelId: session.model
11300
+ },
11301
+ configOptions: configOptions(session)
11273
11302
  });
11274
11303
  const persist = (session) => store.set(session.id, new SessionRecord({
11275
11304
  cwd: session.cwd,
11276
11305
  model: session.model,
11306
+ thoughtLevel: session.thoughtLevel,
11277
11307
  history: session.agent.history.current
11278
11308
  })).pipe(catch_((error) => logWarning("Failed to persist session", error)));
11279
11309
  const openSession = fnUntraced(function* (id, record) {
@@ -11283,6 +11313,7 @@ const make$12 = fnUntraced(function* (options) {
11283
11313
  id,
11284
11314
  cwd: record.cwd,
11285
11315
  model: record.model,
11316
+ thoughtLevel: record.thoughtLevel,
11286
11317
  agent,
11287
11318
  running: void 0,
11288
11319
  toolCalls: 0
@@ -11418,7 +11449,9 @@ const make$12 = fnUntraced(function* (options) {
11418
11449
  sessionUpdate: "usage_update",
11419
11450
  usage: {
11420
11451
  inputTokens: part.inputTokens,
11421
- outputTokens: part.outputTokens
11452
+ outputTokens: part.outputTokens,
11453
+ cacheRead: part.cacheRead,
11454
+ cacheWrite: part.cacheWrite
11422
11455
  }
11423
11456
  });
11424
11457
  case "ErrorRetry": return update(session.id, {
@@ -11474,45 +11507,56 @@ const make$12 = fnUntraced(function* (options) {
11474
11507
  const newSession = fnUntraced(function* (params) {
11475
11508
  const { cwd, model } = yield* decodeParams(NewSessionParams, params);
11476
11509
  const modelId = model ?? options.defaultModel;
11477
- yield* requireModel(modelId);
11510
+ const thoughtLevel = options.defaultThoughtLevel;
11511
+ yield* requireModel(modelId, thoughtLevel);
11478
11512
  const session = yield* openSession(crypto.randomUUID(), new SessionRecord({
11479
11513
  cwd,
11480
11514
  model: modelId,
11515
+ thoughtLevel,
11481
11516
  history: empty$1
11482
11517
  }));
11483
11518
  yield* persist(session);
11484
11519
  return {
11485
11520
  sessionId: session.id,
11486
- models: modelsInfo(session)
11521
+ ...sessionState(session)
11487
11522
  };
11488
11523
  });
11489
11524
  const loadSession = fnUntraced(function* (params, replay) {
11490
11525
  const { sessionId, cwd, model } = yield* decodeParams(LoadSessionParams, params);
11491
11526
  const existing = sessions.get(sessionId);
11492
- if (existing !== void 0) return { models: modelsInfo(existing) };
11527
+ if (existing !== void 0) return sessionState(existing);
11493
11528
  const record = yield* store.get(sessionId).pipe(mapError((error) => new RpcError({
11494
11529
  code: -32603,
11495
11530
  message: error.message
11496
11531
  })));
11497
11532
  if (isNone(record)) return yield* sessionNotFound(sessionId);
11498
11533
  const modelId = model ?? record.value.model;
11499
- yield* requireModel(modelId);
11534
+ yield* requireModel(modelId, record.value.thoughtLevel);
11500
11535
  const session = yield* openSession(sessionId, new SessionRecord({
11501
11536
  cwd: cwd ?? record.value.cwd,
11502
11537
  model: modelId,
11538
+ thoughtLevel: record.value.thoughtLevel,
11503
11539
  history: record.value.history
11504
11540
  }));
11505
11541
  if (replay) yield* replayHistory(session);
11506
- return { models: modelsInfo(session) };
11542
+ return sessionState(session);
11507
11543
  });
11508
11544
  const setModel = fnUntraced(function* (params) {
11509
11545
  const { sessionId, modelId } = yield* decodeParams(SetModelParams, params);
11510
11546
  const session = yield* getSession(sessionId);
11511
- yield* requireModel(modelId);
11547
+ yield* requireModel(modelId, session.thoughtLevel);
11512
11548
  session.model = modelId;
11513
11549
  yield* persist(session);
11514
11550
  return {};
11515
11551
  });
11552
+ const setConfigOption = fnUntraced(function* (params) {
11553
+ const { sessionId, value } = yield* decodeParams(SetConfigOptionParams, params);
11554
+ const session = yield* getSession(sessionId);
11555
+ yield* requireModel(session.model, value);
11556
+ session.thoughtLevel = value;
11557
+ yield* persist(session);
11558
+ return { configOptions: configOptions(session) };
11559
+ });
11516
11560
  const prompt = fnUntraced(function* (params) {
11517
11561
  const { sessionId, prompt } = yield* decodeParams(PromptParams, params);
11518
11562
  const session = yield* getSession(sessionId);
@@ -11520,7 +11564,7 @@ const make$12 = fnUntraced(function* (options) {
11520
11564
  code: -32e3,
11521
11565
  message: `Session ${sessionId} already has a prompt in progress`
11522
11566
  });
11523
- const model = yield* requireModel(session.model);
11567
+ const model = yield* requireModel(session.model, session.thoughtLevel);
11524
11568
  const input = yield* promptFromBlocks(session.cwd, prompt);
11525
11569
  session.running = yield* runTurn(session, input).pipe(provide$1(model), scoped, forkChild);
11526
11570
  const exit$1 = yield* exit(join$2(session.running));
@@ -11539,8 +11583,8 @@ const make$12 = fnUntraced(function* (options) {
11539
11583
  switch (method) {
11540
11584
  case "initialize": return initialize;
11541
11585
  case "authenticate":
11542
- case "session/set_mode":
11543
- case "session/set_config_option": return succeed$2({});
11586
+ case "session/set_mode": return succeed$2({});
11587
+ case "session/set_config_option": return setConfigOption(params);
11544
11588
  case "session/new": return newSession(params);
11545
11589
  case "session/load": return loadSession(params, true);
11546
11590
  case "session/resume": return loadSession(params, false);
@@ -11938,7 +11982,7 @@ var ExaError = class extends TaggedError$1()("ExaError", { cause: Defect() }) {}
11938
11982
  const layer$7 = effect(ExaSearch, gen(function* () {
11939
11983
  const scope$4 = yield* scope;
11940
11984
  const getClient = yield* cachedWithTTL(gen(function* () {
11941
- const McpClient = yield* tryPromise(() => import("./McpClient-0f-vTQC-.mjs"));
11985
+ const McpClient = yield* tryPromise(() => import("./McpClient-zQibhsnA.mjs"));
11942
11986
  const context = yield* buildWithScope(McpClient.layer, scope$4);
11943
11987
  return get$3(context, McpClient.McpClient);
11944
11988
  }), (exit) => isSuccess$1(exit) ? infinity : zero);
@@ -12028,6 +12072,7 @@ var DirectoryChanger = class extends Service()("clanka/AgentTools/DirectoryChang
12028
12072
  var TaskCompleter = class extends Service()("clanka/AgentTools/TaskCompleter") {};
12029
12073
  var SubagentExecutor = class extends Service()("clanka/AgentTools/SubagentExecutor") {};
12030
12074
  var ImageAttacher = class extends Service()("clanka/AgentTools/ImageAttacher") {};
12075
+ const globNamesDirectory = (glob) => glob.split("/").slice(0, -1).some((segment) => segment.length > 0 && !/[*?[\]{}]/.test(segment));
12031
12076
  const AgentTools = make$14(make$16("changeDirectory", {
12032
12077
  description: "Change the executor's working directory to an existing directory and return its absolute path. Relative paths resolve from the current directory without shell expansion. Await this before dependent tools. The change persists across scripts and is shared with delegates using this executor. Startup AGENTS.md, skills, and the semantic-search index root remain fixed. Navigation does not survive a session reload.",
12033
12078
  parameters: String$5.annotate({ identifier: "directory" }),
@@ -12221,17 +12266,23 @@ const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(gen(function* () {
12221
12266
  "--max-columns=300"
12222
12267
  ];
12223
12268
  if (options.filesOnly) args.push("--files-with-matches");
12269
+ const searchesIgnoredFiles = options.glob !== void 0 && !options.glob.startsWith("*");
12224
12270
  if (options.glob) {
12225
12271
  args.push("--glob", options.glob);
12226
- if (!options.glob.startsWith("*")) args.push("-uu");
12272
+ if (searchesIgnoredFiles) args.push("-uu");
12227
12273
  }
12228
12274
  args.push(options.pattern);
12229
- let stream = spawner.streamLines(make$26("rg", args, {
12230
- cwd,
12231
- stdin: "ignore"
12232
- }));
12233
- stream = take$1(stream, options.maxLines ?? 500);
12234
- return yield* runCollect(stream).pipe(map$5(join$1("\n")), orDie);
12275
+ const run = fnUntraced(function* (args) {
12276
+ let stream = spawner.streamLines(make$26("rg", args, {
12277
+ cwd,
12278
+ stdin: "ignore"
12279
+ }));
12280
+ stream = take$1(stream, options.maxLines ?? 500);
12281
+ return yield* runCollect(stream).pipe(map$5(join$1("\n")), orDie);
12282
+ });
12283
+ const output = yield* run(args);
12284
+ if (output.length > 0 || searchesIgnoredFiles || options.glob === void 0 || !globNamesDirectory(options.glob)) return output;
12285
+ return yield* run(args.slice(0, -1).concat("-uu", options.pattern));
12235
12286
  }),
12236
12287
  glob: fn("AgentTools.glob")(function* (pattern) {
12237
12288
  yield* logInfo(`Calling "glob"`).pipe(annotateLogs({ pattern }));
@@ -23375,7 +23426,9 @@ var ScriptEnd = class extends TaggedClass$2()("ScriptEnd", {}) {};
23375
23426
  var Usage = class extends TaggedClass$2()("Usage", {
23376
23427
  contextTokens: Number$2,
23377
23428
  inputTokens: Number$2,
23378
- outputTokens: Number$2
23429
+ outputTokens: Number$2,
23430
+ cacheRead: Number$2,
23431
+ cacheWrite: Number$2
23379
23432
  }) {};
23380
23433
  var ErrorRetry = class extends TaggedClass$2()("ErrorRetry", { error: AiError }) {};
23381
23434
  var ScriptOutput = class extends TaggedClass$2()("ScriptOutput", { output: String$5 }) {};
@@ -23467,6 +23520,8 @@ ${content}
23467
23520
  const output = yield* make$44();
23468
23521
  let inputTokens = 0;
23469
23522
  let outputTokens = 0;
23523
+ let cacheRead = 0;
23524
+ let cacheWrite = 0;
23470
23525
  const prompt = opts.disableHistory ? make$43(empty$1) : history;
23471
23526
  update(prompt, concat(opts.prompt));
23472
23527
  let system = (typeof opts.system === "function" ? opts.system : defaultSystem)({
@@ -23701,6 +23756,8 @@ ${content}
23701
23756
  case "finish":
23702
23757
  const usage = part.usage;
23703
23758
  if (usage.outputTokens.total !== void 0) outputTokens += usage.outputTokens.total;
23759
+ if (usage.inputTokens.cacheRead !== void 0) cacheRead += usage.inputTokens.cacheRead;
23760
+ if (usage.inputTokens.cacheWrite !== void 0) cacheWrite += usage.inputTokens.cacheWrite;
23704
23761
  if (usage.inputTokens.total !== void 0) {
23705
23762
  lastContextTokens = usage.inputTokens.total;
23706
23763
  inputTokens += usage.inputTokens.total;
@@ -23709,7 +23766,9 @@ ${content}
23709
23766
  part: new Usage({
23710
23767
  contextTokens: usage.inputTokens.total,
23711
23768
  inputTokens,
23712
- outputTokens
23769
+ outputTokens,
23770
+ cacheRead,
23771
+ cacheWrite
23713
23772
  })
23714
23773
  });
23715
23774
  }
@@ -25591,7 +25650,7 @@ const model$1 = (model, options) => make$5("xai", model, mergeAll(layer$3({
25591
25650
  const LogToStderr = LogToStderr$1;
25592
25651
  //#endregion
25593
25652
  //#region package.json
25594
- var version$1 = "0.7.6";
25653
+ var version$1 = "0.8.0";
25595
25654
  //#endregion
25596
25655
  //#region src/cli.ts
25597
25656
  const version = version$1;
@@ -25603,15 +25662,22 @@ const providers = [
25603
25662
  ];
25604
25663
  const withSubagentModel = (model) => merge$3(model, layerSubagentModel(model));
25605
25664
  const modelLayer = (provider, model, effort) => provider === "openai" ? withSubagentModel(modelWebSocket(model, { reasoning: { effort } })).pipe(provide$3(layerClient$2)) : provider === "xai" ? withSubagentModel(model$1(model, { reasoning: { effort } })).pipe(provide$3(layerClient)) : withSubagentModel(model$2(model, { reasoning: { effort } })).pipe(provide$3(layerClient$1));
25665
+ const isProvider = (provider) => providers.includes(provider);
25606
25666
  const parseModelId = (modelId) => {
25607
25667
  const [provider, model, effort, ...rest] = modelId.split("/");
25608
- return provider !== void 0 && providers.includes(provider) && model !== void 0 && effort !== void 0 && rest.length === 0 ? some({
25668
+ return isProvider(provider) && model !== void 0 && is(ThoughtLevel)(effort) && rest.length === 0 ? some({
25669
+ model: `${provider}:${model}`,
25670
+ thoughtLevel: effort
25671
+ }) : none();
25672
+ };
25673
+ const parseAcpModelId = (modelId) => {
25674
+ const [provider, model, ...rest] = modelId.split(":");
25675
+ return isProvider(provider) && model !== void 0 && rest.length === 0 ? some({
25609
25676
  provider,
25610
- model,
25611
- effort
25677
+ model
25612
25678
  }) : none();
25613
25679
  };
25614
- const ModelId = String$5.pipe(check(makeFilter((modelId) => isSome(parseModelId(modelId)) || `Invalid model "${modelId}", expected <provider>/<model>/<effort>`)));
25680
+ const ModelId = String$5.pipe(check(makeFilter((modelId) => isSome(parseModelId(modelId)) || `Invalid model "${modelId}", expected <provider>/<model>/<effort> with effort one of ${ThoughtLevel.literals.join(", ")}`)));
25615
25681
  const provider = Literals("provider", providers).pipe(withAlias("p"), withFallbackPrompt(Select({
25616
25682
  message: "Select a provider",
25617
25683
  choices: [
@@ -25646,20 +25712,21 @@ const Search = (directory) => unwrap$1(gen(function* () {
25646
25712
  return empty$9;
25647
25713
  }
25648
25714
  const path = yield* Path$3;
25649
- return (yield* promise(() => import("./SemanticSearch-CBs6yELV.mjs"))).layer({
25715
+ return (yield* promise(() => import("./SemanticSearch-BPxQoRSC.mjs"))).layer({
25650
25716
  directory: process.cwd(),
25651
25717
  database: path.join(directory, "search.sqlite")
25652
25718
  }).pipe(provide$3(model$3("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$5({ apiKey: apiKey.value })));
25653
25719
  })).pipe(provide$3([layer$8, HttpClientLive]));
25654
- const acpModel = String$1("model").pipe(withAlias("m"), withDescription$1("Default model as <provider>/<model>/<effort>, e.g. openai/gpt-6-astra/medium"), withSchema(ModelId), withDefault("openai/gpt-6-astra/medium"));
25720
+ const acpModel = String$1("model").pipe(withAlias("m"), withDescription$1("Default model as <provider>/<model>/<effort>, e.g. openai/gpt-6-astra/medium"), withSchema(ModelId), withDefault("openai/gpt-6-astra/medium"), map$1((modelId) => getOrThrow(parseModelId(modelId))));
25655
25721
  const acp = make$28("acp", {
25656
25722
  model: acpModel,
25657
25723
  compaction
25658
25724
  }).pipe(withDescription("Run as an Agent Client Protocol (ACP) server over stdio"), withHandler(({ model }) => runStdio({
25659
25725
  version,
25660
- defaultModel: model,
25726
+ defaultModel: model.model,
25727
+ defaultThoughtLevel: model.thoughtLevel,
25661
25728
  makeAgent: (cwd) => make$2.pipe(provide$1(layerLocal$1({ directory: cwd }))),
25662
- makeModel: (modelId) => map$7(parseModelId(modelId), ({ provider, model, effort }) => modelLayer(provider, model, effort))
25729
+ makeModel: (modelId, thoughtLevel) => map$7(parseAcpModelId(modelId), ({ provider, model }) => modelLayer(provider, model, thoughtLevel))
25663
25730
  })), provide(({ compaction }) => mergeAll(ConversationMode.layer(true), succeed$4(LogToStderr, true), layerLog, CompactionConfig.layer({ enabled: compaction }))));
25664
25731
  make$28("clanka", {
25665
25732
  provider,
@@ -25669,7 +25736,7 @@ make$28("clanka", {
25669
25736
  compaction
25670
25737
  }).pipe(withHandler(fnUntraced(function* ({ provider, model: modelRaw, semantic, prompt: nonInteractivePrompt }) {
25671
25738
  const stdio = yield* Stdio;
25672
- const OutputFormatter = yield* promise(() => import("./OutputFormatter-DN8OGwuK.mjs"));
25739
+ const OutputFormatter = yield* promise(() => import("./OutputFormatter-C7Awn0DS.mjs"));
25673
25740
  const [model, reasoning] = (yield* match$2(modelRaw, {
25674
25741
  onSome: succeed$2,
25675
25742
  onNone: () => String$4({