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

Function getInteractor

src/core/interactors.ts:12–32  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  runnerContext: RunnerContext,
)

Source from the content-addressed store, hash-verified

10registerBuiltinPlatformPlugins();
11
12export async function getInteractor(
13 device: DeviceInfo,
14 runnerContext: RunnerContext,
15): Promise<Interactor> {
16 if (isActiveProviderDevice(device)) {
17 const providerInteractor = getProviderDeviceInteractor(device);
18 if (providerInteractor) return providerInteractor;
19 throw new AppError(
20 'UNSUPPORTED_OPERATION',
21 'Provider device runtime does not have an active interactor for this device.',
22 { deviceId: device.id, platform: publicPlatformString(device) },
23 );
24 }
25
26 // Byte-identical replacement for the former per-platform switch: each plugin's
27 // `createInteractor` is the SAME lazy dynamic import + factory call the switch
28 // arm performed, and `getPlugin` throws the SAME `UNSUPPORTED_PLATFORM` AppError
29 // the switch default threw. Registry exhaustiveness (BuiltinPluginsCoverAllPlatforms)
30 // guarantees every leaf `Platform` resolves.
31 return await getPlugin(device.platform).createInteractor(device, runnerContext);
32}

Callers 2

dispatchCommandFunction · 0.90

Calls 4

isActiveProviderDeviceFunction · 0.90
publicPlatformStringFunction · 0.90
getPluginFunction · 0.90

Tested by

no test coverage detected