Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(desktop): move the mutation-token post out of main.mjs

koeria1daf178d9108
diff --git a/electron/desktop-mutation-token.mjs b/electron/desktop-mutation-token.mjs
new file mode 100644
index 0000000000..ff786a51f5
--- /dev/null
+++ b/electron/desktop-mutation-token.mjs
@@ -0,0 +1,11 @@
+export function postDesktopMutationToken(proc, token, companionToken, slog) {
+ try {
+ proc.postMessage({
+ type: "openmausbot:desktop-mutation-token",
+ token,
+ companionToken,
+ });
+ } catch (error) {
+ slog(`desktop mutation capability sync failed: ${error?.message ?? error}`);
+ }
+}
diff --git a/electron/main.mjs b/electron/main.mjs
index 1b02913a0a..b33c4d1224 100644
--- a/electron/main.mjs
+++ b/electron/main.mjs
@@ -27,7 +27,7 @@ import { evictStartupCacheOnce } from "./startup-cache-eviction.mjs";
import { activateExistingWindow, releaseSingleInstanceLock } from "./single-instance.mjs";
import { bootFailureMessage, listeningSignal, pollServerIdentity, SERVER_BOOT_TIMEOUT_MS, SERVER_LISTENING_GRACE_MS } from "./server-boot-probe.mjs";
import { createServerSupervisor } from "./server-supervisor.mjs";
-import { serverChildLaunch } from "./server-child-launch.mjs";
+import { serverChildLaunch } from "./server-child-launch.mjs"; import { postDesktopMutationToken } from "./desktop-mutation-token.mjs";
import { packageUrlFromCommandLine, packageUrlFromDeepLink } from "./package-link.mjs";
import { chatLinkFrom, chatLinkFromCommandLine } from "./chat-link.mjs"; import { installDesktopNotifications } from "./desktop-notifications.mjs";
import { createOrganizationEntry, isOrganizationDeepLink, takeOrganizationDeepLink, organizationRestartIntent, withOrganizationRestartIntent, withoutOrganizationRestartIntent } from "./organization-entry.mjs";
@@ -1074,15 +1074,7 @@ async function runCompanyBackup(kind, input, scheduled = null) {
}
function syncDesktopMutationToken(proc) {
- try {
- proc.postMessage({
- type: "openmausbot:desktop-mutation-token",
- token: desktopMutationToken,
- companionToken: companionMutationToken,
- });
- } catch (error) {
- slog(`desktop mutation capability sync failed: ${error?.message ?? error}`);
- }
+ postDesktopMutationToken(proc, desktopMutationToken, companionMutationToken, slog);
}
const savePhoneSecretOnce = createPhoneSecretSaveCoordinator((target, value) =>