agent-device 0.16.9 → 0.16.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -0
  2. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.16.9.apk → agent-device-android-multitouch-helper-0.16.11.apk} +0 -0
  3. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.16.11.apk.sha256 +1 -0
  4. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.16.9.manifest.json → agent-device-android-multitouch-helper-0.16.11.manifest.json} +4 -4
  5. package/android-snapshot-helper/README.md +6 -0
  6. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.16.11.apk +0 -0
  7. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.16.11.apk.sha256 +1 -0
  8. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.16.9.manifest.json → agent-device-android-snapshot-helper-0.16.11.manifest.json} +6 -6
  9. package/dist/src/1352.js +1 -1
  10. package/dist/src/221.js +6 -6
  11. package/dist/src/2415.js +27 -27
  12. package/dist/src/2805.js +1 -1
  13. package/dist/src/4778.js +1 -0
  14. package/dist/src/5792.js +1 -1
  15. package/dist/src/6085.js +1 -1
  16. package/dist/src/6232.js +1 -1
  17. package/dist/src/8699.js +1 -1
  18. package/dist/src/9238.js +4 -0
  19. package/dist/src/9533.js +1 -1
  20. package/dist/src/9542.js +3 -3
  21. package/dist/src/apple.js +1 -1
  22. package/dist/src/apps.js +2 -2
  23. package/dist/src/args.js +54 -25
  24. package/dist/src/batch.d.ts +1 -0
  25. package/dist/src/cli.js +19 -19
  26. package/dist/src/command-metadata.js +1 -1
  27. package/dist/src/command-surface.js +1 -1
  28. package/dist/src/contracts.d.ts +1 -0
  29. package/dist/src/contracts.js +1 -1
  30. package/dist/src/generic.js +10 -10
  31. package/dist/src/index.d.ts +9 -0
  32. package/dist/src/input-actions.js +1 -1
  33. package/dist/src/record-trace.js +3 -3
  34. package/dist/src/session.js +9 -9
  35. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +7 -0
  36. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +109 -0
  37. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +282 -226
  38. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +282 -0
  39. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +29 -0
  40. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +44 -34
  41. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +41 -1
  42. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +2 -20
  43. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +10 -50
  44. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +3 -23
  45. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +64 -22
  46. package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +7 -4
  47. package/package.json +1 -1
  48. package/server.json +2 -2
  49. package/skills/dogfood/SKILL.md +1 -1
  50. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.16.9.apk.sha256 +0 -1
  51. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.16.9.apk +0 -0
  52. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.16.9.apk.sha256 +0 -1
  53. package/dist/src/2842.js +0 -1
  54. package/dist/src/8114.js +0 -4
@@ -14,6 +14,13 @@ NS_ASSUME_NONNULL_BEGIN
14
14
  radius:(double)radius
15
15
  durationMs:(double)durationMs;
16
16
 
17
+ + (NSString * _Nullable)synthesizeSwipeWithApplication:(id)application
18
+ x:(double)x
19
+ y:(double)y
20
+ x2:(double)x2
21
+ y2:(double)y2
22
+ durationMs:(double)durationMs;
23
+
17
24
  @end
18
25
 
19
26
  NS_ASSUME_NONNULL_END
@@ -47,6 +47,12 @@ static id RunnerPointerPath(
47
47
  double durationMs,
48
48
  double side
49
49
  );
50
+ static id RunnerSwipePointerPath(
51
+ const RunnerXCTestEventBridge *bridge,
52
+ CGPoint start,
53
+ CGPoint end,
54
+ double durationMs
55
+ );
50
56
  static CGPoint RunnerPointerPointAt(
51
57
  double x,
52
58
  double y,
@@ -58,6 +64,8 @@ static CGPoint RunnerPointerPointAt(
58
64
  double t,
59
65
  double side
60
66
  );
67
+ static CGPoint RunnerInterpolatedPoint(CGPoint start, CGPoint end, double t);
68
+ static double RunnerSmoothStep(double t);
61
69
 
62
70
  @implementation RunnerSynthesizedGesture
63
71
 
@@ -87,6 +95,26 @@ static CGPoint RunnerPointerPointAt(
87
95
  }
88
96
  }
89
97
 
98
+ + (NSString * _Nullable)synthesizeSwipeWithApplication:(id)application
99
+ x:(double)x
100
+ y:(double)y
101
+ x2:(double)x2
102
+ y2:(double)y2
103
+ durationMs:(double)durationMs {
104
+ @try {
105
+ return [self trySynthesizeSwipeWithApplication:application
106
+ x:x
107
+ y:y
108
+ x2:x2
109
+ y2:y2
110
+ durationMs:durationMs];
111
+ } @catch (NSException *exception) {
112
+ NSString *name = exception.name ?: @"NSException";
113
+ NSString *reason = exception.reason ?: @"private XCTest event synthesis failed";
114
+ return [NSString stringWithFormat:@"%@: %@", name, reason];
115
+ }
116
+ }
117
+
90
118
  + (NSString * _Nullable)trySynthesizeTransformWithApplication:(id)application
