alink-cli 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +297 -29
- package/dist/bin.mjs.map +1 -1
- package/dist/daemon.js +8 -1
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { $ as make$62, A as withLoggerDisabled, At as matchStatus, B as limitsServices, Bt as post$1, C as update$2, Ct as setHeader, D as compression, Dt as uint8Array$1, Et as text$2, F as schemaHeaders, Ft as appendUrlParams, G as CloseEvent, Gt as setUrl, Ht as setBody, I as schemaSearchParams, It as bodyFormData, Jt as HttpClientErrorSchema, K as SocketError, Kt as DecodeError, L as toURL, Lt as bodyJson, M as ParsedSearchParams, O as cors$1, Ot as urlParams$1, P as schemaCookies, Pt as schemaBodyJson, Q as join$1, Rt as get$4, S as set$2, Sn as __commonJSMin, T as appendPreResponseHandler, Tt as stream, Ut as setHeader$1, Vt as prependUrl, Wt as setHeaders, X as makeWebSocket, Xt as isHttpClientError, Y as make$63, Yt as StatusCodeError, Z as awaitEmpty, Zt as empty$2, _ as get$3, _n as fromInput, _t as mergeCookies, a as layer$40, an as CurrentRedactedNames, b as makeUnsafe$3, bn as hasBody, cn as fromRecordUnsafe, d as HttpClient, dn as jsonUnsafe$1, en as set$3, et as run$4, f as TracerPropagationEnabled, g as transformResponse$1, gn as urlParams, gt as jsonUnsafe, h as retryTransient, hn as uint8Array, ht as isHttpServerResponse, j as HttpServerRequest, k as logger, kt as filterStatusOk, l as serve$1, ln as merge, lt as symbol$1, m as mapRequest, mn as text$1, mt as file, o as HttpServer, on as empty$3, ot as RouteNotFound, p as filterStatusOk$1, pt as empty$1, q as SocketErrorReason, qt as HttpClientError, r as Mime_default, rt as HttpServerError, sn as fromInput$1, t as layerWebSocketConstructor, tt as runtime, u as withLogAddress, un as isHttpBody, ut as toResponse, v as getAndSet, vn as schemaRecord, w as updateAndGet, wn as __require, wt as setHeaders$1, x as modify$2, xn as map$3, xt as schemaJson, y as make$60, yn as toRecord, yt as redirect, zt as make$61 } from "./NodeSocket-08w4osAf.mjs";
|
|
4
|
-
import { $ as decodeUnknownExit, $c as combine$1, $d as isNotNull, $i as makeUnsafe$7, $l as fromInput$2, $o as service, $s as taggedEnum, $t as Union$1, $u as empty$5, A as StructWithRest, Ac as die$2, Ad as getStackTraceLimit, Ai as makeUnsafe$5, Al as fnUntraced$1, An as encodeBase64, Ao as never, Ar as mapError$1, As as withTracerEnabled, At as suspend$1, Au as reduce, B as Union, Ba as catch_, Bc as die$1, Bd as NodeInspectSymbol, Bn as now, Bo as provideContext, Br as run$5, Bt as value, C as Number$1, Ca as annotateCurrentSpan, Cc as make$73, Cd as match$1, Ci as fromTransform, Cn as parseJson, Cr as fromSubscription, Cs as void_$1, Ct as isTrimmed, Cu as fromIterable, D as String$1, Da as as, Dc as TracerEnabled, Dd as make$69, Dn as decodeBase64String, Do as matchCauseEffect, Dr as map$8, Dt as mutable, Du as map$5, E as Record, Ea as annotateSpans, Ec as MinimumLogLevel, Ed as Number$2, Ei as pipeTo, Eo as match$2, Er as make$71, Es as withFiber$1, Et as makeFilter, Fa as catchFilter, Fc as isDeferred, Fd as isEffect$1, Fn as isGreaterThan$1, Fo as option, Fs as timer, Ft as toJsonSchemaDocument, Fu as map$7, G as annotateKey, Ga as die, Gc as isSuccess, Gd as equals, Gi as unbounded$2, Gl as Tracer, Gn as InvalidValue$1, Go as retry, Gr as runForEach, Gs as parse$2, Gt as toJsonSchemaMultiDocument, Gu as isFailure$1, H as UnknownFromJsonString$1, Ha as context, Hc as failCause$4, Hd as format, Hi as sliding$1, Hl as MinimumTraceLevel, Hn as toEpochMillis, Ho as raceFirst, Hr as runDrain, Hs as spaced, Ht as toMultiDocumentOpenApi3_1, Hu as failVoid, I as URLFromString, Ia as catchIf, Id as withFiber, Ii as make$75, In as isGreaterThanOrEqualTo$1, Io as orDie, Ir as pipeThroughChannel, Is as update$3, It as toType, J as decodeEffect, Ja as exit, Jc as void_$2, Ji as sliding, Jn as Path, Jo as runPromiseWith, Js as currentTimeMillis, Ju as succeed$2, K as brand, Kc as match$3, Ki as publish, Kl as externalSpan, Ko as runFork, Kr as runForEachArray, Ks as round, Kt as escapeToken, Ku as isSuccess$1, L as Uint8Array$1, La as catchReason, Lc as make$70, Ld as assignProperty, Li as offer$1, Ll as sync$1, Ln as isLessThan$1, Lo as orElseSucceed, Ls as withAttributes, Lt as withConstructorDefault, M as TaggedStruct, Ma as catchCause, Mc as fail$3, Md as Prototype, Mi as end, Mn as encodeHex, Mo as onExit, Ms as zipWith, Mt as toCodecJson, Mu as sort, N as TemplateLiteral, Na as catchDefect, Nc as failCause$2, Nd as PipeInspectableProto, Nn as add$3, Ns as counter, Nt as toCodecJsonAST, O as StringFromUriComponent, Oa as asSome, Oc as TracerTimingEnabled, Oi as splitLines, On as decodeBase64Url, Or as mapArrayEffect, Os as withParentSpan, Ot as optional$3, Ou as match, Pi as failCause$3, Pl as reportCauseUnsafe, Pn as formatIso, Po as onInterrupt, Pr as onExit$1, Ps as snapshotUnsafe, Pt as toCodecStringTree, Q as decodeUnknownEffect, Qa as flatMap$1, Qd as hasProperty, Ql as format$1, Qo as scopedWith, Qs as TaggedError, Qt as isSchemaError, Qu as add$2, R as Undefined, Ra as catchTag, Ri as offerAll, Rl as tracerLogger$1, Rn as make$68, Ro as promise, Rr as provideContext$1, Rs as addDelay, Rt as withDecodingDefault, S as NullOr, Sa as andThen, Sc as forkUnsafe, Sd as map$6, Sl as CurrentLoggers$1, Sn as onSome, So as map$4, Ss as useSpan, St as isSchema, Su as flatMapNullishOr, T as OptionFromNullOr, Ta as annotateLogsScoped, Tc as provide$2, Td as some, Ti as mapEffect$2, Tn as stringifyJson, Tr as isStream, Ts as withErrorReporting, Tt as make$67, Tu as isReadonlyArrayNonEmpty, U as Void, Ua as contextWith, Uc as interrupt$3, Ui as take$1, Ul as NativeSpan, Un as toUtc, Uo as repeat, Ur as runFold, Us as catchDone, Ut as apply, Uu as getOrThrow, V as Unknown, Vc as fail$4, Vd as toJson, Vi as shutdown$1, Vn as toDate, Vo as provideService, Vr as runCollect, Vs as passthrough, Vt as VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP, Vu as fail$1, W as annotate$2, Wa as currentParentSpan, Wc as isFailure, Wi as takeAll, Wl as ParentSpan, Wn as Forbidden$1, Wo as result, Wr as runFoldEffect, Ws as isDoneCause, Wt as toRepresentations, Wu as getOrUndefined$2, X as decodeSync, Xa as failCause$1, Xc as NoSuchElementError, Xi as unbounded$1, Xn as FileSystem, Xo as scope, Xr as takeWhile, Xu as Reference, Y as decodeExit, Ya as fail, Yi as subscribe, Ys as currentTimeNanos, Z as decodeTo, Za as filterOrFail, Zc as StackTrace, Zd as compose$1, Zl as days, Zo as scoped, Zr as toAsyncIterable, Zs as TaggedClass, Zt as SchemaError, Zu as Service$2, _a as Transaction, _c as Scope, _d as getOrElse, _f as pipe, _l as pretty, _n as Transformation, _o as logError, _s as tx, _t as isMaxLength, _u as filter$1, a as Class, aa as runIn, ac as effectDiscard, ad as make$65, an as isLiteral, ao as forkChild, ar as debounce, as as suspend, at as encodeUnknownExit, au as max, b as NonEmptyString, ba as addFinalizer, bc as close, bd as isNone, bi as decodeText$1, bn as transformOrFail, bo as logWarning$1, br as fromPubSub, bt as isNonEmpty, bu as findFirstIndex, c as Defect, ca as empty$6, cc as launch, cd as omit, cf as compose, ci as invalidate, cl as hasInterruptsOnly, cn as isOptional, co as fromResult, cr as drain, cs as tapCause, ct as instanceOf, cu as nanos, d as ErrorClass, da as size$2, dc as provideMerge, dd as filter, df as constUndefined, dl as isCause, dn as isVoid, do as ignoreCause, ds as tapErrorTag, dt as isFinite, ea as await_, ec as CurrentMemoMap, ed as get$5, ef as isNotUndefined, eo as flatten$1, et as decodeUnknownOption, eu as fromInputUnsafe, f as Exit, fa as toArray, fc as succeed$3, fd as firstSomeOf, ff as constVoid, fl as isFailReason, fn as resolveAt, fo as interrupt$1, fr as fail$5, fs as timeout, ft as isGreaterThan, fu as zero, g as Literals, gc as unwrap, gd as fromUndefinedOr, gf as identity, gi as forEach$1, gl as map$9, go as logDebug, gr as fromAsyncIterable, gs as try_, gt as isLessThanOrEqualTo, gu as ensure, h as Literal, hc as tap$1, hd as fromNullishOr, hi as drain$1, hn as toEncoded, ho as log$1, hr as flatMap$2, hs as tryPromise, ht as isLessThan, hu as empty$4, i as Cause, ia as join$2, ic as effectContext, id as getUnsafe$1, if as isTagged, il as findErrorOption, in as isDeclaration, io as forever, ir as concat, is as succeedSome, it as encodeUnknownEffect, j as TaggedErrorClass, ja as callback, jd as setStackTraceLimit, ji as bounded, jn as encodeBase64Url, jo as onError, jr as merge$2, js as yieldNow, jt as tag, ju as reverse, k as Struct, ka as asVoid, kc as _await, ki as make$72, kn as decodeBase64UrlString, ko as matchEffect, kr as mapEffect$1, ks as withSpan, kt as optionalKey, l as Duration, la as head, lc as mergeAll, ld as contains, lf as constFalse, li as make$66, ll as interrupt$2, ln as isSuspend, lo as gen, lr as empty$7, ls as tapDefect, lt as is, lu as seconds, m as Int, ma as PlatformError, mc as sync$2, md as flatten, mf as dual, mn as resolveIdentifier, mo as isEffect, mr as filter$2, mt as isInt, n as ArraySchema, na as interrupt$4, nc as buildWithMemoMap, nd as getOrElse$1, nf as isObject$1, ni as unwrap$1, nl as fail$2, nn as getAST, no as fnUntraced, nr as catchCause$1, ns as succeed$1, nt as encodeEffect, o as DateTimeUtc, oa as append$1, oc as empty$8, od as makeUnsafe$4, oi as get$6, ol as hasDies, on as isNull, oo as forkIn, or as decodeText, os as sync, ot as fieldsAssign, ou as millis, p as Finite, pc as succeedContext, pd as flatMap$3, pf as constant, pn as resolveDescription, po as interruptible, pr as failCause$5, ps as timeoutOption, pt as isGreaterThanOrEqualTo, pu as allocate, q as declare, qa as ensuring, qi as shutdown$2, ql as make$74, qn as makeFormatterDefault, qo as runForkWith, qs as Clock, qt as assign, r as Boolean$1, rc as effect, rd as getOrUndefined$1, rf as isString, ri as withSpan$1, rn as getLastEncoding, ro as forEach, rr as changes, rs as succeedNone, rt as encodeSync, s as DateTimeUtcFromString, sa as drop$1, sd as merge$1, sf as cast, si as has, sl as hasInterrupts, sn as isObjects, so as forkScoped, ss as tap, st as fromJsonString, su as minutes, t as Any, ta as getCurrent, tc as build, td as getOption, tf as isNullish, ti as transformPull, to as fn, ts as sleep, tt as encode$1, tu as hours, u as DurationFromMillis, ua as isEmpty$2, uc as provide, ud as exists, uf as constTrue, ul as interruptors, un as isUnion, uo as ignore$1, ur as encodeText, us as tapError, ut as isBetween, uu as toMillis, v as Never, va as acquireRelease, vc as addFinalizer$1, vd as getOrNull, vf as pipeArguments, vl as prettyErrors, vo as logFatal, vr as fromEffect, vs as txRetry, vt as isMaxProperties, vu as filterMap, w as Option, wa as annotateLogs, wc as makeUnsafe$8, wd as none, wl as consolePretty$1, wo as mapError, wr as groupedWithin, ws as whileLoop, wu as isArrayNonEmpty, x as Null, xa as all, xc as closeUnsafe, xd as isSome, xi as filterArray, xl as ConsoleRef, xn as trim, xo as makeSpanScoped, xr as fromQueue, xs as updateContext, xt as isPattern, xu as findLast, y as NonEmptyArray, ya as acquireUseRelease, yc as addFinalizerExit, yd as getOrUndefined, yi as mapInput, yl as squash, yn as transform$1, yo as logInfo, yr as fromIterable$1, ys as uninterruptible, yt as isMinLength, yu as findFirst, z as UndefinedOr, za as catchTags, zc as succeed$4, zi as offerUnsafe, zn as makeUnsafe$6, zo as provide$1, zr as provideService$1, zs as forever$1, zt as make$64 } from "./Schema-B3i-HrZQ.mjs";
|
|
4
|
+
import { $ as decodeUnknownExit, $c as combine$1, $d as isNotNull, $i as makeUnsafe$7, $l as fromInput$2, $o as service, $s as taggedEnum, $t as Union$1, $u as empty$5, A as StructWithRest, Ac as die$2, Ad as getStackTraceLimit, Ai as makeUnsafe$5, Al as fnUntraced$1, An as encodeBase64, Ao as never, Ar as mapError$1, As as withTracerEnabled, At as suspend$1, Au as reduce, B as Union, Ba as catch_, Bc as die$1, Bd as NodeInspectSymbol, Bn as now, Bo as provideContext, Br as run$5, Bt as value, C as Number$1, Ca as annotateCurrentSpan, Cc as make$73, Cd as match$1, Ci as fromTransform, Cn as parseJson, Cr as fromSubscription, Cs as void_$1, Ct as isTrimmed, Cu as fromIterable, D as String$1, Da as as, Dc as TracerEnabled, Dd as make$69, Dn as decodeBase64String, Do as matchCauseEffect, Dr as map$8, Dt as mutable, Du as map$5, E as Record, Ea as annotateSpans, Ec as MinimumLogLevel, Ed as Number$2, Ei as pipeTo, Eo as match$2, Er as make$71, Es as withFiber$1, Et as makeFilter, Fa as catchFilter, Fc as isDeferred, Fd as isEffect$1, Fn as isGreaterThan$1, Fo as option, Fs as timer, Ft as toJsonSchemaDocument, Fu as map$7, G as annotateKey, Ga as die, Gc as isSuccess, Gd as equals, Gi as unbounded$2, Gl as Tracer, Gn as InvalidValue$1, Go as retry, Gr as runForEach, Gs as parse$2, Gt as toJsonSchemaMultiDocument, Gu as isFailure$1, H as UnknownFromJsonString$1, Ha as context, Hc as failCause$4, Hd as format, Hi as sliding$1, Hl as MinimumTraceLevel, Hn as toEpochMillis, Ho as raceFirst, Hr as runDrain, Hs as spaced, Ht as toMultiDocumentOpenApi3_1, Hu as failVoid, I as URLFromString, Ia as catchIf, Id as withFiber, Ii as make$75, In as isGreaterThanOrEqualTo$1, Io as orDie, Ir as pipeThroughChannel, Is as update$3, It as toType, J as decodeEffect, Ja as exit, Jc as void_$2, Ji as sliding, Jn as Path, Jo as runPromiseWith, Js as currentTimeMillis, Ju as succeed$2, K as brand, Kc as match$3, Ki as publish, Kl as externalSpan, Ko as runFork, Kr as runForEachArray, Ks as round, Kt as escapeToken, Ku as isSuccess$1, L as Uint8Array$1, La as catchReason, Lc as make$70, Ld as assignProperty, Li as offer$1, Ll as sync$1, Ln as isLessThan$1, Lo as orElseSucceed, Ls as withAttributes, Lt as withConstructorDefault, M as TaggedStruct, Ma as catchCause, Mc as fail$3, Md as Prototype, Mi as end, Mn as encodeHex, Mo as onExit, Ms as zipWith, Mt as toCodecJson, Mu as sort, N as TemplateLiteral, Na as catchDefect, Nc as failCause$2, Nd as PipeInspectableProto, Nn as add$3, Ns as counter, Nt as toCodecJsonAST, O as StringFromUriComponent, Oa as asSome, Oc as TracerTimingEnabled, Oi as splitLines, On as decodeBase64Url, Or as mapArrayEffect, Os as withParentSpan, Ot as optional$3, Ou as match, Pi as failCause$3, Pl as reportCauseUnsafe, Pn as formatIso, Po as onInterrupt, Pr as onExit$1, Ps as snapshotUnsafe, Pt as toCodecStringTree, Q as decodeUnknownEffect, Qa as flatMap$1, Qd as hasProperty, Ql as format$1, Qo as scopedWith, Qs as TaggedError, Qt as isSchemaError, Qu as add$2, R as Undefined, Ra as catchTag, Ri as offerAll, Rl as tracerLogger$1, Rn as make$68, Ro as promise, Rr as provideContext$1, Rs as addDelay, Rt as withDecodingDefault, S as NullOr, Sa as andThen, Sc as forkUnsafe, Sd as map$6, Sl as CurrentLoggers$1, Sn as onSome, So as map$4, Ss as useSpan, St as isSchema, Su as flatMapNullishOr, T as OptionFromNullOr, Ta as annotateLogsScoped, Tc as provide$2, Td as some, Ti as mapEffect$2, Tn as stringifyJson, Tr as isStream, Ts as withErrorReporting, Tt as make$67, Tu as isReadonlyArrayNonEmpty, U as Void, Ua as contextWith, Uc as interrupt$3, Ui as take$1, Ul as NativeSpan, Un as toUtc, Uo as repeat, Ur as runFold, Us as catchDone, Ut as apply, Uu as getOrThrow, V as Unknown, Vc as fail$4, Vd as toJson, Vi as shutdown$1, Vn as toDate, Vo as provideService, Vr as runCollect, Vs as passthrough, Vt as VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP, Vu as fail$1, W as annotate$2, Wa as currentParentSpan, Wc as isFailure, Wi as takeAll, Wl as ParentSpan, Wn as Forbidden$1, Wo as result, Wr as runFoldEffect, Ws as isDoneCause, Wt as toRepresentations, Wu as getOrUndefined$2, X as decodeSync, Xa as failCause$1, Xc as NoSuchElementError, Xi as unbounded$1, Xn as FileSystem, Xo as scope, Xr as takeWhile, Xu as Reference, Y as decodeExit, Ya as fail, Yi as subscribe, Ys as currentTimeNanos, Z as decodeTo, Za as filterOrFail, Zc as StackTrace, Zd as compose$1, Zl as days, Zo as scoped, Zr as toAsyncIterable, Zs as TaggedClass, Zt as SchemaError, Zu as Service$2, _a as Transaction, _c as Scope, _d as getOrElse, _f as pipe, _l as pretty, _n as Transformation, _o as logError, _s as tx, _t as isMaxLength, _u as filter$1, a as Class, aa as runIn, ac as effectDiscard, ad as make$65, an as isLiteral, ao as forkChild, ar as debounce, as as suspend, at as encodeUnknownExit, au as max, b as NonEmptyString, ba as addFinalizer, bc as close, bd as isNone, bi as decodeText$1, bn as transformOrFail, bo as logWarning$1, br as fromPubSub, bt as isNonEmpty, bu as findFirstIndex, c as Defect, ca as empty$6, cc as launch, cd as omit, cf as compose, ci as invalidate, cl as hasInterruptsOnly, cn as isOptional, co as fromResult, cr as drain, cs as tapCause, ct as instanceOf, cu as nanos, d as ErrorClass, da as size$2, dc as provideMerge, dd as filter, df as constUndefined, dl as isCause, dn as isVoid, do as ignoreCause, ds as tapErrorTag, dt as isFinite, ea as await_, ec as CurrentMemoMap, ed as get$5, ef as isNotUndefined, eo as flatten$1, es as serviceOption, et as decodeUnknownOption, eu as fromInputUnsafe, f as Exit, fa as toArray, fc as succeed$3, fd as firstSomeOf, ff as constVoid, fl as isFailReason, fn as resolveAt, fo as interrupt$1, fr as fail$5, fs as timeout, ft as isGreaterThan, fu as zero, g as Literals, gc as unwrap, gd as fromUndefinedOr, gf as identity, gi as forEach$1, gl as map$9, go as logDebug, gr as fromAsyncIterable, gs as try_, gt as isLessThanOrEqualTo, gu as ensure, h as Literal, hc as tap$1, hd as fromNullishOr, hi as drain$1, hn as toEncoded, ho as log$1, hr as flatMap$2, hs as tryPromise, ht as isLessThan, hu as empty$4, i as Cause, ia as join$2, ic as effectContext, id as getUnsafe$1, if as isTagged, il as findErrorOption, in as isDeclaration, io as forever, ir as concat, is as succeedSome, it as encodeUnknownEffect, j as TaggedErrorClass, ja as callback, jd as setStackTraceLimit, ji as bounded, jn as encodeBase64Url, jo as onError, jr as merge$2, js as yieldNow, jt as tag, ju as reverse, k as Struct, ka as asVoid, kc as _await, ki as make$72, kn as decodeBase64UrlString, ko as matchEffect, kr as mapEffect$1, ks as withSpan, kt as optionalKey, l as Duration, la as head, lc as mergeAll, ld as contains, lf as constFalse, li as make$66, ll as interrupt$2, ln as isSuspend, lo as gen, lr as empty$7, ls as tapDefect, lt as is, lu as seconds, m as Int, ma as PlatformError, mc as sync$2, md as flatten, mf as dual, mn as resolveIdentifier, mo as isEffect, mr as filter$2, mt as isInt, n as ArraySchema, na as interrupt$4, nc as buildWithMemoMap, nd as getOrElse$1, nf as isObject$1, ni as unwrap$1, nl as fail$2, nn as getAST, no as fnUntraced, nr as catchCause$1, ns as succeed$1, nt as encodeEffect, o as DateTimeUtc, oa as append$1, oc as empty$8, od as makeUnsafe$4, oi as get$6, ol as hasDies, on as isNull, oo as forkIn, or as decodeText, os as sync, ot as fieldsAssign, ou as millis, p as Finite, pc as succeedContext, pd as flatMap$3, pf as constant, pn as resolveDescription, po as interruptible, pr as failCause$5, ps as timeoutOption, pt as isGreaterThanOrEqualTo, pu as allocate, q as declare, qa as ensuring, qi as shutdown$2, ql as make$74, qn as makeFormatterDefault, qo as runForkWith, qs as Clock, qt as assign, r as Boolean$1, rc as effect, rd as getOrUndefined$1, rf as isString, ri as withSpan$1, rn as getLastEncoding, ro as forEach, rr as changes, rs as succeedNone, rt as encodeSync, s as DateTimeUtcFromString, sa as drop$1, sd as merge$1, sf as cast, si as has, sl as hasInterrupts, sn as isObjects, so as forkScoped, ss as tap, st as fromJsonString, su as minutes, t as Any, ta as getCurrent, tc as build, td as getOption, tf as isNullish, ti as transformPull, to as fn, ts as sleep, tt as encode$1, tu as hours, u as DurationFromMillis, ua as isEmpty$2, uc as provide, ud as exists, uf as constTrue, ul as interruptors, un as isUnion, uo as ignore$1, ur as encodeText, us as tapError, ut as isBetween, uu as toMillis, v as Never, va as acquireRelease, vc as addFinalizer$1, vd as getOrNull, vf as pipeArguments, vl as prettyErrors, vo as logFatal, vr as fromEffect, vs as txRetry, vt as isMaxProperties, vu as filterMap, w as Option, wa as annotateLogs, wc as makeUnsafe$8, wd as none, wl as consolePretty$1, wo as mapError, wr as groupedWithin, ws as whileLoop, wu as isArrayNonEmpty, x as Null, xa as all, xc as closeUnsafe, xd as isSome, xi as filterArray, xl as ConsoleRef, xn as trim, xo as makeSpanScoped, xr as fromQueue, xs as updateContext, xt as isPattern, xu as findLast, y as NonEmptyArray, ya as acquireUseRelease, yc as addFinalizerExit, yd as getOrUndefined, yi as mapInput, yl as squash, yn as transform$1, yo as logInfo, yr as fromIterable$1, ys as uninterruptible, yt as isMinLength, yu as findFirst, z as UndefinedOr, za as catchTags, zc as succeed$4, zi as offerUnsafe, zn as makeUnsafe$6, zo as provide$1, zr as provideService$1, zs as forever$1, zt as make$64 } from "./Schema-B3i-HrZQ.mjs";
|
|
5
5
|
import { a as isQuitError, g as ChildProcessSpawner, h as make$76, i as Terminal$1, l as Crypto, n as layer$41, o as Stdio, r as QuitError, s as make$77, u as fromReadable } from "./NodeServices-DDZTiw5K.mjs";
|
|
6
6
|
import { _ as withDefault$2, a as all$1, c as logLevel, d as option$1, f as port, g as url$1, i as TrueValues, l as map$10, m as string$4, n as FalseValues, o as boolean$3, p as schema$1, r as Record$1, s as int, t as Boolean$2, u as number } from "./Config-Bj2ZPCsP.mjs";
|
|
7
7
|
import { c as getOption$1, d as make$78, f as makeWith$1, l as invalidate$1, n as SqlClient, p as set$4, s as get$7, u as keys } from "./SqlClient-DcM69ZvI.mjs";
|
|
@@ -49198,6 +49198,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49198
49198
|
const services = yield* context();
|
|
49199
49199
|
const scope = get$5(services, Scope);
|
|
49200
49200
|
const entries = /* @__PURE__ */ new Map();
|
|
49201
|
+
const hooks = yield* serviceOption(RequestHooks);
|
|
49201
49202
|
let isShutdown = false;
|
|
49202
49203
|
yield* addFinalizer$1(scope, withFiber$1((parent) => {
|
|
49203
49204
|
isShutdown = true;
|
|
@@ -49228,6 +49229,11 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49228
49229
|
const onEffectRequest = (rpc, middleware, span, payload, headers, context, discard) => withFiber$1((parentFiber) => {
|
|
49229
49230
|
if (isShutdown) return interrupt$1;
|
|
49230
49231
|
const id = generateRequestId();
|
|
49232
|
+
const onStart = isSome(hooks) && hooks.value.onRequestStart ? hooks.value.onRequestStart({
|
|
49233
|
+
id,
|
|
49234
|
+
tag: rpc._tag,
|
|
49235
|
+
stream: false
|
|
49236
|
+
}) : void_$1;
|
|
49231
49237
|
const send = middleware((message) => options.onFromClient({
|
|
49232
49238
|
message,
|
|
49233
49239
|
context,
|
|
@@ -49244,7 +49250,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49244
49250
|
} : {},
|
|
49245
49251
|
headers: merge(parentFiber.getRef(CurrentHeaders), headers)
|
|
49246
49252
|
});
|
|
49247
|
-
if (discard) return send;
|
|
49253
|
+
if (discard) return onStart.pipe(andThen(send));
|
|
49248
49254
|
let fiber;
|
|
49249
49255
|
return onInterrupt(callback((resume) => {
|
|
49250
49256
|
const entry = {
|
|
@@ -49259,13 +49265,14 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49259
49265
|
}
|
|
49260
49266
|
};
|
|
49261
49267
|
entries.set(id, entry);
|
|
49262
|
-
fiber =
|
|
49268
|
+
fiber = onStart.pipe(andThen(send), span ? withParentSpan(span, { captureStackTrace: false }) : identity, runForkWith(parentFiber.context));
|
|
49263
49269
|
fiber.addObserver((exit) => {
|
|
49264
49270
|
if (exit._tag === "Failure") return resume(exit);
|
|
49265
49271
|
});
|
|
49266
49272
|
}), (interruptors) => {
|
|
49273
|
+
const entry = entries.get(id);
|
|
49267
49274
|
entries.delete(id);
|
|
49268
|
-
return andThen(interrupt$4(fiber), sendInterrupt(id, Array.from(interruptors), context));
|
|
49275
|
+
return andThen(interrupt$4(fiber), sendInterrupt(id, Array.from(interruptors), context, entry?.rpc._tag));
|
|
49269
49276
|
});
|
|
49270
49277
|
});
|
|
49271
49278
|
const onStreamRequest = fnUntraced(function* (rpc, middleware, payload, headers, streamBufferSize, context) {
|
|
@@ -49273,11 +49280,17 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49273
49280
|
const span = disableTracing ? void 0 : yield* makeSpanScoped(`${spanPrefix}.${rpc._tag}`, { attributes: options.spanAttributes });
|
|
49274
49281
|
const fiber = getCurrent();
|
|
49275
49282
|
const id = generateRequestId();
|
|
49283
|
+
const onStart = isSome(hooks) && hooks.value.onRequestStart ? hooks.value.onRequestStart({
|
|
49284
|
+
id,
|
|
49285
|
+
tag: rpc._tag,
|
|
49286
|
+
stream: true
|
|
49287
|
+
}) : void_$1;
|
|
49276
49288
|
const scope = getUnsafe$1(fiber.context, Scope);
|
|
49277
49289
|
yield* addFinalizerExit(scope, (exit) => {
|
|
49278
|
-
|
|
49290
|
+
const entry = entries.get(id);
|
|
49291
|
+
if (!entry) return void_$1;
|
|
49279
49292
|
entries.delete(id);
|
|
49280
|
-
return sendInterrupt(id, isFailure(exit) ? Array.from(interruptors(exit.cause)) : [], context);
|
|
49293
|
+
return sendInterrupt(id, isFailure(exit) ? Array.from(interruptors(exit.cause)) : [], context, entry.rpc._tag);
|
|
49281
49294
|
});
|
|
49282
49295
|
const queue = yield* bounded(streamBufferSize);
|
|
49283
49296
|
entries.set(id, {
|
|
@@ -49285,9 +49298,10 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49285
49298
|
rpc,
|
|
49286
49299
|
queue,
|
|
49287
49300
|
scope,
|
|
49288
|
-
context
|
|
49301
|
+
context,
|
|
49302
|
+
chunkCount: 0
|
|
49289
49303
|
});
|
|
49290
|
-
yield* middleware((message) => options.onFromClient({
|
|
49304
|
+
yield* onStart.pipe(andThen(middleware((message) => options.onFromClient({
|
|
49291
49305
|
message,
|
|
49292
49306
|
context,
|
|
49293
49307
|
discard: false
|
|
@@ -49302,7 +49316,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49302
49316
|
sampled: span.sampled
|
|
49303
49317
|
} : {},
|
|
49304
49318
|
headers: merge(fiber.getRef(CurrentHeaders), headers)
|
|
49305
|
-
}).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, catchCause((error) => failCause$3(queue, error)), interruptible, forkIn(scope, { startImmediately: true }));
|
|
49319
|
+
}))).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, catchCause((error) => failCause$3(queue, error)), interruptible, forkIn(scope, { startImmediately: true }));
|
|
49306
49320
|
return queue;
|
|
49307
49321
|
});
|
|
49308
49322
|
const getRpcClientMiddleware = (rpc) => {
|
|
@@ -49324,7 +49338,10 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49324
49338
|
});
|
|
49325
49339
|
};
|
|
49326
49340
|
};
|
|
49327
|
-
const sendInterrupt = (requestId, interruptors, context) =>
|
|
49341
|
+
const sendInterrupt = (requestId, interruptors, context, tag) => (isSome(hooks) && hooks.value.onRequestInterrupt ? hooks.value.onRequestInterrupt({
|
|
49342
|
+
id: requestId,
|
|
49343
|
+
tag
|
|
49344
|
+
}) : void_$1).pipe(andThen(callback((resume) => {
|
|
49328
49345
|
const parentFiber = getCurrent();
|
|
49329
49346
|
options.onFromClient({
|
|
49330
49347
|
message: {
|
|
@@ -49337,14 +49354,20 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49337
49354
|
}).pipe(timeout(1e3), runForkWith(parentFiber.context)).addObserver(() => {
|
|
49338
49355
|
resume(void_$1);
|
|
49339
49356
|
});
|
|
49340
|
-
});
|
|
49357
|
+
})));
|
|
49341
49358
|
const write = (message) => {
|
|
49342
49359
|
switch (message._tag) {
|
|
49343
49360
|
case "Chunk": {
|
|
49344
49361
|
const requestId = message.requestId;
|
|
49345
49362
|
const entry = entries.get(requestId);
|
|
49346
49363
|
if (!entry || entry._tag !== "Queue") return void_$1;
|
|
49347
|
-
|
|
49364
|
+
const chunkCount = entry.chunkCount += message.values.length;
|
|
49365
|
+
const onChunk = isSome(hooks) && hooks.value.onRequestChunk ? hooks.value.onRequestChunk({
|
|
49366
|
+
id: requestId,
|
|
49367
|
+
tag: entry.rpc._tag,
|
|
49368
|
+
chunkCount
|
|
49369
|
+
}) : void_$1;
|
|
49370
|
+
return offerAll(entry.queue, message.values).pipe(andThen(onChunk), supportsAck ? flatMap$1(() => options.onFromClient({
|
|
49348
49371
|
message: {
|
|
49349
49372
|
_tag: "Ack",
|
|
49350
49373
|
requestId: message.requestId
|
|
@@ -49358,11 +49381,16 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49358
49381
|
const entry = entries.get(requestId);
|
|
49359
49382
|
if (!entry) return void_$1;
|
|
49360
49383
|
entries.delete(requestId);
|
|
49361
|
-
|
|
49384
|
+
const onExit = isSome(hooks) && hooks.value.onRequestExit ? hooks.value.onRequestExit({
|
|
49385
|
+
id: requestId,
|
|
49386
|
+
tag: entry.rpc._tag,
|
|
49387
|
+
stream: entry._tag === "Queue",
|
|
49388
|
+
exit: message.exit
|
|
49389
|
+
}) : void_$1;
|
|
49390
|
+
if (entry._tag === "Effect") return onExit.pipe(andThen(sync(() => {
|
|
49362
49391
|
entry.resume(message.exit);
|
|
49363
|
-
|
|
49364
|
-
|
|
49365
|
-
return message.exit._tag === "Success" ? end(entry.queue) : failCause$3(entry.queue, message.exit.cause);
|
|
49392
|
+
})));
|
|
49393
|
+
return onExit.pipe(andThen(message.exit._tag === "Success" ? end(entry.queue) : failCause$3(entry.queue, message.exit.cause)));
|
|
49366
49394
|
}
|
|
49367
49395
|
case "Defect": return clearEntries(die$1(message.defect));
|
|
49368
49396
|
case "ClientEnd": return void_$1;
|
|
@@ -49543,6 +49571,11 @@ var Protocol$1 = class extends Service$2()("effect/rpc/RpcClient/Protocol") {
|
|
|
49543
49571
|
*/
|
|
49544
49572
|
static make = withRunClient;
|
|
49545
49573
|
};
|
|
49574
|
+
/**
|
|
49575
|
+
* @since 4.0.0
|
|
49576
|
+
* @category RequestHooks
|
|
49577
|
+
*/
|
|
49578
|
+
var RequestHooks = class extends Service$2()("effect/rpc/RpcClient/RequestHooks") {};
|
|
49546
49579
|
Service$2()("effect/rpc/RpcClient/ConnectionHooks");
|
|
49547
49580
|
const decodeDefect = /*#__PURE__*/ decodeSync(/*#__PURE__*/ Defect());
|
|
49548
49581
|
//#endregion
|
|
@@ -52404,6 +52437,75 @@ function envelopeToUtf8(enckey, envelope) {
|
|
|
52404
52437
|
function isEnvelope(value) {
|
|
52405
52438
|
return typeof value === "object" && value !== null && value.e2e === 1 && typeof value.iv === "string" && typeof value.ct === "string";
|
|
52406
52439
|
}
|
|
52440
|
+
const AGENTLINK_FRAME_CHUNK_TAG = "agentlink-frame-chunk-v1";
|
|
52441
|
+
const AGENTLINK_FRAME_CHUNK_BYTES = 512 * 1024;
|
|
52442
|
+
const AGENTLINK_FRAME_MAX_CHUNKS = 64;
|
|
52443
|
+
const AGENTLINK_FRAME_MAX_IN_FLIGHT = 8;
|
|
52444
|
+
function chunkAgentLinkFrame(plaintext) {
|
|
52445
|
+
const bytes = Buffer.from(plaintext, "utf8");
|
|
52446
|
+
if (bytes.length <= AGENTLINK_FRAME_CHUNK_BYTES) return [plaintext];
|
|
52447
|
+
const id = randomBytes(12).toString("base64url");
|
|
52448
|
+
const total = Math.ceil(bytes.length / AGENTLINK_FRAME_CHUNK_BYTES);
|
|
52449
|
+
if (total > AGENTLINK_FRAME_MAX_CHUNKS) throw new Error("AgentLink frame is too large");
|
|
52450
|
+
const chunks = [];
|
|
52451
|
+
for (let index = 0; index < total; index++) {
|
|
52452
|
+
const start = index * AGENTLINK_FRAME_CHUNK_BYTES;
|
|
52453
|
+
chunks.push(JSON.stringify({
|
|
52454
|
+
__agentlink_chunk: AGENTLINK_FRAME_CHUNK_TAG,
|
|
52455
|
+
id,
|
|
52456
|
+
index,
|
|
52457
|
+
total,
|
|
52458
|
+
data: bytes.subarray(start, start + AGENTLINK_FRAME_CHUNK_BYTES).toString("base64url")
|
|
52459
|
+
}));
|
|
52460
|
+
}
|
|
52461
|
+
return chunks;
|
|
52462
|
+
}
|
|
52463
|
+
function makeAgentLinkFrameAssembler() {
|
|
52464
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
52465
|
+
return (plaintext) => {
|
|
52466
|
+
if (!plaintext.startsWith(`{"__agentlink_chunk":"${AGENTLINK_FRAME_CHUNK_TAG}"`)) return plaintext;
|
|
52467
|
+
let value;
|
|
52468
|
+
try {
|
|
52469
|
+
value = JSON.parse(plaintext);
|
|
52470
|
+
} catch {
|
|
52471
|
+
return plaintext;
|
|
52472
|
+
}
|
|
52473
|
+
if (typeof value !== "object" || value === null || value.__agentlink_chunk !== AGENTLINK_FRAME_CHUNK_TAG) return plaintext;
|
|
52474
|
+
const chunk = value;
|
|
52475
|
+
if (typeof chunk.id !== "string" || !Number.isInteger(chunk.index) || !Number.isInteger(chunk.total) || typeof chunk.data !== "string") throw new Error("invalid AgentLink frame chunk");
|
|
52476
|
+
const id = chunk.id;
|
|
52477
|
+
const index = chunk.index;
|
|
52478
|
+
const total = chunk.total;
|
|
52479
|
+
const data = chunk.data;
|
|
52480
|
+
if (total < 2 || total > AGENTLINK_FRAME_MAX_CHUNKS || index < 0 || index >= total) throw new Error("invalid AgentLink frame chunk");
|
|
52481
|
+
const part = Buffer.from(data, "base64url");
|
|
52482
|
+
let current = inFlight.get(id);
|
|
52483
|
+
if (!current) {
|
|
52484
|
+
if (inFlight.size >= AGENTLINK_FRAME_MAX_IN_FLIGHT) throw new Error("too many AgentLink frame chunks in flight");
|
|
52485
|
+
current = {
|
|
52486
|
+
total,
|
|
52487
|
+
parts: Array.from({ length: total }, () => void 0),
|
|
52488
|
+
bytes: 0
|
|
52489
|
+
};
|
|
52490
|
+
inFlight.set(id, current);
|
|
52491
|
+
}
|
|
52492
|
+
const state = current;
|
|
52493
|
+
if (state.total !== total) throw new Error("inconsistent AgentLink frame chunk");
|
|
52494
|
+
const previous = state.parts[index];
|
|
52495
|
+
if (previous) {
|
|
52496
|
+
if (!previous.equals(part)) throw new Error("duplicate AgentLink frame chunk differs");
|
|
52497
|
+
return null;
|
|
52498
|
+
}
|
|
52499
|
+
state.parts[index] = part;
|
|
52500
|
+
state.bytes += part.length;
|
|
52501
|
+
if (state.bytes > AGENTLINK_FRAME_CHUNK_BYTES * AGENTLINK_FRAME_MAX_CHUNKS) throw new Error("AgentLink frame is too large");
|
|
52502
|
+
if (!state.parts.every((item) => item !== void 0)) return null;
|
|
52503
|
+
if (state.parts.some((item) => item === void 0)) throw new Error("incomplete AgentLink frame chunk");
|
|
52504
|
+
const assembled = Buffer.concat(state.parts);
|
|
52505
|
+
inFlight.delete(id);
|
|
52506
|
+
return assembled.toString("utf8");
|
|
52507
|
+
};
|
|
52508
|
+
}
|
|
52407
52509
|
//#endregion
|
|
52408
52510
|
//#region src/tunnel/bridge.ts
|
|
52409
52511
|
const TUNNEL_SCOPES = [AuthOrchestrationReadScope, AuthOrchestrationOperateScope];
|
|
@@ -52543,7 +52645,7 @@ const makeTunnelSocket = (input) => {
|
|
|
52543
52645
|
return make$63({
|
|
52544
52646
|
runRaw,
|
|
52545
52647
|
writer: sync(() => (chunk) => sync(() => {
|
|
52546
|
-
if (typeof chunk === "string") input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey,
|
|
52648
|
+
if (typeof chunk === "string") for (const part of chunkAgentLinkFrame(chunk)) input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey, part)));
|
|
52547
52649
|
}))
|
|
52548
52650
|
});
|
|
52549
52651
|
};
|
|
@@ -52657,8 +52759,13 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52657
52759
|
const localBaseUrl = `http://127.0.0.1:${serverConfig.port}`;
|
|
52658
52760
|
const sendEncrypted = (frame) => {
|
|
52659
52761
|
try {
|
|
52660
|
-
const
|
|
52661
|
-
|
|
52762
|
+
for (const part of chunkAgentLinkFrame(encodeHttpTunnelResponseFrame(frame))) {
|
|
52763
|
+
const envelope = utf8ToEnvelope(config.enckey, part);
|
|
52764
|
+
if (!writeHub(`${tunnelId} ${JSON.stringify(envelope)}`)) {
|
|
52765
|
+
dropTunnel(tunnelId);
|
|
52766
|
+
return;
|
|
52767
|
+
}
|
|
52768
|
+
}
|
|
52662
52769
|
} catch {
|
|
52663
52770
|
dropTunnel(tunnelId);
|
|
52664
52771
|
}
|
|
@@ -52757,7 +52864,8 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52757
52864
|
closed,
|
|
52758
52865
|
pendingFrames: [],
|
|
52759
52866
|
purpose,
|
|
52760
|
-
onDecryptedFrame: null
|
|
52867
|
+
onDecryptedFrame: null,
|
|
52868
|
+
assembleFrame: makeAgentLinkFrameAssembler()
|
|
52761
52869
|
};
|
|
52762
52870
|
tunnels.set(tunnelId, live);
|
|
52763
52871
|
if (purpose === "http") yield* forkScoped(scoped(attachHttpTunnel(tunnelId, live)));
|
|
@@ -52765,6 +52873,7 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52765
52873
|
});
|
|
52766
52874
|
}
|
|
52767
52875
|
if (control.type === "tunnel_close" && typeof control.tunnelId === "string") dropTunnel(control.tunnelId);
|
|
52876
|
+
if (control.type === "enckey_upload_request") return sync(() => void runFork(upload));
|
|
52768
52877
|
return;
|
|
52769
52878
|
}
|
|
52770
52879
|
const framed = splitHubFrame(data);
|
|
@@ -52784,8 +52893,15 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52784
52893
|
} catch {
|
|
52785
52894
|
return dropTunnel(framed.tunnelId);
|
|
52786
52895
|
}
|
|
52787
|
-
|
|
52788
|
-
|
|
52896
|
+
let complete;
|
|
52897
|
+
try {
|
|
52898
|
+
complete = live.assembleFrame(frame);
|
|
52899
|
+
} catch {
|
|
52900
|
+
return dropTunnel(framed.tunnelId);
|
|
52901
|
+
}
|
|
52902
|
+
if (complete === null) return;
|
|
52903
|
+
if (live.onDecryptedFrame) live.onDecryptedFrame(complete);
|
|
52904
|
+
else if (live.pendingFrames.length < 16) live.pendingFrames.push(complete);
|
|
52789
52905
|
else dropTunnel(framed.tunnelId);
|
|
52790
52906
|
return;
|
|
52791
52907
|
}
|
|
@@ -84134,6 +84250,149 @@ const layerChildProcess = (handle, options = {}) => {
|
|
|
84134
84250
|
return effect(AcpClient, make$4(stdio, options, terminationError));
|
|
84135
84251
|
};
|
|
84136
84252
|
//#endregion
|
|
84253
|
+
//#region src/provider/acp/AcpLocalToolHost.ts
|
|
84254
|
+
/**
|
|
84255
|
+
* AcpLocalToolHost — agentlink fork addition.
|
|
84256
|
+
*
|
|
84257
|
+
* Default client-side implementations of the ACP `fs/*` and `terminal/*`
|
|
84258
|
+
* methods. Some ACP agents (Kimi CLI, notably) do not execute their local
|
|
84259
|
+
* tools in-process; they delegate shell and file operations to the client
|
|
84260
|
+
* through `terminal/create` + `fs/read_text_file` / `fs/write_text_file`.
|
|
84261
|
+
* When the client doesn't advertise those capabilities every such tool call
|
|
84262
|
+
* fails ("ACP terminal capability is unavailable").
|
|
84263
|
+
*
|
|
84264
|
+
* `AcpSessionRuntime` registers these handlers and advertises the matching
|
|
84265
|
+
* client capabilities only when `hostLocalTools` is enabled for the agent
|
|
84266
|
+
* (see `AcpAgentDescriptor.hostLocalTools`). Agents that run tools in their
|
|
84267
|
+
* own process (Gemini/Qwen today) leave the flag off and are unaffected.
|
|
84268
|
+
*
|
|
84269
|
+
* @module provider/acp/AcpLocalToolHost
|
|
84270
|
+
*/
|
|
84271
|
+
/**
|
|
84272
|
+
* Fallback cap for retained terminal output when the agent does not send
|
|
84273
|
+
* `outputByteLimit`. The spec only bounds output when the agent asks; an
|
|
84274
|
+
* unbounded buffer would let a noisy command exhaust daemon memory, so a
|
|
84275
|
+
* generous default (2 MB) is applied instead of retaining everything.
|
|
84276
|
+
*/
|
|
84277
|
+
const DEFAULT_OUTPUT_BYTE_LIMIT = 2e6;
|
|
84278
|
+
const internalError = (message) => AcpRequestError.internalError(message);
|
|
84279
|
+
const unknownTerminal = (terminalId) => AcpRequestError.resourceNotFound(`Unknown ACP terminal: ${terminalId}`);
|
|
84280
|
+
const isNotFoundCause = (cause) => typeof cause === "object" && cause !== null && cause._tag === "SystemError" && cause.reason === "NotFound";
|
|
84281
|
+
const toFsError = (operation, filePath, cause) => isNotFoundCause(cause) ? AcpRequestError.resourceNotFound(`Failed to ${operation} file (not found): ${filePath}`) : internalError(`Failed to ${operation} file: ${filePath}`);
|
|
84282
|
+
/**
|
|
84283
|
+
* Registers local `fs/*` and `terminal/*` handlers on the ACP client.
|
|
84284
|
+
* Terminals are tied to the surrounding scope: when the session runtime
|
|
84285
|
+
* shuts down, every still-running terminal process is killed with it.
|
|
84286
|
+
*/
|
|
84287
|
+
const registerLocalToolHandlers = (input) => gen(function* () {
|
|
84288
|
+
const crypto = yield* Crypto;
|
|
84289
|
+
const fileSystem = yield* FileSystem;
|
|
84290
|
+
const path = yield* Path;
|
|
84291
|
+
const spawner = yield* ChildProcessSpawner;
|
|
84292
|
+
const scope = yield* Scope;
|
|
84293
|
+
const terminals = /* @__PURE__ */ new Map();
|
|
84294
|
+
const resolveFilePath = (filePath) => path.isAbsolute(filePath) ? filePath : path.join(input.cwd, filePath);
|
|
84295
|
+
yield* input.acp.handleReadTextFile((request) => gen(function* () {
|
|
84296
|
+
const filePath = resolveFilePath(request.path);
|
|
84297
|
+
const lines = (yield* fileSystem.readFileString(filePath).pipe(mapError((cause) => toFsError("read", filePath, cause)))).split("\n");
|
|
84298
|
+
const start = request.line !== void 0 && request.line !== null && request.line > 1 ? request.line - 1 : 0;
|
|
84299
|
+
return { content: (request.limit !== void 0 && request.limit !== null ? lines.slice(start, start + request.limit) : lines.slice(start)).join("\n") };
|
|
84300
|
+
}));
|
|
84301
|
+
yield* input.acp.handleWriteTextFile((request) => gen(function* () {
|
|
84302
|
+
const filePath = resolveFilePath(request.path);
|
|
84303
|
+
yield* fileSystem.makeDirectory(path.dirname(filePath), { recursive: true }).pipe(ignore$1);
|
|
84304
|
+
yield* fileSystem.writeFileString(filePath, request.content).pipe(mapError((cause) => toFsError("write", filePath, cause)));
|
|
84305
|
+
return {};
|
|
84306
|
+
}));
|
|
84307
|
+
yield* input.acp.handleCreateTerminal((request) => gen(function* () {
|
|
84308
|
+
const terminalId = yield* crypto.randomUUIDv4.pipe(mapError(() => internalError("Failed to allocate an ACP terminal id.")));
|
|
84309
|
+
const env = (request.env ?? []).reduce((acc, entry) => {
|
|
84310
|
+
acc[entry.name] = entry.value;
|
|
84311
|
+
return acc;
|
|
84312
|
+
}, {});
|
|
84313
|
+
const hasEnv = Object.keys(env).length > 0;
|
|
84314
|
+
const spawnCommand = yield* resolveSpawnCommand(request.command, request.args ?? [], hasEnv ? {
|
|
84315
|
+
env,
|
|
84316
|
+
extendEnv: true
|
|
84317
|
+
} : {});
|
|
84318
|
+
const handle = yield* spawner.spawn(make$76(spawnCommand.command, spawnCommand.args, {
|
|
84319
|
+
cwd: request.cwd ?? input.cwd,
|
|
84320
|
+
...hasEnv ? {
|
|
84321
|
+
env,
|
|
84322
|
+
extendEnv: true
|
|
84323
|
+
} : {},
|
|
84324
|
+
shell: spawnCommand.shell
|
|
84325
|
+
})).pipe(provideService(Scope, scope), mapError(() => internalError(`Failed to spawn ACP terminal command: ${request.command}`)));
|
|
84326
|
+
const exited = yield* make$70();
|
|
84327
|
+
const state = {
|
|
84328
|
+
handle,
|
|
84329
|
+
exited,
|
|
84330
|
+
output: "",
|
|
84331
|
+
truncated: false,
|
|
84332
|
+
exitStatus: void 0,
|
|
84333
|
+
killSignal: void 0
|
|
84334
|
+
};
|
|
84335
|
+
const byteLimit = request.outputByteLimit ?? DEFAULT_OUTPUT_BYTE_LIMIT;
|
|
84336
|
+
const decoder = new TextDecoder();
|
|
84337
|
+
const appendOutput = (chunk) => {
|
|
84338
|
+
state.output += decoder.decode(chunk, { stream: true });
|
|
84339
|
+
if (state.output.length > byteLimit) {
|
|
84340
|
+
state.output = state.output.slice(state.output.length - byteLimit);
|
|
84341
|
+
state.truncated = true;
|
|
84342
|
+
}
|
|
84343
|
+
};
|
|
84344
|
+
yield* runForEach(handle.all, (chunk) => sync(() => appendOutput(chunk))).pipe(ignore$1, forkIn(scope));
|
|
84345
|
+
yield* handle.exitCode.pipe(match$2({
|
|
84346
|
+
onFailure: () => ({
|
|
84347
|
+
exitCode: null,
|
|
84348
|
+
signal: state.killSignal ?? null
|
|
84349
|
+
}),
|
|
84350
|
+
onSuccess: (code) => ({
|
|
84351
|
+
exitCode: Number(code),
|
|
84352
|
+
signal: state.killSignal ?? null
|
|
84353
|
+
})
|
|
84354
|
+
}), flatMap$1((exitStatus) => {
|
|
84355
|
+
state.exitStatus = exitStatus;
|
|
84356
|
+
return succeed$4(exited, exitStatus);
|
|
84357
|
+
}), ignore$1, forkIn(scope));
|
|
84358
|
+
terminals.set(terminalId, state);
|
|
84359
|
+
return { terminalId };
|
|
84360
|
+
}));
|
|
84361
|
+
yield* input.acp.handleTerminalOutput((request) => sync(() => {
|
|
84362
|
+
const state = terminals.get(request.terminalId);
|
|
84363
|
+
if (!state) return;
|
|
84364
|
+
return {
|
|
84365
|
+
output: state.output,
|
|
84366
|
+
truncated: state.truncated,
|
|
84367
|
+
...state.exitStatus ? { exitStatus: state.exitStatus } : {}
|
|
84368
|
+
};
|
|
84369
|
+
}).pipe(flatMap$1((result) => result === void 0 ? fail(unknownTerminal(request.terminalId)) : succeed$1(result))));
|
|
84370
|
+
yield* input.acp.handleTerminalWaitForExit((request) => gen(function* () {
|
|
84371
|
+
const state = terminals.get(request.terminalId);
|
|
84372
|
+
if (!state) return yield* unknownTerminal(request.terminalId);
|
|
84373
|
+
return yield* _await(state.exited);
|
|
84374
|
+
}));
|
|
84375
|
+
yield* input.acp.handleTerminalKill((request) => gen(function* () {
|
|
84376
|
+
const state = terminals.get(request.terminalId);
|
|
84377
|
+
if (!state) return yield* unknownTerminal(request.terminalId);
|
|
84378
|
+
if (state.exitStatus === void 0) {
|
|
84379
|
+
state.killSignal = "SIGTERM";
|
|
84380
|
+
yield* state.handle.kill().pipe(ignore$1);
|
|
84381
|
+
}
|
|
84382
|
+
return {};
|
|
84383
|
+
}));
|
|
84384
|
+
yield* input.acp.handleTerminalRelease((request) => gen(function* () {
|
|
84385
|
+
const state = terminals.get(request.terminalId);
|
|
84386
|
+
if (!state) return yield* unknownTerminal(request.terminalId);
|
|
84387
|
+
terminals.delete(request.terminalId);
|
|
84388
|
+
if (state.exitStatus === void 0) {
|
|
84389
|
+
state.killSignal = "SIGTERM";
|
|
84390
|
+
yield* state.handle.kill().pipe(ignore$1);
|
|
84391
|
+
}
|
|
84392
|
+
return {};
|
|
84393
|
+
}));
|
|
84394
|
+
});
|
|
84395
|
+
//#endregion
|
|
84137
84396
|
//#region ../t3-shared/src/toolActivity.ts
|
|
84138
84397
|
function asRecord(value) {
|
|
84139
84398
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -84667,13 +84926,18 @@ const make$3 = (options) => gen(function* () {
|
|
|
84667
84926
|
params: notification
|
|
84668
84927
|
});
|
|
84669
84928
|
}));
|
|
84929
|
+
if (options.hostLocalTools === true) yield* registerLocalToolHandlers({
|
|
84930
|
+
acp,
|
|
84931
|
+
cwd: options.cwd
|
|
84932
|
+
});
|
|
84933
|
+
const hostLocalTools = options.hostLocalTools === true;
|
|
84670
84934
|
const initializeClientCapabilities = {
|
|
84671
84935
|
fs: {
|
|
84672
|
-
readTextFile:
|
|
84673
|
-
writeTextFile:
|
|
84936
|
+
readTextFile: hostLocalTools,
|
|
84937
|
+
writeTextFile: hostLocalTools,
|
|
84674
84938
|
...options.clientCapabilities?.fs
|
|
84675
84939
|
},
|
|
84676
|
-
terminal: options.clientCapabilities?.terminal ??
|
|
84940
|
+
terminal: options.clientCapabilities?.terminal ?? hostLocalTools,
|
|
84677
84941
|
...options.clientCapabilities?.auth ? { auth: options.clientCapabilities.auth } : {},
|
|
84678
84942
|
...options.clientCapabilities?.elicitation ? { elicitation: options.clientCapabilities.elicitation } : {},
|
|
84679
84943
|
...options.clientCapabilities?._meta ? { _meta: options.clientCapabilities._meta } : {}
|
|
@@ -85013,7 +85277,8 @@ const makeAcpAgentRuntime = (descriptor, input) => gen(function* () {
|
|
|
85013
85277
|
...input,
|
|
85014
85278
|
spawn: buildAcpAgentSpawnInput(descriptor, input.settings, input.cwd, input.environment),
|
|
85015
85279
|
authMethodId: "none",
|
|
85016
|
-
skipAuthentication: true
|
|
85280
|
+
skipAuthentication: true,
|
|
85281
|
+
hostLocalTools: descriptor.hostLocalTools === true
|
|
85017
85282
|
}).pipe(provide(succeed$3(ChildProcessSpawner, input.childProcessSpawner))));
|
|
85018
85283
|
return yield* service(AcpSessionRuntime).pipe(provide$1(acpContext));
|
|
85019
85284
|
});
|
|
@@ -85084,6 +85349,8 @@ const isTextGenerationError = is(TextGenerationError);
|
|
|
85084
85349
|
const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.env) => gen(function* () {
|
|
85085
85350
|
const crypto = yield* Crypto;
|
|
85086
85351
|
const commandSpawner = yield* ChildProcessSpawner;
|
|
85352
|
+
const fileSystem = yield* FileSystem;
|
|
85353
|
+
const path = yield* Path;
|
|
85087
85354
|
const runAcpAgentJson = ({ operation, cwd, prompt, outputSchemaJson, modelSelection }) => gen(function* () {
|
|
85088
85355
|
const resolvedModel = resolveAcpAgentModelId(descriptor, modelSelection.model);
|
|
85089
85356
|
const outputRef = yield* make$60("");
|
|
@@ -85096,7 +85363,7 @@ const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.
|
|
|
85096
85363
|
name: "agentlink-text-generation",
|
|
85097
85364
|
version: "0.0.0"
|
|
85098
85365
|
}
|
|
85099
|
-
}).pipe(provideService(Crypto, crypto));
|
|
85366
|
+
}).pipe(provideService(Crypto, crypto), provideService(FileSystem, fileSystem), provideService(Path, path));
|
|
85100
85367
|
yield* runtime.handleSessionUpdate((notification) => {
|
|
85101
85368
|
const update = notification.update;
|
|
85102
85369
|
if (update.sessionUpdate !== "agent_message_chunk") return void_$1;
|
|
@@ -85765,7 +86032,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
85765
86032
|
version: "0.0.0"
|
|
85766
86033
|
},
|
|
85767
86034
|
...acpNativeLoggers
|
|
85768
|
-
}).pipe(provideService(Crypto, crypto), provideService(Scope, sessionScope), mapError((cause) => new ProviderAdapterProcessError({
|
|
86035
|
+
}).pipe(provideService(Crypto, crypto), provideService(FileSystem, fileSystem), provideService(Path, path), provideService(Scope, sessionScope), mapError((cause) => new ProviderAdapterProcessError({
|
|
85769
86036
|
provider: PROVIDER,
|
|
85770
86037
|
threadId: input.threadId,
|
|
85771
86038
|
detail: cause.message,
|
|
@@ -86597,7 +86864,8 @@ const KimiAcpAgent = {
|
|
|
86597
86864
|
acpArgs: ["acp"],
|
|
86598
86865
|
defaultModel: "kimi-k2",
|
|
86599
86866
|
builtInModels: ["kimi-k2", "kimi-for-coding"],
|
|
86600
|
-
supportsSessionLoad: false
|
|
86867
|
+
supportsSessionLoad: false,
|
|
86868
|
+
hostLocalTools: true
|
|
86601
86869
|
};
|
|
86602
86870
|
//#endregion
|
|
86603
86871
|
//#region src/provider/Drivers/KimiDriver.ts
|