@cmmd-center/forge 0.10.13 → 0.10.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{BunHttpServer-CjwNydcy.cjs → BunHttpServer-BhE7Szci.cjs} +6 -6
  2. package/dist/{BunHttpServer-GM72b26K.mjs → BunHttpServer-VI75aqJw.mjs} +6 -6
  3. package/dist/{BunPTY-B4Ra6mph.cjs → BunPTY-86ttlTi6.cjs} +3 -3
  4. package/dist/{BunPTY-C_ONQ8rt.mjs → BunPTY-oVISucl_.mjs} +3 -3
  5. package/dist/{BunServices-CUeOgVUt.cjs → BunServices-BwE9KexF.cjs} +3 -3
  6. package/dist/{BunServices-B-6JkR0Q.mjs → BunServices-D0JTDujL.mjs} +3 -3
  7. package/dist/{Cache-D56wNKiH.cjs → Cache-CWlxNDbC.cjs} +6 -6
  8. package/dist/{Cache-da-A9JAa.mjs → Cache-p0X77SKw.mjs} +3 -3
  9. package/dist/{Config-D0zF6ChD.mjs → Config-AqUR_lhX.mjs} +2 -2
  10. package/dist/{Config-e5bi-5Ut.cjs → Config-CkEzdD9L.cjs} +2 -2
  11. package/dist/{HttpServer-B-QOc7bR.cjs → HttpServer-DGoLR-kU.cjs} +4 -4
  12. package/dist/{HttpServer-HhjqDZlB.mjs → HttpServer-DNGCTTdk.mjs} +3 -3
  13. package/dist/{NodeHttpServer-Cy1XvkSE.cjs → NodeHttpServer-BPjxt_DT.cjs} +7 -7
  14. package/dist/{NodeHttpServer-DmEyd0J4.mjs → NodeHttpServer-Dw7ivXfX.mjs} +7 -7
  15. package/dist/{NodePTY-DU_KoZdd.mjs → NodePTY-CVH2yNYl.mjs} +4 -4
  16. package/dist/{NodePTY-wATyTf3M.cjs → NodePTY-Cps0jsDA.cjs} +4 -4
  17. package/dist/{NodeServices-DeNLW36O.mjs → NodeServices-CBNXOYLG.mjs} +3 -3
  18. package/dist/{NodeServices-pfwgkiUu.cjs → NodeServices-Cw6SxEbl.cjs} +3 -3
  19. package/dist/{NodeServices-BqfcuvmN.cjs → NodeServices-Ddr-tYRu.cjs} +1 -1
  20. package/dist/{NodeSqliteClient-PZ6NN2gq.cjs → NodeSqliteClient-CmxPzcBf.cjs} +7 -7
  21. package/dist/{NodeSqliteClient-BqUcml1B.mjs → NodeSqliteClient-DGInbxQ3.mjs} +6 -6
  22. package/dist/{NodeTerminal-DfKMT-mE.cjs → NodeTerminal-5iWbO0B2.cjs} +6 -6
  23. package/dist/{NodeTerminal-DBDxXuu0.mjs → NodeTerminal-BEGtoMSS.mjs} +3 -3
  24. package/dist/{PTY-DB-DmqyE.cjs → PTY-BxYDiW3h.cjs} +2 -2
  25. package/dist/{PTY-DdjcAGrF.mjs → PTY-rIPf52QR.mjs} +2 -2
  26. package/dist/{Path-CHDjKLrB.cjs → Path-Be7zSwar.cjs} +281 -54
  27. package/dist/{Path-B0vKGzx2.mjs → Path-C6Zb2WHp.mjs} +271 -58
  28. package/dist/{Schema-BK7-mN_J.mjs → Schema-CJyk7ah1.mjs} +65 -3
  29. package/dist/{Schema-Cf_uEUQU.cjs → Schema-dLi7Qssy.cjs} +76 -2
  30. package/dist/{SqlError-Du_dEWbw.cjs → SqlError-Bt0Bcd5C.cjs} +4 -4
  31. package/dist/{SqlError-LFObCDir.mjs → SqlError-cyJT2IRY.mjs} +3 -3
  32. package/dist/{SqliteClient-D4Srj6O8.cjs → SqliteClient-B08FzZM4.cjs} +6 -6
  33. package/dist/{SqliteClient-DdItRZUr.mjs → SqliteClient-CIsITMoQ.mjs} +5 -5
  34. package/dist/bin.cjs +313 -152
  35. package/dist/bin.mjs +426 -265
  36. package/dist/client/assets/{DiffPanel-DGiCJd76.js → DiffPanel-CniKcSxk.js} +3 -3
  37. package/dist/client/assets/{DiffPanel.logic-Dd5YF6k3.js → DiffPanel.logic-UU4xEJJO.js} +2 -2
  38. package/dist/client/assets/{DiffPanelShell-C-nlQxal.js → DiffPanelShell-BpK-LVcn.js} +119 -119
  39. package/dist/client/assets/{DiffWorkerPoolProvider-CfmtkBLg.js → DiffWorkerPoolProvider-B6dAKEIU.js} +9 -9
  40. package/dist/client/assets/{PullRequestCodePanel-xkECqRzW.js → PullRequestCodePanel-DHZ0dDeb.js} +3 -3
  41. package/dist/client/assets/{Virtualizer-CVyQexgp.js → Virtualizer-BaXfuCj_.js} +2 -2
  42. package/dist/client/assets/{index-CUmbThfW.css → index-BMcOaHS_.css} +1 -1
  43. package/dist/client/assets/{index-BD9iZwyM.js → index-CpaFL0BH.js} +59 -59
  44. package/dist/client/index.html +5 -5
  45. package/dist/forge-build.json +1 -1
  46. package/package.json +1 -1
package/dist/bin.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-C5ckVeoz.mjs";
4
- import { $ as encodeEffect, $c as getOrNull, $i as catchDone, $l as constant, $n as filterMapOrFail, $o as fiberInterrupt, $s as seconds, $t as stringifyJson, Aa as addFinalizer$1, An as cached$3, Ao as pretty, Ar as matchCauseEffect, As as void_$2, At as withConstructorDefault, Ba as MinimumLogLevel, Bi as gauge, Bl as isNotNullish, Bn as catch_, Bo as as$2, Br as orElseSucceed, Bt as head, C as Record, Ca as provide$1, Ci as txRetry, Cn as andThen, Co as hasInterruptsOnly, Cr as logWarning$1, Ct as optionalKey, D as TaggedStruct, Da as sync$2, Dl as format, Dn as as$3, Dr as mapError, Ds as tracerLogger$1, Dt as toCodecStringTree, E as TaggedErrorClass, Ea as succeedContext, Ei as uninterruptibleMask$1, El as toJson, En as annotateSpans, Es as sync, Et as toCodecJson, F as UndefinedOr, Fa as make$37, Fc as Reference$1, Fi as withSpan, Fn as catchFilter, Fo as CurrentLoggers$1, Fr as onExit, Fs as ParentSpan, G as decodeExit, Gc as merge$2, Gi as addDelay, Gn as die$1, Gr as race, Gs as fromInputUnsafe, Gt as Transformation, H as declare, Ha as TracerTimingEnabled, Hc as getUnsafe$1, Hi as timer, Hl as isNullish, Hn as contextWith, Hr as provide, Hs as days, Ht as size$2, I as Union, Ia as makeUnsafe$4, Ic as Service$1, Ii as withTracerEnabled, In as catchIf, Is as Tracer, It as assign, J as decodeUnknownEffect, Jc as flatMap$2, Ji as forever$2, Jl as compose, Jn as exit, Jr as result, Jt as transformOrFail, K as decodeSync, Ka as fail$3, Ki as both, Kr as raceFirst, L as Unknown, La as provide$2, Lc as add$2, Li as yieldNow, Ll as compose$1, Ln as catchReason, Lr as onInterrupt, Ls as externalSpan, Lt as append$1, M as URLFromString, Ma as close, Mc as isSuccess$1, Mi as withFiber$1, Mn as callback, Mo as squash, Mr as matchEffect, Na as closeUnsafe, Nn as catchCause, Nr as never$1, Ns as MinimumTraceLevel, O as TemplateLiteral, Oa as unwrap, Oc as fail$1, Oi as useSpan, On as asSome, Os as uninterruptibleMask, Ot as toJsonSchemaDocument, P as Undefined, Pa as forkUnsafe, Pc as succeed$1, Pi as withParentSpan, Pn as catchDefect, Po as ConsoleRef, Pr as onError$1, Ps as NativeSpan, Q as encode$4, Qa as make$39, Qc as getOrElse, Qi as spaced, Ql as constVoid, Qn as filter$1, Qr as runPromise, Qs as minutes, R as UnknownFromJsonString$1, Ra as CurrentLogAnnotations, Rc as empty$1, Ri as zipWith, Rl as hasProperty, Rn as catchTag, Ro as addFinalizer, Rr as option, Rs as make$42, Rt as drop$1, S as Option, Sa as mergeAll, Si as tx$1, Sl as withFiber, Sn as all, So as hasInterrupts, Sr as logInfo, St as optional$4, T as Struct, Ta as succeed$2, Ti as uninterruptible, Tl as NodeInspectSymbol, Tn as annotateLogs, To as interruptors, Tr as map$3, Ts as suspend, Tt as tag, Ua as _await, Uc as make$35, Ui as update$3, Ul as isObject$1, Un as currentSpan, Ur as provideContext, Us as format$1, Ut as toArray, V as brand, Vi as snapshotUnsafe, Vl as isNotUndefined, Vn as context, Vr as promise, Vt as isEmpty$2, W as decodeEffect, Wa as done, Wc as makeUnsafe$3, Wi as withAttributes, Wl as isTagged, Wo as consolePretty$1, Wr as provideService, Ws as fromInput, X as decodeUnknownOption, Xa as isDeferred, Xc as fromNullishOr, Xi as passthrough$1, Xl as constTrue, Xn as failCause$1, Xr as runFork, Xs as millis, Xt as onSome, Y as decodeUnknownExit, Yc as flatten$1, Yn as fail, Yr as retry, Ys as max, Z as decodeUnknownSync, Zc as fromUndefinedOr, Zi as recurs, Zl as constUndefined, Zr as runForkWith, Zs as min, Zt as parseJson$1, _ as NonEmptyArray, _a as effectDiscard, _i as timeout$1, _n as toUtc, _o as fail$4, _r as isEffect, _t as isSchemaError, a as DateTimeUtc, aa as clamp, ac as empty$3, ai as service, al as none$4, an as value, ao as isFailure, ar as fnUntraced, at as isBetween, b as NullOr, ba as launch$1, bi as tryPromise, bn as acquireUseRelease, br as logError, bs as scopeAddFinalizerExit, bt as makeFilter, c as Defect, ca as currentTimeMillis, cc as flatMapNullishOr, ci as succeed, cl as make$41, cn as add$3, cr as forkChild, cs as forever, ct as isGreaterThanOrEqualTo, d as Exit, da as TaggedError, dc as isArrayNonEmpty, di as suspend$1, dn as isGreaterThanOrEqualTo$1, do as NoSuchElementError, dr as forkScoped, dt as isMaxLength, ec as times, ei as runPromiseWith, el as getOrUndefined, eo as succeed$3, er as filterOrFail, et as encodeSync, eu as dual, fa as CurrentMemoMap, fc as isReadonlyArrayNonEmpty, fi as sync$1, fn as make$38, fo as StackTrace, fr as gen, fs as loggerMake, ft as isMaxProperties, g as Never, ga as effectContext, gc as map$4, gi as tapErrorTag, gn as toEpochMillis, go as done$1, gr as interruptible, gt as isSchema, h as Literals, ha as effect, hi as tapError, hn as toDate, hr as interrupt$1, ht as isPattern, i as Class, ia as Random$1, ic as allocate, il as match, in as make$40, io as interrupt$3, ir as fn$1, it as is$1, iu as pipeArguments, ja as addFinalizerExit, jc as isFailure$1, ji as whileLoop, jl as equals, jn as cachedWithTTL, jo as prettyErrors, jt as withDecodingDefault, k as Trim, ka as Scope$1, ki as void_$1, kn as asVoid, ko as map$6, kr as match$1, kt as toType, l as Duration, la as Class$1, lc as fromIterable, li as succeedNone, ln as distance, lo as void_$3, lr as forkDetach$1, ls as forkDetach, lt as isInt, m as Literal, ma as buildWithMemoMap, mi as tapCause, ml as YieldableProto, mn as now, mr as ignoreCause, mt as isNonEmpty, n as ArraySchema, na as isDoneCause, nc as toSeconds, ni as scope$1, nl as isSome, no as fail$2, nt as encodeUnknownExit, nu as identity, o as DateTimeUtcFromString, oa as parse$6, oc as ensure, oi as serviceOption, ol as some, oo as isSuccess, or as forEach, os as flatMap$1, ot as isFinite$1, p as Int$1, pa as build, pi as tap, pl as PipeInspectableProto, pn as makeUnsafe$5, pr as ignore, pt as isMinLength, q as decodeTo, qa as failCause$3, qc as firstSomeOf, qi as exponential, ql as cast, qn as ensuring, qr as repeat, r as Boolean$1, rc as zero, ri as scoped, rl as map$5, rn as makeFormatterDefault, ro as failCause$2, rr as flatten$2, rt as fromJsonString, ru as pipe$1, sa as Clock, sc as filter, si as sleep$4, sl as Number$2, sn as encodeBase64Url$2, so as match$2, sr as forever$1, ss as fnUntraced$1, st as isGreaterThan, t as Any, tc as toMillis, tl as isNone, tn as InvalidValue$1, to as die$2, tr as flatMap, tt as encodeUnknownEffect, u as ErrorClass, ui as succeedSome, un as formatIso, ur as forkIn, ut as isLessThanOrEqualTo, v as NonEmptyString, va as empty$4, vc as reverse, vi as timeoutOption, vn as Transaction$1, vr as log$4, vs as reportCauseUnsafe, w as String$1, wa as provideMerge, wi as undefined_, wn as annotateCurrentSpan, wo as interrupt$2, wr as makeSpanScoped, wt as suspend$2, x as Number$1, xa as merge$3, xi as try_, xl as isEffect$1, xn as addFinalizer$2, xo as hasDies, xr as logFatal, xs as sleep$3, xt as mutable, y as Null, yc as sort, yi as timeoutOrElse, yn as acquireRelease, yr as logDebug, ys as scope, yt as make$36, z as Void, za as CurrentLogSpans, zc as get$3, zi as counter, zl as isNotNull, zn as catchTags, zo as andThen$1, zr as orDie, zt as empty$2 } from "./Schema-BK7-mN_J.mjs";
5
- import { $ as toAsyncIterable, A as make$45, At as offerAll, Bt as subscribe$1, C as fromEffect, Ct as bounded, E as fromQueue, Et as failCause$4, F as merge$4, Ft as take$1, G as runFold, Gt as await_, H as run$2, It as takeAll, K as runForEach, Kt as getCurrent, Lt as unbounded$2, M as mapAccum, N as mapEffect$1, Nt as shutdown$1, O as fromSubscription, Ot as make$44, Pt as sliding, Q as tick, R as onExit$1, Rt as publish, S as fromChannel, St as makeUnsafe$6, T as fromPubSub, U as runCollect, V as provideContext$1, Vt as unbounded$1, W as runDrain, Wt as makeUnsafe$7, Y as succeed$4, Yt as runIn, Z as takeWhile, _t as fromSubscriptionArray, at as make$46, b as flatMap$3, c as callback$1, d as debounce$1, dt as drain, f as decodeText$1, ft as forEach$1, g as ensuring$1, h as encodeText, ht as mapInput, it as get$4, j as map$7, jt as offerUnsafe, k as isStream, kt as offer$1, l as catchCause$1, m as empty$5, q as runForEachArray, qt as interrupt$4, r as FileSystem, rt as unwrap$1, t as Path$2, u as concat$2, v as failCause$5, vt as fromTransform, w as fromIterable$1, wt as end, x as fromAsyncIterable, xt as make$43, y as filter$2, zt as shutdown$2 } from "./Path-B0vKGzx2.mjs";
6
- import { _ as ChildProcessSpawner, a as Stdio, g as make$47, o as make$48, r as isQuitError } from "./NodeTerminal-DBDxXuu0.mjs";
7
- import { n as layer$7 } from "./NodeServices-DeNLW36O.mjs";
8
- import { $ as file, A as SocketErrorReason, At as merge$5, Bt as set$2, Ct as HttpClientErrorSchema, Dt as empty$7, Ft as getAndSet, G as TracerPropagationEnabled, Ht as updateAndGet, I as HttpServerError, It as getUnsafe$2, J as transformResponse, K as filterStatusOk$1, Lt as make$49, Ot as fromInput$1, Pt as get$5, Q as empty$6, Rt as makeUnsafe$8, St as setBody, Tt as jsonUnsafe$1, U as layer$8, Vt as update$4, W as HttpClient, Z as symbol$1, _ as schemaBodyUrlParams, _t as acceptJson, a as withLogAddress, at as setCookie, bt as get$6, ct as stream, d as logger$1, dt as filterStatusOk, et as isHttpServerResponse, f as withLoggerDisabled, ft as matchStatus, g as schemaBodyJson, gt as schemaBodyJson$1, i as serve$1, it as schemaJson, kt as fromRecordUnsafe, lt as text$2, m as ParsedSearchParams, nt as raw, ot as setCookies, p as HttpServerRequest, q as retryTransient, rt as redirect, st as setHeader, t as HttpServer, tt as jsonUnsafe, u as cors, ut as uint8Array, v as schemaHeaders, vt as bearerToken, wt as isHttpClientError, xt as post, y as toURL, yt as bodyJson, z as RouteNotFound, zt as modify$3 } from "./HttpServer-HhjqDZlB.mjs";
9
- import { _ as withDefault$3, a as all$1, c as logLevel, d as option$1, f as port, g as url$2, i as TrueValues, l as map$8, m as string$7, n as FalseValues, o as boolean$5, p as schema$2, r as Record$1, s as int$2, t as Boolean$2, u as number$2 } from "./Config-D0zF6ChD.mjs";
10
- import { a as make$50, i as keys, n as getOption, o as makeWith$1, r as invalidate, s as set$3, t as get$7 } from "./Cache-da-A9JAa.mjs";
11
- import { S as layer$9, _ as defaultEscape, a as DeadlockError, b as makeCompiler$1, c as SqlError, d as UnknownError, g as custom, h as make$51, i as ConstraintError, l as SqlSyntaxError, m as SqlClient, n as AuthorizationError, o as LockTimeoutError, r as ConnectionError, s as SerializationError, t as AuthenticationError, u as StatementTimeoutError, v as defaultTransforms, y as fragment } from "./SqlError-LFObCDir.mjs";
4
+ import { $ as encodeEffect, $a as make$39, $c as fromUndefinedOr, $i as spaced, $l as constUndefined, $n as filterMapOrFail, $r as runPromise, $s as min, $t as stringifyJson, Aa as Scope$1, Ac as fail$1, Ai as void_$1, An as cached$3, Ar as match$1, As as uninterruptibleMask, At as withConstructorDefault, Ba as CurrentLogSpans, Bc as empty$1, Bi as counter, Bl as hasProperty, Bn as catch_, Bo as addFinalizer, Br as orDie, Bs as make$42, Bt as head, C as Record, Ca as mergeAll, Ci as tx$1, Cl as isEffect$1, Cn as andThen, Co as hasDies, Cr as logInfo, Cs as sleep$3, Ct as optionalKey, D as TaggedStruct, Da as succeedContext, Di as uninterruptibleMask$1, Dl as NodeInspectSymbol, Dn as as$3, Do as interruptors, Ds as suspend, Dt as toCodecStringTree, E as TaggedErrorClass, Ea as succeed$2, Ei as uninterruptible, En as annotateSpans, Eo as interrupt$2, Er as map$3, Et as toCodecJson, F as UndefinedOr, Fa as forkUnsafe, Fi as withParentSpan, Fn as catchFilter, Fr as onError$1, Fs as MinimumTraceLevel, G as decodeExit, Ga as done, Gc as make$35, Gi as withAttributes, Gl as isObject$1, Gn as die$1, Gr as provideService, Gs as format$1, Gt as Transformation, H as declare, Hi as snapshotUnsafe, Hl as isNotNullish, Hn as contextWith, Ho as as$2, Hr as promise, Ht as size$2, I as Union, Ia as make$37, Ic as succeed$1, Ii as withSpan, In as catchIf, Io as ConsoleRef, Ir as onExit, Is as NativeSpan, It as assign, J as decodeUnknownEffect, Ja as failCause$3, Ji as exponential, Jn as exit, Jr as repeat, Jt as transformOrFail, K as decodeSync, Kc as makeUnsafe$3, Ki as addDelay, Kl as isTagged, Ko as consolePretty$1, Kr as race, Ks as fromInput, L as Unknown, La as makeUnsafe$4, Lc as Reference$1, Li as withTracerEnabled, Ln as catchReason, Lo as CurrentLoggers$1, Ls as ParentSpan, Lt as append$1, M as URLFromString, Ma as addFinalizerExit, Mi as whileLoop, Mn as callback, Mo as pretty, Ms as void_$2, Na as close, Nc as isFailure$1, Ni as withFiber$1, Nl as equals, Nn as catchCause, No as prettyErrors, Nr as matchEffect, O as TemplateLiteral, Oa as sync$2, Ol as toJson, On as asSome, Or as mapError, Os as sync, Ot as toJsonSchemaDocument, P as Undefined, Pa as closeUnsafe, Pc as isSuccess$1, Pn as catchDefect, Po as squash, Pr as never$1, Q as encode$4, Qc as fromNullishOr, Qi as recurs, Ql as constTrue, Qn as filter$1, Qr as runForkWith, Qs as millis, R as UnknownFromJsonString$1, Ra as provide$2, Rc as Service$1, Ri as yieldNow, Rn as catchTag, Rr as onInterrupt, Rs as Tracer, Rt as drop$1, S as Option, Sa as merge$3, Si as try_, Sn as all, Sr as logFatal, Ss as scopeAddFinalizerExit, St as optional$4, T as Struct, Ta as provideMerge, Ti as undefined_, Tn as annotateLogs, To as hasInterruptsOnly, Tr as makeSpanScoped, Tt as tag, Ua as TracerTimingEnabled, Ui as timer, Ul as isNotUndefined, Un as currentSpan, Ur as provide, Ut as toArray, V as brand, Va as MinimumLogLevel, Vc as get$3, Vi as gauge, Vl as isNotNull, Vn as context, Vo as andThen$1, Vr as orElseSucceed, Vt as isEmpty$2, W as decodeEffect, Wa as _await, Wc as getUnsafe$1, Wi as update$3, Wl as isNullish, Wr as provideContext, Ws as days, X as decodeUnknownOption, Xc as flatMap$2, Xl as compose, Xn as failCause$1, Xr as retry, Xt as onSome, Y as decodeUnknownExit, Yc as firstSomeOf, Yi as forever$2, Yl as cast, Yn as fail, Yr as result, Z as decodeUnknownSync, Za as isDeferred, Zc as flatten$1, Zi as passthrough$1, Zr as runFork, Zs as max, Zt as parseJson$1, _ as NonEmptyArray, _a as effectContext, _i as tapErrorTag, _n as toUtc, _t as isSchemaError, a as DateTimeUtc, aa as Random$1, ac as zero, al as map$5, an as value, ao as interrupt$3, ar as fnUntraced, at as isBetween, au as pipe$1, b as NullOr, bc as reverse, bi as timeoutOrElse, bn as acquireUseRelease, br as logDebug, bs as reportCauseUnsafe, bt as makeFilter, c as Defect, ca as Clock, cc as ensure, ci as sleep$4, cl as some, cn as add$3, co as match$2, cr as forkChild, cs as flatMap$1, ct as isGreaterThanOrEqualTo, d as Exit, dc as fromIterable, di as succeedSome, dn as isGreaterThanOrEqualTo$1, dr as forkScoped, ds as forkDetach, dt as isMaxLength, ea as catchDone, ec as minutes, el as getOrElse, er as filterOrFail, et as encodeSync, eu as constVoid, fa as TaggedError, fi as suspend$1, fn as make$38, fr as gen, ft as isMaxProperties, g as Never, ga as effect, gi as tapError, gl as YieldableProto, gn as toEpochMillis, gr as interruptible, gt as isSchema, h as Literals, ha as buildWithMemoMap, hi as tapCause, hl as PipeInspectableProto, hn as toDate, hr as interrupt$1, ht as isPattern, i as Class, ic as toSeconds, ii as scoped, il as isSome, in as make$40, io as failCause$2, ir as fn$1, it as is$1, iu as identity, ja as addFinalizer$1, jn as cachedWithTTL, jo as map$6, jr as matchCauseEffect, jt as withDecodingDefault, k as Trim, ka as unwrap, ki as useSpan, kl as format, kn as asVoid, ks as tracerLogger$1, kt as toType, l as Duration, la as currentTimeMillis, lc as filter, li as succeed, ll as Number$2, ln as distance, lr as forkDetach$1, ls as fnUntraced$1, lt as isInt, m as Literal, ma as build, mc as isReadonlyArrayNonEmpty, mi as tap, mn as now, mo as StackTrace, mr as ignoreCause, ms as loggerMake, mt as isNonEmpty, n as ArraySchema, nc as times, nl as getOrUndefined, no as die$2, nt as encodeUnknownExit, nu as dual, o as DateTimeUtcFromString, oa as clamp, oc as allocate, oi as service, ol as match, oo as isFailure, or as forEach, ot as isFinite$1, ou as pipeArguments, p as Int$1, pa as CurrentMemoMap, pc as isArrayNonEmpty, pi as sync$1, pn as makeUnsafe$5, po as NoSuchElementError, pr as ignore, pt as isMinLength, q as decodeTo, qa as fail$3, qc as merge$2, qi as both, qn as ensuring, qr as raceFirst, qs as fromInputUnsafe, r as Boolean$1, ra as isDoneCause, rc as toMillis, ri as scope$1, rl as isNone, rn as makeFormatterDefault, ro as fail$2, rr as flatten$2, rt as fromJsonString, sa as parse$6, sc as empty$3, si as serviceOption, sl as none$4, sn as encodeBase64Url$2, so as isSuccess, sr as forever$1, st as isGreaterThan, t as Any, tc as seconds, ti as runPromiseWith, tl as getOrNull, tn as InvalidValue$1, to as succeed$3, tr as flatMap, ts as fiberInterrupt, tt as encodeUnknownEffect, tu as constant, u as ErrorClass, ua as Class$1, uc as flatMapNullishOr, ui as succeedNone, ul as make$41, un as formatIso, uo as void_$3, ur as forkIn, us as forever, ut as isLessThanOrEqualTo, v as NonEmptyString, va as effectDiscard, vc as map$4, vi as timeout$1, vn as Transaction$1, vo as done$1, vr as isEffect, w as String$1, wa as provide$1, wi as txRetry, wl as withFiber, wn as annotateCurrentSpan, wo as hasInterrupts, wr as logWarning$1, wt as suspend$2, x as Number$1, xa as launch$1, xc as sort, xi as tryPromise, xn as addFinalizer$2, xr as logError, xs as scope, xt as mutable, y as Null, ya as empty$4, yi as timeoutOption, yn as acquireRelease, yo as fail$4, yr as log$4, yt as make$36, z as Void, za as CurrentLogAnnotations, zc as add$2, zi as zipWith, zl as compose$1, zn as catchTags, zr as option, zs as externalSpan, zt as empty$2 } from "./Schema-CJyk7ah1.mjs";
5
+ import { $ as toAsyncIterable, A as make$45, At as make$44, Bt as publish, C as fromEffect, Ct as make$43, E as fromQueue, Et as end, F as merge$4, Ft as shutdown$1, G as runFold, H as run$2, Ht as subscribe$1, It as sliding, Jt as getCurrent, K as runForEach, Kt as makeUnsafe$7, Lt as take$1, M as mapAccum, Mt as offerAll, N as mapEffect$1, Nt as offerUnsafe, O as fromSubscription, Ot as failCause$4, Q as tick, R as onExit$1, Rt as takeAll, S as fromChannel, T as fromPubSub, Tt as bounded, U as runCollect, Ut as unbounded$1, V as provideContext$1, Vt as shutdown$2, W as runDrain, Y as succeed$4, Yt as interrupt$4, Z as takeWhile, Zt as runIn, _t as mapInput, at as make$46, b as flatMap$3, bt as fromTransform, c as callback$1, d as debounce$1, f as decodeText$1, g as ensuring$1, h as encodeText, it as get$4, j as map$7, jt as offer$1, k as isStream, l as catchCause$1, m as empty$5, mt as forEach$1, ot as get$5, pt as drain, q as runForEachArray, qt as await_, r as FileSystem, rt as unwrap$1, st as make$47, t as Path$2, u as concat$2, v as failCause$5, w as fromIterable$1, wt as makeUnsafe$6, x as fromAsyncIterable, y as filter$2, yt as fromSubscriptionArray, zt as unbounded$2 } from "./Path-C6Zb2WHp.mjs";
6
+ import { _ as ChildProcessSpawner, a as Stdio, g as make$48, o as make$49, r as isQuitError } from "./NodeTerminal-BEGtoMSS.mjs";
7
+ import { n as layer$7 } from "./NodeServices-CBNXOYLG.mjs";
8
+ import { $ as file, A as SocketErrorReason, At as merge$5, Bt as set$2, Ct as HttpClientErrorSchema, Dt as empty$7, Ft as getAndSet, G as TracerPropagationEnabled, Ht as updateAndGet, I as HttpServerError, It as getUnsafe$2, J as transformResponse, K as filterStatusOk$1, Lt as make$50, Ot as fromInput$1, Pt as get$6, Q as empty$6, Rt as makeUnsafe$8, St as setBody, Tt as jsonUnsafe$1, U as layer$8, Vt as update$4, W as HttpClient, Z as symbol$1, _ as schemaBodyUrlParams, _t as acceptJson, a as withLogAddress, at as setCookie, bt as get$7, ct as stream, d as logger$1, dt as filterStatusOk, et as isHttpServerResponse, f as withLoggerDisabled, ft as matchStatus, g as schemaBodyJson, gt as schemaBodyJson$1, i as serve$1, it as schemaJson, kt as fromRecordUnsafe, lt as text$2, m as ParsedSearchParams, nt as raw, ot as setCookies, p as HttpServerRequest, q as retryTransient, rt as redirect, st as setHeader, t as HttpServer, tt as jsonUnsafe, u as cors, ut as uint8Array, v as schemaHeaders, vt as bearerToken, wt as isHttpClientError, xt as post, y as toURL, yt as bodyJson, z as RouteNotFound, zt as modify$3 } from "./HttpServer-DNGCTTdk.mjs";
9
+ import { _ as withDefault$3, a as all$1, c as logLevel, d as option$1, f as port, g as url$2, i as TrueValues, l as map$8, m as string$7, n as FalseValues, o as boolean$5, p as schema$2, r as Record$1, s as int$2, t as Boolean$2, u as number$2 } from "./Config-AqUR_lhX.mjs";
10
+ import { a as make$51, i as keys, n as getOption, o as makeWith$1, r as invalidate, s as set$3, t as get$8 } from "./Cache-p0X77SKw.mjs";
11
+ import { S as layer$9, _ as defaultEscape, a as DeadlockError, b as makeCompiler$1, c as SqlError, d as UnknownError, g as custom, h as make$52, i as ConstraintError, l as SqlSyntaxError, m as SqlClient, n as AuthorizationError, o as LockTimeoutError, r as ConnectionError, s as SerializationError, t as AuthenticationError, u as StatementTimeoutError, v as defaultTransforms, y as fragment } from "./SqlError-cyJT2IRY.mjs";
12
12
  import { r as wrapper_default, t as Mime_default } from "./Mime-Dq9IoNiV.mjs";
