Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Sandbox switch: keep an enabled one while the app list is unknown, hide it from editors, pt-BR words
AdityaUmalef697f069a1c0
diff --git a/src/components/bot-settings/AccessSection.test.ts b/src/components/bot-settings/AccessSection.test.tsindex 746c9aed00..f963a42850 100644--- a/src/components/bot-settings/AccessSection.test.ts+++ b/src/components/bot-settings/AccessSection.test.ts@@ -14,12 +14,14 @@ const fixture = vi.hoisted(() => ({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,+ ownerOrAdmin: true as boolean | null,}));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, instances: fixture.instances as typeof original.initialState.instances }, dispatch: fixture.dispatch }) };});// The connected-apps list (Composio accounts plus the native Email connection) is seeded per test.+vi.mock("@/lib/use-owner-or-admin", () => ({ useOwnerOrAdmin: () => fixture.ownerOrAdmin }));vi.mock("./useBotApps", async (importOriginal) => ({...await importOriginal<typeof import("./useBotApps")>(),useBotApps: () => fixture.apps,@@ -41,6 +43,7 @@ beforeEach(() => {vi.stubGlobal("window", {});fixture.dispatch.mockReset();fixture.mcpError = false;+ fixture.ownerOrAdmin = true;fixture.servers = null;fixture.config = null;fixture.instances = [];@@ -433,6 +436,16 @@ describe("AccessSection per-app scopes", () => {expect(on).toContain("below Full access it asks you first each time.");expect(render(makeBot())).not.toContain("data-app-sandbox");});++ it("keeps an enabled sandbox switch while the app list is unknown, and hides it from editors", () => {+ const grants = { connectorTools: { gmail: { tools: "*" as const } } };+ fixture.apps = { phase: "unknown", apps: [], connectedSlugs: [] };+ expect(render(makeBot({ ...grants, appSandbox: true }))).toContain("data-app-sandbox");+ expect(render(makeBot(grants))).not.toContain("data-app-sandbox");+ fixture.apps = { phase: "ready", connectedSlugs: ["gmail"], apps: [app("gmail", "Gmail")] };+ fixture.ownerOrAdmin = false;+ expect(render(makeBot({ ...grants, appSandbox: true }))).not.toContain("data-app-sandbox");+ });});describe("AccessSection parts", () => {diff --git a/src/components/bot-settings/AccessSection.tsx b/src/components/bot-settings/AccessSection.tsxindex 607ae8c163..2e6e796d37 100644--- a/src/components/bot-settings/AccessSection.tsx+++ b/src/components/bot-settings/AccessSection.tsx@@ -24,6 +24,7 @@ import { ToolBudgetLine } from "./ToolBudgetLine";import { useCloudPlan } from "../ProIntroduction";import { xResearchAction } from "@/lib/cloud-plan";import { useBotApps } from "./useBotApps";+import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";import {classifyConnectorTool,connectorServiceAccess,@@ -711,6 +712,7 @@ export function AccessSection({// The same list the Vault tab shows: Composio's connected accounts plus the native Email connection.const apps = useBotApps(bot);const inventoryReady = apps.phase === "ready";+ const ownerOrAdmin = useOwnerOrAdmin();const connectedSlugs = apps.connectedSlugs;const appLabels = Object.fromEntries(apps.apps.map((app) => [app.slug, app.label]));@@ -780,9 +782,13 @@ export function AccessSection({<>{!draft && <ConnectorScopesControl connectedSlugs={connectedSlugs} labels={appLabels} scopes={bot.connectorScopes} onChange={(connectorScopes) => patch({ connectorScopes })} />}<ConnectorToolsGrants bot={bot} patch={patch} slugs={connectedSlugs} />- {bot.connectorTools !== undefined && <AppSandboxRow on={bot.appSandbox === true} onChange={(appSandbox) => patch({ appSandbox })} />}</>)}+ {/* Only an owner or admin may change it (the server refuses an editor). An enabled switch stays shown while the+ app list is unknown, so it can always be turned off. */}+ {connectedAppsEnabled && ownerOrAdmin === true && bot.connectorTools !== undefined && (inventoryReady || bot.appSandbox === true) && (+ <AppSandboxRow on={bot.appSandbox === true} onChange={(appSandbox) => patch({ appSandbox })} />+ )}{connectedAppsEnabled && connectedAppsConfigured && (<buttontype="button"diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex eaae453b01..ae9ee4fd35 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -6517,6 +6517,9 @@"botAccess.apps.none": "Nenhum app conectado tem ferramentas permitidas. Expanda um app para dar acesso a ferramentas.","botAccess.apps.enabled": "Permita que este bot use seus apps conectados, como Gmail, Calendar e Slack.","botAccess.apps.disabled": "Mantenha este bot sem acesso aos apps conectados.",+ "botAccess.apps.sandbox.title": "Executar código no sandbox dos apps",+ "botAccess.apps.sandbox.on": "Este bot pode executar código com seus apps conectados, para tarefas como enviar um arquivo ao Google Drive. Esse código alcança qualquer app conectado; abaixo de “Acesso total”, ele pede sua permissão a cada vez.",+ "botAccess.apps.sandbox.off": "Desligado: este bot usa só as ferramentas de apps acima. Ligue para tarefas que precisam de código, como enviar um arquivo ao Google Drive.","botAccess.apps.allow": "Permitir que este bot use apps conectados","botAccess.apps.connectFirst": "Conecte primeiro os apps nas Configurações do app","botAccess.apps.modelUnsupportedShort": "Este modelo não pode usar apps conectados",