@amd-gaia/agent-ui 0.26.1-rc.2 → 0.27.0-rc.10
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/bin/gaia-ui.cjs +57 -3
- package/dist/assets/AdvancedSettings-BLR8jrQ6.js +1 -0
- package/dist/assets/AutomationsSettings-Cl-NlbrD.js +1 -0
- package/dist/assets/ConnectorsPane-BGI8nBUb.css +1 -0
- package/dist/assets/ConnectorsPane-Dcuevs9v.js +1 -0
- package/dist/assets/DocumentLibrary-BHNYPjV3.js +5 -0
- package/dist/assets/DocumentLibrary-fEMoY7lH.css +1 -0
- package/dist/assets/FileBrowser-1goNp4CP.css +1 -0
- package/dist/assets/FileBrowser-Dosu_Lh8.js +4 -0
- package/dist/assets/MemoryDashboard-1g_y8lqR.js +1 -0
- package/dist/assets/MemoryDashboard-RpfLag-v.css +1 -0
- package/dist/assets/MessagingSettings-DkTMjERx.js +1 -0
- package/dist/assets/{MobileAccessModal-CX4NZmr4.css → MobileAccessModal-BrZMaERi.css} +1 -1
- package/dist/assets/MobileAccessModal-Cj_Qjsbv.js +2 -0
- package/dist/assets/ScheduleManager-B8xUdWID.js +1 -0
- package/dist/assets/ScheduleManager-BZzEH2-W.css +1 -0
- package/dist/assets/Temml-CCjoacWt.woff2 +0 -0
- package/dist/assets/index-bP0Mo7oA.css +1 -0
- package/dist/assets/index-eiWfnMcl.js +225 -0
- package/dist/assets/useFocusTrap-hXXaHKVF.js +6 -0
- package/dist/index.html +3 -3
- package/dist/sw.js +1 -1
- package/main.cjs +165 -101
- package/package.json +5 -3
- package/preload.cjs +34 -0
- package/services/auto-updater.cjs +99 -0
- package/services/backend-orphan.cjs +162 -1
- package/services/browser-pane/bridge-error.cjs +20 -0
- package/services/browser-pane/bridge-server.cjs +496 -0
- package/services/browser-pane/cdp-session.cjs +375 -0
- package/services/browser-pane/contract.d.ts +448 -0
- package/services/browser-pane/dev-servers.cjs +478 -0
- package/services/browser-pane/input.cjs +375 -0
- package/services/browser-pane/ipc.cjs +267 -0
- package/services/browser-pane/navigation-policy.cjs +255 -0
- package/services/browser-pane/pane-host.cjs +1686 -0
- package/services/browser-pane/picker-world.js +360 -0
- package/services/browser-pane/picker.cjs +261 -0
- package/services/browser-pane/service-ports.cjs +66 -0
- package/services/dev-qa-mode.cjs +32 -0
- package/services/quit-guard.cjs +8 -4
- package/services/ui-token.cjs +156 -0
- package/dist/assets/AdvancedSettings-C-9ErldS.js +0 -1
- package/dist/assets/AutomationsSettings-CL3K4hLZ.js +0 -1
- package/dist/assets/ConnectorsPane-DpGR78cA.js +0 -1
- package/dist/assets/ConnectorsPane-w-HLcq3n.css +0 -1
- package/dist/assets/DocumentLibrary-BKZdx6rJ.css +0 -1
- package/dist/assets/DocumentLibrary-N7tBbt9v.js +0 -5
- package/dist/assets/FileBrowser-CO2p3xa2.js +0 -4
- package/dist/assets/FileBrowser-CrRQXiPo.css +0 -1
- package/dist/assets/MemoryDashboard-1OIrKFIa.js +0 -1
- package/dist/assets/MemoryDashboard-B4AO_CU8.css +0 -1
- package/dist/assets/MessagingSettings-0AJnsoWA.js +0 -1
- package/dist/assets/MobileAccessModal-CnPB1BEN.js +0 -2
- package/dist/assets/ScheduleManager-BYOhqnfv.js +0 -1
- package/dist/assets/ScheduleManager-DQBnf_IN.css +0 -1
- package/dist/assets/index-Bkx-QRv4.css +0 -1
- package/dist/assets/index-C-3wCH_s.js +0 -116
- package/dist/assets/useT-DuzpQY8p.js +0 -6
- package/dist/assets/zap-gF9QDKfa.js +0 -1
package/dist/index.html
CHANGED
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
// main.tsx applies the theme again and reports why it could not read the saved one.
|
|
27
27
|
}
|
|
28
28
|
</script>
|
|
29
|
-
<script type="module" crossorigin src="./assets/index-
|
|
29
|
+
<script type="module" crossorigin src="./assets/index-eiWfnMcl.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-XKyaHtl9.js">
|
|
31
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
32
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
31
|
+
<link rel="modulepreload" crossorigin href="./assets/useFocusTrap-hXXaHKVF.js">
|
|
32
|
+
<link rel="stylesheet" crossorigin href="./assets/index-bP0Mo7oA.css">
|
|
33
33
|
</head>
|
|
34
34
|
<body>
|
|
35
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.
|
|
12
|
+
const CACHE_NAME = CACHE_PREFIX + '0.27.0rc10-bb079cbcce58215c';
|
|
13
13
|
const ASSETS_PATH = new URL('assets/', self.registration.scope).pathname;
|
|
14
14
|
|
|
15
15
|
self.addEventListener('install', () => {
|
package/main.cjs
CHANGED
|
@@ -105,7 +105,11 @@ const AgentProcessManager = require("./services/agent-process-manager.cjs");
|
|
|
105
105
|
const NotificationService = require("./services/notification-service.cjs");
|
|
106
106
|
const KeepAwake = require("./services/keep-awake.cjs");
|
|
107
107
|
const PortManager = require("./services/port-manager.cjs");
|
|
108
|
-
const {
|
|
108
|
+
const {
|
|
109
|
+
cleanupOrphanedBackends,
|
|
110
|
+
forgetBackend,
|
|
111
|
+
recordBackend,
|
|
112
|
+
} = require("./services/backend-orphan.cjs");
|
|
109
113
|
const { showBackendCrashDialog } = require("./services/backend-crash-dialog.cjs");
|
|
110
114
|
const { showRendererGoneDialog } = require("./services/renderer-gone-dialog.cjs");
|
|
111
115
|
const { createBackendSupervisor } = require("./services/backend-supervisor.cjs");
|
|
@@ -124,6 +128,17 @@ const { installWindowKeys } = require("./services/window-keys.cjs");
|
|
|
124
128
|
const { installQuitCleanup } = require("./services/quit-cleanup.cjs");
|
|
125
129
|
const { chromiumSwitches } = require("./services/chromium-switches.cjs");
|
|
126
130
|
const { titleBarKind, titleBarOptions } = require("./services/window-frame.cjs");
|
|
131
|
+
const { installBackendAuth } = require("./services/ui-token.cjs");
|
|
132
|
+
const { resolveDevQaMode } = require("./services/dev-qa-mode.cjs");
|
|
133
|
+
const { createBrowserPaneService, PANE_PARTITION } = require("./services/browser-pane/ipc.cjs");
|
|
134
|
+
const { DevServerSupervisor } = require("./services/browser-pane/dev-servers.cjs");
|
|
135
|
+
const { servicePorts } = require("./services/browser-pane/service-ports.cjs");
|
|
136
|
+
const {
|
|
137
|
+
DISCOVERY_ENV: PANE_DISCOVERY_ENV,
|
|
138
|
+
createHandlers: createPaneBridgeHandlers,
|
|
139
|
+
discoveryPath: paneDiscoveryPath,
|
|
140
|
+
startBridge: startPaneBridge,
|
|
141
|
+
} = require("./services/browser-pane/bridge-server.cjs");
|
|
127
142
|
|
|
128
143
|
// No ozone switch: Electron 38+ already picks Wayland or X11, and users override with --ozone-platform=x11.
|
|
129
144
|
for (const [name, value] of chromiumSwitches({ platform: process.platform, env: process.env })) {
|
|
@@ -219,6 +234,10 @@ const RESTART_TIMEOUT = 90000;
|
|
|
219
234
|
// Parse CLI args (T11: --minimized flag for auto-start)
|
|
220
235
|
const startMinimized = process.argv.includes("--minimized");
|
|
221
236
|
|
|
237
|
+
// GAIA_BIN in an unpackaged build: use that backend and leave the user's install alone.
|
|
238
|
+
const devQa = resolveDevQaMode({ isPackaged: app.isPackaged, env: process.env });
|
|
239
|
+
if (devQa) console.log(`[main] Dev QA mode: backend ${devQa.gaiaBin}; installer and pidfile skipped`);
|
|
240
|
+
|
|
222
241
|
// Load app.config.json if available
|
|
223
242
|
let appConfig = {};
|
|
224
243
|
try {
|
|
@@ -248,6 +267,8 @@ let shutdownStarted = false;
|
|
|
248
267
|
// Set once an update install starts quitting the app.
|
|
249
268
|
let updateQuitStarted = false;
|
|
250
269
|
let backendPort = DEFAULT_BACKEND_PORT;
|
|
270
|
+
// The port of the backend this app spawned; only it is sent the API token.
|
|
271
|
+
let spawnedBackendPort = null;
|
|
251
272
|
let healthCheckUrl = `http://localhost:${backendPort}/api/health`;
|
|
252
273
|
let backendStderrTail = [];
|
|
253
274
|
let isIntentionalKill = false;
|
|
@@ -273,6 +294,20 @@ let notificationService = null;
|
|
|
273
294
|
/** @type {KeepAwake | null} */
|
|
274
295
|
let keepAwake = null;
|
|
275
296
|
|
|
297
|
+
/** @type {ReturnType<typeof createBrowserPaneService> | null} */
|
|
298
|
+
let browserPane = null;
|
|
299
|
+
|
|
300
|
+
/** @type {Awaited<ReturnType<typeof startPaneBridge>> | null} */
|
|
301
|
+
let paneBridge = null;
|
|
302
|
+
|
|
303
|
+
/** @type {DevServerSupervisor | null} */
|
|
304
|
+
let devServers = null;
|
|
305
|
+
|
|
306
|
+
/** Where the agent finds the pane's bridge; the backend is told through PANE_DISCOVERY_ENV. */
|
|
307
|
+
function paneDiscoveryFile() {
|
|
308
|
+
return paneDiscoveryPath({ devQa: Boolean(devQa), userDataDir: app.getPath("userData"), gaiaDir: _GAIA_DIR });
|
|
309
|
+
}
|
|
310
|
+
|
|
276
311
|
/** @type {PortManager} */
|
|
277
312
|
const portManager = new PortManager({
|
|
278
313
|
logger: { log: console.log.bind(console), error: console.error.bind(console) },
|
|
@@ -292,54 +327,25 @@ function quitStarted() {
|
|
|
292
327
|
// ── Backend Process ────────────────────────────────────────────────────────
|
|
293
328
|
|
|
294
329
|
/**
|
|
295
|
-
* Terminate
|
|
330
|
+
* Terminate backends left running by a previous launch.
|
|
296
331
|
*
|
|
297
|
-
* The desktop app may
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* so the executable can be replaced.
|
|
332
|
+
* The desktop app may crash, leaving an orphaned `gaia chat --ui` process. On
|
|
333
|
+
* Windows that process keeps an open handle on `gaia.exe`, so the next
|
|
334
|
+
* upgrade's `uv pip install --refresh` fails with `os error 32` (file in use)
|
|
335
|
+
* — issue #1388. We MUST run this BEFORE the installer (`engineInstall.run()`),
|
|
336
|
+
* not just before spawning the new backend, so the executable can be replaced.
|
|
303
337
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
338
|
+
* Each app records its backend under ~/.gaia/backend-pids/<app pid>.pid. Only
|
|
339
|
+
* backends whose app is gone are stopped, and only once verified to be a GAIA
|
|
340
|
+
* backend (issue #782): another copy of the app sharing ~/.gaia keeps its own
|
|
341
|
+
* (issue #7062).
|
|
308
342
|
*/
|
|
309
343
|
async function cleanupOrphanedBackend() {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (!Number.isNaN(existingPid)) {
|
|
316
|
-
console.log(`[main] Found existing backend pidfile (${existingPid}) — verifying process identity`);
|
|
317
|
-
|
|
318
|
-
let isBackend = false;
|
|
319
|
-
try {
|
|
320
|
-
isBackend = isGaiaBackendProcess(existingPid);
|
|
321
|
-
} catch (err) {
|
|
322
|
-
console.warn(`[main] Could not verify pid ${existingPid}: ${err.message}`);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (!isBackend) {
|
|
326
|
-
console.log(`[main] PID ${existingPid} does not appear to be a GAIA backend; skipping kill`);
|
|
327
|
-
} else {
|
|
328
|
-
try {
|
|
329
|
-
await portManager.killBackend(existingPid);
|
|
330
|
-
console.log(`[main] Cleaned up previous backend pid ${existingPid}`);
|
|
331
|
-
} catch (err) {
|
|
332
|
-
console.warn(`[main] Could not clean previous backend pid ${existingPid}: ${err.message}`);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
} catch (err) {
|
|
337
|
-
console.warn(`[main] Failed reading backend pidfile: ${err.message}`);
|
|
338
|
-
}
|
|
339
|
-
try { fs.unlinkSync(pidFile); } catch { /* ignore */ }
|
|
340
|
-
} catch (err) {
|
|
341
|
-
console.warn(`[main] PID cleanup check failed: ${err.message}`);
|
|
342
|
-
}
|
|
344
|
+
await cleanupOrphanedBackends({
|
|
345
|
+
gaiaDir: _GAIA_DIR,
|
|
346
|
+
killBackend: (pid) => portManager.killBackend(pid),
|
|
347
|
+
logger: console,
|
|
348
|
+
});
|
|
343
349
|
}
|
|
344
350
|
|
|
345
351
|
/**
|
|
@@ -351,7 +357,7 @@ async function cleanupOrphanedBackend() {
|
|
|
351
357
|
* (shouldn't happen post-ensureBackend, but we guard just in case).
|
|
352
358
|
*/
|
|
353
359
|
async function startBackend() {
|
|
354
|
-
const gaiaCmd = backendInstaller.findGaiaBin();
|
|
360
|
+
const gaiaCmd = devQa ? devQa.gaiaBin : backendInstaller.findGaiaBin();
|
|
355
361
|
|
|
356
362
|
if (!gaiaCmd) {
|
|
357
363
|
console.error(
|
|
@@ -374,11 +380,13 @@ async function startBackend() {
|
|
|
374
380
|
}
|
|
375
381
|
healthCheckUrl = `http://localhost:${backendPort}/api/health`;
|
|
376
382
|
// Defensively clean up any orphaned backend in case bootstrap was skipped
|
|
377
|
-
// on this path.
|
|
378
|
-
//
|
|
379
|
-
await cleanupOrphanedBackend();
|
|
383
|
+
// on this path. A no-op once earlier startup removed the orphans' records.
|
|
384
|
+
// Dev QA mode leaves it alone: it belongs to the installed app's backend.
|
|
385
|
+
if (!devQa) await cleanupOrphanedBackend();
|
|
380
386
|
|
|
381
387
|
console.log(`Starting backend: ${gaiaCmd} chat --ui --ui-port ${backendPort}`);
|
|
388
|
+
spawnedBackendPort = backendPort;
|
|
389
|
+
const childPort = backendPort;
|
|
382
390
|
|
|
383
391
|
// Reset per-spawn state so a fresh crash dialog doesn't mix tails.
|
|
384
392
|
backendStderrTail = [];
|
|
@@ -394,9 +402,11 @@ async function startBackend() {
|
|
|
394
402
|
// and no other GAIA client is using them.
|
|
395
403
|
// GAIA_BUNDLED_LEMONADE_DIR: where EmbeddedLemonade.install() finds the
|
|
396
404
|
// archive this app ships (electron-builder.yml) instead of downloading it.
|
|
405
|
+
// GAIA_BROWSER_PANE_DISCOVERY: the agent finds this app's browser pane, never another app's.
|
|
397
406
|
env: {
|
|
398
407
|
...process.env,
|
|
399
408
|
GAIA_APP_PID: String(process.pid),
|
|
409
|
+
[PANE_DISCOVERY_ENV]: paneDiscoveryFile(),
|
|
400
410
|
// Piped stdout is block-buffered: a dying backend's last lines would never arrive.
|
|
401
411
|
PYTHONUNBUFFERED: "1",
|
|
402
412
|
...(app.isPackaged && {
|
|
@@ -434,16 +444,15 @@ async function startBackend() {
|
|
|
434
444
|
console.error("Failed to start backend:", err.message);
|
|
435
445
|
});
|
|
436
446
|
|
|
437
|
-
//
|
|
438
|
-
//
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
console.warn(`[main] Could not write backend pidfile: ${err.message}`);
|
|
447
|
+
// Record this backend so a later launch can stop it if this app dies
|
|
448
|
+
// without stopping it. The record is removed when the child exits.
|
|
449
|
+
if (!devQa) {
|
|
450
|
+
try {
|
|
451
|
+
const file = recordBackend({ gaiaDir: _GAIA_DIR, ownerPid: process.pid, backendPid: child.pid });
|
|
452
|
+
console.log(`[main] Wrote backend pidfile ${file} (pid=${child.pid})`);
|
|
453
|
+
} catch (err) {
|
|
454
|
+
console.warn(`[main] Could not write backend pidfile: ${err.message}`);
|
|
455
|
+
}
|
|
447
456
|
}
|
|
448
457
|
|
|
449
458
|
child.on("exit", (code, signal) => {
|
|
@@ -453,23 +462,20 @@ async function startBackend() {
|
|
|
453
462
|
console.error(`Backend exited with code ${code} (signal=${signal}, pid=${child.pid})`);
|
|
454
463
|
}
|
|
455
464
|
if (backendProcess === child) backendProcess = null;
|
|
465
|
+
// Whatever binds the port next is not ours, so it gets no token.
|
|
466
|
+
if (spawnedBackendPort === childPort) spawnedBackendPort = null;
|
|
456
467
|
if (trayManager && !isQuitting) trayManager.setBackendAlive(false);
|
|
457
468
|
|
|
458
469
|
// Once restarts run out, the supervisor's onStopped shows the crash dialog.
|
|
459
470
|
if (crashed) backendSupervisor.crashed({ code, signal });
|
|
460
471
|
|
|
461
|
-
// Remove
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
try { fs.unlinkSync(pidFile); } catch { /* ignore */ }
|
|
468
|
-
}
|
|
472
|
+
// Remove this app's record, unless a newer backend already replaced it.
|
|
473
|
+
if (!devQa) {
|
|
474
|
+
try {
|
|
475
|
+
forgetBackend({ gaiaDir: _GAIA_DIR, ownerPid: process.pid, backendPid: child.pid });
|
|
476
|
+
} catch (err) {
|
|
477
|
+
console.warn(`[main] Failed to remove backend pidfile: ${err.message}`);
|
|
469
478
|
}
|
|
470
|
-
} catch (err) {
|
|
471
|
-
// Non-fatal — just log and continue.
|
|
472
|
-
console.warn(`[main] Failed to remove backend pidfile: ${err.message}`);
|
|
473
479
|
}
|
|
474
480
|
});
|
|
475
481
|
|
|
@@ -875,6 +881,7 @@ function reopenWindow() {
|
|
|
875
881
|
revealWhenReady(reopened, () => !reopened.isDestroyed() && reopened.show());
|
|
876
882
|
if (trayManager) trayManager.mainWindow = mainWindow;
|
|
877
883
|
if (notificationService) notificationService.mainWindow = mainWindow;
|
|
884
|
+
if (browserPane) browserPane.attach(mainWindow);
|
|
878
885
|
loadApp().catch((err) => {
|
|
879
886
|
console.error("[main] Failed to load the reopened window:", err.message);
|
|
880
887
|
dialog.showErrorBox("GAIA", `GAIA couldn't reopen its window: ${err.message}`);
|
|
@@ -920,6 +927,44 @@ function initializeServices() {
|
|
|
920
927
|
|
|
921
928
|
folderDialog.registerIpcHandlers();
|
|
922
929
|
|
|
930
|
+
// GAIA's backend, the pane bridge, and GAIA's other local services: no pane page may reach any.
|
|
931
|
+
const appPorts = () => [backendPort, ...(paneBridge ? [paneBridge.port] : []), ...servicePorts()];
|
|
932
|
+
|
|
933
|
+
// Dev servers the agent starts; ones a crash left running are stopped first.
|
|
934
|
+
devServers = new DevServerSupervisor({
|
|
935
|
+
dir: path.join(app.getPath("userData"), "dev-servers"),
|
|
936
|
+
blockedPorts: appPorts,
|
|
937
|
+
onChange: () => {
|
|
938
|
+
if (browserPane) browserPane.publish();
|
|
939
|
+
},
|
|
940
|
+
});
|
|
941
|
+
devServers.start();
|
|
942
|
+
|
|
943
|
+
// A browser beside the chat; its pages can't reach GAIA's own backend.
|
|
944
|
+
browserPane = createBrowserPaneService({
|
|
945
|
+
ipcMain,
|
|
946
|
+
session: session.fromPartition(PANE_PARTITION),
|
|
947
|
+
shell,
|
|
948
|
+
userDataDir: app.getPath("userData"),
|
|
949
|
+
savePathFor: saveFolderFor,
|
|
950
|
+
// GAIA's backend, the bridge and GAIA's other local services: no pane page may reach any.
|
|
951
|
+
blockedPorts: appPorts,
|
|
952
|
+
devServers,
|
|
953
|
+
});
|
|
954
|
+
browserPane.attach(mainWindow);
|
|
955
|
+
|
|
956
|
+
// The agent reaches the pane through this loopback bridge, in-process or from a sidecar.
|
|
957
|
+
startPaneBridge({
|
|
958
|
+
discoveryFile: paneDiscoveryFile(),
|
|
959
|
+
handlers: createPaneBridgeHandlers({ getHost: () => browserPane.getHost(), devServers, appVersion: app.getVersion() }),
|
|
960
|
+
})
|
|
961
|
+
.then((bridge) => {
|
|
962
|
+
paneBridge = bridge;
|
|
963
|
+
})
|
|
964
|
+
.catch((err) => {
|
|
965
|
+
console.error(`[main] The browser pane bridge did not start, so the agent can't use the pane: ${err.message}`);
|
|
966
|
+
});
|
|
967
|
+
|
|
923
968
|
console.log("[main] Services initialized");
|
|
924
969
|
}
|
|
925
970
|
|
|
@@ -1060,6 +1105,7 @@ app.whenReady().then(async () => {
|
|
|
1060
1105
|
// The window, and the tray that keeps a closed one reachable, come before
|
|
1061
1106
|
// anything that can take time, so an install runs in plain sight.
|
|
1062
1107
|
titleDownloadSaveDialogs();
|
|
1108
|
+
installBackendAuth(session.defaultSession, { getPort: () => spawnedBackendPort });
|
|
1063
1109
|
// Before the window: the desktop ties a window to its launcher when it appears.
|
|
1064
1110
|
if (app.isPackaged) {
|
|
1065
1111
|
try {
|
|
@@ -1093,36 +1139,40 @@ app.whenReady().then(async () => {
|
|
|
1093
1139
|
});
|
|
1094
1140
|
|
|
1095
1141
|
// Decided before the window has a page, so a current backend never sees this screen.
|
|
1096
|
-
|
|
1142
|
+
// Dev QA mode runs GAIA_BIN's backend and never installs one.
|
|
1143
|
+
if (!devQa) showingInstallScreen = !backendInstaller.isBackendCurrent();
|
|
1097
1144
|
if (showingInstallScreen) await loadApp();
|
|
1098
1145
|
|
|
1099
|
-
//
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1146
|
+
// Both write to the user's ~/.gaia, so dev QA mode skips them.
|
|
1147
|
+
if (!devQa) {
|
|
1148
|
+
// Phase 0: seed bundled agents BEFORE the Python backend starts, so the
|
|
1149
|
+
// agent registry sees them on its first discovery pass. Failures here are
|
|
1150
|
+
// non-fatal — the app must still launch even if seeding is blocked (e.g.
|
|
1151
|
+
// permission error on ~/.gaia/agents).
|
|
1152
|
+
try {
|
|
1153
|
+
const seedResult = await agentSeeder.seedBundledAgents();
|
|
1154
|
+
if (seedResult.seeded.length > 0) {
|
|
1155
|
+
console.log("[main] Seeded agents:", seedResult.seeded);
|
|
1156
|
+
}
|
|
1157
|
+
if (seedResult.cleaned.length > 0) {
|
|
1158
|
+
console.log("[main] Cleaned legacy agents:", seedResult.cleaned);
|
|
1159
|
+
}
|
|
1160
|
+
if (seedResult.errors.length > 0) {
|
|
1161
|
+
console.warn(
|
|
1162
|
+
"[main] Agent seeding errors:",
|
|
1163
|
+
seedResult.errors.map((e) => e.id)
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
} catch (err) {
|
|
1167
|
+
console.warn("[main] Agent seeding failed (non-fatal):", err);
|
|
1116
1168
|
}
|
|
1117
|
-
} catch (err) {
|
|
1118
|
-
console.warn("[main] Agent seeding failed (non-fatal):", err);
|
|
1119
|
-
}
|
|
1120
1169
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1170
|
+
// Phase A0: kill any orphaned backend from a previous launch BEFORE the
|
|
1171
|
+
// installer runs. On Windows a live `gaia chat --ui` holds an open handle on
|
|
1172
|
+
// gaia.exe, so an upgrade's `uv pip install --refresh` fails with os error 32
|
|
1173
|
+
// unless that process is gone first (issue #1388).
|
|
1174
|
+
await cleanupOrphanedBackend();
|
|
1175
|
+
}
|
|
1126
1176
|
|
|
1127
1177
|
// Phase A: install or upgrade the Python backend behind EngineInstallScreen.
|
|
1128
1178
|
if (showingInstallScreen) {
|
|
@@ -1195,8 +1245,8 @@ app.whenReady().then(async () => {
|
|
|
1195
1245
|
if (mainWindow) await loadApp();
|
|
1196
1246
|
}
|
|
1197
1247
|
|
|
1198
|
-
// Auto-start enabled agents (T2)
|
|
1199
|
-
if (agentProcessManager) {
|
|
1248
|
+
// Auto-start enabled agents (T2); in dev QA mode the installed app owns them.
|
|
1249
|
+
if (agentProcessManager && !devQa) {
|
|
1200
1250
|
try {
|
|
1201
1251
|
await agentProcessManager.startAllEnabled();
|
|
1202
1252
|
} catch (err) {
|
|
@@ -1320,9 +1370,14 @@ async function cleanup() {
|
|
|
1320
1370
|
keepAwake = null;
|
|
1321
1371
|
}
|
|
1322
1372
|
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1373
|
+
if (paneBridge) {
|
|
1374
|
+
await paneBridge.close().catch((err) => console.error(`[main] Closing the browser pane bridge failed: ${err.message}`));
|
|
1375
|
+
paneBridge = null;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
// The install, the agents, the backend and the dev servers stop side by side: each
|
|
1379
|
+
// waits out its own grace period, and in series they could overrun the quit's time limit.
|
|
1380
|
+
await Promise.all([installStopped, stopAgentsForQuit(), stopBackendForQuit(), stopDevServersForQuit()]);
|
|
1326
1381
|
if (updating) await stopDaemonForUpdate();
|
|
1327
1382
|
|
|
1328
1383
|
// Destroy tray icon
|
|
@@ -1332,6 +1387,15 @@ async function cleanup() {
|
|
|
1332
1387
|
}
|
|
1333
1388
|
}
|
|
1334
1389
|
|
|
1390
|
+
async function stopDevServersForQuit() {
|
|
1391
|
+
if (!devServers) return;
|
|
1392
|
+
try {
|
|
1393
|
+
await devServers.stopAll();
|
|
1394
|
+
} catch (err) {
|
|
1395
|
+
console.error(`[main] Stopping dev servers failed: ${err.message}. Any left running are stopped on the next launch.`);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1335
1399
|
/**
|
|
1336
1400
|
* The daemon runs from the app's own files, which the update is about to
|
|
1337
1401
|
* replace, and macOS has no installer step that stops it first.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amd-gaia/agent-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0-rc.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"productName": "GAIA Agent UI",
|
|
6
6
|
"desktopName": "gaia-desktop.desktop",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"test:watch": "vitest",
|
|
63
63
|
"test:visual": "vite build && playwright test -c visual/playwright.config.ts",
|
|
64
64
|
"docs:shots": "vite build && playwright test -c visual/docs.playwright.config.ts",
|
|
65
|
-
"test:rtl": "vite build && playwright test -c visual/playwright.config.ts rtl --project=light",
|
|
65
|
+
"test:rtl": "vite build && playwright test -c visual/playwright.config.ts visual/rtl.visual.ts --project=light",
|
|
66
66
|
"test:scroll": "vite build && playwright test -c visual/playwright.config.ts autoscroll --project=light",
|
|
67
67
|
"gen:api-types": "node scripts/gen-api-types.mjs"
|
|
68
68
|
},
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"electron-updater": "^6.8.3"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@playwright/test": "1.65.
|
|
73
|
+
"@playwright/test": "1.65.1",
|
|
74
74
|
"@testing-library/jest-dom": "^7.0.0",
|
|
75
75
|
"@testing-library/react": "^16.1.0",
|
|
76
76
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -87,6 +87,8 @@
|
|
|
87
87
|
"react-dom": "^19.2.7",
|
|
88
88
|
"react-markdown": "^10.1.0",
|
|
89
89
|
"remark-gfm": "^4.0.1",
|
|
90
|
+
"remark-math": "^6.0.0",
|
|
91
|
+
"temml": "^0.14.0",
|
|
90
92
|
"typescript": "^7.0.2",
|
|
91
93
|
"vite": "^8.3.2",
|
|
92
94
|
"vitest": "^5.0.3",
|
package/preload.cjs
CHANGED
|
@@ -83,6 +83,34 @@ contextBridge.exposeInMainWorld("gaiaWindow", {
|
|
|
83
83
|
setColors: (colors) => ipcRenderer.invoke("window:set-titlebar-colors", colors),
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
+
// ── Browser pane ─────────────────────────────────────────────────────────
|
|
87
|
+
// Channel names match CHANNELS in services/browser-pane/ipc.cjs (a sandboxed
|
|
88
|
+
// preload can't require it). Types: services/browser-pane/contract.d.ts.
|
|
89
|
+
contextBridge.exposeInMainWorld("gaiaBrowserPane", {
|
|
90
|
+
getState: () => ipcRenderer.invoke("pane:get-state"),
|
|
91
|
+
onState: (cb) => onEvent("pane:state", cb),
|
|
92
|
+
onCommand: (cb) => onEvent("pane:command", cb),
|
|
93
|
+
setBounds: (rect) => ipcRenderer.send("pane:set-bounds", rect),
|
|
94
|
+
setView: (chat, visible) => ipcRenderer.send("pane:set-view", chat, visible),
|
|
95
|
+
claimDraft: (sessionId) => ipcRenderer.send("pane:claim-draft", sessionId),
|
|
96
|
+
forgetChat: (sessionId) => ipcRenderer.send("pane:forget-chat", sessionId),
|
|
97
|
+
setOccluded: (occluded) => ipcRenderer.invoke("pane:set-occluded", occluded),
|
|
98
|
+
openTab: (url) => ipcRenderer.invoke("pane:open-tab", url),
|
|
99
|
+
closeTab: (tabId) => ipcRenderer.invoke("pane:close-tab", tabId),
|
|
100
|
+
selectTab: (tabId) => ipcRenderer.invoke("pane:select-tab", tabId),
|
|
101
|
+
navigate: (tabId, url) => ipcRenderer.invoke("pane:navigate", tabId, url),
|
|
102
|
+
history: (tabId, action) => ipcRenderer.invoke("pane:history", tabId, action),
|
|
103
|
+
toggleDevTools: (tabId) => ipcRenderer.invoke("pane:toggle-devtools", tabId),
|
|
104
|
+
clearBrowsingData: () => ipcRenderer.invoke("pane:clear-data"),
|
|
105
|
+
openExternal: (tabId) => ipcRenderer.invoke("pane:open-external", tabId),
|
|
106
|
+
setControl: (tabId, control) => ipcRenderer.invoke("pane:set-control", tabId, control),
|
|
107
|
+
setViewport: (tabId, choice) => ipcRenderer.invoke("pane:set-viewport", tabId, choice),
|
|
108
|
+
togglePicking: () => ipcRenderer.invoke("pane:toggle-picking"),
|
|
109
|
+
onPicked: (cb) => onEvent("pane:picked", cb),
|
|
110
|
+
stopDevServer: (key) => ipcRenderer.invoke("pane:stop-dev-server", key),
|
|
111
|
+
answerDialog: (tabId, accept, text) => ipcRenderer.invoke("pane:answer-dialog", tabId, accept, text),
|
|
112
|
+
});
|
|
113
|
+
|
|
86
114
|
// ── Backend install (Phase A) ───────────────────────────────────────────
|
|
87
115
|
// EngineInstallScreen runs with no backend, so this stands apart from gaiaAPI.
|
|
88
116
|
contextBridge.exposeInMainWorld("gaiaInstall", {
|
|
@@ -147,6 +175,12 @@ contextBridge.exposeInMainWorld("gaiaUpdater", {
|
|
|
147
175
|
/** Go back to the version before the last update, and pin it. */
|
|
148
176
|
revertUpdate: () => ipcRenderer.invoke("gaia:update:revert"),
|
|
149
177
|
|
|
178
|
+
/** Setup finished on this version: remember it as the one to come back to. */
|
|
179
|
+
markSetupWorked: () => ipcRenderer.invoke("gaia:update:setup-worked"),
|
|
180
|
+
|
|
181
|
+
/** Go back to the last version setup finished on, and pin it. */
|
|
182
|
+
revertToLastWorking: () => ipcRenderer.invoke("gaia:update:revert-to-working"),
|
|
183
|
+
|
|
150
184
|
/**
|
|
151
185
|
* Resume normal auto-updates — clears the version pin set by installVersion.
|
|
152
186
|
* Resolves with the updated state.
|