From c0b7752b45ae00142c4ded1a1e9143b2d16b083f Mon Sep 17 00:00:00 2001 From: Shivansh <89247605+Shivansh-25@users.noreply.github.com> Date: Fri, 13 Mar 2026 21:31:46 +0530 Subject: [PATCH] Allow Bypass permissions mode after Exiting plan (#410) Adds a new `ExitPlanMode` choice so users can switch directly to `bypassPermissions` after accepting a plan, instead of only `acceptEdits` or `default`. ### Changes - Updated the `ExitPlanMode` permission options in `src/acp-agent.ts` to conditionally include: - `Yes, and bypass permissions` (`optionId: "bypassPermissions"`) - Reused existing `ALLOW_BYPASS` guard so the option is only shown when bypass is supported. - Updated selection handling so `bypassPermissions` is treated as a valid accepted outcome and applies mode updates like the existing paths. --- src/acp-agent.ts | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/acp-agent.ts b/src/acp-agent.ts index 1ab61115..60ccad85 100644 --- a/src/acp-agent.ts +++ b/src/acp-agent.ts @@ -1025,16 +1025,25 @@ export class ClaudeAcpAgent implements Agent { } if (toolName === "ExitPlanMode") { + const options = [ + { + kind: "allow_always", + name: "Yes, and auto-accept edits", + optionId: "acceptEdits", + }, + { kind: "allow_once", name: "Yes, and manually approve edits", optionId: "default" }, + { kind: "reject_once", name: "No, keep planning", optionId: "plan" }, + ]; + if (ALLOW_BYPASS) { + options.unshift({ + kind: "allow_always", + name: "Yes, and bypass permissions", + optionId: "bypassPermissions", + }); + } + const response = await this.client.requestPermission({ - options: [ - { - kind: "allow_always", - name: "Yes, and auto-accept edits", - optionId: "acceptEdits", - }, - { kind: "allow_once", name: "Yes, and manually approve edits", optionId: "default" }, - { kind: "reject_once", name: "No, keep planning", optionId: "plan" }, - ], + options, sessionId, toolCall: { toolCallId: toolUseID, @@ -1052,7 +1061,9 @@ export class ClaudeAcpAgent implements Agent { } if ( response.outcome?.outcome === "selected" && - (response.outcome.optionId === "default" || response.outcome.optionId === "acceptEdits") + (response.outcome.optionId === "default" || + response.outcome.optionId === "acceptEdits" || + response.outcome.optionId === "bypassPermissions") ) { session.permissionMode = response.outcome.optionId; await this.client.sessionUpdate({