clanka 0.17.2 → 0.18.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.
- package/README.md +24 -0
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +5 -0
- package/dist/Acp.js.map +1 -1
- package/dist/Agent.d.ts +11 -0
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +35 -15
- package/dist/Agent.js.map +1 -1
- package/dist/Agent.test.js +23 -0
- package/dist/Agent.test.js.map +1 -1
- package/dist/AgentExecutor.js +15 -2
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +16 -0
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentOutput.d.ts +23 -4
- package/dist/AgentOutput.d.ts.map +1 -1
- package/dist/AgentOutput.js +19 -0
- package/dist/AgentOutput.js.map +1 -1
- package/dist/ClaudeAgent.d.ts.map +1 -1
- package/dist/ClaudeAgent.js +84 -13
- package/dist/ClaudeAgent.js.map +1 -1
- package/dist/ClaudeAgent.test.js +187 -4
- package/dist/ClaudeAgent.test.js.map +1 -1
- package/dist/Codex.js +9 -5
- package/dist/Codex.js.map +1 -1
- package/dist/Codex.test.js +26 -7
- package/dist/Codex.test.js.map +1 -1
- package/dist/Compaction.d.ts +41 -6
- package/dist/Compaction.d.ts.map +1 -1
- package/dist/Compaction.js +52 -11
- package/dist/Compaction.js.map +1 -1
- package/dist/Compaction.test.js +5 -4
- package/dist/Compaction.test.js.map +1 -1
- package/dist/CompactionTransport.test.js +11 -0
- package/dist/CompactionTransport.test.js.map +1 -1
- package/dist/Copilot.d.ts.map +1 -1
- package/dist/Copilot.js +3 -6
- package/dist/Copilot.js.map +1 -1
- package/dist/ModelLayer.d.ts +35 -6
- package/dist/ModelLayer.d.ts.map +1 -1
- package/dist/ModelLayer.js +30 -18
- package/dist/ModelLayer.js.map +1 -1
- package/dist/ModelLayer.test.js +11 -3
- package/dist/ModelLayer.test.js.map +1 -1
- package/dist/OutputFormatter.d.ts.map +1 -1
- package/dist/OutputFormatter.js +3 -0
- package/dist/OutputFormatter.js.map +1 -1
- package/dist/Xai.d.ts.map +1 -1
- package/dist/Xai.js +4 -12
- package/dist/Xai.js.map +1 -1
- package/dist/bin/{Effect-DNYYQ84C.mjs → Effect-5XYMLOiB.mjs} +31 -30
- package/dist/bin/Effect-5XYMLOiB.mjs.map +1 -0
- package/dist/bin/{Latch-BSlIwuxI.mjs → Latch-BnrpWMd1.mjs} +2 -2
- package/dist/bin/{Latch-BSlIwuxI.mjs.map → Latch-BnrpWMd1.mjs.map} +1 -1
- package/dist/bin/{McpClient-C7ctqJWo.mjs → McpClient-DoPNaNzW.mjs} +3 -3
- package/dist/bin/{McpClient-C7ctqJWo.mjs.map → McpClient-DoPNaNzW.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-DXej05JW.mjs → OutputFormatter-Dqxyk2qD.mjs} +4 -3
- package/dist/bin/{OutputFormatter-DXej05JW.mjs.map → OutputFormatter-Dqxyk2qD.mjs.map} +1 -1
- package/dist/bin/{Schema-CSQN_Zso.mjs → Schema-Box_9VZG.mjs} +6 -3
- package/dist/bin/{Schema-CSQN_Zso.mjs.map → Schema-Box_9VZG.mjs.map} +1 -1
- package/dist/bin/{SemanticSearch-BiwCnpKX.mjs → SemanticSearch-CH125AHH.mjs} +4 -4
- package/dist/bin/{SemanticSearch-BiwCnpKX.mjs.map → SemanticSearch-CH125AHH.mjs.map} +1 -1
- package/dist/bin/{Stream-Dwvj9X5X.mjs → Stream-C51usiew.mjs} +3 -3
- package/dist/bin/{Stream-Dwvj9X5X.mjs.map → Stream-C51usiew.mjs.map} +1 -1
- package/dist/bin/cli.mjs +339 -229
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{upgrade-BSNjCnra.mjs → upgrade-HMRGSqq8.mjs} +4 -4
- package/dist/bin/{upgrade-BSNjCnra.mjs.map → upgrade-HMRGSqq8.mjs.map} +1 -1
- package/dist/cli.js +45 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/src/Acp.ts +7 -0
- package/src/Agent.test.ts +27 -0
- package/src/Agent.ts +49 -15
- package/src/AgentExecutor.test.ts +23 -1
- package/src/AgentExecutor.ts +16 -2
- package/src/AgentOutput.ts +23 -0
- package/src/ClaudeAgent.test.ts +271 -4
- package/src/ClaudeAgent.ts +114 -19
- package/src/Codex.test.ts +37 -9
- package/src/Codex.ts +25 -20
- package/src/Compaction.test.ts +18 -15
- package/src/Compaction.ts +89 -20
- package/src/CompactionTransport.test.ts +36 -0
- package/src/Copilot.ts +5 -6
- package/src/ModelLayer.test.ts +17 -2
- package/src/ModelLayer.ts +68 -22
- package/src/OutputFormatter.ts +3 -0
- package/src/Xai.ts +8 -12
- package/src/cli.ts +97 -5
- package/dist/bin/Effect-DNYYQ84C.mjs.map +0 -1
package/dist/bin/cli.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-5zChB7MF.mjs";
|
|
3
|
-
import { $ as ignoreCause, $a as
|
|
4
|
-
import { $ as URLFromString, $n as
|
|
5
|
-
import { $ as runLast, A as fromQueue, At as shutdownUnsafe, B as mkString, Bt as interrupt$2, C as fromArray, Ct as failCauseUnsafe, D as fromEffect, Dt as offerAllUnsafe, E as fromChannel$1, Et as offerAll, F as mapArrayEffect, Ft as make$46, G as provideService$1, Gt as camelToSnake, H as orDie$2, Ht as interruptAllAs, I as mapEffect$1, It as set$1, J as runDrain, K as run$4, Kt as toLowerCase, L as mapError$1, Lt as update, M as isStream, Mt as take, N as map$11, Nt as unbounded, Ot as offerUnsafe, P as mapArray, R as merge$4, Rt as await_, S as flattenIterable, St as failCause$2, T as fromAsyncIterable, Tt as offer, U as pipeThroughChannel, Ut as join$3, V as onExit$1, Vt as interruptAll, W as provideContext$1, Wt as runIn, X as runForEach, Y as runFold, Z as runForEachArray, _ as filter$2, _t as makeUnsafe$4, a as catchReason$1, at as takeUntil, b as flatten, bt as endUnsafe, c as concat$1, ct as tapError, d as drainFork, dt as unwrap$6, et as scoped$1, f as drop, ft as fromTransform$1, g as failCause$3, gt as make$48, h as fail$6, ht as unwrap$5, it as take$1, j as fromReadableStream, jt as sliding, k as fromPull, kt as poll, l as decodeText, lt as toAsyncIterable, m as ensuring$1, mt as toTransform, n as callback$1, nt as succeed$6, o as catchTags$1, ot as takeWhile, p as empty$11, pt as mapDone, q as runCollect, r as catchCause$1, rt as suspend$
|
|
6
|
-
import { n as makeUnsafe$5 } from "./Latch-
|
|
3
|
+
import { $ as ignoreCause, $a as succeed$2, $n as TimeoutError, $o as orElseSome, $r as TracerTimingEnabled, A as ensuring, Aa as isCanonicalArrayIndex, Ac as constVoid, Ao as merge$1, Ar as empty$7, As as assignProperty, At as raceFirst, B as fn, Ba as sort, Bc as pipeArguments, Bo as fromUndefinedOr, Br as suspend$1, Bt as scope, C as catchTags, Ca as findFirstIndex, Cc as isTagged, Ci as LogToStderr$1, Co as get$2, Cr as reasonAnnotations, Ct as option$1, Da as headNonEmpty, Dc as constFalse, Do as getUnsafe, Dr as effect, Dt as provide$1, E as contextWith, Ea as fromIterable, Ec as or, Eo as getOrUndefinedUnsafe, Er as buildWithScope, Et as promise, F as failSync, Fc as memoize, Fn as jittered, Fo as flatMap$2, Fr as orDie$1, Fs as NodeInspectSymbol, Ft as runFork, G as forkChild, Ga as failVoid, Go as isNone, Gr as close, Gt as sleep, Ha as empty$6, Hn as isDoneCause, Ho as getOrNull, Hr as Scope, I as filterOrFail, Ia as map$7, In as min, Io as flatMapNullishOr, Ir as provide$3, It as runForkWith, J as forkScoped, Ja as getOrUndefined$2, Jn as round, Jr as make$43, K as forkDetach, Kn as parse$1, Kr as fork, Kt as succeed$1, L as flatMap$1, La as match$3, Lc as pipe, Ln as spaced, Lr as provideMerge, Ls as format, M as fail$1, Ma as join$2, Mc as dual, Mn as forever$1, Mo as all$1, Mr as merge$2, Ms as setStackTraceLimit, Mt as request, N as failCause, Na as last$1, Nc as flow, Nn as fromStep, No as exists, Nr as mergeAll, Ns as BaseProto, Nt as result, O as die, Oa as isArray, Oc as constTrue, Oo as make$41, Or as effectContext, Os as withFiber$1, Ot as provideContext, Pc as identity, Pn as isSchedule, Po as filter$1, Pr as mock, Ps as Class, Pt as retry, Q as ignore, Qn as StackTrace, Qo as orElse$1, Qr as MinimumLogLevel, Qt as tapCause, R as flatMapEager, Ra as of, Rn as toStep, Rr as succeed$4, Rt as runSync, S as catchTag, Sa as findFirst, Si as ConsoleRef, Sn as TaggedClass, So as empty$5, Sr as pretty, St as onInterrupt, T as context, To as getOrUndefined$1, Tr as build, Tt as orElseSucceed, U as forEach$1, Ua as headUnsafe, Ui as forkUnsafe, Uo as getOrThrow$1, Ur as addFinalizer$1, Us as redact, Ut as service, V as fnUntraced, Va as span, Vo as getOrElse, Vr as unwrap$3, Vt as scoped, W as forever, Wa as fail$2, Wn as Random$1, Wo as getOrUndefined, Wr as addFinalizerExit, Wt as serviceOption, X as fromResult, Xa as isSuccess$1, Xn as IllegalArgumentError, Xo as match$2, Xr as provide$2, Xt as sync, Y as fromOption, Ya as isFailure$1, Yn as Done, Yo as map$8, Yr as makeUnsafe$2, Yt as suspend, Z as gen, Za as map$6, Zo as none, Zr as CurrentLogAnnotations, Zt as tap, _ as catchEager, _i as isFailure, _n as withSpan$1, _r as isTimeoutError, _t as matchEffect, a as andThen, ac as hasProperty, ai as isDone, an as undefined_, ao as hours, ar as fail$5, as as String$6, at as logFatal, ba as empty$4, bi as void_$1, bn as equalBatchKeys, bo as Service, bt as onExit, c as as, ci as makeUnsafe$1, cn as updateContext, co as isFinite, cr as fromReasons, ct as makeSpanScoped, d as cached, da as ParentSpan, di as die$1, dn as void_, do as millis, dr as interruptors, ds as mapInput, dt as mapEager, ei as _await, en as timeout, eo as try_$1, er as UnknownError$1, es as some, et as interrupt, f as cachedWithTTL, fc as isNotNull, fi as fail$3, fo as minutes, ft as mapError, ga as Array$1, gc as isNullish, gn as withParentSpan, go as toMillis, gt as matchCauseEffect, h as catchCauseIf, ha as toPredicate, hc as isNull, hi as interrupt$1, ho as seconds, hr as isFailReason, hs as Prototype, i as all, ii as into, in as try_, io as fromInputUnsafe$1, ir as done, it as logError, j as exit, ja as isReadonlyArrayNonEmpty, jn as exponential, jr as fresh, js as getStackTraceLimit, jt as repeat, k as effectify, ka as isArrayNonEmpty, kc as constUndefined, ko as makeUnsafe$3, kt as provideService, l as asSome, li as succeed$5, ln as updateService, lr as hasInterrupts, lt as map$5, m as catchCause, ma as has, mc as isNotUndefined, mi as findErrorOption$1, mn as withFiber, mt as match$4, ni as fail$4, nn as timeoutOrElse, no as normalizeNonEmpty, nt as isEffect, o as annotateCurrentSpan, oa as sync$1, oi as isDoneUnsafe, on as uninterruptible, oo as infinity, or as filterInterruptors, ot as logInfo, p as callback, pa as compose, pc as isNotNullish, pi as failCause$1, pn as whileLoop, pr as isDieReason, q as forkIn, qa as getOrThrow, qo as isSome, qt as succeedNone, r as addFinalizer, rn as tryPromise, ro as format$1, rt as logDebug, s as annotateLogs, si as make$42, sn as uninterruptibleMask, sr as findErrorOption, st as logWarning, t as acquireRelease, ti as doneUnsafe, tn as timeoutOption, tr as annotate$1, ts as toArray, tt as interruptible, u as asVoid, ua as DisablePropagation, uc as isIterable, un as useSpan, uo as max, ur as hasInterruptsOnly, ut as mapBothEager, v as catchFilter, va as appendAll, vc as isObject$1, vi as isSuccess, vn as yieldNow, vo as zero, vr as makeDieReason, vs as PipeInspectableProto, vt as never$1, w as catch_, wa as findLast, wc as isUndefined, wo as getOption, wr as squash, wt as orDie, x as catchReason, xc as isString, xo as add, xr as map$9, y as catchIf, yc as isObjectKeyword, yi as succeed$3, yn as zipWith, yo as Reference, yr as makeFailReason, yt as onError, za as reduce, zn as catchDone, zo as fromNullishOr, zr as succeedContext } from "./Effect-5XYMLOiB.mjs";
|
|
4
|
+
import { $ as URLFromString, $n as optionalKey$1, $r as make$44, $t as isPattern, A as Null, An as escapeToken, Ar as fromBody, At as isGreaterThan, B as String$7, Bn as Objects, Br as retryAfterDelay, Bt as isLessThanDate, C as Literal, Cr as jsonSchemaAnnotationKeys, Ct as isBetweenCodePoints, D as Never, Dn as fromSchemaDraft07, Dr as redactUrl, Dt as isBetweenSize, E as Natural, En as errorWithPath, Er as fromInput, Et as isBetweenProperties, F as OptionFromOptional, Fn as encodeEffect, Fr as fromRecordUnsafe, Ft as isGreaterThanOrEqualToDate, G as TaggedClass$2, Gn as decodeTo, Gr as formatIso, Gt as isMaxLength, H as Struct, Hn as Suspend, Hr as setAll, Ht as isLessThanOrEqualToBigInt, I as Record, In as Arrays, Ir as isRedactedName, It as isIncluding, J as TaggedUnion, Jn as isJson, Jt as isMinCodePoints, K as TaggedError$1, Kn as defaultParseOptions, Kt as isMaxProperties, L as Redacted$4, Ln as Filter, Lr as merge$3, Lt as isInt, M as Number$2, Mn as getSubschemaKind, Mr as CurrentRedactedNames, Mt as isGreaterThanDate, N as Option, Nn as decodeEffect$1, Nr as empty$9, Nt as isGreaterThanOrEqualTo, O as NonEmptyArray, On as fromSchemaDraft2020_12, Or as setAll$1, Ot as isEndingWith, Pn as decodeUnknownEffect, Pr as fromInput$1, Pt as isGreaterThanOrEqualToBigInt, Q as URL$1, Qn as null_, Qr as isRedacted, Qt as isMultipleOf, R as RedactedFromValue, Rn as FilterGroup, Rr as parseRetryAfter$1, Rt as isLessThan, S as JsonObject$1, Sn as withDecodingDefaultKey, Sr as annotationExcludedKeys, St as isBetweenBigInt, T as MutableJson, Tn as pick, Tr as empty$8, Tt as isBetweenLength, U as StructWithRest, Un as Union$1, Ur as empty$10, Ut as isLessThanOrEqualToDate, V as StringForLiteralAutocomplete, Vn as PropertySignature, Vr as set, Vt as isLessThanOrEqualTo, W as Symbol$1, Wn as applyToSelfOrLastLinkEncoding, Wr as fromSetCookie, Wt as isMaxCodePoints, X as Tuple, Xn as isOptional, Xr as decode$3, Xt as isMinProperties, Y as TrueLiterals, Yn as isNever, Yt as isMinLength, Z as TupleWithRest, Zn as mapOrSame, Zr as encode, Zt as isMinSize, _ as Exit, _n as toEncoded$1, _r as transform$4, _t as encodeUnknownEffect, ai as EncodingError, an as isUnique, ar as toEncoded, at as Void, b as Int$5, bn as withConstructorDefault, br as InvalidValue$1, bt as is, c as Date$2, ci as TaggedError, cn as makeFilter$1, cr as Transformation, ct as declare, di as map$10, dn as optional$2, dr as transformEffect$1, dt as decodeTo$1, ei as value, en as isPropertyNames, er as replaceChecks, et as Uint8Array$2, f as DateTimeUtcFromString, fn as optionalKey, fr as transformOptional$1, ft as decodeUnknownEffect$1, g as Error$2, gn as toCodecStringTree, gr as passthroughSubtype, gt as encodeTo, h as DurationFromMillis, hn as toCodecJson, hr as passthrough, ht as encodeEffect$1, i as Boolean$4, in as isUUID, ir as string$1, it as Unknown, j as NullOr, jn as parseUriFragment, jr as unwrap$4, jt as isGreaterThanBigInt, k as NonEmptyString$1, kn as getReferenceKey, kr as toString, kt as isFinite$1, l as DateTimeUtc, li as taggedEnum, ln as makeFilterGroup, lr as passthrough$1, lt as decodeEffect, m as Duration, mn as tag, mt as decodeUnknownSync, n as ArraySchema, ni as Clock, nn as isSchemaError, nr as resolveDescription, nt as UndefinedOr, o as BooleanLiterals, oi as Error$1, on as link$1, or as toType$1, p as Defect, pn as suspend$2, pt as decodeUnknownOption, q as TaggedStruct, qn as getIndexSignatureKeys, qr as fromDateUnsafe, qt as isMaxSize, r as BigInt$2, ri as currentTimeMillis, rn as isStartingWith, rr as resolveIdentifier, rt as Union, s as Class$1, si as TaggedClass$1, sn as make$45, sr as unknown$1, st as check, t as Any, ti as stringOrRedacted, tn as isSchema, tr as resolveAt, tt as Uint8ArrayFromBase64, ui as assignProperty$1, un as mutable, ur as transform$3, ut as decodeSync, v as FalseLiterals, vn as toJsonSchemaDocument, vr as transformEffect, vt as fromJsonString, w as Literals$2, wn as omit, wr as CurrentRedactedNames$1, wt as isBetweenDate, x as Json, xn as withDecodingDefault, xr as Pointer, xt as isBetween, y as Finite, yn as toType, yr as transformOptional, yt as instanceOf, z as SchemaError, zn as Literal$1, zr as remove$1, zt as isLessThanBigInt } from "./Schema-Box_9VZG.mjs";
|
|
5
|
+
import { $ as runLast, A as fromQueue, At as shutdownUnsafe, B as mkString, Bt as interrupt$2, C as fromArray, Ct as failCauseUnsafe, D as fromEffect, Dt as offerAllUnsafe, E as fromChannel$1, Et as offerAll, F as mapArrayEffect, Ft as make$46, G as provideService$1, Gt as camelToSnake, H as orDie$2, Ht as interruptAllAs, I as mapEffect$1, It as set$1, J as runDrain, K as run$4, Kt as toLowerCase, L as mapError$1, Lt as update, M as isStream, Mt as take, N as map$11, Nt as unbounded, Ot as offerUnsafe, P as mapArray, R as merge$4, Rt as await_, S as flattenIterable, St as failCause$2, T as fromAsyncIterable, Tt as offer, U as pipeThroughChannel, Ut as join$3, V as onExit$1, Vt as interruptAll, W as provideContext$1, Wt as runIn, X as runForEach, Y as runFold, Z as runForEachArray, _ as filter$2, _t as makeUnsafe$4, a as catchReason$1, at as takeUntil, b as flatten, bt as endUnsafe, c as concat$1, ct as tapError, d as drainFork, dt as unwrap$6, et as scoped$1, f as drop, ft as fromTransform$1, g as failCause$3, gt as make$48, h as fail$6, ht as unwrap$5, it as take$1, j as fromReadableStream, jt as sliding, k as fromPull, kt as poll, l as decodeText, lt as toAsyncIterable, m as ensuring$1, mt as toTransform, n as callback$1, nt as succeed$6, o as catchTags$1, ot as takeWhile, p as empty$11, pt as mapDone, q as runCollect, r as catchCause$1, rt as suspend$3, s as catch_$1, st as tap$1, t as broadcast, tt as splitLines, u as die$2, ut as transduce, v as filterMap, vt as bounded, wt as make$47, x as flattenArray, xt as fail$7, yt as end, z as mergeAll$1, zt as getCurrent } from "./Stream-C51usiew.mjs";
|
|
6
|
+
import { n as makeUnsafe$5 } from "./Latch-BnrpWMd1.mjs";
|
|
7
7
|
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-CljL9OKa.mjs";
|
|
8
8
|
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-LcwjLVkt.mjs";
|
|
9
9
|
import { createRequire } from "node:module";
|
|
@@ -1297,7 +1297,7 @@ const Number$1 = (options) => {
|
|
|
1297
1297
|
clear: handleNumberClear(opts)
|
|
1298
1298
|
});
|
|
1299
1299
|
};
|
|
1300
|
-
const Int = (options) => {
|
|
1300
|
+
const Int$4 = (options) => {
|
|
1301
1301
|
const opts = {
|
|
1302
1302
|
default: 0,
|
|
1303
1303
|
min: globalThis.Number.NEGATIVE_INFINITY,
|
|
@@ -3347,7 +3347,7 @@ var InterruptibleResponse = class {
|
|
|
3347
3347
|
return source;
|
|
3348
3348
|
}
|
|
3349
3349
|
get stream() {
|
|
3350
|
-
return suspend$
|
|
3350
|
+
return suspend$3(() => {
|
|
3351
3351
|
responseRegistry.unregister(this.original);
|
|
3352
3352
|
return ensuring$1(this.original.stream, sync(() => {
|
|
3353
3353
|
this.controller.abort();
|
|
@@ -3772,7 +3772,7 @@ var UndiciResponse = class extends Class {
|
|
|
3772
3772
|
return pipeArguments(this, arguments);
|
|
3773
3773
|
}
|
|
3774
3774
|
};
|
|
3775
|
-
const loadUpgrade = promise(() => import("./upgrade-
|
|
3775
|
+
const loadUpgrade = promise(() => import("./upgrade-HMRGSqq8.mjs"));
|
|
3776
3776
|
const takeOver = (conn, head, signal) => {
|
|
3777
3777
|
if (head !== void 0 && head.length > 0) conn.unshift(head);
|
|
3778
3778
|
conn.on("error", constVoid);
|
|
@@ -4282,6 +4282,9 @@ function String$4(name) {
|
|
|
4282
4282
|
function NonEmptyString(name) {
|
|
4283
4283
|
return schema$1(NonEmptyString$1, name);
|
|
4284
4284
|
}
|
|
4285
|
+
function Int$3(name) {
|
|
4286
|
+
return schema$1(Int$5, name);
|
|
4287
|
+
}
|
|
4285
4288
|
function Boolean$3(name) {
|
|
4286
4289
|
return schema$1(BooleanLiterals, name);
|
|
4287
4290
|
}
|
|
@@ -5156,6 +5159,7 @@ const makeSchemaPrimitive = (tag, schema) => {
|
|
|
5156
5159
|
return makePrimitive(tag, (value) => mapError(decode(value), (error) => error.message));
|
|
5157
5160
|
};
|
|
5158
5161
|
const Boolean$2 = makeSchemaPrimitive("Boolean", BooleanLiterals);
|
|
5162
|
+
const Int$2 = makeSchemaPrimitive("Int", Int$5);
|
|
5159
5163
|
const String$3 = makePrimitive("String", (value) => succeed$1(value));
|
|
5160
5164
|
const Choice = (choices) => {
|
|
5161
5165
|
const choiceMap = new Map(choices);
|
|
@@ -5236,6 +5240,11 @@ const Boolean$1 = (kind, name) => makeSingle({
|
|
|
5236
5240
|
primitiveType: Boolean$2,
|
|
5237
5241
|
kind
|
|
5238
5242
|
});
|
|
5243
|
+
const Int$1 = (kind, name) => makeSingle({
|
|
5244
|
+
name,
|
|
5245
|
+
primitiveType: Int$2,
|
|
5246
|
+
kind
|
|
5247
|
+
});
|
|
5239
5248
|
const ChoiceWithValue$1 = (kind, name, choices) => makeSingle({
|
|
5240
5249
|
name,
|
|
5241
5250
|
primitiveType: Choice(choices),
|
|
@@ -6675,6 +6684,7 @@ const generate = (executableName, shell, descriptor) => {
|
|
|
6675
6684
|
// node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Flag.js
|
|
6676
6685
|
const String$1 = (name) => String$2(flagKind, name);
|
|
6677
6686
|
const Boolean = (name) => Boolean$1(flagKind, name);
|
|
6687
|
+
const Int = (name) => Int$1(flagKind, name);
|
|
6678
6688
|
const ChoiceWithValue = (name, choices) => ChoiceWithValue$1(flagKind, name, choices);
|
|
6679
6689
|
const Literals = (name, literals) => Literals$1(flagKind, name, literals);
|
|
6680
6690
|
const Directory = (name, options) => Directory$1(flagKind, name, options);
|
|
@@ -7453,7 +7463,7 @@ const promptParam = fnUntraced(function* (param) {
|
|
|
7453
7463
|
return [];
|
|
7454
7464
|
}
|
|
7455
7465
|
}
|
|
7456
|
-
const count = !metadata.isVariadic ? 1 : yield* run$3(Int({
|
|
7466
|
+
const count = !metadata.isVariadic ? 1 : yield* run$3(Int$4({
|
|
7457
7467
|
message: `${renderParamLabel(single)} count`,
|
|
7458
7468
|
default: getOrElse(metadata.variadicMin, () => 0),
|
|
7459
7469
|
min: getOrElse(metadata.variadicMin, () => 0),
|
|
@@ -7499,7 +7509,7 @@ const promptSingle = (single) => {
|
|
|
7499
7509
|
}
|
|
7500
7510
|
case "Date": return map$5(run$3(Date$1({ message })), (date) => commandLineArg(date.toISOString()));
|
|
7501
7511
|
case "Finite": return map$5(run$3(Number$1({ message })), (value) => commandLineArg(String(value)));
|
|
7502
|
-
case "Int": return map$5(run$3(Int({ message })), (value) => commandLineArg(String(value)));
|
|
7512
|
+
case "Int": return map$5(run$3(Int$4({ message })), (value) => commandLineArg(String(value)));
|
|
7503
7513
|
case "Redacted": return map$5(run$3(Password({ message })), (value$2) => commandLineArg(value(value$2), "<redacted>"));
|
|
7504
7514
|
default: return map$5(run$3(String$5({ message })), commandLineArg);
|
|
7505
7515
|
}
|
|
@@ -8299,7 +8309,7 @@ const make$24 = gen(function* () {
|
|
|
8299
8309
|
nodeStream.on("error", (cause) => passThrough.destroy(cause));
|
|
8300
8310
|
nodeStream.pipe(passThrough);
|
|
8301
8311
|
const onError = (cause) => toPlatformError(`fromReadable(fd${fd})`, toError(cause), command);
|
|
8302
|
-
stream = suspend$
|
|
8312
|
+
stream = suspend$3(() => error === void 0 ? fromReadable({
|
|
8303
8313
|
evaluate: () => passThrough,
|
|
8304
8314
|
onError
|
|
8305
8315
|
}) : fail$6(onError(error)));
|
|
@@ -9315,7 +9325,7 @@ var SocketUpgradeError = class SocketUpgradeError extends Error$2("effect/socket
|
|
|
9315
9325
|
};
|
|
9316
9326
|
var SocketCloseError = class extends Error$2("effect/socket/Socket/SocketCloseError")({
|
|
9317
9327
|
_tag: tag("SocketCloseError"),
|
|
9318
|
-
code: Int$
|
|
9328
|
+
code: Int$5,
|
|
9319
9329
|
closeReason: optional$2(String$7)
|
|
9320
9330
|
}) {
|
|
9321
9331
|
get message() {
|
|
@@ -10342,7 +10352,7 @@ var ExaError = class extends TaggedError$1()("ExaError", { cause: Defect() }) {}
|
|
|
10342
10352
|
const layer$8 = effect(ExaSearch, gen(function* () {
|
|
10343
10353
|
const scope$5 = yield* scope;
|
|
10344
10354
|
const getClient = yield* cachedWithTTL(gen(function* () {
|
|
10345
|
-
const McpClient = yield* tryPromise(() => import("./McpClient-
|
|
10355
|
+
const McpClient = yield* tryPromise(() => import("./McpClient-DoPNaNzW.mjs"));
|
|
10346
10356
|
const context = yield* buildWithScope(McpClient.layer, scope$5);
|
|
10347
10357
|
return get$2(context, McpClient.McpClient);
|
|
10348
10358
|
}), (exit) => isSuccess(exit) ? infinity : zero);
|
|
@@ -10415,7 +10425,7 @@ const layer$7 = effect(WebToMarkdown, gen(function* () {
|
|
|
10415
10425
|
}));
|
|
10416
10426
|
// node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/AiError.js
|
|
10417
10427
|
const HttpResponseDetails$1 = Struct({
|
|
10418
|
-
status: Int$
|
|
10428
|
+
status: Int$5,
|
|
10419
10429
|
headers: Record(String$7, Union([String$7, Redacted$4(String$7)]))
|
|
10420
10430
|
}).annotate({ identifier: "HttpResponseDetails" });
|
|
10421
10431
|
const ReasonTypeId = "~effect/ai/AiError/Reason";
|
|
@@ -10474,9 +10484,9 @@ var NetworkError = class NetworkError extends Error$2("effect/ai/AiError/Network
|
|
|
10474
10484
|
};
|
|
10475
10485
|
const ProviderMetadata$1 = Record(String$7, NullOr(MutableJson));
|
|
10476
10486
|
const UsageInfo = Struct({
|
|
10477
|
-
promptTokens: optional$2(Int$
|
|
10478
|
-
completionTokens: optional$2(Int$
|
|
10479
|
-
totalTokens: optional$2(Int$
|
|
10487
|
+
promptTokens: optional$2(Int$5),
|
|
10488
|
+
completionTokens: optional$2(Int$5),
|
|
10489
|
+
totalTokens: optional$2(Int$5)
|
|
10480
10490
|
}).annotate({ identifier: "UsageInfo" });
|
|
10481
10491
|
const HttpContext = Struct({
|
|
10482
10492
|
response: optional$2(HttpResponseDetails$1),
|
|
@@ -14431,7 +14441,11 @@ function runScriptWorker(load) {
|
|
|
14431
14441
|
});
|
|
14432
14442
|
callback();
|
|
14433
14443
|
} }),
|
|
14434
|
-
|
|
14444
|
+
inspectOptions: {
|
|
14445
|
+
colors: false,
|
|
14446
|
+
compact: true,
|
|
14447
|
+
breakLength: Infinity
|
|
14448
|
+
}
|
|
14435
14449
|
}),
|
|
14436
14450
|
fetch,
|
|
14437
14451
|
process: void 0
|
|
@@ -14480,6 +14494,11 @@ const workerSource = `${toFailure}
|
|
|
14480
14494
|
${fromFailure}
|
|
14481
14495
|
(${runScriptWorker})(require)
|
|
14482
14496
|
`;
|
|
14497
|
+
const inspectOptions = {
|
|
14498
|
+
colors: false,
|
|
14499
|
+
compact: true,
|
|
14500
|
+
breakLength: Infinity
|
|
14501
|
+
};
|
|
14483
14502
|
const homeDirectory = () => {
|
|
14484
14503
|
const fromEnv = process.env.HOME;
|
|
14485
14504
|
if (fromEnv) return some(fromEnv);
|
|
@@ -14493,7 +14512,7 @@ const makeConsole = fn(function* (queue) {
|
|
|
14493
14512
|
const writable = new QueueWriteStream(queue);
|
|
14494
14513
|
const newConsole = new NodeConsole.Console({
|
|
14495
14514
|
stdout: writable,
|
|
14496
|
-
|
|
14515
|
+
inspectOptions
|
|
14497
14516
|
});
|
|
14498
14517
|
yield* addFinalizer(() => {
|
|
14499
14518
|
writable.end();
|
|
@@ -16926,7 +16945,7 @@ var ReferenceSlot = class {
|
|
|
16926
16945
|
resolving = false;
|
|
16927
16946
|
wrapper;
|
|
16928
16947
|
constructor(key) {
|
|
16929
|
-
this.wrapper = suspend$
|
|
16948
|
+
this.wrapper = suspend$2(() => {
|
|
16930
16949
|
if (this.body === void 0) throw new Error(`Reference ${key} was evaluated before it was resolved`);
|
|
16931
16950
|
return this.body;
|
|
16932
16951
|
});
|
|
@@ -17904,7 +17923,7 @@ const isBetweenBigIntReviver = makeReviverFilter("effect/schema/isBetweenBigInt"
|
|
|
17904
17923
|
exclusiveMinimum: optional$2(Literal(true)),
|
|
17905
17924
|
exclusiveMaximum: optional$2(Literal(true))
|
|
17906
17925
|
}), ({ annotations, payload }) => isBetweenBigInt(payload, annotations));
|
|
17907
|
-
const RepresentationSchema = suspend$
|
|
17926
|
+
const RepresentationSchema = suspend$2(() => RepresentationUnion);
|
|
17908
17927
|
const RepresentationsSchema = ArraySchema(RepresentationSchema);
|
|
17909
17928
|
const RepresentationAnnotationSchema = Struct({
|
|
17910
17929
|
id: NonEmptyString$1,
|
|
@@ -17923,7 +17942,7 @@ const AnnotationsSchema = optional$2(Record(String$7, Unknown)).pipe(encodeTo(op
|
|
|
17923
17942
|
decode: passthroughSubtype(),
|
|
17924
17943
|
encode: transformOptional((annotations) => isNone(annotations) || annotations.value === void 0 ? none() : pruneAnnotations(annotations.value))
|
|
17925
17944
|
}));
|
|
17926
|
-
const CheckSchema = suspend$
|
|
17945
|
+
const CheckSchema = suspend$2(() => CheckUnion);
|
|
17927
17946
|
const ChecksSchema = ArraySchema(CheckSchema);
|
|
17928
17947
|
const KeywordFields = {
|
|
17929
17948
|
annotations: AnnotationsSchema,
|
|
@@ -18414,8 +18433,8 @@ const makeTool = fnUntraced(function* (serverName, id, tool) {
|
|
|
18414
18433
|
dts: docs.length === 0 ? signature : `${renderJsDoc(docs.join("\n\n"), " ")}\n${signature}`,
|
|
18415
18434
|
search: {
|
|
18416
18435
|
names: [tool.name.toLowerCase(), id.toLowerCase()],
|
|
18417
|
-
nameTokens: new Set([...tokens(tool.name), ...tokens(id)]),
|
|
18418
|
-
parameterTokens: new Set(parameterNames.flatMap(tokens)),
|
|
18436
|
+
nameTokens: new Set([...tokens$1(tool.name), ...tokens$1(id)]),
|
|
18437
|
+
parameterTokens: new Set(parameterNames.flatMap(tokens$1)),
|
|
18419
18438
|
description: (tool.description ?? "").toLowerCase()
|
|
18420
18439
|
}
|
|
18421
18440
|
};
|
|
@@ -18441,7 +18460,7 @@ const SearchParams = Struct({
|
|
|
18441
18460
|
server: optionalKey(String$7)
|
|
18442
18461
|
});
|
|
18443
18462
|
const maxResults = 10;
|
|
18444
|
-
const tokens = (text) => text.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter((token) => token !== "");
|
|
18463
|
+
const tokens$1 = (text) => text.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter((token) => token !== "");
|
|
18445
18464
|
const score = (tool, query) => {
|
|
18446
18465
|
let total = tool.search.names.includes(query.text) ? 1e3 : 0;
|
|
18447
18466
|
for (const token of query.tokens) {
|
|
@@ -18468,7 +18487,7 @@ const makeSearchTools = (servers) => {
|
|
|
18468
18487
|
} else if (query === "") return yield* fail$1(`searchTools: pass a query or a server. Servers: ${serverList}`);
|
|
18469
18488
|
const terms = {
|
|
18470
18489
|
text: query.toLowerCase(),
|
|
18471
|
-
tokens: tokens(query)
|
|
18490
|
+
tokens: tokens$1(query)
|
|
18472
18491
|
};
|
|
18473
18492
|
const ranked = candidates.flatMap((server) => server.tools.map((tool) => ({
|
|
18474
18493
|
server,
|
|
@@ -19123,15 +19142,15 @@ const FinishReason = Literals$2([
|
|
|
19123
19142
|
]);
|
|
19124
19143
|
var Usage$1 = class extends Class$1("effect/ai/AiResponse/Usage")({
|
|
19125
19144
|
inputTokens: Struct({
|
|
19126
|
-
uncached: optional$2(Int$
|
|
19127
|
-
total: optional$2(Int$
|
|
19128
|
-
cacheRead: optional$2(Int$
|
|
19129
|
-
cacheWrite: optional$2(Int$
|
|
19145
|
+
uncached: optional$2(Int$5),
|
|
19146
|
+
total: optional$2(Int$5),
|
|
19147
|
+
cacheRead: optional$2(Int$5),
|
|
19148
|
+
cacheWrite: optional$2(Int$5)
|
|
19130
19149
|
}),
|
|
19131
19150
|
outputTokens: Struct({
|
|
19132
|
-
total: optional$2(Int$
|
|
19133
|
-
text: optional$2(Int$
|
|
19134
|
-
reasoning: optional$2(Int$
|
|
19151
|
+
total: optional$2(Int$5),
|
|
19152
|
+
text: optional$2(Int$5),
|
|
19153
|
+
reasoning: optional$2(Int$5)
|
|
19135
19154
|
})
|
|
19136
19155
|
}) {};
|
|
19137
19156
|
const FinishPart = Struct({
|
|
@@ -19957,6 +19976,7 @@ const defaultConfig = {
|
|
|
19957
19976
|
enabled: true,
|
|
19958
19977
|
contextWindow: 236e3,
|
|
19959
19978
|
reserveTokens: 16e3,
|
|
19979
|
+
thresholdTokens: 16e4,
|
|
19960
19980
|
keepRecentTokens: 2e4
|
|
19961
19981
|
};
|
|
19962
19982
|
var CompactionConfig = class CompactionConfig extends Reference("clanka/Compaction/CompactionConfig", { defaultValue: () => defaultConfig }) {
|
|
@@ -19966,6 +19986,11 @@ var CompactionConfig = class CompactionConfig extends Reference("clanka/Compacti
|
|
|
19966
19986
|
});
|
|
19967
19987
|
};
|
|
19968
19988
|
var SummarizerTransform = class extends Reference("clanka/Compaction/SummarizerTransform", { defaultValue: () => identity }) {};
|
|
19989
|
+
var SummarizerModel = class extends Service()("clanka/Compaction/SummarizerModel") {};
|
|
19990
|
+
const layerSummarizerModel = (layer) => effect(SummarizerModel, gen(function* () {
|
|
19991
|
+
const services = yield* context();
|
|
19992
|
+
return fresh(orDie$1(layer)).pipe(provide$3(succeedContext(services)));
|
|
19993
|
+
}));
|
|
19969
19994
|
const executeOutputCapChars = 32e3;
|
|
19970
19995
|
const summarizerToolResultCapChars = 2e3;
|
|
19971
19996
|
const keptToolResultStubChars = 2e3;
|
|
@@ -20016,9 +20041,10 @@ const estimateTokens = (prompt) => {
|
|
|
20016
20041
|
return Math.ceil(chars / 4);
|
|
20017
20042
|
};
|
|
20018
20043
|
const estimateMessageTokens = (message) => Math.ceil(estimateMessageChars(message) / 4);
|
|
20044
|
+
const compactionThreshold$1 = (config) => Math.min(config.thresholdTokens, config.contextWindow - config.reserveTokens);
|
|
20019
20045
|
const shouldCompact = (options) => {
|
|
20020
20046
|
if (!options.config.enabled) return false;
|
|
20021
|
-
return (options.contextTokens ?? estimateTokens(options.prompt)) > options.config
|
|
20047
|
+
return (options.contextTokens ?? estimateTokens(options.prompt)) > compactionThreshold$1(options.config);
|
|
20022
20048
|
};
|
|
20023
20049
|
const contextLengthPattern = /context[_ ]?(length|window)|too many tokens|prompt is too long|prompt token count|exceeds the (context|token|input )?limit|input token limit|exceeds the model'?s? (context|token|input)/i;
|
|
20024
20050
|
const contextLengthCode = "context_length_exceeded";
|
|
@@ -20205,11 +20231,18 @@ const compact = fnUntraced(function* (options) {
|
|
|
20205
20231
|
if (isNone(parts)) return none();
|
|
20206
20232
|
const { system, previousSummary, toSummarize, kept } = parts.value;
|
|
20207
20233
|
if (options.onStart) yield* options.onStart(options.reason);
|
|
20208
|
-
const
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20234
|
+
const summarize = gen(function* () {
|
|
20235
|
+
const ai = yield* LanguageModel;
|
|
20236
|
+
return yield* (yield* SummarizerTransform)(ai.streamText({ prompt: summarizerPrompt({
|
|
20237
|
+
previousSummary,
|
|
20238
|
+
messages: toSummarize
|
|
20239
|
+
}) }).pipe(runFold(() => "", (text, part) => part.type === "text-delta" ? text + part.delta : text)));
|
|
20240
|
+
});
|
|
20241
|
+
const summarizerModel = yield* serviceOption(SummarizerModel);
|
|
20242
|
+
const summary = (yield* match$2(summarizerModel, {
|
|
20243
|
+
onNone: () => summarize,
|
|
20244
|
+
onSome: (model) => summarize.pipe(provide$1(model), provideService(SummarizerTransform, identity))
|
|
20245
|
+
})).trim();
|
|
20213
20246
|
if (summary.length === 0) return yield* make$18({
|
|
20214
20247
|
module: "clanka/Compaction",
|
|
20215
20248
|
method: "compact",
|
|
@@ -20295,6 +20328,11 @@ var CompactionEnded = class extends TaggedClass$2()("CompactionEnded", {
|
|
|
20295
20328
|
tokensBefore: Number$2,
|
|
20296
20329
|
tokensAfter: Number$2
|
|
20297
20330
|
}) {};
|
|
20331
|
+
var SessionRestarted = class extends TaggedClass$2()("SessionRestarted", {
|
|
20332
|
+
reason: String$7,
|
|
20333
|
+
contextTokens: Number$2,
|
|
20334
|
+
cacheWrite: Number$2
|
|
20335
|
+
}) {};
|
|
20298
20336
|
var EnvironmentUpdated = class extends TaggedClass$2()("EnvironmentUpdated", { update: String$7 }) {};
|
|
20299
20337
|
const ContentPart = Union([
|
|
20300
20338
|
ReasoningStart,
|
|
@@ -20309,6 +20347,7 @@ const ContentPart = Union([
|
|
|
20309
20347
|
ExecuteOutputCapped,
|
|
20310
20348
|
CompactionStarted,
|
|
20311
20349
|
CompactionEnded,
|
|
20350
|
+
SessionRestarted,
|
|
20312
20351
|
EnvironmentUpdated
|
|
20313
20352
|
]);
|
|
20314
20353
|
var SubagentPart = class extends TaggedClass$2()("SubagentPart", {
|
|
@@ -20396,6 +20435,7 @@ const makeWith$1 = fnUntraced(function* (options) {
|
|
|
20396
20435
|
};
|
|
20397
20436
|
const replaceHistory = (next) => {
|
|
20398
20437
|
set$1(prompt, next);
|
|
20438
|
+
lastContextTokens = void 0;
|
|
20399
20439
|
if (!opts.historyEvents) return;
|
|
20400
20440
|
offerUnsafe(output, new HistoryReplaced({ messages: next.content.filter((message) => message.role !== "system") }));
|
|
20401
20441
|
};
|
|
@@ -20686,7 +20726,6 @@ ${prompt}`,
|
|
|
20686
20726
|
let tokensAfter;
|
|
20687
20727
|
if (isSome(result)) {
|
|
20688
20728
|
replaceHistory(fromMessages(result.value.prompt.content.filter((message) => !isEnvironmentUpdate(message))));
|
|
20689
|
-
lastContextTokens = void 0;
|
|
20690
20729
|
tokensBefore = result.value.tokensBefore;
|
|
20691
20730
|
tokensAfter = result.value.tokensAfter;
|
|
20692
20731
|
} else tokensBefore = tokensAfter = estimateTokens(prompt.current);
|
|
@@ -20816,13 +20855,10 @@ ${capOutput(turn.output ?? "").output}
|
|
|
20816
20855
|
});
|
|
20817
20856
|
return true;
|
|
20818
20857
|
};
|
|
20819
|
-
const runModel = pipe(suspend$
|
|
20858
|
+
const runModel = pipe(suspend$3(() => ai.streamText({
|
|
20820
20859
|
prompt: sendImages ? prompt.current : stripImages(prompt.current),
|
|
20821
20860
|
toolkit: singleTool
|
|
20822
|
-
})), takeUntil((part) => {
|
|
20823
|
-
if ((part.type === "text-end" || part.type === "reasoning-end") && mailbox.messages.size > 0) return true;
|
|
20824
|
-
return false;
|
|
20825
|
-
}), runForEachArray((parts) => {
|
|
20861
|
+
})), takeUntil((part) => modelConfig.cutStreamOnSteering !== false && (part.type === "text-end" || part.type === "reasoning-end") && mailbox.messages.size > 0), runForEachArray((parts) => {
|
|
20826
20862
|
response.push(...parts);
|
|
20827
20863
|
turnTimeoutReset();
|
|
20828
20864
|
for (const part of parts) switch (part.type) {
|
|
@@ -20865,6 +20901,14 @@ ${capOutput(turn.output ?? "").output}
|
|
|
20865
20901
|
if (usage.outputTokens.total !== void 0) outputTokens += usage.outputTokens.total;
|
|
20866
20902
|
if (usage.inputTokens.cacheRead !== void 0) cacheRead += usage.inputTokens.cacheRead;
|
|
20867
20903
|
if (usage.inputTokens.cacheWrite !== void 0) cacheWrite += usage.inputTokens.cacheWrite;
|
|
20904
|
+
if (isHistoryResent(part.metadata)) maybeSend({
|
|
20905
|
+
agentId,
|
|
20906
|
+
part: new SessionRestarted({
|
|
20907
|
+
reason: part.metadata.clanka.historyResent.reason,
|
|
20908
|
+
contextTokens: usage.inputTokens.total ?? 0,
|
|
20909
|
+
cacheWrite: usage.inputTokens.cacheWrite ?? 0
|
|
20910
|
+
})
|
|
20911
|
+
});
|
|
20868
20912
|
if (usage.inputTokens.total !== void 0) {
|
|
20869
20913
|
lastContextTokens = usage.inputTokens.total;
|
|
20870
20914
|
inputTokens += usage.inputTokens.total;
|
|
@@ -21047,6 +21091,7 @@ const when = (condition, text) => condition ? text : "";
|
|
|
21047
21091
|
const generateSystemTools = (tools, conversationMode) => `YOU ONLY HAVE ONE TOOL AVAILABLE: "execute", to run javascript code to do your work.
|
|
21048
21092
|
|
|
21049
21093
|
- Use \`console.log\` to print any output you need.
|
|
21094
|
+
- Print only what you need, as everything printed stays in your context.${when(tools.offers("readFile"), ` Read line ranges with "startLine" / "endLine" instead of whole files.`)} Slice or filter large results before printing them.
|
|
21050
21095
|
- Use top level await.${when(tools.offers("search") && tools.offers("rg"), `
|
|
21051
21096
|
- Prefer using the "search" function over "rg", unless you are targeting specific files or patterns.`)}${when(tools.offers("applyPatch"), `
|
|
21052
21097
|
- You can add / update / remove multiple files in one go with "applyPatch".${when(tools.offers("writeFile"), ` Prefer it over "writeFile" to update existing files.`)}`)}${when(tools.offers("bash"), `
|
|
@@ -21092,16 +21137,13 @@ console.log("files:", files)
|
|
|
21092
21137
|
console.log("package.json:", JSON.parse(content))
|
|
21093
21138
|
\`\`\`
|
|
21094
21139
|
|
|
21095
|
-
And then you will
|
|
21140
|
+
And then you will receive back the console output:
|
|
21096
21141
|
|
|
21097
21142
|
\`\`\`
|
|
21098
21143
|
[22:44:53.050] INFO (#47): Calling "ls" { directory: '.' }
|
|
21099
21144
|
[22:44:53.054] INFO (#47): Calling "readFile" { path: 'package.json' }
|
|
21100
21145
|
files: [ 'package.json' ]
|
|
21101
|
-
package.json: {
|
|
21102
|
-
"name": "my-project",
|
|
21103
|
-
"version": "1.0.0"
|
|
21104
|
-
}
|
|
21146
|
+
package.json: { name: 'my-project', version: '1.0.0' }
|
|
21105
21147
|
\`\`\``;
|
|
21106
21148
|
const ReadSkillTools = make$16(make$17("readSkill", {
|
|
21107
21149
|
description: "Read the instructions of a skill listed under Skills, by its name.",
|
|
@@ -21166,7 +21208,13 @@ var MaxRetries = class MaxRetries extends Reference("clanka/Agent/MaxRetries", {
|
|
|
21166
21208
|
};
|
|
21167
21209
|
var AgentModelConfig = class AgentModelConfig extends Reference("clanka/Agent/SystemPromptTransform", { defaultValue: () => ({}) }) {
|
|
21168
21210
|
static layer = (options) => succeed$4(AgentModelConfig, options);
|
|
21211
|
+
static optionKeys = [
|
|
21212
|
+
"systemPromptTransform",
|
|
21213
|
+
"supportsImages",
|
|
21214
|
+
"cutStreamOnSteering"
|
|
21215
|
+
];
|
|
21169
21216
|
};
|
|
21217
|
+
const isHistoryResent = is(Struct({ clanka: Struct({ historyResent: Struct({ reason: String$7 }) }) }));
|
|
21170
21218
|
const responseToSummary = (response) => {
|
|
21171
21219
|
const prompt = fromResponseParts(response);
|
|
21172
21220
|
let parts = empty$4();
|
|
@@ -21632,6 +21680,10 @@ const make$7 = fnUntraced(function* (options) {
|
|
|
21632
21680
|
sessionUpdate: "agent_thought_chunk",
|
|
21633
21681
|
content: textContent(`Retrying after error: ${part.error.message}\n`)
|
|
21634
21682
|
});
|
|
21683
|
+
case "SessionRestarted": return update(session.id, {
|
|
21684
|
+
sessionUpdate: "agent_thought_chunk",
|
|
21685
|
+
content: textContent(`Session restarted (${part.reason}): ${part.contextTokens} context tokens resent, ${part.cacheWrite} cache write\n`)
|
|
21686
|
+
});
|
|
21635
21687
|
case "SubagentStart": {
|
|
21636
21688
|
const announced = session.announcedSubagents.has(part.id);
|
|
21637
21689
|
session.announcedSubagents.add(part.id);
|
|
@@ -22191,7 +22243,7 @@ var Retry = class Retry extends TaggedClass$1("Retry") {
|
|
|
22191
22243
|
}
|
|
22192
22244
|
};
|
|
22193
22245
|
// node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/Generated.js
|
|
22194
|
-
const CompoundFilter = suspend$
|
|
22246
|
+
const CompoundFilter = suspend$2(() => __recursive_CompoundFilter);
|
|
22195
22247
|
const Metadata = Union([Record(String$7, String$7).annotate({ "description": "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n" }), Null]).annotate({ "identifier": "Metadata" });
|
|
22196
22248
|
const ReasoningEffort = Union([Literals$2([
|
|
22197
22249
|
"none",
|
|
@@ -23108,7 +23160,7 @@ const InlineSkillParam = Struct({
|
|
|
23108
23160
|
"type": Literal("inline").annotate({ "description": "Defines an inline skill for this request." }),
|
|
23109
23161
|
"name": String$7.annotate({ "description": "The name of the skill." }),
|
|
23110
23162
|
"description": String$7.annotate({ "description": "The description of the skill." }),
|
|
23111
|
-
"source": suspend$
|
|
23163
|
+
"source": suspend$2(() => InlineSkillSourceParam).annotate({ "description": "Inline skill payload" })
|
|
23112
23164
|
}).annotate({ "identifier": "InlineSkillParam" });
|
|
23113
23165
|
const ContainerNetworkPolicyAllowlistParam = Struct({
|
|
23114
23166
|
"type": Literal("allowlist").annotate({ "description": "Allow outbound network access only to specified domains. Always `allowlist`." }),
|
|
@@ -23150,7 +23202,7 @@ const InputImageContent$1 = Struct({
|
|
|
23150
23202
|
"format": "uri"
|
|
23151
23203
|
}), Null])),
|
|
23152
23204
|
"file_id": optionalKey(Union([String$7.annotate({ "description": "The ID of the file to be sent to the model." }), Null])),
|
|
23153
|
-
"detail": suspend$
|
|
23205
|
+
"detail": suspend$2(() => ImageDetail$1).annotate({ "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." }),
|
|
23154
23206
|
"prompt_cache_breakpoint": optionalKey(PromptCacheBreakpointConfig)
|
|
23155
23207
|
}).annotate({
|
|
23156
23208
|
"title": "Input image",
|
|
@@ -23167,7 +23219,7 @@ const InputFileContent$1 = Struct({
|
|
|
23167
23219
|
"description": "The URL of the file to be sent to the model.",
|
|
23168
23220
|
"format": "uri"
|
|
23169
23221
|
})),
|
|
23170
|
-
"detail": optionalKey(suspend$
|
|
23222
|
+
"detail": optionalKey(suspend$2(() => FileInputDetail).annotate({ "description": "The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`." }))
|
|
23171
23223
|
}).annotate({
|
|
23172
23224
|
"title": "Input file",
|
|
23173
23225
|
"description": "A file input to the model.",
|
|
@@ -23183,7 +23235,7 @@ const ToolCallCallerParam = Union([DirectToolCallCallerParam, ProgramToolCallCal
|
|
|
23183
23235
|
});
|
|
23184
23236
|
const ClickParam = Struct({
|
|
23185
23237
|
"type": Literal("click").annotate({ "description": "Specifies the event type. For a click action, this property is always `click`." }),
|
|
23186
|
-
"button": suspend$
|
|
23238
|
+
"button": suspend$2(() => ClickButtonType).annotate({ "description": "Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`." }),
|
|
23187
23239
|
"x": Number$2.annotate({ "description": "The x-coordinate where the click occurred." }).check(isInt().annotate({ "expected": "an integer" })),
|
|
23188
23240
|
"y": Number$2.annotate({ "description": "The y-coordinate where the click occurred." }).check(isInt().annotate({ "expected": "an integer" })),
|
|
23189
23241
|
"keys": optionalKey(Union([ArraySchema(String$7).annotate({ "description": "The keys being held while clicking." }), Null]))
|
|
@@ -23225,14 +23277,14 @@ const ApplyPatchToolParam = Struct({
|
|
|
23225
23277
|
"identifier": "ApplyPatchToolParam"
|
|
23226
23278
|
});
|
|
23227
23279
|
const RankingOptions = Struct({
|
|
23228
|
-
"ranker": optionalKey(suspend$
|
|
23280
|
+
"ranker": optionalKey(suspend$2(() => RankerVersionType).annotate({ "description": "The ranker to use for the file search." })),
|
|
23229
23281
|
"score_threshold": optionalKey(Number$2.annotate({ "description": "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results." }).check(isFinite$1().annotate({ "expected": "a finite number" }))),
|
|
23230
|
-
"hybrid_search": optionalKey(suspend$
|
|
23282
|
+
"hybrid_search": optionalKey(suspend$2(() => HybridSearchOptions).annotate({ "description": "Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled." }))
|
|
23231
23283
|
}).annotate({ "identifier": "RankingOptions" });
|
|
23232
23284
|
const Filters = Union([ComparisonFilter, CompoundFilter]).annotate({ "identifier": "Filters" });
|
|
23233
23285
|
const ComputerUsePreviewTool = Struct({
|
|
23234
23286
|
"type": Literal("computer_use_preview").annotate({ "description": "The type of the computer use tool. Always `computer_use_preview`." }),
|
|
23235
|
-
"environment": suspend$
|
|
23287
|
+
"environment": suspend$2(() => ComputerEnvironment).annotate({ "description": "The type of computer environment to control." }),
|
|
23236
23288
|
"display_width": Number$2.annotate({ "description": "The width of the computer display." }).check(isInt().annotate({ "expected": "an integer" })),
|
|
23237
23289
|
"display_height": Number$2.annotate({ "description": "The height of the computer display." }).check(isInt().annotate({ "expected": "an integer" }))
|
|
23238
23290
|
}).annotate({
|
|
@@ -23247,7 +23299,7 @@ const WebSearchTool = Struct({
|
|
|
23247
23299
|
"title": "Allowed domains for the search.",
|
|
23248
23300
|
"description": "Allowed domains for the search. If not provided, all domains are allowed.\nSubdomains of the provided domains are allowed as well.\n\nExample: `[\"pubmed.ncbi.nlm.nih.gov\"]`\n"
|
|
23249
23301
|
}), Null])) }).annotate({ "description": "Filters for the search.\n" }), Null])),
|
|
23250
|
-
"user_location": optionalKey(suspend$
|
|
23302
|
+
"user_location": optionalKey(suspend$2(() => WebSearchApproximateLocation).annotate({ "description": "The approximate location of the user. If omitted or null, defaults to the\nUnited States. To avoid this fallback, pass `{\"type\": \"approximate\"}` without\nlocation fields. To localize results, provide the relevant location fields.\n" })),
|
|
23251
23303
|
"search_context_size": optionalKey(Literals$2([
|
|
23252
23304
|
"low",
|
|
23253
23305
|
"medium",
|
|
@@ -23345,7 +23397,7 @@ const ImageGenTool = Struct({
|
|
|
23345
23397
|
"file_id": optionalKey(String$7.annotate({ "description": "File ID for the mask image.\n" }))
|
|
23346
23398
|
}).annotate({ "description": "Optional mask for inpainting. Contains `image_url`\n(string, optional) and `file_id` (string, optional).\n" })),
|
|
23347
23399
|
"partial_images": optionalKey(Number$2.annotate({ "description": "Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n" }).check(isInt().annotate({ "expected": "an integer" })).check(isGreaterThanOrEqualTo(0).annotate({ "expected": "a value greater than or equal to 0" })).check(isLessThanOrEqualTo(3).annotate({ "expected": "a value less than or equal to 3" }))),
|
|
23348
|
-
"action": optionalKey(suspend$
|
|
23400
|
+
"action": optionalKey(suspend$2(() => ImageGenActionEnum).annotate({ "description": "Whether to generate a new image or edit an existing image. Default: `auto`.\n" }))
|
|
23349
23401
|
}).annotate({
|
|
23350
23402
|
"title": "Image generation tool",
|
|
23351
23403
|
"description": "A tool that generates images using the GPT image models.\n",
|
|
@@ -23357,7 +23409,7 @@ const LocalEnvironmentParam = Struct({
|
|
|
23357
23409
|
}).annotate({ "identifier": "LocalEnvironmentParam" });
|
|
23358
23410
|
const CustomGrammarFormatParam = Struct({
|
|
23359
23411
|
"type": Literal("grammar").annotate({ "description": "Grammar format. Always `grammar`." }),
|
|
23360
|
-
"syntax": suspend$
|
|
23412
|
+
"syntax": suspend$2(() => GrammarSyntax1).annotate({ "description": "The syntax of the grammar definition. One of `lark` or `regex`." }),
|
|
23361
23413
|
"definition": String$7.annotate({ "description": "The grammar definition." })
|
|
23362
23414
|
}).annotate({
|
|
23363
23415
|
"title": "Grammar format",
|
|
@@ -23377,9 +23429,9 @@ const FunctionToolParam = Struct({
|
|
|
23377
23429
|
}).annotate({ "identifier": "FunctionToolParam" });
|
|
23378
23430
|
const ToolSearchToolParam = Struct({
|
|
23379
23431
|
"type": Literal("tool_search").annotate({ "description": "The type of the tool. Always `tool_search`." }),
|
|
23380
|
-
"execution": optionalKey(suspend$
|
|
23432
|
+
"execution": optionalKey(suspend$2(() => ToolSearchExecutionType).annotate({ "description": "Whether tool search is executed by the server or by the client." })),
|
|
23381
23433
|
"description": optionalKey(Union([String$7.annotate({ "description": "Description shown to the model for a client-executed tool search tool." }), Null])),
|
|
23382
|
-
"parameters": optionalKey(Union([suspend$
|
|
23434
|
+
"parameters": optionalKey(Union([suspend$2(() => EmptyModelParam).annotate({ "description": "Parameter schema for a client-executed tool search tool." }), Null]))
|
|
23383
23435
|
}).annotate({
|
|
23384
23436
|
"title": "Tool search tool",
|
|
23385
23437
|
"description": "Hosted or BYOT tool search configuration for deferred tools.",
|
|
@@ -23398,8 +23450,8 @@ const ToolSearchOutputFunctionToolParam = Struct({
|
|
|
23398
23450
|
}).annotate({ "identifier": "ToolSearchOutputFunctionToolParam" });
|
|
23399
23451
|
const WebSearchPreviewTool = Struct({
|
|
23400
23452
|
"type": Literals$2(["web_search_preview", "web_search_preview_2025_03_11"]).annotate({ "description": "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`." }),
|
|
23401
|
-
"user_location": optionalKey(Union([suspend$
|
|
23402
|
-
"search_context_size": optionalKey(suspend$
|
|
23453
|
+
"user_location": optionalKey(Union([suspend$2(() => ApproximateLocation).annotate({ "description": "The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{\"type\": \"approximate\"}` without location fields. To localize results, provide the relevant location fields." }), Null])),
|
|
23454
|
+
"search_context_size": optionalKey(suspend$2(() => SearchContextSize).annotate({ "description": "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." })),
|
|
23403
23455
|
"search_content_types": optionalKey(ArraySchema(SearchContentType))
|
|
23404
23456
|
}).annotate({
|
|
23405
23457
|
"title": "Web search preview",
|
|
@@ -23418,7 +23470,7 @@ const InputImageContentParamAutoParam = Struct({
|
|
|
23418
23470
|
"format": "uri"
|
|
23419
23471
|
}).check(isMaxCodePoints(20971520).annotate({ "expected": "a string with at most 20971520 code points" })), Null])),
|
|
23420
23472
|
"file_id": optionalKey(Union([String$7.annotate({ "description": "The ID of the file to be sent to the model." }), Null])),
|
|
23421
|
-
"detail": optionalKey(Union([suspend$
|
|
23473
|
+
"detail": optionalKey(Union([suspend$2(() => DetailEnum).annotate({ "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." }), Null])),
|
|
23422
23474
|
"prompt_cache_breakpoint": optionalKey(Union([PromptCacheBreakpointParam, Null]))
|
|
23423
23475
|
}).annotate({
|
|
23424
23476
|
"title": "Input image",
|
|
@@ -23434,7 +23486,7 @@ const InputFileContentParam = Struct({
|
|
|
23434
23486
|
"description": "The URL of the file to be sent to the model.",
|
|
23435
23487
|
"format": "uri"
|
|
23436
23488
|
}), Null])),
|
|
23437
|
-
"detail": optionalKey(suspend$
|
|
23489
|
+
"detail": optionalKey(suspend$2(() => FileDetailEnum).annotate({ "description": "The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`." })),
|
|
23438
23490
|
"prompt_cache_breakpoint": optionalKey(Union([PromptCacheBreakpointParam, Null]))
|
|
23439
23491
|
}).annotate({
|
|
23440
23492
|
"title": "Input file",
|
|
@@ -23460,12 +23512,12 @@ const ProgramOutputItemParam = Struct({
|
|
|
23460
23512
|
"type": Literal("program_output").annotate({ "description": "The item type. Always `program_output`." }),
|
|
23461
23513
|
"call_id": String$7.annotate({ "description": "The call ID of the program item." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })),
|
|
23462
23514
|
"result": String$7.annotate({ "description": "The result produced by the program item." }).check(isMaxCodePoints(10485760).annotate({ "expected": "a string with at most 10485760 code points" })),
|
|
23463
|
-
"status": suspend$
|
|
23515
|
+
"status": suspend$2(() => ProgramOutputItemStatus).annotate({ "description": "The terminal status of the program output." })
|
|
23464
23516
|
}).annotate({ "identifier": "ProgramOutputItemParam" });
|
|
23465
23517
|
const AutoCodeInterpreterToolParam = Struct({
|
|
23466
23518
|
"type": Literal("auto").annotate({ "description": "Always `auto`." }),
|
|
23467
23519
|
"file_ids": optionalKey(ArraySchema(String$7).annotate({ "description": "An optional list of uploaded files to make available to your code." }).check(isMaxLength(50).annotate({ "expected": "a value with a length of at most 50" }))),
|
|
23468
|
-
"memory_limit": optionalKey(Union([suspend$
|
|
23520
|
+
"memory_limit": optionalKey(Union([suspend$2(() => ContainerMemoryLimit).annotate({ "description": "The memory limit for the code interpreter container." }), Null])),
|
|
23469
23521
|
"network_policy": optionalKey(Union([ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam], { mode: "oneOf" }).annotate({ "description": "Network access policy for the container." }))
|
|
23470
23522
|
}).annotate({
|
|
23471
23523
|
"title": "CodeInterpreterToolAuto",
|
|
@@ -23475,7 +23527,7 @@ const AutoCodeInterpreterToolParam = Struct({
|
|
|
23475
23527
|
const ContainerAutoParam = Struct({
|
|
23476
23528
|
"type": Literal("container_auto").annotate({ "description": "Automatically creates a container for this request" }),
|
|
23477
23529
|
"file_ids": optionalKey(ArraySchema(String$7).annotate({ "description": "An optional list of uploaded files to make available to your code." }).check(isMaxLength(50).annotate({ "expected": "a value with a length of at most 50" }))),
|
|
23478
|
-
"memory_limit": optionalKey(Union([suspend$
|
|
23530
|
+
"memory_limit": optionalKey(Union([suspend$2(() => ContainerMemoryLimit).annotate({ "description": "The memory limit for the container." }), Null])),
|
|
23479
23531
|
"network_policy": optionalKey(Union([ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam], { mode: "oneOf" }).annotate({ "description": "Network access policy for the container." })),
|
|
23480
23532
|
"skills": optionalKey(ArraySchema(Union([SkillReferenceParam, InlineSkillParam], { mode: "oneOf" })).annotate({ "description": "An optional list of skills referenced by id or inline data." }).check(isMaxLength(200).annotate({ "expected": "a value with a length of at most 200" })))
|
|
23481
23533
|
}).annotate({ "identifier": "ContainerAutoParam" });
|
|
@@ -23514,8 +23566,8 @@ const FileSearchTool = Struct({
|
|
|
23514
23566
|
"type": Literal("file_search").annotate({ "description": "The type of the file search tool. Always `file_search`." }),
|
|
23515
23567
|
"vector_store_ids": ArraySchema(String$7).annotate({ "description": "The IDs of the vector stores to search." }),
|
|
23516
23568
|
"max_num_results": optionalKey(Number$2.annotate({ "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." }).check(isInt().annotate({ "expected": "an integer" }))),
|
|
23517
|
-
"ranking_options": optionalKey(suspend$
|
|
23518
|
-
"filters": optionalKey(Union([suspend$
|
|
23569
|
+
"ranking_options": optionalKey(suspend$2(() => RankingOptions).annotate({ "description": "Ranking options for search." })),
|
|
23570
|
+
"filters": optionalKey(Union([suspend$2(() => Filters).annotate({ "description": "A filter to apply." }), Null]))
|
|
23519
23571
|
}).annotate({
|
|
23520
23572
|
"title": "File search",
|
|
23521
23573
|
"description": "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://developers.openai.com/api/docs/guides/tools-file-search).",
|
|
@@ -23537,7 +23589,7 @@ const CustomToolParam = Struct({
|
|
|
23537
23589
|
const FunctionShellCallOutputContentParam = Struct({
|
|
23538
23590
|
"stdout": String$7.annotate({ "description": "Captured stdout output for the shell call." }).check(isMaxCodePoints(10485760).annotate({ "expected": "a string with at most 10485760 code points" })),
|
|
23539
23591
|
"stderr": String$7.annotate({ "description": "Captured stderr output for the shell call." }).check(isMaxCodePoints(10485760).annotate({ "expected": "a string with at most 10485760 code points" })),
|
|
23540
|
-
"outcome": suspend$
|
|
23592
|
+
"outcome": suspend$2(() => FunctionShellCallOutputOutcomeParam).annotate({ "description": "The exit or timeout outcome associated with this shell call." })
|
|
23541
23593
|
}).annotate({
|
|
23542
23594
|
"title": "Shell output content",
|
|
23543
23595
|
"description": "Captured stdout and stderr for a portion of a shell tool call output.",
|
|
@@ -23738,7 +23790,7 @@ const InputItem$1 = Union([
|
|
|
23738
23790
|
"type": Literal("computer_call_output").annotate({ "description": "The type of the computer tool call output. Always `computer_call_output`." }),
|
|
23739
23791
|
"output": ComputerScreenshotImage,
|
|
23740
23792
|
"acknowledged_safety_checks": optionalKey(Union([ArraySchema(ComputerCallSafetyCheckParam).annotate({ "description": "The safety checks reported by the API that have been acknowledged by the developer." }), Null])),
|
|
23741
|
-
"status": optionalKey(Union([suspend$
|
|
23793
|
+
"status": optionalKey(Union([suspend$2(() => FunctionCallItemStatus).annotate({ "description": "The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API." }), Null]))
|
|
23742
23794
|
}).annotate({
|
|
23743
23795
|
"title": "Computer tool call output",
|
|
23744
23796
|
"description": "The output of a computer tool call."
|
|
@@ -23746,7 +23798,7 @@ const InputItem$1 = Union([
|
|
|
23746
23798
|
Struct({
|
|
23747
23799
|
"id": String$7.annotate({ "description": "The unique ID of the web search tool call.\n" }),
|
|
23748
23800
|
"type": Literal("web_search_call").annotate({ "description": "The type of the web search tool call. Always `web_search_call`.\n" }),
|
|
23749
|
-
"status": suspend$
|
|
23801
|
+
"status": suspend$2(() => WebSearchCallStatus).annotate({ "description": "The status of the web search tool call.\n" }),
|
|
23750
23802
|
"action": optionalKey(Union([
|
|
23751
23803
|
WebSearchActionSearch,
|
|
23752
23804
|
WebSearchActionOpenPage,
|
|
@@ -23785,8 +23837,8 @@ const InputItem$1 = Union([
|
|
|
23785
23837
|
], { mode: "oneOf" }).annotate({ "description": "A piece of message content, such as text, an image, or a file." })).annotate({ "description": "An array of content outputs (text, image, file) for the function tool call." })], { mode: "oneOf" }).annotate({ "description": "Text, image, or file output of the function tool call." }),
|
|
23786
23838
|
"name": optionalKey(Union([String$7.annotate({ "description": "The name of the tool that produced the output." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(128).annotate({ "expected": "a string with at most 128 code points" })), Null])),
|
|
23787
23839
|
"namespace": optionalKey(Union([String$7.annotate({ "description": "The namespace of the tool that produced the output." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })).check(isPattern(new RegExp("^[a-zA-Z0-9_-]+$", "u")).annotate({ "expected": "a string matching the RegExp ^[a-zA-Z0-9_-]+$" })), Null])),
|
|
23788
|
-
"caller": optionalKey(Union([suspend$
|
|
23789
|
-
"status": optionalKey(Union([suspend$
|
|
23840
|
+
"caller": optionalKey(Union([suspend$2(() => ToolCallCallerParam).annotate({ "description": "The execution context that produced this tool call." }), Null])),
|
|
23841
|
+
"status": optionalKey(Union([suspend$2(() => FunctionCallItemStatus).annotate({ "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." }), Null]))
|
|
23790
23842
|
}).annotate({
|
|
23791
23843
|
"title": "Function tool call output",
|
|
23792
23844
|
"description": "The output of a function tool call."
|
|
@@ -23795,17 +23847,17 @@ const InputItem$1 = Union([
|
|
|
23795
23847
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of this tool search call." }), Null])),
|
|
23796
23848
|
"call_id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the tool search call generated by the model." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })), Null])),
|
|
23797
23849
|
"type": Literal("tool_search_call").annotate({ "description": "The item type. Always `tool_search_call`." }),
|
|
23798
|
-
"execution": optionalKey(suspend$
|
|
23799
|
-
"arguments": suspend$
|
|
23800
|
-
"status": optionalKey(Union([suspend$
|
|
23850
|
+
"execution": optionalKey(suspend$2(() => ToolSearchExecutionType).annotate({ "description": "Whether tool search was executed by the server or by the client." })),
|
|
23851
|
+
"arguments": suspend$2(() => EmptyModelParam).annotate({ "description": "The arguments supplied to the tool search call." }),
|
|
23852
|
+
"status": optionalKey(Union([suspend$2(() => FunctionCallItemStatus).annotate({ "description": "The status of the tool search call." }), Null]))
|
|
23801
23853
|
}),
|
|
23802
23854
|
Struct({
|
|
23803
23855
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of this tool search output." }), Null])),
|
|
23804
23856
|
"call_id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the tool search call generated by the model." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })), Null])),
|
|
23805
23857
|
"type": Literal("tool_search_output").annotate({ "description": "The item type. Always `tool_search_output`." }),
|
|
23806
|
-
"execution": optionalKey(suspend$
|
|
23858
|
+
"execution": optionalKey(suspend$2(() => ToolSearchExecutionType).annotate({ "description": "Whether tool search was executed by the server or by the client." })),
|
|
23807
23859
|
"tools": ArraySchema(ToolSearchOutputTool).annotate({ "description": "The loaded tool definitions returned by the tool search output." }),
|
|
23808
|
-
"status": optionalKey(Union([suspend$
|
|
23860
|
+
"status": optionalKey(Union([suspend$2(() => FunctionCallItemStatus).annotate({ "description": "The status of the tool search output." }), Null]))
|
|
23809
23861
|
}),
|
|
23810
23862
|
Struct({
|
|
23811
23863
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of this additional tools item." }), Null])),
|
|
@@ -23816,7 +23868,7 @@ const InputItem$1 = Union([
|
|
|
23816
23868
|
Struct({
|
|
23817
23869
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the configuration update item." }), Null])),
|
|
23818
23870
|
"type": Literal("configuration_update").annotate({ "description": "The item type. Always `configuration_update`." }),
|
|
23819
|
-
"reasoning": optionalKey(Struct({ "effort": optionalKey(suspend$
|
|
23871
|
+
"reasoning": optionalKey(Struct({ "effort": optionalKey(suspend$2(() => ReasoningEffort).annotate({ "description": "The reasoning effort to use for subsequent responses until another\nconfiguration update replaces it.\n" })) }).annotate({ "description": "Updates to reasoning configuration. Only effort is supported." }))
|
|
23820
23872
|
}).annotate({ "description": "An update to the conversation's response configuration. The configuration\nremains in effect for subsequent responses until it is replaced by another\nconfiguration update.\n" }),
|
|
23821
23873
|
Struct({
|
|
23822
23874
|
"type": Literal("reasoning").annotate({ "description": "The type of the object. Always `reasoning`.\n" }),
|
|
@@ -23864,9 +23916,9 @@ const InputItem$1 = Union([
|
|
|
23864
23916
|
"max",
|
|
23865
23917
|
"auto"
|
|
23866
23918
|
]).annotate({ "description": "The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`." }), Null])),
|
|
23867
|
-
"action": optionalKey(Union([suspend$
|
|
23868
|
-
"background": optionalKey(Union([suspend$
|
|
23869
|
-
"output_format": optionalKey(Union([suspend$
|
|
23919
|
+
"action": optionalKey(Union([suspend$2(() => ImageGenActionEnum).annotate({ "description": "The action used for image generation." }), Null])),
|
|
23920
|
+
"background": optionalKey(Union([suspend$2(() => ImageBackground).annotate({ "description": "The background setting used for generation." }), Null])),
|
|
23921
|
+
"output_format": optionalKey(Union([suspend$2(() => ImageOutputFormat).annotate({ "description": "The output format used for generation." }), Null])),
|
|
23870
23922
|
"revised_prompt": optionalKey(Union([String$7.annotate({ "description": "The prompt that was used after any model prompt rewriting." }), Null]))
|
|
23871
23923
|
}).annotate({
|
|
23872
23924
|
"title": "Image generation call",
|
|
@@ -23920,10 +23972,10 @@ const InputItem$1 = Union([
|
|
|
23920
23972
|
Struct({
|
|
23921
23973
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the shell tool call. Populated when this item is returned via API." }), Null])),
|
|
23922
23974
|
"call_id": String$7.annotate({ "description": "The unique ID of the shell tool call generated by the model." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })),
|
|
23923
|
-
"caller": optionalKey(Union([suspend$
|
|
23975
|
+
"caller": optionalKey(Union([suspend$2(() => ToolCallCallerParam).annotate({ "description": "The execution context that produced this tool call." }), Null])),
|
|
23924
23976
|
"type": Literal("shell_call").annotate({ "description": "The type of the item. Always `shell_call`." }),
|
|
23925
|
-
"action": suspend$
|
|
23926
|
-
"status": optionalKey(Union([suspend$
|
|
23977
|
+
"action": suspend$2(() => FunctionShellActionParam).annotate({ "description": "The shell commands and limits that describe how to run the tool call." }),
|
|
23978
|
+
"status": optionalKey(Union([suspend$2(() => FunctionShellCallItemStatus).annotate({ "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." }), Null])),
|
|
23927
23979
|
"environment": optionalKey(Union([Union([LocalEnvironmentParam, ContainerReferenceParam], { mode: "oneOf" }).annotate({ "description": "The environment to execute the shell commands in." }), Null]))
|
|
23928
23980
|
}).annotate({
|
|
23929
23981
|
"title": "Shell tool call",
|
|
@@ -23932,10 +23984,10 @@ const InputItem$1 = Union([
|
|
|
23932
23984
|
Struct({
|
|
23933
23985
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the shell tool call output. Populated when this item is returned via API." }), Null])),
|
|
23934
23986
|
"call_id": String$7.annotate({ "description": "The unique ID of the shell tool call generated by the model." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })),
|
|
23935
|
-
"caller": optionalKey(Union([suspend$
|
|
23987
|
+
"caller": optionalKey(Union([suspend$2(() => ToolCallCallerParam).annotate({ "description": "The execution context that produced this tool call." }), Null])),
|
|
23936
23988
|
"type": Literal("shell_call_output").annotate({ "description": "The type of the item. Always `shell_call_output`." }),
|
|
23937
23989
|
"output": ArraySchema(FunctionShellCallOutputContentParam).annotate({ "description": "Captured chunks of stdout and stderr output, along with their associated outcomes." }),
|
|
23938
|
-
"status": optionalKey(Union([suspend$
|
|
23990
|
+
"status": optionalKey(Union([suspend$2(() => FunctionShellCallItemStatus).annotate({ "description": "The status of the shell call output." }), Null])),
|
|
23939
23991
|
"max_output_length": optionalKey(Union([Number$2.annotate({ "description": "The maximum number of UTF-8 characters captured for this shell call's combined output." }).check(isInt().annotate({ "expected": "an integer" })), Null]))
|
|
23940
23992
|
}).annotate({
|
|
23941
23993
|
"title": "Shell tool call output",
|
|
@@ -23945,9 +23997,9 @@ const InputItem$1 = Union([
|
|
|
23945
23997
|
"type": Literal("apply_patch_call").annotate({ "description": "The type of the item. Always `apply_patch_call`." }),
|
|
23946
23998
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." }), Null])),
|
|
23947
23999
|
"call_id": String$7.annotate({ "description": "The unique ID of the apply patch tool call generated by the model." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })),
|
|
23948
|
-
"caller": optionalKey(Union([suspend$
|
|
23949
|
-
"status": suspend$
|
|
23950
|
-
"operation": suspend$
|
|
24000
|
+
"caller": optionalKey(Union([suspend$2(() => ToolCallCallerParam).annotate({ "description": "The execution context that produced this tool call." }), Null])),
|
|
24001
|
+
"status": suspend$2(() => ApplyPatchCallStatusParam).annotate({ "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." }),
|
|
24002
|
+
"operation": suspend$2(() => ApplyPatchOperationParam).annotate({ "description": "The specific create, delete, or update instruction for the apply_patch tool call." })
|
|
23951
24003
|
}).annotate({
|
|
23952
24004
|
"title": "Apply patch tool call",
|
|
23953
24005
|
"description": "A tool call representing a request to create, delete, or update files using diff patches."
|
|
@@ -23956,8 +24008,8 @@ const InputItem$1 = Union([
|
|
|
23956
24008
|
"type": Literal("apply_patch_call_output").annotate({ "description": "The type of the item. Always `apply_patch_call_output`." }),
|
|
23957
24009
|
"id": optionalKey(Union([String$7.annotate({ "description": "The unique ID of the apply patch tool call output. Populated when this item is returned via API." }), Null])),
|
|
23958
24010
|
"call_id": String$7.annotate({ "description": "The unique ID of the apply patch tool call generated by the model." }).check(isMinLength(1).annotate({ "expected": "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ "expected": "a string with at most 64 code points" })),
|
|
23959
|
-
"caller": optionalKey(Union([suspend$
|
|
23960
|
-
"status": suspend$
|
|
24011
|
+
"caller": optionalKey(Union([suspend$2(() => ToolCallCallerParam).annotate({ "description": "The execution context that produced this tool call." }), Null])),
|
|
24012
|
+
"status": suspend$2(() => ApplyPatchCallOutputStatusParam).annotate({ "description": "The status of the apply patch tool call output. One of `completed` or `failed`." }),
|
|
23961
24013
|
"output": optionalKey(Union([String$7.annotate({ "description": "Optional human-readable log text from the apply patch tool (e.g., patch results or errors)." }).check(isMaxCodePoints(10485760).annotate({ "expected": "a string with at most 10485760 code points" })), Null]))
|
|
23962
24014
|
}).annotate({
|
|
23963
24015
|
"title": "Apply patch tool call output",
|
|
@@ -24002,7 +24054,7 @@ const InputItem$1 = Union([
|
|
|
24002
24054
|
"arguments": String$7.annotate({ "description": "A JSON string of the arguments passed to the tool.\n" }),
|
|
24003
24055
|
"output": optionalKey(Union([String$7.annotate({ "description": "The output from the tool call.\n" }), Null])),
|
|
24004
24056
|
"error": optionalKey(Union([MCPToolCallError, Null]).annotate({ "description": "The error from the tool call, if any." })),
|
|
24005
|
-
"status": optionalKey(suspend$
|
|
24057
|
+
"status": optionalKey(suspend$2(() => MCPToolCallStatus).annotate({ "description": "The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n" })),
|
|
24006
24058
|
"approval_request_id": optionalKey(Union([String$7.annotate({ "description": "Unique identifier for the MCP tool call approval request.\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\n" }), Null]))
|
|
24007
24059
|
}).annotate({
|
|
24008
24060
|
"title": "MCP tool call",
|
|
@@ -24048,7 +24100,7 @@ const InputItem$1 = Union([
|
|
|
24048
24100
|
], { mode: "oneOf" }).annotate({ "identifier": "InputItem" });
|
|
24049
24101
|
const __recursive_CompoundFilter = Struct({
|
|
24050
24102
|
"type": Literals$2(["and", "or"]).annotate({ "description": "Type of operation: `and` or `or`." }),
|
|
24051
|
-
"filters": ArraySchema(Union([ComparisonFilter, suspend$
|
|
24103
|
+
"filters": ArraySchema(Union([ComparisonFilter, suspend$2(() => CompoundFilter)], { mode: "oneOf" })).annotate({ "description": "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`." })
|
|
24052
24104
|
}).annotate({
|
|
24053
24105
|
"title": "Compound Filter",
|
|
24054
24106
|
"description": "Combine multiple filters using `and` or `or`.",
|
|
@@ -24928,28 +24980,28 @@ const ComputerScreenshotContent = Struct({
|
|
|
24928
24980
|
const FileCitationAnnotation = Struct({
|
|
24929
24981
|
type: Literal("file_citation"),
|
|
24930
24982
|
file_id: String$7,
|
|
24931
|
-
index: Int$
|
|
24983
|
+
index: Int$5,
|
|
24932
24984
|
filename: String$7
|
|
24933
24985
|
});
|
|
24934
24986
|
const UrlCitationAnnotation = Struct({
|
|
24935
24987
|
type: Literal("url_citation"),
|
|
24936
24988
|
url: String$7,
|
|
24937
|
-
start_index: Int$
|
|
24938
|
-
end_index: Int$
|
|
24989
|
+
start_index: Int$5,
|
|
24990
|
+
end_index: Int$5,
|
|
24939
24991
|
title: String$7
|
|
24940
24992
|
});
|
|
24941
24993
|
const ContainerFileCitationAnnotation = Struct({
|
|
24942
24994
|
type: Literal("container_file_citation"),
|
|
24943
24995
|
container_id: String$7,
|
|
24944
24996
|
file_id: String$7,
|
|
24945
|
-
start_index: Int$
|
|
24946
|
-
end_index: Int$
|
|
24997
|
+
start_index: Int$5,
|
|
24998
|
+
end_index: Int$5,
|
|
24947
24999
|
filename: String$7
|
|
24948
25000
|
});
|
|
24949
25001
|
const FilePathAnnotation = Struct({
|
|
24950
25002
|
type: Literal("file_path"),
|
|
24951
25003
|
file_id: String$7,
|
|
24952
|
-
index: Int$
|
|
25004
|
+
index: Int$5
|
|
24953
25005
|
});
|
|
24954
25006
|
const Annotation = Union([
|
|
24955
25007
|
FileCitationAnnotation,
|
|
@@ -25183,7 +25235,7 @@ const TextResponseFormatConfiguration = Union([
|
|
|
25183
25235
|
]);
|
|
25184
25236
|
const CreateResponse = Struct({
|
|
25185
25237
|
metadata: optional$2(Record(String$7, String$7)),
|
|
25186
|
-
top_logprobs: optional$2(Int$
|
|
25238
|
+
top_logprobs: optional$2(Int$5),
|
|
25187
25239
|
temperature: optional$2(Finite),
|
|
25188
25240
|
top_p: optional$2(Finite),
|
|
25189
25241
|
user: optional$2(String$7),
|
|
@@ -25220,8 +25272,8 @@ const CreateResponse = Struct({
|
|
|
25220
25272
|
]))
|
|
25221
25273
|
})),
|
|
25222
25274
|
background: optional$2(Boolean$4),
|
|
25223
|
-
max_output_tokens: optional$2(Int$
|
|
25224
|
-
max_tool_calls: optional$2(Int$
|
|
25275
|
+
max_output_tokens: optional$2(Int$5),
|
|
25276
|
+
max_tool_calls: optional$2(Int$5),
|
|
25225
25277
|
text: optional$2(Struct({
|
|
25226
25278
|
format: optional$2(TextResponseFormatConfiguration),
|
|
25227
25279
|
verbosity: optional$2(Literals$2([
|
|
@@ -25240,12 +25292,12 @@ const CreateResponse = Struct({
|
|
|
25240
25292
|
stream: optional$2(Boolean$4),
|
|
25241
25293
|
conversation: optional$2(String$7),
|
|
25242
25294
|
modalities: optional$2(ArraySchema(Literals$2(["text", "audio"]))),
|
|
25243
|
-
seed: optional$2(Int$
|
|
25295
|
+
seed: optional$2(Int$5)
|
|
25244
25296
|
});
|
|
25245
25297
|
const ResponseUsage = StructWithRest(Struct({
|
|
25246
|
-
input_tokens: Int$
|
|
25247
|
-
output_tokens: Int$
|
|
25248
|
-
total_tokens: Int$
|
|
25298
|
+
input_tokens: Int$5,
|
|
25299
|
+
output_tokens: Int$5,
|
|
25300
|
+
total_tokens: Int$5,
|
|
25249
25301
|
input_tokens_details: optionalKey(Unknown),
|
|
25250
25302
|
output_tokens_details: optionalKey(Unknown)
|
|
25251
25303
|
}), [UnknownRecord]);
|
|
@@ -25359,8 +25411,8 @@ const PromptCacheDiagnostics = Union([
|
|
|
25359
25411
|
"input_changed",
|
|
25360
25412
|
"service_tier_changed"
|
|
25361
25413
|
]),
|
|
25362
|
-
cache_missed_tokens: Int$
|
|
25363
|
-
comparison_reusable_tokens: optionalKey(Int$
|
|
25414
|
+
cache_missed_tokens: Int$5,
|
|
25415
|
+
comparison_reusable_tokens: optionalKey(Int$5)
|
|
25364
25416
|
}),
|
|
25365
25417
|
Struct({ type: Literal("cache_hit") }),
|
|
25366
25418
|
Struct({ type: Literal("comparison_response_not_found") }),
|
|
@@ -25370,7 +25422,7 @@ const Response$1 = Struct({
|
|
|
25370
25422
|
id: String$7,
|
|
25371
25423
|
object: optionalKey(Literal("response")),
|
|
25372
25424
|
model: String$7,
|
|
25373
|
-
created_at: Int$
|
|
25425
|
+
created_at: Int$5,
|
|
25374
25426
|
output: ArraySchema(OutputItem).pipe(withDecodingDefault(succeed$1([]))),
|
|
25375
25427
|
usage: optionalKey(NullOr(ResponseUsage)),
|
|
25376
25428
|
error: optionalKey(NullOr(ResponseError)),
|
|
@@ -25381,124 +25433,124 @@ const Response$1 = Struct({
|
|
|
25381
25433
|
const ResponseCreatedEvent = Struct({
|
|
25382
25434
|
type: Literal("response.created"),
|
|
25383
25435
|
response: Response$1,
|
|
25384
|
-
sequence_number: optionalKey(Int$
|
|
25436
|
+
sequence_number: optionalKey(Int$5)
|
|
25385
25437
|
});
|
|
25386
25438
|
const ResponseCompletedEvent = Struct({
|
|
25387
25439
|
type: Literal("response.completed"),
|
|
25388
25440
|
response: Response$1,
|
|
25389
|
-
sequence_number: optionalKey(Int$
|
|
25441
|
+
sequence_number: optionalKey(Int$5)
|
|
25390
25442
|
});
|
|
25391
25443
|
const ResponseIncompleteEvent = Struct({
|
|
25392
25444
|
type: Literal("response.incomplete"),
|
|
25393
25445
|
response: Response$1,
|
|
25394
|
-
sequence_number: optionalKey(Int$
|
|
25446
|
+
sequence_number: optionalKey(Int$5)
|
|
25395
25447
|
});
|
|
25396
25448
|
const ResponseFailedEvent = Struct({
|
|
25397
25449
|
type: Literal("response.failed"),
|
|
25398
25450
|
response: Response$1,
|
|
25399
|
-
sequence_number: optionalKey(Int$
|
|
25451
|
+
sequence_number: optionalKey(Int$5)
|
|
25400
25452
|
});
|
|
25401
25453
|
const ResponseOutputItemAddedEvent = Struct({
|
|
25402
25454
|
type: Literal("response.output_item.added"),
|
|
25403
|
-
output_index: Int$
|
|
25404
|
-
sequence_number: optionalKey(Int$
|
|
25455
|
+
output_index: Int$5,
|
|
25456
|
+
sequence_number: optionalKey(Int$5),
|
|
25405
25457
|
item: OutputItem
|
|
25406
25458
|
});
|
|
25407
25459
|
const ResponseOutputItemDoneEvent = Struct({
|
|
25408
25460
|
type: Literal("response.output_item.done"),
|
|
25409
|
-
output_index: Int$
|
|
25410
|
-
sequence_number: optionalKey(Int$
|
|
25461
|
+
output_index: Int$5,
|
|
25462
|
+
sequence_number: optionalKey(Int$5),
|
|
25411
25463
|
item: OutputItem
|
|
25412
25464
|
});
|
|
25413
25465
|
const ResponseOutputTextDeltaEvent = Struct({
|
|
25414
25466
|
type: Literal("response.output_text.delta"),
|
|
25415
25467
|
item_id: String$7,
|
|
25416
|
-
output_index: Int$
|
|
25417
|
-
content_index: Int$
|
|
25468
|
+
output_index: Int$5,
|
|
25469
|
+
content_index: Int$5,
|
|
25418
25470
|
delta: String$7,
|
|
25419
|
-
sequence_number: optionalKey(Int$
|
|
25471
|
+
sequence_number: optionalKey(Int$5),
|
|
25420
25472
|
logprobs: optionalKey(ArraySchema(Unknown))
|
|
25421
25473
|
});
|
|
25422
25474
|
const ResponseOutputTextAnnotationAddedEvent = Struct({
|
|
25423
25475
|
type: Literal("response.output_text.annotation.added"),
|
|
25424
25476
|
item_id: String$7,
|
|
25425
|
-
output_index: Int$
|
|
25426
|
-
content_index: Int$
|
|
25427
|
-
annotation_index: Int$
|
|
25428
|
-
sequence_number: optionalKey(Int$
|
|
25477
|
+
output_index: Int$5,
|
|
25478
|
+
content_index: Int$5,
|
|
25479
|
+
annotation_index: Int$5,
|
|
25480
|
+
sequence_number: optionalKey(Int$5),
|
|
25429
25481
|
annotation: Annotation
|
|
25430
25482
|
});
|
|
25431
25483
|
const ResponseReasoningSummaryPartAddedEvent = Struct({
|
|
25432
25484
|
type: Literal("response.reasoning_summary_part.added"),
|
|
25433
25485
|
item_id: String$7,
|
|
25434
|
-
output_index: Int$
|
|
25435
|
-
summary_index: Int$
|
|
25436
|
-
sequence_number: optionalKey(Int$
|
|
25486
|
+
output_index: Int$5,
|
|
25487
|
+
summary_index: Int$5,
|
|
25488
|
+
sequence_number: optionalKey(Int$5),
|
|
25437
25489
|
part: SummaryTextContent
|
|
25438
25490
|
});
|
|
25439
25491
|
const ResponseReasoningSummaryPartDoneEvent = Struct({
|
|
25440
25492
|
type: Literal("response.reasoning_summary_part.done"),
|
|
25441
25493
|
item_id: String$7,
|
|
25442
|
-
output_index: Int$
|
|
25443
|
-
summary_index: Int$
|
|
25444
|
-
sequence_number: optionalKey(Int$
|
|
25494
|
+
output_index: Int$5,
|
|
25495
|
+
summary_index: Int$5,
|
|
25496
|
+
sequence_number: optionalKey(Int$5),
|
|
25445
25497
|
part: SummaryTextContent
|
|
25446
25498
|
});
|
|
25447
25499
|
const ResponseReasoningSummaryTextDeltaEvent = Struct({
|
|
25448
25500
|
type: Literal("response.reasoning_summary_text.delta"),
|
|
25449
25501
|
item_id: String$7,
|
|
25450
|
-
output_index: Int$
|
|
25451
|
-
summary_index: Int$
|
|
25502
|
+
output_index: Int$5,
|
|
25503
|
+
summary_index: Int$5,
|
|
25452
25504
|
delta: String$7,
|
|
25453
|
-
sequence_number: optionalKey(Int$
|
|
25505
|
+
sequence_number: optionalKey(Int$5)
|
|
25454
25506
|
});
|
|
25455
25507
|
const ResponseFunctionCallArgumentsDeltaEvent = Struct({
|
|
25456
25508
|
type: Literal("response.function_call_arguments.delta"),
|
|
25457
25509
|
item_id: String$7,
|
|
25458
|
-
output_index: Int$
|
|
25459
|
-
sequence_number: optionalKey(Int$
|
|
25510
|
+
output_index: Int$5,
|
|
25511
|
+
sequence_number: optionalKey(Int$5),
|
|
25460
25512
|
delta: String$7
|
|
25461
25513
|
});
|
|
25462
25514
|
const ResponseFunctionCallArgumentsDoneEvent = Struct({
|
|
25463
25515
|
type: Literal("response.function_call_arguments.done"),
|
|
25464
25516
|
item_id: String$7,
|
|
25465
|
-
output_index: Int$
|
|
25466
|
-
sequence_number: optionalKey(Int$
|
|
25517
|
+
output_index: Int$5,
|
|
25518
|
+
sequence_number: optionalKey(Int$5),
|
|
25467
25519
|
arguments: String$7
|
|
25468
25520
|
});
|
|
25469
25521
|
const ResponseCodeInterpreterCallCodeDeltaEvent = Struct({
|
|
25470
25522
|
type: Literal("response.code_interpreter_call_code.delta"),
|
|
25471
25523
|
item_id: String$7,
|
|
25472
|
-
output_index: Int$
|
|
25473
|
-
sequence_number: optionalKey(Int$
|
|
25524
|
+
output_index: Int$5,
|
|
25525
|
+
sequence_number: optionalKey(Int$5),
|
|
25474
25526
|
delta: String$7
|
|
25475
25527
|
});
|
|
25476
25528
|
const ResponseCodeInterpreterCallCodeDoneEvent = Struct({
|
|
25477
25529
|
type: Literal("response.code_interpreter_call_code.done"),
|
|
25478
25530
|
item_id: String$7,
|
|
25479
|
-
output_index: Int$
|
|
25480
|
-
sequence_number: optionalKey(Int$
|
|
25531
|
+
output_index: Int$5,
|
|
25532
|
+
sequence_number: optionalKey(Int$5),
|
|
25481
25533
|
code: String$7
|
|
25482
25534
|
});
|
|
25483
25535
|
const ResponseApplyPatchCallOperationDiffDeltaEvent = Struct({
|
|
25484
25536
|
type: Literal("response.apply_patch_call_operation_diff.delta"),
|
|
25485
25537
|
item_id: String$7,
|
|
25486
|
-
output_index: Int$
|
|
25487
|
-
sequence_number: optionalKey(Int$
|
|
25538
|
+
output_index: Int$5,
|
|
25539
|
+
sequence_number: optionalKey(Int$5),
|
|
25488
25540
|
delta: String$7
|
|
25489
25541
|
});
|
|
25490
25542
|
const ResponseApplyPatchCallOperationDiffDoneEvent = Struct({
|
|
25491
25543
|
type: Literal("response.apply_patch_call_operation_diff.done"),
|
|
25492
25544
|
item_id: String$7,
|
|
25493
|
-
output_index: Int$
|
|
25494
|
-
sequence_number: optionalKey(Int$
|
|
25545
|
+
output_index: Int$5,
|
|
25546
|
+
sequence_number: optionalKey(Int$5),
|
|
25495
25547
|
delta: optionalKey(String$7)
|
|
25496
25548
|
});
|
|
25497
25549
|
const ResponseImageGenerationCallPartialImageEvent = Struct({
|
|
25498
25550
|
type: Literal("response.image_generation_call.partial_image"),
|
|
25499
25551
|
item_id: String$7,
|
|
25500
|
-
output_index: Int$
|
|
25501
|
-
sequence_number: optionalKey(Int$
|
|
25552
|
+
output_index: Int$5,
|
|
25553
|
+
sequence_number: optionalKey(Int$5),
|
|
25502
25554
|
partial_image_b64: String$7
|
|
25503
25555
|
});
|
|
25504
25556
|
const ResponseErrorEvent = Struct({
|
|
@@ -25506,8 +25558,8 @@ const ResponseErrorEvent = Struct({
|
|
|
25506
25558
|
code: NullOr(String$7),
|
|
25507
25559
|
message: String$7,
|
|
25508
25560
|
param: NullOr(String$7),
|
|
25509
|
-
sequence_number: optionalKey(Int$
|
|
25510
|
-
status: optionalKey(Int$
|
|
25561
|
+
sequence_number: optionalKey(Int$5),
|
|
25562
|
+
status: optionalKey(Int$5)
|
|
25511
25563
|
});
|
|
25512
25564
|
const NestedResponseErrorEvent = Struct({
|
|
25513
25565
|
type: Literal("error"),
|
|
@@ -25516,8 +25568,8 @@ const NestedResponseErrorEvent = Struct({
|
|
|
25516
25568
|
message: String$7,
|
|
25517
25569
|
param: NullOr(String$7)
|
|
25518
25570
|
}),
|
|
25519
|
-
sequence_number: optionalKey(Int$
|
|
25520
|
-
status: optionalKey(Int$
|
|
25571
|
+
sequence_number: optionalKey(Int$5),
|
|
25572
|
+
status: optionalKey(Int$5)
|
|
25521
25573
|
}).pipe(decodeTo$1(ResponseErrorEvent, transform$3({
|
|
25522
25574
|
decode: ({ error, ...rest }) => ({
|
|
25523
25575
|
...rest,
|
|
@@ -25582,19 +25634,19 @@ const ResponseStreamEvent = Union([
|
|
|
25582
25634
|
]);
|
|
25583
25635
|
const Embedding = Struct({
|
|
25584
25636
|
embedding: Union([ArraySchema(Finite), String$7]),
|
|
25585
|
-
index: Int$
|
|
25637
|
+
index: Int$5,
|
|
25586
25638
|
object: optionalKey(String$7)
|
|
25587
25639
|
});
|
|
25588
25640
|
const CreateEmbeddingRequest = Struct({
|
|
25589
25641
|
input: Union([
|
|
25590
25642
|
String$7,
|
|
25591
25643
|
ArraySchema(String$7),
|
|
25592
|
-
ArraySchema(Int$
|
|
25593
|
-
ArraySchema(ArraySchema(Int$
|
|
25644
|
+
ArraySchema(Int$5),
|
|
25645
|
+
ArraySchema(ArraySchema(Int$5))
|
|
25594
25646
|
]),
|
|
25595
25647
|
model: String$7,
|
|
25596
25648
|
encoding_format: optionalKey(Literals$2(["float", "base64"])),
|
|
25597
|
-
dimensions: optionalKey(Int$
|
|
25649
|
+
dimensions: optionalKey(Int$5),
|
|
25598
25650
|
user: optionalKey(String$7)
|
|
25599
25651
|
});
|
|
25600
25652
|
const CreateEmbeddingResponse = Struct({
|
|
@@ -25602,8 +25654,8 @@ const CreateEmbeddingResponse = Struct({
|
|
|
25602
25654
|
model: String$7,
|
|
25603
25655
|
object: optionalKey(Literal("list")),
|
|
25604
25656
|
usage: optionalKey(Struct({
|
|
25605
|
-
prompt_tokens: Int$
|
|
25606
|
-
total_tokens: Int$
|
|
25657
|
+
prompt_tokens: Int$5,
|
|
25658
|
+
total_tokens: Int$5
|
|
25607
25659
|
}))
|
|
25608
25660
|
});
|
|
25609
25661
|
const DecisionQuestion = Union([
|
|
@@ -25667,7 +25719,7 @@ const DecisionAnswer = Union([
|
|
|
25667
25719
|
name: String$7,
|
|
25668
25720
|
score: Number$2,
|
|
25669
25721
|
probabilities: ArraySchema(Struct({
|
|
25670
|
-
value: Int$
|
|
25722
|
+
value: Int$5,
|
|
25671
25723
|
label: String$7,
|
|
25672
25724
|
probability: Number$2
|
|
25673
25725
|
})),
|
|
@@ -25681,8 +25733,8 @@ const DecisionAnswer = Union([
|
|
|
25681
25733
|
const CreateDecisionsResponse = Struct({
|
|
25682
25734
|
answers: ArraySchema(DecisionAnswer),
|
|
25683
25735
|
usage: optionalKey(Struct({
|
|
25684
|
-
input_tokens: optionalKey(Int$
|
|
25685
|
-
output_tokens: optionalKey(Int$
|
|
25736
|
+
input_tokens: optionalKey(Int$5),
|
|
25737
|
+
output_tokens: optionalKey(Int$5)
|
|
25686
25738
|
}))
|
|
25687
25739
|
});
|
|
25688
25740
|
// node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiClient.js
|
|
@@ -25846,7 +25898,7 @@ const makeSocket = gen(function* () {
|
|
|
25846
25898
|
});
|
|
25847
25899
|
const ErrorEvent = Struct({
|
|
25848
25900
|
type: Literal("error").pipe(withDecodingDefault(succeed$1("error"))),
|
|
25849
|
-
status: optionalKey(Int$
|
|
25901
|
+
status: optionalKey(Int$5),
|
|
25850
25902
|
error: Struct({
|
|
25851
25903
|
type: optional$2(String$7),
|
|
25852
25904
|
code: optional$2(String$7),
|
|
@@ -28174,7 +28226,7 @@ const transformToolCallParams$1 = fnUntraced(function* (options, toolName, toolP
|
|
|
28174
28226
|
return yield* decodeEffect(codec)(toolParams).pipe(flatMap$1((decoded) => encodeUnknownEffect(tool.parametersSchema)(decoded)), orElseSucceed(() => toolParams));
|
|
28175
28227
|
});
|
|
28176
28228
|
// package.json
|
|
28177
|
-
var version$1 = "0.
|
|
28229
|
+
var version$1 = "0.18.0";
|
|
28178
28230
|
// src/ClaudeAgent.ts
|
|
28179
28231
|
const minimumClaudeCodeVersion = "2.1.248";
|
|
28180
28232
|
const serverName = "clanka";
|
|
@@ -28362,6 +28414,7 @@ const makeConverter = () => {
|
|
|
28362
28414
|
switch (event.type) {
|
|
28363
28415
|
case "message_start":
|
|
28364
28416
|
messageId = event.message.id;
|
|
28417
|
+
calledTools = false;
|
|
28365
28418
|
streamed.add(messageId);
|
|
28366
28419
|
usage.update(messageId, event.message.usage);
|
|
28367
28420
|
break;
|
|
@@ -28589,6 +28642,7 @@ const compareVersions = (a, b) => {
|
|
|
28589
28642
|
}
|
|
28590
28643
|
return 0;
|
|
28591
28644
|
};
|
|
28645
|
+
const toolNames = (provider) => provider.tools.map((tool) => tool.name).join(",");
|
|
28592
28646
|
const closeSession = (session) => suspend(() => {
|
|
28593
28647
|
session.bridge.cancel();
|
|
28594
28648
|
session.query.close();
|
|
@@ -28632,7 +28686,7 @@ const startSession = fnUntraced(function* (model, options, provider, withTools)
|
|
|
28632
28686
|
bridge,
|
|
28633
28687
|
messages,
|
|
28634
28688
|
scope,
|
|
28635
|
-
toolNames: provider
|
|
28689
|
+
toolNames: toolNames(provider),
|
|
28636
28690
|
seen: provider.prompt.content,
|
|
28637
28691
|
outcome: void 0
|
|
28638
28692
|
};
|
|
@@ -28671,7 +28725,7 @@ const continuation = (session, provider) => {
|
|
|
28671
28725
|
const messages = provider.prompt.content;
|
|
28672
28726
|
const seen = session.seen;
|
|
28673
28727
|
const response = messages[seen.length];
|
|
28674
|
-
if (outcome === void 0 || session.toolNames !== provider
|
|
28728
|
+
if (outcome === void 0 || session.toolNames !== toolNames(provider) || response?.role !== "assistant" || !seen.every((message, i) => messages[i] === message) || !isDeepStrictEqual(appended(response), emitted(outcome))) return;
|
|
28675
28729
|
const [toolMessages, users] = span(messages.slice(seen.length + 1), (message) => message.role === "tool");
|
|
28676
28730
|
const results = new Map(toolMessages.flatMap((message) => message.content.flatMap((part) => part.type === "tool-result" ? [[part.id, part]] : [])));
|
|
28677
28731
|
const ids = outcome.calls.map((call) => call.id);
|
|
@@ -28682,6 +28736,14 @@ const continuation = (session, provider) => {
|
|
|
28682
28736
|
users
|
|
28683
28737
|
};
|
|
28684
28738
|
};
|
|
28739
|
+
const restartReason = (session, provider) => session === void 0 || session.outcome === void 0 ? "step-abandoned" : session.toolNames !== toolNames(provider) ? "tools-changed" : "history-changed";
|
|
28740
|
+
const reportRestart = (step, reason) => map$11(step, (part) => part.type === "finish" ? {
|
|
28741
|
+
...part,
|
|
28742
|
+
metadata: {
|
|
28743
|
+
...part.metadata,
|
|
28744
|
+
clanka: { historyResent: { reason } }
|
|
28745
|
+
}
|
|
28746
|
+
} : part);
|
|
28685
28747
|
const continueSession = (session, plan) => {
|
|
28686
28748
|
const results = plan.ids.map((id) => toolResult(plan.results.get(id)));
|
|
28687
28749
|
const last = results.at(-1);
|
|
@@ -28697,8 +28759,13 @@ const continueSession = (session, plan) => {
|
|
|
28697
28759
|
if (users.length > 0) offerUnsafe(session.input, userMessage(toUserContent(fromMessages(users)), last === void 0 ? void 0 : "next"));
|
|
28698
28760
|
plan.ids.forEach((id, i) => session.bridge.resolve(id, results[i]));
|
|
28699
28761
|
};
|
|
28700
|
-
const
|
|
28701
|
-
|
|
28762
|
+
const toolResults = (message) => typeof message.message.content === "string" ? [] : message.message.content.flatMap((block) => block.type === "tool_result" ? [{
|
|
28763
|
+
id: block.tool_use_id,
|
|
28764
|
+
isError: block.is_error === true,
|
|
28765
|
+
text: typeof block.content === "string" ? block.content : (block.content ?? []).flatMap((part) => part.type === "text" ? [part.text] : []).join("\n")
|
|
28766
|
+
}] : []);
|
|
28767
|
+
const isToolUseError = (text) => text.trimStart().startsWith("<tool_use_error>");
|
|
28768
|
+
const readStep = (session, onAbandon) => suspend$3(() => {
|
|
28702
28769
|
const convert = makeConverter();
|
|
28703
28770
|
const calls = [];
|
|
28704
28771
|
const parked = new Set();
|
|
@@ -28708,7 +28775,7 @@ const readStep = (session, onAbandon) => suspend$2(() => {
|
|
|
28708
28775
|
if (finish === void 0) return succeed$1([]);
|
|
28709
28776
|
const unknown = [...parked].find((id) => !calls.some((call) => call.id === id));
|
|
28710
28777
|
if (unknown !== void 0) return fail$1(unknownError(`Claude Code called clanka for tool call ${unknown}, which it never made.`));
|
|
28711
|
-
if (!calls.every((call) => parked.has(call.id))) return succeed$1([]);
|
|
28778
|
+
if (calls.length === 0 || !calls.every((call) => parked.has(call.id))) return succeed$1([]);
|
|
28712
28779
|
session.outcome = {
|
|
28713
28780
|
_tag: "Tools",
|
|
28714
28781
|
calls,
|
|
@@ -28723,9 +28790,17 @@ const readStep = (session, onAbandon) => suspend$2(() => {
|
|
|
28723
28790
|
return release();
|
|
28724
28791
|
}
|
|
28725
28792
|
if (event.type === "user" && event.parent_tool_use_id === null) {
|
|
28726
|
-
|
|
28727
|
-
|
|
28793
|
+
let dropped = false;
|
|
28794
|
+
for (const result of toolResults(event)) {
|
|
28795
|
+
const index = calls.findIndex((call) => call.id === result.id);
|
|
28796
|
+
if (index === -1 || parked.has(result.id)) continue;
|
|
28797
|
+
if (!result.isError || !isToolUseError(result.text)) return fail$1(unknownError(`Claude Code answered the tool call ${result.id} itself instead of calling clanka: ${result.text}`));
|
|
28798
|
+
calls.splice(index, 1);
|
|
28799
|
+
dropped = true;
|
|
28800
|
+
}
|
|
28801
|
+
if (dropped) return release();
|
|
28728
28802
|
}
|
|
28803
|
+
if (event.type === "stream_event" && event.parent_tool_use_id === null && event.event.type === "message_start") finish = void 0;
|
|
28729
28804
|
return flatMap$1(convert(event), (parts) => {
|
|
28730
28805
|
const out = [];
|
|
28731
28806
|
for (const part of parts) switch (part.type) {
|
|
@@ -28765,7 +28840,8 @@ const layerLanguageModel = (model, options) => effect(LanguageModel, gen(functio
|
|
|
28765
28840
|
});
|
|
28766
28841
|
yield* addFinalizer(() => closeCurrent);
|
|
28767
28842
|
let reading = false;
|
|
28768
|
-
|
|
28843
|
+
let started = false;
|
|
28844
|
+
const step = (provider) => suspend$3(() => {
|
|
28769
28845
|
if (reading) return fail$6(unknownError("This Claude Agent model is already reading a step. Every agent needs its own model instance."));
|
|
28770
28846
|
reading = true;
|
|
28771
28847
|
return unwrap$6(gen(function* () {
|
|
@@ -28776,9 +28852,12 @@ const layerLanguageModel = (model, options) => effect(LanguageModel, gen(functio
|
|
|
28776
28852
|
current.outcome = void 0;
|
|
28777
28853
|
return readStep(current, closeCurrent);
|
|
28778
28854
|
}
|
|
28855
|
+
const reason = started ? restartReason(current, provider) : void 0;
|
|
28779
28856
|
yield* closeCurrent;
|
|
28780
28857
|
current = yield* startSession(model, options, provider, true);
|
|
28781
|
-
|
|
28858
|
+
started = true;
|
|
28859
|
+
const read = readStep(current, closeCurrent);
|
|
28860
|
+
return reason === void 0 ? read : reportRestart(read, reason);
|
|
28782
28861
|
})).pipe(ensuring$1(sync(() => {
|
|
28783
28862
|
reading = false;
|
|
28784
28863
|
})));
|
|
@@ -28820,7 +28899,10 @@ const toParts = (parts) => {
|
|
|
28820
28899
|
}
|
|
28821
28900
|
return result;
|
|
28822
28901
|
};
|
|
28823
|
-
const model$3 = (model, options) => make$19("claude", model, merge$2(layerLanguageModel(model, options), AgentModelConfig.layer({
|
|
28902
|
+
const model$3 = (model, options) => make$19("claude", model, merge$2(layerLanguageModel(model, options), AgentModelConfig.layer({
|
|
28903
|
+
supportsImages: options?.supportsImages,
|
|
28904
|
+
cutStreamOnSteering: false
|
|
28905
|
+
})));
|
|
28824
28906
|
// src/DeviceCodeHandler.ts
|
|
28825
28907
|
var DeviceCodeHandler = class extends Service()("clanka/DeviceCodeHandler") {};
|
|
28826
28908
|
const layerConsole = succeed$4(DeviceCodeHandler, { onCode: (options) => log(`Open ${options.verifyUrl} and enter code ${options.deviceCode}.`) });
|
|
@@ -29058,14 +29140,11 @@ var CodexAuth = class CodexAuth extends Service()("clanka/CodexAuth") {
|
|
|
29058
29140
|
const layerClient$2 = layer$4({ apiUrl: "https://chatgpt.com/backend-api/codex" }).pipe(provide$3(CodexAuth.layerClient));
|
|
29059
29141
|
const model$2 = (model, options) => make$19("openai", model, layerModel(model, options));
|
|
29060
29142
|
const modelWebSocket$1 = (model, options) => make$19("openai", model, layerModel(model, options).pipe(merge$2(fresh(layerWebSocketMode))));
|
|
29061
|
-
const layerModel = (model, options) => layer$2({
|
|
29143
|
+
const layerModel = (model, options) => suspend$1(() => layer$2({
|
|
29062
29144
|
model,
|
|
29063
29145
|
config: {
|
|
29064
|
-
...omit(options ?? {}, [
|
|
29065
|
-
|
|
29066
|
-
"systemPromptTransform",
|
|
29067
|
-
"supportsImages"
|
|
29068
|
-
]),
|
|
29146
|
+
...omit(options ?? {}, ["reasoning", ...AgentModelConfig.optionKeys]),
|
|
29147
|
+
prompt_cache_key: options?.prompt_cache_key ?? crypto.randomUUID(),
|
|
29069
29148
|
store: false,
|
|
29070
29149
|
reasoning: options?.reasoning === null ? void 0 : {
|
|
29071
29150
|
effort: "medium",
|
|
@@ -29073,9 +29152,9 @@ const layerModel = (model, options) => layer$2({
|
|
|
29073
29152
|
...options?.reasoning
|
|
29074
29153
|
}
|
|
29075
29154
|
}
|
|
29076
|
-
}).pipe(merge$2(AgentModelConfig.layer({
|
|
29077
|
-
|
|
29078
|
-
|
|
29155
|
+
})).pipe(merge$2(AgentModelConfig.layer({
|
|
29156
|
+
...pick(options ?? {}, AgentModelConfig.optionKeys),
|
|
29157
|
+
systemPromptTransform: (system, effect) => withConfigOverride$1(effect, { instructions: system })
|
|
29079
29158
|
})));
|
|
29080
29159
|
// node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/internal/errors.js
|
|
29081
29160
|
const OpenAiErrorBody = Struct({ error: Struct({
|
|
@@ -29294,7 +29373,7 @@ const make$2 = fnUntraced(function* (options) {
|
|
|
29294
29373
|
const layer$1 = (options) => effect(OpenAiClient, make$2(options));
|
|
29295
29374
|
const EmbeddingSchema = Struct({
|
|
29296
29375
|
embedding: Union([ArraySchema(Finite), String$7]),
|
|
29297
|
-
index: Int$
|
|
29376
|
+
index: Int$5,
|
|
29298
29377
|
object: optionalKey(String$7)
|
|
29299
29378
|
});
|
|
29300
29379
|
const CreateEmbeddingResponseSchema = Struct({
|
|
@@ -29302,8 +29381,8 @@ const CreateEmbeddingResponseSchema = Struct({
|
|
|
29302
29381
|
model: String$7,
|
|
29303
29382
|
object: optionalKey(Literal("list")),
|
|
29304
29383
|
usage: optionalKey(Struct({
|
|
29305
|
-
prompt_tokens: Int$
|
|
29306
|
-
total_tokens: Int$
|
|
29384
|
+
prompt_tokens: Int$5,
|
|
29385
|
+
total_tokens: Int$5
|
|
29307
29386
|
}))
|
|
29308
29387
|
});
|
|
29309
29388
|
const ChatCompletionToolFunction = Struct({
|
|
@@ -29316,14 +29395,14 @@ const ChatCompletionToolFunctionDelta = Struct({
|
|
|
29316
29395
|
});
|
|
29317
29396
|
const ChatCompletionToolCall = Struct({
|
|
29318
29397
|
id: optionalKey(String$7),
|
|
29319
|
-
index: optionalKey(Int$
|
|
29398
|
+
index: optionalKey(Int$5),
|
|
29320
29399
|
type: optionalKey(String$7),
|
|
29321
29400
|
extra_content: optionalKey(NullOr(JsonObject$1)),
|
|
29322
29401
|
function: optionalKey(ChatCompletionToolFunction)
|
|
29323
29402
|
});
|
|
29324
29403
|
const ChatCompletionToolCallDelta = Struct({
|
|
29325
29404
|
id: optionalKey(NullOr(String$7)),
|
|
29326
|
-
index: optionalKey(Int$
|
|
29405
|
+
index: optionalKey(Int$5),
|
|
29327
29406
|
type: optionalKey(String$7),
|
|
29328
29407
|
extra_content: optionalKey(NullOr(JsonObject$1)),
|
|
29329
29408
|
function: optionalKey(ChatCompletionToolFunctionDelta)
|
|
@@ -29343,22 +29422,22 @@ const ChatCompletionDelta = Struct({
|
|
|
29343
29422
|
tool_calls: optionalKey(NullOr(ArraySchema(ChatCompletionToolCallDelta)))
|
|
29344
29423
|
});
|
|
29345
29424
|
const ChatCompletionChoice = Struct({
|
|
29346
|
-
index: Int$
|
|
29425
|
+
index: Int$5,
|
|
29347
29426
|
finish_reason: optionalKey(NullOr(String$7)),
|
|
29348
29427
|
message: optionalKey(ChatCompletionMessage),
|
|
29349
29428
|
delta: optionalKey(ChatCompletionDelta)
|
|
29350
29429
|
});
|
|
29351
29430
|
const ChatCompletionUsage = Struct({
|
|
29352
|
-
prompt_tokens: Int$
|
|
29353
|
-
completion_tokens: Int$
|
|
29354
|
-
total_tokens: Int$
|
|
29431
|
+
prompt_tokens: Int$5,
|
|
29432
|
+
completion_tokens: Int$5,
|
|
29433
|
+
total_tokens: Int$5,
|
|
29355
29434
|
prompt_tokens_details: optionalKey(Any),
|
|
29356
29435
|
completion_tokens_details: optionalKey(Any)
|
|
29357
29436
|
});
|
|
29358
29437
|
const ChatCompletionResponse = Struct({
|
|
29359
29438
|
id: String$7,
|
|
29360
29439
|
model: String$7,
|
|
29361
|
-
created: Int$
|
|
29440
|
+
created: Int$5,
|
|
29362
29441
|
choices: ArraySchema(ChatCompletionChoice),
|
|
29363
29442
|
usage: optionalKey(NullOr(ChatCompletionUsage)),
|
|
29364
29443
|
service_tier: optionalKey(String$7)
|
|
@@ -29366,7 +29445,7 @@ const ChatCompletionResponse = Struct({
|
|
|
29366
29445
|
const ChatCompletionChunk = Struct({
|
|
29367
29446
|
id: String$7,
|
|
29368
29447
|
model: String$7,
|
|
29369
|
-
created: Int$
|
|
29448
|
+
created: Int$5,
|
|
29370
29449
|
choices: ArraySchema(ChatCompletionChoice),
|
|
29371
29450
|
usage: optionalKey(NullOr(ChatCompletionUsage)),
|
|
29372
29451
|
service_tier: optionalKey(String$7)
|
|
@@ -30398,15 +30477,8 @@ var GithubCopilotAuth = class GithubCopilotAuth extends Service()("clanka/Github
|
|
|
30398
30477
|
const layerClient$1 = layer$1({ apiUrl: API_URL }).pipe(provide$3(GithubCopilotAuth.layerClient));
|
|
30399
30478
|
const model$1 = (model, options) => make$19("openai", model, mergeAll(layer({
|
|
30400
30479
|
model,
|
|
30401
|
-
config: omit(options ?? {}, options?.reasoning === null ? [
|
|
30402
|
-
|
|
30403
|
-
"systemPromptTransform",
|
|
30404
|
-
"supportsImages"
|
|
30405
|
-
] : ["systemPromptTransform", "supportsImages"])
|
|
30406
|
-
}), AgentModelConfig.layer({
|
|
30407
|
-
systemPromptTransform: options?.systemPromptTransform,
|
|
30408
|
-
supportsImages: options?.supportsImages
|
|
30409
|
-
}), succeed$4(SummarizerTransform, (effect) => withConfigOverride(effect, { max_output_tokens: summarizerMaxOutputTokens }))));
|
|
30480
|
+
config: omit(options ?? {}, options?.reasoning === null ? ["reasoning", ...AgentModelConfig.optionKeys] : AgentModelConfig.optionKeys)
|
|
30481
|
+
}), AgentModelConfig.layer(pick(options ?? {}, AgentModelConfig.optionKeys)), succeed$4(SummarizerTransform, (effect) => withConfigOverride(effect, { max_output_tokens: summarizerMaxOutputTokens }))));
|
|
30410
30482
|
// src/ModelsRepo.ts
|
|
30411
30483
|
const Provider = Literals$2([
|
|
30412
30484
|
"openai",
|
|
@@ -30682,11 +30754,7 @@ const layerClient = layer$4({ apiUrl: "https://api.x.ai/v1" }).pipe(provide$3(Xa
|
|
|
30682
30754
|
const modelWebSocket = (model, options) => make$19("xai", model, mergeAll(layer$2({
|
|
30683
30755
|
model,
|
|
30684
30756
|
config: {
|
|
30685
|
-
...omit(options ?? {}, [
|
|
30686
|
-
"reasoning",
|
|
30687
|
-
"systemPromptTransform",
|
|
30688
|
-
"supportsImages"
|
|
30689
|
-
]),
|
|
30757
|
+
...omit(options ?? {}, ["reasoning", ...AgentModelConfig.optionKeys]),
|
|
30690
30758
|
store: true,
|
|
30691
30759
|
useItemReferences: false,
|
|
30692
30760
|
reasoning: options?.reasoning === null ? void 0 : {
|
|
@@ -30694,26 +30762,27 @@ const modelWebSocket = (model, options) => make$19("xai", model, mergeAll(layer$
|
|
|
30694
30762
|
...options?.reasoning
|
|
30695
30763
|
}
|
|
30696
30764
|
}
|
|
30697
|
-
}), AgentModelConfig.layer({
|
|
30698
|
-
systemPromptTransform: options?.systemPromptTransform,
|
|
30699
|
-
supportsImages: options?.supportsImages
|
|
30700
|
-
}), succeed$4(SummarizerTransform, (effect) => withConfigOverride$1(effect, { max_output_tokens: summarizerMaxOutputTokens })), fresh(layerWebSocketMode)));
|
|
30765
|
+
}), AgentModelConfig.layer(pick(options ?? {}, AgentModelConfig.optionKeys)), succeed$4(SummarizerTransform, (effect) => withConfigOverride$1(effect, { max_output_tokens: summarizerMaxOutputTokens })), fresh(layerWebSocketMode)));
|
|
30701
30766
|
// src/ModelLayer.ts
|
|
30702
|
-
const withSubagentModel = (model) => merge$2(model, layerSubagentModel(model));
|
|
30703
30767
|
const supportsFastMode = (provider) => provider === "openai";
|
|
30704
|
-
const
|
|
30768
|
+
const languageModel = (provider, model, effort, openai, fastMode) => {
|
|
30705
30769
|
const options = effort === void 0 ? void 0 : { reasoning: effort === null ? null : { effort } };
|
|
30706
30770
|
const openaiOptions = fastMode ? {
|
|
30707
30771
|
...options,
|
|
30708
30772
|
service_tier: "priority"
|
|
30709
30773
|
} : options;
|
|
30710
30774
|
switch (provider) {
|
|
30711
|
-
case "openai": return openai.apiKey !== void 0 ?
|
|
30712
|
-
case "xai": return
|
|
30713
|
-
case "claude": return
|
|
30714
|
-
case "copilot": return
|
|
30775
|
+
case "openai": return openai.apiKey !== void 0 ? model$2(model, openaiOptions).pipe(provide$3(layer$4(openai))) : modelWebSocket$1(model, openaiOptions).pipe(provide$3(layerClient$2));
|
|
30776
|
+
case "xai": return modelWebSocket(model, options).pipe(provide$3(layerClient));
|
|
30777
|
+
case "claude": return model$3(model, { effort });
|
|
30778
|
+
case "copilot": return model$1(model, options).pipe(provide$3(layerClient$1));
|
|
30715
30779
|
}
|
|
30716
30780
|
};
|
|
30781
|
+
const make = (provider, model, effort, openai, fastMode = false, auxiliary) => {
|
|
30782
|
+
const fromSpec = (spec) => languageModel(spec.provider, spec.model, spec.effort, openai, fastMode);
|
|
30783
|
+
const main = languageModel(provider, model, effort, openai, fastMode);
|
|
30784
|
+
return mergeAll(main, layerSubagentModel(auxiliary?.subagent === void 0 ? main : fromSpec(auxiliary.subagent)), auxiliary?.summarizer === void 0 ? empty$7 : layerSummarizerModel(fromSpec(auxiliary.summarizer)));
|
|
30785
|
+
};
|
|
30717
30786
|
const isProvider$1 = is(Provider);
|
|
30718
30787
|
const parseAcpModelId = (modelId) => {
|
|
30719
30788
|
const [provider, model, ...rest] = modelId.split(":");
|
|
@@ -30736,7 +30805,7 @@ const resolveEffort = (efforts, thoughtLevel) => {
|
|
|
30736
30805
|
};
|
|
30737
30806
|
const makeAcp = (options) => (modelId, thoughtLevel, fastMode = false) => map$8(parseAcpModelId(modelId), ({ provider, model }) => unwrap$3(map$5(options.models, (catalog) => {
|
|
30738
30807
|
const info = catalog.find((entry) => entry.provider === provider && entry.id === model);
|
|
30739
|
-
return make(provider, model, info === void 0 ? thoughtLevel : resolveEffort(info.efforts, thoughtLevel), options.openai, fastMode);
|
|
30808
|
+
return make(provider, model, info === void 0 ? thoughtLevel : resolveEffort(info.efforts, thoughtLevel), options.openai, fastMode, options.auxiliary);
|
|
30740
30809
|
})));
|
|
30741
30810
|
// node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Logger.js
|
|
30742
30811
|
const LogToStderr = LogToStderr$1;
|
|
@@ -30792,6 +30861,28 @@ const parseModelId = (modelId) => {
|
|
|
30792
30861
|
}) : none();
|
|
30793
30862
|
};
|
|
30794
30863
|
const ModelId = String$7.pipe(check(makeFilter$1((modelId) => isSome(parseModelId(modelId)) || `Invalid model "${modelId}", expected <provider>/<model>[/<effort>] with effort one of ${ThoughtLevel.literals.join(", ")}`)));
|
|
30864
|
+
const auxiliaryModel = (options) => String$1(options.name).pipe(withDescription$1(`${options.description} As <provider>/<model>[/<effort>], e.g. openai/gpt-6-astra/low; also ${options.env}.`), withFallbackConfig(String$4(options.env)), withSchema(ModelId), map$1((modelId) => {
|
|
30865
|
+
const [provider, model, effort] = modelId.split("/");
|
|
30866
|
+
return {
|
|
30867
|
+
provider,
|
|
30868
|
+
model,
|
|
30869
|
+
effort
|
|
30870
|
+
};
|
|
30871
|
+
}), optional);
|
|
30872
|
+
const subagentModel = auxiliaryModel({
|
|
30873
|
+
name: "subagent-model",
|
|
30874
|
+
env: "CLANKA_SUBAGENT_MODEL",
|
|
30875
|
+
description: "Run sub-agents on this model instead of the agent's model."
|
|
30876
|
+
});
|
|
30877
|
+
const summarizerModel = auxiliaryModel({
|
|
30878
|
+
name: "summarizer-model",
|
|
30879
|
+
env: "CLANKA_SUMMARIZER_MODEL",
|
|
30880
|
+
description: "Summarize the history for compaction with this model instead of the agent's model."
|
|
30881
|
+
});
|
|
30882
|
+
const auxiliaryModels = (flags) => ({
|
|
30883
|
+
subagent: getOrUndefined(flags.subagentModel),
|
|
30884
|
+
summarizer: getOrUndefined(flags.summarizerModel)
|
|
30885
|
+
});
|
|
30795
30886
|
const provider = Literals("provider", providers).pipe(withAlias("p"), withFallbackPrompt(Select({
|
|
30796
30887
|
message: "Select a provider",
|
|
30797
30888
|
choices: [
|
|
@@ -30821,6 +30912,18 @@ const fast = Boolean("fast").pipe(withDescription$1("Use OpenAI fast mode (the p
|
|
|
30821
30912
|
const semantic = Directory("search").pipe(withDescription$1("Directory for semantic search data (uses OPENAI_API_KEY env var)"), withAlias("s"), optional);
|
|
30822
30913
|
const prompt = String$1("prompt").pipe(withDescription$1("Pass a prompt in non-interactive mode"), optional);
|
|
30823
30914
|
const compaction = Boolean("compaction").pipe(withDescription$1("Auto-compact the conversation history when it nears the context window. Disable with --no-compaction or CLANKA_COMPACTION=false; the execute output cap stays on."), withFallbackConfig(Boolean$3("CLANKA_COMPACTION").pipe(withDefault$2(true))));
|
|
30915
|
+
const NonNegativeInt = Int$5.pipe(check(isGreaterThanOrEqualTo(0)));
|
|
30916
|
+
const tokens = (options) => Int(options.name).pipe(withDescription$1(`${options.description} Defaults to ${options.env} or ${options.defaultValue}.`), withFallbackConfig(Int$3(options.env).pipe(withDefault$2(options.defaultValue))), withSchema(NonNegativeInt));
|
|
30917
|
+
const compactionThreshold = tokens({
|
|
30918
|
+
name: "compaction-threshold",
|
|
30919
|
+
env: "CLANKA_COMPACTION_THRESHOLD",
|
|
30920
|
+
description: "Compact once the context exceeds this many tokens, or the context window minus its reserve when that is lower.",
|
|
30921
|
+
defaultValue: defaultConfig.thresholdTokens
|
|
30922
|
+
});
|
|
30923
|
+
const compactionConfig = (flags) => CompactionConfig.layer({
|
|
30924
|
+
enabled: flags.compaction,
|
|
30925
|
+
thresholdTokens: flags.compactionThreshold
|
|
30926
|
+
});
|
|
30824
30927
|
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))));
|
|
30825
30928
|
const mcpConfig = String$1("mcp-config").pipe(withDescription$1("An MCP config file in the { \"mcpServers\": { ... } } format. Repeatable; a later file wins."), atLeast(0));
|
|
30826
30929
|
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(", ")}`;
|
|
@@ -30836,7 +30939,7 @@ const Search = (directory) => unwrap$3(gen(function* () {
|
|
|
30836
30939
|
return empty$7;
|
|
30837
30940
|
}
|
|
30838
30941
|
const path = yield* Path$3;
|
|
30839
|
-
return (yield* promise(() => import("./SemanticSearch-
|
|
30942
|
+
return (yield* promise(() => import("./SemanticSearch-CH125AHH.mjs"))).layer({
|
|
30840
30943
|
directory: process.cwd(),
|
|
30841
30944
|
database: path.join(directory, "search.sqlite")
|
|
30842
30945
|
}).pipe(provide$3(model$4("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$4({ apiKey: apiKey.value })));
|
|
@@ -30849,9 +30952,12 @@ const acp = make$27("acp", {
|
|
|
30849
30952
|
trustAllTools,
|
|
30850
30953
|
fast,
|
|
30851
30954
|
compaction,
|
|
30955
|
+
compactionThreshold,
|
|
30956
|
+
subagentModel,
|
|
30957
|
+
summarizerModel,
|
|
30852
30958
|
apiKey,
|
|
30853
30959
|
apiUrl
|
|
30854
|
-
}).pipe(withDescription("Run as an Agent Client Protocol (ACP) server over stdio"), withHandler(({ model, fast, apiKey, apiUrl }) => gen(function* () {
|
|
30960
|
+
}).pipe(withDescription("Run as an Agent Client Protocol (ACP) server over stdio"), withHandler(({ model, fast, apiKey, apiUrl, ...flags }) => gen(function* () {
|
|
30855
30961
|
const repo = yield* ModelsRepo;
|
|
30856
30962
|
const defaultThoughtLevel = yield* reasoning;
|
|
30857
30963
|
return yield* runStdio({
|
|
@@ -30867,10 +30973,11 @@ const acp = make$27("acp", {
|
|
|
30867
30973
|
openai: {
|
|
30868
30974
|
apiKey: getOrUndefined(apiKey),
|
|
30869
30975
|
apiUrl: getOrUndefined(apiUrl)
|
|
30870
|
-
}
|
|
30976
|
+
},
|
|
30977
|
+
auxiliary: auxiliaryModels(flags)
|
|
30871
30978
|
})
|
|
30872
30979
|
});
|
|
30873
|
-
})), provide((
|
|
30980
|
+
})), provide((flags) => mergeAll(ConversationMode.layer(false), succeed$4(LogToStderr, true), layerLog, compactionConfig(flags))));
|
|
30874
30981
|
make$27("clanka", {
|
|
30875
30982
|
provider,
|
|
30876
30983
|
model,
|
|
@@ -30878,18 +30985,21 @@ make$27("clanka", {
|
|
|
30878
30985
|
semantic,
|
|
30879
30986
|
prompt,
|
|
30880
30987
|
compaction,
|
|
30988
|
+
compactionThreshold,
|
|
30989
|
+
subagentModel,
|
|
30990
|
+
summarizerModel,
|
|
30881
30991
|
apiKey,
|
|
30882
30992
|
apiUrl,
|
|
30883
30993
|
mcp,
|
|
30884
30994
|
mcpConfig
|
|
30885
|
-
}).pipe(withHandler(fnUntraced(function* ({ provider, model: modelRaw, fast, semantic, prompt: nonInteractivePrompt, apiKey, apiUrl, mcp, mcpConfig }) {
|
|
30995
|
+
}).pipe(withHandler(fnUntraced(function* ({ provider, model: modelRaw, fast, semantic, prompt: nonInteractivePrompt, apiKey, apiUrl, mcp, mcpConfig, ...flags }) {
|
|
30886
30996
|
const stdio = yield* Stdio;
|
|
30887
30997
|
const mcpServers = yield* load({
|
|
30888
30998
|
cwd: process.cwd(),
|
|
30889
30999
|
files: mcpConfig,
|
|
30890
31000
|
enabled: mcp
|
|
30891
31001
|
});
|
|
30892
|
-
const OutputFormatter = yield* promise(() => import("./OutputFormatter-
|
|
31002
|
+
const OutputFormatter = yield* promise(() => import("./OutputFormatter-Dqxyk2qD.mjs"));
|
|
30893
31003
|
const { model, effort } = yield* match$2(modelRaw, {
|
|
30894
31004
|
onSome: (selected) => {
|
|
30895
31005
|
const [model, effort] = selected.split("/");
|
|
@@ -30903,7 +31013,7 @@ make$27("clanka", {
|
|
|
30903
31013
|
const Model = make(provider, model, effort, {
|
|
30904
31014
|
apiKey: getOrUndefined(apiKey),
|
|
30905
31015
|
apiUrl: getOrUndefined(apiUrl)
|
|
30906
|
-
}, fast);
|
|
31016
|
+
}, fast, auxiliaryModels(flags));
|
|
30907
31017
|
return yield* gen(function* () {
|
|
30908
31018
|
const agent = yield* Agent;
|
|
30909
31019
|
if (isSome(nonInteractivePrompt)) return yield* pipe(agent.send({ prompt: nonInteractivePrompt.value }), unwrap$6, OutputFormatter.pretty(), run$4(stdio.stdout()));
|
|
@@ -30920,7 +31030,7 @@ make$27("clanka", {
|
|
|
30920
31030
|
onNone: () => empty$7,
|
|
30921
31031
|
onSome: Search
|
|
30922
31032
|
})), provideMerge(layer$6(mcpServers))), Model]));
|
|
30923
|
-
})), provide(({ prompt,
|
|
31033
|
+
})), provide(({ prompt, ...flags }) => mergeAll(ConversationMode.layer(isNone(prompt)), compactionConfig(flags))), withSubcommands([acp]), withGlobalFlags([ReportedVersion]), run$1({ version }), provide$1([
|
|
30924
31034
|
layer$9,
|
|
30925
31035
|
ModelsRepo.layerModelsDev().pipe(provideMerge([Kvs, HttpClientLive])),
|
|
30926
31036
|
layerWebSocketConstructor,
|