alink-cli 0.8.8 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,8 @@
24
24
 
25
25
  选择你的电脑、选择 agent、选择工作目录,然后发任务。输出会实时流回;锁屏或关掉浏览器后,任务仍会继续在电脑上运行。
26
26
 
27
+ 同一台电脑只允许一个 AgentLink daemon 使用本机凭证运行;重复启动会被 CLI 拒绝,不会互相顶掉连接。
28
+
27
29
  ## 常用命令
28
30
 
29
31
  ```bash
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, 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`.
@@ -51832,28 +51884,33 @@ const UNSUPPORTED_STREAM_METHODS = /* @__PURE__ */ new Set([
51832
51884
  * failing `Effect` otherwise.
51833
51885
  */
51834
51886
  const unsupportedRpc = (() => ((method) => UNSUPPORTED_STREAM_METHODS.has(method) ? fail$5(new UnsupportedRpcError({ method })) : new UnsupportedRpcError({ method })))();
51887
+ const wsRpcServices = gen(function* () {
51888
+ return {
51889
+ crypto: yield* Crypto,
51890
+ projectionSnapshotQuery: yield* ProjectionSnapshotQuery,
51891
+ orchestrationEngine: yield* OrchestrationEngineService,
51892
+ keybindings: yield* Keybindings,
51893
+ externalLauncher: yield* ExternalLauncher,
51894
+ providerRegistry: yield* ProviderRegistry,
51895
+ config: yield* ServerConfig,
51896
+ lifecycleEvents: yield* ServerLifecycleEvents,
51897
+ serverSettings: yield* ServerSettingsService,
51898
+ startup: yield* ServerRuntimeStartup,
51899
+ workspaceEntries: yield* WorkspaceEntries,
51900
+ workspaceFileSystem: yield* WorkspaceFileSystem,
51901
+ serverEnvironment: yield* ServerEnvironment,
51902
+ backgroundPolicy: yield* BackgroundPolicy,
51903
+ serverAuth: yield* EnvironmentAuth,
51904
+ bootstrapCredentials: yield* PairingGrantStore,
51905
+ sessions: yield* SessionStore
51906
+ };
51907
+ });
51835
51908
  const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
51836
51909
  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;
51910
+ const { crypto, projectionSnapshotQuery, orchestrationEngine, keybindings, externalLauncher, providerRegistry, config, lifecycleEvents, serverSettings, startup, workspaceEntries, workspaceFileSystem, serverEnvironment, backgroundPolicy, serverAuth, bootstrapCredentials, sessions } = yield* wsRpcServices;
51843
51911
  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
51912
  const rpcClientIds = yield* make$60(/* @__PURE__ */ new Set());
51853
51913
  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
51914
  const authorizationError = (requiredScope) => new EnvironmentAuthorizationError({
51858
51915
  message: `The authenticated token is missing required scope: ${requiredScope}.`,
51859
51916
  requiredScope
@@ -51996,20 +52053,12 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
51996
52053
  return startup.enqueueCommand(dispatchEffect).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
51997
52054
  };
51998
52055
  const loadServerConfig = gen(function* () {
51999
- console.error("[DEBUG-provider-checking-20260820] getConfig start");
52000
52056
  const keybindingsConfig = yield* keybindings.loadConfigState;
52001
- console.error("[DEBUG-provider-checking-20260820] getConfig keybindings");
52002
52057
  const providers = yield* providerRegistry.getProviders;
52003
- console.error("[DEBUG-provider-checking-20260820] getConfig providers");
52004
52058
  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
52059
  return {
52011
- environment,
52012
- auth,
52060
+ environment: yield* serverEnvironment.getDescriptor,
52061
+ auth: yield* serverAuth.getDescriptor(),
52013
52062
  cwd: config.cwd,
52014
52063
  keybindingsConfigPath: config.keybindingsConfigPath,
52015
52064
  keybindings: keybindingsConfig.keybindings,
@@ -52425,30 +52474,17 @@ const makeTunnelSocketProtocol = gen(function* () {
52425
52474
  };
52426
52475
  clients.set(id, { write });
52427
52476
  clientIds.add(id);
52428
- console.error("[DEBUG-provider-checking-20260820] rpc socket ready", { clientId: id });
52429
52477
  yield* socket.runRaw((data) => {
52430
52478
  try {
52431
- console.error("[DEBUG-provider-checking-20260820] rpc input", { byteLength: typeof data === "string" ? data.length : data.byteLength });
52432
52479
  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
52480
  if (decoded.length === 0) return void_$1;
52441
52481
  let i = 0;
52442
52482
  return whileLoop({
52443
52483
  while: () => i < decoded.length,
52444
- body: () => {
52445
- console.error("[DEBUG-provider-checking-20260820] rpc dispatch", { clientId: id });
52446
- return writeRequest(id, decoded[i++]);
52447
- },
52484
+ body: () => writeRequest(id, decoded[i++]),
52448
52485
  step: () => void 0
52449
52486
  });
52450
52487
  } catch (cause) {
52451
- console.error("[DEBUG-provider-checking-20260820] rpc decode error", { message: cause instanceof Error ? cause.message : String(cause) });
52452
52488
  if (isTagged(cause, "MaxBufferSizeExceeded")) return orDie(writeRaw(new CloseEvent(1009, String(cause))));
52453
52489
  const defect = parser.encode(ResponseDefectEncoded(cause));
52454
52490
  return defect === void 0 ? void_$1 : orDie(writeRaw(defect));
@@ -52502,15 +52538,12 @@ const makeTunnelSocket = (input) => {
52502
52538
  input.tunnel.onDecryptedFrame = deliver;
52503
52539
  for (const frame of input.tunnel.pendingFrames.splice(0)) deliver(frame);
52504
52540
  if (options?.onOpen) yield* options.onOpen;
52505
- yield* _await(input.tunnel.closed).pipe(raceFirst(join(fiberSet)));
52541
+ yield* _await(input.tunnel.closed).pipe(raceFirst(join$1(fiberSet)));
52506
52542
  }));
52507
52543
  return make$63({
52508
52544
  runRaw,
52509
52545
  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
- }
52546
+ if (typeof chunk === "string") input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey, chunk)));
52514
52547
  }))
52515
52548
  });
52516
52549
  };
