You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9d2bc90
Browse filesBrowse the repository at this point in the historyBrowse files
fix(fill): harden --text-stdin input handling and docs
- Mask target parse failures under --text-stdin: a stray positional may be
the secret, and the generic target error echoed it.
- Keep a leading byte order mark and refuse lone surrogates in string
chunks instead of replacing them.
- Only refuse batch steps that set textStdin to true.
- Clarify help and docs: passing neither --record-as nor --no-record while
recording is an error, invalid UTF-8 is refused, and printf %s is the
verbatim way to pipe a value.
- Tighten tests to assert each case's own input is never echoed.
`Batch step ${stepNumber}: fill textStdin is not supported because batch steps have no stdin of their own. Run that fill on its own with --text-stdin.`,
// The message names neither source: the positional may already be the secret.
90
-
thrownewAppError(
91
-
'INVALID_ARGS',
92
-
'fill --text-stdin reads the text from stdin, so it cannot also take a text argument.',
93
-
{
94
-
reason: 'fill_text_source_conflict',
95
-
hint: 'Pass only the target, for example: printf %s "$PASSWORD" | agent-device fill @e3 --text-stdin. Quote a multi-word selector so no part of it is read as text.',
thrownewAppError('INVALID_ARGS','fill --text-stdin could not read the target.',{
173
+
reason: 'fill_text_stdin_target_invalid',
174
+
hint: 'Pass only the target: an @ref, a quoted selector, or x y coordinates. The text itself goes to stdin.',
175
+
});
176
+
}
177
+
if(decoded.text!==undefined){
178
+
thrownewAppError(
179
+
'INVALID_ARGS',
180
+
'fill --text-stdin reads the text from stdin, so it cannot also take a text argument.',
181
+
{
182
+
reason: 'fill_text_source_conflict',
183
+
hint: 'Pass only the target, for example: printf %s "$PASSWORD" | agent-device fill @e3 --text-stdin. Quote a multi-word selector so no part of it is read as text.',
The live app receives the value; recording state and the published script contain only \${PASSWORD}. Reuse the same name for repeated values; --record-as is fill-only, requires an armed recording, and is mutually exclusive with --no-record. Replay with AD_VAR_PASSWORD still set, or pass --env PASSWORD=<value>. Do not record passwords/tokens without --record-as; their literal text is written to the .ad target.
181
181
To keep the value out of the CLI's argv as well, pipe it in with --text-stdin instead of a text argument:
182
182
printf %s "$AD_VAR_PASSWORD" | agent-device fill 'id="password"' --text-stdin --record-as PASSWORD
183
-
--text-stdin reads at most 64 KiB, removes exactly one trailing newline, and refuses a terminal, empty input, or an extra text argument. While recording is armed it needs --record-as or --no-record; otherwise the step is left out of recorded actions. It is not available inside batch steps.
183
+
--text-stdin reads at most 64 KiB, removes exactly one trailing newline, and refuses a terminal, empty input, invalid UTF-8, or an extra text argument. While recording is armed, --record-as publishes \${VAR} and --no-record leaves the step out; passing neither is an error. Without an armed recording the step is not recorded. It is not available inside batch steps.
184
184
185
185
Replay divergence and repair:
186
186
A failing replay/test step returns REPLAY_DIVERGENCE with a bounded report (screen digest, ranked selector suggestions, resume). Fix app state, then resume with replay --from <n> --plan-digest <sha256> (both from the report's resume field) to continue without re-running earlier steps; resume never re-executes skipped steps, so app state there is the caller's responsibility. --from is replay-only; test rejects it. The digest binds the script, includes, effective --platform/--target, and per-action runtime/identity; native .ad interpolation is late-bound so changing only its values keeps the digest, while Maestro environment substitution can change it.
`fill --text-stdin` reads the text from stdin instead of a text argument, so a secret never appears in the CLI's process arguments. It reads at most 64 KiB, removes exactly one trailing newline (`\n` or `\r\n`, so `echo` and `printf %s` send the same value), and refuses a terminal, empty input, or an additional text argument. The value is registered as sensitive for diagnostics. While script recording is armed, combine it with `--record-as <VAR>` to publish `${VAR}`, or `--no-record` to leave the step out; otherwise the step is not recorded. Batch steps do not accept it.
468
+
`fill --text-stdin` reads the text from stdin instead of a text argument, so a secret never appears in the CLI's process arguments. Pipe the value with `printf %s`, which sends it verbatim. It reads at most 64 KiB, removes exactly one trailing newline (`\n` or `\r\n`), and refuses a terminal, empty input, invalid UTF-8, or an additional text argument. The value is registered as sensitive for diagnostics. While script recording is armed, combine it with `--record-as <VAR>` to publish `${VAR}`, or `--no-record` to leave the step out; passing neither is an error. Without an armed recording the step is not recorded. Batch steps do not accept it.
469
469
When an interaction fails, see [Retry after a failed command](#retry-after-a-failed-command) before you retry.
470
470
`type` accepts text only. Do not pass `@ref` to `type`; use `fill @ref "text"` to target a field directly, or `press @ref` then `type "text"` to append in the focused field.
471
471
If `type` reports `TEXT_INPUT_NOT_FOCUSED`, focus a visible text input and retry; when accessibility does not expose the input, use a coordinate focus command before typing.
0 commit comments