@swmansion/argent 0.34.1-next.23 → 0.34.1-next.25
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.
- package/assets/ios-screen-stream/Info.plist +12 -0
- package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
- package/dist/cli-cmds.mjs +10 -1
- package/dist/client.js +6 -0
- package/dist/installer.mjs +10 -1
- package/dist/mcp-server.mjs +9 -0
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +5 -7
- package/dist/tool-server.cjs +2275 -1691
- package/package.json +1 -1
- package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +1 -1
- package/skills/argent-ios-device-interact/SKILL.md +2 -2
- package/skills/argent-screen-recording/SKILL.md +3 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleIdentifier</key>
|
|
6
|
+
<string>com.swmansion.argent.ios-screen-stream</string>
|
|
7
|
+
<key>CFBundleName</key>
|
|
8
|
+
<string>Argent iPhone screen capture</string>
|
|
9
|
+
<key>NSCameraUsageDescription</key>
|
|
10
|
+
<string>Argent records the screen of an iPhone connected to this Mac by cable.</string>
|
|
11
|
+
</dict>
|
|
12
|
+
</plist>
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
// Serves a cabled iPhone's screen as an MJPEG stream on 127.0.0.1.
|
|
2
|
+
//
|
|
3
|
+
// Usage: ios-screen-stream [--name <device name>] [--fps <n>] [--quality <0-1>]
|
|
4
|
+
//
|
|
5
|
+
// macOS exposes a cabled iPhone's screen (what QuickTime's "New Movie
|
|
6
|
+
// Recording" shows) as an AVFoundation capture device once the process opts in
|
|
7
|
+
// to screen-capture devices through CoreMediaIO. Nothing runs on the phone.
|
|
8
|
+
//
|
|
9
|
+
// Protocol, one JSON object per stdout line:
|
|
10
|
+
// {"event":"awaiting_permission"} macOS is asking the user for camera access
|
|
11
|
+
// {"event":"ready","port":N,"device":…} GET http://127.0.0.1:N/ streams frames
|
|
12
|
+
// {"event":"error","code":…,"message":…} then exit 1
|
|
13
|
+
// The stream is multipart/x-mixed-replace;boundary=NextFrame, the same shape
|
|
14
|
+
// simulator-server serves. The process exits when stdin closes, so it never
|
|
15
|
+
// outlives the tool-server that spawned it.
|
|
16
|
+
//
|
|
17
|
+
// The tool-server compiles this file with `xcrun swiftc` on first use and
|
|
18
|
+
// embeds Info.plist (see ios-screen-stream.ts).
|
|
19
|
+
|
|
20
|
+
import AVFoundation
|
|
21
|
+
import CoreImage
|
|
22
|
+
import CoreMediaIO
|
|
23
|
+
import Foundation
|
|
24
|
+
import Network
|
|
25
|
+
|
|
26
|
+
setvbuf(stdout, nil, _IOLBF, 0)
|
|
27
|
+
|
|
28
|
+
func emit(_ obj: [String: Any]) {
|
|
29
|
+
guard let data = try? JSONSerialization.data(withJSONObject: obj) else { return }
|
|
30
|
+
FileHandle.standardOutput.write(data + Data([0x0A]))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
func fail(_ code: String, _ message: String) -> Never {
|
|
34
|
+
emit(["event": "error", "code": code, "message": message])
|
|
35
|
+
exit(1)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// MARK: Responsibility
|
|
39
|
+
|
|
40
|
+
// Capture needs camera (TCC) access, which macOS checks against the
|
|
41
|
+
// *responsible* process: the app that launched the tool-server (an editor, a
|
|
42
|
+
// terminal, an agent app). An app without a camera usage string gets a
|
|
43
|
+
// promptless denial. Re-spawning with responsibility disclaimed, as terminals
|
|
44
|
+
// do for their shells, makes this binary, with its embedded Info.plist, the one
|
|
45
|
+
// macOS asks about and remembers.
|
|
46
|
+
@_silgen_name("responsibility_spawnattrs_setdisclaim")
|
|
47
|
+
func responsibility_spawnattrs_setdisclaim(
|
|
48
|
+
_ attrs: UnsafeMutablePointer<posix_spawnattr_t?>, _ disclaim: Int32) -> Int32
|
|
49
|
+
|
|
50
|
+
let disclaimedEnv = "ARGENT_SCREEN_STREAM_DISCLAIMED"
|
|
51
|
+
if getenv(disclaimedEnv) == nil {
|
|
52
|
+
var attr: posix_spawnattr_t?
|
|
53
|
+
posix_spawnattr_init(&attr)
|
|
54
|
+
_ = responsibility_spawnattrs_setdisclaim(&attr, 1)
|
|
55
|
+
setenv(disclaimedEnv, "1", 1)
|
|
56
|
+
var child: pid_t = 0
|
|
57
|
+
let rc = posix_spawn(&child, CommandLine.unsafeArgv[0], nil, &attr, CommandLine.unsafeArgv, environ)
|
|
58
|
+
if rc != 0 { fail("spawn_failed", "Could not re-spawn the capture helper (errno \(rc)).") }
|
|
59
|
+
// Pass termination on. The child shares our stdin, so it also exits on EOF.
|
|
60
|
+
var sources: [DispatchSourceSignal] = []
|
|
61
|
+
for sig in [SIGTERM, SIGINT, SIGHUP] {
|
|
62
|
+
signal(sig, SIG_IGN)
|
|
63
|
+
let source = DispatchSource.makeSignalSource(signal: sig)
|
|
64
|
+
source.setEventHandler { kill(child, sig) }
|
|
65
|
+
source.resume()
|
|
66
|
+
sources.append(source)
|
|
67
|
+
}
|
|
68
|
+
DispatchQueue.global().async {
|
|
69
|
+
var status: Int32 = 0
|
|
70
|
+
while waitpid(child, &status, 0) == -1 && errno == EINTR {}
|
|
71
|
+
exit((status & 0x7f) == 0 ? (status >> 8) & 0xff : 1)
|
|
72
|
+
}
|
|
73
|
+
withExtendedLifetime(sources) { dispatchMain() }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// MARK: Arguments
|
|
77
|
+
|
|
78
|
+
var wantedName: String?
|
|
79
|
+
var fps = 30.0
|
|
80
|
+
var quality = 0.8
|
|
81
|
+
do {
|
|
82
|
+
var args = CommandLine.arguments.dropFirst().makeIterator()
|
|
83
|
+
while let arg = args.next() {
|
|
84
|
+
switch arg {
|
|
85
|
+
case "--name": wantedName = args.next()
|
|
86
|
+
case "--fps": fps = Double(args.next() ?? "") ?? fps
|
|
87
|
+
case "--quality": quality = Double(args.next() ?? "") ?? quality
|
|
88
|
+
default: fail("bad_arguments", "Unknown argument \(arg).")
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Exit with the parent: stdin EOF means the tool-server let go of us.
|
|
94
|
+
DispatchQueue.global().async {
|
|
95
|
+
while FileHandle.standardInput.availableData.count > 0 {}
|
|
96
|
+
exit(0)
|
|
97
|
+
}
|
|
98
|
+
signal(SIGTERM) { _ in exit(0) }
|
|
99
|
+
signal(SIGINT) { _ in exit(0) }
|
|
100
|
+
|
|
101
|
+
// MARK: Camera permission
|
|
102
|
+
|
|
103
|
+
let permissionAdvice =
|
|
104
|
+
"Allow \"ios-screen-stream\" in System Settings > Privacy & Security > Camera, then retry."
|
|
105
|
+
switch AVCaptureDevice.authorizationStatus(for: .video) {
|
|
106
|
+
case .authorized: break
|
|
107
|
+
case .notDetermined:
|
|
108
|
+
emit(["event": "awaiting_permission"])
|
|
109
|
+
let answered = DispatchSemaphore(value: 0)
|
|
110
|
+
var granted = false
|
|
111
|
+
AVCaptureDevice.requestAccess(for: .video) { ok in
|
|
112
|
+
granted = ok
|
|
113
|
+
answered.signal()
|
|
114
|
+
}
|
|
115
|
+
if answered.wait(timeout: .now() + 120) == .timedOut || !granted {
|
|
116
|
+
fail("camera_permission_denied",
|
|
117
|
+
"macOS did not grant the camera access it requires to capture an iPhone screen. \(permissionAdvice)")
|
|
118
|
+
}
|
|
119
|
+
default:
|
|
120
|
+
fail("camera_permission_denied",
|
|
121
|
+
"Camera access, which macOS requires to capture an iPhone screen, is denied. \(permissionAdvice)")
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// MARK: Device discovery
|
|
125
|
+
|
|
126
|
+
var allowProperty = CMIOObjectPropertyAddress(
|
|
127
|
+
mSelector: CMIOObjectPropertySelector(kCMIOHardwarePropertyAllowScreenCaptureDevices),
|
|
128
|
+
mScope: CMIOObjectPropertyScope(kCMIOObjectPropertyScopeGlobal),
|
|
129
|
+
mElement: CMIOObjectPropertyElement(kCMIOObjectPropertyElementMain))
|
|
130
|
+
var allow: UInt32 = 1
|
|
131
|
+
let allowStatus = CMIOObjectSetPropertyData(
|
|
132
|
+
CMIOObjectID(kCMIOObjectSystemObject), &allowProperty, 0, nil,
|
|
133
|
+
UInt32(MemoryLayout<UInt32>.size), &allow)
|
|
134
|
+
if allowStatus != 0 {
|
|
135
|
+
fail("helper_failed", "CoreMediaIO refused to expose screen-capture devices (status \(allowStatus)).")
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// An iPhone screen is an external, muxed device with model "iOS Device". The
|
|
139
|
+
/// phone's Continuity Camera is external too, but carries video media.
|
|
140
|
+
func screenDevices() -> [AVCaptureDevice] {
|
|
141
|
+
AVCaptureDevice.DiscoverySession(
|
|
142
|
+
deviceTypes: [.external], mediaType: nil, position: .unspecified
|
|
143
|
+
).devices.filter { $0.hasMediaType(.muxed) && $0.modelID == "iOS Device" }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// devicectl and AVFoundation may spell the apostrophe in "Name's iPhone" differently.
|
|
147
|
+
func normalize(_ s: String) -> String {
|
|
148
|
+
s.replacingOccurrences(of: "\u{2019}", with: "'").lowercased()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// The screen of the named iPhone, or the only one when the name matches none
|
|
152
|
+
/// (a renamed phone can keep its old name on one side for a while).
|
|
153
|
+
func pickDevice() -> AVCaptureDevice? {
|
|
154
|
+
let all = screenDevices()
|
|
155
|
+
if let wantedName {
|
|
156
|
+
let matches = all.filter { normalize($0.localizedName) == normalize(wantedName) }
|
|
157
|
+
if matches.count > 1 {
|
|
158
|
+
fail("ambiguous_device",
|
|
159
|
+
"\(matches.count) cabled iPhones are named \"\(wantedName)\", so argent cannot tell which screen to record. Rename one in Settings > General > About, or unplug the others.")
|
|
160
|
+
}
|
|
161
|
+
if let match = matches.first { return match }
|
|
162
|
+
}
|
|
163
|
+
if all.count > 1 {
|
|
164
|
+
let names = all.map(\.localizedName).joined(separator: ", ")
|
|
165
|
+
fail("ambiguous_device",
|
|
166
|
+
"\(all.count) cabled iPhones are connected (\(names)) and none is named \"\(wantedName ?? "")\".")
|
|
167
|
+
}
|
|
168
|
+
return all.first
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// The device appears asynchronously after the opt-in, usually within 0.5s.
|
|
172
|
+
var device: AVCaptureDevice?
|
|
173
|
+
let discoveryDeadline = Date().addingTimeInterval(5)
|
|
174
|
+
while device == nil && Date() < discoveryDeadline {
|
|
175
|
+
device = pickDevice()
|
|
176
|
+
if device == nil { RunLoop.current.run(until: Date().addingTimeInterval(0.1)) }
|
|
177
|
+
}
|
|
178
|
+
guard let device else {
|
|
179
|
+
fail("device_not_found",
|
|
180
|
+
"macOS exposes no iPhone screen for capture. Connect the iPhone with a USB cable (not Wi-Fi), unlock it, and trust this Mac.")
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// MARK: Frames
|
|
184
|
+
|
|
185
|
+
final class FrameSink: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate {
|
|
186
|
+
private let context = CIContext(options: [.useSoftwareRenderer: false])
|
|
187
|
+
private let colorSpace = CGColorSpace(name: CGColorSpace.sRGB)!
|
|
188
|
+
private let minInterval: CFTimeInterval
|
|
189
|
+
private let quality: Double
|
|
190
|
+
private var lastEmit: CFTimeInterval = 0
|
|
191
|
+
private let lock = NSLock()
|
|
192
|
+
private var clients: [ObjectIdentifier: NWConnection] = [:]
|
|
193
|
+
private var latest: Data?
|
|
194
|
+
|
|
195
|
+
init(fps: Double, quality: Double) {
|
|
196
|
+
minInterval = 1 / max(fps, 1)
|
|
197
|
+
self.quality = quality
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
func add(_ connection: NWConnection) {
|
|
201
|
+
lock.lock()
|
|
202
|
+
clients[ObjectIdentifier(connection)] = connection
|
|
203
|
+
let frame = latest
|
|
204
|
+
lock.unlock()
|
|
205
|
+
let head =
|
|
206
|
+
"HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace;boundary=NextFrame\r\n"
|
|
207
|
+
+ "Cache-Control: no-cache\r\nConnection: close\r\n\r\n--NextFrame"
|
|
208
|
+
send(Data(head.utf8), to: connection)
|
|
209
|
+
// The phone sends nothing while its screen is still; replay the last frame
|
|
210
|
+
// so a new client does not wait for the next change.
|
|
211
|
+
if let frame { send(part(frame), to: connection) }
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
func remove(_ connection: NWConnection) {
|
|
215
|
+
lock.lock()
|
|
216
|
+
clients[ObjectIdentifier(connection)] = nil
|
|
217
|
+
lock.unlock()
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/// Each part ends with the next boundary, so a reader that splits on the
|
|
221
|
+
/// boundary has the frame the moment it is written.
|
|
222
|
+
private func part(_ jpeg: Data) -> Data {
|
|
223
|
+
Data("\r\nContent-Type: image/jpeg\r\nContent-Length: \(jpeg.count)\r\n\r\n".utf8)
|
|
224
|
+
+ jpeg + Data("\r\n--NextFrame".utf8)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private func send(_ data: Data, to connection: NWConnection) {
|
|
228
|
+
connection.send(content: data, completion: .contentProcessed { [weak self] error in
|
|
229
|
+
if error != nil {
|
|
230
|
+
self?.remove(connection)
|
|
231
|
+
connection.cancel()
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
func captureOutput(
|
|
237
|
+
_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer,
|
|
238
|
+
from connection: AVCaptureConnection
|
|
239
|
+
) {
|
|
240
|
+
let now = CACurrentMediaTime()
|
|
241
|
+
if now - lastEmit < minInterval { return }
|
|
242
|
+
guard let pixels = CMSampleBufferGetImageBuffer(sampleBuffer),
|
|
243
|
+
let jpeg = context.jpegRepresentation(
|
|
244
|
+
of: CIImage(cvPixelBuffer: pixels), colorSpace: colorSpace,
|
|
245
|
+
options: [kCGImageDestinationLossyCompressionQuality as CIImageRepresentationOption: quality])
|
|
246
|
+
else { return }
|
|
247
|
+
lastEmit = now
|
|
248
|
+
lock.lock()
|
|
249
|
+
latest = jpeg
|
|
250
|
+
let targets = Array(clients.values)
|
|
251
|
+
lock.unlock()
|
|
252
|
+
let payload = part(jpeg)
|
|
253
|
+
for client in targets { send(payload, to: client) }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
let session = AVCaptureSession()
|
|
258
|
+
let input: AVCaptureDeviceInput
|
|
259
|
+
do {
|
|
260
|
+
input = try AVCaptureDeviceInput(device: device)
|
|
261
|
+
} catch {
|
|
262
|
+
fail("helper_failed", "Could not open \(device.localizedName)'s screen: \(error.localizedDescription)")
|
|
263
|
+
}
|
|
264
|
+
guard session.canAddInput(input) else {
|
|
265
|
+
fail("helper_failed", "\(device.localizedName)'s screen cannot join a capture session.")
|
|
266
|
+
}
|
|
267
|
+
session.addInput(input)
|
|
268
|
+
|
|
269
|
+
let output = AVCaptureVideoDataOutput()
|
|
270
|
+
output.alwaysDiscardsLateVideoFrames = true
|
|
271
|
+
output.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA]
|
|
272
|
+
let sink = FrameSink(fps: fps, quality: quality)
|
|
273
|
+
output.setSampleBufferDelegate(sink, queue: DispatchQueue(label: "ios-screen-stream.capture"))
|
|
274
|
+
guard session.canAddOutput(output) else {
|
|
275
|
+
fail("helper_failed", "Could not attach a video output to \(device.localizedName)'s screen.")
|
|
276
|
+
}
|
|
277
|
+
session.addOutput(output)
|
|
278
|
+
|
|
279
|
+
// MARK: HTTP
|
|
280
|
+
|
|
281
|
+
let listener: NWListener
|
|
282
|
+
do {
|
|
283
|
+
let params = NWParameters.tcp
|
|
284
|
+
params.requiredLocalEndpoint = NWEndpoint.hostPort(host: "127.0.0.1", port: 0)
|
|
285
|
+
listener = try NWListener(using: params)
|
|
286
|
+
} catch {
|
|
287
|
+
fail("helper_failed", "Could not open a local port: \(error.localizedDescription)")
|
|
288
|
+
}
|
|
289
|
+
let serverQueue = DispatchQueue(label: "ios-screen-stream.server")
|
|
290
|
+
listener.newConnectionHandler = { connection in
|
|
291
|
+
connection.stateUpdateHandler = { state in
|
|
292
|
+
switch state {
|
|
293
|
+
case .failed, .cancelled: sink.remove(connection)
|
|
294
|
+
default: break
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
connection.start(queue: serverQueue)
|
|
298
|
+
// Any request gets the stream; read the head only to know one arrived.
|
|
299
|
+
connection.receive(minimumIncompleteLength: 1, maximumLength: 8192) { _, _, _, error in
|
|
300
|
+
if error != nil {
|
|
301
|
+
connection.cancel()
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
sink.add(connection)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
listener.stateUpdateHandler = { state in
|
|
308
|
+
switch state {
|
|
309
|
+
case .ready:
|
|
310
|
+
session.startRunning()
|
|
311
|
+
emit(["event": "ready", "port": Int(listener.port?.rawValue ?? 0), "device": device.localizedName])
|
|
312
|
+
case .failed(let error):
|
|
313
|
+
fail("helper_failed", "The local stream server failed: \(error.localizedDescription)")
|
|
314
|
+
default: break
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
listener.start(queue: serverQueue)
|
|
318
|
+
|
|
319
|
+
// CoreMediaIO delivers device frames through the main run loop; dispatchMain()
|
|
320
|
+
// would leave the session running with no samples.
|
|
321
|
+
RunLoop.main.run()
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -10761,6 +10761,12 @@ var FAILURE_CODES = {
|
|
|
10761
10761
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
10762
10762
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
10763
10763
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
10764
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
10765
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
10766
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
10767
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
10768
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
10769
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
10764
10770
|
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
10765
10771
|
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
10766
10772
|
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
@@ -10910,6 +10916,9 @@ var FAILURE_COMMANDS = [
|
|
|
10910
10916
|
"unknown",
|
|
10911
10917
|
"devicectl",
|
|
10912
10918
|
"xcodebuild",
|
|
10919
|
+
"swiftc",
|
|
10920
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
10921
|
+
"ios_screen_stream",
|
|
10913
10922
|
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
10914
10923
|
"xcresulttool"
|
|
10915
10924
|
];
|
|
@@ -36133,7 +36142,7 @@ function isCi(env = process.env) {
|
|
|
36133
36142
|
var SESSION_ID2 = randomUUID5();
|
|
36134
36143
|
function readCliVersion() {
|
|
36135
36144
|
if (true) {
|
|
36136
|
-
return "0.34.1-next.
|
|
36145
|
+
return "0.34.1-next.25";
|
|
36137
36146
|
}
|
|
36138
36147
|
return "0.0.0";
|
|
36139
36148
|
}
|
package/dist/client.js
CHANGED
|
@@ -9334,6 +9334,12 @@ var FAILURE_CODES = {
|
|
|
9334
9334
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
9335
9335
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
9336
9336
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
9337
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
9338
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
9339
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
9340
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
9341
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
9342
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
9337
9343
|
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
9338
9344
|
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
9339
9345
|
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
package/dist/installer.mjs
CHANGED
|
@@ -15968,6 +15968,12 @@ var FAILURE_CODES = {
|
|
|
15968
15968
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
15969
15969
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
15970
15970
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
15971
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
15972
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
15973
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
15974
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
15975
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
15976
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
15971
15977
|
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
15972
15978
|
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
15973
15979
|
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
@@ -16117,6 +16123,9 @@ var FAILURE_COMMANDS = [
|
|
|
16117
16123
|
"unknown",
|
|
16118
16124
|
"devicectl",
|
|
16119
16125
|
"xcodebuild",
|
|
16126
|
+
"swiftc",
|
|
16127
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
16128
|
+
"ios_screen_stream",
|
|
16120
16129
|
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
16121
16130
|
"xcresulttool"
|
|
16122
16131
|
];
|
|
@@ -16916,7 +16925,7 @@ function isCi(env = process.env) {
|
|
|
16916
16925
|
var SESSION_ID = randomUUID4();
|
|
16917
16926
|
function readCliVersion() {
|
|
16918
16927
|
if (true) {
|
|
16919
|
-
return "0.34.1-next.
|
|
16928
|
+
return "0.34.1-next.25";
|
|
16920
16929
|
}
|
|
16921
16930
|
return "0.0.0";
|
|
16922
16931
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -26044,6 +26044,12 @@ var FAILURE_CODES = {
|
|
|
26044
26044
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
26045
26045
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
26046
26046
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
26047
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
26048
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
26049
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
26050
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
26051
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
26052
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
26047
26053
|
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
26048
26054
|
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
26049
26055
|
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
@@ -26193,6 +26199,9 @@ var FAILURE_COMMANDS = [
|
|
|
26193
26199
|
"unknown",
|
|
26194
26200
|
"devicectl",
|
|
26195
26201
|
"xcodebuild",
|
|
26202
|
+
"swiftc",
|
|
26203
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
26204
|
+
"ios_screen_stream",
|
|
26196
26205
|
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
26197
26206
|
"xcresulttool"
|
|
26198
26207
|
];
|
|
@@ -3488,6 +3488,10 @@
|
|
|
3488
3488
|
const j = await d.json();
|
|
3489
3489
|
if (j && j.tree) {
|
|
3490
3490
|
vp.tree = j.tree;
|
|
3491
|
+
// The tree is drawn over the stream, in the screen's
|
|
3492
|
+
// portrait-native space; screenshots are upright. Kept to
|
|
3493
|
+
// turn a frame for cropping one (see vpUprightFrame).
|
|
3494
|
+
vp.uiOrientation = j.uiOrientation || null;
|
|
3491
3495
|
vp.treeAt = Date.now();
|
|
3492
3496
|
describeWarmupPending = false;
|
|
3493
3497
|
// A right-click that landed before the tree was loaded waits
|
|
@@ -3632,6 +3636,27 @@
|
|
|
3632
3636
|
// into a chip. Letterboxed (no distortion). Falls back to the full,
|
|
3633
3637
|
// contained image when the element isn't matched on-screen or the agent
|
|
3634
3638
|
// supplied a data: URI (treated as author-made art, shown whole).
|
|
3639
|
+
// A frame of the preview's describe tree (the screen's portrait-native
|
|
3640
|
+
// space) in the UI's upright space, the space of screenshots. The same
|
|
3641
|
+
// map as the tool-server's nativeFrameToUi.
|
|
3642
|
+
function vpUprightFrame(f, orientation) {
|
|
3643
|
+
switch (orientation) {
|
|
3644
|
+
case "landscapeRight":
|
|
3645
|
+
return { x: f.y, y: 1 - f.x - f.width, width: f.height, height: f.width };
|
|
3646
|
+
case "landscapeLeft":
|
|
3647
|
+
return { x: 1 - f.y - f.height, y: f.x, width: f.height, height: f.width };
|
|
3648
|
+
case "portraitUpsideDown":
|
|
3649
|
+
return {
|
|
3650
|
+
x: 1 - f.x - f.width,
|
|
3651
|
+
y: 1 - f.y - f.height,
|
|
3652
|
+
width: f.width,
|
|
3653
|
+
height: f.height,
|
|
3654
|
+
};
|
|
3655
|
+
default:
|
|
3656
|
+
return { x: f.x, y: f.y, width: f.width, height: f.height };
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
|
|
3635
3660
|
function applyThumbCrop(tw, frame) {
|
|
3636
3661
|
const im = tw.querySelector(".thumb-img");
|
|
3637
3662
|
if (!im || !im.naturalWidth || !im.naturalHeight) return;
|
|
@@ -5133,8 +5158,9 @@
|
|
|
5133
5158
|
};
|
|
5134
5159
|
}
|
|
5135
5160
|
if (p._node && !vp.thumbFrames[p.id]) {
|
|
5136
|
-
|
|
5137
|
-
|
|
5161
|
+
// The thumbnail crops a screenshot, which is upright, while the
|
|
5162
|
+
// tree's frame is in the stream's portrait-native space.
|
|
5163
|
+
vp.thumbFrames[p.id] = vpUprightFrame(p._node.frame, vp.uiOrientation);
|
|
5138
5164
|
}
|
|
5139
5165
|
}
|
|
5140
5166
|
layoutCards();
|
|
@@ -143,8 +143,6 @@ export interface ArgentToolArgs {
|
|
|
143
143
|
port?: number;
|
|
144
144
|
/** Device id from list-devices: the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial). */
|
|
145
145
|
device_id: string;
|
|
146
|
-
/** iOS simulator UDID from list-devices. Pass it when device_id is a logicalDeviceId (two or more devices share one Metro), so that the tap coordinates of a landscape UI are on the screen's axes. Give the UDID of the simulator that shows the app. */
|
|
147
|
-
udid?: string;
|
|
148
146
|
/** When true, only components visible on screen are returned. Set to false to include all mounted components, including those scrolled off-screen, e.g. to understand the full page structure. */
|
|
149
147
|
onScreenOnly?: boolean;
|
|
150
148
|
/** Maximum total nodes to include. When exceeded, intermediate single-child wrapper chains are collapsed to preserve both root structure and leaf elements. Default: no limit. */
|
|
@@ -590,7 +588,7 @@ export interface ArgentToolArgs {
|
|
|
590
588
|
udid: string;
|
|
591
589
|
/** Bundle ID of the app (on a Mac app, the bundle id in the device id) */
|
|
592
590
|
bundleId: string;
|
|
593
|
-
/** Raw X coordinate in points, on the
|
|
591
|
+
/** Raw X coordinate in points, on the axes of the UI as the user sees it (the axes of screenshots and describe frames); on a Mac app, points from the top-left of the area describe reports. NOT normalized [0,1] tap space. */
|
|
594
592
|
x: number;
|
|
595
593
|
/** Raw Y coordinate in points, on the same axes as x. NOT normalized [0,1] tap space. */
|
|
596
594
|
y: number;
|
|
@@ -612,7 +610,7 @@ export interface ArgentToolArgs {
|
|
|
612
610
|
udid: string;
|
|
613
611
|
/** Bundle ID of the app (on a Mac app, the bundle id in the device id) */
|
|
614
612
|
bundleId: string;
|
|
615
|
-
/** Raw X coordinate in points, on the
|
|
613
|
+
/** Raw X coordinate in points, on the axes of the UI as the user sees it (the axes of screenshots and describe frames); on a Mac app, points from the top-left of the area describe reports. NOT normalized [0,1] tap space. */
|
|
616
614
|
x: number;
|
|
617
615
|
/** Raw Y coordinate in points, on the same axes as x. NOT normalized [0,1] tap space. */
|
|
618
616
|
y: number;
|
|
@@ -873,7 +871,7 @@ export interface ArgentToolArgs {
|
|
|
873
871
|
}>;
|
|
874
872
|
};
|
|
875
873
|
"screen-recording-start": {
|
|
876
|
-
/** Target device id from `list-devices` (iOS Simulator UDID or Android serial). */
|
|
874
|
+
/** Target device id from `list-devices` (iOS Simulator UDID, cabled iPhone UDID, or Android serial). */
|
|
877
875
|
udid: string;
|
|
878
876
|
/** Auto-stop cap in seconds (default 180). Set it to slightly more than the interaction you plan to capture. */
|
|
879
877
|
timeLimitSeconds?: number;
|
|
@@ -883,13 +881,13 @@ export interface ArgentToolArgs {
|
|
|
883
881
|
showTouches?: boolean;
|
|
884
882
|
};
|
|
885
883
|
"screen-recording-stop": {
|
|
886
|
-
/** Target device id from `list-devices` (iOS Simulator UDID or Android serial). */
|
|
884
|
+
/** Target device id from `list-devices` (iOS Simulator UDID, cabled iPhone UDID, or Android serial). */
|
|
887
885
|
udid: string;
|
|
888
886
|
};
|
|
889
887
|
screenshot: {
|
|
890
888
|
/** Target device id from `list-devices` (iOS UDID, Android serial, Apple TV UDID, Vega serial, HarmonyOS id, Mac app id, or Chromium id). */
|
|
891
889
|
udid: string;
|
|
892
|
-
/** Orientation override for the screenshot (on Chromium it rotates the captured image).
|
|
890
|
+
/** Orientation override for the screenshot (on Chromium it rotates the captured image). Rarely needed: on Android and iOS simulators the capture already follows the UI's orientation, the space describe frames and gesture coordinates use, and an override can make the image disagree with them. Rejected on HarmonyOS, which captures the display in its current orientation and has no override. Ignored on physical iPhones. */
|
|
893
891
|
rotation?: "Portrait" | "LandscapeLeft" | "LandscapeRight" | "PortraitUpsideDown";
|
|
894
892
|
/** Scale factor. Defaults to ARGENT_SCREENSHOT_SCALE env var, or 0.25 if unset for iOS/Android/HarmonyOS. On a local Apple TV simulator, an Android TV or Vega, with neither set, the capture is downscaled to a 576 px long side (0.15 of a 4K capture). On Chromium the default is 1.0 (no downscale); pass <1 to opt in. Downscaling on Chromium requires the optional `sharp` dependency. On a Mac app the default is one pixel per window point, downscaled to a 768 px long side for a larger window. */
|
|
895
893
|
scale?: number;
|