feat(desktop): add permission mode cycling via shift+tab#69
Merged
Conversation
Implement cycling between three permission modes (Plan/Auto-Accept/Ask) using Shift+Tab keyboard shortcut, matching Claude Code CLI behavior. - Add PermissionMode type to shared package - Create PermissionModeStore with global/per-agent override support - Add Shift+Tab handler in Canvas (coordinated with ActionPill) - Display permission mode indicator on agent nodes (visible on hover) - Persist mode selection to localStorage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts: - Canvas.tsx: kept both permissionModeStore (feature) and worktreeService (main) - ActionPill.tsx: used main's refactored version in features/action-pill/, added window.__actionPillExpanded sync for permission mode cycling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…n-mode-cycling-vi
- Add permission mode indicator UI to AgentChatView with click cycling - Add useExpose bindings to Canvas for node creation (addAgentNode, etc.) - Add useExpose bindings to AgentNodePresentation for view/permission control - Update ClaudeCodeAdapter to pass permission flags to CLI: - plan: --allowedTools "Read,Glob,Grep,LSP,WebFetch,WebSearch" - auto-accept: --dangerously-skip-permissions - ask: no additional flags (default interactive mode) - Update ICodingAgentAdapter interface with permissionMode parameter - Pass permission mode from AgentServiceImpl when building CLI commands E2E automation now supports: - expose_call(cyclePermissionMode) - cycles through modes - expose_call(setPermissionMode, [mode]) - sets specific mode - expose_call(showChat/showTerminal/showOverview) - switches views - expose_get(permissionMode/activeView/status) - reads state Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The runQuery method was stripping permission-mode from extraArgs when attempting session resume and in the fallback path. Now extracts both session-id and permission-mode, preserving permission-mode through both code paths. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove duplicate permission indicator from AgentChatView - Make permission indicator in node header clickable to cycle modes - Add hover styling to indicate interactivity - Clean up unused CSS and code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…luse - SharedEventDispatcher: Show all SDK permission:request events in ActionPill, not just AskUserQuestion (SDK chat has no terminal UI) - ClaudeCodeAgent: Filter PreToolUse hook to only emit for AskUserQuestion; other tool events come through PermissionRequest (via canUseTool) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add permissionMode to GenerateRequest interface - Pass permissionMode from AgentServiceImpl to SDK adapter - Add restartSession method for permission mode changes - Update IPC types for permission mode support Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CLI handles its own permission mode, so the indicator is only shown in overview and chat views. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
4 issues found across 18 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/desktop/src/renderer/features/action-pill/ActionPill.tsx">
<violation number="1" location="apps/desktop/src/renderer/features/action-pill/ActionPill.tsx:46">
P2: Clear the global `__actionPillExpanded` flag on unmount to avoid leaving stale state if the ActionPill is removed while expanded.</violation>
</file>
<file name="apps/desktop/src/renderer/services/impl/AgentServiceImpl.ts">
<violation number="1" location="apps/desktop/src/renderer/services/impl/AgentServiceImpl.ts:527">
P2: Magic number 500ms delay should be a named constant. Consider using a descriptive constant like `TERMINAL_READY_DELAY_MS` and document why this specific value was chosen. Better yet, consider using a more robust mechanism to detect terminal readiness instead of an arbitrary timeout.</violation>
</file>
<file name="apps/desktop/src/main/services/coding-agent/query-executor/SdkQueryExecutor.ts">
<violation number="1" location="apps/desktop/src/main/services/coding-agent/query-executor/SdkQueryExecutor.ts:60">
P2: Debug `console.log` should be removed or replaced with the project's logging framework (`getLogServer().log()`). Raw console statements bypass the structured logging infrastructure documented in AGENTS.md.</violation>
</file>
<file name="apps/desktop/src/renderer/nodes/AgentNode/AgentNodePresentation.tsx">
<violation number="1" location="apps/desktop/src/renderer/nodes/AgentNode/AgentNodePresentation.tsx:113">
P2: Missing immediate state sync when `data.agentId` changes. The effect subscribes to mode changes but doesn't initialize the state for the new agent. If `agentId` changes, the permission mode UI could display stale data until the next mode change triggers a subscription callback. Add an immediate state update at the start of the effect.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
apps/desktop/src/main/services/coding-agent/query-executor/SdkQueryExecutor.ts
Outdated
Show resolved
Hide resolved
- Clear global __actionPillExpanded flag on unmount to prevent stale state - Replace magic 500ms delay with named constant TERMINAL_READY_DELAY_MS - Remove debug console.log from SdkQueryExecutor - Add immediate state sync in permission mode subscription effect Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Auto-generated PR for branch
feature/add-permission-mode-cycling-viChanges
This PR was automatically created. Please update the description with relevant details.
Summary by cubic
Add permission mode cycling (Plan → Auto‑Accept → Ask) via Shift+Tab and a clickable badge on agent nodes. Modes persist per agent or globally and update Claude Code CLI flags.
New Features
AgentService passes mode to start/resume commands and supports restartSession to apply changes.
Bug Fixes
Written for commit d43709d. Summary will update on new commits.