Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 30 additions & 0 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,36 @@
"import": "./dist/services/app-session-gate.js",
"default": "./dist/services/app-session-gate.js"
},
"./services/permissions/probers/index": {
"types": "./src/services/permissions/probers/index.d.ts",
"eliza-source": {
"types": "./src/services/permissions/probers/index.ts",
"import": "./src/services/permissions/probers/index.ts",
"default": "./src/services/permissions/probers/index.ts"
},
"bun": {
"types": "./src/services/permissions/probers/index.ts",
"import": "./src/services/permissions/probers/index.ts",
"default": "./src/services/permissions/probers/index.ts"
},
"import": "./dist/services/permissions/probers/index.js",
"default": "./dist/services/permissions/probers/index.js"
},
"./services/permissions/probers/*": {
"types": "./src/services/permissions/probers/*.d.ts",
"eliza-source": {
"types": "./src/services/permissions/probers/*.ts",
"import": "./src/services/permissions/probers/*.ts",
"default": "./src/services/permissions/probers/*.ts"
},
"bun": {
"types": "./src/services/permissions/probers/*.ts",
"import": "./src/services/permissions/probers/*.ts",
"default": "./src/services/permissions/probers/*.ts"
},
"import": "./dist/services/permissions/probers/*.js",
"default": "./dist/services/permissions/probers/*.js"
},
"./security/*": {
"types": "./src/security/*.d.ts",
"eliza-source": {
Expand Down
20 changes: 19 additions & 1 deletion packages/app-core/platforms/electrobun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,25 @@
}
});

win.on("close", () => {
win.on("close", (event: unknown) => {
if (!isQuitting && process.env.ELIZAOS_CLOSE_MINIMIZES_TO_TRAY !== "0") {
const closeEvent = event as { preventDefault?: () => void } | undefined;
if (typeof closeEvent?.preventDefault === "function") {
closeEvent.preventDefault();
void getDesktopManager().hideWindow().catch((err: unknown) => {
logger.warn(
`[Main] Failed to minimize window on close: ${err instanceof Error ? err.message : String(err)}`,
);
});
logger.info("[Main] Window close requested - minimized to tray");
showBackgroundRunNoticeOnce();
return;
}
logger.info(
"[Main] Window close requested - agent continues in background",
);
}

if (currentWindow?.id === win.id) {
currentWindow = null;
currentSendToWebview = null;
Expand Down Expand Up @@ -1607,147 +1625,147 @@
void runUpdateCheck(true);
};

const handleApplicationMenuAction = async (
action: string | undefined,
): Promise<void> => {
if (!currentWindow && shouldRestoreWindowBeforeMenuAction(action)) {
await restoreWindow();
}
if (action === "check-for-updates") {
triggerManualUpdateCheck();
} else if (action === "open-about") {
const updaterState = await getDesktopManager().getUpdaterState();
const version = updaterState.currentVersion || "unknown";
Utils.showNotification({
title: `About ${BRAND.appName}`,
body: `Version ${version} (${process.platform}/${process.arch})`,
});
void createSettingsWindow("updates");
} else if (action === "export-config") {
void exportConfigFromMenu();
} else if (action === "import-config") {
void importConfigFromMenu();
} else if (action === "toggle-devtools") {
toggleFocusedWindowDevTools();
} else if (action === "relaunch") {
void getDesktopManager().relaunch();
} else if (action === "reset-app") {
void resetTheAppFromApplicationMenu();
} else if (action === "open-secrets-manager") {
// The Secrets Storage modal lives in the renderer. Make sure
// the main window is visible, then notify the renderer to
// show the modal. The keyboard accelerator
// (⌘⌥⌃V on Mac / Ctrl+Alt+Shift+V on Win/Linux) flows
// through this same path; the renderer's `keydown` listener
// also dispatches the same toggle directly when a Eliza
// window is already focused.
void restoreWindow();
sendToActiveRenderer("openSecretsManager", {});
} else if (
action === "open-settings" ||
action?.startsWith("open-settings-")
) {
void createSettingsWindow(parseSettingsWindowAction(action));
} else if (action?.startsWith("new-window:")) {
const surface = action.slice("new-window:".length);
if (surfaceWindowManager && isDetachedSurface(surface)) {
void surfaceWindowManager.openSurfaceWindow(surface);
}
} else if (action?.startsWith("focus-window:")) {
const windowId = action.slice("focus-window:".length);
surfaceWindowManager?.focusWindow(windowId);
} else if (action?.startsWith("show-main:")) {
const surface = action.slice("show-main:".length);
showMainSurface(surface);
} else if (action === "focus-main-window") {
void getDesktopManager().focusWindow();
} else if (action === "hide-main-window") {
void getDesktopManager().hideWindow();
} else if (action === "maximize-main-window") {
void getDesktopManager().maximizeWindow();
} else if (action === "restore-main-window") {
void getDesktopManager().unmaximizeWindow();
} else if (action === "desktop-notify") {
void getDesktopManager().showNotification({
title: `${BRAND.appName} Desktop`,
body: `${BRAND.appName} native application menu actions are wired and responding.`,
urgency: "normal",
});
} else if (action === "restart-steward") {
if (isStewardLocalEnabled()) {
restartSteward().catch((err: unknown) => {
logger.error(
`[Main] Steward restart failed: ${err instanceof Error ? err.message : String(err)}`,
);
Utils.showNotification({
title: "Steward Restart Failed",
body: err instanceof Error ? err.message : "Unknown error",
});
});
}
} else if (action === "reset-steward") {
if (isStewardLocalEnabled()) {
resetSteward().catch((err: unknown) => {
logger.error(
`[Main] Steward reset failed: ${err instanceof Error ? err.message : String(err)}`,
);
Utils.showNotification({
title: "Steward Reset Failed",
body: err instanceof Error ? err.message : "Unknown error",
});
});
}
} else if (
action?.startsWith("apps:") ||
action?.startsWith("tray-app-")
) {
// Both shapes resolve to the same flow:
// 1. Look up the app entry by slug.
// 2. If the app declares hasDetailsPage, focus the main window
// and tell the renderer to navigate to /apps/<slug>/details
// (where the user can review config + click Launch).
// 3. Otherwise, open or focus its dedicated native window
// directly (zero-config viewers / overlays).
// WHY two prefixes: `apps:<slug>` is what `buildAppsMenu` emits
// for the OS menu bar; `tray-app-<slug>` is what the tray icons
// emit. Both arrive here.
const slug = action.startsWith("apps:")
? action.slice("apps:".length)
: action.slice("tray-app-".length);
const entry = findAppMenuEntryBySlug(slug);
if (entry) {
if (entry.hasDetailsPage) {
// Restore main window first so the renderer route is visible.
void restoreWindow();
sendToActiveRenderer("desktopAppDetailsRequested", {
slug: entry.slug,
});
} else {
void getDesktopManager().openAppWindow({
slug: entry.slug,
title: entry.displayName,
path: entry.windowPath,
alwaysOnTop: false,
});
}
}
} else if (action === "restart-agent") {
getAgentManager()
.restart()
.catch((err: unknown) => {
logger.error(
`[Main] Agent restart failed: ${err instanceof Error ? err.message : String(err)}`,
);
});
} else if (action === "quit") {
void getDesktopManager().quit();
} else if (action === "show") {
void getDesktopManager().showWindow();
} else if (action?.startsWith("navigate-")) {
void getDesktopManager().showWindow();
sendToActiveRenderer("desktopTrayMenuClick", { itemId: action });
}
};

Check notice on line 1768 in packages/app-core/platforms/electrobun/src/index.ts

View check run for this annotation

codefactor.io / CodeFactor

packages/app-core/platforms/electrobun/src/index.ts#L1628-L1768

Complex Method

setApplicationMenuActionHandler(handleApplicationMenuAction);

Expand Down
4 changes: 4 additions & 0 deletions packages/app-core/platforms/electrobun/src/native/desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,10 @@ X-GNOME-Autostart-enabled=true
}

async closeWindow(): Promise<void> {
if (process.env.ELIZAOS_CLOSE_MINIMIZES_TO_TRAY !== "0") {
await this.hideWindow();
return;
}
this.getWindow()?.close();
}

Expand Down
27 changes: 0 additions & 27 deletions packages/os/linux/.editorconfig

This file was deleted.

100 changes: 0 additions & 100 deletions packages/os/linux/.github/workflows/ci.yml

This file was deleted.

151 changes: 0 additions & 151 deletions packages/os/linux/.gitignore

This file was deleted.

Loading
Loading