refactor(vscode-ide-companion): introduce ApprovalMode enum and improve mode handling

- Create new approvalModeTypes.ts with ApprovalMode enum and helper functions
- Replace hardcoded string literals with ApprovalModeValue type
- Consolidate mode mapping logic using new helper functions
This commit is contained in:
yiliang114
2025-12-08 23:12:04 +08:00
parent f146f062cb
commit 7adb9ed7ff
12 changed files with 154 additions and 136 deletions

View File

@@ -10,6 +10,7 @@ import type {
AcpPermissionRequest,
AcpResponse,
AcpSessionUpdate,
ApprovalModeValue,
} from '../types/acpTypes.js';
import type { ChildProcess, SpawnOptions } from 'child_process';
import { spawn } from 'child_process';
@@ -380,9 +381,7 @@ export class AcpConnection {
/**
* Set approval mode
*/
async setMode(
modeId: 'plan' | 'default' | 'auto-edit' | 'yolo',
): Promise<AcpResponse> {
async setMode(modeId: ApprovalModeValue): Promise<AcpResponse> {
return this.sessionManager.setMode(
modeId,
this.child,