@amd-gaia/agent-ui 0.26.0-rc.2 → 0.26.0-rc.20

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 (52) hide show
  1. package/README.md +2 -2
  2. package/app.config.json +1 -1
  3. package/assets/tray-iconTemplate.png +0 -0
  4. package/assets/tray-iconTemplate@2x.png +0 -0
  5. package/bin/gaia-ui.cjs +19 -16
  6. package/dist/assets/AdvancedSettings-CkNjaXeq.js +1 -0
  7. package/dist/assets/ConnectorsPane-hmunRyL2.css +1 -0
  8. package/dist/assets/ConnectorsPane-j0I-yE2y.js +1 -0
  9. package/dist/assets/DocumentLibrary-AavruIEt.js +4 -0
  10. package/dist/assets/{DocumentLibrary-CM6o8j2T.css → DocumentLibrary-DM09xPsW.css} +1 -1
  11. package/dist/assets/FileBrowser-BAWmtQqm.js +4 -0
  12. package/dist/assets/MemoryDashboard-BYQDFko-.css +1 -0
  13. package/dist/assets/MemoryDashboard-DXHAcjo5.js +1 -0
  14. package/dist/assets/MobileAccessModal-g7HdSxZe.js +2 -0
  15. package/dist/assets/ScheduleManager-D9rKlnaQ.js +1 -0
  16. package/dist/assets/{browser-KnDALPx_.js → browser-DfYHeeW3.js} +1 -1
  17. package/dist/assets/index-DvwJqseR.css +1 -0
  18. package/dist/assets/index-ZvSEroLw.js +90 -0
  19. package/dist/assets/useT-C_wp97pe.js +6 -0
  20. package/dist/assets/zap-DKK5PCxy.js +1 -0
  21. package/dist/index.html +3 -4
  22. package/dist/sw.js +1 -1
  23. package/main-safety-net.cjs +30 -3
  24. package/main.cjs +77 -220
  25. package/package.json +3 -3
  26. package/preload.cjs +0 -30
  27. package/services/agent-process-manager.cjs +3 -411
  28. package/services/appimage-launcher.cjs +183 -0
  29. package/services/auto-updater.cjs +10 -0
  30. package/services/backend-installer.cjs +230 -512
  31. package/services/renderer-gone-dialog.cjs +57 -0
  32. package/services/tray-manager.cjs +7 -14
  33. package/services/window-reveal.cjs +42 -0
  34. package/assets/tray-icon-active.png +0 -0
  35. package/assets/tray-icon-active@2x.png +0 -0
  36. package/dist/assets/AdvancedSettings-DhQOkz13.js +0 -1
  37. package/dist/assets/ConnectorsPane-CzLYXGMl.css +0 -1
  38. package/dist/assets/ConnectorsPane-DZSS3unX.js +0 -1
  39. package/dist/assets/DocumentLibrary-Bxi2x5Ry.js +0 -4
  40. package/dist/assets/FileBrowser-lOETG5oo.js +0 -4
  41. package/dist/assets/MemoryDashboard-DwrWAXi6.css +0 -1
  42. package/dist/assets/MemoryDashboard-Evh8x9AG.js +0 -1
  43. package/dist/assets/MobileAccessModal-jZP8OcFv.js +0 -2
  44. package/dist/assets/ScheduleManager-CoagpVqW.js +0 -1
  45. package/dist/assets/api-9RdlUJAP.js +0 -4
  46. package/dist/assets/index-D8wu2yy4.js +0 -83
  47. package/dist/assets/index-LLooEbjq.css +0 -1
  48. package/dist/assets/useT-C0ow1Kps.js +0 -3
  49. package/dist/assets/zap-D2mvP3-6.js +0 -1
  50. package/services/deep-link-queue.cjs +0 -77
  51. package/services/deep-link.cjs +0 -230
  52. package/services/system-metrics.cjs +0 -154
@@ -0,0 +1 @@
1
+ import{ni as e}from"./useT-C_wp97pe.js";var t={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};t.node;var n=e(t),r={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};r.node;var i=e(r);export{n,i as t};
package/dist/index.html CHANGED
@@ -12,11 +12,10 @@
12
12
  <meta name="apple-mobile-web-app-capable" content="yes" />
13
13
  <meta name="apple-mobile-web-app-title" content="GAIA" />