91
119
  x:(double)x
92
120
  y:(double)y
@@ -151,6 +179,51 @@ static CGPoint RunnerPointerPointAt(
151
179
  return nil;
152
180
  }
153
181
 
182
+ + (NSString * _Nullable)trySynthesizeSwipeWithApplication:(id)application
183
+ x:(double)x
184
+ y:(double)y
185
+ x2:(double)x2
186
+ y2:(double)y2
187
+ durationMs:(double)durationMs {
188
+ RunnerXCTestEventBridge bridge;
189
+ NSString *missing = RunnerResolveXCTestEventBridge(application, &bridge);
190
+ if (missing != nil) {
191
+ return missing;
192
+ }
193
+
194
+ NSInteger interfaceOrientation =
195
+ ((RunnerMsgSendInteger)objc_msgSend)(application, bridge.interfaceOrientationSelector);
196
+ NSInteger targetProcessID = ((RunnerMsgSendInteger)objc_msgSend)(application, bridge.processIDSelector);
197
+ if (targetProcessID <= 0) {
198
+ return @"private XCTest event synthesis unavailable: could not resolve target process ID";
199
+ }
200
+
201
+ id record = ((RunnerMsgSendInitRecord)objc_msgSend)(
202
+ [bridge.recordClass alloc],
203
+ bridge.initRecordSelector,
204
+ @"agent-device-swipe",
205
+ interfaceOrientation
206
+ );
207
+ if (record == nil) {
208
+ return @"private XCTest event synthesis failed: could not create event record";
209
+ }
210
+ ((RunnerMsgSendSetInteger)objc_msgSend)(record, bridge.setTargetProcessIDSelector, targetProcessID);
211
+
212
+ id path = RunnerSwipePointerPath(&bridge, CGPointMake(x, y), CGPointMake(x2, y2), durationMs);
213
+ if (path == nil) {
214
+ return @"private XCTest event synthesis failed: could not create pointer path";
215
+ }
216
+ ((RunnerMsgSendAddPath)objc_msgSend)(record, bridge.addPathSelector, path);
217
+
218
+ NSError *error = nil;
219
+ BOOL ok = ((RunnerMsgSendSynthesize)objc_msgSend)(record, bridge.synthesizeSelector, &error);
220
+ if (!ok) {
221
+ NSString *detail = error.localizedDescription ?: @"synthesizeWithError returned false";
222
+ return [NSString stringWithFormat:@"private XCTest event synthesis failed: %@", detail];
223
+ }
224
+ return nil;
225
+ }
226
+
154
227
  static NSString * _Nullable RunnerResolveXCTestEventBridge(
155
228
  id application,
156
229
  RunnerXCTestEventBridge *bridge
@@ -270,6 +343,31 @@ static id RunnerPointerPath(
270
343
  return path;
271
344
  }
272
345
 
346
+ static id RunnerSwipePointerPath(
347
+ const RunnerXCTestEventBridge *bridge,
348
+ CGPoint start,
349
+ CGPoint end,
350
+ double durationMs
351
+ ) {
352
+ id path =
353
+ ((RunnerMsgSendInitPath)objc_msgSend)([bridge->pathClass alloc], bridge->initPathSelector, start, 0.0);
354
+ if (path == nil) {
355
+ return nil;
356
+ }
357
+
358
+ int frameCount = MAX(3, (int)(durationMs / 16.0));
359
+ NSTimeInterval durationSeconds = durationMs / 1000.0;
360
+ for (int index = 1; index <= frameCount; index += 1) {
361
+ double t = (double)index / (double)frameCount;
362
+ CGPoint point = RunnerInterpolatedPoint(start, end, RunnerSmoothStep(t));
363
+ NSTimeInterval offset = durationSeconds * t;
364
+ ((RunnerMsgSendPathMove)objc_msgSend)(path, bridge->moveSelector, point, offset);
365
+ }
366
+
367
+ ((RunnerMsgSendPathOffset)objc_msgSend)(path, bridge->liftSelector, durationSeconds);
368
+ return path;
369
+ }
370
+
273
371
  static CGPoint RunnerPointerPointAt(
274
372
  double x,
275
373
  double y,
@@ -294,4 +392,15 @@ static CGPoint RunnerPointerPointAt(
294
392
  return CGPointMake(centerX + cos(angle) * radius * side, centerY + sin(angle) * radius * side);
295
393
  }
296
394
 
395
+ static CGPoint RunnerInterpolatedPoint(CGPoint start, CGPoint end, double t) {
396
+ return CGPointMake(
397
+ start.x + (end.x - start.x) * t,
398
+ start.y + (end.y - start.y) * t
399
+ );
400
+ }
401
+
402
+ static double RunnerSmoothStep(double t) {
403
+ return t * t * (3.0 - 2.0 * t);
404
+ }
405
+
297
406
  @end