alink-cli 0.8.8 → 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 CHANGED
@@ -1,16 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
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, 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$1, 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";
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, 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";
8
8
  import * as NodeChildProcess from "node:child_process";
9
9
  import * as NodeCrypto from "node:crypto";
10
- import { createCipheriv, createDecipheriv, hkdfSync, randomBytes } from "node:crypto";
10
+ import { createCipheriv, createDecipheriv, hkdfSync, randomBytes, randomUUID } from "node:crypto";
11
11
  import * as NodeFS from "node:fs";
12
+ import { closeSync, mkdirSync, openSync, readFileSync, rmSync, writeSync } from "node:fs";
12
13
  import * as NodeOS from "node:os";
13
14
  import * as NodePath from "node:path";
15
+ import { join } from "node:path";
14
16
  import { fileURLToPath } from "node:url";
15
17
  import * as NodeReadline from "node:readline";
16
18
  import { parse } from "yaml";
@@ -33275,7 +33277,7 @@ const probeEnvironmentDescriptor = (baseUrl) => gen(function* () {
33275
33277
  descriptor: yield* filterStatusOk(response).pipe(flatMap$1(schemaBodyJson(ExecutionEnvironmentDescriptor)), mapError(() => ({ _tag: "not-a-t3-server" })))
33276
33278
  };
33277
33279
  }).pipe(catch_((outcome) => succeed$1(outcome)));
