add a permission-mode cycler to the primary Claude pane
T-226. The primary pane showed the permission mode but had no way to change it (only the cockpit roster did, T-181). Add three affordances, all cycling the safe trio default -> acceptEdits -> plan over the stream-json control channel: - Ctrl/Cmd+M while the composer is focused, intercepted at the composer so it targets that pane's session. Shift+Tab (the CLI chord) is deliberately NOT used — Tab/Shift+Tab are real a11y focus-traversal intents since T-204. - The status-line mode label is now an interactive badge (ClideTappable): click, or focus + Enter/Space, cycles it. - A "Claude: Cycle permission mode" palette command targeting the primary session. bypassPermissions stays out of every cycle path here — it's reachable only via the cockpit's explicit confirm (T-181). Shared helpers (nextSafePermissionMode, statusSegmentsAroundMode) live in claude_status; the cockpit's existing copy is left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:clide/clide.dart';
|
||||
import 'package:clide/builtin/claude/src/claude_config.dart';
|
||||
import 'package:clide/builtin/claude/src/claude_status.dart' show nextSafePermissionMode;
|
||||
import 'package:clide/builtin/claude/src/claude_session_host.dart';
|
||||
import 'package:clide/builtin/claude/src/session_orchestrator.dart';
|
||||
import 'package:clide/builtin/claude/src/pane_context_status.dart';
|
||||
@@ -162,6 +163,20 @@ class ClaudeExtension extends ClideExtension {
|
||||
return IpcResponse.ok(id: '', data: {'id': id, 'mode': mode, 'status': 'sent'});
|
||||
},
|
||||
),
|
||||
// T-226: cycle the primary session's permission mode through the safe
|
||||
// trio. Palette-discoverable counterpart to the composer's Ctrl/Cmd+M.
|
||||
CommandContribution(
|
||||
id: 'claude.mode.cycle',
|
||||
command: 'claude.mode.cycle',
|
||||
title: 'Claude: Cycle permission mode',
|
||||
run: (_) async {
|
||||
final managed = _orchestrator?.byId('primary');
|
||||
if (managed == null) return IpcResponse.ok(id: '', data: const {'error': 'no primary session'});
|
||||
final next = nextSafePermissionMode(managed.session.status.permissionMode ?? 'default');
|
||||
managed.session.setPermissionMode(next);
|
||||
return IpcResponse.ok(id: '', data: {'mode': next, 'status': 'sent'});
|
||||
},
|
||||
),
|
||||
// Usage: clide claude.task.reassign <taskId> <toSessionId>
|
||||
CommandContribution(
|
||||
id: 'claude.task.reassign',
|
||||
|
||||
Reference in New Issue
Block a user