@swmansion/argent 0.30.2-next.6 → 0.30.2-next.8

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 CHANGED
@@ -35577,7 +35577,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
35577
35577
  var SESSION_ID2 = randomUUID5();
35578
35578
  function readCliVersion() {
35579
35579
  if (true) {
35580
- return "0.30.2-next.5";
35580
+ return "0.30.2-next.8";
35581
35581
  }
35582
35582
  return "0.0.0";
35583
35583
  }
@@ -16899,7 +16899,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16899
16899
  var SESSION_ID = randomUUID4();
16900
16900
  function readCliVersion() {
16901
16901
  if (true) {
16902
- return "0.30.2-next.5";
16902
+ return "0.30.2-next.8";
16903
16903
  }
16904
16904
  return "0.0.0";
16905
16905
  }
@@ -28764,6 +28764,64 @@ async function startMcpServer(options) {
28764
28764
  reconnect,
28765
28765
  extraHeaders: aiClientHeaders
28766
28766
  });
28767
+ async function awaitScreenSettled(udid, toolName) {
28768
+ const maxWaitMs = getAutoScreenshotDelayMs(toolName);
28769
+ if (maxWaitMs === 0) return true;
28770
+ try {
28771
+ const idle = await callTool("await-screen-idle", { udid, timeoutMs: maxWaitMs });
28772
+ await spyLog({
28773
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
28774
+ event: "auto_screenshot_readiness",
28775
+ name: toolName,
28776
+ maxWaitMs,
28777
+ ...idle.result
28778
+ });
28779
+ return idle.result?.settled === true;
28780
+ } catch {
28781
+ await new Promise((r) => setTimeout(r, maxWaitMs));
28782
+ return false;
28783
+ }
28784
+ }
28785
+ async function captureScreenshotBlocks(udid) {
28786
+ try {
28787
+ const { result } = await callTool("screenshot", { udid });
28788
+ const blocks = await toMcpContent(result, "image", {
28789
+ toolsUrl: TOOLS_URL,
28790
+ authToken: AUTH_TOKEN,
28791
+ deviceId: udid
28792
+ });
28793
+ if (!blocks.some((b) => b.type === "image")) return [];
28794
+ return [{ type: "text", text: "--- Screen after action ---" }, ...blocks];
28795
+ } catch {
28796
+ return [];
28797
+ }
28798
+ }
28799
+ async function captureTreeBlocks(udid, toolName) {
28800
+ const t1 = Date.now();
28801
+ try {
28802
+ const d = await callTool("describe", { udid });
28803
+ const desc = d.result?.description;
28804
+ await spyLog({
28805
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
28806
+ event: "auto_describe",
28807
+ name: toolName,
28808
+ durationMs: Date.now() - t1,
28809
+ chars: typeof desc === "string" ? desc.length : 0
28810
+ });
28811
+ if (typeof desc !== "string" || desc.length === 0) return [];
28812
+ return [{ type: "text", text: `${AUTO_DESCRIBE_HEADER}
28813
+ ${desc}` }];
28814
+ } catch (e) {
28815
+ await spyLog({
28816
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
28817
+ event: "auto_describe",
28818
+ name: toolName,
28819
+ durationMs: Date.now() - t1,
28820
+ error: String(e instanceof Error ? e.message : e)
28821
+ });
28822
+ return [];
28823
+ }
28824
+ }
28767
28825
  const server = new Server(
28768
28826
  { name: "argent", version: getInstalledVersion() },
28769
28827
  {
@@ -28831,72 +28889,11 @@ async function startMcpServer(options) {
28831
28889
  }
28832
28890
  ];
28833
28891
  } else if (udid && (wantScreenshot || wantTree)) {
28834
- const maxWaitMs = getAutoScreenshotDelayMs(params.name);
28835
- if (maxWaitMs > 0) {
28836
- try {
28837
- const idle = await callTool("await-screen-idle", { udid, timeoutMs: maxWaitMs });
28838
- await spyLog({
28839
- ts: (/* @__PURE__ */ new Date()).toISOString(),
28840
- event: "auto_screenshot_readiness",
28841
- name: params.name,
28842
- maxWaitMs,
28843
- ...idle.result
28844
- });
28845
- } catch {
28846
- await new Promise((r) => setTimeout(r, maxWaitMs));
28847
- }
28848
- }
28849
- if (wantScreenshot) {
28850
- try {
28851
- const screenshotResult = await callTool("screenshot", { udid });
28852
- const screenshotContent = await toMcpContent(screenshotResult.result, "image", {
28853
- toolsUrl: TOOLS_URL,
28854
- authToken: AUTH_TOKEN,
28855
- deviceId: udid
28856
- });
28857
- const hasImage = screenshotContent.some((b) => b.type === "image");
28858
- if (hasImage) {
28859
- content = [
28860
- ...content,
28861
- {
28862
- type: "text",
28863
- text: "--- Screen after action ---"
28864
- },
28865
- ...screenshotContent
28866
- ];
28867
- }
28868
- } catch {
28869
- }
28870
- }
28871
- if (wantTree) {
28872
- const t1 = Date.now();
28873
- try {
28874
- const d = await callTool("describe", { udid });
28875
- const desc = d.result?.description;
28876
- if (typeof desc === "string" && desc.length > 0) {
28877
- content = [
28878
- ...content,
28879
- { type: "text", text: `${AUTO_DESCRIBE_HEADER}
28880
- ${desc}` }
28881
- ];
28882
- }
28883
- await spyLog({
28884
- ts: (/* @__PURE__ */ new Date()).toISOString(),
28885
- event: "auto_describe",
28886
- name: params.name,
28887
- durationMs: Date.now() - t1,
28888
- chars: typeof desc === "string" ? desc.length : 0
28889
- });
28890
- } catch (e) {
28891
- await spyLog({
28892
- ts: (/* @__PURE__ */ new Date()).toISOString(),
28893
- event: "auto_describe",
28894
- name: params.name,
28895
- durationMs: Date.now() - t1,
28896
- error: String(e instanceof Error ? e.message : e)
28897
- });
28898
- }
28899
- }
28892
+ const screenSettled = await awaitScreenSettled(udid, params.name);
28893
+ const screenshot = wantScreenshot ? captureScreenshotBlocks(udid) : Promise.resolve([]);
28894
+ if (!screenSettled) await screenshot;
28895
+ const tree = wantTree ? captureTreeBlocks(udid, params.name) : Promise.resolve([]);
28896
+ content = [...content, ...await screenshot, ...await tree];
28900
28897
  }