33278
- const isProcessAlive = (pid) => {
33280
+ const isProcessAlive$1 = (pid) => {
33279
33281
  try {
33280
33282
  process.kill(pid, 0);
33281
33283
  return true;
@@ -33298,7 +33300,7 @@ const discoverPairTarget = fn("pair.discoverPairTarget")(function* (explicitBase
33298
33300
  checkedStatePaths.push(statePath);
33299
33301
  const state = yield* readPersistedServerRuntimeState(statePath);
33300
33302
  if (isNone(state)) continue;
33301
- if (!isProcessAlive(state.value.pid)) continue;
33303
+ if (!isProcessAlive$1(state.value.pid)) continue;
33302
33304
  const probed = yield* probeEnvironmentDescriptor(state.value.origin);
33303
33305
  if (probed._tag !== "descriptor") continue;
33304
33306
  return {
@@ -42910,6 +42912,56 @@ const projectCommand = make$59("project").pipe(withDescription("Manage projects.
42910
42912
  projectRenameCommand
42911
42913
  ]));
42912
42914
  //#endregion
42915
+ //#region src/daemonLock.ts
42916
+ const LOCK_FILE = "daemon.lock";
42917
+ function isProcessAlive(pid) {
42918
+ try {
42919
+ process.kill(pid, 0);
42920
+ return true;
42921
+ } catch (error) {
42922
+ return error.code === "EPERM";
42923
+ }
42924
+ }
42925
+ function readLock(path) {
42926
+ try {
42927
+ const record = JSON.parse(readFileSync(path, "utf8"));
42928
+ const pid = typeof record.pid === "number" ? record.pid : -1;
42929
+ return Number.isInteger(pid) && pid > 0 && typeof record.token === "string" ? {
42930
+ pid,
42931
+ token: record.token
42932
+ } : void 0;
42933
+ } catch {
42934
+ return;
42935
+ }
42936
+ }
42937
+ function acquireDaemonLock(stateDir) {
42938
+ mkdirSync(stateDir, { recursive: true });
42939
+ const path = join(stateDir, LOCK_FILE);
42940
+ const token = randomUUID();
42941
+ for (;;) try {
42942
+ const fd = openSync(path, "wx", 384);
42943
+ writeSync(fd, JSON.stringify({
42944
+ pid: process.pid,
42945
+ token
42946
+ }));
42947
+ let released = false;
42948
+ return () => {
42949
+ if (released) return;
42950
+ released = true;
42951
+ try {
42952
+ if (readLock(path)?.token === token) rmSync(path, { force: true });
42953
+ } finally {
42954
+ closeSync(fd);
42955
+ }
42956
+ };
42957
+ } catch (error) {
42958
+ if (error.code !== "EEXIST") throw error;
42959
+ const owner = readLock(path);
42960
+ if (owner && isProcessAlive(owner.pid)) throw new Error(`已有 AgentLink daemon 正在运行(pid ${owner.pid})。请先停止它再启动。`);
42961
+ rmSync(path, { force: true });
42962
+ }
42963
+ }
42964
+ //#endregion
42913
42965
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/httpapi/HttpApiBuilder.js
42914
42966
  /**
42915
42967
  * Registers an `HttpApi` with a `HttpRouter`.
@@ -49146,6 +49198,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49146
49198
  const services = yield* context();
49147
49199
  const scope = get$5(services, Scope);
49148
49200
  const entries = /* @__PURE__ */ new Map();
49201
+ const hooks = yield* serviceOption(RequestHooks);
49149
49202
  let isShutdown = false;
49150
49203
  yield* addFinalizer$1(scope, withFiber$1((parent) => {
49151
49204
  isShutdown = true;
@@ -49176,6 +49229,11 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49176
49229
  const onEffectRequest = (rpc, middleware, span, payload, headers, context, discard) => withFiber$1((parentFiber) => {
49177
49230
  if (isShutdown) return interrupt$1;
49178
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;
49179
49237
  const send = middleware((message) => options.onFromClient({
49180
49238
  message,
49181
49239
  context,
@@ -49192,7 +49250,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49192
49250
  } : {},
49193
49251
  headers: merge(parentFiber.getRef(CurrentHeaders), headers)
49194
49252
  });
49195
- if (discard) return send;
49253
+ if (discard) return onStart.pipe(andThen(send));
49196
49254
  let fiber;
49197
49255
  return onInterrupt(callback((resume) => {
49198
49256
  const entry = {
@@ -49207,13 +49265,14 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49207
49265
  }
49208
49266
  };
49209
49267
  entries.set(id, entry);
49210
- fiber = send.pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, runForkWith(parentFiber.context));
49268
+ fiber = onStart.pipe(andThen(send), span ? withParentSpan(span, { captureStackTrace: false }) : identity, runForkWith(parentFiber.context));
49211
49269
  fiber.addObserver((exit) => {
49212
49270
  if (exit._tag === "Failure") return resume(exit);
49213
49271
  });
49214
49272
  }), (interruptors) => {
49273
+ const entry = entries.get(id);
49215
49274
  entries.delete(id);
49216
- 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));
49217
49276
  });
49218
49277
  });
49219
49278
  const onStreamRequest = fnUntraced(function* (rpc, middleware, payload, headers, streamBufferSize, context) {
@@ -49221,11 +49280,17 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49221
49280
  const span = disableTracing ? void 0 : yield* makeSpanScoped(`${spanPrefix}.${rpc._tag}`, { attributes: options.spanAttributes });
49222
49281
  const fiber = getCurrent();
49223
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;
49224
49288
  const scope = getUnsafe$1(fiber.context, Scope);
49225
49289
  yield* addFinalizerExit(scope, (exit) => {
49226
- if (!entries.has(id)) return void_$1;
49290
+ const entry = entries.get(id);
49291
+ if (!entry) return void_$1;
49227
49292
  entries.delete(id);
49228
- 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);
49229
49294
  });
49230
49295
  const queue = yield* bounded(streamBufferSize);
49231
49296
  entries.set(id, {
@@ -49233,9 +49298,10 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49233
49298
  rpc,
49234
49299
  queue,
49235
49300
  scope,
49236
- context
49301
+ context,
49302
+ chunkCount: 0
49237
49303
  });
49238
- yield* middleware((message) => options.onFromClient({
49304
+ yield* onStart.pipe(andThen(middleware((message) => options.onFromClient({
49239
49305
  message,
49240
49306
  context,
49241
49307
  discard: false
@@ -49250,7 +49316,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49250
49316
  sampled: span.sampled
49251
49317
  } : {},
49252
49318
  headers: merge(fiber.getRef(CurrentHeaders), headers)
49253
- }).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 }));
49254
49320
  return queue;
49255
49321
  });
49256
49322
  const getRpcClientMiddleware = (rpc) => {
@@ -49272,7 +49338,10 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49272
49338
  });
49273
49339
  };
49274
49340
  };
49275
- const sendInterrupt = (requestId, interruptors, context) => callback((resume) => {
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) => {
49276
49345
  const parentFiber = getCurrent();
49277
49346
  options.onFromClient({
49278
49347
  message: {
@@ -49285,14 +49354,20 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49285
49354
  }).pipe(timeout(1e3), runForkWith(parentFiber.context)).addObserver(() => {
49286
49355
  resume(void_$1);
49287
49356
  });
49288
- });
49357
+ })));
49289
49358
  const write = (message) => {
49290
49359
  switch (message._tag) {
49291
49360
  case "Chunk": {
49292
49361
  const requestId = message.requestId;
49293
49362
  const entry = entries.get(requestId);
49294
49363
  if (!entry || entry._tag !== "Queue") return void_$1;
49295
- return offerAll(entry.queue, message.values).pipe(supportsAck ? flatMap$1(() => options.onFromClient({
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({
49296
49371
  message: {
49297
49372
  _tag: "Ack",
49298
49373
  requestId: message.requestId
@@ -49306,11 +49381,16 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
49306
49381
  const entry = entries.get(requestId);
49307
49382
  if (!entry) return void_$1;
49308
49383
  entries.delete(requestId);
49309
- if (entry._tag === "Effect") {
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(() => {
49310
49391
  entry.resume(message.exit);
49311
- return void_$1;
49312
- }
49313
- 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)));
49314
49394
  }
49315
49395
  case "Defect": return clearEntries(die$1(message.defect));
49316
49396
  case "ClientEnd": return void_$1;
@@ -49491,6 +49571,11 @@ var Protocol$1 = class extends Service$2()("effect/rpc/RpcClient/Protocol") {
49491
49571
  */
49492
49572
  static make = withRunClient;
49493
49573
  };
49574
+ /**
49575
+ * @since 4.0.0
49576
+ * @category RequestHooks
49577
+ */
49578
+ var RequestHooks = class extends Service$2()("effect/rpc/RpcClient/RequestHooks") {};
49494
49579
  Service$2()("effect/rpc/RpcClient/ConnectionHooks");
49495
49580
  const decodeDefect = /*#__PURE__*/ decodeSync(/*#__PURE__*/ Defect());
49496
49581
  //#endregion
@@ -51832,28 +51917,33 @@ const UNSUPPORTED_STREAM_METHODS = /* @__PURE__ */ new Set([
51832
51917
  * failing `Effect` otherwise.
51833
51918
  */
51834
51919
  const unsupportedRpc = (() => ((method) => UNSUPPORTED_STREAM_METHODS.has(method) ? fail$5(new UnsupportedRpcError({ method })) : new UnsupportedRpcError({ method })))();
51920
+ const wsRpcServices = gen(function* () {
51921
+ return {
51922
+ crypto: yield* Crypto,
51923
+ projectionSnapshotQuery: yield* ProjectionSnapshotQuery,
51924
+ orchestrationEngine: yield* OrchestrationEngineService,
51925
+ keybindings: yield* Keybindings,
51926
+ externalLauncher: yield* ExternalLauncher,
51927
+ providerRegistry: yield* ProviderRegistry,
51928
+ config: yield* ServerConfig,
51929
+ lifecycleEvents: yield* ServerLifecycleEvents,
51930
+ serverSettings: yield* ServerSettingsService,
51931
+ startup: yield* ServerRuntimeStartup,
51932
+ workspaceEntries: yield* WorkspaceEntries,
51933
+ workspaceFileSystem: yield* WorkspaceFileSystem,
51934
+ serverEnvironment: yield* ServerEnvironment,
51935
+ backgroundPolicy: yield* BackgroundPolicy,
51936
+ serverAuth: yield* EnvironmentAuth,
51937
+ bootstrapCredentials: yield* PairingGrantStore,
51938
+ sessions: yield* SessionStore
51939
+ };
51940
+ });
51835
51941
  const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
51836
51942
  const currentSessionId = currentSession.sessionId;
51837
- const crypto = yield* Crypto;
51838
- const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
51839
- const orchestrationEngine = yield* OrchestrationEngineService;
51840
- const keybindings = yield* Keybindings;
51841
- const externalLauncher = yield* ExternalLauncher;
51842
- const providerRegistry = yield* ProviderRegistry;
51943
+ const { crypto, projectionSnapshotQuery, orchestrationEngine, keybindings, externalLauncher, providerRegistry, config, lifecycleEvents, serverSettings, startup, workspaceEntries, workspaceFileSystem, serverEnvironment, backgroundPolicy, serverAuth, bootstrapCredentials, sessions } = yield* wsRpcServices;
51843
51944
  const providerMaintenanceRunner = yield* ProviderMaintenanceRunner;
51844
- const config = yield* ServerConfig;
51845
- const lifecycleEvents = yield* ServerLifecycleEvents;
51846
- const serverSettings = yield* ServerSettingsService;
51847
- const startup = yield* ServerRuntimeStartup;
51848
- const workspaceEntries = yield* WorkspaceEntries;
51849
- const workspaceFileSystem = yield* WorkspaceFileSystem;
51850
- const serverEnvironment = yield* ServerEnvironment;
51851
- const backgroundPolicy = yield* BackgroundPolicy;
51852
51945
  const rpcClientIds = yield* make$60(/* @__PURE__ */ new Set());
51853
51946
  yield* addFinalizer(() => get$3(rpcClientIds).pipe(flatMap$1((clientIds) => forEach(clientIds, (clientId) => backgroundPolicy.removeRpcClient(currentSessionId, clientId), { discard: true })), ignore$1));
51854
- const serverAuth = yield* EnvironmentAuth;
51855
- const bootstrapCredentials = yield* PairingGrantStore;
51856
- const sessions = yield* SessionStore;
51857
51947
  const authorizationError = (requiredScope) => new EnvironmentAuthorizationError({
51858
51948
  message: `The authenticated token is missing required scope: ${requiredScope}.`,
51859
51949
  requiredScope
@@ -51996,20 +52086,12 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
51996
52086
  return startup.enqueueCommand(dispatchEffect).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
51997
52087
  };
51998
52088
  const loadServerConfig = gen(function* () {
51999
- console.error("[DEBUG-provider-checking-20260820] getConfig start");
52000
52089
  const keybindingsConfig = yield* keybindings.loadConfigState;
52001
- console.error("[DEBUG-provider-checking-20260820] getConfig keybindings");
52002
52090
  const providers = yield* providerRegistry.getProviders;
52003
- console.error("[DEBUG-provider-checking-20260820] getConfig providers");
52004
52091
  const settings = redactServerSettingsForClient(yield* serverSettings.getSettings);
52005
- console.error("[DEBUG-provider-checking-20260820] getConfig settings");
52006
- const environment = yield* serverEnvironment.getDescriptor;
52007
- console.error("[DEBUG-provider-checking-20260820] getConfig environment");
52008
- const auth = yield* serverAuth.getDescriptor();
52009
- console.error("[DEBUG-provider-checking-20260820] getConfig auth");
52010
52092
  return {
52011
- environment,
52012
- auth,
52093
+ environment: yield* serverEnvironment.getDescriptor,
52094
+ auth: yield* serverAuth.getDescriptor(),
52013
52095
  cwd: config.cwd,
52014
52096
  keybindingsConfigPath: config.keybindingsConfigPath,
52015
52097
  keybindings: keybindingsConfig.keybindings,
@@ -52355,6 +52437,75 @@ function envelopeToUtf8(enckey, envelope) {
52355
52437
  function isEnvelope(value) {
52356
52438
  return typeof value === "object" && value !== null && value.e2e === 1 && typeof value.iv === "string" && typeof value.ct === "string";
52357
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
+ }
52358
52509
  //#endregion
52359
52510
  //#region src/tunnel/bridge.ts
52360
52511
  const TUNNEL_SCOPES = [AuthOrchestrationReadScope, AuthOrchestrationOperateScope];
@@ -52425,30 +52576,17 @@ const makeTunnelSocketProtocol = gen(function* () {
52425
52576
  };
52426
52577
  clients.set(id, { write });
52427
52578
  clientIds.add(id);
52428
- console.error("[DEBUG-provider-checking-20260820] rpc socket ready", { clientId: id });
52429
52579
  yield* socket.runRaw((data) => {
52430
52580
  try {
52431
- console.error("[DEBUG-provider-checking-20260820] rpc input", { byteLength: typeof data === "string" ? data.length : data.byteLength });
52432
52581
  const decoded = parser.decode(data);
52433
- console.error("[DEBUG-provider-checking-20260820] rpc decoded", {
52434
- count: decoded.length,
52435
- messages: decoded.map((item) => typeof item === "object" && item !== null ? {
52436
- tag: "tag" in item ? String(item.tag) : void 0,
52437
- id: "id" in item ? String(item.id) : void 0
52438
- } : { type: typeof item })
52439
- });
52440
52582
  if (decoded.length === 0) return void_$1;
52441
52583
  let i = 0;
52442
52584
  return whileLoop({
52443
52585
  while: () => i < decoded.length,
52444
- body: () => {
52445
- console.error("[DEBUG-provider-checking-20260820] rpc dispatch", { clientId: id });
52446
- return writeRequest(id, decoded[i++]);
52447
- },
52586
+ body: () => writeRequest(id, decoded[i++]),
52448
52587
  step: () => void 0
52449
52588
  });
52450
52589
  } catch (cause) {
52451
- console.error("[DEBUG-provider-checking-20260820] rpc decode error", { message: cause instanceof Error ? cause.message : String(cause) });
52452
52590
  if (isTagged(cause, "MaxBufferSizeExceeded")) return orDie(writeRaw(new CloseEvent(1009, String(cause))));
52453
52591
  const defect = parser.encode(ResponseDefectEncoded(cause));
52454
52592
  return defect === void 0 ? void_$1 : orDie(writeRaw(defect));
@@ -52502,15 +52640,12 @@ const makeTunnelSocket = (input) => {
52502
52640
  input.tunnel.onDecryptedFrame = deliver;
52503
52641
  for (const frame of input.tunnel.pendingFrames.splice(0)) deliver(frame);
52504
52642
  if (options?.onOpen) yield* options.onOpen;
52505
- yield* _await(input.tunnel.closed).pipe(raceFirst(join(fiberSet)));
52643
+ yield* _await(input.tunnel.closed).pipe(raceFirst(join$1(fiberSet)));
52506
52644
  }));
52507
52645
  return make$63({
52508
52646
  runRaw,
52509
52647
  writer: sync(() => (chunk) => sync(() => {
52510
- if (typeof chunk === "string") {
52511
- console.error("[DEBUG-provider-checking-20260820] rpc outbound", { byteLength: chunk.length });
52512
- input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey, chunk)));
52513
- }
52648
+ if (typeof chunk === "string") for (const part of chunkAgentLinkFrame(chunk)) input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey, part)));
52514
52649
  }))
52515
52650
  });
52516
52651
  };
@@ -52519,6 +52654,8 @@ const runHubTunnel = (config) => gen(function* () {
52519
52654
  const sessionsStore = yield* SessionStore;
52520
52655
  const serverConfig = yield* ServerConfig;
52521
52656
  const httpClient = yield* HttpClient;
52657
+ yield* wsRpcServices.pipe(asVoid);
52658
+ yield* ChildProcessSpawner;
52522
52659
  yield* retry(gen(function* () {
52523
52660
  yield* logInfo("hub tunnel: connection effect entered");
52524
52661
  const url = `${config.hubUrl.replace(/\/+$/, "")}/daemon-tunnel?token=${encodeURIComponent(config.machineToken)}&v=1`;
@@ -52577,14 +52714,16 @@ const runHubTunnel = (config) => gen(function* () {
52577
52714
  }
52578
52715
  });
52579
52716
  const { protocol, onSocket } = yield* makeTunnelSocketProtocol.pipe(provide$1(layerJson));
52580
- console.error("[DEBUG-provider-checking-20260820] rpc server starting");
52581
- yield* forkScoped(make$13(WsRpcGroup, { disableTracing: true }).pipe(provideService(Protocol, protocol), provide$1(makeWsRpcLayer({
52582
- sessionId: issued.sessionId,
52583
- subject: "hub-tunnel",
52584
- method: "bearer-access-token",
52585
- scopes: [...TUNNEL_SCOPES]
52586
- }).pipe(provideMerge(layerJson), provide(layer$8))), tapCause((cause) => logError("hub tunnel: RPC server failed", { cause: String(cause) }))));
52587
- console.error("[DEBUG-provider-checking-20260820] rpc server started");
52717
+ yield* forkScoped(gen(function* () {
52718
+ const currentContext = yield* context();
52719
+ const rpcContext = yield* build(makeWsRpcLayer({
52720
+ sessionId: issued.sessionId,
52721
+ subject: "hub-tunnel",
52722
+ method: "bearer-access-token",
52723
+ scopes: [...TUNNEL_SCOPES]
52724
+ }).pipe(provideMerge(layerJson), provide(layer$8))).pipe(provideContext(currentContext));
52725
+ yield* make$13(WsRpcGroup, { disableTracing: true }).pipe(provideService(Protocol, protocol), provideContext(rpcContext));
52726
+ }).pipe(tapCause((cause) => logError("hub tunnel: RPC server failed", { cause: String(cause) }))));
52588
52727
  yield* forkScoped(onSocket(socketAdapter));
52589
52728
  if (!writeHub(JSON.stringify({
52590
52729
  type: "tunnel_open",
@@ -52620,8 +52759,13 @@ const runHubTunnel = (config) => gen(function* () {
52620
52759
  const localBaseUrl = `http://127.0.0.1:${serverConfig.port}`;
52621
52760
  const sendEncrypted = (frame) => {
52622
52761
  try {
52623
- const envelope = utf8ToEnvelope(config.enckey, encodeHttpTunnelResponseFrame(frame));
52624
- if (!writeHub(`${tunnelId} ${JSON.stringify(envelope)}`)) dropTunnel(tunnelId);
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
+ }
52625
52769
  } catch {
52626
52770
  dropTunnel(tunnelId);
52627
52771
  }
@@ -52700,16 +52844,7 @@ const runHubTunnel = (config) => gen(function* () {
52700
52844
  tunnelId,
52701
52845
  error
52702
52846
  })));
52703
- let debugProviderCheckingFrameCount = 0;
52704
52847
  yield* socket.runRaw((rawData) => {
52705
- if (debugProviderCheckingFrameCount < 20) {
52706
- debugProviderCheckingFrameCount += 1;
52707
- console.error("[DEBUG-provider-checking-20260820] hub frame", {
52708
- count: debugProviderCheckingFrameCount,
52709
- type: typeof rawData,
52710
- byteLength: typeof rawData === "string" ? rawData.length : rawData instanceof Uint8Array ? rawData.byteLength : -1
52711
- });
52712
- }
52713
52848
  const data = typeof rawData === "string" ? rawData : rawData instanceof Uint8Array ? hubFrameDecoder.decode(rawData) : null;
52714
52849
  if (data === null) return;
52715
52850
  if (data.startsWith("{")) {
@@ -52729,14 +52864,16 @@ const runHubTunnel = (config) => gen(function* () {
52729
52864
  closed,
52730
52865
  pendingFrames: [],
52731
52866
  purpose,
52732
- onDecryptedFrame: null
52867
+ onDecryptedFrame: null,
52868
+ assembleFrame: makeAgentLinkFrameAssembler()
52733
52869
  };
52734
52870
  tunnels.set(tunnelId, live);
52735
- if (purpose === "http") runFork(scoped(attachHttpTunnel(tunnelId, live)));
52736
- else runFork(scoped(attachRpcTunnel(tunnelId, live)));
52871
+ if (purpose === "http") yield* forkScoped(scoped(attachHttpTunnel(tunnelId, live)));
52872
+ else yield* forkScoped(scoped(attachRpcTunnel(tunnelId, live)));
52737
52873
  });
52738
52874
  }
52739
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));
52740
52877
  return;
52741
52878
  }
52742
52879
  const framed = splitHubFrame(data);
@@ -52756,13 +52893,15 @@ const runHubTunnel = (config) => gen(function* () {
52756
52893
  } catch {
52757
52894
  return dropTunnel(framed.tunnelId);
52758
52895
  }
52759
- console.error("[DEBUG-provider-checking-20260820] frame decrypted", {
52760
- tunnelId: framed.tunnelId,
52761
- byteLength: frame.length,
52762
- delivery: live.onDecryptedFrame ? "deliver" : "pending"
52763
- });
52764
- if (live.onDecryptedFrame) live.onDecryptedFrame(frame);
52765
- else if (live.pendingFrames.length < 16) live.pendingFrames.push(frame);
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);
52766
52905
  else dropTunnel(framed.tunnelId);
52767
52906
  return;
52768
52907
  }
@@ -84111,6 +84250,149 @@ const layerChildProcess = (handle, options = {}) => {
84111
84250
  return effect(AcpClient, make$4(stdio, options, terminationError));
84112
84251
  };
84113
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
84114
84396
  //#region ../t3-shared/src/toolActivity.ts
84115
84397
  function asRecord(value) {
84116
84398
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -84644,13 +84926,18 @@ const make$3 = (options) => gen(function* () {
84644
84926
  params: notification
84645
84927
  });
84646
84928
  }));
84929
+ if (options.hostLocalTools === true) yield* registerLocalToolHandlers({
84930
+ acp,
84931
+ cwd: options.cwd
84932
+ });
84933
+ const hostLocalTools = options.hostLocalTools === true;
84647
84934
  const initializeClientCapabilities = {
84648
84935
  fs: {
84649
- readTextFile: false,
84650
- writeTextFile: false,
84936
+ readTextFile: hostLocalTools,
84937
+ writeTextFile: hostLocalTools,
84651
84938
  ...options.clientCapabilities?.fs
84652
84939
  },
84653
- terminal: options.clientCapabilities?.terminal ?? false,
84940
+ terminal: options.clientCapabilities?.terminal ?? hostLocalTools,
84654
84941
  ...options.clientCapabilities?.auth ? { auth: options.clientCapabilities.auth } : {},
84655
84942
  ...options.clientCapabilities?.elicitation ? { elicitation: options.clientCapabilities.elicitation } : {},
84656
84943
  ...options.clientCapabilities?._meta ? { _meta: options.clientCapabilities._meta } : {}
@@ -84754,7 +85041,7 @@ const make$3 = (options) => gen(function* () {
84754
85041
  status: "started"
84755
85042
  });
84756
85043
  const idleFiber = yield* waitForSessionLoadReplayIdle({ gateRef: sessionLoadGateRef }).pipe(forkIn(runtimeScope));
84757
- return yield* raceFirst(acp.agent.loadSession(loadPayload), join$1(idleFiber)).pipe(ensuring(interrupt$4(idleFiber).pipe(ignore$1)), timeoutOption(sessionLoadTimeout), flatMap$1((result) => match$1(result, {
85044
+ return yield* raceFirst(acp.agent.loadSession(loadPayload), join$2(idleFiber)).pipe(ensuring(interrupt$4(idleFiber).pipe(ignore$1)), timeoutOption(sessionLoadTimeout), flatMap$1((result) => match$1(result, {
84758
85045
  onNone: () => fail(new AcpTransportError({
84759
85046
  operation: "call-rpc",
84760
85047
  method: "session/load",
@@ -84849,7 +85136,7 @@ const make$3 = (options) => gen(function* () {
84849
85136
  const cancelledResponse = { stopReason: "cancelled" };
84850
85137
  const promptRpcFiber = yield* runLoggedRequest("session/prompt", requestPayload, acp.agent.prompt(requestPayload)).pipe(forkIn(runtimeScope));
84851
85138
  yield* set$2(activePromptFiberRef, some(promptRpcFiber));
84852
- return yield* join$1(promptRpcFiber).pipe(catchCause((cause) => hasInterruptsOnly(cause) ? succeed$1(cancelledResponse) : failCause$1(cause)), ensuring(gen(function* () {
85139
+ return yield* join$2(promptRpcFiber).pipe(catchCause((cause) => hasInterruptsOnly(cause) ? succeed$1(cancelledResponse) : failCause$1(cause)), ensuring(gen(function* () {
84853
85140
  yield* interrupt$4(promptRpcFiber).pipe(ignore$1);
84854
85141
  yield* set$2(activePromptFiberRef, none());
84855
85142
  })), tap(() => closeActiveAssistantSegment({
@@ -84990,7 +85277,8 @@ const makeAcpAgentRuntime = (descriptor, input) => gen(function* () {
84990
85277
  ...input,
84991
85278
  spawn: buildAcpAgentSpawnInput(descriptor, input.settings, input.cwd, input.environment),
84992
85279
  authMethodId: "none",
84993
- skipAuthentication: true
85280
+ skipAuthentication: true,
85281
+ hostLocalTools: descriptor.hostLocalTools === true
84994
85282
  }).pipe(provide(succeed$3(ChildProcessSpawner, input.childProcessSpawner))));
84995
85283
  return yield* service(AcpSessionRuntime).pipe(provide$1(acpContext));
84996
85284
  });
@@ -85061,6 +85349,8 @@ const isTextGenerationError = is(TextGenerationError);
85061
85349
  const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.env) => gen(function* () {
85062
85350
  const crypto = yield* Crypto;
85063
85351
  const commandSpawner = yield* ChildProcessSpawner;
85352
+ const fileSystem = yield* FileSystem;
85353
+ const path = yield* Path;
85064
85354
  const runAcpAgentJson = ({ operation, cwd, prompt, outputSchemaJson, modelSelection }) => gen(function* () {
85065
85355
  const resolvedModel = resolveAcpAgentModelId(descriptor, modelSelection.model);
85066
85356
  const outputRef = yield* make$60("");
@@ -85073,7 +85363,7 @@ const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.
85073
85363
  name: "agentlink-text-generation",
85074
85364
  version: "0.0.0"
85075
85365
  }
85076
- }).pipe(provideService(Crypto, crypto));
85366
+ }).pipe(provideService(Crypto, crypto), provideService(FileSystem, fileSystem), provideService(Path, path));
85077
85367
  yield* runtime.handleSessionUpdate((notification) => {
85078
85368
  const update = notification.update;
85079
85369
  if (update.sessionUpdate !== "agent_message_chunk") return void_$1;
@@ -85742,7 +86032,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
85742
86032
  version: "0.0.0"
85743
86033
  },
85744
86034
  ...acpNativeLoggers
85745
- }).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({
85746
86036
  provider: PROVIDER,
85747
86037
  threadId: input.threadId,
85748
86038
  detail: cause.message,
@@ -86574,7 +86864,8 @@ const KimiAcpAgent = {
86574
86864
  acpArgs: ["acp"],
86575
86865
  defaultModel: "kimi-k2",
86576
86866
  builtInModels: ["kimi-k2", "kimi-for-coding"],
86577
- supportsSessionLoad: false
86867
+ supportsSessionLoad: false,
86868
+ hostLocalTools: true
86578
86869
  };
86579
86870
  //#endregion
86580
86871
  //#region src/provider/Drivers/KimiDriver.ts
@@ -89612,13 +89903,17 @@ const runServer = launch(unwrap(gen(function* () {
89612
89903
  ...config.tailscaleServeEnabled ? [_await(tailscaleParked)] : []
89613
89904
  ], { concurrency: "unbounded" }).pipe(asVoid)
89614
89905
  }).pipe(provideMerge(RuntimeDependenciesLive));
89615
- return mergeAll(serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }).pipe(tap$1(() => succeed$4(routesReady, void 0).pipe(orDie))), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, config.hubTunnel ? layer$4(config.hubTunnel) : empty$8).pipe(provideMerge(runtimeServicesLive), provide(activationLayer), provideMerge(HttpServerLive), provide(ApplicationObservabilityLive), provideMerge(layer$40), provideMerge(PlatformServicesLive));
89906
+ return mergeAll(serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }).pipe(tap$1(() => succeed$4(routesReady, void 0).pipe(orDie))), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, config.hubTunnel ? layer$4(config.hubTunnel).pipe(provideMerge(runtimeServicesLive)) : empty$8).pipe(provideMerge(runtimeServicesLive), provide(activationLayer), provideMerge(HttpServerLive), provide(ApplicationObservabilityLive), provideMerge(layer$40), provideMerge(PlatformServicesLive));
89616
89907
  })));
89617
89908
  //#endregion
89618
89909
  //#region src/cli/server.ts
89619
89910
  const runServerCommand = (flags, options) => gen(function* () {
89620
89911
  const config = yield* resolveServerConfig(flags, yield* LogLevel, options);
89621
- return yield* runServer.pipe(provideService(ServerConfig, config));
89912
+ const releaseDaemonLock = yield* try_({
89913
+ try: () => acquireDaemonLock(config.stateDir),
89914
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
89915
+ });
89916
+ return yield* runServer.pipe(provideService(ServerConfig, config), ensuring(sync(releaseDaemonLock)));
89622
89917
  });
89623
89918
  const startCommand = make$59("start", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)));
89624
89919
  const serveCommand = make$59("serve", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server without opening a browser."), withHandler((flags) => runServerCommand(flags, {