@swmansion/argent 0.34.1-next.7 → 0.34.1-next.71

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 (68) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +1 -1
  3. package/assets/argent.tracecfg.pbtxt +7 -1
  4. package/assets/ios-screen-stream/Info.plist +12 -0
  5. package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
  6. package/assets/trace-processor/engine_bundle.node.js +2074 -11121
  7. package/assets/trace-processor/trace_processor.wasm +0 -0
  8. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  9. package/bin/darwin/argent-macos-helper +0 -0
  10. package/bin/darwin/ax-service +0 -0
  11. package/bin/darwin/simulator-server +0 -0
  12. package/bin/darwin/tvos-ax-service +0 -0
  13. package/bin/darwin/tvos-hid-daemon +0 -0
  14. package/bin/linux/simulator-server +0 -0
  15. package/bin/linux-arm64/simulator-server +0 -0
  16. package/bin/network-inspector/network-inspector.jar +0 -0
  17. package/bin/tcp/ax-service +0 -0
  18. package/bin/win32/simulator-server.exe +0 -0
  19. package/dist/cli-cmds.mjs +1259 -616
  20. package/dist/client.js +381 -180
  21. package/dist/flow-script-runner.mjs +1 -0
  22. package/dist/installer-help.js +4 -0
  23. package/dist/installer-help.js.map +1 -1
  24. package/dist/installer.mjs +1248 -898
  25. package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +1 -0
  26. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  27. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  28. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession.swift +3 -0
  29. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerHTTPServer.swift +21 -9
  30. package/dist/mcp-server.mjs +2675 -715
  31. package/dist/preview-ui/index.html +28 -2
  32. package/dist/tool-args.generated.d.ts +101 -33
  33. package/dist/tool-server.cjs +15873 -6272
  34. package/dylibs/libArgentAudio.dylib +0 -0
  35. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  36. package/dylibs/libKeyboardPatch.dylib +0 -0
  37. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  38. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  39. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  40. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  41. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  42. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  43. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  44. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  45. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  46. package/package.json +1 -1
  47. package/rules/argent.md +6 -23
  48. package/skills/argent-android-emulator-setup/SKILL.md +4 -4
  49. package/skills/argent-create-e2e/SKILL.md +3 -0
  50. package/skills/argent-create-e2e/references/e2e-yaml.md +20 -2
  51. package/skills/argent-create-e2e/references/live-authoring.md +12 -1
  52. package/skills/argent-device-interact/SKILL.md +22 -21
  53. package/skills/argent-device-interact/references/foldables.md +22 -0
  54. package/skills/argent-ios-device-interact/SKILL.md +3 -3
  55. package/skills/argent-ios-device-setup/SKILL.md +4 -2
  56. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  57. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  58. package/skills/argent-metro-debugger/SKILL.md +26 -14
  59. package/skills/argent-native-profiler/SKILL.md +14 -2
  60. package/skills/argent-qa-e2e/SKILL.md +1 -1
  61. package/skills/argent-react-native-app-workflow/SKILL.md +2 -2
  62. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  63. package/skills/argent-react-native-optimization/references/fix-reference.md +10 -10
  64. package/skills/argent-react-native-profiler/SKILL.md +4 -3
  65. package/skills/argent-screen-recording/SKILL.md +6 -4
  66. package/skills/argent-screenshot-diff/SKILL.md +1 -1
  67. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  68. package/skills/argent-tv-interact/SKILL.md +3 -3
@@ -38,6 +38,7 @@
38
38
  </BuildAction>
39
39
  <TestAction
40
40
  buildConfiguration = "Debug"
41
+ preferredScreenCaptureFormat = "screenshots"
41
42
  selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42
43
  selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43
44
  shouldUseLaunchSchemeArgsEnv = "YES">
@@ -0,0 +1,21 @@
1
+ import XCTest
2
+
3
+ final class ArgentLaunchPerformanceTests: XCTestCase {
4
+ func testLaunchDuration() {
5
+ guard let bundleID = ProcessInfo.processInfo.environment["ARGENT_LAUNCH_BUNDLE_ID"],
6
+ !bundleID.isEmpty
7
+ else {
8
+ XCTFail("Set TEST_RUNNER_ARGENT_LAUNCH_BUNDLE_ID to the installed app's bundle ID.")
9
+ return
10
+ }
11
+
12
+ let options = XCTMeasureOptions()
13
+ // Must match LAUNCH_ITERATIONS in native-profiler/launch-analysis/measure.ts.
14
+ options.iterationCount = 5
15
+ let app = XCUIApplication(bundleIdentifier: bundleID)
16
+
17
+ measure(metrics: [XCTApplicationLaunchMetric()], options: options) {
18
+ app.launch()
19
+ }
20
+ }
21
+ }
@@ -3,11 +3,15 @@ import XCTest
3
3
 