28901
28898
  if (note) {
28902
28899
  content = [{ type: "text", text: note }, ...content];
@@ -100944,7 +100944,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
100944
100944
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
100945
100945
  function readCliVersion() {
100946
100946
  if (true) {
100947
- return "0.30.2-next.5";
100947
+ return "0.30.2-next.8";
100948
100948
  }
100949
100949
  return "0.0.0";
100950
100950
  }
@@ -139501,7 +139501,7 @@ Returns { launched, bundleId, note? }. Fails if the app is not installed on the
139501
139501
  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\`.
139502
139502
  On Vega (Fire TV), pass the interactive component app id from manifest.toml (e.g. com.example.app.main) as bundleId.
139503
139503
 
139504
- Common iOS bundle ids: com.apple.MobileSMS, com.apple.mobilesafari, com.apple.Preferences, com.apple.Maps, com.apple.camera, com.apple.Photos, com.apple.mobilemail, com.apple.mobilenotes, com.apple.MobileAddressBook
139504
+ Common iOS bundle ids: com.apple.MobileSMS, com.apple.mobilesafari, com.apple.Preferences, com.apple.Maps, com.apple.mobileslideshow (Photos), com.apple.MobileAddressBook
139505
139505
  Common Android packages: com.android.settings, com.android.chrome, com.google.android.apps.maps, com.google.android.gm, com.android.vending, com.google.android.dialer, com.google.android.apps.messaging`,
139506
139506
  alwaysLoad: true,
139507
139507
  searchHint: "open start app bundle id package simulator emulator chromium vega launch tvos apple tv fire tv",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.30.2-next.6",
3
+ "version": "0.30.2-next.8",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@ Use `list-devices` to get a target id. Results are tagged with `platform` (`ios`
36
36
  { "udid": "<UDID>", "bundleId": "com.apple.MobileSMS" }
37
37
  ```
38
38
 
39
- Common IDs: `com.apple.MobileSMS` (Messages), `com.apple.mobilesafari` (Safari), `com.apple.Preferences` (Settings), `com.apple.Maps`, `com.apple.Photos`, `com.apple.mobilemail`, `com.apple.mobilenotes`, `com.apple.MobileAddressBook` (Contacts)
39
+ Common IDs: `com.apple.MobileSMS` (Messages), `com.apple.mobilesafari` (Safari), `com.apple.Preferences` (Settings), `com.apple.Maps`, `com.apple.mobileslideshow` (Photos), `com.apple.MobileAddressBook` (Contacts)
40
40
 
41
41
  ### open-url: by URL scheme
42
42
 
@@ -169,6 +169,8 @@ Values: `home`, `back`, `power`, `volumeUp`, `volumeDown`, `appSwitch`, `actionB
169
169
 
170
170
  One call does one action. `text` and `key` are mutually exclusive, and a call that carries both is rejected with nothing typed. To type and then submit, send two `keyboard` steps in one `run-sequence` (§ 8): `{ "text": "search query" }`, then `{ "key": "enter" }`. Two separate calls do the same work, but cost an extra round-trip.
171
171
 
172
+ **React Native: the first tap after typing may only close the keyboard.** Inside a scroll view with the default `keyboardShouldPersistTaps="never"`, React Native uses a tap outside the focused field to dismiss the keyboard and does not pass it on (with `"handled"` or `"always"` the tap reaches the button), so a button tapped right after typing may need a second tap; check the returned tree. When the field submits on return, `{ "key": "enter" }` avoids the extra tap.
173
+
172
174
  Special keys: `enter`, `escape`, `backspace`, `tab`, `space`, `arrow-up`, `arrow-down`, `arrow-left`, `arrow-right`, `f1`–`f12`. Optional: `"delayMs": 100` between keystrokes (default 50ms); applies to the iOS simulator and Chromium; it is ignored on Android phones/tablets (typed via `adb input text`, no per-key cadence), on Vega, and on TV targets.
173
175
 
174
176
  **Typing secrets.** To enter a credential without its plaintext ever entering your context, transcript, or logs, use a secret placeholder in `text` (works in `keyboard`, `paste`, `run-sequence` keyboard steps, and e2e `type` steps):