@cmmd-center/forge 0.13.124 → 0.13.126

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 (37) hide show
  1. package/dist/bin.cjs +365 -65
  2. package/dist/bin.mjs +394 -94
  3. package/dist/client/assets/{CanvasPanel-BOh2xUZv.js → CanvasPanel-Db1Iz4JN.js} +2 -2
  4. package/dist/client/assets/CompositeItem-BxPZ_9BJ.js +2 -0
  5. package/dist/client/assets/DiffPanel-CNil6OV-.js +64 -0
  6. package/dist/client/assets/{DiffPanel.logic-DK4RDoiD.js → DiffPanel.logic-yEOXCs0u.js} +2 -2
  7. package/dist/client/assets/{DiffWorkerPoolProvider-orOnVCAZ.js → DiffWorkerPoolProvider-BF-pZpUl.js} +11 -11
  8. package/dist/client/assets/PullRequestCodePanel-eldrSbZ3.js +5 -0
  9. package/dist/client/assets/{ThemeEditorPanel-v2mnY18G.js → ThemeEditorPanel-DTfrlPBc.js} +2 -2
  10. package/dist/client/assets/{Virtualizer-D5o0Becp.js → Virtualizer-BvsCWf4E.js} +2 -2
  11. package/dist/client/assets/WorkerPoolContext-CaivT_VA.js +1533 -0
  12. package/dist/client/assets/{canvasStateStore-xaZAenqH.js → canvasStateStore-DKtQcBVc.js} +2 -2
  13. package/dist/client/assets/cmmdForgeRuntimeListResource-CRVF6pin.js +1008 -0
  14. package/dist/client/assets/currentForgeWorkspaceStore-DH-DGTJm.js +2 -0
  15. package/dist/client/assets/{index-DB8H2s1H.js → index-CIM7fDFV.js} +68 -68
  16. package/dist/client/assets/popover-Cvb1Axgx.js +2 -0
  17. package/dist/client/assets/scroll-area-DzReJmNn.js +2 -0
  18. package/dist/client/assets/switch-RuRK1onH.js +2 -0
  19. package/dist/client/assets/{themePalette-eOA8OvYM.js → themePalette-gr6ZYaOx.js} +2 -2
  20. package/dist/client/assets/toggle-D8xaJAgP.js +2 -0
  21. package/dist/client/assets/toggle-group-CwSbXP07.js +2 -0
  22. package/dist/client/assets/useOpenInteractionType-B983ff5H.js +2 -0
  23. package/dist/client/assets/utils-B4G-Q0s7.js +2 -0
  24. package/dist/client/index.html +16 -13
  25. package/dist/forge-build.json +1 -1
  26. package/dist/{open-2-reBrpv.mjs → open-yHTUkd2Y.mjs} +3 -3
  27. package/package.json +1 -1
  28. package/dist/client/assets/CompositeItem-DNVaubQt.js +0 -2
  29. package/dist/client/assets/DiffPanel-C1le0UaP.js +0 -64
  30. package/dist/client/assets/PullRequestCodePanel-Br2r3lbU.js +0 -5
  31. package/dist/client/assets/WorkerPoolContext-CpM1XKxV.js +0 -2538
  32. package/dist/client/assets/popover-Cxnw5kve.js +0 -2
  33. package/dist/client/assets/scroll-area-DDcW71H4.js +0 -2
  34. package/dist/client/assets/switch-Wi-2Dkh9.js +0 -2
  35. package/dist/client/assets/toggle-group-Cqh7gA8I.js +0 -2
  36. package/dist/client/assets/toggle-m8ncTpRB.js +0 -2
  37. package/dist/client/assets/useOpenInteractionType-CN3hnnfp.js +0 -2
