(runtime, options = {})
| 191 | SystemKeyboardCommandOptions | undefined, |
| 192 | SystemKeyboardCommandResult |
| 193 | > = async (runtime, options = {}): Promise<SystemKeyboardCommandResult> => { |
| 194 | if (!runtime.backend.setKeyboard) { |
| 195 | throw new AppError('UNSUPPORTED_OPERATION', 'system.keyboard is not supported by this backend'); |
| 196 | } |
| 197 | const action = options.action ?? 'status'; |
| 198 | if (!isKeyboardAction(action)) { |
| 199 | throw new AppError( |
| 200 | 'INVALID_ARGS', |
| 201 | 'system.keyboard action must be status, get, dismiss, enter, or return', |
| 202 | ); |
| 203 | } |
| 204 | const state = await runtime.backend.setKeyboard(toBackendContext(runtime, options), { action }); |
| 205 | const formattedBackendResult = toBackendResult(state); |
| 206 | const keyboardState = isKeyboardResult(state) ? state : {}; |
| 207 | if (action === 'enter' || action === 'return') { |
| 208 | return normalizeKeyboardEnterResult(keyboardState, formattedBackendResult); |
| 209 | } |
| 210 | if (action === 'dismiss') { |
| 211 | return normalizeKeyboardDismissResult(action, keyboardState, formattedBackendResult); |
| 212 | } |
| 213 | return normalizeKeyboardStateResult(action, keyboardState, formattedBackendResult); |
| 214 | }; |
| 215 | |
| 216 | export const clipboardCommand: RuntimeCommand< |
| 217 | SystemClipboardCommandOptions, |
nothing calls this directly
no test coverage detected
searching dependent graphs…