@swmansion/argent 0.26.1-next.11 → 0.26.1-next.12

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.
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -21881,7 +21881,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
21881
21881
  var SESSION_ID2 = randomUUID5();
21882
21882
  function readCliVersion() {
21883
21883
  if (true) {
21884
- return "0.26.1-next.11";
21884
+ return "0.26.1-next.12";
21885
21885
  }
21886
21886
  return "0.0.0";
21887
21887
  }
@@ -16730,7 +16730,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16730
16730
  var SESSION_ID = randomUUID4();
16731
16731
  function readCliVersion() {
16732
16732
  if (true) {
16733
- return "0.26.1-next.11";
16733
+ return "0.26.1-next.12";
16734
16734
  }
16735
16735
  return "0.0.0";
16736
16736
  }
@@ -94814,7 +94814,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
94814
94814
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
94815
94815
  function readCliVersion() {
94816
94816
  if (true) {
94817
- return "0.26.1-next.11";
94817
+ return "0.26.1-next.12";
94818
94818
  }
94819
94819
  return "0.0.0";
94820
94820
  }
@@ -108061,14 +108061,16 @@ async function pointerPost(api, body, signal) {
108061
108061
  return false;
108062
108062
  }
108063
108063
  }
108064
- async function setSimulatorClipboardText(api, text, signal) {
108064
+ var SENSITIVE_TEXT_REFUSED = "refused to set sensitive text";
108065
+ async function setSimulatorClipboardText(api, text, options = {}) {
108066
+ const { sensitive = false, signal } = options;
108065
108067
  if (api.external) assertAllowedSimServerEndpoint("/api/clipboard/text");
108066
108068
  let res;
108067
108069
  try {
108068
108070
  res = await fetch(`${api.apiUrl}/api/clipboard/text`, {
108069
108071
  method: "POST",
108070
108072
  headers: { "Content-Type": "application/json" },
108071
- body: JSON.stringify({ text }),
108073
+ body: JSON.stringify(sensitive ? { text, sensitive } : { text }),
108072
108074
  signal
108073
108075
  });
108074
108076
  } catch (err) {
@@ -108087,6 +108089,7 @@ async function setSimulatorClipboardText(api, text, signal) {
108087
108089
  );
108088
108090
  }
108089
108091
  const body = await res.json().catch(() => null);
108092
+ if (sensitive && body?.error?.includes(SENSITIVE_TEXT_REFUSED)) return "refused";
108090
108093
  if (!res.ok || body?.status !== "ok") {
108091
108094
  throw new FailureError(
108092
108095
  `Paste failed: could not set the device clipboard (${body?.error ?? `HTTP ${res.status}`}).`,
@@ -108098,6 +108101,7 @@ async function setSimulatorClipboardText(api, text, signal) {
108098
108101
  }
108099
108102
  );
108100
108103
  }
108104
+ return "set";
108101
108105
  }
108102
108106
  async function simulatorPost(toolLabel, api, endpoint, reqBody, signal, fallbackHint) {
108103
108107
  if (api.external) assertAllowedSimServerEndpoint(endpoint);
@@ -125814,10 +125818,12 @@ var pasteZodSchema = external_exports.object({
125814
125818
  });
125815
125819
 
125816
125820
  // ../tool-server/src/tools/paste/platforms/ios.ts
125821
+ init_src2();
125817
125822
  var LEFT_GUI_KEYCODE = 227;
125818
125823
  var V_KEYCODE = charToKeyPress("v").keyCode;
125819
125824
  var CHORD_STEP_MS = 50;
125820
125825
  var sleep10 = (ms) => new Promise((r) => setTimeout(r, ms));
125826
+ var typesAsText = (char) => !"\n\r ".includes(char) && !!charToKeyPress(char);
125821
125827
  function rejectTv(device) {
125822
125828
  throw new UnsupportedOperationError(
125823
125829
  "paste",
@@ -125825,8 +125831,22 @@ function rejectTv(device) {
125825
125831
  "tvOS has no pasteboard to paste from \u2014 type into the focused field with keyboard instead"
125826
125832
  );
125827
125833
  }
125828
- async function pasteSimulator(api, text) {
125829
- await setSimulatorClipboardText(api, text);
125834
+ async function pasteSimulator(registry2, device, api, params) {
125835
+ const sensitive = params.hasSecrets === true;
125836
+ if (await setSimulatorClipboardText(api, params.text, { sensitive }) === "refused") {
125837
+ if (![...params.text].every(typesAsText)) {
125838
+ throw new InvalidToolInputError(
125839
+ "Paste failed: Device Hub has opened this simulator, so a secret is typed instead of pasted, and this secret holds a newline, a tab or a character the keyboard cannot type. Nothing was typed.",
125840
+ {
125841
+ error_code: FAILURE_CODES.KEYBOARD_CHARACTER_UNSUPPORTED,
125842
+ failure_stage: "paste_secret_typed_simulator",
125843
+ error_kind: "unsupported"
125844
+ }
125845
+ );
125846
+ }
125847
+ await typeSimulatorServer(registry2, device, { udid: params.udid, text: params.text });
125848
+ return { pasted: true, via: "keyboard" };
125849
+ }
125830
125850
  await api.pressKey("Down", LEFT_GUI_KEYCODE);
125831
125851
  await sleep10(CHORD_STEP_MS);
125832
125852
  await api.pressKey("Down", V_KEYCODE);
@@ -125846,7 +125866,7 @@ function makeIosImpl4(registry2) {
125846
125866
  if (await isTvOsSimulator(device.id)) rejectTv(device);
125847
125867
  const ref = simulatorServerRef(device);
125848
125868
  const api = await registry2.resolveService(ref.urn, ref.options);
125849
- return pasteSimulator(api, params.text);
125869
+ return pasteSimulator(registry2, device, api, params);
125850
125870
  }
125851
125871
  };
125852
125872
  }
@@ -125938,9 +125958,9 @@ function createPasteTool(registry2) {
125938
125958
  completedMsg: () => "Pasted text",
125939
125959
  failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to paste text: ${failureSignal2.error_code}`
125940
125960
  },
125941
- description: `Paste text into the focused field: puts \`text\` on the DEVICE clipboard (the host clipboard is untouched), then triggers the platform's paste shortcut (iOS simulator, Android emulator).
125961
+ description: `Paste text into the focused field: puts \`text\` on the DEVICE clipboard, then triggers the platform's paste shortcut (iOS simulator, Android emulator).
125942
125962
  Do NOT use this in place of \`keyboard\`. \`keyboard\` types as a user would and is the default for all text entry; use \`paste\` only where a real user would paste \u2014 a 2FA/OTP code copied from another app, a long link or token, or when testing the app's own paste handling.
125943
- Tap the field first so it has focus. Returns { pasted: true }. Fails on a TV target, when the device clipboard cannot be set, or when the simulator-server build lacks clipboard support.
125963
+ Tap the field first so it has focus. Returns { pasted: true }, plus via: "keyboard" when a secret was typed instead of pasted. Fails on a TV target, when the device clipboard cannot be set, when a secret that has to be typed holds a character that cannot be typed, or when the simulator-server build lacks clipboard support.
125944
125964
  Supports \`{{secret:<NAME>}}\` placeholders like \`keyboard\`; the value is never echoed back.`,
125945
125965
  searchHint: "paste clipboard pasteboard otp 2fa code fill field",
125946
125966
  zodSchema: pasteZodSchema,
@@ -125951,7 +125971,7 @@ Supports \`{{secret:<NAME>}}\` placeholders like \`keyboard\`; the value is neve
125951
125971
  return serializedPerDevice(params.udid, async () => {
125952
125972
  if (secrets.length === 0) return dispatch(services, params, options);
125953
125973
  try {
125954
- return await dispatch(services, { ...params, text }, options);
125974
+ return await dispatch(services, { ...params, text, hasSecrets: true }, options);
125955
125975
  } catch (err) {
125956
125976
  throw redactSecretsFromError(err, secrets);
125957
125977
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.26.1-next.11",
3
+ "version": "0.26.1-next.12",
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",
@@ -185,7 +185,7 @@ Where the value is read from, and the rules for using a placeholder — includin
185
185
  { "udid": "<UDID>", "text": "482913" }
186
186
  ```
187
187
 
188
- Puts `text` on the **device** clipboard (the host clipboard is untouched) and triggers the platform's paste shortcut. iOS simulator and Android emulator only; a TV target, a physical device, Chromium and Vega are rejected.
188
+ Puts `text` on the **device** clipboard and triggers the platform's paste shortcut. iOS simulator and Android emulator only; a TV target, a physical device, Chromium and Vega are rejected.
189
189
 
190
190
  `paste` is **not** a faster `keyboard`. `keyboard` types the way a user types and stays the default for every text entry — a search query, a login, a form field. Reach for `paste` only where a real user would paste: a 2FA / OTP code copied from another app, a long link or token, or to test how the app handles pasted input. It also carries what `keyboard` can't type on a given platform (multi-line text, non-ASCII on Android), but that alone is not a reason to paste — ask whether the user would.
191
191