clanka 0.24.4 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/Agent.js +1 -1
  2. package/dist/Agent.js.map +1 -1
  3. package/dist/AgentCallerConfig.test.js +8 -2
  4. package/dist/AgentCallerConfig.test.js.map +1 -1
  5. package/dist/AgentExecutor.js +1 -1
  6. package/dist/AgentExecutor.js.map +1 -1
  7. package/dist/AgentExecutor.test.js +14 -0
  8. package/dist/AgentExecutor.test.js.map +1 -1
  9. package/dist/AgentTools.d.ts +112 -88
  10. package/dist/AgentTools.d.ts.map +1 -1
  11. package/dist/AgentTools.js +43 -35
  12. package/dist/AgentTools.js.map +1 -1
  13. package/dist/bin/{AiError-fiHIiGOy.mjs → AiError-CsvdOsKR.mjs} +67 -43
  14. package/dist/bin/Latch-B3e9629m.mjs +5 -0
  15. package/dist/bin/{McpClient-CXwyRd_3.mjs → McpClient-BCxZZgnA.mjs} +1 -1
  16. package/dist/bin/{OutputFormatter-B8yF7iiq.mjs → OutputFormatter-ByMjyBhe.mjs} +2 -2
  17. package/dist/bin/{Schema-D629S5yu.mjs → Schema-BfUmMefy.mjs} +224 -163
  18. package/dist/bin/{SemanticSearch-BlcfFvPr.mjs → SemanticSearch-DMzIsoZb.mjs} +68 -55
  19. package/dist/bin/cli.mjs +506 -381
  20. package/dist/bin/{helpers-CljL9OKa.mjs → helpers-Bb68A2Sv.mjs} +2 -2
  21. package/dist/bin/{index.min-ClUfQ5ji.mjs → index.min-CuA3AuA-.mjs} +1448 -1348
  22. package/dist/bin/{rolldown-runtime-5zChB7MF.mjs → rolldown-runtime-CXhmmSW5.mjs} +4 -4
  23. package/dist/bin/{server-HlLriZxF.mjs → server-D4nrvZHH.mjs} +2 -2
  24. package/dist/bin/{turndown.cjs-C2WBxeA-.mjs → turndown.cjs-CwE2EFNQ.mjs} +15 -10
  25. package/dist/bin/{types-LcwjLVkt.mjs → types-N9Z-HYP0.mjs} +1 -1
  26. package/dist/bin/{upgrade-E_f-q2h8.mjs → upgrade-t590zYhO.mjs} +4 -4
  27. package/package.json +15 -15
  28. package/src/Agent.ts +1 -1
  29. package/src/AgentCallerConfig.test.ts +39 -28
  30. package/src/AgentExecutor.test.ts +38 -0
  31. package/src/AgentExecutor.ts +1 -1
  32. package/src/AgentTools.ts +59 -44
  33. package/dist/bin/Latch-D1909CI6.mjs +0 -5
package/dist/bin/cli.mjs CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env -S node --optimize-for-size
2
- import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-5zChB7MF.mjs";
3
- import { $ as URLFromString, $a as timeoutOrElse, $i as interrupt, $n as optionalKey$1, $o as UnknownError, $r as make$40, $s as fail$4, $t as isPattern, A as Null, Aa as request, Ad as constFalse, Ai as effectify, Al as reduce, An as escapeToken, Ao as fromStep, Ar as fromBody, As as mergeAll, At as isGreaterThan, Au as getOrUndefined, B as String$7, Ba as service, Bd as pipeArguments, Bi as fn, Bl as getOrUndefined$2, Bn as Objects, Br as retryAfterDelay, Bs as addFinalizer$1, Bt as isLessThanDate, C as Literal, Ca as orElseSucceed, Cd as isNullish, Ci as catchTag, Cl as isReadonlyArrayNonEmpty, Cr as jsonSchemaAnnotationKeys, Cs as buildWithScope, Ct as isBetweenCodePoints, Cu as flatMapNullishOr, D as Never, Da as provideService, Dd as isTagged, Di as contextWith, Dl as map$7, Dn as fromSchemaDraft07, Dr as redactUrl, Ds as empty$10, Dt as isBetweenSize, Du as getOrElse, E as Natural, Ea as provideContext, Ed as isString, Ei as context, En as errorWithPath, Er as fromInput, Et as isBetweenProperties, Eu as fromUndefinedOr, F as OptionFromOptional, Fd as dual, Fi as failSync, Fl as empty$9, Fn as encodeEffect, Fo as toStep, Fr as fromRecordUnsafe, Fs as succeed$4, Ft as isGreaterThanOrEqualToDate, Fu as none, G as TaggedClass$1, Gi as forkDetach, Gl as try_$1, Gn as decodeTo, Go as Clock, Gr as formatIso, Gs as make$44, Gt as isMaxLength, H as Struct, Ha as sleep, Hi as forEach$1, Hl as isSuccess$1, Hn as Suspend, Hr as setAll, Hs as close, Ht as isLessThanOrEqualToBigInt, I as Record, Ia as runSync, Id as flow, Ii as filterOrFail, Il as headUnsafe, In as Arrays, Io as catchDone, Ir as isRedactedName, Is as succeedContext, It as isIncluding, Iu as orElse$1, J as TaggedUnion, Ja as tap, Ji as fromOption, Jl as format$1, Jn as isJson, Jo as Done, Js as CurrentLogAnnotations, Jt as isMinCodePoints, K as TaggedError$1, Ka as suspend, Ki as forkIn, Kn as defaultParseOptions, Ko as currentTimeMillis, Ks as makeUnsafe$2, Kt as isMaxProperties, Ku as PipeInspectableProto, L as Redacted$4, La as scope, Ld as identity, Li as flatMap$1, Ll as fail$2, Ln as Filter, Lr as merge$3, Ls as suspend$2, Lt as isInt, Lu as orElseSome, M as Number$2, Ma as retry, Md as constUndefined, Mi as exit, Ml as span, Mn as getSubschemaKind, Mo as jittered, Mr as CurrentRedactedNames, Ms as orDie$1, Mt as isGreaterThanDate, Mu as isSome, N as Option, Na as runFork, Nd as constVoid, Ni as fail$1, Nl as assignProperty$1, Nn as decodeEffect$1, No as min, Nr as empty$6, Ns as provide$3, Nt as isGreaterThanOrEqualTo, Nu as map$8, O as NonEmptyArray, Oa as raceFirst, Od as isUndefined, Ol as match$3, On as fromSchemaDraft2020_12, Oo as exponential, Or as setAll$1, Os as fresh, Ot as isEndingWith, Ou as getOrNull, Pa as runForkWith, Pi as failCause, Pl as map$10, Pn as decodeUnknownEffect, Po as spaced, Pr as fromInput$1, Ps as provideMerge, Pt as isGreaterThanOrEqualToBigInt, Pu as match$2, Q as URL$1, Qa as timeoutOption, Qi as ignoreCause, Ql as isFinite, Qn as null_, Qo as TimeoutError, Qr as isRedacted, Qs as doneUnsafe, Qt as isMultipleOf, R as RedactedFromValue, Ra as scoped, Rc as forkUnsafe, Rd as memoize, Ri as flatMapEager, Rl as failVoid, Rn as FilterGroup, Rr as parseRetryAfter$1, Rs as unwrap$4, Rt as isLessThan, Ru as some, S as JsonObject$1, Sa as orDie, Sd as isNull, Si as catchReason, Sl as isCanonicalArrayIndex, Sn as withDecodingDefaultKey, Sr as annotationExcludedKeys, Ss as build, St as isBetweenBigInt, Su as flatMap$2, Ta as provide$1, Td as isObjectKeyword, Ti as catch_, Tl as last$1, Tn as pick, Tr as empty$5, Ts as effectContext, Tt as isBetweenLength, Tu as fromNullishOr, U as StructWithRest, Ua as succeed$1, Ui as forever, Ul as map$6, Un as Union$1, Uo as parse$1, Ur as empty$7, Us as fork, Ut as isLessThanOrEqualToDate, Uu as mapInput, V as StringForLiteralAutocomplete, Va as serviceOption, Vi as fnUntraced, Vl as isFailure$1, Vn as PropertySignature, Vo as Random$1, Vr as set, Vs as addFinalizerExit, Vt as isLessThanOrEqualTo, Vu as String$6, W as Symbol$1, Wa as succeedNone, Wi as forkChild, Wl as succeed$2, Wn as applyToSelfOrLastLinkEncoding, Wo as round, Wr as fromSetCookie, Wt as isMaxCodePoints, Wu as Prototype, X as Tuple, Xc as sync$1, Xi as gen, Xl as hours, Xn as isOptional, Xr as decode$3, Xs as TracerTimingEnabled, Xt as isMinProperties, Y as TrueLiterals, Ya as tapCause, Yi as fromResult, Yl as fromInputUnsafe$1, Yn as isNever, Yo as IllegalArgumentError, Ys as MinimumLogLevel, Yt as isMinLength, Z as TupleWithRest, Za as timeout, Zi as ignore, Zl as infinity, Zn as mapOrSame, Zo as StackTrace, Zr as encode, Zs as _await, Zt as isMinSize, _ as Exit, _a as onError, _c as void_$1, _d as hasProperty, _n as toEncoded$1, _o as equalBatchKeys, _r as transform$4, _s as makeFailReason, _t as encodeUnknownEffect, _u as merge$1, aa as logInfo, ac as makeUnsafe$1, ad as BaseProto, ai as all, al as TaggedError, an as isUnique, ao as updateContext, ar as toEncoded, as as filterInterruptors, at as Void, au as zero, b as Int$5, ba as onInterrupt, bc as LogToStderr$1, bd as isNotNullish, bi as catchIf, bl as isArray, bn as withConstructorDefault, br as InvalidValue$1, bs as reasonAnnotations, bt as is, bu as exists, c as Date$2, ca as map$5, cc as die$1, ci as annotateLogs, cl as has, cn as makeFilter$1, co as void_, cr as Transformation, cs as hasInterrupts, ct as declare, cu as add, da as mapError, dc as findErrorOption$1, di as asVoid, dl as appendAll, dn as optional$2, do as withFiber, dr as transformEffect$1, dt as decodeTo$1, du as getOption, ea as interruptible, ei as value, el as DisablePropagation, en as isPropertyNames, eo as tryPromise, er as replaceChecks, es as annotate$1, et as Uint8Array$2, eu as max, f as DateTimeUtcFromString, fa as match$4, fc as interrupt$1, fi as cached, fl as empty$4, fn as optionalKey, fr as transformOptional$1, fs as isDieReason, ft as decodeUnknownEffect$1, fu as getOrUndefined$1, g as Error$2, ga as never$1, gc as succeed$3, gi as catchCauseIf, gl as findLast, gn as toCodecStringTree, go as zipWith, gr as passthroughSubtype, gs as makeDieReason, gt as encodeTo, gu as makeUnsafe$3, h as DurationFromMillis, ha as matchEffect, hc as isSuccess, hi as catchCause, hl as findFirstIndex, hn as toCodecJson, ho as yieldNow, hr as passthrough, hs as isTimeoutError, ht as encodeEffect$1, hu as make$42, i as Boolean$4, ia as logFatal, ic as make$43, id as setStackTraceLimit, ii as addFinalizer, il as TaggedClass, in as isUUID, io as uninterruptibleMask, ir as string$1, is as fail$5, it as Unknown, iu as toMillis, j as NullOr, ja as result, jd as constTrue, ji as ensuring, jl as sort, jn as parseUriFragment, jo as isSchedule, jr as unwrap$3, js as mock, jt as isGreaterThanBigInt, ju as isNone, k as NonEmptyString$1, ka as repeat, kd as or, ki as die, kl as of, kn as getReferenceKey, ko as forever$1, kr as toString, ks as merge$2, kt as isFinite$1, ku as getOrThrow$1, la as mapBothEager, lc as fail$3, ld as format, li as as, ll as toPredicate, ln as makeFilterGroup, lr as passthrough$1, ls as hasInterruptsOnly, lt as decodeEffect, lu as empty$8, m as Duration, ma as matchCauseEffect, mc as isFailure, mi as callback, ml as findFirst, mn as tag, mo as withSpan$1, ms as isFailReason, mt as decodeUnknownSync, mu as getUnsafe, n as ArraySchema, na as logDebug, nc as isDone, nd as assignProperty, ni as acquireRelease, nl as EncodingError, nn as isSchemaError, no as undefined_, nr as resolveDescription, nt as UndefinedOr, nu as minutes, o as BooleanLiterals, oa as logWarning, oc as succeed$5, od as Class, oi as andThen, ol as taggedEnum, on as link$1, oo as updateService, or as toType$1, os as findErrorOption, ou as Reference, p as Defect, pi as cachedWithTTL, pn as suspend$1, po as withParentSpan, pt as decodeUnknownOption, pu as getOrUndefinedUnsafe, q as TaggedStruct, qa as sync, qi as forkScoped, ql as normalizeNonEmpty, qn as getIndexSignatureKeys, qr as fromDateUnsafe, qs as provide$2, qt as isMaxSize, r as BigInt$2, ra as logError, rc as isDoneUnsafe, rd as getStackTraceLimit, rl as Error$1, rn as isStartingWith, ro as uninterruptible, rr as resolveIdentifier, rs as done, rt as Union, ru as seconds, s as Class$1, sa as makeSpanScoped, sd as NodeInspectSymbol, si as annotateCurrentSpan, sl as compose, sn as make$41, so as useSpan, sr as unknown$1, ss as fromReasons, st as check, su as Service, t as Any, ta as isEffect, tc as into, td as withFiber$1, ti as stringOrRedacted, tl as ParentSpan, tn as isSchema, to as try_, tr as resolveAt, tt as Uint8ArrayFromBase64, tu as millis, ua as mapEager, uc as failCause$1, ud as redact, ui as asSome, ul as Array$1, un as mutable, uo as whileLoop, ur as transform$3, us as interruptors, ut as decodeSync, uu as get$2, v as FalseLiterals, va as onExit, vd as isIterable, vi as catchEager, vl as fromIterable, vn as toJsonSchemaDocument, vr as transformEffect, vs as map$9, vt as fromJsonString, w as Literals$2, wa as promise, wd as isObject$1, wi as catchTags, wl as join$2, wn as omit, wr as CurrentRedactedNames$1, ws as effect, wt as isBetweenDate, x as Json, xa as option$1, xd as isNotUndefined, xl as isArrayNonEmpty, xn as withDecodingDefault, xr as Pointer, xs as squash, xt as isBetween, xu as filter$1, y as Finite, yc as ConsoleRef, yd as isNotNull, yi as catchFilter, yl as headNonEmpty, yn as toType, yo as TaggedClass$2, yr as transformOptional, ys as pretty, yt as instanceOf, yu as all$1, z as SchemaError, zd as pipe, zl as getOrThrow, zn as Literal$1, zo as isDoneCause, zr as remove$1, zs as Scope, zt as isLessThanBigInt, zu as toArray } from "./Schema-D629S5yu.mjs";
4
- import { $t as offerUnsafe, A as catchTags$1, At as takeUntil, B as failCause$3, Bt as unwrap$5, C as make$47, D as catchCause$1, Dt as succeed$6, E as callback$1, Et as splitLines, F as drainFork, Ft as transduce, G as flattenArray, Gt as endUnsafe, H as filterMap, Ht as makeUnsafe$4, I as drop, It as unwrap$6, Jt as failCauseUnsafe, K as flattenIterable, Kt as fail$7, L as empty$11, Lt as fromTransform$1, M as concat$1, Mt as tap$1, N as decodeText, Nt as tapError, Ot as suspend$3, P as die$2, Pt as toAsyncIterable, Qt as offerAllUnsafe, R as ensuring$1, Rt as mapDone, S as isAiErrorReason, St as runForEachArray, T as broadcast, Tt as scoped$1, Ut as bounded, V as filter$2, Vt as make$48, W as flatten, Wt as end, X as fromChannel$1, Xt as offer, Y as fromAsyncIterable, Yt as make$46, Z as fromEffect, Zt as offerAll, _ as ToolkitRequiredError, _n as toLowerCase, _t as run$4, a as InvalidOutputError, at as mapArray, b as buildErrorDescription, bt as runFold, c as InvalidToolResultError, cn as update, ct as mapError$1, d as RateLimitError, dn as interrupt$2, dt as mkString, en as poll, et as fromPull, f as StructuredOutputError, fn as interruptAll, ft as onExit$1, g as ToolResultEncodingError, gn as camelToSnake, gt as provideService$1, h as ToolParameterValidationError, hn as runIn, ht as provideContext$1, i as InternalProviderError, in as unbounded, it as map$11, j as catch_$1, jt as takeWhile, k as catchReason$1, kt as take$1, l as NetworkError, ln as await_, lt as merge$4, m as ToolNotFoundError, mn as join$3, mt as pipeThroughChannel, n as AuthenticationError, nn as sliding, nt as fromReadableStream, o as InvalidRequestError$1, on as make$45, ot as mapArrayEffect, p as ToolConfigurationError, pn as interruptAllAs, pt as orDie$2, q as fromArray, qt as failCause$2, r as HttpResponseDetails$1, rn as take, rt as isStream, s as InvalidResponseError, sn as set$1, st as mapEffect$1, t as AiError, tn as shutdownUnsafe, tt as fromQueue, u as QuotaExhaustedError, un as getCurrent, ut as mergeAll$1, v as UnknownError$1, vt as runCollect, w as reasonFromHttpStatus, wt as runLast, x as isAiError, xt as runForEach, y as UnsupportedSchemaError, yt as runDrain, z as fail$6, zt as toTransform } from "./AiError-fiHIiGOy.mjs";
5
- import { n as makeUnsafe$5 } from "./Latch-D1909CI6.mjs";
6
- import { a as mergeCapabilities, c as safeParse, i as Protocol$1, n as assertToolsCallTaskCapability, o as getLiteralValue, r as AjvJsonSchemaValidator, s as getObjectShape, t as assertClientRequestTaskCapability } from "./helpers-CljL9OKa.mjs";
7
- import { $ as array, B as SUPPORTED_PROTOCOL_VERSIONS, C as LATEST_PROTOCOL_VERSION, D as ListResourcesResultSchema, E as ListResourceTemplatesResultSchema, I as PromptListChangedNotificationSchema, J as isJSONRPCResultResponse, N as McpError, Q as any, R as ReadResourceResultSchema, S as JSONRPCMessageSchema, T as ListPromptsResultSchema, U as ToolListChangedNotificationSchema, W as isInitializedNotification, Z as ZodNumber, at as string$2, b as InitializeResultSchema, c as CreateMessageResultSchema, d as ElicitRequestSchema, et as boolean, f as ElicitResultSchema, h as GetPromptResultSchema, it as object, j as ListToolsResultSchema, l as CreateMessageResultWithToolsSchema, lt as NEVER, m as ErrorCode, n as CallToolResultSchema, nt as looseObject, o as CompleteResultSchema, ot as url, p as EmptyResultSchema, q as isJSONRPCRequest, rt as number$1, s as CreateMessageRequestSchema, st as _coercedNumber, tt as literal, u as CreateTaskResultSchema, w as ListChangedOptionsBaseSchema, z as ResourceListChangedNotificationSchema } from "./types-LcwjLVkt.mjs";
2
+ import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-CXhmmSW5.mjs";
3
+ import { $ as URLFromString, $c as sync$1, $i as ignore, $l as fromInputUnsafe$1, $n as optionalKey$1, $r as stripCrlf, $s as TracerTimingEnabled, $t as isPattern, A as Null, Aa as provideServiceEffect, Ad as isTagged, An as escapeToken, Ar as fromBody, As as empty$10, At as isGreaterThan, Au as fromUndefinedOr, B as String$7, Ba as scope, Bd as identity, Bi as flatMapEager, Bl as headUnsafe, Bn as Objects, Br as retryAfterDelay, Bs as suspend$2, Bt as isLessThanDate, Bu as orElse$1, C as Literal, Ca as option$1, Cc as LogToStderr$1, Cd as isNotNullish, Cl as headNonEmpty, Cr as jsonSchemaAnnotationKeys, Cs as reasonAnnotations, Ct as isBetweenCodePoints, Cu as all$1, D as Never, Da as provide$1, Dd as isObject$1, Di as catch_, Dl as isReadonlyArrayNonEmpty, Dn as fromSchemaDraft07, Dr as redactUrl, Ds as effect, Dt as isBetweenSize, Du as flatMapNullishOr, E as Natural, Ea as promise, Ed as isNullish, Ei as catchTags, El as isCanonicalArrayIndex, En as errorWithPath, Er as fromInput, Es as buildWithScope, Et as isBetweenProperties, Eu as flatMap$2, F as OptionFromOptional, Fa as retry, Fd as constUndefined, Fi as fail$1, Fl as sort, Fn as encodeEffect, Fo as jittered, Fr as fromRecordUnsafe, Fs as orDie$1, Ft as isGreaterThanOrEqualToDate, Fu as isNone, G as TaggedClass$1, Ga as sleep, Gi as forever, Gl as isFailure$1, Gn as decodeTo, Gr as formatIso, Gs as close, Gt as isMaxLength, Gu as String$6, H as Struct, Hd as pipe, Hi as fn, Hl as failVoid, Hn as Suspend, Ho as isDoneCause, Hr as setAll, Hs as Scope, Ht as isLessThanOrEqualToBigInt, Hu as some, I as Record, Ia as runFork, Id as constVoid, Ii as failCause, Il as span, In as Arrays, Io as min, Ir as isRedactedName, Is as provide$3, It as isIncluding, Iu as isSome, J as TaggedUnion, Ji as forkIn, Jl as succeed$2, Jn as isJson, Jo as Clock, Js as make$44, Jt as isMinCodePoints, Ju as Prototype, K as TaggedError$1, Ka as succeed$1, Ki as forkChild, Kl as isSuccess$1, Kn as defaultParseOptions, Ko as parse$1, Ks as fork, Kt as isMaxProperties, L as Redacted$4, La as runForkWith, Li as failSync, Ll as assignProperty$1, Ln as Filter, Lo as spaced, Lr as merge$3, Ls as provideMerge, Lt as isInt, Lu as map$8, M as Number$2, Ma as repeat, Md as or, Mi as effectify, Ml as match$3, Mn as getSubschemaKind, Mo as forever$1, Mr as CurrentRedactedNames$1, Ms as merge$2, Mt as isGreaterThanDate, Mu as getOrNull, N as Option, Na as request, Nd as constFalse, Ni as ensuring, Nl as of, Nn as decodeEffect$1, No as fromStep, Nr as empty$6, Ns as mergeAll, Nt as isGreaterThanOrEqualTo, Nu as getOrThrow$1, O as NonEmptyArray, Oa as provideContext, Od as isObjectKeyword, Oi as context, Ol as join$2, On as fromSchemaDraft2020_12, Or as setAll$1, Os as effectContext, Ot as isEndingWith, Pa as result, Pd as constTrue, Pi as exit, Pl as reduce, Pn as decodeUnknownEffect, Po as isSchedule, Pr as fromInput$1, Ps as mock, Pt as isGreaterThanOrEqualToBigInt, Pu as getOrUndefined, Q as URL$1, Qa as tapCause, Qi as gen, Ql as format$1, Qn as null_, Qo as IllegalArgumentError, Qr as decodeNative, Qs as MinimumLogLevel, Qt as isMultipleOf, R as RedactedFromValue, Rd as dual, Ri as filterOrFail, Rl as map$10, Rn as FilterGroup, Ro as toStep, Rr as parseRetryAfter$1, Rs as succeed$4, Rt as isLessThan, Ru as match$2, S as JsonObject$1, Sa as onInterrupt, Sc as ConsoleRef, Sd as isNotNull, Si as catchIf, Sl as fromIterable, Sn as withDecodingDefaultKey, So as TaggedClass$2, Sr as annotationExcludedKeys, Ss as pretty, St as isBetweenBigInt, Ta as orElseSucceed, Td as isNull, Ti as catchTag, Tl as isArrayNonEmpty, Tn as pick, Tr as empty$5, Ts as build, Tt as isBetweenLength, Tu as filter$1, U as StructWithRest, Ua as service, Ud as pipeArguments, Ui as fnUntraced, Ul as getOrThrow, Un as Union$1, Ur as empty$7, Us as addFinalizer, Ut as isLessThanOrEqualToDate, Uu as toArray, V as StringForLiteralAutocomplete, Va as scoped, Vc as forkUnsafe, Vd as memoize, Vl as fail$2, Vn as PropertySignature, Vr as set, Vs as unwrap$4, Vt as isLessThanOrEqualTo, Vu as orElseSome, W as Symbol$1, Wa as serviceOption, Wi as forEach$1, Wl as getOrUndefined$2, Wn as applyToSelfOrLastLinkEncoding, Wo as Random$1, Wr as fromSetCookie, Ws as addFinalizerExit, Wt as isMaxCodePoints, X as Tuple, Xa as sync, Xi as fromOption, Xn as isOptional, Xr as decode$3, Xs as provide$2, Xt as isMinProperties, Xu as PipeInspectableProto, Y as TrueLiterals, Ya as suspend, Yi as forkScoped, Yl as try_$1, Yn as isNever, Yo as currentTimeMillis, Ys as makeUnsafe$2, Yt as isMinLength, Z as TupleWithRest, Za as tap, Zi as fromResult, Zl as normalizeNonEmpty, Zn as mapOrSame, Zo as Done, Zr as encode, Zs as CurrentLogAnnotations, Zt as isMinSize, _ as Exit, _a as matchEffect, _c as isFailure, _i as catchCause, _n as toEncoded$1, _o as withSpan$1, _r as transform$3, _s as isFailReason, _t as encodeUnknownEffect, _u as getOrUndefinedUnsafe, aa as logError, ac as isDone, ad as withFiber$1, al as ParentSpan, an as isUnique, ao as undefined_, ar as toEncoded, at as Void, au as millis, b as Int$5, ba as onExit, bc as void_$1, bd as hasProperty, bi as catchEager, bl as findLast, bn as withConstructorDefault, bo as equalBatchKeys, br as InvalidValue$1, bs as makeFailReason, bt as is, bu as makeUnsafe$3, c as Date$2, ca as logWarning, cc as makeUnsafe$1, cd as setStackTraceLimit, ci as andThen, cl as TaggedClass, cn as makeFilter$1, co as updateContext, cr as Transformation, cs as filterInterruptors, ct as declare, cu as toMillis, da as mapBothEager, dc as die$1, dd as NodeInspectSymbol, di as as, dl as compose, dn as optional$2, do as void_, dr as transformEffect$1, ds as hasInterrupts, dt as decodeTo$1, du as Service, ea as ignoreCause, ec as _await, ei as isRedacted, en as isPropertyNames, eo as timeout, er as replaceChecks, es as StackTrace, et as Uint8Array$2, eu as hours, f as DateTimeUtcFromString, fa as mapEager, fc as fail$3, fi as asSome, fl as has, fn as optionalKey, fr as transformOptional$1, fs as hasInterruptsOnly, ft as decodeUnknownEffect$1, fu as add, g as Error$2, ga as matchCauseEffect, gi as callback, gl as empty$4, gn as toCodecStringTree, go as withParentSpan, gr as passthroughSubtype, gt as encodeTo, gu as getOrUndefined$1, h as DurationFromMillis, hc as interrupt$1, hi as cachedWithTTL, hl as appendAll, hn as toCodecJson, hr as passthrough, hs as isDieReason, ht as encodeEffect$1, hu as getOption, i as Boolean$4, ia as logDebug, ic as into, ii as acquireRelease, il as DisablePropagation, in as isUUID, io as try_, ir as string$1, it as Unknown, iu as max, j as NullOr, ja as raceFirst, jd as isUndefined, ji as die, jl as map$7, jn as parseUriFragment, jo as exponential, jr as unwrap$3, js as fresh, jt as isGreaterThanBigInt, ju as getOrElse, k as NonEmptyString$1, ka as provideService, kd as isString, ki as contextWith, kl as last$1, kn as getReferenceKey, kr as toString, kt as isFinite$1, ku as fromNullishOr, la as makeSpanScoped, lc as succeed$5, ld as BaseProto, li as annotateCurrentSpan, ll as TaggedError, ln as makeFilterGroup, lo as updateService, lr as passthrough$1, ls as findErrorOption, lt as decodeEffect, lu as zero, m as Duration, ma as match$4, mc as findErrorOption$1, md as redact, mi as cached, ml as Array$1, mn as tag, mo as withFiber, mt as decodeUnknownSync, mu as get$2, n as ArraySchema, na as interruptible, nc as fail$4, ni as value, nn as isSchemaError, no as timeoutOrElse, nr as resolveDescription, ns as UnknownError, nt as UndefinedOr, nu as isFinite, o as BooleanLiterals, oa as logFatal, oc as isDoneUnsafe, od as assignProperty, oi as addFinalizer$1, ol as EncodingError, on as link$1, oo as uninterruptible, or as toType$1, os as done, ou as minutes, p as Defect, pa as mapError, pc as failCause$1, pd as format, pi as asVoid, pl as toPredicate, pn as suspend$1, po as whileLoop, ps as interruptors, pt as decodeUnknownOption, pu as empty$8, q as TaggedStruct, qa as succeedNone, qi as forkDetach, ql as map$6, qn as getIndexSignatureKeys, qo as round, qr as fromDateUnsafe, qt as isMaxSize, qu as mapInput, r as BigInt$2, ra as isEffect, ri as stringOrRedacted, rn as isStartingWith, ro as tryPromise, rr as resolveIdentifier, rs as annotate$1, rt as Union, s as Class$1, sa as logInfo, sc as make$43, sd as getStackTraceLimit, si as all, sl as Error$1, sn as make$41, so as uninterruptibleMask, sr as unknown$1, ss as fail$5, st as check, su as seconds, t as Any, ta as interrupt, tc as doneUnsafe, ti as make$40, tn as isSchema, to as timeoutOption, tr as resolveAt, ts as TimeoutError, tt as Uint8ArrayFromBase64, tu as infinity, ua as map$5, ud as Class, ui as annotateLogs, ul as taggedEnum, un as mutable, uo as useSpan, ur as transform$2, us as fromReasons, ut as decodeSync, uu as Reference, v as FalseLiterals, va as never$1, vc as isSuccess, vi as catchCauseIf, vl as findFirst, vn as toJsonSchemaDocument, vo as yieldNow, vr as transformEffect, vs as isTimeoutError, vt as fromJsonString, vu as getUnsafe, w as Literals$2, wa as orDie, wd as isNotUndefined, wi as catchReason, wl as isArray, wn as omit, wr as CurrentRedactedNames, ws as squash, wt as isBetweenDate, wu as exists, x as Json, xd as isIterable, xi as catchFilter, xn as withDecodingDefault, xr as Pointer, xs as map$9, xt as isBetween, xu as merge$1, y as Finite, ya as onError, yc as succeed$3, yl as findFirstIndex, yn as toType, yo as zipWith, yr as transformOptional, ys as makeDieReason, yt as instanceOf, yu as make$42, z as SchemaError, za as runSync, zd as flow, zi as flatMap$1, zl as empty$9, zn as Literal$1, zo as catchDone, zr as remove$1, zs as succeedContext, zt as isLessThanBigInt, zu as none } from "./Schema-BfUmMefy.mjs";
4
+ import { $t as offerUnsafe, A as catchTags$1, At as takeUntil, B as failCause$3, Bt as unwrap$5, C as make$47, D as catchCause$1, Dt as succeed$6, E as callback$1, Et as splitLines, F as drainFork, Ft as transduce, G as flattenArray, Gt as endUnsafe, H as filterMap, Ht as makeUnsafe$4, I as drop, It as unwrap$6, Jt as failCauseUnsafe, K as flattenIterable, Kt as fail$7, L as empty$11, Lt as fromTransform$1, M as concat$1, Mt as tap$1, N as decodeText, Nt as tapError, Ot as suspend$3, P as die$2, Pt as toAsyncIterable, Qt as offerAllUnsafe, R as ensuring$1, Rt as mapDone, S as isAiErrorReason, St as runForEachArray, T as broadcast, Tt as scoped$1, Ut as bounded, V as filter$2, Vt as make$48, W as flatten, Wt as end, X as fromChannel$1, Xt as offer, Y as fromAsyncIterable, Yt as make$46, Z as fromEffect, Zt as offerAll, _ as ToolkitRequiredError, _n as toLowerCase, _t as run$4, a as InvalidOutputError, at as mapArray, b as buildErrorDescription, bt as runFold, c as InvalidToolResultError, cn as update, ct as mapError$1, d as RateLimitError, dn as interrupt$2, dt as mkString, en as poll, et as fromPull, f as StructuredOutputError, fn as interruptAll, ft as onExit$1, g as ToolResultEncodingError, gn as camelToSnake, gt as provideService$1, h as ToolParameterValidationError, hn as runIn, ht as provideContext$1, i as InternalProviderError, in as unbounded, it as map$11, j as catch_$1, jt as takeWhile, k as catchReason$1, kt as take$1, l as NetworkError, ln as await_, lt as merge$4, m as ToolNotFoundError, mn as join$3, mt as pipeThroughChannel, n as AuthenticationError, nn as sliding, nt as fromReadableStream, o as InvalidRequestError$1, on as make$45, ot as mapArrayEffect, p as ToolConfigurationError, pn as interruptAllAs, pt as orDie$2, q as fromArray, qt as failCause$2, r as HttpResponseDetails$1, rn as take, rt as isStream, s as InvalidResponseError, sn as set$1, st as mapEffect$1, t as AiError, tn as shutdownUnsafe, tt as fromQueue, u as QuotaExhaustedError, un as getCurrent, ut as mergeAll$1, v as UnknownError$1, vt as runCollect, w as reasonFromHttpStatus, wt as runLast, x as isAiError, xt as runForEach, y as UnsupportedSchemaError, yt as runDrain, z as fail$6, zt as toTransform } from "./AiError-CsvdOsKR.mjs";
5
+ import { n as makeUnsafe$5 } from "./Latch-B3e9629m.mjs";
6
+ import { a as mergeCapabilities, c as safeParse, i as Protocol$1, n as assertToolsCallTaskCapability, o as getLiteralValue, r as AjvJsonSchemaValidator, s as getObjectShape, t as assertClientRequestTaskCapability } from "./helpers-Bb68A2Sv.mjs";
7
+ import { $ as array, B as SUPPORTED_PROTOCOL_VERSIONS, C as LATEST_PROTOCOL_VERSION, D as ListResourcesResultSchema, E as ListResourceTemplatesResultSchema, I as PromptListChangedNotificationSchema, J as isJSONRPCResultResponse, N as McpError, Q as any, R as ReadResourceResultSchema, S as JSONRPCMessageSchema, T as ListPromptsResultSchema, U as ToolListChangedNotificationSchema, W as isInitializedNotification, Z as ZodNumber, at as string$2, b as InitializeResultSchema, c as CreateMessageResultSchema, d as ElicitRequestSchema, et as boolean, f as ElicitResultSchema, h as GetPromptResultSchema, it as object, j as ListToolsResultSchema, l as CreateMessageResultWithToolsSchema, lt as NEVER, m as ErrorCode, n as CallToolResultSchema, nt as looseObject, o as CompleteResultSchema, ot as url, p as EmptyResultSchema, q as isJSONRPCRequest, rt as number$1, s as CreateMessageRequestSchema, st as _coercedNumber, tt as literal, u as CreateTaskResultSchema, w as ListChangedOptionsBaseSchema, z as ResourceListChangedNotificationSchema } from "./types-N9Z-HYP0.mjs";
8
8
  import { createRequire } from "node:module";
