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 21, 07:15 UTC
feat(fx): offer Full access where the installed fx supports it (#26969)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Jake Leventhal committed
Nov 18, 2026 at 20:13 UTC
cbd8267c2d9aeb682fb2306215e442492aff3196
10 files changed
+145
-40
apps/server/src/orchestration-v2/Adapters/FxAdapterV2.test.ts
+13
-7
@@ -55,7 +55,7 @@ const NAMED_MODEL = "anthropic/claude-sonnet-5.5";
55
const CUSTOM_MODEL = "openai/gpt-6.1-sol";
56
const CODEX_MODEL = "gpt-6.1-sol";
57
const FX_0_0_13_MODES = ["code", "ask"];
58
-/** fx `main` after vercel-labs/fx#1189. */
58
+/** fx 0.0.14+, after vercel-labs/fx#1189. */
59
const FX_MAIN_MODES = ["auto", "ask", "full-access"];
60
61
type Frame = Record<string, unknown>;
@@ -277,16 +277,22 @@ const openFxSession = Effect.fn("openFxSession")(function* (input: {
277
});
278
279
describe("FxAdapterV2", () => {
280
- it.effect("runs Auto as fx's `code` mode on 0.0.13 and as `auto` where fx advertises it", () =>
280
+ it.effect("runs Auto as `code` on 0.0.13, and Auto and Full access as fx names them later", () =>
281
Effect.forEach(
282
[
283
- { scenario: "auto-0-0-13", modes: FX_0_0_13_MODES, written: "code" },
284
- { scenario: "auto-main", modes: FX_MAIN_MODES, written: "auto" },
285
- ],
286
- ({ scenario, modes, written }) =>
283
+ { scenario: "auto-0-0-13", runtimeMode: "auto", modes: FX_0_0_13_MODES, written: "code" },
284
+ { scenario: "auto-main", runtimeMode: "auto", modes: FX_MAIN_MODES, written: "auto" },
285
+ {
286
+ scenario: "full-access-main",
287
+ runtimeMode: "full-access",
288
+ modes: FX_MAIN_MODES,
289
+ written: "full-access",
290
+ },
291
+ ] as const,
292
+ ({ scenario, runtimeMode, modes, written }) =>
293
openFxSession({
294
scenario,
289
- runtimeMode: "auto",
295
+ runtimeMode,
296
frames: [
297
...initialize,
298
outbound("session/new", {
apps/server/src/orchestration-v2/RuntimePolicy.ts
+1
-1
@@ -88,7 +88,7 @@ export const layer: Layer.Layer<RuntimePolicyV2> = Layer.succeed(RuntimePolicyV2
88
}),
89
});
90
91
-function providerRuntimeMode(
91
+export function providerRuntimeMode(
92
runtimeMode: RuntimeMode,
93
supportedRuntimeModes: ReadonlyArray<RuntimeMode> | undefined,
94
): RuntimeMode {
apps/server/src/orchestration-v2/testkit/FxReplayFixtures.integration.test.ts
+18
-1
@@ -1,10 +1,27 @@
1
import { describe } from "@effect/vitest";
2
+import { FX_SUPPORTED_RUNTIME_MODES } from "@t3tools/provider-fx/testing";
3
4
import { FxOrchestratorReplayHarness } from "../Adapters/FxAdapterV2.testkit.ts";
5
+import { providerRuntimeMode } from "../RuntimePolicy.ts";
6
import { itRunsReplayFixtures, runReplayFixture } from "./ProviderReplayFixtures.ts";
7
8
describe("fx replay fixtures", () => {
9
+ // Recorded where fx's snapshot offers no Full access (0.0.13), so a thread
10
+ // set to it runs as RuntimePolicy resolves it there: Supervised.
11
itRunsReplayFixtures("fx", (input) =>
8
- runReplayFixture({ ...input, harness: FxOrchestratorReplayHarness }),
12
+ runReplayFixture({
13
+ ...input,
14
+ buildInput: () => {
15
+ const fixtureInput = input.buildInput();
16
+ return {
17
+ ...fixtureInput,
18
+ runtimeMode: providerRuntimeMode(
19
+ fixtureInput.runtimeMode ?? "full-access",
20
+ FX_SUPPORTED_RUNTIME_MODES,
21
+ ),
22
+ };
23
+ },
24
+ harness: FxOrchestratorReplayHarness,
25
+ }),
26
);
27
});
docs/user/permission-modes.md
+2
-2
@@ -34,8 +34,8 @@ to you for approval. On fx, prompts it still sends also come to you.
34
Muse Code offers only **Supervised** and **Full access**. A Muse thread already set to another mode
35
runs in **Supervised**.
36
37
-T3 Code offers no **Auto-accept edits** or **Full access** for fx. An fx thread already set to either runs in
38
-**Supervised**.
37
+T3 Code offers no **Auto-accept edits** for fx, and **Full access** only with fx 0.0.14 or later. An fx
38
+thread set to a mode its fx lacks runs in **Supervised**.
39
40
Grok offers no **Auto-accept edits**. A Grok thread already set to it runs in **Supervised**. Grok
41
file-change approvals offer **Allow all edits this session**. Its command approvals have no
docs/user/providers-fx.md
+7
-7
@@ -43,14 +43,15 @@ fx threads load the MCP servers from fx's profile config, `~/.fx/mcp.json`, on t
43
44
## Permission modes
45
46
-fx offers two composer modes.
46
+| Mode | Behavior |
47
+| --------------- | ----------------------------------------------------------------------------------- |
48
+| **Supervised** | fx asks before it changes files or runs commands. Read requests run without asking. |
49
+| **Auto** | fx handles routine actions itself. Anything it still asks about reaches you. |
50
+| **Full access** | fx runs every action without asking. Needs fx 0.0.14 or later. |
51
48
-| Mode | Behavior |
49
-| -------------- | ----------------------------------------------------------------------------------- |
50
-| **Supervised** | fx asks before it changes files or runs commands. Read requests run without asking. |
51
-| **Auto** | fx handles routine actions itself. Anything it still asks about reaches you. |
52
+T3 Code offers **Full access** only when the server's fx reports it. After you upgrade fx, refresh the provider in **Settings → Providers** to see it. On an older fx, or before the provider check finishes, a thread set to **Full access** runs in **Supervised**.
53
53
-T3 Code does not offer **Full access** or **Auto-accept edits** for fx. A thread already set to one of those runs in **Supervised**. Changing the permission mode restarts the connection and reloads the same fx session.
54
+T3 Code does not offer **Auto-accept edits** for fx. A thread already set to it runs in **Supervised**. Changing the permission mode restarts the connection and reloads the same fx session.
55
56
On fx 0.0.14 and later, fx saves the mode T3 Code sets as its default permission mode. T3 Code sets it each time it opens an fx thread, so fx in the terminal then starts in that thread's mode.
57
@@ -64,7 +65,6 @@ fx doesn't pass on a sub-agent's permission requests, so a sub-agent that needs
65
66
## Not supported yet
67
67
-- **Full access**.
68
- **Auto-accept edits**.
69
- Commit messages, pull request text, branch names, and thread titles. Pick another provider for those.
70
packages/provider-fx/src/server/acpSupport.test.ts
+30
@@ -11,6 +11,7 @@ import { ProviderAdapterV2RuntimePolicy } from "@t3tools/provider-core/server/Pr
11
import {
12
applyFxModelSelection,
13
fxPermissionDisposition,
14
+ fxSessionModeForPolicy,
15
fxToolCallWasCancelled,
16
} from "./acpSupport.ts";
17
@@ -39,6 +40,35 @@ describe("fx permission prompts", () => {
40
"ask",
41
);
42
});
43
+
44
+ it("answers Full access prompts itself unless an explicit policy confines them", () => {
45
+ const fullAccess = {
46
+ runtimeMode: "full-access",
47
+ interactionMode: "default",
48
+ cwd: "/work",
49
+ } as const;
50
+ assert.equal(
51
+ fxPermissionDisposition(ProviderAdapterV2RuntimePolicy.make(fullAccess), editRequest),
52
+ "allow",
53
+ );
54
+ // Runs fx's `ask`, so the policy decides what fx asks about.
55
+ assert.equal(
56
+ fxPermissionDisposition(
57
+ ProviderAdapterV2RuntimePolicy.make({ ...fullAccess, approvalPolicy: "on-request" }),
58
+ editRequest,
59
+ ),
60
+ "ask",
61
+ );
62
+ for (const confined of [
63
+ { approvalPolicy: "on-request" },
64
+ { sandboxPolicy: { type: "readOnly" } },
65
+ ] as const) {
66
+ assert.equal(
67
+ fxSessionModeForPolicy(ProviderAdapterV2RuntimePolicy.make({ ...fullAccess, ...confined })),
68
+ "ask",
69
+ );
70
+ }
71
+ });
72
});
73
74
describe("fx model selection", () => {
packages/provider-fx/src/server/acpSupport.ts
+30
-15
@@ -53,10 +53,13 @@ export const FX_EFFORT_OPTION_DESCRIPTOR: ProviderOptionDescriptor = {
53
})),
54
};
55
56
+/** Every fx offers these; the provider snapshot adds Full access where `fx status` lists `full-access`. */
57
export const FX_SUPPORTED_RUNTIME_MODES = [
58
"approval-required",
59
"auto",
60
] as const satisfies ReadonlyArray<RuntimeMode>;
61
+/** fx 0.0.14+; fx 0.0.13 has no such mode. */
62
+export const FX_FULL_ACCESS_MODE_ID = "full-access";
63
/** fx 0.0.13 answers a cancelled prompt with `stopReason: cancelled`. */
64
export const FX_ACP_CANCEL_BEHAVIOR = "wait-for-prompt" as const;
65
/** fx inherits the user's `~/.fx/mcp.json` servers only when session setup asks for them. */
@@ -115,28 +118,40 @@ export function fxToolCallWasCancelled(payload: unknown): boolean {
118
}
119
120
/**
118
- * Supervised runs fx's `ask` mode and Auto its automatic review. An explicit
119
- * approval or sandbox policy must not launch automatic review, which would
120
- * perform writes the policy meant to confine.
121
+ * Supervised runs fx's `ask` mode, Auto its automatic review and Full access
122
+ * its `full-access`. An explicit approval or sandbox policy runs `ask`, so it
123
+ * never launches a mode that performs writes the policy meant to confine.
124
*/
125
export function fxSessionModeForPolicy(
126
policy: ProviderAdapter.ProviderAdapterV2RuntimePolicy,
124
-): "ask" | "auto" {
125
- return policy.runtimeMode === "auto" &&
126
- policy.approvalPolicy === undefined &&
127
- policy.sandboxPolicy === undefined
128
- ? "auto"
129
- : "ask";
127
+): "ask" | "auto" | typeof FX_FULL_ACCESS_MODE_ID {
128
+ if (policy.approvalPolicy !== undefined || policy.sandboxPolicy !== undefined) return "ask";
129
+ switch (policy.runtimeMode) {
130
+ case "auto":
131
+ return "auto";
132
+ case "full-access":
133
+ return FX_FULL_ACCESS_MODE_ID;
134
+ default:
135
+ return "ask";
136
+ }
137
}
138
132
-/** In automatic review fx asks only about what it refused itself, so every prompt reaches the user. */
139
+/**
140
+ * In automatic review fx asks only about what it refused itself, so every
141
+ * prompt reaches the user. Full access answers by the shared ACP policy.
142
+ */
143
export function fxPermissionDisposition(
144
policy: ProviderAdapter.ProviderAdapterV2RuntimePolicy,
145
request: EffectAcpSchema.RequestPermissionRequest,
146
): AcpPermissionDisposition {
137
- return fxSessionModeForPolicy(policy) === "auto"
138
- ? "ask"
139
- : acpPermissionDisposition({ ...policy, runtimeMode: "approval-required" }, request);
147
+ switch (fxSessionModeForPolicy(policy)) {
148
+ case "auto":
149
+ return "ask";
150
+ case FX_FULL_ACCESS_MODE_ID:
151
+ return acpPermissionDisposition(policy, request);
152
+ case "ask":
153
+ return acpPermissionDisposition({ ...policy, runtimeMode: "approval-required" }, request);
154
+ }
155
}
156
157
/**
@@ -147,8 +162,8 @@ export function fxPermissionDisposition(
162
*/
163
function fxModeId(requested: string, advertised: ReadonlyArray<string>): string | undefined {
164
const candidates =
150
- requested === "ask"
151
- ? ["ask"]
165
+ requested === "ask" || requested === FX_FULL_ACCESS_MODE_ID
166
+ ? [requested]
167
: requested === "auto" || requested === "code"
168
? ["auto", "code"]
169
: [];
packages/provider-fx/src/server/status.test.ts
+27
-1
@@ -44,7 +44,7 @@ function processHandle(stdout: string, code: number, answered: Effect.Effect<voi
44
45
// `fx status --json` and `fx models --json` from fx 0.0.15, trimmed to the
46
// fields T3 reads plus a few it ignores.
47
-const status = (auth: string, fields: Record<string, string> = {}) =>
47
+const status = (auth: string, fields: Record<string, unknown> = {}) =>
48
JSON.stringify({ kind: "status", model: "default", auth, auth_refreshable: false, ...fields });
49
const models = (ids: ReadonlyArray<string>) =>
50
JSON.stringify({ kind: "models", count: ids.length, private_models_hidden: false, ids });
@@ -284,6 +284,32 @@ describe("checkFxProviderStatus", () => {
284
}),
285
);
286
287
+ it.effect("offers Full access only when `fx status` lists that mode", () =>
288
+ Effect.gen(function* () {
289
+ const backends = {
290
+ "gateway status --json": status("fx login"),
291
+ "gateway models --json": GATEWAY_MODELS,
292
+ "codex status --json": status("missing"),
293
+ "grok status --json": status("missing"),
294
+ };
295
+ // fx 0.0.13 lists no modes and has no full-access mode.
296
+ const withoutModes = yield* check({ ...backends, " status --json": status("fx login") });
297
+ assert.deepEqual(withoutModes.draft.supportedRuntimeModes, ["approval-required", "auto"]);
298
+ // fx 0.0.14+ lists the ACP session modes (src/core/output/output_contracts.zig).
299
+ const withModes = yield* check({
300
+ ...backends,
301
+ " status --json": status("fx login", {
302
+ modes: [{ id: "auto" }, { id: "ask" }, { id: "full-access" }],
303
+ }),
304
+ });
305
+ assert.deepEqual(withModes.draft.supportedRuntimeModes, [
306
+ "approval-required",
307
+ "auto",
308
+ "full-access",
309
+ ]);
310
+ }),
311
+ );
312
+
313
it.effect("reports a machine signed out of every backend", () =>
314
Effect.gen(function* () {
315
const signedOut = yield* check({
packages/provider-fx/src/server/status.ts
+12
-5
@@ -20,6 +20,7 @@ import {
20
FX_DEFAULT_MODEL_SLUG,
21
FX_DRIVER_KIND,
22
FX_EFFORT_OPTION_DESCRIPTOR,
23
+ FX_FULL_ACCESS_MODE_ID,
24
FX_SUPPORTED_RUNTIME_MODES,
25
type FxModelChoice,
26
fxModelSlug,
@@ -38,11 +39,13 @@ import {
39
spawnAndCollect,
40
} from "@t3tools/provider-core/server/snapshotProbe";
41
41
-const FX_PRESENTATION = {
42
+const fxPresentation = (fullAccess: boolean) => ({
43
displayName: "fx",
44
showInteractionModeToggle: false,
44
- supportedRuntimeModes: FX_SUPPORTED_RUNTIME_MODES,
45
-} as const;
45
+ supportedRuntimeModes: fullAccess
46
+ ? [...FX_SUPPORTED_RUNTIME_MODES, "full-access" as const]
47
+ : FX_SUPPORTED_RUNTIME_MODES,
48
+});
49
const FX_MODEL_CAPABILITIES = createModelCapabilities({
50
optionDescriptors: [FX_EFFORT_OPTION_DESCRIPTOR],
51
});
@@ -115,10 +118,11 @@ const snapshot = (
118
probe: ProviderProbeResult,
119
defaultModel?: string,
120
backends: ReadonlyArray<FxBackendProbe> = [],
121
+ fullAccess = false,
122
): ServerProviderDraft => ({
123
...buildServerProvider({
124
driver: FX_DRIVER_KIND,
121
- presentation: FX_PRESENTATION,
125
+ presentation: fxPresentation(fullAccess),
126
enabled: settings.enabled,
127
checkedAt,
128
models: fxModels(settings, defaultModel, backends),
@@ -180,7 +184,8 @@ const readFxCli = (
184
/**
185
* `fx status --json`: `auth` names the login method, `missing` when signed
186
* out. `model_source` names a backend other than the gateway, by its label
183
- * for a built-in one and its id for a configured endpoint.
187
+ * for a built-in one and its id for a configured endpoint. fx 0.0.14+ also
188
+ * lists the ACP session `modes`; 0.0.13 omits them.
189
*/
190
const FxStatus = Schema.fromJsonString(
191
Schema.Struct({
@@ -188,6 +193,7 @@ const FxStatus = Schema.fromJsonString(
193
auth_help: Schema.optional(Schema.String),
194
model: Schema.optional(Schema.String),
195
model_source: Schema.optional(Schema.String),
196
+ modes: Schema.optional(Schema.Array(Schema.Struct({ id: Schema.String }))),
197
}),
198
);
199
const decodeFxStatus = Schema.decodeUnknownOption(FxStatus);
@@ -379,6 +385,7 @@ export const checkFxProviderStatus = Effect.fn("checkFxProviderStatus")(function
385
{ installed: true, version, auth, ...probe },
386
defaultModel,
387
backends,
388
+ status?.modes?.some((mode) => mode.id === FX_FULL_ACCESS_MODE_ID) ?? false,
389
);
390
});
391
packages/provider-fx/src/testing.ts
+5
-1
@@ -4,4 +4,8 @@
4
* @module provider-fx/testing
5
*/
6
export { FX_DRIVER_KIND, makeFxAdapterV2 } from "./server/adapter.ts";
7
-export { FX_ACP_CANCEL_BEHAVIOR, makeFxAcpRuntime } from "./server/acpSupport.ts";
7
+export {
8
+ FX_ACP_CANCEL_BEHAVIOR,
9
+ FX_SUPPORTED_RUNTIME_MODES,
10
+ makeFxAcpRuntime,
11
+} from "./server/acpSupport.ts";