Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Cursor: give model discovery its own request budget so a cold start keeps the real catalog
skygunner30a835bb36cd
diff --git a/server/drivers/acp/cursor.test.ts b/server/drivers/acp/cursor.test.tsindex 481f71ee30..264302f972 100644--- a/server/drivers/acp/cursor.test.ts+++ b/server/drivers/acp/cursor.test.ts@@ -5,6 +5,7 @@ import { dirname, join } from "node:path";import { fileURLToPath } from "node:url";import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";+import { discoverAcpModels } from "./custom-model-catalog.ts";import type { RuntimeEvent } from "../../contracts.ts";import { ensureDirs } from "../../config.ts";import { recordEvents } from "../../testing/events.ts";@@ -20,11 +21,17 @@ import {decodeCursorAuthText,decodeCursorModelCatalog,decodeCursorModelText,+ fetchCursorModels,matchCursorAcpModel,STATIC_CURSOR_MODELS,resolveCursorAcpModelId,} from "./cursor.ts";+vi.mock("./custom-model-catalog.ts", async (importOriginal) => ({+ ...await importOriginal<typeof import("./custom-model-catalog.ts")>(),+ discoverAcpModels: vi.fn(await importOriginal<typeof import("./custom-model-catalog.ts")>().then((real) => real.discoverAcpModels)),+}));+const FAKE_CLI = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "testing", "fake-acp-cli.ts");describe("decodeCursorAuthStatus", () => {@@ -1122,3 +1129,11 @@ describe("cursor ACP model namespace (NS: set_model wiring)", () => {}});});++describe("fetchCursorModels", () => {+ it("gives the discovery session its own request budget, above the shared 8s default (#4371)", async () => {+ await fetchCursorModels("cursor-agent-does-not-exist", {});+ const options = vi.mocked(discoverAcpModels).mock.calls.at(-1)?.[3] as { requestTimeoutMs?: number } | undefined;+ expect(options?.requestTimeoutMs).toBeGreaterThanOrEqual(15_000);+ });+});diff --git a/server/drivers/acp/cursor.ts b/server/drivers/acp/cursor.tsindex fc60d73298..6b799a0839 100644--- a/server/drivers/acp/cursor.ts+++ b/server/drivers/acp/cursor.ts@@ -363,7 +363,9 @@ export async function fetchCursorModels(env: Record<string, string | undefined>,run: typeof execCli = execCli,): Promise<ModelCatalog> {- const fromSession = await discoverAcpModels(env, cli, ["acp"], { variants: false, clientCapabilitiesMeta: CURSOR_CLIENT_META })+ // cursor-agent's cold start can take longer than the shared 8s request budget before session/new answers+ // (#4371): give it its own, so a slow but working session does not collapse to the static list for six hours.+ const fromSession = await discoverAcpModels(env, cli, ["acp"], { variants: false, requestTimeoutMs: 20_000, clientCapabilitiesMeta: CURSOR_CLIENT_META }).then((catalog) => cursorCatalogFromSession(catalog.options), () => null);if (fromSession) return fromSession;// Live CLI prints plain text (`slug - Label`); `--format json` is not supported yet.