@swmansion/argent 0.34.1-next.96 → 0.34.1-next.98
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/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/tool-args.generated.d.ts +32 -32
- package/dist/tool-server.cjs +250 -190
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +7 -15
- package/skills/argent-device-interact/SKILL.md +25 -23
- package/skills/argent-macos-app-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +25 -25
- package/skills/argent-qa-e2e/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/references/fix-reference.md +10 -10
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
package/dist/tool-server.cjs
CHANGED
|
@@ -72948,7 +72948,7 @@ function isCi(env = process.env) {
|
|
|
72948
72948
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72949
72949
|
function readCliVersion() {
|
|
72950
72950
|
if (true) {
|
|
72951
|
-
return "0.34.1-next.
|
|
72951
|
+
return "0.34.1-next.98";
|
|
72952
72952
|
}
|
|
72953
72953
|
return "0.0.0";
|
|
72954
72954
|
}
|
|
@@ -125226,19 +125226,19 @@ async function queryViewHierarchyFor(services, params, toolId, method, errorCode
|
|
|
125226
125226
|
// ../tool-server/src/tools/network/network-capture.ts
|
|
125227
125227
|
var captureSchema = external_exports.object({
|
|
125228
125228
|
udid: external_exports.string().describe(
|
|
125229
|
-
"
|
|
125229
|
+
"Device ID from list-devices<flag:macos-apps>. For Mac builds started outside Argent, use macos-app-<bundle id></flag:macos-apps>."
|
|
125230
125230
|
),
|
|
125231
125231
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
125232
|
-
"App bundle ID on iOS or package name on Android<flag:macos-apps>. On Mac
|
|
125232
|
+
"App bundle ID on iOS or package name on Android<flag:macos-apps>. On Mac, omit the macos-app- prefix</flag:macos-apps>. On Chromium, use a valid placeholder such as argent.capture."
|
|
125233
125233
|
),
|
|
125234
125234
|
port: metroPortField.describe(
|
|
125235
|
-
"The app's Metro port. Omit it
|
|
125235
|
+
"The app's Metro port for JS capture and native log filtering. Omit it only when the app uses the device's port (usually 8081); otherwise check the project's Metro start script. Chromium uses the CDP port in udid."
|
|
125236
125236
|
),
|
|
125237
125237
|
layer: external_exports.enum(["js", "native"]).optional().describe(
|
|
125238
|
-
"
|
|
125238
|
+
"Omit to control both layers. Selecting one leaves the other alone. Chromium ignores this setting."
|
|
125239
125239
|
),
|
|
125240
125240
|
logicalDeviceId: external_exports.string().min(1).optional().describe(
|
|
125241
|
-
"
|
|
125241
|
+
"For iOS simulators and Android on shared Metro, use the logical ID for the intended device if requested. Reuse it for start and stop, and as device_id for JS reads.<flag:macos-apps> For Mac apps, omit logicalDeviceId and keep the Mac app id even on shared Metro.</flag:macos-apps>"
|
|
125242
125242
|
)
|
|
125243
125243
|
});
|
|
125244
125244
|
function requestedLayers(layer) {
|
|
@@ -125386,23 +125386,23 @@ var zodSchema4 = external_exports.object({
|
|
|
125386
125386
|
"Device ID from list-devices: an iOS simulator UDID or Android serial<flag:macos-apps>, or a Mac app id (macos-app-<bundle id>)</flag:macos-apps>"
|
|
125387
125387
|
),
|
|
125388
125388
|
bundleId: external_exports.string().describe(
|
|
125389
|
-
"App bundle ID on iOS or package name on Android<flag:macos-apps
|
|
125389
|
+
"App bundle ID on iOS or package name on Android<flag:macos-apps>. On macOS, omit the macos-app- prefix</flag:macos-apps>."
|
|
125390
125390
|
),
|
|
125391
125391
|
port: metroPortField.describe(
|
|
125392
|
-
"
|
|
125392
|
+
"Exclude requests to this Metro port on local addresses. Omit it to use the device's Metro port (usually 8081)."
|
|
125393
125393
|
),
|
|
125394
125394
|
limit: external_exports.number().int().nonnegative().optional().default(50).describe(
|
|
125395
|
-
"
|
|
125395
|
+
"Take the newest matching requests and return them oldest first. Use 0 for capture status and totals without entries."
|
|
125396
125396
|
),
|
|
125397
125397
|
clear: external_exports.boolean().optional().default(false).describe(
|
|
125398
|
-
"
|
|
125398
|
+
"Hide existing history from later lists. Cleared request IDs still work in view-network-request-details."
|
|
125399
125399
|
),
|
|
125400
125400
|
// Declared so this non-strict object refuses the old stop instead of stripping it: the read
|
|
125401
125401
|
// would succeed while capture records on.
|
|
125402
125402
|
stop: external_exports.never({
|
|
125403
125403
|
error: "native-network-logs no longer stops capture: call network-capture-stop with this udid and bundleId, which keeps what was captured (stop-all-simulator-servers for the device also ends it). Drop `stop` from this call; `stop: false` was a plain read"
|
|
125404
125404
|
}).optional().describe(
|
|
125405
|
-
"Retired
|
|
125405
|
+
"Retired. Omit even when false. Use network-capture-stop with the same udid and bundleId."
|
|
125406
125406
|
)
|
|
125407
125407
|
});
|
|
125408
125408
|
function createNativeNetworkLogsTool(registry2) {
|
|
@@ -125419,18 +125419,11 @@ function createNativeNetworkLogsTool(registry2) {
|
|
|
125419
125419
|
android: { emulator: true, device: true },
|
|
125420
125420
|
macos: { app: true, catalyst: true }
|
|
125421
125421
|
},
|
|
125422
|
-
description: `
|
|
125423
|
-
|
|
125424
|
-
On iOS
|
|
125425
|
-
|
|
125426
|
-
|
|
125427
|
-
On iOS: when capture started while the app was already running, the header of the first answer says that the app's launch was not recorded; to capture the launch, call restart-app, then network-capture-start (a relaunch ends JS capture), then this tool, unless the header says the launch cannot be recorded on that device. On a local simulator, launch-app and restart-app return networkCapture saying whether capture is armed in the new process.
|
|
125428
|
-
<flag:macos-apps>On a Mac app: when capture started while the app was already running, the header of the first answer says that its requests before the start were not recorded. Capture stays on across restart-app, and requests sent while the app starts can be missing.
|
|
125429
|
-
</flag:macos-apps>On iOS: If status is restart_required: follow the message (usually restart-app), then retry. If status is service_stale: the app is already injected, so restarting it cannot help. Restart the tool-server (\`argent server stop && argent server start --detach\`) and retry. If the same status comes back after that restart, stop restarting: follow the message, which names the terminal fallback. If status is connect_pending: the app is injected and still connecting. Do not restart it, wait a few seconds and retry. If status is init_failed: follow the message (re-boot the simulator) rather than retrying.
|
|
125430
|
-
On a device whose devtools agent argent attached to rather than armed itself, a not-connected app fails with \`NATIVE_DEVTOOLS_NOT_CONNECTED\` instead of a status, and no restart on argent's side fixes it. An Apple system app is rejected outright (terminal: never retry it).
|
|
125431
|
-
On Android: needs a debuggable build. A header that says not attached means this tool-server did not attach capture to the app's current process: network-capture-start attaches it.
|
|
125432
|
-
Capture also misses a request already in flight at the attach and requests from clients other than OkHttp (e.g. HttpURLConnection, Cronet); an app whose OkHttp is fully minified reports capture unavailable.
|
|
125433
|
-
Android results also carry capture and captureDetail. When capture is active, captureDetail and the header can say that only some requests are captured: then an empty or short list does not mean the app sent nothing.`,
|
|
125422
|
+
description: `List native HTTP requests from URLSession and NSURLConnection on iOS simulators<flag:macos-apps> and Mac apps</flag:macos-apps>, or OkHttp in a debuggable Android build. Use when debugging traffic from a native module or SDK. Coverage excludes background URLSession transfers, WKWebView and Network.framework.
|
|
125423
|
+
Call network-capture-start before triggering requests. Returns recent requests oldest first, with capture status and coverage in header. The log stays readable after capture stops. Pass an ID to view-network-request-details.<flag:macos-apps> If the Mac log stays stopped after a failed start, check the start result.</flag:macos-apps>
|
|
125424
|
+
On an iOS simulator, a blocked read returns status and a message with the next action. Follow the message before retrying.
|
|
125425
|
+
If the call fails with NATIVE_DEVTOOLS_NOT_CONNECTED, follow its message.
|
|
125426
|
+
An Apple system app is rejected outright (terminal: never retry it).`,
|
|
125434
125427
|
zodSchema: zodSchema4,
|
|
125435
125428
|
services: (params) => {
|
|
125436
125429
|
const device = resolveDevice(params.udid);
|
|
@@ -132397,7 +132390,7 @@ function createLaunchAppTool(registry2) {
|
|
|
132397
132390
|
longRunning: true,
|
|
132398
132391
|
description: `Open an installed app, or confirm the running renderer (Chromium).<flag:macos-apps> On a Mac app it starts the app in the background when it does not run, and leaves a running app as it is.</flag:macos-apps>
|
|
132399
132392
|
Use when starting any app; prefer this over tapping home-screen / launcher icons. Also prepares the native-devtools injection before the app starts (iOS and Apple TV).
|
|
132400
|
-
Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed on the target device (iOS / Android<flag:harmonyos> / HarmonyOS</flag:harmonyos>). On a physical iPhone this registers the app every other tool acts on; com.apple.springboard and com.apple.Spotlight register without launching. note warns when runner signing is not ready.
|
|
132393
|
+
Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed on the target device (iOS / Android<flag:harmonyos> / HarmonyOS</flag:harmonyos>). On a physical iPhone this registers the app every other tool acts on; com.apple.springboard and com.apple.Spotlight register without launching. note warns when runner signing is not ready. If Argent started native capture, networkCapture reports whether it followed the launch or was stopped. This note applies to Android and local iOS simulators.<flag:macos-apps>
|
|
132401
132394
|
For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the build and arguments in use. The note can report an already running app or a missing window.</flag:macos-apps>
|
|
132402
132395
|
For Chromium, the app is already running behind a CDP port; this call simply refreshes the cached viewport and acknowledges the bundleId tag. To change the visible route, use \`open-url\`.
|
|
132403
132396
|
|
|
@@ -132697,7 +132690,7 @@ function createRestartAppTool(registry2) {
|
|
|
132697
132690
|
longRunning: true,
|
|
132698
132691
|
description: `Terminate then relaunch an app on iOS, Android, <flag:harmonyos>HarmonyOS, </flag:harmonyos><flag:macos-apps>macOS, </flag:macos-apps>or Vega.
|
|
132699
132692
|
Use when you need a clean in-memory state without a full reinstall. The relaunch also refreshes the native-devtools injection (iOS and Apple TV).<flag:macos-apps> On a Mac app it quits the app and starts the same .app again in the background.</flag:macos-apps>
|
|
132700
|
-
Returns { restarted, bundleId, <flag:macos-apps>kind?, appPath?, args?, note?, </flag:macos-apps>networkCapture? }.
|
|
132693
|
+
Returns { restarted, bundleId, <flag:macos-apps>kind?, appPath?, args?, note?, </flag:macos-apps>networkCapture? }. If Argent started native capture, networkCapture reports whether it followed the launch or was stopped. This note applies to Android and local iOS simulators. Fails if the app is not installed, on a local iOS simulator if terminating it does not finish within 15s, or on a remote simulator if terminating it fails for a reason other than the app not running.<flag:macos-apps>
|
|
132701
132694
|
For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the restarted build and arguments. Check note for warnings such as a force-quit or no window.</flag:macos-apps>`,
|
|
132702
132695
|
zodSchema: zodSchema12,
|
|
132703
132696
|
alwaysLoad: true,
|
|
@@ -137356,18 +137349,18 @@ init_device_info();
|
|
|
137356
137349
|
// ../tool-server/src/tools/network-conditions/schema.ts
|
|
137357
137350
|
init_zod();
|
|
137358
137351
|
var networkConditionsZodSchema = external_exports.object({
|
|
137359
|
-
udid: external_exports.string().min(1).describe(
|
|
137360
|
-
|
|
137361
|
-
),
|
|
137362
|
-
bundleId: external_exports.string().min(1).optional().describe("iOS only, and required there: the bundle id of the app to throttle."),
|
|
137352
|
+
udid: external_exports.string().min(1).describe("Device ID from list-devices."),
|
|
137353
|
+
bundleId: external_exports.string().min(1).optional().describe("Bundle ID of the app to shape. Required on iOS and ignored elsewhere."),
|
|
137363
137354
|
port: metroPortField.describe(
|
|
137364
|
-
"
|
|
137355
|
+
"Metro port to exempt from shaping on iOS and Android. Omit for the device's port (usually 8081)."
|
|
137356
|
+
),
|
|
137357
|
+
latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe(
|
|
137358
|
+
"Delay in milliseconds. Android adds it per round trip. iOS and Chromium use it as a minimum response delay."
|
|
137365
137359
|
),
|
|
137366
|
-
latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe("Minimum time in milliseconds from sending a request to its response."),
|
|
137367
137360
|
downloadKbps: external_exports.number().int().min(1).optional().describe("Download limit in kilobits per second."),
|
|
137368
137361
|
uploadKbps: external_exports.number().int().min(1).optional().describe("Upload limit in kilobits per second."),
|
|
137369
137362
|
offline: external_exports.boolean().optional().describe(
|
|
137370
|
-
"Make requests fail as if the network were down. On Android, ports
|
|
137363
|
+
"Make requests fail as if the network were down. On Android, adb reverse ports stay reachable, but Metro at 10.0.2.2 does not. False alone resets the conditions."
|
|
137371
137364
|
)
|
|
137372
137365
|
}).strict();
|
|
137373
137366
|
function requestedConditions(params) {
|
|
@@ -137598,13 +137591,12 @@ var capability22 = {
|
|
|
137598
137591
|
};
|
|
137599
137592
|
var networkConditionsTool = {
|
|
137600
137593
|
id: "network-conditions",
|
|
137601
|
-
description: `
|
|
137602
|
-
|
|
137603
|
-
|
|
137604
|
-
|
|
137605
|
-
|
|
137606
|
-
|
|
137607
|
-
conditions is null after a reset. Fails on a physical iOS or Android device.`,
|
|
137594
|
+
description: `Add latency, cap speed or simulate an offline connection. Use when testing loading states, retries or timeouts. Each call replaces the previous conditions. Omit the conditions to reset after the test.
|
|
137595
|
+
Returns the scope and applied conditions. A reset returns null for conditions.
|
|
137596
|
+
On a local iOS simulator, Argent shapes one app's intercepted HTTP traffic. While online, Argent forwards requests immediately and delays delivery to the app. Native devtools must be connected. WebSockets and the Metro port are exempt. Follow message if the result includes a status.
|
|
137597
|
+
On Android, Argent shapes traffic that uses the system proxy. Restart the app if existing connections bypass shaping. Throttling fails if the emulator has a proxy Argent did not set. Ethernet can prevent offline mode. Reset if a crash leaves the emulator unable to connect.
|
|
137598
|
+
On Chromium, Argent shapes the active page. Workers and cross-site iframes are outside its scope.
|
|
137599
|
+
Fails on physical devices and remote iOS simulators.`,
|
|
137608
137600
|
zodSchema: networkConditionsZodSchema,
|
|
137609
137601
|
searchHint: "network throttle latency slow offline bandwidth 3g conditions emulate",
|
|
137610
137602
|
interaction: {
|
|
@@ -140652,25 +140644,20 @@ ${lines.join("\n")}`;
|
|
|
140652
140644
|
var zodSchema38 = external_exports.object({
|
|
140653
140645
|
port: metroPortField,
|
|
140654
140646
|
device_id: external_exports.string().describe(
|
|
140655
|
-
"Device
|
|
140647
|
+
"Device ID from list-devices. For iOS simulators and Android, use logicalDeviceId if capture started with it<flag:macos-apps>. For a Mac app, keep the Mac app id macos-app-<bundle id> on shared Metro and for builds started outside Argent</flag:macos-apps>."
|
|
140656
140648
|
),
|
|
140657
140649
|
// `.default` covers only an omitted param, and `z.coerce.number()` reads null as 0, so
|
|
140658
140650
|
// null would return the oldest page. Agents send null for "not set": read it as "latest".
|
|
140659
140651
|
pageIndex: external_exports.union([external_exports.coerce.number().int().nonnegative(), external_exports.literal("latest")]).nullable().default("latest").transform((value) => value ?? "latest").describe(
|
|
140660
|
-
'
|
|
140652
|
+
'Zero-based page index. "latest" and null select the newest page. Each page contains up to 50 entries.'
|
|
140661
140653
|
)
|
|
140662
140654
|
});
|
|
140663
140655
|
var networkLogsTool = {
|
|
140664
140656
|
id: "view-network-logs",
|
|
140665
|
-
description: `
|
|
140666
|
-
Returns a paginated list
|
|
140667
|
-
|
|
140668
|
-
|
|
140669
|
-
On React Native, lists XMLHttpRequest (including axios), React Native fetch, Expo fetch, and requests from libraries such as react-native-fetch-api that call React Native's network module in a Metro development build.
|
|
140670
|
-
For JavaScript capture on iOS and Android<flag:macos-apps> (and on Mac apps)</flag:macos-apps>, use network-capture-start before triggering requests and after a reload. On Vega, the first read starts capture. Read again after a reload to resume capture.<flag:macos-apps> Use native-network-logs for native URLSession traffic on Mac apps. Both logs can show the same fetch request.</flag:macos-apps>
|
|
140671
|
-
On Chromium, lists all request types for the active tab.
|
|
140672
|
-
Use when inspecting outbound HTTP traffic or debugging API calls in the running app.
|
|
140673
|
-
Fails if the app is not connected (RN) or the device is not reachable (Chromium).`,
|
|
140657
|
+
description: `List captured HTTP requests from React Native JavaScript or the active Chromium tab. Use when you need to find a request or compare several calls. For native traffic, use native-network-logs.
|
|
140658
|
+
Returns a paginated list with request IDs, status, size and timing. Pass an ID to view-network-request-details for headers and bodies.
|
|
140659
|
+
On iOS simulators<flag:macos-apps>, Mac apps</flag:macos-apps> and Android, call network-capture-start before the action and again after a reload. On Vega, read this log before the action and again after a reload to resume capture. Chromium records while Argent is attached to the page.
|
|
140660
|
+
Fails if the Chromium target is unreachable. A read can also fail if Argent cannot reach the debugger for an existing JS capture. If the tool returns a capture message in place of a list, follow it before retrying.`,
|
|
140674
140661
|
zodSchema: zodSchema38,
|
|
140675
140662
|
readOnly: true,
|
|
140676
140663
|
interaction: {
|
|
@@ -140821,20 +140808,16 @@ ${postData.slice(0, MAX_BODY_SIZE)}...`;
|
|
|
140821
140808
|
var zodSchema39 = external_exports.object({
|
|
140822
140809
|
port: metroPortField,
|
|
140823
140810
|
device_id: external_exports.string().describe(
|
|
140824
|
-
"Device
|
|
140811
|
+
"Device ID for the matching log. For JS capture on iOS simulators and Android, use the logicalDeviceId if capture started with it<flag:macos-apps>. For a Mac app, keep the Mac app id even on shared Metro</flag:macos-apps>."
|
|
140825
140812
|
),
|
|
140826
|
-
requestId: external_exports.string().describe(
|
|
140827
|
-
|
|
140828
|
-
),
|
|
140829
|
-
includeBody: external_exports.boolean().default(true).describe("Whether to include the response body (if captured).")
|
|
140813
|
+
requestId: external_exports.string().describe("Request ID from either network log or await-network-request."),
|
|
140814
|
+
includeBody: external_exports.boolean().default(true).describe("Set false to omit the response body. The request body can still appear.")
|
|
140830
140815
|
});
|
|
140831
140816
|
var networkRequestTool = {
|
|
140832
140817
|
id: "view-network-request-details",
|
|
140833
|
-
description: `Read the details of one request
|
|
140834
|
-
Returns
|
|
140835
|
-
|
|
140836
|
-
If a request is missing, the tool returns an error: list requests again. If capture is off, start it before reproducing the request. On Vega, a JS lookup can start capture. Use view-network-logs before triggering requests on Vega.
|
|
140837
|
-
IDs from stopped capture still work. After a JavaScript reload, list requests again because an old JS ID may now refer to a different request.`,
|
|
140818
|
+
description: `Read the details of one captured request. Call this with an ID from a network log or await-network-request. Native requests need no debugger connection.
|
|
140819
|
+
Returns status, timing, headers and available bodies. Argent redacts sensitive headers and limits text previews to 1000 characters. URLs and bodies can still contain secrets. If a native upload is still in progress, retry after it finishes.
|
|
140820
|
+
If the ID is not found, the tool returns a message. Refresh the log if that happens or after a JavaScript reload. Reloads can reuse IDs for different requests. On Vega, a JS lookup can start capture. Read view-network-logs before triggering the request.`,
|
|
140838
140821
|
zodSchema: zodSchema39,
|
|
140839
140822
|
readOnly: true,
|
|
140840
140823
|
interaction: {
|
|
@@ -141236,11 +141219,10 @@ var JS_ANSWER_WAIT_MS = 5e3;
|
|
|
141236
141219
|
function createNetworkCaptureStartTool(registry2) {
|
|
141237
141220
|
return {
|
|
141238
141221
|
id: "network-capture-start",
|
|
141239
|
-
description: `Start
|
|
141240
|
-
|
|
141241
|
-
|
|
141242
|
-
|
|
141243
|
-
When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING.`,
|
|
141222
|
+
description: `Start HTTP capture on iOS simulators, Android<flag:macos-apps>, Mac apps</flag:macos-apps> and Chromium. Call this before the action you want to inspect. Each start keeps existing requests and opens a new window for await-network-request. On Chromium, start attaches to the tab if needed and marks the window in its log.
|
|
141223
|
+
Returns each layer's readiness in armed. Follow reason if a layer is still waiting or unavailable. Native capture can arm when the app connects on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>. On Android, it can attach when Argent launches the app. JS capture needs the app's Metro port. Start it again after a reload or relaunch.<flag:macos-apps> For a React Native Mac app launched from Xcode, select layer js. If the reason lists other targets for a Mac app, verify the app's Metro port and Debug build.</flag:macos-apps>
|
|
141224
|
+
Stop capture with network-capture-stop when you have the requests. Native capture can affect timing.
|
|
141225
|
+
Fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING when every requested layer is unavailable.`,
|
|
141244
141226
|
zodSchema: captureSchema,
|
|
141245
141227
|
capability: CAPTURE_CAPABILITY,
|
|
141246
141228
|
interaction: {
|
|
@@ -141595,10 +141577,8 @@ var JS_ANSWER_WAIT_MS2 = 5e3;
|
|
|
141595
141577
|
function createNetworkCaptureStopTool(registry2) {
|
|
141596
141578
|
return {
|
|
141597
141579
|
id: "network-capture-stop",
|
|
141598
|
-
description: `Stop
|
|
141599
|
-
|
|
141600
|
-
On other supported targets, read the retained requests with native-network-logs or view-network-logs. Use view-network-request-details with an ID from the log. JS request IDs expire on reload. Capture stays off until network-capture-start, including after relaunch. In-flight requests can finish in the log. Stopping Android native capture marks them failed in the log without interrupting the app's requests. Only bodies read before that stop remain available.
|
|
141601
|
-
Returns { status, layers }. Check armed and reason to confirm the stop. If the stop fails to reach the JS runtime, retry once the app reconnects to Metro. total counts the retained requests, or is 0 when the stop cannot count them.`,
|
|
141580
|
+
description: `Stop capture and keep the recorded requests. Call this after collecting the requests you need or before profiling. Read any Android native bodies you need before stopping. On Chromium, this closes the window for await-network-request. The tab log keeps recording while Argent is attached.
|
|
141581
|
+
Returns a result for each layer. Check armed and reason. The reason can explain an unconfirmed stop or say that capture never started. If Argent fails to reach the JS runtime, retry after it reconnects to Metro.`,
|
|
141602
141582
|
zodSchema: captureSchema,
|
|
141603
141583
|
capability: CAPTURE_CAPABILITY,
|
|
141604
141584
|
interaction: {
|
|
@@ -143598,26 +143578,26 @@ var DEFAULT_POLL_INTERVAL_MS2 = 400;
|
|
|
143598
143578
|
var MIN_JS_READ_MS = 1e3;
|
|
143599
143579
|
var zodSchema44 = external_exports.object({
|
|
143600
143580
|
udid: external_exports.string().min(1).describe(
|
|
143601
|
-
"Device ID passed as udid to network-capture-start
|
|
143581
|
+
"Device ID passed as udid to network-capture-start. The wait reuses its Metro target."
|
|
143602
143582
|
),
|
|
143603
143583
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
143604
|
-
"
|
|
143584
|
+
"The bundleId used for network-capture-start. On Chromium, use a valid placeholder such as argent.capture."
|
|
143605
143585
|
),
|
|
143606
143586
|
url: external_exports.string().min(1).describe(
|
|
143607
|
-
|
|
143587
|
+
"URL text or a pattern. Match a part with no secrets. The result includes the full URL and secret placeholders are rejected."
|
|
143608
143588
|
),
|
|
143609
143589
|
urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
|
|
143610
|
-
"contains (default)
|
|
143590
|
+
"contains (default) and equals ignore case. matches uses a case-sensitive JavaScript regular expression with no implicit anchors."
|
|
143611
143591
|
),
|
|
143612
|
-
method: external_exports.string().min(1).optional().describe("HTTP method
|
|
143592
|
+
method: external_exports.string().min(1).optional().describe("HTTP method, matched without regard to case."),
|
|
143613
143593
|
status: external_exports.union([
|
|
143614
143594
|
external_exports.enum(STATUS_CLASSES),
|
|
143615
143595
|
external_exports.coerce.number().int().min(100).max(599)
|
|
143616
143596
|
]).optional().describe(
|
|
143617
|
-
'Exact HTTP status
|
|
143597
|
+
'Exact HTTP status or a class such as "2xx". Failed requests can match if they received response headers.'
|
|
143618
143598
|
),
|
|
143619
143599
|
outcome: external_exports.enum(["complete", "failed", "any"]).optional().describe(
|
|
143620
|
-
"complete (default)
|
|
143600
|
+
"complete (default) accepts a finished response, including HTTP errors. failed accepts a request error. any accepts either."
|
|
143621
143601
|
),
|
|
143622
143602
|
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Wait limit in milliseconds. Default ${DEFAULT_TIMEOUT_MS4}.`),
|
|
143623
143603
|
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(
|
|
@@ -143671,9 +143651,9 @@ function createAwaitNetworkRequestTool(registry2) {
|
|
|
143671
143651
|
return {
|
|
143672
143652
|
// A literal, so scripts/extract-tools.mjs finds the description it scores.
|
|
143673
143653
|
id: "await-network-request",
|
|
143674
|
-
description: `Check whether a
|
|
143675
|
-
|
|
143676
|
-
|
|
143654
|
+
description: `Check whether a request finished in the latest capture window. Call network-capture-start before the action. Call this tool after triggering the request, then stop capture when you are done. On Chromium, match the final URL and method after redirects. Other layers use the URL the app requested. Physical iPhones and Vega are unsupported.
|
|
143655
|
+
Returns the match or diagnostic details. Use match.id with view-network-request-details. A miss only means no captured request matched. Check cause and nearMisses. If capture is unreadable, follow the layer notes before repeating the action. An active JS window can restore recording after a disconnect. Requests sent before it reconnects can be missing.
|
|
143656
|
+
Fails with NETWORK_CAPTURE_NOT_STARTED if there is no usable capture window. Start capture and repeat the action. A result with success false fails an e2e step and stops a run-sequence.`,
|
|
143677
143657
|
zodSchema: zodSchema44,
|
|
143678
143658
|
searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
|
|
143679
143659
|
readOnly: true,
|
|
@@ -162588,12 +162568,16 @@ function captureAbortSignal(env, budgetMs) {
|
|
|
162588
162568
|
const bound = AbortSignal.timeout(budgetMs);
|
|
162589
162569
|
return env.signal ? AbortSignal.any([env.signal, bound]) : bound;
|
|
162590
162570
|
}
|
|
162591
|
-
function comparePixels(a, b, maskTopFraction = 0) {
|
|
162571
|
+
function comparePixels(a, b, maskTopFraction = 0, maskBottomFraction = 0) {
|
|
162592
162572
|
if (a.width !== b.width || a.height !== b.height) return "moving";
|
|
162593
162573
|
const maskedRows = Math.min(a.height, Math.floor(a.height * maskTopFraction));
|
|
162594
|
-
const
|
|
162574
|
+
const maskedBottomRows = Math.min(
|
|
162575
|
+
a.height - maskedRows,
|
|
162576
|
+
Math.floor(a.height * maskBottomFraction)
|
|
162577
|
+
);
|
|
162578
|
+
const total = a.width * (a.height - maskedRows - maskedBottomRows);
|
|
162595
162579
|
if (total <= 0) return "still";
|
|
162596
|
-
const limit = Math.min(a.data.length, b.data.length);
|
|
162580
|
+
const limit = Math.min(a.data.length, b.data.length, (a.height - maskedBottomRows) * a.width * 4);
|
|
162597
162581
|
let changed = 0;
|
|
162598
162582
|
for (let o = maskedRows * a.width * 4; o + 2 < limit; o += 4) {
|
|
162599
162583
|
const dr = a.data[o] - b.data[o];
|
|
@@ -162608,6 +162592,40 @@ function comparePixels(a, b, maskTopFraction = 0) {
|
|
|
162608
162592
|
if (changed > motionThreshold) return "moving";
|
|
162609
162593
|
return changed >= LOCALIZED_MOTION_MIN_PIXELS ? "localized" : "still";
|
|
162610
162594
|
}
|
|
162595
|
+
var SNAPSHOT_SETTLE_POLL_MS = 100;
|
|
162596
|
+
var SNAPSHOT_SETTLE_TIMEOUT_MS = 3e3;
|
|
162597
|
+
var SNAPSHOT_QUIET_AFTER_ACTION_MS = 300;
|
|
162598
|
+
var ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS = 400;
|
|
162599
|
+
var SNAPSHOT_LOCALIZED_POLLS = 3;
|
|
162600
|
+
var HOME_INDICATOR_MASK_FRACTION = 0.02;
|
|
162601
|
+
async function settlesOnPixels(device) {
|
|
162602
|
+
if (device.platform === "android") return device.kind === "emulator";
|
|
162603
|
+
if (device.platform !== "ios" || isIosPhysicalDevice(device)) return false;
|
|
162604
|
+
return !await isTvOsSimulator(device.id);
|
|
162605
|
+
}
|
|
162606
|
+
async function settleOnPixels(env) {
|
|
162607
|
+
const deadline = Date.now() + SNAPSHOT_SETTLE_TIMEOUT_MS;
|
|
162608
|
+
const quietAfter = (env.lastActionAt ?? 0) + (env.device.platform === "android" ? ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS : SNAPSHOT_QUIET_AFTER_ACTION_MS);
|
|
162609
|
+
const maskTopFraction = await statusBarMaskFraction(env.device);
|
|
162610
|
+
const maskBottomFraction = maskTopFraction > 0 ? HOME_INDICATOR_MASK_FRACTION : 0;
|
|
162611
|
+
let previous = await capturePixelsWithin(env, deadline, true);
|
|
162612
|
+
let compared = false;
|
|
162613
|
+
let localizedPolls = 0;
|
|
162614
|
+
while (Date.now() < deadline) {
|
|
162615
|
+
if (!await sleepOrAbort(SNAPSHOT_SETTLE_POLL_MS, env.signal)) return "aborted";
|
|
162616
|
+
const frame2 = await capturePixelsWithin(env, deadline, false);
|
|
162617
|
+
if (env.signal?.aborted) return "aborted";
|
|
162618
|
+
if (previous && frame2) {
|
|
162619
|
+
compared = true;
|
|
162620
|
+
const change = comparePixels(previous, frame2, maskTopFraction, maskBottomFraction);
|
|
162621
|
+
localizedPolls = change === "localized" ? localizedPolls + 1 : 0;
|
|
162622
|
+
const settled = change === "still" || localizedPolls >= SNAPSHOT_LOCALIZED_POLLS;
|
|
162623
|
+
if (settled && Date.now() >= quietAfter) return "still";
|
|
162624
|
+
}
|
|
162625
|
+
previous = frame2;
|
|
162626
|
+
}
|
|
162627
|
+
return compared ? "moving" : "blind";
|
|
162628
|
+
}
|
|
162611
162629
|
|
|
162612
162630
|
// ../tool-server/src/tools/flows/flow-actions.ts
|
|
162613
162631
|
var ABORTED_OUTCOME = {
|
|
@@ -167770,13 +167788,6 @@ var FUZZY_SAME_TEXT_CENTER_DISTANCE_PX = 60;
|
|
|
167770
167788
|
var MAX_TEXT_CHANGES = 10;
|
|
167771
167789
|
var DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE = 0.7;
|
|
167772
167790
|
async function analyzeScreenshotTextChanges(options) {
|
|
167773
|
-
if (options.hasPixelDiff === false) {
|
|
167774
|
-
return {
|
|
167775
|
-
status: "skipped",
|
|
167776
|
-
provider: "ocr",
|
|
167777
|
-
changes: []
|
|
167778
|
-
};
|
|
167779
|
-
}
|
|
167780
167791
|
const [baselineOcr, currentOcr] = await Promise.all([
|
|
167781
167792
|
extractOcrTextBlocks(options.baselinePath),
|
|
167782
167793
|
extractOcrTextBlocks(options.currentPath)
|
|
@@ -168445,86 +168456,112 @@ var HORIZONTAL_TEXT_MERGE_HEIGHT_MULTIPLIER = 3;
|
|
|
168445
168456
|
var HORIZONTAL_TEXT_MERGE_MIN_GAP = 32;
|
|
168446
168457
|
var HORIZONTAL_TEXT_MERGE_MAX_GAP = 120;
|
|
168447
168458
|
var UNIFORM_BRIGHTNESS_DELTA_TOLERANCE = 4;
|
|
168448
|
-
|
|
168449
|
-
|
|
168450
|
-
|
|
168451
|
-
|
|
168452
|
-
|
|
168459
|
+
var DIFF_PNG_ENCODING = { filterType: 1, deflateLevel: 3 };
|
|
168460
|
+
var PNG_SIGNATURE2 = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
168461
|
+
var PNG_IHDR_CHUNK_LENGTH = 25;
|
|
168462
|
+
var PNG_IEND_CHUNK = Buffer.from([0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]);
|
|
168463
|
+
async function compareScreenshots(options) {
|
|
168464
|
+
const [baselineBytes, currentBytes] = await Promise.all([
|
|
168465
|
+
readPngFile(options.baselinePath),
|
|
168466
|
+
readPngFile(options.currentPath)
|
|
168453
168467
|
]);
|
|
168468
|
+
const identicalSize = baselineBytes.equals(currentBytes) ? completePngSize(baselineBytes) : void 0;
|
|
168469
|
+
if (identicalSize) {
|
|
168470
|
+
return {
|
|
168471
|
+
totalPixels: identicalSize.width * identicalSize.height,
|
|
168472
|
+
differentPixels: 0,
|
|
168473
|
+
mismatchPercentage: 0,
|
|
168474
|
+
imageSize: identicalSize
|
|
168475
|
+
};
|
|
168476
|
+
}
|
|
168477
|
+
const baseline = decodePng(baselineBytes, options.baselinePath);
|
|
168478
|
+
const current = decodePng(currentBytes, options.currentPath);
|
|
168454
168479
|
if (baseline.width !== current.width || baseline.height !== current.height) {
|
|
168455
|
-
return
|
|
168480
|
+
return {
|
|
168481
|
+
totalPixels: baseline.width * baseline.height,
|
|
168482
|
+
differentPixels: 0,
|
|
168483
|
+
mismatchPercentage: 0,
|
|
168484
|
+
dimensionMismatch: {
|
|
168485
|
+
expected: { width: baseline.width, height: baseline.height },
|
|
168486
|
+
actual: { width: current.width, height: current.height }
|
|
168487
|
+
}
|
|
168488
|
+
};
|
|
168456
168489
|
}
|
|
168490
|
+
const ignoreTopNormalizedY = (options.topMask ?? "status-bar") === "none" ? 0 : DEFAULT_IGNORE_TOP_NORMALIZED_Y;
|
|
168457
168491
|
const totalPixels = baseline.width * baseline.height;
|
|
168458
168492
|
const pixelDiff = markChangedPixels({
|
|
168459
168493
|
baseline,
|
|
168460
168494
|
current,
|
|
168461
|
-
thresholdSquared:
|
|
168462
|
-
ignoreTopNormalizedY
|
|
168463
|
-
});
|
|
168464
|
-
const regions = getChangedRegions({
|
|
168465
|
-
mask: pixelDiff.mask,
|
|
168466
|
-
baseline,
|
|
168467
|
-
current,
|
|
168468
|
-
joinGapPixels: settings.joinGapPixels
|
|
168495
|
+
thresholdSquared: DEFAULT_THRESHOLD * DEFAULT_THRESHOLD * MAX_RGB_DISTANCE_SQUARED2,
|
|
168496
|
+
ignoreTopNormalizedY
|
|
168469
168497
|
});
|
|
168498
|
+
return {
|
|
168499
|
+
totalPixels,
|
|
168500
|
+
differentPixels: pixelDiff.differentPixels,
|
|
168501
|
+
mismatchPercentage: totalPixels === 0 ? 0 : pixelDiff.differentPixels / totalPixels * 100,
|
|
168502
|
+
imageSize: { width: baseline.width, height: baseline.height },
|
|
168503
|
+
pixels: { baseline, current, mask: pixelDiff.mask, ignoreTopNormalizedY }
|
|
168504
|
+
};
|
|
168505
|
+
}
|
|
168506
|
+
async function writeContextDiff(comparison, destination) {
|
|
168507
|
+
if (!comparison.pixels || comparison.differentPixels === 0) return false;
|
|
168508
|
+
const diffImage = buildAnnotatedDiff(comparison.pixels, changedRegionsOf(comparison.pixels));
|
|
168509
|
+
await writePngFile(destination, downscalePng(diffImage, DEFAULT_CONTEXT_DIFF_SCALE));
|
|
168510
|
+
return true;
|
|
168511
|
+
}
|
|
168512
|
+
async function diffPngFiles(options) {
|
|
168513
|
+
const { pixels, ...comparison } = await compareScreenshots(options);
|
|
168514
|
+
if (!pixels || comparison.differentPixels === 0) {
|
|
168515
|
+
return summarizeResult({
|
|
168516
|
+
...comparison,
|
|
168517
|
+
regions: [],
|
|
168518
|
+
textAnalysis: { status: "skipped", provider: "ocr", changes: [] }
|
|
168519
|
+
});
|
|
168520
|
+
}
|
|
168521
|
+
const regions = changedRegionsOf(pixels);
|
|
168470
168522
|
const artifactPaths = resolveDiffArtifactPaths(options);
|
|
168471
|
-
|
|
168472
|
-
|
|
168473
|
-
|
|
168474
|
-
|
|
168475
|
-
|
|
168476
|
-
|
|
168477
|
-
contextDiffScale: settings.contextDiffScale
|
|
168478
|
-
});
|
|
168479
|
-
const mismatchPercentage = totalPixels === 0 ? 0 : pixelDiff.differentPixels / totalPixels * 100;
|
|
168523
|
+
const diffImage = buildAnnotatedDiff(pixels, regions);
|
|
168524
|
+
await writePngFile(artifactPaths.diffPath, diffImage);
|
|
168525
|
+
await writePngFile(
|
|
168526
|
+
artifactPaths.contextDiffPath,
|
|
168527
|
+
downscalePng(diffImage, DEFAULT_CONTEXT_DIFF_SCALE)
|
|
168528
|
+
);
|
|
168480
168529
|
const textAnalysis = await analyzeScreenshotTextChangesSafely({
|
|
168481
168530
|
baselinePath: options.baselinePath,
|
|
168482
168531
|
currentPath: options.currentPath,
|
|
168483
|
-
|
|
168484
|
-
|
|
168485
|
-
|
|
168486
|
-
ignoreTopPixels: ignoredTopRowsFor(baseline.height, settings.ignoreTopNormalizedY),
|
|
168532
|
+
baselineImage: pixels.baseline,
|
|
168533
|
+
currentImage: pixels.current,
|
|
168534
|
+
ignoreTopPixels: ignoredTopRowsFor(pixels.baseline.height, pixels.ignoreTopNormalizedY),
|
|
168487
168535
|
textChangeMinConfidence: DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE
|
|
168488
168536
|
});
|
|
168489
168537
|
return summarizeResult({
|
|
168490
|
-
|
|
168491
|
-
differentPixels: pixelDiff.differentPixels,
|
|
168492
|
-
mismatchPercentage,
|
|
168493
|
-
imageSize: { width: baseline.width, height: baseline.height },
|
|
168538
|
+
...comparison,
|
|
168494
168539
|
diffPath: artifactPaths.diffPath,
|
|
168495
168540
|
contextDiffPath: artifactPaths.contextDiffPath,
|
|
168496
168541
|
regions,
|
|
168497
168542
|
textAnalysis
|
|
168498
168543
|
});
|
|
168499
168544
|
}
|
|
168500
|
-
function
|
|
168501
|
-
|
|
168502
|
-
|
|
168503
|
-
|
|
168504
|
-
|
|
168505
|
-
|
|
168506
|
-
|
|
168545
|
+
function completePngSize(bytes) {
|
|
168546
|
+
const complete = bytes.length >= PNG_SIGNATURE2.length + PNG_IHDR_CHUNK_LENGTH + PNG_IEND_CHUNK.length && bytes.subarray(0, PNG_SIGNATURE2.length).equals(PNG_SIGNATURE2) && bytes.toString("latin1", 12, 16) === "IHDR" && bytes.subarray(bytes.length - PNG_IEND_CHUNK.length).equals(PNG_IEND_CHUNK);
|
|
168547
|
+
return complete ? { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) } : void 0;
|
|
168548
|
+
}
|
|
168549
|
+
function changedRegionsOf(pixels) {
|
|
168550
|
+
return getChangedRegions({
|
|
168551
|
+
mask: pixels.mask,
|
|
168552
|
+
baseline: pixels.baseline,
|
|
168553
|
+
current: pixels.current,
|
|
168554
|
+
joinGapPixels: DEFAULT_REGION_MERGE_DISTANCE
|
|
168555
|
+
});
|
|
168556
|
+
}
|
|
168557
|
+
function buildAnnotatedDiff(pixels, regions) {
|
|
168558
|
+
const diffImage = buildContextDiff(pixels);
|
|
168559
|
+
drawRegionRectangles(diffImage, regions);
|
|
168560
|
+
return diffImage;
|
|
168507
168561
|
}
|
|
168508
168562
|
function summarizeResult(result) {
|
|
168509
168563
|
return { ...result, summary: formatScreenshotDiffSummary(result) };
|
|
168510
168564
|
}
|
|
168511
|
-
function buildDimensionMismatchResult(params) {
|
|
168512
|
-
return {
|
|
168513
|
-
totalPixels: params.baseline.width * params.baseline.height,
|
|
168514
|
-
differentPixels: 0,
|
|
168515
|
-
mismatchPercentage: 0,
|
|
168516
|
-
dimensionMismatch: {
|
|
168517
|
-
expected: { width: params.baseline.width, height: params.baseline.height },
|
|
168518
|
-
actual: { width: params.current.width, height: params.current.height }
|
|
168519
|
-
},
|
|
168520
|
-
regions: [],
|
|
168521
|
-
textAnalysis: {
|
|
168522
|
-
status: "skipped",
|
|
168523
|
-
provider: "ocr",
|
|
168524
|
-
changes: []
|
|
168525
|
-
}
|
|
168526
|
-
};
|
|
168527
|
-
}
|
|
168528
168565
|
function markChangedPixels(params) {
|
|
168529
168566
|
const totalPixels = params.baseline.width * params.baseline.height;
|
|
168530
168567
|
const baselineData = params.baseline.data;
|
|
@@ -168580,40 +168617,32 @@ function outputArtifactBaseName(filePath) {
|
|
|
168580
168617
|
const parsed2 = import_path8.default.parse(import_path8.default.basename(filePath));
|
|
168581
168618
|
return parsed2.name || parsed2.base;
|
|
168582
168619
|
}
|
|
168583
|
-
async function
|
|
168584
|
-
|
|
168585
|
-
|
|
168586
|
-
|
|
168587
|
-
|
|
168588
|
-
}
|
|
168589
|
-
drawRegionRectangles(diffImage, params.regions);
|
|
168590
|
-
await writePngFile(params.paths.diffPath, diffImage);
|
|
168591
|
-
await writePngFile(
|
|
168592
|
-
params.paths.contextDiffPath,
|
|
168593
|
-
downscalePng(diffImage, params.contextDiffScale)
|
|
168594
|
-
);
|
|
168620
|
+
async function readPngFile(filePath) {
|
|
168621
|
+
try {
|
|
168622
|
+
return await import_promises22.default.readFile(filePath);
|
|
168623
|
+
} catch (err) {
|
|
168624
|
+
throw unreadablePngError(filePath, err);
|
|
168625
|
+
}
|
|
168595
168626
|
}
|
|
168596
|
-
|
|
168627
|
+
function decodePng(buffer, filePath) {
|
|
168597
168628
|
try {
|
|
168598
|
-
const buffer = await import_promises22.default.readFile(filePath);
|
|
168599
168629
|
const png = import_pngjs6.PNG.sync.read(buffer);
|
|
168600
|
-
return {
|
|
168601
|
-
width: png.width,
|
|
168602
|
-
height: png.height,
|
|
168603
|
-
data: png.data
|
|
168604
|
-
};
|
|
168630
|
+
return { width: png.width, height: png.height, data: png.data };
|
|
168605
168631
|
} catch (err) {
|
|
168606
|
-
throw
|
|
168607
|
-
`Could not read PNG at ${filePath}: ${err instanceof Error ? err.message : String(err)}`,
|
|
168608
|
-
{
|
|
168609
|
-
error_code: FAILURE_CODES.SCREENSHOT_DIFF_INPUT_INVALID,
|
|
168610
|
-
failure_stage: "screenshot_diff_decode_failed",
|
|
168611
|
-
failure_area: "tool_server",
|
|
168612
|
-
error_kind: "validation"
|
|
168613
|
-
}
|
|
168614
|
-
);
|
|
168632
|
+
throw unreadablePngError(filePath, err);
|
|
168615
168633
|
}
|
|
168616
168634
|
}
|
|
168635
|
+
function unreadablePngError(filePath, err) {
|
|
168636
|
+
return new FailureError(
|
|
168637
|
+
`Could not read PNG at ${filePath}: ${err instanceof Error ? err.message : String(err)}`,
|
|
168638
|
+
{
|
|
168639
|
+
error_code: FAILURE_CODES.SCREENSHOT_DIFF_INPUT_INVALID,
|
|
168640
|
+
failure_stage: "screenshot_diff_decode_failed",
|
|
168641
|
+
failure_area: "tool_server",
|
|
168642
|
+
error_kind: "validation"
|
|
168643
|
+
}
|
|
168644
|
+
);
|
|
168645
|
+
}
|
|
168617
168646
|
async function analyzeScreenshotTextChangesSafely(options) {
|
|
168618
168647
|
try {
|
|
168619
168648
|
return await analyzeScreenshotTextChanges(options);
|
|
@@ -168651,7 +168680,7 @@ function luminanceFromOffset(data, offset) {
|
|
|
168651
168680
|
}
|
|
168652
168681
|
async function writePngFile(filePath, png) {
|
|
168653
168682
|
await import_promises22.default.mkdir(import_path8.default.dirname(filePath), { recursive: true });
|
|
168654
|
-
await import_promises22.default.writeFile(filePath, import_pngjs6.PNG.sync.write(png));
|
|
168683
|
+
await import_promises22.default.writeFile(filePath, import_pngjs6.PNG.sync.write(png, DIFF_PNG_ENCODING));
|
|
168655
168684
|
}
|
|
168656
168685
|
function downscalePng(source, scale) {
|
|
168657
168686
|
const resized = resizeDecodedPng(
|
|
@@ -168985,13 +169014,24 @@ async function cropPngFile(src, dest, frame2) {
|
|
|
168985
169014
|
await fs81.writeFile(dest, import_pngjs7.PNG.sync.write(out));
|
|
168986
169015
|
return { w, h };
|
|
168987
169016
|
}
|
|
168988
|
-
async function
|
|
168989
|
-
|
|
168990
|
-
|
|
168991
|
-
|
|
168992
|
-
|
|
168993
|
-
|
|
169017
|
+
async function warmSnapshotCapture(registry2, device) {
|
|
169018
|
+
try {
|
|
169019
|
+
if (!await settlesOnPixels(device)) return;
|
|
169020
|
+
const refs = isIosSimulator(device) ? [simulatorServerRef(device), axServiceRef(device)] : [simulatorServerRef(device)];
|
|
169021
|
+
await Promise.all(refs.map((ref) => registry2.resolveService(ref.urn, ref.options)));
|
|
169022
|
+
} catch {
|
|
169023
|
+
}
|
|
169024
|
+
}
|
|
169025
|
+
async function settleScreen(env) {
|
|
169026
|
+
if (await settlesOnPixels(env.device) && await settleOnPixels(env) !== "blind") return;
|
|
169027
|
+
if (!supportsFlowTree(env.device.platform)) return;
|
|
169028
|
+
try {
|
|
169029
|
+
await settleTree(env);
|
|
169030
|
+
} catch {
|
|
168994
169031
|
}
|
|
169032
|
+
}
|
|
169033
|
+
async function runSnapshot(env, opts) {
|
|
169034
|
+
if (opts.cropOn === void 0) await settleScreen(env);
|
|
168995
169035
|
if (env.signal?.aborted) {
|
|
168996
169036
|
return { status: "skip", reason: "run aborted during snapshot settle" };
|
|
168997
169037
|
}
|
|
@@ -169138,13 +169178,12 @@ async function runSnapshot(env, opts) {
|
|
|
169138
169178
|
};
|
|
169139
169179
|
}
|
|
169140
169180
|
const localBaseline = await hostBaseline(stored);
|
|
169141
|
-
|
|
169181
|
+
let outputDir;
|
|
169142
169182
|
let keepInOutputDir;
|
|
169143
169183
|
try {
|
|
169144
|
-
const result = await
|
|
169184
|
+
const result = await compareScreenshots({
|
|
169145
169185
|
baselinePath: localBaseline,
|
|
169146
169186
|
currentPath,
|
|
169147
|
-
outputDir,
|
|
169148
169187
|
// A crop compares EVERY pixel of the element's region, wherever it
|
|
169149
169188
|
// sits. Masking a crop's overlap with the screen's top status-bar band
|
|
169150
169189
|
// would degenerate into comparing nothing for an element inside the
|
|
@@ -169178,18 +169217,20 @@ async function runSnapshot(env, opts) {
|
|
|
169178
169217
|
baseline: await baselineArtifact(localBaseline),
|
|
169179
169218
|
current: await currentArtifact()
|
|
169180
169219
|
};
|
|
169181
|
-
|
|
169220
|
+
outputDir = await fs81.mkdtemp(path66.join(os27.tmpdir(), "argent-e2e-diff-"));
|
|
169221
|
+
const contextDiffPath = path66.join(outputDir, `${snapshotKey}-diff.png`);
|
|
169222
|
+
if (await writeContextDiff(result, contextDiffPath)) {
|
|
169182
169223
|
artifacts.diff = await store.register({
|
|
169183
|
-
hostPath:
|
|
169224
|
+
hostPath: contextDiffPath,
|
|
169184
169225
|
kind: "screenshot-diff-context",
|
|
169185
169226
|
mimeType: "image/png",
|
|
169186
169227
|
filename: `${snapshotKey}-diff.png`
|
|
169187
169228
|
});
|
|
169188
|
-
keepInOutputDir =
|
|
169229
|
+
keepInOutputDir = contextDiffPath;
|
|
169189
169230
|
}
|
|
169190
169231
|
return { ...captureWarned, status: "fail", reason: reason2, snapshotKey, artifacts };
|
|
169191
169232
|
} finally {
|
|
169192
|
-
await cleanupDiffDir(outputDir, keepInOutputDir);
|
|
169233
|
+
if (outputDir !== void 0) await cleanupDiffDir(outputDir, keepInOutputDir);
|
|
169193
169234
|
}
|
|
169194
169235
|
} finally {
|
|
169195
169236
|
if (cropDir !== void 0) {
|
|
@@ -170005,6 +170046,9 @@ Without a link, every step kind runs.`,
|
|
|
170005
170046
|
);
|
|
170006
170047
|
const device = resolved.device;
|
|
170007
170048
|
const statusBarPinned = device !== null && await pinStatusBar(device, signal);
|
|
170049
|
+
if (device !== null && !signal?.aborted && mayRunSnapshotStep(flow)) {
|
|
170050
|
+
void warmSnapshotCapture(registry2, device);
|
|
170051
|
+
}
|
|
170008
170052
|
if (device?.platform === "chromium" && !signal?.aborted) {
|
|
170009
170053
|
await frontChromiumPage(registry2, device);
|
|
170010
170054
|
}
|
|
@@ -170020,6 +170064,8 @@ Without a link, every step kind runs.`,
|
|
|
170020
170064
|
// its own, which is why that step spends this verdict rather than
|
|
170021
170065
|
// inheriting whatever the sub-run proved.
|
|
170022
170066
|
treeOutage: {},
|
|
170067
|
+
// The caller may have acted on the app right before this run.
|
|
170068
|
+
lastActionAt: Date.now(),
|
|
170023
170069
|
flowsDir,
|
|
170024
170070
|
viaUpload,
|
|
170025
170071
|
project,
|
|
@@ -170319,6 +170365,19 @@ function childScope(scope, overrides = {}) {
|
|
|
170319
170365
|
function depthOf(scope) {
|
|
170320
170366
|
return scope.depth ? { depth: scope.depth } : {};
|
|
170321
170367
|
}
|
|
170368
|
+
function mayRunSnapshotStep(flow) {
|
|
170369
|
+
return [...walkSteps(flow.steps)].some(
|
|
170370
|
+
({ step }) => step.kind === "snapshot" || step.kind === "run"
|
|
170371
|
+
);
|
|
170372
|
+
}
|
|
170373
|
+
var SCREEN_READING_STEPS = /* @__PURE__ */ new Set([
|
|
170374
|
+
"echo",
|
|
170375
|
+
"await",
|
|
170376
|
+
"assert",
|
|
170377
|
+
"idle",
|
|
170378
|
+
"wait",
|
|
170379
|
+
"snapshot"
|
|
170380
|
+
]);
|
|
170322
170381
|
async function execSteps(state3, steps, scope) {
|
|
170323
170382
|
for (const step of steps) {
|
|
170324
170383
|
const index = state3.reports.length;
|
|
@@ -170389,6 +170448,9 @@ async function execSteps(state3, steps, scope) {
|
|
|
170389
170448
|
scope.legacyPoints && step.kind === "tool" ? "native" : "upright",
|
|
170390
170449
|
() => execLeafStep(state3, step, index, scope)
|
|
170391
170450
|
);
|
|
170451
|
+
if (report.status !== "skip" && !SCREEN_READING_STEPS.has(step.kind)) {
|
|
170452
|
+
state3.lastActionAt = Date.now();
|
|
170453
|
+
}
|
|
170392
170454
|
if (report.status !== "skip") report.durationMs = Date.now() - startedAt;
|
|
170393
170455
|
if ((report.status === "fail" || report.status === "error") && !report.artifacts) {
|
|
170394
170456
|
const screen = await captureFailureScreen(state3);
|
|
@@ -171614,9 +171676,7 @@ var zodSchema79 = external_exports.object({
|
|
|
171614
171676
|
rotation: external_exports.enum(["Portrait", "LandscapeLeft", "LandscapeRight", "PortraitUpsideDown"]).optional().describe(
|
|
171615
171677
|
"Orientation override for live baseline/current captures. <flag:harmonyos>Rejected on HarmonyOS, which captures the display in its current orientation and has no override. </flag:harmonyos>Ignored on physical iPhones."
|
|
171616
171678
|
),
|
|
171617
|
-
outputDir: external_exports.string().min(1).optional().describe(
|
|
171618
|
-
"Directory where diff artifacts should be written (default: a temp directory). The diff images are returned in the result either way."
|
|
171619
|
-
)
|
|
171679
|
+
outputDir: external_exports.string().min(1).optional().describe("Directory where diff artifacts should be written (default: a temp directory).")
|
|
171620
171680
|
}).strict();
|
|
171621
171681
|
var screenshotDiffTool = {
|
|
171622
171682
|
id: "screenshot-diff",
|
|
@@ -171626,7 +171686,7 @@ Both images must have identical dimensions: save baselines with screenshot scale
|
|
|
171626
171686
|
Use when stable before/after screenshots exist and the expected result is pixel-visible: layout, spacing, color, typography, image/icon rendering, clipping, overflow, or text rendering.
|
|
171627
171687
|
Physical iPhones: live captures are device-wide and need no registered app.
|
|
171628
171688
|
<flag:macos-apps>Mac apps: a resized window fails as a dimension mismatch.
|
|
171629
|
-
</flag:macos-apps>Returns { summary, diffPath
|
|
171689
|
+
</flag:macos-apps>Returns { summary }, plus diffPath and contextDiffPath when pixels differ. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display.
|
|
171630
171690
|
Ignores the fixed top status-bar band for both pixel and OCR text comparisons.
|
|
171631
171691
|
Fails if the input sources are invalid, PNG files cannot be read, outputDir cannot be written, or the simulator-server / emulator backend<flag:harmonyos>, or \`hdc\` on HarmonyOS,</flag:harmonyos> is not reachable.`,
|
|
171632
171692
|
zodSchema: zodSchema79,
|