@swmansion/argent 0.34.1-next.39 → 0.34.1-next.40
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/dist/cli-cmds.mjs +3 -0
- package/dist/client.js +3 -0
- package/dist/installer.mjs +3 -0
- package/dist/mcp-server.mjs +3 -0
- package/dist/tool-args.generated.d.ts +16 -0
- package/dist/tool-server.cjs +495 -132
- package/package.json +1 -1
- package/skills/argent-device-interact/SKILL.md +22 -21
package/dist/tool-server.cjs
CHANGED
|
@@ -1602,6 +1602,9 @@ var init_failure_codes = __esm({
|
|
|
1602
1602
|
ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
|
|
1603
1603
|
ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
|
|
1604
1604
|
ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
|
|
1605
|
+
ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
|
|
1606
|
+
ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
|
|
1607
|
+
ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
|
|
1605
1608
|
SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
|
|
1606
1609
|
SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
|
|
1607
1610
|
SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
|
|
@@ -79624,22 +79627,22 @@ var init_harmony_flag = __esm({
|
|
|
79624
79627
|
});
|
|
79625
79628
|
|
|
79626
79629
|
// ../tool-server/src/utils/capability.ts
|
|
79627
|
-
function platformMatrix(platform,
|
|
79630
|
+
function platformMatrix(platform, capability42) {
|
|
79628
79631
|
switch (platform) {
|
|
79629
79632
|
case "ios":
|
|
79630
|
-
return
|
|
79633
|
+
return capability42.apple;
|
|
79631
79634
|
case "ios-remote":
|
|
79632
|
-
return
|
|
79635
|
+
return capability42.appleRemote;
|
|
79633
79636
|
case "android":
|
|
79634
|
-
return
|
|
79637
|
+
return capability42.android;
|
|
79635
79638
|
case "chromium":
|
|
79636
|
-
return
|
|
79639
|
+
return capability42.chromium;
|
|
79637
79640
|
case "vega":
|
|
79638
|
-
return
|
|
79641
|
+
return capability42.vega;
|
|
79639
79642
|
case "harmony":
|
|
79640
|
-
return
|
|
79643
|
+
return capability42.harmony;
|
|
79641
79644
|
case "macos":
|
|
79642
|
-
return
|
|
79645
|
+
return capability42.macos;
|
|
79643
79646
|
}
|
|
79644
79647
|
}
|
|
79645
79648
|
function macosAppsUnavailableReason() {
|
|
@@ -79651,14 +79654,14 @@ function isFlagOffered(flag) {
|
|
|
79651
79654
|
if (flag === MACOS_APPS_FLAG) return macosAppsUnavailableReason() === null;
|
|
79652
79655
|
return isFeatureEnabled(flag);
|
|
79653
79656
|
}
|
|
79654
|
-
function assertSupported(toolId,
|
|
79655
|
-
if (!
|
|
79657
|
+
function assertSupported(toolId, capability42, device) {
|
|
79658
|
+
if (!capability42) return;
|
|
79656
79659
|
if (device.platform === "harmony" && !isHarmonyEnabled()) {
|
|
79657
79660
|
throw new UnsupportedOperationError(toolId, device, HARMONY_DISABLED_REASON);
|
|
79658
79661
|
}
|
|
79659
79662
|
const macosRefusal = device.platform === "macos" ? macosAppsUnavailableReason() : null;
|
|
79660
79663
|
if (macosRefusal) throw new UnsupportedOperationError(toolId, device, macosRefusal);
|
|
79661
|
-
const matrix = platformMatrix(device.platform,
|
|
79664
|
+
const matrix = platformMatrix(device.platform, capability42);
|
|
79662
79665
|
if (!matrix) {
|
|
79663
79666
|
const reason2 = (device.platform === "macos" ? MACOS_REFUSAL_REASONS[toolId] : void 0) ?? `no ${device.platform} support declared`;
|
|
79664
79667
|
throw new UnsupportedOperationError(toolId, device, reason2);
|
|
@@ -79669,7 +79672,7 @@ function assertSupported(toolId, capability41, device) {
|
|
|
79669
79672
|
const reason2 = device.platform === "harmony" && device.kind === "emulator" ? 'a `harmony-emulator-` id names an instance only boot-device starts; drive the `harmony-<connectKey>` id of its `kind: "device"` entry in list-devices' : catalystReason ?? `kind '${device.kind}' not supported`;
|
|
79670
79673
|
throw new UnsupportedOperationError(toolId, device, reason2);
|
|
79671
79674
|
}
|
|
79672
|
-
if (
|
|
79675
|
+
if (capability42.supports && !capability42.supports(device)) {
|
|
79673
79676
|
throw new UnsupportedOperationError(toolId, device, "supports() refiner rejected device");
|
|
79674
79677
|
}
|
|
79675
79678
|
}
|
|
@@ -80054,16 +80057,16 @@ function lookupExternalDeviceNow(id) {
|
|
|
80054
80057
|
}
|
|
80055
80058
|
return device;
|
|
80056
80059
|
}
|
|
80057
|
-
async function assertExternalCapability(namespace, device,
|
|
80058
|
-
assertExternalCapabilitySync(namespace, device,
|
|
80060
|
+
async function assertExternalCapability(namespace, device, capability42) {
|
|
80061
|
+
assertExternalCapabilitySync(namespace, device, capability42);
|
|
80059
80062
|
}
|
|
80060
|
-
function assertExternalCapabilitySync(namespace, device,
|
|
80063
|
+
function assertExternalCapabilitySync(namespace, device, capability42) {
|
|
80061
80064
|
const id = typeof device === "string" ? device : device.id;
|
|
80062
80065
|
const externalDevice = isExternalId(id) ? lookupExternalDeviceNow(id) : externalClaimForNativeId(id);
|
|
80063
80066
|
if (!externalDevice) return;
|
|
80064
|
-
if (externalDevice.capabilities.has(
|
|
80067
|
+
if (externalDevice.capabilities.has(capability42)) return;
|
|
80065
80068
|
throw new FailureError(
|
|
80066
|
-
`${namespace} is not available on '${externalDevice.name}': ${externalDevice.provider.name} did not grant the '${
|
|
80069
|
+
`${namespace} is not available on '${externalDevice.name}': ${externalDevice.provider.name} did not grant the '${capability42}' capability for this device.`,
|
|
80067
80070
|
{
|
|
80068
80071
|
error_code: FAILURE_CODES.EXTERNAL_DEVICE_CAPABILITY_DENIED,
|
|
80069
80072
|
error_kind: "unsupported",
|
|
@@ -103891,8 +103894,8 @@ async function simctlArgsForUdid(udid, args, options) {
|
|
|
103891
103894
|
return [...simctlPrefix(await deviceSetForUdid(udid)), ...nativeArgs(udid, args)];
|
|
103892
103895
|
}
|
|
103893
103896
|
function assertSimctlEntitlement(udid, options) {
|
|
103894
|
-
const
|
|
103895
|
-
assertExternalCapabilitySync(
|
|
103897
|
+
const capability42 = options?.granted ?? "simctl";
|
|
103898
|
+
assertExternalCapabilitySync(capability42, udid, capability42);
|
|
103896
103899
|
}
|
|
103897
103900
|
async function simctlTargetForUdid(udid, options) {
|
|
103898
103901
|
assertSimctlEntitlement(udid, options);
|
|
@@ -124525,6 +124528,7 @@ var NON_INJECTABLE_RECOVERY = "Use the standard `describe` tool (its accessibili
|
|
|
124525
124528
|
var MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS = 3;
|
|
124526
124529
|
var NATIVE_DEVTOOLS_AGE_SLOP_MS = 3e3;
|
|
124527
124530
|
var NATIVE_DEVTOOLS_CONNECT_BUDGET_MS = 15e3;
|
|
124531
|
+
var LENT_RELEASE_TIMEOUT_MS = 1e3;
|
|
124528
124532
|
function buildAppStateMessage(bundleId, state3) {
|
|
124529
124533
|
switch (state3) {
|
|
124530
124534
|
case "not_running":
|
|
@@ -124553,6 +124557,7 @@ var NATIVE_DEVTOOLS_PRECHECK_TOOLS = /* @__PURE__ */ new Set([
|
|
|
124553
124557
|
"native-find-views",
|
|
124554
124558
|
"native-full-hierarchy",
|
|
124555
124559
|
"native-network-logs",
|
|
124560
|
+
"network-conditions",
|
|
124556
124561
|
"native-view-at-point",
|
|
124557
124562
|
"native-user-interactable-view-at-point",
|
|
124558
124563
|
"native-devtools-status",
|
|
@@ -124723,6 +124728,9 @@ var nativeDevtoolsBlueprint = {
|
|
|
124723
124728
|
let inFlight4 = null;
|
|
124724
124729
|
let envRetired = false;
|
|
124725
124730
|
const activatedBundleIds = /* @__PURE__ */ new Set();
|
|
124731
|
+
const networkConditions = /* @__PURE__ */ new Map();
|
|
124732
|
+
const providerCapture = /* @__PURE__ */ new Map();
|
|
124733
|
+
const unconfirmedThrottles = /* @__PURE__ */ new Set();
|
|
124726
124734
|
const events = new TypedEventEmitter();
|
|
124727
124735
|
const noteInitFailure = (err) => {
|
|
124728
124736
|
if (err instanceof XcodeFirstLaunchPendingError) return;
|
|
@@ -124757,11 +124765,17 @@ var nativeDevtoolsBlueprint = {
|
|
|
124757
124765
|
if (initFailure?.givenUp) return Promise.resolve();
|
|
124758
124766
|
return runEnsureEnv();
|
|
124759
124767
|
};
|
|
124768
|
+
const writeMessage = (socket, type, payload) => {
|
|
124769
|
+
socket.write(JSON.stringify({ type, payload }) + "\n");
|
|
124770
|
+
};
|
|
124771
|
+
const writeActivation = (socket) => {
|
|
124772
|
+
writeMessage(socket, "Control", { command: "activateNetworkInspection" });
|
|
124773
|
+
};
|
|
124760
124774
|
const isAppRunning = async (bundleId) => {
|
|
124761
124775
|
const runningBundleIds = await host.listRunningBundleIds(udid);
|
|
124762
124776
|
return runningBundleIds.has(bundleId);
|
|
124763
124777
|
};
|
|
124764
|
-
function
|
|
124778
|
+
function sendRpc(targetBundleId, type, method, params, timeoutMs) {
|
|
124765
124779
|
const conn = connections2.get(targetBundleId);
|
|
124766
124780
|
if (!conn) {
|
|
124767
124781
|
return Promise.reject(
|
|
@@ -124774,20 +124788,14 @@ var nativeDevtoolsBlueprint = {
|
|
|
124774
124788
|
);
|
|
124775
124789
|
}
|
|
124776
124790
|
const id = nextRpcId++;
|
|
124777
|
-
const timeoutMs = method === "ViewHierarchy.getFullHierarchy" ? 15e3 : 5e3;
|
|
124778
124791
|
return new Promise((resolve21, reject) => {
|
|
124779
124792
|
pendingRpc.set(id, { resolve: resolve21, reject });
|
|
124780
|
-
conn.socket
|
|
124781
|
-
JSON.stringify({
|
|
124782
|
-
type: "ViewInspector",
|
|
124783
|
-
payload: { id, method, params }
|
|
124784
|
-
}) + "\n"
|
|
124785
|
-
);
|
|
124793
|
+
writeMessage(conn.socket, type, { id, method, params });
|
|
124786
124794
|
setTimeout(() => {
|
|
124787
124795
|
if (pendingRpc.has(id)) {
|
|
124788
124796
|
pendingRpc.delete(id);
|
|
124789
124797
|
reject(
|
|
124790
|
-
new FailureError(
|
|
124798
|
+
new FailureError(`${type} RPC timed out: ${method}`, {
|
|
124791
124799
|
error_code: FAILURE_CODES.NATIVE_DEVTOOLS_RPC_TIMEOUT,
|
|
124792
124800
|
failure_stage: "native_devtools_rpc_request",
|
|
124793
124801
|
failure_area: "tool_server",
|
|
@@ -124798,6 +124806,74 @@ var nativeDevtoolsBlueprint = {
|
|
|
124798
124806
|
}, timeoutMs);
|
|
124799
124807
|
});
|
|
124800
124808
|
}
|
|
124809
|
+
function sendViewInspectorRpc(targetBundleId, method, params = {}) {
|
|
124810
|
+
const timeoutMs = method === "ViewHierarchy.getFullHierarchy" ? 15e3 : 5e3;
|
|
124811
|
+
return sendRpc(targetBundleId, "ViewInspector", method, params, timeoutMs);
|
|
124812
|
+
}
|
|
124813
|
+
const sendCdpRpc = (targetBundleId, method, params = {}) => sendRpc(targetBundleId, "CDP", method, params, 5e3);
|
|
124814
|
+
const readCaptureEnabled = async (bundleId) => {
|
|
124815
|
+
const state3 = await sendCdpRpc(bundleId, "NativeDevtoolsIos.getConditions").catch(() => null);
|
|
124816
|
+
return state3?.enabled !== false;
|
|
124817
|
+
};
|
|
124818
|
+
const noteProviderCapture = async (bundleId) => {
|
|
124819
|
+
if (!lentSocketPath || providerCapture.has(bundleId)) return;
|
|
124820
|
+
providerCapture.set(bundleId, await readCaptureEnabled(bundleId));
|
|
124821
|
+
};
|
|
124822
|
+
const keepsCapture = (bundleId) => activatedBundleIds.has(bundleId) || providerCapture.get(bundleId) === true;
|
|
124823
|
+
const applyThrottle = async (bundleId, throttle) => {
|
|
124824
|
+
await noteProviderCapture(bundleId);
|
|
124825
|
+
await sendCdpRpc(bundleId, "NativeDevtoolsIos.configure", {
|
|
124826
|
+
bypassPorts: [throttle.metroPort]
|
|
124827
|
+
});
|
|
124828
|
+
await sendCdpRpc(bundleId, "Network.emulateNetworkConditions", { ...throttle.conditions });
|
|
124829
|
+
};
|
|
124830
|
+
const clearThrottle = async (bundleId) => {
|
|
124831
|
+
await sendCdpRpc(bundleId, "NativeDevtoolsIos.configure", { bypassPorts: [] });
|
|
124832
|
+
await sendCdpRpc(bundleId, keepsCapture(bundleId) ? "Network.enable" : "Network.disable");
|
|
124833
|
+
providerCapture.delete(bundleId);
|
|
124834
|
+
};
|
|
124835
|
+
const reapplyThrottle = (bundleId, throttle) => {
|
|
124836
|
+
applyThrottle(bundleId, throttle).catch((err) => {
|
|
124837
|
+
const reason2 = err instanceof Error ? err.message : String(err);
|
|
124838
|
+
process.stderr.write(
|
|
124839
|
+
`[native-devtools] could not re-apply network conditions to ${bundleId}: ${reason2}
|
|
124840
|
+
`
|
|
124841
|
+
);
|
|
124842
|
+
});
|
|
124843
|
+
};
|
|
124844
|
+
const sendNetworkSetup = (bundleId, socket) => {
|
|
124845
|
+
if (activatedBundleIds.has(bundleId)) writeActivation(socket);
|
|
124846
|
+
const throttle = networkConditions.get(bundleId);
|
|
124847
|
+
if (throttle) reapplyThrottle(bundleId, throttle);
|
|
124848
|
+
};
|
|
124849
|
+
const storeThrottle = (bundleId, throttle) => {
|
|
124850
|
+
if (throttle) networkConditions.set(bundleId, throttle);
|
|
124851
|
+
else networkConditions.delete(bundleId);
|
|
124852
|
+
};
|
|
124853
|
+
const releaseLentThrottles = async () => {
|
|
124854
|
+
const throttled = /* @__PURE__ */ new Set([...networkConditions.keys(), ...unconfirmedThrottles]);
|
|
124855
|
+
const cleared = [...throttled].filter((bundleId) => connections2.has(bundleId)).map((bundleId) => clearThrottle(bundleId).catch(() => {
|
|
124856
|
+
}));
|
|
124857
|
+
await Promise.race([
|
|
124858
|
+
Promise.all(cleared),
|
|
124859
|
+
new Promise((resolve21) => setTimeout(resolve21, LENT_RELEASE_TIMEOUT_MS).unref())
|
|
124860
|
+
]);
|
|
124861
|
+
};
|
|
124862
|
+
const settleRpc = (payload) => {
|
|
124863
|
+
const pending = pendingRpc.get(payload.id);
|
|
124864
|
+
if (!pending) return;
|
|
124865
|
+
pendingRpc.delete(payload.id);
|
|
124866
|
+
if (payload.error) {
|
|
124867
|
+
pending.reject(
|
|
124868
|
+
new FailureError(payload.error.message, {
|
|
124869
|
+
error_code: FAILURE_CODES.NATIVE_DEVTOOLS_RPC_ERROR,
|
|
124870
|
+
failure_stage: "native_devtools_rpc_response",
|
|
124871
|
+
failure_area: "tool_server",
|
|
124872
|
+
error_kind: "subprocess"
|
|
124873
|
+
})
|
|
124874
|
+
);
|
|
124875
|
+
} else pending.resolve(payload.result);
|
|
124876
|
+
};
|
|
124801
124877
|
if (transport === "unix" && !lentSocketPath) {
|
|
124802
124878
|
try {
|
|
124803
124879
|
fs23.unlinkSync(socketPath);
|
|
@@ -124818,18 +124894,12 @@ var nativeDevtoolsBlueprint = {
|
|
|
124818
124894
|
existing.socket.destroy();
|
|
124819
124895
|
}
|
|
124820
124896
|
connections2.set(bundleId, { socket, networkLog: [] });
|
|
124821
|
-
|
|
124822
|
-
socket.write(
|
|
124823
|
-
JSON.stringify({
|
|
124824
|
-
type: "Control",
|
|
124825
|
-
payload: { command: "activateNetworkInspection" }
|
|
124826
|
-
}) + "\n"
|
|
124827
|
-
);
|
|
124828
|
-
}
|
|
124897
|
+
sendNetworkSetup(bundleId, socket);
|
|
124829
124898
|
return;
|
|
124830
124899
|
}
|
|
124831
124900
|
if (msg.type === "CDP") {
|
|
124832
124901
|
const p = msg.payload;
|
|
124902
|
+
if (p.id !== void 0) settleRpc(p);
|
|
124833
124903
|
if (p.method && p.id === void 0) {
|
|
124834
124904
|
const conn = connections2.get(bundleId);
|
|
124835
124905
|
if (conn) {
|
|
@@ -124844,22 +124914,7 @@ var nativeDevtoolsBlueprint = {
|
|
|
124844
124914
|
}
|
|
124845
124915
|
}
|
|
124846
124916
|
}
|
|
124847
|
-
if (msg.type === "ViewInspector")
|
|
124848
|
-
const p = msg.payload;
|
|
124849
|
-
const pending = pendingRpc.get(p.id);
|
|
124850
|
-
if (!pending) return;
|
|
124851
|
-
pendingRpc.delete(p.id);
|
|
124852
|
-
if (p.error) {
|
|
124853
|
-
pending.reject(
|
|
124854
|
-
new FailureError(p.error.message, {
|
|
124855
|
-
error_code: FAILURE_CODES.NATIVE_DEVTOOLS_RPC_ERROR,
|
|
124856
|
-
failure_stage: "native_devtools_rpc_response",
|
|
124857
|
-
failure_area: "tool_server",
|
|
124858
|
-
error_kind: "subprocess"
|
|
124859
|
-
})
|
|
124860
|
-
);
|
|
124861
|
-
} else pending.resolve(p.result);
|
|
124862
|
-
}
|
|
124917
|
+
if (msg.type === "ViewInspector") settleRpc(msg.payload);
|
|
124863
124918
|
}
|
|
124864
124919
|
});
|
|
124865
124920
|
socket.on("close", () => {
|
|
@@ -124989,15 +125044,26 @@ var nativeDevtoolsBlueprint = {
|
|
|
124989
125044
|
return "unregistered";
|
|
124990
125045
|
},
|
|
124991
125046
|
activateNetworkInspection(bundleId) {
|
|
125047
|
+
const alreadyCapturingThrottled = activatedBundleIds.has(bundleId) && networkConditions.has(bundleId);
|
|
124992
125048
|
activatedBundleIds.add(bundleId);
|
|
124993
125049
|
const conn = connections2.get(bundleId);
|
|
124994
|
-
if (conn)
|
|
124995
|
-
|
|
124996
|
-
|
|
124997
|
-
|
|
124998
|
-
|
|
124999
|
-
|
|
125000
|
-
|
|
125050
|
+
if (conn && !alreadyCapturingThrottled) sendNetworkSetup(bundleId, conn.socket);
|
|
125051
|
+
},
|
|
125052
|
+
async setNetworkConditions(bundleId, throttle) {
|
|
125053
|
+
const previous = networkConditions.get(bundleId) ?? null;
|
|
125054
|
+
storeThrottle(bundleId, throttle);
|
|
125055
|
+
if (!connections2.has(bundleId)) return;
|
|
125056
|
+
if (!throttle && !previous && !unconfirmedThrottles.has(bundleId)) return;
|
|
125057
|
+
try {
|
|
125058
|
+
if (throttle) await applyThrottle(bundleId, throttle);
|
|
125059
|
+
else await clearThrottle(bundleId);
|
|
125060
|
+
unconfirmedThrottles.delete(bundleId);
|
|
125061
|
+
} catch (err) {
|
|
125062
|
+
if (throttle) unconfirmedThrottles.add(bundleId);
|
|
125063
|
+
if ((networkConditions.get(bundleId) ?? null) === throttle) {
|
|
125064
|
+
storeThrottle(bundleId, previous);
|
|
125065
|
+
}
|
|
125066
|
+
throw err;
|
|
125001
125067
|
}
|
|
125002
125068
|
},
|
|
125003
125069
|
getNetworkLog: (bundleId) => [...connections2.get(bundleId)?.networkLog ?? []],
|
|
@@ -125052,11 +125118,15 @@ var nativeDevtoolsBlueprint = {
|
|
|
125052
125118
|
api,
|
|
125053
125119
|
dispose: async () => {
|
|
125054
125120
|
disposed = true;
|
|
125121
|
+
if (lentSocketPath) await releaseLentThrottles();
|
|
125055
125122
|
for (const { socket } of connections2.values()) {
|
|
125056
125123
|
socket.destroy();
|
|
125057
125124
|
}
|
|
125058
125125
|
connections2.clear();
|
|
125059
125126
|
activatedBundleIds.clear();
|
|
125127
|
+
networkConditions.clear();
|
|
125128
|
+
unconfirmedThrottles.clear();
|
|
125129
|
+
providerCapture.clear();
|
|
125060
125130
|
lentSocket?.destroy();
|
|
125061
125131
|
server?.close();
|
|
125062
125132
|
if (transport === "unix" && !lentSocketPath) {
|
|
@@ -128559,6 +128629,11 @@ async function copyScreenshotToClipboard(ctx, opts = {}) {
|
|
|
128559
128629
|
|
|
128560
128630
|
// ../tool-server/src/chromium-server/tabs.ts
|
|
128561
128631
|
init_src2();
|
|
128632
|
+
var isHttpUrl = (url2) => /^https?:/i.test(url2 ?? "");
|
|
128633
|
+
var isBlank = (url2) => url2 === "" || url2 === "about:blank";
|
|
128634
|
+
var TYPED_LOAD_TIMEOUT_MS = 12e4;
|
|
128635
|
+
var HISTORY_RESET_ATTEMPTS = 20;
|
|
128636
|
+
var HISTORY_RESET_RETRY_MS = 100;
|
|
128562
128637
|
function createTabsManager(deps) {
|
|
128563
128638
|
const { cdp, port } = deps;
|
|
128564
128639
|
const targetToTab = /* @__PURE__ */ new Map();
|
|
@@ -128655,8 +128730,23 @@ function createTabsManager(deps) {
|
|
|
128655
128730
|
});
|
|
128656
128731
|
}
|
|
128657
128732
|
}
|
|
128733
|
+
async function loadAsTyped(targetId, url2) {
|
|
128734
|
+
await cdp.send("Page.navigate", { url: url2, transitionType: "typed" }, TYPED_LOAD_TIMEOUT_MS);
|
|
128735
|
+
for (let attempt = 0; attempt < HISTORY_RESET_ATTEMPTS; attempt++) {
|
|
128736
|
+
if (activeTargetId !== targetId) return;
|
|
128737
|
+
const reset = await cdp.send("Page.resetNavigationHistory").then(
|
|
128738
|
+
() => true,
|
|
128739
|
+
() => false
|
|
128740
|
+
);
|
|
128741
|
+
if (reset) return;
|
|
128742
|
+
await sleep(HISTORY_RESET_RETRY_MS);
|
|
128743
|
+
}
|
|
128744
|
+
}
|
|
128658
128745
|
async function open5(opts) {
|
|
128659
|
-
const
|
|
128746
|
+
const requestedUrl = opts?.url;
|
|
128747
|
+
const activating = opts?.activate !== false;
|
|
128748
|
+
const deferLoad = activating && isHttpUrl(requestedUrl) && deps.networkThrottled();
|
|
128749
|
+
const url2 = deferLoad ? "about:blank" : requestedUrl ?? "about:blank";
|
|
128660
128750
|
const created = await withBrowserClient(async (browser) => {
|
|
128661
128751
|
let out;
|
|
128662
128752
|
try {
|
|
@@ -128688,16 +128778,21 @@ function createTabsManager(deps) {
|
|
|
128688
128778
|
labelToTab.set(opts.label, tabId);
|
|
128689
128779
|
tabToLabel.set(tabId, opts.label);
|
|
128690
128780
|
}
|
|
128691
|
-
if (
|
|
128692
|
-
|
|
128693
|
-
|
|
128694
|
-
|
|
128695
|
-
|
|
128696
|
-
|
|
128781
|
+
if (activating) await activate(created, await listTargets2());
|
|
128782
|
+
if (deferLoad) loadAsTyped(created, requestedUrl).catch(() => {
|
|
128783
|
+
});
|
|
128784
|
+
const tabs = await list();
|
|
128785
|
+
return tabs.map(
|
|
128786
|
+
(tab) => tab.targetId === created && requestedUrl && isBlank(tab.url) ? { ...tab, url: requestedUrl } : tab
|
|
128787
|
+
);
|
|
128697
128788
|
}
|
|
128698
128789
|
async function close(ref) {
|
|
128699
128790
|
const targets = await listTargets2();
|
|
128700
128791
|
const targetId = ref ? resolveTargetId(ref, targets) : activeTargetId;
|
|
128792
|
+
if (targetId === activeTargetId) {
|
|
128793
|
+
const fallback = targets.find((t) => t.id !== targetId && t.webSocketDebuggerUrl);
|
|
128794
|
+
if (fallback) await activate(fallback.id, targets);
|
|
128795
|
+
}
|
|
128701
128796
|
await withBrowserClient((browser) => browser.send("Target.closeTarget", { targetId }));
|
|
128702
128797
|
const tabId = targetToTab.get(targetId);
|
|
128703
128798
|
targetToTab.delete(targetId);
|
|
@@ -128708,13 +128803,8 @@ function createTabsManager(deps) {
|
|
|
128708
128803
|
tabToLabel.delete(tabId);
|
|
128709
128804
|
}
|
|
128710
128805
|
}
|
|
128711
|
-
|
|
128712
|
-
|
|
128713
|
-
if (remaining.length > 0) {
|
|
128714
|
-
await activate(remaining[0].id, remaining);
|
|
128715
|
-
}
|
|
128716
|
-
}
|
|
128717
|
-
return list();
|
|
128806
|
+
const remaining = (await listTargets2()).filter((t) => t.id !== targetId);
|
|
128807
|
+
return remaining.map(toInfo);
|
|
128718
128808
|
}
|
|
128719
128809
|
return {
|
|
128720
128810
|
list,
|
|
@@ -128727,10 +128817,12 @@ function createTabsManager(deps) {
|
|
|
128727
128817
|
|
|
128728
128818
|
// ../tool-server/src/chromium-server/network.ts
|
|
128729
128819
|
var MAX_RECORDS = 1e3;
|
|
128820
|
+
var shapesTraffic = (c) => c.offline || c.latency > 0 || c.downloadThroughput >= 0 || c.uploadThroughput >= 0;
|
|
128730
128821
|
function createNetworkManager(deps) {
|
|
128731
128822
|
const { cdp } = deps;
|
|
128732
128823
|
const order = [];
|
|
128733
128824
|
const byId = /* @__PURE__ */ new Map();
|
|
128825
|
+
let conditions = null;
|
|
128734
128826
|
function record2(requestId) {
|
|
128735
128827
|
let rec = byId.get(requestId);
|
|
128736
128828
|
if (!rec) {
|
|
@@ -128816,7 +128908,16 @@ function createNetworkManager(deps) {
|
|
|
128816
128908
|
reattach: async () => {
|
|
128817
128909
|
await cdp.send("Network.enable").catch(() => {
|
|
128818
128910
|
});
|
|
128911
|
+
if (conditions) {
|
|
128912
|
+
await cdp.send("Network.emulateNetworkConditions", conditions).catch(() => {
|
|
128913
|
+
});
|
|
128914
|
+
}
|
|
128819
128915
|
},
|
|
128916
|
+
setConditions: async (next) => {
|
|
128917
|
+
await cdp.send("Network.emulateNetworkConditions", next);
|
|
128918
|
+
conditions = next;
|
|
128919
|
+
},
|
|
128920
|
+
throttled: () => conditions !== null && shapesTraffic(conditions),
|
|
128820
128921
|
dispose: () => {
|
|
128821
128922
|
cdp.events.off("event", onEvent);
|
|
128822
128923
|
cdp.send("Network.disable").catch(() => {
|
|
@@ -128893,7 +128994,8 @@ async function createChromiumServer(opts) {
|
|
|
128893
128994
|
await primePageSession(cdp);
|
|
128894
128995
|
viewport = await readViewport(cdp);
|
|
128895
128996
|
await network.reattach();
|
|
128896
|
-
}
|
|
128997
|
+
},
|
|
128998
|
+
networkThrottled: () => network.throttled()
|
|
128897
128999
|
});
|
|
128898
129000
|
await network.reattach();
|
|
128899
129001
|
const server = {
|
|
@@ -145127,7 +145229,7 @@ function createMacosAppApi(bundleId) {
|
|
|
145127
145229
|
const reconnect = async () => {
|
|
145128
145230
|
const app = await runningTrackedApp(bundleId);
|
|
145129
145231
|
if (!app) throw notRunningError(bundleId);
|
|
145130
|
-
const
|
|
145232
|
+
const notConnected2 = (detail, cause) => macosFailure(
|
|
145131
145233
|
`${bundleId} is running (pid ${app.pid}) but argent cannot reach its library: ${detail} If it is paused in a debugger, continue it and try again. Otherwise run restart-app to start it again with the library.`,
|
|
145132
145234
|
FAILURE_CODES.MACOS_APP_NOT_CONNECTED,
|
|
145133
145235
|
"macos_app_reconnect",
|
|
@@ -145152,7 +145254,7 @@ function createMacosAppApi(bundleId) {
|
|
|
145152
145254
|
await ch.waitForHandshake(RECONNECT_TIMEOUT_MS);
|
|
145153
145255
|
} catch (err) {
|
|
145154
145256
|
ch.close();
|
|
145155
|
-
throw
|
|
145257
|
+
throw notConnected2(errorMessage2(err), err);
|
|
145156
145258
|
}
|
|
145157
145259
|
if (disposed && !launching) {
|
|
145158
145260
|
ch.close();
|
|
@@ -161463,6 +161565,266 @@ Works on local and remote (sim-remote) iOS simulators. Fails on a physical devic
|
|
|
161463
161565
|
})
|
|
161464
161566
|
};
|
|
161465
161567
|
|
|
161568
|
+
// ../tool-server/src/tools/network-conditions/index.ts
|
|
161569
|
+
init_device_info();
|
|
161570
|
+
|
|
161571
|
+
// ../tool-server/src/tools/network-conditions/schema.ts
|
|
161572
|
+
init_zod();
|
|
161573
|
+
var networkConditionsZodSchema = external_exports.object({
|
|
161574
|
+
udid: external_exports.string().min(1).describe(
|
|
161575
|
+
"Target device id from `list-devices`: an iOS simulator UDID, an Android emulator serial, or a Chromium id."
|
|
161576
|
+
),
|
|
161577
|
+
bundleId: external_exports.string().min(1).optional().describe("iOS only, and required there: the bundle id of the app to throttle."),
|
|
161578
|
+
port: metroPortField.describe(
|
|
161579
|
+
"iOS only: the Metro port the throttle leaves alone. Omit it to use this device's port (8081 by default)."
|
|
161580
|
+
),
|
|
161581
|
+
latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe(
|
|
161582
|
+
"Minimum time in milliseconds from sending a request to its response. iOS and Chromium only."
|
|
161583
|
+
),
|
|
161584
|
+
downloadKbps: external_exports.number().int().min(1).optional().describe("Download limit in kilobits per second. iOS and Chromium only."),
|
|
161585
|
+
uploadKbps: external_exports.number().int().min(1).optional().describe("Upload limit in kilobits per second. iOS and Chromium only."),
|
|
161586
|
+
offline: external_exports.boolean().optional().describe(
|
|
161587
|
+
"Make requests fail as if the network were down. On Android, ports forwarded with adb reverse stay reachable."
|
|
161588
|
+
)
|
|
161589
|
+
}).strict();
|
|
161590
|
+
function requestedConditions(params) {
|
|
161591
|
+
const { latencyMs, downloadKbps, uploadKbps, offline } = params;
|
|
161592
|
+
const conditions = {
|
|
161593
|
+
...latencyMs !== void 0 && { latencyMs },
|
|
161594
|
+
...downloadKbps !== void 0 && { downloadKbps },
|
|
161595
|
+
...uploadKbps !== void 0 && { uploadKbps },
|
|
161596
|
+
...offline && { offline }
|
|
161597
|
+
};
|
|
161598
|
+
return Object.keys(conditions).length > 0 ? conditions : null;
|
|
161599
|
+
}
|
|
161600
|
+
|
|
161601
|
+
// ../tool-server/src/tools/network-conditions/platforms/ios.ts
|
|
161602
|
+
init_src2();
|
|
161603
|
+
|
|
161604
|
+
// ../tool-server/src/utils/network-conditions.ts
|
|
161605
|
+
var kbpsToBytesPerSecond = (kbps) => kbps === void 0 ? -1 : kbps * 125;
|
|
161606
|
+
function toCdpNetworkConditions(conditions) {
|
|
161607
|
+
return {
|
|
161608
|
+
offline: conditions?.offline ?? false,
|
|
161609
|
+
latency: conditions?.latencyMs ?? 0,
|
|
161610
|
+
downloadThroughput: kbpsToBytesPerSecond(conditions?.downloadKbps),
|
|
161611
|
+
uploadThroughput: kbpsToBytesPerSecond(conditions?.uploadKbps)
|
|
161612
|
+
};
|
|
161613
|
+
}
|
|
161614
|
+
|
|
161615
|
+
// ../tool-server/src/tools/network-conditions/platforms/ios.ts
|
|
161616
|
+
function missingBundleId() {
|
|
161617
|
+
return new FailureError("network-conditions on iOS needs `bundleId`: the app to throttle.", {
|
|
161618
|
+
error_code: FAILURE_CODES.TOOL_INPUT_INVALID,
|
|
161619
|
+
failure_stage: "network_conditions_params",
|
|
161620
|
+
failure_area: "tool_server",
|
|
161621
|
+
error_kind: "validation"
|
|
161622
|
+
});
|
|
161623
|
+
}
|
|
161624
|
+
function notConnected(bundleId) {
|
|
161625
|
+
return new FailureError(`Native devtools not connected for bundleId: ${bundleId}.`, {
|
|
161626
|
+
error_code: FAILURE_CODES.NATIVE_DEVTOOLS_NOT_CONNECTED,
|
|
161627
|
+
failure_stage: "network_conditions_connection",
|
|
161628
|
+
failure_area: "tool_server",
|
|
161629
|
+
error_kind: "not_found"
|
|
161630
|
+
});
|
|
161631
|
+
}
|
|
161632
|
+
function appleApp(bundleId) {
|
|
161633
|
+
return new FailureError(
|
|
161634
|
+
`${bundleId} is an Apple system app. network-conditions on iOS throttles only a non-Apple app that Argent launched with native devtools.`,
|
|
161635
|
+
{
|
|
161636
|
+
error_code: FAILURE_CODES.NATIVE_DEVTOOLS_NOT_INJECTABLE,
|
|
161637
|
+
failure_stage: "network_conditions_params",
|
|
161638
|
+
failure_area: "tool_server",
|
|
161639
|
+
error_kind: "validation"
|
|
161640
|
+
}
|
|
161641
|
+
);
|
|
161642
|
+
}
|
|
161643
|
+
async function isNotRunning(api, bundleId) {
|
|
161644
|
+
if (api.isConnected(bundleId)) return false;
|
|
161645
|
+
const state3 = await api.appConnectionState(bundleId).catch(() => null);
|
|
161646
|
+
return state3 === "not_running";
|
|
161647
|
+
}
|
|
161648
|
+
var iosImpl5 = {
|
|
161649
|
+
requires: ["xcrun"],
|
|
161650
|
+
async handler(services, params) {
|
|
161651
|
+
const { bundleId } = params;
|
|
161652
|
+
if (!bundleId) throw missingBundleId();
|
|
161653
|
+
if (!isInjectableBundleId(bundleId)) throw appleApp(bundleId);
|
|
161654
|
+
const api = services.nativeDevtools;
|
|
161655
|
+
const conditions = requestedConditions(params);
|
|
161656
|
+
if (!conditions && !api.isConnected(bundleId)) await api.setNetworkConditions(bundleId, null);
|
|
161657
|
+
if (conditions || !await isNotRunning(api, bundleId)) {
|
|
161658
|
+
const blocked = await precheckNativeDevtools(api, params.udid, bundleId);
|
|
161659
|
+
if (blocked) return blocked;
|
|
161660
|
+
if (!api.isConnected(bundleId)) throw notConnected(bundleId);
|
|
161661
|
+
}
|
|
161662
|
+
const throttle = conditions && {
|
|
161663
|
+
conditions: toCdpNetworkConditions(conditions),
|
|
161664
|
+
metroPort: metroPort({ device_id: params.udid, port: params.port })
|
|
161665
|
+
};
|
|
161666
|
+
await api.setNetworkConditions(bundleId, throttle);
|
|
161667
|
+
return { scope: "app", conditions };
|
|
161668
|
+
}
|
|
161669
|
+
};
|
|
161670
|
+
|
|
161671
|
+
// ../tool-server/src/tools/network-conditions/platforms/android.ts
|
|
161672
|
+
init_src2();
|
|
161673
|
+
init_adb();
|
|
161674
|
+
var NETWORK_UP_TIMEOUT_MS = 15e3;
|
|
161675
|
+
var NETWORK_DOWN_TIMEOUT_MS = 15e3;
|
|
161676
|
+
var NETWORK_POLL_MS = 500;
|
|
161677
|
+
function onlyOfflineSupported() {
|
|
161678
|
+
return new FailureError(
|
|
161679
|
+
"On an Android emulator network-conditions supports only `offline`. The emulator console's speed and delay settings do not shape the Wi-Fi network that current system images use.",
|
|
161680
|
+
{
|
|
161681
|
+
error_code: FAILURE_CODES.TOOL_INPUT_INVALID,
|
|
161682
|
+
failure_stage: "network_conditions_params",
|
|
161683
|
+
failure_area: "tool_server",
|
|
161684
|
+
error_kind: "unsupported"
|
|
161685
|
+
}
|
|
161686
|
+
);
|
|
161687
|
+
}
|
|
161688
|
+
function networkDidNotReturn(serial) {
|
|
161689
|
+
return new FailureError(
|
|
161690
|
+
`Turned Wi-Fi and mobile data back on for ${serial}, but no network came up within ${NETWORK_UP_TIMEOUT_MS / 1e3} s. Check the emulator's network, then call network-conditions again with no conditions.`,
|
|
161691
|
+
{
|
|
161692
|
+
error_code: FAILURE_CODES.ANDROID_NETWORK_RESTORE_TIMEOUT,
|
|
161693
|
+
failure_stage: "network_conditions_reset",
|
|
161694
|
+
failure_area: "tool_server",
|
|
161695
|
+
error_kind: "timeout"
|
|
161696
|
+
}
|
|
161697
|
+
);
|
|
161698
|
+
}
|
|
161699
|
+
function networkStayedUp(serial) {
|
|
161700
|
+
return new FailureError(
|
|
161701
|
+
`${serial} still has a network with Wi-Fi and mobile data off, so network-conditions cannot take it offline. An Android TV emulator connects over Ethernet, which Argent cannot turn off. Wi-Fi and mobile data are back on.`,
|
|
161702
|
+
{
|
|
161703
|
+
error_code: FAILURE_CODES.ANDROID_OFFLINE_UNSUPPORTED,
|
|
161704
|
+
failure_stage: "network_conditions_offline",
|
|
161705
|
+
failure_area: "tool_server",
|
|
161706
|
+
error_kind: "unsupported"
|
|
161707
|
+
}
|
|
161708
|
+
);
|
|
161709
|
+
}
|
|
161710
|
+
function networkDidNotDrop(serial) {
|
|
161711
|
+
return new FailureError(
|
|
161712
|
+
`Turned Wi-Fi and mobile data off for ${serial}, but could not confirm it was offline after ${NETWORK_DOWN_TIMEOUT_MS / 1e3} s. Check the adb connection and call network-conditions again. Wi-Fi and mobile data are back on.`,
|
|
161713
|
+
{
|
|
161714
|
+
error_code: FAILURE_CODES.ANDROID_OFFLINE_TIMEOUT,
|
|
161715
|
+
failure_stage: "network_conditions_offline",
|
|
161716
|
+
failure_area: "tool_server",
|
|
161717
|
+
error_kind: "timeout"
|
|
161718
|
+
}
|
|
161719
|
+
);
|
|
161720
|
+
}
|
|
161721
|
+
async function setRadios(serial, enabled) {
|
|
161722
|
+
const state3 = enabled ? "enable" : "disable";
|
|
161723
|
+
await runAdb(["-s", serial, "shell", "svc", "wifi", state3]);
|
|
161724
|
+
await runAdb(["-s", serial, "shell", "svc", "data", state3]).catch((err) => {
|
|
161725
|
+
if (!String(err).includes("Can't find service")) throw err;
|
|
161726
|
+
});
|
|
161727
|
+
}
|
|
161728
|
+
async function readNetworkState(serial) {
|
|
161729
|
+
const out = await adbShell(
|
|
161730
|
+
serial,
|
|
161731
|
+
"dumpsys connectivity | grep -m1 'Active default network'"
|
|
161732
|
+
).catch(() => "");
|
|
161733
|
+
const value = /^\s*Active default network:\s*(none|\d+)\s*$/m.exec(out)?.[1];
|
|
161734
|
+
if (!value) return "unknown";
|
|
161735
|
+
return value === "none" ? "offline" : "online";
|
|
161736
|
+
}
|
|
161737
|
+
async function defaultNetworkIsEthernet(serial) {
|
|
161738
|
+
const out = await adbShell(serial, "dumpsys connectivity");
|
|
161739
|
+
const id = /Active default network: (\d+)/.exec(out)?.[1];
|
|
161740
|
+
const agent = out.split("\n").find((line) => line.includes(`NetworkAgentInfo{network{${id}}`));
|
|
161741
|
+
return /Transports: [A-Z|]*ETHERNET/.test(agent ?? "");
|
|
161742
|
+
}
|
|
161743
|
+
async function waitForNetworkState(serial, expected, timeoutMs) {
|
|
161744
|
+
const deadline = Date.now() + timeoutMs;
|
|
161745
|
+
while (Date.now() < deadline) {
|
|
161746
|
+
if (await readNetworkState(serial) === expected) return true;
|
|
161747
|
+
await new Promise((resolve21) => setTimeout(resolve21, NETWORK_POLL_MS));
|
|
161748
|
+
}
|
|
161749
|
+
return false;
|
|
161750
|
+
}
|
|
161751
|
+
async function waitForNetwork(serial) {
|
|
161752
|
+
const up = await waitForNetworkState(serial, "online", NETWORK_UP_TIMEOUT_MS);
|
|
161753
|
+
if (!up) throw networkDidNotReturn(serial);
|
|
161754
|
+
}
|
|
161755
|
+
async function goOffline(serial) {
|
|
161756
|
+
await setRadios(serial, false);
|
|
161757
|
+
const down = await waitForNetworkState(serial, "offline", NETWORK_DOWN_TIMEOUT_MS);
|
|
161758
|
+
if (down) return;
|
|
161759
|
+
const ethernet = await defaultNetworkIsEthernet(serial).catch(() => false);
|
|
161760
|
+
await setRadios(serial, true);
|
|
161761
|
+
throw ethernet ? networkStayedUp(serial) : networkDidNotDrop(serial);
|
|
161762
|
+
}
|
|
161763
|
+
var androidImpl7 = {
|
|
161764
|
+
requires: ["adb"],
|
|
161765
|
+
async handler(_services, params) {
|
|
161766
|
+
const serial = params.udid;
|
|
161767
|
+
const conditions = requestedConditions(params);
|
|
161768
|
+
const offlineOnly = conditions?.offline === true && Object.keys(conditions).length === 1;
|
|
161769
|
+
if (conditions && !offlineOnly) throw onlyOfflineSupported();
|
|
161770
|
+
if (conditions) {
|
|
161771
|
+
await goOffline(serial);
|
|
161772
|
+
} else if (await readNetworkState(serial) !== "online") {
|
|
161773
|
+
await setRadios(serial, true);
|
|
161774
|
+
await waitForNetwork(serial);
|
|
161775
|
+
}
|
|
161776
|
+
return { scope: "device", conditions };
|
|
161777
|
+
}
|
|
161778
|
+
};
|
|
161779
|
+
|
|
161780
|
+
// ../tool-server/src/tools/network-conditions/platforms/chromium.ts
|
|
161781
|
+
var chromiumImpl3 = {
|
|
161782
|
+
async handler(services, params) {
|
|
161783
|
+
const conditions = requestedConditions(params);
|
|
161784
|
+
await services.chromium.server.network.setConditions(toCdpNetworkConditions(conditions));
|
|
161785
|
+
return { scope: "tab", conditions };
|
|
161786
|
+
}
|
|
161787
|
+
};
|
|
161788
|
+
|
|
161789
|
+
// ../tool-server/src/tools/network-conditions/index.ts
|
|
161790
|
+
var capability22 = {
|
|
161791
|
+
apple: { simulator: true },
|
|
161792
|
+
android: { emulator: true },
|
|
161793
|
+
chromium: { app: true }
|
|
161794
|
+
};
|
|
161795
|
+
var networkConditionsTool = {
|
|
161796
|
+
id: "network-conditions",
|
|
161797
|
+
description: `Throttle the network: add latency, limit download and upload speed, or go offline.
|
|
161798
|
+
Use to test loading states, timeouts, retries and offline handling. Each call replaces the previous conditions. Call it with no condition (only udid, plus bundleId on iOS) to remove the throttle.
|
|
161799
|
+
Returns { scope, conditions }. scope names what was shaped:
|
|
161800
|
+
- "app" on an iOS simulator: only the app named by bundleId, a non-Apple app with native devtools connected. Shapes its http/https URLSession requests, except WebSockets and requests to the Metro port (port). The server gets each request at once: Argent delays what the app receives. Argent applies the conditions again when the app restarts and reconnects; the app drops them when the tool-server stops. If status is restart_required, service_stale, connect_pending or init_failed, follow the message as for native-network-logs.
|
|
161801
|
+
- "device" on an Android emulator: offline only. offline turns Wi-Fi and mobile data off, and fails on an emulator that keeps a network (an Android TV emulator uses Ethernet); a call without conditions turns both on when no network is up and fails if none comes up within 15 s. latencyMs, downloadKbps and uploadKbps fail there. While offline, requests through adb reverse still work, and an app that reaches Metro at 10.0.2.2 loses it, so the debugger tools cannot reach a React Native app that loads from there.
|
|
161802
|
+
- "tab" on Chromium: requests of the active tab's page, not its workers, service workers or cross-site iframes. Argent applies the conditions again after a tab switch and before a tab opened by chromium-tabs loads.
|
|
161803
|
+
conditions is null after a reset. Fails on a physical iOS or Android device.`,
|
|
161804
|
+
zodSchema: networkConditionsZodSchema,
|
|
161805
|
+
searchHint: "network throttle latency slow offline bandwidth 3g conditions emulate",
|
|
161806
|
+
interaction: {
|
|
161807
|
+
startedMsg: () => "Setting network conditions",
|
|
161808
|
+
completedMsg: () => "Set network conditions",
|
|
161809
|
+
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to set network conditions: ${failureSignal2.error_code}`
|
|
161810
|
+
},
|
|
161811
|
+
capability: capability22,
|
|
161812
|
+
services: (params) => {
|
|
161813
|
+
const device = resolveDevice(params.udid);
|
|
161814
|
+
if (device.platform === "chromium") return { chromium: chromiumCdpRef(device) };
|
|
161815
|
+
if (device.platform === "ios" && device.kind === "simulator")
|
|
161816
|
+
return { nativeDevtools: nativeDevtoolsRef(device) };
|
|
161817
|
+
return {};
|
|
161818
|
+
},
|
|
161819
|
+
execute: dispatchByPlatform({
|
|
161820
|
+
toolId: "network-conditions",
|
|
161821
|
+
capability: capability22,
|
|
161822
|
+
ios: iosImpl5,
|
|
161823
|
+
android: androidImpl7,
|
|
161824
|
+
chromium: chromiumImpl3
|
|
161825
|
+
})
|
|
161826
|
+
};
|
|
161827
|
+
|
|
161466
161828
|
// ../tool-server/src/tools/fold/index.ts
|
|
161467
161829
|
init_zod();
|
|
161468
161830
|
init_src2();
|
|
@@ -161712,7 +162074,7 @@ async function fold(serial, params, device, signal) {
|
|
|
161712
162074
|
...warnings.length > 0 ? { warning: warnings.join(" ") } : {}
|
|
161713
162075
|
};
|
|
161714
162076
|
}
|
|
161715
|
-
var
|
|
162077
|
+
var androidImpl8 = {
|
|
161716
162078
|
requires: ["adb"],
|
|
161717
162079
|
async handler(_services, params, device, options) {
|
|
161718
162080
|
const serial = params.udid;
|
|
@@ -161731,7 +162093,7 @@ var androidImpl7 = {
|
|
|
161731
162093
|
var POSTURES2 = ["closed", "half-open", "open"];
|
|
161732
162094
|
var POSTURE_ANGLE = { "closed": 0, "half-open": 120, "open": 180 };
|
|
161733
162095
|
var HINGE_REQUEST_TIMEOUT_MS = 3e4;
|
|
161734
|
-
var
|
|
162096
|
+
var capability23 = {
|
|
161735
162097
|
// Local simulators only. A remote (MoQ) simulator is driven on its main
|
|
161736
162098
|
// screen and carries no hinge message; the server itself rejects a device
|
|
161737
162099
|
// that is not foldable, with its own reason.
|
|
@@ -161790,7 +162152,7 @@ function screenResult(activeScreen, panels) {
|
|
|
161790
162152
|
...panel ? { width: panel.width, height: panel.height } : {}
|
|
161791
162153
|
};
|
|
161792
162154
|
}
|
|
161793
|
-
var
|
|
162155
|
+
var iosImpl6 = {
|
|
161794
162156
|
async handler(services, params, _device, ctx) {
|
|
161795
162157
|
const api = services.simulatorServer;
|
|
161796
162158
|
const udid = params.udid;
|
|
@@ -161877,7 +162239,7 @@ Fails if the device is not foldable, is a remote simulator or a physical Android
|
|
|
161877
162239
|
completedMsg: ({ params, result }) => "activeScreen" in result ? `Folded device to ${targetLabel2(params)}; it renders to screen ${result.activeScreen} (${result.screen.panel})` : `Folded device to ${targetLabel2(params)}; it is in device state ${result.deviceState}`,
|
|
161878
162240
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to fold device to ${targetLabel2(params)}: ${failureSignal2.error_code}`
|
|
161879
162241
|
},
|
|
161880
|
-
capability:
|
|
162242
|
+
capability: capability23,
|
|
161881
162243
|
// The Android hinge is moved through `adb`, so no simulator-server is
|
|
161882
162244
|
// spawned for it; the server follows the new panel on its own.
|
|
161883
162245
|
services: (params) => {
|
|
@@ -161886,9 +162248,9 @@ Fails if the device is not foldable, is a remote simulator or a physical Android
|
|
|
161886
162248
|
},
|
|
161887
162249
|
execute: dispatchByPlatform({
|
|
161888
162250
|
toolId: "fold",
|
|
161889
|
-
capability:
|
|
161890
|
-
ios:
|
|
161891
|
-
android:
|
|
162251
|
+
capability: capability23,
|
|
162252
|
+
ios: iosImpl6,
|
|
162253
|
+
android: androidImpl8
|
|
161892
162254
|
})
|
|
161893
162255
|
};
|
|
161894
162256
|
|
|
@@ -161964,7 +162326,7 @@ var vegaImpl5 = {
|
|
|
161964
162326
|
|
|
161965
162327
|
// ../tool-server/src/tools/tv-remote/index.ts
|
|
161966
162328
|
var BUTTONS = [...REMOTE_BUTTONS];
|
|
161967
|
-
var
|
|
162329
|
+
var capability24 = {
|
|
161968
162330
|
apple: { simulator: true },
|
|
161969
162331
|
android: { emulator: true, device: true, unknown: true },
|
|
161970
162332
|
vega: { vvd: true }
|
|
@@ -162013,11 +162375,11 @@ Returns { pressed, count }. Fails on a target that is not a TV, and on the Apple
|
|
|
162013
162375
|
// A path (≤64 buttons) × repeat (≤50) flattens to thousands of presses, sent
|
|
162014
162376
|
// one round-trip at a time on the Apple/Android path — minutes of wall-clock.
|
|
162015
162377
|
longRunning: true,
|
|
162016
|
-
capability:
|
|
162378
|
+
capability: capability24,
|
|
162017
162379
|
services: () => ({}),
|
|
162018
162380
|
execute: dispatchByPlatform({
|
|
162019
162381
|
toolId: "tv-remote",
|
|
162020
|
-
capability:
|
|
162382
|
+
capability: capability24,
|
|
162021
162383
|
ios: makeIosImpl5(registry2),
|
|
162022
162384
|
android: makeAndroidImpl3(registry2),
|
|
162023
162385
|
vega: vegaImpl5
|
|
@@ -162094,7 +162456,7 @@ var ALLOWED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
162094
162456
|
"tv-remote",
|
|
162095
162457
|
AWAIT_UI_ELEMENT_TOOL_ID
|
|
162096
162458
|
]);
|
|
162097
|
-
var
|
|
162459
|
+
var capability25 = {
|
|
162098
162460
|
// Physical iOS is a valid outer target. Unsupported steps fail at their own gate, not the whole sequence.
|
|
162099
162461
|
apple: { simulator: true, device: true },
|
|
162100
162462
|
appleRemote: { simulator: true },
|
|
@@ -162159,7 +162521,7 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
162159
162521
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to run interaction sequence: ${failureSignal2.error_code}`
|
|
162160
162522
|
},
|
|
162161
162523
|
longRunning: true,
|
|
162162
|
-
capability:
|
|
162524
|
+
capability: capability25,
|
|
162163
162525
|
// Each step resolves its own services. An eager resolver can't be used
|
|
162164
162526
|
// because a tvOS udid shape-classifies as `ios` (there is no `tvos`
|
|
162165
162527
|
// platform), so declaring simulator-server would spawn a controller it
|
|
@@ -164731,7 +165093,7 @@ function withDescription(data) {
|
|
|
164731
165093
|
if (data.hint) out.hint = data.hint;
|
|
164732
165094
|
return out;
|
|
164733
165095
|
}
|
|
164734
|
-
var
|
|
165096
|
+
var capability26 = {
|
|
164735
165097
|
apple: { simulator: true, device: true },
|
|
164736
165098
|
appleRemote: { simulator: true },
|
|
164737
165099
|
android: { emulator: true, device: true, unknown: true },
|
|
@@ -164743,7 +165105,7 @@ var capability25 = {
|
|
|
164743
165105
|
function makeDescribeExecute(registry2) {
|
|
164744
165106
|
return dispatchByPlatform({
|
|
164745
165107
|
toolId: "describe",
|
|
164746
|
-
capability:
|
|
165108
|
+
capability: capability26,
|
|
164747
165109
|
ios: {
|
|
164748
165110
|
requires: iosRequires,
|
|
164749
165111
|
handler: async (_services, params, device) => (
|
|
@@ -164834,7 +165196,7 @@ For React Native component names, or a testID describe does not list, use debugg
|
|
|
164834
165196
|
completedMsg: () => "Read screen",
|
|
164835
165197
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to read screen: ${failureSignal2.error_code}`
|
|
164836
165198
|
},
|
|
164837
|
-
capability:
|
|
165199
|
+
capability: capability26,
|
|
164838
165200
|
services: (params) => {
|
|
164839
165201
|
const device = resolveDevice(params.udid);
|
|
164840
165202
|
if (device.platform === "chromium") {
|
|
@@ -165278,7 +165640,7 @@ async function readAndroidUiTree(registry2, device) {
|
|
|
165278
165640
|
}
|
|
165279
165641
|
|
|
165280
165642
|
// ../tool-server/src/tools/ui-tree/index.ts
|
|
165281
|
-
var
|
|
165643
|
+
var capability27 = {
|
|
165282
165644
|
apple: { simulator: true },
|
|
165283
165645
|
appleRemote: { simulator: true },
|
|
165284
165646
|
android: { emulator: true, device: true, unknown: true }
|
|
@@ -165301,11 +165663,11 @@ Fails if the iOS ax-service predates the tree command; update argent.`,
|
|
|
165301
165663
|
completedMsg: () => "Read UI tree",
|
|
165302
165664
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to read UI tree: ${failureSignal2.error_code}`
|
|
165303
165665
|
},
|
|
165304
|
-
capability:
|
|
165666
|
+
capability: capability27,
|
|
165305
165667
|
services: () => ({}),
|
|
165306
165668
|
execute: dispatchByPlatform({
|
|
165307
165669
|
toolId: "ui-tree",
|
|
165308
|
-
capability:
|
|
165670
|
+
capability: capability27,
|
|
165309
165671
|
ios: {
|
|
165310
165672
|
requires: iosRequires,
|
|
165311
165673
|
handler: async (_services, _params, device) => {
|
|
@@ -165332,7 +165694,7 @@ Fails if the iOS ax-service predates the tree command; update argent.`,
|
|
|
165332
165694
|
// ../tool-server/src/tools/foreground-app/index.ts
|
|
165333
165695
|
init_zod();
|
|
165334
165696
|
init_capability();
|
|
165335
|
-
var
|
|
165697
|
+
var capability28 = {
|
|
165336
165698
|
apple: { simulator: true },
|
|
165337
165699
|
appleRemote: { simulator: true },
|
|
165338
165700
|
android: { emulator: true, device: true, unknown: true }
|
|
@@ -165372,11 +165734,11 @@ A field is unset when it is unknown.`,
|
|
|
165372
165734
|
completedMsg: () => "Read foreground app",
|
|
165373
165735
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to read foreground app: ${failureSignal2.error_code}`
|
|
165374
165736
|
},
|
|
165375
|
-
capability:
|
|
165737
|
+
capability: capability28,
|
|
165376
165738
|
services: () => ({}),
|
|
165377
165739
|
execute: dispatchByPlatform({
|
|
165378
165740
|
toolId: "foreground-app",
|
|
165379
|
-
capability:
|
|
165741
|
+
capability: capability28,
|
|
165380
165742
|
ios: {
|
|
165381
165743
|
requires: iosRequires,
|
|
165382
165744
|
handler: async (_services, _params, device) => {
|
|
@@ -165861,7 +166223,7 @@ async function fillChromium(registry2, device, text) {
|
|
|
165861
166223
|
}
|
|
165862
166224
|
|
|
165863
166225
|
// ../tool-server/src/tools/fill/index.ts
|
|
165864
|
-
var
|
|
166226
|
+
var capability29 = {
|
|
165865
166227
|
apple: { simulator: true, device: true },
|
|
165866
166228
|
appleRemote: { simulator: true },
|
|
165867
166229
|
android: { emulator: true, device: true, unknown: true },
|
|
@@ -165876,7 +166238,7 @@ var zodSchema43 = external_exports.object({
|
|
|
165876
166238
|
function createFillTool(registry2) {
|
|
165877
166239
|
const dispatch = dispatchByPlatform({
|
|
165878
166240
|
toolId: "fill",
|
|
165879
|
-
capability:
|
|
166241
|
+
capability: capability29,
|
|
165880
166242
|
ios: {
|
|
165881
166243
|
requires: iosRequires,
|
|
165882
166244
|
handler: async (_services, params, device) => {
|
|
@@ -165929,7 +166291,7 @@ Fails with FILL_NO_FOCUSED_FIELD when nothing editable has focus, FILL_NOT_VERIF
|
|
|
165929
166291
|
completedMsg: () => "Filled the focused field",
|
|
165930
166292
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to fill the field: ${failureSignal2.error_code}`
|
|
165931
166293
|
},
|
|
165932
|
-
capability:
|
|
166294
|
+
capability: capability29,
|
|
165933
166295
|
services: () => ({}),
|
|
165934
166296
|
execute: async (services, params, options) => {
|
|
165935
166297
|
const { text, secrets } = resolveSecretPlaceholders(params.text, {
|
|
@@ -165958,7 +166320,7 @@ var TV_NO_CURSOR_STABLE_MS = 1200;
|
|
|
165958
166320
|
var DARK_TAIL_POLLS = 2;
|
|
165959
166321
|
var DARK_TAIL_MAX_MS = 2e3;
|
|
165960
166322
|
var TV_NO_CURSOR_NOTE = "no element holds focus on this screen, so a remote press may be lost";
|
|
165961
|
-
var
|
|
166323
|
+
var capability30 = {
|
|
165962
166324
|
apple: { simulator: true, device: true },
|
|
165963
166325
|
appleRemote: { simulator: true },
|
|
165964
166326
|
android: { emulator: true, device: true, unknown: true },
|
|
@@ -166039,7 +166401,7 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
|
|
|
166039
166401
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed while waiting for screen to settle: ${failureSignal2.error_code}`
|
|
166040
166402
|
},
|
|
166041
166403
|
longRunning: true,
|
|
166042
|
-
capability:
|
|
166404
|
+
capability: capability30,
|
|
166043
166405
|
services: (params) => {
|
|
166044
166406
|
const device = resolveDevice(params.udid);
|
|
166045
166407
|
if (device.platform === "chromium") {
|
|
@@ -166049,7 +166411,7 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
|
|
|
166049
166411
|
},
|
|
166050
166412
|
async execute(services, params, ctx) {
|
|
166051
166413
|
const device = resolveDevice(params.udid);
|
|
166052
|
-
assertSupported(AWAIT_SCREEN_IDLE_TOOL_ID,
|
|
166414
|
+
assertSupported(AWAIT_SCREEN_IDLE_TOOL_ID, capability30, device);
|
|
166053
166415
|
if (device.platform === "ios") await ensureDeps(iosRequires);
|
|
166054
166416
|
else if (device.platform === "ios-remote") await ensureDeps(["sim-remote"]);
|
|
166055
166417
|
else if (device.platform === "android") await ensureDeps(androidRequires);
|
|
@@ -174747,7 +175109,7 @@ function metroDeviceIdParam(description) {
|
|
|
174747
175109
|
}
|
|
174748
175110
|
|
|
174749
175111
|
// ../tool-server/src/tools/profiler/native-profiler/native-profiler-start.ts
|
|
174750
|
-
var
|
|
175112
|
+
var capability31 = {
|
|
174751
175113
|
apple: { simulator: true },
|
|
174752
175114
|
android: { emulator: true, device: true, unknown: true },
|
|
174753
175115
|
macos: { app: true, catalyst: true }
|
|
@@ -174780,7 +175142,7 @@ With malloc stack logging off, Argent blocks the bundled template if it detects
|
|
|
174780
175142
|
completedMsg: () => "Started native profiler",
|
|
174781
175143
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to start native profiler: ${failureSignal2.error_code}`
|
|
174782
175144
|
},
|
|
174783
|
-
capability:
|
|
175145
|
+
capability: capability31,
|
|
174784
175146
|
services: (params) => {
|
|
174785
175147
|
const device = resolveDevice(params.device_id);
|
|
174786
175148
|
return {
|
|
@@ -174791,7 +175153,7 @@ With malloc stack logging off, Argent blocks the bundled template if it detects
|
|
|
174791
175153
|
async execute(services, params) {
|
|
174792
175154
|
const api = services.session;
|
|
174793
175155
|
const device = resolveDevice(params.device_id);
|
|
174794
|
-
assertSupported("native-profiler-start",
|
|
175156
|
+
assertSupported("native-profiler-start", capability31, device);
|
|
174795
175157
|
let started;
|
|
174796
175158
|
let warning;
|
|
174797
175159
|
if (api.platform === "ios") {
|
|
@@ -174818,7 +175180,7 @@ With malloc stack logging off, Argent blocks the bundled template if it detects
|
|
|
174818
175180
|
init_zod();
|
|
174819
175181
|
init_device_info();
|
|
174820
175182
|
init_capability();
|
|
174821
|
-
var
|
|
175183
|
+
var capability32 = {
|
|
174822
175184
|
apple: { simulator: true },
|
|
174823
175185
|
android: { emulator: true, device: true, unknown: true },
|
|
174824
175186
|
macos: { app: true, catalyst: true }
|
|
@@ -174855,7 +175217,7 @@ On iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, export CPU, hangs, and l
|
|
|
174855
175217
|
completedMsg: ({ result }) => `Saved native profile ${result.traceFile.filename}`,
|
|
174856
175218
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to stop native profiler: ${failureSignal2.error_code}`
|
|
174857
175219
|
},
|
|
174858
|
-
capability:
|
|
175220
|
+
capability: capability32,
|
|
174859
175221
|
// Packaging plus the export passes routinely exceed the 30s MCP fetch timeout.
|
|
174860
175222
|
longRunning: true,
|
|
174861
175223
|
services: (params) => ({
|
|
@@ -174864,7 +175226,7 @@ On iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, export CPU, hangs, and l
|
|
|
174864
175226
|
async execute(services, params, ctx) {
|
|
174865
175227
|
const api = services.session;
|
|
174866
175228
|
const device = resolveDevice(params.device_id);
|
|
174867
|
-
assertSupported("native-profiler-stop",
|
|
175229
|
+
assertSupported("native-profiler-stop", capability32, device);
|
|
174868
175230
|
if (recordsWithXctrace(api.platform)) {
|
|
174869
175231
|
await ensureDeps(["xcrun"]);
|
|
174870
175232
|
const ios = await stopNativeProfilerIos(api);
|
|
@@ -174893,7 +175255,7 @@ On iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, export CPU, hangs, and l
|
|
|
174893
175255
|
init_zod();
|
|
174894
175256
|
init_device_info();
|
|
174895
175257
|
init_capability();
|
|
174896
|
-
var
|
|
175258
|
+
var capability33 = {
|
|
174897
175259
|
apple: { simulator: true },
|
|
174898
175260
|
android: { emulator: true, device: true, unknown: true },
|
|
174899
175261
|
macos: { app: true, catalyst: true }
|
|
@@ -174914,7 +175276,7 @@ Use profiler-stack-query for details behind a finding.`,
|
|
|
174914
175276
|
completedMsg: () => "Analyzed native profile",
|
|
174915
175277
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to analyze native profile: ${failureSignal2.error_code}`
|
|
174916
175278
|
},
|
|
174917
|
-
capability:
|
|
175279
|
+
capability: capability33,
|
|
174918
175280
|
// Parsing a trace from a recording up to RECORDING_CAP_MS long routinely exceeds
|
|
174919
175281
|
// the 30s MCP fetch timeout, and an aborted call is replayed, not cancelled.
|
|
174920
175282
|
longRunning: true,
|
|
@@ -174924,7 +175286,7 @@ Use profiler-stack-query for details behind a finding.`,
|
|
|
174924
175286
|
async execute(services, params, ctx) {
|
|
174925
175287
|
const api = services.session;
|
|
174926
175288
|
const device = resolveDevice(params.device_id);
|
|
174927
|
-
assertSupported("native-profiler-analyze",
|
|
175289
|
+
assertSupported("native-profiler-analyze", capability33, device);
|
|
174928
175290
|
let result;
|
|
174929
175291
|
if (recordsWithXctrace(api.platform)) {
|
|
174930
175292
|
await ensureDeps(["xcrun"]);
|
|
@@ -178194,7 +178556,7 @@ var DEFAULT_TIME_LIMIT_SECONDS = 180;
|
|
|
178194
178556
|
var MAX_TIME_LIMIT_SECONDS = 600;
|
|
178195
178557
|
var POINTER_TRAIL_LENGTH = 8;
|
|
178196
178558
|
var POINTER_REQUEST_TIMEOUT_MS = 2e3;
|
|
178197
|
-
var
|
|
178559
|
+
var capability34 = {
|
|
178198
178560
|
// A cabled iPhone records through a host-side CoreMediaIO helper, not
|
|
178199
178561
|
// simulator-server (see ios-device-stream/).
|
|
178200
178562
|
apple: { simulator: true, device: true },
|
|
@@ -178231,7 +178593,7 @@ Fails if a recording is already running on the device, the device is not booted,
|
|
|
178231
178593
|
completedMsg: () => "Started screen recording",
|
|
178232
178594
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to start screen recording: ${failureSignal2.error_code}`
|
|
178233
178595
|
},
|
|
178234
|
-
capability:
|
|
178596
|
+
capability: capability34,
|
|
178235
178597
|
// A remote start first ends a leftover runner-side recording, which can
|
|
178236
178598
|
// take minutes, past the 30s MCP fetch timeout.
|
|
178237
178599
|
longRunning: true,
|
|
@@ -178244,7 +178606,7 @@ Fails if a recording is already running on the device, the device is not booted,
|
|
|
178244
178606
|
async execute(services, params) {
|
|
178245
178607
|
const api = services.session;
|
|
178246
178608
|
const device = resolveDevice(params.udid);
|
|
178247
|
-
assertSupported("screen-recording-start",
|
|
178609
|
+
assertSupported("screen-recording-start", capability34, device);
|
|
178248
178610
|
const isTvOs = device.platform === "ios-remote" ? await isRemoteTvOsSimulator(params.udid) : device.platform === "ios" && device.kind !== "device" && await isTvOsSimulator(params.udid);
|
|
178249
178611
|
if (isTvOs) {
|
|
178250
178612
|
throw new FailureError(
|
|
@@ -178353,7 +178715,7 @@ init_zod();
|
|
|
178353
178715
|
init_device_info();
|
|
178354
178716
|
init_capability();
|
|
178355
178717
|
var RECORDINGS_DIR = ".argent/recordings";
|
|
178356
|
-
var
|
|
178718
|
+
var capability35 = {
|
|
178357
178719
|
apple: { simulator: true, device: true },
|
|
178358
178720
|
appleRemote: { simulator: true },
|
|
178359
178721
|
android: { emulator: true, device: true, unknown: true }
|
|
@@ -178378,7 +178740,7 @@ Fails if no recording (running or finished-but-unretrieved) exists for the given
|
|
|
178378
178740
|
completedMsg: ({ result }) => `Saved screen recording ${result.video.filename}`,
|
|
178379
178741
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to stop screen recording: ${failureSignal2.error_code}`
|
|
178380
178742
|
},
|
|
178381
|
-
capability:
|
|
178743
|
+
capability: capability35,
|
|
178382
178744
|
// A remote stop waits for the runner to finish the mp4, downloads it and
|
|
178383
178745
|
// re-encodes it locally, which routinely exceeds the 30s MCP fetch timeout.
|
|
178384
178746
|
longRunning: true,
|
|
@@ -178388,7 +178750,7 @@ Fails if no recording (running or finished-but-unretrieved) exists for the given
|
|
|
178388
178750
|
async execute(services, params, ctx) {
|
|
178389
178751
|
const api = services.session;
|
|
178390
178752
|
const device = resolveDevice(params.udid);
|
|
178391
|
-
assertSupported("screen-recording-stop",
|
|
178753
|
+
assertSupported("screen-recording-stop", capability35, device);
|
|
178392
178754
|
const stopped = device.platform === "ios-remote" ? await stopRemoteCapture(api) : await stopCapture(api);
|
|
178393
178755
|
const artifacts = requireArtifacts(ctx);
|
|
178394
178756
|
const video = await artifacts.register({
|
|
@@ -193494,7 +193856,7 @@ init_zod();
|
|
|
193494
193856
|
init_src2();
|
|
193495
193857
|
init_device_info();
|
|
193496
193858
|
init_capability();
|
|
193497
|
-
var
|
|
193859
|
+
var capability36 = {
|
|
193498
193860
|
apple: { simulator: true, device: true },
|
|
193499
193861
|
android: { emulator: true, device: true, unknown: true },
|
|
193500
193862
|
harmony: { device: true },
|
|
@@ -193546,7 +193908,7 @@ Fails if the input sources are invalid, PNG files cannot be read, outputDir cann
|
|
|
193546
193908
|
completedMsg: ({ result }) => summaryReportsDimensionMismatch(result.summary) ? "Skipped comparison - screenshot dimensions differ" : "Compared screenshots",
|
|
193547
193909
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to compare screenshots: ${failureSignal2.error_code}`
|
|
193548
193910
|
},
|
|
193549
|
-
capability:
|
|
193911
|
+
capability: capability36,
|
|
193550
193912
|
fileInputs: fileInputs8,
|
|
193551
193913
|
services: (params) => {
|
|
193552
193914
|
if (params.captureBaseline || params.captureCurrent) {
|
|
@@ -194048,7 +194410,7 @@ var tabAction = {
|
|
|
194048
194410
|
failure: "close"
|
|
194049
194411
|
}
|
|
194050
194412
|
};
|
|
194051
|
-
var
|
|
194413
|
+
var capability37 = {
|
|
194052
194414
|
chromium: { app: true }
|
|
194053
194415
|
};
|
|
194054
194416
|
var zodSchema81 = external_exports.object({
|
|
@@ -194075,7 +194437,7 @@ Returns { tabs: [{ tabId, targetId, title, url, active, label? }] } after the ac
|
|
|
194075
194437
|
completedMsg: ({ params, result }) => tabAction[params.action].completed(params, result),
|
|
194076
194438
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to ${tabAction[params.action].failure} browser tabs: ${failureSignal2.error_code}`
|
|
194077
194439
|
},
|
|
194078
|
-
capability:
|
|
194440
|
+
capability: capability37,
|
|
194079
194441
|
services: (params) => {
|
|
194080
194442
|
const device = resolveDevice(params.udid);
|
|
194081
194443
|
if (device.platform === "chromium") {
|
|
@@ -194182,7 +194544,7 @@ var cookieAction = {
|
|
|
194182
194544
|
delete: { started: "Deleting", completed: "Deleted", failure: "delete" },
|
|
194183
194545
|
clear: { started: "Clearing", completed: "Cleared", failure: "clear" }
|
|
194184
194546
|
};
|
|
194185
|
-
var
|
|
194547
|
+
var capability38 = {
|
|
194186
194548
|
chromium: { app: true }
|
|
194187
194549
|
};
|
|
194188
194550
|
var zodSchema82 = external_exports.object({
|
|
@@ -194215,7 +194577,7 @@ Returns { cookies, count } for get, or a small status object ({ set } / { delete
|
|
|
194215
194577
|
completedMsg: ({ params }) => `${cookieAction[params.action].completed} browser cookies`,
|
|
194216
194578
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to ${cookieAction[params.action].failure} browser cookies: ${failureSignal2.error_code}`
|
|
194217
194579
|
},
|
|
194218
|
-
capability:
|
|
194580
|
+
capability: capability38,
|
|
194219
194581
|
services: (params) => {
|
|
194220
194582
|
const device = resolveDevice(params.udid);
|
|
194221
194583
|
if (device.platform === "chromium") {
|
|
@@ -194286,7 +194648,7 @@ var storageAction = {
|
|
|
194286
194648
|
remove: { started: "Removing from", completed: "Removed from", failure: "remove from" },
|
|
194287
194649
|
clear: { started: "Clearing", completed: "Cleared", failure: "clear" }
|
|
194288
194650
|
};
|
|
194289
|
-
var
|
|
194651
|
+
var capability39 = {
|
|
194290
194652
|
chromium: { app: true }
|
|
194291
194653
|
};
|
|
194292
194654
|
var zodSchema83 = external_exports.object({
|
|
@@ -194313,7 +194675,7 @@ Returns { value } for one key, { entries, count } for all keys, and { set } / {
|
|
|
194313
194675
|
completedMsg: ({ params }) => `${storageAction[params.action].completed} ${params.store} storage`,
|
|
194314
194676
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to ${storageAction[params.action].failure} ${params.store} storage: ${failureSignal2.error_code}`
|
|
194315
194677
|
},
|
|
194316
|
-
capability:
|
|
194678
|
+
capability: capability39,
|
|
194317
194679
|
services: (params) => {
|
|
194318
194680
|
const device = resolveDevice(params.udid);
|
|
194319
194681
|
if (device.platform === "chromium") {
|
|
@@ -194373,7 +194735,7 @@ var sleep18 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
|
194373
194735
|
var DEFAULT_PANEL_TIMEOUT_MS = 5e3;
|
|
194374
194736
|
var MAX_PANEL_TIMEOUT_MS = 3e4;
|
|
194375
194737
|
var PANEL_POLL_MS2 = 100;
|
|
194376
|
-
var
|
|
194738
|
+
var capability40 = {
|
|
194377
194739
|
macos: { app: true, catalyst: true }
|
|
194378
194740
|
};
|
|
194379
194741
|
var invalid = (message, stage) => new InvalidToolInputError(message, { failure_stage: stage });
|
|
@@ -194565,14 +194927,14 @@ Fails if no panel appears within timeoutMs, if more than one panel is open and p
|
|
|
194565
194927
|
},
|
|
194566
194928
|
// timeoutMs can reach the MCP fetch timeout, whose abort replays the call.
|
|
194567
194929
|
longRunning: true,
|
|
194568
|
-
capability:
|
|
194930
|
+
capability: capability40,
|
|
194569
194931
|
services: (params) => {
|
|
194570
194932
|
const device = resolveDevice(params.udid);
|
|
194571
194933
|
return device.platform === "macos" ? macosAppServices(device) : {};
|
|
194572
194934
|
},
|
|
194573
194935
|
async execute(services, params, ctx) {
|
|
194574
194936
|
const device = resolveDevice(params.udid);
|
|
194575
|
-
assertSupported("file-panel",
|
|
194937
|
+
assertSupported("file-panel", capability40, device);
|
|
194576
194938
|
const app = requireMacosApp(services, "file-panel", device);
|
|
194577
194939
|
switch (params.action) {
|
|
194578
194940
|
case "list":
|
|
@@ -194601,7 +194963,7 @@ init_capability();
|
|
|
194601
194963
|
init_device_info();
|
|
194602
194964
|
var sleep19 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
194603
194965
|
var MAX_PATH_TITLES = 9;
|
|
194604
|
-
var
|
|
194966
|
+
var capability41 = {
|
|
194605
194967
|
macos: { app: true, catalyst: true }
|
|
194606
194968
|
};
|
|
194607
194969
|
var invalid2 = (message) => new InvalidToolInputError(message, { failure_stage: "menu_bar_params" });
|
|
@@ -194681,14 +195043,14 @@ Fails if no item matches (the error lists the titles at that level), if the item
|
|
|
194681
195043
|
completedMsg: ({ params }) => params.action === "list" ? "Read the menu bar" : "Chose the menu item",
|
|
194682
195044
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to ${params.action === "list" ? "read" : "choose from"} the menu bar: ${failureSignal2.error_code}`
|
|
194683
195045
|
},
|
|
194684
|
-
capability:
|
|
195046
|
+
capability: capability41,
|
|
194685
195047
|
services: (params) => {
|
|
194686
195048
|
const device = resolveDevice(params.udid);
|
|
194687
195049
|
return device.platform === "macos" ? macosAppServices(device) : {};
|
|
194688
195050
|
},
|
|
194689
195051
|
async execute(services, params) {
|
|
194690
195052
|
const device = resolveDevice(params.udid);
|
|
194691
|
-
assertSupported("menu-bar",
|
|
195053
|
+
assertSupported("menu-bar", capability41, device);
|
|
194692
195054
|
const app = requireMacosApp(services, "menu-bar", device);
|
|
194693
195055
|
if (params.action === "list") {
|
|
194694
195056
|
if (params.path !== void 0 || params.identifier !== void 0) {
|
|
@@ -194791,6 +195153,7 @@ function createRegistry() {
|
|
|
194791
195153
|
registry2.registerTool(menuBarTool);
|
|
194792
195154
|
registry2.registerTool(createRotateTool(registry2));
|
|
194793
195155
|
registry2.registerTool(shakeTool);
|
|
195156
|
+
registry2.registerTool(networkConditionsTool);
|
|
194794
195157
|
registry2.registerTool(foldTool);
|
|
194795
195158
|
registry2.registerTool(createTvRemoteTool(registry2));
|
|
194796
195159
|
registry2.registerTool(createRunSequenceTool(registry2));
|