Skip to content

Commit 75fb664

Browse files
Check mode to be available in current session
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent a85a9f1 commit 75fb664

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/cli/src/zed-integration/zedIntegration.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,12 @@ export class Session {
416416
}
417417

418418
setMode(modeId: acp.SessionModeId): acp.SetSessionModeResponse {
419-
const mode = Object.values(ApprovalMode).find((m) => m === modeId);
419+
const availableModes = buildAvailableModes(this.config.isPlanEnabled());
420+
const mode = availableModes.find((m) => m.id === modeId);
420421
if (!mode) {
421-
throw new Error(`Invalid mode: ${modeId}`);
422+
throw new Error(`Invalid or unavailable mode: ${modeId}`);
422423
}
423-
this.config.setApprovalMode(mode);
424+
this.config.setApprovalMode(mode.id as ApprovalMode);
424425
return {};
425426
}
426427

0 commit comments

Comments
 (0)