9
9
  import { PassThrough, Readable, Writable, finished } from "node:stream";
10
- import { StringDecoder } from "node:string_decoder";
11
10
  import * as NodeChildProcess from "node:child_process";
12
11
  import * as Crypto from "node:crypto";
13
12
  import * as NFS from "node:fs";
@@ -20,13 +19,13 @@ import * as NodeVm from "node:vm";
20
19
  import { Worker } from "node:worker_threads";
21
20
  import process$1 from "node:process";
22
21
  import { isDeepStrictEqual } from "node:util";
23
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/BigInt.js
22
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/BigInt.js
24
23
  const BigInt$1 = globalThis.BigInt;
25
24
  const toNumber = (b) => {
26
25
  if (b > BigInt$1(Number.MAX_SAFE_INTEGER) || b < BigInt$1(Number.MIN_SAFE_INTEGER)) return none();
27
26
  return some(Number(b));
28
27
  };
29
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ByteSize.js
28
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ByteSize.js
30
29
  const bigint0 = BigInt(0);
31
30
  const bigint1 = BigInt(1);
32
31
  const decimalBase = BigInt(1e3);
@@ -217,16 +216,24 @@ const fromNumber = (input) => {
217
216
  if (!Number.isSafeInteger(input) || input < 0) return invalid(`expected a non-negative safe integer, received ${input}`);
218
217
  return make$39(BigInt(input));
219
218
  };
219
+ const scaleDecimal = (quantity, factor) => {
220
+ const match = /^(\d+)(?:\.(\d+))?(?:e([+-]\d+))?$/.exec(quantity);
221
+ if (match === null) return void 0;
222
+ const fraction = match[2] ?? "";
223
+ const numerator = BigInt(match[1] + fraction) * factor;
224
+ const shift = Number(match[3] ?? 0) - fraction.length;
225
+ if (shift >= 0) return numerator * BigInt(10) ** BigInt(shift);
226
+ const scale = BigInt(10) ** BigInt(-shift);
227
+ return numerator % scale === bigint0 ? numerator / scale : void 0;
228
+ };
220
229
  const fromStringUnsafe = (input) => {
221
- const match = /^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(input);
230
+ const match = /^\s*(\d+(?:\.\d+)?)\s*([A-Za-z]+)\s*$/.exec(input);
222
231
  if (match === null) return invalid(`unsupported syntax ${JSON.stringify(input)}`);
223
- const unit = unitsByName.get(match[3]);
224
- if (unit === void 0) return invalid(`unsupported unit ${JSON.stringify(match[3])}`);
225
- const fraction = match[2] ?? "";
226
- const scale = BigInt(10) ** BigInt(fraction.length);
227
- const numerator = BigInt(match[1] + fraction) * unit.factor;
228
- if (numerator % scale !== bigint0) return invalid(`${JSON.stringify(input)} does not represent an integral number of bytes`);
229
- return make$39(numerator / scale);
232
+ const unit = unitsByName.get(match[2]);
233
+ if (unit === void 0) return invalid(`unsupported unit ${JSON.stringify(match[2])}`);
234
+ const value = scaleDecimal(match[1], unit.factor);
235
+ if (value === void 0) return invalid(`${JSON.stringify(input)} does not represent an integral number of bytes`);
236
+ return make$39(value);
230
237
  };
231
238
  const fromInputUnsafe = (input) => {
232
239
  switch (typeof input) {
@@ -239,7 +246,7 @@ const fromInputUnsafe = (input) => {
239
246
  return invalid(`unsupported input ${input}`);
240
247
  };
241
248
  const bytes = (value) => typeof value === "bigint" ? fromInputUnsafe(value) : fromNumber(value);
242
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/glob.js
249
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/internal/glob.js
243
250
  const maxExpansions = 1e4;
244
251
  const maxExpandedLength = 2 ** 22;
245
252
  const maxBraceDepth = 64;
@@ -786,7 +793,7 @@ const walk = fnUntraced(function* (fs, compiled, options) {
786
793
  finishing = true;
787
794
  })), _await(failed));
788
795
  });
789
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/PlatformError.js
796
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/PlatformError.js
790
797
  const TypeId$30 = "~effect/PlatformError";
791
798
  var BadArgument = class extends TaggedError("BadArgument") {
792
799
  get message() {
@@ -813,7 +820,7 @@ var PlatformError = class extends TaggedError("PlatformError") {
813
820
  };
814
821
  const systemError = (options) => new PlatformError(new SystemError(options));
815
822
  const badArgument = (options) => new PlatformError(new BadArgument(options));
816
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Sink.js
823
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Sink.js
817
824
  const TypeId$29 = "~effect/Sink";
818
825
  const endVoid = succeed$1([void 0]);
819
826
  const sinkVariance = {
@@ -850,7 +857,7 @@ const last = () => last_;
850
857
  const forEach = (f) => forEachArray(forEach$1((_) => f(_), { discard: true }));
851
858
  const forEachArray = (f) => fromTransform((upstream) => upstream.pipe(flatMap$1(f), forever({ disableYield: true }), catchDone(() => endVoid)));
852
859
  const unwrap$2 = (effect) => fromChannel(unwrap$5(map$5(effect, toChannel)));
853
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/rcRef.js
860
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/internal/rcRef.js
854
861
  const TypeId$28 = "~effect/RcRef";
855
862
  const stateEmpty = { _tag: "Empty" };
856
863
  const stateClosed = { _tag: "Closed" };
@@ -977,11 +984,11 @@ const invalidate$1 = (self_) => {
977
984
  return close(state.scope, void_$1);
978
985
  }));
979
986
  };
980
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/RcRef.js
987
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/RcRef.js
981
988
  const make$36 = make$37;
982
989
  const get = get$1;
983
990
  const invalidate = invalidate$1;
984
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/FileSystem.js
991
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/FileSystem.js
985
992
  const TypeId$27 = "~effect/FileSystem";
986
993
  const FileSystem = Service("effect/FileSystem");