14
14
  <title>GAIA Agent UI</title>
15
- <script type="module" crossorigin src="./assets/index-D8wu2yy4.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-ZvSEroLw.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-XKyaHtl9.js">
17
- <link rel="modulepreload" crossorigin href="./assets/useT-C0ow1Kps.js">
18
- <link rel="modulepreload" crossorigin href="./assets/api-9RdlUJAP.js">
19
- <link rel="stylesheet" crossorigin href="./assets/index-LLooEbjq.css">
17
+ <link rel="modulepreload" crossorigin href="./assets/useT-C_wp97pe.js">
18
+ <link rel="stylesheet" crossorigin href="./assets/index-DvwJqseR.css">
20
19
  </head>
21
20
  <body>
22
21
  <div id="root"></div>
package/dist/sw.js CHANGED
@@ -9,7 +9,7 @@
9
9
  // never sees a stale UI or stale data.
10
10
 
11
11
  const CACHE_PREFIX = 'gaia-assets-';
12
- const CACHE_NAME = CACHE_PREFIX + '0.26.0rc2-c6932d3e03cf42c5';
12
+ const CACHE_NAME = CACHE_PREFIX + '0.26.0rc20-12330251e2f687e1';
13
13
  const ASSETS_PATH = new URL('assets/', self.registration.scope).pathname;
14
14
 
