Skip to content

Commit 7e65313

Browse files
juliusmarmingetamaro-skaljic
authored andcommitted
Refactor Claude runtime mode mapping
- Map runtime modes to permission modes with an explicit lookup - Include approval-required as the default permission path
1 parent a3315b3 commit 7e65313

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

apps/server/src/provider/Layers/ClaudeAdapter.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
TurnId,
4040
type UserInputQuestion,
4141
ClaudeCodeEffort,
42+
RuntimeMode,
4243
} from "@t3tools/contracts";
4344
import {
4445
applyClaudePromptEffortPrefix,
@@ -2693,12 +2694,12 @@ const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
26932694
? modelSelection.options.thinking
26942695
: undefined;
26952696
const effectiveEffort = getEffectiveClaudeCodeEffort(effort);
2696-
const permissionMode: PermissionMode =
2697-
input.runtimeMode === "full-access"
2698-
? "bypassPermissions"
2699-
: input.runtimeMode === "auto-accept-edits"
2700-
? "acceptEdits"
2701-
: "default";
2697+
const runtimeModeToPermission: Record<RuntimeMode, PermissionMode> = {
2698+
"approval-required": "default",
2699+
"auto-accept-edits": "acceptEdits",
2700+
"full-access": "bypassPermissions",
2701+
};
2702+
const permissionMode = runtimeModeToPermission[input.runtimeMode];
27022703
const settings = {
27032704
...(typeof thinking === "boolean" ? { alwaysThinkingEnabled: thinking } : {}),
27042705
...(fastMode ? { fastMode: true } : {}),

0 commit comments

Comments
 (0)