clanka 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Acp.d.ts +21 -2
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +66 -13
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +56 -10
- package/dist/Acp.test.js.map +1 -1
- package/dist/AcpImage.test.js +1 -0
- package/dist/AcpImage.test.js.map +1 -1
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +1 -2
- package/dist/Agent.js.map +1 -1
- package/dist/AgentExecutor.d.ts +0 -172
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentTools.d.ts +0 -123
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +22 -60
- package/dist/AgentTools.js.map +1 -1
- package/dist/AgentTools.test.d.ts +2 -0
- package/dist/AgentTools.test.d.ts.map +1 -0
- package/dist/AgentTools.test.js +63 -0
- package/dist/AgentTools.test.js.map +1 -0
- package/dist/bin/{Effect-DdkIoNCD.mjs → Effect-CeAMoJlg.mjs} +7 -2
- package/dist/bin/Effect-CeAMoJlg.mjs.map +1 -0
- package/dist/bin/{McpClient-CJ0Vugoi.mjs → McpClient-zQibhsnA.mjs} +3 -3
- package/dist/bin/{McpClient-CJ0Vugoi.mjs.map → McpClient-zQibhsnA.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-DN8OGwuK.mjs → OutputFormatter-C7Awn0DS.mjs} +3 -3
- package/dist/bin/{OutputFormatter-DN8OGwuK.mjs.map → OutputFormatter-C7Awn0DS.mjs.map} +1 -1
- package/dist/bin/{Schema-BALIXGp7.mjs → Schema-Bc06DxcV.mjs} +3 -6
- package/dist/bin/{Schema-BALIXGp7.mjs.map → Schema-Bc06DxcV.mjs.map} +1 -1
- package/dist/bin/{SemanticSearch-O6PZBRfd.mjs → SemanticSearch-BPxQoRSC.mjs} +4 -4
- package/dist/bin/{SemanticSearch-O6PZBRfd.mjs.map → SemanticSearch-BPxQoRSC.mjs.map} +1 -1
- package/dist/bin/{Stream-B5ebASRi.mjs → Stream-DlGXvw0L.mjs} +2 -2
- package/dist/bin/{Stream-B5ebASRi.mjs.map → Stream-DlGXvw0L.mjs.map} +1 -1
- package/dist/bin/cli.mjs +95 -91
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/cli.js +17 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/src/Acp.test.ts +86 -9
- package/src/Acp.ts +90 -17
- package/src/AcpImage.test.ts +1 -0
- package/src/Agent.ts +1 -2
- package/src/AgentTools.test.ts +116 -0
- package/src/AgentTools.ts +32 -76
- package/src/cli.ts +22 -9
- 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
|
|
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-
|
|
4
|
-
import { $ as
|
|
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
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
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
|
|
@@ -11474,45 +11505,56 @@ const make$12 = fnUntraced(function* (options) {
|
|
|
11474
11505
|
const newSession = fnUntraced(function* (params) {
|
|
11475
11506
|
const { cwd, model } = yield* decodeParams(NewSessionParams, params);
|
|
11476
11507
|
const modelId = model ?? options.defaultModel;
|
|
11477
|
-
|
|
11508
|
+
const thoughtLevel = options.defaultThoughtLevel;
|
|
11509
|
+
yield* requireModel(modelId, thoughtLevel);
|
|
11478
11510
|
const session = yield* openSession(crypto.randomUUID(), new SessionRecord({
|
|
11479
11511
|
cwd,
|
|
11480
11512
|
model: modelId,
|
|
11513
|
+
thoughtLevel,
|
|
11481
11514
|
history: empty$1
|
|
11482
11515
|
}));
|
|
11483
11516
|
yield* persist(session);
|
|
11484
11517
|
return {
|
|
11485
11518
|
sessionId: session.id,
|
|
11486
|
-
|
|
11519
|
+
...sessionState(session)
|
|
11487
11520
|
};
|
|
11488
11521
|
});
|
|
11489
11522
|
const loadSession = fnUntraced(function* (params, replay) {
|
|
11490
11523
|
const { sessionId, cwd, model } = yield* decodeParams(LoadSessionParams, params);
|
|
11491
11524
|
const existing = sessions.get(sessionId);
|
|
11492
|
-
if (existing !== void 0) return
|
|
11525
|
+
if (existing !== void 0) return sessionState(existing);
|
|
11493
11526
|
const record = yield* store.get(sessionId).pipe(mapError((error) => new RpcError({
|
|
11494
11527
|
code: -32603,
|
|
11495
11528
|
message: error.message
|
|
11496
11529
|
})));
|
|
11497
11530
|
if (isNone(record)) return yield* sessionNotFound(sessionId);
|
|
11498
11531
|
const modelId = model ?? record.value.model;
|
|
11499
|
-
yield* requireModel(modelId);
|
|
11532
|
+
yield* requireModel(modelId, record.value.thoughtLevel);
|
|
11500
11533
|
const session = yield* openSession(sessionId, new SessionRecord({
|
|
11501
11534
|
cwd: cwd ?? record.value.cwd,
|
|
11502
11535
|
model: modelId,
|
|
11536
|
+
thoughtLevel: record.value.thoughtLevel,
|
|
11503
11537
|
history: record.value.history
|
|
11504
11538
|
}));
|
|
11505
11539
|
if (replay) yield* replayHistory(session);
|
|
11506
|
-
return
|
|
11540
|
+
return sessionState(session);
|
|
11507
11541
|
});
|
|
11508
11542
|
const setModel = fnUntraced(function* (params) {
|
|
11509
11543
|
const { sessionId, modelId } = yield* decodeParams(SetModelParams, params);
|
|
11510
11544
|
const session = yield* getSession(sessionId);
|
|
11511
|
-
yield* requireModel(modelId);
|
|
11545
|
+
yield* requireModel(modelId, session.thoughtLevel);
|
|
11512
11546
|
session.model = modelId;
|
|
11513
11547
|
yield* persist(session);
|
|
11514
11548
|
return {};
|
|
11515
11549
|
});
|
|
11550
|
+
const setConfigOption = fnUntraced(function* (params) {
|
|
11551
|
+
const { sessionId, value } = yield* decodeParams(SetConfigOptionParams, params);
|
|
11552
|
+
const session = yield* getSession(sessionId);
|
|
11553
|
+
yield* requireModel(session.model, value);
|
|
11554
|
+
session.thoughtLevel = value;
|
|
11555
|
+
yield* persist(session);
|
|
11556
|
+
return { configOptions: configOptions(session) };
|
|
11557
|
+
});
|
|
11516
11558
|
const prompt = fnUntraced(function* (params) {
|
|
11517
11559
|
const { sessionId, prompt } = yield* decodeParams(PromptParams, params);
|
|
11518
11560
|
const session = yield* getSession(sessionId);
|
|
@@ -11520,7 +11562,7 @@ const make$12 = fnUntraced(function* (options) {
|
|
|
11520
11562
|
code: -32e3,
|
|
11521
11563
|
message: `Session ${sessionId} already has a prompt in progress`
|
|
11522
11564
|
});
|
|
11523
|
-
const model = yield* requireModel(session.model);
|
|
11565
|
+
const model = yield* requireModel(session.model, session.thoughtLevel);
|
|
11524
11566
|
const input = yield* promptFromBlocks(session.cwd, prompt);
|
|
11525
11567
|
session.running = yield* runTurn(session, input).pipe(provide$1(model), scoped, forkChild);
|
|
11526
11568
|
const exit$1 = yield* exit(join$2(session.running));
|
|
@@ -11539,8 +11581,8 @@ const make$12 = fnUntraced(function* (options) {
|
|
|
11539
11581
|
switch (method) {
|
|
11540
11582
|
case "initialize": return initialize;
|
|
11541
11583
|
case "authenticate":
|
|
11542
|
-
case "session/set_mode":
|
|
11543
|
-
case "session/set_config_option": return
|
|
11584
|
+
case "session/set_mode": return succeed$2({});
|
|
11585
|
+
case "session/set_config_option": return setConfigOption(params);
|
|
11544
11586
|
case "session/new": return newSession(params);
|
|
11545
11587
|
case "session/load": return loadSession(params, true);
|
|
11546
11588
|
case "session/resume": return loadSession(params, false);
|
|
@@ -11938,7 +11980,7 @@ var ExaError = class extends TaggedError$1()("ExaError", { cause: Defect() }) {}
|
|
|
11938
11980
|
const layer$7 = effect(ExaSearch, gen(function* () {
|
|
11939
11981
|
const scope$4 = yield* scope;
|
|
11940
11982
|
const getClient = yield* cachedWithTTL(gen(function* () {
|
|
11941
|
-
const McpClient = yield* tryPromise(() => import("./McpClient-
|
|
11983
|
+
const McpClient = yield* tryPromise(() => import("./McpClient-zQibhsnA.mjs"));
|
|
11942
11984
|
const context = yield* buildWithScope(McpClient.layer, scope$4);
|
|
11943
11985
|
return get$3(context, McpClient.McpClient);
|
|
11944
11986
|
}), (exit) => isSuccess$1(exit) ? infinity : zero);
|
|
@@ -12028,11 +12070,7 @@ var DirectoryChanger = class extends Service()("clanka/AgentTools/DirectoryChang
|
|
|
12028
12070
|
var TaskCompleter = class extends Service()("clanka/AgentTools/TaskCompleter") {};
|
|
12029
12071
|
var SubagentExecutor = class extends Service()("clanka/AgentTools/SubagentExecutor") {};
|
|
12030
12072
|
var ImageAttacher = class extends Service()("clanka/AgentTools/ImageAttacher") {};
|
|
12031
|
-
|
|
12032
|
-
id: Number$2,
|
|
12033
|
-
text: String$5,
|
|
12034
|
-
completed: Boolean$4
|
|
12035
|
-
})) {};
|
|
12073
|
+
const globNamesDirectory = (glob) => glob.split("/").slice(0, -1).some((segment) => segment.length > 0 && !/[*?[\]{}]/.test(segment));
|
|
12036
12074
|
const AgentTools = make$14(make$16("changeDirectory", {
|
|
12037
12075
|
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.",
|
|
12038
12076
|
parameters: String$5.annotate({ identifier: "directory" }),
|
|
@@ -12072,23 +12110,6 @@ const AgentTools = make$14(make$16("changeDirectory", {
|
|
|
12072
12110
|
parameters: ArraySchema(String$5).annotate({ identifier: "args" }),
|
|
12073
12111
|
success: String$5,
|
|
12074
12112
|
dependencies: [CurrentDirectory]
|
|
12075
|
-
}), make$16("listTodos", {
|
|
12076
|
-
description: "Read your todo list",
|
|
12077
|
-
parameters: Void,
|
|
12078
|
-
success: ArraySchema(TodoItem)
|
|
12079
|
-
}), make$16("addTodo", {
|
|
12080
|
-
description: "Add an item to your todo list",
|
|
12081
|
-
parameters: String$5.annotate({ identifier: "text" })
|
|
12082
|
-
}), make$16("updateTodo", {
|
|
12083
|
-
description: "Update an item in your todo list",
|
|
12084
|
-
parameters: Struct({
|
|
12085
|
-
id: Number$2,
|
|
12086
|
-
text: optional$2(String$5),
|
|
12087
|
-
completed: optional$2(Boolean$4)
|
|
12088
|
-
})
|
|
12089
|
-
}), make$16("clearTodos", {
|
|
12090
|
-
description: "Clear all items in your todo list",
|
|
12091
|
-
parameters: Void
|
|
12092
12113
|
}), make$16("bash", {
|
|
12093
12114
|
description: "Run a bash command and return the output",
|
|
12094
12115
|
parameters: Struct({
|
|
@@ -12155,8 +12176,6 @@ const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(gen(function* () {
|
|
|
12155
12176
|
const pathService = yield* Path$3;
|
|
12156
12177
|
const webSearch = yield* ExaSearch;
|
|
12157
12178
|
const fetchMarkdown = yield* WebToMarkdown;
|
|
12158
|
-
const todoMap = new Map();
|
|
12159
|
-
let todoIdCounter = 0;
|
|
12160
12179
|
const execute = fn(function* (command) {
|
|
12161
12180
|
const handle = yield* spawner.spawn(command);
|
|
12162
12181
|
return yield* handle.all.pipe(decodeText, mkString, flatMap$1(fnUntraced(function* (output) {
|
|
@@ -12245,51 +12264,29 @@ const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(gen(function* () {
|
|
|
12245
12264
|
"--max-columns=300"
|
|
12246
12265
|
];
|
|
12247
12266
|
if (options.filesOnly) args.push("--files-with-matches");
|
|
12267
|
+
const searchesIgnoredFiles = options.glob !== void 0 && !options.glob.startsWith("*");
|
|
12248
12268
|
if (options.glob) {
|
|
12249
12269
|
args.push("--glob", options.glob);
|
|
12250
|
-
if (
|
|
12270
|
+
if (searchesIgnoredFiles) args.push("-uu");
|
|
12251
12271
|
}
|
|
12252
12272
|
args.push(options.pattern);
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12273
|
+
const run = fnUntraced(function* (args) {
|
|
12274
|
+
let stream = spawner.streamLines(make$26("rg", args, {
|
|
12275
|
+
cwd,
|
|
12276
|
+
stdin: "ignore"
|
|
12277
|
+
}));
|
|
12278
|
+
stream = take$1(stream, options.maxLines ?? 500);
|
|
12279
|
+
return yield* runCollect(stream).pipe(map$5(join$1("\n")), orDie);
|
|
12280
|
+
});
|
|
12281
|
+
const output = yield* run(args);
|
|
12282
|
+
if (output.length > 0 || searchesIgnoredFiles || options.glob === void 0 || !globNamesDirectory(options.glob)) return output;
|
|
12283
|
+
return yield* run(args.slice(0, -1).concat("-uu", options.pattern));
|
|
12259
12284
|
}),
|
|
12260
12285
|
glob: fn("AgentTools.glob")(function* (pattern) {
|
|
12261
12286
|
yield* logInfo(`Calling "glob"`).pipe(annotateLogs({ pattern }));
|
|
12262
12287
|
const cwd = yield* CurrentDirectory;
|
|
12263
12288
|
return yield* promise(() => import("./index.min-CI3qqohw.mjs").then((Glob) => Glob.glob(pattern, { cwd })));
|
|
12264
12289
|
}),
|
|
12265
|
-
listTodos: fn("AgentTools.listTodos")(function* () {
|
|
12266
|
-
yield* logInfo(`Calling "listTodos"`);
|
|
12267
|
-
return fromIterable$1(todoMap.values());
|
|
12268
|
-
}),
|
|
12269
|
-
addTodo: fn("AgentTools.addTodo")(function* (text) {
|
|
12270
|
-
yield* logInfo(`Calling "addTodo"`).pipe(annotateLogs({ text }));
|
|
12271
|
-
const id = ++todoIdCounter;
|
|
12272
|
-
const item = {
|
|
12273
|
-
id,
|
|
12274
|
-
text,
|
|
12275
|
-
completed: false
|
|
12276
|
-
};
|
|
12277
|
-
todoMap.set(id, item);
|
|
12278
|
-
}),
|
|
12279
|
-
updateTodo: fn("AgentTools.updateTodo")(function* (options) {
|
|
12280
|
-
yield* logInfo(`Calling "updateTodo"`).pipe(annotateLogs(options));
|
|
12281
|
-
const item = todoMap.get(options.id);
|
|
12282
|
-
if (item === void 0) return yield* die(`Todo item ${options.id} not found`);
|
|
12283
|
-
todoMap.set(item.id, {
|
|
12284
|
-
...item,
|
|
12285
|
-
text: options.text ?? item.text,
|
|
12286
|
-
completed: options.completed ?? item.completed
|
|
12287
|
-
});
|
|
12288
|
-
}),
|
|
12289
|
-
clearTodos: fn("AgentTools.clearTodos")(function* () {
|
|
12290
|
-
yield* logInfo(`Calling "clearTodos"`);
|
|
12291
|
-
todoMap.clear();
|
|
12292
|
-
}),
|
|
12293
12290
|
bash: fn("AgentTools.bash")(function* (options) {
|
|
12294
12291
|
const timeoutMs = Math.min(options.timeoutMs ?? 12e4, 24e4);
|
|
12295
12292
|
yield* logInfo(`Calling "bash"`).pipe(annotateLogs({
|
|
@@ -23887,8 +23884,7 @@ const generateSystemTools = (capabilities, conversationMode) => `YOU ONLY HAVE O
|
|
|
23887
23884
|
- You can add / update / remove multiple files in one go with "applyPatch".
|
|
23888
23885
|
- Avoid passing scripts into the "bash" function, and instead write javascript.
|
|
23889
23886
|
- Variables are not shared between executions.
|
|
23890
|
-
- Do not use \`require\`, \`import\`, \`process\`, or any other Node.js apis
|
|
23891
|
-
- Make use of the todo functions to keep track of your progress.${conversationMode ? "" : `
|
|
23887
|
+
- Do not use \`require\`, \`import\`, \`process\`, or any other Node.js apis.${conversationMode ? "" : `
|
|
23892
23888
|
|
|
23893
23889
|
When you have fully completed your task, call the "taskComplete" function with the final output.
|
|
23894
23890
|
Make sure every detail of the task is done before calling "taskComplete".`}
|
|
@@ -25644,7 +25640,7 @@ const model$1 = (model, options) => make$5("xai", model, mergeAll(layer$3({
|
|
|
25644
25640
|
const LogToStderr = LogToStderr$1;
|
|
25645
25641
|
//#endregion
|
|
25646
25642
|
//#region package.json
|
|
25647
|
-
var version$1 = "0.7.
|
|
25643
|
+
var version$1 = "0.7.7";
|
|
25648
25644
|
//#endregion
|
|
25649
25645
|
//#region src/cli.ts
|
|
25650
25646
|
const version = version$1;
|
|
@@ -25656,15 +25652,22 @@ const providers = [
|
|
|
25656
25652
|
];
|
|
25657
25653
|
const withSubagentModel = (model) => merge$3(model, layerSubagentModel(model));
|
|
25658
25654
|
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));
|
|
25655
|
+
const isProvider = (provider) => providers.includes(provider);
|
|
25659
25656
|
const parseModelId = (modelId) => {
|
|
25660
25657
|
const [provider, model, effort, ...rest] = modelId.split("/");
|
|
25661
|
-
return
|
|
25658
|
+
return isProvider(provider) && model !== void 0 && is(ThoughtLevel)(effort) && rest.length === 0 ? some({
|
|
25659
|
+
model: `${provider}:${model}`,
|
|
25660
|
+
thoughtLevel: effort
|
|
25661
|
+
}) : none();
|
|
25662
|
+
};
|
|
25663
|
+
const parseAcpModelId = (modelId) => {
|
|
25664
|
+
const [provider, model, ...rest] = modelId.split(":");
|
|
25665
|
+
return isProvider(provider) && model !== void 0 && rest.length === 0 ? some({
|
|
25662
25666
|
provider,
|
|
25663
|
-
model
|
|
25664
|
-
effort
|
|
25667
|
+
model
|
|
25665
25668
|
}) : none();
|
|
25666
25669
|
};
|
|
25667
|
-
const ModelId = String$5.pipe(check(makeFilter((modelId) => isSome(parseModelId(modelId)) || `Invalid model "${modelId}", expected <provider>/<model>/<effort
|
|
25670
|
+
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(", ")}`)));
|
|
25668
25671
|
const provider = Literals("provider", providers).pipe(withAlias("p"), withFallbackPrompt(Select({
|
|
25669
25672
|
message: "Select a provider",
|
|
25670
25673
|
choices: [
|
|
@@ -25699,20 +25702,21 @@ const Search = (directory) => unwrap$1(gen(function* () {
|
|
|
25699
25702
|
return empty$9;
|
|
25700
25703
|
}
|
|
25701
25704
|
const path = yield* Path$3;
|
|
25702
|
-
return (yield* promise(() => import("./SemanticSearch-
|
|
25705
|
+
return (yield* promise(() => import("./SemanticSearch-BPxQoRSC.mjs"))).layer({
|
|
25703
25706
|
directory: process.cwd(),
|
|
25704
25707
|
database: path.join(directory, "search.sqlite")
|
|
25705
25708
|
}).pipe(provide$3(model$3("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$5({ apiKey: apiKey.value })));
|
|
25706
25709
|
})).pipe(provide$3([layer$8, HttpClientLive]));
|
|
25707
|
-
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"));
|
|
25710
|
+
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))));
|
|
25708
25711
|
const acp = make$28("acp", {
|
|
25709
25712
|
model: acpModel,
|
|
25710
25713
|
compaction
|
|
25711
25714
|
}).pipe(withDescription("Run as an Agent Client Protocol (ACP) server over stdio"), withHandler(({ model }) => runStdio({
|
|
25712
25715
|
version,
|
|
25713
|
-
defaultModel: model,
|
|
25716
|
+
defaultModel: model.model,
|
|
25717
|
+
defaultThoughtLevel: model.thoughtLevel,
|
|
25714
25718
|
makeAgent: (cwd) => make$2.pipe(provide$1(layerLocal$1({ directory: cwd }))),
|
|
25715
|
-
makeModel: (modelId) => map$7(
|
|
25719
|
+
makeModel: (modelId, thoughtLevel) => map$7(parseAcpModelId(modelId), ({ provider, model }) => modelLayer(provider, model, thoughtLevel))
|
|
25716
25720
|
})), provide(({ compaction }) => mergeAll(ConversationMode.layer(true), succeed$4(LogToStderr, true), layerLog, CompactionConfig.layer({ enabled: compaction }))));
|
|
25717
25721
|
make$28("clanka", {
|
|
25718
25722
|
provider,
|
|
@@ -25722,7 +25726,7 @@ make$28("clanka", {
|
|
|
25722
25726
|
compaction
|
|
25723
25727
|
}).pipe(withHandler(fnUntraced(function* ({ provider, model: modelRaw, semantic, prompt: nonInteractivePrompt }) {
|
|
25724
25728
|
const stdio = yield* Stdio;
|
|
25725
|
-
const OutputFormatter = yield* promise(() => import("./OutputFormatter-
|
|
25729
|
+
const OutputFormatter = yield* promise(() => import("./OutputFormatter-C7Awn0DS.mjs"));
|
|
25726
25730
|
const [model, reasoning] = (yield* match$2(modelRaw, {
|
|
25727
25731
|
onSome: succeed$2,
|
|
25728
25732
|
onNone: () => String$4({
|