alink-cli 0.9.1 → 0.10.1

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,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { $ as make$65, 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$66, Yt as StatusCodeError, Z as awaitEmpty, Zt as empty$2, _ as get$3, _n as fromInput, _t as mergeCookies, a as layer$43, 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$63, yn as toRecord, yt as redirect, zt as make$64 } from "./NodeSocket-CLfrrutd.mjs";
4
- import { $ as decodeUnknownExit, $a as flatMap$1, $d as hasProperty, $l as format$1, $o as scopedWith, $s as TaggedError, $t as Union$1, $u as add$2, A as StructWithRest, Aa as asVoid, Ac as _await, Ai as make$75, An as encodeBase64, Ao as matchEffect, Ar as mapEffect$1, As as withSpan, At as suspend$1, B as Union, Ba as catchTags, Bc as succeed$4, Bi as offerUnsafe, Bn as now$1, Bo as provide$1, Br as provideService$1, Bs as forever$1, Bt as value, C as Number$1, Ca as andThen, Cc as forkUnsafe, Cd as map$6, Cl as CurrentLoggers$1, Cn as parseJson, Co as map$4, Cs as useSpan, Ct as isTrimmed, Cu as flatMapNullishOr, D as String$1, Da as annotateSpans, Dc as MinimumLogLevel, Dd as Number$2, Di as pipeTo, Dn as decodeBase64String, Do as match$2, Dr as make$74, Ds as withFiber$1, Dt as mutable, E as Record, Ea as annotateLogsScoped, Ec as provide$2, Ed as some, Ei as mapEffect$2, Er as isStream, Es as withErrorReporting, Et as makeFilter, Eu as isReadonlyArrayNonEmpty, Fi as failCause$3, Fl as reportCauseUnsafe, Fn as isGreaterThan$1, Fo as onInterrupt, Fr as onExit$1, Fs as snapshotUnsafe, Ft as toJsonSchemaDocument, G as annotateKey, Ga as currentParentSpan, Gc as isFailure, Gi as takeAll, Gl as ParentSpan, Gn as InvalidValue$1, Go as result, Gr as runFoldEffect, Gs as isDoneCause, Gt as toJsonSchemaMultiDocument, Gu as getOrUndefined$2, H as UnknownFromJsonString$1, Hc as fail$4, Hd as toJson, Hi as shutdown$1, Hn as toEpochMillis, Ho as provideService, Hr as runCollect, Hs as passthrough, Ht as toMultiDocumentOpenApi3_1, Hu as fail$1, I as URLFromString, Ia as catchFilter, Ic as isDeferred, Id as isEffect$1, In as isGreaterThanOrEqualTo$1, Io as option, Is as timer, It as toType, Iu as map$7, J as decodeEffect, Ja as ensuring, Ji as shutdown$2, Jl as make$77, Jn as Path, Jo as runForkWith, Js as Clock, K as brand, Ka as die, Kc as isSuccess, Kd as equals, Ki as unbounded$2, Kl as Tracer, Ko as retry, Kr as runForEach, Ks as parse$2, Kt as escapeToken, Ku as isFailure$1, L as Uint8Array$1, La as catchIf, Ld as withFiber, Li as make$78, Ln as isLessThan$1, Lo as orDie, Lr as pipeThroughChannel, Ls as update$3, Lt as withConstructorDefault, M as TaggedStruct, Ma as callback, Md as setStackTraceLimit, Mi as bounded, Mn as encodeHex, Mo as onError, Mr as merge$2, Ms as yieldNow, Mt as toCodecJson, Mu as reverse, N as TemplateLiteral, Na as catchCause, Nc as fail$3, Nd as Prototype, Ni as end, Nn as add$3, No as onExit, Ns as zipWith, Nt as toCodecJsonAST, Nu as sort, O as StringFromUriComponent, Oa as as, Oc as TracerEnabled, Od as make$72, On as decodeBase64Url, Oo as matchCauseEffect, Or as map$8, Ot as optional$3, Ou as map$5, Pa as catchDefect, Pc as failCause$2, Pd as PipeInspectableProto, Pn as formatIso, Ps as counter, Pt as toCodecStringTree, Q as decodeUnknownEffect, Qa as filterOrFail, Qc as StackTrace, Qd as compose$1, Ql as days, Qo as scoped, Qr as toAsyncIterable, Qs as TaggedClass, Qt as isSchemaError, Qu as Service$2, R as Undefined, Ra as catchReason, Rc as make$73, Rd as assignProperty, Ri as offer$1, Rl as sync$1, Rn as make$71, Ro as orElseSucceed, Rs as withAttributes, Rt as withDecodingDefault, S as NullOr, Sa as all, Sc as closeUnsafe, Sd as isSome, Si as filterArray, Sl as ConsoleRef, Sn as onSome, So as makeSpanScoped, Sr as fromQueue, Ss as updateContext, St as isSchema, Su as findLast, T as OptionFromNullOr, Ta as annotateLogs, Tc as makeUnsafe$8, Td as none, Tl as consolePretty$1, Tn as stringifyJson, To as mapError, Tr as groupedWithin, Ts as whileLoop, Tt as make$70, Tu as isArrayNonEmpty, U as Void, Ua as context, Uc as failCause$4, Ud as format, Ui as sliding$1, Ul as MinimumTraceLevel, Un as toUtc, Uo as raceFirst, Ur as runDrain, Us as spaced, Ut as apply, Uu as failVoid, V as Unknown, Va as catch_, Vc as die$1, Vd as NodeInspectSymbol, Vn as toDate, Vo as provideContext, Vr as run$5, Vt as VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP, W as annotate$2, Wa as contextWith, Wc as interrupt$3, Wi as take$1, Wl as NativeSpan, Wn as Forbidden$1, Wo as repeat, Wr as runFold, Ws as catchDone, Wt as toRepresentations, Wu as getOrThrow, X as decodeSync, Xa as fail, Xi as subscribe, Xn as FileSystem, Xs as currentTimeNanos, Y as decodeExit, Ya as exit, Yc as void_$2, Yi as sliding, Yo as runPromiseWith, Ys as currentTimeMillis, Yu as succeed$2, Z as decodeTo, Za as failCause$1, Zc as NoSuchElementError, Zi as unbounded$1, Zo as scope, Zr as takeWhile, Zt as SchemaError, Zu as Reference, _c as unwrap, _d as fromUndefinedOr, _f as identity, _i as forEach$1, _l as map$9, _n as Transformation, _o as logDebug, _s as try_, _t as isMaxLength, _u as ensure, a as Class, aa as join$2, ac as effectContext, ad as getUnsafe$1, af as isTagged, al as findErrorOption, an as isLiteral, ao as forever, ar as debounce, as as succeedSome, at as encodeUnknownExit, b as NonEmptyString, ba as acquireUseRelease, bc as addFinalizerExit, bd as getOrUndefined, bi as mapInput, bl as squash, bn as transformOrFail, bo as logInfo, br as fromIterable$1, bs as uninterruptible, bt as isNonEmpty, bu as findFirst, c as Defect, ca as drop$1, cd as merge$1, cf as cast, ci as has, cl as hasInterrupts, cn as isOptional, co as forkScoped, cr as drain, cs as tap, ct as instanceOf, cu as minutes, d as ErrorClass, da as isEmpty$2, dc as provide, dd as exists, df as constTrue, dl as interruptors, dn as isVoid, do as ignore$1, ds as tapError, dt as isFinite, du as toMillis, ea as makeUnsafe$7, ec as taggedEnum, ed as empty$5, ef as isNotNull, el as combine$1, es as service, et as decodeUnknownOption, eu as fromInput$2, f as Exit, fa as size$2, fc as provideMerge, fd as filter, ff as constUndefined, fl as isCause, fn as resolveAt, fo as ignoreCause, fr as fail$5, fs as tapErrorTag, ft as isGreaterThan, g as Literals, gc as tap$1, gd as fromNullishOr, gi as drain$1, go as log$1, gr as fromAsyncIterable, gs as tryPromise, gt as isLessThanOrEqualTo, gu as empty$4, h as Literal, ha as PlatformError, hc as sync$2, hd as flatten, hf as dual, hn as toEncoded, ho as isEffect, hr as flatMap$2, ht as isLessThan, i as Cause, ic as effect, id as getOrUndefined$1, if as isString, ii as withSpan$1, in as isDeclaration, io as forEach, ir as concat, is as succeedNone, it as encodeUnknownEffect, j as TaggedErrorClass, ja as cached, jc as die$2, jd as getStackTraceLimit, ji as makeUnsafe$5, jl as fnUntraced$1, jn as encodeBase64Url, jo as never, jr as mapError$1, js as withTracerEnabled, jt as tag, ju as reduce, k as Struct, ka as asSome, kc as TracerTimingEnabled, ki as splitLines, kn as decodeBase64UrlString, kr as mapArrayEffect, ks as withParentSpan, kt as optionalKey, ku as match, l as Duration, la as empty$6, lc as launch, ld as omit, lf as compose, li as invalidate, ll as hasInterruptsOnly, ln as isSuspend, lo as fromResult, lr as empty$7, ls as tapCause, lt as is, lu as nanos, m as Int, mc as succeedContext, md as flatMap$3, mf as constant, mn as resolveIdentifier, mo as interruptible, mr as filter$2, ms as timeoutOption, mt as isInt, mu as allocate, n as ArraySchema, na as getCurrent, nc as build, nd as getOption, nf as isNullish, ni as transformPull, nn as getAST, no as fn, nr as catchCause$1, ns as sleep, nt as encodeEffect, nu as hours, o as DateTimeUtc, oa as runIn, oc as effectDiscard, od as make$68, on as isNull, oo as forkChild, or as decodeText, os as suspend, ot as fieldsAssign, ou as max, p as Finite, pa as toArray, pc as succeed$3, pd as firstSomeOf, pf as constVoid, pl as isFailReason, pn as resolveDescription, po as interrupt$1, pr as failCause$5, ps as timeout, pt as isGreaterThanOrEqualTo, pu as zero, q as declare, qc as match$3, qi as publish, ql as externalSpan, qn as makeFormatterDefault, qo as runFork, qr as runForEachArray, qs as round, qt as assign, qu as isSuccess$1, r as Boolean$1, ra as interrupt$4, rc as buildWithMemoMap, rd as getOrElse$1, rf as isObject$1, ri as unwrap$1, rl as fail$2, rn as getLastEncoding, ro as fnUntraced, rr as changes, rs as succeed$1, rt as encodeSync, s as DateTimeUtcFromString, sa as append$1, sc as empty$8, sd as makeUnsafe$4, si as get$6, sl as hasDies, sn as isObjects, so as forkIn, ss as sync, st as fromJsonString, su as millis, t as Any, ta as await_, tc as CurrentMemoMap, td as get$5, tf as isNotUndefined, to as flatten$1, tr as callback$1, ts as serviceOption, tt as encode$1, tu as fromInputUnsafe, u as DurationFromMillis, ua as head, uc as mergeAll, ud as contains, uf as constFalse, ui as make$69, ul as interrupt$2, un as isUnion, uo as gen, ur as encodeText, us as tapDefect, ut as isBetween, uu as seconds, v as Never, va as Transaction, vc as Scope, vd as getOrElse, vf as pipe, vl as pretty, vo as logError, vr as fromEffect, vs as tx, vt as isMaxProperties, vu as filter$1, w as Option, wa as annotateCurrentSpan, wc as make$76, wd as match$1, wi as fromTransform, wr as fromSubscription, ws as void_$1, wu as fromIterable, x as Null, xa as addFinalizer, xc as close, xd as isNone, xi as decodeText$1, xn as trim, xo as logWarning$1, xr as fromPubSub, xt as isPattern, xu as findFirstIndex, y as NonEmptyArray, ya as acquireRelease, yc as addFinalizer$1, yd as getOrNull, yf as pipeArguments, yl as prettyErrors, yn as transform$1, yo as logFatal, yr as fromEffectSchedule, ys as txRetry, yt as isMinLength, yu as filterMap, z as UndefinedOr, za as catchTag, zi as offerAll, zl as tracerLogger$1, zn as makeUnsafe$6, zo as promise, zr as provideContext$1, zs as addDelay, zt as make$67 } from "./Schema-B4KtKnpr.mjs";
5
- import { a as isQuitError, g as ChildProcessSpawner, h as make$79, i as Terminal$1, l as Crypto, n as layer$44, o as Stdio, r as QuitError, s as make$80, u as fromReadable } from "./NodeServices-BtcL7AtO.mjs";
3
+ import { $ as make$66, 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$67, Yt as StatusCodeError, Z as awaitEmpty, Zt as empty$2, _ as get$3, _n as fromInput, _t as mergeCookies, a as layer$44, 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$64, yn as toRecord, yt as redirect, zt as make$65 } from "./NodeSocket-CLfrrutd.mjs";
4
+ import { $ as decodeUnknownExit, $a as flatMap$1, $d as hasProperty, $l as format$1, $o as scopedWith, $s as TaggedError, $t as Union$1, $u as add$2, A as StructWithRest, Aa as asVoid, Ac as _await, Ai as make$76, An as encodeBase64, Ao as matchEffect, Ar as mapEffect$1, As as withSpan, At as suspend$1, B as Union, Ba as catchTags, Bc as succeed$4, Bi as offerUnsafe, Bn as now$1, Bo as provide$1, Br as provideService$1, Bs as forever$1, Bt as value, C as Number$1, Ca as andThen, Cc as forkUnsafe, Cd as map$6, Cl as CurrentLoggers$1, Cn as parseJson, Co as map$4, Cs as useSpan, Ct as isTrimmed, Cu as flatMapNullishOr, D as String$1, Da as annotateSpans, Dc as MinimumLogLevel, Dd as Number$2, Di as pipeTo, Dn as decodeBase64String, Do as match$2, Dr as make$75, Ds as withFiber$1, Dt as mutable, E as Record, Ea as annotateLogsScoped, Ec as provide$2, Ed as some, Ei as mapEffect$2, Er as isStream, Es as withErrorReporting, Et as makeFilter, Eu as isReadonlyArrayNonEmpty, Fi as failCause$3, Fl as reportCauseUnsafe, Fn as isGreaterThan$1, Fo as onInterrupt, Fr as onExit$1, Fs as snapshotUnsafe, Ft as toJsonSchemaDocument, G as annotateKey, Ga as currentParentSpan, Gc as isFailure, Gi as takeAll, Gl as ParentSpan, Gn as InvalidValue$1, Go as result, Gr as runFoldEffect, Gs as isDoneCause, Gt as toJsonSchemaMultiDocument, Gu as getOrUndefined$2, H as UnknownFromJsonString$1, Hc as fail$4, Hd as toJson, Hi as shutdown$1, Hn as toEpochMillis, Ho as provideService, Hr as runCollect, Hs as passthrough, Ht as toMultiDocumentOpenApi3_1, Hu as fail$1, I as URLFromString, Ia as catchFilter, Ic as isDeferred, Id as isEffect$1, In as isGreaterThanOrEqualTo$1, Io as option, Is as timer, It as toType, Iu as map$7, J as decodeEffect, Ja as ensuring, Ji as shutdown$2, Jl as make$78, Jn as Path, Jo as runForkWith, Js as Clock, K as brand, Ka as die, Kc as isSuccess, Kd as equals, Ki as unbounded$2, Kl as Tracer, Ko as retry, Kr as runForEach, Ks as parse$2, Kt as escapeToken, Ku as isFailure$1, L as Uint8Array$1, La as catchIf, Ld as withFiber, Li as make$79, Ln as isLessThan$1, Lo as orDie, Lr as pipeThroughChannel, Ls as update$3, Lt as withConstructorDefault, M as TaggedStruct, Ma as callback, Md as setStackTraceLimit, Mi as bounded, Mn as encodeHex, Mo as onError, Mr as merge$2, Ms as yieldNow, Mt as toCodecJson, Mu as reverse, N as TemplateLiteral, Na as catchCause, Nc as fail$3, Nd as Prototype, Ni as end, Nn as add$3, No as onExit, Ns as zipWith, Nt as toCodecJsonAST, Nu as sort, O as StringFromUriComponent, Oa as as, Oc as TracerEnabled, Od as make$73, On as decodeBase64Url, Oo as matchCauseEffect, Or as map$8, Ot as optional$3, Ou as map$5, Pa as catchDefect, Pc as failCause$2, Pd as PipeInspectableProto, Pn as formatIso, Ps as counter, Pt as toCodecStringTree, Q as decodeUnknownEffect, Qa as filterOrFail, Qc as StackTrace, Qd as compose$1, Ql as days, Qo as scoped, Qr as toAsyncIterable, Qs as TaggedClass, Qt as isSchemaError, Qu as Service$2, R as Undefined, Ra as catchReason, Rc as make$74, Rd as assignProperty, Ri as offer$1, Rl as sync$1, Rn as make$72, Ro as orElseSucceed, Rs as withAttributes, Rt as withDecodingDefault, S as NullOr, Sa as all, Sc as closeUnsafe, Sd as isSome, Si as filterArray, Sl as ConsoleRef, Sn as onSome, So as makeSpanScoped, Sr as fromQueue, Ss as updateContext, St as isSchema, Su as findLast, T as OptionFromNullOr, Ta as annotateLogs, Tc as makeUnsafe$8, Td as none, Tl as consolePretty$1, Tn as stringifyJson, To as mapError, Tr as groupedWithin, Ts as whileLoop, Tt as make$71, Tu as isArrayNonEmpty, U as Void, Ua as context, Uc as failCause$4, Ud as format, Ui as sliding$1, Ul as MinimumTraceLevel, Un as toUtc, Uo as raceFirst, Ur as runDrain, Us as spaced, Ut as apply, Uu as failVoid, V as Unknown, Va as catch_, Vc as die$1, Vd as NodeInspectSymbol, Vn as toDate, Vo as provideContext, Vr as run$5, Vt as VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP, W as annotate$2, Wa as contextWith, Wc as interrupt$3, Wi as take$1, Wl as NativeSpan, Wn as Forbidden$1, Wo as repeat, Wr as runFold, Ws as catchDone, Wt as toRepresentations, Wu as getOrThrow, X as decodeSync, Xa as fail, Xi as subscribe, Xn as FileSystem, Xs as currentTimeNanos, Y as decodeExit, Ya as exit, Yc as void_$2, Yi as sliding, Yo as runPromiseWith, Ys as currentTimeMillis, Yu as succeed$2, Z as decodeTo, Za as failCause$1, Zc as NoSuchElementError, Zi as unbounded$1, Zo as scope, Zr as takeWhile, Zt as SchemaError, Zu as Reference, _c as unwrap, _d as fromUndefinedOr, _f as identity, _i as forEach$1, _l as map$9, _n as Transformation, _o as logDebug, _s as try_, _t as isMaxLength, _u as ensure, a as Class, aa as join$2, ac as effectContext, ad as getUnsafe$1, af as isTagged, al as findErrorOption, an as isLiteral, ao as forever, ar as debounce, as as succeedSome, at as encodeUnknownExit, b as NonEmptyString, ba as acquireUseRelease, bc as addFinalizerExit, bd as getOrUndefined, bi as mapInput, bl as squash, bn as transformOrFail, bo as logInfo, br as fromIterable$1, bs as uninterruptible, bt as isNonEmpty, bu as findFirst, c as Defect, ca as drop$1, cd as merge$1, cf as cast, ci as has, cl as hasInterrupts, cn as isOptional, co as forkScoped, cr as drain, cs as tap, ct as instanceOf, cu as minutes, d as ErrorClass, da as isEmpty$2, dc as provide, dd as exists, df as constTrue, dl as interruptors, dn as isVoid, do as ignore$1, ds as tapError, dt as isFinite, du as toMillis, ea as makeUnsafe$7, ec as taggedEnum, ed as empty$5, ef as isNotNull, el as combine$1, es as service, et as decodeUnknownOption, eu as fromInput$2, f as Exit, fa as size$2, fc as provideMerge, fd as filter, ff as constUndefined, fl as isCause, fn as resolveAt, fo as ignoreCause, fr as fail$5, fs as tapErrorTag, ft as isGreaterThan, g as Literals, gc as tap$1, gd as fromNullishOr, gi as drain$1, go as log$1, gr as fromAsyncIterable, gs as tryPromise, gt as isLessThanOrEqualTo, gu as empty$4, h as Literal, ha as PlatformError, hc as sync$2, hd as flatten, hf as dual, hn as toEncoded, ho as isEffect, hr as flatMap$2, ht as isLessThan, i as Cause, ic as effect, id as getOrUndefined$1, if as isString, ii as withSpan$1, in as isDeclaration, io as forEach, ir as concat, is as succeedNone, it as encodeUnknownEffect, j as TaggedErrorClass, ja as cached, jc as die$2, jd as getStackTraceLimit, ji as makeUnsafe$5, jl as fnUntraced$1, jn as encodeBase64Url, jo as never, jr as mapError$1, js as withTracerEnabled, jt as tag, ju as reduce, k as Struct, ka as asSome, kc as TracerTimingEnabled, ki as splitLines, kn as decodeBase64UrlString, kr as mapArrayEffect, ks as withParentSpan, kt as optionalKey, ku as match, l as Duration, la as empty$6, lc as launch, ld as omit, lf as compose, li as invalidate, ll as hasInterruptsOnly, ln as isSuspend, lo as fromResult, lr as empty$7, ls as tapCause, lt as is, lu as nanos, m as Int, mc as succeedContext, md as flatMap$3, mf as constant, mn as resolveIdentifier, mo as interruptible, mr as filter$2, ms as timeoutOption, mt as isInt, mu as allocate, n as ArraySchema, na as getCurrent, nc as build, nd as getOption, nf as isNullish, ni as transformPull, nn as getAST, no as fn, nr as catchCause$1, ns as sleep, nt as encodeEffect, nu as hours, o as DateTimeUtc, oa as runIn, oc as effectDiscard, od as make$69, on as isNull, oo as forkChild, or as decodeText, os as suspend, ot as fieldsAssign, ou as max, p as Finite, pa as toArray, pc as succeed$3, pd as firstSomeOf, pf as constVoid, pl as isFailReason, pn as resolveDescription, po as interrupt$1, pr as failCause$5, ps as timeout, pt as isGreaterThanOrEqualTo, pu as zero, q as declare, qc as match$3, qi as publish, ql as externalSpan, qn as makeFormatterDefault, qo as runFork, qr as runForEachArray, qs as round, qt as assign, qu as isSuccess$1, r as Boolean$1, ra as interrupt$4, rc as buildWithMemoMap, rd as getOrElse$1, rf as isObject$1, ri as unwrap$1, rl as fail$2, rn as getLastEncoding, ro as fnUntraced, rr as changes, rs as succeed$1, rt as encodeSync, s as DateTimeUtcFromString, sa as append$1, sc as empty$8, sd as makeUnsafe$4, si as get$6, sl as hasDies, sn as isObjects, so as forkIn, ss as sync, st as fromJsonString, su as millis, t as Any, ta as await_, tc as CurrentMemoMap, td as get$5, tf as isNotUndefined, to as flatten$1, tr as callback$1, ts as serviceOption, tt as encode$1, tu as fromInputUnsafe, u as DurationFromMillis, ua as head, uc as mergeAll, ud as contains, uf as constFalse, ui as make$70, ul as interrupt$2, un as isUnion, uo as gen, ur as encodeText, us as tapDefect, ut as isBetween, uu as seconds, v as Never, va as Transaction, vc as Scope, vd as getOrElse, vf as pipe, vl as pretty, vo as logError, vr as fromEffect, vs as tx, vt as isMaxProperties, vu as filter$1, w as Option, wa as annotateCurrentSpan, wc as make$77, wd as match$1, wi as fromTransform, wr as fromSubscription, ws as void_$1, wu as fromIterable, x as Null, xa as addFinalizer, xc as close, xd as isNone, xi as decodeText$1, xn as trim, xo as logWarning$1, xr as fromPubSub, xt as isPattern, xu as findFirstIndex, y as NonEmptyArray, ya as acquireRelease, yc as addFinalizer$1, yd as getOrNull, yf as pipeArguments, yl as prettyErrors, yn as transform$1, yo as logFatal, yr as fromEffectSchedule, ys as txRetry, yt as isMinLength, yu as filterMap, z as UndefinedOr, za as catchTag, zi as offerAll, zl as tracerLogger$1, zn as makeUnsafe$6, zo as promise, zr as provideContext$1, zs as addDelay, zt as make$68 } from "./Schema-B4KtKnpr.mjs";
5
+ import { a as isQuitError, g as ChildProcessSpawner, h as make$80, i as Terminal$1, l as Crypto, n as layer$45, o as Stdio, r as QuitError, s as make$81, u as fromReadable } from "./NodeServices-BtcL7AtO.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-CxDW-52j.mjs";
7
- import { c as getOption$1, d as make$81, f as makeWith$1, l as invalidate$1, n as SqlClient, p as set$4, s as get$7, u as keys } from "./SqlClient-BQM_tAo_.mjs";
7
+ import { c as getOption$1, d as make$82, f as makeWith$1, l as invalidate$1, n as SqlClient, p as set$4, s as get$7, u as keys } from "./SqlClient-BQM_tAo_.mjs";
8
8
  import * as NodeModule from "node:module";
9
9
  import * as NodeChildProcess from "node:child_process";
10
10
  import * as NodeCrypto from "node:crypto";
