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

Function runIosSequenceChunks

src/core/dispatch-interactions.ts:345–387  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  steps: RunnerSequenceStep[],
  context: DispatchContext | undefined,
)

Source from the content-addressed store, hash-verified

343// completedSteps, and concatenated sequenceResults so recording-gestures and response shaping
344// see the whole series, not just the first chunk.
345async function runIosSequenceChunks(
346 device: DeviceInfo,
347 steps: RunnerSequenceStep[],
348 context: DispatchContext | undefined,
349): Promise<Record<string, unknown>> {
350 const { runAppleRunnerCommand } = await import('../platforms/apple/core/runner/runner-client.ts');
351 const { MAX_RUNNER_SEQUENCE_STEPS, buildRunnerSequenceCommand, parseRunnerSequenceResult } =
352 await import('../platforms/apple/core/runner/runner-sequence.ts');
353 const chunks = chunkRunnerSequenceStepsByBudget(steps, MAX_RUNNER_SEQUENCE_STEPS);
354
355 let firstChunkRunnerResult: Record<string, unknown> | undefined;
356 let lastChunkRunnerResult: Record<string, unknown> | undefined;
357 let completedSteps = 0;
358 const sequenceResults: unknown[] = [];
359 let stepOffset = 0;
360 for (const chunk of chunks) {
361 const runnerResult = await runAppleRunnerCommand(
362 device,
363 buildRunnerSequenceCommand(chunk, context?.appBundleId),
364 runnerOptionsFromContext(context),
365 );
366 firstChunkRunnerResult ??= runnerResult;
367 lastChunkRunnerResult = runnerResult;
368 let parsed;
369 try {
370 parsed = parseRunnerSequenceResult(runnerResult);
371 } catch (error) {
372 throw remapSequenceErrorStepIndex(error, stepOffset);
373 }
374 completedSteps += parsed.completedSteps;
375 sequenceResults.push(...parsed.results);
376 stepOffset += chunk.length;
377 }
378
379 return {
380 ...(firstChunkRunnerResult ?? {}),
381 completedSteps,
382 sequenceResults,
383 ...(lastChunkRunnerResult?.gestureEndUptimeMs !== undefined
384 ? { gestureEndUptimeMs: lastChunkRunnerResult.gestureEndUptimeMs }
385 : {}),
386 };
387}
388
389// Fuses an iOS press series — plain, double-tap, hold, and jitter variants — into `sequence`
390// runner requests, replacing both the retired `tapSeries` runner command and the N-request

Callers 2

runIosPressSequenceFunction · 0.85
runSwipeCoordinatesFunction · 0.85

Calls 7

runAppleRunnerCommandFunction · 0.85
runnerOptionsFromContextFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected