Repository navigation
Conversation
`orca terminal send --text` is the highest-volume payload path in the CLI, and on WSL argv cannot carry it. The bridge hands the string to `orca.exe` through Windows PowerShell 5.1, which never escapes an embedded double quote when it builds a native command line, so `--text 'say "hello" now'` returns ok:true and delivers `say hello now`, while `--text 'tell me "whats next"'` splits into two arguments and exits 1 on the stray positional. Details and the localization harness are in stablyai#12231. That defect deserves its own fix in the bridge; this change is the orthogonal half — the payload never has to touch a command line in the first place: printf %s "$NOTE" | orca terminal send --terminal <handle> --text-stdin --enter The flag mirrors `computer type-text` / `paste-text` / `set-value`, which already accept --text-stdin / --value-stdin, so the reader moves to src/cli/stdin-payload.ts and both call sites share one implementation. Passing --text and --text-stdin together is an invalid_argument, matching computer-use. One deliberate difference from computer-use: empty stdin stays a legal payload here. `--text-stdin --enter` with no bytes is a bare newline, which is a real thing to send to a terminal; in computer-use an empty type-text is a mistake. Tests cover the stdin route with a quote-bearing payload, a multi-line payload, the mutual exclusion, the untouched --text path, and the help output. The four that assert new behavior fail without this change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe CLI adds shared asynchronous stdin payload reading with TTY validation and UTF-8 decoding. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/cli/handlers/terminal.test.ts (1)
99-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest an empty stdin payload.
The handler must preserve empty stdin as
text: '', but these tests cover only non-empty stdin. Add a--text-stdin --entercase with an empty stream. Assert thatterminal.sendreceivestext: ''.Proposed test
+ it('preserves an empty stdin payload', async () => { + stubStdin('') + + const call = await send(['terminal', 'send', '--terminal', 'term-1', '--text-stdin', '--enter']) + + expect(call).toHaveBeenCalledWith( + 'terminal.send', + expect.objectContaining({ text: '', enter: true }) + ) + })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8de2d17d-d62f-49b6-8cc5-417f3475cc25
📒 Files selected for processing (7)
skill-guides/orca-cli.mdsrc/cli/bundled-skill-guides.tssrc/cli/handlers/computer-action-flags.tssrc/cli/handlers/terminal.test.tssrc/cli/handlers/terminal.tssrc/cli/specs/core.tssrc/cli/stdin-payload.ts
|
I tried this branch against current It no longer applies cleanly
Since this branch's base, main has moved For a local check I kept main's side of the three conflicts and moved your Results on that port
Payloads that Git Bash or a shell can rewrite in argv I added 17 local tests (not part of this PR). One checks that
Other cases covered: On the port all 17 pass. On unmodified main all 17 fail. What this does not show
Checked with the help of an AI coding agent (Claude Opus 5.5). |
Adapt logii’s original PR stablyai#12239 reader extraction to the current terminal-send modules. Reuse the computer reader, bound terminal accumulation, and preserve prompt delivery and empty-input policies. Reported by rajpopat27 in stablyai#16113.
The pinned contributor head is a shallow imported history. Keep the current named main and adapted implementation as first-parent source authority; preserve original PR stablyai#12239 and its Claude coauthor without replaying its old terminal/core files.
Add the focused stdin route to command discovery, canonical guide and public reference, including EOF, UTF-8/newline behavior and the unchanged RPC limit. Regenerate only the guide bundle after the explicit shared-file lease.
ELI5
Terminal text can now come from a pipe, so generated multiline text can use the
same stdin route that computer actions already support.
What Changed
Previously,
terminal send --text-stdinwas rejected as an unknown flag. It nowaccepts UTF-8 stdin through the existing computer-action reader, with a
terminal-only raw input bound of 16 MiB. Conflicting text sources and invalid
wait/retry flags fail before reading stdin; the resolved text then follows the
current prompt preflight, request identity, wait, receipt and refusal behavior.
Empty stdin remains legal, including bare Enter, while empty prompt retries and
computer type/paste text remain invalid.
Why
This adapts logii's original reader-extraction approach from #12239 to the current
extracted CLI modules. Sharing the reader gives stdin parity without a file or
base64 mode, streamed terminal writes, a new RPC shape or a launcher redesign.
It does not claim to fix shell expansion or a native bridge defect.
Linked Issue
Fixes #16113
Visual Proof
N/A — no rendered UI or native focus change. The actual freshly built CLI was
run on macOS arm64 with a finite stdin pipe into an owned, bounded local JSON RPC
fixture; no app or user terminal received input. The complete raw CLI receipts
and readable before/after evidence
include argv/help/empty-Enter controls, separate Enter flags, exact retry identity,
and cleanup. Public artifact links expire November 1, 2026; the essential actual
outputs are retained below in this PR.
The same 89-byte valid UTF-8 input contains quotes, backticks, dollar syntax,
CRLF, slash commands, multibyte characters and a trailing newline. Captured text
SHA256:
c66430f590ee0c28f45d7abfb0e9174ed2ced1d903d6afc07259de3b9dda1dd9.This proves the CLI pipe/payload boundary, not native PTY input, host deduplication,
Windows/WSL/PowerShell/MSYS launcher forwarding, SSH or remote delivery.
Before: unknown flag, exit 1, zero RPC requests
Recorded at main
1fc24d311481a85d5b4ae596898ee072389f040cforterminal send --terminal term-disposable-fixture --text-stdin --json,with the finite fixture pipe:
{ "id": "local", "ok": false, "error": { "code": "invalid_argument", "message": "Unknown flag --text-stdin for command: terminal send", "data": { "validFlags": [ "enter", "environment", "help", "interrupt", "json", "pairing-code", "retry-request", "terminal", "text", "wait-submit" ], "suggestions": [], "nextSteps": [ "Valid flags: --enter, --environment, --help, --interrupt, --json, --pairing-code, --retry-request, --terminal, --text, --wait-submit" ] } }, "_meta": { "runtimeId": null } }After: exit 0, one terminal.send request, exact text length/hash
Recorded at
1ceed3b5b80da10e856a350183a245dc70ec5762for the sameinvocation and finite input:
{ "id": "84e8be30-86a0-475a-bd57-975f449a39df", "ok": true, "result": { "send": { "handle": "term-disposable-fixture", "accepted": true, "bytesWritten": 89 } }, "_meta": { "runtimeId": "stdin-fixture" } }Captured
textis exactly the 89-byte input;enteris false. The separate--entercase keeps the same text/hash and sendsenter: true. Repeating thesame retry ID sends identical parameters; the fixture's own replay table records
one unique capture, which is not proof of native execution-host deduplication.
Raw before receipt SHA256:
ec72025f81d63bd39505e6864a56c23e433c8df5aea9fc29e1372ddc438c2b82.Raw after receipt SHA256:
dfbb6cbc3aca4c60f2379750d4a18a335130cac07053bd4cda1c2b2c38a26dee.Testing
macOS arm64, Node 24: 153 focused tests, CLI and node/application typechecks,
formatting, changed-code quality, generated-guide freshness and a freshly built
local CLI with an owned bounded local RPC fixture. A separate temporary
combination with five concurrent CLI changes passed 305 tests, CLI typecheck/build,
guide freshness and unique registration/flag preservation; source and index were
restored before the final focused build. Exact-limit unit controls
prove reader/handler acceptance, not 16 MiB transport delivery. Windows, Linux,
native PTY, WSL/PowerShell/MSYS launchers and SSH/remote were not tested; the
existing text field, selectors and host delivery mechanisms are unchanged.
Review
Independent review: CLEAN for commit
1ceed3b5b80da10e856a350183a245dc70ec5762, treebffe9094143bb9d54a778615190ed80b22334c9e, against named main1fc24d311481a85d5b4ae596898ee072389f040c.The verbatim independent verdict, ten-file manifest, ancestry and complete patch
are bound to full-diff SHA256
1d7d7faf6e22911b2bb2c0cbbe0b2e33fa9ab1ec555787eb6560609f35ac76ac.The reviewer independently reran all 153 focused tests, CLI typecheck, changed-code
quality, formatting and guide checks, then verified the source remained unchanged.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Credit: rajpopat27 reported #16113; logii authored the original #12239 commit
dfc937d3eda7ed079901cd9252faf86410f8ec13. That commit and its Claude coauthorare preserved in the branch ancestry. brynnclaw also supplied issue context and
pointed to the original PR. Current main remains the first-parent
source authority; old
terminal.tsandcore.tschanges were adapted to thecurrent extracted modules rather than replayed.
Introduced behavior: stdin waits for EOF, refuses a TTY, decodes UTF-8 and rejects
raw terminal input over 16 MiB without truncation. Malformed UTF-8 retains the
existing replacement-character behavior. Unchanged constraints: the local JSON
RPC cap is 1 MiB including envelope and escaping, so 16 MiB input is not guaranteed
deliverable; newlines/CRLF are neither added nor stripped, a newline can affect
the target program, and
--enteris a separate submit action. Producer/launcherevaluation or encoding is not undone. Remote servers receive the existing text
shape and retain their capability negotiation; folder workspaces and Git
providers retain the existing terminal selectors. Generated guides are refreshed, and the separate compatibility check preserved
concurrent CLI additions. This PR contains only the stdin feature, with no
dependency on those unmerged changes. Merge risk is concentrated in the shared
reader extraction and earlier flag validation; the computer empty/TTY policies,
existing terminal actions and prompt receipts have regression coverage.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)