Skip to content

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

Home screen names the person's own server while a frozen copy goes back to it

AdityaUmale43e2011048fb
diff --git a/electron/home-window-recovery.node-test.mjs b/electron/home-window-recovery.node-test.mjs
index cf0efeaedb..bfc97a0d25 100644
--- a/electron/home-window-recovery.node-test.mjs
+++ b/electron/home-window-recovery.node-test.mjs
@@ -23,7 +23,7 @@ test("the recovery owns the window until it settles, and a server chosen meanwhi
const leaving = world({ journal: null, marker, state: { status: "signed-out" }, url: `${LOCAL}${HOME_SCREEN_PATH}` });
leaving.reopenAnswer = false;
await leaving.home.show();
- assert.deepEqual(leaving.home.view(), { screen: "offline", reason: "Your bots are on Garage server." });
+ assert.deepEqual(leaving.home.view(), { screen: "offline", name: "Garage server", reason: "Your bots are on Garage server." });
assert.equal(leaving.timers.length, 1, "it was going to look again by itself");
leaving.url = "https://studio.example.test/";
leaving.home.cancel();
@@ -40,7 +40,7 @@ test("the recovery owns the window until it settles, and a server chosen meanwhi
await overlapped.later(OPEN_MS);
await tick();
assert.equal(settled, true, "a second show() leaves the deadline to the recovery");
- assert.deepEqual(overlapped.home.view(), { screen: "offline", reason: "Your bots are on Garage server." }, "a page that never commits is still bounded");
+ assert.deepEqual(overlapped.home.view(), { screen: "offline", name: "Garage server", reason: "Your bots are on Garage server." }, "a page that never commits is still bounded");
assert.equal(overlapped.timers.length, 1, "and looks again by itself");
await firstLook;
const replaced = world({ journal: null, marker, state: { status: "signed-out" }, url: `${LOCAL}${HOME_SCREEN_PATH}` });
diff --git a/electron/home-window.d.mts b/electron/home-window.d.mts
index 7dbbdfa5a7..8dee4626ea 100644
--- a/electron/home-window.d.mts
+++ b/electron/home-window.d.mts
@@ -1,7 +1,7 @@
/** What this computer's screen says while the window can't show the place. `reason`: the Admin's words on why My Cloud
* doesn't answer, in English; `cause`: the same as a code the page says in its own language; `machine`: a plan
* problem's state; `other`: another MausBot Cloud account is signed in; `name`: the team whose Cloud is being opened
- * (absent for My Cloud). */
+ * or the server of the person's own a frozen copy goes back to (absent for My Cloud). */
export type HomeView = { name?: string } & (
| { screen: "opening" | "waking" | "moving" }
/** The Admin is setting it up (or a brand-new one's name isn't found yet, at `checking`): the step it reports. */
diff --git a/electron/home-window.mjs b/electron/home-window.mjs
index 1407cb8f14..b42a7bb0de 100644
--- a/electron/home-window.mjs
+++ b/electron/home-window.mjs
@@ -301,7 +301,11 @@ export function createHomeWindow(deps) {
if (home.kind === "signin" && !name) return { screen: "signin" };
const own = ownMove();
if (own && MOVING.has(own.phase)) return { screen: "moving", name: own.name };
- return named({ screen: MOVING.has(parseJournal(journal())?.phase ?? "") ? "moving" : "opening" });
+ const moving = MOVING.has(parseJournal(journal())?.phase ?? "");
+ // A frozen copy's way back opens the person's own server: the screen names it, never My Cloud.
+ const parked = !moving && !name && !own && !asked && home.kind === "computer" && !home.clean ? home.frozenPlace?.place : null;
+ if (parked) return { screen: "opening", name: parked };
+ return named({ screen: moving ? "moving" : "opening" });
}
const tell = () => { try { publish(view()); } catch {} };
let splashSaid = null;
@@ -596,7 +600,7 @@ export function createHomeWindow(deps) {
timers.clear(slow);
if (!wanted(token)) return;
if (back) return;
- toScreen({ screen: "offline", reason: `Your bots are on ${parkedAt.place}.` });
+ toScreen({ screen: "offline", name: parkedAt.place, reason: `Your bots are on ${parkedAt.place}.` });
return later();
} finally { if (recovering === mine) recovering = null; }
}
@@ -793,7 +797,7 @@ export function createHomeWindow(deps) {
if (!place && parkedAt?.origin && at === parkedAt.origin) {
++opens;
if (ownMove()) tell();
- else toScreen({ screen: "offline", reason: `Your bots are on ${parkedAt.place}.` });
+ else toScreen({ screen: "offline", name: parkedAt.place, reason: `Your bots are on ${parkedAt.place}.` });
later();
return true;
}
diff --git a/electron/home-window.node-test.mjs b/electron/home-window.node-test.mjs
index 09cd15d21c..4c8e44e6fa 100644
--- a/electron/home-window.node-test.mjs
+++ b/electron/home-window.node-test.mjs
@@ -62,12 +62,12 @@ test("a frozen copy left on this computer's own page goes back to the server it
assert.equal(parked.url, `${garage}/`, "the window is on the server");
assert.deepEqual(parked.local, [], "this computer's frozen page is never shown");
assert.deepEqual(parked.calls, ["ensure"], "a window is there to open it in");
- assert.deepEqual(parked.home.view(), { screen: "opening" }, "no screen of its own while the server opens");
+ assert.deepEqual(parked.home.view(), { screen: "opening", name: "Garage server" }, "while the server opens, the screen names it, never My Cloud");
// A server forgotten here, or one that doesn't answer: the screen says where the bots are, and looks again by itself.
const forgotten = world({ journal: null, marker, state: { status: "signed-out" }, url: `${LOCAL}${HOME_SCREEN_PATH}` });
forgotten.reopenAnswer = false;
await forgotten.home.show();
- assert.deepEqual(forgotten.home.view(), { screen: "offline", reason: "Your bots are on Garage server." });
+ assert.deepEqual(forgotten.home.view(), { screen: "offline", name: "Garage server", reason: "Your bots are on Garage server." });
assert.equal(forgotten.timers.length, 1, "it looks again by itself");
// The second try lands on the server, and the next show() leaves the window there, never back on the frozen page.
forgotten.reopenAnswer = true;
@@ -95,7 +95,7 @@ test("a frozen copy left on this computer's own page goes back to the server it
const loading = world({ journal: null, marker, state: { status: "signed-out" }, url: `${LOCAL}${HOME_SCREEN_PATH}` });
await loading.home.show();
assert.equal(loading.home.failed(`${garage}/chats`, -105), true, "the way back's load failure is answered here");
- assert.deepEqual(loading.home.view(), { screen: "offline", reason: "Your bots are on Garage server." });
+ assert.deepEqual(loading.home.view(), { screen: "offline", name: "Garage server", reason: "Your bots are on Garage server." });
// A recovery whose page never commits is bounded: the screen says where the bots are, with a retry, within OPEN_MS.
const stuck = world({ journal: null, marker, state: { status: "signed-out" }, url: `${LOCAL}${HOME_SCREEN_PATH}` });
stuck.reopenGate = new Promise(() => {});
@@ -106,7 +106,7 @@ test("a frozen copy left on this computer's own page goes back to the server it
await tick();
assert.equal(back, true, "the deadline hands show() back");
await waiting;
- assert.deepEqual(stuck.home.view(), { screen: "offline", reason: "Your bots are on Garage server." }, "the screen says where they are");
+ assert.deepEqual(stuck.home.view(), { screen: "offline", name: "Garage server", reason: "Your bots are on Garage server." }, "the screen says where they are");
assert.equal(stuck.timers.length, 1, "and looks again by itself");
// A move still under way is that screen's to say, not this one's.
const moving = world({ journal: null, marker, state: { status: "signed-out" }, ownMove: { phase: "final", name: "Garage server" }, url: `${LOCAL}${HOME_SCREEN_PATH}` });