Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Draft Works on tiles say what stands in the way
Kevincedb7536d25d
diff --git a/src/components/WorksOnGrid.tsx b/src/components/WorksOnGrid.tsxindex 2b5060af43..a8c0de8021 100644--- a/src/components/WorksOnGrid.tsx+++ b/src/components/WorksOnGrid.tsx@@ -32,6 +32,7 @@ export interface WorksOnOption {managedBy?: string;disabled: boolean;unavailableTitle?: string;+ note?: string;issue: boolean;view: PlaceView;}@@ -39,7 +40,7 @@ export interface WorksOnOption {export function WorksOnGrid({ options, onSelect }: { options: readonly WorksOnOption[]; onSelect: (mode: WorksOnMode) => void }) {return (<div role="group" aria-label={t("computer.destinationAria")} className="mt-3 grid auto-rows-fr grid-cols-2 gap-2">- {options.map(({ mode, labelKey, descriptionKey, Icon, selected, managedBy, disabled, unavailableTitle, issue, view }) => (+ {options.map(({ mode, labelKey, descriptionKey, Icon, selected, managedBy, disabled, unavailableTitle, note, issue, view }) => (<buttonkey={mode ?? "auto"}disabled={disabled}@@ -62,7 +63,7 @@ export function WorksOnGrid({ options, onSelect }: { options: readonly WorksOnOp<span>{t(labelKey)}</span></span><span className="mt-1.5 block text-[11px] leading-4 text-ink-secondary">- {managedBy ?? (disabled ? view.line : issue ? view.short : t(descriptionKey))}+ {managedBy ?? note ?? (disabled ? view.line : issue ? view.short : t(descriptionKey))}</span></button>))}diff --git a/src/components/bot-settings/AccessSection.test.ts b/src/components/bot-settings/AccessSection.test.tsindex bb23427783..9846d43927 100644--- a/src/components/bot-settings/AccessSection.test.ts+++ b/src/components/bot-settings/AccessSection.test.ts@@ -11,11 +11,13 @@ const fixture = vi.hoisted(() => ({mcpError: false,servers: null as null | Array<{ name: string; enabled: boolean }>,config: null as unknown,+ instances: [] as unknown[],+ capabilities: { host: { homeDir: undefined } as { homeDir: undefined; platform?: string }, localComputer: { available: false, reasonCode: "unsupported" } },apps: { phase: "loading", apps: [], connectedSlugs: [] } as import("./useBotApps").BotApps,}));vi.mock("@/state/store", async (importOriginal) => {const original = await importOriginal<typeof import("@/state/store")>();- return { ...original, useStore: () => ({ state: { ...original.initialState, config: fixture.config ?? original.initialState.config }, dispatch: fixture.dispatch }) };+ return { ...original, useStore: () => ({ state: { ...original.initialState, config: fixture.config ?? original.initialState.config, instances: fixture.instances as typeof original.initialState.instances }, dispatch: fixture.dispatch }) };});// The connected-apps list (Composio accounts plus the native HighLevel connection) is seeded per test.vi.mock("./useBotApps", async (importOriginal) => ({@@ -29,7 +31,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 }, localComputer: { available: false, reasonCode: "unsupported" } } }),+ useDesktopCapabilities: () => ({ capabilities: fixture.capabilities }),}));const { AccessSection } = await import("./AccessSection");@@ -41,6 +43,8 @@ beforeEach(() => {fixture.mcpError = false;fixture.servers = null;fixture.config = null;+ fixture.instances = [];+ fixture.capabilities.host = { homeDir: undefined };fixture.apps = { phase: "loading", apps: [], connectedSlugs: [] };});afterEach(() => vi.unstubAllGlobals());@@ -245,6 +249,30 @@ describe("AccessSection Works on", () => {expect(vi.mocked(derived.patch).mock.calls).toEqual([[{ computer: "browser", browser: true }], [{ computer: null }]]);});+ it("says on a selectable tile of a bot not made yet what stands in its way, with no name to borrow", () => {+ fixture.config = { box: { configured: true } } as Partial<ConfigStatus>;+ fixture.instances = [{ instanceId: "local", capabilities: { computerMcp: true } }];+ fixture.capabilities.host = { homeDir: undefined, platform: "darwin" };+ let tree!: ReturnType<typeof AccessSection>;+ function Capture() { tree = AccessSection({ bot, derived: makeDerived() }); return tree; }+ const bot = makeBot({ name: "", toolScope: { deny: ["mcp:computer:*"] } } as Partial<Bot>);+ renderToStaticMarkup(createElement(StoreProvider, null, createElement(BotEditorContext.Provider, { value: { request: api, draft: true } }, createElement(Capture))));+ const picker = nodes(tree).find((node) => (node.type as { name?: string }).name === "DraftWorksOn")!;+ let rendered: ReactNode = null;+ function Picker() { rendered = (picker.type as (props: unknown) => ReactNode)(picker.props); return rendered; }+ renderToStaticMarkup(createElement(StoreProvider, null, createElement(Picker)));+ const grid = nodes(rendered).find((node) => (node.type as { name?: string }).name === "WorksOnGrid")!;+ const options = grid.props.options as Array<{ mode: string | null; disabled: boolean; note?: string }>;+ const of = (mode: string) => options.find((option) => option.mode === mode)!;+ expect(of("cloud")).toMatchObject({ disabled: false, note: "What New bot can use doesn't include a desktop." });+ expect(of("local").disabled).toBe(false);+ expect(of("local").note).toBeTruthy();+ const html = renderToStaticMarkup(grid).replaceAll("'", "'").replaceAll("&", "&");+ expect(html).toContain(of("cloud").note);+ expect(html).toContain(of("local").note);+ });++it("hides the Boat or VPS choice on My Cloud, whose cloud computers are the plan's", () => {expect(render(makeBot())).toContain("Cloud backend");fixture.config = { cloudHome: true } as Partial<ConfigStatus>;diff --git a/src/components/bot-settings/AccessSection.tsx b/src/components/bot-settings/AccessSection.tsxindex 3fbb219266..8842e1d404 100644--- a/src/components/bot-settings/AccessSection.tsx+++ b/src/components/bot-settings/AccessSection.tsx@@ -640,12 +640,14 @@ function DraftWorksOn({ bot, patch, seat }: { bot: Bot; patch: ReturnType<typeofconst { state } = useStore();const { capabilities } = useDesktopCapabilities();const providerSupportsLocal = instanceSupportsLocalComputer(state.instances, bot);+ const localReason = localComputerDisabledReason({ capabilities, providerSupportsLocal });+ const named = { ...bot, name: bot.name || t("sidebar.newBotSimple") };const options = WORKS_ON_CHOICES.filter(([mode]) => mode === null || mode === "off" || placeOffered(mode, state.config)).map(([mode, labelKey, descriptionKey, Icon]) => {const view = placeViewFor(placeFacts({- bot, place: mode ?? "auto", seat, config: state.config, instances: state.instances,+ bot: named, place: mode ?? "auto", seat, config: state.config, instances: state.instances,local: {ready: localComputerSelectable({ capabilities, providerSupportsLocal }),- reason: localComputerDisabledReason({ capabilities, providerSupportsLocal }) ?? t("computer.unavailableLocal"),+ reason: localReason ?? t("computer.unavailableLocal"),},}));const managedBy = placeManagedBy(mode, bot.cloudBackend, state.config?.managedPolicy);@@ -654,6 +656,7 @@ function DraftWorksOn({ bot, patch, seat }: { bot: Bot; patch: ReturnType<typeofselected: mode === null ? !bot.computer : bot.computer === mode,disabled: Boolean(managedBy) || placeBlocked(view),issue: !managedBy && placeHasIssue(view),+ note: placeHasIssue(view) ? view.line : mode === "local" ? localReason ?? undefined : undefined,};});const choose = (mode: WorksOnMode) => patch(mode === "browser" ? { computer: mode, browser: true } : { computer: mode });