13
13
  import { a as diag, c as SpanKind$1, d as TraceFlags, f as ROOT_CONTEXT, i as propagation, l as isSpanContextValid, m as DiagLogLevel, n as init_esm$1, o as context$1, p as createContextKey, r as trace, s as SpanStatusCode, t as esm_exports$1 } from "./esm-wLIF-u3N.mjs";
14
14
  import { a as verifyCmmdAuthRuntimeTicket, c as verifyCmmdRuntimeTicket, d as setRuntimeGrantToken, f as createReadOnceFileTokenAccessor, i as sendRuntimeControlHeartbeat, l as verifyCmmdRuntimeTicketRefreshProof, n as bootstrapRuntimeControlAuthorityFromNarrowGrant, o as verifyCmmdClaudeReadinessTicket, r as readRuntimeControlAuthority, s as verifyCmmdClaudeUsageTicket, t as bootstrapRuntimeControlAuthority, u as runtimeGrantToken } from "./runtimeControlAuthority-COHmz_WT.mjs";
15
- import { n as PtySpawnError, t as PtyAdapter } from "./PTY-DdjcAGrF.mjs";
15
+ import { n as PtySpawnError, t as PtyAdapter } from "./PTY-rIPf52QR.mjs";
16
16
  import { createRequire } from "node:module";
17
17
  import * as HE from "node:child_process";
18
18
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -65495,7 +65495,7 @@ function normalizeNumberish(value) {
65495
65495
  }
65496
65496
  //#endregion
65497
65497
  //#region package.json
65498
- var version$1 = "0.10.13";
65498
+ var version$1 = "0.10.16";
65499
65499
  //#endregion
65500
65500
  //#region src/sentry.ts
65501
65501
  const SERVER_APP_NAME = "forge-server";