@@ -5881,7 +5881,7 @@ const map$2 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(
5881
5881
  * @category constructors
5882
5882
  * @since 4.0.0
5883
5883
  */
5884
- const password = (options) => basePrompt(options, "password").pipe(map$2(make$67));
5884
+ const password = (options) => basePrompt(options, "password").pipe(map$2(make$68));
5885
5885
  /**
5886
5886
  * Runs a prompt by reading terminal input and rendering prompt frames until the
5887
5887
  * prompt submits a value.
@@ -10589,7 +10589,7 @@ const isCommand = (u) => hasProperty(u, TypeId$14);
10589
10589
  * @category constructors
10590
10590
  * @since 4.0.0
10591
10591
  */
10592
- const make$62 = (name, config, handler) => {
10592
+ const make$63 = (name, config, handler) => {
10593
10593
  return makeCommand({
10594
10594
  name,
10595
10595
  config: parseConfig(config ?? {}),
@@ -11085,7 +11085,7 @@ const runWith = (command, config) => {
11085
11085
  }
11086
11086
  const services = match$1(logLevel, {
11087
11087
  onNone: () => empty$5(),
11088
- onSome: (level) => make$68(MinimumLogLevel, level)
11088
+ onSome: (level) => make$69(MinimumLogLevel, level)
11089
11089
  });
11090
11090
  yield* provideContext(program, services);
11091
11091
  }, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$2(error) : fail$1(error), (error) => andThen(showHelp(command, error), fail(error))), catchFilter((e) => isQuitError(e) ? succeed$2(e) : fail$1(e), (_) => interrupt$1));
@@ -11103,7 +11103,7 @@ const closeServer = (server) => {
11103
11103
  * NetService - Service tag for startup networking helpers.
11104
11104
  */
11105
11105
  var NetService = class extends Service$2()("@t3tools/shared/Net/NetService") {};
11106
- const make$61 = () => {
11106
+ const make$62 = () => {
11107
11107
  /**
11108
11108
  * Returns true when a TCP server can bind to {host, port}.
11109
11109
  * `EADDRNOTAVAIL` is treated as available so IPv6-absent hosts don't fail
@@ -11212,7 +11212,7 @@ const make$61 = () => {
11212
11212
  })
11213
11213
  };
11214
11214
  };
11215
- const layer$42 = sync$2(NetService, make$61);
11215
+ const layer$43 = sync$2(NetService, make$62);
11216
11216
  //#endregion
11217
11217
  //#region package.json
11218
11218
  var version = "0.0.31";
@@ -12087,7 +12087,7 @@ function parse$1(input) {
12087
12087
  const FULL_PATH_REGEXP = /^https?:\/\/.*?\//;
12088
12088
  const OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
12089
12089
  /** @internal */
12090
- const make$60 = (options = {}) => new RouterImpl(options);
12090
+ const make$61 = (options = {}) => new RouterImpl(options);
12091
12091
  var RouterImpl = class {
12092
12092
  constructor(options = {}) {
12093
12093
  this.options = {
@@ -12606,7 +12606,7 @@ const httpMethods = [
12606
12606
  * @since 1.0.0
12607
12607
  * @category constructors
12608
12608
  */
12609
- const make$59 = make$60;
12609
+ const make$60 = make$61;
12610
12610
  //#endregion
12611
12611
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpRouter.js
12612
12612
  /**
@@ -12641,8 +12641,8 @@ const HttpRouter = /*#__PURE__*/ Service$2("effect/http/HttpRouter");
12641
12641
  * @category constructors
12642
12642
  * @since 4.0.0
12643
12643
  */
12644
- const make$58 = /*#__PURE__*/ gen(function* () {
12645
- const router = make$59(yield* RouterConfig);
12644
+ const make$59 = /*#__PURE__*/ gen(function* () {
12645
+ const router = make$60(yield* RouterConfig);
12646
12646
  const middleware = /* @__PURE__ */ new Set();
12647
12647
  const addAll = (routes) => contextWith((context) => {
12648
12648
  const middleware = getMiddleware(context);
@@ -12808,7 +12808,7 @@ const add$1 = (method, path, handler, options) => use((router) => router.add(met
12808
12808
  * @category layers
12809
12809
  * @since 4.0.0
12810
12810
  */
12811
- const layer$41 = /*#__PURE__*/ effect(HttpRouter)(make$58);
12811
+ const layer$42 = /*#__PURE__*/ effect(HttpRouter)(make$59);
12812
12812
  const RouteTypeId = "~effect/http/HttpRouter/Route";
12813
12813
  const makeRoute = (options) => ({
12814
12814
  ...options,
@@ -12992,7 +12992,7 @@ const cors = (options) => middleware(cors$1(options), { global: true });
12992
12992
  const serve = (appLayer, options) => {
12993
12993
  let middleware = options?.middleware;
12994
12994
  if (options?.disableLogger !== true) middleware = middleware ? compose(middleware, logger) : logger;
12995
- const RouterLayer = options?.routerConfig ? provide(layer$41, succeed$3(RouterConfig)(options.routerConfig)) : layer$41;
12995
+ const RouterLayer = options?.routerConfig ? provide(layer$42, succeed$3(RouterConfig)(options.routerConfig)) : layer$42;
12996
12996
  return gen(function* () {
12997
12997
  const handler = (yield* HttpRouter).asHttpEffect();
12998
12998
  return middleware ? serve$1(handler, middleware) : serve$1(handler);
@@ -13099,7 +13099,7 @@ function makeProto$4(options) {
13099
13099
  * @category constructors
13100
13100
  * @since 4.0.0
13101
13101
  */
13102
- const make$57 = (method) => (identifier, path, options) => {
13102
+ const make$58 = (method) => (identifier, path, options) => {
13103
13103
  const disableCodecs = options?.disableCodecs ?? false;
13104
13104
  const transformStringTree = disableCodecs ? identity : toCodecStringTree;
13105
13105
  return makeProto$4({
@@ -13240,15 +13240,15 @@ function transformPayload(schema, method) {
13240
13240
  * @category constructors
13241
13241
  * @since 4.0.0
13242
13242
  */
13243
- const get$2 = /*#__PURE__*/ make$57("GET");
13243
+ const get$2 = /*#__PURE__*/ make$58("GET");
13244
13244
  /**
13245
13245
  * Creates a `POST` endpoint declaration.
13246
13246
  *
13247
13247
  * @category constructors
13248
13248
  * @since 4.0.0
13249
13249
  */
13250
- const post = /*#__PURE__*/ make$57("POST");
13251
- const del = /*#__PURE__*/ make$57("DELETE");
13250
+ const post = /*#__PURE__*/ make$58("POST");
13251
+ const del = /*#__PURE__*/ make$58("DELETE");
13252
13252
  //#endregion
13253
13253
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/httpapi/HttpApi.js
13254
13254
  const TypeId$11 = "~effect/httpapi/HttpApi";
@@ -13323,7 +13323,7 @@ const makeProto$3 = (options) => {
13323
13323
  * @category constructors
13324
13324
  * @since 4.0.0
13325
13325
  */
13326
- const make$56 = (identifier) => makeProto$3({
13326
+ const make$57 = (identifier) => makeProto$3({
13327
13327
  identifier,
13328
13328
  groups: {},
13329
13329
  annotations: empty$5()
@@ -13462,7 +13462,7 @@ const makeProto$2 = (options) => {
13462
13462
  * @category constructors
13463
13463
  * @since 4.0.0
13464
13464
  */
13465
- const make$55 = (identifier, options) => makeProto$2({
13465
+ const make$56 = (identifier, options) => makeProto$2({
13466
13466
  identifier,
13467
13467
  topLevel: options?.topLevel ?? false,
13468
13468
  endpoints: {},
@@ -14414,6 +14414,15 @@ Union([DispatchableClientOrchestrationCommand, Union([
14414
14414
  session: OrchestrationSession,
14415
14415
  createdAt: IsoDateTime
14416
14416
  }),
14417
+ Struct({
14418
+ type: Literal("thread.message.user.import"),
14419
+ commandId: CommandId,
14420
+ threadId: ThreadId,
14421
+ messageId: MessageId,
14422
+ turnId: TurnId,
14423
+ text: String$1,
14424
+ createdAt: IsoDateTime
14425
+ }),
14417
14426
  Struct({
14418
14427
  type: Literal("thread.message.assistant.delta"),
14419
14428
  commandId: CommandId,
@@ -16173,11 +16182,11 @@ const RelayHealthResponse = Struct({
16173
16182
  ok: Boolean$1,
16174
16183
  service: Literal("relay")
16175
16184
  });
16176
- const RelayHealthGroup = make$55("health").add(get$2("health", "/health", {
16185
+ const RelayHealthGroup = make$56("health").add(get$2("health", "/health", {
16177
16186
  success: RelayHealthResponse,
16178
16187
  error: RelayInternalError
16179
16188
  }).annotate(Summary, "Check relay health")).annotate(Description, "Service health and readiness.");
16180
- const RelayMetadataGroup = make$55("metadata").add(get$2("authorizationServer", "/.well-known/oauth-authorization-server", { success: RelayAuthorizationServerMetadata }).annotate(Summary, "Read OAuth authorization-server metadata"), get$2("protectedResource", "/.well-known/oauth-protected-resource", { success: RelayProtectedResourceMetadata }).annotate(Summary, "Read OAuth protected-resource metadata")).annotate(Description, "OAuth and DPoP discovery metadata.");
16189
+ const RelayMetadataGroup = make$56("metadata").add(get$2("authorizationServer", "/.well-known/oauth-authorization-server", { success: RelayAuthorizationServerMetadata }).annotate(Summary, "Read OAuth authorization-server metadata"), get$2("protectedResource", "/.well-known/oauth-protected-resource", { success: RelayProtectedResourceMetadata }).annotate(Summary, "Read OAuth protected-resource metadata")).annotate(Description, "OAuth and DPoP discovery metadata.");
16181
16190
  const RelayRegisterDeviceEndpoint = post("registerDevice", "/v1/mobile/devices", {
16182
16191
  headers: RelayDpopRequestHeaders,
16183
16192
  payload: RelayDeviceRegistrationRequest,
@@ -16201,8 +16210,8 @@ const RelayUnregisterDeviceEndpoint = del("unregisterDevice", "/v1/mobile/device
16201
16210
  success: RelayOkResponse,
16202
16211
  error: RelayAuthAndInternalErrors
16203
16212
  }).annotate(Summary, "Unregister a mobile device");
16204
- const RelayMobileGroup = make$55("mobile").add(RelayRegisterDeviceEndpoint, RelayRegisterLiveActivityEndpoint, RelayAgentActivitySnapshotEndpoint, RelayUnregisterDeviceEndpoint).annotate(Description, "Mobile push-notification and Live Activity registration.").middleware(RelayDpopClientAuth);
16205
- const RelayClientGroup = make$55("client").add(get$2("listEnvironments", "/v1/environments", {
16213
+ const RelayMobileGroup = make$56("mobile").add(RelayRegisterDeviceEndpoint, RelayRegisterLiveActivityEndpoint, RelayAgentActivitySnapshotEndpoint, RelayUnregisterDeviceEndpoint).annotate(Description, "Mobile push-notification and Live Activity registration.").middleware(RelayDpopClientAuth);
16214
+ const RelayClientGroup = make$56("client").add(get$2("listEnvironments", "/v1/environments", {
16206
16215
  headers: RelayBearerRequestHeaders,
16207
16216
  success: RelayListEnvironmentsResponse,
16208
16217
  error: RelayAuthAndInternalErrors
@@ -16237,7 +16246,7 @@ const RelayExchangeDpopAccessTokenEndpoint = post("exchangeDpopAccessToken", "/v
16237
16246
  success: RelayDpopAccessTokenResponse,
16238
16247
  error: RelayAuthAndInternalErrors
16239
16248
  }).annotate(Summary, "Exchange a Clerk token for a DPoP access token").annotate(Description, "Bootstrap endpoint. Send the DPoP proof JWT in the dpop header and the Clerk token in subject_token. The returned access token is bound to the proof key.");
16240
- const RelayTokenGroup = make$55("token").add(RelayExchangeDpopAccessTokenEndpoint).annotate(Description, "OAuth token exchange for DPoP-bound client access.");
16249
+ const RelayTokenGroup = make$56("token").add(RelayExchangeDpopAccessTokenEndpoint).annotate(Description, "OAuth token exchange for DPoP-bound client access.");
16241
16250
  const RelayConnectEnvironmentEndpoint = post("connectEnvironment", "/v1/environments/:environmentId/connect", {
16242
16251
  headers: RelayDpopRequestHeaders,
16243
16252
  params: Struct({ environmentId: EnvironmentId }),
@@ -16251,8 +16260,8 @@ const RelayGetEnvironmentStatusEndpoint = post("getEnvironmentStatus", "/v1/envi
16251
16260
  success: RelayEnvironmentStatusResponse,
16252
16261
  error: RelayEnvironmentConnectErrors
16253
16262
  }).annotate(Summary, "Check environment status");
16254
- const RelayDpopClientGroup = make$55("dpopClient").add(RelayConnectEnvironmentEndpoint, RelayGetEnvironmentStatusEndpoint).annotate(Description, "DPoP-authenticated client access to linked environments.").middleware(RelayDpopClientAuth);
16255
- const RelayServerGroup = make$55("server").add(post("publishAgentActivity", "/v1/environments/:environmentId/threads/:threadId/agent-activity", {
16263
+ const RelayDpopClientGroup = make$56("dpopClient").add(RelayConnectEnvironmentEndpoint, RelayGetEnvironmentStatusEndpoint).annotate(Description, "DPoP-authenticated client access to linked environments.").middleware(RelayDpopClientAuth);
16264
+ const RelayServerGroup = make$56("server").add(post("publishAgentActivity", "/v1/environments/:environmentId/threads/:threadId/agent-activity", {
16256
16265
  params: Struct({
16257
16266
  environmentId: EnvironmentId,
16258
16267
  threadId: ThreadId
@@ -16261,7 +16270,7 @@ const RelayServerGroup = make$55("server").add(post("publishAgentActivity", "/v1
16261
16270
  success: RelayPublishResponse,
16262
16271
  error: RelayAgentActivityPublishErrors
16263
16272
  }).annotate(Summary, "Publish agent activity")).annotate(Description, "Environment-authenticated activity publication.").middleware(RelayEnvironmentAuth);
16264
- make$56("RelayApi").add(RelayHealthGroup, RelayMetadataGroup, RelayMobileGroup, RelayClientGroup, RelayTokenGroup, RelayDpopClientGroup, RelayServerGroup).annotate(Title$1, "AgentLink Relay API").annotate(Version, "1.0.0").annotate(Description, "Control-plane API for linking T3 environments, connecting authorized clients, and publishing agent activity.");
16273
+ make$57("RelayApi").add(RelayHealthGroup, RelayMetadataGroup, RelayMobileGroup, RelayClientGroup, RelayTokenGroup, RelayDpopClientGroup, RelayServerGroup).annotate(Title$1, "AgentLink Relay API").annotate(Version, "1.0.0").annotate(Description, "Control-plane API for linking T3 environments, connecting authorized clients, and publishing agent activity.");
16265
16274
  //#endregion
16266
16275
  //#region ../t3-contracts/src/environmentHttp.ts
16267
16276
  const OptionalBearerHeaders = Struct({
@@ -16439,8 +16448,8 @@ const EnvironmentCloudPreferencesRequest = Struct({ publishAgentActivity: Boolea
16439
16448
  const AuthPairingLinkRevokeResult = Struct({ revoked: Boolean$1 });
16440
16449
  const AuthClientSessionRevokeResult = Struct({ revoked: Boolean$1 });
16441
16450
  const AuthOtherClientSessionsRevokeResult = Struct({ revokedCount: Number$1 });
16442
- var EnvironmentMetadataHttpApi = class extends make$55("metadata").add(get$2("descriptor", "/.well-known/t3/environment", { success: ExecutionEnvironmentDescriptor })) {};
16443
- var EnvironmentAuthHttpApi = class extends make$55("auth").add(get$2("session", "/api/auth/session", {
16451
+ var EnvironmentMetadataHttpApi = class extends make$56("metadata").add(get$2("descriptor", "/.well-known/t3/environment", { success: ExecutionEnvironmentDescriptor })) {};
16452
+ var EnvironmentAuthHttpApi = class extends make$56("auth").add(get$2("session", "/api/auth/session", {
16444
16453
  headers: OptionalBearerHeaders,
16445
16454
  success: AuthSessionState,
16446
16455
  error: [EnvironmentInternalError]
@@ -16486,7 +16495,7 @@ var EnvironmentAuthHttpApi = class extends make$55("auth").add(get$2("session",
16486
16495
  error: EnvironmentScopedOperationErrors
16487
16496
  }).middleware(EnvironmentAuthenticatedAuth)) {};
16488
16497
  const EnvironmentOrchestrationThreadSnapshotParams = Struct({ threadId: ThreadId });
16489
- var EnvironmentOrchestrationHttpApi = class extends make$55("orchestration").add(get$2("snapshot", "/api/orchestration/snapshot", {
16498
+ var EnvironmentOrchestrationHttpApi = class extends make$56("orchestration").add(get$2("snapshot", "/api/orchestration/snapshot", {
16490
16499
  headers: OptionalBearerHeaders,
16491
16500
  success: OrchestrationReadModel,
16492
16501
  error: EnvironmentOrchestrationSnapshotErrors
@@ -16505,7 +16514,7 @@ var EnvironmentOrchestrationHttpApi = class extends make$55("orchestration").add
16505
16514
  success: DispatchResult,
16506
16515
  error: EnvironmentOrchestrationDispatchErrors
16507
16516
  }).middleware(EnvironmentAuthenticatedAuth)) {};
16508
- var EnvironmentConnectHttpApi = class extends make$55("connect").add(post("linkProof", "/api/connect/link-proof", {
16517
+ var EnvironmentConnectHttpApi = class extends make$56("connect").add(post("linkProof", "/api/connect/link-proof", {
16509
16518
  headers: OptionalBearerHeaders,
16510
16519
  payload: RelayLinkProofRequest,
16511
16520
  success: RelayEnvironmentLinkProof,
@@ -16541,7 +16550,7 @@ var EnvironmentConnectHttpApi = class extends make$55("connect").add(post("linkP
16541
16550
  success: RelayEnvironmentMintResponse,
16542
16551
  error: EnvironmentHttpCloudErrors
16543
16552
  })) {};
16544
- var EnvironmentHttpApi = class extends make$56("environment").add(EnvironmentMetadataHttpApi).add(EnvironmentAuthHttpApi).add(EnvironmentOrchestrationHttpApi).add(EnvironmentConnectHttpApi) {};
16553
+ var EnvironmentHttpApi = class extends make$57("environment").add(EnvironmentMetadataHttpApi).add(EnvironmentAuthHttpApi).add(EnvironmentOrchestrationHttpApi).add(EnvironmentConnectHttpApi) {};
16545
16554
  //#endregion
16546
16555
  //#region ../t3-contracts/src/relayClient.ts
16547
16556
  const RelayClientStatusSchema = Union([
@@ -16764,10 +16773,10 @@ const TypeId$7 = "~effect/LayerMap";
16764
16773
  * @category constructors
16765
16774
  * @since 3.14.0
16766
16775
  */
16767
- const make$54 = /*#__PURE__*/ fnUntraced(function* (lookup, options) {
16776
+ const make$55 = /*#__PURE__*/ fnUntraced(function* (lookup, options) {
16768
16777
  const context$3 = yield* context();
16769
16778
  const memoMap = CurrentMemoMap.forkOrCreate(context$3);
16770
- const rcMap = yield* make$69({
16779
+ const rcMap = yield* make$70({
16771
16780
  lookup: (key) => contextWith((_) => buildWithMemoMap(lookup(key), memoMap, get$5(_, Scope))),
16772
16781
  idleTimeToLive: options?.idleTimeToLive
16773
16782
  });
@@ -16832,7 +16841,7 @@ const make$54 = /*#__PURE__*/ fnUntraced(function* (lookup, options) {
16832
16841
  * @category constructors
16833
16842
  * @since 3.14.0
16834
16843
  */
16835
- const fromRecord$1 = (layers, options) => make$54((key) => layers[key], {
16844
+ const fromRecord$1 = (layers, options) => make$55((key) => layers[key], {
16836
16845
  ...options,
16837
16846
  preloadKeys: options?.preload ? Object.keys(layers) : void 0
16838
16847
  });
@@ -16894,7 +16903,7 @@ const Service = () => (id, options) => {
16894
16903
  Object.defineProperty(TagClass, "stack", { get() {
16895
16904
  return creationError.stack;
16896
16905
  } });
16897
- TagClass_.layerNoDeps = effect(TagClass_)("lookup" in options ? make$54(options.lookup, options) : fromRecord$1(options.layers, options));
16906
+ TagClass_.layerNoDeps = effect(TagClass_)("lookup" in options ? make$55(options.lookup, options) : fromRecord$1(options.layers, options));
16898
16907
  TagClass_.layer = options.dependencies && options.dependencies.length > 0 ? provide(TagClass_.layerNoDeps, options.dependencies) : TagClass_.layerNoDeps;
16899
16908
  TagClass_.get = (key) => unwrap(map$4(TagClass_, (layerMap) => layerMap.get(key)));
16900
16909
  TagClass_.contextEffect = (key) => flatMap$1(TagClass_, (layerMap) => layerMap.contextEffect(key));
@@ -17019,7 +17028,7 @@ const tracerLogger = tracerLogger$1;
17019
17028
  * @category layers
17020
17029
  * @since 4.0.0
17021
17030
  */
17022
- const layer$40 = (loggers, options) => effect(CurrentLoggers, withFiber(fnUntraced$1(function* (fiber) {
17031
+ const layer$41 = (loggers, options) => effect(CurrentLoggers, withFiber(fnUntraced$1(function* (fiber) {
17023
17032
  const currentLoggers = new Set(options?.mergeWithExisting === true ? fiber.getRef(CurrentLoggers$1) : []);
17024
17033
  for (const logger of loggers) currentLoggers.add(isEffect$1(logger) ? yield* logger : logger);
17025
17034
  return currentLoggers;
@@ -17085,7 +17094,7 @@ const makeUnsafe$2 = (value) => {
17085
17094
  * @category constructors
17086
17095
  * @since 2.0.0
17087
17096
  */
17088
- const make$53 = (value) => sync(() => makeUnsafe$2(value));
17097
+ const make$54 = (value) => sync(() => makeUnsafe$2(value));
17089
17098
  /**
17090
17099
  * Reads the current value synchronously, bypassing the `Effect` API and the
17091
17100
  * ref's semaphore.
@@ -17170,7 +17179,7 @@ const TypeId$5 = "~effect/transactions/TxRef";
17170
17179
  * @category constructors
17171
17180
  * @since 2.0.0
17172
17181
  */
17173
- const make$52 = (initial) => sync(() => makeUnsafe$1(initial));
17182
+ const make$53 = (initial) => sync(() => makeUnsafe$1(initial));
17174
17183
  /**
17175
17184
  * Creates a new `TxRef` synchronously with the specified initial value.
17176
17185
  *
@@ -17398,7 +17407,7 @@ const TxChunkProto = {
17398
17407
  * @category constructors
17399
17408
  * @since 4.0.0
17400
17409
  */
17401
- const empty = () => map$4(make$52(empty$6()), (ref) => makeUnsafe(ref));
17410
+ const empty = () => map$4(make$53(empty$6()), (ref) => makeUnsafe(ref));
17402
17411
  /**
17403
17412
  * Creates a new `TxChunk` with the specified TxRef.
17404
17413
  *
@@ -17723,7 +17732,7 @@ const TxQueueProto = {
17723
17732
  */
17724
17733
  const unbounded = () => gen(function* () {
17725
17734
  const items = yield* empty();
17726
- const stateRef = yield* make$52({ _tag: "Open" });
17735
+ const stateRef = yield* make$53({ _tag: "Open" });
17727
17736
  const txQueue = Object.create(TxQueueProto);
17728
17737
  txQueue.strategy = "unbounded";
17729
17738
  txQueue.capacity = Number.POSITIVE_INFINITY;
@@ -22846,7 +22855,7 @@ const schema = /*#__PURE__*/ declare(isStream);
22846
22855
  * @since 4.0.0
22847
22856
  */
22848
22857
  function Stream(success, error) {
22849
- return make$70(schema.ast, {
22858
+ return make$71(schema.ast, {
22850
22859
  [StreamSchemaTypeId]: StreamSchemaTypeId,
22851
22860
  success,
22852
22861
  error
@@ -23000,7 +23009,7 @@ const makeProto$1 = (options) => {
23000
23009
  * @category constructors
23001
23010
  * @since 4.0.0
23002
23011
  */
23003
- const make$51 = (tag, options) => {
23012
+ const make$52 = (tag, options) => {
23004
23013
  const successSchema = options?.success ?? Void;
23005
23014
  const errorSchema = options?.error ?? Never;
23006
23015
  const defectSchema = options?.defect ?? Defect();
@@ -23156,7 +23165,7 @@ const RpcGroupProto = {
23156
23165
  });
23157
23166
  },
23158
23167
  annotateRpcs(service, value) {
23159
- return this.annotateRpcsMerge(make$68(service, value));
23168
+ return this.annotateRpcsMerge(make$69(service, value));
23160
23169
  },
23161
23170
  annotateMerge(context) {
23162
23171
  return makeProto({
@@ -23183,7 +23192,7 @@ const makeProto = (options) => Object.assign(function() {}, RpcGroupProto, {
23183
23192
  * @category constructors
23184
23193
  * @since 4.0.0
23185
23194
  */
23186
- const make$50 = (...rpcs) => makeProto({
23195
+ const make$51 = (...rpcs) => makeProto({
23187
23196
  requests: new Map(rpcs.map((rpc) => [rpc._tag, rpc])),
23188
23197
  annotations: empty$5()
23189
23198
  });
@@ -23267,22 +23276,22 @@ const WS_METHODS = {
23267
23276
  subscribeBackgroundPolicy: "subscribeBackgroundPolicy",
23268
23277
  subscribeResourceTelemetry: "subscribeResourceTelemetry"
23269
23278
  };
23270
- const WsServerUpsertKeybindingRpc = make$51(WS_METHODS.serverUpsertKeybinding, {
23279
+ const WsServerUpsertKeybindingRpc = make$52(WS_METHODS.serverUpsertKeybinding, {
23271
23280
  payload: ServerUpsertKeybindingInput,
23272
23281
  success: ServerUpsertKeybindingResult,
23273
23282
  error: Union([KeybindingsConfigError, EnvironmentAuthorizationError])
23274
23283
  });
23275
- const WsServerRemoveKeybindingRpc = make$51(WS_METHODS.serverRemoveKeybinding, {
23284
+ const WsServerRemoveKeybindingRpc = make$52(WS_METHODS.serverRemoveKeybinding, {
23276
23285
  payload: ServerRemoveKeybindingInput,
23277
23286
  success: ServerRemoveKeybindingResult,
23278
23287
  error: Union([KeybindingsConfigError, EnvironmentAuthorizationError])
23279
23288
  });
23280
- const WsServerProbeRpc = make$51(WS_METHODS.serverProbe, {
23289
+ const WsServerProbeRpc = make$52(WS_METHODS.serverProbe, {
23281
23290
  payload: Struct({}),
23282
23291
  success: Struct({}),
23283
23292
  error: EnvironmentAuthorizationError
23284
23293
  });
23285
- const WsServerGetConfigRpc = make$51(WS_METHODS.serverGetConfig, {
23294
+ const WsServerGetConfigRpc = make$52(WS_METHODS.serverGetConfig, {
23286
23295
  payload: Struct({}),
23287
23296
  success: ServerConfig$1,
23288
23297
  error: Union([
@@ -23291,7 +23300,7 @@ const WsServerGetConfigRpc = make$51(WS_METHODS.serverGetConfig, {
23291
23300
  EnvironmentAuthorizationError
23292
23301
  ])
23293
23302
  });
23294
- const WsServerRefreshProvidersRpc = make$51(WS_METHODS.serverRefreshProviders, {
23303
+ const WsServerRefreshProvidersRpc = make$52(WS_METHODS.serverRefreshProviders, {
23295
23304
  payload: Struct({
23296
23305
  /**
23297
23306
  * When supplied, only refresh this specific provider instance. When
@@ -23303,202 +23312,202 @@ instanceId: optional$3(ProviderInstanceId) }),
23303
23312
  success: ServerProviderUpdatedPayload,
23304
23313
  error: EnvironmentAuthorizationError
23305
23314
  });
23306
- const WsServerUpdateProviderRpc = make$51(WS_METHODS.serverUpdateProvider, {
23315
+ const WsServerUpdateProviderRpc = make$52(WS_METHODS.serverUpdateProvider, {
23307
23316
  payload: ServerProviderUpdateInput,
23308
23317
  success: ServerProviderUpdatedPayload,
23309
23318
  error: Union([ServerProviderUpdateError, EnvironmentAuthorizationError])
23310
23319
  });
23311
- const WsServerUpdateServerRpc = make$51(WS_METHODS.serverUpdateServer, {
23320
+ const WsServerUpdateServerRpc = make$52(WS_METHODS.serverUpdateServer, {
23312
23321
  payload: ServerSelfUpdateInput,
23313
23322
  success: ServerSelfUpdateResult,
23314
23323
  error: Union([ServerSelfUpdateError, EnvironmentAuthorizationError])
23315
23324
  });
23316
- const WsServerUpdateServerWithProgressRpc = make$51(WS_METHODS.serverUpdateServerWithProgress, {
23325
+ const WsServerUpdateServerWithProgressRpc = make$52(WS_METHODS.serverUpdateServerWithProgress, {
23317
23326
  payload: ServerSelfUpdateInput,
23318
23327
  success: ServerSelfUpdateProgressEvent,
23319
23328
  error: Union([ServerSelfUpdateError, EnvironmentAuthorizationError]),
23320
23329
  stream: true
23321
23330
  });
23322
- const WsServerGetSettingsRpc = make$51(WS_METHODS.serverGetSettings, {
23331
+ const WsServerGetSettingsRpc = make$52(WS_METHODS.serverGetSettings, {
23323
23332
  payload: Struct({}),
23324
23333
  success: ServerSettings,
23325
23334
  error: Union([ServerSettingsError, EnvironmentAuthorizationError])
23326
23335
  });
23327
- const WsServerUpdateSettingsRpc = make$51(WS_METHODS.serverUpdateSettings, {
23336
+ const WsServerUpdateSettingsRpc = make$52(WS_METHODS.serverUpdateSettings, {
23328
23337
  payload: Struct({ patch: ServerSettingsPatch }),
23329
23338
  success: ServerSettings,
23330
23339
  error: Union([ServerSettingsError, EnvironmentAuthorizationError])
23331
23340
  });
23332
- const WsServerDiscoverSourceControlRpc = make$51(WS_METHODS.serverDiscoverSourceControl, {
23341
+ const WsServerDiscoverSourceControlRpc = make$52(WS_METHODS.serverDiscoverSourceControl, {
23333
23342
  payload: Struct({}),
23334
23343
  success: SourceControlDiscoveryResult,
23335
23344
  error: EnvironmentAuthorizationError
23336
23345
  });
23337
- const WsServerGetTraceDiagnosticsRpc = make$51(WS_METHODS.serverGetTraceDiagnostics, {
23346
+ const WsServerGetTraceDiagnosticsRpc = make$52(WS_METHODS.serverGetTraceDiagnostics, {
23338
23347
  payload: Struct({}),
23339
23348
  success: ServerTraceDiagnosticsResult,
23340
23349
  error: EnvironmentAuthorizationError
23341
23350
  });
23342
- const WsServerGetProcessDiagnosticsRpc = make$51(WS_METHODS.serverGetProcessDiagnostics, {
23351
+ const WsServerGetProcessDiagnosticsRpc = make$52(WS_METHODS.serverGetProcessDiagnostics, {
23343
23352
  payload: Struct({}),
23344
23353
  success: ServerProcessDiagnosticsResult,
23345
23354
  error: EnvironmentAuthorizationError
23346
23355
  });
23347
- const WsServerGetProcessResourceHistoryRpc = make$51(WS_METHODS.serverGetProcessResourceHistory, {
23356
+ const WsServerGetProcessResourceHistoryRpc = make$52(WS_METHODS.serverGetProcessResourceHistory, {
23348
23357
  payload: ServerProcessResourceHistoryInput,
23349
23358
  success: ServerProcessResourceHistoryResult,
23350
23359
  error: EnvironmentAuthorizationError
23351
23360
  });
23352
- const WsServerGetResourceTelemetryHistoryRpc = make$51(WS_METHODS.serverGetResourceTelemetryHistory, {
23361
+ const WsServerGetResourceTelemetryHistoryRpc = make$52(WS_METHODS.serverGetResourceTelemetryHistory, {
23353
23362
  payload: ResourceTelemetryHistoryInput,
23354
23363
  success: ResourceTelemetryHistory,
23355
23364
  error: EnvironmentAuthorizationError
23356
23365
  });
23357
- const WsServerRetryResourceTelemetryRpc = make$51(WS_METHODS.serverRetryResourceTelemetry, {
23366
+ const WsServerRetryResourceTelemetryRpc = make$52(WS_METHODS.serverRetryResourceTelemetry, {
23358
23367
  payload: Struct({}),
23359
23368
  success: ResourceTelemetryRetryResult,
23360
23369
  error: EnvironmentAuthorizationError
23361
23370
  });
23362
- const WsServerSignalProcessRpc = make$51(WS_METHODS.serverSignalProcess, {
23371
+ const WsServerSignalProcessRpc = make$52(WS_METHODS.serverSignalProcess, {
23363
23372
  payload: ServerSignalProcessInput,
23364
23373
  success: ServerSignalProcessResult,
23365
23374
  error: EnvironmentAuthorizationError
23366
23375
  });
23367
- const WsCloudGetRelayClientStatusRpc = make$51(WS_METHODS.cloudGetRelayClientStatus, {
23376
+ const WsCloudGetRelayClientStatusRpc = make$52(WS_METHODS.cloudGetRelayClientStatus, {
23368
23377
  payload: Struct({}),
23369
23378
  success: RelayClientStatusSchema,
23370
23379
  error: EnvironmentAuthorizationError
23371
23380
  });
23372
- const WsCloudInstallRelayClientRpc = make$51(WS_METHODS.cloudInstallRelayClient, {
23381
+ const WsCloudInstallRelayClientRpc = make$52(WS_METHODS.cloudInstallRelayClient, {
23373
23382
  payload: Struct({}),
23374
23383
  success: RelayClientInstallProgressEventSchema,
23375
23384
  error: Union([RelayClientInstallFailedError, EnvironmentAuthorizationError]),
23376
23385
  stream: true
23377
23386
  });
23378
- const WsServerReportClientActivityRpc = make$51(WS_METHODS.serverReportClientActivity, {
23387
+ const WsServerReportClientActivityRpc = make$52(WS_METHODS.serverReportClientActivity, {
23379
23388
  payload: ClientActivityReportInput,
23380
23389
  error: EnvironmentAuthorizationError
23381
23390
  });
23382
- const WsServerReportHostPowerStateRpc = make$51(WS_METHODS.serverReportHostPowerState, {
23391
+ const WsServerReportHostPowerStateRpc = make$52(WS_METHODS.serverReportHostPowerState, {
23383
23392
  payload: HostPowerSnapshot,
23384
23393
  error: EnvironmentAuthorizationError
23385
23394
  });
23386
- const WsServerGetBackgroundPolicyRpc = make$51(WS_METHODS.serverGetBackgroundPolicy, {
23395
+ const WsServerGetBackgroundPolicyRpc = make$52(WS_METHODS.serverGetBackgroundPolicy, {
23387
23396
  payload: Struct({}),
23388
23397
  success: BackgroundPolicySnapshot,
23389
23398
  error: EnvironmentAuthorizationError
23390
23399
  });
23391
- const WsSourceControlLookupRepositoryRpc = make$51(WS_METHODS.sourceControlLookupRepository, {
23400
+ const WsSourceControlLookupRepositoryRpc = make$52(WS_METHODS.sourceControlLookupRepository, {
23392
23401
  payload: SourceControlRepositoryLookupInput,
23393
23402
  success: SourceControlRepositoryInfo,
23394
23403
  error: Union([SourceControlRepositoryError, EnvironmentAuthorizationError])
23395
23404
  });
23396
- const WsSourceControlCloneRepositoryRpc = make$51(WS_METHODS.sourceControlCloneRepository, {
23405
+ const WsSourceControlCloneRepositoryRpc = make$52(WS_METHODS.sourceControlCloneRepository, {
23397
23406
  payload: SourceControlCloneRepositoryInput,
23398
23407
  success: SourceControlCloneRepositoryResult,
23399
23408
  error: Union([SourceControlRepositoryError, EnvironmentAuthorizationError])
23400
23409
  });
23401
- const WsSourceControlPublishRepositoryRpc = make$51(WS_METHODS.sourceControlPublishRepository, {
23410
+ const WsSourceControlPublishRepositoryRpc = make$52(WS_METHODS.sourceControlPublishRepository, {
23402
23411
  payload: SourceControlPublishRepositoryInput,
23403
23412
  success: SourceControlPublishRepositoryResult,
23404
23413
  error: Union([SourceControlRepositoryError, EnvironmentAuthorizationError])
23405
23414
  });
23406
- const WsProjectsSearchEntriesRpc = make$51(WS_METHODS.projectsSearchEntries, {
23415
+ const WsProjectsSearchEntriesRpc = make$52(WS_METHODS.projectsSearchEntries, {
23407
23416
  payload: ProjectSearchEntriesInput,
23408
23417
  success: ProjectSearchEntriesResult,
23409
23418
  error: Union([ProjectSearchEntriesError, EnvironmentAuthorizationError])
23410
23419
  });
23411
- const WsProjectsSearchContentsRpc = make$51(WS_METHODS.projectsSearchContents, {
23420
+ const WsProjectsSearchContentsRpc = make$52(WS_METHODS.projectsSearchContents, {
23412
23421
  payload: ProjectSearchContentsInput,
23413
23422
  success: ProjectSearchContentsResult,
23414
23423
  error: Union([ProjectSearchContentsError, EnvironmentAuthorizationError])
23415
23424
  });
23416
- const WsProjectsListEntriesRpc = make$51(WS_METHODS.projectsListEntries, {
23425
+ const WsProjectsListEntriesRpc = make$52(WS_METHODS.projectsListEntries, {
23417
23426
  payload: ProjectListEntriesInput,
23418
23427
  success: ProjectListEntriesResult,
23419
23428
  error: Union([ProjectListEntriesError, EnvironmentAuthorizationError])
23420
23429
  });
23421
- const WsProjectsReadFileRpc = make$51(WS_METHODS.projectsReadFile, {
23430
+ const WsProjectsReadFileRpc = make$52(WS_METHODS.projectsReadFile, {
23422
23431
  payload: ProjectReadFileInput,
23423
23432
  success: ProjectReadFileResult,
23424
23433
  error: Union([ProjectReadFileError, EnvironmentAuthorizationError])
23425
23434
  });
23426
- const WsProjectsWriteFileRpc = make$51(WS_METHODS.projectsWriteFile, {
23435
+ const WsProjectsWriteFileRpc = make$52(WS_METHODS.projectsWriteFile, {
23427
23436
  payload: ProjectWriteFileInput,
23428
23437
  success: ProjectWriteFileResult,
23429
23438
  error: Union([ProjectWriteFileError, EnvironmentAuthorizationError])
23430
23439
  });
23431
- const WsShellOpenInEditorRpc = make$51(WS_METHODS.shellOpenInEditor, {
23440
+ const WsShellOpenInEditorRpc = make$52(WS_METHODS.shellOpenInEditor, {
23432
23441
  payload: LaunchEditorInput,
23433
23442
  error: Union([ExternalLauncherError, EnvironmentAuthorizationError])
23434
23443
  });
23435
- const WsFilesystemBrowseRpc = make$51(WS_METHODS.filesystemBrowse, {
23444
+ const WsFilesystemBrowseRpc = make$52(WS_METHODS.filesystemBrowse, {
23436
23445
  payload: FilesystemBrowseInput,
23437
23446
  success: FilesystemBrowseResult,
23438
23447
  error: Union([FilesystemBrowseError, EnvironmentAuthorizationError])
23439
23448
  });
23440
- const WsAssetsCreateUrlRpc = make$51(WS_METHODS.assetsCreateUrl, {
23449
+ const WsAssetsCreateUrlRpc = make$52(WS_METHODS.assetsCreateUrl, {
23441
23450
  payload: AssetCreateUrlInput,
23442
23451
  success: AssetCreateUrlResult,
23443
23452
  error: Union([AssetAccessError, EnvironmentAuthorizationError])
23444
23453
  });
23445
- const WsSubscribeVcsStatusRpc = make$51(WS_METHODS.subscribeVcsStatus, {
23454
+ const WsSubscribeVcsStatusRpc = make$52(WS_METHODS.subscribeVcsStatus, {
23446
23455
  payload: VcsStatusInput,
23447
23456
  success: VcsStatusStreamEvent,
23448
23457
  error: Union([GitManagerServiceError, EnvironmentAuthorizationError]),
23449
23458
  stream: true
23450
23459
  });
23451
- const WsVcsPullRpc = make$51(WS_METHODS.vcsPull, {
23460
+ const WsVcsPullRpc = make$52(WS_METHODS.vcsPull, {
23452
23461
  payload: VcsPullInput,
23453
23462
  success: VcsPullResult,
23454
23463
  error: Union([GitCommandError, EnvironmentAuthorizationError])
23455
23464
  });
23456
- const WsVcsRefreshStatusRpc = make$51(WS_METHODS.vcsRefreshStatus, {
23465
+ const WsVcsRefreshStatusRpc = make$52(WS_METHODS.vcsRefreshStatus, {
23457
23466
  payload: VcsStatusInput,
23458
23467
  success: VcsStatusResult,
23459
23468
  error: Union([GitManagerServiceError, EnvironmentAuthorizationError])
23460
23469
  });
23461
- const WsGitRunStackedActionRpc = make$51(WS_METHODS.gitRunStackedAction, {
23470
+ const WsGitRunStackedActionRpc = make$52(WS_METHODS.gitRunStackedAction, {
23462
23471
  payload: GitRunStackedActionInput,
23463
23472
  success: GitActionProgressEvent,
23464
23473
  error: Union([GitManagerServiceError, EnvironmentAuthorizationError]),
23465
23474
  stream: true
23466
23475
  });
23467
- const WsGitResolvePullRequestRpc = make$51(WS_METHODS.gitResolvePullRequest, {
23476
+ const WsGitResolvePullRequestRpc = make$52(WS_METHODS.gitResolvePullRequest, {
23468
23477
  payload: GitPullRequestRefInput,
23469
23478
  success: GitResolvePullRequestResult,
23470
23479
  error: Union([GitManagerServiceError, EnvironmentAuthorizationError])
23471
23480
  });
23472
- const WsGitPreparePullRequestThreadRpc = make$51(WS_METHODS.gitPreparePullRequestThread, {
23481
+ const WsGitPreparePullRequestThreadRpc = make$52(WS_METHODS.gitPreparePullRequestThread, {
23473
23482
  payload: GitPreparePullRequestThreadInput,
23474
23483
  success: GitPreparePullRequestThreadResult,
23475
23484
  error: Union([GitManagerServiceError, EnvironmentAuthorizationError])
23476
23485
  });
23477
- const WsVcsListRefsRpc = make$51(WS_METHODS.vcsListRefs, {
23486
+ const WsVcsListRefsRpc = make$52(WS_METHODS.vcsListRefs, {
23478
23487
  payload: VcsListRefsInput,
23479
23488
  success: VcsListRefsResult,
23480
23489
  error: Union([GitCommandError, EnvironmentAuthorizationError])
23481
23490
  });
23482
- const WsVcsCreateWorktreeRpc = make$51(WS_METHODS.vcsCreateWorktree, {
23491
+ const WsVcsCreateWorktreeRpc = make$52(WS_METHODS.vcsCreateWorktree, {
23483
23492
  payload: VcsCreateWorktreeInput,
23484
23493
  success: VcsCreateWorktreeResult,
23485
23494
  error: Union([GitCommandError, EnvironmentAuthorizationError])
23486
23495
  });
23487
- const WsVcsRemoveWorktreeRpc = make$51(WS_METHODS.vcsRemoveWorktree, {
23496
+ const WsVcsRemoveWorktreeRpc = make$52(WS_METHODS.vcsRemoveWorktree, {
23488
23497
  payload: VcsRemoveWorktreeInput,
23489
23498
  error: Union([GitCommandError, EnvironmentAuthorizationError])
23490
23499
  });
23491
- const WsVcsCreateRefRpc = make$51(WS_METHODS.vcsCreateRef, {
23500
+ const WsVcsCreateRefRpc = make$52(WS_METHODS.vcsCreateRef, {
23492
23501
  payload: VcsCreateRefInput,
23493
23502
  success: VcsCreateRefResult,
23494
23503
  error: Union([GitCommandError, EnvironmentAuthorizationError])
23495
23504
  });
23496
- const WsVcsSwitchRefRpc = make$51(WS_METHODS.vcsSwitchRef, {
23505
+ const WsVcsSwitchRefRpc = make$52(WS_METHODS.vcsSwitchRef, {
23497
23506
  payload: VcsSwitchRefInput,
23498
23507
  success: VcsSwitchRefResult,
23499
23508
  error: Union([GitCommandError, EnvironmentAuthorizationError])
23500
23509
  });
23501
- const WsVcsInitRpc = make$51(WS_METHODS.vcsInit, {
23510
+ const WsVcsInitRpc = make$52(WS_METHODS.vcsInit, {
23502
23511
  payload: VcsInitInput,
23503
23512
  error: Union([VcsError, EnvironmentAuthorizationError])
23504
23513
  });
@@ -23507,159 +23516,159 @@ const WsVcsInitRpc = make$51(WS_METHODS.vcsInit, {
23507
23516
  * Not the persisted T3 Review model. Future review sessions should use
23508
23517
  * review.open* + review.getSnapshot.
23509
23518
  */
23510
- const WsReviewGetDiffPreviewRpc = make$51(WS_METHODS.reviewGetDiffPreview, {
23519
+ const WsReviewGetDiffPreviewRpc = make$52(WS_METHODS.reviewGetDiffPreview, {
23511
23520
  payload: ReviewDiffPreviewInput,
23512
23521
  success: ReviewDiffPreviewResult,
23513
23522
  error: Union([ReviewDiffPreviewError, EnvironmentAuthorizationError])
23514
23523
  });
23515
- const WsReviewGetDiffFileContentsRpc = make$51(WS_METHODS.reviewGetDiffFileContents, {
23524
+ const WsReviewGetDiffFileContentsRpc = make$52(WS_METHODS.reviewGetDiffFileContents, {
23516
23525
  payload: ReviewDiffFileContentsInput,
23517
23526
  success: ReviewDiffFileContentsResult,
23518
23527
  error: Union([ReviewDiffPreviewError, EnvironmentAuthorizationError])
23519
23528
  });
23520
- const WsTerminalOpenRpc = make$51(WS_METHODS.terminalOpen, {
23529
+ const WsTerminalOpenRpc = make$52(WS_METHODS.terminalOpen, {
23521
23530
  payload: TerminalOpenInput,
23522
23531
  success: TerminalSessionSnapshot,
23523
23532
  error: Union([TerminalError, EnvironmentAuthorizationError])
23524
23533
  });
23525
- const WsTerminalAttachRpc = make$51(WS_METHODS.terminalAttach, {
23534
+ const WsTerminalAttachRpc = make$52(WS_METHODS.terminalAttach, {
23526
23535
  payload: TerminalAttachInput,
23527
23536
  success: TerminalAttachStreamEvent,
23528
23537
  error: Union([TerminalError, EnvironmentAuthorizationError]),
23529
23538
  stream: true
23530
23539
  });
23531
- const WsTerminalWriteRpc = make$51(WS_METHODS.terminalWrite, {
23540
+ const WsTerminalWriteRpc = make$52(WS_METHODS.terminalWrite, {
23532
23541
  payload: TerminalWriteInput,
23533
23542
  error: Union([TerminalError, EnvironmentAuthorizationError])
23534
23543
  });
23535
- const WsTerminalResizeRpc = make$51(WS_METHODS.terminalResize, {
23544
+ const WsTerminalResizeRpc = make$52(WS_METHODS.terminalResize, {
23536
23545
  payload: TerminalResizeInput,
23537
23546
  error: Union([TerminalError, EnvironmentAuthorizationError])
23538
23547
  });
23539
- const WsTerminalClearRpc = make$51(WS_METHODS.terminalClear, {
23548
+ const WsTerminalClearRpc = make$52(WS_METHODS.terminalClear, {
23540
23549
  payload: TerminalClearInput,
23541
23550
  error: Union([TerminalError, EnvironmentAuthorizationError])
23542
23551
  });
23543
- const WsTerminalRestartRpc = make$51(WS_METHODS.terminalRestart, {
23552
+ const WsTerminalRestartRpc = make$52(WS_METHODS.terminalRestart, {
23544
23553
  payload: TerminalRestartInput,
23545
23554
  success: TerminalSessionSnapshot,
23546
23555
  error: Union([TerminalError, EnvironmentAuthorizationError])
23547
23556
  });
23548
- const WsTerminalCloseRpc = make$51(WS_METHODS.terminalClose, {
23557
+ const WsTerminalCloseRpc = make$52(WS_METHODS.terminalClose, {
23549
23558
  payload: TerminalCloseInput,
23550
23559
  error: Union([TerminalError, EnvironmentAuthorizationError])
23551
23560
  });
23552
- const WsPreviewOpenRpc = make$51(WS_METHODS.previewOpen, {
23561
+ const WsPreviewOpenRpc = make$52(WS_METHODS.previewOpen, {
23553
23562
  payload: PreviewOpenInput,
23554
23563
  success: PreviewSessionSnapshot,
23555
23564
  error: Union([PreviewError, EnvironmentAuthorizationError])
23556
23565
  });
23557
- const WsPreviewNavigateRpc = make$51(WS_METHODS.previewNavigate, {
23566
+ const WsPreviewNavigateRpc = make$52(WS_METHODS.previewNavigate, {
23558
23567
  payload: PreviewNavigateInput,
23559
23568
  success: PreviewSessionSnapshot,
23560
23569
  error: Union([PreviewError, EnvironmentAuthorizationError])
23561
23570
  });
23562
- const WsPreviewResizeRpc = make$51(WS_METHODS.previewResize, {
23571
+ const WsPreviewResizeRpc = make$52(WS_METHODS.previewResize, {
23563
23572
  payload: PreviewResizeInput,
23564
23573
  success: PreviewSessionSnapshot,
23565
23574
  error: Union([PreviewError, EnvironmentAuthorizationError])
23566
23575
  });
23567
- const WsPreviewRefreshRpc = make$51(WS_METHODS.previewRefresh, {
23576
+ const WsPreviewRefreshRpc = make$52(WS_METHODS.previewRefresh, {
23568
23577
  payload: PreviewRefreshInput,
23569
23578
  error: Union([PreviewError, EnvironmentAuthorizationError])
23570
23579
  });
23571
- const WsPreviewCloseRpc = make$51(WS_METHODS.previewClose, {
23580
+ const WsPreviewCloseRpc = make$52(WS_METHODS.previewClose, {
23572
23581
  payload: PreviewCloseInput,
23573
23582
  error: Union([PreviewError, EnvironmentAuthorizationError])
23574
23583
  });
23575
- const WsPreviewListRpc = make$51(WS_METHODS.previewList, {
23584
+ const WsPreviewListRpc = make$52(WS_METHODS.previewList, {
23576
23585
  payload: PreviewListInput,
23577
23586
  success: PreviewListResult,
23578
23587
  error: EnvironmentAuthorizationError
23579
23588
  });
23580
- const WsPreviewReportStatusRpc = make$51(WS_METHODS.previewReportStatus, {
23589
+ const WsPreviewReportStatusRpc = make$52(WS_METHODS.previewReportStatus, {
23581
23590
  payload: PreviewReportStatusInput,
23582
23591
  error: Union([PreviewError, EnvironmentAuthorizationError])
23583
23592
  });
23584
- const WsPreviewAutomationConnectRpc = make$51(WS_METHODS.previewAutomationConnect, {
23593
+ const WsPreviewAutomationConnectRpc = make$52(WS_METHODS.previewAutomationConnect, {
23585
23594
  payload: PreviewAutomationHost,
23586
23595
  success: PreviewAutomationStreamEvent,
23587
23596
  error: Union([PreviewAutomationError, EnvironmentAuthorizationError]),
23588
23597
  stream: true
23589
23598
  });
23590
- const WsPreviewAutomationRespondRpc = make$51(WS_METHODS.previewAutomationRespond, {
23599
+ const WsPreviewAutomationRespondRpc = make$52(WS_METHODS.previewAutomationRespond, {
23591
23600
  payload: PreviewAutomationResponse,
23592
23601
  error: Union([PreviewAutomationError, EnvironmentAuthorizationError])
23593
23602
  });
23594
- const WsPreviewAutomationFocusHostRpc = make$51(WS_METHODS.previewAutomationFocusHost, {
23603
+ const WsPreviewAutomationFocusHostRpc = make$52(WS_METHODS.previewAutomationFocusHost, {
23595
23604
  payload: PreviewAutomationHostFocus,
23596
23605
  error: EnvironmentAuthorizationError
23597
23606
  });
23598
- const WsSubscribePreviewEventsRpc = make$51(WS_METHODS.subscribePreviewEvents, {
23607
+ const WsSubscribePreviewEventsRpc = make$52(WS_METHODS.subscribePreviewEvents, {
23599
23608
  payload: Struct({}),
23600
23609
  success: PreviewEvent,
23601
23610
  error: EnvironmentAuthorizationError,
23602
23611
  stream: true
23603
23612
  });
23604
- const WsSubscribeDiscoveredLocalServersRpc = make$51(WS_METHODS.subscribeDiscoveredLocalServers, {
23613
+ const WsSubscribeDiscoveredLocalServersRpc = make$52(WS_METHODS.subscribeDiscoveredLocalServers, {
23605
23614
  payload: Struct({}),
23606
23615
  success: DiscoveredLocalServerList,
23607
23616
  error: EnvironmentAuthorizationError,
23608
23617
  stream: true
23609
23618
  });
23610
- const WsOrchestrationDispatchCommandRpc = make$51(ORCHESTRATION_WS_METHODS.dispatchCommand, {
23619
+ const WsOrchestrationDispatchCommandRpc = make$52(ORCHESTRATION_WS_METHODS.dispatchCommand, {
23611
23620
  payload: ClientOrchestrationCommand,
23612
23621
  success: OrchestrationRpcSchemas.dispatchCommand.output,
23613
23622
  error: Union([OrchestrationDispatchCommandError, EnvironmentAuthorizationError])
23614
23623
  });
23615
- const WsOrchestrationGetWorkflowScriptRpc = make$51(ORCHESTRATION_WS_METHODS.getWorkflowScript, {
23624
+ const WsOrchestrationGetWorkflowScriptRpc = make$52(ORCHESTRATION_WS_METHODS.getWorkflowScript, {
23616
23625
  payload: OrchestrationRpcSchemas.getWorkflowScript.input,
23617
23626
  success: OrchestrationRpcSchemas.getWorkflowScript.output,
23618
23627
  error: Union([OrchestrationGetWorkflowScriptError, EnvironmentAuthorizationError])
23619
23628
  });
23620
- const WsOrchestrationGetTurnDiffRpc = make$51(ORCHESTRATION_WS_METHODS.getTurnDiff, {
23629
+ const WsOrchestrationGetTurnDiffRpc = make$52(ORCHESTRATION_WS_METHODS.getTurnDiff, {
23621
23630
  payload: OrchestrationGetTurnDiffInput,
23622
23631
  success: OrchestrationRpcSchemas.getTurnDiff.output,
23623
23632
  error: Union([OrchestrationGetTurnDiffError, EnvironmentAuthorizationError])
23624
23633
  });
23625
- const WsOrchestrationGetFullThreadDiffRpc = make$51(ORCHESTRATION_WS_METHODS.getFullThreadDiff, {
23634
+ const WsOrchestrationGetFullThreadDiffRpc = make$52(ORCHESTRATION_WS_METHODS.getFullThreadDiff, {
23626
23635
  payload: OrchestrationGetFullThreadDiffInput,
23627
23636
  success: OrchestrationRpcSchemas.getFullThreadDiff.output,
23628
23637
  error: Union([OrchestrationGetFullThreadDiffError, EnvironmentAuthorizationError])
23629
23638
  });
23630
- const WsOrchestrationSearchThreadsRpc = make$51(ORCHESTRATION_WS_METHODS.searchThreads, {
23639
+ const WsOrchestrationSearchThreadsRpc = make$52(ORCHESTRATION_WS_METHODS.searchThreads, {
23631
23640
  payload: OrchestrationSearchThreadsInput,
23632
23641
  success: OrchestrationRpcSchemas.searchThreads.output,
23633
23642
  error: Union([OrchestrationSearchThreadsError, EnvironmentAuthorizationError])
23634
23643
  });
23635
- const WsOrchestrationGetArchivedShellSnapshotRpc = make$51(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, {
23644
+ const WsOrchestrationGetArchivedShellSnapshotRpc = make$52(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, {
23636
23645
  payload: OrchestrationRpcSchemas.getArchivedShellSnapshot.input,
23637
23646
  success: OrchestrationRpcSchemas.getArchivedShellSnapshot.output,
23638
23647
  error: Union([OrchestrationGetSnapshotError, EnvironmentAuthorizationError])
23639
23648
  });
23640
- const WsOrchestrationSubscribeShellRpc = make$51(ORCHESTRATION_WS_METHODS.subscribeShell, {
23649
+ const WsOrchestrationSubscribeShellRpc = make$52(ORCHESTRATION_WS_METHODS.subscribeShell, {
23641
23650
  payload: OrchestrationRpcSchemas.subscribeShell.input,
23642
23651
  success: OrchestrationRpcSchemas.subscribeShell.output,
23643
23652
  error: Union([OrchestrationGetSnapshotError, EnvironmentAuthorizationError]),
23644
23653
  stream: true
23645
23654
  });
23646
- const WsOrchestrationSubscribeThreadRpc = make$51(ORCHESTRATION_WS_METHODS.subscribeThread, {
23655
+ const WsOrchestrationSubscribeThreadRpc = make$52(ORCHESTRATION_WS_METHODS.subscribeThread, {
23647
23656
  payload: OrchestrationRpcSchemas.subscribeThread.input,
23648
23657
  success: OrchestrationRpcSchemas.subscribeThread.output,
23649
23658
  error: Union([OrchestrationGetSnapshotError, EnvironmentAuthorizationError]),
23650
23659
  stream: true
23651
23660
  });
23652
- const WsRpcGroup = make$50(WsServerProbeRpc, WsServerGetConfigRpc, WsServerRefreshProvidersRpc, WsServerUpdateProviderRpc, WsServerUpdateServerRpc, WsServerUpdateServerWithProgressRpc, WsServerUpsertKeybindingRpc, WsServerRemoveKeybindingRpc, WsServerGetSettingsRpc, WsServerUpdateSettingsRpc, WsServerDiscoverSourceControlRpc, WsServerGetTraceDiagnosticsRpc, WsServerGetProcessDiagnosticsRpc, WsServerGetProcessResourceHistoryRpc, WsServerGetResourceTelemetryHistoryRpc, WsServerRetryResourceTelemetryRpc, WsServerSignalProcessRpc, WsServerReportClientActivityRpc, WsServerReportHostPowerStateRpc, WsServerGetBackgroundPolicyRpc, WsCloudGetRelayClientStatusRpc, WsCloudInstallRelayClientRpc, WsSourceControlLookupRepositoryRpc, WsSourceControlCloneRepositoryRpc, WsSourceControlPublishRepositoryRpc, WsProjectsListEntriesRpc, WsProjectsReadFileRpc, WsProjectsSearchContentsRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsShellOpenInEditorRpc, WsFilesystemBrowseRpc, WsAssetsCreateUrlRpc, WsSubscribeVcsStatusRpc, WsVcsPullRpc, WsVcsRefreshStatusRpc, WsGitRunStackedActionRpc, WsGitResolvePullRequestRpc, WsGitPreparePullRequestThreadRpc, WsVcsListRefsRpc, WsVcsCreateWorktreeRpc, WsVcsRemoveWorktreeRpc, WsVcsCreateRefRpc, WsVcsSwitchRefRpc, WsVcsInitRpc, WsReviewGetDiffPreviewRpc, WsReviewGetDiffFileContentsRpc, WsTerminalOpenRpc, WsTerminalAttachRpc, WsTerminalWriteRpc, WsTerminalResizeRpc, WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, make$51(WS_METHODS.subscribeTerminalEvents, {
23661
+ const WsRpcGroup = make$51(WsServerProbeRpc, WsServerGetConfigRpc, WsServerRefreshProvidersRpc, WsServerUpdateProviderRpc, WsServerUpdateServerRpc, WsServerUpdateServerWithProgressRpc, WsServerUpsertKeybindingRpc, WsServerRemoveKeybindingRpc, WsServerGetSettingsRpc, WsServerUpdateSettingsRpc, WsServerDiscoverSourceControlRpc, WsServerGetTraceDiagnosticsRpc, WsServerGetProcessDiagnosticsRpc, WsServerGetProcessResourceHistoryRpc, WsServerGetResourceTelemetryHistoryRpc, WsServerRetryResourceTelemetryRpc, WsServerSignalProcessRpc, WsServerReportClientActivityRpc, WsServerReportHostPowerStateRpc, WsServerGetBackgroundPolicyRpc, WsCloudGetRelayClientStatusRpc, WsCloudInstallRelayClientRpc, WsSourceControlLookupRepositoryRpc, WsSourceControlCloneRepositoryRpc, WsSourceControlPublishRepositoryRpc, WsProjectsListEntriesRpc, WsProjectsReadFileRpc, WsProjectsSearchContentsRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsShellOpenInEditorRpc, WsFilesystemBrowseRpc, WsAssetsCreateUrlRpc, WsSubscribeVcsStatusRpc, WsVcsPullRpc, WsVcsRefreshStatusRpc, WsGitRunStackedActionRpc, WsGitResolvePullRequestRpc, WsGitPreparePullRequestThreadRpc, WsVcsListRefsRpc, WsVcsCreateWorktreeRpc, WsVcsRemoveWorktreeRpc, WsVcsCreateRefRpc, WsVcsSwitchRefRpc, WsVcsInitRpc, WsReviewGetDiffPreviewRpc, WsReviewGetDiffFileContentsRpc, WsTerminalOpenRpc, WsTerminalAttachRpc, WsTerminalWriteRpc, WsTerminalResizeRpc, WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, make$52(WS_METHODS.subscribeTerminalEvents, {
23653
23662
  payload: Struct({}),
23654
23663
  success: TerminalEvent,
23655
23664
  error: EnvironmentAuthorizationError,
23656
23665
  stream: true
23657
- }), make$51(WS_METHODS.subscribeTerminalMetadata, {
23666
+ }), make$52(WS_METHODS.subscribeTerminalMetadata, {
23658
23667
  payload: Struct({}),
23659
23668
  success: TerminalMetadataStreamEvent,
23660
23669
  error: EnvironmentAuthorizationError,
23661
23670
  stream: true
23662
- }), WsPreviewOpenRpc, WsPreviewNavigateRpc, WsPreviewResizeRpc, WsPreviewRefreshRpc, WsPreviewCloseRpc, WsPreviewListRpc, WsPreviewReportStatusRpc, WsPreviewAutomationConnectRpc, WsPreviewAutomationRespondRpc, WsPreviewAutomationFocusHostRpc, WsSubscribePreviewEventsRpc, WsSubscribeDiscoveredLocalServersRpc, make$51(WS_METHODS.subscribeServerConfig, {
23671
+ }), WsPreviewOpenRpc, WsPreviewNavigateRpc, WsPreviewResizeRpc, WsPreviewRefreshRpc, WsPreviewCloseRpc, WsPreviewListRpc, WsPreviewReportStatusRpc, WsPreviewAutomationConnectRpc, WsPreviewAutomationRespondRpc, WsPreviewAutomationFocusHostRpc, WsSubscribePreviewEventsRpc, WsSubscribeDiscoveredLocalServersRpc, make$52(WS_METHODS.subscribeServerConfig, {
23663
23672
  payload: Struct({}),
23664
23673
  success: ServerConfigStreamEvent,
23665
23674
  error: Union([
@@ -23668,22 +23677,22 @@ const WsRpcGroup = make$50(WsServerProbeRpc, WsServerGetConfigRpc, WsServerRefre
23668
23677
  EnvironmentAuthorizationError
23669
23678
  ]),
23670
23679
  stream: true
23671
- }), make$51(WS_METHODS.subscribeServerLifecycle, {
23680
+ }), make$52(WS_METHODS.subscribeServerLifecycle, {
23672
23681
  payload: Struct({}),
23673
23682
  success: ServerLifecycleStreamEvent,
23674
23683
  error: EnvironmentAuthorizationError,
23675
23684
  stream: true
23676
- }), make$51(WS_METHODS.subscribeAuthAccess, {
23685
+ }), make$52(WS_METHODS.subscribeAuthAccess, {
23677
23686
  payload: Struct({}),
23678
23687
  success: AuthAccessStreamEvent,
23679
23688
  error: Union([AuthAccessStreamError, EnvironmentAuthorizationError]),
23680
23689
  stream: true
23681
- }), make$51(WS_METHODS.subscribeBackgroundPolicy, {
23690
+ }), make$52(WS_METHODS.subscribeBackgroundPolicy, {
23682
23691
  payload: Struct({}),
23683
23692
  success: BackgroundPolicySnapshot,
23684
23693
  error: EnvironmentAuthorizationError,
23685
23694
  stream: true
23686
- }), make$51(WS_METHODS.subscribeResourceTelemetry, {
23695
+ }), make$52(WS_METHODS.subscribeResourceTelemetry, {
23687
23696
  payload: Struct({}),
23688
23697
  success: ResourceTelemetrySnapshot,
23689
23698
  error: EnvironmentAuthorizationError,
@@ -23751,8 +23760,8 @@ var ServerConfig = class extends Service$2()("t3/config/ServerConfig") {
23751
23760
  /** @deprecated Import and use `layerTest` from this module. */
23752
23761
  static layerTest = (cwd, baseDirOrPrefix) => layerTest$2(cwd, baseDirOrPrefix);
23753
23762
  };
23754
- const make$49 = (config) => ServerConfig.of(config);
23755
- const layer$39 = (config) => succeed$3(ServerConfig, make$49(config));
23763
+ const make$50 = (config) => ServerConfig.of(config);
23764
+ const layer$40 = (config) => succeed$3(ServerConfig, make$50(config));
23756
23765
  const deriveServerPaths = fn(function* (baseDir, devUrl, options = {}) {
23757
23766
  const { join } = yield* Path;
23758
23767
  const stateDir = join(baseDir, devUrl !== void 0 && !options.baseDirIsExplicit ? "dev" : "userdata");
@@ -23948,7 +23957,7 @@ function deriveAuthClientMetadata(input) {
23948
23957
  //#endregion
23949
23958
  //#region src/auth/EnvironmentAuthPolicy.ts
23950
23959
  var EnvironmentAuthPolicy = class extends Service$2()("t3/auth/EnvironmentAuthPolicy") {};
23951
- const layer$38 = effect(EnvironmentAuthPolicy, gen(function* () {
23960
+ const layer$39 = effect(EnvironmentAuthPolicy, gen(function* () {
23952
23961
  const config = yield* ServerConfig;
23953
23962
  const isRemoteReachable = isRemoteReachableHost(config.host);
23954
23963
  const policy = config.mode === "desktop" ? isRemoteReachable ? "remote-reachable" : "desktop-managed-local" : isRemoteReachable ? "remote-reachable" : "loopback-browser";
@@ -24160,7 +24169,7 @@ function toPersistenceSqlOrDecodeError$6(sqlOperation, decodeOperation, correlat
24160
24169
  cause
24161
24170
  });
24162
24171
  }
24163
- const layer$37 = effect(AuthPairingLinkRepository, gen(function* () {
24172
+ const layer$38 = effect(AuthPairingLinkRepository, gen(function* () {
24164
24173
  const sql = yield* SqlClient;
24165
24174
  const createPairingLinkRow = void_({
24166
24175
  Request: CreateAuthPairingLinkInput,
@@ -24388,11 +24397,11 @@ const DEV_STARTUP_TTL_HOURS = hours(24);
24388
24397
  const PAIRING_TOKEN_ALPHABET = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
24389
24398
  const PAIRING_TOKEN_LENGTH = 12;
24390
24399
  const PAIRING_TOKEN_REJECTION_LIMIT = Math.floor(256 / 32) * 32;
24391
- const layer$36 = effect(PairingGrantStore, gen(function* () {
24400
+ const layer$37 = effect(PairingGrantStore, gen(function* () {
24392
24401
  const crypto = yield* Crypto;
24393
24402
  const config = yield* ServerConfig;
24394
24403
  const pairingLinks = yield* AuthPairingLinkRepository;
24395
- const seededGrantsRef = yield* make$63(/* @__PURE__ */ new Map());
24404
+ const seededGrantsRef = yield* make$64(/* @__PURE__ */ new Map());
24396
24405
  const changesPubSub = yield* unbounded$1();
24397
24406
  const generatePairingToken = gen(function* () {
24398
24407
  let credential = "";
@@ -24585,7 +24594,7 @@ const layer$36 = effect(PairingGrantStore, gen(function* () {
24585
24594
  revoke,
24586
24595
  consume
24587
24596
  });
24588
- })).pipe(provideMerge(layer$37));
24597
+ })).pipe(provideMerge(layer$38));
24589
24598
  //#endregion
24590
24599
  //#region src/auth/ServerSecretStore.ts
24591
24600
  const secretStoreErrorContext = {
@@ -24651,7 +24660,7 @@ const isSecretStoreError = is(Union([
24651
24660
  const isPlatformError = (value) => isTagged(value, "PlatformError");
24652
24661
  const isSecretAlreadyExistsError = (error) => "cause" in error && isPlatformError(error.cause) && error.cause.reason._tag === "AlreadyExists";
24653
24662
  var ServerSecretStore = class extends Service$2()("t3/auth/ServerSecretStore") {};
24654
- const layer$35 = effect(ServerSecretStore, gen(function* () {
24663
+ const layer$36 = effect(ServerSecretStore, gen(function* () {
24655
24664
  const crypto = yield* Crypto;
24656
24665
  const fileSystem = yield* FileSystem;
24657
24666
  const path = yield* Path;
@@ -24832,7 +24841,7 @@ function toPersistenceSqlOrDecodeError$5(sqlOperation, decodeOperation, correlat
24832
24841
  cause
24833
24842
  });
24834
24843
  }
24835
- const layer$34 = effect(AuthSessionRepository, gen(function* () {
24844
+ const layer$35 = effect(AuthSessionRepository, gen(function* () {
24836
24845
  const sql = yield* SqlClient;
24837
24846
  const createSessionRow = void_({
24838
24847
  Request: CreateAuthSessionInput,
@@ -25198,13 +25207,13 @@ function toAuthClientSession(input) {
25198
25207
  current: false
25199
25208
  };
25200
25209
  }
25201
- const layer$33 = effect(SessionStore, gen(function* () {
25210
+ const layer$34 = effect(SessionStore, gen(function* () {
25202
25211
  const crypto = yield* Crypto;
25203
25212
  const serverConfig = yield* ServerConfig;
25204
25213
  const secretStore = yield* ServerSecretStore;
25205
25214
  const authSessions = yield* AuthSessionRepository;
25206
25215
  const signingSecret = yield* secretStore.getOrCreateRandom(SIGNING_SECRET_NAME$1, 32);
25207
- const connectedSessionsRef = yield* make$63(/* @__PURE__ */ new Map());
25216
+ const connectedSessionsRef = yield* make$64(/* @__PURE__ */ new Map());
25208
25217
  const changesPubSub = yield* unbounded$1();
25209
25218
  const cookieName = resolveSessionCookieName({
25210
25219
  mode: serverConfig.mode,
@@ -25331,7 +25340,7 @@ const layer$33 = effect(SessionStore, gen(function* () {
25331
25340
  if (!timingSafeEqualBase64Url(signature, signPayload(encodedPayload, signingSecret))) return yield* new InvalidSessionTokenSignatureError({});
25332
25341
  const claims = yield* decodeSessionClaims(base64UrlDecodeUtf8(encodedPayload)).pipe(mapError((cause) => new InvalidSessionTokenPayloadError({ cause })));
25333
25342
  const observedAt = yield* now$1;
25334
- const expiresAt = make$71(claims.exp);
25343
+ const expiresAt = make$72(claims.exp);
25335
25344
  if (isNone(expiresAt)) return yield* new InvalidSessionExpirationClaimError({
25336
25345
  sessionId: claims.sid,
25337
25346
  expirationClaim: claims.exp
@@ -25391,7 +25400,7 @@ const layer$33 = effect(SessionStore, gen(function* () {
25391
25400
  if (!timingSafeEqualBase64Url(signature, signPayload(encodedPayload, signingSecret))) return yield* new InvalidWebSocketTokenSignatureError({});
25392
25401
  const claims = yield* decodeWebSocketClaims(base64UrlDecodeUtf8(encodedPayload)).pipe(mapError((cause) => new InvalidWebSocketTokenPayloadError({ cause })));
25393
25402
  const observedAt = yield* now$1;
25394
- const expiresAt = make$71(claims.exp);
25403
+ const expiresAt = make$72(claims.exp);
25395
25404
  if (isNone(expiresAt)) return yield* new InvalidSessionExpirationClaimError({
25396
25405
  sessionId: claims.sid,
25397
25406
  expirationClaim: claims.exp
@@ -25496,7 +25505,7 @@ const layer$33 = effect(SessionStore, gen(function* () {
25496
25505
  markConnected,
25497
25506
  markDisconnected
25498
25507
  });
25499
- })).pipe(provideMerge(layer$34));
25508
+ })).pipe(provideMerge(layer$35));
25500
25509
  //#endregion
25501
25510
  //#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/cryptoNode.js
25502
25511
  /**
@@ -28282,7 +28291,7 @@ var MigrationError = class extends TaggedError("MigrationError") {};
28282
28291
  * @category constructors
28283
28292
  * @since 4.0.0
28284
28293
  */
28285
- const make$42 = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory, table = "effect_sql_migrations" }) => gen(function* () {
28294
+ const make$43 = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory, table = "effect_sql_migrations" }) => gen(function* () {
28286
28295
  const sql = yield* SqlClient;
28287
28296
  const ensureMigrationsTable = sql.onDialectOrElse({
28288
28297
  mssql: () => sql`IF OBJECT_ID(N'${sql.literal(table)}', N'U') IS NULL
@@ -28371,7 +28380,7 @@ const make$42 = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory,
28371
28380
  if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause((cause) => logInfo("Could not dump schema", cause)));
28372
28381
  return completed;
28373
28382
  });
28374
- const migrationOrder = /*#__PURE__*/ make$72(([a], [b]) => Number$2(a, b));
28383
+ const migrationOrder = /*#__PURE__*/ make$73(([a], [b]) => Number$2(a, b));
28375
28384
  const isConstraintConflict = (error) => error.reason._tag === "ConstraintError" || error.reason._tag === "UniqueViolation";
28376
28385
  /**
28377
28386
  * Creates a migration loader from a record of migration effects keyed by
@@ -29938,7 +29947,7 @@ const makeMigrationLoader = (throughId) => fromRecord(Object.fromEntries(migrati
29938
29947
  * Migrator run function - no schema dumping needed
29939
29948
  * Uses the base Migrator.make without platform dependencies
29940
29949
  */
29941
- const run = make$42({});
29950
+ const run = make$43({});
29942
29951
  /**
29943
29952
  * Run all pending migrations.
29944
29953
  *
@@ -30185,7 +30194,7 @@ function parseDpopToken(request) {
30185
30194
  const token = header.slice(5).trim();
30186
30195
  return token.length > 0 ? token : null;
30187
30196
  }
30188
- const layer$32 = effect(EnvironmentAuth, gen(function* () {
30197
+ const layer$33 = effect(EnvironmentAuth, gen(function* () {
30189
30198
  const policy = yield* EnvironmentAuthPolicy;
30190
30199
  const bootstrapCredentials = yield* PairingGrantStore;
30191
30200
  const sessions = yield* SessionStore;
@@ -30393,9 +30402,9 @@ const layer$32 = effect(EnvironmentAuth, gen(function* () {
30393
30402
  issueWebSocketTicket,
30394
30403
  issueStartupPairingUrl
30395
30404
  });
30396
- })).pipe(provideMerge(layer$36), provideMerge(layer$33), provideMerge(layer$38));
30397
- const storageLayer = mergeAll(layer$35, layerConfig);
30398
- const runtimeLayer = layer$32.pipe(provideMerge(storageLayer));
30405
+ })).pipe(provideMerge(layer$37), provideMerge(layer$34), provideMerge(layer$39));
30406
+ const storageLayer = mergeAll(layer$36, layerConfig);
30407
+ const runtimeLayer = layer$33.pipe(provideMerge(storageLayer));
30399
30408
  //#endregion
30400
30409
  //#region src/cliAuthFormat.ts
30401
30410
  const newline = "\n";
@@ -31792,7 +31801,7 @@ const runWithEnvironmentAuth = (flags, run, options) => gen(function* () {
31792
31801
  const minimumLogLevel = options?.quietLogs ? "Error" : config.logLevel;
31793
31802
  return yield* gen(function* () {
31794
31803
  return yield* run(yield* EnvironmentAuth);
31795
- }).pipe(provide$1(mergeAll(runtimeLayer).pipe(provide(layer$39(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)))));
31804
+ }).pipe(provide$1(mergeAll(runtimeLayer).pipe(provide(layer$40(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)))));
31796
31805
  });
31797
31806
  const ttlFlag$1 = string("ttl").pipe(withSchema(DurationFromString), withDescription$1("TTL, for example `5m`, `1h`, `30d`, or `15 minutes`."), optional);
31798
31807
  const jsonFlag = boolean("json").pipe(withDescription$1("Emit JSON instead of human-readable output."), withDefault(false));
@@ -31800,7 +31809,7 @@ const labelFlag$1 = string("label").pipe(withDescription$1("Optional human-reada
31800
31809
  const subjectFlag = string("subject").pipe(withDescription$1("Optional session subject."), optional);
31801
31810
  const baseUrlFlag = string("base-url").pipe(withDescription$1("Optional public base URL used to print a ready `/pair#token=...` link."), optional);
31802
31811
  const tokenOnlyFlag = boolean("token-only").pipe(withDescription$1("Print only the issued bearer token."), withDefault(false));
31803
- const pairingCreateCommand = make$62("create", {
31812
+ const pairingCreateCommand = make$63("create", {
31804
31813
  ...authLocationFlags,
31805
31814
  ttl: ttlFlag$1,
31806
31815
  label: labelFlag$1,
@@ -31818,26 +31827,26 @@ const pairingCreateCommand = make$62("create", {
31818
31827
  });
31819
31828
  yield* log(output);
31820
31829
  }), { quietLogs: flags.json })));
31821
- const pairingListCommand = make$62("list", {
31830
+ const pairingListCommand = make$63("list", {
31822
31831
  ...authLocationFlags,
31823
31832
  json: jsonFlag
31824
31833
  }).pipe(withDescription("List active client pairing tokens without revealing their secrets."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
31825
31834
  const pairingLinks = yield* environmentAuth.listPairingLinks({ excludeSubjects: [INTERNAL_ADMINISTRATIVE_BOOTSTRAP_SUBJECT] });
31826
31835
  yield* log(formatPairingCredentialList(pairingLinks, { json: flags.json }));
31827
31836
  }), { quietLogs: flags.json })));
31828
- const pairingRevokeCommand = make$62("revoke", {
31837
+ const pairingRevokeCommand = make$63("revoke", {
31829
31838
  ...authLocationFlags,
31830
31839
  id: string$1("id").pipe(withDescription$2("Pairing credential id to revoke."))
31831
31840
  }).pipe(withDescription("Revoke an active client pairing token."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
31832
31841
  const revoked = yield* environmentAuth.revokePairingLink(flags.id);
31833
31842
  yield* log(revoked ? `Revoked pairing credential ${flags.id}.\n` : `No active pairing credential found for ${flags.id}.\n`);
31834
31843
  }))));
31835
- const pairingCommand = make$62("pairing").pipe(withDescription("Manage one-time client pairing tokens."), withSubcommands([
31844
+ const pairingCommand = make$63("pairing").pipe(withDescription("Manage one-time client pairing tokens."), withSubcommands([
31836
31845
  pairingCreateCommand,
31837
31846
  pairingListCommand,
31838
31847
  pairingRevokeCommand
31839
31848
  ]));
31840
- const sessionIssueCommand = make$62("issue", {
31849
+ const sessionIssueCommand = make$63("issue", {
31841
31850
  ...authLocationFlags,
31842
31851
  ttl: ttlFlag$1,
31843
31852
  label: labelFlag$1,
@@ -31856,26 +31865,26 @@ const sessionIssueCommand = make$62("issue", {
31856
31865
  tokenOnly: flags.tokenOnly
31857
31866
  }));
31858
31867
  }), { quietLogs: flags.json || flags.tokenOnly })));
31859
- const sessionListCommand = make$62("list", {
31868
+ const sessionListCommand = make$63("list", {
31860
31869
  ...authLocationFlags,
31861
31870
  json: jsonFlag
31862
31871
  }).pipe(withDescription("List active sessions without revealing bearer tokens."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
31863
31872
  const sessions = yield* environmentAuth.listSessions();
31864
31873
  yield* log(formatSessionList(sessions, { json: flags.json }));
31865
31874
  }), { quietLogs: flags.json })));
31866
- const sessionRevokeCommand = make$62("revoke", {
31875
+ const sessionRevokeCommand = make$63("revoke", {
31867
31876
  ...authLocationFlags,
31868
31877
  sessionId: string$1("session-id").pipe(withDescription$2("Session id to revoke."), withSchema$1(AuthSessionId))
31869
31878
  }).pipe(withDescription("Revoke an active session."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
31870
31879
  const revoked = yield* environmentAuth.revokeSession(flags.sessionId);
31871
31880
  yield* log(revoked ? `Revoked session ${flags.sessionId}.\n` : `No active session found for ${flags.sessionId}.\n`);
31872
31881
  }))));
31873
- const sessionCommand = make$62("session").pipe(withDescription("Manage bearer sessions."), withSubcommands([
31882
+ const sessionCommand = make$63("session").pipe(withDescription("Manage bearer sessions."), withSubcommands([
31874
31883
  sessionIssueCommand,
31875
31884
  sessionListCommand,
31876
31885
  sessionRevokeCommand
31877
31886
  ]));
31878
- const authCommand = make$62("auth").pipe(withDescription("Manage the local auth control plane for headless deployments."), withSubcommands([pairingCommand, sessionCommand]));
31887
+ const authCommand = make$63("auth").pipe(withDescription("Manage the local auth control plane for headless deployments."), withSubcommands([pairingCommand, sessionCommand]));
31879
31888
  //#endregion
31880
31889
  //#region ../t3-shared/src/devHome.ts
31881
31890
  /**
@@ -32063,7 +32072,7 @@ const readTailscaleStatus = gen(function* () {
32063
32072
  argumentCount: args.length
32064
32073
  };
32065
32074
  return yield* gen(function* () {
32066
- const child = yield* spawner.spawn(make$79(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
32075
+ const child = yield* spawner.spawn(make$80(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
32067
32076
  ...commandContext,
32068
32077
  cause
32069
32078
  })));
@@ -32107,7 +32116,7 @@ const runTailscaleCommand = (args, timeoutInput) => gen(function* () {
32107
32116
  };
32108
32117
  const timeout$1 = fromInputUnsafe(timeoutInput);
32109
32118
  return yield* gen(function* () {
32110
- const child = yield* spawner.spawn(make$79(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
32119
+ const child = yield* spawner.spawn(make$80(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
32111
32120
  ...commandContext,
32112
32121
  cause
32113
32122
  })));
@@ -33324,7 +33333,7 @@ const makePairServerConfig = fn(function* (input) {
33324
33333
  const { baseDir, variant, state } = input.target;
33325
33334
  const devUrl = state.devUrl !== void 0 ? new URL(state.devUrl) : void 0;
33326
33335
  const derivedPaths = yield* deriveServerPaths(baseDir, variant === "dev" ? DEV_VARIANT_PLACEHOLDER_URL : void 0, {});
33327
- return make$49({
33336
+ return make$50({
33328
33337
  logLevel: input.logLevel,
33329
33338
  traceMinLevel: "Info",
33330
33339
  traceTimingEnabled: false,
@@ -33410,9 +33419,9 @@ const mintPairingLink = fn("pair.mintPairingLink")(function* (input) {
33410
33419
  label: getOrElse(input.label, () => "t3 pair"),
33411
33420
  ...isSome(input.ttl) ? { ttl: input.ttl.value } : {}
33412
33421
  });
33413
- }).pipe(provide$1(runtimeLayer.pipe(provide(layer$39(input.config)), provide(succeed$3(MinimumLogLevel, input.config.logLevel)))));
33422
+ }).pipe(provide$1(runtimeLayer.pipe(provide(layer$40(input.config)), provide(succeed$3(MinimumLogLevel, input.config.logLevel)))));
33414
33423
  });
33415
- const pairCommand = make$62("pair", {
33424
+ const pairCommand = make$63("pair", {
33416
33425
  baseDir: baseDirFlag,
33417
33426
  ttl: string("ttl").pipe(withSchema(DurationFromString), withDescription$1("Token TTL, for example `5m`, `1h`, or `15 minutes`. Defaults to 5 minutes."), optional),
33418
33427
  label: string("label").pipe(withDescription$1("Optional label shown in the server's connections list."), optional),
@@ -33453,7 +33462,7 @@ const pairCommand = make$62("pair", {
33453
33462
  expiresAt: issued.expiresAt,
33454
33463
  notes
33455
33464
  }));
33456
- }).pipe(provide$1(layer$43))));
33465
+ }).pipe(provide$1(layer$44))));
33457
33466
  //#endregion
33458
33467
  //#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/encoding/Sse.js
33459
33468
  const SseErrorTypeId = "~effect/encoding/Sse/SseError";
@@ -33799,7 +33808,7 @@ const makeClient = (api, options) => gen(function* () {
33799
33808
  const encodeQuery = map$3(endpoint.query, encodeUnknownEffect);
33800
33809
  const middlewareKeys = Array.from(onEndpointOptions.middleware, (tag) => `${tag.key}/Client`);
33801
33810
  const endpointFn = fnUntraced(function* (request) {
33802
- let httpRequest = make$64(endpoint.method)(endpoint.path);
33811
+ let httpRequest = make$65(endpoint.method)(endpoint.path);
33803
33812
  if (request !== void 0) {
33804
33813
  if (encodeParams !== void 0) {
33805
33814
  const params = yield* encodeParams(request.params);
@@ -33842,7 +33851,7 @@ const makeClient = (api, options) => gen(function* () {
33842
33851
  * @category constructors
33843
33852
  * @since 4.0.0
33844
33853
  */
33845
- const make$40 = (api, options) => flatMap$1(HttpClient, (httpClient) => makeWith(api, {
33854
+ const make$41 = (api, options) => flatMap$1(HttpClient, (httpClient) => makeWith(api, {
33846
33855
  ...options,
33847
33856
  httpClient: options?.transformClient ? options.transformClient(httpClient) : httpClient
33848
33857
  }));
@@ -35789,6 +35798,32 @@ const decideOrchestrationCommand = fn("decideOrchestrationCommand")(function* ({
35789
35798
  updatedAt: command.createdAt
35790
35799
  }
35791
35800
  };
35801
+ case "thread.message.user.import":
35802
+ yield* requireThread({
35803
+ readModel,
35804
+ command,
35805
+ threadId: command.threadId
35806
+ });
35807
+ return {
35808
+ ...yield* withEventBase({
35809
+ aggregateKind: "thread",
35810
+ aggregateId: command.threadId,
35811
+ occurredAt: command.createdAt,
35812
+ commandId: command.commandId
35813
+ }),
35814
+ type: "thread.message-sent",
35815
+ payload: {
35816
+ threadId: command.threadId,
35817
+ messageId: command.messageId,
35818
+ role: "user",
35819
+ text: command.text,
35820
+ attachments: [],
35821
+ turnId: command.turnId,
35822
+ streaming: false,
35823
+ createdAt: command.createdAt,
35824
+ updatedAt: command.createdAt
35825
+ }
35826
+ };
35792
35827
  case "thread.message.assistant.complete":
35793
35828
  yield* requireThread({
35794
35829
  readModel,
@@ -36077,7 +36112,7 @@ const OrchestrationEngineLive = effect(OrchestrationEngineService, gen(function*
36077
36112
  yield* logDebug("orchestration engine started").pipe(annotateLogs({ sequence: commandReadModel.snapshotSequence }));
36078
36113
  const readEvents = (fromSequenceExclusive, limit) => eventStore.readFromSequence(fromSequenceExclusive, limit);
36079
36114
  const dispatch = (command) => gen(function* () {
36080
- const result = yield* make$73();
36115
+ const result = yield* make$74();
36081
36116
  yield* offer$1(commandQueue, {
36082
36117
  command,
36083
36118
  result,
@@ -38507,7 +38542,7 @@ const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
38507
38542
  "interrupted"
38508
38543
  ]);
38509
38544
  var ThreadBackgroundLivenessService = class extends Service$2()("t3/orchestration/ThreadBackgroundLiveness/ThreadBackgroundLivenessService") {};
38510
- function make$39() {
38545
+ function make$40() {
38511
38546
  const stateByThreadId = /* @__PURE__ */ new Map();
38512
38547
  const stateFor = (threadId) => {
38513
38548
  const existing = stateByThreadId.get(threadId);
@@ -38557,7 +38592,7 @@ function make$39() {
38557
38592
  }
38558
38593
  };
38559
38594
  }
38560
- const layer$31 = effect(ThreadBackgroundLivenessService, sync(make$39));
38595
+ const layer$32 = effect(ThreadBackgroundLivenessService, sync(make$40));
38561
38596
  //#endregion
38562
38597
  //#region ../t3-shared/src/sourceControl.ts
38563
38598
  function parseRemoteHost(remoteUrl) {
@@ -38857,7 +38892,7 @@ const runProcessCore = fn("processRunner.runProcessCore")(function* (spawner, in
38857
38892
  env: input.env,
38858
38893
  extendEnv
38859
38894
  });
38860
- const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
38895
+ const child = yield* spawner.spawn(make$80(spawnCommand.command, spawnCommand.args, {
38861
38896
  ...input.spawnCwd ?? input.cwd ? { cwd: input.spawnCwd ?? input.cwd } : {},
38862
38897
  ...input.env !== void 0 ? {
38863
38898
  env: input.env,
@@ -38875,7 +38910,7 @@ const runProcessCore = fn("processRunner.runProcessCore")(function* (spawner, in
38875
38910
  cause
38876
38911
  })));
38877
38912
  const stdin = input.stdin;
38878
- const writeStdin = stdin === void 0 ? void_$1 : run$5(encodeText(make$74(stdin)), child.stdin).pipe(mapError((cause) => new ProcessStdinError({
38913
+ const writeStdin = stdin === void 0 ? void_$1 : run$5(encodeText(make$75(stdin)), child.stdin).pipe(mapError((cause) => new ProcessStdinError({
38879
38914
  command: input.command,
38880
38915
  argumentCount: input.args.length,
38881
38916
  cwd: input.cwd,
@@ -38925,7 +38960,7 @@ const runProcessCore = fn("processRunner.runProcessCore")(function* (spawner, in
38925
38960
  stderrTruncated: stderr.truncated
38926
38961
  };
38927
38962
  });
38928
- const layer$30 = effect(ProcessRunner, fn("ProcessRunner.make")(function* () {
38963
+ const layer$31 = effect(ProcessRunner, fn("ProcessRunner.make")(function* () {
38929
38964
  const spawner = yield* ChildProcessSpawner;
38930
38965
  const run = (input) => finalizeRunProcess(runProcessCore(spawner, input), input);
38931
38966
  return ProcessRunner.of({ run });
@@ -39020,7 +39055,7 @@ const resolveRepositoryIdentityFromCacheKey = fn("RepositoryIdentityResolver.res
39020
39055
  rootPath: cacheKey
39021
39056
  }) : null;
39022
39057
  });
39023
- const layer$29 = effect(RepositoryIdentityResolver, fn("RepositoryIdentityResolver.make")(function* (options = {}) {
39058
+ const layer$30 = effect(RepositoryIdentityResolver, fn("RepositoryIdentityResolver.make")(function* (options = {}) {
39024
39059
  const processRunner = yield* ProcessRunner;
39025
39060
  const repositoryIdentityCache = yield* makeWith$1((cacheKey) => resolveRepositoryIdentityFromCacheKey(cacheKey).pipe(provideService(ProcessRunner, processRunner)), {
39026
39061
  capacity: options.cacheCapacity ?? DEFAULT_REPOSITORY_IDENTITY_CACHE_CAPACITY,
@@ -39034,7 +39069,7 @@ const layer$29 = effect(RepositoryIdentityResolver, fn("RepositoryIdentityResolv
39034
39069
  return yield* get$7(repositoryIdentityCache, cacheKey);
39035
39070
  });
39036
39071
  return RepositoryIdentityResolver.of({ resolve });
39037
- })()).pipe(provide(layer$30));
39072
+ })()).pipe(provide(layer$31));
39038
39073
  //#endregion
39039
39074
  //#region src/orchestration/Layers/ProjectionSnapshotQuery.ts
39040
39075
  const decodeReadModel = decodeUnknownEffect(OrchestrationReadModel);
@@ -40470,7 +40505,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
40470
40505
  getThreadDetailById,
40471
40506
  getThreadDetailSnapshot
40472
40507
  };
40473
- })), mergeAll(OrchestrationEventStoreLive, OrchestrationCommandReceiptRepositoryLive), OrchestrationProjectionPipelineLive.pipe(provide(OrchestrationEventStoreLive))).pipe(provideMerge(layer$31));
40508
+ })), mergeAll(OrchestrationEventStoreLive, OrchestrationCommandReceiptRepositoryLive), OrchestrationProjectionPipelineLive.pipe(provide(OrchestrationEventStoreLive))).pipe(provideMerge(layer$32));
40474
40509
  const OrchestrationLayerLive = mergeAll(OrchestrationInfrastructureLayerLive, OrchestrationEngineLive.pipe(provide(OrchestrationInfrastructureLayerLive)));
40475
40510
  //#endregion
40476
40511
  //#region ../t3-shared/src/keybindings.ts
@@ -40935,16 +40970,16 @@ function mergeWithDefaultKeybindings(custom) {
40935
40970
  * Keybindings - Service tag for keybinding configuration operations.
40936
40971
  */
40937
40972
  var Keybindings = class extends Service$2()("t3/keybindings") {};
40938
- const layer$28 = effect(Keybindings, gen(function* () {
40973
+ const layer$29 = effect(Keybindings, gen(function* () {
40939
40974
  const { keybindingsConfigPath } = yield* ServerConfig;
40940
40975
  const fs = yield* FileSystem;
40941
40976
  const path = yield* Path;
40942
- const upsertSemaphore = yield* make$75(1);
40977
+ const upsertSemaphore = yield* make$76(1);
40943
40978
  const resolvedConfigCacheKey = "resolved";
40944
40979
  const changesPubSub = yield* unbounded$1();
40945
- const startedRef = yield* make$63(false);
40946
- const startedDeferred = yield* make$73();
40947
- const watcherScope = yield* make$76("sequential");
40980
+ const startedRef = yield* make$64(false);
40981
+ const startedDeferred = yield* make$74();
40982
+ const watcherScope = yield* make$77("sequential");
40948
40983
  yield* addFinalizer(() => close(watcherScope, void_$2));
40949
40984
  const emitChange = (configState) => publish(changesPubSub, configState).pipe(asVoid);
40950
40985
  const readConfigExists = fs.exists(keybindingsConfigPath).pipe(mapError((cause) => new KeybindingsConfigError({
@@ -41044,7 +41079,7 @@ const layer$28 = effect(Keybindings, gen(function* () {
41044
41079
  keybindings: mergeWithDefaultKeybindings(compileResolvedKeybindingsConfig(keybindings)),
41045
41080
  issues
41046
41081
  })));
41047
- const resolvedConfigCache = yield* make$81({
41082
+ const resolvedConfigCache = yield* make$82({
41048
41083
  capacity: 1,
41049
41084
  lookup: () => loadConfigStateFromDisk
41050
41085
  });
@@ -41387,7 +41422,7 @@ const resolveEditorLaunch = fn("resolveEditorLaunch")(function* (input) {
41387
41422
  });
41388
41423
  const launchAndUnref = fn("externalLauncher.launchAndUnref")(function* (launch, onError) {
41389
41424
  const spawner = yield* ChildProcessSpawner;
41390
- const command = make$79(launch.command, launch.args, launch.options);
41425
+ const command = make$80(launch.command, launch.args, launch.options);
41391
41426
  yield* spawner.spawn(command).pipe(flatMap$1((handle) => handle.unref), asVoid, scoped, mapError(onError));
41392
41427
  });
41393
41428
  const launchBrowser = fn("externalLauncher.launchBrowser")(function* (target) {
@@ -41424,7 +41459,7 @@ const launchEditorProcess = fn("externalLauncher.launchEditorProcess")(function*
41424
41459
  cause
41425
41460
  }));
41426
41461
  });
41427
- const layer$27 = effect(ExternalLauncher, gen(function* () {
41462
+ const layer$28 = effect(ExternalLauncher, gen(function* () {
41428
41463
  const spawner = yield* ChildProcessSpawner;
41429
41464
  const fileSystem = yield* FileSystem;
41430
41465
  const path = yield* Path;
@@ -41452,9 +41487,9 @@ var OrchestrationReactor = class extends Service$2()("t3/orchestration/Services/
41452
41487
  //#endregion
41453
41488
  //#region src/serverLifecycleEvents.ts
41454
41489
  var ServerLifecycleEvents = class extends Service$2()("t3/serverLifecycleEvents") {};
41455
- const layer$26 = effect(ServerLifecycleEvents, gen(function* () {
41490
+ const layer$27 = effect(ServerLifecycleEvents, gen(function* () {
41456
41491
  const pubsub = yield* unbounded$1();
41457
- const state = yield* make$63({
41492
+ const state = yield* make$64({
41458
41493
  sequence: 0,
41459
41494
  events: []
41460
41495
  });
@@ -41531,7 +41566,7 @@ var ServerSettingsService = class extends Service$2()("t3/serverSettings/ServerS
41531
41566
  const makeTest = (overrides = {}) => gen(function* () {
41532
41567
  const { automaticGitFetchInterval, providerHealthRefreshInterval, ...overridesForMerge } = overrides;
41533
41568
  const merged = deepMerge(DEFAULT_SERVER_SETTINGS, overridesForMerge);
41534
- const currentSettingsRef = yield* make$63(yield* normalizeServerSettings({
41569
+ const currentSettingsRef = yield* make$64(yield* normalizeServerSettings({
41535
41570
  ...merged,
41536
41571
  ...automaticGitFetchInterval !== void 0 ? { automaticGitFetchInterval } : {},
41537
41572
  ...providerHealthRefreshInterval !== void 0 ? { providerHealthRefreshInterval } : {}
@@ -41585,17 +41620,17 @@ function stripDefaultServerSettings(current, defaults) {
41585
41620
  }
41586
41621
  return Object.is(current, defaults) ? void 0 : current;
41587
41622
  }
41588
- const layer$25 = effect(ServerSettingsService, gen(function* () {
41623
+ const layer$26 = effect(ServerSettingsService, gen(function* () {
41589
41624
  const { settingsPath } = yield* ServerConfig;
41590
41625
  const fs = yield* FileSystem;
41591
41626
  const pathService = yield* Path;
41592
41627
  const secretStore = yield* ServerSecretStore;
41593
- const writeSemaphore = yield* make$75(1);
41628
+ const writeSemaphore = yield* make$76(1);
41594
41629
  const cacheKey = "settings";
41595
41630
  const changesPubSub = yield* unbounded$1();
41596
- const startedRef = yield* make$63(false);
41597
- const startedDeferred = yield* make$73();
41598
- const watcherScope = yield* make$76("sequential");
41631
+ const startedRef = yield* make$64(false);
41632
+ const startedDeferred = yield* make$74();
41633
+ const watcherScope = yield* make$77("sequential");
41599
41634
  yield* addFinalizer(() => close(watcherScope, void_$2));
41600
41635
  const emitChange = (settings) => publish(changesPubSub, settings).pipe(asVoid);
41601
41636
  const readConfigExists = fs.exists(settingsPath).pipe(mapError((cause) => new ServerSettingsError({
@@ -41622,7 +41657,7 @@ const layer$25 = effect(ServerSettingsService, gen(function* () {
41622
41657
  }
41623
41658
  return decoded.value;
41624
41659
  });
41625
- const settingsCache = yield* make$81({
41660
+ const settingsCache = yield* make$82({
41626
41661
  capacity: 1,
41627
41662
  lookup: () => loadSettingsFromDisk
41628
41663
  });
@@ -41982,12 +42017,12 @@ var AnalyticsService = class AnalyticsService extends Service$2()("t3/telemetry/
41982
42017
  flush: void_$1
41983
42018
  }));
41984
42019
  };
41985
- const layer$24 = effect(AnalyticsService, gen(function* () {
42020
+ const layer$25 = effect(AnalyticsService, gen(function* () {
41986
42021
  const telemetryConfig = yield* TelemetryEnvConfig;
41987
42022
  const httpClient = yield* HttpClient;
41988
42023
  const serverConfig = yield* ServerConfig;
41989
42024
  const identifier = yield* getTelemetryIdentifier;
41990
- const bufferRef = yield* make$63([]);
42025
+ const bufferRef = yield* make$64([]);
41991
42026
  const clientType = serverConfig.mode === "desktop" ? "desktop-app" : "cli-web-client";
41992
42027
  const hostPlatform = yield* HostProcessPlatform;
41993
42028
  const hostArchitecture = yield* HostProcessArchitecture;
@@ -42187,7 +42222,7 @@ function platformArch(architecture) {
42187
42222
  * state. It intentionally has no fallback Layer.succeed value: callers must
42188
42223
  * provide the external platform services and a ServerConfig.
42189
42224
  */
42190
- const layer$23 = effect(ServerEnvironment, gen(function* () {
42225
+ const layer$24 = effect(ServerEnvironment, gen(function* () {
42191
42226
  const fileSystem = yield* FileSystem;
42192
42227
  const path = yield* Path;
42193
42228
  const serverConfig = yield* ServerConfig;
@@ -42241,7 +42276,7 @@ const layer$23 = effect(ServerEnvironment, gen(function* () {
42241
42276
  getEnvironmentId: succeed$1(environmentId),
42242
42277
  getDescriptor: succeed$1(descriptor)
42243
42278
  });
42244
- })).pipe(provide(layer$30));
42279
+ })).pipe(provide(layer$31));
42245
42280
  //#endregion
42246
42281
  //#region src/provider/Services/ProviderSessionReaper.ts
42247
42282
  var ProviderSessionReaper = class extends Service$2()("t3/provider/Services/ProviderSessionReaper") {};
@@ -42255,7 +42290,7 @@ const forkParked = (effect) => gen(function* () {
42255
42290
  yield* forkScoped(effect);
42256
42291
  return;
42257
42292
  }
42258
- const parked = yield* make$73();
42293
+ const parked = yield* make$74();
42259
42294
  yield* forkScoped(succeed$4(parked, void 0).pipe(andThen(activation), andThen(effect)));
42260
42295
  yield* _await(parked);
42261
42296
  });
@@ -42274,9 +42309,9 @@ var ServerRuntimeStartupError = class extends TaggedErrorClass()("ServerRuntimeS
42274
42309
  var ServerRuntimeStartup = class extends Service$2()("t3/serverRuntimeStartup") {};
42275
42310
  const settleQueuedCommand = (deferred, exit) => isSuccess(exit) ? succeed$4(deferred, exit.value) : failCause$2(deferred, exit.cause);
42276
42311
  const makeCommandGate = gen(function* () {
42277
- const commandReady = yield* make$73();
42312
+ const commandReady = yield* make$74();
42278
42313
  const commandQueue = yield* unbounded$2();
42279
- const commandReadinessState = yield* make$63("pending");
42314
+ const commandReadinessState = yield* make$64("pending");
42280
42315
  yield* forkScoped(forever(take$1(commandQueue).pipe(flatMap$1((command) => command.run))));
42281
42316
  return {
42282
42317
  awaitCommandReady: _await(commandReady),
@@ -42292,7 +42327,7 @@ const makeCommandGate = gen(function* () {
42292
42327
  const readinessState = yield* get$3(commandReadinessState);
42293
42328
  if (readinessState === "ready") return yield* effect;
42294
42329
  if (readinessState !== "pending") return yield* readinessState;
42295
- const result = yield* make$73();
42330
+ const result = yield* make$74();
42296
42331
  yield* offer$1(commandQueue, { run: _await(commandReady).pipe(flatMap$1(() => effect), exit, flatMap$1((exit) => settleQueuedCommand(result, exit))) });
42297
42332
  return yield* _await(result);
42298
42333
  })
@@ -42395,7 +42430,7 @@ const maybeOpenBrowser = (target) => gen(function* () {
42395
42430
  yield* (yield* ExternalLauncher).launchBrowser(target).pipe(catch_(() => logInfo("browser auto-open unavailable", { hint: `Open ${target} in your browser.` })));
42396
42431
  });
42397
42432
  const runStartupPhase = (phase, effect) => effect.pipe(annotateSpans({ "startup.phase": phase }), withSpan(`server.startup.${phase}`));
42398
- const make$30 = (options) => gen(function* () {
42433
+ const make$31 = (options) => gen(function* () {
42399
42434
  const serverConfig = yield* ServerConfig;
42400
42435
  const keybindings = yield* Keybindings;
42401
42436
  const orchestrationReactor = yield* OrchestrationReactor;
@@ -42405,8 +42440,8 @@ const make$30 = (options) => gen(function* () {
42405
42440
  const serverEnvironment = yield* ServerEnvironment;
42406
42441
  const crypto = yield* Crypto;
42407
42442
  const commandGate = yield* makeCommandGate;
42408
- const httpListening = yield* make$73();
42409
- const reactorScope = yield* make$76("sequential");
42443
+ const httpListening = yield* make$74();
42444
+ const reactorScope = yield* make$77("sequential");
42410
42445
  yield* addFinalizer(() => close(reactorScope, void_$2));
42411
42446
  yield* forkScoped(exit(gen(function* () {
42412
42447
  yield* logDebug("startup phase: starting keybindings runtime");
@@ -42509,7 +42544,7 @@ const make$30 = (options) => gen(function* () {
42509
42544
  enqueueCommand: commandGate.enqueueCommand
42510
42545
  };
42511
42546
  });
42512
- const layerWithOptions = (options) => effect(ServerRuntimeStartup, make$30(options));
42547
+ const layerWithOptions = (options) => effect(ServerRuntimeStartup, make$31(options));
42513
42548
  layerWithOptions();
42514
42549
  //#endregion
42515
42550
  //#region src/workspace/WorkspacePaths.ts
@@ -42581,7 +42616,7 @@ function expandHomePath$2(input, path) {
42581
42616
  if (input.startsWith("~/") || input.startsWith("~\\")) return path.join(NodeOS.homedir(), input.slice(2));
42582
42617
  return input;
42583
42618
  }
42584
- const layer$21 = effect(WorkspacePaths, gen(function* () {
42619
+ const layer$22 = effect(WorkspacePaths, gen(function* () {
42585
42620
  const fileSystem = yield* FileSystem;
42586
42621
  const path = yield* Path;
42587
42622
  const statWorkspaceRoot = fn("WorkspacePaths.statWorkspaceRoot")(function* (workspaceRoot, normalizedWorkspaceRoot, phase) {
@@ -42743,14 +42778,14 @@ const projectCommandUuid = Crypto.pipe(flatMap$1((crypto) => crypto.randomUUIDv4
42743
42778
  operation: "generateProjectCommandId",
42744
42779
  cause
42745
42780
  })));
42746
- const ProjectCliRuntimeLive = mergeAll(layer$21, OrchestrationLayerLive.pipe(provideMerge(layer$29), provideMerge(layerConfig)));
42781
+ const ProjectCliRuntimeLive = mergeAll(layer$22, OrchestrationLayerLive.pipe(provideMerge(layer$30), provideMerge(layerConfig)));
42747
42782
  const PROJECT_CLI_LIVE_SERVER_TIMEOUT = seconds(1);
42748
42783
  const withProjectCliSessionToken = (environmentAuth, run) => acquireUseRelease(environmentAuth.issueSession({
42749
42784
  scopes: AuthAdministrativeScopes,
42750
42785
  label: "t3 project cli"
42751
42786
  }), (issued) => run(issued.token), (issued) => environmentAuth.revokeSession(issued.sessionId).pipe(ignore$1({ log: true })));
42752
42787
  const withProjectCliLiveServerTimeout = (effect) => effect.pipe(timeout(PROJECT_CLI_LIVE_SERVER_TIMEOUT));
42753
- const makeLiveServerClient = (origin) => make$40(EnvironmentHttpApi, { baseUrl: origin });
42788
+ const makeLiveServerClient = (origin) => make$41(EnvironmentHttpApi, { baseUrl: origin });
42754
42789
  const normalizeWorkspaceRootForProjectCommand = fn("normalizeWorkspaceRootForProjectCommand")(function* (workspaceRoot) {
42755
42790
  return yield* (yield* WorkspacePaths).normalizeWorkspaceRoot(workspaceRoot);
42756
42791
  });
@@ -42833,7 +42868,7 @@ const runProjectMutation = fn("runProjectMutation")(function* (flags, run) {
42833
42868
  });
42834
42869
  yield* log(output);
42835
42870
  }));
42836
- const offlineRuntimeLayer = ProjectCliRuntimeLive.pipe(provide(layer$39(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)));
42871
+ const offlineRuntimeLayer = ProjectCliRuntimeLive.pipe(provide(layer$40(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)));
42837
42872
  return yield* gen(function* () {
42838
42873
  const snapshot = yield* getOfflineSnapshot();
42839
42874
  const orchestrationEngine = yield* OrchestrationEngineService;
@@ -42844,9 +42879,9 @@ const runProjectMutation = fn("runProjectMutation")(function* (flags, run) {
42844
42879
  });
42845
42880
  yield* log(output);
42846
42881
  }).pipe(provide$1(offlineRuntimeLayer));
42847
- }).pipe(provide$1(mergeAll(runtimeLayer, layer$21).pipe(provideMerge(layer$43), provide(layer$39(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)))));
42882
+ }).pipe(provide$1(mergeAll(runtimeLayer, layer$22).pipe(provideMerge(layer$44), provide(layer$40(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)))));
42848
42883
  });
42849
- const projectAddCommand = make$62("add", {
42884
+ const projectAddCommand = make$63("add", {
42850
42885
  ...projectLocationFlags,
42851
42886
  workspaceRoot: string$1("path").pipe(withDescription$2("Workspace root to add as a project.")),
42852
42887
  title: string("title").pipe(withDescription$1("Optional project title."), optional)
@@ -42871,7 +42906,7 @@ const projectAddCommand = make$62("add", {
42871
42906
  });
42872
42907
  return `Added project ${projectId} (${title}) at ${workspaceRoot}.`;
42873
42908
  }))));
42874
- const projectRemoveCommand = make$62("remove", {
42909
+ const projectRemoveCommand = make$63("remove", {
42875
42910
  ...projectLocationFlags,
42876
42911
  project: string$1("project").pipe(withDescription$2("Project id or workspace root to remove.")),
42877
42912
  force: boolean("force").pipe(withDescription$1("Delete the project and all of its threads."), withDefault(false))
@@ -42888,7 +42923,7 @@ const projectRemoveCommand = make$62("remove", {
42888
42923
  });
42889
42924
  return `Removed project ${project.id} (${project.title}).`;
42890
42925
  }))));
42891
- const projectRenameCommand = make$62("rename", {
42926
+ const projectRenameCommand = make$63("rename", {
42892
42927
  ...projectLocationFlags,
42893
42928
  project: string$1("project").pipe(withDescription$2("Project id or workspace root to rename.")),
42894
42929
  title: string$1("title").pipe(withDescription$2("New project title."))
@@ -42907,7 +42942,7 @@ const projectRenameCommand = make$62("rename", {
42907
42942
  });
42908
42943
  return `Renamed project ${project.id} to ${nextTitle}.`;
42909
42944
  }))));
42910
- const projectCommand = make$62("project").pipe(withDescription("Manage projects."), withSubcommands([
42945
+ const projectCommand = make$63("project").pipe(withDescription("Manage projects."), withSubcommands([
42911
42946
  projectAddCommand,
42912
42947
  projectRemoveCommand,
42913
42948
  projectRenameCommand
@@ -42970,7 +43005,7 @@ function acquireDaemonLock(stateDir) {
42970
43005
  * @category layers
42971
43006
  * @since 4.0.0
42972
43007
  */
42973
- const layer$20 = (api, options) => use(fnUntraced(function* (router) {
43008
+ const layer$21 = (api, options) => use(fnUntraced(function* (router) {
42974
43009
  const services = yield* context();
42975
43010
  const routes = [];
42976
43011
  const availableGroups = Array.from(services.mapUnsafe.keys()).filter((key) => key.startsWith("effect/httpapi/HttpApiGroup/"));
@@ -43023,19 +43058,19 @@ const HandlersTypeId = "~effect/httpapi/HttpApiBuilder/Handlers";
43023
43058
  */
43024
43059
  const securityDecode = (self) => {
43025
43060
  switch (self._tag) {
43026
- case "Http": return map$4(HttpServerRequest, (request) => make$67(getAuthorizationCredential(request.headers.authorization, self.scheme) ?? ""));
43061
+ case "Http": return map$4(HttpServerRequest, (request) => make$68(getAuthorizationCredential(request.headers.authorization, self.scheme) ?? ""));
43027
43062
  case "ApiKey": {
43028
43063
  const key = self.in === "header" ? self.key.toLowerCase() : self.key;
43029
43064
  const schema = Struct({ [key]: String$1 });
43030
43065
  return match$2(self.in === "query" ? schemaSearchParams(schema) : self.in === "cookie" ? schemaCookies(schema) : schemaHeaders(schema), {
43031
- onFailure: () => make$67(""),
43032
- onSuccess: (match) => make$67(match[key])
43066
+ onFailure: () => make$68(""),
43067
+ onSuccess: (match) => make$68(match[key])
43033
43068
  });
43034
43069
  }
43035
43070
  case "Basic": {
43036
43071
  const empty = {
43037
43072
  username: "",
43038
- password: make$67("")
43073
+ password: make$68("")
43039
43074
  };
43040
43075
  return map$4(HttpServerRequest, (request) => {
43041
43076
  const encoded = getAuthorizationCredential(request.headers.authorization, basicScheme);
@@ -43046,7 +43081,7 @@ const securityDecode = (self) => {
43046
43081
  if (separator === -1) return empty;
43047
43082
  return {
43048
43083
  username: decoded.slice(0, separator),
43049
- password: make$67(decoded.slice(separator + 1))
43084
+ password: make$68(decoded.slice(separator + 1))
43050
43085
  };
43051
43086
  });
43052
43087
  }
@@ -43584,18 +43619,18 @@ function requireDesktopTelemetryWriteProgress(fd, remainingBytes, written) {
43584
43619
  remainingBytes
43585
43620
  }));
43586
43621
  }
43587
- const layer$19 = effect(DesktopTelemetryReceiver, fn("resourceTelemetry.desktopTelemetryReceiver.make")(function* () {
43622
+ const layer$20 = effect(DesktopTelemetryReceiver, fn("resourceTelemetry.desktopTelemetryReceiver.make")(function* () {
43588
43623
  const config = yield* ServerConfig;
43589
43624
  const serverSettings = yield* ServerSettingsService;
43590
- const latest = yield* make$63(none());
43625
+ const latest = yield* make$64(none());
43591
43626
  const receiverStartedAt = yield* now$1;
43592
- const lastContactAtMs = yield* make$63(initialDesktopTelemetryContactAt(config.desktopTelemetryFd, toEpochMillis(receiverStartedAt)));
43593
- const snapshotStaleAfterMs = yield* make$63(resolveDesktopTelemetrySnapshotStaleAfterMs(DEFAULT_HOST_POWER_ACTIVE_INTERVAL_MS, DEFAULT_HOST_POWER_IDLE_INTERVAL_MS));
43627
+ const lastContactAtMs = yield* make$64(initialDesktopTelemetryContactAt(config.desktopTelemetryFd, toEpochMillis(receiverStartedAt)));
43628
+ const snapshotStaleAfterMs = yield* make$64(resolveDesktopTelemetrySnapshotStaleAfterMs(DEFAULT_HOST_POWER_ACTIVE_INTERVAL_MS, DEFAULT_HOST_POWER_IDLE_INTERVAL_MS));
43594
43629
  const changes = yield* sliding(8);
43595
43630
  const healthChanges = yield* sliding(4);
43596
- const controlMutex = yield* make$75(1);
43597
- const snapshotMutex = yield* make$75(1);
43598
- const health = yield* make$63({
43631
+ const controlMutex = yield* make$76(1);
43632
+ const snapshotMutex = yield* make$76(1);
43633
+ const health = yield* make$64({
43599
43634
  status: config.desktopTelemetryFd === void 0 ? "unavailable" : "starting",
43600
43635
  lastSampleAt: none(),
43601
43636
  lastError: config.desktopTelemetryFd === void 0 ? some(new DesktopTelemetryDescriptorUnavailable({ mode: config.mode }).message) : none()
@@ -43761,8 +43796,8 @@ const makeUnknownSnapshot = (source, updatedAt) => ({
43761
43796
  function samePowerState(left, right) {
43762
43797
  return left.source === right.source && left.idle === right.idle && left.locked === right.locked && left.suspended === right.suspended && left.onBattery === right.onBattery && left.lowPowerMode === right.lowPowerMode && left.thermalState === right.thermalState && left.stale === right.stale;
43763
43798
  }
43764
- const make$27 = fn("background.hostPower.make")(function* (initialSnapshot) {
43765
- const latestRef = yield* make$63(initialSnapshot ?? makeUnknownSnapshot("unknown", yield* now$1));
43799
+ const make$28 = fn("background.hostPower.make")(function* (initialSnapshot) {
43800
+ const latestRef = yield* make$64(initialSnapshot ?? makeUnknownSnapshot("unknown", yield* now$1));
43766
43801
  const changes = yield* sliding(1);
43767
43802
  const report = (snapshot) => modify$2(latestRef, (current) => {
43768
43803
  if (isLessThan$1(snapshot.updatedAt, current.updatedAt)) return [none(), current];
@@ -43777,12 +43812,12 @@ const make$27 = fn("background.hostPower.make")(function* (initialSnapshot) {
43777
43812
  streamChanges: fromPubSub(changes)
43778
43813
  });
43779
43814
  });
43780
- const layer$18 = effect(HostPowerMonitor, gen(function* () {
43815
+ const layer$19 = effect(HostPowerMonitor, gen(function* () {
43781
43816
  const desktopSubscription = yield* (yield* DesktopTelemetryReceiver).subscribe;
43782
43817
  const initial = desktopSubscription.latest;
43783
43818
  const monitor = yield* match$1(initial, {
43784
- onNone: () => make$27(),
43785
- onSome: (snapshot) => make$27(snapshot.power)
43819
+ onNone: () => make$28(),
43820
+ onSome: (snapshot) => make$28(snapshot.power)
43786
43821
  });
43787
43822
  yield* desktopSubscription.changes.pipe(map$8((snapshot) => snapshot.power), runForEach(monitor.report), forkScoped);
43788
43823
  return monitor;
@@ -43872,12 +43907,12 @@ function computeSnapshot(input) {
43872
43907
  updatedAt: input.updatedAt
43873
43908
  };
43874
43909
  }
43875
- const layer$17 = effect(BackgroundPolicy, fn("background.policy.make")(function* () {
43910
+ const layer$18 = effect(BackgroundPolicy, fn("background.policy.make")(function* () {
43876
43911
  const hostPowerMonitor = yield* HostPowerMonitor;
43877
43912
  const serverSettings = yield* ServerSettingsService;
43878
- const leasesRef = yield* make$63(/* @__PURE__ */ new Map());
43913
+ const leasesRef = yield* make$64(/* @__PURE__ */ new Map());
43879
43914
  const changes = yield* sliding(1);
43880
- const publishMutex = yield* make$75(1);
43915
+ const publishMutex = yield* make$76(1);
43881
43916
  const backgroundActivitySettings = serverSettings.getSettings.pipe(map$4(resolveServerBackgroundActivitySettings), orElseSucceed(() => getBackgroundActivityPresetSettings("balanced")));
43882
43917
  const snapshot = gen(function* () {
43883
43918
  const [hostPower, leases, now, settings] = yield* all([
@@ -43965,8 +44000,8 @@ function nonNegativeInteger(value, fallback) {
43965
44000
  if (!Number.isFinite(value)) return 0;
43966
44001
  return Math.max(0, Math.round(value));
43967
44002
  }
43968
- const layer$16 = effect(ResourceAttribution, fn("resourceTelemetry.resourceAttribution.make")(function* () {
43969
- const entries = yield* make$63(/* @__PURE__ */ new Map());
44003
+ const layer$17 = effect(ResourceAttribution, fn("resourceTelemetry.resourceAttribution.make")(function* () {
44004
+ const entries = yield* make$64(/* @__PURE__ */ new Map());
43970
44005
  const record = (input) => update$2(entries, (current) => {
43971
44006
  const next = new Map(current);
43972
44007
  const entryKey = key(input);
@@ -44102,7 +44137,7 @@ const layerFlusher = /*#__PURE__*/ sync$2(Flusher, () => {
44102
44137
  * @category constructors
44103
44138
  * @since 4.0.0
44104
44139
  */
44105
- const make$24 = /*#__PURE__*/ fnUntraced(function* (options) {
44140
+ const make$25 = /*#__PURE__*/ fnUntraced(function* (options) {
44106
44141
  const services = yield* context();
44107
44142
  const clock = get$5(services, Clock);
44108
44143
  const scope = get$5(services, Scope);
@@ -44134,7 +44169,7 @@ const make$24 = /*#__PURE__*/ fnUntraced(function* (options) {
44134
44169
  package: "@effect/opentelemetry",
44135
44170
  module: options.label
44136
44171
  }));
44137
- const exportFibers = yield* make$65();
44172
+ const exportFibers = yield* make$66();
44138
44173
  const runExportFork = yield* runtime(exportFibers)();
44139
44174
  yield* (yield* Flusher).register(runExport);
44140
44175
  yield* addFinalizer$1(scope, suspend(() => {
@@ -44172,7 +44207,7 @@ const make$24 = /*#__PURE__*/ fnUntraced(function* (options) {
44172
44207
  * @category constructors
44173
44208
  * @since 4.0.0
44174
44209
  */
44175
- const make$23 = (options) => {
44210
+ const make$24 = (options) => {
44176
44211
  const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
44177
44212
  resourceAttributes.push({
44178
44213
  key: "service.name",
@@ -44219,7 +44254,7 @@ const fromConfig = /*#__PURE__*/ fnUntraced(function* (options) {
44219
44254
  };
44220
44255
  delete attributes["service.name"];
44221
44256
  delete attributes["service.version"];
44222
- return make$23({
44257
+ return make$24({
44223
44258
  serviceName,
44224
44259
  serviceVersion,
44225
44260
  attributes
@@ -44338,7 +44373,7 @@ const layerJson$1 = /*#__PURE__*/ succeed$3(OtlpSerialization, {
44338
44373
  * @category constructors
44339
44374
  * @since 4.0.0
44340
44375
  */
44341
- const make$22 = /*#__PURE__*/ fnUntraced(function* (options) {
44376
+ const make$23 = /*#__PURE__*/ fnUntraced(function* (options) {
44342
44377
  const clock = yield* Clock;
44343
44378
  const serialization = yield* OtlpSerialization;
44344
44379
  const startTimeNanos = yield* clock.currentTimeNanos;
@@ -44619,7 +44654,7 @@ const make$22 = /*#__PURE__*/ fnUntraced(function* (options) {
44619
44654
  }]
44620
44655
  }] });
44621
44656
  };
44622
- yield* make$24({
44657
+ yield* make$25({
44623
44658
  label: "OtlpMetrics",
44624
44659
  url: options.url,
44625
44660
  headers: options.headers,
@@ -44635,7 +44670,7 @@ const make$22 = /*#__PURE__*/ fnUntraced(function* (options) {
44635
44670
  * @category layers
44636
44671
  * @since 4.0.0
44637
44672
  */
44638
- const layer$15 = (options) => effectDiscard(make$22(options)).pipe(provideMerge(layerFlusher));
44673
+ const layer$16 = (options) => effectDiscard(make$23(options)).pipe(provideMerge(layerFlusher));
44639
44674
  /** Creates a unique key for a metric including its attributes */
44640
44675
  const makeMetricKey = (id, attributes) => {
44641
44676
  if (attributes === void 0 || Object.keys(attributes).length === 0) return id;
@@ -44730,11 +44765,11 @@ const EAggregationTemporality = {
44730
44765
  * @category constructors
44731
44766
  * @since 4.0.0
44732
44767
  */
44733
- const make$21 = /*#__PURE__*/ fnUntraced(function* (options) {
44768
+ const make$22 = /*#__PURE__*/ fnUntraced(function* (options) {
44734
44769
  const otelResource = yield* fromConfig(options.resource);
44735
44770
  const serialization = yield* OtlpSerialization;
44736
44771
  const scope = { name: serviceNameUnsafe(otelResource) };
44737
- const exporter = yield* make$24({
44772
+ const exporter = yield* make$25({
44738
44773
  label: "OtlpTracer",
44739
44774
  url: options.url,
44740
44775
  headers: options.headers,
@@ -44756,7 +44791,7 @@ const make$21 = /*#__PURE__*/ fnUntraced(function* (options) {
44756
44791
  if (!span.sampled) return;
44757
44792
  exporter.push(makeOtlpSpan(span));
44758
44793
  }
44759
- return make$77({
44794
+ return make$78({
44760
44795
  span(options) {
44761
44796
  return makeSpan({
44762
44797
  ...options,
@@ -45274,8 +45309,8 @@ const makeLocalFileTracer = fn("makeLocalFileTracer")(function* (options) {
45274
45309
  batchWindowMs: options.batchWindowMs,
45275
45310
  ...options.onFlush ? { onFlush: options.onFlush } : {}
45276
45311
  }));
45277
- const delegate = options.delegate ?? make$77({ span: (spanOptions) => new NativeSpan(spanOptions) });
45278
- return make$77({
45312
+ const delegate = options.delegate ?? make$78({ span: (spanOptions) => new NativeSpan(spanOptions) });
45313
+ return make$78({
45279
45314
  span(spanOptions) {
45280
45315
  return new LocalFileSpan(spanOptions, delegate.span(spanOptions), sink.push);
45281
45316
  },
@@ -45441,7 +45476,7 @@ const logT3ProjectFileLoadError = (error) => logWarning$1(error).pipe(annotateLo
45441
45476
  filePath: error.filePath,
45442
45477
  errorTag: error._tag
45443
45478
  }));
45444
- const layer$14 = effect(T3ProjectFileLoader, gen(function* () {
45479
+ const layer$15 = effect(T3ProjectFileLoader, gen(function* () {
45445
45480
  const fileSystem = yield* FileSystem;
45446
45481
  const path = yield* Path;
45447
45482
  const load = fn("T3ProjectFileLoader.load")(function* (workspaceRoot) {
@@ -45532,7 +45567,7 @@ function extractIconHref(source) {
45532
45567
  return null;
45533
45568
  }
45534
45569
  const optionOnNotFound$1 = (effect) => effect.pipe(map$4(some), catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeed$1(none()) : fail(error) }));
45535
- const layer$13 = effect(ProjectFaviconResolver, gen(function* () {
45570
+ const layer$14 = effect(ProjectFaviconResolver, gen(function* () {
45536
45571
  const fileSystem = yield* FileSystem;
45537
45572
  const path = yield* Path;
45538
45573
  const workspacePaths = yield* WorkspacePaths;
@@ -45874,10 +45909,10 @@ const resolveAsset = fn("AssetAccess.resolveAsset")(function* (token, relativePa
45874
45909
  //#endregion
45875
45910
  //#region src/observability/BrowserTraceCollector.ts
45876
45911
  var BrowserTraceCollector = class extends Service$2()("t3/observability/BrowserTraceCollector") {};
45877
- const make$18 = (sink) => BrowserTraceCollector.of({ record: (records) => sync(() => {
45912
+ const make$19 = (sink) => BrowserTraceCollector.of({ record: (records) => sync(() => {
45878
45913
  for (const record of records) sink.push(record);
45879
45914
  }) });
45880
- const layer$12 = (sink) => succeed$3(BrowserTraceCollector, make$18(sink));
45915
+ const layer$13 = (sink) => succeed$3(BrowserTraceCollector, make$19(sink));
45881
45916
  //#endregion
45882
45917
  //#region src/auth/http.ts
45883
45918
  const CREDENTIAL_RESPONSE_HEADERS = {
@@ -49427,7 +49462,7 @@ let clientIdCounter = 0;
49427
49462
  * @category constructors
49428
49463
  * @since 4.0.0
49429
49464
  */
49430
- const make$17 = /*#__PURE__*/ fnUntraced(function* (group, options) {
49465
+ const make$18 = /*#__PURE__*/ fnUntraced(function* (group, options) {
49431
49466
  const clientId = clientIdCounter++;
49432
49467
  const { run, send, supportsAck, supportsTransferables } = yield* Protocol$1;
49433
49468
  const entries = /* @__PURE__ */ new Map();
@@ -49599,7 +49634,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
49599
49634
  const services = yield* context();
49600
49635
  const scope = get$5(services, Scope);
49601
49636
  const trackFiber = runIn(forkUnsafe(scope, "parallel"));
49602
- const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$75(concurrency);
49637
+ const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$76(concurrency);
49603
49638
  const clients = /* @__PURE__ */ new Map();
49604
49639
  let isShutdown = false;
49605
49640
  const shutdownLatch = makeUnsafe$7(false);
@@ -49835,10 +49870,10 @@ const applyMiddleware = (context, handler, options) => {
49835
49870
  * @category running
49836
49871
  * @since 4.0.0
49837
49872
  */
49838
- const make$16 = /*#__PURE__*/ fnUntraced(function* (group, options) {
49873
+ const make$17 = /*#__PURE__*/ fnUntraced(function* (group, options) {
49839
49874
  const { disconnects, end, run, send, supportsAck, supportsSpanPropagation, supportsTransferables } = yield* Protocol;
49840
49875
  const services = yield* context();
49841
- const scope = yield* make$76();
49876
+ const scope = yield* make$77();
49842
49877
  const server = yield* makeNoSerialization(group, {
49843
49878
  ...options,
49844
49879
  disableClientAcks: !supportsAck,
@@ -50026,12 +50061,12 @@ const makeProtocolWithHttpEffectWebsocket = /*#__PURE__*/ gen(function* () {
50026
50061
  */
50027
50062
  const toHttpEffectWebsocket = /*#__PURE__*/ fnUntraced(function* (group, options) {
50028
50063
  const { httpEffect, protocol } = yield* makeProtocolWithHttpEffectWebsocket;
50029
- yield* make$16(group, options).pipe(provideService(Protocol, protocol), forkScoped);
50064
+ yield* make$17(group, options).pipe(provideService(Protocol, protocol), forkScoped);
50030
50065
  return httpEffect;
50031
50066
  });
50032
50067
  const makeSocketProtocol = /*#__PURE__*/ gen(function* () {
50033
50068
  const serialization = yield* RpcSerialization;
50034
- const disconnects = yield* make$78();
50069
+ const disconnects = yield* make$79();
50035
50070
  let clientId = 0;
50036
50071
  const clients = /* @__PURE__ */ new Map();
50037
50072
  const clientIds = /* @__PURE__ */ new Set();
@@ -50106,8 +50141,8 @@ var ProviderRegistry = class extends Service$2()("t3/provider/Services/ProviderR
50106
50141
  //#endregion
50107
50142
  //#region src/provider/providerMaintenanceCommandCoordinator.ts
50108
50143
  const makeProviderMaintenanceCommandCoordinator = fn("makeProviderMaintenanceCommandCoordinator")(function* (input) {
50109
- const runningTargetsRef = yield* make$63(/* @__PURE__ */ new Set());
50110
- const locksRef = yield* make$63(/* @__PURE__ */ new Map());
50144
+ const runningTargetsRef = yield* make$64(/* @__PURE__ */ new Set());
50145
+ const locksRef = yield* make$64(/* @__PURE__ */ new Map());
50111
50146
  const acquireTarget = fn("acquireTarget")(function* (targetKey) {
50112
50147
  return yield* modify$2(runningTargetsRef, (runningTargets) => {
50113
50148
  if (runningTargets.has(targetKey)) return [false, runningTargets];
@@ -50124,7 +50159,7 @@ const makeProviderMaintenanceCommandCoordinator = fn("makeProviderMaintenanceCom
50124
50159
  const getLock = fn("getProviderMaintenanceCommandLock")(function* (lockKey) {
50125
50160
  const existing = (yield* get$3(locksRef)).get(lockKey);
50126
50161
  if (existing) return existing;
50127
- const lock = yield* make$75(1);
50162
+ const lock = yield* make$76(1);
50128
50163
  return yield* modify$2(locksRef, (locks) => {
50129
50164
  const current = locks.get(lockKey);
50130
50165
  if (current) return [current, locks];
@@ -50493,7 +50528,7 @@ const nowIso$3 = map$4(now$1, formatIso);
50493
50528
  const runProviderMaintenanceCommandWithSpawner = fn("ProviderMaintenanceRunner.runCommand")(function* (input) {
50494
50529
  return yield* fn("ProviderMaintenanceRunner.collectCommandResult")(function* () {
50495
50530
  const resolved = yield* resolveSpawnCommand(input.command, input.args);
50496
- const child = yield* input.spawner.spawn(make$79(resolved.command, resolved.args, { shell: resolved.shell })).pipe(mapError((cause) => new ProviderMaintenanceCommandError({
50531
+ const child = yield* input.spawner.spawn(make$80(resolved.command, resolved.args, { shell: resolved.shell })).pipe(mapError((cause) => new ProviderMaintenanceCommandError({
50497
50532
  message: `Failed to run update command ${input.command}: ${cause.message}`,
50498
50533
  cause
50499
50534
  })));
@@ -50561,7 +50596,7 @@ function makeUpdateState(input) {
50561
50596
  output: input.output ?? null
50562
50597
  };
50563
50598
  }
50564
- const layer$11 = effect(ProviderMaintenanceRunner, fn("ProviderMaintenanceRunner.make")(function* () {
50599
+ const layer$12 = effect(ProviderMaintenanceRunner, fn("ProviderMaintenanceRunner.make")(function* () {
50565
50600
  const providerRegistry = yield* ProviderRegistry;
50566
50601
  const spawner = yield* ChildProcessSpawner;
50567
50602
  const httpClient = yield* HttpClient;
@@ -50621,7 +50656,7 @@ const layer$11 = effect(ProviderMaintenanceRunner, fn("ProviderMaintenanceRunner
50621
50656
  })).pipe(asVoid);
50622
50657
  const runProviderUpdate = fn("ProviderMaintenanceRunner.runProviderUpdate")(function* () {
50623
50658
  const finish = (state) => setUpdateState(state).pipe(map$4((providers) => ({ providers })));
50624
- const startedAtRef = yield* make$63(null);
50659
+ const startedAtRef = yield* make$64(null);
50625
50660
  const runCommandAndVerify = fn("ProviderMaintenanceRunner.runCommandAndVerify")(function* () {
50626
50661
  const startedAt = yield* nowIso$3;
50627
50662
  yield* set$2(startedAtRef, startedAt);
@@ -50911,6 +50946,29 @@ const normalizeDispatchCommand = (command) => gen(function* () {
50911
50946
  };
50912
50947
  });
50913
50948
  //#endregion
50949
+ //#region src/orchestration/Services/ProviderRuntimeIngestion.ts
50950
+ /**
50951
+ * ProviderRuntimeIngestionService - Provider runtime ingestion service interface.
50952
+ *
50953
+ * Owns background workers that consume provider runtime streams and emit
50954
+ * orchestration commands/events.
50955
+ *
50956
+ * @module ProviderRuntimeIngestionService
50957
+ */
50958
+ var ProviderRuntimeReconciliationError = class extends TaggedErrorClass()("ProviderRuntimeReconciliationError", {
50959
+ threadId: ThreadId,
50960
+ detail: String$1,
50961
+ cause: optional$3(Defect())
50962
+ }) {
50963
+ get message() {
50964
+ return `Failed to reconcile provider thread '${this.threadId}': ${this.detail}`;
50965
+ }
50966
+ };
50967
+ /**
50968
+ * ProviderRuntimeIngestionService - Service tag for runtime ingestion workers.
50969
+ */
50970
+ var ProviderRuntimeIngestionService = class extends Service$2()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {};
50971
+ //#endregion
50914
50972
  //#region src/observability/RpcInstrumentation.ts
50915
50973
  const RPC_SPAN_PREFIX = "ws.rpc";
50916
50974
  const DEFAULT_RPC_SPAN_ATTRIBUTES = {
@@ -51193,7 +51251,7 @@ const waitForIndexReady = fn("WorkspaceSearchIndex.waitForIndexReady")(function*
51193
51251
  timeout: WORKSPACE_INDEX_SCAN_TIMEOUT
51194
51252
  });
51195
51253
  });
51196
- const make$14 = fn("WorkspaceSearchIndex.make")(function* (cwd, variant = "paths") {
51254
+ const make$15 = fn("WorkspaceSearchIndex.make")(function* (cwd, variant = "paths") {
51197
51255
  const finder = yield* acquireRelease(createFinder(cwd, variant), (finder) => try_({
51198
51256
  try: () => finder.destroy(),
51199
51257
  catch: (cause) => new WorkspaceSearchIndexDestroyFailed({
@@ -51322,12 +51380,12 @@ function parseWorkspaceSearchIndexKey(key) {
51322
51380
  * idle cleanup; using a default cwd here would mix resources from different
51323
51381
  * workspaces.
51324
51382
  */
51325
- const layer$10 = (key) => {
51383
+ const layer$11 = (key) => {
51326
51384
  const { cwd, variant } = parseWorkspaceSearchIndexKey(key);
51327
- return effect(WorkspaceSearchIndex, make$14(cwd, variant));
51385
+ return effect(WorkspaceSearchIndex, make$15(cwd, variant));
51328
51386
  };
51329
51387
  var WorkspaceSearchIndexMap = class extends Service()("t3/workspace/WorkspaceSearchIndexMap", {
51330
- lookup: layer$10,
51388
+ lookup: layer$11,
51331
51389
  idleTimeToLive: WORKSPACE_INDEX_IDLE_TTL
51332
51390
  }) {};
51333
51391
  //#endregion
@@ -51389,7 +51447,7 @@ const resolveBrowseTarget = fn("WorkspaceEntries.resolveBrowseTarget")(function*
51389
51447
  if (!input.cwd) return yield* new WorkspaceEntriesCurrentProjectRequiredError({ partialPath: input.partialPath });
51390
51448
  return path.resolve(expandHomePath$1(input.cwd, path), input.partialPath);
51391
51449
  });
51392
- const layer$9 = effect(WorkspaceEntries, gen(function* () {
51450
+ const layer$10 = effect(WorkspaceEntries, gen(function* () {
51393
51451
  const path = yield* Path;
51394
51452
  const workspacePaths = yield* WorkspacePaths;
51395
51453
  const workspaceSearchIndexes = yield* WorkspaceSearchIndexMap;
@@ -51542,7 +51600,7 @@ Union([
51542
51600
  ]);
51543
51601
  /** Service tag for workspace file operations. */
51544
51602
  var WorkspaceFileSystem = class extends Service$2()("t3/workspace/WorkspaceFileSystem") {};
51545
- const layer$8 = effect(WorkspaceFileSystem, gen(function* () {
51603
+ const layer$9 = effect(WorkspaceFileSystem, gen(function* () {
51546
51604
  const fileSystem = yield* FileSystem;
51547
51605
  const path = yield* Path;
51548
51606
  const workspacePaths = yield* WorkspacePaths;
@@ -51726,7 +51784,7 @@ function parseGitRefs(output, refKind, query = "", currentRef = null) {
51726
51784
  });
51727
51785
  }
51728
51786
  var GitWorkspace = class extends Service$2()("agentlink/workspace/GitWorkspace") {};
51729
- const layer$7 = effect(GitWorkspace, gen(function* () {
51787
+ const layer$8 = effect(GitWorkspace, gen(function* () {
51730
51788
  const runner = yield* ProcessRunner;
51731
51789
  const run = fn("GitWorkspace.run")(function* (cwd, operation, args, allowFailure = false) {
51732
51790
  const result = yield* runner.run({
@@ -51863,7 +51921,7 @@ const layer$7 = effect(GitWorkspace, gen(function* () {
51863
51921
  listRefs,
51864
51922
  switchRef
51865
51923
  });
51866
- })).pipe(provide(layer$30));
51924
+ })).pipe(provide(layer$31));
51867
51925
  //#endregion
51868
51926
  //#region src/terminal/PtyAdapter.ts
51869
51927
  /**
@@ -51949,7 +52007,7 @@ function validateCwd(cwd) {
51949
52007
  }
51950
52008
  }).pipe(flatMap$1((stat) => stat.isDirectory() ? void_$1 : new TerminalCwdNotDirectoryError({ cwd })));
51951
52009
  }
51952
- const layer$6 = effect(TerminalManager, gen(function* () {
52010
+ const layer$7 = effect(TerminalManager, gen(function* () {
51953
52011
  const pty = yield* PtyAdapter;
51954
52012
  const runFork = runForkWith(yield* context());
51955
52013
  const sessions = /* @__PURE__ */ new Map();
@@ -52518,6 +52576,7 @@ const wsRpcServices = gen(function* () {
52518
52576
  crypto: yield* Crypto,
52519
52577
  projectionSnapshotQuery: yield* ProjectionSnapshotQuery,
52520
52578
  orchestrationEngine: yield* OrchestrationEngineService,
52579
+ providerRuntimeIngestion: yield* ProviderRuntimeIngestionService,
52521
52580
  keybindings: yield* Keybindings,
52522
52581
  externalLauncher: yield* ExternalLauncher,
52523
52582
  providerRegistry: yield* ProviderRegistry,
@@ -52538,9 +52597,9 @@ const wsRpcServices = gen(function* () {
52538
52597
  });
52539
52598
  const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52540
52599
  const currentSessionId = currentSession.sessionId;
52541
- const { crypto, projectionSnapshotQuery, orchestrationEngine, keybindings, externalLauncher, providerRegistry, config, lifecycleEvents, serverSettings, startup, workspaceEntries, workspaceFileSystem, gitWorkspace, terminalManager, serverEnvironment, backgroundPolicy, serverAuth, bootstrapCredentials, sessions } = yield* wsRpcServices;
52600
+ const { crypto, projectionSnapshotQuery, orchestrationEngine, providerRuntimeIngestion, keybindings, externalLauncher, providerRegistry, config, lifecycleEvents, serverSettings, startup, workspaceEntries, workspaceFileSystem, gitWorkspace, terminalManager, serverEnvironment, backgroundPolicy, serverAuth, bootstrapCredentials, sessions } = yield* wsRpcServices;
52542
52601
  const providerMaintenanceRunner = yield* ProviderMaintenanceRunner;
52543
- const rpcClientIds = yield* make$63(/* @__PURE__ */ new Set());
52602
+ const rpcClientIds = yield* make$64(/* @__PURE__ */ new Set());
52544
52603
  yield* addFinalizer(() => get$3(rpcClientIds).pipe(flatMap$1((clientIds) => forEach(clientIds, (clientId) => backgroundPolicy.removeRpcClient(currentSessionId, clientId), { discard: true })), ignore$1));
52545
52604
  const authorizationError = (requiredScope) => new EnvironmentAuthorizationError({
52546
52605
  message: `The authenticated token is missing required scope: ${requiredScope}.`,
@@ -52681,7 +52740,8 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52681
52740
  });
52682
52741
  const dispatchNormalizedCommand = (normalizedCommand) => {
52683
52742
  const dispatchEffect = normalizedCommand.type === "thread.turn.start" && normalizedCommand.bootstrap ? dispatchBootstrapTurnStart(normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
52684
- return startup.enqueueCommand(dispatchEffect).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
52743
+ const guardedDispatchEffect = normalizedCommand.type === "thread.turn.start" && normalizedCommand.bootstrap === void 0 ? providerRuntimeIngestion.reconcileThread(normalizedCommand.threadId, { requireWritable: true }).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to reconcile provider thread")), andThen(dispatchEffect)) : dispatchEffect;
52744
+ return startup.enqueueCommand(guardedDispatchEffect).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
52685
52745
  };
52686
52746
  const loadServerConfig = gen(function* () {
52687
52747
  const keybindingsConfig = yield* keybindings.loadConfigState;
@@ -52755,7 +52815,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52755
52815
  if (input.afterSequence !== void 0) {
52756
52816
  const afterSequence = input.afterSequence;
52757
52817
  const replayGap = (yield* orchestrationEngine.latestSequence) - afterSequence;
52758
- if (replayGap < 0 || replayGap > SHELL_RESUME_MAX_GAP) return concat(make$74({
52818
+ if (replayGap < 0 || replayGap > SHELL_RESUME_MAX_GAP) return concat(make$75({
52759
52819
  kind: "snapshot",
52760
52820
  snapshot: yield* loadSnapshot
52761
52821
  }), synchronizedThenLive);
@@ -52764,7 +52824,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52764
52824
  cause
52765
52825
  }))), synchronizedThenLive);
52766
52826
  }
52767
- return concat(make$74({
52827
+ return concat(make$75({
52768
52828
  kind: "snapshot",
52769
52829
  snapshot: yield* loadSnapshot
52770
52830
  }), synchronizedThenLive);
@@ -52782,6 +52842,10 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52782
52842
  const liveBuffer = yield* unbounded$2();
52783
52843
  yield* forkScoped(liveStream.pipe(runForEach((item) => offer$1(liveBuffer, item))));
52784
52844
  const bufferedLiveStream = fromQueue(liveBuffer);
52845
+ yield* providerRuntimeIngestion.reconcileThread(input.threadId).pipe(mapError((cause) => new OrchestrationGetSnapshotError({
52846
+ message: cause.message,
52847
+ cause
52848
+ })));
52785
52849
  if (input.afterSequence !== void 0) {
52786
52850
  const afterSequence = input.afterSequence;
52787
52851
  const replayGap = (yield* orchestrationEngine.latestSequence) - afterSequence;
@@ -52802,7 +52866,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52802
52866
  cause: input.threadId
52803
52867
  });
52804
52868
  const afterSnapshot = input.requestCompletionMarker === true ? concat(fromEffect(offer$1(liveBuffer, { kind: "synchronized" })).pipe(drain), bufferedLiveStream) : bufferedLiveStream;
52805
- return concat(make$74({
52869
+ return concat(make$75({
52806
52870
  kind: "snapshot",
52807
52871
  snapshot: projectThreadDetailSnapshot(snapshot.value)
52808
52872
  }), afterSnapshot);
@@ -52906,7 +52970,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52906
52970
  })));
52907
52971
  yield* providerRegistry.refresh().pipe(ignoreCause({ log: true }), forkScoped);
52908
52972
  const liveUpdates = merge$2(keybindingsUpdates, merge$2(providerStatuses, settingsUpdates));
52909
- return concat(make$74({
52973
+ return concat(make$75({
52910
52974
  version: 1,
52911
52975
  type: "snapshot",
52912
52976
  config: yield* loadServerConfig
@@ -52920,9 +52984,9 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52920
52984
  }), { "rpc.aggregate": "server" }),
52921
52985
  [WS_METHODS.subscribeAuthAccess]: (_input) => observeRpcStreamEffect$1(WS_METHODS.subscribeAuthAccess, gen(function* () {
52922
52986
  const initialSnapshot = yield* loadAuthAccessSnapshot();
52923
- const revisionRef = yield* make$63(1);
52987
+ const revisionRef = yield* make$64(1);
52924
52988
  const liveEvents = merge$2(bootstrapCredentials.streamChanges, sessions.streamChanges).pipe(mapEffect$1((change) => updateAndGet(revisionRef, (revision) => revision + 1).pipe(map$4((revision) => toAuthAccessStreamEvent(change, revision, currentSessionId)))));
52925
- return concat(make$74({
52989
+ return concat(make$75({
52926
52990
  version: 1,
52927
52991
  revision: 1,
52928
52992
  type: "snapshot",
@@ -52982,7 +53046,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
52982
53046
  [ORCHESTRATION_WS_METHODS.getFullThreadDiff]: unsupportedRpc,
52983
53047
  [ORCHESTRATION_WS_METHODS.getTurnDiff]: unsupportedRpc,
52984
53048
  [ORCHESTRATION_WS_METHODS.getWorkflowScript]: unsupportedRpc,
52985
- [WS_METHODS.subscribeBackgroundPolicy]: (_input) => observeRpcStream$1(WS_METHODS.subscribeBackgroundPolicy, unwrap$1(map$4(backgroundPolicy.subscribe, ({ latest, changes }) => concat(make$74(latest), changes))), { "rpc.aggregate": "server" })
53049
+ [WS_METHODS.subscribeBackgroundPolicy]: (_input) => observeRpcStream$1(WS_METHODS.subscribeBackgroundPolicy, unwrap$1(map$4(backgroundPolicy.subscribe, ({ latest, changes }) => concat(make$75(latest), changes))), { "rpc.aggregate": "server" })
52986
53050
  });
52987
53051
  }));
52988
53052
  const websocketRpcRouteLayer = unwrap(gen(function* () {
@@ -52991,7 +53055,7 @@ const websocketRpcRouteLayer = unwrap(gen(function* () {
52991
53055
  const serverAuth = yield* EnvironmentAuth;
52992
53056
  const sessions = yield* SessionStore;
52993
53057
  const session = yield* serverAuth.authenticateWebSocketUpgrade(request).pipe(catchIf(isServerAuthCredentialError, (error) => failEnvironmentAuthInvalid(serverAuthCredentialReason(error))), catchIf(isServerAuthInternalError, (error) => failEnvironmentInternal("internal_error", error)));
52994
- const rpcWebSocketHttpEffect = yield* toHttpEffectWebsocket(WsRpcGroup, { disableTracing: true }).pipe(provide$1(makeWsRpcLayer(session).pipe(provideMerge(layerJson), provide(layer$11))));
53058
+ const rpcWebSocketHttpEffect = yield* toHttpEffectWebsocket(WsRpcGroup, { disableTracing: true }).pipe(provide$1(makeWsRpcLayer(session).pipe(provideMerge(layerJson), provide(layer$12))));
52995
53059
  return yield* acquireUseRelease(sessions.markConnected(session.sessionId), () => rpcWebSocketHttpEffect, () => sessions.markDisconnected(session.sessionId));
52996
53060
  }).pipe(catchTags({
52997
53061
  EnvironmentAuthInvalidError: toResponse,
@@ -53151,7 +53215,7 @@ const ResponseDefectEncoded = (cause) => ({
53151
53215
  });
53152
53216
  const makeTunnelSocketProtocol = gen(function* () {
53153
53217
  const serialization = yield* RpcSerialization;
53154
- const disconnects = yield* make$78();
53218
+ const disconnects = yield* make$79();
53155
53219
  let clientId = 0;
53156
53220
  const clients = /* @__PURE__ */ new Map();
53157
53221
  const clientIds = /* @__PURE__ */ new Set();
@@ -53233,7 +53297,7 @@ function encodeHttpTunnelResponseFrame(frame) {
53233
53297
  }
53234
53298
  const makeTunnelSocket = (input) => {
53235
53299
  const runRaw = (handler, options) => scopedWith((scope) => gen(function* () {
53236
- const fiberSet = yield* make$65().pipe(provide$2(scope));
53300
+ const fiberSet = yield* make$66().pipe(provide$2(scope));
53237
53301
  const runFork = yield* runtime(fiberSet)();
53238
53302
  const deliver = (frame) => {
53239
53303
  const handled = handler(frame);
@@ -53244,7 +53308,7 @@ const makeTunnelSocket = (input) => {
53244
53308
  if (options?.onOpen) yield* options.onOpen;
53245
53309
  yield* _await(input.tunnel.closed).pipe(raceFirst(join$1(fiberSet)));
53246
53310
  }));
53247
- return make$66({
53311
+ return make$67({
53248
53312
  runRaw,
53249
53313
  writer: sync(() => (chunk) => sync(() => {
53250
53314
  if (typeof chunk === "string") for (const part of chunkAgentLinkFrame(chunk)) input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey, part)));
@@ -53323,8 +53387,8 @@ const runHubTunnel = (config) => gen(function* () {
53323
53387
  subject: "hub-tunnel",
53324
53388
  method: "bearer-access-token",
53325
53389
  scopes: [...TUNNEL_SCOPES]
53326
- }).pipe(provideMerge(layerJson), provide(layer$11))).pipe(provideContext(currentContext));
53327
- yield* make$16(WsRpcGroup, { disableTracing: true }).pipe(provideService(Protocol, protocol), provideContext(rpcContext));
53390
+ }).pipe(provideMerge(layerJson), provide(layer$12))).pipe(provideContext(currentContext));
53391
+ yield* make$17(WsRpcGroup, { disableTracing: true }).pipe(provideService(Protocol, protocol), provideContext(rpcContext));
53328
53392
  }).pipe(tapCause((cause) => logError("hub tunnel: RPC server failed", { cause: String(cause) }))));
53329
53393
  yield* forkScoped(onSocket(socketAdapter));
53330
53394
  if (!writeHub(JSON.stringify({
@@ -53407,7 +53471,7 @@ const runHubTunnel = (config) => gen(function* () {
53407
53471
  if (lower === "authorization" || lower === "cookie") continue;
53408
53472
  headers[lower] = value;
53409
53473
  }
53410
- let request = make$64(requestFrame.method)(targetUrl).pipe(setHeaders(headers));
53474
+ let request = make$65(requestFrame.method)(targetUrl).pipe(setHeaders(headers));
53411
53475
  if (requestFrame.body !== null) request = setBody(uint8Array(Buffer.from(requestFrame.body, "base64")))(request);
53412
53476
  const response = yield* httpClient.execute(request);
53413
53477
  const responseBody = yield* response.arrayBuffer;
@@ -53460,7 +53524,7 @@ const runHubTunnel = (config) => gen(function* () {
53460
53524
  const tunnelId = control.tunnelId;
53461
53525
  if (tunnels.has(tunnelId)) return;
53462
53526
  return gen(function* () {
53463
- const closed = yield* make$73();
53527
+ const closed = yield* make$74();
53464
53528
  const purpose = control.purpose === "http" ? "http" : "rpc";
53465
53529
  const live = {
53466
53530
  closed,
@@ -53514,7 +53578,159 @@ const runHubTunnel = (config) => gen(function* () {
53514
53578
  while: (error) => !(SocketError.is(error) && error.reason._tag === "SocketCloseError" && (error.reason.code === 4401 || error.reason.code === 4403))
53515
53579
  });
53516
53580
  }).pipe(tapDefect((cause) => logError("hub tunnel: worker defect", { cause: String(cause) })), catchCause((cause) => logError("hub tunnel: worker failed", { cause: String(cause) })));
53517
- const layer$5 = (config) => effectDiscard(forkScoped(runHubTunnel(config)));
53581
+ const layer$6 = (config) => effectDiscard(forkScoped(runHubTunnel(config)));
53582
+ //#endregion
53583
+ //#region ../t3-shared/src/agentAwareness.ts
53584
+ function buildAgentAwarenessDeepLink(input) {
53585
+ return `/threads/${encodeURIComponent(input.environmentId)}/${encodeURIComponent(input.threadId)}`;
53586
+ }
53587
+ function projectThreadAwareness(input) {
53588
+ const { environmentId, project, thread } = input;
53589
+ const phase = resolveThreadAwarenessPhase(thread);
53590
+ if (!phase) return null;
53591
+ const detail = detailForPhase(phase, thread);
53592
+ return {
53593
+ environmentId,
53594
+ threadId: thread.id,
53595
+ projectTitle: project.title,
53596
+ threadTitle: thread.title,
53597
+ phase,
53598
+ headline: headlineForPhase(phase),
53599
+ ...detail === void 0 ? {} : { detail },
53600
+ modelTitle: thread.modelSelection.model,
53601
+ updatedAt: thread.updatedAt,
53602
+ deepLink: buildAgentAwarenessDeepLink({
53603
+ environmentId,
53604
+ threadId: thread.id
53605
+ })
53606
+ };
53607
+ }
53608
+ function resolveThreadAwarenessPhase(thread) {
53609
+ if (thread.hasPendingApprovals) return "waiting_for_approval";
53610
+ if (thread.hasPendingUserInput) return "waiting_for_input";
53611
+ if (thread.session?.status === "error" || thread.latestTurn?.state === "error") return "failed";
53612
+ if (thread.session?.status === "starting") return "starting";
53613
+ if (thread.session?.status === "running" || thread.latestTurn?.state === "running") return "running";
53614
+ if (thread.latestTurn?.state === "completed") return "completed";
53615
+ if (thread.latestTurn?.state === "interrupted" && thread.latestTurn.completedAt !== null) return "completed";
53616
+ if (thread.session?.status === "ready" || thread.session?.status === "idle") return "completed";
53617
+ return null;
53618
+ }
53619
+ function headlineForPhase(phase) {
53620
+ switch (phase) {
53621
+ case "starting": return "Starting agent";
53622
+ case "running": return "Agent is working";
53623
+ case "waiting_for_approval": return "Approval needed";
53624
+ case "waiting_for_input": return "Waiting for input";
53625
+ case "completed": return "Agent finished";
53626
+ case "failed": return "Agent failed";
53627
+ case "stale": return "Update delayed";
53628
+ }
53629
+ }
53630
+ function detailForPhase(phase, thread) {
53631
+ if (phase === "failed") return thread.session?.lastError ?? void 0;
53632
+ if (phase === "completed") return "Review the completed task.";
53633
+ if (phase === "running" && thread.session?.providerName) return `${thread.session.providerName} is active.`;
53634
+ }
53635
+ //#endregion
53636
+ //#region ../t3-shared/src/DrainableWorker.ts
53637
+ /**
53638
+ * Create a drainable worker that processes items from an unbounded queue.
53639
+ *
53640
+ * The worker is forked into the current scope and will be interrupted when
53641
+ * the scope closes. A finalizer shuts down the queue.
53642
+ *
53643
+ * @param process - The effect to run for each queued item.
53644
+ * @returns A `DrainableWorker` with `queue` and `drain`.
53645
+ */
53646
+ const makeDrainableWorker = (process) => gen(function* () {
53647
+ const queue = yield* acquireRelease(unbounded(), shutdown);
53648
+ const outstanding = yield* make$53(0);
53649
+ yield* take(queue).pipe(tap((a) => ensuring(process(a), update$1(outstanding, (n) => n - 1))), forever, forkScoped);
53650
+ const drain = get$1(outstanding).pipe(tap((n) => n > 0 ? txRetry : void_$1), tx);
53651
+ const enqueue = (element) => offer(queue, element).pipe(tap(() => update$1(outstanding, (n) => n + 1)), tx);
53652
+ return {
53653
+ enqueue,
53654
+ drain
53655
+ };
53656
+ });
53657
+ //#endregion
53658
+ //#region src/tunnel/AgentAwarenessHub.ts
53659
+ var AgentAwarenessHub = class extends Service$2()("agentlink/AgentAwarenessHub") {};
53660
+ function eventThreadId(event) {
53661
+ const payload = event.payload;
53662
+ if (typeof payload.threadId === "string") return payload.threadId;
53663
+ return event.aggregateKind === "thread" && typeof event.aggregateId === "string" ? event.aggregateId : null;
53664
+ }
53665
+ function shouldPublishAgentAwarenessEvent(event) {
53666
+ if (event.type === "thread.message-sent" || event.type === "thread.turn-start-requested") return false;
53667
+ if (event.type !== "thread.activity-appended") return true;
53668
+ return [
53669
+ "approval.requested",
53670
+ "approval.resolved",
53671
+ "user-input.requested",
53672
+ "user-input.resolved",
53673
+ "runtime.error"
53674
+ ].includes(event.payload.activity.kind);
53675
+ }
53676
+ const make$10 = (config) => gen(function* () {
53677
+ const environment = yield* ServerEnvironment;
53678
+ const snapshots = yield* ProjectionSnapshotQuery;
53679
+ const engine = yield* OrchestrationEngineService;
53680
+ const published = yield* make$64(/* @__PURE__ */ new Map());
53681
+ const publishThread = fn("AgentAwarenessHub.publishThread")(function* (threadId) {
53682
+ const thread = yield* snapshots.getThreadShellById(threadId);
53683
+ if (isNone(thread)) return;
53684
+ const project = yield* snapshots.getProjectShellById(thread.value.projectId);
53685
+ if (isNone(project)) return;
53686
+ const state = projectThreadAwareness({
53687
+ environmentId: yield* environment.getEnvironmentId,
53688
+ project: project.value,
53689
+ thread: thread.value
53690
+ });
53691
+ if (!state || ![
53692
+ "waiting_for_approval",
53693
+ "waiting_for_input",
53694
+ "completed",
53695
+ "failed"
53696
+ ].includes(state.phase)) {
53697
+ yield* update$2(published, (current) => {
53698
+ const next = new Map(current);
53699
+ next.delete(threadId);
53700
+ return next;
53701
+ });
53702
+ return;
53703
+ }
53704
+ const { updatedAt: _updatedAt, detail: _detail, ...safeState } = state;
53705
+ const identity = JSON.stringify(safeState);
53706
+ if ((yield* get$3(published)).get(threadId) === identity) return;
53707
+ const response = yield* tryPromise({
53708
+ try: () => fetch(`${hubHttpUrl(config.hubUrl)}/api/push/activity`, {
53709
+ method: "POST",
53710
+ headers: {
53711
+ authorization: `Bearer ${config.machineToken}`,
53712
+ "content-type": "application/json",
53713
+ "x-requested-with": "agentlink"
53714
+ },
53715
+ body: JSON.stringify({ state: safeState })
53716
+ }),
53717
+ catch: (cause) => cause
53718
+ });
53719
+ if (!response.ok) return yield* fail(/* @__PURE__ */ new Error(`Hub push publish failed: ${response.status}`));
53720
+ yield* update$2(published, (current) => new Map(current).set(threadId, identity));
53721
+ });
53722
+ const worker = yield* makeDrainableWorker((threadId) => publishThread(threadId).pipe(catchCause((cause) => logWarning$1("Agent awareness Hub publish failed", {
53723
+ threadId,
53724
+ cause
53725
+ }))));
53726
+ return AgentAwarenessHub.of({ start: () => runForEach(engine.streamDomainEvents, (event) => {
53727
+ const threadId = eventThreadId(event);
53728
+ return threadId && shouldPublishAgentAwarenessEvent(event) ? worker.enqueue(threadId) : void_$1;
53729
+ }).pipe(catchCause(() => void_$1)) });
53730
+ });
53731
+ const layer$5 = (config) => effectDiscard(gen(function* () {
53732
+ yield* forkScoped((yield* make$10(config)).start());
53733
+ }));
53518
53734
  //#endregion
53519
53735
  //#region src/persistence/ProviderSessionRuntime.ts
53520
53736
  /**
@@ -54263,7 +54479,7 @@ const makeEventNdjsonLogStore = fnUntraced(function* (filePath, options = {}) {
54263
54479
  filePath: failure.filePath,
54264
54480
  errorTag: errorTag(failure.cause)
54265
54481
  });
54266
- const stateRef = yield* make$53({
54482
+ const stateRef = yield* make$54({
54267
54483
  pending: [],
54268
54484
  pendingBytes: 0,
54269
54485
  sinks: /* @__PURE__ */ new Map(),
@@ -54271,7 +54487,7 @@ const makeEventNdjsonLogStore = fnUntraced(function* (filePath, options = {}) {
54271
54487
  closed: false,
54272
54488
  lastRetentionAt: initializedAt
54273
54489
  });
54274
- const timerScope = yield* make$76();
54490
+ const timerScope = yield* make$77();
54275
54491
  const flush = fnUntraced(function* (timerFired, close) {
54276
54492
  const startedAt = yield* currentTimeMillis;
54277
54493
  const result = yield* modifyEffect(stateRef, (state) => sync(() => drainPending({
@@ -54522,7 +54738,7 @@ const ProviderServiceLive = effect(ProviderService, fn("makeProviderService")(fu
54522
54738
  provider: canonicalEvent.provider,
54523
54739
  eventType: canonicalEvent.type
54524
54740
  }).pipe(andThen(publishRuntimeEvent(canonicalEvent)))));
54525
- const subscribedAdapters = yield* make$63(/* @__PURE__ */ new Map());
54741
+ const subscribedAdapters = yield* make$64(/* @__PURE__ */ new Map());
54526
54742
  const getAdapterEntries = get$3(subscribedAdapters).pipe(map$4((map) => Array.from(map.entries())));
54527
54743
  const reconcileInstanceSubscriptions = gen(function* () {
54528
54744
  const previous = yield* get$3(subscribedAdapters);
@@ -54914,6 +55130,29 @@ const ProviderServiceLive = effect(ProviderService, fn("makeProviderService")(fu
54914
55130
  });
54915
55131
  const getCapabilities = (instanceId) => registry.getByInstance(instanceId).pipe(map$4((adapter) => adapter.capabilities));
54916
55132
  const getInstanceInfo = (instanceId) => registry.getInstanceInfo(instanceId);
55133
+ const readThread = fn("readThread")(function* (threadId) {
55134
+ const binding = getOrUndefined(yield* directory.getBinding(threadId));
55135
+ if (!binding) return yield* toValidationError("ProviderService.readThread", `Cannot read thread '${threadId}' because no persisted provider binding exists.`);
55136
+ const instanceId = yield* requireBindingInstanceId("ProviderService.readThread", binding);
55137
+ const adapter = yield* registry.getByInstance(instanceId);
55138
+ const cwd = readPersistedCwd(binding.runtimePayload);
55139
+ const modelSelection = readPersistedModelSelection(binding.runtimePayload);
55140
+ const hasResumeCursor = binding.resumeCursor !== null && binding.resumeCursor !== void 0;
55141
+ return yield* adapter.readThread({
55142
+ threadId,
55143
+ provider: binding.provider,
55144
+ providerInstanceId: instanceId,
55145
+ ...cwd ? { cwd } : {},
55146
+ ...modelSelection ? { modelSelection } : {},
55147
+ ...hasResumeCursor ? { resumeCursor: binding.resumeCursor } : {},
55148
+ runtimeMode: binding.runtimeMode ?? "full-access"
55149
+ });
55150
+ });
55151
+ const ensureSession = (threadId) => resolveRoutableSession({
55152
+ threadId,
55153
+ operation: "ProviderService.ensureSession",
55154
+ allowRecovery: true
55155
+ }).pipe(asVoid);
54917
55156
  const rollbackConversation = fn("rollbackConversation")(function* (rawInput) {
54918
55157
  const input = yield* decodeInputOrValidationError({
54919
55158
  operation: "ProviderService.rollbackConversation",
@@ -54984,6 +55223,8 @@ const ProviderServiceLive = effect(ProviderService, fn("makeProviderService")(fu
54984
55223
  listSessions,
54985
55224
  getCapabilities,
54986
55225
  getInstanceInfo,
55226
+ readThread,
55227
+ ensureSession,
54987
55228
  rollbackConversation,
54988
55229
  get streamEvents() {
54989
55230
  return fromPubSub(runtimeEventPubSub);
@@ -56339,7 +56580,7 @@ const probeClaudeCapabilities = (claudeSettings, environment, cwd) => {
56339
56580
  const runClaudeCommand = fn("runClaudeCommand")(function* (claudeSettings, args, environment) {
56340
56581
  const claudeEnvironment = yield* makeClaudeEnvironment(claudeSettings, environment);
56341
56582
  const spawnCommand = yield* resolveSpawnCommand(claudeSettings.binaryPath, args, { env: claudeEnvironment });
56342
- const command = make$79(spawnCommand.command, spawnCommand.args, {
56583
+ const command = make$80(spawnCommand.command, spawnCommand.args, {
56343
56584
  env: claudeEnvironment,
56344
56585
  shell: spawnCommand.shell
56345
56586
  });
@@ -56556,11 +56797,11 @@ const makeClaudeTextGeneration = fn("makeClaudeTextGeneration")(function* (claud
56556
56797
  ...settingsJson ? ["--settings", settingsJson] : [],
56557
56798
  "--dangerously-skip-permissions"
56558
56799
  ], { env: claudeEnvironment });
56559
- const command = make$79(spawnCommand.command, spawnCommand.args, {
56800
+ const command = make$80(spawnCommand.command, spawnCommand.args, {
56560
56801
  env: claudeEnvironment,
56561
56802
  cwd,
56562
56803
  shell: spawnCommand.shell,
56563
- stdin: { stream: encodeText(make$74(prompt)) }
56804
+ stdin: { stream: encodeText(make$75(prompt)) }
56564
56805
  });
56565
56806
  const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("claude", operation, cause, "Failed to spawn Claude CLI process")));
56566
56807
  const [stdout, stderr, exitCode] = yield* all([
@@ -58902,7 +59143,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
58902
59143
  const taskAgents = /* @__PURE__ */ new Map();
58903
59144
  const workflowMemberFingerprints = /* @__PURE__ */ new Map();
58904
59145
  const liveTaskIds = /* @__PURE__ */ new Set();
58905
- const contextRef = yield* make$63(void 0);
59146
+ const contextRef = yield* make$64(void 0);
58906
59147
  /**
58907
59148
  * Handle AskUserQuestion tool calls by emitting a `user-input.requested`
58908
59149
  * runtime event and waiting for the user to respond via `respondToUserInput`.
@@ -58919,7 +59160,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
58919
59160
  })) : [],
58920
59161
  multiSelect: typeof q.multiSelect === "boolean" ? q.multiSelect : false
58921
59162
  }));
58922
- const answersDeferred = yield* make$73();
59163
+ const answersDeferred = yield* make$74();
58923
59164
  let aborted = false;
58924
59165
  const pendingInput = {
58925
59166
  questions,
@@ -59015,7 +59256,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
59015
59256
  const requestId = ApprovalRequestId.make(yield* randomUUIDv4);
59016
59257
  const requestType = classifyRequestType(toolName);
59017
59258
  const detail = summarizeToolRequest(toolName, toolInput);
59018
- const decisionDeferred = yield* make$73();
59259
+ const decisionDeferred = yield* make$74();
59019
59260
  const pendingApproval = {
59020
59261
  requestType,
59021
59262
  detail,
@@ -59352,8 +59593,8 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
59352
59593
  catch: (cause) => toRequestError(threadId, "turn/interrupt", cause)
59353
59594
  });
59354
59595
  });
59355
- const readThread = fn("readThread")(function* (threadId) {
59356
- const context = yield* requireSession(threadId);
59596
+ const readThread = fn("readThread")(function* (input) {
59597
+ const context = yield* requireSession(input.threadId);
59357
59598
  return yield* snapshotThread(context);
59358
59599
  });
59359
59600
  const rollbackThread = fn("rollbackThread")(function* (threadId, numTurns) {
@@ -59420,15 +59661,15 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
59420
59661
  const makeManagedServerProvider = fn("makeManagedServerProvider")(function* (input) {
59421
59662
  const backgroundPolicy = yield* BackgroundPolicy;
59422
59663
  const serverSettings = yield* ServerSettingsService;
59423
- const refreshSemaphore = yield* make$75(1);
59664
+ const refreshSemaphore = yield* make$76(1);
59424
59665
  const changesPubSub = yield* acquireRelease(unbounded$1(), shutdown$2);
59425
59666
  const initialSettings = yield* input.getSettings;
59426
- const snapshotStateRef = yield* make$63({
59667
+ const snapshotStateRef = yield* make$64({
59427
59668
  snapshot: yield* input.initialSnapshot(initialSettings),
59428
59669
  enrichmentGeneration: 0
59429
59670
  });
59430
- const settingsRef = yield* make$63(initialSettings);
59431
- const enrichmentFiberRef = yield* make$63(null);
59671
+ const settingsRef = yield* make$64(initialSettings);
59672
+ const enrichmentFiberRef = yield* make$64(null);
59432
59673
  const scope$1 = yield* scope;
59433
59674
  const publishEnrichedSnapshot = fn("publishEnrichedSnapshot")(function* (generation, nextSnapshot) {
59434
59675
  const snapshotToPublish = yield* modify$2(snapshotStateRef, (state) => {
@@ -59619,7 +59860,7 @@ const ClaudeDriver = {
59619
59860
  ...eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}
59620
59861
  });
59621
59862
  const textGeneration = yield* makeClaudeTextGeneration(effectiveConfig, processEnv);
59622
- const capabilitiesProbeCache = yield* make$81({
59863
+ const capabilitiesProbeCache = yield* make$82({
59623
59864
  capacity: 1,
59624
59865
  timeToLive: CAPABILITIES_PROBE_TTL,
59625
59866
  lookup: () => probeClaudeCapabilities(effectiveConfig, processEnv, cwd).pipe(provideService(Path, path))
@@ -59755,14 +59996,14 @@ const makeCodexTextGeneration = fn("makeCodexTextGeneration")(function* (codexCo
59755
59996
  ...imagePaths.flatMap((imagePath) => ["--image", imagePath]),
59756
59997
  "-"
59757
59998
  ], { env: resolvedEnvironment });
59758
- const command = make$79(spawnCommand.command, spawnCommand.args, {
59999
+ const command = make$80(spawnCommand.command, spawnCommand.args, {
59759
60000
  env: {
59760
60001
  ...resolvedEnvironment,
59761
60002
  ...codexConfig.homePath ? { CODEX_HOME: expandHomePath(codexConfig.homePath) } : {}
59762
60003
  },
59763
60004
  cwd,
59764
60005
  shell: spawnCommand.shell,
59765
- stdin: { stream: encodeText(make$74(prompt)) }
60006
+ stdin: { stream: encodeText(make$75(prompt)) }
59766
60007
  });
59767
60008
  const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to spawn Codex CLI process")));
59768
60009
  const [stdout, stderr, exitCode] = yield* all([
@@ -77715,10 +77956,10 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
77715
77956
  const outgoing = yield* unbounded$2();
77716
77957
  const incomingNotifications = yield* unbounded$2();
77717
77958
  const incomingRequests = yield* unbounded$2();
77718
- const pending = yield* make$63(/* @__PURE__ */ new Map());
77719
- const nextRequestId = yield* make$63(1);
77720
- const remainder = yield* make$63("");
77721
- const terminationHandled = yield* make$63(false);
77959
+ const pending = yield* make$64(/* @__PURE__ */ new Map());
77960
+ const nextRequestId = yield* make$64(1);
77961
+ const remainder = yield* make$64("");
77962
+ const terminationHandled = yield* make$64(false);
77722
77963
  const logProtocol = (event) => {
77723
77964
  if (event.direction === "incoming" && !options.logIncoming) return void_$1;
77724
77965
  if (event.direction === "outgoing" && !options.logOutgoing) return void_$1;
@@ -77817,7 +78058,7 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
77817
78058
  yield* fromQueue(outgoing).pipe(run$5(options.stdio.stdout()), forkScoped);
77818
78059
  const request = (method, payload) => gen(function* () {
77819
78060
  const requestId = yield* modify$2(nextRequestId, (current) => [current, current + 1]);
77820
- const deferred = yield* make$73();
78061
+ const deferred = yield* make$74();
77821
78062
  yield* update$2(pending, (current) => new Map(current).set(String(requestId), {
77822
78063
  deferred,
77823
78064
  method
@@ -77845,7 +78086,7 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
77845
78086
  //#endregion
77846
78087
  //#region ../effect-codex-app-server/src/_internal/stdio.ts
77847
78088
  const encoder$2 = new TextEncoder();
77848
- const makeChildStdio$1 = (handle) => make$80({
78089
+ const makeChildStdio$1 = (handle) => make$81({
77849
78090
  args: succeed$1([]),
77850
78091
  stdin: handle.stdout,
77851
78092
  stdout: () => mapInput(handle.stdin, (chunk) => typeof chunk === "string" ? encoder$2.encode(chunk) : chunk),
@@ -77856,7 +78097,7 @@ fn("makeInMemoryStdio")(function* () {
77856
78097
  const output = yield* unbounded$2();
77857
78098
  const decoder = new TextDecoder();
77858
78099
  return {
77859
- stdio: make$80({
78100
+ stdio: make$81({
77860
78101
  args: succeed$1([]),
77861
78102
  stdin: fromQueue(input),
77862
78103
  stdout: () => forEach$1((chunk) => offer$1(output, typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }))),
@@ -78143,7 +78384,7 @@ const probeCodexAppServerProvider = fn("probeCodexAppServerProvider")(function*
78143
78384
  env: environment,
78144
78385
  extendEnv: true
78145
78386
  });
78146
- const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
78387
+ const child = yield* spawner.spawn(make$80(spawnCommand.command, spawnCommand.args, {
78147
78388
  cwd: input.cwd,
78148
78389
  env: environment,
78149
78390
  extendEnv: true,
@@ -78832,8 +79073,14 @@ function updateSession(sessionRef, updates) {
78832
79073
  function parseThreadSnapshot(response) {
78833
79074
  return {
78834
79075
  threadId: response.thread.id,
79076
+ createdAt: response.thread.createdAt,
79077
+ updatedAt: response.thread.updatedAt,
79078
+ status: response.thread.status,
78835
79079
  turns: response.thread.turns.map((turn) => ({
78836
79080
  id: TurnId.make(turn.id),
79081
+ status: turn.status,
79082
+ ...turn.startedAt !== void 0 && turn.startedAt !== null ? { startedAt: turn.startedAt } : {},
79083
+ ...turn.completedAt !== void 0 && turn.completedAt !== null ? { completedAt: turn.completedAt } : {},
78837
79084
  items: turn.items
78838
79085
  }))
78839
79086
  };
@@ -78843,14 +79090,14 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
78843
79090
  const runtimeScope = yield* Scope;
78844
79091
  const crypto = yield* Crypto;
78845
79092
  const events = yield* unbounded$2();
78846
- const pendingApprovalsRef = yield* make$63(/* @__PURE__ */ new Map());
78847
- const approvalCorrelationsRef = yield* make$63(/* @__PURE__ */ new Map());
78848
- const pendingUserInputsRef = yield* make$63(/* @__PURE__ */ new Map());
78849
- const collabReceiverTurnsRef = yield* make$63(/* @__PURE__ */ new Map());
78850
- const collabChildAgentsRef = yield* make$63(/* @__PURE__ */ new Map());
79093
+ const pendingApprovalsRef = yield* make$64(/* @__PURE__ */ new Map());
79094
+ const approvalCorrelationsRef = yield* make$64(/* @__PURE__ */ new Map());
79095
+ const pendingUserInputsRef = yield* make$64(/* @__PURE__ */ new Map());
79096
+ const collabReceiverTurnsRef = yield* make$64(/* @__PURE__ */ new Map());
79097
+ const collabChildAgentsRef = yield* make$64(/* @__PURE__ */ new Map());
78851
79098
  /** Child provider-thread id → its currently running provider turn id. */
78852
- const collabChildLiveTurnsRef = yield* make$63(/* @__PURE__ */ new Map());
78853
- const closedRef = yield* make$63(false);
79099
+ const collabChildLiveTurnsRef = yield* make$64(/* @__PURE__ */ new Map());
79100
+ const closedRef = yield* make$64(false);
78854
79101
  const resolvedHomePath = options.homePath ? expandHomePath(options.homePath) : void 0;
78855
79102
  const env = {
78856
79103
  ...options.environment,
@@ -78862,7 +79109,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
78862
79109
  env,
78863
79110
  extendEnv
78864
79111
  });
78865
- const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
79112
+ const child = yield* spawner.spawn(make$80(spawnCommand.command, spawnCommand.args, {
78866
79113
  cwd: options.cwd,
78867
79114
  env,
78868
79115
  extendEnv,
@@ -78874,6 +79121,10 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
78874
79121
  })));
78875
79122
  const clientContext = yield* layerChildProcess$1(child).pipe(build, provideService(Scope, runtimeScope));
78876
79123
  const client = yield* service(CodexAppServerClient).pipe(provide$1(clientContext));
79124
+ const initializeClient = yield* cached(gen(function* () {
79125
+ yield* client.request("initialize", buildCodexInitializeParams());
79126
+ yield* client.notify("initialized", void 0);
79127
+ }));
78877
79128
  const serverNotifications = yield* unbounded$2();
78878
79129
  const nowIso = map$4(now$1, formatIso);
78879
79130
  const randomUUIDv4 = (purpose) => crypto.randomUUIDv4.pipe(mapError((cause) => new CodexAppServerIdentifierGenerationError({
@@ -78881,7 +79132,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
78881
79132
  cause
78882
79133
  })));
78883
79134
  const sessionCreatedAt = yield* nowIso;
78884
- const sessionRef = yield* make$63({
79135
+ const sessionRef = yield* make$64({
78885
79136
  provider: PROVIDER$1,
78886
79137
  ...options.providerInstanceId ? { providerInstanceId: options.providerInstanceId } : {},
78887
79138
  status: "connecting",
@@ -79209,7 +79460,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
79209
79460
  const requestId = ApprovalRequestId.make(yield* randomUUIDv4("command-approval-request"));
79210
79461
  const turnId = TurnId.make(payload.turnId);
79211
79462
  const itemId = ProviderItemId.make(payload.itemId);
79212
- const decision = yield* make$73();
79463
+ const decision = yield* make$74();
79213
79464
  yield* update$2(pendingApprovalsRef, (current) => {
79214
79465
  const next = new Map(current);
79215
79466
  next.set(requestId, {
@@ -79252,7 +79503,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
79252
79503
  const requestId = ApprovalRequestId.make(yield* randomUUIDv4("file-change-approval-request"));
79253
79504
  const turnId = TurnId.make(payload.turnId);
79254
79505
  const itemId = ProviderItemId.make(payload.itemId);
79255
- const decision = yield* make$73();
79506
+ const decision = yield* make$74();
79256
79507
  yield* update$2(pendingApprovalsRef, (current) => {
79257
79508
  const next = new Map(current);
79258
79509
  next.set(requestId, {
@@ -79295,7 +79546,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
79295
79546
  const requestId = ApprovalRequestId.make(yield* randomUUIDv4("user-input-request"));
79296
79547
  const turnId = TurnId.make(payload.turnId);
79297
79548
  const itemId = ProviderItemId.make(payload.itemId);
79298
- const answers = yield* make$73();
79549
+ const answers = yield* make$74();
79299
79550
  yield* update$2(pendingUserInputsRef, (current) => {
79300
79551
  const next = new Map(current);
79301
79552
  next.set(requestId, {
@@ -79328,7 +79579,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
79328
79579
  discard: true
79329
79580
  });
79330
79581
  yield* fromQueue(serverNotifications).pipe(runForEach(handleRawNotification), forkIn(runtimeScope));
79331
- const stderrRemainderRef = yield* make$63("");
79582
+ const stderrRemainderRef = yield* make$64("");
79332
79583
  yield* child.stderr.pipe(decodeText(), runForEach((chunk) => modify$2(stderrRemainderRef, (current) => {
79333
79584
  const lines = (current + chunk).split("\n");
79334
79585
  const remainder = lines.pop() ?? "";
@@ -79352,8 +79603,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
79352
79603
  }))), forkIn(runtimeScope));
79353
79604
  const start = fn("CodexSessionRuntime.start")(function* () {
79354
79605
  yield* emitSessionEvent("session/connecting", "Starting Codex App Server session.");
79355
- yield* client.request("initialize", buildCodexInitializeParams());
79356
- yield* client.notify("initialized", void 0);
79606
+ yield* initializeClient;
79357
79607
  const requestedModel = normalizeCodexModelSlug(options.model);
79358
79608
  const opened = yield* openCodexThread({
79359
79609
  client,
@@ -79447,6 +79697,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
79447
79697
  }),
79448
79698
  readThread: gen(function* () {
79449
79699
  const providerThreadId = yield* readProviderThreadId;
79700
+ yield* initializeClient;
79450
79701
  return parseThreadSnapshot(yield* client.request("thread/read", {
79451
79702
  threadId: providerThreadId,
79452
79703
  includeTurns: true
@@ -79748,6 +79999,7 @@ function runtimeEventBase(event, canonicalThreadId) {
79748
79999
  return {
79749
80000
  eventId: event.id,
79750
80001
  provider: event.provider,
80002
+ ...event.providerInstanceId !== void 0 ? { providerInstanceId: event.providerInstanceId } : {},
79751
80003
  threadId: canonicalThreadId,
79752
80004
  createdAt: event.createdAt,
79753
80005
  ...event.turnId ? { turnId: event.turnId } : {},
@@ -80473,6 +80725,90 @@ function mapToRuntimeEvents(event, canonicalThreadId) {
80473
80725
  }
80474
80726
  return [];
80475
80727
  }
80728
+ function unixSecondsToIso(value, fallback) {
80729
+ return (/* @__PURE__ */ new Date((value ?? fallback) * 1e3)).toISOString();
80730
+ }
80731
+ function summarizeCodexUserInput(input) {
80732
+ switch (input.type) {
80733
+ case "text": return input.text;
80734
+ case "image":
80735
+ case "localImage": return "[Image input omitted]";
80736
+ case "audio":
80737
+ case "localAudio": return "[Audio input omitted]";
80738
+ case "skill": return `[Skill: ${input.name}]`;
80739
+ case "mention": return `[Mention: ${input.name}]`;
80740
+ }
80741
+ }
80742
+ /** Converts a native `thread/read` snapshot through the same item mapper as live events. */
80743
+ function mapCodexThreadSnapshot(canonicalThreadId, providerInstanceId, snapshot) {
80744
+ const makeEvent = (input) => {
80745
+ const itemId = input.item ? ProviderItemId.make(input.item.id) : void 0;
80746
+ const suffix = itemId ? `item:${itemId}:completed` : input.method.replace("/", ":");
80747
+ const createdAt = unixSecondsToIso(input.method === "turn/started" ? input.turn.startedAt : input.turn.completedAt, input.method === "turn/started" ? snapshot.createdAt : snapshot.updatedAt);
80748
+ const payload = input.method === "item/completed" && input.item ? {
80749
+ completedAtMs: Date.parse(createdAt),
80750
+ threadId: snapshot.threadId,
80751
+ turnId: input.turn.id,
80752
+ item: input.item
80753
+ } : {
80754
+ threadId: snapshot.threadId,
80755
+ turn: input.turn
80756
+ };
80757
+ return {
80758
+ id: EventId.make(`codex-snapshot:${snapshot.threadId}:turn:${input.turn.id}:${suffix}`),
80759
+ kind: "notification",
80760
+ provider: PROVIDER,
80761
+ providerInstanceId,
80762
+ threadId: canonicalThreadId,
80763
+ createdAt,
80764
+ method: input.method,
80765
+ turnId: input.turn.id,
80766
+ ...itemId ? { itemId } : {},
80767
+ payload
80768
+ };
80769
+ };
80770
+ return {
80771
+ threadId: canonicalThreadId,
80772
+ providerThreadId: snapshot.threadId,
80773
+ status: snapshot.status.type,
80774
+ activeFlags: snapshot.status.type === "active" ? snapshot.status.activeFlags : [],
80775
+ turns: snapshot.turns.map((turn) => {
80776
+ const terminal = turn.status !== "inProgress";
80777
+ const nativeEvents = [
80778
+ makeEvent({
80779
+ method: "turn/started",
80780
+ turn
80781
+ }),
80782
+ ...terminal ? turn.items.map((item) => makeEvent({
80783
+ method: "item/completed",
80784
+ turn,
80785
+ item
80786
+ })) : [],
80787
+ ...terminal ? [makeEvent({
80788
+ method: "turn/completed",
80789
+ turn
80790
+ })] : []
80791
+ ];
80792
+ const userMessages = turn.items.flatMap((item) => {
80793
+ if (item.type !== "userMessage") return [];
80794
+ const text = item.content.map(summarizeCodexUserInput).filter((part) => part.trim().length > 0).join("\n");
80795
+ return [{
80796
+ id: ProviderItemId.make(item.id),
80797
+ text: text.length > 0 ? text : "[Empty user message]"
80798
+ }];
80799
+ });
80800
+ return {
80801
+ id: turn.id,
80802
+ status: turn.status,
80803
+ ...turn.startedAt !== void 0 ? { startedAt: unixSecondsToIso(turn.startedAt, snapshot.createdAt) } : {},
80804
+ ...turn.completedAt !== void 0 ? { completedAt: unixSecondsToIso(turn.completedAt, snapshot.updatedAt) } : {},
80805
+ items: turn.items,
80806
+ userMessages,
80807
+ runtimeEvents: nativeEvents.flatMap((event) => mapToRuntimeEvents(event, canonicalThreadId))
80808
+ };
80809
+ })
80810
+ };
80811
+ }
80476
80812
  /**
80477
80813
  * Build a Codex provider adapter bound to a specific `CodexSettings` payload.
80478
80814
  *
@@ -80492,16 +80828,10 @@ const makeCodexAdapter = fn("makeCodexAdapter")(function* (codexConfig, options)
80492
80828
  const managedNativeEventLogger = options?.nativeEventLogger === void 0 ? nativeEventLogger : void 0;
80493
80829
  const runtimeEventQueue = yield* unbounded$2();
80494
80830
  const sessions = /* @__PURE__ */ new Map();
80495
- const startSession = (input) => scoped(gen(function* () {
80496
- if (input.provider !== void 0 && input.provider !== PROVIDER) return yield* new ProviderAdapterValidationError({
80497
- provider: PROVIDER,
80498
- operation: "startSession",
80499
- issue: `Expected provider '${PROVIDER}' but received '${input.provider}'.`
80500
- });
80501
- const existing = sessions.get(input.threadId);
80502
- if (existing && !existing.stopped) yield* suspend(() => stopSessionInternal(existing));
80831
+ const createRuntime = options?.makeRuntime ?? makeCodexSessionRuntime;
80832
+ const toRuntimeInput = (input) => {
80503
80833
  const serviceTier = input.modelSelection?.instanceId === boundInstanceId ? getCodexServiceTierOptionValue(input.modelSelection) : void 0;
80504
- const runtimeInput = {
80834
+ return {
80505
80835
  threadId: input.threadId,
80506
80836
  providerInstanceId: boundInstanceId,
80507
80837
  cwd: input.cwd ?? process.cwd(),
@@ -80514,10 +80844,20 @@ const makeCodexAdapter = fn("makeCodexAdapter")(function* (codexConfig, options)
80514
80844
  ...input.modelSelection?.instanceId === boundInstanceId ? { model: input.modelSelection.model } : {},
80515
80845
  ...serviceTier ? { serviceTier } : {}
80516
80846
  };
80517
- const sessionScope = yield* make$76("sequential");
80847
+ };
80848
+ const startSession = (input) => scoped(gen(function* () {
80849
+ if (input.provider !== void 0 && input.provider !== PROVIDER) return yield* new ProviderAdapterValidationError({
80850
+ provider: PROVIDER,
80851
+ operation: "startSession",
80852
+ issue: `Expected provider '${PROVIDER}' but received '${input.provider}'.`
80853
+ });
80854
+ const existing = sessions.get(input.threadId);
80855
+ if (existing && !existing.stopped) yield* suspend(() => stopSessionInternal(existing));
80856
+ const runtimeInput = toRuntimeInput(input);
80857
+ const sessionScope = yield* make$77("sequential");
80518
80858
  let sessionScopeTransferred = false;
80519
80859
  yield* addFinalizer(() => sessionScopeTransferred ? void_$1 : close(sessionScope, void_$2));
80520
- const runtime = yield* (options?.makeRuntime ?? makeCodexSessionRuntime)(runtimeInput).pipe(provideService(Scope, sessionScope), provideService(ChildProcessSpawner, childProcessSpawner), provideService(Crypto, crypto), mapError((cause) => new ProviderAdapterProcessError({
80860
+ const runtime = yield* createRuntime(runtimeInput).pipe(provideService(Scope, sessionScope), provideService(ChildProcessSpawner, childProcessSpawner), provideService(Crypto, crypto), mapError((cause) => new ProviderAdapterProcessError({
80521
80861
  provider: PROVIDER,
80522
80862
  threadId: input.threadId,
80523
80863
  detail: cause.message,
@@ -80536,7 +80876,7 @@ const makeCodexAdapter = fn("makeCodexAdapter")(function* (codexConfig, options)
80536
80876
  return;
80537
80877
  }
80538
80878
  yield* offerAll(runtimeEventQueue, runtimeEvents);
80539
- })).pipe(forkChild);
80879
+ })).pipe(forkIn(sessionScope));
80540
80880
  const started = yield* runtime.start().pipe(mapError((cause) => new ProviderAdapterProcessError({
80541
80881
  provider: PROVIDER,
80542
80882
  threadId: input.threadId,
@@ -80597,20 +80937,24 @@ const makeCodexAdapter = fn("makeCodexAdapter")(function* (codexConfig, options)
80597
80937
  return session;
80598
80938
  });
80599
80939
  const interruptTurn = (threadId, turnId) => requireSession(threadId).pipe(flatMap$1((session) => session.runtime.interruptTurn(turnId)), mapError((cause) => cause._tag === "ProviderAdapterSessionNotFoundError" ? cause : mapCodexRuntimeError(threadId, "turn/interrupt", cause)));
80600
- const readThread = (threadId) => requireSession(threadId).pipe(flatMap$1((session) => session.runtime.readThread), mapError((cause) => cause._tag === "ProviderAdapterSessionNotFoundError" ? cause : mapCodexRuntimeError(threadId, "thread/read", cause)), map$4((snapshot) => ({
80601
- threadId,
80602
- turns: snapshot.turns
80603
- })));
80940
+ const readThread = (input) => {
80941
+ const active = sessions.get(input.threadId);
80942
+ return (active && !active.stopped ? active.runtime.readThread.pipe(mapError((cause) => mapCodexRuntimeError(input.threadId, "thread/read", cause))) : scoped(gen(function* () {
80943
+ return yield* (yield* createRuntime(toRuntimeInput(input)).pipe(provideService(ChildProcessSpawner, childProcessSpawner), provideService(Crypto, crypto), mapError((cause) => new ProviderAdapterProcessError({
80944
+ provider: PROVIDER,
80945
+ threadId: input.threadId,
80946
+ detail: cause.message,
80947
+ cause
80948
+ })))).readThread.pipe(mapError((cause) => mapCodexRuntimeError(input.threadId, "thread/read", cause)));
80949
+ }))).pipe(map$4((snapshot) => mapCodexThreadSnapshot(input.threadId, boundInstanceId, snapshot)));
80950
+ };
80604
80951
  const rollbackThread = (threadId, numTurns) => {
80605
80952
  if (!Number.isInteger(numTurns) || numTurns < 1) return fail(new ProviderAdapterValidationError({
80606
80953
  provider: PROVIDER,
80607
80954
  operation: "rollbackThread",
80608
80955
  issue: "numTurns must be an integer >= 1."
80609
80956
  }));
80610
- return requireSession(threadId).pipe(flatMap$1((session) => session.runtime.rollbackThread(numTurns)), mapError((cause) => cause._tag === "ProviderAdapterSessionNotFoundError" ? cause : mapCodexRuntimeError(threadId, "thread/rollback", cause)), map$4((snapshot) => ({
80611
- threadId,
80612
- turns: snapshot.turns
80613
- })));
80957
+ return requireSession(threadId).pipe(flatMap$1((session) => session.runtime.rollbackThread(numTurns)), mapError((cause) => cause._tag === "ProviderAdapterSessionNotFoundError" ? cause : mapCodexRuntimeError(threadId, "thread/rollback", cause)), map$4((snapshot) => mapCodexThreadSnapshot(threadId, boundInstanceId, snapshot)));
80614
80958
  };
80615
80959
  const respondToRequest = (threadId, requestId, decision) => requireSession(threadId).pipe(flatMap$1((session) => session.runtime.respondToRequest(requestId, decision)), mapError((cause) => cause._tag === "ProviderAdapterSessionNotFoundError" ? cause : mapCodexRuntimeError(threadId, "item/requestApproval/decision", cause)));
80616
80960
  const respondToUserInput = (threadId, requestId, answers) => requireSession(threadId).pipe(flatMap$1((session) => session.runtime.respondToUserInput(requestId, answers)), mapError((cause) => cause._tag === "ProviderAdapterSessionNotFoundError" ? cause : mapCodexRuntimeError(threadId, "item/tool/requestUserInput", cause)));
@@ -84284,9 +84628,9 @@ const makeAcpPatchedProtocol = fn("makeAcpPatchedProtocol")(function* (options)
84284
84628
  const notificationQueue = yield* unbounded$2();
84285
84629
  const disconnects = yield* unbounded$2();
84286
84630
  const outgoing = yield* unbounded$2();
84287
- const nextRequestId = yield* make$63(1);
84288
- const terminationHandled = yield* make$63(false);
84289
- const extPending = yield* make$63(/* @__PURE__ */ new Map());
84631
+ const nextRequestId = yield* make$64(1);
84632
+ const terminationHandled = yield* make$64(false);
84633
+ const extPending = yield* make$64(/* @__PURE__ */ new Map());
84290
84634
  const logProtocol = (event) => {
84291
84635
  if (event.direction === "incoming" && !options.logIncoming) return void_$1;
84292
84636
  if (event.direction === "outgoing" && !options.logOutgoing) return void_$1;
@@ -84504,7 +84848,7 @@ const makeAcpPatchedProtocol = fn("makeAcpPatchedProtocol")(function* (options)
84504
84848
  },
84505
84849
  request: fn("sendRequest")(function* (method, payload) {
84506
84850
  const requestId = yield* modify$2(nextRequestId, (current) => [current, current + 1]);
84507
- const deferred = yield* make$73();
84851
+ const deferred = yield* make$74();
84508
84852
  yield* update$2(extPending, (pending) => new Map(pending).set(String(requestId), {
84509
84853
  deferred,
84510
84854
  method
@@ -84526,113 +84870,113 @@ function isProtocolError(value) {
84526
84870
  }
84527
84871
  //#endregion
84528
84872
  //#region ../effect-acp/src/rpc.ts
84529
- const InitializeRpc = make$51(AGENT_METHODS.initialize, {
84873
+ const InitializeRpc = make$52(AGENT_METHODS.initialize, {
84530
84874
  payload: InitializeRequest,
84531
84875
  success: InitializeResponse,
84532
84876
  error: Error$1
84533
84877
  });
84534
- const AuthenticateRpc = make$51(AGENT_METHODS.authenticate, {
84878
+ const AuthenticateRpc = make$52(AGENT_METHODS.authenticate, {
84535
84879
  payload: AuthenticateRequest,
84536
84880
  success: AuthenticateResponse,
84537
84881
  error: Error$1
84538
84882
  });
84539
- const LogoutRpc = make$51(AGENT_METHODS.logout, {
84883
+ const LogoutRpc = make$52(AGENT_METHODS.logout, {
84540
84884
  payload: LogoutRequest,
84541
84885
  success: LogoutResponse,
84542
84886
  error: Error$1
84543
84887
  });
84544
- const NewSessionRpc = make$51(AGENT_METHODS.session_new, {
84888
+ const NewSessionRpc = make$52(AGENT_METHODS.session_new, {
84545
84889
  payload: NewSessionRequest,
84546
84890
  success: NewSessionResponse,
84547
84891
  error: Error$1
84548
84892
  });
84549
- const LoadSessionRpc = make$51(AGENT_METHODS.session_load, {
84893
+ const LoadSessionRpc = make$52(AGENT_METHODS.session_load, {
84550
84894
  payload: LoadSessionRequest,
84551
84895
  success: LoadSessionResponse,
84552
84896
  error: Error$1
84553
84897
  });
84554
- const ListSessionsRpc = make$51(AGENT_METHODS.session_list, {
84898
+ const ListSessionsRpc = make$52(AGENT_METHODS.session_list, {
84555
84899
  payload: ListSessionsRequest,
84556
84900
  success: ListSessionsResponse,
84557
84901
  error: Error$1
84558
84902
  });
84559
- const ForkSessionRpc = make$51(AGENT_METHODS.session_fork, {
84903
+ const ForkSessionRpc = make$52(AGENT_METHODS.session_fork, {
84560
84904
  payload: ForkSessionRequest,
84561
84905
  success: ForkSessionResponse,
84562
84906
  error: Error$1
84563
84907
  });
84564
- const ResumeSessionRpc = make$51(AGENT_METHODS.session_resume, {
84908
+ const ResumeSessionRpc = make$52(AGENT_METHODS.session_resume, {
84565
84909
  payload: ResumeSessionRequest,
84566
84910
  success: ResumeSessionResponse,
84567
84911
  error: Error$1
84568
84912
  });
84569
- const CloseSessionRpc = make$51(AGENT_METHODS.session_close, {
84913
+ const CloseSessionRpc = make$52(AGENT_METHODS.session_close, {
84570
84914
  payload: CloseSessionRequest,
84571
84915
  success: CloseSessionResponse,
84572
84916
  error: Error$1
84573
84917
  });
84574
- const PromptRpc = make$51(AGENT_METHODS.session_prompt, {
84918
+ const PromptRpc = make$52(AGENT_METHODS.session_prompt, {
84575
84919
  payload: PromptRequest,
84576
84920
  success: PromptResponse,
84577
84921
  error: Error$1
84578
84922
  });
84579
- const SetSessionModelRpc = make$51(AGENT_METHODS.session_set_model, {
84923
+ const SetSessionModelRpc = make$52(AGENT_METHODS.session_set_model, {
84580
84924
  payload: SetSessionModelRequest,
84581
84925
  success: SetSessionModelResponse,
84582
84926
  error: Error$1
84583
84927
  });
84584
- const SetSessionConfigOptionRpc = make$51(AGENT_METHODS.session_set_config_option, {
84928
+ const SetSessionConfigOptionRpc = make$52(AGENT_METHODS.session_set_config_option, {
84585
84929
  payload: SetSessionConfigOptionRequest,
84586
84930
  success: SetSessionConfigOptionResponse,
84587
84931
  error: Error$1
84588
84932
  });
84589
- const ReadTextFileRpc = make$51(CLIENT_METHODS.fs_read_text_file, {
84933
+ const ReadTextFileRpc = make$52(CLIENT_METHODS.fs_read_text_file, {
84590
84934
  payload: ReadTextFileRequest,
84591
84935
  success: ReadTextFileResponse,
84592
84936
  error: Error$1
84593
84937
  });
84594
- const WriteTextFileRpc = make$51(CLIENT_METHODS.fs_write_text_file, {
84938
+ const WriteTextFileRpc = make$52(CLIENT_METHODS.fs_write_text_file, {
84595
84939
  payload: WriteTextFileRequest,
84596
84940
  success: WriteTextFileResponse,
84597
84941
  error: Error$1
84598
84942
  });
84599
- const RequestPermissionRpc = make$51(CLIENT_METHODS.session_request_permission, {
84943
+ const RequestPermissionRpc = make$52(CLIENT_METHODS.session_request_permission, {
84600
84944
  payload: RequestPermissionRequest,
84601
84945
  success: RequestPermissionResponse,
84602
84946
  error: Error$1
84603
84947
  });
84604
- const ElicitationRpc = make$51(CLIENT_METHODS.session_elicitation, {
84948
+ const ElicitationRpc = make$52(CLIENT_METHODS.session_elicitation, {
84605
84949
  payload: ElicitationRequest,
84606
84950
  success: ElicitationResponse,
84607
84951
  error: Error$1
84608
84952
  });
84609
- const CreateTerminalRpc = make$51(CLIENT_METHODS.terminal_create, {
84953
+ const CreateTerminalRpc = make$52(CLIENT_METHODS.terminal_create, {
84610
84954
  payload: CreateTerminalRequest,
84611
84955
  success: CreateTerminalResponse,
84612
84956
  error: Error$1
84613
84957
  });
84614
- const TerminalOutputRpc = make$51(CLIENT_METHODS.terminal_output, {
84958
+ const TerminalOutputRpc = make$52(CLIENT_METHODS.terminal_output, {
84615
84959
  payload: TerminalOutputRequest,
84616
84960
  success: TerminalOutputResponse,
84617
84961
  error: Error$1
84618
84962
  });
84619
- const ReleaseTerminalRpc = make$51(CLIENT_METHODS.terminal_release, {
84963
+ const ReleaseTerminalRpc = make$52(CLIENT_METHODS.terminal_release, {
84620
84964
  payload: ReleaseTerminalRequest,
84621
84965
  success: ReleaseTerminalResponse,
84622
84966
  error: Error$1
84623
84967
  });
84624
- const WaitForTerminalExitRpc = make$51(CLIENT_METHODS.terminal_wait_for_exit, {
84968
+ const WaitForTerminalExitRpc = make$52(CLIENT_METHODS.terminal_wait_for_exit, {
84625
84969
  payload: WaitForTerminalExitRequest,
84626
84970
  success: WaitForTerminalExitResponse,
84627
84971
  error: Error$1
84628
84972
  });
84629
- const KillTerminalRpc = make$51(CLIENT_METHODS.terminal_kill, {
84973
+ const KillTerminalRpc = make$52(CLIENT_METHODS.terminal_kill, {
84630
84974
  payload: KillTerminalRequest,
84631
84975
  success: KillTerminalResponse,
84632
84976
  error: Error$1
84633
84977
  });
84634
- const AgentRpcs = make$50(InitializeRpc, AuthenticateRpc, LogoutRpc, NewSessionRpc, LoadSessionRpc, ListSessionsRpc, ForkSessionRpc, ResumeSessionRpc, CloseSessionRpc, PromptRpc, SetSessionModelRpc, SetSessionConfigOptionRpc);
84635
- const ClientRpcs = make$50(ReadTextFileRpc, WriteTextFileRpc, RequestPermissionRpc, ElicitationRpc, CreateTerminalRpc, TerminalOutputRpc, ReleaseTerminalRpc, WaitForTerminalExitRpc, KillTerminalRpc);
84978
+ const AgentRpcs = make$51(InitializeRpc, AuthenticateRpc, LogoutRpc, NewSessionRpc, LoadSessionRpc, ListSessionsRpc, ForkSessionRpc, ResumeSessionRpc, CloseSessionRpc, PromptRpc, SetSessionModelRpc, SetSessionConfigOptionRpc);
84979
+ const ClientRpcs = make$51(ReadTextFileRpc, WriteTextFileRpc, RequestPermissionRpc, ElicitationRpc, CreateTerminalRpc, TerminalOutputRpc, ReleaseTerminalRpc, WaitForTerminalExitRpc, KillTerminalRpc);
84636
84980
  //#endregion
84637
84981
  //#region ../effect-acp/src/_internal/shared.ts
84638
84982
  const isError = is(Error$1);
@@ -84657,7 +85001,7 @@ ArraySchema(Unknown);
84657
85001
  //#endregion
84658
85002
  //#region ../effect-acp/src/_internal/stdio.ts
84659
85003
  const encoder = new TextEncoder();
84660
- const makeChildStdio = (handle) => make$80({
85004
+ const makeChildStdio = (handle) => make$81({
84661
85005
  args: succeed$1([]),
84662
85006
  stdin: handle.stdout,
84663
85007
  stdout: () => mapInput(handle.stdin, (chunk) => typeof chunk === "string" ? encoder.encode(chunk) : chunk),
@@ -84668,7 +85012,7 @@ fn("makeInMemoryStdio")(function* () {
84668
85012
  const output = yield* unbounded$2();
84669
85013
  const decoder = new TextDecoder();
84670
85014
  return {
84671
- stdio: make$80({
85015
+ stdio: make$81({
84672
85016
  args: succeed$1([]),
84673
85017
  stdin: fromQueue(input),
84674
85018
  stdout: () => forEach$1((chunk) => offer$1(output, typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }))),
@@ -84760,9 +85104,9 @@ const make$5 = fn("effect-acp/AcpClient.make")(function* (stdio, options = {}, t
84760
85104
  [CLIENT_METHODS.terminal_kill]: (payload) => runHandler(coreHandlers.terminalKill, payload, CLIENT_METHODS.terminal_kill).pipe(map$4((result) => result ?? {})),
84761
85105
  [CLIENT_METHODS.terminal_release]: (payload) => runHandler(coreHandlers.terminalRelease, payload, CLIENT_METHODS.terminal_release).pipe(map$4((result) => result ?? {}))
84762
85106
  }));
84763
- yield* make$16(ClientRpcs).pipe(provideService(Protocol, transport.serverProtocol), provide$1(clientHandlerLayer), forkScoped);
85107
+ yield* make$17(ClientRpcs).pipe(provideService(Protocol, transport.serverProtocol), provide$1(clientHandlerLayer), forkScoped);
84764
85108
  let nextRpcRequestId = 2 ** 32;
84765
- const rpc = yield* make$17(AgentRpcs, { generateRequestId: () => RequestId$2(nextRpcRequestId++) }).pipe(provideService(Protocol$1, transport.clientProtocol));
85109
+ const rpc = yield* make$18(AgentRpcs, { generateRequestId: () => RequestId$2(nextRpcRequestId++) }).pipe(provideService(Protocol$1, transport.clientProtocol));
84766
85110
  return AcpClient.of({
84767
85111
  raw: {
84768
85112
  notifications: transport.incoming,
@@ -84917,7 +85261,7 @@ const registerLocalToolHandlers = (input) => gen(function* () {
84917
85261
  env,
84918
85262
  extendEnv: true
84919
85263
  } : {});
84920
- const handle = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
85264
+ const handle = yield* spawner.spawn(make$80(spawnCommand.command, spawnCommand.args, {
84921
85265
  cwd: request.cwd ?? input.cwd,
84922
85266
  ...hasEnv ? {
84923
85267
  env,
@@ -84925,7 +85269,7 @@ const registerLocalToolHandlers = (input) => gen(function* () {
84925
85269
  } : {},
84926
85270
  shell: spawnCommand.shell
84927
85271
  })).pipe(provideService(Scope, scope), mapError(() => internalError(`Failed to spawn ACP terminal command: ${request.command}`)));
84928
- const exited = yield* make$73();
85272
+ const exited = yield* make$74();
84929
85273
  const state = {
84930
85274
  handle,
84931
85275
  exited,
@@ -85457,18 +85801,18 @@ const make$4 = (options) => gen(function* () {
85457
85801
  const spawner = yield* ChildProcessSpawner;
85458
85802
  const runtimeScope = yield* Scope;
85459
85803
  const eventQueue = yield* unbounded$2();
85460
- const modeStateRef = yield* make$63(void 0);
85461
- const toolCallsRef = yield* make$63(/* @__PURE__ */ new Map());
85804
+ const modeStateRef = yield* make$64(void 0);
85805
+ const toolCallsRef = yield* make$64(/* @__PURE__ */ new Map());
85462
85806
  const assistantItemRuntimeId = yield* crypto.randomUUIDv4.pipe(mapError((cause) => new AcpTransportError({
85463
85807
  detail: "Failed to generate an ACP assistant item runtime identifier.",
85464
85808
  cause
85465
85809
  })));
85466
- const assistantSegmentRef = yield* make$63({ nextSegmentIndex: 0 });
85467
- const configOptionsRef = yield* make$63(sessionConfigOptionsFromSetup(void 0));
85468
- const startStateRef = yield* make$63({ _tag: "NotStarted" });
85469
- const promptSerializationSemaphore = yield* make$75(1);
85470
- const activePromptFiberRef = yield* make$63(none());
85471
- const sessionLoadGateRef = yield* make$63(none());
85810
+ const assistantSegmentRef = yield* make$64({ nextSegmentIndex: 0 });
85811
+ const configOptionsRef = yield* make$64(sessionConfigOptionsFromSetup(void 0));
85812
+ const startStateRef = yield* make$64({ _tag: "NotStarted" });
85813
+ const promptSerializationSemaphore = yield* make$76(1);
85814
+ const activePromptFiberRef = yield* make$64(none());
85815
+ const sessionLoadGateRef = yield* make$64(none());
85472
85816
  const logRequest = (event) => options.requestLogger ? options.requestLogger(event) : void_$1;
85473
85817
  const runLoggedRequest = (method, payload, effect) => logRequest({
85474
85818
  method,
@@ -85489,7 +85833,7 @@ const make$4 = (options) => gen(function* () {
85489
85833
  env: options.spawn.env,
85490
85834
  extendEnv: true
85491
85835
  } : {});
85492
- const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
85836
+ const child = yield* spawner.spawn(make$80(spawnCommand.command, spawnCommand.args, {
85493
85837
  ...options.spawn.cwd ? { cwd: options.spawn.cwd } : {},
85494
85838
  ...options.spawn.env ? {
85495
85839
  env: options.spawn.env,
@@ -85682,7 +86026,7 @@ const make$4 = (options) => gen(function* () {
85682
86026
  };
85683
86027
  });
85684
86028
  const start = gen(function* () {
85685
- const deferred = yield* make$73();
86029
+ const deferred = yield* make$74();
85686
86030
  return yield* yield* modify$2(startStateRef, (state) => {
85687
86031
  switch (state._tag) {
85688
86032
  case "Started": return [succeed$1(state.result), state];
@@ -85716,7 +86060,7 @@ const make$4 = (options) => gen(function* () {
85716
86060
  start: () => start,
85717
86061
  getEvents: () => fromQueue(eventQueue),
85718
86062
  drainEvents: gen(function* () {
85719
- const acknowledge = yield* make$73();
86063
+ const acknowledge = yield* make$74();
85720
86064
  yield* offer$1(eventQueue, {
85721
86065
  _tag: "EventStreamBarrier",
85722
86066
  acknowledge
@@ -85955,7 +86299,7 @@ const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.
85955
86299
  const path = yield* Path;
85956
86300
  const runAcpAgentJson = ({ operation, cwd, prompt, outputSchemaJson, modelSelection }) => gen(function* () {
85957
86301
  const resolvedModel = resolveAcpAgentModelId(descriptor, modelSelection.model);
85958
- const outputRef = yield* make$63("");
86302
+ const outputRef = yield* make$64("");
85959
86303
  const runtime = yield* makeAcpAgentRuntime(descriptor, {
85960
86304
  settings,
85961
86305
  environment,
@@ -86410,7 +86754,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
86410
86754
  const managedNativeEventLogger = options?.nativeEventLogger === void 0 ? nativeEventLogger : void 0;
86411
86755
  const makeAcpNativeLoggers = yield* makeAcpNativeLoggerFactory();
86412
86756
  const sessions = /* @__PURE__ */ new Map();
86413
- const threadLocksRef = yield* make$53(/* @__PURE__ */ new Map());
86757
+ const threadLocksRef = yield* make$54(/* @__PURE__ */ new Map());
86414
86758
  const runtimeEventPubSub = yield* unbounded$1();
86415
86759
  const nowIso = map$4(now$1, formatIso);
86416
86760
  const randomUUIDv4 = crypto.randomUUIDv4.pipe(mapError((cause) => new ProviderAdapterRequestError({
@@ -86431,7 +86775,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
86431
86775
  const offerRuntimeEvent = (event) => publish(runtimeEventPubSub, event).pipe(asVoid);
86432
86776
  const getThreadSemaphore = (threadId) => modifyEffect(threadLocksRef, (current) => {
86433
86777
  return match$1(fromNullishOr(current.get(threadId)), {
86434
- onNone: () => make$75(1).pipe(map$4((semaphore) => {
86778
+ onNone: () => make$76(1).pipe(map$4((semaphore) => {
86435
86779
  const next = new Map(current);
86436
86780
  next.set(threadId, semaphore);
86437
86781
  return [semaphore, next];
@@ -86614,7 +86958,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
86614
86958
  const existing = sessions.get(input.threadId);
86615
86959
  if (existing && !existing.stopped) yield* stopSessionInternal(existing);
86616
86960
  const pendingApprovals = /* @__PURE__ */ new Map();
86617
- const sessionScope = yield* make$76("sequential");
86961
+ const sessionScope = yield* make$77("sequential");
86618
86962
  let sessionScopeTransferred = false;
86619
86963
  yield* addFinalizer(() => sessionScopeTransferred ? void_$1 : close(sessionScope, void_$2));
86620
86964
  const resumeSessionId = resolveResumeSessionId(descriptor, input.resumeCursor);
@@ -86653,7 +86997,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
86653
86997
  const permissionRequest = parsePermissionRequest(params);
86654
86998
  const requestId = ApprovalRequestId.make(yield* randomUUIDv4);
86655
86999
  const runtimeRequestId = RuntimeRequestId.make(requestId);
86656
- const decision = yield* make$73();
87000
+ const decision = yield* make$74();
86657
87001
  const turnId = resolveSessionCallbackTurnId(sessions, input.threadId);
86658
87002
  pendingApprovals.set(requestId, { decision });
86659
87003
  yield* offerRuntimeEvent(makeAcpRequestOpenedEvent({
@@ -86910,10 +87254,10 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
86910
87254
  });
86911
87255
  })));
86912
87256
  }));
86913
- const promptSettled = yield* make$63(false);
86914
- const promptRpcSucceeded = yield* make$63(false);
86915
- const promptResultRef = yield* make$63(void 0);
86916
- const promptFailureMessageRef = yield* make$63(void 0);
87257
+ const promptSettled = yield* make$64(false);
87258
+ const promptRpcSucceeded = yield* make$64(false);
87259
+ const promptResultRef = yield* make$64(void 0);
87260
+ const promptFailureMessageRef = yield* make$64(void 0);
86917
87261
  return yield* gen(function* () {
86918
87262
  const result = yield* prepared.acp.prompt({ prompt: prepared.promptParts }).pipe(tap((promptResult) => all([set$2(promptRpcSucceeded, true), set$2(promptResultRef, promptResult)])), tapError((error) => set$2(promptFailureMessageRef, mapAcpToAdapterError(PROVIDER, input.threadId, "session/prompt", error).message).pipe(andThen(prepared.acp.drainEvents))), mapError((error) => mapAcpToAdapterError(PROVIDER, input.threadId, "session/prompt", error)));
86919
87263
  return yield* withThreadLock(input.threadId, gen(function* () {
@@ -87085,10 +87429,11 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
87085
87429
  detail: `${descriptor.displayName} ACP sessions do not emit structured user-input requests (request ${requestId}).`
87086
87430
  });
87087
87431
  });
87088
- const readThread = (threadId) => gen(function* () {
87432
+ const readThread = (input) => gen(function* () {
87433
+ const ctx = yield* requireSession(input.threadId);
87089
87434
  return {
87090
- threadId,
87091
- turns: (yield* requireSession(threadId)).turns
87435
+ threadId: input.threadId,
87436
+ turns: ctx.turns
87092
87437
  };
87093
87438
  });
87094
87439
  const rollbackThread = (threadId, numTurns) => gen(function* () {
@@ -87213,7 +87558,7 @@ const discoverModelsViaAcp = (descriptor, settings, environment = process.env) =
87213
87558
  const runVersionCommand = (descriptor, settings, environment = process.env) => gen(function* () {
87214
87559
  const command = settings.binaryPath.trim() || descriptor.defaultBinary;
87215
87560
  const spawnCommand = yield* resolveSpawnCommand(command, ["--version"], { env: environment });
87216
- return yield* spawnAndCollect(command, make$79(spawnCommand.command, spawnCommand.args, {
87561
+ return yield* spawnAndCollect(command, make$80(spawnCommand.command, spawnCommand.args, {
87217
87562
  env: environment,
87218
87563
  shell: spawnCommand.shell
87219
87564
  }));
@@ -87701,7 +88046,7 @@ const buildEntry = (input) => gen(function* () {
87701
88046
  };
87702
88047
  }
87703
88048
  const typedConfig = decodeResult.success;
87704
- const childScope = yield* make$76();
88049
+ const childScope = yield* make$77();
87705
88050
  yield* addFinalizer$1(parentScope, close(childScope, void_$2).pipe(ignore$1));
87706
88051
  const createResult = yield* driver.create({
87707
88052
  instanceId,
@@ -87822,8 +88167,8 @@ const makeProviderInstanceRegistry = (input) => gen(function* () {
87822
88167
  const driversById = new Map(input.drivers.map((driver) => [driver.driverKind, driver]));
87823
88168
  const parentScope = yield* Scope;
87824
88169
  const driverContext = yield* context();
87825
- const entries = yield* make$63(/* @__PURE__ */ new Map());
87826
- const unavailable = yield* make$63(/* @__PURE__ */ new Map());
88170
+ const entries = yield* make$64(/* @__PURE__ */ new Map());
88171
+ const unavailable = yield* make$64(/* @__PURE__ */ new Map());
87827
88172
  const changes = yield* unbounded$1();
87828
88173
  yield* addFinalizer(() => shutdown$2(changes));
87829
88174
  const reconcileWithR = makeReconcile({
@@ -87858,7 +88203,7 @@ const makeProviderInstanceRegistry = (input) => gen(function* () {
87858
88203
  * changes. Tests that exercise the mutator directly can pair this Layer
87859
88204
  * with a test-local `ServerSettingsService`.
87860
88205
  */
87861
- const ProviderInstanceRegistryMutableLayer = (input) => effectContext(makeProviderInstanceRegistry(input).pipe(map$4(({ registry, mutator }) => make$68(ProviderInstanceRegistry, registry).pipe(add$2(ProviderInstanceRegistryMutator, mutator)))));
88206
+ const ProviderInstanceRegistryMutableLayer = (input) => effectContext(makeProviderInstanceRegistry(input).pipe(map$4(({ registry, mutator }) => make$69(ProviderInstanceRegistry, registry).pipe(add$2(ProviderInstanceRegistryMutator, mutator)))));
87862
88207
  //#endregion
87863
88208
  //#region src/provider/Layers/ProviderInstanceRegistryHydration.ts
87864
88209
  /**
@@ -87986,20 +88331,6 @@ const ProviderInstanceRegistryHydrationLive = unwrap(gen(function* () {
87986
88331
  */
87987
88332
  var ProviderCommandReactor = class extends Service$2()("t3/orchestration/Services/ProviderCommandReactor") {};
87988
88333
  //#endregion
87989
- //#region src/orchestration/Services/ProviderRuntimeIngestion.ts
87990
- /**
87991
- * ProviderRuntimeIngestionService - Provider runtime ingestion service interface.
87992
- *
87993
- * Owns background workers that consume provider runtime streams and emit
87994
- * orchestration commands/events.
87995
- *
87996
- * @module ProviderRuntimeIngestionService
87997
- */
87998
- /**
87999
- * ProviderRuntimeIngestionService - Service tag for runtime ingestion workers.
88000
- */
88001
- var ProviderRuntimeIngestionService = class extends Service$2()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {};
88002
- //#endregion
88003
88334
  //#region src/orchestration/Services/ThreadDeletionReactor.ts
88004
88335
  /**
88005
88336
  * ThreadDeletionReactor - Thread deletion cleanup reactor service interface.
@@ -88081,28 +88412,6 @@ const makeRuntimeReceiptBusTest = gen(function* () {
88081
88412
  const RuntimeReceiptBusLive = effect(RuntimeReceiptBus, makeRuntimeReceiptBus);
88082
88413
  effect(RuntimeReceiptBus, makeRuntimeReceiptBusTest);
88083
88414
  //#endregion
88084
- //#region ../t3-shared/src/DrainableWorker.ts
88085
- /**
88086
- * Create a drainable worker that processes items from an unbounded queue.
88087
- *
88088
- * The worker is forked into the current scope and will be interrupted when
88089
- * the scope closes. A finalizer shuts down the queue.
88090
- *
88091
- * @param process - The effect to run for each queued item.
88092
- * @returns A `DrainableWorker` with `queue` and `drain`.
88093
- */
88094
- const makeDrainableWorker = (process) => gen(function* () {
88095
- const queue = yield* acquireRelease(unbounded(), shutdown);
88096
- const outstanding = yield* make$52(0);
88097
- yield* take(queue).pipe(tap((a) => ensuring(process(a), update$1(outstanding, (n) => n - 1))), forever, forkScoped);
88098
- const drain = get$1(outstanding).pipe(tap((n) => n > 0 ? txRetry : void_$1), tx);
88099
- const enqueue = (element) => offer(queue, element).pipe(tap(() => update$1(outstanding, (n) => n + 1)), tx);
88100
- return {
88101
- enqueue,
88102
- drain
88103
- };
88104
- });
88105
- //#endregion
88106
88415
  //#region src/orchestration/Layers/ProviderRuntimeIngestion.ts
88107
88416
  const providerTurnKey = (threadId, turnId) => `${threadId}:${turnId}`;
88108
88417
  const providerTaskKey = (threadId, taskId) => `${threadId}:${taskId}`;
@@ -88560,23 +88869,34 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
88560
88869
  const providerService = yield* ProviderService;
88561
88870
  const projectionTurnRepository = yield* ProjectionTurnRepository;
88562
88871
  const serverSettingsService = yield* ServerSettingsService;
88563
- const providerCommandId = (event, tag) => crypto.randomUUIDv4.pipe(map$4((uuid) => CommandId.make(`provider:${event.eventId}:${tag}:${uuid}`)));
88564
- const turnMessageIdsByTurnKey = yield* make$81({
88872
+ const providerCommandId = (event, tag) => String(event.eventId).startsWith("codex-snapshot:") ? succeed$1(CommandId.make(`provider:${event.eventId}:${tag}`)) : crypto.randomUUIDv4.pipe(map$4((uuid) => CommandId.make(`provider:${event.eventId}:${tag}:${uuid}`)));
88873
+ const threadLocksRef = yield* make$54(/* @__PURE__ */ new Map());
88874
+ const getThreadSemaphore = (threadId) => modifyEffect(threadLocksRef, (current) => {
88875
+ const existing = current.get(threadId);
88876
+ if (existing) return succeed$1([existing, current]);
88877
+ return make$76(1).pipe(map$4((semaphore) => {
88878
+ const next = new Map(current);
88879
+ next.set(threadId, semaphore);
88880
+ return [semaphore, next];
88881
+ }));
88882
+ });
88883
+ const withThreadLock = (threadId, effect) => flatMap$1(getThreadSemaphore(threadId), (semaphore) => semaphore.withPermit(effect));
88884
+ const turnMessageIdsByTurnKey = yield* make$82({
88565
88885
  capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
88566
88886
  timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
88567
88887
  lookup: () => succeed$1(/* @__PURE__ */ new Set())
88568
88888
  });
88569
- const bufferedAssistantTextByMessageId = yield* make$81({
88889
+ const bufferedAssistantTextByMessageId = yield* make$82({
88570
88890
  capacity: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_CACHE_CAPACITY,
88571
88891
  timeToLive: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_TTL,
88572
88892
  lookup: () => succeed$1("")
88573
88893
  });
88574
- const assistantSegmentStateByTurnKey = yield* make$81({
88894
+ const assistantSegmentStateByTurnKey = yield* make$82({
88575
88895
  capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
88576
88896
  timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
88577
88897
  lookup: () => die(/* @__PURE__ */ new Error("assistant segment state should be read through getOption before initialization"))
88578
88898
  });
88579
- const bufferedProposedPlanById = yield* make$81({
88899
+ const bufferedProposedPlanById = yield* make$82({
88580
88900
  capacity: BUFFERED_PROPOSED_PLAN_BY_ID_CACHE_CAPACITY,
88581
88901
  timeToLive: BUFFERED_PROPOSED_PLAN_BY_ID_TTL,
88582
88902
  lookup: () => succeed$1({
@@ -88584,7 +88904,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
88584
88904
  createdAt: ""
88585
88905
  })
88586
88906
  });
88587
- const taskDescriptionByTaskKey = yield* make$81({
88907
+ const taskDescriptionByTaskKey = yield* make$82({
88588
88908
  capacity: TASK_DESCRIPTION_BY_TASK_CACHE_CAPACITY,
88589
88909
  timeToLive: TASK_DESCRIPTION_BY_TASK_TTL,
88590
88910
  lookup: () => succeed$1("")
@@ -88679,7 +88999,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
88679
88999
  if (!hasRenderableAssistantText(bufferedText)) return false;
88680
89000
  yield* orchestrationEngine.dispatch({
88681
89001
  type: "thread.message.assistant.delta",
88682
- commandId: yield* providerCommandId(input.event, input.commandTag),
89002
+ commandId: yield* providerCommandId(input.event, `${input.commandTag}:${input.messageId}`),
88683
89003
  threadId: input.threadId,
88684
89004
  messageId: input.messageId,
88685
89005
  delta: bufferedText,
@@ -88707,7 +89027,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
88707
89027
  const hasRenderableText = hasRenderableAssistantText(text);
88708
89028
  if (hasRenderableText) yield* orchestrationEngine.dispatch({
88709
89029
  type: "thread.message.assistant.delta",
88710
- commandId: yield* providerCommandId(input.event, input.finalDeltaCommandTag),
89030
+ commandId: yield* providerCommandId(input.event, `${input.finalDeltaCommandTag}:${input.messageId}`),
88711
89031
  threadId: input.threadId,
88712
89032
  messageId: input.messageId,
88713
89033
  delta: text,
@@ -88716,7 +89036,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
88716
89036
  });
88717
89037
  if (input.hasProjectedMessage || hasRenderableText) yield* orchestrationEngine.dispatch({
88718
89038
  type: "thread.message.assistant.complete",
88719
- commandId: yield* providerCommandId(input.event, input.commandTag),
89039
+ commandId: yield* providerCommandId(input.event, `${input.commandTag}:${input.messageId}`),
88720
89040
  threadId: input.threadId,
88721
89041
  messageId: input.messageId,
88722
89042
  ...input.turnId ? { turnId: input.turnId } : {},
@@ -88750,7 +89070,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
88750
89070
  const existingPlan = findProposedPlanById(input.threadProposedPlans, input.planId);
88751
89071
  yield* orchestrationEngine.dispatch({
88752
89072
  type: "thread.proposed-plan.upsert",
88753
- commandId: yield* providerCommandId(input.event, "proposed-plan-upsert"),
89073
+ commandId: yield* providerCommandId(input.event, `proposed-plan-upsert:${input.planId}`),
88754
89074
  threadId: input.threadId,
88755
89075
  proposedPlan: {
88756
89076
  id: input.planId,
@@ -89094,7 +89414,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
89094
89414
  taskTitle = yield* lookupTaskDescription(thread.id, event.payload.taskId);
89095
89415
  if (!taskTitle) taskTitle = findTaskTitleInActivities((yield* getLoadedThreadDetail())?.activities, event.payload.taskId);
89096
89416
  }
89097
- yield* forEach(runtimeEventToActivities(event, taskTitle), (activity) => providerCommandId(event, "thread-activity-append").pipe(flatMap$1((commandId) => orchestrationEngine.dispatch({
89417
+ yield* forEach(runtimeEventToActivities(event, taskTitle), (activity) => providerCommandId(event, `thread-activity-append:${activity.id}`).pipe(flatMap$1((commandId) => orchestrationEngine.dispatch({
89098
89418
  type: "thread.activity.append",
89099
89419
  commandId,
89100
89420
  threadId: thread.id,
@@ -89102,6 +89422,47 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
89102
89422
  createdAt: activity.createdAt
89103
89423
  })))).pipe(asVoid);
89104
89424
  });
89425
+ const reconcileThreadUnlocked = fn("reconcileThreadUnlocked")(function* (threadId, options) {
89426
+ const thread = yield* resolveThreadShell(threadId);
89427
+ if (!thread || thread.session?.providerName !== ProviderDriverKind.make("codex")) return;
89428
+ const snapshot = yield* providerService.readThread(threadId);
89429
+ for (const turn of snapshot.turns) {
89430
+ const existing = getOrUndefined(yield* projectionTurnRepository.getByTurnId({
89431
+ threadId,
89432
+ turnId: turn.id
89433
+ }));
89434
+ const isTerminal = turn.status === "completed" || turn.status === "failed" || turn.status === "interrupted";
89435
+ if (isTerminal && existing && (existing.state === "completed" || existing.state === "error" || existing.state === "interrupted")) continue;
89436
+ if (isTerminal) {
89437
+ const pendingTurnStart = yield* projectionTurnRepository.getPendingTurnStartByThreadId({ threadId });
89438
+ if (!(existing?.pendingMessageId !== null && existing?.pendingMessageId !== void 0 ? true : isSome(pendingTurnStart))) {
89439
+ const createdAt = turn.startedAt ?? turn.runtimeEvents?.[0]?.createdAt ?? thread.session.updatedAt;
89440
+ const providerThreadId = snapshot.providerThreadId ?? String(threadId);
89441
+ for (const userMessage of turn.userMessages ?? []) yield* orchestrationEngine.dispatch({
89442
+ type: "thread.message.user.import",
89443
+ commandId: CommandId.make(`provider-user:${providerThreadId}:${turn.id}:${userMessage.id}:import`),
89444
+ threadId,
89445
+ messageId: MessageId.make(`provider-user:${providerThreadId}:${turn.id}:${userMessage.id}`),
89446
+ turnId: turn.id,
89447
+ text: userMessage.text,
89448
+ createdAt
89449
+ });
89450
+ }
89451
+ }
89452
+ const runtimeEvents = turn.runtimeEvents ?? [];
89453
+ yield* forEach(isTerminal ? runtimeEvents : runtimeEvents.filter((event) => event.type === "turn.started"), processRuntimeEvent, {
89454
+ concurrency: 1,
89455
+ discard: true
89456
+ });
89457
+ }
89458
+ if (options?.requireWritable !== true) return;
89459
+ yield* providerService.ensureSession(threadId);
89460
+ });
89461
+ const reconcileThread = (threadId, options) => withThreadLock(threadId, reconcileThreadUnlocked(threadId, options)).pipe(mapError((cause) => cause instanceof ProviderRuntimeReconciliationError ? cause : new ProviderRuntimeReconciliationError({
89462
+ threadId,
89463
+ detail: cause instanceof Error ? cause.message : "Provider snapshot sync failed.",
89464
+ cause
89465
+ })));
89105
89466
  const processDomainEvent = (_event) => void_$1;
89106
89467
  const processInput = (input) => input.source === "runtime" ? processRuntimeEvent(input.event) : processDomainEvent(input.event);
89107
89468
  const processInputSafely = (input) => processInput(input).pipe(catchCause((cause) => {
@@ -89129,6 +89490,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
89129
89490
  });
89130
89491
  return {
89131
89492
  start,
89493
+ reconcileThread,
89132
89494
  drain: worker.drain
89133
89495
  };
89134
89496
  })).pipe(provide(ProjectionTurnRepositoryLive));
@@ -89278,7 +89640,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
89278
89640
  const serverSettingsService = yield* ServerSettingsService;
89279
89641
  const serverCommandId = (tag) => crypto.randomUUIDv4.pipe(map$4((uuid) => CommandId.make(`server:${tag}:${uuid}`)));
89280
89642
  const serverEventId = () => crypto.randomUUIDv4.pipe(map$4(EventId.make));
89281
- const handledTurnStartKeys = yield* make$81({
89643
+ const handledTurnStartKeys = yield* make$82({
89282
89644
  capacity: HANDLED_TURN_START_KEY_MAX,
89283
89645
  timeToLive: HANDLED_TURN_START_KEY_TTL,
89284
89646
  lookup: () => succeed$1(true)
@@ -90087,7 +90449,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
90087
90449
  if (provider === void 0 || source === void 0) continue;
90088
90450
  fallbackByInstance.set(source.instanceId, provider);
90089
90451
  }
90090
- const providersRef = yield* make$63(yield* forEach(bootSources, (source) => gen(function* () {
90452
+ const providersRef = yield* make$64(yield* forEach(bootSources, (source) => gen(function* () {
90091
90453
  const filePath = yield* resolveProviderStatusCachePath({
90092
90454
  cacheDir: config.providerStatusCacheDir,
90093
90455
  instanceId: source.instanceId
@@ -90110,9 +90472,9 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
90110
90472
  return succeed$1(hydrateCachedProvider(correlation));
90111
90473
  }));
90112
90474
  }), { concurrency: "unbounded" }).pipe(map$4((providers) => orderProviderSnapshots(providers.filter((provider) => provider !== void 0)))));
90113
- const maintenanceActionStatesRef = yield* make$63(/* @__PURE__ */ new Map());
90114
- const liveSubsRef = yield* make$63(/* @__PURE__ */ new Map());
90115
- const syncSemaphore = yield* make$75(1);
90475
+ const maintenanceActionStatesRef = yield* make$64(/* @__PURE__ */ new Map());
90476
+ const liveSubsRef = yield* make$64(/* @__PURE__ */ new Map());
90477
+ const syncSemaphore = yield* make$76(1);
90116
90478
  const getLiveSources = get$3(liveSubsRef).pipe(map$4((map) => Array.from(map.values(), buildSnapshotSource)));
90117
90479
  const persistProvider = (provider) => gen(function* () {
90118
90480
  const key = snapshotInstanceKey(provider);
@@ -90408,7 +90770,7 @@ const httpHeaderRedactionLayer = effect(CurrentRedactedNames, map$4(CurrentRedac
90408
90770
  //#region src/serverLogger.ts
90409
90771
  const ServerLoggerLive = gen(function* () {
90410
90772
  const minimumLogLevelLayer = succeed$3(MinimumLogLevel, (yield* ServerConfig).logLevel);
90411
- return mergeAll(layer$40([consolePretty(), tracerLogger], { mergeWithExisting: false }), minimumLogLevelLayer);
90773
+ return mergeAll(layer$41([consolePretty(), tracerLogger], { mergeWithExisting: false }), minimumLogLevelLayer);
90412
90774
  }).pipe(unwrap);
90413
90775
  //#endregion
90414
90776
  //#region src/observability/Layers/Observability.ts
@@ -90431,7 +90793,7 @@ const ObservabilityLive = unwrap(gen(function* () {
90431
90793
  durationMs: stats.durationMs
90432
90794
  })
90433
90795
  });
90434
- const delegate = config.otlpTracesUrl === void 0 ? void 0 : yield* make$21({
90796
+ const delegate = config.otlpTracesUrl === void 0 ? void 0 : yield* make$22({
90435
90797
  url: config.otlpTracesUrl,
90436
90798
  exportInterval: `${config.otlpExportIntervalMs} millis`,
90437
90799
  resource: {
@@ -90449,9 +90811,9 @@ const ObservabilityLive = unwrap(gen(function* () {
90449
90811
  batchWindowMs: config.traceBatchWindowMs,
90450
90812
  sink,
90451
90813
  ...delegate ? { delegate } : {}
90452
- })), layer$12(sink));
90814
+ })), layer$13(sink));
90453
90815
  })).pipe(provide(layerFlusher), provideMerge(otlpSerializationLayer));
90454
- const metricsLayer = config.otlpMetricsUrl === void 0 ? empty$8 : layer$15({
90816
+ const metricsLayer = config.otlpMetricsUrl === void 0 ? empty$8 : layer$16({
90455
90817
  url: config.otlpMetricsUrl,
90456
90818
  exportInterval: `${config.otlpExportIntervalMs} millis`,
90457
90819
  resource: {
@@ -90504,11 +90866,11 @@ const orchestrationHttpApiLayer = group(EnvironmentHttpApi, "orchestration", fnU
90504
90866
  //#endregion
90505
90867
  //#region src/server.ts
90506
90868
  const HTTP_PREEMPTIVE_SHUTDOWN_GRACE_MS = 0;
90507
- const ApplicationObservabilityLive = ObservabilityLive.pipe(provideMerge(layer$16));
90508
- const ServerSettingsLayerLive = layer$25.pipe(provide(layer$35));
90509
- const DesktopTelemetryReceiverLayerLive = layer$19.pipe(provideMerge(ServerSettingsLayerLive));
90510
- const HostPowerMonitorLayerLive = layer$18.pipe(provide(DesktopTelemetryReceiverLayerLive));
90511
- const BackgroundLayerLive = layer$17.pipe(provide(HostPowerMonitorLayerLive), provideMerge(ServerSettingsLayerLive));
90869
+ const ApplicationObservabilityLive = ObservabilityLive.pipe(provideMerge(layer$17));
90870
+ const ServerSettingsLayerLive = layer$26.pipe(provide(layer$36));
90871
+ const DesktopTelemetryReceiverLayerLive = layer$20.pipe(provideMerge(ServerSettingsLayerLive));
90872
+ const HostPowerMonitorLayerLive = layer$19.pipe(provide(DesktopTelemetryReceiverLayerLive));
90873
+ const BackgroundLayerLive = layer$18.pipe(provide(HostPowerMonitorLayerLive), provideMerge(ServerSettingsLayerLive));
90512
90874
  const HttpServerLive = unwrap(gen(function* () {
90513
90875
  const config = yield* ServerConfig;
90514
90876
  if (typeof Bun !== "undefined") return (yield* promise(() => import("@effect/platform-bun/BunHttpServer"))).layer({
@@ -90543,23 +90905,23 @@ const ReactorLayerLive = empty$8.pipe(provideMerge(OrchestrationReactorLive), pr
90543
90905
  const ProviderSessionDirectoryLayerLive = ProviderSessionDirectoryLive.pipe(provide(layer$4));
90544
90906
  const ProviderLayerLive = ProviderServiceLive.pipe(provide(ProviderAdapterRegistryLive), provideMerge(ProviderSessionDirectoryLayerLive));
90545
90907
  const PersistenceLayerLive = empty$8.pipe(provideMerge(layerConfig));
90546
- const WorkspaceEntriesLayerLive = layer$9.pipe(provide(layer$21));
90547
- const WorkspaceLayerLive = mergeAll(layer$21, WorkspaceEntriesLayerLive, layer$8.pipe(provide(layer$21), provide(WorkspaceEntriesLayerLive)));
90548
- const TerminalLayerLive = layer$6.pipe(provide(layer));
90549
- const ProjectFaviconResolverLayerLive = layer$13.pipe(provide(layer$21), provide(layer$14));
90550
- const AuthLayerLive = layer$32.pipe(provideMerge(PersistenceLayerLive), provide(layer$35));
90908
+ const WorkspaceEntriesLayerLive = layer$10.pipe(provide(layer$22));
90909
+ const WorkspaceLayerLive = mergeAll(layer$22, WorkspaceEntriesLayerLive, layer$9.pipe(provide(layer$22), provide(WorkspaceEntriesLayerLive)));
90910
+ const TerminalLayerLive = layer$7.pipe(provide(layer));
90911
+ const ProjectFaviconResolverLayerLive = layer$14.pipe(provide(layer$22), provide(layer$15));
90912
+ const AuthLayerLive = layer$33.pipe(provideMerge(PersistenceLayerLive), provide(layer$36));
90551
90913
  const ProviderRuntimeLayerLive = ProviderSessionReaperLive.pipe(provideMerge(ProviderLayerLive), provideMerge(OrchestrationLayerLive));
90552
- const RuntimeDependenciesLive = ReactorLayerLive.pipe(provideMerge(ServerSettingsLayerLive), provideMerge(ProviderRuntimeLayerLive), provideMerge(PersistenceLayerLive), provideMerge(layer$28), provideMerge(layer$2), provideMerge(ProviderRegistryLive), provideMerge(ProviderInstanceRegistryHydrationLive), provideMerge(layer$3), provideMerge(WorkspaceLayerLive), provideMerge(layer$7), provideMerge(TerminalLayerLive), provideMerge(ProjectFaviconResolverLayerLive), provideMerge(layer$29), provideMerge(layer$23), provideMerge(AuthLayerLive), provideMerge(layer$35)).pipe(provideMerge(BackgroundLayerLive), provideMerge(layer$24), provideMerge(layer$27), provideMerge(layer$26), provide(layer$42));
90914
+ const RuntimeDependenciesLive = ReactorLayerLive.pipe(provideMerge(ServerSettingsLayerLive), provideMerge(ProviderRuntimeLayerLive), provideMerge(PersistenceLayerLive), provideMerge(layer$29), provideMerge(layer$2), provideMerge(ProviderRegistryLive), provideMerge(ProviderInstanceRegistryHydrationLive), provideMerge(layer$3), provideMerge(WorkspaceLayerLive), provideMerge(layer$8), provideMerge(TerminalLayerLive), provideMerge(ProjectFaviconResolverLayerLive), provideMerge(layer$30), provideMerge(layer$24), provideMerge(AuthLayerLive), provideMerge(layer$36)).pipe(provideMerge(BackgroundLayerLive), provideMerge(layer$25), provideMerge(layer$28), provideMerge(layer$27), provide(layer$43));
90553
90915
  const commandReadinessLayer = middleware((httpEffect) => flatMap$1(ServerRuntimeStartup, (startup) => startup.awaitCommandReady.pipe(orDie, andThen(httpEffect))), { global: true });
90554
- const makeRoutesLayer = mergeAll(layer$20(EnvironmentHttpApi).pipe(provide(authHttpApiLayer), provide(connectHttpApiLayer), provide(orchestrationHttpApiLayer), provide(serverEnvironmentHttpApiLayer), provide(environmentAuthenticatedAuthLayer)), otlpTracesProxyRouteLayer, assetRouteLayer, staticAndDevRouteLayer, websocketRpcRouteLayer).pipe(provide(commandReadinessLayer), provide(browserApiCorsLayer), provide(httpCompressionLayer));
90916
+ const makeRoutesLayer = mergeAll(layer$21(EnvironmentHttpApi).pipe(provide(authHttpApiLayer), provide(connectHttpApiLayer), provide(orchestrationHttpApiLayer), provide(serverEnvironmentHttpApiLayer), provide(environmentAuthenticatedAuthLayer)), otlpTracesProxyRouteLayer, assetRouteLayer, staticAndDevRouteLayer, websocketRpcRouteLayer).pipe(provide(commandReadinessLayer), provide(browserApiCorsLayer), provide(httpCompressionLayer));
90555
90917
  const runServer = launch(unwrap(gen(function* () {
90556
90918
  const config = yield* ServerConfig;
90557
- const activation = yield* make$73();
90919
+ const activation = yield* make$74();
90558
90920
  const awaitActivation = _await(activation);
90559
90921
  const activationLayer = succeed$3(ServerActivation, awaitActivation);
90560
- const runtimeStateParked = yield* make$73();
90561
- const tailscaleParked = yield* make$73();
90562
- const routesReady = yield* make$73();
90922
+ const runtimeStateParked = yield* make$74();
90923
+ const tailscaleParked = yield* make$74();
90924
+ const routesReady = yield* make$74();
90563
90925
  yield* fixPath();
90564
90926
  const httpListeningLayer = effectDiscard(gen(function* () {
90565
90927
  yield* HttpServer;
@@ -90613,7 +90975,7 @@ const runServer = launch(unwrap(gen(function* () {
90613
90975
  ...config.tailscaleServeEnabled ? [_await(tailscaleParked)] : []
90614
90976
  ], { concurrency: "unbounded" }).pipe(asVoid)
90615
90977
  }).pipe(provideMerge(RuntimeDependenciesLive));
90616
- return mergeAll(serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }).pipe(tap$1(() => succeed$4(routesReady, void 0).pipe(orDie))), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, config.hubTunnel ? layer$5(config.hubTunnel).pipe(provideMerge(runtimeServicesLive)) : empty$8).pipe(provideMerge(runtimeServicesLive), provide(activationLayer), provideMerge(HttpServerLive), provide(ApplicationObservabilityLive), provideMerge(layer$43), provideMerge(PlatformServicesLive));
90978
+ return mergeAll(serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }).pipe(tap$1(() => succeed$4(routesReady, void 0).pipe(orDie))), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, config.hubTunnel ? mergeAll(layer$6(config.hubTunnel), layer$5(config.hubTunnel)).pipe(provideMerge(runtimeServicesLive)) : empty$8).pipe(provideMerge(runtimeServicesLive), provide(activationLayer), provideMerge(HttpServerLive), provide(ApplicationObservabilityLive), provideMerge(layer$44), provideMerge(PlatformServicesLive));
90617
90979
  })));
90618
90980
  //#endregion
90619
90981
  //#region src/cli/server.ts
@@ -90625,15 +90987,15 @@ const runServerCommand = (flags, options) => gen(function* () {
90625
90987
  });
90626
90988
  return yield* runServer.pipe(provideService(ServerConfig, config), ensuring(sync(releaseDaemonLock)));
90627
90989
  });
90628
- const startCommand = make$62("start", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)));
90629
- const serveCommand = make$62("serve", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server without opening a browser."), withHandler((flags) => runServerCommand(flags, {
90990
+ const startCommand = make$63("start", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)));
90991
+ const serveCommand = make$63("serve", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server without opening a browser."), withHandler((flags) => runServerCommand(flags, {
90630
90992
  startupPresentation: "headless",
90631
90993
  forceAutoBootstrapProjectFromCwd: false
90632
90994
  })));
90633
90995
  //#endregion
90634
90996
  //#region src/bin.ts
90635
- const CliRuntimeLayer = mergeAll(layer$44, layer$42);
90636
- const makeCli = () => make$62("t3", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)), withSubcommands([
90997
+ const CliRuntimeLayer = mergeAll(layer$45, layer$43);
90998
+ const makeCli = () => make$63("t3", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)), withSubcommands([
90637
90999
  startCommand,
90638
91000
  serveCommand,
90639
91001
  pairCommand,