Skip to content

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

Merge main (the clean workspace and the identity fix, now merged)

milind-soni13f194bae115
diff --cc electron/cloud-rail.mjs
index c5b1fc66bd,8ebcb6a8d8..06b88eb4b3
--- a/electron/cloud-rail.mjs
+++ b/electron/cloud-rail.mjs
@@@ -162,18 -159,10 +162,20 @@@ export function installCloudRail({ ipcM
ipcMain.handle("workspaces:places", guard((event) => (lists(event) ? { places: places().map(seen), add: choices() }
: { places: [], add: { cloud: false, link: false, address: false, organization: false }, ...(beside() ? { beside: true } : {}) })));
// A Cloud the Admin is still making has no saved place: its own screen opens, by main's word for which Cloud it is.
+ const opening = place => (place.id.startsWith(PENDING) ? openCloud(place.cloudId) : open(place.id));
+ // A place of another account: that account becomes the one in use first, and nothing moves if it can't. By then the place is
+ // listed as that account's own; an account with no place of its own is simply where the window goes.
- listed("workspaces:open", async (_event, id) => {
- const place = places().find(entry => entry.id === plain(id) && entry.opens);
- if (!place) throw new Error("That place isn't here any more.");
- if (!place.account) return opening(place);
++ const switchingTo = async place => {
+ const said = await switchAccount(place.account);
+ if (said.outcome !== "switched") return { outcome: said.outcome, ...(said.email ? { email: said.email } : {}) };
+ const arrived = places().find(entry => entry.id === place.id && entry.opens && !entry.account);
+ if (arrived) await opening(arrived);
+ return { outcome: "switched" };
++ };
+ listed("workspaces:open", (_event, id) => {
+ const place = places().find(entry => entry.id === plain(id) && entry.opens);
+ if (!place) throw new Error("That place isn't here any more.");
- return place.id.startsWith(PENDING) ? openCloud(place.cloudId) : open(place.id);
++ return place.account ? switchingTo(place) : opening(place);
});
// Remove from list, from a circle's menu (the page asked the person first): only a Cloud or a server saved by hand that
// main listed as removable. A server is forgotten here; a Cloud is taken off the person's list at the Admin.
diff --cc electron/home-window-clean.node-test.mjs
index 1fa2c21102,1fa2c21102..a1bf2e3776
--- a/electron/home-window-clean.node-test.mjs
+++ b/electron/home-window-clean.node-test.mjs
@@@ -130,18 -130,18 +130,23 @@@ test("signed out with a place remembere
assert.deepEqual(w.went, []);
});
--test("from the clean workspace, this account's own Clouds open as they do for anyone: My Cloud, and another of its own", async () => {
-- const mine = { ...other(), machine: { status: "ready", origin: CLIENT }, clouds: [{ ...CLIENT_A, id: "own", primary: true }, { ...CLIENT_A, id: "c-b", origin: "https://omb-c-b.fly.dev", name: "Client B" }] };
++test("another account with a Cloud of its own: that Cloud opens, with no clean workspace, and the frozen copy stays frozen", async () => {
++ const clean = cleanSide(), w = world({ clean, state: { ...other(), machine: { status: "ready", origin: CLIENT } } });
++ await w.home.show();
++ assert.equal(clean.enters, 0);
++ assert.equal(w.home.current().origin, CLIENT);
++ assert.equal(w.went.at(-1)?.[1], CLIENT);
++});
++
++test("from the clean workspace, another Cloud of this account's own, or a team, opens as for anyone, and the frozen copy stays stopped", async () => {
++ const mine = { ...other(), machine: null, clouds: [{ ...CLIENT_A, id: "c-b", primary: false }] };
const clean = cleanSide(), w = world({ clean, state: mine });
await w.home.show();
assert.equal(clean.enters, 1);
-- await w.home.openCloud();
-- assert.equal(w.went.at(-1)?.[1], CLIENT, "its My Cloud");
-- assert.equal(clean.on, true, "the frozen copy stays stopped");
-- assert.equal(clean.leaves, 0);
await w.home.show({ place: { cloud: "c-b" } });
-- assert.equal(w.went.at(-1)?.[1], "https://omb-c-b.fly.dev");
++ assert.equal(w.went.at(-1)?.[1], CLIENT);
assert.equal(clean.on, true);
++ assert.equal(clean.leaves, 0);
});
test("the Sign in that switches account ends this sign-in first, as the screen's did", async () => {