@swmansion/argent 0.31.1-next.6 → 0.31.1-next.7

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.
@@ -406,7 +406,7 @@ export interface ArgentToolArgs {
406
406
  keyboard: {
407
407
  /** Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, HarmonyOS id, or Chromium id). */
408
408
  udid: string;
409
- /** Text to type character by character. Cannot be combined with `key` in one call (one call per action); to type and then press a key, put two `keyboard` steps in one `run-sequence`. Handles uppercase and common punctuation. To type a credential without its plaintext ever entering your context, use a secret placeholder: `{{secret:<NAME>}}`, e.g. text: "{{secret:APP_PASSWORD}}". The value is resolved on the machine running the tool-server, from the first source that defines the name: the `ARGENT_SECRET_<NAME>` environment variable, `.argent/secrets.env` in the project, the project's `.env.local` / `.env` (only their `ARGENT_SECRET_`-prefixed keys), then `~/.argent/secrets.env`. Nothing else on the host is reachable. Placeholders can be embedded in longer text and are never echoed back resolved. If the secret you need is not set, the failure lists the available names and every source it looked in; ask the user to add it to one of them (a secrets file applies immediately; an env var needs a restart), NEVER ask the user to paste the secret value into the conversation. */
409
+ /** Text to type character by character. Cannot be combined with `key` in one call (one call per action); to type and then press a key, put two `keyboard` steps in one `run-sequence`. Handles uppercase and common punctuation. To type a credential without its plaintext ever entering your context, use a secret placeholder: `{{secret:<NAME>}}`, e.g. text: "{{secret:APP_PASSWORD}}". The value is resolved on the machine running the tool-server, from the first source that defines the name: the `ARGENT_SECRET_<NAME>` environment variable, `.argent/secrets.env` in the project, the project's `.env.local` / `.env` (only their `ARGENT_SECRET_`-prefixed keys), then `~/.argent/secrets.env`. Nothing else on the host is reachable. Over a link with the `forward-secrets` flag on, the client's own sources are checked first. Placeholders can be embedded in longer text and are never echoed back resolved. If the secret you need is not set, the failure lists the available names and every source it looked in; ask the user to add it to one of them (a secrets file applies immediately; an env var needs a restart), NEVER ask the user to paste the secret value into the conversation. */
410
410
  text?: string;
411
411
  /** Named key to press: enter, escape, backspace, tab, space, arrow-up, arrow-down, arrow-left, arrow-right, f1-f12. Cannot be combined with `text` in one call: one call per action; to type and then press a key, put two `keyboard` steps in one `run-sequence`. Not supported on TV targets; move focus with `tv-remote` (up/down/left/right) instead. Physical iOS: only `enter` and `backspace`. HarmonyOS: only enter (return), backspace (delete), space, arrow-left and arrow-right; any other key fails with 400 KEYBOARD_KEY_UNSUPPORTED. */
412
412
  key?: string;
@@ -559,7 +559,7 @@ export interface ArgentToolArgs {
559
559
  paste: {
560
560
  /** Target device id from `list-devices` (iOS simulator UDID or Android emulator serial). */
561
561
  udid: string;
562
- /** Text to put on the device clipboard and paste into the focused field. Supports `{{secret:<NAME>}}` placeholders, resolved on the tool-server from the `ARGENT_SECRET_<NAME>` environment variable or an argent secrets file (the same sources as `keyboard`), so a credential never enters your context. If the secret is not set, the failure lists the available names and every source it looked in; ask the user to add it there, NEVER ask for the value in the conversation. */
562
+ /** Text to put on the device clipboard and paste into the focused field. Supports `{{secret:<NAME>}}` placeholders, resolved on the tool-server from the `ARGENT_SECRET_<NAME>` environment variable or an argent secrets file (the same sources as `keyboard`, the client's first over a link with the `forward-secrets` flag on), so a credential never enters your context. If the secret is not set, the failure lists the available names and every source it looked in; ask the user to add it there, NEVER ask for the value in the conversation. */
563
563
  text: string;
564
564
  };
565
565
  "profiler-combined-report": {
@@ -146,6 +146,10 @@ var init_flags = __esm({
146
146
  name: "harmonyos",
147
147
  description: "HarmonyOS support: list, boot and drive HarmonyOS phones and DevEco Studio emulators over `hdc`. Off by default while the platform is experimental."
148
148
  },
149
+ {
150
+ name: "forward-secrets",
151
+ description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
152
+ },
149
153
  {
150
154
  name: "video-watermark",
151
155
  description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
@@ -705,6 +709,33 @@ function secretSources(options = {}) {
705
709
  }
706
710
  return sources;
707
711
  }
712
+ function clientSecretSource(values) {
713
+ return {
714
+ label: "secrets the argent client sent with this call",
715
+ kind: "client",
716
+ present: true,
717
+ names: [...values.keys()].sort(),
718
+ values: new Map(values)
719
+ };
720
+ }
721
+ function decodeClientSecrets(header) {
722
+ let parsed;
723
+ try {
724
+ parsed = JSON.parse(Buffer.from(header, "base64").toString("utf8"));
725
+ } catch {
726
+ throw new Error("is not base64-encoded JSON");
727
+ }
728
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
729
+ throw new Error("is not a JSON object");
730
+ }
731
+ const values = /* @__PURE__ */ new Map();
732
+ for (const [name, value] of Object.entries(parsed)) {
733
+ if (!SECRET_NAME_RE.test(name)) throw new Error(`names an invalid secret "${name}"`);
734
+ if (typeof value !== "string") throw new Error(`has a non-string value for ${name}`);
735
+ values.set(name, value);
736
+ }
737
+ return values;
738
+ }
708
739
  function lookupSecret(name, sources) {
709
740
  for (const source of sources) {
710
741
  const value = source.values.get(name);
@@ -712,6 +743,12 @@ function lookupSecret(name, sources) {
712
743
  }
713
744
  return void 0;
714
745
  }
746
+ function lookupPlaceholderSecret(rawName, sources) {
747
+ const value = lookupSecret(rawName, sources);
748
+ if (value !== void 0 || !REDUNDANT_PREFIX_RE.test(rawName)) return { name: rawName, value };
749
+ const name = rawName.replace(REDUNDANT_PREFIX_RE, "");
750
+ return { name, value: lookupSecret(name, sources) };
751
+ }
715
752
  function secretNames(sources) {
716
753
  const names = /* @__PURE__ */ new Set();
717
754
  for (const source of sources) for (const name of source.names) names.add(name);
@@ -724,15 +761,18 @@ function describeSecretSources(sources) {
724
761
  if (!source.present) state3 = "not found";
725
762
  else if (source.needsPrefix) {
726
763
  state3 = `found, but no ${SECRET_ENV_PREFIX}* keys \u2014 only prefixed keys are exposed from a file the app shares`;
727
- } else state3 = source.kind === "env" ? count2 : `found, ${count2}`;
764
+ } else state3 = source.kind === "file" ? `found, ${count2}` : count2;
728
765
  return ` ${i + 1}. ${source.label} \u2014 ${state3}`;
729
766
  }).join("\n");
730
767
  }
731
768
  function secretPlacementAdvice(name, options = {}) {
732
769
  const globalFile = path3.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME);
733
- return `To make it available, ask the user to add \`${name}=\u2026\` to ${globalFile} (or to \`.argent/${SECRETS_FILE_NAME}\` in the project), add \`${SECRET_ENV_PREFIX}${name}=\u2026\` to the project's .env / .env.local, or export ${SECRET_ENV_PREFIX}${name} in the tool-server's environment \u2014 never ask the user for the secret value itself.`;
770
+ return `To make it available, ask the user to add \`${name}=\u2026\` to ${globalFile} (or to \`.argent/${SECRETS_FILE_NAME}\` in the project), add \`${SECRET_ENV_PREFIX}${name}=\u2026\` to the project's .env / .env.local, or export ${SECRET_ENV_PREFIX}${name} in the tool-server's environment \u2014 never ask the user for the secret value itself. If this tool-server is reached through \`argent link\` or ARGENT_TOOLS_URL, the user can instead define it on the client's machine and run \`argent enable forward-secrets\` there; \`argent secrets\` there lists the sources the client reads, which this list leaves out.`;
734
771
  }
735
- var fs3, path3, import_dotenv, SECRET_ENV_PREFIX, SECRETS_FILE_NAME, SHARED_ENV_FILES, SECRET_NAME_RE;
772
+ function clientSecretPlacementAdvice(name) {
773
+ return `To make it available, ask the user to add \`${name}=\u2026\` to ~/.argent/${SECRETS_FILE_NAME} on the client's machine (or to \`.argent/${SECRETS_FILE_NAME}\` in the project the client runs in), or to export ${SECRET_ENV_PREFIX}${name} before the client starts; \`argent secrets\` there lists the sources the client reads \u2014 never ask the user for the secret value itself.`;
774
+ }
775
+ var fs3, path3, import_dotenv, SECRET_ENV_PREFIX, SECRETS_FILE_NAME, SHARED_ENV_FILES, SECRET_NAME_RE, SECRET_PLACEHOLDER_RE, REDUNDANT_PREFIX_RE;
736
776
  var init_secrets = __esm({
737
777
  "../configuration-core/src/secrets.ts"() {
738
778
  "use strict";
@@ -745,6 +785,8 @@ var init_secrets = __esm({
745
785
  SECRETS_FILE_NAME = "secrets.env";
746
786
  SHARED_ENV_FILES = [".env.local", ".env"];
747
787
  SECRET_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
788
+ SECRET_PLACEHOLDER_RE = /\{\{secret:([A-Za-z_][A-Za-z0-9_]*)\}\}/g;
789
+ REDUNDANT_PREFIX_RE = /^argent_secret_/i;
748
790
  }
749
791
  });
750
792
 
@@ -1080,12 +1122,13 @@ var init_event_emitter = __esm({
1080
1122
  function isLiveServiceState(state3) {
1081
1123
  return state3 === "RUNNING" /* RUNNING */ || state3 === "STARTING" /* STARTING */;
1082
1124
  }
1083
- var LINKED_CALL_HEADER, E2E_DIR_CLIENT_HEADER;
1125
+ var LINKED_CALL_HEADER, E2E_DIR_CLIENT_HEADER, CLIENT_SECRETS_HEADER;
1084
1126
  var init_types = __esm({
1085
1127
  "../registry/src/types.ts"() {
1086
1128
  "use strict";
1087
1129
  LINKED_CALL_HEADER = "x-argent-linked";
1088
1130
  E2E_DIR_CLIENT_HEADER = "x-argent-e2e-dir";
1131
+ CLIENT_SECRETS_HEADER = "x-argent-client-secrets";
1089
1132
  }
1090
1133
  });
1091
1134
 
@@ -100978,7 +101021,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
100978
101021
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
100979
101022
  function readCliVersion() {
100980
101023
  if (true) {
100981
- return "0.31.1-next.6";
101024
+ return "0.31.1-next.7";
100982
101025
  }
100983
101026
  return "0.0.0";
100984
101027
  }
@@ -130893,6 +130936,18 @@ function createHttpApp(registry2, options) {
130893
130936
  res.status(404).json({ error: `Tool "${name}" not found` });
130894
130937
  return;
130895
130938
  }
130939
+ let clientSecrets;
130940
+ const clientSecretsHeader = firstHeader(req.headers[CLIENT_SECRETS_HEADER]);
130941
+ if (clientSecretsHeader !== void 0) {
130942
+ try {
130943
+ clientSecrets = decodeClientSecrets(clientSecretsHeader);
130944
+ } catch (err) {
130945
+ res.status(400).json({
130946
+ error: `The ${CLIENT_SECRETS_HEADER} header ${err instanceof Error ? err.message : String(err)}.`
130947
+ });
130948
+ return;
130949
+ }
130950
+ }
130896
130951
  let bodyArgs;
130897
130952
  let resolvedFileInputs;
130898
130953
  let derivedTargets;
@@ -131058,6 +131113,7 @@ function createHttpApp(registry2, options) {
131058
131113
  // A client released before the rename writes client files only under
131059
131114
  // `.argent/flows/`, so the recorder keeps its recordings there.
131060
131115
  ...firstHeader(req.headers[E2E_DIR_CLIENT_HEADER]) === "1" ? {} : { legacyE2eDir: true },
131116
+ ...clientSecrets ? { clientSecrets } : {},
131061
131117
  toolInvocationId,
131062
131118
  ...recordChildInvocation ? { recordChildInvocation } : {},
131063
131119
  ...wantsStream ? { emitProgress: (event2) => writeLine({ event: "progress", data: event2 }) } : {}
@@ -143039,26 +143095,23 @@ init_src2();
143039
143095
  init_capability();
143040
143096
  init_src();
143041
143097
  var SECRET_PLACEHOLDER_MARKER = "{{secret:";
143042
- var PLACEHOLDER_RE = /\{\{secret:([A-Za-z_][A-Za-z0-9_]*)\}\}/g;
143043
- var REDUNDANT_PREFIX_RE = /^argent_secret_/i;
143044
143098
  function resolveSecretPlaceholders(text, options = {}) {
143045
143099
  const secrets = [];
143046
143100
  let sources;
143047
- const resolved = text.replace(PLACEHOLDER_RE, (_placeholder, rawName) => {
143048
- sources ??= secretSources(options);
143049
- let name = rawName;
143050
- let value = lookupSecret(name, sources);
143051
- if (value === void 0 && REDUNDANT_PREFIX_RE.test(name)) {
143052
- name = name.replace(REDUNDANT_PREFIX_RE, "");
143053
- value = lookupSecret(name, sources);
143054
- }
143101
+ const resolved = text.replace(SECRET_PLACEHOLDER_RE, (_placeholder, rawName) => {
143102
+ sources ??= [
143103
+ ...options.clientSecrets ? [clientSecretSource(options.clientSecrets)] : [],
143104
+ ...secretSources(options)
143105
+ ];
143106
+ const { name, value } = lookupPlaceholderSecret(rawName, sources);
143055
143107
  if (value === void 0) {
143056
143108
  const names = secretNames(sources);
143109
+ const where = options.clientSecrets ? `the required secret ${name} was not provided: the argent client forwards its secrets to this tool-server and has no value for it, and no source on the machine running the tool-server defines it either` : `no source on the machine running the tool-server defines ${name}`;
143057
143110
  throw new InvalidToolInputError(
143058
- `Unknown secret "${rawName}" \u2014 no source on the machine running the tool-server defines ${name}. Available secrets: ${names.length ? names.join(", ") : "(none)"}.
143111
+ `Unknown secret "${rawName}" \u2014 ${where}. Available secrets: ${names.length ? names.join(", ") : "(none)"}.
143059
143112
  Sources consulted, first match wins:
143060
143113
  ${describeSecretSources(sources)}
143061
- ` + secretPlacementAdvice(name, options),
143114
+ ` + (options.clientSecrets ? clientSecretPlacementAdvice(name) : secretPlacementAdvice(name, options)),
143062
143115
  {
143063
143116
  error_code: FAILURE_CODES.SECRET_PLACEHOLDER_UNKNOWN,
143064
143117
  failure_stage: "secret_placeholder_resolution",
@@ -143773,7 +143826,7 @@ var zodSchema25 = external_exports.object({
143773
143826
  "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos>or Chromium id)."
143774
143827
  ),
143775
143828
  text: external_exports.string().optional().describe(
143776
- 'Text to type character by character. Cannot be combined with `key` in one call (one call per action); to type and then press a key, put two `keyboard` steps in one `run-sequence`. Handles uppercase and common punctuation. To type a credential without its plaintext ever entering your context, use a secret placeholder: `{{secret:<NAME>}}`, e.g. text: "{{secret:APP_PASSWORD}}". The value is resolved on the machine running the tool-server, from the first source that defines the name: the `ARGENT_SECRET_<NAME>` environment variable, `.argent/secrets.env` in the project, the project\'s `.env.local` / `.env` (only their `ARGENT_SECRET_`-prefixed keys), then `~/.argent/secrets.env`. Nothing else on the host is reachable. Placeholders can be embedded in longer text and are never echoed back resolved. If the secret you need is not set, the failure lists the available names and every source it looked in; ask the user to add it to one of them (a secrets file applies immediately; an env var needs a restart), NEVER ask the user to paste the secret value into the conversation.'
143829
+ "Text to type character by character. Cannot be combined with `key` in one call (one call per action); to type and then press a key, put two `keyboard` steps in one `run-sequence`. Handles uppercase and common punctuation. To type a credential without its plaintext ever entering your context, use a secret placeholder: `{{secret:<NAME>}}`, e.g. text: \"{{secret:APP_PASSWORD}}\". The value is resolved on the machine running the tool-server, from the first source that defines the name: the `ARGENT_SECRET_<NAME>` environment variable, `.argent/secrets.env` in the project, the project's `.env.local` / `.env` (only their `ARGENT_SECRET_`-prefixed keys), then `~/.argent/secrets.env`. Nothing else on the host is reachable. Over a link with the `forward-secrets` flag on, the client's own sources are checked first. Placeholders can be embedded in longer text and are never echoed back resolved. If the secret you need is not set, the failure lists the available names and every source it looked in; ask the user to add it to one of them (a secrets file applies immediately; an env var needs a restart), NEVER ask the user to paste the secret value into the conversation."
143777
143830
  ),
143778
143831
  key: external_exports.string().optional().describe(
143779
143832
  "Named key to press: enter, escape, backspace, tab, space, arrow-up, arrow-down, arrow-left, arrow-right, f1-f12. Cannot be combined with `text` in one call: one call per action; to type and then press a key, put two `keyboard` steps in one `run-sequence`. Not supported on TV targets; move focus with `tv-remote` (up/down/left/right) instead. Physical iOS: only `enter` and `backspace`.<flag:harmonyos> HarmonyOS: only enter (return), backspace (delete), space, arrow-left and arrow-right; any other key fails with 400 KEYBOARD_KEY_UNSUPPORTED.</flag:harmonyos>"
@@ -143824,7 +143877,7 @@ function createKeyboardTool(registry2) {
143824
143877
  Use when you need to enter text or trigger a named key such as enter, escape, or arrow keys. On Vega and Apple TV / Android TV, prefer the remote tools for D-pad navigation; use keyboard to type into a focused text field (e.g. a search or login box).
143825
143878
  Returns { typed: string, keys: number }. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if text and key are both given in one call (rejected before anything is typed), if an unsupported key name is provided, or if the device's input backend is not reachable.
143826
143879
  A failure is not rolled back. An unsupported key name is always rejected before anything is sent. Un-typeable text is not: the iOS simulator and Chromium reject it mid-string and leave the characters before it in the field (Android, <flag:harmonyos>HarmonyOS, </flag:harmonyos>Vega and TV targets check the whole string up front). A transport failure partway also leaves the text already sent. On a retry, read the field's actual contents; do not assume it is unchanged.
143827
- - text: types a string (supports uppercase, digits, common punctuation). To type a credential, use \`{{secret:<NAME>}}\`, resolved server-side from the \`ARGENT_SECRET_<NAME>\` env var or an argent secrets file (\`.argent/secrets.env\` in the project, \`~/.argent/secrets.env\`, or an \`ARGENT_SECRET_\`-prefixed key in the project's \`.env\`/\`.env.local\`), so the plaintext never enters agent context; the result echoes the placeholder, not the value, and the after-typing auto-screenshot is skipped. To submit after typing a secret, put both steps in ONE \`run-sequence\`: that keeps the skip covering the Enter, which a second bare \`keyboard\` call would not.
143880
+ - text: types a string (supports uppercase, digits, common punctuation). To type a credential, use \`{{secret:<NAME>}}\`, resolved server-side from the \`ARGENT_SECRET_<NAME>\` env var or an argent secrets file (\`.argent/secrets.env\` in the project, \`~/.argent/secrets.env\`, or an \`ARGENT_SECRET_\`-prefixed key in the project's \`.env\`/\`.env.local\`; over a link with \`forward-secrets\` on, the client's own sources first), so the plaintext never enters agent context; the result echoes the placeholder, not the value, and the after-typing auto-screenshot is skipped. To submit after typing a secret, put both steps in ONE \`run-sequence\`: that keeps the skip covering the Enter, which a second bare \`keyboard\` call would not.
143828
143881
  - key: presses a single named key (enter, escape, backspace, tab, arrow-up/down/left/right, f1-f12). NOT supported on TV targets; move focus with \`tv-remote\` instead. <flag:harmonyos>HarmonyOS presses enter (or \`return\`), backspace (or \`delete\`), space and the horizontal arrows; any other key name is rejected. </flag:harmonyos>Physical iOS: only \`enter\` and \`backspace\`.
143829
143882
  On a TV target (runtimeKind 'tv') only \`text\` applies. Focus a text field first (with \`tv-remote\`), then type into it (injected HID keyboard on Apple TV, \`adb input text\` on Android TV).
143830
143883
  One call does one action: pass text OR key, never both. To type and then press a key, send two \`keyboard\` steps in one \`run-sequence\` ({ text: "hello" } then { key: "enter" }), which also keeps it to a single round-trip.`,
@@ -143873,7 +143926,9 @@ One call does one action: pass text OR key, never both. To type and then press a
143873
143926
  );
143874
143927
  }
143875
143928
  if (params.text === void 0) return dispatch(services, params, options);
143876
- const { text, secrets } = resolveSecretPlaceholders(params.text);
143929
+ const { text, secrets } = resolveSecretPlaceholders(params.text, {
143930
+ clientSecrets: options?.clientSecrets
143931
+ });
143877
143932
  if (secrets.length === 0) return dispatch(services, params, options);
143878
143933
  try {
143879
143934
  const result = await dispatch(services, { ...params, text }, options);
@@ -143892,7 +143947,7 @@ var pasteZodSchema = external_exports.object({
143892
143947
  "Target device id from `list-devices` (iOS simulator UDID or Android emulator serial)."
143893
143948
  ),
143894
143949
  text: external_exports.string().min(1).describe(
143895
- "Text to put on the device clipboard and paste into the focused field. Supports `{{secret:<NAME>}}` placeholders, resolved on the tool-server from the `ARGENT_SECRET_<NAME>` environment variable or an argent secrets file (the same sources as `keyboard`), so a credential never enters your context. If the secret is not set, the failure lists the available names and every source it looked in; ask the user to add it there, NEVER ask for the value in the conversation."
143950
+ "Text to put on the device clipboard and paste into the focused field. Supports `{{secret:<NAME>}}` placeholders, resolved on the tool-server from the `ARGENT_SECRET_<NAME>` environment variable or an argent secrets file (the same sources as `keyboard`, the client's first over a link with the `forward-secrets` flag on), so a credential never enters your context. If the secret is not set, the failure lists the available names and every source it looked in; ask the user to add it there, NEVER ask for the value in the conversation."
143896
143951
  )
143897
143952
  });
143898
143953
 
@@ -144048,7 +144103,9 @@ Supports \`{{secret:<NAME>}}\` placeholders like \`keyboard\`; the value is neve
144048
144103
  capability: capability18,
144049
144104
  services: () => ({}),
144050
144105
  execute: async (services, params, options) => {
144051
- const { text, secrets } = resolveSecretPlaceholders(params.text);
144106
+ const { text, secrets } = resolveSecretPlaceholders(params.text, {
144107
+ clientSecrets: options?.clientSecrets
144108
+ });
144052
144109
  return serializedPerDevice(params.udid, async () => {
144053
144110
  if (secrets.length === 0) return dispatch(services, params, options);
144054
144111
  try {
@@ -145152,7 +145209,8 @@ async function invokeSubTool(registry2, ctx, toolId, args, extra) {
145152
145209
  const flowStack = extra?.flowStack ?? ctx?.flowStack;
145153
145210
  const forwarded = {
145154
145211
  ...extra?.fileInputs ? { fileInputs: extra.fileInputs } : {},
145155
- ...flowStack ? { flowStack } : {}
145212
+ ...flowStack ? { flowStack } : {},
145213
+ ...ctx?.clientSecrets ? { clientSecrets: ctx.clientSecrets } : {}
145156
145214
  };
145157
145215
  if (!recordChildInvocation) {
145158
145216
  return signal || Object.keys(forwarded).length > 0 ? registry2.invokeTool(toolId, args, { ...signal ? { signal } : {}, ...forwarded }) : registry2.invokeTool(toolId, args);
@@ -151205,7 +151263,7 @@ Allowed tools and their args (udid is auto-injected, do NOT include it in args):
151205
151263
  gesture-rotate: { centerX: number, centerY: number, radius?: number, radiusX?: number, radiusY?: number, startAngle: number, endAngle: number, durationMs?: number } [ios/android]
151206
151264
  button: { button: "home"|"back"|"power"|"volumeUp"|"volumeDown"|"appSwitch"|"actionButton" } [ios/android<flag:harmonyos>/harmony; harmony: home/back/power only</flag:harmonyos>]
151207
151265
  keyboard: { text?: string, key?: string, delayMs?: number } (text OR key per step, never both; TV: text only<flag:harmonyos>; harmony: enter/return, backspace/delete, space, arrow-left, arrow-right only</flag:harmonyos>) [ios/android/chromium/vega/tv<flag:harmonyos>/harmony</flag:harmonyos>]
151208
- text supports {{secret:<NAME>}} placeholders, resolved server-side from ARGENT_SECRET_<NAME> env vars or an argent secrets file; credentials never enter agent context
151266
+ text supports {{secret:<NAME>}} placeholders, resolved server-side from ARGENT_SECRET_<NAME> env vars or an argent secrets file (over a forward-secrets link, the client's first); credentials never enter agent context
151209
151267
  paste: { text: string } (device clipboard + paste shortcut; only where a user would paste, e.g. an OTP; keyboard otherwise) [ios sim/android emu]
151210
151268
  rotate: { orientation: "Portrait"|"LandscapeLeft"|"LandscapeRight"|"PortraitUpsideDown" } [ios/android]
151211
151269
  shake: { count?: number } [ios sim/android emu]
@@ -154951,7 +155009,9 @@ Fails with FILL_NO_FOCUSED_FIELD when nothing editable has focus, FILL_NOT_VERIF
154951
155009
  capability: capability28,
154952
155010
  services: () => ({}),
154953
155011
  execute: async (services, params, options) => {
154954
- const { text, secrets } = resolveSecretPlaceholders(params.text);
155012
+ const { text, secrets } = resolveSecretPlaceholders(params.text, {
155013
+ clientSecrets: options?.clientSecrets
155014
+ });
154955
155015
  try {
154956
155016
  return await dispatch(services, { udid: params.udid, text }, options);
154957
155017
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.31.1-next.6",
3
+ "version": "0.31.1-next.7",
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",
@@ -156,7 +156,7 @@ Only the direction presets carry OS-edge margins. A resolved `from` point is use
156
156
 
157
157
  On Chromium a swipe is a mouse drag (`gesture-drag`), so a `from` on an `<img>`, an `<a href>` or a `draggable="true"` node starts the browser's native drag-and-drop: the page gets `pointerdown` then `pointercancel` and sees no travel. On Vega, `swipe` fails upfront like the other touch directives.
158
158
 
159
- `type` presses Enter in a second `keyboard` call unless `submit: false`. A polished focus tap plus one text-only `keyboard` call usually needs `submit: false`. Store external values as `{{secret:NAME}}`. The runner uses the first source that defines the name: environment `ARGENT_SECRET_NAME`; project `.argent/secrets.env`; project `.env.local`, then `.env`; then `~/.argent/secrets.env`. The two `secrets.env` files accept the bare `NAME`, but the shared dotenv files expose only `ARGENT_SECRET_`-prefixed keys, so a bare `NAME=…` in `.env` or `.env.local` stays unresolved. The runner redacts every resolved value, so do not use a placeholder for content a report must show.
159
+ `type` presses Enter in a second `keyboard` call unless `submit: false`. A polished focus tap plus one text-only `keyboard` call usually needs `submit: false`. Store external values as `{{secret:NAME}}`. The runner uses the first source that defines the name: environment `ARGENT_SECRET_NAME`; project `.argent/secrets.env`; project `.env.local`, then `.env`; then `~/.argent/secrets.env`. Over a link with `forward-secrets` on, the same sources on the client's machine come first. The two `secrets.env` files accept the bare `NAME`, but the shared dotenv files expose only `ARGENT_SECRET_`-prefixed keys, so a bare `NAME=…` in `.env` or `.env.local` stays unresolved. The runner redacts every resolved value, so do not use a placeholder for content a report must show.
160
160
 
161
161
  A **selector-less gesture** (a coordinate `tap`/`long-press`/`swipe`, or a `pinch`/`rotate` with no `on:`) resolves no frame, so a tree source it cannot read does not fail it. It settles best effort, dispatches anyway, and the step **passes carrying a warning** that quotes the source's own error. That green says the gesture was sent, not that it landed: one aimed at a moving element can miss it entirely. Restore the tree source, usually by relaunching the app so the instrumentation loads. Accept the warning only where the app serves no tree at all, and put an explicit `wait:` before a gesture that follows a transition. The first such gesture proves the outage and later ones spend that verdict without paying the settle window again. A tree read that comes back, or a relaunch, retires that verdict, which only makes the next gesture pay a fresh window, and it warns again if the source is still down.
162
162
 
@@ -13,9 +13,11 @@ The placeholder is resolved on the machine running the tool-server, from the fir
13
13
  | 3 | `<project>/.env.local`, then `<project>/.env` | only `ARGENT_SECRET_`-prefixed keys, so app config stays unreachable |
14
14
  | 4 | `~/.argent/secrets.env` | every key, per-user, works in any project |
15
15
 
16
+ Over `argent link` or `ARGENT_TOOLS_URL` the tool-server can be another machine. With `argent enable forward-secrets` on the client, the client resolves each placeholder of a call with these same sources on its own machine and sends the values with the call; the tool-server's sources resolve only the names the client lacks.
17
+
16
18
  ## Rules
17
19
 
18
- - The result echoes the placeholder, never the value. An unknown name fails with the list of available secret _names_ and every source it looked in, with paths; read that list before asking the user anything.
20
+ - The result echoes the placeholder, never the value. An unknown name fails with the list of available secret _names_ and every source the tool-server looked in, with paths; read that list before asking the user anything. A client that forwards secrets does not add its own sources to it; `argent secrets` on the client lists those. When the failure says the required secret was not provided, the client forwards secrets and has no value for the name, so it belongs on the client's machine.
19
21
  - The auto-screenshot after the call is skipped so the typed value cannot re-enter your context as pixels. Do **not** `describe` or `screenshot` a non-secure field you just filled with a secret; submit or navigate away first, then verify the resulting screen. To submit, put the text step and the Enter step in **one `run-sequence`**. The skip covers a whole batch that contains the placeholder, but a second bare `keyboard` call gets its own screenshot of the filled field.
20
- - Nothing outside those sources is reachable; never ask the user to paste a secret value into the conversation. Ask them to put it in a secrets file instead: a file edit applies to the next call, while an exported env var only reaches a tool-server started afterwards.
22
+ - Nothing outside those sources is reachable; never ask the user to paste a secret value into the conversation. Ask them to put it in a secrets file instead: a file edit applies to the next call, while an exported env var only reaches a tool-server (or, for a forwarded secret, a client) started afterwards.
21
23
  - The project sources are found by walking up from the tool-server's working directory. If a project file is not being picked up, the failure's source list shows the paths actually consulted; `~/.argent/secrets.env` needs no project and always applies.
@@ -67,7 +67,7 @@ Steps:
67
67
  7. screenshot → verify home screen appeared
68
68
  ```
69
69
 
70
- > **Credentials:** never type plaintext credentials; use a `{{secret:<NAME>}}` placeholder in `keyboard`, resolved server-side so the value never enters agent context. It comes from the `ARGENT_SECRET_<NAME>` environment variable or an argent secrets file (`.argent/secrets.env` in the project, `~/.argent/secrets.env`, or an `ARGENT_SECRET_`-prefixed key in the project's `.env` / `.env.local`). If the name is not defined, the failure lists the available names and every path it checked; ask the user to add it to one of those files (which applies immediately) instead of pasting the secret into the conversation. Never invent credentials or echo secret values into reports or saved files.
70
+ > **Credentials:** never type plaintext credentials; use a `{{secret:<NAME>}}` placeholder in `keyboard`, resolved server-side so the value never enters agent context. It comes from the `ARGENT_SECRET_<NAME>` environment variable or an argent secrets file (`.argent/secrets.env` in the project, `~/.argent/secrets.env`, or an `ARGENT_SECRET_`-prefixed key in the project's `.env` / `.env.local`); over a link with `forward-secrets` on, the client's own sources come first. If the name is not defined, the failure lists the available names and every path it checked; ask the user to add it to one of those files (which applies immediately) instead of pasting the secret into the conversation. Never invent credentials or echo secret values into reports or saved files.
71
71
 
72
72
  ### Scroll and navigation
73
73