Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Settings: keep the computer name editor once a device is paired
aivsomkarced2692fe22e
diff --git a/src/components/ServerPairingCard.computerName.dom.test.ts b/src/components/ServerPairingCard.computerName.dom.test.tsnew file mode 100644index 0000000000..c4e4953596--- /dev/null+++ b/src/components/ServerPairingCard.computerName.dom.test.ts@@ -0,0 +1,45 @@+// @vitest-environment happy-dom+import { createElement } from "react";+import { flushSync } from "react-dom";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, expect, it, vi } from "vitest";++import { setLocale } from "@/lib/i18n";++const sessions = vi.hoisted(() => ({ list: [] as unknown[] }));+vi.mock("@/state/store", () => ({+ api: async (path: string) => path === "/api/config"+ ? { computerName: "Studio" }+ : { sessions: sessions.list, current: null },+}));+vi.mock("../lib/session", async (original) => ({+ ...await original<typeof import("../lib/session")>(),+ readSessionState: async () => ({ kind: "loopback" }),+}));+const { ServerPairingCard } = await import("./ServerPairingCard");++let host: HTMLDivElement;+let root: Root;+beforeEach(() => {+ setLocale("en");+ host = document.createElement("div");+ document.body.append(host);+ root = createRoot(host);+});+afterEach(() => {+ flushSync(() => root.unmount());+ host.remove();+});++const phone = { id: "a", label: "Ada's phone", scopes: ["client"], lastSeenAt: 0, expiresAt: 1 };++it.each([+ ["nothing is paired", []],+ ["a device is paired", [phone]],+])("lets the owner rename the computer when %s", async (_, list) => {+ sessions.list = list;+ flushSync(() => root.render(createElement(ServerPairingCard)));+ await vi.waitFor(() => expect(host.querySelector("[data-phone-pairing-action]")).not.toBeNull());+ if (list.length) await vi.waitFor(() => expect(host.querySelector("[data-paired-device]")).not.toBeNull());+ await vi.waitFor(() => expect(host.querySelector("[data-computer-name]")).not.toBeNull());+});diff --git a/src/components/ServerPairingCard.tsx b/src/components/ServerPairingCard.tsxindex 4065ff8d1c..63611e9b9a 100644--- a/src/components/ServerPairingCard.tsx+++ b/src/components/ServerPairingCard.tsx@@ -217,6 +217,8 @@ export function ServerPairingCard({ initialSession = null, initialPairingCodes =<option value="client">{t("remote.serverPairing.scope.client")}</option></Select>) : null;+ const nameRow = !simple && pairingCodes && !cloudHome && computerName !== null+ ? <SettingsRows><ComputerNameRow saved={computerName} onSaved={setComputerName} className="px-4 py-3" /></SettingsRows> : null;const pairRow = (<PairRow reason={pairingCodes ? null : t("remote.serverPairing.portalShort")}>{choices}{pairButton}@@ -229,7 +231,7 @@ export function ServerPairingCard({ initialSession = null, initialPairingCodes ={listed.length === 0 ? (<SettingsGroup block="pair"><SettingsRows>{pairRow}</SettingsRows>- {!simple && pairingCodes && !cloudHome && computerName !== null && <SettingsRows><ComputerNameRow saved={computerName} onSaved={setComputerName} className="px-4 py-3" /></SettingsRows>}+ {nameRow}{!pairingCodes && <p data-server-pairing-portal className="px-4 text-[12px] leading-4 text-ink-secondary">{t("remote.serverPairing.portal")}</p>}</SettingsGroup>) : (@@ -250,6 +252,7 @@ export function ServerPairingCard({ initialSession = null, initialPairingCodes =</div>))}</SettingsRows>+ {nameRow}{!pairingCodes && <p data-server-pairing-portal className="px-4 text-[12px] leading-4 text-ink-secondary">{t("remote.serverPairing.portal")}</p>}</SettingsGroup>)}