Skip to content

Add send-input command with delayed enter and optional activation#20106

Closed
laffo16 wants to merge 4 commits intomicrosoft:mainfrom
laffo16:feature/send-input-cli-poc
Closed

Add send-input command with delayed enter and optional activation#20106
laffo16 wants to merge 4 commits intomicrosoft:mainfrom
laffo16:feature/send-input-cli-poc

Conversation

@laffo16
Copy link
Copy Markdown

@laffo16 laffo16 commented Apr 12, 2026

Summary

This adds a new wt send-input command for sending text to the active pane.

Included in this change:

  • send-input <input...>
  • --enter
  • --enter-delay-ms <ms>
  • --activate

Behavior notes:

  • send-input targeting an existing window stays in the background by default
  • send-input --activate opts back into the normal summon/foreground behavior
  • focus-helper chains like focus-tab ; send-input stay background by default
  • structural chains like new-tab ; send-input and split-pane ; send-input preserve existing activation behavior

Examples

wt -w 0 send-input "hello"
wt -w 0 send-input --enter "echo ready"
wt -w 0 send-input --enter --enter-delay-ms 200 "Please reply exactly with TEST_OK."
wt -w 0 send-input --activate "hello"
wt -w 0 focus-tab -t 1 ; send-input --enter "echo TAB2_OK"

Implementation Notes

  • Reuses the existing SendInput action path
  • Allows targeting existing windows without implicitly prepending new-tab for automation-style send/focus flows
  • Preserves existing activation behavior for non-send structural command chains
  • Keeps generated action IDs stable for zero-delay/default-args cases

Validation

Built successfully:

  • SettingsModel.UnitTests.vcxproj
  • TerminalApp.LocalTests.vcxproj

Focused tests passed:

  • SettingsModelUnitTests::KeyBindingsTests::HashDeduplication
  • SettingsModelUnitTests::KeyBindingsTests::DefaultArgSemanticDeduplication
  • SettingsModelUnitTests::KeyBindingsTests::SendInputZeroDelayDeduplication
  • SettingsModelUnitTests::KeyBindingsTests::SendInputDelayedEnterStaysDistinct
  • TerminalAppLocalTests::CommandlineTest::ParseSendInputArgs

Manual smoke also passed against a side-by-side patched Terminal Dev package:

  • background send-input
  • --activate
  • focus-tab ; send-input
  • Codex prompt submission using --enter --enter-delay-ms

@laffo16
Copy link
Copy Markdown
Author

laffo16 commented Apr 12, 2026

@microsoft-github-policy-service agree

@DHowett
Copy link
Copy Markdown
Member

DHowett commented Apr 13, 2026

I'm sorry, but we will not be accepting any work that adds a remote input injection vulnerability to Windows Terminal. Adding a wt send-input command will allow any application on the computer to inject input into any running instance of Terminal, unauthenticated, potentially controlling remote servers or admin sessions.

@DHowett DHowett closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants