Remove Cursor provider support across server and web

- drop `cursor` from provider/model contracts and runtime validation
- remove Cursor-specific UI options, settings, and model normalization paths
- update server/web tests and fixtures to cover Codex + Claude Code only
This commit is contained in:
Julius Marminge committed 2026-03-16 10:35:53 -07:00
1 parent 858116d836
commit 040011dbc7
26 files changed
+25 -511

No files matched your search

@@ -35,7 +35,7 @@ export interface TestTurnResponse {
export type FixtureProviderRuntimeEvent = {
readonly type: string;
readonly eventId: EventId;
readonly provider: "codex" | "claudeCode" | "cursor";
readonly provider: "codex" | "claudeCode";
readonly createdAt: string;
readonly threadId: string;
readonly turnId?: string | undefined;
@@ -44,7 +44,7 @@ const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);
type LegacyProviderRuntimeEvent = {
readonly type: string;
readonly eventId: EventId;
readonly provider: "codex" | "claudeCode" | "cursor";
readonly provider: "codex" | "claudeCode";
readonly createdAt: string;
readonly threadId: ThreadId;
readonly turnId?: string | undefined;
@@ -96,9 +96,7 @@ describe("ProviderCommandReactor", () => {
typeof input === "object" &&
input !== null &&
"provider" in input &&
(input.provider === "codex" ||
input.provider === "claudeCode" ||
input.provider === "cursor")
(input.provider === "codex" || input.provider === "claudeCode")
? input.provider
: "codex";
const resumeCursor =
@@ -131,7 +129,7 @@ describe("ProviderCommandReactor", () => {
: "full-access",
...(model !== undefined ? { model } : {}),
threadId,
resumeCursor: resumeCursor ?? { opaque: `cursor-${sessionIndex}` },
resumeCursor: resumeCursor ?? { opaque: `resume-${sessionIndex}` },
createdAt: now,
updatedAt: now,
};
@@ -428,42 +426,6 @@ describe("ProviderCommandReactor", () => {
expect(thread?.session?.threadId).toBe("thread-1");
});
it("starts first turn with cursor provider when provider is specified", async () => {
const harness = await createHarness();
const now = new Date().toISOString();
await Effect.runPromise(
harness.engine.dispatch({
type: "thread.turn.start",
commandId: CommandId.makeUnsafe("cmd-turn-start-provider-cursor"),
threadId: ThreadId.makeUnsafe("thread-1"),
message: {
messageId: asMessageId("user-message-provider-cursor"),
role: "user",
text: "hello cursor",
attachments: [],
},
provider: "cursor",
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
runtimeMode: "approval-required",
createdAt: now,
}),
);
await waitFor(() => harness.startSession.mock.calls.length === 1);
await waitFor(() => harness.sendTurn.mock.calls.length === 1);
expect(harness.startSession.mock.calls[0]?.[1]).toMatchObject({
provider: "cursor",
cwd: "/tmp/provider-project",
model: "gpt-5-codex",
runtimeMode: "approval-required",
});
const readModel = await Effect.runPromise(harness.engine.getReadModel());
const thread = readModel.threads.find((entry) => entry.id === ThreadId.makeUnsafe("thread-1"));
expect(thread?.session?.providerName).toBe("cursor");
expect(thread?.session?.threadId).toBe("thread-1");
});
it("reuses the same provider session when runtime mode is unchanged", async () => {
const harness = await createHarness();
const now = new Date().toISOString();
@@ -584,7 +546,7 @@ describe("ProviderCommandReactor", () => {
expect(harness.stopSession.mock.calls.length).toBe(0);
expect(harness.startSession.mock.calls[1]?.[1]).toMatchObject({
threadId: ThreadId.makeUnsafe("thread-1"),
resumeCursor: { opaque: "cursor-1" },
resumeCursor: { opaque: "resume-1" },
runtimeMode: "approval-required",
});
expect(harness.sendTurn.mock.calls[1]?.[0]).toMatchObject({
@@ -207,8 +207,7 @@ const make = Effect.gen(function* () {
const desiredRuntimeMode = thread.runtimeMode;
const currentProvider: ProviderKind | undefined =
thread.session?.providerName === "codex" ||
thread.session?.providerName === "claudeCode" ||
thread.session?.providerName === "cursor"
thread.session?.providerName === "claudeCode"
? thread.session.providerName
: undefined;
const preferredProvider: ProviderKind | undefined = options?.provider ?? currentProvider;
@@ -45,7 +45,7 @@ const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);
type LegacyProviderRuntimeEvent = {
readonly type: string;
readonly eventId: EventId;
readonly provider: "codex" | "claudeCode" | "cursor";
readonly provider: "codex" | "claudeCode";
readonly createdAt: string;
readonly threadId: ThreadId;
readonly turnId?: string | undefined;
@@ -1,7 +1,7 @@
/**
* ProviderAdapterRegistryLive - In-memory provider adapter lookup layer.
*
* Binds provider kinds (codex/cursor/...) to concrete adapter services.
* Binds provider kinds (codex/claudeCode/...) to concrete adapter services.
* This layer only performs adapter lookup; it does not route session-scoped
* calls or own provider lifecycle workflows.
*
@@ -52,7 +52,7 @@ const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);
type LegacyProviderRuntimeEvent = {
readonly type: string;
readonly eventId: EventId;
readonly provider: "codex" | "claudeCode" | "cursor";
readonly provider: "codex" | "claudeCode";
readonly createdAt: string;
readonly threadId: ThreadId;
readonly turnId?: string | undefined;
@@ -74,7 +74,7 @@ function makeFakeCodexAdapter(provider: ProviderKind = "codex") {
status: "ready",
runtimeMode: input.runtimeMode,
threadId: input.threadId,
resumeCursor: input.resumeCursor ?? { opaque: `cursor-${String(input.threadId)}` },
resumeCursor: input.resumeCursor ?? { opaque: `resume-${String(input.threadId)}` },
cwd: input.cwd ?? process.cwd(),
createdAt: now,
updatedAt: now,
@@ -141,8 +141,8 @@ it.layer(makeDirectoryLayer(SqlitePersistenceMemory))("ProviderSessionDirectoryL
yield* runtimeRepository.upsert({
threadId,
providerName: "cursor",
adapterKey: "cursor",
providerName: "claudeCode",
adapterKey: "claudeCode",
runtimeMode: "full-access",
status: "running",
lastSeenAt: new Date().toISOString(),
@@ -22,7 +22,7 @@ function decodeProviderKind(
providerName: string,
operation: string,
): Effect.Effect<ProviderKind, ProviderSessionDirectoryPersistenceError> {
if (providerName === "codex" || providerName === "claudeCode" || providerName === "cursor") {
if (providerName === "codex" || providerName === "claudeCode") {
return Effect.succeed(providerName);
}
return Effect.fail(
+1 -7
View File
@@ -21,15 +21,11 @@ describe("normalizeCustomModelSlugs", () => {
).toEqual(["custom/internal-model"]);
});
it("normalizes provider-specific aliases for claude and cursor", () => {
it("normalizes provider-specific aliases for claude", () => {
expect(normalizeCustomModelSlugs(["sonnet"], "claudeCode")).toEqual([]);
expect(normalizeCustomModelSlugs(["claude/custom-sonnet"], "claudeCode")).toEqual([
"claude/custom-sonnet",
]);
expect(normalizeCustomModelSlugs(["composer"], "cursor")).toEqual([]);
expect(normalizeCustomModelSlugs(["cursor/custom-model"], "cursor")).toEqual([
"cursor/custom-model",
]);
});
});
@@ -86,9 +82,7 @@ describe("timestamp format defaults", () => {
describe("provider-specific custom models", () => {
it("includes provider-specific custom slugs in non-codex model lists", () => {
const claudeOptions = getAppModelOptions("claudeCode", ["claude/custom-opus"]);
const cursorOptions = getAppModelOptions("cursor", ["cursor/custom-model"]);
expect(claudeOptions.some((option) => option.slug === "claude/custom-opus")).toBe(true);
expect(cursorOptions.some((option) => option.slug === "cursor/custom-model")).toBe(true);
});
});
-5
View File
@@ -13,7 +13,6 @@ export const DEFAULT_TIMESTAMP_FORMAT: TimestampFormat = "locale";
const BUILT_IN_MODEL_SLUGS_BY_PROVIDER: Record<ProviderKind, ReadonlySet<string>> = {
codex: new Set(getModelOptions("codex").map((option) => option.slug)),
claudeCode: new Set(getModelOptions("claudeCode").map((option) => option.slug)),
cursor: new Set(getModelOptions("cursor").map((option) => option.slug)),
};
const AppSettingsSchema = Schema.Struct({
@@ -39,9 +38,6 @@ const AppSettingsSchema = Schema.Struct({
customClaudeModels: Schema.Array(Schema.String).pipe(
Schema.withConstructorDefault(() => Option.some([])),
),
customCursorModels: Schema.Array(Schema.String).pipe(
Schema.withConstructorDefault(() => Option.some([])),
),
});
export type AppSettings = typeof AppSettingsSchema.Type;
export interface AppModelOption {
@@ -86,7 +82,6 @@ function normalizeAppSettings(settings: AppSettings): AppSettings {
...settings,
customCodexModels: normalizeCustomModelSlugs(settings.customCodexModels, "codex"),
customClaudeModels: normalizeCustomModelSlugs(settings.customClaudeModels, "claudeCode"),
customCursorModels: normalizeCustomModelSlugs(settings.customCursorModels, "cursor"),
};
}
export function getAppModelOptions(
@@ -119,11 +119,9 @@ export function cloneComposerImageForRetry(
export function getCustomModelOptionsByProvider(settings: {
customCodexModels: readonly string[];
customClaudeModels: readonly string[];
customCursorModels: readonly string[];
}): Record<ProviderKind, ReadonlyArray<{ slug: string; name: string }>> {
return {
codex: getAppModelOptions("codex", settings.customCodexModels),
claudeCode: getAppModelOptions("claudeCode", settings.customClaudeModels),
cursor: getAppModelOptions("cursor", settings.customCursorModels),
};
}
+1 -2
View File
@@ -504,9 +504,8 @@ export default function ChatView({ threadId }: ChatViewProps) {
() => ({
codex: settings.customCodexModels,
claudeCode: settings.customClaudeModels,
cursor: settings.customCursorModels,
}),
[settings.customClaudeModels, settings.customCodexModels, settings.customCursorModels],
[settings.customClaudeModels, settings.customCodexModels],
);
const customModelsForSelectedProvider = customModelsByProvider[selectedProvider];
const selectedModel = useMemo(() => {
@@ -17,7 +17,7 @@ import {
MenuSubTrigger,
MenuTrigger,
} from "../ui/menu";
import { ClaudeAI, CursorIcon, Gemini, Icon, OpenAI, OpenCodeIcon } from "../Icons";
import { ClaudeAI, Gemini, Icon, OpenAI, OpenCodeIcon } from "../Icons";
import { cn } from "~/lib/utils";
function isAvailableProviderOption(option: (typeof PROVIDER_OPTIONS)[number]): option is {
@@ -64,7 +64,6 @@ function resolveModelForProviderPicker(
const PROVIDER_ICON_BY_PROVIDER: Record<ProviderPickerKind, Icon> = {
codex: OpenAI,
claudeCode: ClaudeAI,
cursor: CursorIcon,
};
export const AVAILABLE_PROVIDER_OPTIONS = PROVIDER_OPTIONS.filter(isAvailableProviderOption);
+1 -1
View File
@@ -246,7 +246,7 @@ function shouldRemoveDraft(draft: ComposerThreadDraftState): boolean {
}
function normalizeProviderKind(value: unknown): ProviderKind | null {
return value === "codex" || value === "claudeCode" || value === "cursor" ? value : null;
return value === "codex" || value === "claudeCode" ? value : null;
}
function revokeObjectPreviewUrl(previewUrl: string): void {
-7
View File
@@ -76,8 +76,6 @@ function getCustomModelsForProvider(
switch (provider) {
case "claudeCode":
return settings.customClaudeModels;
case "cursor":
return settings.customCursorModels;
case "codex":
default:
return settings.customCodexModels;
@@ -91,8 +89,6 @@ function getDefaultCustomModelsForProvider(
switch (provider) {
case "claudeCode":
return defaults.customClaudeModels;
case "cursor":
return defaults.customCursorModels;
case "codex":
default:
return defaults.customCodexModels;
@@ -103,8 +99,6 @@ function patchCustomModels(provider: ProviderKind, models: string[]) {
switch (provider) {
case "claudeCode":
return { customClaudeModels: models };
case "cursor":
return { customCursorModels: models };
case "codex":
default:
return { customCodexModels: models };
@@ -122,7 +116,6 @@ function SettingsRouteView() {
>({
codex: "",
claudeCode: "",
cursor: "",
});
const [customModelErrorByProvider, setCustomModelErrorByProvider] = useState<
Partial<Record<ProviderKind, string | null>>
+1 -8
View File
@@ -673,23 +673,16 @@ describe("deriveActiveWorkStartedAt", () => {
});
describe("PROVIDER_OPTIONS", () => {
it("advertises Claude Code on the Claude stack while keeping Cursor as a placeholder", () => {
it("advertises the supported providers", () => {
const claude = PROVIDER_OPTIONS.find((option) => option.value === "claudeCode");
const cursor = PROVIDER_OPTIONS.find((option) => option.value === "cursor");
expect(PROVIDER_OPTIONS).toEqual([
{ value: "codex", label: "Codex", available: true },
{ value: "claudeCode", label: "Claude Code", available: true },
{ value: "cursor", label: "Cursor", available: false },
]);
expect(claude).toEqual({
value: "claudeCode",
label: "Claude Code",
available: true,
});
expect(cursor).toEqual({
value: "cursor",
label: "Cursor",
available: false,
});
});
});
+1 -2
View File
@@ -18,7 +18,7 @@ import type {
TurnDiffSummary,
} from "./types";
export type ProviderPickerKind = ProviderKind | "claudeCode" | "cursor";
export type ProviderPickerKind = ProviderKind;
export const PROVIDER_OPTIONS: Array<{
value: ProviderPickerKind;
@@ -27,7 +27,6 @@ export const PROVIDER_OPTIONS: Array<{
}> = [
{ value: "codex", label: "Codex", available: true },
{ value: "claudeCode", label: "Claude Code", available: true },
{ value: "cursor", label: "Cursor", available: false },
];
export interface WorkLogEntry {
-22
View File
@@ -226,28 +226,6 @@ describe("store read model sync", () => {
expect(next.threads[0]?.model).toBe("claude-sonnet-4-6");
});
it("resolves cursor aliases when session provider is cursor", () => {
const initialState = makeState(makeThread());
const readModel = makeReadModel(
makeReadModelThread({
model: "composer",
session: {
threadId: ThreadId.makeUnsafe("thread-1"),
status: "ready",
providerName: "cursor",
runtimeMode: "approval-required",
activeTurnId: null,
lastError: null,
updatedAt: "2026-02-27T00:00:00.000Z",
},
}),
);
const next = syncServerReadModel(initialState, readModel);
expect(next.threads[0]?.model).toBe("composer-1.5");
});
it("preserves the current project order when syncing incoming read model updates", () => {
const project1 = ProjectId.makeUnsafe("project-1");
const project2 = ProjectId.makeUnsafe("project-2");
+2 -23
View File
@@ -189,7 +189,7 @@ function toLegacySessionStatus(
}
function toLegacyProvider(providerName: string | null): ProviderKind {
if (providerName === "codex" || providerName === "claudeCode" || providerName === "cursor") {
if (providerName === "codex" || providerName === "claudeCode") {
return providerName;
}
return "codex";
@@ -199,28 +199,14 @@ const CODEX_MODEL_SLUGS = new Set<string>(getModelOptions("codex").map((option)
const CLAUDE_MODEL_SLUGS = new Set<string>(
getModelOptions("claudeCode").map((option) => option.slug),
);
const CURSOR_MODEL_SLUGS = new Set<string>(getModelOptions("cursor").map((option) => option.slug));
const CURSOR_DISTINCT_MODEL_SLUGS = new Set(
[...CURSOR_MODEL_SLUGS].filter(
(slug) => !CODEX_MODEL_SLUGS.has(slug) && !CLAUDE_MODEL_SLUGS.has(slug),
),
);
function inferProviderForThreadModel(input: {
readonly model: string;
readonly sessionProviderName: string | null;
}): ProviderKind {
if (
input.sessionProviderName === "codex" ||
input.sessionProviderName === "claudeCode" ||
input.sessionProviderName === "cursor"
) {
if (input.sessionProviderName === "codex" || input.sessionProviderName === "claudeCode") {
return input.sessionProviderName;
}
const normalizedCursor = normalizeModelSlug(input.model, "cursor");
if (normalizedCursor && CURSOR_DISTINCT_MODEL_SLUGS.has(normalizedCursor)) {
return "cursor";
}
const normalizedClaude = normalizeModelSlug(input.model, "claudeCode");
if (normalizedClaude && CLAUDE_MODEL_SLUGS.has(normalizedClaude)) {
return "claudeCode";
@@ -229,13 +215,6 @@ function inferProviderForThreadModel(input: {
if (normalizedCodex && CODEX_MODEL_SLUGS.has(normalizedCodex)) {
return "codex";
}
if (
input.model.trim().startsWith("composer-") ||
input.model.trim().startsWith("gemini-") ||
input.model.trim().endsWith("-thinking")
) {
return "cursor";
}
return input.model.trim().startsWith("claude-") ? "claudeCode" : "codex";
}
-69
View File
@@ -1,9 +1,6 @@
import { Schema } from "effect";
import type { ProviderKind } from "./orchestration";
export const CURSOR_REASONING_OPTIONS = ["low", "normal", "high", "xhigh"] as const;
export type CursorReasoningOption = (typeof CURSOR_REASONING_OPTIONS)[number];
export const CODEX_REASONING_EFFORT_OPTIONS = ["xhigh", "high", "medium", "low"] as const;
export type CodexReasoningEffort = (typeof CODEX_REASONING_EFFORT_OPTIONS)[number];
@@ -18,17 +15,9 @@ export const ClaudeCodeModelOptions = Schema.Struct({
});
export type ClaudeCodeModelOptions = typeof ClaudeCodeModelOptions.Type;
export const CursorModelOptions = Schema.Struct({
reasoning: Schema.optional(Schema.Literals(CURSOR_REASONING_OPTIONS)),
fastMode: Schema.optional(Schema.Boolean),
thinking: Schema.optional(Schema.Boolean),
});
export type CursorModelOptions = typeof CursorModelOptions.Type;
export const ProviderModelOptions = Schema.Struct({
codex: Schema.optional(CodexModelOptions),
claudeCode: Schema.optional(ClaudeCodeModelOptions),
cursor: Schema.optional(CursorModelOptions),
});
export type ProviderModelOptions = typeof ProviderModelOptions.Type;
@@ -37,25 +26,6 @@ type ModelOption = {
readonly name: string;
};
type CursorModelFamilyOption = {
readonly slug: string;
readonly name: string;
};
export const CURSOR_MODEL_FAMILY_OPTIONS = [
{ slug: "auto", name: "Auto" },
{ slug: "composer-1.5", name: "Composer 1.5" },
{ slug: "composer-1", name: "Composer 1" },
{ slug: "gpt-5.3-codex", name: "GPT-5.3 Codex" },
{ slug: "gpt-5.3-codex-spark-preview", name: "GPT-5.3 Codex Spark" },
{ slug: "opus-4.6", name: "Claude 4.6 Opus" },
{ slug: "opus-4.5", name: "Claude 4.5 Opus" },
{ slug: "sonnet-4.6", name: "Claude 4.6 Sonnet" },
{ slug: "gemini-3.1-pro", name: "Gemini 3.1 Pro" },
] as const satisfies readonly CursorModelFamilyOption[];
export type CursorModelFamily = (typeof CURSOR_MODEL_FAMILY_OPTIONS)[number]["slug"];
export const MODEL_OPTIONS_BY_PROVIDER = {
codex: [
{ slug: "gpt-5.4", name: "GPT-5.4" },
@@ -69,38 +39,15 @@ export const MODEL_OPTIONS_BY_PROVIDER = {
{ slug: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
{ slug: "claude-haiku-4-5", name: "Claude Haiku 4.5" },
],
cursor: [
{ slug: "auto", name: "Auto" },
{ slug: "composer-1.5", name: "Composer 1.5" },
{ slug: "composer-1", name: "Composer 1" },
{ slug: "gpt-5.3-codex-low", name: "GPT-5.3 Codex Low" },
{ slug: "gpt-5.3-codex-low-fast", name: "GPT-5.3 Codex Low Fast" },
{ slug: "gpt-5.3-codex", name: "GPT-5.3 Codex" },
{ slug: "gpt-5.3-codex-fast", name: "GPT-5.3 Codex Fast" },
{ slug: "gpt-5.3-codex-high", name: "GPT-5.3 Codex High" },
{ slug: "gpt-5.3-codex-high-fast", name: "GPT-5.3 Codex High Fast" },
{ slug: "gpt-5.3-codex-xhigh", name: "GPT-5.3 Codex Extra High" },
{ slug: "gpt-5.3-codex-xhigh-fast", name: "GPT-5.3 Codex Extra High Fast" },
{ slug: "gpt-5.3-codex-spark-preview", name: "GPT-5.3 Codex Spark" },
{ slug: "opus-4.6", name: "Claude 4.6 Opus" },
{ slug: "opus-4.6-thinking", name: "Claude 4.6 Opus (Thinking)" },
{ slug: "opus-4.5", name: "Claude 4.5 Opus" },
{ slug: "opus-4.5-thinking", name: "Claude 4.5 Opus (Thinking)" },
{ slug: "sonnet-4.6", name: "Claude 4.6 Sonnet" },
{ slug: "sonnet-4.6-thinking", name: "Claude 4.6 Sonnet (Thinking)" },
{ slug: "gemini-3.1-pro", name: "Gemini 3.1 Pro" },
],
} as const satisfies Record<ProviderKind, readonly ModelOption[]>;
export type ModelOptionsByProvider = typeof MODEL_OPTIONS_BY_PROVIDER;
type BuiltInModelSlug = (typeof MODEL_OPTIONS_BY_PROVIDER)[ProviderKind][number]["slug"];
export type ModelSlug = BuiltInModelSlug | (string & {});
export type CursorModelSlug = (typeof MODEL_OPTIONS_BY_PROVIDER)["cursor"][number]["slug"];
export const DEFAULT_MODEL_BY_PROVIDER: Record<ProviderKind, ModelSlug> = {
codex: "gpt-5.4",
claudeCode: "claude-sonnet-4-6",
cursor: "opus-4.6-thinking",
};
// Backward compatibility for existing Codex-only call sites.
@@ -129,30 +76,14 @@ export const MODEL_SLUG_ALIASES_BY_PROVIDER: Record<ProviderKind, Record<string,
"claude-haiku-4.5": "claude-haiku-4-5",
"claude-haiku-4-5-20251001": "claude-haiku-4-5",
},
cursor: {
composer: "composer-1.5",
"composer-1.5": "composer-1.5",
"composer-1": "composer-1",
"gpt-5.3-codex": "gpt-5.3-codex",
"gpt-5.3-codex-spark": "gpt-5.3-codex-spark-preview",
"gemini-3.1-pro": "gemini-3.1-pro",
"claude-4.6-sonnet-thinking": "sonnet-4.6-thinking",
"claude-4.6-opus-thinking": "opus-4.6-thinking",
"claude-4.5-opus-thinking": "opus-4.5-thinking",
"sonnet-4.6-thinking": "sonnet-4.6-thinking",
"opus-4.6-thinking": "opus-4.6-thinking",
"opus-4.5-thinking": "opus-4.5-thinking",
},
};
export const REASONING_EFFORT_OPTIONS_BY_PROVIDER = {
codex: CODEX_REASONING_EFFORT_OPTIONS,
claudeCode: [],
cursor: [],
} as const satisfies Record<ProviderKind, readonly CodexReasoningEffort[]>;
export const DEFAULT_REASONING_EFFORT_BY_PROVIDER = {
codex: "high",
claudeCode: null,
cursor: null,
} as const satisfies Record<ProviderKind, CodexReasoningEffort | null>;
+1 -6
View File
@@ -27,7 +27,7 @@ export const ORCHESTRATION_WS_CHANNELS = {
domainEvent: "orchestration.domainEvent",
} as const;
export const ProviderKind = Schema.Literals(["codex", "claudeCode", "cursor"]);
export const ProviderKind = Schema.Literals(["codex", "claudeCode"]);
export type ProviderKind = typeof ProviderKind.Type;
export const ProviderApprovalPolicy = Schema.Literals([
"untrusted",
@@ -56,11 +56,6 @@ const ProviderStartOptions = Schema.Struct({
maxThinkingTokens: Schema.optional(NonNegativeInt),
}),
),
cursor: Schema.optional(
Schema.Struct({
binaryPath: Schema.optional(TrimmedNonEmptyString),
}),
),
});
export const RuntimeMode = Schema.Literals(["approval-required", "full-access"]);
export type RuntimeMode = typeof RuntimeMode.Type;
-25
View File
@@ -64,31 +64,6 @@ describe("ProviderSessionStartInput", () => {
expect(parsed.providerOptions?.claudeCode?.maxThinkingTokens).toBe(12_000);
expect(parsed.runtimeMode).toBe("full-access");
});
it("accepts cursor provider payloads", () => {
const parsed = decodeProviderSessionStartInput({
threadId: "thread-1",
provider: "cursor",
cwd: "/tmp/workspace",
model: "composer-1.5",
modelOptions: {
cursor: {
thinking: true,
},
},
providerOptions: {
cursor: {
binaryPath: "/usr/local/bin/agent",
},
},
runtimeMode: "approval-required",
});
expect(parsed.provider).toBe("cursor");
expect(parsed.model).toBe("composer-1.5");
expect(parsed.modelOptions?.cursor?.thinking).toBe(true);
expect(parsed.providerOptions?.cursor?.binaryPath).toBe("/usr/local/bin/agent");
expect(parsed.runtimeMode).toBe("approval-required");
});
});
describe("ProviderSendTurnInput", () => {
-5
View File
@@ -59,14 +59,9 @@ const ClaudeCodeProviderStartOptions = Schema.Struct({
maxThinkingTokens: Schema.optional(NonNegativeInt),
});
const CursorProviderStartOptions = Schema.Struct({
binaryPath: Schema.optional(TrimmedNonEmptyStringSchema),
});
export const ProviderStartOptions = Schema.Struct({
codex: Schema.optional(CodexProviderStartOptions),
claudeCode: Schema.optional(ClaudeCodeProviderStartOptions),
cursor: Schema.optional(CursorProviderStartOptions),
});
export type ProviderStartOptions = typeof ProviderStartOptions.Type;
+3 -70
View File
@@ -1,7 +1,5 @@
import { describe, expect, it } from "vitest";
import {
CURSOR_MODEL_FAMILY_OPTIONS,
CURSOR_REASONING_OPTIONS,
DEFAULT_MODEL,
DEFAULT_MODEL_BY_PROVIDER,
DEFAULT_REASONING_EFFORT_BY_PROVIDER,
@@ -13,12 +11,9 @@ import {
import {
getDefaultModel,
getDefaultReasoningEffort,
getCursorModelFamilyOptions,
getModelOptions,
getReasoningEffortOptions,
normalizeModelSlug,
parseCursorModelSelection,
resolveCursorModelFromSelection,
resolveModelSlug,
resolveModelSlugForProvider,
} from "./model";
@@ -49,11 +44,9 @@ describe("normalizeModelSlug", () => {
it("uses provider-specific aliases", () => {
expect(normalizeModelSlug("sonnet", "claudeCode")).toBe("claude-sonnet-4-6");
expect(normalizeModelSlug("opus-4.6", "claudeCode")).toBe("claude-opus-4-6");
expect(normalizeModelSlug("claude-haiku-4-5-20251001", "claudeCode")).toBe("claude-haiku-4-5");
expect(normalizeModelSlug("composer", "cursor")).toBe("composer-1.5");
expect(normalizeModelSlug("gpt-5.3-codex-spark", "cursor")).toBe("gpt-5.3-codex-spark-preview");
expect(normalizeModelSlug("gemini-3.1", "cursor")).toBe("gemini-3.1");
expect(normalizeModelSlug("claude-4.6-sonnet-thinking", "cursor")).toBe("sonnet-4.6-thinking");
expect(normalizeModelSlug("claude-haiku-4-5-20251001", "claudeCode")).toBe(
"claude-haiku-4-5",
);
});
});
@@ -82,67 +75,12 @@ describe("resolveModelSlug", () => {
expect(resolveModelSlugForProvider("claudeCode", "gpt-5.3-codex")).toBe(
DEFAULT_MODEL_BY_PROVIDER.claudeCode,
);
expect(resolveModelSlugForProvider("cursor", undefined)).toBe(DEFAULT_MODEL_BY_PROVIDER.cursor);
expect(resolveModelSlugForProvider("cursor", "composer")).toBe("composer-1.5");
expect(resolveModelSlugForProvider("cursor", "gpt-5.3-codex-high-fast")).toBe(
"gpt-5.3-codex-high-fast",
);
expect(resolveModelSlugForProvider("cursor", "claude-sonnet-4-6")).toBe(
DEFAULT_MODEL_BY_PROVIDER.cursor,
);
});
it("keeps codex defaults for backward compatibility", () => {
expect(getDefaultModel()).toBe(DEFAULT_MODEL);
expect(getModelOptions()).toEqual(MODEL_OPTIONS);
expect(getModelOptions("claudeCode")).toEqual(MODEL_OPTIONS_BY_PROVIDER.claudeCode);
expect(getModelOptions("cursor")).toEqual(MODEL_OPTIONS_BY_PROVIDER.cursor);
expect(getCursorModelFamilyOptions()).toEqual(CURSOR_MODEL_FAMILY_OPTIONS);
});
});
describe("cursor model selection", () => {
it("includes the expected cursor reasoning levels and families", () => {
expect(CURSOR_REASONING_OPTIONS).toEqual(["low", "normal", "high", "xhigh"]);
expect(getCursorModelFamilyOptions().map((option) => option.slug)).toContain("gpt-5.3-codex");
expect(getCursorModelFamilyOptions().map((option) => option.slug)).toContain("opus-4.6");
});
it("parses codex reasoning and fast mode variants", () => {
expect(parseCursorModelSelection("gpt-5.3-codex-high-fast")).toEqual({
family: "gpt-5.3-codex",
reasoning: "high",
fast: true,
thinking: false,
});
expect(parseCursorModelSelection("gpt-5.2-codex")).toEqual(
parseCursorModelSelection(DEFAULT_MODEL_BY_PROVIDER.cursor),
);
});
it("parses and resolves thinking variants", () => {
expect(parseCursorModelSelection("sonnet-4.6-thinking")).toEqual({
family: "sonnet-4.6",
reasoning: "normal",
fast: false,
thinking: true,
});
expect(
resolveCursorModelFromSelection({
family: "sonnet-4.6",
thinking: true,
}),
).toBe("sonnet-4.6-thinking");
});
it("resolves codex family selections into concrete model ids", () => {
expect(
resolveCursorModelFromSelection({
family: "gpt-5.3-codex",
reasoning: "xhigh",
fast: true,
}),
).toBe("gpt-5.3-codex-xhigh-fast");
});
});
@@ -154,10 +92,6 @@ describe("getReasoningEffortOptions", () => {
it("returns no reasoning options for claudeCode", () => {
expect(getReasoningEffortOptions("claudeCode")).toEqual([]);
});
it("returns no reasoning options for cursor", () => {
expect(getReasoningEffortOptions("cursor")).toEqual([]);
});
});
describe("getDefaultReasoningEffort", () => {
@@ -166,6 +100,5 @@ describe("getDefaultReasoningEffort", () => {
expect(getDefaultReasoningEffort("claudeCode")).toBe(
DEFAULT_REASONING_EFFORT_BY_PROVIDER.claudeCode,
);
expect(getDefaultReasoningEffort("cursor")).toBe(DEFAULT_REASONING_EFFORT_BY_PROVIDER.cursor);
});
});
-203
View File
@@ -1,227 +1,24 @@
import {
CODEX_REASONING_EFFORT_OPTIONS,
CURSOR_MODEL_FAMILY_OPTIONS,
CURSOR_REASONING_OPTIONS,
DEFAULT_MODEL_BY_PROVIDER,
DEFAULT_REASONING_EFFORT_BY_PROVIDER,
MODEL_OPTIONS_BY_PROVIDER,
MODEL_SLUG_ALIASES_BY_PROVIDER,
REASONING_EFFORT_OPTIONS_BY_PROVIDER,
type CodexReasoningEffort,
type CursorModelFamily,
type CursorModelSlug,
type CursorReasoningOption,
type ModelSlug,
type ProviderKind,
} from "@t3tools/contracts";
type CursorModelCapability = {
readonly supportsReasoning: boolean;
readonly supportsFast: boolean;
readonly supportsThinking: boolean;
readonly defaultReasoning: CursorReasoningOption;
readonly defaultThinking: boolean;
};
const CURSOR_MODEL_CAPABILITY_BY_FAMILY: Record<CursorModelFamily, CursorModelCapability> = {
auto: {
supportsReasoning: false,
supportsFast: false,
supportsThinking: false,
defaultReasoning: "normal",
defaultThinking: false,
},
"composer-1.5": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: false,
defaultReasoning: "normal",
defaultThinking: false,
},
"composer-1": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: false,
defaultReasoning: "normal",
defaultThinking: false,
},
"gpt-5.3-codex": {
supportsReasoning: true,
supportsFast: true,
supportsThinking: false,
defaultReasoning: "normal",
defaultThinking: false,
},
"gpt-5.3-codex-spark-preview": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: false,
defaultReasoning: "normal",
defaultThinking: false,
},
"opus-4.6": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: true,
defaultReasoning: "normal",
defaultThinking: true,
},
"opus-4.5": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: true,
defaultReasoning: "normal",
defaultThinking: true,
},
"sonnet-4.6": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: true,
defaultReasoning: "normal",
defaultThinking: true,
},
"gemini-3.1-pro": {
supportsReasoning: false,
supportsFast: false,
supportsThinking: false,
defaultReasoning: "normal",
defaultThinking: false,
},
};
const MODEL_SLUG_SET_BY_PROVIDER: Record<ProviderKind, ReadonlySet<ModelSlug>> = {
claudeCode: new Set(MODEL_OPTIONS_BY_PROVIDER.claudeCode.map((option) => option.slug)),
codex: new Set(MODEL_OPTIONS_BY_PROVIDER.codex.map((option) => option.slug)),
cursor: new Set(MODEL_OPTIONS_BY_PROVIDER.cursor.map((option) => option.slug)),
};
const CURSOR_MODEL_FAMILY_SET = new Set<CursorModelFamily>(
CURSOR_MODEL_FAMILY_OPTIONS.map((option) => option.slug),
);
export interface CursorModelSelection {
readonly family: CursorModelFamily;
readonly reasoning: CursorReasoningOption;
readonly fast: boolean;
readonly thinking: boolean;
}
export function getModelOptions(provider: ProviderKind = "codex") {
return MODEL_OPTIONS_BY_PROVIDER[provider];
}
export function getCursorModelFamilyOptions() {
return CURSOR_MODEL_FAMILY_OPTIONS;
}
export function getCursorModelCapabilities(family: CursorModelFamily) {
return CURSOR_MODEL_CAPABILITY_BY_FAMILY[family];
}
function fallbackCursorModelFamily(): CursorModelFamily {
const fallback = parseCursorModelSelection(DEFAULT_MODEL_BY_PROVIDER.cursor);
return fallback.family;
}
function resolveCursorModelFamily(model: string | null | undefined): CursorModelFamily {
const normalized = normalizeModelSlug(model, "cursor");
if (!normalized) {
return fallbackCursorModelFamily();
}
if (
normalized === "gpt-5.3-codex" ||
normalized === "gpt-5.3-codex-fast" ||
normalized === "gpt-5.3-codex-low" ||
normalized === "gpt-5.3-codex-low-fast" ||
normalized === "gpt-5.3-codex-high" ||
normalized === "gpt-5.3-codex-high-fast" ||
normalized === "gpt-5.3-codex-xhigh" ||
normalized === "gpt-5.3-codex-xhigh-fast"
) {
return "gpt-5.3-codex";
}
if (normalized === "sonnet-4.6-thinking") {
return "sonnet-4.6";
}
if (normalized === "opus-4.6-thinking") {
return "opus-4.6";
}
if (normalized === "opus-4.5-thinking") {
return "opus-4.5";
}
return CURSOR_MODEL_FAMILY_SET.has(normalized as CursorModelFamily)
? (normalized as CursorModelFamily)
: fallbackCursorModelFamily();
}
function resolveCursorReasoning(model: CursorModelSlug): CursorReasoningOption {
if (model.includes("-xhigh")) return "xhigh";
if (model.includes("-high")) return "high";
if (model.includes("-low")) return "low";
return "normal";
}
export function parseCursorModelSelection(model: string | null | undefined): CursorModelSelection {
const family = resolveCursorModelFamily(model);
const capability = CURSOR_MODEL_CAPABILITY_BY_FAMILY[family];
const normalized = resolveModelSlugForProvider("cursor", model) as CursorModelSlug;
if (capability.supportsReasoning) {
return {
family,
reasoning: resolveCursorReasoning(normalized),
fast: normalized.endsWith("-fast"),
thinking: false,
};
}
if (capability.supportsThinking) {
return {
family,
reasoning: capability.defaultReasoning,
fast: false,
thinking: normalized.endsWith("-thinking"),
};
}
return {
family,
reasoning: capability.defaultReasoning,
fast: false,
thinking: capability.defaultThinking,
};
}
export function resolveCursorModelFromSelection(input: {
readonly family: CursorModelFamily;
readonly reasoning?: CursorReasoningOption | null;
readonly fast?: boolean;
readonly thinking?: boolean;
}): CursorModelSlug {
const family = resolveCursorModelFamily(input.family);
const capability = CURSOR_MODEL_CAPABILITY_BY_FAMILY[family];
if (capability.supportsReasoning) {
const reasoning = CURSOR_REASONING_OPTIONS.includes(input.reasoning ?? "normal")
? (input.reasoning ?? "normal")
: capability.defaultReasoning;
const reasoningSuffix = reasoning === "normal" ? "" : `-${reasoning}`;
const fastSuffix = input.fast ? "-fast" : "";
const candidate = `${family}${reasoningSuffix}${fastSuffix}`;
return resolveModelSlugForProvider("cursor", candidate) as CursorModelSlug;
}
if (capability.supportsThinking) {
const candidate = input.thinking ? `${family}-thinking` : family;
return resolveModelSlugForProvider("cursor", candidate) as CursorModelSlug;
}
return resolveModelSlugForProvider("cursor", family) as CursorModelSlug;
}
export function getDefaultModel(provider: ProviderKind = "codex"): ModelSlug {
return DEFAULT_MODEL_BY_PROVIDER[provider];
}