Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(computer): don't name this computer in Auto's line on a remote server's page
jimina70c3e17cbb4
diff --git a/shared/place-view.ts b/shared/place-view.tsindex 3d3ac0c7c8..dc2cf04730 100644--- a/shared/place-view.ts+++ b/shared/place-view.ts@@ -71,7 +71,7 @@ export interface PlaceView {}/** Where this server runs, as the Auto line describes it. */-export type ServerKind = "my-cloud" | "mac" | "pc" | "linux";+export type ServerKind = "my-cloud" | "mac" | "pc" | "linux" | "remote";/** The facts a place's state is read from. */export interface PlaceFacts {@@ -358,7 +358,7 @@ function sourceAction(source: PlaceSource, state: PlaceState): PlaceActionId | nfunction lineKey(state: PlaceState, params: PlaceParams, server?: ServerKind): PlaceKey {const segment = STATE[state].key;if (state === "auto") {- return server === "my-cloud" ? "place.view.auto.lineMyCloud" : server === "linux" ? "place.view.auto.lineLinux" : "place.view.auto.lineDesktop";+ return server === "my-cloud" ? "place.view.auto.lineMyCloud" : server === "linux" || server === "remote" ? "place.view.auto.lineLinux" : "place.view.auto.lineDesktop";}if (state === "cc-sign-in" && server === "my-cloud") return "place.view.ccSignIn.lineMyCloud";// A refusal read from a code alone has no numbers or names to give.diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsxindex 58a0554afa..453deecd00 100644--- a/src/components/ChatView.tsx+++ b/src/components/ChatView.tsx@@ -254,7 +254,7 @@ function PlaceFailedRow({ place, botId, threadId, onRetry }: {}) {const { state, dispatch } = useStore();const { capabilities } = useDesktopCapabilities();- const seat = usePlaceSeat(state.config, capabilities.host.platform);+ const seat = usePlaceSeat(state.config, capabilities);const bot = state.bots.find((candidate) => candidate.id === botId);const view = placeRowViewFor(place, seat, worksOnSimpleLabel(bot?.computer, capabilities.host.platform));const id = view.action?.id;diff --git a/src/components/ComputerPanel.simple.test.ts b/src/components/ComputerPanel.simple.test.tsindex 4158d36fab..9ad802f80d 100644--- a/src/components/ComputerPanel.simple.test.ts+++ b/src/components/ComputerPanel.simple.test.ts@@ -377,7 +377,9 @@ describe("Where the bot works", () => {it("leaves This Mac out on another server's page, where this computer can never be a bot's place", () => {fixture.localComputer = { available: false, support: "unsupported", enabled: false, status: "unavailable", reasonCode: "remote-server" };- expect(grid(render(makeBot())).map((node) => text(node.props.children))).toEqual(["Auto", "Cloud desktop", "Private desktop", "Browser", "Off"]);+ const rendered = render(makeBot());+ expect(grid(rendered).map((node) => text(node.props.children))).toEqual(["Auto", "Cloud desktop", "Private desktop", "Browser", "Off"]);+ expect(placeLine(rendered)).toBe("Uses the built-in browser, or a running private desktop when a task needs one.");});it("shows a bot set to This Mac as Auto on another server's page, without changing its setting", () => {diff --git a/src/components/ComputerPanel.tsx b/src/components/ComputerPanel.tsxindex e74d85d7eb..22bce83be3 100644--- a/src/components/ComputerPanel.tsx+++ b/src/components/ComputerPanel.tsx@@ -160,7 +160,7 @@ export function ComputerPanel({const localSelectable = placeOffered("local", state.config) && localComputerSelectable({ capabilities, providerSupportsLocal });const [localAutoWarningTarget, setLocalAutoWarningTarget] = useState<string | null>(null);const localDisabledReason = localComputerDisabledReason({ capabilities, providerSupportsLocal });- const placeSeat = usePlaceSeat(state.config, capabilities.host.platform);+ const placeSeat = usePlaceSeat(state.config, capabilities);const [phase, setPhase] = useState<Phase>("checking");const [persistedComputerSelection, setPersistedComputerSelection] = useState<{botId: string;diff --git a/src/components/PlaceChip.tsx b/src/components/PlaceChip.tsxindex 9717de470a..70a87e663e 100644--- a/src/components/PlaceChip.tsx+++ b/src/components/PlaceChip.tsx@@ -18,7 +18,7 @@ export type PlaceAvailability = Record<Place, boolean>;export function usePlaceViews(bot: Bot): Record<Place, { view: PlaceView; reachable: boolean; policy: boolean; listed: boolean }> {const { state } = useStore();const { capabilities } = useDesktopCapabilities();- const seat = usePlaceSeat(state.config, capabilities.host.platform);+ const seat = usePlaceSeat(state.config, capabilities);const backend = bot.cloudBackend === "vps" ? "vps" : "box";const allowed = state.config?.managedPolicy?.computers ?? { thisComputer: true, localVm: true, box: true, vps: true };const providerSupportsLocal = instanceSupportsLocalComputer(state.instances, bot);diff --git a/src/components/bot-settings/AccessSection.test.ts b/src/components/bot-settings/AccessSection.test.tsindex a1110497df..6c591ad8f2 100644--- a/src/components/bot-settings/AccessSection.test.ts+++ b/src/components/bot-settings/AccessSection.test.ts@@ -28,7 +28,7 @@ vi.mock("@/lib/mcp-servers", async (importOriginal) => ({// DesktopCapabilities reads window.ogb at module scope, and this suite runs in the node environment.vi.mock("../DesktopCapabilities", () => ({- useDesktopCapabilities: () => ({ capabilities: { host: { homeDir: undefined } } }),+ useDesktopCapabilities: () => ({ capabilities: { host: { homeDir: undefined }, localComputer: {} } }),}));const { AccessSection } = await import("./AccessSection");diff --git a/src/components/bot-settings/AccessSection.tsx b/src/components/bot-settings/AccessSection.tsxindex df0a0d7a4e..0c5c1f3897 100644--- a/src/components/bot-settings/AccessSection.tsx+++ b/src/components/bot-settings/AccessSection.tsx@@ -660,7 +660,7 @@ export function AccessSection({} = derived;const browserInstallable = state.config?.browserEngine?.installable === true;const { capabilities } = useDesktopCapabilities();- const placeSeat = usePlaceSeat(state.config, capabilities.host?.platform ?? "other");+ const placeSeat = usePlaceSeat(state.config, capabilities);const worksOn = placeViewFor(placeFacts({bot, place: bot.computer ?? "auto", seat: placeSeat, config: state.config, instances: state.instances,}));diff --git a/src/components/bot-settings/ProposalStatus.test.ts b/src/components/bot-settings/ProposalStatus.test.tsindex 80ce5afe33..ca595ec2c0 100644--- a/src/components/bot-settings/ProposalStatus.test.ts+++ b/src/components/bot-settings/ProposalStatus.test.ts@@ -11,7 +11,7 @@ vi.mock("@/state/store", async (importOriginal) => {return { ...original, useStore: () => ({ state: { ...original.initialState, bots: fixture.bots }, dispatch: vi.fn() }) };});vi.mock("../DesktopCapabilities", () => ({- useDesktopCapabilities: () => ({ capabilities: { host: { homeDir: undefined } } }),+ useDesktopCapabilities: () => ({ capabilities: { host: { homeDir: undefined }, localComputer: {} } }),}));vi.mock("@/lib/mcp-servers", async (importOriginal) => ({...await importOriginal<typeof import("@/lib/mcp-servers")>(),diff --git a/src/lib/place-view.ts b/src/lib/place-view.tsindex 2f51b1d68b..cb5b552979 100644--- a/src/lib/place-view.ts+++ b/src/lib/place-view.ts@@ -6,6 +6,7 @@ import { engineSignedOut } from "@/lib/failed-turn";import { browserAvailable, builtInBrowserEnabled, type FeatureFlagConfig } from "@/lib/feature-flags";import { writeComputerPanelView } from "@/lib/computer-panel-view";import { useAdvancedMode } from "@/lib/interface-mode";+import { pageOnRemoteServer } from "@/lib/local-computer";import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";import { openBotSettings } from "@/components/bot-panel/panel-link";import { openKeySettings } from "@/components/keys/key-focus";@@ -25,8 +26,10 @@ export interface PlaceSeat {mode: "simple" | "advanced";}-export function serverKind(config: Pick<ConfigStatus, "cloudHome"> | null | undefined, platform: DesktopCapabilities["host"]["platform"]): ServerKind {+export function serverKind(config: Pick<ConfigStatus, "cloudHome"> | null | undefined, capabilities: DesktopCapabilities): ServerKind {if (config?.cloudHome) return "my-cloud";+ if (pageOnRemoteServer(capabilities)) return "remote";+ const { platform } = capabilities.host;return platform === "darwin" ? "mac" : platform === "win32" ? "pc" : "linux";}@@ -103,11 +106,11 @@ export function useCloudPlanPaid(): boolean {return Boolean(bridge) && cloudPlanView(account).kind === "paid";}-export function usePlaceSeat(config: Pick<ConfigStatus, "cloudHome"> | null | undefined, platform: DesktopCapabilities["host"]["platform"]): PlaceSeat {+export function usePlaceSeat(config: Pick<ConfigStatus, "cloudHome"> | null | undefined, capabilities: DesktopCapabilities): PlaceSeat {const plan = useCloudPlanPaid();const ownerOrAdmin = useOwnerOrAdmin();const advanced = useAdvancedMode();- return { server: serverKind(config, platform), plan, role: ownerOrAdmin === false ? "user" : "admin", mode: advanced ? "advanced" : "simple" };+ return { server: serverKind(config, capabilities), plan, role: ownerOrAdmin === false ? "user" : "admin", mode: advanced ? "advanced" : "simple" };}export function openPlaceAction(