Skip to content

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

Keep custom Claude endpoints out of hosted workspaces

fanxing1115f51a5885b6
diff --git a/src/components/EnginesSettings.test.ts b/src/components/EnginesSettings.test.ts
index db5c30ade4..25bec9a04f 100644
--- a/src/components/EnginesSettings.test.ts
+++ b/src/components/EnginesSettings.test.ts
@@ -432,3 +432,29 @@ describe("Settings → AI in Simple mode", () => {
expect(simple(true)).toContain('data-engine-card="kimi"');
});
});
+
+describe("Settings → Engines → custom Claude endpoints", () => {
+ const hostedClaude = (): InstanceInfo => ({
+ instanceId: "claude", driverKind: "claudeAgent", displayName: "Claude", readOnly: true,
+ snapshot: { state: "available", authenticated: true }, models: { default: "claude-sonnet-5", options: [] },
+ });
+
+ it("leaves the endpoint section out of a hosted workspace, which refuses instance changes", () => {
+ vi.stubGlobal("window", {});
+ vi.stubGlobal("navigator", { userAgent: "Linux" });
+ fixture.instances = [hostedClaude()];
+ fixture.bots = [];
+ expect(renderToStaticMarkup(createElement(EnginesSettings))).not.toContain("data-claude-endpoints");
+ });
+
+ it("offers the endpoint section while Claude is not listed on this computer", () => {
+ vi.stubGlobal("window", {});
+ vi.stubGlobal("navigator", { userAgent: "Linux" });
+ fixture.instances = [{
+ instanceId: "codex", driverKind: "codexAgent", displayName: "Codex", cliDefault: "codex",
+ snapshot: { state: "available", authenticated: true }, models: { default: "model", options: [] },
+ }];
+ fixture.bots = [];
+ expect(renderToStaticMarkup(createElement(EnginesSettings))).toContain("data-claude-endpoints");
+ });
+});
diff --git a/src/components/EnginesSettings.tsx b/src/components/EnginesSettings.tsx
index df554eb75c..cc9d4f150f 100644
--- a/src/components/EnginesSettings.tsx
+++ b/src/components/EnginesSettings.tsx
@@ -520,8 +520,10 @@ export function EnginesSettings({ simple = false, more }: { simple?: boolean; mo
return group && groups.get(group)?.[0] === instance ? group : null;
};
const rows = listed.filter((instance) => !accountGroupOf(instance) || groupOf(instance));
- // A hidden ordinary Claude instance takes its card, and the endpoint section inside it, away.
- const orphanEndpoints = !groups.has("claude");
+ // A hidden ordinary Claude instance takes its card, and the endpoint section inside it, away. A hosted
+ // workspace lists every engine read-only and refuses instance changes, so there the section has no Add.
+ const hostedWorkspace = rows.length > 0 && rows.every((instance) => instance.readOnly);
+ const orphanEndpoints = !groups.has("claude") && !hostedWorkspace;
const isReady = (instance: InstanceInfo) => { const group = groupOf(instance); return group ? accountsReady(groups.get(group)!) : engineReady(instance); };
const renderEngine = (instance: InstanceInfo, bare = false) => {
const group = groupOf(instance);