@devries-cameron20 / t3code Mirror · read-only / commits / 994bd7373c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 12:45 UTC

fix(cursor): honor auto and full access modes (#9283)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

maria committed Sep 2, 2026 at 19:27 UTC 994bd7373cf3a335c204a617604e690ed4c00cba
5 files changed +59 -5
apps/server/src/provider/Layers/CursorAdapter.test.ts
+4 -1
@@ -820,6 +820,9 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
820 );
821 assert.isDefined(permissionResponse);
822
823 + const argvRuns = yield* Effect.promise(() => readArgvLog(argvLogPath));
824 + assert.deepStrictEqual(argvRuns, [["--force", "acp"]]);
825 +
826 yield* adapter.stopSession(threadId);
827 }),
828 );
@@ -1260,7 +1263,7 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
1263
1264 const argvRuns = yield* Effect.promise(() => readArgvLog(argvLogPath));
1265 assert.lengthOf(argvRuns, 1, "session should not restart — only one spawn");
1263 - assert.deepStrictEqual(argvRuns[0], ["acp"]);
1266 + assert.deepStrictEqual(argvRuns[0], ["--force", "acp"]);
1267
1268 const requests = yield* Effect.promise(() => readJsonLines(requestLogPath));
1269 const setConfigRequests = requests.filter(
apps/server/src/provider/Layers/CursorAdapter.ts
+1
@@ -537,6 +537,7 @@ export function makeCursorAdapter(
537 ...(options?.environment ? { environment: options.environment } : {}),
538 childProcessSpawner,
539 cwd,
540 + runtimeMode: input.runtimeMode,
541 ...(resumeSessionId ? { resumeSessionId } : {}),
542 clientInfo: { name: "t3-code", version: "0.0.0" },
543 ...(mcpSession
apps/server/src/provider/acp/CursorAcpSupport.test.ts
+27
@@ -74,6 +74,33 @@ describe("buildCursorAcpSpawnInput", () => {
74 cwd: "/tmp/project",
75 });
76 });
77 +
78 + it("forces approval in full-access mode", () => {
79 + expect(buildCursorAcpSpawnInput(undefined, "/tmp/project", undefined, "full-access")).toEqual({
80 + command: "cursor-agent",
81 + args: ["--force", "acp"],
82 + cwd: "/tmp/project",
83 + });
84 + });
85 +
86 + it("uses Cursor auto-review in auto mode", () => {
87 + expect(buildCursorAcpSpawnInput(undefined, "/tmp/project", undefined, "auto")).toEqual({
88 + command: "cursor-agent",
89 + args: ["--auto-review", "acp"],
90 + cwd: "/tmp/project",
91 + });
92 + });
93 +
94 + it.each(["approval-required", "auto-accept-edits"] as const)(
95 + "does not relax approval in %s mode",
96 + (runtimeMode) => {
97 + expect(buildCursorAcpSpawnInput(undefined, "/tmp/project", undefined, runtimeMode)).toEqual({
98 + command: "cursor-agent",
99 + args: ["acp"],
100 + cwd: "/tmp/project",
101 + });
102 + },
103 + );
104 });
105
106 describe("applyCursorAcpModelSelection", () => {
apps/server/src/provider/acp/CursorAcpSupport.ts
+25 -2
@@ -1,4 +1,8 @@
1 -import { type CursorSettings, type ProviderOptionSelection } from "@t3tools/contracts";
1 +import {
2 + type CursorSettings,
3 + type ProviderOptionSelection,
4 + type RuntimeMode,
5 +} from "@t3tools/contracts";
6 import * as Crypto from "effect/Crypto";
7 import * as Effect from "effect/Effect";
8 import * as Layer from "effect/Layer";
@@ -15,6 +19,17 @@ import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
19
20 type CursorAcpRuntimeCursorSettings = Pick<CursorSettings, "apiEndpoint" | "binaryPath">;
21
22 +function cursorAcpPermissionArgs(runtimeMode?: RuntimeMode): ReadonlyArray<string> {
23 + switch (runtimeMode) {
24 + case "auto":
25 + return ["--auto-review"];
26 + case "full-access":
27 + return ["--force"];
28 + default:
29 + return [];
30 + }
31 +}
32 +
33 export interface CursorAcpRuntimeInput extends Omit<
34 AcpSessionRuntime.AcpSessionRuntimeOptions,
35 "authMethodId" | "clientCapabilities" | "spawn"
@@ -22,6 +37,7 @@ export interface CursorAcpRuntimeInput extends Omit<
37 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
38 readonly cursorSettings: CursorAcpRuntimeCursorSettings | null | undefined;
39 readonly environment?: NodeJS.ProcessEnv;
40 + readonly runtimeMode?: RuntimeMode;
41 }
42
43 export interface CursorAcpModelSelectionErrorContext {
@@ -34,11 +50,13 @@ export function buildCursorAcpSpawnInput(
50 cursorSettings: CursorAcpRuntimeCursorSettings | null | undefined,
51 cwd: string,
52 environment?: NodeJS.ProcessEnv,
53 + runtimeMode?: RuntimeMode,
54 ): AcpSessionRuntime.AcpSpawnInput {
55 return {
56 command: cursorSettings?.binaryPath || "cursor-agent",
57 args: [
58 ...(cursorSettings?.apiEndpoint ? (["-e", cursorSettings.apiEndpoint] as const) : []),
59 + ...cursorAcpPermissionArgs(runtimeMode),
60 "acp",
61 ],
62 cwd,
@@ -57,7 +75,12 @@ export const makeCursorAcpRuntime = (
75 const acpContext = yield* Layer.build(
76 AcpSessionRuntime.layer({
77 ...input,
60 - spawn: buildCursorAcpSpawnInput(input.cursorSettings, input.cwd, input.environment),
78 + spawn: buildCursorAcpSpawnInput(
79 + input.cursorSettings,
80 + input.cwd,
81 + input.environment,
82 + input.runtimeMode,
83 + ),
84 authMethodId: "cursor_login",
85 clientCapabilities: CURSOR_PARAMETERIZED_MODEL_PICKER_CAPABILITIES,
86 }).pipe(
docs/user/permission-modes.md
+2 -2
@@ -17,8 +17,8 @@ without prompting; commands and anything else still stop for approval.
17
18 **Auto**: routine actions proceed without you; risky ones still ask. How this is enforced depends
19 on the provider: Codex delegates routine approvals to an AI reviewer, Claude uses its own auto
20 -permission mode, and providers without an equivalent (such as OpenCode) fall back to asking, like
21 -Supervised.
20 +permission mode, Cursor uses Smart Auto review, and providers without an equivalent (such as
21 +OpenCode) fall back to asking, like Supervised.
22
23 **Full access**: allow commands and edits without prompts. The default. The agent runs
24 unattended until it finishes or asks a question of its own.