Skip to content

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

Say 'organizations' instead of 'workspaces' and link the note to the add controls

AdityaUmale126b0983742f
diff --git a/src/components/EngineAccounts.tsx b/src/components/EngineAccounts.tsx
index 45ba2165fe..293347d86f 100644
--- a/src/components/EngineAccounts.tsx
+++ b/src/components/EngineAccounts.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useRef, useState, type ReactNode } from "react";
+import { useEffect, useId, useRef, useState, type ReactNode } from "react";
import { Check, Loader2, MoreHorizontal, Plus } from "lucide-react";
import { api, useStore, type InstanceInfo } from "@/state/store";
import { t } from "@/lib/i18n";
@@ -248,11 +248,12 @@ function AccountRow({ group, instance, signingIn, onSignIn, onSignInDone }: {
}
/** Names a new account and hands its id back, so the caller can start its sign-in at once. */
-export function AddAccount({ label, endpoint, extra, folder: offerFolder = false, onAdded }: {
+export function AddAccount({ label, endpoint, extra, folder: offerFolder = false, describedBy, onAdded }: {
label: string;
endpoint: string;
extra?: Record<string, unknown>;
folder?: boolean;
+ describedBy?: string;
onAdded: (instanceId: string) => void;
}) {
const { dispatch } = useStore();
@@ -283,7 +284,7 @@ export function AddAccount({ label, endpoint, extra, folder: offerFolder = false
if (!open) {
return (
- <button type="button" onClick={() => setOpen(true)} className="flex min-h-8 w-fit items-center gap-1.5 rounded-lg px-2 py-1.5 text-[13px] font-medium text-ink-secondary outline-none hover:bg-control hover:text-ink focus-visible:ring-2 focus-visible:ring-accent">
+ <button type="button" onClick={() => setOpen(true)} aria-describedby={describedBy} className="flex min-h-8 w-fit items-center gap-1.5 rounded-lg px-2 py-1.5 text-[13px] font-medium text-ink-secondary outline-none hover:bg-control hover:text-ink focus-visible:ring-2 focus-visible:ring-accent">
<Plus size={14} />{label}
</button>
);
@@ -292,7 +293,7 @@ export function AddAccount({ label, endpoint, extra, folder: offerFolder = false
<form data-add-account={endpoint} className="space-y-2.5 rounded-xl border border-hairline/50 bg-app p-3" onSubmit={(event) => { event.preventDefault(); void add(); }}>
<label className="flex flex-col gap-1 text-[12px] font-medium text-ink">
{t("accounts.nameLabel")}
- <input value={name} onChange={(event) => setName(event.target.value)} placeholder={t("accounts.namePlaceholder")} maxLength={80} autoFocus required disabled={saving}
+ <input value={name} onChange={(event) => setName(event.target.value)} placeholder={t("accounts.namePlaceholder")} maxLength={80} autoFocus required disabled={saving} aria-describedby={describedBy}
className="rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] font-normal text-ink outline-none focus:border-accent-border disabled:opacity-50" />
</label>
{offerFolder && (
@@ -321,6 +322,7 @@ export function AccountsCard({ group, accounts, advanced, bare = false }: { grou
const primary = accounts[0]!;
const installed = accounts.some((instance) => instance.snapshot.state === "available");
const policy = accounts.find((instance) => instance.policy)?.policy;
+ const noteId = useId();
return (
<EngineCard instance={primary} summary={summaryFor(group, accounts)} bare={bare}>
{policy && <p className="mb-3 text-[12px] leading-relaxed text-ink-secondary">
@@ -337,8 +339,9 @@ export function AccountsCard({ group, accounts, advanced, bare = false }: { grou
))}
</ul>
{!primary.snapshot.authenticationUnavailableReason && <>
- <AddAccount label={t(COPY[group].add)} endpoint={`/api/instances/${group}-accounts`} folder={group === "claude"} onAdded={setSigningIn} />
- {group === "chatgpt" && <p className="px-2 text-[12px] leading-relaxed text-ink-secondary">{t("accounts.addChatgptWorkspaceNote")}</p>}
+ <AddAccount label={t(COPY[group].add)} endpoint={`/api/instances/${group}-accounts`} folder={group === "claude"}
+ describedBy={group === "chatgpt" ? noteId : undefined} onAdded={setSigningIn} />
+ {group === "chatgpt" && <p id={noteId} className="px-2 text-[12px] leading-relaxed text-ink-secondary">{t("accounts.addChatgptWorkspaceNote")}</p>}
</>}
</div>
)}
diff --git a/src/components/EnginesSettings.test.ts b/src/components/EnginesSettings.test.ts
index edba3d7cd6..7d624650eb 100644
--- a/src/components/EnginesSettings.test.ts
+++ b/src/components/EnginesSettings.test.ts
@@ -130,11 +130,11 @@ describe("Settings → Engines → setup cards", () => {
expect(unsupported).not.toMatch(/<button[^>]*>Sign in<\/button>/);
});
- it("says under Add another ChatGPT account that Business and Enterprise workspaces can block it, on the ChatGPT card only", () => {
+ it("says under Add another ChatGPT account that Business and Enterprise organizations can block it, on the ChatGPT card only", () => {
vi.stubGlobal("window", {});
vi.stubGlobal("navigator", { userAgent: "Linux" });
fixture.bots = [];
- const note = "ChatGPT Business and Enterprise workspaces can block adding an account here";
+ const note = "ChatGPT Business and Enterprise organizations can block adding an account here";
const chatgpt: InstanceInfo = {
instanceId: "chatgpt", driverKind: "codex", displayName: "ChatGPT", cliDefault: "codex",
snapshot: { state: "available", authenticated: true, chatgptPlan: true }, models: { default: "gpt", options: [] },
@@ -144,6 +144,9 @@ describe("Settings → Engines → setup cards", () => {
expect(html.split(note)).toHaveLength(2);
expect(html).toContain("3p_delegated_access_policy_denied");
expect(html.indexOf(note)).toBeGreaterThan(html.indexOf("Add another ChatGPT account"));
+ const noteId = html.match(/<p id="([^"]+)"[^>]*>ChatGPT Business and Enterprise organizations/)?.[1];
+ expect(noteId).toBeTruthy();
+ expect(html).toMatch(new RegExp(`<button[^>]*aria-describedby="${noteId}"[^>]*>.*?Add another ChatGPT account`));
fixture.instances = [{ instanceId: "claude", driverKind: "claudeAgent", displayName: "Claude", cliDefault: "claude", snapshot: { state: "available", authenticated: true }, models: { default: "sonnet", options: [] } }];
expect(renderToStaticMarkup(createElement(EnginesSettings))).not.toContain(note);
fixture.instances = [{ ...chatgpt, readOnly: true }];
diff --git a/src/locales/en.json b/src/locales/en.json
index 02dd4f6197..172e15e83a 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -4331,7 +4331,7 @@
"accounts.removeBodyAntigravity": "This removes the account and its sign-in from {app}. Your other Antigravity accounts stay connected.",
"accounts.addClaude": "Add another Claude account",
"accounts.addChatgpt": "Add another ChatGPT account",
- "accounts.addChatgptWorkspaceNote": "ChatGPT Business and Enterprise workspaces can block adding an account here (OpenAI shows 3p_delegated_access_policy_denied).",
+ "accounts.addChatgptWorkspaceNote": "ChatGPT Business and Enterprise organizations can block adding an account here (OpenAI shows 3p_delegated_access_policy_denied).",
"accounts.nameLabel": "Account name",
"accounts.namePlaceholder": "Work",
"accounts.addSubmit": "Add and sign in",