MCPcopy Create free account
hub / github.com/callstack/agent-device / tapCommand

Function tapCommand

src/commands/interaction/runtime/interactions.ts:154–184  ·  view source on GitHub ↗
(
  runtime: AgentDeviceRuntime,
  options: PressCommandOptions,
  action: 'click' | 'press',
)

Source from the content-addressed store, hash-verified

152};
153
154async function tapCommand(
155 runtime: AgentDeviceRuntime,
156 options: PressCommandOptions,
157 action: 'click' | 'press',
158): Promise<PressCommandResult> {
159 const nativeRefTap = await maybeTapRefTarget(runtime, options, action);
160 if (nativeRefTap) return nativeRefTap;
161
162 const resolved = await resolveInteractionTarget(runtime, options, {
163 action,
164 requireInteractive: true,
165 promoteToHittableAncestor: true,
166 });
167 if (!runtime.backend.tap) {
168 throw new AppError('UNSUPPORTED_OPERATION', 'tap is not supported by this backend');
169 }
170 const point = requireResolvedPoint(resolved);
171 const backendResult = await runtime.backend.tap(toBackendContext(runtime, options), point, {
172 button: options.button,
173 count: options.count,
174 intervalMs: options.intervalMs,
175 holdMs: options.holdMs,
176 jitterPx: options.jitterPx,
177 doubleTap: options.doubleTap,
178 });
179 const formattedBackendResult = toBackendResult(backendResult);
180 return {
181 ...resolved,
182 ...(formattedBackendResult ? { backendResult: formattedBackendResult } : {}),
183 };
184}
185
186function requireResolvedPoint(result: { point?: Point }): Point {
187 if (!result.point) {

Callers 2

pressCommandFunction · 0.85
clickCommandFunction · 0.85

Calls 6

resolveInteractionTargetFunction · 0.90
toBackendContextFunction · 0.90
toBackendResultFunction · 0.90
maybeTapRefTargetFunction · 0.85
tapMethod · 0.80
requireResolvedPointFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…