MCPcopy Index your code
hub / github.com/callstack/agent-device / handleKeyboardCommand

Function handleKeyboardCommand

src/core/dispatch.ts:393–416  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  positionals: string[],
  context: DispatchContext | undefined,
  runnerCtx: RunnerContext,
)

Source from the content-addressed store, hash-verified

391}
392
393async function handleKeyboardCommand(
394 device: DeviceInfo,
395 positionals: string[],
396 context: DispatchContext | undefined,
397 runnerCtx: RunnerContext,
398): Promise<Record<string, unknown>> {
399 const action = (positionals[0] ?? 'status').toLowerCase();
400 if (!isKeyboardAction(action)) {
401 throw new AppError(
402 'INVALID_ARGS',
403 'keyboard requires a subcommand: status, get, dismiss, enter, or return',
404 );
405 }
406 if (positionals.length > 1) {
407 throw new AppError('INVALID_ARGS', 'keyboard accepts at most one subcommand argument');
408 }
409 if (device.platform === 'android') {
410 return await handleAndroidKeyboardCommand(device, action);
411 }
412 if (isIosFamily(device)) {
413 return await handleIosKeyboardCommand(device, action, context, runnerCtx);
414 }
415 throw new AppError('UNSUPPORTED_OPERATION', 'keyboard is supported only on Android and iOS');
416}
417
418async function handleAndroidKeyboardCommand(
419 device: DeviceInfo,

Callers 1

dispatch.tsFile · 0.85

Calls 4

isKeyboardActionFunction · 0.90
isIosFamilyFunction · 0.90
handleIosKeyboardCommandFunction · 0.85

Tested by

no test coverage detected