glimmervoid 0.48.3-next.337 → 0.48.3-next.339

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 (99) hide show
  1. package/dist/bin/glimmervoid.js +3 -3
  2. package/dist/chunks/{adapters-SWcaMeiS.js → adapters-Cypnpb15.js} +1 -1
  3. package/dist/chunks/{adapters-BLwLbCbP.js → adapters-D3fvjFaD.js} +1 -1
  4. package/dist/chunks/{main-C010jfJ0.js → main-CWw2h5HJ.js} +395 -42
  5. package/dist/client/assets/{action-status-2TEW4EL2.js → action-status-DEIpSTGp.js} +1 -1
  6. package/dist/client/assets/action-status-DEIpSTGp.js.br +0 -0
  7. package/dist/client/assets/{benchmark-panel-jKczyBsZ.js → benchmark-panel-ihBHovIz.js} +1 -1
  8. package/dist/client/assets/benchmark-panel-ihBHovIz.js.br +0 -0
  9. package/dist/client/assets/{boards-view-r9ysDKVz.js → boards-view-3eqajeRD.js} +1 -1
  10. package/dist/client/assets/boards-view-3eqajeRD.js.br +0 -0
  11. package/dist/client/assets/{card-registry-D5FILlqB.js → card-registry-DmMhE6ta.js} +1 -1
  12. package/dist/client/assets/card-registry-DmMhE6ta.js.br +5 -0
  13. package/dist/client/assets/{community-panel-D0um5dCB.js → community-panel-CgxbciTt.js} +1 -1
  14. package/dist/client/assets/community-panel-CgxbciTt.js.br +0 -0
  15. package/dist/client/assets/{control-ws-CLjOEjA2.js → control-ws-B-xw3MKQ.js} +1 -1
  16. package/dist/client/assets/control-ws-B-xw3MKQ.js.br +0 -0
  17. package/dist/client/assets/{dialogs-KYf3mpVq.js → dialogs-Ct-_NMef.js} +1 -1
  18. package/dist/client/assets/dialogs-Ct-_NMef.js.br +0 -0
  19. package/dist/client/assets/{doc-editor-ui-B1UVTG3s.js → doc-editor-ui-BsYMRT-Q.js} +1 -1
  20. package/dist/client/assets/doc-editor-ui-BsYMRT-Q.js.br +0 -0
  21. package/dist/client/assets/{feature-hint-CkU5nF1K.js → feature-hint-BwA2gCQ1.js} +1 -1
  22. package/dist/client/assets/feature-hint-BwA2gCQ1.js.br +0 -0
  23. package/dist/client/assets/{first-run-checklist-B2BuAX_w.js → first-run-checklist-DH1ANJNx.js} +1 -1
  24. package/dist/client/assets/first-run-checklist-DH1ANJNx.js.br +0 -0
  25. package/dist/client/assets/{hooks-panel-E2uUiL8g.js → hooks-panel-MydUrzQK.js} +1 -1
  26. package/dist/client/assets/hooks-panel-MydUrzQK.js.br +0 -0
  27. package/dist/client/assets/{index-DNCFW7HQ.js → index-CdA_jL-G.js} +5 -5
  28. package/dist/client/assets/index-CdA_jL-G.js.br +0 -0
  29. package/dist/client/assets/{issues-panel-B1DFAvrx.js → issues-panel-C7_9rjrA.js} +1 -1
  30. package/dist/client/assets/issues-panel-C7_9rjrA.js.br +0 -0
  31. package/dist/client/assets/{my-prs-panel-2gYv28N1.js → my-prs-panel-DagrP1TG.js} +1 -1
  32. package/dist/client/assets/my-prs-panel-DagrP1TG.js.br +0 -0
  33. package/dist/client/assets/{nyan-cat-DIPme3y-.js → nyan-cat-DXfeVvHq.js} +1 -1
  34. package/dist/client/assets/nyan-cat-DXfeVvHq.js.br +0 -0
  35. package/dist/client/assets/{phone-shell-BtFmDho7.js → phone-shell-CsR6d89L.js} +1 -1
  36. package/dist/client/assets/phone-shell-CsR6d89L.js.br +0 -0
  37. package/dist/client/assets/{plan-face-CybcdwGY.js → plan-face-CSvRLD7O.js} +1 -1
  38. package/dist/client/assets/plan-face-CSvRLD7O.js.br +0 -0
  39. package/dist/client/assets/{plan-render-D1sERNqT.js → plan-render-CgMI21b0.js} +1 -1
  40. package/dist/client/assets/plan-render-CgMI21b0.js.br +0 -0
  41. package/dist/client/assets/{pr-queue-columns-DLiNQnxA.js → pr-queue-columns-Bd1V6i4M.js} +1 -1
  42. package/dist/client/assets/pr-queue-columns-Bd1V6i4M.js.br +0 -0
  43. package/dist/client/assets/{radar-panel-Ck-ZVUWi.js → radar-panel-Bgq1laPC.js} +1 -1
  44. package/dist/client/assets/radar-panel-Bgq1laPC.js.br +0 -0
  45. package/dist/client/assets/{repo-roots-adder-DOItOVb5.js → repo-roots-adder-C199Zry5.js} +1 -1
  46. package/dist/client/assets/repo-roots-adder-C199Zry5.js.br +0 -0
  47. package/dist/client/assets/{resume-dialog-Od7CQuDr.js → resume-dialog-Tbqt4mj_.js} +1 -1
  48. package/dist/client/assets/resume-dialog-Tbqt4mj_.js.br +0 -0
  49. package/dist/client/assets/{review-queue-panel-CzMD36ii.js → review-queue-panel-_6mOsc1K.js} +1 -1
  50. package/dist/client/assets/review-queue-panel-_6mOsc1K.js.br +0 -0
  51. package/dist/client/assets/{session-tick-D-qLNqb3.js → session-tick-D5WnSMBa.js} +1 -1
  52. package/dist/client/assets/{settings-panel-CovjR75P.js → settings-panel-CpOqwhY4.js} +2 -2
  53. package/dist/client/assets/settings-panel-CpOqwhY4.js.br +0 -0
  54. package/dist/client/assets/{shown-lightbox-BRpxsqKx.js → shown-lightbox-Bi7zIO2T.js} +1 -1
  55. package/dist/client/assets/shown-lightbox-Bi7zIO2T.js.br +0 -0
  56. package/dist/client/assets/{team-review-panel-CQuVL2yx.js → team-review-panel-Ubpt_NGs.js} +1 -1
  57. package/dist/client/assets/team-review-panel-Ubpt_NGs.js.br +0 -0
  58. package/dist/client/assets/{trace-panel-CkGMUS9b.js → trace-panel-B75kowxN.js} +1 -1
  59. package/dist/client/assets/trace-panel-B75kowxN.js.br +0 -0
  60. package/dist/client/assets/{updates-view-core-C8XDTgVm.js → updates-view-core-DcQGhSIg.js} +1 -1
  61. package/dist/client/assets/updates-view-core-DcQGhSIg.js.br +0 -0
  62. package/dist/client/assets/{usage-panel-nfEwK_fR.js → usage-panel-BosJ6i7A.js} +1 -1
  63. package/dist/client/assets/usage-panel-BosJ6i7A.js.br +0 -0
  64. package/dist/client/assets/{your-day-tip-DeUJQvGU.js → your-day-tip-DOncg3k2.js} +1 -1
  65. package/dist/client/assets/your-day-tip-DOncg3k2.js.br +0 -0
  66. package/dist/client/index.html +6 -6
  67. package/dist/client/index.html.br +0 -0
  68. package/dist/server/index.js +1 -1
  69. package/package.json +1 -1
  70. package/dist/client/assets/action-status-2TEW4EL2.js.br +0 -0
  71. package/dist/client/assets/benchmark-panel-jKczyBsZ.js.br +0 -0
  72. package/dist/client/assets/boards-view-r9ysDKVz.js.br +0 -0
  73. package/dist/client/assets/card-registry-D5FILlqB.js.br +0 -0
  74. package/dist/client/assets/community-panel-D0um5dCB.js.br +0 -0
  75. package/dist/client/assets/control-ws-CLjOEjA2.js.br +0 -0
  76. package/dist/client/assets/dialogs-KYf3mpVq.js.br +0 -0
  77. package/dist/client/assets/doc-editor-ui-B1UVTG3s.js.br +0 -0
  78. package/dist/client/assets/feature-hint-CkU5nF1K.js.br +0 -0
  79. package/dist/client/assets/first-run-checklist-B2BuAX_w.js.br +0 -0
  80. package/dist/client/assets/hooks-panel-E2uUiL8g.js.br +0 -0
  81. package/dist/client/assets/index-DNCFW7HQ.js.br +0 -0
  82. package/dist/client/assets/issues-panel-B1DFAvrx.js.br +0 -0
  83. package/dist/client/assets/my-prs-panel-2gYv28N1.js.br +0 -0
  84. package/dist/client/assets/nyan-cat-DIPme3y-.js.br +0 -0
  85. package/dist/client/assets/phone-shell-BtFmDho7.js.br +0 -0
  86. package/dist/client/assets/plan-face-CybcdwGY.js.br +0 -0
  87. package/dist/client/assets/plan-render-D1sERNqT.js.br +0 -0
  88. package/dist/client/assets/pr-queue-columns-DLiNQnxA.js.br +0 -0
  89. package/dist/client/assets/radar-panel-Ck-ZVUWi.js.br +0 -0
  90. package/dist/client/assets/repo-roots-adder-DOItOVb5.js.br +0 -0
  91. package/dist/client/assets/resume-dialog-Od7CQuDr.js.br +0 -0
  92. package/dist/client/assets/review-queue-panel-CzMD36ii.js.br +0 -0
  93. package/dist/client/assets/settings-panel-CovjR75P.js.br +0 -0
  94. package/dist/client/assets/shown-lightbox-BRpxsqKx.js.br +0 -0
  95. package/dist/client/assets/team-review-panel-CQuVL2yx.js.br +0 -0
  96. package/dist/client/assets/trace-panel-CkGMUS9b.js.br +0 -0
  97. package/dist/client/assets/updates-view-core-C8XDTgVm.js.br +0 -0
  98. package/dist/client/assets/usage-panel-nfEwK_fR.js.br +0 -0
  99. package/dist/client/assets/your-day-tip-DeUJQvGU.js.br +0 -0
@@ -58,8 +58,7 @@ if (commandLine.globalOptions.configPath) process.env.GLIMMERVOID_CONFIG = comma
58
58
  if (commandLine.globalOptions.port) process.env.GLIMMERVOID_PORT = commandLine.globalOptions.port;
59
59
  var OWNED_COMMAND_RUNNERS = {
60
60
  doctor: async () => {
61
- await runDoctor();
62
- return 0;
61
+ return await runDoctor() ? 0 : 1;
63
62
  },
64
63
  pair: async ({ values }) => {
65
64
  const { runPairCli } = await import("../chunks/pair-cli-CEnZQWHm.js");
@@ -247,7 +246,7 @@ async function runDoctor() {
247
246
  }
248
247
  switchSection("Agents");
249
248
  try {
250
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-SWcaMeiS.js");
249
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-Cypnpb15.js");
251
250
  const declaredCustomAgents = await readDeclaredCustomAgents();
252
251
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
253
252
  setCustomAgents(declaredCustomAgents.declared);
@@ -299,6 +298,7 @@ async function runDoctor() {
299
298
  onPathFlag: false,
300
299
  platform
301
300
  })}`);
301
+ return nodePty.ok;
302
302
  }
303
303
  function resolveNpmGlobalPrefix(exec) {
304
304
  try {
@@ -1 +1 @@
1
- export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-BLwLbCbP.js";
1
+ export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-D3fvjFaD.js";
@@ -2150,4 +2150,4 @@ function resetCommandCache() {
2150
2150
  resolvedCommands.clear();
2151
2151
  }
2152
2152
  //#endregion
2153
- export { isUsageFile as $, exceedsUploadCap as A, isOversizedPartialLine as B, parseResolvedSha as C, totalTokensOf as Ct, MAX_UPLOAD_BYTES as D, openContainedFile as E, claudeCode as Et, MAX_TRANSCRIPT_READ_BYTES as F, codexHomes as G, resumeOffsetFrom as H, TRACE_TAIL_SCAN_BYTES as I, continuationDelayMs as J, codexRootCandidates as K, committedOffsetFromTraceTailOrNull as L, imageMimeForUploadFilename as M, isSafePathSegment as N, buildUploadFilename as O, planUploadRetention as P, grokHomes as Q, completeLineBytes as R, parseRegistryLatest as S, shouldReplace as St, shortSha as T, HOOK_TOOLS as Tt, withCommittedOffset as U, planContiguousRead as V, codexFallbackRoots as W, dedupeCodexFiles as X, decideFileRead as Y, expandTilde as Z, decideUpdateStatus as _, identityFromRelPath as _t, describeAgentResolvability as a, sessionsRootCandidates as at, normalizeUpdateChannel as b, parseJsonLine as bt, isKnownAgentId as c, splitLines as ct, resolveAdapter as d, addEntryToTotals as dt, kimiHomes as et, setCustomAgents as f, dedupKeys as ft, decideInstallFlavor as g, foldReplacementIntoGenerationRollup as gt, requestCodexAppServer as h, foldEntryIntoGenerationRollup as ht, customAgentFingerprint as i, scopedClaudeRoots as it, framePathPaste as j, decideUploadType as k, listAgentIds as l, kimiDedupIdentity as lt, readHostCodexVersion as m, expandAdvisorIterations as mt, cachedAgentResolvability as n, projectDirCandidates as nt, getAdapter as o, shouldEvaluateDespiteIoFailures as ot, codex as p, emptyTotals as pt, codexSessionIdFromPath as q, commandFor as r, resolveProjectsDirs as rt, hookProfileOf as s, shouldPersistWarehouse as st, DEFAULT_AGENT_ID as t, passOutcome as tt, resetCommandCache as u, parseKimiUsageLine as ut, isCheckFresh as v, isWithinGenerationRecencyWindow as vt, pickNewestPublished as w, vendorUsageEntry as wt, parseRegistryDeprecation as x, parseUsageLine as xt, normalizeSha as y, mergeGenerationRollups as yt, containmentRefusalReason as z };
2153
+ export { grokHomes as $, decideUploadType as A, containmentRefusalReason as B, parseRegistryLatest as C, shouldReplace as Ct, openContainedFile as D, claudeCode as Dt, shortSha as E, HOOK_TOOLS as Et, planUploadRetention as F, codexFallbackRoots as G, planContiguousRead as H, MAX_TRANSCRIPT_READ_BYTES as I, codexSessionIdFromPath as J, codexHomes as K, TRACE_TAIL_SCAN_BYTES as L, framePathPaste as M, imageMimeForUploadFilename as N, MAX_UPLOAD_BYTES as O, isSafePathSegment as P, expandTilde as Q, committedOffsetFromTraceTailOrNull as R, parseRegistryDeprecation as S, parseUsageLine as St, pickNewestPublished as T, vendorUsageEntry as Tt, resumeOffsetFrom as U, isOversizedPartialLine as V, withCommittedOffset as W, decideFileRead as X, continuationDelayMs as Y, dedupeCodexFiles as Z, decideInstallFlavor as _, foldReplacementIntoGenerationRollup as _t, describeAgentResolvability as a, scopedClaudeRoots as at, normalizeSha as b, mergeGenerationRollups as bt, isKnownAgentId as c, shouldPersistWarehouse as ct, resolveAdapter as d, parseKimiUsageLine as dt, isUsageFile as et, setCustomAgents as f, addEntryToTotals as ft, NODE_PTY_INSTALL_SCRIPT_FLAG as g, foldEntryIntoGenerationRollup as gt, requestCodexAppServer as h, expandAdvisorIterations as ht, customAgentFingerprint as i, resolveProjectsDirs as it, exceedsUploadCap as j, buildUploadFilename as k, listAgentIds as l, splitLines as lt, readHostCodexVersion as m, emptyTotals as mt, cachedAgentResolvability as n, passOutcome as nt, getAdapter as o, sessionsRootCandidates as ot, codex as p, dedupKeys as pt, codexRootCandidates as q, commandFor as r, projectDirCandidates as rt, hookProfileOf as s, shouldEvaluateDespiteIoFailures as st, DEFAULT_AGENT_ID as t, kimiHomes as tt, resetCommandCache as u, kimiDedupIdentity as ut, decideUpdateStatus as v, identityFromRelPath as vt, parseResolvedSha as w, totalTokensOf as wt, normalizeUpdateChannel as x, parseJsonLine as xt, isCheckFresh as y, isWithinGenerationRecencyWindow as yt, completeLineBytes as z };
@@ -20,7 +20,7 @@ import { C as parseCgroupBytes, D as DEFAULT_MAX_MS, E as DEFAULT_BASE_MS, O as
20
20
  import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-D5RoJ_zB.js";
21
21
  import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel-CuS5bnD6.js";
22
22
  import { i as resolveArgvCommandMatches } from "./kimi-BUCUWtAv.js";
23
- import { $ as isUsageFile, A as exceedsUploadCap, B as isOversizedPartialLine, C as parseResolvedSha, Ct as totalTokensOf$1, D as MAX_UPLOAD_BYTES, E as openContainedFile, Et as claudeCode, F as MAX_TRANSCRIPT_READ_BYTES, G as codexHomes, H as resumeOffsetFrom, I as TRACE_TAIL_SCAN_BYTES, J as continuationDelayMs, K as codexRootCandidates, L as committedOffsetFromTraceTailOrNull, M as imageMimeForUploadFilename, N as isSafePathSegment, O as buildUploadFilename, P as planUploadRetention, Q as grokHomes, R as completeLineBytes, S as parseRegistryLatest, St as shouldReplace, T as shortSha$1, Tt as HOOK_TOOLS, U as withCommittedOffset, V as planContiguousRead, W as codexFallbackRoots, X as dedupeCodexFiles, Y as decideFileRead, Z as expandTilde, _ as decideUpdateStatus, _t as identityFromRelPath, a as describeAgentResolvability, at as sessionsRootCandidates, b as normalizeUpdateChannel, bt as parseJsonLine, c as isKnownAgentId, ct as splitLines, d as resolveAdapter, dt as addEntryToTotals, et as kimiHomes, f as setCustomAgents, ft as dedupKeys, g as decideInstallFlavor, gt as foldReplacementIntoGenerationRollup, h as requestCodexAppServer, ht as foldEntryIntoGenerationRollup, i as customAgentFingerprint, it as scopedClaudeRoots, j as framePathPaste, k as decideUploadType, l as listAgentIds, lt as kimiDedupIdentity, m as readHostCodexVersion, mt as expandAdvisorIterations, n as cachedAgentResolvability, nt as projectDirCandidates, o as getAdapter, ot as shouldEvaluateDespiteIoFailures, p as codex, pt as emptyTotals, q as codexSessionIdFromPath, r as commandFor, rt as resolveProjectsDirs, s as hookProfileOf, st as shouldPersistWarehouse, t as DEFAULT_AGENT_ID$1, tt as passOutcome, u as resetCommandCache, ut as parseKimiUsageLine, v as isCheckFresh, vt as isWithinGenerationRecencyWindow, w as pickNewestPublished, wt as vendorUsageEntry, x as parseRegistryDeprecation, xt as parseUsageLine, y as normalizeSha, yt as mergeGenerationRollups, z as containmentRefusalReason } from "./adapters-BLwLbCbP.js";
23
+ import { $ as grokHomes, A as decideUploadType, B as containmentRefusalReason, C as parseRegistryLatest, Ct as shouldReplace, D as openContainedFile, Dt as claudeCode, E as shortSha$1, Et as HOOK_TOOLS, F as planUploadRetention, G as codexFallbackRoots, H as planContiguousRead, I as MAX_TRANSCRIPT_READ_BYTES, J as codexSessionIdFromPath, K as codexHomes, L as TRACE_TAIL_SCAN_BYTES, M as framePathPaste, N as imageMimeForUploadFilename, O as MAX_UPLOAD_BYTES, P as isSafePathSegment, Q as expandTilde, R as committedOffsetFromTraceTailOrNull, S as parseRegistryDeprecation, St as parseUsageLine, T as pickNewestPublished, Tt as vendorUsageEntry, U as resumeOffsetFrom, V as isOversizedPartialLine, W as withCommittedOffset, X as decideFileRead, Y as continuationDelayMs, Z as dedupeCodexFiles, _ as decideInstallFlavor, _t as foldReplacementIntoGenerationRollup, a as describeAgentResolvability, at as scopedClaudeRoots, b as normalizeSha, bt as mergeGenerationRollups, c as isKnownAgentId, ct as shouldPersistWarehouse, d as resolveAdapter, dt as parseKimiUsageLine, et as isUsageFile, f as setCustomAgents, ft as addEntryToTotals, g as NODE_PTY_INSTALL_SCRIPT_FLAG, gt as foldEntryIntoGenerationRollup, h as requestCodexAppServer, ht as expandAdvisorIterations, i as customAgentFingerprint, it as resolveProjectsDirs, j as exceedsUploadCap, k as buildUploadFilename, l as listAgentIds, lt as splitLines, m as readHostCodexVersion, mt as emptyTotals, n as cachedAgentResolvability, nt as passOutcome, o as getAdapter, ot as sessionsRootCandidates, p as codex, pt as dedupKeys, q as codexRootCandidates, r as commandFor, rt as projectDirCandidates, s as hookProfileOf, st as shouldEvaluateDespiteIoFailures, t as DEFAULT_AGENT_ID$1, tt as kimiHomes, u as resetCommandCache, ut as kimiDedupIdentity, v as decideUpdateStatus, vt as identityFromRelPath, w as parseResolvedSha, wt as totalTokensOf$1, x as normalizeUpdateChannel, xt as parseJsonLine, y as isCheckFresh, yt as isWithinGenerationRecencyWindow, z as completeLineBytes } from "./adapters-D3fvjFaD.js";
24
24
  import { c as CODEX_HOME_PROFILE, l as KIMI_HOME_PROFILE } from "./agent-home-core-DgW3orTE.js";
25
25
  import { d as releaseSessionLock, f as sessionIdOfLockFile, l as releaseUnheldAgentHomeSecrets, n as generatedAgentHomePath, p as trashSessionTempFolderOnceUnheld, s as realAgentHome, u as createHeldSessionTempFolder } from "./agent-home-BzANIIVe.js";
26
26
  import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
@@ -453,7 +453,7 @@ function closeExtraServers(extraServers) {
453
453
  } catch {}
454
454
  }
455
455
  }
456
- function createLifecycle({ shutdown, httpServer, extraServers = [], onRestart = null, spawn, exit = process.exit, getArgv = () => process.argv, cwd = () => process.cwd(), env = process.env, log = console.log, capMs = 3e3, closeTimeoutMs = 2e3, beforeHandOff, beforeHandOffCapMs = 3e5 }) {
456
+ function createLifecycle({ shutdown, httpServer, extraServers = [], onRestart = null, spawn, exit = process.exit, getArgv = () => process.argv, cwd = () => process.cwd(), env = process.env, log = console.log, capMs = 3e3, closeTimeoutMs = 2e3, beforeHandOff, beforeHandOffCapMs = 3e5, superviseSuccessor }) {
457
457
  let requested = false;
458
458
  let handOffPrepared = false;
459
459
  function fallbackTimer(fn, keepProcessAlive = false) {
@@ -522,23 +522,31 @@ function createLifecycle({ shutdown, httpServer, extraServers = [], onRestart =
522
522
  exit(75);
523
523
  return;
524
524
  }
525
- const successor = spawn(stableNodePath, getArgv().slice(1), {
525
+ const successor = await spawnReplacement();
526
+ if (!successor) return;
527
+ if (superviseSuccessor ? await superviseSuccessor(successor) : false) {
528
+ const rolledBackServer = await spawnReplacement();
529
+ if (!rolledBackServer) return;
530
+ rolledBackServer.unref();
531
+ }
532
+ successor.unref();
533
+ exit(0);
534
+ }
535
+ async function spawnReplacement() {
536
+ const replacement = spawn(stableNodePath, getArgv().slice(1), {
526
537
  cwd: cwd(),
527
538
  stdio: "ignore",
528
539
  detached: true,
529
540
  windowsHide: true
530
541
  });
531
542
  const spawnError = await new Promise((resolve) => {
532
- successor.once("spawn", () => resolve(null));
533
- successor.once("error", resolve);
543
+ replacement.once("spawn", () => resolve(null));
544
+ replacement.once("error", resolve);
534
545
  });
535
- if (spawnError) {
536
- log(`[lifecycle] could not start the replacement server with ${stableNodePath}: ${stopFailureText(spawnError)}`);
537
- exit(1);
538
- return;
539
- }
540
- successor.unref();
541
- exit(0);
546
+ if (!spawnError) return replacement;
547
+ log(`[lifecycle] could not start the replacement server with ${stableNodePath}: ${stopFailureText(spawnError)}`);
548
+ exit(1);
549
+ return null;
542
550
  }
543
551
  await new Promise((resolve, reject) => {
544
552
  const handOff = () => {
@@ -47811,6 +47819,8 @@ var QUARANTINED_DIST_NAME = "broken-dist";
47811
47819
  var QUARANTINED_DEPENDENCIES_NAME = "broken-node_modules";
47812
47820
  var SUPPORTED_UPDATE_REMOTE = "origin";
47813
47821
  var LOWEST_SCHEDULING_PRIORITY = "19";
47822
+ var NPM_PACKAGE_FOLDER_NAME = "glimmervoid";
47823
+ var NPM_GLOBAL_UPDATE_FOLDER_NAME = ".glimmervoid-update";
47814
47824
  var TRANSITIONS_ALLOWED_BY_STATE = Object.freeze({
47815
47825
  idle: Object.freeze(["begin-run"]),
47816
47826
  running: Object.freeze([
@@ -47825,7 +47835,7 @@ var TRANSITIONS_ALLOWED_BY_STATE = Object.freeze({
47825
47835
  "mark-succeeded",
47826
47836
  "mark-discarded"
47827
47837
  ]),
47828
- succeeded: Object.freeze(["begin-run"]),
47838
+ succeeded: Object.freeze(["begin-run", "fail-run"]),
47829
47839
  failed: Object.freeze(["begin-run"]),
47830
47840
  discarded: Object.freeze(["begin-run"]),
47831
47841
  interrupted: Object.freeze(["begin-run"])
@@ -47866,10 +47876,10 @@ function decidePreflight(facts) {
47866
47876
  reason: "unsupported-flavor",
47867
47877
  message: "Glimmervoid runs from the npx cache. Stop Glimmervoid and run the command shown."
47868
47878
  };
47869
- if (facts.flavor !== "clone") return {
47879
+ if (facts.flavor !== "clone" && facts.flavor !== "npm-global") return {
47870
47880
  ok: false,
47871
47881
  reason: "unsupported-flavor",
47872
- message: "Use the install command because dashboard updates require a clone."
47882
+ message: "Use the install command because dashboard updates need a clone or an npm global install."
47873
47883
  };
47874
47884
  if (facts.platform === "win32") return {
47875
47885
  ok: false,
@@ -47886,6 +47896,45 @@ function decidePreflight(facts) {
47886
47896
  reason: "no-update-available",
47887
47897
  message: "No update is available."
47888
47898
  };
47899
+ if (facts.flavor === "npm-global") return decideNpmGlobalPreflight(facts);
47900
+ return decideClonePreflight(facts);
47901
+ }
47902
+ function decideRunPreflight(facts) {
47903
+ if (facts.journalState === "running") return {
47904
+ ok: false,
47905
+ reason: "already-running",
47906
+ message: "Wait for the current update to finish."
47907
+ };
47908
+ if (facts.journalState === "staged") return {
47909
+ ok: false,
47910
+ reason: "already-staged",
47911
+ message: "Restart to apply the staged update."
47912
+ };
47913
+ if (facts.restartRequested) return {
47914
+ ok: false,
47915
+ reason: "restart-requested",
47916
+ message: "Wait for the requested restart to finish."
47917
+ };
47918
+ return {
47919
+ ok: true,
47920
+ lockfileCheckNeeded: true
47921
+ };
47922
+ }
47923
+ function decideNpmGlobalPreflight(facts) {
47924
+ const install = facts.npmGlobalInstall;
47925
+ if (!install) return {
47926
+ ok: false,
47927
+ reason: "unsupported-flavor",
47928
+ message: "Use the install command because this install is not in an npm global folder."
47929
+ };
47930
+ if (install.isWritable === false) return {
47931
+ ok: false,
47932
+ reason: "install-not-writable",
47933
+ message: `Use the install command because Glimmervoid cannot write to ${install.installFolder}.`
47934
+ };
47935
+ return decideRunPreflight(facts);
47936
+ }
47937
+ function decideClonePreflight(facts) {
47889
47938
  if (!facts.isTreeClean) return {
47890
47939
  ok: false,
47891
47940
  reason: "dirty-tree",
@@ -47922,25 +47971,7 @@ function decidePreflight(facts) {
47922
47971
  reason: "nothing-to-do",
47923
47972
  message: "The checkout is already at the target. Check for updates again."
47924
47973
  };
47925
- if (facts.journalState === "running") return {
47926
- ok: false,
47927
- reason: "already-running",
47928
- message: "Wait for the current update to finish."
47929
- };
47930
- if (facts.journalState === "staged") return {
47931
- ok: false,
47932
- reason: "already-staged",
47933
- message: "Restart to apply the staged update."
47934
- };
47935
- if (facts.restartRequested) return {
47936
- ok: false,
47937
- reason: "restart-requested",
47938
- message: "Wait for the requested restart to finish."
47939
- };
47940
- return {
47941
- ok: true,
47942
- lockfileCheckNeeded: true
47943
- };
47974
+ return decideRunPreflight(facts);
47944
47975
  }
47945
47976
  function decideFastForward({ canFastForward, isTargetAncestorOfHead }) {
47946
47977
  if (canFastForward) return {
@@ -48009,13 +48040,48 @@ function planHandOffRenames({ root, stagingPath, lockfileChanged }) {
48009
48040
  });
48010
48041
  return {
48011
48042
  renames,
48012
- reversalsByFailureIndex: renames.map((_, failureIndex) => renames.slice(0, failureIndex).reverse().map(({ from, to, artifact }) => ({
48013
- from: to,
48014
- to: from,
48015
- artifact
48016
- })))
48043
+ reversalsByFailureIndex: reversalsFor(renames)
48044
+ };
48045
+ }
48046
+ function decideNpmGlobalLayout(packageRoot) {
48047
+ const segments = packageRoot.replace(/\/+$/, "").split("/");
48048
+ const [libName, nodeModulesName, packageName] = segments.slice(-3);
48049
+ if (packageName !== NPM_PACKAGE_FOLDER_NAME || nodeModulesName !== "node_modules" || libName !== "lib") return null;
48050
+ const installFolder = segments.slice(0, -1).join("/");
48051
+ const updatePath = `${installFolder}/${NPM_GLOBAL_UPDATE_FOLDER_NAME}`;
48052
+ const stagePrefix = `${updatePath}/stage`;
48053
+ return {
48054
+ installFolder,
48055
+ livePackagePath: segments.join("/"),
48056
+ updatePath,
48057
+ stagePrefix,
48058
+ stagedPackagePath: `${stagePrefix}/lib/node_modules/${NPM_PACKAGE_FOLDER_NAME}`,
48059
+ previousPackagePath: `${updatePath}/previous`,
48060
+ quarantinedPackagePath: `${updatePath}/broken`
48017
48061
  };
48018
48062
  }
48063
+ function planNpmGlobalHandOffRenames(layout) {
48064
+ const renames = [{
48065
+ from: layout.livePackagePath,
48066
+ to: layout.previousPackagePath,
48067
+ artifact: "package"
48068
+ }, {
48069
+ from: layout.stagedPackagePath,
48070
+ to: layout.livePackagePath,
48071
+ artifact: "package"
48072
+ }];
48073
+ return {
48074
+ renames,
48075
+ reversalsByFailureIndex: reversalsFor(renames)
48076
+ };
48077
+ }
48078
+ function reversalsFor(renames) {
48079
+ return renames.map((_, failureIndex) => renames.slice(0, failureIndex).reverse().map(({ from, to, artifact }) => ({
48080
+ from: to,
48081
+ to: from,
48082
+ artifact
48083
+ })));
48084
+ }
48019
48085
  function appendTail(existingTail, output) {
48020
48086
  const appendedLines = output.split(/\r?\n/);
48021
48087
  if (appendedLines.at(-1) === "") appendedLines.pop();
@@ -48444,7 +48510,8 @@ function createBackendUpdateCheck(dependencies) {
48444
48510
  headSha: recorded.currentSha,
48445
48511
  targetSha: recorded.latestSha,
48446
48512
  journalState: journal?.state || "idle",
48447
- restartRequested: dependencies.isRestartRequested?.() === true
48513
+ restartRequested: dependencies.isRestartRequested?.() === true,
48514
+ npmGlobalInstall: dependencies.getNpmGlobalInstall?.() ?? null
48448
48515
  });
48449
48516
  if (!decision.ok) return {
48450
48517
  reason: decision.reason,
@@ -50683,6 +50750,9 @@ var HANDOFF_QUEUE_ADMISSION_TIMEOUT_MS = 3e4;
50683
50750
  var MERGE_COMMAND_TIMEOUT_MS = 3e4;
50684
50751
  var INSTALL_TIMEOUT_MS = 9e5;
50685
50752
  var BUILD_TIMEOUT_MS = 6e5;
50753
+ var VERIFY_TIMEOUT_MS = 6e4;
50754
+ var SUCCESSOR_LISTEN_TIMEOUT_MS = 3e4;
50755
+ var SUCCESSOR_POLL_INTERVAL_MS = 500;
50686
50756
  var COMMAND_MAX_BUFFER = 16777216;
50687
50757
  var RESTORE_MARKER_NAME = "restore.json";
50688
50758
  function errorText(error) {
@@ -50712,6 +50782,11 @@ function createUpdateApplyLane(dependencies) {
50712
50782
  const clock = dependencies.clock || (() => Date.now());
50713
50783
  const updatePath = path.join(dependencies.packageRoot, ".glimmervoid", "update");
50714
50784
  const stagingPath = path.join(updatePath, "next");
50785
+ const npmGlobalLayout = decideNpmGlobalLayout(dependencies.packageRoot);
50786
+ const nodePath = dependencies.nodePath || stableNodePath;
50787
+ const npmPath = path.join(path.dirname(nodePath), "npm");
50788
+ let isInstallWritable = null;
50789
+ let hasSwappedNpmGlobalPackage = false;
50715
50790
  let journal = idleJournal(dependencies.getUpdateChannel());
50716
50791
  let stagedDescriptor = null;
50717
50792
  let inFlight = false;
@@ -50732,6 +50807,22 @@ function createUpdateApplyLane(dependencies) {
50732
50807
  function getJournal() {
50733
50808
  return structuredClone(journal);
50734
50809
  }
50810
+ function getNpmGlobalInstall() {
50811
+ if (!npmGlobalLayout) return null;
50812
+ return {
50813
+ installFolder: npmGlobalLayout.installFolder,
50814
+ isWritable: isInstallWritable
50815
+ };
50816
+ }
50817
+ async function refreshInstallWritability() {
50818
+ if (!npmGlobalLayout) return;
50819
+ try {
50820
+ await fsPromises.access(npmGlobalLayout.installFolder, fs.constants.W_OK);
50821
+ isInstallWritable = true;
50822
+ } catch {
50823
+ isInstallWritable = false;
50824
+ }
50825
+ }
50735
50826
  async function publish(nextJournal, failOnWrite = true) {
50736
50827
  journal = nextJournal;
50737
50828
  persistenceFailure = null;
@@ -50836,6 +50927,7 @@ function createUpdateApplyLane(dependencies) {
50836
50927
  if (!status) return refusal("missing-update-status", "Check for updates before applying one.");
50837
50928
  if (journal.state === "staged" || stagedDescriptor?.state === "staged") return refusal("already-staged", "Restart to apply the staged update.");
50838
50929
  if (restartRequested) return refusal("restart-requested", "Wait for the requested restart to finish.");
50930
+ if (status.flavor === "npm-global") return stageNpmGlobalUpdate(status, channel);
50839
50931
  const tree = await dependencies.gitWorkspace.probeWorktreeDirty({
50840
50932
  projectPath: dependencies.packageRoot,
50841
50933
  cwd: dependencies.packageRoot
@@ -50939,6 +51031,7 @@ function createUpdateApplyLane(dependencies) {
50939
51031
  await publish(markStaged(journal, { now: clock() }));
50940
51032
  stagedDescriptor = {
50941
51033
  state: "staged",
51034
+ kind: "clone",
50942
51035
  fromSha: tree.headSha,
50943
51036
  targetSha: status.latestSha,
50944
51037
  lockfileChanged,
@@ -50963,6 +51056,112 @@ function createUpdateApplyLane(dependencies) {
50963
51056
  activeRun = run;
50964
51057
  return run;
50965
51058
  }
51059
+ async function stageNpmGlobalUpdate(status, channel) {
51060
+ await refreshInstallWritability();
51061
+ const decision = decidePreflight({
51062
+ flavor: status.flavor,
51063
+ platform: dependencies.platform || process.platform,
51064
+ statusChannel: status.channel,
51065
+ configuredChannel: channel,
51066
+ updateAvailable: status.updateAvailable,
51067
+ isTreeClean: false,
51068
+ branch: null,
51069
+ upstream: null,
51070
+ statusBranch: null,
51071
+ statusUpstream: null,
51072
+ headSha: null,
51073
+ targetSha: null,
51074
+ journalState: journal.state,
51075
+ restartRequested,
51076
+ npmGlobalInstall: getNpmGlobalInstall()
51077
+ });
51078
+ if (!decision.ok) return refusal(decision.reason, decision.message);
51079
+ if (!npmGlobalLayout || !status.latest) return refusal("missing-target-version", "The target version is unknown. Check for updates again.");
51080
+ const layout = npmGlobalLayout;
51081
+ const targetVersion = status.latest;
51082
+ try {
51083
+ await publish(beginRun(journal, {
51084
+ stepIds: ["install"],
51085
+ fromSha: status.currentSha,
51086
+ toSha: status.latestSha,
51087
+ toVersion: targetVersion,
51088
+ channel,
51089
+ now: clock()
51090
+ }));
51091
+ await fsPromises.rm(layout.stagePrefix, {
51092
+ recursive: true,
51093
+ force: true
51094
+ });
51095
+ await fsPromises.mkdir(layout.stagePrefix, { recursive: true });
51096
+ await publish(beginStep(journal, {
51097
+ stepId: "install",
51098
+ now: clock()
51099
+ }));
51100
+ await runNpmGlobalInstall(layout, targetVersion);
51101
+ await verifyStagedPackage(layout, targetVersion);
51102
+ await publish(finishStep(journal, {
51103
+ stepId: "install",
51104
+ now: clock()
51105
+ }));
51106
+ await publish(markStaged(journal, { now: clock() }));
51107
+ stagedDescriptor = {
51108
+ state: "staged",
51109
+ kind: "npm-global",
51110
+ layout
51111
+ };
51112
+ dependencies.logger.log(`[update] staged glimmervoid@${targetVersion} in ${layout.stagedPackagePath}`);
51113
+ return {
51114
+ ok: true,
51115
+ reason: null,
51116
+ message: "Update staged. Restart to apply it."
51117
+ };
51118
+ } catch (error) {
51119
+ return failAndCleanNpmGlobal(layout, errorText(error));
51120
+ }
51121
+ }
51122
+ async function runInstallCommand(file, args, cwd, timeout) {
51123
+ const outcome = await command(file, args, cwd, timeout);
51124
+ journal = appendStepOutput(journal, "install", outcome.output);
51125
+ if (!outcome.ok) throw new Error(outcome.reason || `${path.basename(file)} failed`);
51126
+ return outcome.output;
51127
+ }
51128
+ async function runNpmGlobalInstall(layout, targetVersion) {
51129
+ const platform = dependencies.platform || process.platform;
51130
+ const installArgs = [
51131
+ "install",
51132
+ "--global",
51133
+ "--prefix",
51134
+ layout.stagePrefix,
51135
+ "--no-audit",
51136
+ "--no-fund",
51137
+ `glimmervoid@${targetVersion}`
51138
+ ];
51139
+ if (platform === "linux") installArgs.push(NODE_PTY_INSTALL_SCRIPT_FLAG);
51140
+ const throttled = lowPriorityCommand({
51141
+ file: npmPath,
51142
+ args: installArgs,
51143
+ platform
51144
+ });
51145
+ await runInstallCommand(throttled.file, throttled.args, layout.updatePath, INSTALL_TIMEOUT_MS);
51146
+ }
51147
+ async function verifyStagedPackage(layout, targetVersion) {
51148
+ const stagedBin = path.join(layout.stagedPackagePath, "dist", "bin", "glimmervoid.js");
51149
+ const printedVersion = (await runInstallCommand(nodePath, [stagedBin, "--version"], layout.updatePath, VERIFY_TIMEOUT_MS)).trim();
51150
+ if (printedVersion !== targetVersion) throw new Error(`staged-version-mismatch: expected ${targetVersion}, the staged build printed ${printedVersion || "nothing"}`);
51151
+ await runInstallCommand(nodePath, [stagedBin, "doctor"], layout.updatePath, VERIFY_TIMEOUT_MS);
51152
+ }
51153
+ async function failAndCleanNpmGlobal(layout, reason) {
51154
+ stagedDescriptor = null;
51155
+ await fsPromises.rm(layout.stagePrefix, {
51156
+ recursive: true,
51157
+ force: true
51158
+ });
51159
+ await publish(failRun(journal, {
51160
+ reason,
51161
+ now: clock()
51162
+ }), false);
51163
+ return refusal(reason, reason);
51164
+ }
50966
51165
  async function writeRestoreMarker(failedReversals) {
50967
51166
  const restore = failedReversals.map((operation) => ({
50968
51167
  from: operation.artifact === "node_modules" ? PREVIOUS_DEPENDENCIES_BACKUP_NAME : PREVIOUS_DIST_BACKUP_NAME,
@@ -51015,6 +51214,121 @@ function createUpdateApplyLane(dependencies) {
51015
51214
  atHandOff: true
51016
51215
  }), false);
51017
51216
  }
51217
+ async function performNpmGlobalHandOff(descriptor) {
51218
+ const plan = planNpmGlobalHandOffRenames(descriptor.layout);
51219
+ try {
51220
+ await fsPromises.rm(descriptor.layout.previousPackagePath, {
51221
+ recursive: true,
51222
+ force: true
51223
+ });
51224
+ for (let renameIndex = 0; renameIndex < plan.renames.length; renameIndex += 1) {
51225
+ const rename = plan.renames[renameIndex];
51226
+ try {
51227
+ await fsPromises.rename(rename.from, rename.to);
51228
+ } catch (error) {
51229
+ const failedReversals = await reverseRenames(plan.reversalsByFailureIndex[renameIndex] || []);
51230
+ const reversalNote = failedReversals.length === 0 ? "" : `; could not move ${failedReversals.map((reversal) => reversal.from).join(", ")} back`;
51231
+ await publish(failRun(journal, {
51232
+ reason: `handoff-rename-failed: ${errorText(error)}${reversalNote}`,
51233
+ now: clock(),
51234
+ atHandOff: true
51235
+ }), false);
51236
+ return;
51237
+ }
51238
+ }
51239
+ hasSwappedNpmGlobalPackage = true;
51240
+ await publish(markSucceeded(journal, { now: clock() }), false);
51241
+ stagedDescriptor = null;
51242
+ } catch (error) {
51243
+ await publish(failRun(journal, {
51244
+ reason: errorText(error),
51245
+ now: clock(),
51246
+ atHandOff: true
51247
+ }), false);
51248
+ }
51249
+ }
51250
+ async function isPathPresent(candidatePath) {
51251
+ try {
51252
+ await fsPromises.access(candidatePath);
51253
+ return true;
51254
+ } catch {
51255
+ return false;
51256
+ }
51257
+ }
51258
+ function awaitSuccessorFate(successor, previousPackagePath) {
51259
+ return new Promise((resolve) => {
51260
+ const deadline = clock() + SUCCESSOR_LISTEN_TIMEOUT_MS;
51261
+ let pollTimer = null;
51262
+ let isSettled = false;
51263
+ const settle = (fate) => {
51264
+ if (isSettled) return;
51265
+ isSettled = true;
51266
+ if (pollTimer) clearTimeout(pollTimer);
51267
+ resolve(fate);
51268
+ };
51269
+ successor.once("exit", () => settle("exited"));
51270
+ const poll = async () => {
51271
+ if (isSettled) return;
51272
+ if (!await isPathPresent(previousPackagePath)) {
51273
+ settle("listening");
51274
+ return;
51275
+ }
51276
+ if (clock() >= deadline) {
51277
+ settle("still-starting");
51278
+ return;
51279
+ }
51280
+ pollTimer = setTimeout(() => {
51281
+ poll();
51282
+ }, SUCCESSOR_POLL_INTERVAL_MS);
51283
+ };
51284
+ poll();
51285
+ });
51286
+ }
51287
+ async function restorePreviousPackage(layout) {
51288
+ try {
51289
+ await fsPromises.rm(layout.quarantinedPackagePath, {
51290
+ recursive: true,
51291
+ force: true
51292
+ });
51293
+ await fsPromises.rename(layout.livePackagePath, layout.quarantinedPackagePath);
51294
+ } catch (error) {
51295
+ return errorText(error);
51296
+ }
51297
+ try {
51298
+ await fsPromises.rename(layout.previousPackagePath, layout.livePackagePath);
51299
+ return null;
51300
+ } catch (restoreError) {
51301
+ try {
51302
+ await fsPromises.rename(layout.quarantinedPackagePath, layout.livePackagePath);
51303
+ return errorText(restoreError);
51304
+ } catch (unquarantineError) {
51305
+ return `${errorText(restoreError)}; moving the new version back also failed: ${errorText(unquarantineError)}`;
51306
+ }
51307
+ }
51308
+ }
51309
+ async function superviseSuccessor(successor) {
51310
+ if (!npmGlobalLayout || !hasSwappedNpmGlobalPackage) return false;
51311
+ if (await awaitSuccessorFate(successor, npmGlobalLayout.previousPackagePath) !== "exited") return false;
51312
+ if (!await isPathPresent(npmGlobalLayout.previousPackagePath)) return false;
51313
+ const failedVersion = journal.toVersion || "the new version";
51314
+ const rollbackFailure = await restorePreviousPackage(npmGlobalLayout);
51315
+ if (rollbackFailure) {
51316
+ await publish(failRun(journal, {
51317
+ reason: `${failedVersion} exited before listening and the rollback failed: ${rollbackFailure}`,
51318
+ now: clock(),
51319
+ atHandOff: true
51320
+ }), false);
51321
+ return false;
51322
+ }
51323
+ hasSwappedNpmGlobalPackage = false;
51324
+ dependencies.logger.warn(`[update] ${failedVersion} exited before listening; restored the previous version`);
51325
+ await publish(failRun(journal, {
51326
+ reason: `${failedVersion} exited before listening, so the previous version was restored`,
51327
+ now: clock(),
51328
+ atHandOff: true
51329
+ }), false);
51330
+ return true;
51331
+ }
51018
51332
  async function performHandOff(descriptor) {
51019
51333
  let mergeMovedHead = false;
51020
51334
  let sampledHead = null;
@@ -51080,7 +51394,11 @@ function createUpdateApplyLane(dependencies) {
51080
51394
  async function handOffStagedUpdate() {
51081
51395
  await bootRun;
51082
51396
  const descriptor = stagedDescriptor;
51083
- if (!descriptor || descriptor.state !== "staged" || inFlight) {
51397
+ if (npmGlobalLayout) {
51398
+ await handOffNpmGlobalUpdate(npmGlobalLayout, descriptor);
51399
+ return;
51400
+ }
51401
+ if (descriptor?.kind !== "clone" || inFlight) {
51084
51402
  await dependencies.gitWorkspace.removeWorktreeByPath({
51085
51403
  projectPath: dependencies.packageRoot,
51086
51404
  cause: "update-apply",
@@ -51096,6 +51414,21 @@ function createUpdateApplyLane(dependencies) {
51096
51414
  activeRun = run;
51097
51415
  await run;
51098
51416
  }
51417
+ async function handOffNpmGlobalUpdate(layout, descriptor) {
51418
+ if (descriptor?.kind !== "npm-global" || inFlight) {
51419
+ await fsPromises.rm(layout.stagePrefix, {
51420
+ recursive: true,
51421
+ force: true
51422
+ });
51423
+ return;
51424
+ }
51425
+ inFlight = true;
51426
+ const run = performNpmGlobalHandOff(descriptor).finally(() => {
51427
+ inFlight = false;
51428
+ });
51429
+ activeRun = run;
51430
+ await run;
51431
+ }
51099
51432
  function isRestartRequested() {
51100
51433
  return restartRequested;
51101
51434
  }
@@ -51155,6 +51488,21 @@ function createUpdateApplyLane(dependencies) {
51155
51488
  reason: "interrupted",
51156
51489
  now: clock()
51157
51490
  }), false);
51491
+ if (npmGlobalLayout) {
51492
+ await fsPromises.rm(npmGlobalLayout.stagePrefix, {
51493
+ recursive: true,
51494
+ force: true
51495
+ });
51496
+ await fsPromises.rm(npmGlobalLayout.previousPackagePath, {
51497
+ recursive: true,
51498
+ force: true
51499
+ });
51500
+ await fsPromises.rm(npmGlobalLayout.quarantinedPackagePath, {
51501
+ recursive: true,
51502
+ force: true
51503
+ });
51504
+ return;
51505
+ }
51158
51506
  if (wasRunInFlight || await isStagingCheckoutPresent()) await dependencies.gitWorkspace.removeWorktreeByPath({
51159
51507
  projectPath: dependencies.packageRoot,
51160
51508
  cause: "update-apply",
@@ -51207,10 +51555,13 @@ function createUpdateApplyLane(dependencies) {
51207
51555
  }
51208
51556
  return whenIdle();
51209
51557
  }
51558
+ refreshInstallWritability();
51210
51559
  return {
51211
51560
  applyUpdate,
51212
51561
  getJournal,
51562
+ getNpmGlobalInstall,
51213
51563
  handOffStagedUpdate,
51564
+ superviseSuccessor,
51214
51565
  isRestartRequested,
51215
51566
  noteRestartRequested,
51216
51567
  startAfterListening,
@@ -52561,6 +52912,7 @@ function createBackend(httpServer, options = {}) {
52561
52912
  checkForUpdate: options.checkForUpdate || void 0,
52562
52913
  getUpdateJournal: () => updateApply.getJournal(),
52563
52914
  isRestartRequested: () => updateApply.isRestartRequested(),
52915
+ getNpmGlobalInstall: () => updateApply.getNpmGlobalInstall(),
52564
52916
  getControlClientCount: () => controlWss.clients.size,
52565
52917
  broadcastControl,
52566
52918
  logger: console,
@@ -52658,7 +53010,8 @@ function createBackend(httpServer, options = {}) {
52658
53010
  extraServers: [agentIngressServer],
52659
53011
  onRestart: options.onRestart || null,
52660
53012
  spawn,
52661
- beforeHandOff: updateApply.handOffStagedUpdate
53013
+ beforeHandOff: updateApply.handOffStagedUpdate,
53014
+ superviseSuccessor: updateApply.superviseSuccessor
52662
53015
  });
52663
53016
  ({removeExitedSession} = createBackendControl({
52664
53017
  controlWss,