987
994
  const make$35 = (impl) => FileSystem.of({
@@ -1033,7 +1040,7 @@ const make$35 = (impl) => FileSystem.of({
1033
1040
  });
1034
1041
  const FileTypeId = "~effect/FileSystem/File";
1035
1042
  var WatchBackend = class extends Service()("effect/FileSystem/WatchBackend") {};
1036
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Path.js
1043
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Path.js
1037
1044
  const TypeId$26 = "~effect/Path";
1038
1045
  const Path$3 = Service("effect/Path");
1039
1046
  const make$34 = (impl) => Path$3.of({
@@ -1047,9 +1054,9 @@ const make$34 = (impl) => Path$3.of({
1047
1054
  return relative === ".." || relative.startsWith(`..${impl.sep}`) || impl.isAbsolute(relative) ? none() : some(candidate);
1048
1055
  }
1049
1056
  });
1050
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/encoding/Base64Url.js
1057
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/encoding/Base64Url.js
1051
1058
  const decode$2 = (str) => {
1052
- const stripped = str.replace(/[\n\r]/g, "");
1059
+ const stripped = stripCrlf(str);
1053
1060
  const length = stripped.length;
1054
1061
  const padded = stripped.endsWith("=");
1055
1062
  if (padded ? length % 4 !== 0 : length % 4 === 1) return fail$2(new EncodingError({
@@ -1058,15 +1065,18 @@ const decode$2 = (str) => {
1058
1065
  input: stripped,
1059
1066
  message: padded ? `Padded length should be a multiple of 4, but is ${length}` : `Unpadded length should not be 1 more than a multiple of 4, but is ${length}`
1060
1067
  }));
1068
+ const end = !padded ? length : stripped.charCodeAt(length - 2) === 61 ? length - 2 : length - 1;
1069
+ const decodedLength = Math.floor(end * 3 / 4);
1070
+ const native = decodeNative(stripped, decodedLength, nativeDecodeOptions);
1071
+ if (native) return succeed$2(native);
1061
1072
  if (!/^[-_A-Z0-9]*?={0,2}$/i.test(stripped)) return fail$2(new EncodingError({
1062
1073
  module: "Base64Url",
1063
1074
  kind: "Decode",
1064
1075
  input: stripped,
1065
1076
  message: "Invalid input"
1066
1077
  }));
1067
- const end = !padded ? length : stripped.charCodeAt(length - 2) === 61 ? length - 2 : length - 1;
1068
1078
  const fullEnd = end & -4;
1069
- const result = new Uint8Array(Math.floor(end * 3 / 4));
1079
+ const result = new Uint8Array(decodedLength);
1070
1080
  let j = 0;
1071
1081
  for (let i = 0; i < fullEnd; i += 4) {
1072
1082
  const a = codes[stripped.charCodeAt(i)];
@@ -1085,12 +1095,13 @@ const decode$2 = (str) => {
1085
1095
  }
1086
1096
  return succeed$2(result);
1087
1097
  };
1098
+ const nativeDecodeOptions = { alphabet: "base64url" };
1088
1099
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
1089
1100
  const codes = new Uint8Array(128);
1090
1101
  for (let i = 0; i < 64; i++) codes[alphabet.charCodeAt(i)] = i;
1091
1102
  const decodeString = (str) => map$6(decode$2(str), (_) => decoder.decode(_));
1092
- const decoder = new TextDecoder();
1093
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Terminal.js
1103
+ const decoder = new TextDecoder("utf-8", { ignoreBOM: true });
1104
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Terminal.js
1094
1105
  const TypeId$25 = "~effect/Terminal";
1095
1106
  const QuitErrorTypeId = "~effect/Terminal/QuitError";
1096
1107
  var QuitError = class extends Error$2("QuitError")({ _tag: tag("QuitError") }) {
@@ -1102,7 +1113,7 @@ const make$33 = (impl) => Terminal.of({
1102
1113
  ...impl,
1103
1114
  [TypeId$25]: TypeId$25
1104
1115
  });
1105
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/ansi.js
1116
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/ansi.js
1106
1117
  const ESC = "\x1B[";
1107
1118
  const BEL = "\x07";
1108
1119
  const SEP = ";";
@@ -1154,7 +1165,7 @@ const eraseLines = (rows) => {
1154
1165
  if (rows > 0) command += `${ESC}G`;
1155
1166
  return command;
1156
1167
  };
1157
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Prompt.js
1168
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/Prompt.js
1158
1169
  const TypeId$24 = "~effect/cli/Prompt";
1159
1170
  const isPrompt$1 = (u) => hasProperty(u, TypeId$24);
1160
1171
  const defaultTheme = {
@@ -2611,7 +2622,7 @@ const entriesToDisplay = (cursor, total, maxVisible) => {
2611
2622
  endIndex
2612
2623
  };
2613
2624
  };
2614
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpBody.js
2625
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpBody.js
2615
2626
  const TypeId$23 = "~effect/http/HttpBody";
2616
2627
  var Proto$14 = class {
2617
2628
  [TypeId$23];
@@ -2672,7 +2683,7 @@ const text = (body, contentType) => {
2672
2683
  };
2673
2684
  const jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?? "application/json");
2674
2685
  const urlParams = (urlParams, contentType) => text(toString(fromInput(urlParams)), contentType ?? "application/x-www-form-urlencoded");
2675
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpClientError.js
2686
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpClientError.js
2676
2687
  const TypeId$22 = "~effect/http/HttpClientError";
2677
2688
  const isHttpClientError = (u) => hasProperty(u, TypeId$22);
2678
2689
  var HttpClientError = class extends TaggedError("HttpClientError") {
@@ -2696,22 +2707,46 @@ var HttpClientError = class extends TaggedError("HttpClientError") {
2696
2707
  };
2697
2708
  const formatReason = (tag) => tag.endsWith("Error") ? tag.slice(0, -5) : tag;
2698
2709
  const formatMessage = (reason, description, info) => description ? `${reason}: ${description} (${info})` : `${reason} error (${info})`;
2699
- const formatMethodAndUrl = (request) => `${request.method} ${redactUrl(request.url)}`;
2710
+ const responseRedactedNames = new WeakMap();
2711
+ const redactedUrls = new WeakMap();
2712
+ const addRedactedNames = (reason, names) => {
2713
+ const url = redactedUrls.get(reason);
2714
+ if (url !== void 0 && names !== void 0) redactedUrls.set(reason, redactUrl(url, names));
2715
+ };
2716
+ const addResponseRedactedNames = (response, names) => {
2717
+ const existing = responseRedactedNames.get(response);
2718
+ responseRedactedNames.set(response, existing === void 0 ? names : [...existing, ...names]);
2719
+ };
2720
+ const addFailureRedactedNames = (cause, names) => {
2721
+ for (const reason of cause.reasons) if (isFailReason(reason) && isHttpClientError(reason.error)) addRedactedNames(reason.error.reason, names);
2722
+ };
2723
+ const ReasonError = (tag) => {
2724
+ class Base extends TaggedError(tag) {
2725
+ constructor(props) {
2726
+ super(props);
2727
+ redactedUrls.set(this, redactUrl(props.request.url));
2728
+ if (props.response !== void 0) addRedactedNames(this, responseRedactedNames.get(props.response));
2729
+ }
2730
+ }
2731
+ return Base;
2732
+ };
2733
+ const redactedUrl = (reason) => redactUrl(redactedUrls.get(reason) ?? reason.request.url);
2734
+ const formatMethodAndUrl = (reason) => `${reason.request.method} ${redactedUrl(reason)}`;
2700
2735
  const reasonToJSON = (reason, json) => ({
2701
2736
  ...json,
2702
2737
  request: {
2703
2738
  _id: "HttpClientRequest",
2704
2739
  method: reason.request.method,
2705
- url: redactUrl(reason.request.url)
2740
+ url: redactedUrl(reason)
2706
2741
  },
2707
2742
  ..."response" in reason ? { response: {
2708
2743
  _id: "HttpClientResponse",
2709
2744
  status: reason.response.status
2710
2745
  } } : void 0
2711
2746
  });
2712
- var TransportError = class extends TaggedError("TransportError") {
2747
+ var TransportError = class extends ReasonError("TransportError") {
2713
2748
  get methodAndUrl() {
2714
- return formatMethodAndUrl(this.request);
2749
+ return formatMethodAndUrl(this);
2715
2750
  }
2716
2751
  get message() {
2717
2752
  return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);
@@ -2720,9 +2755,9 @@ var TransportError = class extends TaggedError("TransportError") {
2720
2755
  return reasonToJSON(this, super.toJSON());
2721
2756
  }
2722
2757
  };
2723
- var EncodeError = class extends TaggedError("EncodeError") {
2758
+ var EncodeError = class extends ReasonError("EncodeError") {
2724
2759
  get methodAndUrl() {
2725
- return formatMethodAndUrl(this.request);
2760
+ return formatMethodAndUrl(this);
2726
2761
  }
2727
2762
  get message() {
2728
2763
  return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);
@@ -2731,9 +2766,9 @@ var EncodeError = class extends TaggedError("EncodeError") {
2731
2766
  return reasonToJSON(this, super.toJSON());
2732
2767
  }
2733
2768
  };
2734
- var InvalidUrlError = class extends TaggedError("InvalidUrlError") {
2769
+ var InvalidUrlError = class extends ReasonError("InvalidUrlError") {
2735
2770
  get methodAndUrl() {
2736
- return formatMethodAndUrl(this.request);
2771
+ return formatMethodAndUrl(this);
2737
2772
  }
2738
2773
  get message() {
2739
2774
  return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);
@@ -2742,9 +2777,9 @@ var InvalidUrlError = class extends TaggedError("InvalidUrlError") {
2742
2777
  return reasonToJSON(this, super.toJSON());
2743
2778
  }
2744
2779
  };
2745
- var StatusCodeError = class extends TaggedError("StatusCodeError") {
2780
+ var StatusCodeError = class extends ReasonError("StatusCodeError") {
2746
2781
  get methodAndUrl() {
2747
- return formatMethodAndUrl(this.request);
2782
+ return formatMethodAndUrl(this);
2748
2783
  }
2749
2784
  get message() {
2750
2785
  const info = `${this.response.status} ${this.methodAndUrl}`;
@@ -2754,9 +2789,9 @@ var StatusCodeError = class extends TaggedError("StatusCodeError") {
2754
2789
  return reasonToJSON(this, super.toJSON());
2755
2790
  }
2756
2791
  };
2757
- var DecodeError = class extends TaggedError("DecodeError") {
2792
+ var DecodeError = class extends ReasonError("DecodeError") {
2758
2793
  get methodAndUrl() {
2759
- return formatMethodAndUrl(this.request);
2794
+ return formatMethodAndUrl(this);
2760
2795
  }
2761
2796
  get message() {
2762
2797
  const info = `${this.response.status} ${this.methodAndUrl}`;
@@ -2766,9 +2801,9 @@ var DecodeError = class extends TaggedError("DecodeError") {
2766
2801
  return reasonToJSON(this, super.toJSON());
2767
2802
  }
2768
2803
  };
2769
- var EmptyBodyError = class extends TaggedError("EmptyBodyError") {
2804
+ var EmptyBodyError = class extends ReasonError("EmptyBodyError") {
2770
2805
  get methodAndUrl() {
2771
- return formatMethodAndUrl(this.request);
2806
+ return formatMethodAndUrl(this);
2772
2807
  }
2773
2808
  get message() {
2774
2809
  const info = `${this.response.status} ${this.methodAndUrl}`;
@@ -2778,7 +2813,7 @@ var EmptyBodyError = class extends TaggedError("EmptyBodyError") {
2778
2813
  return reasonToJSON(this, super.toJSON());
2779
2814
  }
2780
2815
  };
2781
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpMethod.js
2816
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpMethod.js
2782
2817
  const allShort = [
2783
2818
  ["GET", "get"],
2784
2819
  ["POST", "post"],
@@ -2790,7 +2825,7 @@ const allShort = [
2790
2825
  ["TRACE", "trace"],
2791
2826
  ["QUERY", "query"]
2792
2827
  ];
2793
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/internal/httpBody.js
2828
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/internal/httpBody.js
2794
2829
  const updateHeaders$1 = (headers, body) => {
2795
2830
  if (body._tag === "Empty" || body._tag === "FormData") return remove$1(remove$1(headers, "content-type"), "content-length");
2796
2831
  headers = body.contentType === void 0 ? remove$1(headers, "content-type") : set(headers, "content-type", body.contentType);
@@ -2800,7 +2835,7 @@ const updateContentLength = (headers, body) => {
2800
2835
  const contentLength = body._tag === "Empty" || body._tag === "FormData" ? void 0 : body.contentLength;
2801
2836
  return contentLength === void 0 ? remove$1(headers, "content-length") : set(headers, "content-length", contentLength.toString());
2802
2837
  };
2803
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/Url.js
2838
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/Url.js
2804
2839
  var UrlError = class extends TaggedError("UrlError") {};
2805
2840
  const make$32 = (url, params, hash) => try_$1({
2806
2841
  try: () => {
@@ -2828,7 +2863,7 @@ const fromString = (url, base) => try_$1({
2828
2863
  try: () => new URL(url, base),
2829
2864
  catch: () => new IllegalArgumentError(`Invalid URL: "${url}"${base !== void 0 ? ` with base "${base}"` : ""}`)
2830
2865
  });
2831
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpClientRequest.js
2866
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpClientRequest.js
2832
2867
  const TypeId$21 = "~effect/http/HttpClientRequest";
2833
2868
  const Proto$13 = {
2834
2869
  [TypeId$21]: TypeId$21,
@@ -2915,7 +2950,7 @@ function toUrl(self) {
2915
2950
  if (isSuccess$1(r)) return some(r.success);
2916
2951
  return none();
2917
2952
  }
2918
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpIncomingMessage.js
2953
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpIncomingMessage.js
2919
2954
  const TypeId$20 = "~effect/http/HttpIncomingMessage";
2920
2955
  const schemaBodyJson = (schema, options) => {
2921
2956
  const decode = decodeEffect(toCodecJson(schema));
@@ -2930,10 +2965,10 @@ const inspect = (self, that) => {
2930
2965
  remoteAddress: self.remoteAddress
2931
2966
  };
2932
2967
  };
2933
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/internal/webResponse.js
2968
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/internal/webResponse.js
2934
2969
  const WebSourceSymbol = "~effect/http/HttpClientResponse/WebSource";
2935
2970
  const getWebSource = (self) => self[WebSourceSymbol]?.();
2936
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpClientResponse.js
2971
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpClientResponse.js
2937
2972
  const TypeId$19 = "~effect/http/HttpClientResponse";
2938
2973
  const fromWeb = (request, source) => new WebHttpClientResponse(request, source);
2939
2974
  const filterStatusOk$1 = (self) => self.status >= 200 && self.status < 300 ? succeed$1(self) : fail$1(new HttpClientError({ reason: new StatusCodeError({
@@ -3057,7 +3092,7 @@ var WebHttpClientResponse = class extends Class {
3057
3092
  return pipeArguments(this, arguments);
3058
3093
  }
3059
3094
  };
3060
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpTraceContext.js
3095
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpTraceContext.js
3061
3096
  const toHeaders = (span) => fromRecordUnsafe({
3062
3097
  b3: `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${match$2(span.parent, {
3063
3098
  onNone: () => "",
@@ -3065,7 +3100,7 @@ const toHeaders = (span) => fromRecordUnsafe({
3065
3100
  })}`,
3066
3101
  traceparent: `00-${span.traceId.padStart(32, "0")}-${span.spanId}-${span.sampled ? "01" : "00"}`
3067
3102
  });
3068
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/internal/tracing.js
3103
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/internal/tracing.js
3069
3104
  const defaultPorts = {
3070
3105
  "http:": 80,
3071
3106
  "https:": 443,
@@ -3094,11 +3129,10 @@ const addHeaderAttributes = (span, phase, headers, filter, redactedNames) => {
3094
3129
  span.attribute(`http.${phase}.header.${name}`, isRedactedName(name, redactedNames) ? "<redacted>" : headers[name]);
3095
3130
  }
3096
3131
  };
3097
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/HttpClient.js
3132
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/http/HttpClient.js
3098
3133
  const TypeId$18 = "~effect/http/HttpClient";
3099
3134
  const isHttpClient = (u) => hasProperty(u, TypeId$18);
3100
3135
  const HttpClient = Service("effect/HttpClient");
3101
- const transform$2 = dual(2, (self, f) => makeWith$2(flatMap$1((request) => f(self.postprocess(succeed$1(request)), request)), self.preprocess));
3102
3136
  const transformResponse = dual(2, (self, f) => makeWith$2((request) => f(self.postprocess(request)), self.preprocess));
3103
3137
  const filterStatusOk = transformResponse(flatMap$1(filterStatusOk$1));
3104
3138
  const makeWith$2 = (postprocess, preprocess) => {
@@ -3124,49 +3158,44 @@ const Proto$12 = {
3124
3158
  }]))
3125
3159
  };
3126
3160
  const make$30 = (f) => makeWith$2((effect) => flatMap$1(effect, (request) => withFiber((fiber) => {
3127
- const scopedController = scopedRequests.get(request);
3128
- const controller = scopedController ?? new AbortController();
3161
+ const scope = fiber.getRef(RequestScope);
3162
+ const controller = new AbortController();
3163
+ const urlParamsRedactedNames = fiber.getRef(CurrentRedactedNames);
3129
3164
  const urlResult = make$32(request.url, request.urlParams, getOrUndefined(request.hash));
3130
3165
  if (isFailure$1(urlResult)) return fail$1(new HttpClientError({ reason: new InvalidUrlError({
3131
3166
  request,
3132
3167
  cause: urlResult.failure
3133
3168
  }) }));
3134
3169
  const url = urlResult.success;
3135
- if (fiber.getRef(DisablePropagation) || fiber.getRef(TracerDisabledWhen)(request)) {
3136
- const effect = f(request, url, controller.signal, fiber);
3137
- if (scopedController) return map$5(effect, (response) => trackResponse(response, controller, true));
3138
- return uninterruptibleMask((restore) => matchCauseEffect(restore(effect), {
3139
- onSuccess(response) {
3140
- return succeed$1(trackResponse(response, controller, false));
3141
- },
3142
- onFailure(cause) {
3143
- if (hasInterrupts(cause)) controller.abort();
3144
- return failCause(cause);
3145
- }
3146
- }));
3147
- }
3170
+ const send = (request) => scope === void 0 ? f(request, url, controller.signal, fiber) : flatMap$1(addFinalizer(scope, sync(() => controller.abort())), () => f(request, url, controller.signal, fiber));
3171
+ const exchange = (request, onResponse) => uninterruptibleMask((restore) => matchCauseEffect(restore(send(request)), {
3172
+ onSuccess: (response) => {
3173
+ response = trackResponse(response, controller, scope !== void 0, urlParamsRedactedNames);
3174
+ onResponse?.(response);
3175
+ return succeed$1(response);
3176
+ },
3177
+ onFailure: (cause) => {
3178
+ if (hasInterrupts(cause)) controller.abort();
3179
+ addFailureRedactedNames(cause, urlParamsRedactedNames);
3180
+ return failCause(cause);
3181
+ }
3182
+ }));
3183
+ if (fiber.getRef(DisablePropagation) || fiber.getRef(TracerDisabledWhen)(request)) return exchange(request);
3148
3184
  return useSpan(fiber.getRef(SpanNameGenerator)(request), { kind: "client" }, (span) => {
3149
3185
  span.attribute("http.request.method", request.method);
3150
- const redactedHeaderNames = fiber.getRef(CurrentRedactedNames);
3151
- addUrlAttributes(span, url, redactedNames(request.urlParams, fiber.getRef(CurrentRedactedNames$1)));
3186
+ const redactedHeaderNames = fiber.getRef(CurrentRedactedNames$1);
3187
+ addUrlAttributes(span, url, redactedNames(request.urlParams, urlParamsRedactedNames));
3152
3188
  const headerFilter = fiber.getRef(TracerHeaderFilter);
3153
3189
  addHeaderAttributes(span, "request", request.headers, headerFilter, redactedHeaderNames);
3154
3190
  request = fiber.getRef(TracerPropagationEnabled) ? setHeaders(request, toHeaders(span)) : request;
3155
- return uninterruptibleMask((restore) => restore(f(request, url, controller.signal, fiber)).pipe(withParentSpan(span, { captureStackTrace: false }), matchCauseEffect({
3156
- onSuccess: (response) => {
3157
- span.attribute("http.response.status_code", response.status);
3158
- addHeaderAttributes(span, "response", response.headers, headerFilter, redactedHeaderNames);
3159
- if (response.status >= 400 && response.status < 600) {
3160
- span.attribute("error.type", String(response.status));
3161
- endSpanWithStatusError(fiber, span, request, response);
3162
- }
3163
- return succeed$1(trackResponse(response, controller, scopedController !== void 0));
3164
- },
3165
- onFailure(cause) {
3166
- if (!scopedController && hasInterrupts(cause)) controller.abort();
3167
- return failCause(cause);
3191
+ return withParentSpan(exchange(request, (response) => {
3192
+ span.attribute("http.response.status_code", response.status);
3193
+ addHeaderAttributes(span, "response", response.headers, headerFilter, redactedHeaderNames);
3194
+ if (response.status >= 400 && response.status < 600) {
3195
+ span.attribute("error.type", String(response.status));
3196
+ endSpanWithStatusError(fiber, span, request, response);
3168
3197
  }
3169
- })));
3198
+ }), span, { captureStackTrace: false });
3170
3199
  });
3171
3200
  })), succeed$1);
3172
3201
  const endSpanWithStatusError = (fiber, span, request, response) => {
@@ -3205,11 +3234,7 @@ const parseRetryAfter = (nowMillis, value) => {
3205
3234
  const retryAfter = parseRetryAfter$1(value);
3206
3235
  return isSuccess$1(retryAfter) ? max(retryAfterDelay(retryAfter.success, nowMillis), millis(1)) : void 0;
3207
3236
  };
3208
- const withScope = (self) => transform$2(self, (effect, request) => {
3209
- const controller = new AbortController();
3210
- scopedRequests.set(request, controller);
3211
- return andThen(addFinalizer(() => sync(() => controller.abort())), effect);
3212
- });
3237
+ const withScope = (self) => transformResponse(self, provideServiceEffect(RequestScope, scope));
3213
3238
  const followRedirects = dual((args) => isHttpClient(args[0]), (self, maxRedirects) => makeWith$2((request) => {
3214
3239
  const loop = (request, redirects) => suspend(() => {
3215
3240
  let currentRequest;
@@ -3277,12 +3302,14 @@ const responseRegistry = (() => {
3277
3302
  }
3278
3303
  };
3279
3304
  })();
3280
- const scopedRequests = new WeakMap();
3305
+ const RequestScope = Reference("effect/http/HttpClient/RequestScope", { defaultValue: () => void 0 });
3281
3306
  const responseControllers = new WeakMap();
3282
- const trackResponse = (response, controller, scoped) => {
3307
+ const trackResponse = (response, controller, scoped, urlParamsRedactedNames) => {
3308
+ addResponseRedactedNames(response, urlParamsRedactedNames);
3283
3309
  if (!scoped) {
3284
3310
  responseRegistry.register(response, controller);
3285
3311
  response = new InterruptibleResponse(response, controller);
3312
+ addResponseRedactedNames(response, urlParamsRedactedNames);
3286
3313
  }
3287
3314
  responseControllers.set(response, controller);
3288
3315
  return response;
@@ -3375,11 +3402,11 @@ const withRetryAfter = (schedule) => fromStep(map$5(toStep(schedule), (step) =>
3375
3402
  return map$5(step(now, input), ([output, delay]) => [output, max(delay, retryAfter)]);
3376
3403
  }));
3377
3404
  const isTransientResponse = (response) => response.status === 408 || response.status === 429 || response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504;
3378
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/internal/http.js
3405
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/internal/http.js
3379
3406
  const require$1 = createRequire(typeof __filename === "string" ? __filename : import.meta.url);
3380
3407
  const http = require$1("node:http");
3381
3408
  const https = require$1("node:https");
3382
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/internal/stream.js
3409
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/internal/stream.js
3383
3410
  const destroyStream = (stream, cleanup, onDestroyed) => {
3384
3411
  if (!("closed" in stream)) {
3385
3412
  cleanup();
@@ -3406,7 +3433,7 @@ const destroyStream = (stream, cleanup, onDestroyed) => {
3406
3433
  cleanup();
3407
3434
  if (!stream.closed) stream.destroy();
3408
3435
  };
3409
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeSink.js
3436
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeSink.js
3410
3437
  const fromWritable = (options) => fromChannel(mapDone(fromWritableChannel(options), (_) => [_]));
3411
3438
  const fromWritableChannel = (options) => fromTransform$1((pull) => {
3412
3439
  const writable = options.evaluate();
@@ -3488,7 +3515,7 @@ const pullIntoWritable = (options) => withFiber((fiber) => {
3488
3515
  } else removeErrorListener();
3489
3516
  })));
3490
3517
  });
3491
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeStream.js
3518
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeStream.js
3492
3519
  var MaxBytesError = class extends Error {
3493
3520
  _tag = "MaxBytesError";
3494
3521
  maxBytes;
@@ -3528,8 +3555,9 @@ const toArrayBuffer = (readable, options) => {
3528
3555
  resume(succeed$1(buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)));
3529
3556
  });
3530
3557
  function onData(chunk) {
3531
- buffers.push(chunk);
3532
- bytes += chunk.length;
3558
+ const buffer = typeof chunk === "string" ? Buffer.from(chunk, stream.readableEncoding ?? "utf8") : chunk;
3559
+ buffers.push(buffer);
3560
+ bytes += buffer.byteLength;
3533
3561
  if (maxBytesNumber !== void 0 && bytes > maxBytesNumber) {
3534
3562
  stream.off("data", onData);
3535
3563
  if (options?.destroyOnOverflow === false) drainReadable(stream, cleanup);
@@ -3585,7 +3613,7 @@ const readableToPullUnsafe = (options) => {
3585
3613
  }
3586
3614
  return succeed$1(chunk);
3587
3615
  });
3588
- return as(addFinalizer$1(options.scope, sync(() => {
3616
+ return as(addFinalizer(options.scope, sync(() => {
3589
3617
  readable.off("readable", onReadable);
3590
3618
  if (closeOnDone) destroyStream(readable, cleanup);
3591
3619
  else cleanup();
@@ -3593,7 +3621,7 @@ const readableToPullUnsafe = (options) => {
3593
3621
  };
3594
3622
  const defaultOnError = (error) => new UnknownError(error);
3595
3623
  const toMaxBytes = (maxBytes) => maxBytes === void 0 || maxBytes === Infinity ? void 0 : Number(fromInputUnsafe(maxBytes));
3596
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeHttpIncomingMessage.js
3624
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeHttpIncomingMessage.js
3597
3625
  const textDecoder = new TextDecoder();
3598
3626
  const formDecoder$1 = new TextDecoder("utf-8", { ignoreBOM: true });
3599
3627
  var NodeHttpIncomingMessage = class extends Class {
@@ -3662,7 +3690,7 @@ var NodeHttpIncomingMessage = class extends Class {
3662
3690
  return this.arrayBufferEffect;
3663
3691
  }
3664
3692
  };
3665
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeHttpClient.js
3693
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeHttpClient.js
3666
3694
  function noopErrorHandler(_) {}
3667
3695
  const formDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
3668
3696
  var UndiciResponse = class extends Class {
@@ -3771,7 +3799,7 @@ var UndiciResponse = class extends Class {
3771
3799
  return pipeArguments(this, arguments);
3772
3800
  }
3773
3801
  };
3774
- const loadUpgrade = promise(() => import("./upgrade-E_f-q2h8.mjs"));
3802
+ const loadUpgrade = promise(() => import("./upgrade-t590zYhO.mjs"));
3775
3803
  const takeOver = (conn, head, signal) => {
3776
3804
  if (head !== void 0 && head.length > 0) conn.unshift(head);
3777
3805
  conn.on("error", constVoid);
@@ -3985,7 +4013,7 @@ var NodeHttpResponse = class extends NodeHttpIncomingMessage {
3985
4013
  }
3986
4014
  };
3987
4015
  const layerNodeHttpNoAgent = layerMergedContext(makeNodeHttp);
3988
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Console.js
4016
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Console.js
3989
4017
  const Console = ConsoleRef;
3990
4018
  const consoleWith = (f) => withFiber$1((fiber) => f(fiber.getRef(Console)));
3991
4019
  const error = (...args) => consoleWith((console) => sync$1(() => {
@@ -3994,10 +4022,19 @@ const error = (...args) => consoleWith((console) => sync$1(() => {
3994
4022
  const log = (...args) => consoleWith((console) => sync$1(() => {
3995
4023
  console.log(...args);
3996
4024
  }));
3997
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Runtime.js
4025
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Runtime.js
4026
+ var InterruptExitCode = class extends Service()("effect/Runtime/InterruptExitCode") {};
3998
4027
  const defaultTeardown = (exit, onExit) => {
3999
4028
  if (isSuccess(exit)) return onExit(0);
4000
- if (hasInterruptsOnly(exit.cause)) return onExit(130);
4029
+ if (hasInterruptsOnly(exit.cause)) {
4030
+ let code = -Infinity;
4031
+ for (const reason of exit.cause.reasons) {
4032
+ const annotated = getOrUndefined$1(reasonAnnotations(reason), InterruptExitCode);
4033
+ if (annotated === void 0) return onExit(130);
4034
+ code = Math.max(code, annotated);
4035
+ }
4036
+ return onExit(code);
4037
+ }
4001
4038
  return onExit(getErrorExitCode(squash(exit.cause)));
4002
4039
  };
4003
4040
  const makeRunMain = (f) => dual((args) => isEffect(args[0]), (effect, options) => {
@@ -4036,7 +4073,7 @@ const getErrorReported = (u) => {
4036
4073
  }
4037
4074
  return true;
4038
4075
  };
4039
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Stdio.js
4076
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Stdio.js
4040
4077
  const TypeId$17 = "~effect/Stdio";
4041
4078
  const Stdio = Service(TypeId$17);
4042
4079
  const make$29 = (options) => ({
@@ -4046,7 +4083,7 @@ const make$29 = (options) => ({
4046
4083
  stderrIsTerminal: succeed$1(false),
4047
4084
  ...options
4048
4085
  });
4049
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ConfigProvider.js
4086
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ConfigProvider.js
4050
4087
  function makeValue(value) {
4051
4088
  return {
4052
4089
  _tag: "Value",
@@ -4132,7 +4169,7 @@ function trieNodeAt(root, path) {
4132
4169
  }
4133
4170
  return node;
4134
4171
  }
4135
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Config.js
4172
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Config.js
4136
4173
  const TypeId$16 = "~effect/Config";
4137
4174
  var ConfigError = class {
4138
4175
  _tag = "ConfigError";
@@ -4290,7 +4327,7 @@ function Boolean$3(name) {
4290
4327
  function Redacted$3(name) {
4291
4328
  return schema$1(Redacted$4(String$7), name);
4292
4329
  }
4293
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/TerminalCapabilities.js
4330
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/TerminalCapabilities.js
4294
4331
  const TerminalCapabilities = Reference("effect/cli/TerminalCapabilities", { defaultValue: () => fromProcess() });
4295
4332
  const isPresent = (value) => value !== void 0 && value.length > 0;
4296
4333
  const isForcingColor = (value) => isPresent(value) && value !== "0" && value.toLowerCase() !== "false";
@@ -4316,7 +4353,7 @@ const fromProcess = () => {
4316
4353
  stdoutIsTerminal: process?.stdout?.isTTY === true
4317
4354
  });
4318
4355
  };
4319
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/CliOutput.js
4356
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/CliOutput.js
4320
4357
  const Formatter = Reference("effect/cli/CliOutput", { defaultValue: () => defaultFormatter() });
4321
4358
  const defaultPresenter = { present: fnUntraced(function* (event) {
4322
4359
  const context$3 = yield* context();
@@ -4499,7 +4536,7 @@ const formatHelpDocImpl = (doc, colors, options) => {
4499
4536
  if (sections[sections.length - 1] === "") sections.pop();
4500
4537
  return sections.join("\n");
4501
4538
  };
4502
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/CliError.js
4539
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/CliError.js
4503
4540
  const TypeId$15 = "~effect/cli/CliError";
4504
4541
  const isCliError = (u) => hasProperty(u, TypeId$15);
4505
4542
  const userMessage$2 = "~effect/cli/CliError/userMessage";
@@ -4609,7 +4646,7 @@ var ShowHelp = class extends TaggedError$1(`${TypeId$15}/ShowHelp`)("ShowHelp",
4609
4646
  return "Help requested";
4610
4647
  }
4611
4648
  };
4612
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/encoding/Yaml.js
4649
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/encoding/Yaml.js
4613
4650
  const hasOwn = Object.prototype.hasOwnProperty;
4614
4651
  const setProperty = (record, key, value) => {
4615
4652
  Object.defineProperty(record, key, {
@@ -5143,7 +5180,7 @@ const parse = (input) => {
5143
5180
  });
5144
5181
  return new YamlParser(lines).parse();
5145
5182
  };
5146
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Primitive.js
5183
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/Primitive.js
5147
5184
  const Proto$9 = { ["~effect/cli/Primitive"]: { _A: identity } };
5148
5185
  const isTrueLiteral = is(TrueLiterals);
5149
5186
  const isFalseLiteral = is(FalseLiterals);
@@ -5206,7 +5243,7 @@ const getTypeName = (primitive) => {
5206
5243
  };
5207
5244
  const getChoiceKeys = (primitive) => primitive._tag === "Choice" ? primitive.choiceKeys : void 0;
5208
5245
  const getPathType = (primitive) => primitive._tag === "Path" ? primitive.pathType : void 0;
5209
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Param.js
5246
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/Param.js
5210
5247
  const TypeId$14 = "~effect/cli/Param";
5211
5248
  const argumentKind = "argument";
5212
5249
  const flagKind = "flag";
@@ -5226,6 +5263,7 @@ const makeSingle = (params) => {
5226
5263
  description: params.description ?? none(),
5227
5264
  aliases: params.aliases ?? [],
5228
5265
  hidden: params.hidden ?? false,
5266
+ annotations: params.annotations ?? empty$8(),
5229
5267
  parse
5230
5268
  }, Proto$8);
5231
5269
  };
@@ -5292,7 +5330,7 @@ const map$2 = dual(2, (self, f) => {
5292
5330
  parse
5293
5331
  });
5294
5332
  });
5295
- const transform$1 = (self, f, alternatives = []) => {
5333
+ const transform$1 = (self, f, alternatives = [], fallback) => {
5296
5334
  const alternativeParsers = alternatives.map((alternative) => () => alternative().parse);
5297
5335
  return Object.assign(Object.create(Proto$8), {
5298
5336
  _tag: "Transform",
@@ -5300,6 +5338,7 @@ const transform$1 = (self, f, alternatives = []) => {
5300
5338
  param: self,
5301
5339
  alternatives,
5302
5340
  f,
5341
+ fallback,
5303
5342
  parse: f(self.parse, alternativeParsers)
5304
5343
  });
5305
5344
  };
@@ -5317,11 +5356,14 @@ const optional$1 = (param) => {
5317
5356
  });
5318
5357
  };
5319
5358
  const withDefault$1 = dual(2, (self, defaultValue) => {
5320
- if (!isEffect(defaultValue)) return map$2(optional$1(self), getOrElse(() => defaultValue));
5321
- return mapEffect(optional$1(self), match$2({
5322
- onNone: () => defaultValue,
5323
- onSome: succeed$1
5324
- }));
5359
+ if (!isEffect(defaultValue)) return transform$1(optional$1(self), (parse) => (args) => map$5(parse(args), ([leftover, value]) => [leftover, getOrElse(value, () => defaultValue)]), [], {
5360
+ _tag: "Default",
5361
+ value: defaultValue
5362
+ });
5363
+ return transform$1(optional$1(self), (parse) => (args) => flatMap$1(parse(args), ([leftover, value]) => match$2(value, {
5364
+ onNone: () => map$5(defaultValue, (b) => [leftover, b]),
5365
+ onSome: (a) => succeed$1([leftover, a])
5366
+ })), [], { _tag: "DefaultEffect" });
5325
5367
  });
5326
5368
  const withFallbackConfig$1 = dual(2, (self, config) => {
5327
5369
  const toInvalidValue = (error, configError) => new InvalidValue({
@@ -5334,7 +5376,7 @@ const withFallbackConfig$1 = dual(2, (self, config) => {
5334
5376
  onNone: () => fail$1(error),
5335
5377
  onSome: (value) => succeed$1([args.arguments, value])
5336
5378
  })));
5337
- return transform$1(self, (parse) => (args) => parse(args).pipe(catchTag(["MissingOption", "MissingArgument"], (error) => runConfig(error, args))));
5379
+ return transform$1(self, (parse) => (args) => parse(args).pipe(catchTag(["MissingOption", "MissingArgument"], (error) => runConfig(error, args))), [], { _tag: "Config" });
5338
5380
  });
5339
5381
  const withFallbackPrompt$1 = dual(2, (self, prompt) => {
5340
5382
  const runPrompt = fnUntraced(function* (error, args) {
@@ -5344,7 +5386,7 @@ const withFallbackPrompt$1 = dual(2, (self, prompt) => {
5344
5386
  const value = yield* catchTag(run$3(built), "QuitError", () => fail$1(error));
5345
5387
  return [args.arguments, value];
5346
5388
  });
5347
- return transform$1(self, (parse) => (args) => parse(args).pipe(catchTag(["MissingOption", "MissingArgument"], (error) => runPrompt(error, args))));
5389
+ return transform$1(self, (parse) => (args) => parse(args).pipe(catchTag(["MissingOption", "MissingArgument"], (error) => runPrompt(error, args))), [], { _tag: "Prompt" });
5348
5390
  });
5349
5391
  const variadic = (self, options) => {
5350
5392
  const single = getUnderlyingSingleOrThrow(self);
@@ -5472,7 +5514,7 @@ const transformSingle = (param, f) => {
5472
5514
  return matchParam(param, {
5473
5515
  Single: (single) => f(single),
5474
5516
  Map: (mapped) => map$2(transformSingle(mapped.param, f), mapped.f),
5475
- Transform: (mapped) => transform$1(transformSingle(mapped.param, f), mapped.f, mapped.alternatives.map((alternative) => () => transformSingle(alternative(), f))),
5517
+ Transform: (mapped) => transform$1(transformSingle(mapped.param, f), mapped.f, mapped.alternatives.map((alternative) => () => transformSingle(alternative(), f)), mapped.fallback),
5476
5518
  Optional: (p) => optional$1(transformSingle(p.param, f)),
5477
5519
  Variadic: (p) => variadic(transformSingle(p.param, f), {
5478
5520
  min: getOrUndefined(p.min),
@@ -5496,28 +5538,33 @@ const getUnderlyingSingleOrThrow = (param) => {
5496
5538
  return singles[0];
5497
5539
  };
5498
5540
  const getParamMetadata = (param) => {
5499
- return matchParam(param, {
5500
- Single: () => ({
5501
- isOptional: false,
5502
- isVariadic: false,
5503
- variadicMin: none(),
5504
- variadicMax: none()
5505
- }),
5506
- Map: (mapped) => getParamMetadata(mapped.param),
5507
- Transform: (mapped) => getParamMetadata(mapped.param),
5508
- Optional: (optional) => ({
5509
- ...getParamMetadata(optional.param),
5510
- isOptional: true
5511
- }),
5512
- Variadic: (variadic) => ({
5513
- ...getParamMetadata(variadic.param),
5514
- isVariadic: true,
5515
- variadicMin: variadic.min,
5516
- variadicMax: variadic.max
5517
- })
5518
- });
5541
+ const metadata = collectParamMetadata(param);
5542
+ return {
5543
+ ...metadata,
5544
+ isRequired: !metadata.isOptional && (!metadata.isVariadic || exists(metadata.variadicMin, (min) => min > 0))
5545
+ };
5519
5546
  };
5520
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/config.js
5547
+ const collectParamMetadata = (param) => matchParam(param, {
5548
+ Single: () => ({
5549
+ isOptional: false,
5550
+ isVariadic: false,
5551
+ variadicMin: none(),
5552
+ variadicMax: none()
5553
+ }),
5554
+ Map: (mapped) => collectParamMetadata(mapped.param),
5555
+ Transform: (mapped) => collectParamMetadata(mapped.param),
5556
+ Optional: (optional) => ({
5557
+ ...collectParamMetadata(optional.param),
5558
+ isOptional: true
5559
+ }),
5560
+ Variadic: (variadic) => ({
5561
+ ...collectParamMetadata(variadic.param),
5562
+ isVariadic: true,
5563
+ variadicMin: variadic.min,
5564
+ variadicMax: variadic.max
5565
+ })
5566
+ });
5567
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/config.js
5521
5568
  const ConfigInternalTypeId = "~effect/cli/Command/Config/Internal";
5522
5569
  const parseConfig = (config) => {
5523
5570
  const orderedParams = [];
@@ -5568,7 +5615,7 @@ const reconstructTree = (tree, results) => {
5568
5615
  }
5569
5616
  }
5570
5617
  };
5571
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/command.js
5618
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/command.js
5572
5619
  const TypeId$13 = "~effect/cli/Command";
5573
5620
  const toImpl = (self) => self;
5574
5621
  const Proto$7 = { ...Prototype({
@@ -5601,7 +5648,7 @@ const makeCommand = (options) => {
5601
5648
  name: single.name,
5602
5649
  type: single.typeName ?? getTypeName(single.primitiveType),
5603
5650
  description: single.description,
5604
- required: !metadata.isOptional && (!metadata.isVariadic || exists(metadata.variadicMin, (min) => min > 0)),
5651
+ required: metadata.isRequired,
5605
5652
  variadic: metadata.isVariadic
5606
5653
  });
5607
5654
  }
@@ -5730,7 +5777,7 @@ const checkForDuplicateFlags = (parent, subcommands, options) => {
5730
5777
  }
5731
5778
  }
5732
5779
  };
5733
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/completions/descriptor.js
5780
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/completions/descriptor.js
5734
5781
  const toFlagType = (single) => {
5735
5782
  switch (single.primitiveType._tag) {
5736
5783
  case "Boolean": return { _tag: "Boolean" };
@@ -5776,27 +5823,34 @@ const toArgumentType = (single) => {
5776
5823
  default: return { _tag: "String" };
5777
5824
  }
5778
5825
  };
5826
+ const repeatableSingles = (param, repeatable) => {
5827
+ const p = param;
5828
+ switch (p._tag) {
5829
+ case "Single": return [[p, repeatable === true]];
5830
+ case "Map":
5831
+ case "Optional": return repeatableSingles(p.param, repeatable);
5832
+ case "Transform": return [...repeatableSingles(p.param, repeatable), ...p.alternatives.flatMap((alternative) => repeatableSingles(alternative(), repeatable))];
5833
+ case "Variadic": return repeatableSingles(p.param, repeatable ?? !exists(p.max, (max) => max <= 1));
5834
+ }
5835
+ };
5779
5836
  const fromCommand$1 = (cmd, inheritedFlags = []) => {
5780
5837
  const impl = toImpl(cmd);
5781
5838
  const config = impl.config;
5782
5839
  const flags = [];
5783
5840
  const seen = new Set();
5784
- for (const [index, flag] of [...config.flags, ...inheritedFlags].entries()) {
5785
- const singles = extractSingleParams(flag);
5786
- for (const single of singles) {
5787
- if (single.kind !== "flag") continue;
5788
- if (single.hidden) continue;
5789
- if (index >= config.flags.length && seen.has(single.name)) continue;
5790
- seen.add(single.name);
5791
- flags.push({
5792
- name: single.name,
5793
- aliases: single.aliases,
5794
- description: getOrUndefined(single.description),
5795
- type: toFlagType(single),
5796
- optionalValue: single.optionalValue !== void 0,
5797
- negation: single.negation
5798
- });
5799
- }
5841
+ for (const [index, flag] of [...config.flags, ...inheritedFlags].entries()) for (const [single, repeatable] of repeatableSingles(flag)) {
5842
+ if (single.hidden) continue;
5843
+ if (index >= config.flags.length && seen.has(single.name)) continue;
5844
+ seen.add(single.name);
5845
+ flags.push({
5846
+ name: single.name,
5847
+ aliases: single.aliases,
5848
+ description: getOrUndefined(single.description),
5849
+ type: toFlagType(single),
5850
+ optionalValue: single.optionalValue !== void 0,
5851
+ repeatable,
5852
+ negation: single.negation
5853
+ });
5800
5854
  }
5801
5855
  const args = [];
5802
5856
  for (const arg of config.arguments) {
@@ -5807,7 +5861,7 @@ const fromCommand$1 = (cmd, inheritedFlags = []) => {
5807
5861
  args.push({
5808
5862
  name: single.name,
5809
5863
  description: getOrUndefined(single.description),
5810
- required: !metadata.isOptional,
5864
+ required: !metadata.isOptional && (!metadata.isVariadic || exists(metadata.variadicMin, (min) => min > 0)),
5811
5865
  variadic: metadata.isVariadic,
5812
5866
  type: toArgumentType(single)
5813
5867
  });
@@ -5834,7 +5888,7 @@ const fromCommand$1 = (cmd, inheritedFlags = []) => {
5834
5888
  };
5835
5889
  const takesSeparateValue = (flag) => flag.type._tag !== "Boolean" && flag.optionalValue !== true;
5836
5890
  const negatedName$1 = (flag) => flag.type._tag !== "Boolean" || flag.negation === false ? void 0 : flag.negation ?? `no-${flag.name}`;
5837
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/completions/bash.js
5891
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/completions/bash.js
5838
5892
  const escapeForBash = (s) => s.replace(/'/g, "'\\''");
5839
5893
  const sanitizeFunctionName = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
5840
5894
  const flagNamesForWordlist = (flag) => {
@@ -5857,7 +5911,8 @@ const buildFlagGroupDeclarations = (flags, lines) => {
5857
5911
  lines.push(` done`);
5858
5912
  lines.push(` local _filtered_flags=""`);
5859
5913
  groups.forEach((forms, index) => {
5860
- lines.push(` [[ -n "$_used_${index}" ]] || _filtered_flags+=" ${forms.join(" ")}"`);
5914
+ const guard = flags[index].repeatable === true ? "" : `[[ -n "$_used_${index}" ]] || `;
5915
+ lines.push(` ${guard}_filtered_flags+=" ${forms.join(" ")}"`);
5861
5916
  });
5862
5917
  lines.push(``);
5863
5918
  };
@@ -5958,12 +6013,10 @@ const pathsHelper = (helpers, lines) => {
5958
6013
  lines.push(`}`);
5959
6014
  lines.push(``);
5960
6015
  };
6016
+ const choicesCompletion = (values, helpers) => `${helpers.choices} "$cur" "$_comp_word" ${values.map((value) => `'${escapeForBash(value)}'`).join(" ")}`;
5961
6017
  const valueCompletion = (type, helpers) => {
5962
6018
  switch (type._tag) {
5963
- case "Choice": {
5964
- const values = type.values.map((value) => `'${escapeForBash(value)}'`).join(" ");
5965
- return `${helpers.choices} "$cur" "$_comp_word" ${values}`;
5966
- }
6019
+ case "Choice": return choicesCompletion(type.values, helpers);
5967
6020
  case "Path": return `${helpers.paths} ${type.pathType === "directory" ? "-d" : "-f"} "$cur" "$_comp_word"`;
5968
6021
  default: return;
5969
6022
  }
@@ -6081,10 +6134,7 @@ const generateFunction$1 = (descriptor, parentPath, lines, helpers) => {
6081
6134
  lines.push(` return`);
6082
6135
  lines.push(` fi`);
6083
6136
  }
6084
- } else if (descriptor.subcommands.length > 0) {
6085
- const subNames = descriptor.subcommands.map((s) => s.name);
6086
- lines.push(` COMPREPLY=( $(compgen -W '${subNames.join(" ")}' -- "$cur") )`);
6087
- }
6137
+ } else if (descriptor.subcommands.length > 0) lines.push(` ${choicesCompletion(descriptor.subcommands.map((s) => s.name), helpers)}`);
6088
6138
  lines.push(`}`);
6089
6139
  lines.push(``);
6090
6140
  for (const sub of descriptor.subcommands) generateFunction$1(sub, currentPath, lines, helpers);
@@ -6137,7 +6187,7 @@ const generate$4 = (executableName, descriptor) => {
6137
6187
  lines.push(`###-end-${escapeForBash(executableName)}-completions-###`);
6138
6188
  return lines.join("\n");
6139
6189
  };
6140
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/completions/fish.js
6190
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/completions/fish.js
6141
6191
  const escapeFishString = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
6142
6192
  const escapeFishChoice = (s) => escapeFishString(s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&"));
6143
6193
  const subcommandCondition = (parentPath, childSubcommandNames) => {
@@ -6207,8 +6257,7 @@ const generateCompletions = (executableName, descriptor, parentPath, lines) => {
6207
6257
  lines.push(parts.join(" "));
6208
6258
  }
6209
6259
  for (const flag of descriptor.flags) {
6210
- const dedup = takesSeparateValue(flag) ? valueFlagDedupCondition(flag) : flagContainsOptCondition(flag);
6211
- const flagCondition = condition ? `${condition}; and ${dedup}` : dedup;
6260
+ const flagCondition = [condition, flag.repeatable === true ? "" : takesSeparateValue(flag) ? valueFlagDedupCondition(flag) : flagContainsOptCondition(flag)].filter((part) => part !== "").join("; and ");
6212
6261
  const flagCondArg = flagCondition ? `-n '${flagCondition}'` : ``;
6213
6262
  const parts = [`complete -c ${executableName}`];
6214
6263
  if (flagCondArg) parts.push(flagCondArg);
@@ -6227,7 +6276,7 @@ const generateCompletions = (executableName, descriptor, parentPath, lines) => {
6227
6276
  const notDash = `not string match -q -- "-*" (commandline -ct)`;
6228
6277
  const bareBase = condition ? `${condition}; and ${notDash}` : notDash;
6229
6278
  for (const flag of descriptor.flags) {
6230
- const bareCondition = `${bareBase}; and ${flagContainsOptCondition(flag)}`;
6279
+ const bareCondition = flag.repeatable === true ? bareBase : `${bareBase}; and ${flagContainsOptCondition(flag)}`;
6231
6280
  const negation = negatedName$1(flag);
6232
6281
  const parts = [`complete -c ${executableName}`];
6233
6282
  parts.push(`-n '${bareCondition}'`);
@@ -6270,7 +6319,7 @@ const generate$3 = (executableName, descriptor) => {
6270
6319
  lines.push(`###-end-${executableName}-completions-###`);
6271
6320
  return lines.join("\n");
6272
6321
  };
6273
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/completions/powershell.js
6322
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/completions/powershell.js
6274
6323
  const quotePs = (s) => {
6275
6324
  const parts = [];
6276
6325
  let literal = "";
@@ -6294,7 +6343,7 @@ const flagForms = (flag) => [`--${flag.name}`, ...flag.aliases.map((alias) => al
6294
6343
  const valueFields = (type) => `values = ${psArray(type._tag === "Choice" ? type.values : [])}; pathType = ${type._tag === "Path" ? quotePs(type.pathType) : "$null"}`;
6295
6344
  const flagEntry = (flag) => {
6296
6345
  const negation = negatedName$1(flag);
6297
- return `@{ name = ${quotePs(flag.name)}; forms = ${psArray(flagForms(flag))}; takesValue = $${flag.type._tag !== "Boolean"}; ` + (negation === void 0 ? "" : `negation = ${quotePs(`--${negation}`)}; `) + (flag.optionalValue === true ? `optionalValue = $true; ` : "") + `${valueFields(flag.type)}; description = ${psOptional(flag.description)} }`;
6346
+ return `@{ name = ${quotePs(flag.name)}; forms = ${psArray(flagForms(flag))}; takesValue = $${flag.type._tag !== "Boolean"}; ` + (negation === void 0 ? "" : `negation = ${quotePs(`--${negation}`)}; `) + (flag.optionalValue === true ? `optionalValue = $true; ` : "") + (flag.repeatable === true ? `repeatable = $true; ` : "") + `${valueFields(flag.type)}; description = ${psOptional(flag.description)} }`;
6298
6347
  };
6299
6348
  const argumentEntry = (argument) => `@{ name = ${quotePs(argument.name)}; variadic = $${argument.variadic}; ${valueFields(argument.type)}; description = ${psOptional(argument.description)} }`;
6300
6349
  const pushList = (lines, field, entries) => {
@@ -6361,7 +6410,7 @@ const completer = (dataName) => String.raw` param($wordToComplete, $commandAst,
6361
6410
  $addFlags = {
6362
6411
  param([string]$typed)
6363
6412
  foreach ($flag in $context.flags) {
6364
- if ($used.ContainsKey($flag.name)) { continue }
6413
+ if (-not $flag.repeatable -and $used.ContainsKey($flag.name)) { continue }
6365
6414
  foreach ($form in $flag.forms) {
6366
6415
  & $add $form 'ParameterName' $flag.description $typed ''
6367
6416
  }
@@ -6530,7 +6579,7 @@ const generate$2 = (executableName, descriptor) => {
6530
6579
  lines.push(`###-end-${executableName}-completions-###`);
6531
6580
  return lines.join("\n");
6532
6581
  };
6533
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/completions/zsh.js
6582
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/completions/zsh.js
6534
6583
  const escapeZsh = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "'\\''").replace(/:/g, "\\:");
6535
6584
  const escapeZshExplanation = (s) => escapeZsh(s).replace(/]/g, "\\]");
6536
6585
  const escapeZshChoice = (s) => s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&").replace(/'/g, "'\\''");
@@ -6566,7 +6615,7 @@ const flagSpecs = (flag) => {
6566
6615
  const optional = flag.optionalValue === true && flag.type._tag !== "Boolean";
6567
6616
  const valueSuffix = optional ? "=-" : "";
6568
6617
  const action = optional ? `:${valueAction(flag.type)}` : valueAction(flag.type);
6569
- const excl = `(${allForms(flag).join(" ")})`;
6618
+ const excl = flag.repeatable === true ? "*" : `(${allForms(flag).join(" ")})`;
6570
6619
  specs.push(`'${excl}--${flag.name}${valueSuffix}${desc}${action}'`);
6571
6620
  for (const alias of flag.aliases) {
6572
6621
  const prefix = alias.length === 1 ? "-" : "--";
@@ -6596,7 +6645,7 @@ const generateFunction = (descriptor, parentPath, lines) => {
6596
6645
  lines.push(` commands=(`);
6597
6646
  for (const sub of descriptor.subcommands) {
6598
6647
  const desc = sub.description ? escapeZsh(sub.description) : "";
6599
- lines.push(` '${sub.name}:${desc}'`);
6648
+ lines.push(` '${escapeZsh(sub.name)}:${desc}'`);
6600
6649
  }
6601
6650
  lines.push(` )`);
6602
6651
  lines.push(``);
@@ -6670,7 +6719,7 @@ const generate$1 = (executableName, descriptor) => {
6670
6719
  lines.push(`###-end-${executableName}-completions-###`);
6671
6720
  return lines.join("\n");
6672
6721
  };
6673
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Completions.js
6722
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/Completions.js
6674
6723
  const fromCommand = (command) => fromCommand$1(command);
6675
6724
  const generate = (executableName, shell, descriptor) => {
6676
6725
  switch (shell) {
@@ -6680,7 +6729,7 @@ const generate = (executableName, shell, descriptor) => {
6680
6729
  case "powershell": return generate$2(executableName, descriptor);
6681
6730
  }
6682
6731
  };
6683
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Flag.js
6732
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/Flag.js
6684
6733
  const String$1 = (name) => String$2(flagKind, name);
6685
6734
  const Boolean = (name) => Boolean$1(flagKind, name);
6686
6735
  const Int = (name) => Int$1(flagKind, name);
@@ -6698,7 +6747,7 @@ const withFallbackPrompt = dual(2, (self, prompt) => withFallbackPrompt$1(self,
6698
6747
  const map$1 = dual(2, (self, f) => map$2(self, f));
6699
6748
  const atLeast = dual(2, (self, min) => atLeast$1(self, min));
6700
6749
  const withSchema = dual(2, (self, schema) => withSchema$1(self, schema));
6701
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/help.js
6750
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/help.js
6702
6751
  const dedupeGlobalFlags = (flags) => {
6703
6752
  const seen = new Set();
6704
6753
  const deduped = [];
@@ -6790,7 +6839,7 @@ const getHelpForCommandPath = (command, commandPath, builtIns) => gen(function*
6790
6839
  commandPath
6791
6840
  };
6792
6841
  });
6793
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/GlobalFlag.js
6842
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/GlobalFlag.js
6794
6843
  const Action = (options) => ({
6795
6844
  _tag: "Action",
6796
6845
  flag: options.flag,
@@ -6866,12 +6915,12 @@ const BuiltIns = [
6866
6915
  Completions,
6867
6916
  LogLevel
6868
6917
  ];
6869
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/CliConfig.js
6918
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/CliConfig.js
6870
6919
  var CliConfig = class extends Reference("effect/cli/CliConfig", { defaultValue: () => defaults }) {};
6871
6920
  const defaults = { builtIns: BuiltIns };
6872
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/formatter.js
6921
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/formatter.js
6873
6922
  const resolveFormatter = contextWith((context) => succeed$1(getOrUndefined$1(context, Formatter) ?? defaultFormatter({ colors: get$2(context, TerminalCapabilities).canColor })));
6874
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/lexer.js
6923
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/lexer.js
6875
6924
  function lex(argv) {
6876
6925
  const endIndex = argv.indexOf("--");
6877
6926
  if (endIndex === -1) return {
@@ -6940,7 +6989,7 @@ const lexTokens = (args) => {
6940
6989
  });
6941
6990
  return tokens;
6942
6991
  };
6943
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/auto-suggest.js
6992
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/auto-suggest.js
6944
6993
  const levenshtein = (a, b) => {
6945
6994
  const m = a.length;
6946
6995
  const n = b.length;
@@ -6959,7 +7008,7 @@ const suggest = (input, candidates) => {
6959
7008
  const minDistance = distances[0][0];
6960
7009
  return distances.filter(([d]) => d === minDistance).map(([, c]) => c);
6961
7010
  };
6962
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/parser.js
7011
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/parser.js
6963
7012
  const getCommandPath = (parsedInput) => match$2(parsedInput.subcommand, {
6964
7013
  onNone: () => [],
6965
7014
  onSome: (subcommand) => [subcommand.name, ...getCommandPath(subcommand.parsedInput)]
@@ -7397,7 +7446,7 @@ const scanCommandLevel = (tokens, context) => {
7397
7446
  }
7398
7447
  return toLeafResult(state);
7399
7448
  };
7400
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/internal/wizard.js
7449
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/internal/wizard.js
7401
7450
  const run$2 = fnUntraced(function* (command, options) {
7402
7451
  const commandPath = options?.commandPath ?? [command.name];
7403
7452
  const selected = getCommandAtPath(command, commandPath);
@@ -7567,7 +7616,7 @@ const wrapCommand = (commandLine) => {
7567
7616
  return lines;
7568
7617
  };
7569
7618
  const formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
7570
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/cli/Command.js
7619
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/cli/Command.js
7571
7620
  const isCommand = (u) => hasProperty(u, TypeId$13);
7572
7621
  const make$26 = (name, config, handler) => {
7573
7622
  const parsedConfig = parseConfig(config ?? {});
@@ -7752,10 +7801,11 @@ const runWith = (command, config) => {
7752
7801
  trailingOperands
7753
7802
  }, command);
7754
7803
  const commandPath = [command.name, ...getCommandPath(parsedArgs)];
7755
- const toShowHelp = mapError((error) => error._tag === "ShowHelp" ? error : new ShowHelp({
7804
+ const toShowHelpError = (error) => error._tag === "ShowHelp" ? error : new ShowHelp({
7756
7805
  commandPath,
7757
7806
  errors: [error]
7758
- }));
7807
+ });
7808
+ const toShowHelp = mapError(toShowHelpError);
7759
7809
  const handlerCtx = {
7760
7810
  builtIns,
7761
7811
  command,
@@ -7813,7 +7863,7 @@ const runWith = (command, config) => {
7813
7863
  commandPath,
7814
7864
  errors: parsedArgs.errors
7815
7865
  });
7816
- const input = yield* commandImpl.parse(parsedArgs).pipe(toShowHelp);
7866
+ const input = yield* commandImpl.parse(parsedArgs).pipe(mapError((error) => isCliError(error) ? toShowHelpError(error) : error));
7817
7867
  let program = commandImpl.handle(input, [command.name]);
7818
7868
  const logLevel = activeFlags.includes(LogLevel) ? (yield* LogLevel.flag.parse(emptyArgs).pipe(toShowHelp))[1] : none();
7819
7869
  program = provideService(program, LogLevel, logLevel);
@@ -7836,7 +7886,7 @@ const runWith = (command, config) => {
7836
7886
  });
7837
7887
  }, ({ error, userMessage }) => andThen(showUserError(error, userMessage), fail$1(error))), catchFilter((e) => isQuitError(e) ? succeed$2(e) : fail$2(e), (_) => interrupt));
7838
7888
  };
7839
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Brand.js
7889
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Brand.js
7840
7890
  function nominal() {
7841
7891
  return Object.assign((input) => input, {
7842
7892
  option: (input) => some(input),
@@ -7844,7 +7894,7 @@ function nominal() {
7844
7894
  is: (_) => true
7845
7895
  });
7846
7896
  }
7847
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/process/ChildProcessSpawner.js
7897
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/process/ChildProcessSpawner.js
7848
7898
  const ExitCode = nominal();
7849
7899
  const ProcessId = nominal();
7850
7900
  const HandleTypeId = "~effect/process/ChildProcessSpawner/ChildProcessHandle";
@@ -7872,7 +7922,7 @@ const make$25 = (spawn) => {
7872
7922
  });
7873
7923
  };
7874
7924
  var ChildProcessSpawner = class extends Service()("effect/process/ChildProcessSpawner") {};
7875
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/process/CommandLine.js
7925
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/process/CommandLine.js
7876
7926
  var CommandLineError = class extends TaggedError("CommandLineError") {};
7877
7927
  const display = (words, options) => {
7878
7928
  if (words.length === 0) return "";
@@ -8048,7 +8098,7 @@ const parseTemplate$1 = (texts, values) => {
8048
8098
  endWord();
8049
8099
  return succeed$2(words);
8050
8100
  };
8051
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/process/ChildProcess.js
8101
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/process/ChildProcess.js
8052
8102
  const TypeId$12 = "~effect/process/ChildProcess";
8053
8103
  const Proto$6 = {
8054
8104
  ...Prototype({
@@ -8114,7 +8164,7 @@ const shellScript = (templates, expressions) => {
8114
8164
  });
8115
8165
  return script;
8116
8166
  };
8117
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/internal/nodeChildProcessSpawner.js
8167
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/internal/nodeChildProcessSpawner.js
8118
8168
  const buildSpawnOptions = (options, base, platform) => {
8119
8169
  const detached = options.detached ?? platform !== "win32";
8120
8170
  return {
@@ -8124,7 +8174,7 @@ const buildSpawnOptions = (options, base, platform) => {
8124
8174
  windowsHide: options.windowsHide ?? !detached
8125
8175
  };
8126
8176
  };
8127
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/internal/utils.js
8177
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/internal/utils.js
8128
8178
  const handleErrnoException = (module, method) => (err, [path]) => {
8129
8179
  let reason = "Unknown";
8130
8180
  switch (err.code) {
@@ -8158,7 +8208,7 @@ const handleErrnoException = (module, method) => (err, [path]) => {
8158
8208
  cause: err
8159
8209
  });
8160
8210
  };
8161
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
8211
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
8162
8212
  const toError = (error) => error instanceof globalThis.Error ? error : new globalThis.Error(String(error));
8163
8213
  const toPlatformError = (method, error, command) => {
8164
8214
  const { commands } = flattenCommand(command);
@@ -8495,11 +8545,7 @@ const make$23 = gen(function* () {
8495
8545
  const cwd = yield* resolveWorkingDirectory(cmd.options);
8496
8546
  const env = resolveEnvironment(cmd.options);
8497
8547
  const stdio = buildStdioArray(stdinConfig, stdoutConfig, stderrConfig, resolvedAdditionalFds);
8498
- const [childProcess, exitSignal] = yield* acquireRelease(spawn(cmd, buildSpawnOptions(cmd.options, {
8499
- cwd,
8500
- env,
8501
- stdio
8502
- }, process.platform)), fnUntraced(function* ([childProcess, exitSignal]) {
8548
+ const releaseProcess = fnUntraced(function* (childProcess, exitSignal) {
8503
8549
  if (yield* isDone(exitSignal)) {
8504
8550
  const [code] = yield* _await(exitSignal);
8505
8551
  if (code !== 0 && isNotNull(code)) yield* ignore(terminateProcessGroup(cmd, childProcess, exitSignal, cmd.options));
@@ -8508,6 +8554,15 @@ const make$23 = gen(function* () {
8508
8554
  }
8509
8555
  if (!isReferenced) return;
8510
8556
  yield* ignore(terminateProcessGroup(cmd, childProcess, exitSignal, cmd.options));
8557
+ });
8558
+ const inputScope = makeUnsafe$2();
8559
+ const [childProcess, exitSignal] = yield* acquireRelease(spawn(cmd, buildSpawnOptions(cmd.options, {
8560
+ cwd,
8561
+ env,
8562
+ stdio
8563
+ }, process.platform)), ([childProcess, exitSignal], exit) => all([close(inputScope, exit), releaseProcess(childProcess, exitSignal)], {
8564
+ concurrency: "unbounded",
8565
+ discard: true
8511
8566
  }));
8512
8567
  const pid = ProcessId(childProcess.pid);
8513
8568
  if (cmd.options.detached !== false) childProcess.on("exit", (code) => {
@@ -8527,9 +8582,9 @@ const make$23 = gen(function* () {
8527
8582
  return reref;
8528
8583
  });
8529
8584
  const inputFailure = makeUnsafe$1();
8530
- const stdin = yield* setupChildStdin(cmd, childProcess, stdinConfig, inputFailure);
8531
- const { all, stderr, stdout } = setupChildOutputStreams(cmd, childProcess, stdoutConfig, stderrConfig);
8532
- const { getInputFd, getOutputFd } = yield* setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds, inputFailure);
8585
+ const stdin = yield* provide$2(inputScope)(setupChildStdin(cmd, childProcess, stdinConfig, inputFailure));
8586
+ const { all: all$2, stderr, stdout } = setupChildOutputStreams(cmd, childProcess, stdoutConfig, stderrConfig);
8587
+ const { getInputFd, getOutputFd } = yield* provide$2(inputScope)(setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds, inputFailure));
8533
8588
  const isRunning = map$5(isDone(exitSignal), (done) => !done);
8534
8589
  const exitCode = flatMap$1(raceFirst(_await(exitSignal), _await(inputFailure)), ([code, signal]) => {
8535
8590
  if (isDoneUnsafe(inputFailure)) return _await(inputFailure);
@@ -8546,7 +8601,7 @@ const make$23 = gen(function* () {
8546
8601
  stdin,
8547
8602
  stdout,
8548
8603
  stderr,
8549
- all,
8604
+ all: all$2,
8550
8605
  getInputFd,
8551
8606
  getOutputFd,
8552
8607
  unref
@@ -8646,7 +8701,7 @@ const flattenCommand = (command) => {
8646
8701
  pipeOptions
8647
8702
  };
8648
8703
  };
8649
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
8704
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
8650
8705
  const handleBadArgument = (method) => (err) => badArgument({
8651
8706
  module: "FileSystem",
8652
8707
  method,
@@ -8771,7 +8826,10 @@ const makeFile = (() => {
8771
8826
  const nodeStat = effectify(NFS.fstat, handleErrnoException("FileSystem", "stat"), handleBadArgument("stat"));
8772
8827
  const nodeTruncate = effectify(NFS.ftruncate, handleErrnoException("FileSystem", "truncate"), handleBadArgument("truncate"));
8773
8828
  const nodeSync = effectify(NFS.fsync, handleErrnoException("FileSystem", "sync"), handleBadArgument("sync"));
8774
- const nodeWriteFactory = (method) => effectify(NFS.write, handleErrnoException("FileSystem", method), handleBadArgument(method));
8829
+ const nodeWriteFactory = (method) => {
8830
+ const write = effectify(NFS.write, handleErrnoException("FileSystem", method), handleBadArgument(method));
8831
+ return (fd, buffer, position) => write(fd, buffer, 0, buffer.length, position);
8832
+ };
8775
8833
  const nodeWrite = nodeWriteFactory("write");
8776
8834
  const nodeWriteAll = nodeWriteFactory("writeAll");
8777
8835
  class FileImpl {
@@ -8854,7 +8912,7 @@ const makeFile = (() => {
8854
8912
  write(buffer) {
8855
8913
  return suspend(() => {
8856
8914
  const position = this.position;
8857
- return flatMap$1(this.append ? succeed$1(void 0) : positionToNumber(position, "write"), (nodePosition) => map$5(nodeWrite(this.fd, buffer, void 0, void 0, nodePosition), (bytesWritten) => {
8915
+ return flatMap$1(this.append ? succeed$1(void 0) : positionToNumber(position, "write"), (nodePosition) => map$5(nodeWrite(this.fd, buffer, nodePosition), (bytesWritten) => {
8858
8916
  if (!this.append) this.position = position + BigInt(bytesWritten);
8859
8917
  return bytesWritten;
8860
8918
  }));
@@ -8863,7 +8921,7 @@ const makeFile = (() => {
8863
8921
  writeAllChunk(buffer) {
8864
8922
  return suspend(() => {
8865
8923
  const position = this.position;
8866
- return flatMap$1(this.append ? succeed$1(void 0) : positionToNumber(position, "writeAll"), (nodePosition) => flatMap$1(nodeWriteAll(this.fd, buffer, void 0, void 0, nodePosition), (bytesWritten) => {
8924
+ return flatMap$1(this.append ? succeed$1(void 0) : positionToNumber(position, "writeAll"), (nodePosition) => flatMap$1(nodeWriteAll(this.fd, buffer, nodePosition), (bytesWritten) => {
8867
8925
  if (bytesWritten === 0) return fail$1(systemError({
8868
8926
  module: "FileSystem",
8869
8927
  method: "writeAll",
@@ -9057,9 +9115,9 @@ const makeFileSystem = map$5(serviceOption(WatchBackend), (backend) => make$35({
9057
9115
  writeFile
9058
9116
  }));
9059
9117
  const layer$17 = effect(FileSystem)(makeFileSystem);
9060
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeFileSystem.js
9118
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeFileSystem.js
9061
9119
  const layer$16 = layer$17;
9062
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodePath.js
9120
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodePath.js
9063
9121
  const fileUrlOps = (windows) => ({
9064
9122
  fromFileUrl: (url) => try_({
9065
9123
  try: () => NodeUrl.fileURLToPath(url, { windows }),
@@ -9090,9 +9148,9 @@ const layer$15 = succeed$4(Path$3)(make$34({
9090
9148
  ...Path,
9091
9149
  ...fileUrlOps(void 0)
9092
9150
  }));
9093
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodePath.js
9151
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodePath.js
9094
9152
  const layer$14 = layer$15;
9095
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeStdio.js
9153
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeStdio.js
9096
9154
  const layer$13 = succeed$4(Stdio, make$29({
9097
9155
  args: sync(() => process.argv.slice(2)),
9098
9156
  stdinIsTerminal: sync(() => process.stdin.isTTY === true),
@@ -9129,23 +9187,30 @@ const layer$13 = succeed$4(Stdio, make$29({
9129
9187
  closeOnDone: false
9130
9188
  })
9131
9189
  }));
9132
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeStdio.js
9190
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeStdio.js
9133
9191
  const layer$12 = layer$13;
9134
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
9192
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
9135
9193
  const make$22 = fnUntraced(function* (shouldQuit = defaultShouldQuit) {
9136
- const stdin = process.stdin;
9137
- const stdout = process.stdout;
9138
9194
  const lines = yield* make$46();
9139
- let inputEnded = stdin.readableEnded;
9195
+ let inputEnded = false;
9140
9196
  let readlineActive = false;
9141
9197
  const onStdinEnd = () => {
9142
9198
  inputEnded = true;
9143
9199
  if (!readlineActive) endUnsafe(lines);
9144
9200
  };
9145
- stdin.once("end", onStdinEnd);
9146
- yield* addFinalizer(() => sync(() => stdin.off("end", onStdinEnd)));
9201
+ let stdin;
9202
+ const getStdin = () => {
9203
+ if (stdin === void 0) {
9204
+ stdin = process.stdin;
9205
+ if (stdin.readableEnded) onStdinEnd();
9206
+ else stdin.once("end", onStdinEnd);
9207
+ }
9208
+ return stdin;
9209
+ };
9210
+ yield* addFinalizer$1(() => sync(() => stdin?.off("end", onStdinEnd)));
9147
9211
  const rlRef = yield* make$36({
9148
9212
  acquire: acquireRelease(sync(() => {
9213
+ const stdin = getStdin();
9149
9214
  const rl = readline.createInterface({
9150
9215
  input: stdin,
9151
9216
  escapeCodeTimeout: 50
@@ -9174,21 +9239,23 @@ const make$22 = fnUntraced(function* (shouldQuit = defaultShouldQuit) {
9174
9239
  idleTimeToLive: "10 millis"
9175
9240
  });
9176
9241
  const setRawMode = (enabled) => sync(() => {
9242
+ const stdin = getStdin();
9177
9243
  if (stdin.isTTY) stdin.setRawMode(enabled);
9178
9244
  });
9179
9245
  const rawModeRef = yield* make$36({
9180
9246
  acquire: acquireRelease(setRawMode(true), () => setRawMode(false)),
9181
9247
  idleTimeToLive: "10 millis"
9182
9248
  });
9183
- const columns = sync(() => stdout.columns ?? 0);
9184
- const rows = sync(() => stdout.rows ?? 0);
9249
+ const columns = sync(() => process.stdout.columns ?? 0);
9250
+ const rows = sync(() => process.stdout.rows ?? 0);
9185
9251
  const size = gen(function* () {
9252
+ const stdout = process.stdout;
9186
9253
  const queue = yield* sliding(1);
9187
9254
  const onResize = () => offerUnsafe(queue, {
9188
9255
  columns: stdout.columns ?? 0,
9189
9256
  rows: stdout.rows ?? 0
9190
9257
  });
9191
- yield* addFinalizer(() => sync(() => {
9258
+ yield* addFinalizer$1(() => sync(() => {
9192
9259
  stdout.off("resize", onResize);
9193
9260
  endUnsafe(queue);
9194
9261
  }));
@@ -9197,6 +9264,7 @@ const make$22 = fnUntraced(function* (shouldQuit = defaultShouldQuit) {
9197
9264
  return queue;
9198
9265
  });
9199
9266
  const readInput = gen(function* () {
9267
+ const stdin = getStdin();
9200
9268
  const queue = yield* make$46();
9201
9269
  const handleKeypress = (s, k) => {
9202
9270
  const userInput = {
@@ -9216,7 +9284,7 @@ const make$22 = fnUntraced(function* (shouldQuit = defaultShouldQuit) {
9216
9284
  clearInterval(keepAlive);
9217
9285
  endUnsafe(queue);
9218
9286
  };
9219
- yield* addFinalizer(() => sync(() => {
9287
+ yield* addFinalizer$1(() => sync(() => {
9220
9288
  clearInterval(keepAlive);
9221
9289
  stdin.off("keypress", handleKeypress);
9222
9290
  stdin.off("end", handleEnd);
@@ -9235,7 +9303,7 @@ const make$22 = fnUntraced(function* (shouldQuit = defaultShouldQuit) {
9235
9303
  onSome: succeed$1
9236
9304
  })), mapError(() => new QuitError({}))));
9237
9305
  const display = (prompt) => uninterruptible(callback((resume) => {
9238
- stdout.write(prompt, (err) => isNullish(err) ? resume(void_) : resume(fail$1(badArgument({
9306
+ process.stdout.write(prompt, (err) => isNullish(err) ? resume(void_) : resume(fail$1(badArgument({
9239
9307
  module: "Terminal",
9240
9308
  method: "display",
9241
9309
  description: "Failed to write prompt to stdout",
@@ -9256,11 +9324,11 @@ function defaultShouldQuit(input) {
9256
9324
  const key = input.key;
9257
9325
  return key.name === "escape" || key.ctrl && (key.name === "c" || key.name === "d");
9258
9326
  }
9259
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeTerminal.js
9327
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeTerminal.js
9260
9328
  const layer$10 = layer$11;
9261
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeServices.js
9329
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeServices.js
9262
9330
  const layer$9 = provideMerge(layer$18, mergeAll(layer$16, layer$14, layer$12, layer$10));
9263
- // node_modules/.pnpm/@effect+platform-node-shared@4.1.1_effect@4.1.1/node_modules/@effect/platform-node-shared/dist/NodeRuntime.js
9331
+ // node_modules/.pnpm/@effect+platform-node-shared@4.1.3_effect@4.1.3/node_modules/@effect/platform-node-shared/dist/NodeRuntime.js
9264
9332
  const runMain$1 = makeRunMain(({ fiber, teardown }) => {
9265
9333
  let receivedSignal = false;
9266
9334
  fiber.addObserver((exit) => {
@@ -9277,9 +9345,9 @@ const runMain$1 = makeRunMain(({ fiber, teardown }) => {
9277
9345
  process.on("SIGINT", onSigint);
9278
9346
  process.on("SIGTERM", onSigint);
9279
9347
  });
9280
- // node_modules/.pnpm/@effect+platform-node@4.1.1_effect@4.1.1_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeRuntime.js
9348
+ // node_modules/.pnpm/@effect+platform-node@4.1.3_effect@4.1.3_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeRuntime.js
9281
9349
  const runMain = runMain$1;
9282
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/socket/Socket.js
9350
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/socket/Socket.js
9283
9351
  const TypeId$11 = "~effect/socket/Socket";
9284
9352
  const Socket = Service("effect/socket/Socket");
9285
9353
  const make$21 = (options) => Socket.of({
@@ -9449,7 +9517,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
9449
9517
  ws.addEventListener("message", onMessage);
9450
9518
  ws.addEventListener("error", onError, { once: true });
9451
9519
  ws.addEventListener("close", onClose, { once: true });
9452
- yield* addFinalizer$1(scope$6, sync(() => {
9520
+ yield* addFinalizer(scope$6, sync(() => {
9453
9521
  fail(closeError(1006));
9454
9522
  ws.removeEventListener("message", onMessage);
9455
9523
  ws.addEventListener("error", constVoid);
@@ -9541,7 +9609,7 @@ const layerWebSocketConstructor = succeed$4(WebSocketConstructor)((url, options)
9541
9609
  if (options === void 0 || typeof options === "string" || Array.isArray(options)) return new (webSocketWithOptions())(url, options);
9542
9610
  return new (webSocketWithOptions())(url, { headers: options.headers });
9543
9611
  });
9544
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/Prompt.js
9612
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Prompt.js
9545
9613
  const ProviderOptions = Record(String$7, NullOr(Json));
9546
9614
  const PartTypeId$1 = "~effect/ai/Prompt/Part";
9547
9615
  const BasePart$1 = Struct({
@@ -9565,7 +9633,7 @@ const ReasoningPart$1 = Struct({
9565
9633
  text: String$7
9566
9634
  }).annotate({ identifier: "ReasoningPart" });
9567
9635
  const TaggedURL = TaggedStruct("URL", { href: URLFromString });
9568
- const urlFromTaggedURL = transform$3({
9636
+ const urlFromTaggedURL = transform$2({
9569
9637
  decode: ({ href }) => href,
9570
9638
  encode: (href) => ({
9571
9639
  _tag: "URL",
@@ -9579,7 +9647,7 @@ const FilePart$1 = Struct({
9579
9647
  fileName: optional$2(String$7),
9580
9648
  data: Union([
9581
9649
  String$7,
9582
- TaggedStruct("Uint8Array", { base64: Uint8ArrayFromBase64 }).pipe(decodeTo$1(Uint8Array$2, transform$3({
9650
+ TaggedStruct("Uint8Array", { base64: Uint8ArrayFromBase64 }).pipe(decodeTo$1(Uint8Array$2, transform$2({
9583
9651
  decode: ({ base64 }) => base64,
9584
9652
  encode: (base64) => ({
9585
9653
  _tag: "Uint8Array",
@@ -9635,7 +9703,7 @@ const makeMessage = (role, params) => ({
9635
9703
  role,
9636
9704
  options: params.options ?? {}
9637
9705
  });
9638
- const ContentFromString = String$7.pipe(decodeTo$1(NonEmptyArray(toType(TextPart$1)), transform$3({
9706
+ const ContentFromString = String$7.pipe(decodeTo$1(NonEmptyArray(toType(TextPart$1)), transform$2({
9639
9707
  decode: (text) => of(makePart$1("text", { text })),
9640
9708
  encode: (content) => content[0].text
9641
9709
  })));
@@ -9837,10 +9905,10 @@ const setSystem = dual(2, (self, content) => {
9837
9905
  for (const message of self.content) if (message.role !== "system") messages.push(message);
9838
9906
  return makePrompt(messages);
9839
9907
  });
9840
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/UndefinedOr.js
9908
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/UndefinedOr.js
9841
9909
  const map = dual(2, (self, f) => self === void 0 ? void 0 : f(self));
9842
9910
  const match$1 = dual(2, (self, { onDefined, onUndefined }) => self === void 0 ? onUndefined() : onDefined(self));
9843
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/persistence/KeyValueStore.js
9911
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/persistence/KeyValueStore.js
9844
9912
  const TypeId$9 = "~effect/persistence/KeyValueStore";
9845
9913
  const ErrorTypeId = "~effect/persistence/KeyValueStore/KeyValueStoreError";
9846
9914
  var KeyValueStoreError = class extends TaggedError("KeyValueStoreError") {
@@ -9984,7 +10052,7 @@ const toSchemaStore = (self, schema) => {
9984
10052
  isEmpty: self.isEmpty
9985
10053
  };
9986
10054
  };
9987
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/Model.js
10055
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Model.js
9988
10056
  const TypeId$8 = "~effect/ai/Model";
9989
10057
  var ProviderName = class extends Service()("effect/ai/Model/ProviderName") {};
9990
10058
  var ModelName = class extends Service()("effect/ai/Model/ModelName") {};
@@ -10351,7 +10419,7 @@ var ExaError = class extends TaggedError$1()("ExaError", { cause: Defect() }) {}
10351
10419
  const layer$8 = effect(ExaSearch, gen(function* () {
10352
10420
  const scope$5 = yield* scope;
10353
10421
  const getClient = yield* cachedWithTTL(gen(function* () {
10354
- const McpClient = yield* tryPromise(() => import("./McpClient-CXwyRd_3.mjs"));
10422
+ const McpClient = yield* tryPromise(() => import("./McpClient-BCxZZgnA.mjs"));
10355
10423
  const context = yield* buildWithScope(McpClient.layer, scope$5);
10356
10424
  return get$2(context, McpClient.McpClient);
10357
10425
  }), (exit) => isSuccess(exit) ? infinity : zero);
@@ -10410,7 +10478,7 @@ const layer$7 = effect(WebToMarkdown, gen(function* () {
10410
10478
  "progress",
10411
10479
  "meter"
10412
10480
  ]);
10413
- const turndown = yield* cached(map$5(promise(() => import("./turndown.cjs-C2WBxeA-.mjs").then((m) => __toESM(m.default, 1))), ({ default: TurndownService }) => new TurndownService().remove((node) => toRemove.has(node.nodeName.toLowerCase()))));
10481
+ const turndown = yield* cached(map$5(promise(() => import("./turndown.cjs-CwE2EFNQ.mjs").then((m) => __toESM(m.default, 1))), ({ default: TurndownService }) => new TurndownService().remove((node) => toRemove.has(node.nodeName.toLowerCase()))));
10414
10482
  const convertHtml = fn("WebToMarkdown.convertHtml")(function* (html) {
10415
10483
  return (yield* turndown).turndown(html);
10416
10484
  });
@@ -10422,16 +10490,20 @@ const layer$7 = effect(WebToMarkdown, gen(function* () {
10422
10490
  })
10423
10491
  });
10424
10492
  }));
10425
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/Tool.js
10493
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Tool.js
10426
10494
  const TypeId$7 = "~effect/ai/Tool";
10427
10495
  const ProviderDefinedTypeId = "~effect/ai/Tool/ProviderDefined";
10428
10496
  const DynamicTypeId = "~effect/ai/Tool/Dynamic";
10429
10497
  const isUserDefined = (u) => hasProperty(u, "~effect/ai/Tool") && !isProviderDefined(u) && !isDynamic(u);
10430
10498
  const isProviderDefined = (u) => hasProperty(u, ProviderDefinedTypeId);
10431
10499
  const isDynamic = (u) => hasProperty(u, DynamicTypeId);
10500
+ const isClientExecuted = (tool) => tool.execution === "client";
10432
10501
  const clone = (self, overrides) => Object.assign(Object.create(Object.getPrototypeOf(self)), self, overrides);
10433
10502
  const Proto$3 = {
10434
- [TypeId$7]: { _Requirements: identity },
10503
+ [TypeId$7]: {
10504
+ _Config: identity,
10505
+ _Requirements: identity
10506
+ },
10435
10507
  pipe() {
10436
10508
  return pipeArguments(this, arguments);
10437
10509
  },
@@ -10488,7 +10560,8 @@ const make$17 = (name, options) => {
10488
10560
  failureMode: options?.failureMode ?? "error",
10489
10561
  annotations: empty$8(),
10490
10562
  needsApproval: options?.needsApproval,
10491
- toModelOutput: options?.toModelOutput
10563
+ toModelOutput: options?.toModelOutput,
10564
+ execution: options?.execution
10492
10565
  });
10493
10566
  };
10494
10567
  var NameMapper = class {
@@ -10576,10 +10649,18 @@ const EmptyParams = Record(String$7, Never);
10576
10649
  function isEmptyParamsRecord(indexSignature) {
10577
10650
  return indexSignature.parameter === string$1 && isNever(indexSignature.type);
10578
10651
  }
10579
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/Toolkit.js
10652
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Toolkit.js
10580
10653
  const TypeId$6 = "~effect/ai/Toolkit";
10581
10654
  const FailureOrigin = Reference("effect/ai/Toolkit/FailureOrigin", { defaultValue: () => "result" });
10582
10655
  const PreliminaryBuffer = Reference("effect/ai/Toolkit/PreliminaryBuffer", { defaultValue: () => "unbounded" });
10656
+ const RecordToolArguments = Reference("effect/ai/Toolkit/RecordToolArguments", { defaultValue: () => false });
10657
+ const stringifyToolArguments = (params) => {
10658
+ try {
10659
+ return JSON.stringify(params) ?? "null";
10660
+ } catch {
10661
+ return String(params);
10662
+ }
10663
+ };
10583
10664
  const failureCause = (error, origin) => annotate$1(fail$5(error), make$42(FailureOrigin, origin));
10584
10665
  const failureOrigin = (error) => isSchemaError(error) ? "result" : "handler";
10585
10666
  const Proto$2 = {
@@ -10593,9 +10674,9 @@ const Proto$2 = {
10593
10674
  let schemas = schemasCache.get(tool);
10594
10675
  if (isUndefined(schemas)) {
10595
10676
  const handler = services.mapUnsafe.get(tool.id);
10596
- const decodeParameters = isSchema(tool.parametersSchema) ? decodeUnknownEffect$1(tool.parametersSchema) : (u) => succeed$1(u);
10597
- const encodeSuccess = encodeUnknownEffect(tool.successSchema);
10598
- const encodeFailure = encodeUnknownEffect(failureResultSchema(tool));
10677
+ const decodeParameters = isSchema(tool.parametersSchema) ? decodeUnknownEffect$1(toCodecJson(tool.parametersSchema)) : (u) => succeed$1(u);
10678
+ const encodeSuccess = encodeUnknownEffect(toCodecJson(tool.successSchema));
10679
+ const encodeFailure = encodeUnknownEffect(toCodecJson(failureResultSchema(tool)));
10599
10680
  const encodeResult = (u, isFailure) => isFailure ? encodeFailure(u) : encodeSuccess(u);
10600
10681
  schemas = {
10601
10682
  context: handler.context,
@@ -10611,10 +10692,9 @@ const Proto$2 = {
10611
10692
  tools,
10612
10693
  handle: fnUntraced(function* (name, params, toolCallId, options) {
10613
10694
  const tool = Object.hasOwn(tools, name) ? tools[name] : void 0;
10614
- yield* annotateCurrentSpan({
10615
- tool: name,
10616
- parameters: params
10617
- });
10695
+ yield* annotateCurrentSpan("gen_ai.tool.name", name);
10696
+ if (toolCallId !== void 0) yield* annotateCurrentSpan("gen_ai.tool.call.id", toolCallId);
10697
+ if (yield* RecordToolArguments) yield* annotateCurrentSpan("gen_ai.tool.call.arguments", stringifyToolArguments(params));
10618
10698
  if (isUndefined(tool)) return yield* make$47({
10619
10699
  module: "Toolkit",
10620
10700
  method: `${name}.handle`,
@@ -10623,6 +10703,7 @@ const Proto$2 = {
10623
10703
  availableTools: Object.keys(tools)
10624
10704
  })
10625
10705
  });
10706
+ if (isClientExecuted(tool)) return yield* die(new Error(`Tool "${name}" is executed by the client and has no handler`));
10626
10707
  const schemas = getSchemas(tool);
10627
10708
  const encodeResult = (result, isFailure) => schemas.encodeResult(result, isFailure).pipe(mapError((cause) => make$47({
10628
10709
  module: "Toolkit",
@@ -10702,7 +10783,10 @@ const Proto$2 = {
10702
10783
  encodedResult,
10703
10784
  modelOutput: tool.toModelOutput(output.result)
10704
10785
  };
10705
- })), ensuring$1(interrupt$2(fiber)));
10786
+ })), ensuring$1(flatMap$1(andThen(interrupt$2(fiber), await_(fiber)), (exit) => {
10787
+ const dies = isFailure(exit) ? exit.cause.reasons.filter(isDieReason) : [];
10788
+ return dies.length > 0 ? failCause(fromReasons(dies)) : void_;
10789
+ })));
10706
10790
  })
10707
10791
  };
10708
10792
  })
@@ -11199,7 +11283,12 @@ const AgentTools = make$16(make$17("changeDirectory", {
11199
11283
  parameters: ArraySchema(String$7).annotate({ identifier: "args" }),
11200
11284
  success: String$7,
11201
11285
  dependencies: [CurrentDirectory]
11202
- }), makeBashTool(defaultBashTimeout), make$17("taskOutput", {
11286
+ }), makeBashTool(defaultBashTimeout), make$17("run", {
11287
+ description: "Run a bash command in the foreground and return its output. If it takes longer than 2 minutes it will become a background task.",
11288
+ parameters: String$7.annotate({ identifier: "command" }),
11289
+ success: String$7,
11290
+ dependencies: [CurrentDirectory]
11291
+ }), make$17("taskOutput", {
11203
11292
  description: "Return the status and output so far of one of your tasks: a background bash command or a sub-agent.",
11204
11293
  parameters: String$7.annotate({ identifier: "id" }),
11205
11294
  success: Task,
@@ -11366,6 +11455,32 @@ const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(gen(function* () {
11366
11455
  });
11367
11456
  return `Image attached: ${fileName}`;
11368
11457
  });
11458
+ const bash = fn("AgentTools.bash")(function* (options) {
11459
+ const maxMs = bashTimeoutMs(yield* CommandLimits);
11460
+ const timeoutMs = Math.min(options.timeoutMs ?? maxMs, maxMs);
11461
+ yield* logInfo(`Calling "bash"`).pipe(annotateLogs({
11462
+ ...options,
11463
+ timeoutMs
11464
+ }));
11465
+ const cwd = yield* CurrentDirectory;
11466
+ const cmd = make$24("bash", ["-c", options.command], {
11467
+ cwd,
11468
+ stdin: "ignore"
11469
+ });
11470
+ const entry = yield* addBashTask(options.command, yield* startCommand(cmd, true));
11471
+ if (options.background !== true) {
11472
+ const exit = yield* awaitCommand(entry.command, millis(timeoutMs));
11473
+ if (isSome(exit)) {
11474
+ const exitCode = yield* exit.value;
11475
+ const task = reportBash(entry);
11476
+ if (exitCode === 0) return task;
11477
+ return yield* die(new Error(`Command failed with exit code ${exitCode}: ${task.output}`));
11478
+ }
11479
+ }
11480
+ const task = reportBash(entry);
11481
+ if (task.status === "running") yield* watchBashTask(entry);
11482
+ return options.background === true ? task : backgroundRunningOutput(task);
11483
+ }, orDie);
11369
11484
  return AgentToolsWithSearch.of({
11370
11485
  changeDirectory: fn("AgentTools.changeDirectory")(function* (directory) {
11371
11486
  yield* logInfo(`Calling "changeDirectory"`).pipe(annotateLogs({ directory }));
@@ -11451,34 +11566,15 @@ const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(gen(function* () {
11451
11566
  glob: fn("AgentTools.glob")(function* (pattern) {
11452
11567
  yield* logInfo(`Calling "glob"`).pipe(annotateLogs({ pattern }));
11453
11568
  const cwd = yield* CurrentDirectory;
11454
- return yield* promise(() => import("./index.min-ClUfQ5ji.mjs").then((Glob) => Glob.glob(pattern, { cwd })));
11569
+ return yield* promise(() => import("./index.min-CuA3AuA-.mjs").then((Glob) => Glob.glob(pattern, { cwd })));
11570
+ }),
11571
+ bash,
11572
+ run: fn("AgentTools.run")(function* (command) {
11573
+ return (yield* bash({
11574
+ command,
11575
+ timeoutMs: 12e4
11576
+ })).output;
11455
11577
  }),
11456
- bash: fn("AgentTools.bash")(function* (options) {
11457
- const maxMs = bashTimeoutMs(yield* CommandLimits);
11458
- const timeoutMs = Math.min(options.timeoutMs ?? maxMs, maxMs);
11459
- yield* logInfo(`Calling "bash"`).pipe(annotateLogs({
11460
- ...options,
11461
- timeoutMs
11462
- }));
11463
- const cwd = yield* CurrentDirectory;
11464
- const cmd = make$24("bash", ["-c", options.command], {
11465
- cwd,
11466
- stdin: "ignore"
11467
- });
11468
- const entry = yield* addBashTask(options.command, yield* startCommand(cmd, true));
11469
- if (options.background !== true) {
11470
- const exit = yield* awaitCommand(entry.command, millis(timeoutMs));
11471
- if (isSome(exit)) {
11472
- const exitCode = yield* exit.value;
11473
- const task = reportBash(entry);
11474
- if (exitCode === 0) return task;
11475
- return yield* die(new Error(`Command failed with exit code ${exitCode}: ${task.output}`));
11476
- }
11477
- }
11478
- const task = reportBash(entry);
11479
- if (task.status === "running") yield* watchBashTask(entry);
11480
- return options.background === true ? task : backgroundRunningOutput(task);
11481
- }, orDie),
11482
11578
  taskOutput: fn("AgentTools.taskOutput")(function* (input) {
11483
11579
  const id = yield* decodeTaskOutput(input);
11484
11580
  yield* logInfo(`Calling "taskOutput"`).pipe(annotateLogs({ id }));
@@ -12217,7 +12313,7 @@ file with "readFile" before a task that matches its description.
12217
12313
  ${renderEntries(discovered.skills)}`);
12218
12314
  return sections.join("\n\n");
12219
12315
  };
12220
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/workers/Transferable.js
12316
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/workers/Transferable.js
12221
12317
  var Collector = class extends Service()("effect/workers/Transferable/Collector") {};
12222
12318
  const makeCollectorUnsafe = () => {
12223
12319
  let tranferables = [];
@@ -12239,7 +12335,7 @@ const makeCollectorUnsafe = () => {
12239
12335
  clear: sync(unsafeClear)
12240
12336
  });
12241
12337
  };
12242
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/FiberSet.js
12338
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/FiberSet.js
12243
12339
  const TypeId$5 = "~effect/FiberSet";
12244
12340
  const isFiberSet = (u) => hasProperty(u, TypeId$5);
12245
12341
  const Proto$1 = {
@@ -12317,16 +12413,16 @@ const awaitEmpty = (self) => whileLoop({
12317
12413
  body: () => await_(headUnsafe(self)),
12318
12414
  step: constVoid
12319
12415
  });
12320
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/internal/tracing.js
12416
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/internal/tracing.js
12321
12417
  const spanName = (spanPrefix, tag) => spanPrefix === void 0 ? tag : `${spanPrefix}.${tag}`;
12322
12418
  const spanAttributes = (tag, attributes) => ({
12323
12419
  "rpc.system.name": "effect_rpc",
12324
12420
  "rpc.method": tag,
12325
12421
  ...attributes
12326
12422
  });
12327
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/PrimaryKey.js
12423
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/PrimaryKey.js
12328
12424
  const symbol = "~effect/PrimaryKey";
12329
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/RpcSchema.js
12425
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/RpcSchema.js
12330
12426
  const StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
12331
12427
  function isStreamSchema(schema) {
12332
12428
  return hasProperty(schema, StreamSchemaTypeId);
@@ -12352,7 +12448,7 @@ var ClientAbort = class extends Service()("effect/rpc/RpcSchema/ClientAbort") {
12352
12448
  parent: void 0
12353
12449
  }));
12354
12450
  };
12355
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/Rpc.js
12451
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/Rpc.js
12356
12452
  const TypeId$4 = "~effect/rpc/Rpc";
12357
12453
  const Proto = {
12358
12454
  [TypeId$4]: TypeId$4,
@@ -12480,7 +12576,7 @@ const exitSchema = (self) => {
12480
12576
  const ParseOptions = Reference("effect/rpc/Rpc/ParseOptions", { defaultValue: () => defaultParseOptions });
12481
12577
  const WrapperTypeId = "~effect/rpc/Rpc/Wrapper";
12482
12578
  const isWrapper = (u) => WrapperTypeId in u;
12483
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/RpcMessage.js
12579
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/RpcMessage.js
12484
12580
  const RequestId$1 = (id) => id;
12485
12581
  const RequestIdSchema = Union([String$7, Number$2]);
12486
12582
  const RequestEncodedSchema = Struct({
@@ -12523,7 +12619,7 @@ const EncodedSchema = Union([
12523
12619
  }),
12524
12620
  Struct({ _tag: tag("Pong") })
12525
12621
  ]);
12526
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/Utils.js
12622
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/Utils.js
12527
12623
  const withRunClient = (f) => suspend(() => {
12528
12624
  const clientIds = new Set();
12529
12625
  const clientBuffers = new Map();
@@ -12561,7 +12657,7 @@ const withRunClient = (f) => suspend(() => {
12561
12657
  }
12562
12658
  }));
12563
12659
  });
12564
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/RpcClient.js
12660
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/RpcClient.js
12565
12661
  let requestIdCounter = 0;
12566
12662
  const makeNoSerialization = fnUntraced(function* (group, options) {
12567
12663
  const spanPrefix = options.spanPrefix;
@@ -12572,7 +12668,7 @@ const makeNoSerialization = fnUntraced(function* (group, options) {
12572
12668
  const scope = get$2(services, Scope);
12573
12669
  const entries = new Map();
12574
12670
  let isShutdown = false;
12575
- yield* addFinalizer$1(scope, withFiber((parent) => {
12671
+ yield* addFinalizer(scope, withFiber((parent) => {
12576
12672
  isShutdown = true;
12577
12673
  return clearEntries(interrupt$1(parent.id));
12578
12674
  }));
@@ -12899,7 +12995,7 @@ const make$13 = fnUntraced(function* (group, options) {
12899
12995
  default: return void_;
12900
12996
  }
12901
12997
  }).pipe(catchCause(logError), interruptible, forkScoped);
12902
- yield* addFinalizer(() => succeed$5(closing, void 0));
12998
+ yield* addFinalizer$1(() => succeed$5(closing, void 0));
12903
12999
  return client;
12904
13000
  });
12905
13001
  const makeRpcSchemas = (codecFor) => {
@@ -12925,7 +13021,7 @@ const CurrentHeaders = Reference("effect/rpc/RpcClient/CurrentHeaders", { defaul
12925
13021
  var Protocol = class extends Service()("effect/rpc/RpcClient/Protocol") {
12926
13022
  static make = withRunClient;
12927
13023
  };
12928
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/rpc/RpcGroup.js
13024
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/rpc/RpcGroup.js
12929
13025
  const RpcGroupProto = {
12930
13026
  add(...rpcs) {
12931
13027
  const requests = new Map(this.requests);
@@ -14084,7 +14180,7 @@ var Rpcs = class extends make$12(make$14("capabilities", { success: Capabilities
14084
14180
  })) {};
14085
14181
  const RpcWriteFileParams = Struct({
14086
14182
  ...AgentTools.tools.writeFile.parametersSchema.fields,
14087
- content: Union([String$7, Struct({ base64: Uint8ArrayFromBase64 }).pipe(decodeTo$1(Uint8Array$2, transform$3({
14183
+ content: Union([String$7, Struct({ base64: Uint8ArrayFromBase64 }).pipe(decodeTo$1(Uint8Array$2, transform$2({
14088
14184
  decode: ({ base64 }) => base64,
14089
14185
  encode: (base64) => ({ base64 })
14090
14186
  })))])
@@ -14135,7 +14231,7 @@ const excludedToolNames = (excludeTools) => {
14135
14231
  const names = new Set(excludeTools);
14136
14232
  if (names.has("subagent")) {
14137
14233
  names.add("messageAgent");
14138
- if (names.has("bash")) for (const name of [
14234
+ if (names.has("bash") && names.has("run")) for (const name of [
14139
14235
  "taskOutput",
14140
14236
  "waitTasks",
14141
14237
  "stopTask",
@@ -14306,7 +14402,7 @@ const makeConsole = fn(function* (queue) {
14306
14402
  stdout: writable,
14307
14403
  inspectOptions
14308
14404
  });
14309
- yield* addFinalizer(() => {
14405
+ yield* addFinalizer$1(() => {
14310
14406
  writable.end();
14311
14407
  return void_;
14312
14408
  });
@@ -16731,7 +16827,7 @@ var StreamableHTTPClientTransport = class {
16731
16827
  });
16732
16828
  }
16733
16829
  };
16734
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/fromRepresentation.js
16830
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/internal/schema/fromRepresentation.js
16735
16831
  var ReferenceSlot = class {
16736
16832
  body;
16737
16833
  resolving = false;
@@ -16743,7 +16839,7 @@ var ReferenceSlot = class {
16743
16839
  });
16744
16840
  }
16745
16841
  };
16746
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/fromJsonSchemaDocument.js
16842
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/internal/schema/fromJsonSchemaDocument.js
16747
16843
  const never = {
16748
16844
  _tag: "Never",
16749
16845
  checks: []
@@ -16864,6 +16960,18 @@ function makeFilter(filter) {
16864
16960
  function addNumberCheck(checks, value, make) {
16865
16961
  if (typeof value === "number") checks.push(makeFilter(make(value)));
16866
16962
  }
16963
+ function hasReferences(schema) {
16964
+ if (!isObject(schema)) return false;
16965
+ if (typeof schema.$ref === "string" || typeof schema.$dynamicRef === "string") return true;
16966
+ return Object.entries(schema).some(([keyword, value]) => {
16967
+ switch (getSubschemaKind(keyword)) {
16968
+ case "schema": return hasReferences(value);
16969
+ case "array": return Array.isArray(value) && value.some(hasReferences);
16970
+ case "map": return isObject(value) && Object.values(value).some(hasReferences);
16971
+ default: return false;
16972
+ }
16973
+ });
16974
+ }
16867
16975
  function jsonSchemaAnnotations(schema, options) {
16868
16976
  const annotations = {};
16869
16977
  if (typeof schema.title === "string") annotations.title = schema.title;
@@ -16875,7 +16983,7 @@ function jsonSchemaAnnotations(schema, options) {
16875
16983
  if (typeof schema.format === "string") annotations.format = schema.format;
16876
16984
  if (typeof schema.contentEncoding === "string") annotations.contentEncoding = schema.contentEncoding;
16877
16985
  if (typeof schema.contentMediaType === "string") annotations.contentMediaType = schema.contentMediaType;
16878
- if (isJson(schema.contentSchema)) annotations.contentSchema = schema.contentSchema;
16986
+ if (isJson(schema.contentSchema) && !hasReferences(schema.contentSchema)) annotations.contentSchema = schema.contentSchema;
16879
16987
  let customAnnotations;
16880
16988
  if (options?.includeAnnotationKey !== void 0) for (const key of Object.keys(schema)) {
16881
16989
  if (key.startsWith("~") || jsonSchemaAnnotationExcludedKeys.has(key) || !options.includeAnnotationKey(key)) continue;
@@ -17621,7 +17729,7 @@ function fromJsonSchemaDocument$1(document, options) {
17621
17729
  definitions: document.definitions
17622
17730
  }, options, true)[0];
17623
17731
  }
17624
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/SchemaRepresentation.js
17732
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/SchemaRepresentation.js
17625
17733
  const makeReviverFilter = (id, payloadSchema, revive) => ({
17626
17734
  id,
17627
17735
  payloadSchema,
@@ -17777,8 +17885,8 @@ function makeValueSchema(type, value) {
17777
17885
  type: tag(type),
17778
17886
  value
17779
17887
  }), {
17780
- decode: transform$4((encoded) => encoded.value),
17781
- encode: transform$4((value) => ({
17888
+ decode: transform$3((encoded) => encoded.value),
17889
+ encode: transform$3((value) => ({
17782
17890
  type,
17783
17891
  value
17784
17892
  }))
@@ -18109,7 +18217,7 @@ const connect = fnUntraced(function* (entry, id, runFork) {
18109
18217
  client.close = () => closing ??= close();
18110
18218
  const logError = (error) => runFork(logDebug("MCP client error", error.message).pipe(annotateLogs({ server: entry.name })));
18111
18219
  client.onerror = logError;
18112
- yield* addFinalizer(() => promise(() => client.close().catch(() => void 0)));
18220
+ yield* addFinalizer$1(() => promise(() => client.close().catch(() => void 0)));
18113
18221
  const connectTimeout = fromInputUnsafe$1(entry.connectTimeout ?? defaultConnectTimeout);
18114
18222
  const timeout = toMillis(connectTimeout);
18115
18223
  const listed = yield* tryPromise({
@@ -18429,11 +18537,11 @@ const stripWrappingCodeFence = (script) => {
18429
18537
  const newLine = script.includes("\r\n") ? "\r\n" : "\n";
18430
18538
  return lines.slice(firstNonEmpty + 1, lastNonEmpty).join(newLine);
18431
18539
  };
18432
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Random.js
18540
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Random.js
18433
18541
  const Random = Random$1;
18434
18542
  const randomWith = (f) => withFiber((fiber) => succeed$1(f(fiber.getRef(Random))));
18435
18543
  const next = randomWith((r) => r.nextDoubleUnsafe());
18436
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/IdGenerator.js
18544
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/IdGenerator.js
18437
18545
  var IdGenerator = class extends Service()("@effect/ai/IdGenerator") {};
18438
18546
  const DEFAULT_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
18439
18547
  const DEFAULT_SEPARATOR = "_";
@@ -18452,7 +18560,7 @@ const makeGenerator = ({ alphabet = DEFAULT_ALPHABET, prefix, separator = DEFAUL
18452
18560
  });
18453
18561
  };
18454
18562
  const defaultIdGenerator = { generateId: makeGenerator({ prefix: "id" }) };
18455
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/internal/structured-output.js
18563
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/internal/structured-output.js
18456
18564
  const REST_PROPERTY_NAME = "__rest__";
18457
18565
  const TAIL_PROPERTY_PREFIX = "__tail_";
18458
18566
  const RECORD_DESCRIPTION = "Object encoded as array of [key, value] pairs. Apply object constraints to the decoded object";
@@ -18465,10 +18573,17 @@ function resolveReference($ref, definitions) {
18465
18573
  return definitions[key];
18466
18574
  }
18467
18575
  function resolveTopLevelReference(document) {
18468
- if (typeof document.schema.$ref !== "string") return document;
18576
+ let schema = document.schema;
18577
+ if (typeof schema.$ref !== "string") return document;
18578
+ const visited = new Set();
18579
+ while (typeof schema.$ref === "string") {
18580
+ if (visited.has(schema.$ref)) throw new Error(`Circular reference ${JSON.stringify(schema.$ref)}`);
18581
+ visited.add(schema.$ref);
18582
+ schema = resolveReference(schema.$ref, document.definitions);
18583
+ }
18469
18584
  return {
18470
18585
  ...document,
18471
- schema: resolveReference(document.schema.$ref, document.definitions)
18586
+ schema
18472
18587
  };
18473
18588
  }
18474
18589
  function toCodec(schema) {
@@ -18538,7 +18653,7 @@ function tupleToObject(ast, recur) {
18538
18653
  for (let index = 1; index < ast.rest.length; index++) propertySignatures.push(new PropertySignature(`${TAIL_PROPERTY_PREFIX}${index - 1}__`, ast.rest[index]));
18539
18654
  }
18540
18655
  const from = recur(new Objects(propertySignatures, [], structuralAnnotations(ast, ast.rest.length > 1 ? TUPLE_TAIL_DESCRIPTION : TUPLE_DESCRIPTION), compilerChecks(ast.checks)));
18541
- return decodeTo(from, ast, transform$3({
18656
+ return decodeTo(from, ast, transform$2({
18542
18657
  decode: (object) => {
18543
18658
  const tuple = [];
18544
18659
  for (let index = 0; index < ast.elements.length; index++) {
@@ -18570,7 +18685,7 @@ function objectToEntries(ast, recur) {
18570
18685
  const key = unionOrSingle([...ast.propertySignatures.map((propertySignature) => new Literal$1(propertySignature.name)), ...ast.indexSignatures.map((indexSignature) => indexSignature.parameter)]);
18571
18686
  const value = unionOrSingle([...ast.propertySignatures.map((propertySignature) => propertySignature.type), ...ast.indexSignatures.map((indexSignature) => indexSignature.type)]);
18572
18687
  const from = recur(new Arrays(false, [], [new Arrays(false, [key, value], [])], structuralAnnotations(ast, RECORD_DESCRIPTION), checks));
18573
- return decodeTo(from, ast, transform$3({
18688
+ return decodeTo(from, ast, transform$2({
18574
18689
  decode: Object.fromEntries,
18575
18690
  encode: Object.entries
18576
18691
  }));
@@ -18605,7 +18720,7 @@ function compilerAnnotations(annotations) {
18605
18720
  };
18606
18721
  }
18607
18722
  function optionalToNullable(type) {
18608
- return decodeTo(new Union$1([type, null_]), optionalKey$1(type), transformOptional$1({
18723
+ return decodeTo(new Union$1([type, null_]), optionalKey$1(toType$1(type)), transformOptional$1({
18609
18724
  decode: filter$1(isNotNull),
18610
18725
  encode: orElseSome(() => null)
18611
18726
  }));
@@ -18700,7 +18815,7 @@ function appendDescription(schema, description) {
18700
18815
  function isJsonSchema(input) {
18701
18816
  return typeof input === "object" && input !== null && !Array.isArray(input);
18702
18817
  }
18703
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/internal/codec-transformer.js
18818
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/internal/codec-transformer.js
18704
18819
  const makeDefaultCodecTransformer = (toJsonSchemaDocument) => {
18705
18820
  return (codec) => {
18706
18821
  const document = resolveTopLevelReference(toJsonSchemaDocument(codec));
@@ -18713,15 +18828,17 @@ const makeDefaultCodecTransformer = (toJsonSchemaDocument) => {
18713
18828
  };
18714
18829
  };
18715
18830
  const defaultCodecTransformer$1 = makeDefaultCodecTransformer(toJsonSchemaDocument);
18716
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/Response.js
18831
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Response.js
18717
18832
  const PartTypeId = "~effect/ai/Response/Part";
18718
18833
  const toolPartSchemaCache = new WeakMap();
18719
18834
  const toolPartSchemas = (tool) => {
18720
18835
  let parts = toolPartSchemaCache.get(tool);
18721
18836
  if (parts === void 0) {
18837
+ const hasProviderResults = isProviderDefined(tool) && !tool.requiresHandler;
18838
+ const failure = failureResultSchema(tool);
18722
18839
  parts = {
18723
18840
  toolCall: ToolCallPart(tool.name, tool.parametersSchema),
18724
- toolResult: ToolResultPart(tool.name, tool.successSchema, failureResultSchema(tool))
18841
+ toolResult: hasProviderResults ? ToolResultPart(tool.name, tool.successSchema, failure) : ToolResultPart(tool.name, toCodecJson(tool.successSchema), toCodecJson(failure))
18725
18842
  };
18726
18843
  toolPartSchemaCache.set(tool, parts);
18727
18844
  }
@@ -18871,7 +18988,7 @@ const makeToolResultPart = (name, success, failure) => {
18871
18988
  metadata: optional$2(ProviderMetadata),
18872
18989
  preliminary: optional$2(Boolean$4)
18873
18990
  });
18874
- return Decoded.pipe(encodeTo(Encoded, transform$3({
18991
+ return Decoded.pipe(encodeTo(Encoded, transform$2({
18875
18992
  decode: (encoded) => ({
18876
18993
  ...encoded,
18877
18994
  [PartTypeId]: PartTypeId,
@@ -18957,7 +19074,7 @@ const ErrorPart = Struct({
18957
19074
  type: tag("error"),
18958
19075
  error: Unknown
18959
19076
  }).annotate({ identifier: "ErrorPart" });
18960
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/ResponseIdTracker.js
19077
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/ResponseIdTracker.js
18961
19078
  var ResponseIdTracker = class extends Service()("effect/ai/ResponseIdTracker") {};
18962
19079
  const make$10 = sync(() => {
18963
19080
  const sentParts = new Map();
@@ -19002,7 +19119,7 @@ const make$10 = sync(() => {
19002
19119
  }
19003
19120
  };
19004
19121
  });
19005
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/Telemetry.js
19122
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/Telemetry.js
19006
19123
  const addSpanAttributes = (keyPrefix, transformKey) => (span, attributes) => {
19007
19124
  for (const [key, value] of Object.entries(attributes)) if (isNotNullish(value)) span.attribute(`${keyPrefix}.${transformKey(key)}`, value);
19008
19125
  };
@@ -19021,7 +19138,7 @@ const addGenAIAnnotations$2 = dual(2, (span, options) => {
19021
19138
  if (isNotNullish(options.usage)) addSpanUsageAttributes(span, options.usage);
19022
19139
  });
19023
19140
  var CurrentSpanTransformer = class extends Service()("effect/ai/Telemetry/CurrentSpanTransformer") {};
19024
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/LanguageModel.js
19141
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/LanguageModel.js
19025
19142
  const LanguageModel = Service("effect/ai/LanguageModel");
19026
19143
  const TypeId$3 = "~effect/ai/LanguageModel";
19027
19144
  const defaultCodecTransformer = defaultCodecTransformer$1;
@@ -19277,7 +19394,7 @@ const make$9 = fnUntraced(function* (params) {
19277
19394
  const content = yield* decodeContent(rawContent);
19278
19395
  yield* validateProviderExecutedToolCalls(toolkit, rawContent);
19279
19396
  const incompleteFinishReason = findIncompleteFinishReason(rawContent);
19280
- const toolResults = incompleteFinishReason !== void 0 ? rawContent.filter((part) => part.type === "tool-call" && part.providerExecuted !== true && toolkit.tools[part.name] !== void 0).map((part) => makeInterruptedToolResult(part, incompleteFinishReason)) : yield* resolveToolCalls(rawContent, toolkit, providerOptions.prompt.content, concurrency).pipe(filter$2((result) => result.type === "tool-approval-request" || result.preliminary === false), runCollect);
19397
+ const toolResults = incompleteFinishReason !== void 0 ? rawContent.filter((part) => part.type === "tool-call" && part.providerExecuted !== true && resolvableTool(toolkit, part.name) !== void 0).map((part) => makeInterruptedToolResult(part, incompleteFinishReason)) : yield* resolveToolCalls(rawContent, toolkit, providerOptions.prompt.content, concurrency).pipe(filter$2((result) => result.type === "tool-approval-request" || result.preliminary === false), runCollect);
19281
19398
  if (tracker) {
19282
19399
  const responseMetadata = content.find((part) => part.type === "response-metadata");
19283
19400
  if (isNotUndefined(responseMetadata) && isNotUndefined(responseMetadata.id)) tracker.markParts(providerOptions.prompt.content, responseMetadata.id);
@@ -19404,7 +19521,7 @@ const make$9 = fnUntraced(function* (params) {
19404
19521
  const pendingToolCalls = new Map();
19405
19522
  const bufferedToolCalls = [];
19406
19523
  const handleToolCall = fnUntraced(function* (part) {
19407
- const tool = toolkit.tools[part.name];
19524
+ const tool = resolvableTool(toolkit, part.name);
19408
19525
  if (!tool) return;
19409
19526
  if (yield* isApprovalNeeded(tool, part, providerOptions.prompt.content)) {
19410
19527
  const approvalId = yield* (yield* IdGenerator).generateId();
@@ -19452,7 +19569,7 @@ const make$9 = fnUntraced(function* (params) {
19452
19569
  if (immediateParts.length > 0) yield* offerAll(queue, immediateParts);
19453
19570
  if (findIncompleteFinishReason(deferredFinishParts) === void 0) yield* forkBufferedToolCalls;
19454
19571
  for (const part of chunk) if (part.type === "tool-call" && part.providerExecuted !== true) {
19455
- if (toolkit.tools[part.name] !== void 0) pendingToolCalls.set(part.id, part.name);
19572
+ if (resolvableTool(toolkit, part.name) !== void 0) pendingToolCalls.set(part.id, part.name);
19456
19573
  bufferedToolCalls.push(part);
19457
19574
  }
19458
19575
  })), andThen(suspend(() => {
@@ -19546,7 +19663,7 @@ const stripResolvedApprovals = (prompt, approved, denied) => {
19546
19663
  const isApprovalNeeded = fnUntraced(function* (tool, toolCall, messages) {
19547
19664
  if (isUndefined(tool.needsApproval)) return false;
19548
19665
  if (typeof tool.needsApproval === "function") {
19549
- const params = yield* decodeUnknownEffect$1(tool.parametersSchema)(toolCall.params);
19666
+ const params = yield* decodeUnknownEffect$1(toCodecJson(tool.parametersSchema))(toolCall.params);
19550
19667
  const result = tool.needsApproval(params, {
19551
19668
  toolCallId: toolCall.id,
19552
19669
  messages
@@ -19628,6 +19745,10 @@ const makeInterruptedToolResult = (toolCall, finishReason) => {
19628
19745
  });
19629
19746
  };
19630
19747
  const modelOutputField = (modelOutput) => modelOutput === void 0 ? void 0 : { modelOutput };
19748
+ const resolvableTool = (toolkit, name) => {
19749
+ const tool = toolkit.tools[name];
19750
+ return tool === void 0 || isClientExecuted(tool) ? void 0 : tool;
19751
+ };
19631
19752
  const resolveToolCalls = (content, toolkit, messages, concurrency) => {
19632
19753
  const toolCalls = [];
19633
19754
  for (const part of content) if (part.type === "tool-call") {
@@ -19638,7 +19759,7 @@ const resolveToolCalls = (content, toolkit, messages, concurrency) => {
19638
19759
  const approvedToolCallIds = new Set(approved.map((approval) => approval.toolCallId));
19639
19760
  const deniedByToolCallId = new Map(denied.map((denial) => [denial.toolCallId, denial]));
19640
19761
  const streams = toolCalls.map((toolCall) => gen(function* () {
19641
- const tool = toolkit.tools[toolCall.name];
19762
+ const tool = resolvableTool(toolkit, toolCall.name);
19642
19763
  if (!tool) return empty$11;
19643
19764
  if (deniedByToolCallId.has(toolCall.id)) {
19644
19765
  const denial = deniedByToolCallId.get(toolCall.id);
@@ -19688,11 +19809,12 @@ const resolveToolCalls = (content, toolkit, messages, concurrency) => {
19688
19809
  }).pipe(unwrap$6));
19689
19810
  return mergeAll$1(streams, { concurrency });
19690
19811
  };
19812
+ const hasProviderParameters = (tool) => isProviderDefined(tool) && !tool.requiresHandler;
19691
19813
  const makeResponseDecoder = (make) => {
19692
19814
  let cached;
19693
19815
  return (toolkit, encoded, deferred) => {
19694
19816
  const key = [encoded, deferred];
19695
- for (const tool of Object.values(toolkit.tools)) key.push(tool.name, tool.parametersSchema, tool.successSchema, tool.failureSchema);
19817
+ for (const tool of Object.values(toolkit.tools)) key.push(tool.name, hasProviderParameters(tool), tool.parametersSchema, tool.successSchema, tool.failureSchema);
19696
19818
  if (cached !== void 0 && cached.key.length === key.length && cached.key.every((part, i) => part === key[i])) return cached.decode;
19697
19819
  const decode = make(encoded ? makeToolkitWithEncodedParameters(toolkit) : makeToolkitWithOpaqueParameters(toolkit), deferred);
19698
19820
  cached = {
@@ -19709,7 +19831,7 @@ const withParameterMode = (tool, mode) => {
19709
19831
  tools = {};
19710
19832
  parameterModeTools.set(tool, tools);
19711
19833
  }
19712
- return tools[mode] ??= tool.setParameters(mode === "encoded" ? toEncoded$1(tool.parametersSchema) : Unknown);
19834
+ return tools[mode] ??= tool.setParameters(mode === "opaque" ? Unknown : hasProviderParameters(tool) ? toEncoded$1(tool.parametersSchema) : toEncoded$1(toCodecJson(tool.parametersSchema)));
19713
19835
  };
19714
19836
  const makeToolkitWithEncodedParameters = (toolkit) => make$16(...Object.values(toolkit.tools).map((tool) => withParameterMode(tool, "encoded")));
19715
19837
  const makeToolkitWithOpaqueParameters = (toolkit) => make$16(...Object.values(toolkit.tools).map((tool) => withParameterMode(tool, "opaque")));
@@ -21021,7 +21143,7 @@ const incompleteResponseError = (description) => make$47({
21021
21143
  method: "send",
21022
21144
  reason: new InternalProviderError({ description })
21023
21145
  });
21024
- const retryPolicy = min([exponential(100, 1.5), spaced(5e3)]).pipe(jittered);
21146
+ const retryPolicy = min([exponential(100, 1.5), spaced({ minutes: 5 })]).pipe(jittered);
21025
21147
  const environmentUpdateOpen = "<environment-update>";
21026
21148
  const environmentUpdateMessage = (text) => make$20([{
21027
21149
  role: "user",
@@ -21403,7 +21525,7 @@ const make$7 = fnUntraced(function* (options) {
21403
21525
  const store = toSchemaStore(prefix(kvs, "session-"), SessionRecord);
21404
21526
  const scope$3 = yield* scope;
21405
21527
  const sessions = new Map();
21406
- yield* addFinalizer(() => {
21528
+ yield* addFinalizer$1(() => {
21407
21529
  const running = Array.from(sessions.values()).filter((session) => session.running !== void 0).map((session) => session.id);
21408
21530
  return running.length === 0 ? void_ : logWarning("ACP server stopping with prompts in progress").pipe(annotateLogs({ sessions: running.join(", ") }));
21409
21531
  });
@@ -22058,7 +22180,7 @@ const expandEntry = fnUntraced(function* (raw) {
22058
22180
  for (const field of expandedFields) if (field in entry) entry[field] = yield* expandStrings(entry[field]);
22059
22181
  return entry;
22060
22182
  });
22061
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/encoding/Sse.js
22183
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/encoding/Sse.js
22062
22184
  const SseErrorTypeId = "~effect/encoding/Sse/SseError";
22063
22185
  var EventTooLarge = class extends TaggedError("EventTooLarge") {
22064
22186
  get message() {
@@ -22224,7 +22346,7 @@ var Retry = class Retry extends TaggedClass("Retry") {
22224
22346
  return Retry.is(u) ? succeed$2(u) : fail$2(u);
22225
22347
  }
22226
22348
  };
22227
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/Generated.js
22349
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/Generated.js
22228
22350
  const CompoundFilter = suspend$1(() => __recursive_CompoundFilter);
22229
22351
  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" });
22230
22352
  const ReasoningEffort = Union([Literals$2([
@@ -24698,7 +24820,7 @@ const BetaListInputItemsParams = Struct({
24698
24820
  "openai-beta": optionalKey(ArraySchema(Literal("responses_multi_agent=v1")))
24699
24821
  });
24700
24822
  var OpenAiClientErrorImpl = class extends Error$1 {};
24701
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/internal/errors.js
24823
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/internal/errors.js
24702
24824
  const OpenAiErrorBody$1 = Struct({ error: Struct({
24703
24825
  message: String$7,
24704
24826
  type: optional$2(NullOr(String$7)),
@@ -24882,11 +25004,11 @@ const mapStatusCodeToReason$1 = ({ status, method, url, headers, message, metada
24882
25004
  });
24883
25005
  }
24884
25006
  };
24885
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiConfig.js
25007
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiConfig.js
24886
25008
  var OpenAiConfig$1 = class OpenAiConfig$1 extends Service()("@effect/ai-openai/OpenAiConfig") {
24887
25009
  static getOrUndefined = map$5(context(), getOrUndefined$1(OpenAiConfig$1));
24888
25010
  };
24889
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiSchema.js
25011
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiSchema.js
24890
25012
  const UnknownRecord = Record(String$7, Unknown);
24891
25013
  const JsonObject = Record(String$7, Unknown);
24892
25014
  const MessageRole = Literals$2([
@@ -25013,6 +25135,7 @@ const OutputMessage = Struct({
25013
25135
  type: Literal("message"),
25014
25136
  role: Literal("assistant"),
25015
25137
  content: ArraySchema(OutputMessageContent),
25138
+ phase: optionalKey(NullOr(Literals$2(["commentary", "final_answer"]))),
25016
25139
  status: MessageStatus
25017
25140
  });
25018
25141
  const ReasoningItem = Struct({
@@ -25552,7 +25675,7 @@ const NestedResponseErrorEvent = Struct({
25552
25675
  }),
25553
25676
  sequence_number: optionalKey(Int$5),
25554
25677
  status: optionalKey(Int$5)
25555
- }).pipe(decodeTo$1(ResponseErrorEvent, transform$3({
25678
+ }).pipe(decodeTo$1(ResponseErrorEvent, transform$2({
25556
25679
  decode: ({ error, ...rest }) => ({
25557
25680
  ...rest,
25558
25681
  ...error
@@ -25719,14 +25842,14 @@ const CreateDecisionsResponse = Struct({
25719
25842
  output_tokens: optionalKey(Int$5)
25720
25843
  }))
25721
25844
  });
25722
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiClient.js
25845
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiClient.js
25723
25846
  const decodeResponseStreamEvent = decodeUnknownEffect$1(fromJsonString(ResponseStreamEvent));
25724
25847
  var OpenAiClient$1 = class extends Service()("@effect/ai-openai/OpenAiClient") {};
25725
25848
  const RedactedOpenAiHeaders$1 = {
25726
25849
  OpenAiOrganization: "OpenAI-Organization",
25727
25850
  OpenAiProject: "OpenAI-Project"
25728
25851
  };
25729
- const withRedactedHeaders$1 = updateService(CurrentRedactedNames, appendAll(Object.values(RedactedOpenAiHeaders$1)));
25852
+ const withRedactedHeaders$1 = updateService(CurrentRedactedNames$1, appendAll(Object.values(RedactedOpenAiHeaders$1)));
25730
25853
  const make$6 = fnUntraced(function* (options) {
25731
25854
  const baseClient = yield* HttpClient;
25732
25855
  const apiUrl = options.apiUrl ?? "https://api.openai.com/v1";
@@ -25897,7 +26020,7 @@ const errorTypeToStatus = {
25897
26020
  const AllEvents = Union([ErrorEvent, ResponseStreamEvent]);
25898
26021
  const decodeEvent = decodeUnknownSync(fromJsonString(AllEvents));
25899
26022
  const layerWebSocketMode = effectContext(makeSocket);
25900
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/RequestResolver.js
26023
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/RequestResolver.js
25901
26024
  const TypeId$1 = "~effect/RequestResolver";
25902
26025
  const RequestResolverProto = {
25903
26026
  [TypeId$1]: {
@@ -25965,7 +26088,7 @@ const withSpan = dual((args) => isRequestResolver(args[0]), (self, name, options
25965
26088
  });
25966
26089
  })
25967
26090
  }));
25968
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/EmbeddingModel.js
26091
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/EmbeddingModel.js
25969
26092
  const EmbeddingModel = Service("effect/ai/EmbeddingModel");
25970
26093
  const TypeId = "~effect/ai/EmbeddingModel";
25971
26094
  var Dimensions = class extends Service()("effect/ai/EmbeddingModel/Dimensions") {};
@@ -26010,7 +26133,7 @@ const mapProviderResults = (inputLength, results) => {
26010
26133
  }
26011
26134
  return succeed$1(embeddings);
26012
26135
  };
26013
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiEmbeddingModel.js
26136
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiEmbeddingModel.js
26014
26137
  var Config$2 = class extends Service()("@effect/ai-openai/OpenAiEmbeddingModel/Config") {};
26015
26138
  const model$5 = (model, options) => make$18("openai", model, merge$2(layer$3({
26016
26139
  model,
@@ -26061,7 +26184,7 @@ const invalidOutput = (description) => make$47({
26061
26184
  method: "embedMany",
26062
26185
  reason: new InvalidOutputError({ description })
26063
26186
  });
26064
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ai/OpenAiStructuredOutput.js
26187
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/ai/OpenAiStructuredOutput.js
26065
26188
  function toCodecOpenAI(schema) {
26066
26189
  const codec = toCodec(schema);
26067
26190
  const document = resolveTopLevelReference(toJsonSchemaDocument(codec, {
@@ -26268,7 +26391,7 @@ const formats = new Set([
26268
26391
  "ipv6",
26269
26392
  "uuid"
26270
26393
  ]);
26271
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/internal/utilities.js
26394
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/internal/utilities.js
26272
26395
  const finishReasonMap$1 = {
26273
26396
  content_filter: "content-filter",
26274
26397
  function_call: "tool-calls",
@@ -26284,7 +26407,7 @@ const resolveFinishReason$1 = (finishReason, hasToolCalls) => {
26284
26407
  if (reason == null) return hasToolCalls ? "tool-calls" : "unknown";
26285
26408
  return reason;
26286
26409
  };
26287
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiTelemetry.js
26410
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiTelemetry.js
26288
26411
  const addOpenAiRequestAttributes$1 = addSpanAttributes("openai.request", camelToSnake);
26289
26412
  const addOpenAiResponseAttributes$1 = addSpanAttributes("openai.response", camelToSnake);
26290
26413
  const addGenAIAnnotations$1 = dual(2, (span, options) => {
@@ -26294,7 +26417,7 @@ const addGenAIAnnotations$1 = dual(2, (span, options) => {
26294
26417
  if (options.openai.response != null) addOpenAiResponseAttributes$1(span, options.openai.response);
26295
26418
  }
26296
26419
  });
26297
- // node_modules/.pnpm/@effect+ai-openai@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai/dist/OpenAiLanguageModel.js
26420
+ // node_modules/.pnpm/@effect+ai-openai@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai/dist/OpenAiLanguageModel.js
26298
26421
  ModelIdsResponses.members[1];
26299
26422
  ModelIdsShared.members[1];
26300
26423
  var Config$1 = class extends Service()("@effect/ai-openai/OpenAiLanguageModel/Config") {};
@@ -26331,10 +26454,10 @@ const make$3 = fnUntraced(function* ({ model, config: providerConfig }) {
26331
26454
  ...apiConfig,
26332
26455
  input: messages,
26333
26456
  include: include.size > 0 ? Array.from(include) : void 0,
26334
- text: {
26335
- verbosity: config.text?.verbosity ?? void 0,
26457
+ text: responseFormat !== void 0 || config.text?.verbosity !== void 0 ? {
26458
+ verbosity: config.text?.verbosity,
26336
26459
  format: responseFormat
26337
- }
26460
+ } : void 0
26338
26461
  };
26339
26462
  if (tools) request.tools = tools;
26340
26463
  if (toolChoice) request.tool_choice = toolChoice;
@@ -26515,6 +26638,8 @@ const prepareMessages$1 = fnUntraced(function* ({ config, options, isReasoningMo
26515
26638
  const id = getItemId(part);
26516
26639
  const status = getStatus(part);
26517
26640
  if (hasConversation && isNotNull(id)) break;
26641
+ const result = part.providerExecuted ? providerExecutedParts.find((candidate) => candidate.type === "tool-result" && candidate.id === part.id && candidate.name === part.name) : void 0;
26642
+ if (useItemReferences && isNotUndefined(result)) break;
26518
26643
  if (useItemReferences && isNotNull(id)) {
26519
26644
  messages.push({
26520
26645
  type: "item_reference",
@@ -26524,8 +26649,7 @@ const prepareMessages$1 = fnUntraced(function* ({ config, options, isReasoningMo
26524
26649
  }
26525
26650
  if (part.providerExecuted) {
26526
26651
  if (config.store !== true && options.incrementalFallback !== true) break;
26527
- const result = providerExecutedParts.find((candidate) => candidate.type === "tool-result" && candidate.id === part.id && candidate.name === part.name);
26528
- if (isUndefined(result) || result.type !== "tool-result") return yield* unreplayableProviderItem(part.name, part.id);
26652
+ if (isUndefined(result)) return yield* unreplayableProviderItem(part.name, part.id);
26529
26653
  if (hasProperty(result.result, "type") && result.result.type === "execution-denied") break;
26530
26654
  const itemId = getItemId(part) ?? getItemId(result) ?? part.id;
26531
26655
  switch (part.name) {
@@ -26671,7 +26795,7 @@ const prepareMessages$1 = fnUntraced(function* ({ config, options, isReasoningMo
26671
26795
  id,
26672
26796
  type: "shell_call_output",
26673
26797
  call_id: part.id,
26674
- output: part.result,
26798
+ output: getShellOutput(part),
26675
26799
  ...isNotNull(status) ? { status } : {}
26676
26800
  });
26677
26801
  continue;
@@ -26681,7 +26805,7 @@ const prepareMessages$1 = fnUntraced(function* ({ config, options, isReasoningMo
26681
26805
  id,
26682
26806
  type: "local_shell_call_output",
26683
26807
  call_id: part.id,
26684
- output: part.result,
26808
+ output: getShellOutput(part),
26685
26809
  ...isNotNull(status) ? { status } : {}
26686
26810
  });
26687
26811
  continue;
@@ -26912,6 +27036,7 @@ const makeResponse$1 = fnUntraced(function* ({ options, rawResponse, response, t
26912
27036
  break;
26913
27037
  }
26914
27038
  case "message":
27039
+ if (options.responseFormat.type === "json" && part.phase === "commentary") break;
26915
27040
  for (const contentPart of part.content) switch (contentPart.type) {
26916
27041
  case "output_text": {
26917
27042
  const annotations = contentPart.annotations.length > 0 ? { annotations: contentPart.annotations } : void 0;
@@ -27276,7 +27401,7 @@ const makeStreamResponse$1 = fnUntraced(function* ({ stream, response, config, o
27276
27401
  case "shell_call": {
27277
27402
  const toolName = toolNameMapper.getCustomName("shell");
27278
27403
  activeToolCalls[event.output_index] = {
27279
- id: event.item.id ?? event.item.call_id,
27404
+ id: event.item.call_id,
27280
27405
  name: toolName
27281
27406
  };
27282
27407
  break;
@@ -27552,7 +27677,7 @@ const makeStreamResponse$1 = fnUntraced(function* ({ stream, response, config, o
27552
27677
  const toolName = toolNameMapper.getCustomName("shell");
27553
27678
  parts.push({
27554
27679
  type: "tool-call",
27555
- id: event.item.id ?? event.item.call_id,
27680
+ id: event.item.call_id,
27556
27681
  name: toolName,
27557
27682
  params: { action: event.item.action },
27558
27683
  metadata: { openai: makeItemIdMetadata$1(event.item.id) }
@@ -28059,6 +28184,7 @@ const isFileId$1 = (data, config) => config.fileIdPrefixes != null && config.fil
28059
28184
  const getItemId = (part) => part.options.openai?.itemId ?? null;
28060
28185
  const getStatus = (part) => part.options.openai?.status ?? null;
28061
28186
  const getEncryptedContent = (part) => part.options.openai?.encryptedContent ?? null;
28187
+ const getShellOutput = (part) => part.isFailure ? part.result : part.result.output;
28062
28188
  const getImageDetail$1 = (part) => part.options.openai?.imageDetail ?? "auto";
28063
28189
  const getPromptCacheBreakpoint = (input) => {
28064
28190
  const promptCacheBreakpoint = input.options.openai?.promptCacheBreakpoint;
@@ -28097,7 +28223,6 @@ const prepareResponseFormat$1 = fnUntraced(function* ({ config, options }) {
28097
28223
  strict: config.strictJsonSchema ?? true
28098
28224
  };
28099
28225
  }
28100
- return { type: "text" };
28101
28226
  });
28102
28227
  const nonReasoningModelPattern = /^(?:gpt-[34]|chatgpt-|chat-latest|gpt-\d+(?:\.\d+)?-chat)/;
28103
28228
  const resolveReasoningModel = (config) => {
@@ -28205,10 +28330,10 @@ const transformToolCallParams$1 = fnUntraced(function* (options, toolName, toolP
28205
28330
  }
28206
28331
  if (isDynamic(tool) && tool.jsonSchema !== void 0) return toolParams;
28207
28332
  const { codec } = yield* tryCodecTransform$1(tool.parametersSchema, "makeResponse");
28208
- return yield* decodeEffect(codec)(toolParams).pipe(flatMap$1((decoded) => encodeUnknownEffect(tool.parametersSchema)(decoded)), orElseSucceed(() => toolParams));
28333
+ return yield* decodeEffect(codec)(toolParams).pipe(flatMap$1((decoded) => encodeUnknownEffect(toCodecJson(tool.parametersSchema))(decoded)), orElseSucceed(() => toolParams));
28209
28334
  });
28210
28335
  // package.json
28211
- var version$1 = "0.24.4";
28336
+ var version$1 = "0.25.0";
28212
28337
  // src/ClaudeAgent.ts
28213
28338
  const minimumClaudeCodeVersion = "2.1.248";
28214
28339
  const serverName = "clanka";
@@ -28574,7 +28699,7 @@ const makeToolBridge = (onCall) => {
28574
28699
  };
28575
28700
  const makeToolServer = (tools, bridge) => tryPromise({
28576
28701
  try: async () => {
28577
- const [{ Server }, { CallToolRequestSchema, ListToolsRequestSchema }] = await Promise.all([import("./server-HlLriZxF.mjs"), import("./types-LcwjLVkt.mjs").then((n) => n.X)]);
28702
+ const [{ Server }, { CallToolRequestSchema, ListToolsRequestSchema }] = await Promise.all([import("./server-D4nrvZHH.mjs"), import("./types-N9Z-HYP0.mjs").then((n) => n.X)]);
28578
28703
  const server = new Server({
28579
28704
  name: serverName,
28580
28705
  version: version$1
@@ -28821,7 +28946,7 @@ const layerLanguageModel = (model, options) => effect(LanguageModel, gen(functio
28821
28946
  current = void 0;
28822
28947
  return session === void 0 ? void_ : closeSession(session);
28823
28948
  });
28824
- yield* addFinalizer(() => closeCurrent);
28949
+ yield* addFinalizer$1(() => closeCurrent);
28825
28950
  let reading = false;
28826
28951
  let started = false;
28827
28952
  const step = (provider) => suspend$3(() => {
@@ -29139,7 +29264,7 @@ const layerModel = (model, options) => suspend$2(() => layer$2({
29139
29264
  ...pick(options ?? {}, AgentModelConfig.optionKeys),
29140
29265
  systemPromptTransform: (system, effect) => withConfigOverride$1(effect, { instructions: system })
29141
29266
  })));
29142
- // node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/internal/errors.js
29267
+ // node_modules/.pnpm/@effect+ai-openai-compat@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai-compat/dist/internal/errors.js
29143
29268
  const OpenAiErrorBody = Struct({ error: Struct({
29144
29269
  message: String$7,
29145
29270
  type: optional$2(NullOr(String$7)),
@@ -29147,7 +29272,7 @@ const OpenAiErrorBody = Struct({ error: Struct({
29147
29272
  param: optional$2(NullOr(String$7)),
29148
29273
  code: optional$2(NullOr(Union([String$7, Finite])))
29149
29274
  }) });
29150
- const OpenAiErrorBodyJson = decodeUnknownOption(fromJsonString(Union([OpenAiErrorBody, NonEmptyArray(OpenAiErrorBody).pipe(decodeTo$1(toType(OpenAiErrorBody), transform$3({
29275
+ const OpenAiErrorBodyJson = decodeUnknownOption(fromJsonString(Union([OpenAiErrorBody, NonEmptyArray(OpenAiErrorBody).pipe(decodeTo$1(toType(OpenAiErrorBody), transform$2({
29151
29276
  decode: headNonEmpty,
29152
29277
  encode: (item) => [item]
29153
29278
  })))])));
@@ -29307,17 +29432,17 @@ const mapStatusCodeToReason = ({ status, method, url, headers, message, metadata
29307
29432
  });
29308
29433
  }
29309
29434
  };
29310
- // node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/OpenAiConfig.js
29435
+ // node_modules/.pnpm/@effect+ai-openai-compat@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai-compat/dist/OpenAiConfig.js
29311
29436
  var OpenAiConfig = class OpenAiConfig extends Service()("@effect/ai-openai-compat/OpenAiConfig") {
29312
29437
  static getOrUndefined = map$5(context(), getOrUndefined$1(OpenAiConfig));
29313
29438
  };
29314
- // node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/OpenAiClient.js
29439
+ // node_modules/.pnpm/@effect+ai-openai-compat@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai-compat/dist/OpenAiClient.js
29315
29440
  var OpenAiClient = class extends Service()("@effect/ai-openai-compat/OpenAiClient") {};
29316
29441
  const RedactedOpenAiHeaders = {
29317
29442
  OpenAiOrganization: "openai-organization",
29318
29443
  OpenAiProject: "openai-project"
29319
29444
  };
29320
- const withRedactedHeaders = updateService(CurrentRedactedNames, appendAll(Object.values(RedactedOpenAiHeaders)));
29445
+ const withRedactedHeaders = updateService(CurrentRedactedNames$1, appendAll(Object.values(RedactedOpenAiHeaders)));
29321
29446
  const make$2 = fnUntraced(function* (options) {
29322
29447
  const httpClient = (yield* HttpClient).pipe(mapRequest((request) => request.pipe(prependUrl(options.apiUrl ?? "https://api.openai.com/v1"), options.apiKey !== void 0 ? bearerToken(value(options.apiKey)) : identity, options.organizationId !== void 0 ? setHeader(RedactedOpenAiHeaders.OpenAiOrganization, value(options.organizationId)) : identity, options.projectId !== void 0 ? setHeader(RedactedOpenAiHeaders.OpenAiProject, value(options.projectId)) : identity, acceptJson)), options.transformClient !== void 0 ? options.transformClient : identity);
29323
29448
  const resolveHttpClient = map$5(OpenAiConfig.getOrUndefined, (config) => config?.transformClient !== void 0 ? config.transformClient(httpClient) : httpClient);
@@ -29450,7 +29575,7 @@ const decodeChatCompletionSseData = (data) => {
29450
29575
  data: parsed
29451
29576
  };
29452
29577
  };
29453
- // node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/internal/utilities.js
29578
+ // node_modules/.pnpm/@effect+ai-openai-compat@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai-compat/dist/internal/utilities.js
29454
29579
  const finishReasonMap = {
29455
29580
  content_filter: "content-filter",
29456
29581
  function_call: "tool-calls",
@@ -29464,7 +29589,7 @@ const resolveFinishReason = (finishReason, hasToolCalls) => {
29464
29589
  if (reason == null) return hasToolCalls ? "tool-calls" : "unknown";
29465
29590
  return reason;
29466
29591
  };
29467
- // node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/OpenAiTelemetry.js
29592
+ // node_modules/.pnpm/@effect+ai-openai-compat@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai-compat/dist/OpenAiTelemetry.js
29468
29593
  const addOpenAiRequestAttributes = addSpanAttributes("openai.request", camelToSnake);
29469
29594
  const addOpenAiResponseAttributes = addSpanAttributes("openai.response", camelToSnake);
29470
29595
  const addGenAIAnnotations = dual(2, (span, options) => {
@@ -29474,7 +29599,7 @@ const addGenAIAnnotations = dual(2, (span, options) => {
29474
29599
  if (options.openai.response != null) addOpenAiResponseAttributes(span, options.openai.response);
29475
29600
  }
29476
29601
  });
29477
- // node_modules/.pnpm/@effect+ai-openai-compat@4.1.1_effect@4.1.1/node_modules/@effect/ai-openai-compat/dist/OpenAiLanguageModel.js
29602
+ // node_modules/.pnpm/@effect+ai-openai-compat@4.1.3_effect@4.1.3/node_modules/@effect/ai-openai-compat/dist/OpenAiLanguageModel.js
29478
29603
  var Config = class extends Service()("@effect/ai-openai-compat/OpenAiLanguageModel/Config") {};
29479
29604
  const make$1 = fnUntraced(function* ({ model, config: providerConfig }) {
29480
29605
  const client = yield* OpenAiClient;
@@ -29981,7 +30106,7 @@ const transformToolCallParams = fnUntraced(function* (options, toolName, toolPar
29981
30106
  }
29982
30107
  if (isDynamic(tool) && tool.jsonSchema !== void 0) return toolParams;
29983
30108
  const codec = toolCodecs.get(tool) ?? (yield* tryCodecTransform(tool.parametersSchema, "makeResponse")).codec;
29984
- return yield* decodeEffect(codec)(toolParams).pipe(flatMap$1((decoded) => encodeUnknownEffect(tool.parametersSchema)(decoded)), orElseSucceed(() => toolParams));
30109
+ return yield* decodeEffect(codec)(toolParams).pipe(flatMap$1((decoded) => encodeUnknownEffect(toCodecJson(tool.parametersSchema))(decoded)), orElseSucceed(() => toolParams));
29985
30110
  });
29986
30111
  const prepareTools = fnUntraced(function* ({ config, options, toolNameMapper }) {
29987
30112
  const toolCodecs = new Map();
@@ -30847,7 +30972,7 @@ const makeAcp = (options) => (modelId, thoughtLevel, fastMode = false) => map$8(
30847
30972
  const info = catalog.find((entry) => entry.provider === provider && entry.id === model);
30848
30973
  return make(provider, model, info?.efforts === void 0 ? thoughtLevel : resolveEffort(info.efforts, thoughtLevel), options.openai, fastMode, options.auxiliary);
30849
30974
  })));
30850
- // node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Logger.js
30975
+ // node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/Logger.js
30851
30976
  const LogToStderr = LogToStderr$1;
30852
30977
  // src/cli.ts
30853
30978
  const ReportedVersion = Setting("reported-version")({ flag: String$1("reported-version").pipe(withDescription$1("Report this version instead of clanka's own, for --version and to ACP clients"), optional) });
@@ -30980,7 +31105,7 @@ const Search = (directory) => unwrap$4(gen(function* () {
30980
31105
  return empty$10;
30981
31106
  }
30982
31107
  const path = yield* Path$3;
30983
- return (yield* promise(() => import("./SemanticSearch-BlcfFvPr.mjs"))).layer({
31108
+ return (yield* promise(() => import("./SemanticSearch-DMzIsoZb.mjs"))).layer({
30984
31109
  directory: process.cwd(),
30985
31110
  database: path.join(directory, "search.sqlite")
30986
31111
  }).pipe(provide$3(model$5("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$4({ apiKey: apiKey.value })));
@@ -31051,7 +31176,7 @@ make$26("clanka", {
31051
31176
  files: mcpConfig,
31052
31177
  enabled: mcp
31053
31178
  });
31054
- const OutputFormatter = yield* promise(() => import("./OutputFormatter-B8yF7iiq.mjs"));
31179
+ const OutputFormatter = yield* promise(() => import("./OutputFormatter-ByMjyBhe.mjs"));
31055
31180
  const { model, effort } = yield* match$2(modelRaw, {
31056
31181
  onSome: (selected) => succeed$1(parseModel(selected)),
31057
31182
  onNone: () => selectModel(provider)