({ setting, value }: Input, context)
| 109 | renderToolResultMessage, |
| 110 | renderToolUseRejectedMessage, |
| 111 | async call({ setting, value }: Input, context): Promise<{ data: Output }> { |
| 112 | // 1. Check if setting is supported |
| 113 | // Voice settings are registered at build-time (feature('VOICE_MODE')), but |
| 114 | // must also be gated at runtime. When the kill-switch is on, treat |
| 115 | // voiceEnabled as an unknown setting so no voice-specific strings leak. |
| 116 | if (feature('VOICE_MODE') && setting === 'voiceEnabled') { |
| 117 | const { isVoiceGrowthBookEnabled } = await import( |
| 118 | '../../voice/voiceModeEnabled.js' |
| 119 | ) |
| 120 | if (!isVoiceGrowthBookEnabled()) { |
| 121 | return { |
| 122 | data: { success: false, error: `Unknown setting: "${setting}"` }, |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | if (!isSupported(setting)) { |
| 127 | return { |
| 128 | data: { success: false, error: `Unknown setting: "${setting}"` }, |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | const config = getConfig(setting)! |
| 133 | const path = getPath(setting) |
| 134 | |
| 135 | // 2. GET operation |
| 136 | if (value === undefined) { |
| 137 | const currentValue = getValue(config.source, path) |
| 138 | const displayValue = config.formatOnRead |
| 139 | ? config.formatOnRead(currentValue) |
| 140 | : currentValue |
| 141 | return { |
| 142 | data: { success: true, operation: 'get', setting, value: displayValue }, |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // 3. SET operation |
| 147 | |
| 148 | // Handle "default" — unset the config key so it falls back to the |
| 149 | // platform-aware default (determined by the bridge feature gate). |
| 150 | if ( |
| 151 | setting === 'remoteControlAtStartup' && |
| 152 | typeof value === 'string' && |
| 153 | value.toLowerCase().trim() === 'default' |
| 154 | ) { |
| 155 | saveGlobalConfig(prev => { |
| 156 | if (prev.remoteControlAtStartup === undefined) return prev |
| 157 | const next = { ...prev } |
| 158 | delete next.remoteControlAtStartup |
| 159 | return next |
| 160 | }) |
| 161 | const resolved = getRemoteControlAtStartup() |
| 162 | // Sync to AppState so useReplBridge reacts immediately |
| 163 | context.setAppState(prev => { |
| 164 | if (prev.replBridgeEnabled === resolved && !prev.replBridgeOutboundOnly) |
| 165 | return prev |
| 166 | return { |
| 167 | ...prev, |
| 168 | replBridgeEnabled: resolved, |
nothing calls this directly
no test coverage detected