15
15
  self.addEventListener('install', () => {
@@ -103,6 +103,10 @@ const FATAL_EXIT_GRACE_MS = 25000;
103
103
  * @param {Function} [opts.beforeQuit] - Called before the fatal quit, e.g.
104
104
  * so the quit guard does not ask the user to confirm it.
105
105
  * @param {number} [opts.exitGraceMs] - Override for FATAL_EXIT_GRACE_MS.
106
+ * @param {Function} [opts.onRendererGone] - Called with (webContents, details)
107
+ * when a window's page dies while GAIA runs on, e.g. to offer a reload.
108
+ * Without it, or if it throws synchronously, the crash is fatal; an async
109
+ * handler must handle its own failures.
106
110
  */
107
111
  function installSafetyNet({
108
112
  logPath,
@@ -112,6 +116,7 @@ function installSafetyNet({
112
116
  beforeQuit,
113
117
  exitGraceMs = FATAL_EXIT_GRACE_MS,
114
118
  holdCrashCount = () => false,
119
+ onRendererGone,
115
120
  }) {
116
121
  const homedir = homedirFn || (() => os.homedir());
117
122
 
@@ -199,9 +204,31 @@ function installSafetyNet({
199
204
  });
200
205
 
201
206
  // Renderer and GPU-process crashes don't fire uncaughtException — route
202
- // them through fatal() so they get the same dialog + counter treatment.
203
- appModule.on("render-process-gone", (_event, _webContents, details) => {
204
- fatal(new Error(`render-process-gone: reason=${details && details.reason}`));
207
+ // them through fatal() so they get the same dialog + counter treatment,
208
+ // unless onRendererGone can bring the window back.
209
+ appModule.on("render-process-gone", (_event, webContents, details) => {
210
+ const reason = details && details.reason;
211
+ // The renderer exits cleanly when the app is signalled to stop (logout, a
212
+ // stopped app unit); that is a shutdown, not a crash.
213
+ if (reason === "clean-exit") {
214
+ appendLog(logPath, `[${new Date().toISOString()}] RENDER_PROCESS_EXITED reason=${reason}`);
215
+ return;
216
+ }
217
+ if (typeof onRendererGone === "function") {
218
+ // Only the page died: the backend and agents still run, so the window can come back.
219
+ appendLog(
220
+ logPath,
221
+ `[${new Date().toISOString()}] RENDER_PROCESS_GONE reason=${reason} exitCode=${details && details.exitCode}`
222
+ );
223
+ try {
224
+ onRendererGone(webContents, details);
225
+ writeCount(readCount(homedir) + 1, homedir);
226
+ return;
227
+ } catch (err) {
228
+ appendLog(logPath, `[${new Date().toISOString()}] RENDER_PROCESS_GONE handler failed: ${err.stack || err}`);
229
+ }
230
+ }
231
+ fatal(new Error(`render-process-gone: reason=${reason}`));
205
232
  });
206
233
 
207
234
  appModule.on("child-process-gone", (_event, details) => {
package/main.cjs CHANGED
@@ -68,6 +68,9 @@ try {
68
68
  },
69
69
  // The install screen takes focus before anything has proved it can run.
70
70
  holdCrashCount: () => showingInstallScreen,
71
+ onRendererGone: (contents, details) => {
72
+ void handleRendererGone(contents, details);
73
+ },
71
74
  }));
72
75
  } catch (err) {
73
76
  try { process.stderr.write(`[main] safety-net load failed: ${err.message}\n`); } catch { }
@@ -86,6 +89,8 @@ const _inSafeMode = _crashCount >= SAFE_MODE_THRESHOLD;
86
89
  // Services (loaded after app.whenReady)
87
90
  const TrayManager = require("./services/tray-manager.cjs");
88
91
  const { probeTrayHost } = require("./services/tray-host.cjs");
92
+ const { installAppImageLauncher } = require("./services/appimage-launcher.cjs");
93
+ const { revealWhenReady } = require("./services/window-reveal.cjs");
89
94
  const { appIconPath, appUserModelId } = require("./services/app-icon.cjs");
90
95
  const {
91
96
  attachWindowGuards,
@@ -102,26 +107,19 @@ const KeepAwake = require("./services/keep-awake.cjs");
102
107
  const PortManager = require("./services/port-manager.cjs");
103
108
  const { isGaiaBackendProcess } = require("./services/backend-orphan.cjs");
104
109
  const { showBackendCrashDialog } = require("./services/backend-crash-dialog.cjs");
110
+ const { showRendererGoneDialog } = require("./services/renderer-gone-dialog.cjs");
105
111
  const { createBackendSupervisor } = require("./services/backend-supervisor.cjs");
106
112
  const { buildIndexQuery, INSTALL_SCREEN_QUERY } = require("./services/index-query.cjs");
107
113
  const backendInstaller = require("./services/backend-installer.cjs");
108
114
  const { createEngineInstall } = require("./services/engine-install.cjs");
109
115
  const autoUpdater = require("./services/auto-updater.cjs");
110
116
  const agentSeeder = require("./services/agent-seeder.cjs");
111
- const systemMetrics = require("./services/system-metrics.cjs");
112
117
  const folderDialog = require("./services/folder-dialog.cjs");
113
- const {
114
- parseDeepLink,
115
- extractDeepLinkFromArgv,
116
- dispatchDeepLink,
117
- buildInstallPrompt,
118
- } = require("./services/deep-link.cjs");
119
118
  const {
120
119
  isAllowedExternalUrl,
121
120
  isInAppNavigation,
122
121
  describeBlockedUrl,
123
122
  } = require("./services/link-policy.cjs");
124
- const { createStartupDeepLinkQueue } = require("./services/deep-link-queue.cjs");
125
123
  const { installWindowKeys } = require("./services/window-keys.cjs");
126
124
  const { installQuitCleanup } = require("./services/quit-cleanup.cjs");
127
125
  const { chromiumSwitches } = require("./services/chromium-switches.cjs");
@@ -403,6 +401,9 @@ async function startBackend() {
403
401
  PYTHONUNBUFFERED: "1",
404
402
  ...(app.isPackaged && {
405
403
  GAIA_BUNDLED_LEMONADE_DIR: path.join(process.resourcesPath, "vendor", "lemonade"),
404
+ // The daemon exits once this is deleted: a Trashed macOS app or a
405
+ // deleted AppImage runs no uninstall step. An AppImage's exe is a mount.
406
+ GAIA_APP_PATH: process.env.APPIMAGE || app.getPath("exe"),
406
407
  }),
407
408
  },
408
409
  detached: false,
@@ -569,6 +570,34 @@ async function handleBackendCrash(code, signal) {
569
570
  }
570
571
  }
571
572
 
573
+ /**
574
+ * The window's page died (a crash, or the PC ran out of memory) while the
575
+ * backend and agents run on: offer to reload the window, or to quit.
576
+ */
577
+ async function handleRendererGone(contents, { reason }) {
578
+ if (!mainWindow || mainWindow.isDestroyed() || contents !== mainWindow.webContents) {
579
+ _fatalHandler(new Error(`render-process-gone: reason=${reason} (not GAIA's window)`));
580
+ return;
581
+ }
582
+ try {
583
+ const choice = await showRendererGoneDialog({ dialog, parent: mainWindow, reason });
584
+ console.log(`[main] Window stopped working (${reason}): user chose ${choice}`);
585
+ if (choice === "reload") {
586
+ // Built afresh, so a backend restarted on a new port is the one it reaches.
587
+ try {
588
+ await loadApp();
589
+ } catch (err) {
590
+ // A page that dies again while loading fires render-process-gone, which asks again.
591
+ console.error(`[main] Reload after window crash failed: ${err.stack || err}`);
592
+ }
593
+ } else {
594
+ app.quit();
595
+ }
596
+ } catch (err) {
597
+ _fatalHandler(err);
598
+ }
599
+ }
600
+
572
601
  async function waitForBackend(timeoutMs, isAlive = () => true) {
573
602
  const start = Date.now();
574
603
  const http = require("http");
@@ -747,8 +776,8 @@ function createWindow() {
747
776
  });
748
777
 
749
778
  // Show window when ready (unless --minimized or startMinimized config)
750
- mainWindow.once("ready-to-show", () => {
751
- console.log("[main] ready-to-show fired");
779
+ revealWhenReady(mainWindow, (via) => {
780
+ console.log(`[main] Window ready to show (${via})`);
752
781
  Promise.resolve(trayHostReady).then(() => {
753
782
  if (!mainWindow || mainWindow.isDestroyed()) return;
754
783
  // Never start hidden where no tray icon would bring the window back.
@@ -842,8 +871,8 @@ async function loadApp() {
842
871
  function reopenWindow() {
843
872
  createWindow();
844
873
  // Asked for from the tray or the dock: show it even when starting minimized.
845
- mainWindow.once("ready-to-show", () => mainWindow && mainWindow.show());
846
- if (agentProcessManager) agentProcessManager.mainWindow = mainWindow;
874
+ const reopened = mainWindow;
875
+ revealWhenReady(reopened, () => !reopened.isDestroyed() && reopened.show());
847
876
  if (trayManager) trayManager.mainWindow = mainWindow;
848
877
  if (notificationService) notificationService.mainWindow = mainWindow;
849
878
  loadApp().catch((err) => {
@@ -857,12 +886,7 @@ function initializeServices() {
857
886
  console.log("[main] Initializing services...");
858
887
 
859
888
  // T2: Agent Process Manager (manages OS agent subprocesses)
860
- // getBackendPort lets its install/uninstall handlers proxy to the live
861
- // Python backend's install runtime (issue #1721) on whatever random port
862
- // port-manager picked this session.
863
- agentProcessManager = new AgentProcessManager(mainWindow, {
864
- getBackendPort: () => backendPort,
865
- });
889
+ agentProcessManager = new AgentProcessManager();
866
890
 
867
891
  // T1: Tray Manager (system tray icon + context menu)
868
892
  trayManager = new TrayManager(mainWindow, {
@@ -894,9 +918,6 @@ function initializeServices() {
894
918
  // #5226: hold off idle sleep while a chat turn runs
895
919
  keepAwake = new KeepAwake();
896
920
 
897
- // #2007: System metrics for the observability dashboard
898
- systemMetrics.registerIpcHandlers();
899
-
900
921
  folderDialog.registerIpcHandlers();
901
922
 
902
923
  console.log("[main] Services initialized");
@@ -967,194 +988,6 @@ async function goBackToPreviousVersion() {
967
988
  await autoUpdater.revertUpdate();
968
989
  }
969
990
 
970
- // ── gaia:// deep-link install bridge (issue #1725) ──────────────────────────
971
- //
972
- // The website's "Open in GAIA" button opens a `gaia://hub/install/<id>` URL.
973
- // The OS routes it to this app (registered as the gaia:// protocol client);
974
- // we parse it and hand the agent id to the install runtime (issue #1721).
975
- //
976
- // Sources of the URL differ per OS:
977
- // • macOS — the `open-url` app event (registered before whenReady).
978
- // • Win/Linux — a command-line argument, either at cold start (process.argv)
979
- // or on a second launch (the `second-instance` event argv).
980
- // A malformed/unsupported link surfaces a loud error dialog — never a silent
981
- // no-op (deep-link.cjs throws with an actionable message).
982
-
983
- // Holds gaia:// links until startup has waited for the backend (the install
984
- // gate verifies the agent through its catalog API), then dispatches each once.
985
- const startupDeepLinks = createStartupDeepLinkQueue({
986
- dispatch: (rawUrl) => {
987
- void runDeepLink(parseDeepLink(rawUrl));
988
- },
989
- reportNotReady: reportDeepLinksNotReady,
990
- logger: console,
991
- });
992
-
993
- /**
994
- * Register this app as the handler for the gaia:// scheme. In dev (`electron .`)
995
- * the launcher is Electron itself, so the app path must be threaded through
996
- * explicitly; packaged builds register their own executable.
997
- */
998
- function registerProtocolHandler() {
999
- try {
1000
- let registered;
1001
- if (process.defaultApp && process.argv.length >= 2) {
1002
- // Dev: `electron . <args>` — point the scheme at this script.
1003
- registered = app.setAsDefaultProtocolClient("gaia", process.execPath, [
1004
- path.resolve(process.argv[1]),
1005
- ]);
1006
- } else {
1007
- registered = app.setAsDefaultProtocolClient("gaia");
1008
- }
1009
- if (registered) {
1010
- console.log("[main] Registered as gaia:// protocol client");
1011
- } else {
1012
- console.warn(
1013
- "[main] Could not register gaia:// protocol client — deep-link installs may not route to this app"
1014
- );
1015
- }
1016
- } catch (err) {
1017
- console.warn(
1018
- `[main] setAsDefaultProtocolClient failed: ${err && err.message ? err.message : err}`
1019
- );
1020
- }
1021
- }
1022
-
1023
- /**
1024
- * Entry point for any inbound deep link. Validates it now (a bad link is
1025
- * refused loudly and immediately), then hands it to the startup queue, which
1026
- * holds it until the backend is ready and dispatches it immediately after.
1027
- */
1028
- function handleDeepLink(rawUrl) {
1029
- try {
1030
- parseDeepLink(rawUrl);
1031
- } catch (err) {
1032
- const message = err && err.message ? err.message : String(err);
1033
- console.error(`[main] Rejected deep link: ${message}`);
1034
- try {
1035
- dialog.showErrorBox("Invalid GAIA link", message);
1036
- } catch {
1037
- /* dialog may be unavailable pre-ready — the log line above still fires */
1038
- }
1039
- return;
1040
- }
1041
-
1042
- startupDeepLinks.accept(rawUrl);
1043
- }
1044
-
1045
- /**
1046
- * Explicit, INFORMED per-agent confirmation for a web-triggered install. This
1047
- * is the security gate: the user must confirm the SPECIFIC agent — and see
1048
- * its real trust tier and permissions, not just its bare id — before any
1049
- * download happens (issue #2196 review; hardened so the shown facts match
1050
- * the backend's non-verified gate, which now covers every non-verified
1051
- * agent, not just native ones). Defaults to the safe (Cancel) option.
1052
- *
1053
- * Fails closed: if the agent can't be found in the catalog, or the backend
1054
- * is unreachable, the install is refused with an explanatory error — never
1055
- * installed blind.
1056
- * @returns {Promise<boolean>}
1057
- */
1058
- async function confirmDeepLinkInstall(command) {
1059
- let entry;
1060
- try {
1061
- entry = await agentProcessManager.fetchCatalogEntry(command.agentId);
1062
- } catch (err) {
1063
- const message = err && err.message ? err.message : String(err);
1064
- console.error(
1065
- `[main] Refusing deep-link install of "${command.agentId}": ${message}`
1066
- );
1067
- try {
1068
- dialog.showErrorBox("Could not verify this agent", message);
1069
- } catch {
1070
- /* best-effort */
1071
- }
1072
- return false;
1073
- }
1074
-
1075
- const prompt = buildInstallPrompt(entry);
1076
- const choice = await dialog.showMessageBox(
1077
- mainWindow && !mainWindow.isDestroyed() ? mainWindow : null,
1078
- {
1079
- type: "question",
1080
- buttons: [prompt.requiresTrust ? "Trust & Install" : "Install", "Cancel"],
1081
- defaultId: 1, // Enter selects the safe option
1082
- cancelId: 1,
1083
- title: prompt.title,
1084
- message: prompt.message,
1085
- detail: prompt.detail,
1086
- noLink: true,
1087
- }
1088
- );
1089
- return !!choice && choice.response === 0;
1090
- }
1091
-
1092
- /** Wire the injected deep-link dispatcher to this process's runtime effects. */
1093
- async function runDeepLink(command) {
1094
- console.log(`[main] Deep-link install request: ${command.agentId}`);
1095
- try {
1096
- await dispatchDeepLink(command, {
1097
- confirm: confirmDeepLinkInstall,
1098
- installAgent: (agentId, opts) => agentProcessManager.installAgent(agentId, opts),
1099
- focusWindow: () => {
1100
- if (mainWindow && !mainWindow.isDestroyed()) {
1101
- if (mainWindow.isMinimized()) mainWindow.restore();
1102
- if (!mainWindow.isVisible()) mainWindow.show();
1103
- mainWindow.focus();
1104
- }
1105
- },
1106
- logger: { log: console.log.bind(console), error: console.error.bind(console) },
1107
- });
1108
- } catch (err) {
1109
- const message = err && err.message ? err.message : String(err);
1110
- console.error(
1111
- `[main] Deep-link install of "${command.agentId}" failed: ${message}`
1112
- );
1113
- try {
1114
- dialog.showErrorBox(`Could not install "${command.agentId}"`, message);
1115
- } catch {
1116
- /* best-effort */
1117
- }
1118
- }
1119
- }
1120
-
1121
- /**
1122
- * Release queued deep links, plus any gaia:// URL in the cold-start argv. Call
1123
- * once, after startup has waited for the backend.
1124
- *
1125
- * @param {boolean} backendReady Whether the backend API answered its health check.
1126
- */
1127
- function processStartupDeepLinks(backendReady) {
1128
- startupDeepLinks.drain({ backendReady, argvUrl: extractDeepLinkFromArgv(process.argv) });
1129
- }
1130
-
1131
- /** The backend never came up: tell the user instead of dispatching blind. */
1132
- function reportDeepLinksNotReady(urls) {
1133
- const why = backendProcess
1134
- ? `did not answer within ${Math.round(STARTUP_TIMEOUT / 1000)}s`
1135
- : "could not be started";
1136
- const message =
1137
- `GAIA could not open ${urls.map((u) => `"${u}"`).join(", ")} because ` +
1138
- `its backend ${why}, so the agent cannot be verified before install. ` +
1139
- `Check ${_MAIN_LOG_PATH} for the startup error, then click the link ` +
1140
- "again once GAIA is running.";
1141
- console.error(`[main] ${message}`);
1142
- try {
1143
- dialog.showErrorBox("GAIA is not ready yet", message);
1144
- } catch {
1145
- /* best-effort */
1146
- }
1147
- }
1148
-
1149
- // macOS delivers deep links via this event; it can fire before whenReady, so
1150
- // register it at module load and let handleDeepLink queue as needed.
1151
- app.on("open-url", (event, url) => {
1152
- event.preventDefault();
1153
- handleDeepLink(url);
1154
- });
1155
-
1156
- registerProtocolHandler();
1157
-
1158
991
  // ── App Lifecycle ──────────────────────────────────────────────────────────
1159
992
 
1160
993
  // Note: electron-squirrel-startup was removed in Phase C of the
@@ -1197,7 +1030,13 @@ if (process.platform === "win32") {
1197
1030
  app.setAppUserModelId(appUserModelId(app.isPackaged));
1198
1031
  }
1199
1032
 
1200
- app.on("second-instance", (_event, argv, _cwd) => {
1033
+ // Older builds registered gaia:// at runtime; nothing handles it any more.
1034
+ if (app.isPackaged && app.isDefaultProtocolClient("gaia")) {
1035
+ const removed = app.removeAsDefaultProtocolClient("gaia");
1036
+ console.log(`[main] Removed stale gaia:// registration: ${removed}`);
1037
+ }
1038
+
1039
+ app.on("second-instance", () => {
1201
1040
  // A second launch happened while we were running. Surface our window
1202
1041
  // (the user almost certainly wanted to see it).
1203
1042
  if (typeof mainWindow !== "undefined" && mainWindow && !mainWindow.isDestroyed()) {
@@ -1205,11 +1044,6 @@ app.on("second-instance", (_event, argv, _cwd) => {
1205
1044
  if (!mainWindow.isVisible()) mainWindow.show();
1206
1045
  mainWindow.focus();
1207
1046
  }
1208
-
1209
- // Win/Linux: a `gaia://…` deep link from the second launch arrives as an argv
1210
- // entry. Route it into the already-running first instance (issue #1725).
1211
- const deepLink = extractDeepLinkFromArgv(argv);
1212
- if (deepLink) handleDeepLink(deepLink);
1213
1047
  });
1214
1048
 
1215
1049
  app.whenReady().then(async () => {
@@ -1226,6 +1060,17 @@ app.whenReady().then(async () => {
1226
1060
  // The window, and the tray that keeps a closed one reachable, come before
1227
1061
  // anything that can take time, so an install runs in plain sight.
1228
1062
  titleDownloadSaveDialogs();
1063
+ // Before the window: the desktop ties a window to its launcher when it appears.
1064
+ if (app.isPackaged) {
1065
+ try {
1066
+ const launcher = installAppImageLauncher();
1067
+ if (launcher.status !== "not-appimage") {
1068
+ console.log(`[main] AppImage launcher ${launcher.status}: ${launcher.entry}`);
1069
+ }
1070
+ } catch (err) {
1071
+ console.error(`[main] ${err.message}`);
1072
+ }
1073
+ }
1229
1074
  createWindow();
1230
1075
  initializeServices();
1231
1076
  engineInstall = createEngineInstall({
@@ -1350,11 +1195,6 @@ app.whenReady().then(async () => {
1350
1195
  if (mainWindow) await loadApp();
1351
1196
  }
1352
1197
 
1353
- // Act on any gaia:// deep link that arrived during bootstrap or via the
1354
- // cold-start command line (issue #1725) — after the backend is listening,
1355
- // because the install gate queries its catalog API.
1356
- processStartupDeepLinks(backendReady);
1357
-
1358
1198
  // Auto-start enabled agents (T2)
1359
1199
  if (agentProcessManager) {
1360
1200
  try {
@@ -1457,6 +1297,7 @@ async function cleanup() {
1457
1297
  shutdownStarted = true;
1458
1298
  backendSupervisor.stop();
1459
1299
  const installStopped = engineInstall ? engineInstall.stop() : null;
1300
+ const updating = app.isPackaged && autoUpdater.installsOnQuit();
1460
1301
 
1461
1302
  // Phase F: tear down auto-updater timers and IPC handlers.
1462
1303
  try {
@@ -1482,6 +1323,7 @@ async function cleanup() {
1482
1323
  // The install, the agents and the backend stop side by side: each waits out
1483
1324
  // its own grace period, and in series they could overrun the quit's time limit.
1484
1325
  await Promise.all([installStopped, stopAgentsForQuit(), stopBackendForQuit()]);
1326
+ if (updating) await stopDaemonForUpdate();
1485
1327
 
1486
1328
  // Destroy tray icon
1487
1329
  if (trayManager) {
@@ -1490,6 +1332,21 @@ async function cleanup() {
1490
1332
  }
1491
1333
  }
1492
1334
 
1335
+ /**
1336
+ * The daemon runs from the app's own files, which the update is about to
1337
+ * replace, and macOS has no installer step that stops it first.
1338
+ */
1339
+ async function stopDaemonForUpdate() {
1340
+ const gaia = backendInstaller.findGaiaBin();
1341
+ if (!gaia) return;
1342
+ console.log("Stopping the GAIA daemon before the update replaces its files...");
1343
+ try {
1344
+ await backendInstaller.stopRunningDaemon({ gaiaBin: gaia, timeoutMs: 30000 });
1345
+ } catch (err) {
1346
+ console.error(`[main] Couldn't stop the GAIA daemon before the update: ${err.message}`);
1347
+ }
1348
+ }
1349
+
1493
1350
  async function stopAgentsForQuit() {
1494
1351
  if (!agentProcessManager) return;
1495
1352
  console.log("Stopping all managed agents...");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amd-gaia/agent-ui",
3
- "version": "0.26.0-rc.2",
3
+ "version": "0.26.0-rc.20",
4
4
  "type": "module",
5
5
  "productName": "GAIA Agent UI",
6
6
  "desktopName": "gaia-desktop.desktop",
@@ -69,7 +69,7 @@
69
69
  "electron-updater": "^6.8.3"
70
70
  },
71
71
  "devDependencies": {
72
- "@playwright/test": "1.64.1",
72
+ "@playwright/test": "1.65.0",
73
73
  "@testing-library/jest-dom": "^7.0.0",
74
74
  "@testing-library/react": "^16.1.0",
75
75
  "@testing-library/user-event": "^14.5.2",
@@ -78,7 +78,7 @@
78
78
  "@vitejs/plugin-react": "^6.0.2",
79
79
  "electron": "^45.0.0",
80
80
  "electron-builder": "^26.8.1",
81
- "jsdom": "^30.0.1",
81
+ "jsdom": "^31.0.0",
82
82
  "json-schema-to-typescript": "16.0.0",
83
83
  "lucide-react": "^1.50.0",
84
84
  "qrcode": "^1.5.4",
package/preload.cjs CHANGED
@@ -8,12 +8,10 @@
8
8
  * Required because main.cjs uses `contextIsolation: true`.
9
9
  *
10
10
  * Channels:
11
- * agent:* — Agent process management (T2)
12
11
  * tray:* — Tray icon/config (T1)
13
12
  * notification:* — Desktop notifications & permission prompts (T5)
14
13
  * install:* — Backend install status, retry and log (Phase A)
15
14
  * gaia:update:* — Auto-update status & manual check (Phase F)
16
- * system:* — System metrics for the observability dashboard (#2007)
17
15
  * power:* — Keep the PC awake while a chat turn runs (#5226)
18
16
  * dialog:* — The OS folder picker
19
17
  * backend:* — Backend restarts after a crash (services/backend-supervisor.cjs)
@@ -29,29 +27,6 @@ function onEvent(channel, callback) {
29
27
  }
30
28
 
31
29
  contextBridge.exposeInMainWorld("gaiaAPI", {
32
- // ── Agent process management (T2) ─────────────────────────────────────
33
- agent: {
34
- start: (id) => ipcRenderer.invoke("agent:start", id),
35
- stop: (id) => ipcRenderer.invoke("agent:stop", id),
36
- restart: (id) => ipcRenderer.invoke("agent:restart", id),
37
- status: (id) => ipcRenderer.invoke("agent:status", id),
38
- statusAll: () => ipcRenderer.invoke("agent:status-all"),
39
- sendRpc: (id, method, params) =>
40
- ipcRenderer.invoke("agent:send-rpc", id, method, params),
41
- getManifest: () => ipcRenderer.invoke("agent:get-manifest"),
42
- // install(id, opts?) — opts: { trustNative?, version? }. Proxies to the
43
- // backend install runtime; progress arrives via onInstallProgress (#1721).
44
- install: (id, opts) => ipcRenderer.invoke("agent:install", id, opts),
45
- uninstall: (id) => ipcRenderer.invoke("agent:uninstall", id),
46
-
47
- // Event streams (return unsubscribe functions)
48
- onStdout: (cb) => onEvent("agent:stdout", cb),
49
- onStderr: (cb) => onEvent("agent:stderr", cb),
50
- onStatusChange: (cb) => onEvent("agent:status-change", cb),
51
- onCrashed: (cb) => onEvent("agent:crashed", cb),
52
- onInstallProgress: (cb) => onEvent("agent:install-progress", cb),
53
- },
54
-
55
30
  // ── Tray configuration (T1) ───────────────────────────────────────────
56
31
  tray: {
57
32
  getConfig: () => ipcRenderer.invoke("tray:get-config"),
@@ -82,11 +57,6 @@ contextBridge.exposeInMainWorld("gaiaAPI", {
82
57
  setKeepAwake: (on) => ipcRenderer.invoke("power:keep-awake", on),
83
58
  },
84
59
 
85
- // ── System metrics for the observability dashboard (#2007) ────────────
86
- system: {
87
- getMetrics: () => ipcRenderer.invoke("system:get-metrics"),
88
- },
89
-
90
60
  // ── OS folder picker; resolves the chosen path, or null on cancel ─────
91
61
  dialog: {
92
62
  pickFolder: (defaultPath) => ipcRenderer.invoke("dialog:pick-folder", defaultPath),