mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
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:
parent
f146f062cb
commit
7adb9ed7ff
12 changed files with 154 additions and 136 deletions
|
|
@ -7,6 +7,7 @@ import { AcpConnection } from './acpConnection.js';
|
|||
import type {
|
||||
AcpSessionUpdate,
|
||||
AcpPermissionRequest,
|
||||
ApprovalModeValue,
|
||||
} from '../types/acpTypes.js';
|
||||
import { QwenSessionReader, type QwenSession } from './qwenSessionReader.js';
|
||||
import { QwenSessionManager } from './qwenSessionManager.js';
|
||||
|
|
@ -138,21 +139,12 @@ export class QwenAgentManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set approval mode from UI (maps UI edit mode -> ACP mode id)
|
||||
* Set approval mode from UI
|
||||
*/
|
||||
async setApprovalModeFromUi(
|
||||
uiMode: 'ask' | 'auto' | 'plan' | 'yolo',
|
||||
): Promise<'plan' | 'default' | 'auto-edit' | 'yolo'> {
|
||||
const map: Record<
|
||||
'ask' | 'auto' | 'plan' | 'yolo',
|
||||
'plan' | 'default' | 'auto-edit' | 'yolo'
|
||||
> = {
|
||||
plan: 'plan',
|
||||
ask: 'default',
|
||||
auto: 'auto-edit',
|
||||
yolo: 'yolo',
|
||||
} as const;
|
||||
const modeId = map[uiMode];
|
||||
mode: ApprovalModeValue,
|
||||
): Promise<ApprovalModeValue> {
|
||||
const modeId = mode;
|
||||
try {
|
||||
const res = await this.connection.setMode(modeId);
|
||||
// Optimistically notify UI using response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue