@amd-gaia/agent-ui 0.26.0-rc.3 → 0.26.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/app.config.json +1 -1
- package/assets/tray-iconTemplate.png +0 -0
- package/assets/tray-iconTemplate@2x.png +0 -0
- package/dist/assets/AdvancedSettings-AZf0WCqG.js +1 -0
- package/dist/assets/AutomationsSettings-DwubSse_.js +1 -0
- package/dist/assets/ConnectorsPane-BAsWmgVb.css +1 -0
- package/dist/assets/ConnectorsPane-CfpUJvF6.js +1 -0
- package/dist/assets/DocumentLibrary-DudZtBqr.css +1 -0
- package/dist/assets/DocumentLibrary-DvDlhZCI.js +4 -0
- package/dist/assets/FileBrowser-CrRQXiPo.css +1 -0
- package/dist/assets/FileBrowser-CwyzT9Ee.js +4 -0
- package/dist/assets/MemoryDashboard-B4AO_CU8.css +1 -0
- package/dist/assets/MemoryDashboard-BTLZKTNP.js +1 -0
- package/dist/assets/MessagingSettings-CO_iuTcZ.js +1 -0
- package/dist/assets/MobileAccessModal-BPHPdrPb.js +2 -0
- package/dist/assets/MobileAccessModal-CX4NZmr4.css +1 -0
- package/dist/assets/ScheduleManager-B_r7eDEE.js +1 -0
- package/dist/assets/ScheduleManager-DQBnf_IN.css +1 -0
- package/dist/assets/{browser-KnDALPx_.js → browser-DfYHeeW3.js} +1 -1
- package/dist/assets/index-CC3nUEeN.js +107 -0
- package/dist/assets/index-DAgBH5y7.css +1 -0
- package/dist/assets/useT-DOuPwmY8.js +6 -0
- package/dist/assets/zap-BO861jhc.js +1 -0
- package/dist/index.html +17 -4
- package/dist/sw.js +1 -1
- package/main-safety-net.cjs +30 -3
- package/main.cjs +74 -220
- package/package.json +3 -3
- package/preload.cjs +0 -30
- package/services/agent-process-manager.cjs +3 -411
- package/services/appimage-launcher.cjs +183 -0
- package/services/auto-updater.cjs +56 -3
- package/services/backend-installer.cjs +207 -497
- package/services/renderer-gone-dialog.cjs +57 -0
- package/services/tray-manager.cjs +7 -14
- package/services/window-reveal.cjs +42 -0
- package/assets/tray-icon-active.png +0 -0
- package/assets/tray-icon-active@2x.png +0 -0
- package/dist/assets/AdvancedSettings-CaObX4Wa.js +0 -1
- package/dist/assets/ConnectorsPane-D0I07qUd.js +0 -1
- package/dist/assets/ConnectorsPane-DU5VkSj1.css +0 -1
- package/dist/assets/DocumentLibrary-CM6o8j2T.css +0 -1
- package/dist/assets/DocumentLibrary-CijRJVE8.js +0 -4
- package/dist/assets/FileBrowser-BU-MxcRT.js +0 -4
- package/dist/assets/FileBrowser-Cna3BsT7.css +0 -1
- package/dist/assets/MemoryDashboard-BPAUphrI.js +0 -1
- package/dist/assets/MemoryDashboard-DwrWAXi6.css +0 -1
- package/dist/assets/MobileAccessModal-BSC78LTu.js +0 -2
- package/dist/assets/MobileAccessModal-BkVDm3YG.css +0 -1
- package/dist/assets/ScheduleManager-Bc1GA1nB.js +0 -1
- package/dist/assets/ScheduleManager-CjHJ4NbD.css +0 -1
- package/dist/assets/api-BemWvhdJ.js +0 -4
- package/dist/assets/index-BbM3URRX.js +0 -83
- package/dist/assets/index-LLooEbjq.css +0 -1
- package/dist/assets/useT-DRJDft_1.js +0 -3
- package/dist/assets/zap-DSyPz4mM.js +0 -1
- package/services/deep-link-queue.cjs +0 -77
- package/services/deep-link.cjs +0 -230
- package/services/system-metrics.cjs +0 -154
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{oi as e}from"./useT-DOuPwmY8.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,24 @@
|
|
|
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
|
-
|
|
15
|
+
<!-- Paints the saved theme before the first frame; must resolve it exactly as
|
|
16
|
+
main.tsx does (a saved light/dark wins, otherwise the OS, dark if unreadable). -->
|
|
17
|
+
<script>
|
|
18
|
+
try {
|
|
19
|
+
var t = localStorage.getItem('gaia-chat-theme');
|
|
20
|
+
if (t !== 'light' && t !== 'dark') {
|
|
21
|
+
t = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
|
22
|
+
}
|
|
23
|
+
document.documentElement.setAttribute('data-theme', t);
|
|
24
|
+
document.documentElement.style.colorScheme = t;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
// main.tsx applies the theme again and reports why it could not read the saved one.
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
<script type="module" crossorigin src="./assets/index-CC3nUEeN.js"></script>
|
|
16
30
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-XKyaHtl9.js">
|
|
17
|
-
<link rel="modulepreload" crossorigin href="./assets/useT-
|
|
18
|
-
<link rel="
|
|
19
|
-
<link rel="stylesheet" crossorigin href="./assets/index-LLooEbjq.css">
|
|
31
|
+
<link rel="modulepreload" crossorigin href="./assets/useT-DOuPwmY8.js">
|
|
32
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DAgBH5y7.css">
|
|
20
33
|
</head>
|
|
21
34
|
<body>
|
|
22
35
|
<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.
|
|
12
|
+
const CACHE_NAME = CACHE_PREFIX + '0.26.0rc30-5db1cdba4c033a98';
|
|
13
13
|
const ASSETS_PATH = new URL('assets/', self.registration.scope).pathname;
|
|
14
14
|
|
|
15
15
|
self.addEventListener('install', () => {
|
package/main-safety-net.cjs
CHANGED
|
@@ -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
|
-
|
|
204
|
-
|
|
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");
|
|
@@ -572,6 +570,34 @@ async function handleBackendCrash(code, signal) {
|
|
|
572
570
|
}
|
|
573
571
|
}
|
|
574
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
|
+
|
|
575
601
|
async function waitForBackend(timeoutMs, isAlive = () => true) {
|
|
576
602
|
const start = Date.now();
|
|
577
603
|
const http = require("http");
|
|
@@ -750,8 +776,8 @@ function createWindow() {
|
|
|
750
776
|
});
|
|
751
777
|
|
|
752
778
|
// Show window when ready (unless --minimized or startMinimized config)
|
|
753
|
-
mainWindow
|
|
754
|
-
console.log(
|
|
779
|
+
revealWhenReady(mainWindow, (via) => {
|
|
780
|
+
console.log(`[main] Window ready to show (${via})`);
|
|
755
781
|
Promise.resolve(trayHostReady).then(() => {
|
|
756
782
|
if (!mainWindow || mainWindow.isDestroyed()) return;
|
|
757
783
|
// Never start hidden where no tray icon would bring the window back.
|
|
@@ -845,8 +871,8 @@ async function loadApp() {
|
|
|
845
871
|
function reopenWindow() {
|
|
846
872
|
createWindow();
|
|
847
873
|
// Asked for from the tray or the dock: show it even when starting minimized.
|
|
848
|
-
|
|
849
|
-
|
|
874
|
+
const reopened = mainWindow;
|
|
875
|
+
revealWhenReady(reopened, () => !reopened.isDestroyed() && reopened.show());
|
|
850
876
|
if (trayManager) trayManager.mainWindow = mainWindow;
|
|
851
877
|
if (notificationService) notificationService.mainWindow = mainWindow;
|
|
852
878
|
loadApp().catch((err) => {
|
|
@@ -860,12 +886,7 @@ function initializeServices() {
|
|
|
860
886
|
console.log("[main] Initializing services...");
|
|
861
887
|
|
|
862
888
|
// T2: Agent Process Manager (manages OS agent subprocesses)
|
|
863
|
-
|
|
864
|
-
// Python backend's install runtime (issue #1721) on whatever random port
|
|
865
|
-
// port-manager picked this session.
|
|
866
|
-
agentProcessManager = new AgentProcessManager(mainWindow, {
|
|
867
|
-
getBackendPort: () => backendPort,
|
|
868
|
-
});
|
|
889
|
+
agentProcessManager = new AgentProcessManager();
|
|
869
890
|
|
|
870
891
|
// T1: Tray Manager (system tray icon + context menu)
|
|
871
892
|
trayManager = new TrayManager(mainWindow, {
|
|
@@ -897,9 +918,6 @@ function initializeServices() {
|
|
|
897
918
|
// #5226: hold off idle sleep while a chat turn runs
|
|
898
919
|
keepAwake = new KeepAwake();
|
|
899
920
|
|
|
900
|
-
// #2007: System metrics for the observability dashboard
|
|
901
|
-
systemMetrics.registerIpcHandlers();
|
|
902
|
-
|
|
903
921
|
folderDialog.registerIpcHandlers();
|
|
904
922
|
|
|
905
923
|
console.log("[main] Services initialized");
|
|
@@ -970,194 +988,6 @@ async function goBackToPreviousVersion() {
|
|
|
970
988
|
await autoUpdater.revertUpdate();
|
|
971
989
|
}
|
|
972
990
|
|
|
973
|
-
// ── gaia:// deep-link install bridge (issue #1725) ──────────────────────────
|
|
974
|
-
//
|
|
975
|
-
// The website's "Open in GAIA" button opens a `gaia://hub/install/<id>` URL.
|
|
976
|
-
// The OS routes it to this app (registered as the gaia:// protocol client);
|
|
977
|
-
// we parse it and hand the agent id to the install runtime (issue #1721).
|
|
978
|
-
//
|
|
979
|
-
// Sources of the URL differ per OS:
|
|
980
|
-
// • macOS — the `open-url` app event (registered before whenReady).
|
|
981
|
-
// • Win/Linux — a command-line argument, either at cold start (process.argv)
|
|
982
|
-
// or on a second launch (the `second-instance` event argv).
|
|
983
|
-
// A malformed/unsupported link surfaces a loud error dialog — never a silent
|
|
984
|
-
// no-op (deep-link.cjs throws with an actionable message).
|
|
985
|
-
|
|
986
|
-
// Holds gaia:// links until startup has waited for the backend (the install
|
|
987
|
-
// gate verifies the agent through its catalog API), then dispatches each once.
|
|
988
|
-
const startupDeepLinks = createStartupDeepLinkQueue({
|
|
989
|
-
dispatch: (rawUrl) => {
|
|
990
|
-
void runDeepLink(parseDeepLink(rawUrl));
|
|
991
|
-
},
|
|
992
|
-
reportNotReady: reportDeepLinksNotReady,
|
|
993
|
-
logger: console,
|
|
994
|
-
});
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Register this app as the handler for the gaia:// scheme. In dev (`electron .`)
|
|
998
|
-
* the launcher is Electron itself, so the app path must be threaded through
|
|
999
|
-
* explicitly; packaged builds register their own executable.
|
|
1000
|
-
*/
|
|
1001
|
-
function registerProtocolHandler() {
|
|
1002
|
-
try {
|
|
1003
|
-
let registered;
|
|
1004
|
-
if (process.defaultApp && process.argv.length >= 2) {
|
|
1005
|
-
// Dev: `electron . <args>` — point the scheme at this script.
|
|
1006
|
-
registered = app.setAsDefaultProtocolClient("gaia", process.execPath, [
|
|
1007
|
-
path.resolve(process.argv[1]),
|
|
1008
|
-
]);
|
|
1009
|
-
} else {
|
|
1010
|
-
registered = app.setAsDefaultProtocolClient("gaia");
|
|
1011
|
-
}
|
|
1012
|
-
if (registered) {
|
|
1013
|
-
console.log("[main] Registered as gaia:// protocol client");
|
|
1014
|
-
} else {
|
|
1015
|
-
console.warn(
|
|
1016
|
-
"[main] Could not register gaia:// protocol client — deep-link installs may not route to this app"
|
|
1017
|
-
);
|
|
1018
|
-
}
|
|
1019
|
-
} catch (err) {
|
|
1020
|
-
console.warn(
|
|
1021
|
-
`[main] setAsDefaultProtocolClient failed: ${err && err.message ? err.message : err}`
|
|
1022
|
-
);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* Entry point for any inbound deep link. Validates it now (a bad link is
|
|
1028
|
-
* refused loudly and immediately), then hands it to the startup queue, which
|
|
1029
|
-
* holds it until the backend is ready and dispatches it immediately after.
|
|
1030
|
-
*/
|
|
1031
|
-
function handleDeepLink(rawUrl) {
|
|
1032
|
-
try {
|
|
1033
|
-
parseDeepLink(rawUrl);
|
|
1034
|
-
} catch (err) {
|
|
1035
|
-
const message = err && err.message ? err.message : String(err);
|
|
1036
|
-
console.error(`[main] Rejected deep link: ${message}`);
|
|
1037
|
-
try {
|
|
1038
|
-
dialog.showErrorBox("Invalid GAIA link", message);
|
|
1039
|
-
} catch {
|
|
1040
|
-
/* dialog may be unavailable pre-ready — the log line above still fires */
|
|
1041
|
-
}
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
startupDeepLinks.accept(rawUrl);
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
/**
|
|
1049
|
-
* Explicit, INFORMED per-agent confirmation for a web-triggered install. This
|
|
1050
|
-
* is the security gate: the user must confirm the SPECIFIC agent — and see
|
|
1051
|
-
* its real trust tier and permissions, not just its bare id — before any
|
|
1052
|
-
* download happens (issue #2196 review; hardened so the shown facts match
|
|
1053
|
-
* the backend's non-verified gate, which now covers every non-verified
|
|
1054
|
-
* agent, not just native ones). Defaults to the safe (Cancel) option.
|
|
1055
|
-
*
|
|
1056
|
-
* Fails closed: if the agent can't be found in the catalog, or the backend
|
|
1057
|
-
* is unreachable, the install is refused with an explanatory error — never
|
|
1058
|
-
* installed blind.
|
|
1059
|
-
* @returns {Promise<boolean>}
|
|
1060
|
-
*/
|
|
1061
|
-
async function confirmDeepLinkInstall(command) {
|
|
1062
|
-
let entry;
|
|
1063
|
-
try {
|
|
1064
|
-
entry = await agentProcessManager.fetchCatalogEntry(command.agentId);
|
|
1065
|
-
} catch (err) {
|
|
1066
|
-
const message = err && err.message ? err.message : String(err);
|
|
1067
|
-
console.error(
|
|
1068
|
-
`[main] Refusing deep-link install of "${command.agentId}": ${message}`
|
|
1069
|
-
);
|
|
1070
|
-
try {
|
|
1071
|
-
dialog.showErrorBox("Could not verify this agent", message);
|
|
1072
|
-
} catch {
|
|
1073
|
-
/* best-effort */
|
|
1074
|
-
}
|
|
1075
|
-
return false;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
const prompt = buildInstallPrompt(entry);
|
|
1079
|
-
const choice = await dialog.showMessageBox(
|
|
1080
|
-
mainWindow && !mainWindow.isDestroyed() ? mainWindow : null,
|
|
1081
|
-
{
|
|
1082
|
-
type: "question",
|
|
1083
|
-
buttons: [prompt.requiresTrust ? "Trust & Install" : "Install", "Cancel"],
|
|
1084
|
-
defaultId: 1, // Enter selects the safe option
|
|
1085
|
-
cancelId: 1,
|
|
1086
|
-
title: prompt.title,
|
|
1087
|
-
message: prompt.message,
|
|
1088
|
-
detail: prompt.detail,
|
|
1089
|
-
noLink: true,
|
|
1090
|
-
}
|
|
1091
|
-
);
|
|
1092
|
-
return !!choice && choice.response === 0;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
/** Wire the injected deep-link dispatcher to this process's runtime effects. */
|
|
1096
|
-
async function runDeepLink(command) {
|
|
1097
|
-
console.log(`[main] Deep-link install request: ${command.agentId}`);
|
|
1098
|
-
try {
|
|
1099
|
-
await dispatchDeepLink(command, {
|
|
1100
|
-
confirm: confirmDeepLinkInstall,
|
|
1101
|
-
installAgent: (agentId, opts) => agentProcessManager.installAgent(agentId, opts),
|
|
1102
|
-
focusWindow: () => {
|
|
1103
|
-
if (mainWindow && !mainWindow.isDestroyed()) {
|
|
1104
|
-
if (mainWindow.isMinimized()) mainWindow.restore();
|
|
1105
|
-
if (!mainWindow.isVisible()) mainWindow.show();
|
|
1106
|
-
mainWindow.focus();
|
|
1107
|
-
}
|
|
1108
|
-
},
|
|
1109
|
-
logger: { log: console.log.bind(console), error: console.error.bind(console) },
|
|
1110
|
-
});
|
|
1111
|
-
} catch (err) {
|
|
1112
|
-
const message = err && err.message ? err.message : String(err);
|
|
1113
|
-
console.error(
|
|
1114
|
-
`[main] Deep-link install of "${command.agentId}" failed: ${message}`
|
|
1115
|
-
);
|
|
1116
|
-
try {
|
|
1117
|
-
dialog.showErrorBox(`Could not install "${command.agentId}"`, message);
|
|
1118
|
-
} catch {
|
|
1119
|
-
/* best-effort */
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
/**
|
|
1125
|
-
* Release queued deep links, plus any gaia:// URL in the cold-start argv. Call
|
|
1126
|
-
* once, after startup has waited for the backend.
|
|
1127
|
-
*
|
|
1128
|
-
* @param {boolean} backendReady Whether the backend API answered its health check.
|
|
1129
|
-
*/
|
|
1130
|
-
function processStartupDeepLinks(backendReady) {
|
|
1131
|
-
startupDeepLinks.drain({ backendReady, argvUrl: extractDeepLinkFromArgv(process.argv) });
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
/** The backend never came up: tell the user instead of dispatching blind. */
|
|
1135
|
-
function reportDeepLinksNotReady(urls) {
|
|
1136
|
-
const why = backendProcess
|
|
1137
|
-
? `did not answer within ${Math.round(STARTUP_TIMEOUT / 1000)}s`
|
|
1138
|
-
: "could not be started";
|
|
1139
|
-
const message =
|
|
1140
|
-
`GAIA could not open ${urls.map((u) => `"${u}"`).join(", ")} because ` +
|
|
1141
|
-
`its backend ${why}, so the agent cannot be verified before install. ` +
|
|
1142
|
-
`Check ${_MAIN_LOG_PATH} for the startup error, then click the link ` +
|
|
1143
|
-
"again once GAIA is running.";
|
|
1144
|
-
console.error(`[main] ${message}`);
|
|
1145
|
-
try {
|
|
1146
|
-
dialog.showErrorBox("GAIA is not ready yet", message);
|
|
1147
|
-
} catch {
|
|
1148
|
-
/* best-effort */
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
// macOS delivers deep links via this event; it can fire before whenReady, so
|
|
1153
|
-
// register it at module load and let handleDeepLink queue as needed.
|
|
1154
|
-
app.on("open-url", (event, url) => {
|
|
1155
|
-
event.preventDefault();
|
|
1156
|
-
handleDeepLink(url);
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
registerProtocolHandler();
|
|
1160
|
-
|
|
1161
991
|
// ── App Lifecycle ──────────────────────────────────────────────────────────
|
|
1162
992
|
|
|
1163
993
|
// Note: electron-squirrel-startup was removed in Phase C of the
|
|
@@ -1200,7 +1030,13 @@ if (process.platform === "win32") {
|
|
|
1200
1030
|
app.setAppUserModelId(appUserModelId(app.isPackaged));
|
|
1201
1031
|
}
|
|
1202
1032
|
|
|
1203
|
-
|
|
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", () => {
|
|
1204
1040
|
// A second launch happened while we were running. Surface our window
|
|
1205
1041
|
// (the user almost certainly wanted to see it).
|
|
1206
1042
|
if (typeof mainWindow !== "undefined" && mainWindow && !mainWindow.isDestroyed()) {
|
|
@@ -1208,11 +1044,6 @@ app.on("second-instance", (_event, argv, _cwd) => {
|
|
|
1208
1044
|
if (!mainWindow.isVisible()) mainWindow.show();
|
|
1209
1045
|
mainWindow.focus();
|
|
1210
1046
|
}
|
|
1211
|
-
|
|
1212
|
-
// Win/Linux: a `gaia://…` deep link from the second launch arrives as an argv
|
|
1213
|
-
// entry. Route it into the already-running first instance (issue #1725).
|
|
1214
|
-
const deepLink = extractDeepLinkFromArgv(argv);
|
|
1215
|
-
if (deepLink) handleDeepLink(deepLink);
|
|
1216
1047
|
});
|
|
1217
1048
|
|
|
1218
1049
|
app.whenReady().then(async () => {
|
|
@@ -1229,6 +1060,17 @@ app.whenReady().then(async () => {
|
|
|
1229
1060
|
// The window, and the tray that keeps a closed one reachable, come before
|
|
1230
1061
|
// anything that can take time, so an install runs in plain sight.
|
|
1231
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
|
+
}
|
|
1232
1074
|
createWindow();
|
|
1233
1075
|
initializeServices();
|
|
1234
1076
|
engineInstall = createEngineInstall({
|
|
@@ -1353,11 +1195,6 @@ app.whenReady().then(async () => {
|
|
|
1353
1195
|
if (mainWindow) await loadApp();
|
|
1354
1196
|
}
|
|
1355
1197
|
|
|
1356
|
-
// Act on any gaia:// deep link that arrived during bootstrap or via the
|
|
1357
|
-
// cold-start command line (issue #1725) — after the backend is listening,
|
|
1358
|
-
// because the install gate queries its catalog API.
|
|
1359
|
-
processStartupDeepLinks(backendReady);
|
|
1360
|
-
|
|
1361
1198
|
// Auto-start enabled agents (T2)
|
|
1362
1199
|
if (agentProcessManager) {
|
|
1363
1200
|
try {
|
|
@@ -1460,6 +1297,7 @@ async function cleanup() {
|
|
|
1460
1297
|
shutdownStarted = true;
|
|
1461
1298
|
backendSupervisor.stop();
|
|
1462
1299
|
const installStopped = engineInstall ? engineInstall.stop() : null;
|
|
1300
|
+
const updating = app.isPackaged && autoUpdater.installsOnQuit();
|
|
1463
1301
|
|
|
1464
1302
|
// Phase F: tear down auto-updater timers and IPC handlers.
|
|
1465
1303
|
try {
|
|
@@ -1485,6 +1323,7 @@ async function cleanup() {
|
|
|
1485
1323
|
// The install, the agents and the backend stop side by side: each waits out
|
|
1486
1324
|
// its own grace period, and in series they could overrun the quit's time limit.
|
|
1487
1325
|
await Promise.all([installStopped, stopAgentsForQuit(), stopBackendForQuit()]);
|
|
1326
|
+
if (updating) await stopDaemonForUpdate();
|
|
1488
1327
|
|
|
1489
1328
|
// Destroy tray icon
|
|
1490
1329
|
if (trayManager) {
|
|
@@ -1493,6 +1332,21 @@ async function cleanup() {
|
|
|
1493
1332
|
}
|
|
1494
1333
|
}
|
|
1495
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
|
+
|
|
1496
1350
|
async function stopAgentsForQuit() {
|
|
1497
1351
|
if (!agentProcessManager) return;
|
|
1498
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.
|
|
3
|
+
"version": "0.26.0-rc.30",
|
|
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.
|
|
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": "^
|
|
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),
|