4
4
  extension DeviceButton {
5
5
  /// The XCUIDevice member for this wire name.
6
- var hardwareButton: XCUIDevice.Button {
6
+ var hardwareButton: XCUIDevice.Button? {
7
7
  switch self {
8
8
  case .home: return .home
9
+ #if targetEnvironment(simulator)
10
+ case .volumeUp, .volumeDown: return nil
11
+ #else
9
12
  case .volumeUp: return .volumeUp
10
13
  case .volumeDown: return .volumeDown
14
+ #endif
11
15
  case .actionButton: return .action
12
16
  }
13
17
  }
@@ -191,7 +195,9 @@ extension ArgentRunnerSession {
191
195
 
192
196
  // press on an absent button is a silent no-op that would read as a
193
197
  // successful press, so it is refused up front.
194
- guard device.hasHardwareButton(button.hardwareButton) else {
198
+ guard let hardwareButton = button.hardwareButton,
199
+ device.hasHardwareButton(hardwareButton)
200
+ else {
195
201
  return .failure(
196
202
  .unsupportedOperation,
197
203
  "this \(UIDevice.current.model) has no \(button.rawValue) button",
@@ -200,7 +206,7 @@ extension ArgentRunnerSession {
200
206
  )
201
207
  }
202
208
 
203
- device.press(button.hardwareButton)
209
+ device.press(hardwareButton)
204
210
 
205
211
  return .success(MessagePayload(message: "pressed \(button.rawValue)"))
206
212
  }
@@ -112,6 +112,9 @@ final class ArgentRunnerSession: XCTestCase {
112
112
  finishLock.unlock()
113
113
 
114
114
  let server = RunnerHTTPServer(
115
+ tunnelAddress: ProcessInfo.processInfo.environment["ARGENT_RUNNER_ADDRESS"].flatMap {
116
+ $0.isEmpty ? nil : $0
117
+ },
115
118
  dispatch: { [weak self] body, deliver in
116
119
  self?.dispatch(body: body, deliver: deliver)
117
120
  },
@@ -4,10 +4,8 @@ import Network
4
4
  /// Minimal single-purpose HTTP/1.1 endpoint on NWListener: each connection
5
5
  /// carries one POSTed JSON command and receives one JSON reply, then closes.
6
6
  ///
7
- /// The listener is unauthenticated, so it binds loopback-only. The host
8
- /// reaches the runner through a usbmux forwarded stream that terminates on
9
- /// the device's own loopback. Bodies are opaque bytes handed to the
10
- /// dispatch closure.
7
+ /// USB uses a loopback listener. A CoreDevice connection binds only the
8
+ /// device's tunnel IPv6 address. Access follows the transport's host-level trust.
11
9
  final class RunnerHTTPServer {
12
10
  struct Reply {
13
11
  let status: Int
@@ -35,25 +33,39 @@ final class RunnerHTTPServer {
35
33
  /// interface is unavailable). Carries the failure description.
36
34
  private let onListenerFailure: (String) -> Void
37
35
  private var listener: NWListener?
36
+ private let tunnelAddress: String?
38
37
 
39
38
  init(
39
+ tunnelAddress: String? = nil,
40
40
  dispatch: @escaping (Data, @escaping (Reply) -> Void) -> Void,
41
41
  onFinish: @escaping () -> Void,
42
42
  onListenerFailure: @escaping (String) -> Void
43
43
  ) {
44
+ self.tunnelAddress = tunnelAddress
44
45
  self.dispatch = dispatch
45
46
  self.onFinish = onFinish
46
47
  self.onListenerFailure = onListenerFailure
47
48
  }
48
49
 
49
- /// Starts listening on loopback, on the given port or a system-assigned
50
+ /// Starts listening on the selected interface, on the given port or a system-assigned
50
51
  /// one when the port is 0.
51
52
  func start(port: UInt16) throws {
52
- // Restrict to the loopback interface rather than pinning a 127.0.0.1
53
- // endpoint. The interface restriction admits either address family and
54
- // keeps port-0 auto-assignment and the .port readback working.
55
53
  let parameters = NWParameters.tcp
56
- parameters.requiredInterfaceType = .loopback
54
+ if let address = tunnelAddress {
55
+ guard let ipv6 = IPv6Address(address),
56
+ let prefix = ipv6.rawValue.first, prefix & 0xfe == 0xfc
57
+ else {
58
+ throw NSError(domain: "ArgentRunner", code: 1, userInfo: [
59
+ NSLocalizedDescriptionKey: "Expected a CoreDevice tunnel IPv6 address"
60
+ ])
61
+ }
62
+ // Bind the tunnel only, never Wi-Fi or a wildcard address.
63
+ parameters.requiredLocalEndpoint = .hostPort(
64
+ host: NWEndpoint.Host(address), port: NWEndpoint.Port(rawValue: port)!
65
+ )
66
+ } else {
67
+ parameters.requiredInterfaceType = .loopback
68
+ }
57
69
  let listener: NWListener
58
70
 
59
71
  if port > 0, let nwPort = NWEndpoint.Port(rawValue: port) {