@@ -52519,6 +52552,8 @@ const runHubTunnel = (config) => gen(function* () {
52519
52552
  const sessionsStore = yield* SessionStore;
52520
52553
  const serverConfig = yield* ServerConfig;
52521
52554
  const httpClient = yield* HttpClient;
52555
+ yield* wsRpcServices.pipe(asVoid);
52556
+ yield* ChildProcessSpawner;
52522
52557
  yield* retry(gen(function* () {
52523
52558
  yield* logInfo("hub tunnel: connection effect entered");
52524
52559
  const url = `${config.hubUrl.replace(/\/+$/, "")}/daemon-tunnel?token=${encodeURIComponent(config.machineToken)}&v=1`;
@@ -52577,14 +52612,16 @@ const runHubTunnel = (config) => gen(function* () {
52577
52612
  }
52578
52613
  });
52579
52614
  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");
52615
+ yield* forkScoped(gen(function* () {
52616
+ const currentContext = yield* context();
52617
+ const rpcContext = yield* build(makeWsRpcLayer({
52618
+ sessionId: issued.sessionId,
52619
+ subject: "hub-tunnel",
52620
+ method: "bearer-access-token",
52621
+ scopes: [...TUNNEL_SCOPES]
52622
+ }).pipe(provideMerge(layerJson), provide(layer$8))).pipe(provideContext(currentContext));
52623
+ yield* make$13(WsRpcGroup, { disableTracing: true }).pipe(provideService(Protocol, protocol), provideContext(rpcContext));
52624
+ }).pipe(tapCause((cause) => logError("hub tunnel: RPC server failed", { cause: String(cause) }))));
52588
52625
  yield* forkScoped(onSocket(socketAdapter));
52589
52626
  if (!writeHub(JSON.stringify({
52590
52627
  type: "tunnel_open",
@@ -52700,16 +52737,7 @@ const runHubTunnel = (config) => gen(function* () {
52700
52737
  tunnelId,
52701
52738
  error
52702
52739
  })));
52703
- let debugProviderCheckingFrameCount = 0;
52704
52740
  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
52741
  const data = typeof rawData === "string" ? rawData : rawData instanceof Uint8Array ? hubFrameDecoder.decode(rawData) : null;
52714
52742
  if (data === null) return;
52715
52743
  if (data.startsWith("{")) {
@@ -52732,8 +52760,8 @@ const runHubTunnel = (config) => gen(function* () {
52732
52760
  onDecryptedFrame: null
52733
52761
  };
52734
52762
  tunnels.set(tunnelId, live);
52735
- if (purpose === "http") runFork(scoped(attachHttpTunnel(tunnelId, live)));
52736
- else runFork(scoped(attachRpcTunnel(tunnelId, live)));
52763
+ if (purpose === "http") yield* forkScoped(scoped(attachHttpTunnel(tunnelId, live)));
52764
+ else yield* forkScoped(scoped(attachRpcTunnel(tunnelId, live)));
52737
52765
  });
52738
52766
  }
52739
52767
  if (control.type === "tunnel_close" && typeof control.tunnelId === "string") dropTunnel(control.tunnelId);
@@ -52756,11 +52784,6 @@ const runHubTunnel = (config) => gen(function* () {
52756
52784
  } catch {
52757
52785
  return dropTunnel(framed.tunnelId);
52758
52786
  }
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
52787
  if (live.onDecryptedFrame) live.onDecryptedFrame(frame);
52765
52788
  else if (live.pendingFrames.length < 16) live.pendingFrames.push(frame);
52766
52789
  else dropTunnel(framed.tunnelId);
@@ -84754,7 +84777,7 @@ const make$3 = (options) => gen(function* () {
84754
84777
  status: "started"
84755
84778
  });
84756
84779
  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, {
84780
+ 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
84781
  onNone: () => fail(new AcpTransportError({
84759
84782
  operation: "call-rpc",
84760
84783
  method: "session/load",
@@ -84849,7 +84872,7 @@ const make$3 = (options) => gen(function* () {
84849
84872
  const cancelledResponse = { stopReason: "cancelled" };
84850
84873
  const promptRpcFiber = yield* runLoggedRequest("session/prompt", requestPayload, acp.agent.prompt(requestPayload)).pipe(forkIn(runtimeScope));
84851
84874
  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* () {
84875
+ return yield* join$2(promptRpcFiber).pipe(catchCause((cause) => hasInterruptsOnly(cause) ? succeed$1(cancelledResponse) : failCause$1(cause)), ensuring(gen(function* () {
84853
84876
  yield* interrupt$4(promptRpcFiber).pipe(ignore$1);
84854
84877
  yield* set$2(activePromptFiberRef, none());
84855
84878
  })), tap(() => closeActiveAssistantSegment({
@@ -89612,13 +89635,17 @@ const runServer = launch(unwrap(gen(function* () {
89612
89635
  ...config.tailscaleServeEnabled ? [_await(tailscaleParked)] : []
89613
89636
  ], { concurrency: "unbounded" }).pipe(asVoid)
89614
89637
  }).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));
89638
+ 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
89639
  })));
89617
89640
  //#endregion
89618
89641
  //#region src/cli/server.ts
89619
89642
  const runServerCommand = (flags, options) => gen(function* () {
89620
89643
  const config = yield* resolveServerConfig(flags, yield* LogLevel, options);
89621
- return yield* runServer.pipe(provideService(ServerConfig, config));
89644
+ const releaseDaemonLock = yield* try_({
89645
+ try: () => acquireDaemonLock(config.stateDir),
89646
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
89647
+ });
89648
+ return yield* runServer.pipe(provideService(ServerConfig, config), ensuring(sync(releaseDaemonLock)));
89622
89649
  });
89623
89650
  const startCommand = make$59("start", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)));
89624
89651
  const serveCommand = make$59("serve", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server without opening a browser."), withHandler((flags) => runServerCommand(flags, {