@@ -65968,7 +65968,7 @@ function readCmmdAvatarUrl(raw) {
65968
65968
  function readTrimmedString$2(value) {
65969
65969
  return typeof value === "string" ? value.trim() || null : null;
65970
65970
  }
65971
- function asRecord$13(value) {
65971
+ function asRecord$14(value) {
65972
65972
  return value && typeof value === "object" ? value : null;
65973
65973
  }
65974
65974
  function readDirectPlanLabelFromRecord(obj) {
@@ -65980,26 +65980,26 @@ function readNestedPlanLabelFromRecord(obj) {
65980
65980
  function readCmmdPlanLabel(obj) {
65981
65981
  const direct = readDirectPlanLabelFromRecord(obj);
65982
65982
  if (direct) return direct;
65983
- const plan = asRecord$13(obj["plan"]);
65983
+ const plan = asRecord$14(obj["plan"]);
65984
65984
  if (plan) {
65985
65985
  const label = readNestedPlanLabelFromRecord(plan);
65986
65986
  if (label) return label;
65987
65987
  }
65988
- const subscription = asRecord$13(obj["subscription"]);
65988
+ const subscription = asRecord$14(obj["subscription"]);
65989
65989
  if (subscription) {
65990
65990
  const label = readNestedPlanLabelFromRecord(subscription);
65991
65991
  if (label) return label;
65992
- const subscriptionPlan = asRecord$13(subscription["plan"]);
65992
+ const subscriptionPlan = asRecord$14(subscription["plan"]);
65993
65993
  if (subscriptionPlan) {
65994
65994
  const nestedLabel = readNestedPlanLabelFromRecord(subscriptionPlan);
65995
65995
  if (nestedLabel) return nestedLabel;
65996
65996
  }
65997
65997
  }
65998
- const billing = asRecord$13(obj["billing"]);
65998
+ const billing = asRecord$14(obj["billing"]);
65999
65999
  if (billing) {
66000
66000
  const label = readNestedPlanLabelFromRecord(billing);
66001
66001
  if (label) return label;
66002
- const billingPlan = asRecord$13(billing["plan"]);
66002
+ const billingPlan = asRecord$14(billing["plan"]);
66003
66003
  if (billingPlan) return readNestedPlanLabelFromRecord(billingPlan);
66004
66004
  }
66005
66005
  return null;
@@ -69794,22 +69794,22 @@ const EMPTY_PARSED_ERROR = {
69794
69794
  message: null,
69795
69795
  raw: null
69796
69796
  };
69797
- function asRecord$12(value) {
69797
+ function asRecord$13(value) {
69798
69798
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
69799
69799
  }
69800
69800
  function readTrimmedString$1(value) {
69801
69801
  return (typeof value === "string" ? value.trim() : "") || null;
69802
69802
  }
69803
69803
  function readErrorEnvelope(record) {
69804
- return asRecord$12(record["error"]);
69804
+ return asRecord$13(record["error"]);
69805
69805
  }
69806
69806
  function readUpstreamErrorCode(body) {
69807
- const record = asRecord$12(body);
69807
+ const record = asRecord$13(body);
69808
69808
  if (record === null) return null;
69809
69809
  return readTrimmedString$1(record["code"]) ?? readTrimmedString$1(readErrorEnvelope(record)?.["code"]);
69810
69810
  }
69811
69811
  function readErrorMessage$2(raw) {
69812
- const record = asRecord$12(raw);
69812
+ const record = asRecord$13(raw);
69813
69813
  if (record === null) return null;
69814
69814
  const error = record["error"];
69815
69815
  const nestedMessage = readErrorEnvelope(record)?.["message"];
@@ -71891,7 +71891,7 @@ function readStringJS(length) {
71891
71891
  if (units.length > 0) result += fromCharCode.apply(String, units);
71892
71892
  return result;
71893
71893
  }
71894
- function readString$4(source, start, length) {
71894
+ function readString$5(source, start, length) {
71895
71895
  let existingSrc = src;
71896
71896
  src = source;
71897
71897
  position$1 = start;
@@ -73756,7 +73756,7 @@ function readStruct(src, position, srcEnd, unpackr) {
73756
73756
  }
73757
73757
  if (end == null) end = source.bytesEnd - refStart;
73758
73758
  if (source.srcString) return source.srcString.slice(ref, end);
73759
- return readString$4(src, ref + refStart, end - ref);
73759
+ return readString$5(src, ref + refStart, end - ref);
73760
73760
  };
73761
73761
  break;
73762
73762
  case UTF8:
@@ -77105,7 +77105,7 @@ succeed$2(TraceDiagnostics, TraceDiagnostics.of({ read: (options) => succeed(mak
77105
77105
  * through the server is what lets it ask at all.
77106
77106
  */
77107
77107
  const RUNTIMES_PATH = "/api/forge/context/runtimes";
77108
- function asRecord$11(value) {
77108
+ function asRecord$12(value) {
77109
77109
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
77110
77110
  }
77111
77111
  /** A trimmed string, or null. Empty and whitespace are the same as absent. */
@@ -77120,7 +77120,7 @@ function text$1(value) {
77120
77120
  * something that cannot work.
77121
77121
  */
77122
77122
  function toSummary(value) {
77123
- const row = asRecord$11(value);
77123
+ const row = asRecord$12(value);
77124
77124
  if (!row) return null;
77125
77125
  const runtimeId = text$1(row["runtimeId"]);
77126
77126
  const organizationId = row["organizationId"];
@@ -77144,7 +77144,7 @@ function listCloudRuntimes(input) {
77144
77144
  return gen(function* () {
77145
77145
  const jwt = input.jwt;
77146
77146
  if (jwt === null || jwt.trim().length === 0) return yield* fail(new CloudRuntimeListError({ failure: "not_signed_in" }));
77147
- const runtimes = asRecord$11(asRecord$11(yield* tryPromise({
77147
+ const runtimes = asRecord$12(asRecord$12(yield* tryPromise({
77148
77148
  try: () => input.request({
77149
77149
  method: "GET",
77150
77150
  jwt,
@@ -77433,10 +77433,10 @@ function updateSuccessfulEntry(input) {
77433
77433
  return next;
77434
77434
  }
77435
77435
  const makeSourceControlRateLimit = gen(function* () {
77436
- const entries = yield* make$49(/* @__PURE__ */ new Map());
77436
+ const entries = yield* make$50(/* @__PURE__ */ new Map());
77437
77437
  const check = fn$1("SourceControlRateLimit.check")(function* (input, options) {
77438
77438
  const now = yield* currentTimeMillis;
77439
- const entry = (yield* get$5(entries)).get(normalizedKey(input));
77439
+ const entry = (yield* get$6(entries)).get(normalizedKey(input));
77440
77440
  if (entry !== void 0 && entry.retryAt > now && options?.allowPaused !== true) return yield* new SourceControlRateLimitPausedError$1({
77441
77441
  provider: input.provider,
77442
77442
  host: input.host.trim().toLowerCase(),
@@ -82423,7 +82423,7 @@ const makePullRequestService = gen(function* () {
82423
82423
  const staleList = staleWhileRevalidate(LIST_STALE_WINDOW, LIST_CACHE_CAPACITY);
82424
82424
  const list = (input) => {
82425
82425
  const key = listCacheKey(input, listingsEpoch);
82426
- return staleList(key, get$7(listCache, key));
82426
+ return staleList(key, get$8(listCache, key));
82427
82427
  };
82428
82428
  const detailCache = yield* makeWith$1((key) => {
82429
82429
  const [, projectId, repository, number] = JSON.parse(key);
@@ -82444,7 +82444,7 @@ const makePullRequestService = gen(function* () {
82444
82444
  input.repository,
82445
82445
  input.number
82446
82446
  ]);
82447
- return staleDetail(key, get$7(detailCache, key));
82447
+ return staleDetail(key, get$8(detailCache, key));
82448
82448
  };
82449
82449
  const activityCache = yield* makeWith$1((key) => {
82450
82450
  const [, projectId, repository, number] = JSON.parse(key);
@@ -82465,7 +82465,7 @@ const makePullRequestService = gen(function* () {
82465
82465
  input.repository,
82466
82466
  input.number
82467
82467
  ]);
82468
- return staleActivity(key, get$7(activityCache, key));
82468
+ return staleActivity(key, get$8(activityCache, key));
82469
82469
  };
82470
82470
  const diffCache = yield* makeWith$1((key) => {
82471
82471
  const [, projectId, repository, number, cursor, commit] = JSON.parse(key);
@@ -82493,7 +82493,7 @@ const makePullRequestService = gen(function* () {
82493
82493
  input.cursor ?? null,
82494
82494
  input.commit ?? null
82495
82495
  ]);
82496
- return staleDiff(key, get$7(diffCache, key));
82496
+ return staleDiff(key, get$8(diffCache, key));
82497
82497
  };
82498
82498
  const listStatsCache = yield* makeWith$1((key) => {
82499
82499
  const [, refs] = JSON.parse(key);
@@ -82514,7 +82514,7 @@ const makePullRequestService = gen(function* () {
82514
82514
  ref.repository,
82515
82515
  ref.number
82516
82516
  ]).toSorted((left, right) => `${left[0]} ${left[1]} ${left[2]}`.localeCompare(`${right[0]} ${right[1]} ${right[2]}`))]);
82517
- return staleListStats(key, get$7(listStatsCache, key));
82517
+ return staleListStats(key, get$8(listStatsCache, key));
82518
82518
  };
82519
82519
  const invalidate = (input) => sync$1(() => {
82520
82520
  if (input.reference === void 0) {
@@ -82632,12 +82632,12 @@ function resolveGithubWriteIdentity(getSettings) {
82632
82632
  }
82633
82633
  var ServerSettingsService = class ServerSettingsService extends Service$1()("forge/serverSettings/ServerSettingsService") {
82634
82634
  static layerTest = (overrides = {}) => effect(ServerSettingsService, gen(function* () {
82635
- const currentSettingsRef = yield* make$49(deepMerge$1(DEFAULT_SERVER_SETTINGS, overrides));
82635
+ const currentSettingsRef = yield* make$50(deepMerge$1(DEFAULT_SERVER_SETTINGS, overrides));
82636
82636
  return {
82637
82637
  start: void_$1,
82638
82638
  ready: void_$1,
82639
- getSettings: get$5(currentSettingsRef),
82640
- updateSettings: (patch) => get$5(currentSettingsRef).pipe(map$3((currentSettings) => deepMerge$1(currentSettings, patch)), tap((nextSettings) => set$2(currentSettingsRef, nextSettings))),
82639
+ getSettings: get$6(currentSettingsRef),
82640
+ updateSettings: (patch) => get$6(currentSettingsRef).pipe(map$3((currentSettings) => deepMerge$1(currentSettings, patch)), tap((nextSettings) => set$2(currentSettingsRef, nextSettings))),
82641
82641
  streamChanges: empty$5
82642
82642
  };
82643
82643
  }));
@@ -82693,7 +82693,7 @@ const ServerSettingsLive = effect(ServerSettingsService, gen(function* () {
82693
82693
  const writeSemaphore = yield* make$43(1);
82694
82694
  const cacheKey = "settings";
82695
82695
  const changesPubSub = yield* unbounded$1();
82696
- const startedRef = yield* make$49(false);
82696
+ const startedRef = yield* make$50(false);
82697
82697
  const startedDeferred = yield* make$39();
82698
82698
  const watcherScope = yield* make$37("sequential");
82699
82699
  yield* addFinalizer$2(() => close(watcherScope, void_$3));
@@ -82721,11 +82721,11 @@ const ServerSettingsLive = effect(ServerSettingsService, gen(function* () {
82721
82721
  }
82722
82722
  return decoded.value;
82723
82723
  });
82724
- const settingsCache = yield* make$50({
82724
+ const settingsCache = yield* make$51({
82725
82725
  capacity: 1,
82726
82726
  lookup: () => loadSettingsFromDisk
82727
82727
  });
82728
- const getSettingsFromCache = get$7(settingsCache, cacheKey);
82728
+ const getSettingsFromCache = get$8(settingsCache, cacheKey);
82729
82729
  const writeSettingsAtomically = (settings) => {
82730
82730
  const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
82731
82731
  const sparseSettings = stripDefaultServerSettings(settings, DEFAULT_SERVER_SETTINGS) ?? {};
@@ -91522,7 +91522,7 @@ const KeybindingsLive = effect(Keybindings, gen(function* () {
91522
91522
  const upsertSemaphore = yield* make$43(1);
91523
91523
  const resolvedConfigCacheKey = "resolved";
91524
91524
  const changesPubSub = yield* unbounded$1();
91525
- const startedRef = yield* make$49(false);
91525
+ const startedRef = yield* make$50(false);
91526
91526
  const startedDeferred = yield* make$39();
91527
91527
  const watcherScope = yield* make$37("sequential");
91528
91528
  yield* addFinalizer$2(() => close(watcherScope, void_$3));
@@ -91622,11 +91622,11 @@ const KeybindingsLive = effect(Keybindings, gen(function* () {
91622
91622
  keybindings: mergeWithDefaultKeybindings(compileResolvedKeybindingsConfig(keybindings)),
91623
91623
  issues
91624
91624
  })));
91625
- const resolvedConfigCache = yield* make$50({
91625
+ const resolvedConfigCache = yield* make$51({
91626
91626
  capacity: 1,
91627
91627
  lookup: () => loadConfigStateFromDisk
91628
91628
  });
91629
- const loadConfigStateFromCacheOrDisk = get$7(resolvedConfigCache, resolvedConfigCacheKey);
91629
+ const loadConfigStateFromCacheOrDisk = get$8(resolvedConfigCache, resolvedConfigCacheKey);
91630
91630
  const revalidateAndEmit = upsertSemaphore.withPermits(1)(gen(function* () {
91631
91631
  yield* invalidate(resolvedConfigCache, resolvedConfigCacheKey);
91632
91632
  yield* emitChange(yield* loadConfigStateFromCacheOrDisk);
@@ -91706,7 +91706,7 @@ const KeybindingsLive = effect(Keybindings, gen(function* () {
91706
91706
  });
91707
91707
  return {
91708
91708
  start: gen(function* () {
91709
- if (yield* get$5(startedRef)) return yield* _await(startedDeferred);
91709
+ if (yield* get$6(startedRef)) return yield* _await(startedDeferred);
91710
91710
  yield* set$2(startedRef, true);
91711
91711
  const startupExit = yield* exit(gen(function* () {
91712
91712
  yield* startWatcher;
@@ -92550,7 +92550,7 @@ var ProviderRegistry = class extends Service$1()("forge/provider/Services/Provid
92550
92550
  var ServerLifecycleEvents = class extends Service$1()("forge/serverLifecycleEvents") {};
92551
92551
  const ServerLifecycleEventsLive = effect(ServerLifecycleEvents, gen(function* () {
92552
92552
  const pubsub = yield* unbounded$1();
92553
- const state = yield* make$49({
92553
+ const state = yield* make$50({
92554
92554
  sequence: 0,
92555
92555
  events: []
92556
92556
  });
@@ -92566,7 +92566,7 @@ const ServerLifecycleEventsLive = effect(ServerLifecycleEvents, gen(function* ()
92566
92566
  events: nextEvent.type === "welcome" ? [nextEvent, ...current.events.filter((entry) => entry.type !== "welcome")] : [nextEvent, ...current.events.filter((entry) => entry.type !== "ready")]
92567
92567
  }];
92568
92568
  }).pipe(tap((event) => publish(pubsub, event))),
92569
- snapshot: get$5(state),
92569
+ snapshot: get$6(state),
92570
92570
  get stream() {
92571
92571
  return fromPubSub(pubsub);
92572
92572
  }
@@ -97847,10 +97847,10 @@ const runUsageScanWarmup = (options) => gen(function* () {
97847
97847
  const now = options.now ?? currentTimeMillis;
97848
97848
  const startDelayMs = options.startDelayMs ?? 2e4;
97849
97849
  const intervalMs = options.intervalMs ?? 36e5;
97850
- const scanning = yield* make$49(false);
97850
+ const scanning = yield* make$50(false);
97851
97851
  yield* sleep(startDelayMs);
97852
97852
  return yield* forever$1(gen(function* () {
97853
- if (yield* get$5(scanning)) yield* logInfo("usage scan warm-up skipped; the previous scan is still running");
97853
+ if (yield* get$6(scanning)) yield* logInfo("usage scan warm-up skipped; the previous scan is still running");
97854
97854
  else {
97855
97855
  yield* set$2(scanning, true);
97856
97856
  yield* forkChild(scanOnce(options, now).pipe(ensuring(set$2(scanning, false))));
@@ -97866,7 +97866,7 @@ const settleQueuedCommand = (deferred, exit) => isSuccess(exit) ? succeed$3(defe
97866
97866
  const makeCommandGate = gen(function* () {
97867
97867
  const commandReady = yield* make$39();
97868
97868
  const commandQueue = yield* unbounded$2();
97869
- const commandReadinessState = yield* make$49("pending");
97869
+ const commandReadinessState = yield* make$50("pending");
97870
97870
  yield* forkScoped(forever$1(take$1(commandQueue).pipe(flatMap((command) => command.run))));
97871
97871
  return {
97872
97872
  awaitCommandReady: _await(commandReady),
@@ -97879,7 +97879,7 @@ const makeCommandGate = gen(function* () {
97879
97879
  yield* fail$3(commandReady, error).pipe(orDie);
97880
97880
  }),
97881
97881
  enqueueCommand: (effect) => gen(function* () {
97882
- const readinessState = yield* get$5(commandReadinessState);
97882
+ const readinessState = yield* get$6(commandReadinessState);
97883
97883
  if (readinessState === "ready") return yield* effect;
97884
97884
  if (readinessState !== "pending") return yield* readinessState;
97885
97885
  const result = yield* make$39();
@@ -99238,19 +99238,19 @@ function previewUrlForPort(port) {
99238
99238
  return `http://127.0.0.1:${port}/`;
99239
99239
  }
99240
99240
  const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
99241
- const byThreadId = yield* make$49(/* @__PURE__ */ new Map());
99242
- const usedPorts = yield* make$49(/* @__PURE__ */ new Set());
99241
+ const byThreadId = yield* make$50(/* @__PURE__ */ new Map());
99242
+ const usedPorts = yield* make$50(/* @__PURE__ */ new Set());
99243
99243
  const allocateNextPort = gen(function* () {
99244
- const used = yield* get$5(usedPorts);
99244
+ const used = yield* get$6(usedPorts);
99245
99245
  for (let port = DEFAULT_PORT_MIN; port <= DEFAULT_PORT_MAX; port += 1) if (!used.has(port)) return port;
99246
99246
  return yield* new ThreadDevRuntimeError({ detail: `No dev ports available in range ${DEFAULT_PORT_MIN}-${DEFAULT_PORT_MAX}.` });
99247
99247
  });
99248
99248
  return {
99249
99249
  get: (input) => gen(function* () {
99250
- return (yield* get$5(byThreadId)).get(input.threadId) ?? null;
99250
+ return (yield* get$6(byThreadId)).get(input.threadId) ?? null;
99251
99251
  }),
99252
99252
  allocatePort: (input) => gen(function* () {
99253
- const existing = (yield* get$5(byThreadId)).get(input.threadId);
99253
+ const existing = (yield* get$6(byThreadId)).get(input.threadId);
99254
99254
  if (existing && existing.status !== "released") return existing;
99255
99255
  const port = yield* allocateNextPort;
99256
99256
  const record = {
@@ -99273,7 +99273,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
99273
99273
  return record;
99274
99274
  }),
99275
99275
  release: (input) => gen(function* () {
99276
- const existing = (yield* get$5(byThreadId)).get(input.threadId);
99276
+ const existing = (yield* get$6(byThreadId)).get(input.threadId);
99277
99277
  if (!existing) return;
99278
99278
  yield* update$4(byThreadId, (current) => {
99279
99279
  const next = new Map(current);
@@ -99291,7 +99291,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
99291
99291
  });
99292
99292
  }),
99293
99293
  setRunning: (threadId, patch) => gen(function* () {
99294
- const existing = (yield* get$5(byThreadId)).get(threadId);
99294
+ const existing = (yield* get$6(byThreadId)).get(threadId);
99295
99295
  if (!existing && patch.allocatedPort === void 0) return yield* new ThreadDevRuntimeError({ detail: `No dev runtime record for thread ${threadId}.` });
99296
99296
  const allocatedPort = patch.allocatedPort ?? existing?.allocatedPort;
99297
99297
  if (allocatedPort === void 0) return yield* new ThreadDevRuntimeError({ detail: `No dev runtime port is available for thread ${threadId}.` });
@@ -100501,7 +100501,7 @@ const EMPTY_PLAN_VALUES = new Set([
100501
100501
  "none",
100502
100502
  "null"
100503
100503
  ]);
100504
- function asRecord$10(value) {
100504
+ function asRecord$11(value) {
100505
100505
  if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
100506
100506
  return value;
100507
100507
  }
@@ -100518,7 +100518,7 @@ function decodeJwtClaims(token) {
100518
100518
  try {
100519
100519
  const decoded = Buffer.from(payload, "base64url");
100520
100520
  if (decoded.byteLength > MAX_CLAIMS_BYTES) return void 0;
100521
- return asRecord$10(JSON.parse(decoded.toString("utf8")));
100521
+ return asRecord$11(JSON.parse(decoded.toString("utf8")));
100522
100522
  } catch {
100523
100523
  return;
100524
100524
  }
@@ -100540,7 +100540,7 @@ function findPlanType(claims) {
100540
100540
  const direct = fromRecord(claims);
100541
100541
  if (direct) return direct;
100542
100542
  for (const value of Object.values(claims)) {
100543
- const nested = asRecord$10(value);
100543
+ const nested = asRecord$11(value);
100544
100544
  if (!nested) continue;
100545
100545
  const found = fromRecord(nested);
100546
100546
  if (found) return found;
@@ -100557,7 +100557,7 @@ function readCodexAuthIdentity(authJson) {
100557
100557
  } catch {
100558
100558
  return {};
100559
100559
  }
100560
- const claims = decodeJwtClaims(asRecord$10(asRecord$10(parsed)?.tokens)?.id_token);
100560
+ const claims = decodeJwtClaims(asRecord$11(asRecord$11(parsed)?.tokens)?.id_token);
100561
100561
  if (!claims) return {};
100562
100562
  const email = findEmail(claims);
100563
100563
  const planType = findPlanType(claims);
@@ -105075,7 +105075,7 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(g
105075
105075
  }), { "rpc.aggregate": "server" }),
105076
105076
  [WS_METHODS.subscribeAuthAccess]: (_input) => observeRpcStreamEffect(WS_METHODS.subscribeAuthAccess, gen(function* () {
105077
105077
  const initialSnapshot = yield* loadAuthAccessSnapshot();
105078
- const revisionRef = yield* make$49(1);
105078
+ const revisionRef = yield* make$50(1);
105079
105079
  const liveEvents = merge$4(bootstrapCredentials.streamChanges, sessions.streamChanges).pipe(mapEffect$1((change) => updateAndGet(revisionRef, (revision) => revision + 1).pipe(map$3((revision) => toAuthAccessStreamEvent(change, revision, currentSessionId)))));
105080
105080
  return concat$2(make$45({
105081
105081
  version: 1,
@@ -112410,7 +112410,7 @@ const makeWith = /* @__PURE__ */ fnUntraced(function* (options) {
112410
112410
  const compiler = makeCompiler(options.transformQueryNames, options.transformJson);
112411
112411
  const transformRows = options.transformResultNames ? defaultTransforms(options.transformResultNames, options.transformJson).array : void 0;
112412
112412
  const config = options.config;
112413
- return Object.assign(yield* make$51({
112413
+ return Object.assign(yield* make$52({
112414
112414
  acquirer: options.acquirer,
112415
112415
  transactionAcquirer: options.transactionAcquirer,
112416
112416
  compiler,
@@ -116161,8 +116161,8 @@ effectDiscard(runMigrations());
116161
116161
  //#endregion
116162
116162
  //#region src/persistence/Layers/Sqlite.ts
116163
116163
  const defaultSqliteClientLoaders = {
116164
- bun: () => import("./SqliteClient-DdItRZUr.mjs"),
116165
- node: () => import("./NodeSqliteClient-BqUcml1B.mjs")
116164
+ bun: () => import("./SqliteClient-CIsITMoQ.mjs"),
116165
+ node: () => import("./NodeSqliteClient-DGInbxQ3.mjs")
116166
116166
  };
116167
116167
  const makeRuntimeSqliteLayer = fn$1("makeRuntimeSqliteLayer")(function* (config) {
116168
116168
  const loader = defaultSqliteClientLoaders[process.versions.bun !== void 0 ? "bun" : "node"];
@@ -147374,7 +147374,7 @@ const AnalyticsServiceLayerLive = effect(AnalyticsService, gen(function* () {
147374
147374
  const httpClient = yield* HttpClient;
147375
147375
  const serverConfig = yield* ServerConfig;
147376
147376
  const identifier = yield* getTelemetryIdentifier;
147377
- const bufferRef = yield* make$49([]);
147377
+ const bufferRef = yield* make$50([]);
147378
147378
  const clientType = serverConfig.mode === "desktop" ? "desktop-app" : "cli-web-client";
147379
147379
  const enqueueBufferedEvent = (event, properties) => flatMap(now, (now) => modify$3(bufferRef, (current) => {
147380
147380
  const appended = [...current, {
@@ -149004,11 +149004,11 @@ function readObject(value) {
149004
149004
  function readArray(value) {
149005
149005
  return Array.isArray(value) ? value : void 0;
149006
149006
  }
149007
- function readString$3(value) {
149007
+ function readString$4(value) {
149008
149008
  return typeof value === "string" ? value : void 0;
149009
149009
  }
149010
149010
  function nonEmptyTrimmed$1(value) {
149011
- const candidate = readString$3(value)?.trim();
149011
+ const candidate = readString$4(value)?.trim();
149012
149012
  return candidate ? candidate : void 0;
149013
149013
  }
149014
149014
  function readBoolean$2(value) {
@@ -149790,6 +149790,23 @@ function issueCmmdLocalUserProviderEgressCredential(input) {
149790
149790
  });
149791
149791
  }
149792
149792
  //#endregion
149793
+ //#region src/provider/codexAccountTransition.ts
149794
+ function explicitProviderAccountTransition(fromAccountId, toAccountId) {
149795
+ if (!fromAccountId || !toAccountId || fromAccountId === toAccountId) return void 0;
149796
+ return {
149797
+ fromAccountId,
149798
+ toAccountId
149799
+ };
149800
+ }
149801
+ function permitsCodexAccountTransition(input) {
149802
+ const { transition, requestedAccountId, prior, current } = input;
149803
+ if (!transition || transition.fromAccountId === transition.toAccountId || transition.toAccountId !== requestedAccountId || prior.identity.kind !== "provider_account" || current.identity.kind !== "provider_account" || prior.identity.provider !== "codex" || current.identity.provider !== "codex") return false;
149804
+ return providerDeliveryBindingsEqual({
149805
+ ...prior,
149806
+ identity: current.identity
149807
+ }, current);
149808
+ }
149809
+ //#endregion
149793
149810
  //#region src/providerAuth/codexLocalAccountIdentity.ts
149794
149811
  const ACCOUNT_IDENTITY_PATH = "/api/forge/context/providers/codex/account-identity";
149795
149812
  const PROVIDER_ACCOUNT_IDENTITY$1 = /^pai_v1_[A-Za-z0-9_-]{43}$/;
@@ -150287,7 +150304,12 @@ var CodexAppServerManager = class extends EventEmitter$1 {
150287
150304
  const rawPriorDeliveryBinding = input.resumeCursor.providerDeliveryBinding;
150288
150305
  const priorDeliveryBinding = readProviderDeliveryBinding(rawPriorDeliveryBinding);
150289
150306
  if (rawPriorDeliveryBinding !== void 0 && rawPriorDeliveryBinding !== null && !priorDeliveryBinding) throw new Error("Existing Codex history cannot resume because its persisted delivered provider account binding is unreadable.");
150290
- if (priorDeliveryBinding && !providerDeliveryBindingsEqual(priorDeliveryBinding, currentDeliveryBinding)) throw new Error("Existing Codex history cannot resume because the delivered provider account changed.");
150307
+ if (priorDeliveryBinding && !providerDeliveryBindingsEqual(priorDeliveryBinding, currentDeliveryBinding) && !permitsCodexAccountTransition({
150308
+ transition: input.accountTransition,
150309
+ requestedAccountId: input.providerAccountId,
150310
+ prior: priorDeliveryBinding,
150311
+ current: currentDeliveryBinding
150312
+ })) throw new Error("Existing Codex history cannot resume because the delivered provider account changed.");
150291
150313
  }
150292
150314
  const initialResumeCursor = initialCodexResumeCursor({
150293
150315
  resumeCursor: input.resumeCursor,
@@ -206501,7 +206523,7 @@ function createCodexBrowserDynamicTools() {
206501
206523
  function readArgs$3(value) {
206502
206524
  return value && typeof value === "object" ? value : {};
206503
206525
  }
206504
- function readString$2(args, key) {
206526
+ function readString$3(args, key) {
206505
206527
  const value = args[key];
206506
206528
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
206507
206529
  }
@@ -206530,27 +206552,27 @@ function createCodexBrowserDynamicToolHandler(browserManager, options = {}) {
206530
206552
  const toolScope = options.environmentId === void 0 ? {} : { environmentId: options.environmentId };
206531
206553
  const handlers = makeBrowserHandlers(browserManager, ThreadId.make(input.threadId), toolScope);
206532
206554
  const args = readArgs$3(input.arguments);
206533
- const tabId = readString$2(args, "tabId");
206555
+ const tabId = readString$3(args, "tabId");
206534
206556
  switch (input.tool) {
206535
206557
  case "forge_browser_list_sessions": return toCodexDynamicToolResult$2(await handlers.listSessions());
206536
206558
  case "forge_browser_name_session": {
206537
- const name = readString$2(args, "name");
206559
+ const name = readString$3(args, "name");
206538
206560
  if (!name) throw new Error("forge_browser_name_session requires a name.");
206539
206561
  return toCodexDynamicToolResult$2(await handlers.nameSession(name));
206540
206562
  }
206541
206563
  case "forge_browser_set_visibility": {
206542
- const visibility = readString$2(args, "visibility");
206564
+ const visibility = readString$3(args, "visibility");
206543
206565
  if (visibility !== "hidden" && visibility !== "visible") throw new Error("forge_browser_set_visibility requires visibility hidden or visible.");
206544
206566
  return toCodexDynamicToolResult$2(await handlers.setVisibility(visibility));
206545
206567
  }
206546
206568
  case "forge_browser_close_session":
206547
206569
  case "forge_browser_reset_session": return toCodexDynamicToolResult$2(await handlers.closeSession());
206548
206570
  case "forge_browser_navigate": {
206549
- const url = readString$2(args, "url");
206571
+ const url = readString$3(args, "url");
206550
206572
  if (!url) throw new Error("forge_browser_navigate requires a URL.");
206551
206573
  return toCodexDynamicToolResult$2(await handlers.navigate(url, tabId));
206552
206574
  }
206553
- case "forge_browser_new_tab": return toCodexDynamicToolResult$2(await handlers.newTab(readString$2(args, "url")));
206575
+ case "forge_browser_new_tab": return toCodexDynamicToolResult$2(await handlers.newTab(readString$3(args, "url")));
206554
206576
  case "forge_browser_close_tab":
206555
206577
  if (!tabId) throw new Error("forge_browser_close_tab requires a tabId.");
206556
206578
  return toCodexDynamicToolResult$2(await handlers.closeTab(tabId));
@@ -206561,33 +206583,33 @@ function createCodexBrowserDynamicToolHandler(browserManager, options = {}) {
206561
206583
  case "forge_browser_go_forward": return toCodexDynamicToolResult$2(await handlers.goForward(tabId));
206562
206584
  case "forge_browser_reload": return toCodexDynamicToolResult$2(await handlers.reload(tabId));
206563
206585
  case "forge_browser_click": {
206564
- const selector = readString$2(args, "selector");
206586
+ const selector = readString$3(args, "selector");
206565
206587
  if (!selector) throw new Error("forge_browser_click requires a selector.");
206566
206588
  return toCodexDynamicToolResult$2(await handlers.click(selector, tabId));
206567
206589
  }
206568
206590
  case "forge_browser_click_point": {
206569
206591
  const x = readNumber$2(args, "x");
206570
206592
  const y = readNumber$2(args, "y");
206571
- const button = readString$2(args, "button");
206593
+ const button = readString$3(args, "button");
206572
206594
  const clickCount = readNumber$2(args, "clickCount");
206573
206595
  if (x === void 0 || y === void 0) throw new Error("forge_browser_click_point requires x and y.");
206574
206596
  if (button !== void 0 && button !== "left" && button !== "middle" && button !== "right") throw new Error("forge_browser_click_point requires button left, middle, or right.");
206575
206597
  return toCodexDynamicToolResult$2(await handlers.clickPoint(x, y, button, clickCount, tabId));
206576
206598
  }
206577
206599
  case "forge_browser_type": {
206578
- const selector = readString$2(args, "selector");
206600
+ const selector = readString$3(args, "selector");
206579
206601
  if (!selector) throw new Error("forge_browser_type requires a selector.");
206580
- const text = readString$2(args, "text");
206602
+ const text = readString$3(args, "text");
206581
206603
  if (text === void 0) throw new Error("forge_browser_type requires text.");
206582
206604
  return toCodexDynamicToolResult$2(await handlers.type(selector, text, readBoolean$1(args, "append"), tabId));
206583
206605
  }
206584
206606
  case "forge_browser_type_text": {
206585
- const text = readString$2(args, "text");
206607
+ const text = readString$3(args, "text");
206586
206608
  if (text === void 0) throw new Error("forge_browser_type_text requires text.");
206587
206609
  return toCodexDynamicToolResult$2(await handlers.typeText(text, readBoolean$1(args, "pressEnter"), tabId));
206588
206610
  }
206589
206611
  case "forge_browser_press_key": {
206590
- const key = readString$2(args, "key");
206612
+ const key = readString$3(args, "key");
206591
206613
  if (!key) throw new Error("forge_browser_press_key requires a key.");
206592
206614
  return toCodexDynamicToolResult$2(await handlers.pressKey(key, tabId));
206593
206615
  }
@@ -206901,7 +206923,7 @@ function createCodexComputerDynamicToolHandler(computerManager) {
206901
206923
  function readArgs$1(value) {
206902
206924
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
206903
206925
  }
206904
- function readString$1(args, key) {
206926
+ function readString$2(args, key) {
206905
206927
  const value = args[key];
206906
206928
  return typeof value === "string" ? value : void 0;
206907
206929
  }
@@ -206921,7 +206943,7 @@ function readStringArray(args, key) {
206921
206943
  return value.filter((entry) => typeof entry === "string");
206922
206944
  }
206923
206945
  function readRequiredString(args, key, toolName) {
206924
- const value = readString$1(args, key)?.trim();
206946
+ const value = readString$2(args, key)?.trim();
206925
206947
  if (!value) throw new Error(`${toolName} requires ${key}.`);
206926
206948
  return value;
206927
206949
  }
@@ -206956,7 +206978,7 @@ async function runGitHubLifecycleTool(toolName, context) {
206956
206978
  action,
206957
206979
  args: lifecycleArgs,
206958
206980
  mode
206959
- }), mode === "write" ? readString$1(args, "confirmationId") : void 0);
206981
+ }), mode === "write" ? readString$2(args, "confirmationId") : void 0);
206960
206982
  }
206961
206983
  //#endregion
206962
206984
  //#region src/github/GitHubCodexPullRequestTools.ts
@@ -206966,8 +206988,8 @@ async function runGitHubPullRequestTool(toolName, context) {
206966
206988
  case "forge_github_create_pull_request": {
206967
206989
  const cwd = readRequiredString(args, "cwd", toolName);
206968
206990
  const title = readRequiredString(args, "title", toolName);
206969
- const body = readString$1(args, "body");
206970
- const headBranch = readString$1(args, "headBranch")?.trim();
206991
+ const body = readString$2(args, "body");
206992
+ const headBranch = readString$2(args, "headBranch")?.trim();
206971
206993
  if (body === void 0) throw new Error("forge_github_create_pull_request requires body.");
206972
206994
  const request = {
206973
206995
  cwd,
@@ -206976,7 +206998,7 @@ async function runGitHubPullRequestTool(toolName, context) {
206976
206998
  baseBranch: readRequiredString(args, "baseBranch", toolName),
206977
206999
  ...headBranch ? { headBranch } : {}
206978
207000
  };
206979
- return runTool(request, () => broker.createPullRequest(auth, request), readString$1(args, "confirmationId"));
207001
+ return runTool(request, () => broker.createPullRequest(auth, request), readString$2(args, "confirmationId"));
206980
207002
  }
206981
207003
  case "forge_github_get_pull_request": {
206982
207004
  const cwd = readRequiredString(args, "cwd", toolName);
@@ -206998,29 +207020,29 @@ function runStatus$1({ auth, broker, runTool }) {
206998
207020
  return runTool({}, () => broker.status(auth));
206999
207021
  }
207000
207022
  function runListRepositories({ args, auth, broker, runTool }) {
207001
- const search = readString$1(args, "search");
207023
+ const search = readString$2(args, "search");
207002
207024
  return runTool({ search: search ?? null }, () => broker.listRepositories(auth, { search }));
207003
207025
  }
207004
207026
  function runCloneRepository({ args, auth, broker, runTool }) {
207005
207027
  const toolName = "forge_github_clone_repository";
207006
207028
  const repoFullName = readRequiredString(args, "repoFullName", toolName);
207007
207029
  const destination = readRequiredString(args, "destination", toolName);
207008
- const branch = readString$1(args, "branch");
207030
+ const branch = readString$2(args, "branch");
207009
207031
  const request = {
207010
207032
  repoFullName,
207011
207033
  destination,
207012
207034
  ...branch ? { branch } : {}
207013
207035
  };
207014
- return runTool(request, () => broker.cloneRepository(auth, request), readString$1(args, "confirmationId"));
207036
+ return runTool(request, () => broker.cloneRepository(auth, request), readString$2(args, "confirmationId"));
207015
207037
  }
207016
207038
  function runCreateRepository({ args, auth, broker, runTool }) {
207017
207039
  const toolName = "forge_github_create_repository";
207018
207040
  const owner = readRequiredString(args, "owner", toolName);
207019
207041
  const name = readRequiredString(args, "name", toolName);
207020
- const visibility = readString$1(args, "visibility");
207042
+ const visibility = readString$2(args, "visibility");
207021
207043
  if (visibility !== void 0 && visibility !== "private" && visibility !== "public") throw new Error("forge_github_create_repository visibility must be private or public.");
207022
207044
  const repositoryVisibility = visibility;
207023
- const description = readString$1(args, "description");
207045
+ const description = readString$2(args, "description");
207024
207046
  const request = {
207025
207047
  owner,
207026
207048
  name,
@@ -207028,32 +207050,32 @@ function runCreateRepository({ args, auth, broker, runTool }) {
207028
207050
  ...repositoryVisibility ? { visibility: repositoryVisibility } : {},
207029
207051
  ...description !== void 0 ? { description } : {}
207030
207052
  };
207031
- return runTool(request, () => broker.createRepository(auth, request), readString$1(args, "confirmationId"));
207053
+ return runTool(request, () => broker.createRepository(auth, request), readString$2(args, "confirmationId"));
207032
207054
  }
207033
207055
  function runLinkProjectRepository({ args, auth, broker, runTool }) {
207034
207056
  const toolName = "forge_github_link_project_repository";
207035
207057
  const cwd = readRequiredString(args, "cwd", toolName);
207036
207058
  const repoFullName = readRequiredString(args, "repoFullName", toolName);
207037
- const branch = readString$1(args, "branch");
207059
+ const branch = readString$2(args, "branch");
207038
207060
  const request = {
207039
207061
  cwd,
207040
207062
  repoFullName,
207041
207063
  ...branch ? { branch } : {}
207042
207064
  };
207043
- return runTool(request, () => broker.linkProjectRepository(auth, request), readString$1(args, "confirmationId"));
207065
+ return runTool(request, () => broker.linkProjectRepository(auth, request), readString$2(args, "confirmationId"));
207044
207066
  }
207045
207067
  function runPushBranch({ args, auth, broker, runTool }) {
207046
207068
  const cwd = readRequiredString(args, "cwd", "forge_github_push_branch");
207047
- const branch = readString$1(args, "branch");
207069
+ const branch = readString$2(args, "branch");
207048
207070
  const request = {
207049
207071
  cwd,
207050
207072
  ...branch ? { branch } : {}
207051
207073
  };
207052
- return runTool(request, () => broker.pushProjectBranch(auth, request), readString$1(args, "confirmationId"));
207074
+ return runTool(request, () => broker.pushProjectBranch(auth, request), readString$2(args, "confirmationId"));
207053
207075
  }
207054
207076
  function runRefreshCredentials({ args, auth, broker, runTool }) {
207055
207077
  const request = { cwd: readRequiredString(args, "cwd", "forge_github_refresh_credentials") };
207056
- return runTool(request, () => broker.refreshProjectCredentials(auth, request), readString$1(args, "confirmationId"));
207078
+ return runTool(request, () => broker.refreshProjectCredentials(auth, request), readString$2(args, "confirmationId"));
207057
207079
  }
207058
207080
  const repositoryToolHandlers = {
207059
207081
  forge_github_status: runStatus$1,
@@ -207091,7 +207113,7 @@ async function runGitHubWorkflowTool(toolName, context) {
207091
207113
  }
207092
207114
  function listWorkflowRuns({ args, auth, broker, runTool }) {
207093
207115
  const cwd = readRequiredString(args, "cwd", "forge_github_list_workflow_runs");
207094
- const branch = readString$1(args, "branch")?.trim();
207116
+ const branch = readString$2(args, "branch")?.trim();
207095
207117
  const limit = readNumber$1(args, "limit");
207096
207118
  const request = {
207097
207119
  cwd,
@@ -207110,7 +207132,7 @@ function watchWorkflowRun({ args, auth, broker, runTool }) {
207110
207132
  }
207111
207133
  function getWorkflowRunLogs({ args, auth, broker, runTool }) {
207112
207134
  const { cwd, runId } = readWorkflowRunRequest(args, "forge_github_get_workflow_run_logs");
207113
- const jobId = readString$1(args, "jobId")?.trim();
207135
+ const jobId = readString$2(args, "jobId")?.trim();
207114
207136
  const request = {
207115
207137
  cwd,
207116
207138
  runId,
@@ -207120,16 +207142,16 @@ function getWorkflowRunLogs({ args, auth, broker, runTool }) {
207120
207142
  }
207121
207143
  function downloadWorkflowArtifacts({ args, auth, broker, runTool }) {
207122
207144
  const cwd = readRequiredString(args, "cwd", "forge_github_download_workflow_artifacts");
207123
- const runId = readString$1(args, "runId")?.trim();
207124
- const artifactName = readString$1(args, "artifactName")?.trim();
207125
- const destinationDir = readString$1(args, "destinationDir")?.trim();
207145
+ const runId = readString$2(args, "runId")?.trim();
207146
+ const artifactName = readString$2(args, "artifactName")?.trim();
207147
+ const destinationDir = readString$2(args, "destinationDir")?.trim();
207126
207148
  const request = {
207127
207149
  cwd,
207128
207150
  ...runId ? { runId } : {},
207129
207151
  ...artifactName ? { artifactName } : {},
207130
207152
  ...destinationDir ? { destinationDir } : {}
207131
207153
  };
207132
- return runTool(request, () => broker.downloadWorkflowArtifacts(auth, request), readString$1(args, "confirmationId"));
207154
+ return runTool(request, () => broker.downloadWorkflowArtifacts(auth, request), readString$2(args, "confirmationId"));
207133
207155
  }
207134
207156
  function listWorkflows({ args, auth, broker, runTool }) {
207135
207157
  const cwd = readRequiredString(args, "cwd", "forge_github_list_workflows");
@@ -207148,7 +207170,7 @@ function getWorkflow({ args, auth, broker, runTool }) {
207148
207170
  }
207149
207171
  function runWorkflow({ args, auth, broker, runTool }) {
207150
207172
  const { cwd, workflow } = readWorkflowRequest(args, "forge_github_run_workflow");
207151
- const ref = readString$1(args, "ref")?.trim();
207173
+ const ref = readString$2(args, "ref")?.trim();
207152
207174
  const fields = readStringRecord(args, "fields");
207153
207175
  const request = {
207154
207176
  cwd,
@@ -207156,7 +207178,7 @@ function runWorkflow({ args, auth, broker, runTool }) {
207156
207178
  ...ref ? { ref } : {},
207157
207179
  ...fields && Object.keys(fields).length > 0 ? { fields } : {}
207158
207180
  };
207159
- return runTool(request, () => broker.runWorkflow(auth, request), readString$1(args, "confirmationId"));
207181
+ return runTool(request, () => broker.runWorkflow(auth, request), readString$2(args, "confirmationId"));
207160
207182
  }
207161
207183
  function enableWorkflow(context) {
207162
207184
  return runWorkflowToggle("forge_github_enable_workflow", context, "enableWorkflow");
@@ -207179,12 +207201,12 @@ function readWorkflowRequest(args, toolName) {
207179
207201
  async function runWorkflowRunMutation(toolName, context, brokerMethod) {
207180
207202
  const { args, auth, broker, runTool } = context;
207181
207203
  const request = readWorkflowRunRequest(args, toolName);
207182
- return runTool(request, () => broker[brokerMethod](auth, request), readString$1(args, "confirmationId"));
207204
+ return runTool(request, () => broker[brokerMethod](auth, request), readString$2(args, "confirmationId"));
207183
207205
  }
207184
207206
  function runWorkflowToggle(toolName, context, brokerMethod) {
207185
207207
  const { args, auth, broker, runTool } = context;
207186
207208
  const request = readWorkflowRequest(args, toolName);
207187
- return runTool(request, () => broker[brokerMethod](auth, request), readString$1(args, "confirmationId"));
207209
+ return runTool(request, () => broker[brokerMethod](auth, request), readString$2(args, "confirmationId"));
207188
207210
  }
207189
207211
  //#endregion
207190
207212
  //#region src/github/GitHubCodexWorkspaceGitTools.ts
@@ -207201,7 +207223,7 @@ async function runWorkspaceGitTool(toolName, context) {
207201
207223
  case "forge_git_commit": return runCommit("forge_git_commit", context);
207202
207224
  case "forge_git_reset_hard": return runResetHard("forge_git_reset_hard", context);
207203
207225
  case "forge_git": {
207204
- const operation = readString$1(args, "operation")?.trim();
207226
+ const operation = readString$2(args, "operation")?.trim();
207205
207227
  switch (operation) {
207206
207228
  case "status": return runStatus(toolName, context, "status");
207207
207229
  case "log": return runLog(toolName, context);
@@ -207230,7 +207252,7 @@ function runLog(toolName, { args, broker, runTool }) {
207230
207252
  }
207231
207253
  function runStash(toolName, { args, broker, runTool }, operation) {
207232
207254
  const cwd = readRequiredString(args, "cwd", toolName);
207233
- const message = readString$1(args, "message")?.trim();
207255
+ const message = readString$2(args, "message")?.trim();
207234
207256
  return runTool({
207235
207257
  cwd,
207236
207258
  ...operation ? { operation } : {},
@@ -207238,12 +207260,12 @@ function runStash(toolName, { args, broker, runTool }, operation) {
207238
207260
  }, () => broker.stashWorkspace({
207239
207261
  cwd,
207240
207262
  ...message ? { message } : {}
207241
- }), readString$1(args, "confirmationId"));
207263
+ }), readString$2(args, "confirmationId"));
207242
207264
  }
207243
207265
  function runCommit(toolName, { args, broker, runTool }, operation) {
207244
207266
  const cwd = readRequiredString(args, "cwd", toolName);
207245
207267
  const message = readRequiredString(args, "message", operation ? `${toolName} operation=commit` : toolName);
207246
- const branch = readString$1(args, "branch")?.trim();
207268
+ const branch = readString$2(args, "branch")?.trim();
207247
207269
  return runTool({
207248
207270
  cwd,
207249
207271
  ...operation ? { operation } : {},
@@ -207253,11 +207275,11 @@ function runCommit(toolName, { args, broker, runTool }, operation) {
207253
207275
  cwd,
207254
207276
  message,
207255
207277
  ...branch ? { branch } : {}
207256
- }), readString$1(args, "confirmationId"));
207278
+ }), readString$2(args, "confirmationId"));
207257
207279
  }
207258
207280
  function runResetHard(toolName, { args, broker, runTool }, operation) {
207259
207281
  const cwd = readRequiredString(args, "cwd", toolName);
207260
- const ref = readString$1(args, "ref")?.trim();
207282
+ const ref = readString$2(args, "ref")?.trim();
207261
207283
  return runTool({
207262
207284
  cwd,
207263
207285
  ...operation ? { operation } : {},
@@ -207265,7 +207287,7 @@ function runResetHard(toolName, { args, broker, runTool }, operation) {
207265
207287
  }, () => broker.resetWorkspaceHard({
207266
207288
  cwd,
207267
207289
  ...ref ? { ref } : {}
207268
- }), readString$1(args, "confirmationId"));
207290
+ }), readString$2(args, "confirmationId"));
207269
207291
  }
207270
207292
  //#endregion
207271
207293
  //#region src/github/GitHubCodexToolRunner.ts
@@ -207899,7 +207921,7 @@ function createCodexGitHubDynamicToolHandler(options = {}) {
207899
207921
  error: "Forge could not resolve the authenticated user session for this thread. Send a new turn from the Forge UI and retry."
207900
207922
  }, false);
207901
207923
  const args = readArgs$1(input.arguments);
207902
- const dispatchOperation = input.tool === "forge_git" ? readString$1(args, "operation")?.trim() : void 0;
207924
+ const dispatchOperation = input.tool === "forge_git" ? readString$2(args, "operation")?.trim() : void 0;
207903
207925
  const operation = dispatchOperation ?? operationForTool(input.tool);
207904
207926
  const requiresConfirmation = !bypassWriteConfirmation && (isGitHubWriteTool(input.tool) || dispatchOperation !== void 0 && FORGE_GIT_WRITE_OPERATIONS.has(dispatchOperation));
207905
207927
  const runTool = async (request, execute, confirmationId) => {
@@ -208421,7 +208443,7 @@ function createCodexDevServerDynamicTools() {
208421
208443
  function readArgs(value) {
208422
208444
  return value && typeof value === "object" ? value : {};
208423
208445
  }
208424
- function readString(args, key) {
208446
+ function readString$1(args, key) {
208425
208447
  const value = args[key];
208426
208448
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
208427
208449
  }
@@ -208434,8 +208456,8 @@ function readBoolean(args, key) {
208434
208456
  return typeof value === "boolean" ? value : void 0;
208435
208457
  }
208436
208458
  function runDevServerStart(handlers, args) {
208437
- const command = readString(args, "command");
208438
- const cwd = readString(args, "cwd");
208459
+ const command = readString$1(args, "command");
208460
+ const cwd = readString$1(args, "cwd");
208439
208461
  const port = readNumber(args, "port");
208440
208462
  const readyTimeoutMs = readNumber(args, "readyTimeoutMs");
208441
208463
  const openPreview = readBoolean(args, "openPreview");
@@ -208591,7 +208613,7 @@ function readConnectorParams(tool, args) {
208591
208613
  switch (tool.tool) {
208592
208614
  case "forge_gmail_search": return {
208593
208615
  ...params,
208594
- query: readString$1(args, "query") ?? ""
208616
+ query: readString$2(args, "query") ?? ""
208595
208617
  };
208596
208618
  case "forge_gmail_list_recent": return {
208597
208619
  ...params,
@@ -208603,7 +208625,7 @@ function readConnectorParams(tool, args) {
208603
208625
  }
208604
208626
  }
208605
208627
  function appendString(target, args, key) {
208606
- const value = readString$1(args, key);
208628
+ const value = readString$2(args, key);
208607
208629
  if (value !== void 0) target[key] = value;
208608
208630
  }
208609
208631
  function appendNumber(target, args, key) {
@@ -209141,7 +209163,7 @@ const MODEL_LIST_PROBE_TIMEOUT_MS = 5e3;
209141
209163
  const probeCliModels = (input) => gen(function* () {
209142
209164
  const useShell = process.platform === "win32";
209143
209165
  if (useShell && !isShellSafeCommandPath(input.binaryPath)) return;
209144
- const command = make$47(input.binaryPath, [...input.args], {
209166
+ const command = make$48(input.binaryPath, [...input.args], {
209145
209167
  shell: useShell,
209146
209168
  env: scrubForgeProviderChildEnvSecrets(process.env)
209147
209169
  });
@@ -209192,7 +209214,7 @@ const collectStreamAsString = (stream) => stream.pipe(decodeText$1(), runFold(()
209192
209214
  //#region src/orchestration/WorkerPlanCodexTools.ts
209193
209215
  const FORGE_PROPOSE_WORKER_TASKS_TOOL = "forge_propose_worker_tasks";
209194
209216
  const MAX_WORKER_PLAN_ITEMS = 5;
209195
- function asRecord$9(value) {
209217
+ function asRecord$10(value) {
209196
209218
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
209197
209219
  }
209198
209220
  function readTrimmedString(value) {
@@ -209208,7 +209230,7 @@ function isValidWorkerSummary(value) {
209208
209230
  return value !== void 0 && value.length > 0 && value.length <= 4e3;
209209
209231
  }
209210
209232
  function decodeWorkerPlanItem(value) {
209211
- const item = asRecord$9(value);
209233
+ const item = asRecord$10(value);
209212
209234
  const slug = readTrimmedString(item?.slug);
209213
209235
  const title = readTrimmedString(item?.title);
209214
209236
  const summary = readTrimmedString(item?.summary);
@@ -209272,7 +209294,7 @@ function createWorkerPlanDynamicTools() {
209272
209294
  function createWorkerPlanDynamicToolHandler() {
209273
209295
  return async (input) => {
209274
209296
  if (input.tool !== "forge_propose_worker_tasks") throw new Error(`Unsupported worker-plan tool: ${input.tool}`);
209275
- if (!decodeWorkerPlanItems(asRecord$9(input.arguments)?.items)) throw new Error("Worker plans require one to five unique, fully described items.");
209297
+ if (!decodeWorkerPlanItems(asRecord$10(input.arguments)?.items)) throw new Error("Worker plans require one to five unique, fully described items.");
209276
209298
  return {
209277
209299
  success: true,
209278
209300
  contentItems: [{
@@ -210434,6 +210456,7 @@ const makeCodexAdapter = fn$1("makeCodexAdapter")(function* (options) {
210434
210456
  ...browserToolEnvironmentId !== void 0 ? { environmentId: browserToolEnvironmentId } : {}
210435
210457
  };
210436
210458
  const managerInput = {
210459
+ ...input.accountTransition ? { accountTransition: input.accountTransition } : {},
210437
210460
  threadId: input.threadId,
210438
210461
  provider: "codex",
210439
210462
  ...input.cwd !== void 0 ? { cwd: input.cwd } : {},
@@ -210767,14 +210790,14 @@ const makeManagedServerProvider = fn$1("makeManagedServerProvider")(function* (i
210767
210790
  const refreshSemaphore = yield* make$43(1);
210768
210791
  const changesPubSub = yield* acquireRelease(unbounded$1(), shutdown$2);
210769
210792
  const initialSettings = yield* input.getSettings;
210770
- const snapshotRef = yield* make$49(input.initialSnapshot(initialSettings));
210771
- const settingsRef = yield* make$49(initialSettings);
210793
+ const snapshotRef = yield* make$50(input.initialSnapshot(initialSettings));
210794
+ const settingsRef = yield* make$50(initialSettings);
210772
210795
  const applySnapshotBase = fn$1("applySnapshot")(function* (nextSettings, options) {
210773
210796
  const forceRefresh = options?.forceRefresh === true;
210774
- const previousSettings = yield* get$5(settingsRef);
210797
+ const previousSettings = yield* get$6(settingsRef);
210775
210798
  if (!forceRefresh && !input.haveSettingsChanged(previousSettings, nextSettings)) {
210776
210799
  yield* set$2(settingsRef, nextSettings);
210777
- return yield* get$5(snapshotRef);
210800
+ return yield* get$6(snapshotRef);
210778
210801
  }
210779
210802
  const nextSnapshot = yield* input.checkProvider;
210780
210803
  yield* set$2(settingsRef, nextSettings);
@@ -210787,9 +210810,9 @@ const makeManagedServerProvider = fn$1("makeManagedServerProvider")(function* (i
210787
210810
  return yield* applySnapshot(yield* input.getSettings, { forceRefresh: true });
210788
210811
  });
210789
210812
  yield* runForEach(input.streamSettings, (nextSettings) => asVoid(applySnapshot(nextSettings))).pipe(forkScoped);
210790
- const refreshFailureCount = yield* make$49(0);
210813
+ const refreshFailureCount = yield* make$50(0);
210791
210814
  yield* forever$1(gen(function* () {
210792
- const failureCount = yield* get$5(refreshFailureCount);
210815
+ const failureCount = yield* get$6(refreshFailureCount);
210793
210816
  const baseMs = 6e4;
210794
210817
  yield* sleep$4(millis(Math.min(baseMs * Math.pow(2, failureCount), 3e5)));
210795
210818
  if (isFailure(yield* refreshSnapshot().pipe(tapError((e) => sync$1(() => captureServerError(e))), exit))) {
@@ -211087,25 +211110,25 @@ const AUTH_METHOD_CONTAINER_KEYS = [
211087
211110
  /** Lift an unknown value into `Option<string>` if it is a non-empty string. */
211088
211111
  const asNonEmptyString = (v) => typeof v === "string" && v.length > 0 ? some(v) : none$4();
211089
211112
  /** Lift an unknown value into `Option<Record>` if it is a plain object. */
211090
- const asRecord$8 = (v) => typeof v === "object" && v !== null && !globalThis.Array.isArray(v) ? some(v) : none$4();
211113
+ const asRecord$9 = (v) => typeof v === "object" && v !== null && !globalThis.Array.isArray(v) ? some(v) : none$4();
211091
211114
  /**
211092
211115
  * Walk an unknown parsed JSON value looking for a subscription/plan
211093
211116
  * identifier, returning the first match as an `Option`.
211094
211117
  */
211095
211118
  function findSubscriptionType(value) {
211096
211119
  if (globalThis.Array.isArray(value)) return firstSomeOf(value.map(findSubscriptionType));
211097
- return asRecord$8(value).pipe(flatMap$2((record) => {
211120
+ return asRecord$9(value).pipe(flatMap$2((record) => {
211098
211121
  const direct = firstSomeOf(SUBSCRIPTION_TYPE_KEYS.map((key) => asNonEmptyString(record[key])));
211099
211122
  if (isSome(direct)) return direct;
211100
- return firstSomeOf(SUBSCRIPTION_CONTAINER_KEYS.map((key) => asRecord$8(record[key]).pipe(flatMap$2(findSubscriptionType))));
211123
+ return firstSomeOf(SUBSCRIPTION_CONTAINER_KEYS.map((key) => asRecord$9(record[key]).pipe(flatMap$2(findSubscriptionType))));
211101
211124
  }));
211102
211125
  }
211103
211126
  function findAuthMethod(value) {
211104
211127
  if (globalThis.Array.isArray(value)) return firstSomeOf(value.map(findAuthMethod));
211105
- return asRecord$8(value).pipe(flatMap$2((record) => {
211128
+ return asRecord$9(value).pipe(flatMap$2((record) => {
211106
211129
  const direct = firstSomeOf(AUTH_METHOD_KEYS.map((key) => asNonEmptyString(record[key])));
211107
211130
  if (isSome(direct)) return direct;
211108
- return firstSomeOf(AUTH_METHOD_CONTAINER_KEYS.map((key) => asRecord$8(record[key]).pipe(flatMap$2(findAuthMethod))));
211131
+ return firstSomeOf(AUTH_METHOD_CONTAINER_KEYS.map((key) => asRecord$9(record[key]).pipe(flatMap$2(findAuthMethod))));
211109
211132
  }));
211110
211133
  }
211111
211134
  /**
@@ -211332,7 +211355,7 @@ const runClaudeCommand = fn$1("runClaudeCommand")(function* (args) {
211332
211355
  }));
211333
211356
  const claudeSettings = yield* service(ServerSettingsService).pipe(flatMap((service) => service.getSettings), map$3((settings) => settings.providers.claudeAgent));
211334
211357
  const effectiveConfigPath = claudeSettings.configPath || config.forgeClaudeConfigPath || process.env.CLAUDE_CONFIG_DIR || void 0;
211335
- const command = make$47(claudeSettings.binaryPath, [...args], {
211358
+ const command = make$48(claudeSettings.binaryPath, [...args], {
211336
211359
  shell: process.platform === "win32",
211337
211360
  env: scrubForgeProviderChildEnvSecrets({
211338
211361
  ...process.env,
@@ -211516,7 +211539,7 @@ const makePendingClaudeProvider = (claudeSettings) => {
211516
211539
  const ClaudeProviderLive = effect(ClaudeProvider, gen(function* () {
211517
211540
  const serverSettings = yield* ServerSettingsService;
211518
211541
  const spawner = yield* ChildProcessSpawner;
211519
- const subscriptionProbeCache = yield* make$50({
211542
+ const subscriptionProbeCache = yield* make$51({
211520
211543
  capacity: 4,
211521
211544
  timeToLive: minutes(5),
211522
211545
  lookup: (key) => {
@@ -211527,7 +211550,7 @@ const ClaudeProviderLive = effect(ClaudeProvider, gen(function* () {
211527
211550
  });
211528
211551
  }
211529
211552
  });
211530
- const getDiscovery = (input) => get$7(subscriptionProbeCache, JSON.stringify([input.binaryPath, input.configPath]));
211553
+ const getDiscovery = (input) => get$8(subscriptionProbeCache, JSON.stringify([input.binaryPath, input.configPath]));
211531
211554
  const checkProvider = checkClaudeProviderStatus((input) => getDiscovery(input).pipe(map$3((probe) => probe?.subscriptionType)), (input) => getDiscovery(input).pipe(map$3((probe) => probe?.slashCommands)), (input) => getDiscovery(input).pipe(map$3((probe) => probe?.models))).pipe(provideService(ServerSettingsService, serverSettings), provideService(ChildProcessSpawner, spawner));
211532
211555
  return yield* makeManagedServerProvider({
211533
211556
  getSettings: serverSettings.getSettings.pipe(map$3((settings) => settings.providers.claudeAgent), orDie),
@@ -212351,7 +212374,7 @@ function userInputQuestionsFromToolInput(toolInput) {
212351
212374
  return (Array.isArray(toolInput.questions) ? toolInput.questions : []).map((question, idx) => userInputQuestionFromUnknown(question, idx));
212352
212375
  }
212353
212376
  function userInputQuestionFromUnknown(question, idx) {
212354
- const value = asRecord$7(question) ?? {};
212377
+ const value = asRecord$8(question) ?? {};
212355
212378
  return {
212356
212379
  id: typeof value.header === "string" ? value.header : `q-${idx}`,
212357
212380
  header: typeof value.header === "string" ? value.header : `Question ${idx + 1}`,
@@ -212361,13 +212384,13 @@ function userInputQuestionFromUnknown(question, idx) {
212361
212384
  };
212362
212385
  }
212363
212386
  function userInputOptionFromUnknown(option) {
212364
- const value = asRecord$7(option) ?? {};
212387
+ const value = asRecord$8(option) ?? {};
212365
212388
  return {
212366
212389
  label: typeof value.label === "string" ? value.label : "",
212367
212390
  description: typeof value.description === "string" ? value.description : ""
212368
212391
  };
212369
212392
  }
212370
- function asRecord$7(value) {
212393
+ function asRecord$8(value) {
212371
212394
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
212372
212395
  }
212373
212396
  function permissionResultFromDecision(decision, toolInput, suggestions) {
@@ -213271,7 +213294,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
213271
213294
  const updateResumeCursor = fn$1("updateResumeCursor")(function* (context) {
213272
213295
  const threadId = context.session.threadId;
213273
213296
  if (!threadId) return;
213274
- const providerDeliveryBinding = readProviderDeliveryBinding(asRecord$7(context.session.resumeCursor)?.providerDeliveryBinding);
213297
+ const providerDeliveryBinding = readProviderDeliveryBinding(asRecord$8(context.session.resumeCursor)?.providerDeliveryBinding);
213275
213298
  const resumeCursor = {
213276
213299
  threadId,
213277
213300
  ...context.resumeSessionId ? { resume: context.resumeSessionId } : {},
@@ -214424,7 +214447,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
214424
214447
  });
214425
214448
  const makeCanUseTool = (contextRef, runtimeMode, pendingApprovals, pendingUserInputs, runFork, runPromise) => {
214426
214449
  const canUseToolEffect = fn$1("canUseTool")(function* (toolName, toolInput, callbackOptions) {
214427
- const context = yield* get$5(contextRef);
214450
+ const context = yield* get$6(contextRef);
214428
214451
  if (!context) return {
214429
214452
  behavior: "deny",
214430
214453
  message: "Claude session context is unavailable."
@@ -214566,7 +214589,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
214566
214589
  const pendingApprovals = /* @__PURE__ */ new Map();
214567
214590
  const pendingUserInputs = /* @__PURE__ */ new Map();
214568
214591
  const inFlightTools = /* @__PURE__ */ new Map();
214569
- const contextRef = yield* make$49(void 0);
214592
+ const contextRef = yield* make$50(void 0);
214570
214593
  const canUseTool = makeCanUseTool(contextRef, input.runtimeMode, pendingApprovals, pendingUserInputs, runFork, runPromise);
214571
214594
  const serverSettings = yield* serverSettingsService.getSettings.pipe(mapError((error) => new ProviderAdapterProcessError({
214572
214595
  provider: PROVIDER$11,
@@ -218346,7 +218369,7 @@ function makeAcpContentDeltaEvent(input) {
218346
218369
  }
218347
218370
  //#endregion
218348
218371
  //#region ../../packages/shared/src/toolActivity.ts
218349
- function asRecord$6(value) {
218372
+ function asRecord$7(value) {
218350
218373
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
218351
218374
  }
218352
218375
  function asTrimmedString(value) {
@@ -218372,10 +218395,10 @@ function extractCommandFromTitle$1(title) {
218372
218395
  return /`([^`]+)`/u.exec(title)?.[1]?.trim() || void 0;
218373
218396
  }
218374
218397
  function extractToolCommand(data, title) {
218375
- const item = asRecord$6(data?.item);
218376
- const itemInput = asRecord$6(item?.input);
218377
- const itemResult = asRecord$6(item?.result);
218378
- const rawInput = asRecord$6(data?.rawInput);
218398
+ const item = asRecord$7(data?.item);
218399
+ const itemInput = asRecord$7(item?.input);
218400
+ const itemResult = asRecord$7(item?.result);
218401
+ const rawInput = asRecord$7(data?.rawInput);
218379
218402
  const direct = [
218380
218403
  normalizeCommandValue$1(item?.command),
218381
218404
  normalizeCommandValue$1(itemInput?.command),
@@ -218403,7 +218426,7 @@ function collectPaths(value, paths, seen, depth) {
218403
218426
  }
218404
218427
  return;
218405
218428
  }
218406
- const record = asRecord$6(value);
218429
+ const record = asRecord$7(value);
218407
218430
  if (!record) return;
218408
218431
  for (const key of [
218409
218432
  "path",
@@ -218462,7 +218485,7 @@ function deriveToolActivityPresentation(input) {
218462
218485
  const title = asTrimmedString(input.title);
218463
218486
  const detail = stripTrailingExitCode(asTrimmedString(input.detail));
218464
218487
  const fallbackSummary = asTrimmedString(input.fallbackSummary) ?? "Tool";
218465
- const data = asRecord$6(input.data);
218488
+ const data = asRecord$7(input.data);
218466
218489
  const command = extractToolCommand(data, title);
218467
218490
  const primaryPath = extractPrimaryPath(data);
218468
218491
  const action = classifyToolAction({
@@ -218486,7 +218509,7 @@ function deriveToolActivityPresentation(input) {
218486
218509
  ...primaryPath ? { detail: primaryPath } : {}
218487
218510
  };
218488
218511
  if (action === "search") {
218489
- const query = asTrimmedString(asRecord$6(data?.rawInput)?.query) ?? asTrimmedString(asRecord$6(data?.rawInput)?.pattern) ?? asTrimmedString(asRecord$6(data?.rawInput)?.searchTerm);
218512
+ const query = asTrimmedString(asRecord$7(data?.rawInput)?.query) ?? asTrimmedString(asRecord$7(data?.rawInput)?.pattern) ?? asTrimmedString(asRecord$7(data?.rawInput)?.searchTerm);
218490
218513
  return {
218491
218514
  summary: "Searched files",
218492
218515
  ...query ? { detail: query } : {}
@@ -218841,9 +218864,9 @@ const makeAcpPatchedProtocol = fn$1("makeAcpPatchedProtocol")(function* (options
218841
218864
  const notificationQueue = yield* sliding(1024);
218842
218865
  const disconnects = yield* unbounded$2();
218843
218866
  const outgoing = yield* unbounded$2();
218844
- const nextRequestId = yield* make$49(1n);
218845
- const terminationHandled = yield* make$49(false);
218846
- const extPending = yield* make$49(/* @__PURE__ */ new Map());
218867
+ const nextRequestId = yield* make$50(1n);
218868
+ const terminationHandled = yield* make$50(false);
218869
+ const extPending = yield* make$50(/* @__PURE__ */ new Map());
218847
218870
  const logProtocol = (event) => {
218848
218871
  if (event.direction === "incoming" && !options.logIncoming) return void_$1;
218849
218872
  if (event.direction === "outgoing" && !options.logOutgoing) return void_$1;
@@ -218959,7 +218982,7 @@ const makeAcpPatchedProtocol = fn$1("makeAcpPatchedProtocol")(function* (options
218959
218982
  if (!options.serverRequestMethods.has(message.tag)) return handleExtRequest(message).pipe(catch_(() => respondWithError(message.id, AcpRequestError.internalError())), asVoid);
218960
218983
  return offer$1(serverQueue, message).pipe(asVoid);
218961
218984
  };
218962
- const handleExitEncoded = (message) => get$5(extPending).pipe(flatMap((pending) => {
218985
+ const handleExitEncoded = (message) => get$6(extPending).pipe(flatMap((pending) => {
218963
218986
  if (!pending.has(message.requestId)) return offer$1(clientQueue, message).pipe(asVoid);
218964
218987
  if (message.exit._tag === "Success") return completeExtPendingSuccess(message.requestId, message.exit.value);
218965
218988
  const failure = message.exit.cause.find((entry) => entry._tag === "Fail");
@@ -218970,7 +218993,7 @@ const makeAcpPatchedProtocol = fn$1("makeAcpPatchedProtocol")(function* (options
218970
218993
  switch (message._tag) {
218971
218994
  case "Request": return handleRequestEncoded(message);
218972
218995
  case "Exit": return handleExitEncoded(message);
218973
- case "Chunk": return get$5(extPending).pipe(flatMap((pending) => pending.has(message.requestId) ? completeExtPendingFailure(message.requestId, AcpRequestError.internalError("Streaming extension responses are not supported")) : offer$1(clientQueue, message).pipe(asVoid)));
218996
+ case "Chunk": return get$6(extPending).pipe(flatMap((pending) => pending.has(message.requestId) ? completeExtPendingFailure(message.requestId, AcpRequestError.internalError("Streaming extension responses are not supported")) : offer$1(clientQueue, message).pipe(asVoid)));
218974
218997
  case "Defect":
218975
218998
  case "ClientProtocolError":
218976
218999
  case "Pong": return offer$1(clientQueue, message).pipe(asVoid);
@@ -219212,7 +219235,7 @@ ArraySchema(Unknown);
219212
219235
  //#endregion
219213
219236
  //#region ../../packages/effect-acp/src/_internal/stdio.ts
219214
219237
  const encoder$1 = new TextEncoder();
219215
- const makeChildStdio = (handle) => make$48({
219238
+ const makeChildStdio = (handle) => make$49({
219216
219239
  args: succeed([]),
219217
219240
  stdin: handle.stdout,
219218
219241
  stdout: () => mapInput(handle.stdin, (chunk) => typeof chunk === "string" ? encoder$1.encode(chunk) : chunk),
@@ -219223,7 +219246,7 @@ fn$1("makeInMemoryStdio")(function* () {
219223
219246
  const output = yield* unbounded$2();
219224
219247
  const decoder = new TextDecoder();
219225
219248
  return {
219226
- stdio: make$48({
219249
+ stdio: make$49({
219227
219250
  args: succeed([]),
219228
219251
  stdin: fromQueue(input),
219229
219252
  stdout: () => forEach$1((chunk) => offer$1(output, typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }))),
@@ -219414,11 +219437,11 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219414
219437
  const spawner = yield* ChildProcessSpawner;
219415
219438
  const runtimeScope = yield* Scope$1;
219416
219439
  const eventQueue = yield* unbounded$2();
219417
- const modeStateRef = yield* make$49(void 0);
219418
- const toolCallsRef = yield* make$49(/* @__PURE__ */ new Map());
219419
- const assistantSegmentRef = yield* make$49({ nextSegmentIndex: 0 });
219420
- const configOptionsRef = yield* make$49(sessionConfigOptionsFromSetup(void 0));
219421
- const startStateRef = yield* make$49({ _tag: "NotStarted" });
219440
+ const modeStateRef = yield* make$50(void 0);
219441
+ const toolCallsRef = yield* make$50(/* @__PURE__ */ new Map());
219442
+ const assistantSegmentRef = yield* make$50({ nextSegmentIndex: 0 });
219443
+ const configOptionsRef = yield* make$50(sessionConfigOptionsFromSetup(void 0));
219444
+ const startStateRef = yield* make$50({ _tag: "NotStarted" });
219422
219445
  const logRequest = (event) => options.requestLogger ? options.requestLogger(event) : void_$1;
219423
219446
  const runLoggedRequest = (method, payload, effect) => logRequest({
219424
219447
  method,
@@ -219440,7 +219463,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219440
219463
  command: options.spawn.command,
219441
219464
  cause: /* @__PURE__ */ new Error(`Refusing to spawn ACP child process: command path contains shell metacharacters that cmd.exe would interpret as additional commands. Adjust the provider \`binaryPath\` setting to an unquoted absolute path.`)
219442
219465
  });
219443
- const acpContext = yield* build(layerChildProcess(yield* spawner.spawn(make$47(options.spawn.command, [...options.spawn.args], {
219466
+ const acpContext = yield* build(layerChildProcess(yield* spawner.spawn(make$48(options.spawn.command, [...options.spawn.args], {
219444
219467
  ...options.spawn.cwd ? { cwd: options.spawn.cwd } : {},
219445
219468
  env: scrubForgeProviderChildEnvSecrets({
219446
219469
  ...process.env,
@@ -219475,7 +219498,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219475
219498
  ...options.clientCapabilities?._meta ? { _meta: options.clientCapabilities._meta } : {}
219476
219499
  };
219477
219500
  const getStartedState = gen(function* () {
219478
- const state = yield* get$5(startStateRef);
219501
+ const state = yield* get$6(startStateRef);
219479
219502
  if (state._tag === "Started") return state.result;
219480
219503
  return yield* new AcpTransportError({
219481
219504
  detail: "ACP session runtime has not been started",
@@ -219483,7 +219506,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219483
219506
  });
219484
219507
  });
219485
219508
  const validateConfigOptionValue = (configId, value) => gen(function* () {
219486
- const configOption = findSessionConfigOption(yield* get$5(configOptionsRef), configId);
219509
+ const configOption = findSessionConfigOption(yield* get$6(configOptionsRef), configId);
219487
219510
  if (!configOption) return;
219488
219511
  if (configOption.type === "boolean") {
219489
219512
  if (typeof value === "boolean") return;
@@ -219523,7 +219546,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219523
219546
  ...current,
219524
219547
  currentModeId: modeId
219525
219548
  } : current);
219526
- const setConfigOption = (configId, value) => validateConfigOptionValue(configId, value).pipe(flatMap(() => getStartedState), flatMap((started) => get$5(configOptionsRef).pipe(flatMap((configOptions) => {
219549
+ const setConfigOption = (configId, value) => validateConfigOptionValue(configId, value).pipe(flatMap(() => getStartedState), flatMap((started) => get$6(configOptionsRef).pipe(flatMap((configOptions) => {
219527
219550
  const existing = findSessionConfigOption(configOptions, configId);
219528
219551
  if (existing && configOptionCurrentValueMatches(existing, value)) return succeed({ configOptions });
219529
219552
  const requestPayload = typeof value === "boolean" ? {
@@ -219604,8 +219627,8 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219604
219627
  handleExtNotification: acp.handleExtNotification,
219605
219628
  start: () => start,
219606
219629
  getEvents: () => fromQueue(eventQueue),
219607
- getModeState: get$5(modeStateRef),
219608
- getConfigOptions: get$5(configOptionsRef),
219630
+ getModeState: get$6(modeStateRef),
219631
+ getConfigOptions: get$6(configOptionsRef),
219609
219632
  prompt: (payload) => getStartedState.pipe(flatMap((started) => {
219610
219633
  const requestPayload = {
219611
219634
  sessionId: started.sessionId,
@@ -219620,7 +219643,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
219620
219643
  })));
219621
219644
  })),
219622
219645
  cancel: getStartedState.pipe(flatMap((started) => acp.agent.cancel({ sessionId: started.sessionId }))),
219623
- setMode: (modeId) => get$5(modeStateRef).pipe(flatMap((modeState) => {
219646
+ setMode: (modeId) => get$6(modeStateRef).pipe(flatMap((modeState) => {
219624
219647
  if (modeState?.currentModeId === modeId) return succeed({});
219625
219648
  return getStartedState.pipe(flatMap((started) => {
219626
219649
  if (sessionResponseHasModeState(started.sessionSetupResult)) {
@@ -219712,7 +219735,7 @@ const handleSessionUpdate = ({ queue, modeStateRef, toolCallsRef, assistantSegme
219712
219735
  }
219713
219736
  if (event._tag === "ContentDelta") {
219714
219737
  if (event.text.trim().length === 0) {
219715
- if (!(yield* get$5(assistantSegmentRef)).activeItemId) continue;
219738
+ if (!(yield* get$6(assistantSegmentRef)).activeItemId) continue;
219716
219739
  }
219717
219740
  const itemId = yield* ensureActiveAssistantSegment({
219718
219741
  queue,
@@ -219764,7 +219787,7 @@ const closeActiveAssistantSegment = ({ queue, assistantSegmentRef }) => modify$3
219764
219787
  }, { nextSegmentIndex: current.nextSegmentIndex }];
219765
219788
  }).pipe(flatMap((event) => event ? offer$1(queue, event) : void_$1));
219766
219789
  const makeStartCoordinator = (startStateRef, startOnce) => gen(function* () {
219767
- const currentState = yield* get$5(startStateRef);
219790
+ const currentState = yield* get$6(startStateRef);
219768
219791
  if (currentState._tag === "Started") return currentState.result;
219769
219792
  if (currentState._tag === "Starting") return yield* _await(currentState.deferred);
219770
219793
  const deferred = yield* make$39();
@@ -219889,7 +219912,7 @@ const readCursorApiKey = (_settings) => process.env.CURSOR_API_KEY || null;
219889
219912
  const runCursorCommand = fn$1("runCursorCommand")(function* (binaryPath, args) {
219890
219913
  const useShell = process.platform === "win32";
219891
219914
  if (useShell && !isShellSafeCommandPath(binaryPath)) return yield* fail(/* @__PURE__ */ new Error(`Refusing to spawn cursor-agent: \`binaryPath\` contains shell metacharacters that cmd.exe would interpret as additional commands.`));
219892
- return yield* spawnAndCollect(binaryPath, make$47(binaryPath, [...args], {
219915
+ return yield* spawnAndCollect(binaryPath, make$48(binaryPath, [...args], {
219893
219916
  shell: useShell,
219894
219917
  env: scrubForgeProviderChildEnvSecrets(process.env)
219895
219918
  }));
@@ -227708,7 +227731,7 @@ const makeOpenCodeRuntime = gen(function* () {
227708
227731
  const netService = yield* NetService;
227709
227732
  const runOpenCodeCommand = (input) => gen(function* () {
227710
227733
  yield* rejectUnsafeWindowsBinaryPath("runOpenCodeCommand", input.binaryPath);
227711
- const child = yield* spawner.spawn(make$47(input.binaryPath, [...input.args], {
227734
+ const child = yield* spawner.spawn(make$48(input.binaryPath, [...input.args], {
227712
227735
  shell: process.platform === "win32",
227713
227736
  env: input.environment ?? process.env
227714
227737
  }));
@@ -227743,7 +227766,7 @@ const makeOpenCodeRuntime = gen(function* () {
227743
227766
  `--hostname=${hostname}`,
227744
227767
  `--port=${port}`
227745
227768
  ];
227746
- const child = yield* spawner.spawn(make$47(input.binaryPath, args, {
227769
+ const child = yield* spawner.spawn(make$48(input.binaryPath, args, {
227747
227770
  detached: process.platform !== "win32",
227748
227771
  shell: process.platform === "win32",
227749
227772
  env: {
@@ -227764,8 +227787,8 @@ const makeOpenCodeRuntime = gen(function* () {
227764
227787
  } catch {}
227765
227788
  });
227766
227789
  yield* addFinalizer$1(runtimeScope, killOpenCodeProcessGroup("SIGTERM").pipe(andThen(sleep$4("1 second")), andThen(killOpenCodeProcessGroup("SIGKILL")), ignore));
227767
- const stdoutRef = yield* make$49("");
227768
- const stderrRef = yield* make$49("");
227790
+ const stdoutRef = yield* make$50("");
227791
+ const stderrRef = yield* make$50("");
227769
227792
  const readyDeferred = yield* make$39();
227770
227793
  const setReadyFromStdoutChunk = (chunk) => updateAndGet(stdoutRef, (stdout) => `${stdout}${chunk}`).pipe(flatMap((nextStdout) => {
227771
227794
  const parsed = parseServerUrlFromOutput(nextStdout);
@@ -227774,8 +227797,8 @@ const makeOpenCodeRuntime = gen(function* () {
227774
227797
  const stdoutFiber = yield* child.stdout.pipe(decodeText$1(), runForEach(setReadyFromStdoutChunk), ignore, forkIn(runtimeScope));
227775
227798
  const stderrFiber = yield* child.stderr.pipe(decodeText$1(), runForEach((chunk) => update$4(stderrRef, (stderr) => `${stderr}${chunk}`)), ignore, forkIn(runtimeScope));
227776
227799
  const exitFiber = yield* child.exitCode.pipe(flatMap((code) => gen(function* () {
227777
- const stdout = yield* get$5(stdoutRef);
227778
- const stderr = yield* get$5(stderrRef);
227800
+ const stdout = yield* get$6(stdoutRef);
227801
+ const stderr = yield* get$6(stderrRef);
227779
227802
  const exitCode = Number(code);
227780
227803
  yield* fail$3(readyDeferred, new OpenCodeRuntimeError({
227781
227804
  operation: "startOpenCodeServerProcess",
@@ -228436,12 +228459,12 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228436
228459
  }
228437
228460
  }))).pipe(exit, flatMap((exit) => gen(function* () {
228438
228461
  /* v8 ignore next -- session-scope interruption timing is a defensive cleanup path. */
228439
- if (eventsAbortController.signal.aborted || (yield* get$5(context.stopped))) return;
228462
+ if (eventsAbortController.signal.aborted || (yield* get$6(context.stopped))) return;
228440
228463
  if (isFailure(exit)) yield* emitUnexpectedExit(context, openCodeRuntimeErrorDetail(squash(exit.cause)));
228441
228464
  })), forkIn(context.sessionScope));
228442
228465
  if (!context.server.external && context.server.exitCode !== null) yield* context.server.exitCode.pipe(flatMap((code) => gen(function* () {
228443
228466
  /* v8 ignore next -- server-exit watcher can lose the race to an already-stopped context. */
228444
- if (yield* get$5(context.stopped)) return;
228467
+ if (yield* get$6(context.stopped)) return;
228445
228468
  yield* emitUnexpectedExit(context, `OpenCode server exited unexpectedly (${code}).`);
228446
228469
  })), forkIn(context.sessionScope));
228447
228470
  });
@@ -228524,7 +228547,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228524
228547
  activeTurnId: void 0,
228525
228548
  activeAgent: void 0,
228526
228549
  activeVariant: void 0,
228527
- stopped: yield* make$49(false),
228550
+ stopped: yield* make$50(false),
228528
228551
  sessionScope: started.sessionScope
228529
228552
  };
228530
228553
  sessions.set(input.threadId, context);
@@ -228883,6 +228906,8 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
228883
228906
  const canonicalEventLogger = options?.canonicalEventLogger ?? (options?.canonicalEventLogPath !== void 0 ? yield* makeEventNdjsonLogger(options.canonicalEventLogPath, { stream: "canonical" }) : void 0);
228884
228907
  const registry = yield* ProviderAdapterRegistry;
228885
228908
  const directory = yield* ProviderSessionDirectory;
228909
+ const sessionLocks = yield* make$47({ lookup: (_threadId) => make$43(1) });
228910
+ const withSessionLock = (threadId, effect) => get$5(sessionLocks, threadId).pipe(flatMap((lock) => lock.withPermit(effect)), scoped);
228886
228911
  const runtimeEventPubSub = yield* unbounded$1();
228887
228912
  const assertProviderExecutable = options?.assertProviderExecutable ?? (() => succeed(null));
228888
228913
  const assertCurrentProviderDelivery = fn$1("assertCurrentProviderDelivery")(function* (input) {
@@ -229055,18 +229080,19 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
229055
229080
  "provider.runtime_mode": input.runtimeMode
229056
229081
  });
229057
229082
  const persistedBinding = getOrUndefined(yield* directory.getBinding(threadId));
229058
- yield* assertProviderAccountBoundary({
229083
+ const adapter = yield* registry.getByProvider(effectiveProvider);
229084
+ const priorAccountId = readPersistedProviderAccountId(persistedBinding?.runtimePayload);
229085
+ const requestedAccountId = readProviderAccountIdFromModelSelection(input.modelSelection);
229086
+ if (effectiveProvider !== "codex" || persistedBinding?.provider !== effectiveProvider || (yield* adapter.hasSession(threadId))) yield* assertProviderAccountBoundary({
229059
229087
  operation: "ProviderService.startSession",
229060
229088
  threadId,
229061
- persistedAccountId: readPersistedProviderAccountId(persistedBinding?.runtimePayload),
229062
- requestedAccountId: readProviderAccountIdFromModelSelection(input.modelSelection)
229089
+ persistedAccountId: priorAccountId,
229090
+ requestedAccountId
229063
229091
  });
229064
- const effectiveResumeCursor = input.resumeCursor ?? (persistedBinding?.provider === effectiveProvider ? persistedBinding.resumeCursor : void 0);
229065
- const adapter = yield* registry.getByProvider(effectiveProvider);
229066
229092
  const boundResumeCursor = yield* bindProviderDeliveryToResumeCursor({
229067
229093
  operation: "ProviderService.startSession",
229068
229094
  provider: effectiveProvider,
229069
- resumeCursor: effectiveResumeCursor,
229095
+ resumeCursor: input.resumeCursor ?? (persistedBinding?.provider === effectiveProvider ? persistedBinding.resumeCursor : void 0),
229070
229096
  currentBinding: yield* assertProviderExecutable({
229071
229097
  threadId,
229072
229098
  provider: effectiveProvider,
@@ -229075,6 +229101,7 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
229075
229101
  });
229076
229102
  const session = yield* adapter.startSession({
229077
229103
  ...input,
229104
+ accountTransition: explicitProviderAccountTransition(priorAccountId, requestedAccountId),
229078
229105
  ...boundResumeCursor !== void 0 ? { resumeCursor: boundResumeCursor } : {}
229079
229106
  });
229080
229107
  if (session.provider !== adapter.provider) return yield* toValidationError("ProviderService.startSession", `Adapter/provider mismatch: requested '${adapter.provider}', received '${session.provider}'.`);
@@ -229375,15 +229402,15 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
229375
229402
  });
229376
229403
  yield* addFinalizer$2(() => catch_(runStopAll(), (cause) => logWarning$1("failed to stop provider service", { cause })));
229377
229404
  return {
229378
- startSession,
229379
- sendTurn,
229380
- interruptTurn,
229381
- respondToRequest,
229382
- respondToUserInput,
229383
- stopSession,
229405
+ startSession: (threadId, input) => withSessionLock(threadId, startSession(threadId, input)),
229406
+ sendTurn: (input) => withSessionLock(input?.threadId, sendTurn(input)),
229407
+ interruptTurn: (input) => withSessionLock(input?.threadId, interruptTurn(input)),
229408
+ respondToRequest: (input) => withSessionLock(input?.threadId, respondToRequest(input)),
229409
+ respondToUserInput: (input) => withSessionLock(input?.threadId, respondToUserInput(input)),
229410
+ stopSession: (input) => withSessionLock(input?.threadId, stopSession(input)),
229384
229411
  listSessions,
229385
229412
  getCapabilities,
229386
- rollbackConversation,
229413
+ rollbackConversation: (input) => withSessionLock(input?.threadId, rollbackConversation(input)),
229387
229414
  get streamEvents() {
229388
229415
  return fromPubSub(runtimeEventPubSub);
229389
229416
  }
@@ -230582,7 +230609,7 @@ const createTrace2Monitor = fn$1("createTrace2Monitor")(function* (input, progre
230582
230609
  suffix: ".json"
230583
230610
  });
230584
230611
  const hookStartByChildKey = /* @__PURE__ */ new Map();
230585
- const traceTailState = yield* make$49({
230612
+ const traceTailState = yield* make$50({
230586
230613
  processedChars: 0,
230587
230614
  remainder: ""
230588
230615
  });
@@ -230757,7 +230784,7 @@ const GitCoreLive = effect(GitCore, fn$1("makeGitCore")(function* (options) {
230757
230784
  const truncateOutputAtMaxBytes = input.truncateOutputAtMaxBytes ?? false;
230758
230785
  return yield* fn$1("runGitCommand")(function* () {
230759
230786
  const trace2Monitor = yield* createTrace2Monitor(commandInput, input.progress).pipe(provideService(Path$2, path$10), provideService(FileSystem, fileSystem), mapError(toGitCommandError(commandInput, "failed to create trace2 monitor.")));
230760
- const child = yield* commandSpawner.spawn(make$47("git", commandInput.args, {
230787
+ const child = yield* commandSpawner.spawn(make$48("git", commandInput.args, {
230761
230788
  cwd: commandInput.cwd,
230762
230789
  env: withRepositoryOwnershipTrust({
230763
230790
  ...process.env,
@@ -230918,7 +230945,7 @@ const GitCoreLive = effect(GitCore, fn$1("makeGitCore")(function* (options) {
230918
230945
  const refreshStatusUpstreamIfStale = fn$1("refreshStatusUpstreamIfStale")(function* (cwd) {
230919
230946
  const upstream = yield* resolveCurrentUpstream(cwd);
230920
230947
  if (!upstream) return;
230921
- yield* get$7(statusRemoteRefreshCache, new StatusRemoteRefreshCacheKey({
230948
+ yield* get$8(statusRemoteRefreshCache, new StatusRemoteRefreshCacheKey({
230922
230949
  gitCommonDir: yield* resolveGitCommonDir(cwd),
230923
230950
  remoteName: upstream.remoteName
230924
230951
  }));
@@ -232122,10 +232149,10 @@ const GitStatusBroadcasterLive = effect(GitStatusBroadcaster, gen(function* () {
232122
232149
  const gitManager = yield* GitManager;
232123
232150
  const changesPubSub = yield* acquireRelease(unbounded$1(), (pubsub) => shutdown$2(pubsub));
232124
232151
  const broadcasterScope = yield* acquireRelease(make$37(), (scope) => close(scope, void_$3));
232125
- const cacheRef = yield* make$49(/* @__PURE__ */ new Map());
232152
+ const cacheRef = yield* make$50(/* @__PURE__ */ new Map());
232126
232153
  const pollersRef = yield* make$32(/* @__PURE__ */ new Map());
232127
232154
  const getCachedStatus = fn$1("getCachedStatus")(function* (cwd) {
232128
- return yield* get$5(cacheRef).pipe(map$3((cache) => cache.get(cwd) ?? null));
232155
+ return yield* get$6(cacheRef).pipe(map$3((cache) => cache.get(cwd) ?? null));
232129
232156
  });
232130
232157
  const updateCachedLocalStatus = fn$1("updateCachedLocalStatus")(function* (cwd, local, options) {
232131
232158
  const nextLocal = {
@@ -232748,7 +232775,7 @@ const runCodexCommand = fn$1("runCodexCommand")(function* (args) {
232748
232775
  }));
232749
232776
  const codexSettings = yield* (yield* ServerSettingsService).getSettings.pipe(map$3((settings) => settings.providers.codex));
232750
232777
  const effectiveHomePath = codexSettings.homePath || config.forgeCodexHomePath || process.env.CODEX_HOME || void 0;
232751
- const command = make$47(codexSettings.binaryPath, [...args], {
232778
+ const command = make$48(codexSettings.binaryPath, [...args], {
232752
232779
  shell: process.platform === "win32",
232753
232780
  env: scrubForgeProviderChildEnvSecrets({
232754
232781
  ...process.env,
@@ -232976,7 +233003,7 @@ const CodexProviderLive = effect(CodexProvider, gen(function* () {
232976
233003
  const fileSystem = yield* FileSystem;
232977
233004
  const path = yield* Path$2;
232978
233005
  const spawner = yield* ChildProcessSpawner;
232979
- const accountProbeCache = yield* make$50({
233006
+ const accountProbeCache = yield* make$51({
232980
233007
  capacity: 4,
232981
233008
  timeToLive: minutes(5),
232982
233009
  lookup: (key) => {
@@ -232988,7 +233015,7 @@ const CodexProviderLive = effect(CodexProvider, gen(function* () {
232988
233015
  });
232989
233016
  }
232990
233017
  });
232991
- const getDiscovery = (input) => get$7(accountProbeCache, JSON.stringify([
233018
+ const getDiscovery = (input) => get$8(accountProbeCache, JSON.stringify([
232992
233019
  input.binaryPath,
232993
233020
  input.homePath,
232994
233021
  input.cwd
@@ -233130,7 +233157,7 @@ const CodexTextGenerationLive = effect(TextGeneration, gen(function* () {
233130
233157
  ...threadId ? { threadId } : {},
233131
233158
  authSessionId
233132
233159
  });
233133
- const command = make$47(codexSettings?.binaryPath || "codex", [
233160
+ const command = make$48(codexSettings?.binaryPath || "codex", [
233134
233161
  "exec",
233135
233162
  "--ephemeral",
233136
233163
  "--skip-git-repo-check",
@@ -233368,7 +233395,7 @@ const ClaudeTextGenerationLive = effect(TextGeneration, gen(function* () {
233368
233395
  };
233369
233396
  const claudeSettings = yield* map$3(serverSettingsService.getSettings, (settings) => settings.providers.claudeAgent).pipe(catch_(() => undefined_));
233370
233397
  const rawStdout = yield* fn$1("runClaudeJson.runClaudeCommand")(function* () {
233371
- const command = make$47(claudeSettings?.binaryPath || "claude", [
233398
+ const command = make$48(claudeSettings?.binaryPath || "claude", [
233372
233399
  "-p",
233373
233400
  "--output-format",
233374
233401
  "json",
@@ -282886,7 +282913,7 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
282886
282913
  });
282887
282914
  const resolveDefaultBranch = fn$1("resolveDefaultBranch")(function* (cwd, localDefaultBranch) {
282888
282915
  if (localDefaultBranch && localDefaultBranch.length > 0) return localDefaultBranch;
282889
- const fromGh = yield* get$7(defaultBranchFallbackCache, normalizeStatusCacheKey(cwd));
282916
+ const fromGh = yield* get$8(defaultBranchFallbackCache, normalizeStatusCacheKey(cwd));
282890
282917
  if (fromGh && fromGh.length > 0) return fromGh;
282891
282918
  return DEFAULT_BASE_BRANCH_FALLBACK;
282892
282919
  });
@@ -283266,10 +283293,10 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
283266
283293
  };
283267
283294
  });
283268
283295
  const localStatus = fn$1("localStatus")(function* (input) {
283269
- return yield* get$7(localStatusResultCache, normalizeStatusCacheKey(input.cwd));
283296
+ return yield* get$8(localStatusResultCache, normalizeStatusCacheKey(input.cwd));
283270
283297
  });
283271
283298
  const remoteStatus = fn$1("remoteStatus")(function* (input) {
283272
- return yield* get$7(remoteStatusResultCache, normalizeStatusCacheKey(input.cwd));
283299
+ return yield* get$8(remoteStatusResultCache, normalizeStatusCacheKey(input.cwd));
283273
283300
  });
283274
283301
  const status = fn$1("status")(function* (input) {
283275
283302
  const [local, remote] = yield* all([localStatus(input), remoteStatus(input)]);
@@ -283420,7 +283447,7 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
283420
283447
  preparePullRequestThread,
283421
283448
  runStackedAction: fn$1("runStackedAction")(function* (input, options) {
283422
283449
  const progress = createProgressEmitter(input, options);
283423
- const currentPhase = yield* make$49(none$4());
283450
+ const currentPhase = yield* make$50(none$4());
283424
283451
  return yield* fn$1("runStackedAction.runAction")(function* () {
283425
283452
  const initialStatus = yield* gitCore.statusDetails(input.cwd);
283426
283453
  const wantsCommit = isCommitAction(input.action);
@@ -283509,7 +283536,7 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
283509
283536
  result
283510
283537
  });
283511
283538
  return result;
283512
- })().pipe(ensuring(invalidateStatus(input.cwd)), tapError((error) => flatMap(get$5(currentPhase), (phase) => progress.emit({
283539
+ })().pipe(ensuring(invalidateStatus(input.cwd)), tapError((error) => flatMap(get$6(currentPhase), (phase) => progress.emit({
283513
283540
  kind: "action_failed",
283514
283541
  phase: getOrNull(phase),
283515
283542
  message: error.message
@@ -285284,7 +285311,7 @@ function makeApprovedWorkerPlanEventState() {
285284
285311
  function promptKey(masterThreadId, promptId) {
285285
285312
  return `${masterThreadId}\n${promptId}`;
285286
285313
  }
285287
- function asRecord$5(value) {
285314
+ function asRecord$6(value) {
285288
285315
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
285289
285316
  }
285290
285317
  function exactMaterializedTaskIds(value, expectedCount) {
@@ -285294,7 +285321,7 @@ function exactMaterializedTaskIds(value, expectedCount) {
285294
285321
  }
285295
285322
  function readyBatchFromActivity(state, event) {
285296
285323
  if (event.payload.activity.kind !== "plan.task-creation.batch-succeeded") return null;
285297
- const payload = asRecord$5(event.payload.activity.payload);
285324
+ const payload = asRecord$6(event.payload.activity.payload);
285298
285325
  const promptId = payload?.["promptId"];
285299
285326
  if (typeof promptId !== "string") return null;
285300
285327
  const key = promptKey(event.payload.threadId, promptId);
@@ -286470,7 +286497,7 @@ function runtimeGrantNeedsRefresh(token, identity, nowSeconds = Math.floor(Date.
286470
286497
  return claims.expiresAtSeconds - nowSeconds <= RUNTIME_GRANT_REFRESH_SKEW_SECONDS;
286471
286498
  }
286472
286499
  /** Narrow an unknown to a plain object, or null. */
286473
- function asRecord$4(value) {
286500
+ function asRecord$5(value) {
286474
286501
  return value !== null && typeof value === "object" ? value : null;
286475
286502
  }
286476
286503
  /** The raw (untrimmed) string when it is present and not blank, else null. */
@@ -286482,7 +286509,7 @@ function asTimestamp(value) {
286482
286509
  return typeof value === "string" && Number.isFinite(Date.parse(value)) ? value : null;
286483
286510
  }
286484
286511
  function parseRuntimeGrantRefreshResponse(runtimeId, value) {
286485
- const data = asRecord$4(asRecord$4(value)?.data);
286512
+ const data = asRecord$5(asRecord$5(value)?.data);
286486
286513
  if (!data || data.runtimeId !== runtimeId) return null;
286487
286514
  const grantToken = asNonBlankString(data.grantToken);
286488
286515
  const expiresAt = asTimestamp(data.expiresAt);
@@ -286543,7 +286570,6 @@ async function refreshRuntimeProvisioningGrant(input) {
286543
286570
  async function maybeRefreshRuntimeProvisioningGrant(input) {
286544
286571
  const current = runtimeGrantToken();
286545
286572
  if (!current) return "skipped";
286546
- if (!runtimeGrantNeedsRefresh(current, input)) return "skipped";
286547
286573
  const exactIdentity = exactRuntimeControlIdentity(input);
286548
286574
  const currentClaims = currentGrantClaimsForRefresh({
286549
286575
  currentGrant: current,
@@ -286552,6 +286578,11 @@ async function maybeRefreshRuntimeProvisioningGrant(input) {
286552
286578
  });
286553
286579
  if (!currentClaims) throw invalidRefreshResponse("Current runtime provisioning grant is unverifiable.");
286554
286580
  const currentAuthorityClass = currentGrantAuthorityClass(currentClaims, exactIdentity);
286581
+ const controlAuthorityMissing = currentAuthorityClass === "exact" && exactIdentity !== null && readRuntimeControlAuthority({
286582
+ runtimeId: input.runtimeId,
286583
+ ...exactIdentity
286584
+ }) === null;
286585
+ if (!runtimeGrantNeedsRefresh(current, input) && !controlAuthorityMissing) return "skipped";
286555
286586
  const refreshed = await refreshRuntimeProvisioningGrant({
286556
286587
  runtimeId: input.runtimeId,
286557
286588
  currentGrant: current,
@@ -286598,7 +286629,7 @@ function normalizeCount(count) {
286598
286629
  return Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
286599
286630
  }
286600
286631
  const makeRuntimeDrainState = gen(function* () {
286601
- const stateRef = yield* make$49(initialState);
286632
+ const stateRef = yield* make$50(initialState);
286602
286633
  const update = (f) => updateAndGet(stateRef, f).pipe(map$3(snapshotFromState));
286603
286634
  return {
286604
286635
  beginTurn: (input) => update((state) => {
@@ -286649,8 +286680,8 @@ const makeRuntimeDrainState = gen(function* () {
286649
286680
  drainTargetImageVersion: input.drainTargetImageVersion ?? state.drainTargetImageVersion,
286650
286681
  drainForceRequired: input.drainForceRequired ?? state.drainForceRequired
286651
286682
  })),
286652
- snapshot: get$5(stateRef).pipe(map$3(snapshotFromState)),
286653
- isDraining: get$5(stateRef).pipe(map$3((state) => state.draining))
286683
+ snapshot: get$6(stateRef).pipe(map$3(snapshotFromState)),
286684
+ isDraining: get$6(stateRef).pipe(map$3((state) => state.draining))
286654
286685
  };
286655
286686
  });
286656
286687
  var RuntimeDrainState = class extends Service$1()("forge/runtimeDrain/RuntimeDrainState") {};
@@ -287203,17 +287234,17 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, fn$
287203
287234
  const browserManager = yield* BrowserManager;
287204
287235
  const runtimeDrainState = yield* RuntimeDrainState;
287205
287236
  const runtimeDrainReporter = yield* RuntimeDrainReporter;
287206
- const turnMessageIdsByTurnKey = yield* make$50({
287237
+ const turnMessageIdsByTurnKey = yield* make$51({
287207
287238
  capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
287208
287239
  timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
287209
287240
  lookup: () => succeed(/* @__PURE__ */ new Set())
287210
287241
  });
287211
- const bufferedAssistantTextByMessageId = yield* make$50({
287242
+ const bufferedAssistantTextByMessageId = yield* make$51({
287212
287243
  capacity: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_CACHE_CAPACITY,
287213
287244
  timeToLive: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_TTL,
287214
287245
  lookup: () => succeed("")
287215
287246
  });
287216
- const bufferedProposedPlanById = yield* make$50({
287247
+ const bufferedProposedPlanById = yield* make$51({
287217
287248
  capacity: BUFFERED_PROPOSED_PLAN_BY_ID_CACHE_CAPACITY,
287218
287249
  timeToLive: BUFFERED_PROPOSED_PLAN_BY_ID_TTL,
287219
287250
  lookup: () => succeed({
@@ -288052,7 +288083,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
288052
288083
  const serverSettingsService = yield* ServerSettingsService;
288053
288084
  const serverConfig = yield* ServerConfig;
288054
288085
  const runtimeDrainState = yield* RuntimeDrainState;
288055
- const handledTurnStartKeys = yield* make$50({
288086
+ const handledTurnStartKeys = yield* make$51({
288056
288087
  capacity: HANDLED_TURN_START_KEY_MAX,
288057
288088
  timeToLive: HANDLED_TURN_START_KEY_TTL,
288058
288089
  lookup: () => succeed(true)
@@ -290844,7 +290875,7 @@ const readOpenCodeApiKey = (_settings) => process.env.OPENCODE_API_KEY || proces
290844
290875
  const runOpenCodeCommand = fn$1("runOpenCodeCommand")(function* (binaryPath, args) {
290845
290876
  const useShell = process.platform === "win32";
290846
290877
  if (useShell && !isShellSafeCommandPath(binaryPath)) return yield* fail(/* @__PURE__ */ new Error(`Refusing to spawn opencode: \`binaryPath\` contains shell metacharacters that cmd.exe would interpret as additional commands.`));
290847
- return yield* spawnAndCollect(binaryPath, make$47(binaryPath, [...args], {
290878
+ return yield* spawnAndCollect(binaryPath, make$48(binaryPath, [...args], {
290848
290879
  shell: useShell,
290849
290880
  env: scrubForgeProviderChildEnvSecrets(process.env)
290850
290881
  }));
@@ -291087,7 +291118,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
291087
291118
  provider
291088
291119
  })]));
291089
291120
  const fallbackByProvider = new Map(fallbackProviders.map((provider) => [provider.provider, provider]));
291090
- const providersRef = yield* make$49(yield* forEach(PROVIDER_CACHE_IDS, (provider) => {
291121
+ const providersRef = yield* make$50(yield* forEach(PROVIDER_CACHE_IDS, (provider) => {
291091
291122
  const filePath = cachePathByProvider.get(provider);
291092
291123
  const fallbackProvider = fallbackByProvider.get(provider);
291093
291124
  return readProviderStatusCache(filePath).pipe(provideService(FileSystem, fileSystem), map$3((cachedProvider) => {
@@ -291145,7 +291176,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
291145
291176
  ], {
291146
291177
  concurrency: "unbounded",
291147
291178
  discard: true
291148
- }).pipe(andThen(get$5(providersRef)));
291179
+ }).pipe(andThen(get$6(providersRef)));
291149
291180
  }
291150
291181
  });
291151
291182
  yield* runForEach(codexProvider.streamChanges, (provider) => syncProvider(provider)).pipe(forkScoped);
@@ -291156,7 +291187,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
291156
291187
  yield* runForEach(cursorProvider.streamChanges, (provider) => syncProvider(provider)).pipe(forkScoped);
291157
291188
  yield* runForEach(opencodeProvider.streamChanges, (provider) => syncProvider(provider)).pipe(forkScoped);
291158
291189
  return {
291159
- getProviders: get$5(providersRef),
291190
+ getProviders: get$6(providersRef),
291160
291191
  refresh: (provider) => refresh(provider).pipe(tapError(logError), orElseSucceed(() => [])),
291161
291192
  get streamChanges() {
291162
291193
  return fromPubSub(changesPubSub);
@@ -291526,7 +291557,7 @@ const RepositoryIdentityResolverLive = effect(RepositoryIdentityResolver, fn$1("
291526
291557
  });
291527
291558
  return { resolve: fn$1("RepositoryIdentityResolver.resolve")(function* (cwd) {
291528
291559
  const location = yield* promise(() => resolveRepositoryLocation(cwd));
291529
- const baseIdentity = yield* get$7(repositoryIdentityCache, location.cacheKey);
291560
+ const baseIdentity = yield* get$8(repositoryIdentityCache, location.cacheKey);
291530
291561
  if (baseIdentity === null) return null;
291531
291562
  return location.subpath === null ? baseIdentity : {
291532
291563
  ...baseIdentity,
@@ -291835,7 +291866,7 @@ const WorkspaceEntriesLive = effect(WorkspaceEntries, gen(function* () {
291835
291866
  if (normalizedCwd !== cwd) yield* invalidate(workspaceIndexCache, normalizedCwd);
291836
291867
  });
291837
291868
  const search = fn$1("WorkspaceEntries.search")(function* (input) {
291838
- return yield* get$7(workspaceIndexCache, yield* normalizeWorkspaceRoot(input.cwd)).pipe(map$3((index) => {
291869
+ return yield* get$8(workspaceIndexCache, yield* normalizeWorkspaceRoot(input.cwd)).pipe(map$3((index) => {
291839
291870
  const normalizedQuery = normalizeSearchQuery(input.query, { trimLeadingPattern: /^[@./]+/ });
291840
291871
  const limit = Math.max(0, Math.floor(input.limit));
291841
291872
  const rankedEntries = [];
@@ -291859,7 +291890,7 @@ const WorkspaceEntriesLive = effect(WorkspaceEntries, gen(function* () {
291859
291890
  return {
291860
291891
  invalidate: invalidate$1,
291861
291892
  list: fn$1("WorkspaceEntries.list")(function* (input) {
291862
- const index = yield* get$7(workspaceIndexCache, yield* normalizeWorkspaceRoot(input.cwd));
291893
+ const index = yield* get$8(workspaceIndexCache, yield* normalizeWorkspaceRoot(input.cwd));
291863
291894
  return {
291864
291895
  entries: index.entries.map((entry) => ({
291865
291896
  path: entry.path,
@@ -293493,7 +293524,7 @@ function resolveBuildCommitFromEnv(env) {
293493
293524
  * environment descriptor down instead of reporting an honest "unknown".
293494
293525
  */
293495
293526
  function readBakedBuildCommit() {
293496
- return "75c8e9532c9e35e71d4da1d8d45474fa2855ff1d";
293527
+ return "7f0d765bc59cb837f8aa8025b9b2f855df3fd36d";
293497
293528
  }
293498
293529
  async function resolveServerBuildCommit(input) {
293499
293530
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -293667,7 +293698,7 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
293667
293698
  return yield* decodeUnknownEffect(EnvironmentMetadata)(parsed).pipe(orElseSucceed(() => ({ displayName: null })));
293668
293699
  });
293669
293700
  const writeMetadata = (metadata) => fileSystem.writeFileString(serverConfig.environmentMetadataPath, `${JSON.stringify(metadata, null, 2)}\n`);
293670
- const displayNameOverrideRef = yield* make$49(normalizeDisplayName((yield* readMetadata).displayName ?? null));
293701
+ const displayNameOverrideRef = yield* make$50(normalizeDisplayName((yield* readMetadata).displayName ?? null));
293671
293702
  const posthog = yield* PosthogPublicConfig.asEffect();
293672
293703
  const buildCommit = yield* promise(() => resolveServerBuildCommit({
293673
293704
  baked: readBakedBuildCommit(),
@@ -293676,7 +293707,7 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
293676
293707
  }));
293677
293708
  const deviceRuntimeId = resolveDescriptorDeviceRuntimeId(serverConfig);
293678
293709
  const buildDescriptor = gen(function* () {
293679
- const displayNameOverride = yield* get$5(displayNameOverrideRef);
293710
+ const displayNameOverride = yield* get$6(displayNameOverrideRef);
293680
293711
  const os = platformOs();
293681
293712
  return {
293682
293713
  environmentId,
@@ -294912,7 +294943,7 @@ const generatePairingToken = () => {
294912
294943
  const BootstrapCredentialServiceLive = effect(BootstrapCredentialService, gen(function* () {
294913
294944
  const config = yield* ServerConfig;
294914
294945
  const pairingLinks = yield* AuthPairingLinkRepository;
294915
- const seededGrantsRef = yield* make$49(/* @__PURE__ */ new Map());
294946
+ const seededGrantsRef = yield* make$50(/* @__PURE__ */ new Map());
294916
294947
  const changesPubSub = yield* unbounded$1();
294917
294948
  const invalidBootstrapCredentialError = (message) => new BootstrapCredentialError({
294918
294949
  message,
@@ -295357,7 +295388,7 @@ const SessionCredentialServiceLive = effect(SessionCredentialService, gen(functi
295357
295388
  if (serverConfig.forgeCloudShellMode === true && configuredSigningKey === null) return yield* die$1(/* @__PURE__ */ new Error("FORGE_SESSION_SIGNING_KEY must decode to at least 32 bytes in cloud-shell mode. Forge Cloud refuses to issue restart-unsafe or replica-local sessions."));
295358
295389
  const signingSecret = configuredSigningKey ?? (yield* secretStore.getOrCreateRandom(SIGNING_SECRET_NAME, 32));
295359
295390
  const statelessCookieSessions = configuredSigningKey !== null;
295360
- const connectedSessionsRef = yield* make$49(/* @__PURE__ */ new Map());
295391
+ const connectedSessionsRef = yield* make$50(/* @__PURE__ */ new Map());
295361
295392
  const changesPubSub = yield* unbounded$1();
295362
295393
  const cookieName = resolveSessionCookieName({
295363
295394
  mode: serverConfig.mode,
@@ -295379,7 +295410,7 @@ const SessionCredentialServiceLive = effect(SessionCredentialService, gen(functi
295379
295410
  const loadActiveSession = (sessionId) => gen(function* () {
295380
295411
  const row = yield* authSessions.getById({ sessionId });
295381
295412
  if (isNone(row) || row.value.revokedAt !== null) return none$4();
295382
- const connectedSessions = yield* get$5(connectedSessionsRef);
295413
+ const connectedSessions = yield* get$6(connectedSessionsRef);
295383
295414
  return some(toAuthClientSession({
295384
295415
  sessionId: row.value.sessionId,
295385
295416
  subject: row.value.subject,
@@ -295544,7 +295575,7 @@ const SessionCredentialServiceLive = effect(SessionCredentialService, gen(functi
295544
295575
  })));
295545
295576
  const listActive = () => gen(function* () {
295546
295577
  const now$1 = yield* now;
295547
- const connectedSessions = yield* get$5(connectedSessionsRef);
295578
+ const connectedSessions = yield* get$6(connectedSessionsRef);
295548
295579
  return (yield* authSessions.listActive({ now: now$1 })).map((row) => toAuthClientSession({
295549
295580
  sessionId: row.sessionId,
295550
295581
  subject: row.subject,
@@ -302524,7 +302555,7 @@ const LocalAutomationSchedulerLive = effectDiscard(gen(function* () {
302524
302555
  }));
302525
302556
  //#endregion
302526
302557
  //#region src/command/providerUsageEnvironment.ts
302527
- function asRecord$3(value) {
302558
+ function asRecord$4(value) {
302528
302559
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
302529
302560
  }
302530
302561
  function positiveInteger(value) {
@@ -302544,7 +302575,7 @@ function readRuntimeId(row) {
302544
302575
  return typeof runtimeId === "string" && runtimeId.trim() !== "" ? runtimeId : null;
302545
302576
  }
302546
302577
  function readCandidate(runtime, ownerUserId) {
302547
- const row = asRecord$3(runtime);
302578
+ const row = asRecord$4(runtime);
302548
302579
  if (row === null || !isOwnedRuntime(row, ownerUserId) || row["desiredState"] !== "running") return null;
302549
302580
  const organizationId = positiveInteger(row["organizationId"]);
302550
302581
  const environmentId = readEnvironmentId(row["environmentId"]);
@@ -302579,15 +302610,17 @@ function deduplicateCandidates(candidates) {
302579
302610
  * organization from browser input.
302580
302611
  */
302581
302612
  function selectProviderUsageEnvironment(rawCatalog, ownerUserId) {
302582
- const runtimes = asRecord$3(asRecord$3(rawCatalog)?.["data"])?.["runtimes"];
302613
+ const runtimes = asRecord$4(asRecord$4(rawCatalog)?.["data"])?.["runtimes"];
302583
302614
  if (!Array.isArray(runtimes)) return { kind: "unavailable" };
302584
302615
  const candidates = deduplicateCandidates(runtimes.map((runtime) => readCandidate(runtime, ownerUserId)).filter((candidate) => candidate !== null));
302585
302616
  const bestRank = Math.min(...candidates.map((candidate) => statusRank(candidate.status)));
302586
302617
  const bestCandidates = candidates.filter((candidate) => statusRank(candidate.status) === bestRank);
302587
302618
  if (bestCandidates.length !== 1) return { kind: "unavailable" };
302619
+ const selected = bestCandidates[0];
302588
302620
  return {
302589
302621
  kind: "ready",
302590
- organizationId: bestCandidates[0].organizationId
302622
+ organizationId: selected.organizationId,
302623
+ runtimeId: selected.runtimeId
302591
302624
  };
302592
302625
  }
302593
302626
  //#endregion
@@ -302608,13 +302641,22 @@ function selectProviderUsageEnvironment(rawCatalog, ownerUserId) {
302608
302641
  const FAILURE_TEXT = {
302609
302642
  CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE: "Refresh needs your Environment running.",
302610
302643
  CLAUDE_USAGE_CREDENTIAL_NOT_READY: "The Claude credential is not applied to your Environment yet.",
302644
+ CLAUDE_USAGE_CREDENTIAL_APPLY_FAILED: "Your Environment rejected the delivered Claude credential.",
302645
+ CLAUDE_USAGE_CREDENTIAL_REFRESHING: "The delivered Claude credential expired. CMMD is sending a replacement.",
302611
302646
  CLAUDE_USAGE_REFRESH_IN_PROGRESS: "A refresh for this account is already running.",
302612
302647
  CLAUDE_USAGE_PROBE_FAILED: "Your Environment could not read Claude usage.",
302613
302648
  CLAUDE_USAGE_RECONNECT_REQUIRED: "Reconnect this Claude account to refresh usage.",
302614
302649
  CLAUDE_USAGE_ACCOUNT_NOT_FOUND: "This Claude account is no longer connected.",
302615
302650
  CLAUDE_USAGE_REFRESH_UNAVAILABLE: "Claude usage refresh is unavailable."
302616
302651
  };
302617
- /** Verbatim from CMMD `personal-claude-usage.ts` and `provider-usage-service.ts`. */
302652
+ /**
302653
+ * Verbatim from CMMD `personal-claude-usage.ts` and `provider-usage-service.ts`.
302654
+ *
302655
+ * Three reasons land on `CLAUDE_USAGE_CREDENTIAL_NOT_READY` because the refresh
302656
+ * response cannot tell them apart. `claudeUsageCredentialReadiness.ts` splits
302657
+ * them afterwards by reading the runtime's readiness, which is the only place
302658
+ * that knows whether a delivery is on its way or has already failed.
302659
+ */
302618
302660
  const CODE_BY_UPSTREAM_REASON = {
302619
302661
  runtime_not_active: "CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE",
302620
302662
  claude_native_delivery_disabled: "CLAUDE_USAGE_ENVIRONMENT_UNAVAILABLE",
@@ -302627,7 +302669,12 @@ const CODE_BY_UPSTREAM_REASON = {
302627
302669
  usage_receipt_invalid: "CLAUDE_USAGE_PROBE_FAILED",
302628
302670
  usage_output_invalid: "CLAUDE_USAGE_PROBE_FAILED"
302629
302671
  };
302630
- function failure(code, status) {
302672
+ /**
302673
+ * The one place a failure body is built, so every sentence a browser reads is
302674
+ * written in `FAILURE_TEXT` above. `claudeUsageCredentialReadiness.ts` calls it
302675
+ * to reach the two codes no upstream reason maps to.
302676
+ */
302677
+ function describeClaudeUsageRefreshFailureCode(code, status) {
302631
302678
  return {
302632
302679
  status,
302633
302680
  body: {
@@ -302636,6 +302683,9 @@ function failure(code, status) {
302636
302683
  }
302637
302684
  };
302638
302685
  }
302686
+ function failure(code, status) {
302687
+ return describeClaudeUsageRefreshFailureCode(code, status);
302688
+ }
302639
302689
  /**
302640
302690
  * CMMD sends the reason as `{ "error": "<reason>" }`. Anything else, including
302641
302691
  * a longer sentence that happens to start with an allowlisted word, is treated
@@ -302656,6 +302706,77 @@ function describeClaudeUsageRefreshFailure(error) {
302656
302706
  return failure("CLAUDE_USAGE_REFRESH_UNAVAILABLE", error.status === 503 ? 503 : 502);
302657
302707
  }
302658
302708
  //#endregion
302709
+ //#region src/command/claudeUsageCredentialReadiness.ts
302710
+ /**
302711
+ * Which "credential not ready" a Claude usage refresh actually hit.
302712
+ *
302713
+ * CMMD answers a blocked refresh with one reason for three different worlds:
302714
+ * a delivery still travelling, a delivery CMMD cannot produce, and a delivery
302715
+ * the Environment already ran and rejected. `claudeUsageRefreshFailure.ts` has
302716
+ * to collapse all three into `CLAUDE_USAGE_CREDENTIAL_NOT_READY`, because the
302717
+ * refresh response carries nothing that separates them. The card then says
302718
+ * "not applied yet", which asks the user to wait even when waiting can never
302719
+ * work: on 2026-09-08 CMMD's reconciler failed native credential validation on
302720
+ * runtime 523cd771 forty-three times in seventy-two minutes, and the card said
302721
+ * "yet" through all of it.
302722
+ *
302723
+ * The runtime readiness read is the one source that separates the worlds, so
302724
+ * the handler makes that read only for the collapsed code and hands the answer
302725
+ * here. Every sentence is written in `claudeUsageRefreshFailure.ts`; nothing
302726
+ * from CMMD's `lastErrorCode` or `lastErrorMessage` is repeated to a browser.
302727
+ */
302728
+ const CMMD_READINESS_PATH_PREFIX = "/api/forge/context/providers/claude/runtime-readiness/";
302729
+ /** Typed as the gateway's absolute-path shape so the call site needs no cast. */
302730
+ function claudeUsageReadinessPath(runtimeId) {
302731
+ return `${CMMD_READINESS_PATH_PREFIX}${encodeURIComponent(runtimeId)}`;
302732
+ }
302733
+ /**
302734
+ * Whether a readiness read would tell the caller anything it does not know.
302735
+ *
302736
+ * Only the collapsed code is ambiguous. Every other failure already names its
302737
+ * own cause, so asking CMMD again would cost a round trip on the error path
302738
+ * and could only produce a less specific answer.
302739
+ */
302740
+ function claudeUsageFailureWantsReadiness(failure) {
302741
+ return failure.body.code === "CLAUDE_USAGE_CREDENTIAL_NOT_READY";
302742
+ }
302743
+ function asRecord$3(value) {
302744
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
302745
+ }
302746
+ function readString(value) {
302747
+ return typeof value === "string" && value !== "" ? value : null;
302748
+ }
302749
+ /**
302750
+ * Refines the collapsed credential failure using the runtime's readiness.
302751
+ *
302752
+ * The ranking is by what the user can act on, not by which field looks most
302753
+ * severe:
302754
+ *
302755
+ * 1. A reason of `credential_reconnect_required` or `credential_not_connected`
302756
+ * means CMMD holds no usable grant. That is upstream of delivery, so it wins
302757
+ * even when the delivery it caused also failed. No re-delivery helps; only a
302758
+ * reconnect does.
302759
+ * 2. `deliveryStatus: "failed"` means CMMD had a credential, sent it, and the
302760
+ * Environment rejected it. Waiting cannot fix that, which is exactly what
302761
+ * the collapsed sentence tells the user to do.
302762
+ * 3. `credential_expired_refreshing` means a replacement is already in flight,
302763
+ * so the honest instruction is to retry shortly.
302764
+ *
302765
+ * Anything else, including a readiness read that failed or answered a shape
302766
+ * this module does not recognise, keeps the collapsed failure. A refinement
302767
+ * that guessed would be worse than the vague sentence it replaced.
302768
+ */
302769
+ function refineClaudeUsageRefreshFailure(failure, rawReadiness) {
302770
+ if (!claudeUsageFailureWantsReadiness(failure)) return failure;
302771
+ const readiness = asRecord$3(asRecord$3(rawReadiness)?.["data"]);
302772
+ if (readiness === null) return failure;
302773
+ const reasonCode = claudeReadinessReasonCode(readString(readiness["reason"]));
302774
+ if (reasonCode === "CREDENTIAL_RECONNECT_REQUIRED") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_RECONNECT_REQUIRED", 409);
302775
+ if (readiness["deliveryStatus"] === "failed") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_CREDENTIAL_APPLY_FAILED", 503);
302776
+ if (reasonCode === "CREDENTIAL_EXPIRED_REFRESHING") return describeClaudeUsageRefreshFailureCode("CLAUDE_USAGE_CREDENTIAL_REFRESHING", 503);
302777
+ return failure;
302778
+ }
302779
+ //#endregion
302659
302780
  //#region src/command/wsToken.ts
302660
302781
  /**
302661
302782
  * Build the WS token response given an optional PAT and the configured CMMD
@@ -304520,6 +304641,25 @@ function buildClaudeUsageRefreshErrorResponse(error) {
304520
304641
  const failure = describeClaudeUsageRefreshFailure(error);
304521
304642
  return jsonUnsafe(failure.body, { status: failure.status });
304522
304643
  }
304644
+ /**
304645
+ * Answers a refresh CMMD refused, asking the selected runtime what state its
304646
+ * Claude credential is in when the refusal alone cannot say. Only the collapsed
304647
+ * credential code costs the extra read, and a readiness read that itself fails
304648
+ * leaves the original answer untouched.
304649
+ */
304650
+ function answerBlockedClaudeUsageRefresh(input) {
304651
+ return gen(function* () {
304652
+ const failure = describeClaudeUsageRefreshFailure(input.error);
304653
+ if (!claudeUsageFailureWantsReadiness(failure)) return jsonUnsafe(failure.body, { status: failure.status });
304654
+ const readinessOutcome = yield* runCmmdRestProxy(input.session, (jwt) => cmmdGateway.request({
304655
+ method: "GET",
304656
+ jwt,
304657
+ path: claudeUsageReadinessPath(input.runtimeId)
304658
+ }), { jwt: input.requestJwt });
304659
+ const refined = refineClaudeUsageRefreshFailure(failure, readinessOutcome.ok ? readinessOutcome.value : null);
304660
+ return jsonUnsafe(refined.body, { status: refined.status });
304661
+ });
304662
+ }
304523
304663
  function makeRefreshProviderUsageHandler(dependencies = {}) {
304524
304664
  return gen(function* () {
304525
304665
  const request = yield* HttpServerRequest;
@@ -304556,7 +304696,12 @@ function makeRefreshProviderUsageHandler(dependencies = {}) {
304556
304696
  body: { providerAccountId: input.providerAccountId },
304557
304697
  orgId: String(target.organizationId)
304558
304698
  }), { jwt: requestJwt });
304559
- if (!refreshOutcome.ok) return buildClaudeUsageRefreshErrorResponse(refreshOutcome.error);
304699
+ if (!refreshOutcome.ok) return yield* answerBlockedClaudeUsageRefresh({
304700
+ session,
304701
+ requestJwt,
304702
+ runtimeId: target.runtimeId,
304703
+ error: refreshOutcome.error
304704
+ });
304560
304705
  const snapshotOutcome = yield* runCmmdRestProxy(session, (jwt) => cmmdGateway.request({
304561
304706
  method: "GET",
304562
304707
  jwt,
@@ -304655,6 +304800,22 @@ registerProxyRoute({
304655
304800
  responseShape: "unwrapData",
304656
304801
  successStatus: 200
304657
304802
  });
304803
+ registerProxyRoute({
304804
+ forgePath: "/api/cmmd/forge-runtimes/:runtimeId/execution-intents",
304805
+ method: "POST",
304806
+ cmmdPath: "/api/forge/context/runtimes/:runtimeId/execution-intents",
304807
+ orgIdSource: "none",
304808
+ responseShape: "unwrapData",
304809
+ successStatus: 200
304810
+ });
304811
+ registerProxyRoute({
304812
+ forgePath: "/api/cmmd/forge-runtimes/:runtimeId/execution-intents/:intentId/dispatched",
304813
+ method: "POST",
304814
+ cmmdPath: "/api/forge/context/runtimes/:runtimeId/execution-intents/:intentId/dispatched",
304815
+ orgIdSource: "none",
304816
+ responseShape: "unwrapData",
304817
+ successStatus: 200
304818
+ });
304658
304819
  registerProxyRoute({
304659
304820
  forgePath: "/api/cmmd/devices/:deviceId/revoke",
304660
304821
  method: "POST",
@@ -306805,7 +306966,7 @@ const RuntimeReplicationLive = effect(RuntimeReplication, gen(function* () {
306805
306966
  const terminal = yield* serviceOption(TerminalManager);
306806
306967
  const activeHourMeter = yield* ActiveHourMeter;
306807
306968
  const runtimeId = resolveRuntimeReplicationRuntimeId(config);
306808
- const outboxWarningActive = yield* make$49(false);
306969
+ const outboxWarningActive = yield* make$50(false);
306809
306970
  const enqueueInventoryPayload = (payload) => runtimeId ? outbox.enqueue({
306810
306971
  runtimeId,
306811
306972
  streamKey: "inventory",
@@ -308060,7 +308221,7 @@ const isActiveHourMeteringEnabled = gen(function* () {
308060
308221
  }).pipe(catch_(() => succeed(false)));
308061
308222
  const ActiveHourMeterLive = effect(ActiveHourMeter, gen(function* () {
308062
308223
  const outbox = yield* RuntimeReplicationOutbox;
308063
- const statesByRuntime = yield* make$49(/* @__PURE__ */ new Map());
308224
+ const statesByRuntime = yield* make$50(/* @__PURE__ */ new Map());
308064
308225
  const markAwake = (runtimeId) => gen(function* () {
308065
308226
  if (!(yield* isActiveHourMeteringEnabled)) return;
308066
308227
  yield* update$4(statesByRuntime, (states) => {
@@ -310447,11 +310608,11 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
310447
310608
  if (!preparedHandoffMatchesRun(preparedHandoff, input.runId)) return yield* coordinatorError("registerHandoff", "PIPELINE_HANDOFF_PREPARATION_INVALID", "The pipeline handoff preparation is missing, belongs to another run, or was already consumed.");
310448
310609
  preparedHandoffs.delete(input.preparedHandoff);
310449
310610
  const ownedProviderAuthorityInstallations = /* @__PURE__ */ new Set();
310450
- const preparedAuthorityRef = yield* make$49({
310611
+ const preparedAuthorityRef = yield* make$50({
310451
310612
  authority: preparedHandoff.authority,
310452
310613
  preparation: preparedHandoff.providerAuthorityPreparation
310453
310614
  });
310454
- const acceptingHeartbeatRef = yield* make$49(true);
310615
+ const acceptingHeartbeatRef = yield* make$50(true);
310455
310616
  const heartbeatPublicationSemaphore = yield* make$43(1);
310456
310617
  if ((yield* store.getByRunId(input.runId)) !== null) return yield* coordinatorError("registerHandoff", "PIPELINE_HANDOFF_ALREADY_BOUND", "The CMMD run already has a Forge task thread and must use the authority rebind contract.");
310457
310618
  const snapshot = preparedHandoff.snapshot;
@@ -310486,7 +310647,7 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
310486
310647
  contextHash: preparedHandoff.authority.contextHash,
310487
310648
  contextSnapshot: snapshot.run.contextSnapshot
310488
310649
  }).pipe(mapError((cause) => coordinatorError("registerHandoff", "PIPELINE_CONTEXT_ARTIFACT_FAILED", "The immutable CMMD run context could not be materialized for the provider.", cause)));
310489
- const latestPreparedAuthority = yield* heartbeatPublicationSemaphore.withPermits(1)(set$2(acceptingHeartbeatRef, false).pipe(andThen(get$5(preparedAuthorityRef))));
310650
+ const latestPreparedAuthority = yield* heartbeatPublicationSemaphore.withPermits(1)(set$2(acceptingHeartbeatRef, false).pipe(andThen(get$6(preparedAuthorityRef))));
310490
310651
  const persistedAuthority = yield* persistAuthoritySecret({
310491
310652
  runId: input.runId,
310492
310653
  organizationId: latestPreparedAuthority.authority.organizationId,
@@ -310560,7 +310721,7 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
310560
310721
  executionSessionInstallations.set(input.runId, rollbackSession);
310561
310722
  }), gen(function* () {
310562
310723
  yield* sleep$4(seconds(30));
310563
- const currentAuthority = (yield* get$5(preparedAuthorityRef)).authority;
310724
+ const currentAuthority = (yield* get$6(preparedAuthorityRef)).authority;
310564
310725
  const heartbeat = yield* client.heartbeat({
310565
310726
  runId: input.runId,
310566
310727
  authority: currentAuthority,
@@ -310572,7 +310733,7 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
310572
310733
  heartbeat
310573
310734
  });
310574
310735
  yield* heartbeatPublicationSemaphore.withPermits(1)(gen(function* () {
310575
- if (!(yield* get$5(acceptingHeartbeatRef))) return;
310736
+ if (!(yield* get$6(acceptingHeartbeatRef))) return;
310576
310737
  yield* set$2(preparedAuthorityRef, {
310577
310738
  authority: heartbeat.refreshedAuthority,
310578
310739
  preparation
@@ -315296,9 +315457,9 @@ const AgentProtocolReactorLive = effect(AgentProtocolReactor, gen(function* () {
315296
315457
  const PRUNE_GRACE_MS = 6e4;
315297
315458
  const makeUserSlot = gen(function* () {
315298
315459
  return {
315299
- snapshotRef: yield* make$49(null),
315460
+ snapshotRef: yield* make$50(null),
315300
315461
  pubsub: yield* unbounded$1(),
315301
- subscriberCountRef: yield* make$49(0)
315462
+ subscriberCountRef: yield* make$50(0)
315302
315463
  };
315303
315464
  });
315304
315465
  const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function* () {
@@ -315338,14 +315499,14 @@ const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function
315338
315499
  */
315339
315500
  const schedulePrune = (userId, slot) => gen(function* () {
315340
315501
  yield* sleep$4(millis(PRUNE_GRACE_MS));
315341
- if ((yield* get$5(slot.subscriberCountRef)) > 0) return;
315342
- if ((yield* get$5(slot.snapshotRef))?.phase !== "app-ready") return;
315502
+ if ((yield* get$6(slot.subscriberCountRef)) > 0) return;
315503
+ if ((yield* get$6(slot.snapshotRef))?.phase !== "app-ready") return;
315343
315504
  yield* shutdown$2(slot.pubsub);
315344
315505
  yield* removeSlot(userId);
315345
315506
  }).pipe(forkIn(pruneScope), asVoid);
315346
315507
  const update = (userId, event) => gen(function* () {
315347
315508
  const slot = yield* getOrCreateSlot(userId);
315348
- const previous = yield* get$5(slot.snapshotRef);
315509
+ const previous = yield* get$6(slot.snapshotRef);
315349
315510
  if (previous !== null && event.ts < previous.ts) return;
315350
315511
  yield* set$2(slot.snapshotRef, event);
315351
315512
  yield* publish(slot.pubsub, event);
@@ -315354,7 +315515,7 @@ const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function
315354
315515
  const snapshot = (userId) => gen(function* () {
315355
315516
  const slot = (yield* get$2(slotsRef)).get(userId);
315356
315517
  if (!slot) return null;
315357
- return yield* get$5(slot.snapshotRef);
315518
+ return yield* get$6(slot.snapshotRef);
315358
315519
  });
315359
315520
  /**
315360
315521
  * Stream of phase events for `userId`. Emits the current snapshot first
@@ -315363,7 +315524,7 @@ const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function
315363
315524
  */
315364
315525
  const subscribe = (userId) => unwrap$1(gen(function* () {
315365
315526
  const slot = yield* getOrCreateSlot(userId);
315366
- const initial = yield* get$5(slot.snapshotRef);
315527
+ const initial = yield* get$6(slot.snapshotRef);
315367
315528
  const live = fromPubSub(slot.pubsub);
315368
315529
  const stream = initial === null ? live : concat$2(succeed$4(initial), live);
315369
315530
  yield* update$4(slot.subscriberCountRef, (n) => n + 1);
@@ -316339,13 +316500,13 @@ const gitUrlCloneRouteLayer = add$1("POST", "/api/cloud/git/clone-url", gen(func
316339
316500
  //#endregion
316340
316501
  //#region src/server.ts
316341
316502
  const PtyAdapterLive = unwrap(gen(function* () {
316342
- if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunPTY-C_ONQ8rt.mjs"))).layer;
316343
- else return (yield* promise(() => import("./NodePTY-DU_KoZdd.mjs"))).layer;
316503
+ if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunPTY-oVISucl_.mjs"))).layer;
316504
+ else return (yield* promise(() => import("./NodePTY-CVH2yNYl.mjs"))).layer;
316344
316505
  }));
316345
316506
  const HttpServerLive = unwrap(gen(function* () {
316346
316507
  const config = yield* ServerConfig;
316347
- if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunHttpServer-GM72b26K.mjs"))).layer(bunHttpServerOptions(config));
316348
- const [NodeHttpServer, NodeHttp] = yield* all([promise(() => import("./NodeHttpServer-DmEyd0J4.mjs")), promise(() => import("node:http"))]);
316508
+ if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunHttpServer-VI75aqJw.mjs"))).layer(bunHttpServerOptions(config));
316509
+ const [NodeHttpServer, NodeHttp] = yield* all([promise(() => import("./NodeHttpServer-Dw7ivXfX.mjs")), promise(() => import("node:http"))]);
316349
316510
  return NodeHttpServer.layer(NodeHttp.createServer, {
316350
316511
  host: config.host,
316351
316512
  port: config.port
@@ -316353,10 +316514,10 @@ const HttpServerLive = unwrap(gen(function* () {
316353
316514
  }));
316354
316515
  const PlatformServicesLive = unwrap(gen(function* () {
316355
316516
  if (typeof Bun !== "undefined") {
316356
- const { layer } = yield* promise(() => import("./BunServices-B-6JkR0Q.mjs"));
316517
+ const { layer } = yield* promise(() => import("./BunServices-D0JTDujL.mjs"));
316357
316518
  return layer;
316358
316519
  } else {
316359
- const { layer } = yield* promise(() => import("./NodeServices-DeNLW36O.mjs").then((n) => n.t));
316520
+ const { layer } = yield* promise(() => import("./NodeServices-CBNXOYLG.mjs").then((n) => n.t));
316360
316521
  return layer;
316361
316522
  }
316362
316523
  }));
@@ -317041,12 +317202,12 @@ const findActiveProjectTarget = fn$1("findActiveProjectTarget")(function* (input
317041
317202
  workspaceRoot: resolved.workspaceRoot
317042
317203
  };
317043
317204
  });
317044
- const fetchLiveOrchestrationSnapshot = (origin, bearerToken$1) => runLiveServerRequest(get$6(`${origin}/api/orchestration/snapshot`).pipe(acceptJson, bearerToken(bearerToken$1)), matchStatus({
317205
+ const fetchLiveOrchestrationSnapshot = (origin, bearerToken$1) => runLiveServerRequest(get$7(`${origin}/api/orchestration/snapshot`).pipe(acceptJson, bearerToken(bearerToken$1)), matchStatus({
317045
317206
  "2xx": decodeOrchestrationReadModelResponse,
317046
317207
  orElse: (response) => readErrorMessageFromResponse(response).pipe(flatMap((message) => fail(new Error(message))))
317047
317208
  }));
317048
317209
  const ProjectLeadExplanationEnvelope = Struct({ data: ProjectLeadExplanationSchema });
317049
- const fetchLiveProjectLeadExplanation = (origin, bearerToken$3, projectId) => runLiveServerRequest(get$6(`${origin}/api/cmmd/projects/${projectId}/project-lead/explain`).pipe(acceptJson, bearerToken(bearerToken$3)), matchStatus({
317210
+ const fetchLiveProjectLeadExplanation = (origin, bearerToken$3, projectId) => runLiveServerRequest(get$7(`${origin}/api/cmmd/projects/${projectId}/project-lead/explain`).pipe(acceptJson, bearerToken(bearerToken$3)), matchStatus({
317050
317211
  "2xx": (response) => schemaBodyJson$1(ProjectLeadExplanationEnvelope)(response).pipe(map$3((body) => body.data)),
317051
317212
  orElse: (response) => readErrorMessageFromResponse(response).pipe(flatMap((message) => fail(new Error(message))))
317052
317213
  }));