MCPcopy Create free account
hub / github.com/tiann/hapi / resolveAcpModeConfigValue

Function resolveAcpModeConfigValue

cli/src/cursor/utils/cursorModeConfig.ts:20–40  ·  view source on GitHub ↗
(
    mode: CursorPermissionMode | undefined,
    backend: AcpSdkBackend,
    sessionId: string
)

Source from the content-addressed store, hash-verified

18}
19
20function 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
42export async function applyCursorAcpMode(
43 backend: AcpSdkBackend,

Callers 1

applyCursorAcpModeFunction · 0.85

Calls 2

toCursorAcpModeFunction · 0.85

Tested by

no test coverage detected