(
mode: CursorPermissionMode | undefined,
backend: AcpSdkBackend,
sessionId: string
)
| 18 | } |
| 19 | |
| 20 | function resolveAcpModeConfigValue( |
| 21 | mode: CursorPermissionMode | undefined, |
| 22 | backend: AcpSdkBackend, |
| 23 | sessionId: string |
| 24 | ): string { |
| 25 | const acpMode = toCursorAcpMode(mode); |
| 26 | const modeOption = backend.getConfigOptionByCategory?.(sessionId, 'mode'); |
| 27 | const optionValues = modeOption?.options.map((entry) => entry.value) ?? []; |
| 28 | if (optionValues.includes(acpMode)) { |
| 29 | return acpMode; |
| 30 | } |
| 31 | if (mode === 'yolo' || mode === 'default') { |
| 32 | if (optionValues.includes('agent')) { |
| 33 | return 'agent'; |
| 34 | } |
| 35 | } |
| 36 | if (mode === 'debug' && optionValues.includes('debug')) { |
| 37 | return 'debug'; |
| 38 | } |
| 39 | return acpMode; |
| 40 | } |
| 41 | |
| 42 | export async function applyCursorAcpMode( |
| 43 | backend: AcpSdkBackend, |
no test coverage detected