package/dist/bin.mjs CHANGED
@@ -1,7 +1,7 @@
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, $a as make$38, $i as spaced, $n as filterMapOrFail, $r as runPromise, $s as max, $t as stringifyJson, Aa as Scope$1, Ai as void_$1, An as cached$3, Ar as match$1, As as uninterruptibleMask, At as withConstructorDefault, Ba as CurrentLogSpans, Bi as counter, Bn as catch_, Bo as addFinalizer, Br as orDie, Bs as make$41, Bt as head, C as Record, Ca as mergeAll, Cc as map$4, Ci as tx$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, Dn as as$3, Do as interruptors, Ds as suspend, Dt as toCodecStringTree, E as TaggedErrorClass, Ea as succeed$2, Ec as sort, Ei as uninterruptible, En as annotateSpans, Eo as interrupt$2, Er as map$3, Et as toCodecJson, F as UndefinedOr, Fa as forkUnsafe, Fc as fail$1, Fi as withParentSpan, Fn as catchFilter, Fr as onError$1, Fs as MinimumTraceLevel, G as decodeExit, Ga as done, Gc as empty$1, Gi as withAttributes, Gl as hasProperty, Gn as die$1, Gr as provideService, Gs as format$1, Gt as Transformation, H as declare, Hc as Reference$1, Hi as snapshotUnsafe, Hn as contextWith, Ho as as$2, Hr as promise, Ht as size$2, I as Union, Ia as make$36, 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, Jl as isNotUndefined, Jn as exit, Jr as repeat, Js as hours, Jt as transformOrFail, K as decodeSync, Kc as get$3, Ki as addDelay, Kl as isNotNull, Ko as consolePretty$1, Kr as race, Ks as fromInput, L as Unknown, La as makeUnsafe$4, 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, Ml as NodeInspectSymbol, Mn as callback, Mo as pretty, Ms as void_$2, Na as close, Ni as withFiber$1, Nl as toJson, Nn as catchCause, No as prettyErrors, Nr as matchEffect, O as TemplateLiteral, Oa as sync$2, Ol as isEffect$1, On as asSome, Or as mapError, Os as sync, Ot as toJsonSchemaDocument, P as Undefined, Pa as closeUnsafe, Pl as format, Pn as catchDefect, Po as squash, Pr as never$1, Q as encode$4, Qc as merge$2, Qi as recurs, Qn as filter$1, Qr as runForkWith, R as UnknownFromJsonString$1, Ra as provide$2, Rc as isFailure$1, Ri as yieldNow, Rl as equals, 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, Tc as reverse, Ti as undefined_, Tn as annotateLogs, To as hasInterruptsOnly, Tr as makeSpanScoped, Tt as tag, Ua as TracerTimingEnabled, Uc as Service$1, Ui as timer, Un as currentSpan, Ur as provide, Ut as toArray, V as brand, Va as MinimumLogLevel, Vc as succeed$1, Vi as gauge, Vn as context, Vo as andThen$1, Vr as orElseSucceed, Vt as isEmpty$2, W as decodeEffect, Wa as _await, Wc as add$2, Wi as update$3, Wl as compose$1, Wr as provideContext, Ws as days, X as decodeUnknownOption, Xc as make$34, Xl as isObject$1, Xn as failCause$1, Xr as retry, Xt as onSome, Y as decodeUnknownExit, Yc as getUnsafe$1, Yi as forever$2, Yl as isNullish, Yn as fail, Yr as result, Z as decodeUnknownSync, Za as isDeferred, Zc as makeUnsafe$3, Zi as passthrough$1, Zl as isTagged, Zr as runFork, Zs as isGreaterThan$1, 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 sum$1, al as getOrElse, an as value, ao as interrupt$3, ar as fnUntraced, at as isBetween, au as constVoid, b as NullOr, bi as timeoutOrElse, bl as PipeInspectableProto, bn as acquireUseRelease, br as logDebug, bs as reportCauseUnsafe, bt as makeFilter, c as Defect, ca as Clock, cc as toSeconds, ci as sleep$4, cl as isNone, cn as add$3, co as match$2, cr as forkChild, cs as flatMap$1, ct as isGreaterThanOrEqualTo, d as Exit, dc as empty$3, di as succeedSome, dl as match, dn as isGreaterThanOrEqualTo$1, dr as forkScoped, ds as forkDetach, dt as isMaxLength, du as pipeArguments, ea as catchDone, ec as millis, el as firstSomeOf, er as filterOrFail, et as encodeSync, eu as cast, fa as TaggedError, fc as ensure, fi as suspend$1, fl as none$4, fn as make$37, fr as gen, ft as isMaxProperties, g as Never, ga as effect, gi as tapError, gn as toEpochMillis, gr as interruptible, gt as isSchema, h as Literals, ha as buildWithMemoMap, hc as fromIterable, hi as tapCause, hl as make$40, hn as toDate, hr as interrupt$1, ht as isPattern, i as Class, ic as subtract, ii as scoped, il as fromUndefinedOr, in as make$39, io as failCause$2, ir as fn$1, it as is$1, iu as constUndefined, 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 withFiber, kn as asVoid, ks as tracerLogger$1, kt as toType, l as Duration, la as currentTimeMillis, lc as zero, li as succeed, ll as isSome, ln as distance, lr as forkDetach$1, ls as fnUntraced$1, lt as isInt, lu as identity, m as Literal, ma as build, mc as flatMapNullishOr, mi as tap, ml as Number$2, mn as now, mo as StackTrace, mr as ignoreCause, ms as loggerMake, mt as isNonEmpty, n as ArraySchema, nc as minutes, nl as flatten$1, no as die$2, nt as encodeUnknownExit, o as DateTimeUtcFromString, oa as clamp, oc as times, oi as service, ol as getOrNull, oo as isFailure, or as forEach, ot as isFinite$1, ou as constant, p as Int$1, pa as CurrentMemoMap, pc as filter, pi as sync$1, pl as some, pn as makeUnsafe$5, po as NoSuchElementError, pr as ignore, pt as isMinLength, q as decodeTo, qa as fail$3, qi as both, ql as isNotNullish, qn as ensuring, qr as raceFirst, qs as fromInputUnsafe, r as Boolean$1, ra as isDoneCause, rc as seconds, ri as scope$1, rl as fromNullishOr, rn as makeFormatterDefault, ro as fail$2, rr as flatten$2, rt as fromJsonString, ru as constTrue, sa as parse$6, sc as toMillis, si as serviceOption, sl as getOrUndefined, sn as encodeBase64Url$2, so as isSuccess, sr as forever$1, st as isGreaterThan, su as dual, t as Any, tc as min, ti as runPromiseWith, tl as flatMap$2, tn as InvalidValue$1, to as succeed$3, tr as flatMap, ts as fiberInterrupt, tt as encodeUnknownEffect, tu as compose, u as ErrorClass, ua as Class$1, uc as allocate, ui as succeedNone, ul as map$5, un as formatIso, uo as void_$3, ur as forkIn, us as forever, ut as isLessThanOrEqualTo, uu as pipe$1, v as NonEmptyString, va as effectDiscard, vc as isArrayNonEmpty, 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, wn as annotateCurrentSpan, wo as hasInterrupts, wr as logWarning$1, wt as suspend$2, x as Number$1, xa as launch$1, xi as tryPromise, xl as YieldableProto, xn as addFinalizer$2, xr as logError, xs as scope, xt as mutable, y as Null, ya as empty$4, yc as isReadonlyArrayNonEmpty, yi as timeoutOption, yn as acquireRelease, yo as fail$4, yr as log$4, yt as make$35, z as Void, za as CurrentLogAnnotations, zc as isSuccess$1, zi as zipWith, zn as catchTags, zr as option, zs as externalSpan, zt as empty$2 } from "./Schema-Ay3DUM83.mjs";
4
+ import { $ as encodeEffect, $a as make$38, $i as spaced, $n as filterMapOrFail, $r as runPromise, $s as max, $t as stringifyJson, Aa as Scope$1, Ai as void_$1, An as cached$3, Ar as match$1, As as uninterruptibleMask, At as withConstructorDefault, Ba as CurrentLogSpans, Bi as counter, Bn as catch_, Bo as addFinalizer, Br as orDie, Bs as make$41, Bt as head, C as Record, Ca as mergeAll, Cc as map$4, Ci as tx$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, Dn as as$3, Do as interruptors, Ds as suspend, Dt as toCodecStringTree, E as TaggedErrorClass, Ea as succeed$2, Ec as sort, Ei as uninterruptible, En as annotateSpans, Eo as interrupt$2, Er as map$3, Et as toCodecJson, F as UndefinedOr, Fa as forkUnsafe, Fc as fail$1, Fi as withParentSpan, Fn as catchFilter, Fr as onError$1, Fs as MinimumTraceLevel, G as decodeExit, Ga as done, Gc as empty$1, Gi as withAttributes, Gl as hasProperty, Gn as die$1, Gr as provideService, Gs as format$1, Gt as Transformation, H as declare, Hc as Reference$1, Hi as snapshotUnsafe, Hn as contextWith, Ho as as$2, Hr as promise, Ht as size$2, I as Union, Ia as make$36, 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, Jl as isNotUndefined, Jn as exit, Jr as repeat, Js as hours, Jt as transformOrFail, K as decodeSync, Kc as get$3, Ki as addDelay, Kl as isNotNull, Ko as consolePretty$1, Kr as race, Ks as fromInput, L as Unknown, La as makeUnsafe$4, 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, Ml as NodeInspectSymbol, Mn as callback, Mo as pretty, Ms as void_$2, Na as close, Ni as withFiber$1, Nl as toJson, Nn as catchCause, No as prettyErrors, Nr as matchEffect, O as TemplateLiteral, Oa as sync$2, Ol as isEffect$1, On as asSome, Or as mapError, Os as sync, Ot as toJsonSchemaDocument, P as Undefined, Pa as closeUnsafe, Pl as format, Pn as catchDefect, Po as squash, Pr as never$1, Q as encode$4, Qc as merge$2, Qi as recurs, Qn as filter$1, Qr as runForkWith, R as UnknownFromJsonString$1, Ra as provide$2, Rc as isFailure$1, Ri as yieldNow, Rl as equals, 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, Tc as reverse, Ti as undefined_, Tn as annotateLogs, To as hasInterruptsOnly, Tr as makeSpanScoped, Tt as tag, Ua as TracerTimingEnabled, Uc as Service$1, Ui as timer, Un as currentSpan, Ur as provide, Ut as toArray, V as brand, Va as MinimumLogLevel, Vc as succeed$1, Vi as gauge, Vn as context, Vo as andThen$1, Vr as orElseSucceed, Vt as isEmpty$2, W as decodeEffect, Wa as _await, Wc as add$2, Wi as update$3, Wl as compose$1, Wr as provideContext, Ws as days, X as decodeUnknownOption, Xc as make$34, Xl as isObject$1, Xn as failCause$1, Xr as retry, Xt as onSome, Y as decodeUnknownExit, Yc as getUnsafe$1, Yi as forever$2, Yl as isNullish, Yn as fail, Yr as result, Z as decodeUnknownSync, Za as isDeferred, Zc as makeUnsafe$3, Zi as passthrough$1, Zl as isTagged, Zr as runFork, Zs as isGreaterThan$1, 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 sum$1, al as getOrElse, an as value, ao as interrupt$3, ar as fnUntraced, at as isBetween, au as constVoid, b as NullOr, bi as timeoutOrElse, bl as PipeInspectableProto, bn as acquireUseRelease, br as logDebug, bs as reportCauseUnsafe, bt as makeFilter, c as Defect, ca as Clock, cc as toSeconds, ci as sleep$4, cl as isNone, cn as add$3, co as match$2, cr as forkChild, cs as flatMap$1, ct as isGreaterThanOrEqualTo, d as Exit, dc as empty$3, di as succeedSome, dl as match, dn as isGreaterThanOrEqualTo$1, dr as forkScoped, ds as forkDetach, dt as isMaxLength, du as pipeArguments, ea as catchDone, ec as millis, el as firstSomeOf, er as filterOrFail, et as encodeSync, eu as cast, fa as TaggedError, fc as ensure, fi as suspend$1, fl as none$4, fn as make$37, fr as gen, ft as isMaxProperties, g as Never, ga as effect, gi as tapError, gn as toEpochMillis, gr as interruptible, gt as isSchema, h as Literals, ha as buildWithMemoMap, hc as fromIterable, hi as tapCause, hl as make$40, hn as toDate, hr as interrupt$1, ht as isPattern, i as Class, ic as subtract, ii as scoped, il as fromUndefinedOr, in as make$39, io as failCause$2, ir as fn$1, it as is$1, iu as constUndefined, 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 withFiber, kn as asVoid, ks as tracerLogger$1, kt as toType, l as Duration, la as currentTimeMillis, lc as zero, li as succeed, ll as isSome, ln as distance, lr as forkDetach$1, ls as fnUntraced$1, lt as isInt, lu as identity, m as Literal, ma as build, mc as flatMapNullishOr, mi as tap, ml as Number$2, mn as now, mo as StackTrace, mr as ignoreCause, ms as loggerMake, mt as isNonEmpty, n as ArraySchema, nc as minutes, nl as flatten$1, no as die$2, nt as encodeUnknownExit, o as DateTimeUtcFromString, oa as clamp, oc as times, oi as service, ol as getOrNull, oo as isFailure, or as forEach, ot as isFinite$1, ou as constant, p as Int$1, pa as CurrentMemoMap, pc as filter, pi as sync$1, pl as some, pn as makeUnsafe$5, po as NoSuchElementError, pr as ignore, pt as isMinLength, q as decodeTo, qa as fail$3, qi as both, ql as isNotNullish, qn as ensuring, qr as raceFirst, qs as fromInputUnsafe, r as Boolean$1, ra as isDoneCause, rc as seconds, ri as scope$1, rl as fromNullishOr, rn as makeFormatterDefault, ro as fail$2, rr as flatten$2, rt as fromJsonString, ru as constTrue, sa as parse$6, sc as toMillis, si as serviceOption, sl as getOrUndefined, sn as encodeBase64Url$3, so as isSuccess, sr as forever$1, st as isGreaterThan, su as dual, t as Any, tc as min, ti as runPromiseWith, tl as flatMap$2, tn as InvalidValue$1, to as succeed$3, tr as flatMap, ts as fiberInterrupt, tt as encodeUnknownEffect, tu as compose, u as ErrorClass, ua as Class$1, uc as allocate, ui as succeedNone, ul as map$5, un as formatIso, uo as void_$3, ur as forkIn, us as forever, ut as isLessThanOrEqualTo, uu as pipe$1, v as NonEmptyString, va as effectDiscard, vc as isArrayNonEmpty, 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, wn as annotateCurrentSpan, wo as hasInterrupts, wr as logWarning$1, wt as suspend$2, x as Number$1, xa as launch$1, xi as tryPromise, xl as YieldableProto, xn as addFinalizer$2, xr as logError, xs as scope, xt as mutable, y as Null, ya as empty$4, yc as isReadonlyArrayNonEmpty, yi as timeoutOption, yn as acquireRelease, yo as fail$4, yr as log$4, yt as make$35, z as Void, za as CurrentLogAnnotations, zc as isSuccess$1, zi as zipWith, zn as catchTags, zr as option, zs as externalSpan, zt as empty$2 } from "./Schema-Ay3DUM83.mjs";
5
5
  import { $t as interrupt$4, A as fromSubscription, At as end, B as onExit$1, Bt as sliding, C as fromChannel, Ct as fromSubscriptionArray, D as fromPull, Dt as make$43, E as fromPubSub, F as mapEffect$1, Ft as offer$1, G as runCollect, Gt as shutdown$2, Ht as takeAll, I as mapError$1, It as offerAll, J as runForEach, K as runDrain, Kt as subscribe$1, L as merge$4, Lt as offerUnsafe, M as make$42, Mt as failCause$4, N as map$7, O as fromQueue, Ot as makeUnsafe$6, P as mapAccum, Pt as make$44, Q as succeed$4, Qt as getCurrent, S as fromAsyncIterable, T as fromIterable$1, U as provideContext$1, Ut as unbounded$2, Vt as take$1, W as run$2, Wt as publish, X as runHead, Xt as makeUnsafe$7, Y as runForEachArray, Zt as await_, _t as drain, b as flatMap$3, c as callback$1, ct as get$4, d as debounce$1, dt as make$46, et as takeWhile, f as decodeText$1, g as ensuring$1, h as encodeText, j as isStream, kt as bounded, l as catchCause$1, lt as make$45, m as empty$5, nt as toAsyncIterable, q as runFold, qt as unbounded$1, r as FileSystem, rt as toPull, st as unwrap$1, t as Path$2, tn as runIn, tt as tick, u as concat$2, ut as get$5, v as failCause$5, vt as forEach$1, w as fromEffect, wt as fromTransform, x as fromArray, xt as mapInput, y as filter$2, zt as shutdown$1 } from "./Path-BIaGSU2M.mjs";
6
6
  import { _ as ChildProcessSpawner, a as Stdio, g as make$47, o as make$48, r as isQuitError } from "./NodeTerminal-CeaWke6-.mjs";
7
7
  import { n as layer$7 } from "./NodeServices-Bt1GwPBR.mjs";
@@ -19,11 +19,11 @@ import * as HE from "node:child_process";
19
19
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
20
20
  import { Readable } from "node:stream";
21
21
  import * as Crypto from "node:crypto";
22
- import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicKey, randomBytes, randomUUID, timingSafeEqual, verify } from "node:crypto";
22
+ import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual, verify } from "node:crypto";
23
23
  import * as FS$1 from "node:fs";
24
24
  import fs, { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, mkdtempSync, promises, readFile, readFileSync, readdir, readdirSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
25
25
  import * as NodeOS from "node:os";
26
- import $U, { homedir, networkInterfaces, tmpdir } from "node:os";
26
+ import os, { homedir, networkInterfaces, tmpdir } from "node:os";
27
27
  import * as Path$1 from "node:path";
28
28
  import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
29
29
  import { pathToFileURL } from "node:url";
@@ -30476,7 +30476,7 @@ function frameClassByte(frameClass) {
30476
30476
  if (frameClass === "application") return Uint8Array.of(1);
30477
30477
  return Uint8Array.of(2);
30478
30478
  }
30479
- function encodeBase64Url$1(value) {
30479
+ function encodeBase64Url$2(value) {
30480
30480
  let output = "";
30481
30481
  for (let index = 0; index < value.byteLength; index += 3) {
30482
30482
  const first = value[index] ?? 0;
@@ -30506,7 +30506,7 @@ function decodeBase64Url$1(value) {
30506
30506
  outputIndex += 1;
30507
30507
  }
30508
30508
  }
30509
- if (encodeBase64Url$1(output) !== value) throw new RelayPayloadChannelFailure("channel_authentication_failed", "Encrypted relay frame has a non-canonical base64url encoding.");
30509
+ if (encodeBase64Url$2(output) !== value) throw new RelayPayloadChannelFailure("channel_authentication_failed", "Encrypted relay frame has a non-canonical base64url encoding.");
30510
30510
  return output;
30511
30511
  }
30512
30512
  function isLowOrderX25519PublicKey(value) {
@@ -30545,7 +30545,7 @@ async function createRelayPayloadBinding(input, digestProvider = defaultDigestPr
30545
30545
  };
30546
30546
  }
30547
30547
  function relayPayloadTicketDigestBase64Url(binding) {
30548
- return encodeBase64Url$1(binding.ticketDigest);
30548
+ return encodeBase64Url$2(binding.ticketDigest);
30549
30549
  }
30550
30550
  function relayPayloadInfo(binding) {
30551
30551
  return concat([
@@ -30582,7 +30582,7 @@ async function generateRelayEndpointKeyPair(randomSource = defaultRandomSource)
30582
30582
  }
30583
30583
  async function serializeRelayEndpointPublicKey(publicKey) {
30584
30584
  try {
30585
- return encodeBase64Url$1(bytes(await suite.kem.serializePublicKey(publicKey)));
30585
+ return encodeBase64Url$2(bytes(await suite.kem.serializePublicKey(publicKey)));
30586
30586
  } catch (error) {
30587
30587
  throw new RelayPayloadChannelFailure("endpoint_key_invalid", error instanceof Error ? error.message : "Endpoint public-key serialization failed.");
30588
30588
  }
@@ -30637,7 +30637,7 @@ var HpkeRelayPayloadSender = class {
30637
30637
  constructor(binding, context) {
30638
30638
  this.binding = binding;
30639
30639
  this.context = context;
30640
- this.encapsulatedKey = encodeBase64Url$1(bytes(context.enc));
30640
+ this.encapsulatedKey = encodeBase64Url$2(bytes(context.enc));
30641
30641
  }
30642
30642
  seal(input) {
30643
30643
  return this.queue.run(async () => {
@@ -30667,7 +30667,7 @@ var HpkeRelayPayloadSender = class {
30667
30667
  direction: this.binding.direction,
30668
30668
  frameClass: input.frameClass,
30669
30669
  sequence,
30670
- ciphertext: encodeBase64Url$1(ciphertext)
30670
+ ciphertext: encodeBase64Url$2(ciphertext)
30671
30671
  };
30672
30672
  });
30673
30673
  }
@@ -50658,7 +50658,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
50658
50658
  const min = forceColor || 0;
50659
50659
  if (env.TERM === "dumb") return min;
50660
50660
  if (process$1.platform === "win32") {
50661
- const osRelease = $U.release().split(".");
50661
+ const osRelease = os.release().split(".");
50662
50662
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
50663
50663
  return 1;
50664
50664
  }
@@ -53101,7 +53101,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53101
53101
  exports.processDetector = void 0;
53102
53102
  const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
53103
53103
  const semconv_1 = require_semconv$1();
53104
- const os$3 = __require("os");
53104
+ const os$4 = __require("os");
53105
53105
  /**
53106
53106
  * ProcessDetector will be used to detect the resources related current process running
53107
53107
  * and being instrumented from the NodeJS Process module.
@@ -53123,7 +53123,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53123
53123
  };
53124
53124
  if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
53125
53125
  try {
53126
- const userInfo = os$3.userInfo();
53126
+ const userInfo = os$4.userInfo();
53127
53127
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
53128
53128
  } catch (e) {
53129
53129
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -66046,7 +66046,7 @@ function normalizeNumberish(value) {
66046
66046
  }
66047
66047
  //#endregion
66048
66048
  //#region package.json
66049
- var version$1 = "0.13.124";
66049
+ var version$1 = "0.13.126";
66050
66050
  //#endregion
66051
66051
  //#region src/sentry.ts
66052
66052
  const SERVER_APP_NAME = "forge-server";
@@ -71098,6 +71098,19 @@ function mintCmmdShortLivedToken(grantToken) {
71098
71098
  });
71099
71099
  }
71100
71100
  /**
71101
+ * The redemption request body. `popPublicKeyPem` is the server's PoP identity
71102
+ * (forge#3534): presented when bound sessions are enabled so CMMD stamps the
71103
+ * returned JWT with this server's key (`cnf.jkt`), omitted otherwise.
71104
+ */
71105
+ function buildSessionGrantRedemptionBody(grantToken, popPublicKeyPem) {
71106
+ return {
71107
+ grant_type: "forge_session_grant",
71108
+ grant_token: grantToken,
71109
+ client_id: "cmmd-forge-web",
71110
+ ...popPublicKeyPem ? { pop_public_key: popPublicKeyPem } : {}
71111
+ };
71112
+ }
71113
+ /**
71101
71114
  * Redeem a durable CMMD session grant for a fresh credential set.
71102
71115
  *
71103
71116
  * The grant is CMMD's designed recovery path for exactly the case a rotating
@@ -71109,15 +71122,11 @@ function mintCmmdShortLivedToken(grantToken) {
71109
71122
  * Returns the new MCP PAT alongside the JWT/refresh pair, because CMMD mints a
71110
71123
  * fresh PAT on redemption and the old one is not carried over.
71111
71124
  */
71112
- function redeemCmmdSessionGrant(grantToken) {
71125
+ function redeemCmmdSessionGrant(grantToken, popPublicKeyPem) {
71113
71126
  return fetch(new URL("/api/mcp-server/oauth/token", resolveCommandAppUrl()).toString(), {
71114
71127
  method: "POST",
71115
71128
  headers: { "Content-Type": "application/json" },
71116
- body: JSON.stringify({
71117
- grant_type: "forge_session_grant",
71118
- grant_token: grantToken,
71119
- client_id: "cmmd-forge-web"
71120
- })
71129
+ body: JSON.stringify(buildSessionGrantRedemptionBody(grantToken, popPublicKeyPem))
71121
71130
  }).then(async (response) => {
71122
71131
  if (!response.ok) return null;
71123
71132
  const payload = await response.json();
@@ -71188,6 +71197,140 @@ async function readOAuthErrorCode(response) {
71188
71197
  }
71189
71198
  }
71190
71199
  //#endregion
71200
+ //#region ../../packages/shared/src/cmmdSessionPop.ts
71201
+ /**
71202
+ * CMMD session proof-of-possession client protocol (forge#3517).
71203
+ *
71204
+ * A CMMD session issued to a Forge client can be bound to the client's Ed25519
71205
+ * device key: the public key travels with the login (`pop_public_key`), CMMD
71206
+ * stamps its thumbprint into the token (`cnf.jkt`), and every authenticated
71207
+ * request must then carry a detached Ed25519 signature over a canonical
71208
+ * request binding (method + path + timestamp + nonce). A stolen bearer token
71209
+ * alone is unusable.
71210
+ *
71211
+ * This module is the client half of the scheme CMMD verifies in
71212
+ * `server/services/auth/session-pop-binding.ts`. The protocol deliberately
71213
+ * reuses CMMD's existing crypto shapes rather than inventing a new scheme: the
71214
+ * thumbprint is the same sha256-over-SPKI-DER base64url digest as the forge
71215
+ * device registry and the desktop relay identity, and the signature covers
71216
+ * `<purpose>.<base64url payload>`, the forge relay challenge shape, with
71217
+ * Ed25519. It is not a DPoP port: proofs are plain headers, not JWTs.
71218
+ */
71219
+ const HEADER_KEY = "x-cmmd-pop-key";
71220
+ const HEADER_INPUT = "x-cmmd-pop-input";
71221
+ const HEADER_SIGNATURE = "x-cmmd-pop-signature";
71222
+ const CMMD_SESSION_POP_PURPOSE = "cmmd-session-pop-v1";
71223
+ function encodeBase64Url$1(bytes) {
71224
+ let binary = "";
71225
+ for (const byte of bytes) binary += String.fromCharCode(byte);
71226
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/u, "");
71227
+ }
71228
+ function buildCmmdSessionPopSigningInput(payload) {
71229
+ return `${CMMD_SESSION_POP_PURPOSE}.${encodeBase64Url$1(new TextEncoder().encode(JSON.stringify(payload)))}`;
71230
+ }
71231
+ function randomNonce() {
71232
+ const bytes = new Uint8Array(16);
71233
+ crypto.getRandomValues(bytes);
71234
+ return encodeBase64Url$1(bytes);
71235
+ }
71236
+ /**
71237
+ * Build the three proof headers for one request. Each call produces a fresh
71238
+ * nonce; callers must not reuse the returned headers across attempts
71239
+ * (retries included), because CMMD rejects replayed nonces.
71240
+ */
71241
+ async function buildCmmdSessionPopProofHeaders(input) {
71242
+ const payload = {
71243
+ version: 1,
71244
+ htm: input.method.toUpperCase(),
71245
+ htu: input.path,
71246
+ ts: input.nowSeconds ?? Math.floor(Date.now() / 1e3),
71247
+ nonce: input.nonce ?? randomNonce()
71248
+ };
71249
+ const signingInput = buildCmmdSessionPopSigningInput(payload);
71250
+ const signature = await input.signer.sign(signingInput);
71251
+ const spkiDer = decodePemSpkiDer(input.signer.publicKeyPem);
71252
+ return {
71253
+ [HEADER_KEY]: encodeBase64Url$1(spkiDer),
71254
+ [HEADER_INPUT]: encodeBase64Url$1(new TextEncoder().encode(JSON.stringify(payload))),
71255
+ [HEADER_SIGNATURE]: encodeBase64Url$1(signature)
71256
+ };
71257
+ }
71258
+ function decodePemSpkiDer(pem) {
71259
+ const base64 = pem.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").replace(/\s+/gu, "").replace(/-/g, "+").replace(/_/g, "/");
71260
+ const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
71261
+ const binary = atob(padded);
71262
+ const bytes = new Uint8Array(binary.length);
71263
+ for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
71264
+ return bytes;
71265
+ }
71266
+ //#endregion
71267
+ //#region src/cmmd/cmmdSessionPopServer.ts
71268
+ /**
71269
+ * The Forge server's own CMMD session proof-of-possession identity (forge#3534,
71270
+ * D3): the server holds an Ed25519 key, presents its SPKI PEM as
71271
+ * `pop_public_key` when it redeems a CMMD session grant, and signs every
71272
+ * CMMD-origin REST call it makes with detached proofs, so a stolen bearer JWT
71273
+ * alone is unusable. CMMD verifies the scheme in
71274
+ * `server/services/auth/session-pop-binding.ts`.
71275
+ *
71276
+ * Rollout order (docs/forge-cmmd-auth-lanes.md): CMMD deploys first; Forge
71277
+ * flips `FORGE_CMMD_SESSION_POP_ENABLED` afterwards; CMMD's
71278
+ * `JWT_REQUIRE_BOUND_SESSIONS=true` is the contract phase. While the flag is
71279
+ * off this module produces no keys and no headers, and CMMD treats tokens as
71280
+ * plain bearers.
71281
+ *
71282
+ * The identity lives in memory for the process lifetime. After a restart the
71283
+ * server mints a new identity; CMMD then refuses proofs from the old one, and
71284
+ * the JWT resolver's recovery ladder re-mints the affected credentials. The
71285
+ * persistence duty (a stable identity across restarts) lands with the flag
71286
+ * rollout, not with this plumbing.
71287
+ */
71288
+ const ENABLED_FLAG = "FORGE_CMMD_SESSION_POP_ENABLED";
71289
+ /** Enables session proofs only when the rollout flag is exactly "true". */
71290
+ function isCmmdSessionPopEnabled() {
71291
+ return process.env[ENABLED_FLAG] === "true";
71292
+ }
71293
+ let cachedSigner = null;
71294
+ /** Creates an in-memory Ed25519 identity with a public SPKI PEM and a detached signer. */
71295
+ function createServerSigner() {
71296
+ const { publicKey, privateKey } = generateKeyPairSync("ed25519");
71297
+ const exported = publicKey.export({
71298
+ type: "spki",
71299
+ format: "pem"
71300
+ });
71301
+ return {
71302
+ publicKeyPem: typeof exported === "string" ? exported : exported.toString("utf8"),
71303
+ sign: async (signingInput) => new Uint8Array(sign(null, Buffer.from(signingInput, "utf8"), privateKey))
71304
+ };
71305
+ }
71306
+ /**
71307
+ * The server's PoP identity, created on first use under the flag and stable
71308
+ * for the process lifetime. Null while the flag is off.
71309
+ */
71310
+ function resolveCmmdSessionPopSigner() {
71311
+ if (!isCmmdSessionPopEnabled()) return null;
71312
+ cachedSigner ??= createServerSigner();
71313
+ return cachedSigner;
71314
+ }
71315
+ /** The `pop_public_key` value to present at issuance, or null while disabled. */
71316
+ function cmmdSessionPopPublicKey() {
71317
+ return resolveCmmdSessionPopSigner()?.publicKeyPem ?? null;
71318
+ }
71319
+ /**
71320
+ * The three proof headers for one CMMD-origin request, or no headers while
71321
+ * disabled. Each call carries a fresh nonce; never reuse the result across
71322
+ * attempts, because CMMD rejects replayed nonces.
71323
+ */
71324
+ async function cmmdSessionPopRequestHeaders(input) {
71325
+ const signer = resolveCmmdSessionPopSigner();
71326
+ if (!signer) return {};
71327
+ return buildCmmdSessionPopProofHeaders({
71328
+ signer,
71329
+ method: input.method,
71330
+ path: input.path
71331
+ });
71332
+ }
71333
+ //#endregion
71191
71334
  //#region src/command/cmmdTokenMintLane.ts
71192
71335
  /**
71193
71336
  * The CMMD token-mint lane (forge#3518, expand phase).
@@ -71440,7 +71583,7 @@ function tryGrantRedemption(sessionId, context) {
71440
71583
  return gen(function* () {
71441
71584
  yield* logCmmdJwtRung(context, "grant-redemption", "attempted", "redeeming this session's durable CMMD session grant");
71442
71585
  yield* recordCmmdCredentialRefreshMetric("grant-redemption", "attempted");
71443
- const redeemed = yield* promise(() => redeemCmmdSessionGrant(grantToken)).pipe(orElseSucceed(() => null));
71586
+ const redeemed = yield* promise(() => redeemCmmdSessionGrant(grantToken, cmmdSessionPopPublicKey())).pipe(orElseSucceed(() => null));
71444
71587
  const accessToken = usableCmmdUserJwt(redeemed?.accessToken);
71445
71588
  if (!accessToken) {
71446
71589
  yield* logCmmdJwtRung(context, "grant-redemption", "failed", "session grant redemption did not return a usable user access JWT");
@@ -71729,11 +71872,25 @@ async function requireCmmdProxySuccess(response, signal) {
71729
71872
  * Uses the stored JWT (set after OAuth auth-code flow with post-update CMMD)
71730
71873
  * to make authenticated REST calls on behalf of the user. A missing delegated
71731
71874
  * JWT is an authentication-required state, not a CMMD availability failure.
71875
+ *
71876
+ * Every request this module sends can carry the server's session
71877
+ * proof-of-possession headers (forge#3534): while
71878
+ * `FORGE_CMMD_SESSION_POP_ENABLED` is true, `authHeaders` attaches detached
71879
+ * Ed25519 proofs over each request's method and path, which CMMD requires for
71880
+ * tokens bound with `cnf.jkt` and ignores otherwise. Each call gets a fresh
71881
+ * nonce, so retries re-sign rather than replay.
71732
71882
  */
71733
- function authHeaders(jwt, orgId) {
71883
+ /** Builds owner JWT and optional organization headers with fresh, flag-gated session proofs. */
71884
+ async function authHeaders(jwt, orgId, method, path) {
71734
71885
  const headers = { Authorization: `Bearer ${jwt}` };
71735
71886
  if (orgId) headers["X-Organization-ID"] = orgId;
71736
- return headers;
71887
+ return {
71888
+ ...headers,
71889
+ ...await cmmdSessionPopRequestHeaders({
71890
+ method,
71891
+ path
71892
+ })
71893
+ };
71737
71894
  }
71738
71895
  async function fetchResponse(url, init, options) {
71739
71896
  try {
@@ -71745,18 +71902,20 @@ async function fetchResponse(url, init, options) {
71745
71902
  rethrowCmmdProxyTimeout(error, options?.signal);
71746
71903
  }
71747
71904
  }
71905
+ /** Fetches a CMMD JSON resource with optional query parameters and caller cancellation. */
71748
71906
  async function proxyGet(jwt, path, searchParams, orgId, options) {
71749
71907
  const cmmdBase = resolveCommandAppUrl();
71750
71908
  const url = new URL(path, cmmdBase);
71751
71909
  if (searchParams) for (const [k, v] of Object.entries(searchParams)) url.searchParams.set(k, v);
71752
- return handleCmmdProxyResponse(await fetchResponse(url.toString(), { headers: authHeaders(jwt, orgId) }, options), options?.signal);
71910
+ return handleCmmdProxyResponse(await fetchResponse(url.toString(), { headers: await authHeaders(jwt, orgId, "GET", path) }, options), options?.signal);
71753
71911
  }
71912
+ /** Posts JSON to CMMD on the owner JWT lane and decodes the response or upstream error. */
71754
71913
  async function proxyPost(jwt, path, body, orgId, options) {
71755
71914
  const cmmdBase = resolveCommandAppUrl();
71756
71915
  return handleCmmdProxyResponse(await fetchResponse(new URL(path, cmmdBase).toString(), {
71757
71916
  method: "POST",
71758
71917
  headers: {
71759
- ...authHeaders(jwt, orgId),
71918
+ ...await authHeaders(jwt, orgId, "POST", path),
71760
71919
  "Content-Type": "application/json"
71761
71920
  },
71762
71921
  body: JSON.stringify(body)
@@ -71770,44 +71929,49 @@ async function responseWithMetadata(response, signal) {
71770
71929
  retryAfter: response.headers.get("retry-after")
71771
71930
  };
71772
71931
  }
71932
+ /** Fetches a CMMD resource while preserving status, Location, and Retry-After metadata. */
71773
71933
  async function proxyGetWithMetadata(jwt, path, orgId, options) {
71774
- return responseWithMetadata(await fetchResponse(new URL(path, resolveCommandAppUrl()).toString(), { headers: authHeaders(jwt, orgId) }, options), options?.signal);
71934
+ return responseWithMetadata(await fetchResponse(new URL(path, resolveCommandAppUrl()).toString(), { headers: await authHeaders(jwt, orgId, "GET", path) }, options), options?.signal);
71775
71935
  }
71936
+ /** Posts JSON to CMMD while preserving status, Location, and Retry-After metadata. */
71776
71937
  async function proxyPostWithMetadata(jwt, path, body, orgId, options) {
71777
71938
  const cmmdBase = resolveCommandAppUrl();
71778
71939
  return responseWithMetadata(await fetchResponse(new URL(path, cmmdBase).toString(), {
71779
71940
  method: "POST",
71780
71941
  headers: {
71781
- ...authHeaders(jwt, orgId),
71942
+ ...await authHeaders(jwt, orgId, "POST", path),
71782
71943
  "Content-Type": "application/json"
71783
71944
  },
71784
71945
  body: JSON.stringify(body)
71785
71946
  }, options), options?.signal);
71786
71947
  }
71948
+ /** Applies a JSON patch request to CMMD using the owner JWT and optional organization. */
71787
71949
  async function proxyPatch(jwt, path, body, orgId) {
71788
71950
  const cmmdBase = resolveCommandAppUrl();
71789
71951
  const url = new URL(path, cmmdBase);
71790
71952
  return handleCmmdProxyResponse(await fetch(url.toString(), {
71791
71953
  method: "PATCH",
71792
71954
  headers: {
71793
- ...authHeaders(jwt, orgId),
71955
+ ...await authHeaders(jwt, orgId, "PATCH", path),
71794
71956
  "Content-Type": "application/json"
71795
71957
  },
71796
71958
  body: JSON.stringify(body)
71797
71959
  }));
71798
71960
  }
71961
+ /** Sends a JSON replacement request to CMMD and decodes its response or upstream error. */
71799
71962
  async function proxyPut(jwt, path, body, orgId) {
71800
71963
  const cmmdBase = resolveCommandAppUrl();
71801
71964
  const url = new URL(path, cmmdBase);
71802
71965
  return handleCmmdProxyResponse(await fetch(url.toString(), {
71803
71966
  method: "PUT",
71804
71967
  headers: {
71805
- ...authHeaders(jwt, orgId),
71968
+ ...await authHeaders(jwt, orgId, "PUT", path),
71806
71969
  "Content-Type": "application/json"
71807
71970
  },
71808
71971
  body: JSON.stringify(body)
71809
71972
  }));
71810
71973
  }
71974
+ /** Deletes a CMMD resource with optional query parameters and JSON body; 204 returns undefined. */
71811
71975
  async function proxyDelete(jwt, path, searchParams, orgId, body) {
71812
71976
  const cmmdBase = resolveCommandAppUrl();
71813
71977
  const url = new URL(path, cmmdBase);
@@ -71815,7 +71979,7 @@ async function proxyDelete(jwt, path, searchParams, orgId, body) {
71815
71979
  const response = await fetch(url.toString(), {
71816
71980
  method: "DELETE",
71817
71981
  headers: {
71818
- ...authHeaders(jwt, orgId),
71982
+ ...await authHeaders(jwt, orgId, "DELETE", path),
71819
71983
  ...body === void 0 ? {} : { "Content-Type": "application/json" }
71820
71984
  },
71821
71985
  ...body === void 0 ? {} : { body: JSON.stringify(body) }
@@ -71823,13 +71987,14 @@ async function proxyDelete(jwt, path, searchParams, orgId, body) {
71823
71987
  if (!response.ok && response.status !== 204) await requireCmmdProxySuccess(response);
71824
71988
  return response.status === 204 ? void 0 : handleCmmdProxyResponse(response);
71825
71989
  }
71990
+ /** Forwards multipart bytes to CMMD, preserving the caller's content type and boundary. */
71826
71991
  async function proxyMultipart(jwt, path, body, contentType, orgId) {
71827
71992
  const cmmdBase = resolveCommandAppUrl();
71828
71993
  const url = new URL(path, cmmdBase);
71829
71994
  return handleCmmdProxyResponse(await fetch(url.toString(), {
71830
71995
  method: "POST",
71831
71996
  headers: {
71832
- ...authHeaders(jwt, orgId),
71997
+ ...await authHeaders(jwt, orgId, "POST", path),
71833
71998
  "Content-Type": contentType
71834
71999
  },
71835
72000
  body
@@ -72153,20 +72318,25 @@ const legacyCmmdToolBridge = {
72153
72318
  };
72154
72319
  //#endregion
72155
72320
  //#region src/command/workIntakeCache.ts
72156
- const cacheBySessionId = /* @__PURE__ */ new Map();
72321
+ const cacheByKey = /* @__PURE__ */ new Map();
72322
+ function cacheKeyFor(sessionId, orgId) {
72323
+ return `${sessionId}\u0000${orgId ?? ""}`;
72324
+ }
72157
72325
  function resolveCmmdWorkIntakeCacheIdentity(subject, cmmdUserId) {
72158
72326
  return cmmdUserId ? `cmmd-user:${cmmdUserId}` : `forge-subject:${subject}`;
72159
72327
  }
72160
72328
  function fingerprintToken(token) {
72161
72329
  return createHash("sha256").update(token).digest("hex");
72162
72330
  }
72163
- async function fetchBlockingSnapshot(input, identityKey, tokenFingerprint, existing) {
72331
+ async function fetchBlockingSnapshot(input, cacheKey, identityKey, tokenFingerprint, existing) {
72164
72332
  if (existing?.inFlight) return existing.inFlight;
72165
72333
  const nowMs = input.nowMs ?? Date.now;
72166
72334
  let promise;
72167
72335
  promise = input.fetchFresh().then((snapshot) => {
72168
- const current = cacheBySessionId.get(input.sessionId);
72169
- if (current?.tokenFingerprint === tokenFingerprint && current.inFlight === promise) cacheBySessionId.set(input.sessionId, {
72336
+ const current = cacheByKey.get(cacheKey);
72337
+ if (current?.tokenFingerprint === tokenFingerprint && current.inFlight === promise) cacheByKey.set(cacheKey, {
72338
+ sessionId: input.sessionId,
72339
+ orgId: input.orgId,
72170
72340
  identityKey,
72171
72341
  tokenFingerprint,
72172
72342
  snapshot,
@@ -72175,12 +72345,14 @@ async function fetchBlockingSnapshot(input, identityKey, tokenFingerprint, exist
72175
72345
  });
72176
72346
  return snapshot;
72177
72347
  }).catch((error) => {
72178
- const current = cacheBySessionId.get(input.sessionId);
72179
- if (current?.tokenFingerprint === tokenFingerprint && current.inFlight === promise) if (legacyCmmdToolBridge.isAuthError(error)) cacheBySessionId.delete(input.sessionId);
72348
+ const current = cacheByKey.get(cacheKey);
72349
+ if (current?.tokenFingerprint === tokenFingerprint && current.inFlight === promise) if (legacyCmmdToolBridge.isAuthError(error)) cacheByKey.delete(cacheKey);
72180
72350
  else current.inFlight = null;
72181
72351
  throw error;
72182
72352
  });
72183
- cacheBySessionId.set(input.sessionId, {
72353
+ cacheByKey.set(cacheKey, {
72354
+ sessionId: input.sessionId,
72355
+ orgId: input.orgId,
72184
72356
  identityKey,
72185
72357
  tokenFingerprint,
72186
72358
  snapshot: existing?.snapshot ?? null,
@@ -72196,9 +72368,9 @@ async function fetchBlockingSnapshot(input, identityKey, tokenFingerprint, exist
72196
72368
  * opportunistically on every read.
72197
72369
  */
72198
72370
  function sweepExpiredWorkIntakeEntries(nowMs) {
72199
- for (const [sessionId, entry] of cacheBySessionId) {
72371
+ for (const [key, entry] of cacheByKey) {
72200
72372
  if (entry.inFlight) continue;
72201
- if (nowMs - entry.cachedAtMs > 3e5) cacheBySessionId.delete(sessionId);
72373
+ if (nowMs - entry.cachedAtMs > 3e5) cacheByKey.delete(key);
72202
72374
  }
72203
72375
  }
72204
72376
  async function readCachedCmmdWorkIntakeForSession(input) {
@@ -72207,17 +72379,18 @@ async function readCachedCmmdWorkIntakeForSession(input) {
72207
72379
  const identityKey = input.identityKey ?? input.sessionId;
72208
72380
  if (input.forceFresh) invalidateCachedCmmdWorkIntakeForIdentity(identityKey);
72209
72381
  const tokenFingerprint = fingerprintToken(input.token);
72210
- const existing = cacheBySessionId.get(input.sessionId);
72211
- if (existing && (existing.identityKey !== identityKey || existing.tokenFingerprint !== tokenFingerprint)) cacheBySessionId.delete(input.sessionId);
72212
- const current = cacheBySessionId.get(input.sessionId);
72213
- if (!current?.snapshot) return fetchBlockingSnapshot(input, identityKey, tokenFingerprint, current);
72382
+ const cacheKey = cacheKeyFor(input.sessionId, input.orgId);
72383
+ const existing = cacheByKey.get(cacheKey);
72384
+ if (existing && (existing.identityKey !== identityKey || existing.tokenFingerprint !== tokenFingerprint)) cacheByKey.delete(cacheKey);
72385
+ const current = cacheByKey.get(cacheKey);
72386
+ if (!current?.snapshot) return fetchBlockingSnapshot(input, cacheKey, identityKey, tokenFingerprint, current);
72214
72387
  const ageMs = Math.max(0, nowMs() - current.cachedAtMs);
72215
72388
  if (ageMs <= 12e4) return current.snapshot;
72216
72389
  if (ageMs <= 3e5) {
72217
72390
  if (!current.inFlight) {
72218
72391
  let refreshPromise;
72219
72392
  refreshPromise = input.fetchFresh().then((snapshot) => {
72220
- const latest = cacheBySessionId.get(input.sessionId);
72393
+ const latest = cacheByKey.get(cacheKey);
72221
72394
  if (latest?.tokenFingerprint === tokenFingerprint && latest.inFlight === refreshPromise) {
72222
72395
  latest.snapshot = snapshot;
72223
72396
  latest.cachedAtMs = nowMs();
@@ -72225,25 +72398,25 @@ async function readCachedCmmdWorkIntakeForSession(input) {
72225
72398
  return snapshot;
72226
72399
  }).catch((error) => {
72227
72400
  if (legacyCmmdToolBridge.isAuthError(error)) {
72228
- const latest = cacheBySessionId.get(input.sessionId);
72229
- if (latest?.tokenFingerprint === tokenFingerprint && latest.inFlight === refreshPromise) cacheBySessionId.delete(input.sessionId);
72401
+ const latest = cacheByKey.get(cacheKey);
72402
+ if (latest?.tokenFingerprint === tokenFingerprint && latest.inFlight === refreshPromise) cacheByKey.delete(cacheKey);
72230
72403
  }
72231
72404
  return current.snapshot;
72232
72405
  }).finally(() => {
72233
- const latest = cacheBySessionId.get(input.sessionId);
72406
+ const latest = cacheByKey.get(cacheKey);
72234
72407
  if (latest?.tokenFingerprint === tokenFingerprint && latest.inFlight === refreshPromise) latest.inFlight = null;
72235
72408
  });
72236
72409
  current.inFlight = refreshPromise;
72237
72410
  }
72238
72411
  return current.snapshot;
72239
72412
  }
72240
- return fetchBlockingSnapshot(input, identityKey, tokenFingerprint, current);
72413
+ return fetchBlockingSnapshot(input, cacheKey, identityKey, tokenFingerprint, current);
72241
72414
  }
72242
72415
  function invalidateCachedCmmdWorkIntakeForSession(sessionId) {
72243
- cacheBySessionId.delete(sessionId);
72416
+ for (const [key, entry] of cacheByKey) if (entry.sessionId === sessionId) cacheByKey.delete(key);
72244
72417
  }
72245
72418
  function invalidateCachedCmmdWorkIntakeForIdentity(identityKey) {
72246
- for (const [sessionId, entry] of cacheBySessionId) if (entry.identityKey === identityKey) cacheBySessionId.delete(sessionId);
72419
+ for (const [key, entry] of cacheByKey) if (entry.identityKey === identityKey) cacheByKey.delete(key);
72247
72420
  }
72248
72421
  //#endregion
72249
72422
  //#region src/cmmdData/proxyRouteRegistry.ts
@@ -76116,7 +76289,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
76116
76289
  var fs$6 = __require("fs");
76117
76290
  var path$5 = __require("path");
76118
76291
  var url$1 = __require("url");
76119
- var os$2 = __require("os");
76292
+ var os$3 = __require("os");
76120
76293
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
76121
76294
  var vars = process.config && process.config.variables || {};
76122
76295
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
@@ -76124,8 +76297,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
76124
76297
  var abi = versions.modules;
76125
76298
  if (versions.deno || process.isBun) abi = "unsupported";
76126
76299
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
76127
- var arch = process.env.npm_config_arch || os$2.arch();
76128
- var platform = process.env.npm_config_platform || os$2.platform();
76300
+ var arch = process.env.npm_config_arch || os$3.arch();
76301
+ var platform = process.env.npm_config_platform || os$3.platform();
76129
76302
  var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
76130
76303
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
76131
76304
  var uv = (versions.uv || "").split(".")[0];
@@ -93969,7 +94142,7 @@ const launchDetached = (launch) => gen(function* () {
93969
94142
  });
93970
94143
  const OpenLive = effect(Open, gen(function* () {
93971
94144
  const open = yield* tryPromise({
93972
- try: () => import("./open-2-reBrpv.mjs"),
94145
+ try: () => import("./open-yHTUkd2Y.mjs"),
93973
94146
  catch: (cause) => new OpenError$1({
93974
94147
  message: "failed to load browser opener",
93975
94148
  cause
@@ -104670,6 +104843,29 @@ function warn$1(label, cause) {
104670
104843
  return `${label} fetch failed: ${cause instanceof Error ? cause.message : String(cause)}`;
104671
104844
  }
104672
104845
  /**
104846
+ * Reads the workspace catalog off a settled bootstrap call. No explicit org
104847
+ * means CMMD answered `activeWorkspace` with its own default-organization
104848
+ * guess, not a confirmed fact -- leave it null rather than publish it
104849
+ * (forge#3636).
104850
+ */
104851
+ function resolveWorkspacesFromBootstrap(bootstrapResult, orgId, warnings) {
104852
+ if (bootstrapResult.status !== "fulfilled") {
104853
+ warnings.push(warn$1("Workspaces (bootstrap)", bootstrapResult.reason));
104854
+ return {
104855
+ workspaces: [],
104856
+ activeWorkspace: null
104857
+ };
104858
+ }
104859
+ const bootstrap = unwrapRestObject(bootstrapResult.value);
104860
+ const rawWorkspaces = bootstrap?.["workspaces"];
104861
+ const workspaces = Array.isArray(rawWorkspaces) ? rawWorkspaces.map(adaptBootstrapWorkspace) : [];
104862
+ const rawActive = orgId !== void 0 ? bootstrap?.["activeWorkspace"] : void 0;
104863
+ return {
104864
+ workspaces,
104865
+ activeWorkspace: rawActive && typeof rawActive === "object" ? adaptBootstrapWorkspace(rawActive) : null
104866
+ };
104867
+ }
104868
+ /**
104673
104869
  * Build the CMMD work-intake snapshot via the JWT REST API:
104674
104870
  * bootstrap (workspaces) + campaigns + projects + center-board (tasks WITH deps).
104675
104871
  * `identity` is supplied by the session (resolved at login), matching the MCP builder.
@@ -104677,21 +104873,13 @@ function warn$1(label, cause) {
104677
104873
  async function fetchCmmdWorkIntakeViaRest(jwt, identity, deps = {}) {
104678
104874
  const get = deps.proxyGet ?? proxyGet;
104679
104875
  const [bootstrapResult, campaignsResult, projectsResult, boardResult] = await Promise.allSettled([
104680
- get(jwt, "/api/forge/context/bootstrap"),
104876
+ get(jwt, "/api/forge/context/bootstrap", void 0, deps.orgId),
104681
104877
  get(jwt, "/api/forge/context/campaigns"),
104682
104878
  fetchAllProjects(get, jwt),
104683
104879
  get(jwt, "/api/forge/context/work-items/board")
104684
104880
  ]);
104685
104881
  const warnings = [];
104686
- let workspaces = [];
104687
- let activeWorkspace = null;
104688
- if (bootstrapResult.status === "fulfilled") {
104689
- const bootstrap = unwrapRestObject(bootstrapResult.value);
104690
- const rawWorkspaces = bootstrap?.["workspaces"];
104691
- if (Array.isArray(rawWorkspaces)) workspaces = rawWorkspaces.map(adaptBootstrapWorkspace);
104692
- const rawActive = bootstrap?.["activeWorkspace"];
104693
- if (rawActive && typeof rawActive === "object") activeWorkspace = adaptBootstrapWorkspace(rawActive);
104694
- } else warnings.push(warn$1("Workspaces (bootstrap)", bootstrapResult.reason));
104882
+ const { workspaces, activeWorkspace } = resolveWorkspacesFromBootstrap(bootstrapResult, deps.orgId, warnings);
104695
104883
  if (projectsResult.status === "rejected") throw projectsResult.reason;
104696
104884
  if (campaignsResult.status === "rejected") warnings.push(warn$1("Campaigns", campaignsResult.reason));
104697
104885
  if (boardResult.status === "rejected") warnings.push(warn$1("Tasks (board)", boardResult.reason));
@@ -192255,7 +192443,7 @@ var Vce = {
192255
192443
  function Ve() {
192256
192444
  return Vce;
192257
192445
  }
192258
- var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
192446
+ var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
192259
192447
  let t = path.join(Us, "Library");
192260
192448
  return {
192261
192449
  data: path.join(t, "Application Support", e),
@@ -202455,12 +202643,12 @@ function qZ(e, t) {
202455
202643
  }
202456
202644
  return n;
202457
202645
  }
202458
- var os$1 = "https://code.claude.com/docs/en", kKe = [
202646
+ var os$2 = "https://code.claude.com/docs/en", kKe = [
202459
202647
  {
202460
202648
  matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
202461
202649
  tip: {
202462
202650
  suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
202463
- docLink: `${os$1}/iam#permission-modes`
202651
+ docLink: `${os$2}/iam#permission-modes`
202464
202652
  }
202465
202653
  },
202466
202654
  {
@@ -202475,7 +202663,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202475
202663
  matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
202476
202664
  tip: {
202477
202665
  suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
202478
- docLink: `${os$1}/settings#environment-variables`
202666
+ docLink: `${os$2}/settings#environment-variables`
202479
202667
  }
202480
202668
  },
202481
202669
  {
@@ -202486,14 +202674,14 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202486
202674
  matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
202487
202675
  tip: {
202488
202676
  suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
202489
- docLink: `${os$1}/hooks`
202677
+ docLink: `${os$2}/hooks`
202490
202678
  }
202491
202679
  },
202492
202680
  {
202493
202681
  matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
202494
202682
  tip: {
202495
202683
  suggestion: "Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {\"type\": \"command\", \"command\": \"echo\", \"args\": [\"hi\"]}. For shell form, set `command` to the full shell string: {\"type\": \"command\", \"command\": \"echo hi\"}.",
202496
- docLink: `${os$1}/hooks#exec-form-and-shell-form`
202684
+ docLink: `${os$2}/hooks#exec-form-and-shell-form`
202497
202685
  }
202498
202686
  },
202499
202687
  {
@@ -202508,7 +202696,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202508
202696
  matches: (e) => e.code === "unrecognized_keys",
202509
202697
  tip: {
202510
202698
  suggestion: "Check for typos or refer to the documentation for valid fields",
202511
- docLink: `${os$1}/settings`
202699
+ docLink: `${os$2}/settings`
202512
202700
  }
202513
202701
  },
202514
202702
  {
@@ -202523,13 +202711,13 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202523
202711
  matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
202524
202712
  tip: {
202525
202713
  suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
202526
- docLink: `${os$1}/iam#working-directories`
202714
+ docLink: `${os$2}/iam#working-directories`
202527
202715
  }
202528
202716
  }
202529
202717
  ], AKe = {
202530
- permissions: `${os$1}/iam#configuring-permissions`,
202531
- env: `${os$1}/settings#environment-variables`,
202532
- hooks: `${os$1}/hooks`
202718
+ permissions: `${os$2}/iam#configuring-permissions`,
202719
+ env: `${os$2}/settings#environment-variables`,
202720
+ hooks: `${os$2}/hooks`
202533
202721
  };
202534
202722
  function GZ(e) {
202535
202723
  let t = kKe.find((r) => r.matches(e));
@@ -234623,7 +234811,7 @@ function inferCheckpointRefsPrefixFromStored(checkpointRefs) {
234623
234811
  return checkpointRefs.some((checkpointRef) => String(checkpointRef).startsWith(`refs/t3/checkpoints/`)) ? LEGACY_CHECKPOINT_REFS_PREFIX : CHECKPOINT_REFS_PREFIX;
234624
234812
  }
234625
234813
  function checkpointRefForThreadTurnWithPrefix(threadId, turnCount, prefix) {
234626
- return CheckpointRef.make(`${prefix}/${encodeBase64Url$2(threadId)}/turn/${turnCount}`);
234814
+ return CheckpointRef.make(`${prefix}/${encodeBase64Url$3(threadId)}/turn/${turnCount}`);
234627
234815
  }
234628
234816
  function resolveThreadWorkspaceCwd(input) {
234629
234817
  const worktreeCwd = input.thread.worktreePath ?? void 0;
@@ -239110,10 +239298,10 @@ function legacySafeThreadId(threadId) {
239110
239298
  return threadId.replace(/[^a-zA-Z0-9._-]/g, "_");
239111
239299
  }
239112
239300
  function toSafeThreadId(threadId) {
239113
- return `terminal_${encodeBase64Url$2(threadId)}`;
239301
+ return `terminal_${encodeBase64Url$3(threadId)}`;
239114
239302
  }
239115
239303
  function toSafeTerminalId(terminalId) {
239116
- return encodeBase64Url$2(terminalId);
239304
+ return encodeBase64Url$3(terminalId);
239117
239305
  }
239118
239306
  function toSessionKey(threadId, terminalId) {
239119
239307
  return `${threadId}\u0000${terminalId}`;
@@ -271073,7 +271261,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
271073
271261
  var dgram = __require("dgram");
271074
271262
  var thunky = require_thunky();
271075
271263
  var events = __require("events");
271076
- var os = __require("os");
271264
+ var os$1 = __require("os");
271077
271265
  var noop = function() {};
271078
271266
  module.exports = function(opts) {
271079
271267
  if (!opts) opts = {};
@@ -271204,14 +271392,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
271204
271392
  return that;
271205
271393
  };
271206
271394
  function defaultInterface() {
271207
- var networks = os.networkInterfaces();
271395
+ var networks = os$1.networkInterfaces();
271208
271396
  var names = Object.keys(networks);
271209
271397
  for (var i = 0; i < names.length; i++) {
271210
271398
  var net = networks[names[i]];
271211
271399
  for (var j = 0; j < net.length; j++) {
271212
271400
  var iface = net[j];
271213
271401
  if (isIPv4(iface.family) && !iface.internal) {
271214
- if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
271402
+ if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
271215
271403
  return "0.0.0.0";
271216
271404
  }
271217
271405
  }
@@ -271219,7 +271407,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
271219
271407
  return "127.0.0.1";
271220
271408
  }
271221
271409
  function allInterfaces() {
271222
- var networks = os.networkInterfaces();
271410
+ var networks = os$1.networkInterfaces();
271223
271411
  var names = Object.keys(networks);
271224
271412
  var res = [];
271225
271413
  for (var i = 0; i < names.length; i++) {
@@ -299854,7 +300042,7 @@ function resolveBuildCommitFromEnv(env) {
299854
300042
  * environment descriptor down instead of reporting an honest "unknown".
299855
300043
  */
299856
300044
  function readBakedBuildCommit() {
299857
- return "52e8c25f0de536143b44ff1ac86510aa93d35772";
300045
+ return "8a4057a4a58eeb014b73143ffbb1bb091089d750";
299858
300046
  }
299859
300047
  async function resolveServerBuildCommit(input) {
299860
300048
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -310204,6 +310392,24 @@ function logWorkIntakeFailure(cause) {
310204
310392
  }
310205
310393
  console.error("[work-intake] fetch failed:", cause);
310206
310394
  }
310395
+ /**
310396
+ * `?orgId=` present but empty (a stripped or malformed query string) is not
310397
+ * an explicit org. Treat it the same as an absent param rather than sending
310398
+ * CMMD an empty `X-Organization-ID` header (forge#3636).
310399
+ */
310400
+ function normalizeOrgIdQueryParam(raw) {
310401
+ const trimmed = raw?.trim();
310402
+ return trimmed ? trimmed : void 0;
310403
+ }
310404
+ /**
310405
+ * `{ orgId }` when present, `{}` when not -- the `exactOptionalPropertyTypes`
310406
+ * shape every `orgId?: string` deps object here needs, since spreading
310407
+ * `{ orgId: possiblyUndefined }` inline assigns `undefined` to a property
310408
+ * the type says is only ever absent or a string.
310409
+ */
310410
+ function orgIdDeps(orgId) {
310411
+ return orgId !== void 0 ? { orgId } : {};
310412
+ }
310207
310413
  function fetchRestFallbackWorkIntakeForSession(session, dependencies = {}) {
310208
310414
  return gen(function* () {
310209
310415
  const jwt = yield* (dependencies.resolveJwt ?? resolveCmmdJwtForSession)({
@@ -310215,7 +310421,7 @@ function fetchRestFallbackWorkIntakeForSession(session, dependencies = {}) {
310215
310421
  const identity = (dependencies.readIdentity ?? readCmmdUserIdentityForSession)(session.sessionId);
310216
310422
  const fetchFallback = dependencies.fetchFallback ?? fetchCmmdWorkIntakeViaRest;
310217
310423
  return yield* tryPromise({
310218
- try: () => fetchFallback(jwt, identity),
310424
+ try: () => fetchFallback(jwt, identity, orgIdDeps(dependencies.orgId)),
310219
310425
  catch: (cause) => new WorkIntakeSnapshotReadError({
310220
310426
  detail: "Failed to build CMMD REST work-intake fallback.",
310221
310427
  cause
@@ -310327,7 +310533,9 @@ function unwrapForgeEnvelopeJsonText(text) {
310327
310533
  const cmmdWorkIntakeRouteLayer = add$1("GET", "/api/cmmd/work-intake", gen(function* () {
310328
310534
  const request = yield* HttpServerRequest;
310329
310535
  const session = yield* (yield* ServerAuth).authenticateHttpRequest(request);
310330
- const forceFresh = new URL(request.url, "http://localhost").searchParams.get("fresh") === "1";
310536
+ const requestUrl = new URL(request.url, "http://localhost");
310537
+ const forceFresh = requestUrl.searchParams.get("fresh") === "1";
310538
+ const orgId = normalizeOrgIdQueryParam(requestUrl.searchParams.get("orgId"));
310331
310539
  let accessToken = readCommandAccessTokenForSession(session.sessionId);
310332
310540
  if (!accessToken && session.role === "owner" && (session.subject === "owner-bootstrap" || session.subject === "desktop-bootstrap")) accessToken = (yield* promoteMostRecentOwnerCommandAuthToSession(session.sessionId).pipe(catch_((error) => logWarning$1("Failed to promote owner CMMD auth for work intake.", {
310333
310541
  cause: error,
@@ -310372,8 +310580,9 @@ const cmmdWorkIntakeRouteLayer = add$1("GET", "/api/cmmd/work-intake", gen(funct
310372
310580
  sessionId: session.sessionId,
310373
310581
  identityKey: workIntakeCacheIdentity,
310374
310582
  token: accessToken,
310583
+ ...orgIdDeps(orgId),
310375
310584
  forceFresh,
310376
- fetchFresh: () => cmmdJwt ? fetchCmmdWorkIntakeViaRest(cmmdJwt, sessionIdentity) : Promise.reject(/* @__PURE__ */ new Error("CMMD JWT unavailable for work-intake fetch."))
310585
+ fetchFresh: () => cmmdJwt ? fetchCmmdWorkIntakeViaRest(cmmdJwt, sessionIdentity, orgIdDeps(orgId)) : Promise.reject(/* @__PURE__ */ new Error("CMMD JWT unavailable for work-intake fetch."))
310377
310586
  }),
310378
310587
  catch: (cause) => new WorkIntakeSnapshotReadError({
310379
310588
  detail: "Failed to read CMMD work intake snapshot.",
@@ -310391,7 +310600,7 @@ const cmmdWorkIntakeRouteLayer = add$1("GET", "/api/cmmd/work-intake", gen(funct
310391
310600
  if (isCmmdMcpAuthError(cause)) {
310392
310601
  console.error("[WORK_INTAKE] CMMD_AUTH_EXPIRED mcp_error:", cause instanceof Error ? cause.message : String(cause));
310393
310602
  invalidateCachedCmmdWorkIntakeForSession(session.sessionId);
310394
- const fallback = yield* fetchRestFallbackWorkIntakeForSession(session);
310603
+ const fallback = yield* fetchRestFallbackWorkIntakeForSession(session, orgIdDeps(orgId));
310395
310604
  yield* clearCommandAccessTokenForSession(session.sessionId).pipe(catch_((error) => logWarning$1("Failed to clear expired CMMD token after MCP auth failure.", {
310396
310605
  cause: error,
310397
310606
  sessionId: session.sessionId
@@ -310416,7 +310625,7 @@ const cmmdWorkIntakeRouteLayer = add$1("GET", "/api/cmmd/work-intake", gen(funct
310416
310625
  connected: snapshot.connected
310417
310626
  });
310418
310627
  invalidateCachedCmmdWorkIntakeForSession(session.sessionId);
310419
- const fallback = yield* fetchRestFallbackWorkIntakeForSession(session);
310628
+ const fallback = yield* fetchRestFallbackWorkIntakeForSession(session, orgIdDeps(orgId));
310420
310629
  yield* clearCommandAccessTokenForSession(session.sessionId).pipe(catch_((error) => logWarning$1("Failed to clear expired CMMD token after auth warning.", {
310421
310630
  cause: error,
310422
310631
  sessionId: session.sessionId
@@ -311771,12 +311980,65 @@ registerProxyRoute({
311771
311980
  responseShape: "unwrapData",
311772
311981
  requestBody: "none"
311773
311982
  });
311774
- registerProxyRoute({
311983
+ function parseCmmdBootstrapRequest(request) {
311984
+ return sync$1(() => {
311985
+ return {
311986
+ ok: true,
311987
+ value: normalizeOrgIdQueryParam(new URL(request.url, "http://localhost").searchParams.get("orgId"))
311988
+ };
311989
+ });
311990
+ }
311991
+ /**
311992
+ * Nulls `activeWorkspace` on a bootstrap body, wherever it sits. CMMD answers
311993
+ * `GET /api/forge/context/bootstrap` either flat (`{ activeWorkspace, ... }`)
311994
+ * or enveloped (`{ data: { activeWorkspace, ... } }`) -- `workIntakeRest.ts`'s
311995
+ * `unwrapRestObject` already treats both as live shapes for this exact
311996
+ * endpoint. Nulling only the top level left `data.activeWorkspace` (CMMD's
311997
+ * guess) untouched on the enveloped shape.
311998
+ */
311999
+ function nullActiveWorkspace(body) {
312000
+ const data = body["data"];
312001
+ const nulledData = typeof data === "object" && data !== null && !Array.isArray(data) ? {
312002
+ ...data,
312003
+ activeWorkspace: null
312004
+ } : data;
312005
+ return {
312006
+ ...body,
312007
+ activeWorkspace: null,
312008
+ ...data !== void 0 ? { data: nulledData } : {}
312009
+ };
312010
+ }
312011
+ /**
312012
+ * CMMD resolves `activeWorkspace` to the caller's own default organization
312013
+ * whenever the request carries no `X-Organization-ID` header (forge#3636:
312014
+ * the owner working in org 2119 kept getting org 2142, CMMD's default, back).
312015
+ * Passing the client's explicit `?orgId=` scopes CMMD's answer to that
312016
+ * workspace; without one, CMMD still guesses, so `activeWorkspace` is nulled
312017
+ * here rather than forwarded as fact. Everything else in the bootstrap
312018
+ * response passes through untouched.
312019
+ */
312020
+ function runCmmdBootstrap(orgId, { session }) {
312021
+ return runCmmdRestProxyAsHandlerResult(session, (jwt) => cmmdGateway.request({
312022
+ method: "GET",
312023
+ jwt,
312024
+ path: "/api/forge/context/bootstrap",
312025
+ ...orgId !== void 0 ? { orgId } : {}
312026
+ }), (value) => {
312027
+ if (orgId !== void 0 || value === null || typeof value !== "object") return {
312028
+ status: 200,
312029
+ body: value
312030
+ };
312031
+ return {
312032
+ status: 200,
312033
+ body: nullActiveWorkspace(value)
312034
+ };
312035
+ });
312036
+ }
312037
+ registerProxyHandler({
311775
312038
  forgePath: "/api/cmmd/bootstrap",
311776
312039
  method: "GET",
311777
- cmmdPath: "/api/forge/context/bootstrap",
311778
- orgIdSource: "none",
311779
- responseShape: "passthrough"
312040
+ parse: parseCmmdBootstrapRequest,
312041
+ run: runCmmdBootstrap
311780
312042
  });
311781
312043
  registerProxyRoute({
311782
312044
  forgePath: "/api/cmmd/account/preferences",
@@ -312710,6 +312972,44 @@ const cmmdUpdateProjectAgentMemberAvatarRouteLayer = registerProxyRoute({
312710
312972
  responseShape: "unwrapData"
312711
312973
  });
312712
312974
  //#endregion
312975
+ //#region src/command/cmmdPushProxyRoutes.ts
312976
+ /**
312977
+ * The signed-in phone's push registration, forwarded to CMMD's push
312978
+ * device-token API on the owner's stored CMMD JWT (forge#3534).
312979
+ *
312980
+ * CMMD owns push delivery: the `device_push_tokens` table, the Expo transport,
312981
+ * and the `mobile_push_v1` delivery flag are all CMMD-side, and its
312982
+ * registration API lives at `/api/push`, not under `/api/forge/context`. The
312983
+ * mobile push delivery spec (docs/specs/2026-09-09-mobile-push-delivery.md,
312984
+ * stage 2) recommends reusing that API over adding a forge-context doorway
312985
+ * first: the Forge server already holds the phone's CMMD credential, and the
312986
+ * registry prologue here provides the same session auth, CMMD-connection
312987
+ * gate, and `CMMD_AUTH_REQUIRED` mapping every `/api/cmmd` route gets. The
312988
+ * deny-listed legacy owner control paths are untouched. If review wants a
312989
+ * forge-context doorway first, these two routes are the only call sites to
312990
+ * repoint.
312991
+ *
312992
+ * `orgIdSource` is `none` (the organization comes from the JWT, like the
312993
+ * settings and device-registry routes): a phone registers against its default
312994
+ * organization and has no workspace context to pass.
312995
+ */
312996
+ const cmmdRegisterMobilePushDeviceRouteLayer = registerProxyRoute({
312997
+ forgePath: "/api/cmmd/mobile/push/registration",
312998
+ method: "POST",
312999
+ cmmdPath: "/api/push/device-tokens",
313000
+ orgIdSource: "none",
313001
+ responseShape: "unwrapData",
313002
+ successStatus: 201
313003
+ });
313004
+ const cmmdDeleteMobilePushDeviceRouteLayer = registerProxyRoute({
313005
+ forgePath: "/api/cmmd/mobile/push/registration",
313006
+ method: "DELETE",
313007
+ cmmdPath: "/api/push/device-tokens",
313008
+ orgIdSource: "none",
313009
+ responseShape: "unwrapData",
313010
+ requestBody: "json"
313011
+ });
313012
+ //#endregion
312713
313013
  //#region src/command/runtimeProviderAuthorityUpgradeModel.ts
312714
313014
  const AUTHORITY_UPGRADE_OPERATION_KEYS = new Set([
312715
313015
  "operationId",
@@ -324279,7 +324579,7 @@ const MiscRuntimeLayerLive = mergeAll(AnalyticsServiceLayerLive, OpenLive, Serve
324279
324579
  const RuntimeDependenciesWithoutPullRequestsLive = ReactorLayerLive.pipe(provideMerge(CheckpointingLayerLive), provideMerge(GitLayerLive), provideMerge(OrchestrationLayerLive), provideMerge(ProviderLayerLive), provideMerge(TerminalLayerLive), provideMerge(AgentBrowserManagerLive), provideMerge(mergeAll(ThreadDevRuntimeLive, DevTunnelLive.pipe(provide$1(ThreadDevRuntimeLive)))), provideMerge(PersistenceLayerLive), provideMerge(KeybindingsLive), provideMerge(ProviderRegistryLive), provideMerge(mergeAll(ServerSettingsLive, UsageServiceLive.pipe(provide$1(ServerSettingsLive), provide$1(UsageSessionLookupLive), provide$1(UsageRecordedSourceLive.pipe(provide$1(OrchestrationLayerLive), provide$1(RuntimeReplicationOutboxLive), provide$1(ProviderSessionRuntimeRepositoryLive), provide$1(TextGenerationSessionRepositoryLive)))))), provideMerge(WorkspaceLayerLive), provideMerge(WorkspaceReadinessStateLive), provideMerge(ProjectFaviconResolverLive), provideMerge(RepositoryIdentityResolverLive), provideMerge(ServerEnvironmentLive), provideMerge(AuthLayerLive), provideMerge(ServerSecretStoreLayerLive), provideMerge(mergeAll(CloudRedisCoordinationLive, CloudStateSyncLive.pipe(provide$1(PersistenceLayerLive)))), provideMerge(MiscRuntimeLayerLive));
324280
324580
  const RuntimeDependenciesLive = pullRequestServiceFactoryLayer.pipe(provideMerge(RuntimeDependenciesWithoutPullRequestsLive), provideMerge(cmmdProjectIdentityResolverLive.pipe(provide$1(RuntimeDependenciesWithoutPullRequestsLive))), provideMerge(pullRequestProviderRuntimeLive));
324281
324581
  const RuntimeServicesLive = ServerRuntimeStartupLive.pipe(provideMerge(RuntimeDependenciesLive));
324282
- const makeRoutesLayer = mergeAll(attachmentUploadRouteLayer, authBearerBootstrapRouteLayer, authBootstrapRouteLayer, authCommandBearerBootstrapRouteLayer, authCommandBootstrapRouteLayer, authCmmdEmbedExchangeRouteLayer, authOAuthTokenExchangeRouteLayer, authWebSocketTicketRouteLayer, authCmmdOAuthDeviceRouteLayer, authCmmdOAuthTokenRouteLayer, authCmmdPasswordTokenRouteLayer, authClientsRevokeOthersRouteLayer, authClientsRevokeRouteLayer, authClientsRouteLayer, authLogoutRouteLayer, authPairingLinksRevokeRouteLayer, authPairingLinksRouteLayer, authPairingCredentialRouteLayer, authSessionRenewRouteLayer, authSessionRouteLayer, authWebSocketTokenRouteLayer, authWebLoginRouteLayer, authWebCallbackRouteLayer, cloudOwnerSessionRedeemRouteLayer, cloudOwnerSessionRevokeRouteLayer, desktopLocalWebBridgePublishRouteLayer, desktopLocalWebBridgeBootstrapRouteLayer, desktopRelayControlPlaneRouteLayer, apiDocsHtmlRouteLayer, apiDocsOpenApiRouteLayer, pulseSignalStateListRouteLayer, pulseSignalStateUpsertRouteLayer, cmmdProfileRouteLayer, ...cmmdProxyRouteLayers, cmmdWorkIntakeRouteLayer, cmmdWsTokenRouteLayer, cmmdGetProjectCommentsRouteLayer, cmmdAddProjectCommentRouteLayer, cmmdUpdateProjectRouteLayer, cmmdUploadTaskAttachmentRouteLayer, cmmdUpdateTaskCommentRouteLayer, cmmdListWorkspaceMembersRouteLayer, cmmdAddProjectMemberRouteLayer, cmmdUpdateProjectAgentMemberAvatarRouteLayer, runtimeReplicationStatusRouteLayer, cmmdRefreshProviderUsageRouteLayer, cmmdForgeCloudProjectsListRouteLayer, cmmdForgeCloudProjectsEventsRouteLayer, cmmdForgeEnvironmentsEventsRouteLayer, cmmdForgeRuntimesEnsureRouteLayer, cmmdForgeRuntimesConnectRouteLayer, ownerRuntimeCodexReadinessRouteLayer, cmmdForgeRuntimesStatusRouteLayer, cmmdForgeRuntimesStartRouteLayer, cmmdForgeRuntimesStopRouteLayer, cmmdForgeRuntimesRecycleRouteLayer, cmmdForgeRuntimesUpdateCommitRouteLayer, cmmdForgeRuntimesDestroyRouteLayer, mobileProviderCatalogRouteLayer, attachmentsRouteLayer, orchestrationDispatchRouteLayer, orchestrationCmmdWorkRunEventRouteLayer, orchestrationAutomationStartThreadRouteLayer, orchestrationAutomationRebindRouteLayer, orchestrationAutomationTerminalReconcileRouteLayer, mobileGitRunStackedActionRouteLayer, pullRequestDiffRouteLayer, orchestrationSnapshotRouteLayer, orchestrationThreadSnapshotRouteLayer, localAutomationListRouteLayer, localAutomationCreateRouteLayer, localAutomationUpdateRouteLayer, localAutomationDeleteRouteLayer, localAutomationRunRouteLayer, otlpTracesProxyRouteLayer, devTunnelProxyRouteLayer, devTunnelLocalPortProxyRouteLayer, projectFaviconRouteLayer, serverEnvironmentRouteLayer, browserWebRtcReadinessRouteLayer, staticAndDevRouteLayer, githubStatusRouteLayer, githubAuthorizeUrlRouteLayer, githubDisconnectRouteLayer, githubReposRouteLayer, githubCloneRouteLayer, githubCloneJobStartRouteLayer, githubCloneJobStatusRouteLayer, githubRefreshCredentialsRouteLayer, githubToolConfirmationApproveRouteLayer, projectLinkGetRouteLayer, projectLinkListRouteLayer, projectLinkSetRouteLayer, projectLinkDeleteRouteLayer, cmmdWorkspacesRouteLayer, cmmdCampaignsRouteLayer, cmmdProjectLinksRouteLayer, cmmdEnsureGitHubProjectContextRouteLayer, cmmdProjectRepositoryEnsureRouteLayer, cmmdProjectsGetRouteLayer, cmmdProjectsCreateRouteLayer, workspaceReadinessRouteLayer, runtimeLivenessRouteLayer, runtimeFilesystemHealthRouteLayer, claudeNativeGenerationProofRouteLayer, claudeUsageRouteLayer, codexRuntimeProviderReadinessRouteLayer, runtimeDiagnosticsRouteLayer, cloudFoldersRouteLayer, cloudProjectCreateRouteLayer, gitUrlCloneRouteLayer, websocketRpcRouteLayer).pipe(provide$1(browserApiCorsLayer));
324582
+ const makeRoutesLayer = mergeAll(attachmentUploadRouteLayer, authBearerBootstrapRouteLayer, authBootstrapRouteLayer, authCommandBearerBootstrapRouteLayer, authCommandBootstrapRouteLayer, authCmmdEmbedExchangeRouteLayer, authOAuthTokenExchangeRouteLayer, authWebSocketTicketRouteLayer, authCmmdOAuthDeviceRouteLayer, authCmmdOAuthTokenRouteLayer, authCmmdPasswordTokenRouteLayer, authClientsRevokeOthersRouteLayer, authClientsRevokeRouteLayer, authClientsRouteLayer, authLogoutRouteLayer, authPairingLinksRevokeRouteLayer, authPairingLinksRouteLayer, authPairingCredentialRouteLayer, authSessionRenewRouteLayer, authSessionRouteLayer, authWebSocketTokenRouteLayer, authWebLoginRouteLayer, authWebCallbackRouteLayer, cloudOwnerSessionRedeemRouteLayer, cloudOwnerSessionRevokeRouteLayer, desktopLocalWebBridgePublishRouteLayer, desktopLocalWebBridgeBootstrapRouteLayer, desktopRelayControlPlaneRouteLayer, apiDocsHtmlRouteLayer, apiDocsOpenApiRouteLayer, pulseSignalStateListRouteLayer, pulseSignalStateUpsertRouteLayer, cmmdProfileRouteLayer, ...cmmdProxyRouteLayers, cmmdWorkIntakeRouteLayer, cmmdWsTokenRouteLayer, cmmdGetProjectCommentsRouteLayer, cmmdAddProjectCommentRouteLayer, cmmdUpdateProjectRouteLayer, cmmdUploadTaskAttachmentRouteLayer, cmmdUpdateTaskCommentRouteLayer, cmmdListWorkspaceMembersRouteLayer, cmmdAddProjectMemberRouteLayer, cmmdUpdateProjectAgentMemberAvatarRouteLayer, runtimeReplicationStatusRouteLayer, cmmdRefreshProviderUsageRouteLayer, cmmdForgeCloudProjectsListRouteLayer, cmmdForgeCloudProjectsEventsRouteLayer, cmmdForgeEnvironmentsEventsRouteLayer, cmmdForgeRuntimesEnsureRouteLayer, cmmdForgeRuntimesConnectRouteLayer, ownerRuntimeCodexReadinessRouteLayer, cmmdRegisterMobilePushDeviceRouteLayer, cmmdDeleteMobilePushDeviceRouteLayer, cmmdForgeRuntimesStatusRouteLayer, cmmdForgeRuntimesStartRouteLayer, cmmdForgeRuntimesStopRouteLayer, cmmdForgeRuntimesRecycleRouteLayer, cmmdForgeRuntimesUpdateCommitRouteLayer, cmmdForgeRuntimesDestroyRouteLayer, mobileProviderCatalogRouteLayer, attachmentsRouteLayer, orchestrationDispatchRouteLayer, orchestrationCmmdWorkRunEventRouteLayer, orchestrationAutomationStartThreadRouteLayer, orchestrationAutomationRebindRouteLayer, orchestrationAutomationTerminalReconcileRouteLayer, mobileGitRunStackedActionRouteLayer, pullRequestDiffRouteLayer, orchestrationSnapshotRouteLayer, orchestrationThreadSnapshotRouteLayer, localAutomationListRouteLayer, localAutomationCreateRouteLayer, localAutomationUpdateRouteLayer, localAutomationDeleteRouteLayer, localAutomationRunRouteLayer, otlpTracesProxyRouteLayer, devTunnelProxyRouteLayer, devTunnelLocalPortProxyRouteLayer, projectFaviconRouteLayer, serverEnvironmentRouteLayer, browserWebRtcReadinessRouteLayer, staticAndDevRouteLayer, githubStatusRouteLayer, githubAuthorizeUrlRouteLayer, githubDisconnectRouteLayer, githubReposRouteLayer, githubCloneRouteLayer, githubCloneJobStartRouteLayer, githubCloneJobStatusRouteLayer, githubRefreshCredentialsRouteLayer, githubToolConfirmationApproveRouteLayer, projectLinkGetRouteLayer, projectLinkListRouteLayer, projectLinkSetRouteLayer, projectLinkDeleteRouteLayer, cmmdWorkspacesRouteLayer, cmmdCampaignsRouteLayer, cmmdProjectLinksRouteLayer, cmmdEnsureGitHubProjectContextRouteLayer, cmmdProjectRepositoryEnsureRouteLayer, cmmdProjectsGetRouteLayer, cmmdProjectsCreateRouteLayer, workspaceReadinessRouteLayer, runtimeLivenessRouteLayer, runtimeFilesystemHealthRouteLayer, claudeNativeGenerationProofRouteLayer, claudeUsageRouteLayer, codexRuntimeProviderReadinessRouteLayer, runtimeDiagnosticsRouteLayer, cloudFoldersRouteLayer, cloudProjectCreateRouteLayer, gitUrlCloneRouteLayer, websocketRpcRouteLayer).pipe(provide$1(browserApiCorsLayer));
324283
324583
  const runServer = launch$1(unwrap(gen(function* () {
324284
324584
  const config = yield* ServerConfig;
324285
324585
  fixPath({ preferProcessPath: config.forgeCmmdRuntimeMode === true });
@@ -325211,7 +325511,7 @@ const connectLoginCommand = make$33("login", {
325211
325511
  })).json();
325212
325512
  },
325213
325513
  openBrowser: async (url) => {
325214
- const open = (await import("./open-2-reBrpv.mjs")).default;
325514
+ const open = (await import("./open-yHTUkd2Y.mjs")).default;
325215
325515
  await open(url);
325216
325516
  return true;
325217
325517
  },