feat(fill): read text from stdin with --text-stdin

Merged
ME
2mo ago
+1207-28

Summary

fill can now take its text from stdin, so a secret never appears in the CLI's argv:

printf %s "$PASSWORD" | agent-device fill @e3 --text-stdin
printf %s "$PASSWORD" | agent-device fill 'id="password"' --text-stdin --record-as PASSWORD
  • Reads at most 64 KiB and strips exactly one trailing \n or \r\n. A text argument, a TTY, empty input and invalid UTF-8 are INVALID_ARGS with typed reasons (fill_text_source_conflict, fill_text_stdin_*); no message echoes the input.
  • Uses the existing sensitivity contract: the value is registered as a diagnostics secret in the CLI and daemon scopes, and stays out of session.actions unless --record-as parameterizes it. While recording is armed, --text-stdin needs --record-as or --no-record (fill_text_stdin_unparameterized_recording). Happy to switch this to recording the step without its text if you prefer.
  • Batch steps, MCP tools and env/config defaults cannot set it.

25 files; scope stays within the fill family. Closes #3260.

Validation

Tested at 9d2bc9074 (includes the review fixes): pnpm check:affected --run passed (all runnable checks; device and toolchain lanes are GitHub-authoritative). CI pending.

Live run on an iPhone 16 simulator (iOS 18.6, Settings search field): stdin fill succeeded; an armed recording refused it without --record-as and published ${PASSWORD} with it. The value was absent from the daemon log, session events and the .ad script. It still appears in the native XCTest session log, which is #3261 and out of scope here.