Repository navigation
fix(sdk): support sending input through the PTY handle - #1502
mishushakov wants to merge 5 commits into
Conversation
Wire up `handle_send_stdin`/`handleSendStdin` on the handle returned by `pty.create()`/`pty.connect()` across the JS and Python (sync + async) SDKs, so `handle.send_stdin(...)`/`handle.sendStdin(...)` works the same as for regular command handles instead of raising "Sending stdin is not supported for this command handle." PTY input methods now also accept `str`, encoding it as UTF-8. In the JS SDK, `pty.sendStdin()` is added as the canonical PTY input method to mirror `commands.sendStdin()`, with `pty.sendInput()` kept as a deprecated alias. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: e3d87e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit e3d87e7. Bugbot is set up for automated code reviews on this repo. Configure here. |
Package ArtifactsBuilt from 3b97b0d. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-dockerfile-utils-0.1.3-mishushakov-pty-send-stdin-error.0.tgz ./e2b-2.64.1-mishushakov-pty-send-stdin-error.0.tgzCLI ( npm install ./e2b-cli-2.24.1-mishushakov-pty-send-stdin-error.0.tgzCode Interpreter JS SDK ( npm install ./e2b-code-interpreter-2.9.2-mishushakov-pty-send-stdin-error.0.tgzDesktop JS SDK ( npm install ./e2b-desktop-2.5.1-mishushakov-pty-send-stdin-error.0.tgzPython SDK ( pip install ./e2b_dockerfile_utils-0.1.2+mishushakov.pty.send.stdin.error-py3-none-any.whl ./e2b-2.64.0+mishushakov.pty.send.stdin.error-py3-none-any.whlCode Interpreter Python SDK ( pip install ./e2b_code_interpreter-2.11.10+mishushakov.pty.send.stdin.error-py3-none-any.whlDesktop Python SDK ( pip install ./e2b_desktop-2.7.2+mishushakov.pty.send.stdin.error-py3-none-any.whl |
Addresses PR review: the CLI was the one internal consumer still calling the now-deprecated `pty.sendInput`, which would emit a self-inflicted deprecation warning. Switch it to the canonical `pty.sendStdin` (identical behavior, the alias just delegates). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…stdin-error # Conflicts: # packages/python-sdk/e2b/sandbox_async/commands/pty.py # packages/python-sdk/e2b/sandbox_sync/commands/pty.py
|
My reluctance here is that we don't feed the input to the process stdin, so I didn't want to name it stdin. Also the output is not called stdout (the same case), so the symmetry is already broken. Might make sense to have both for compatibility, but does not feel very clean then. |
|
@ValentaTomas I would settle on one name, in that case as far as I understand, sendInput would be the correct one? |
PTYs have no stdin, so PTY input is exposed as sendInput/send_input: - JS: keep pty.sendInput as the canonical method (drop the sendStdin rename), accept strings, add CommandHandle.sendInput for PTY handles. - Python: add pty.send_input, keep pty.send_stdin as a deprecated alias, add CommandHandle.send_input for PTY handles (sync + async). - send_stdin/sendStdin on a PTY handle now points to send_input/sendInput. - CLI takes main's streamInput-based terminal input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
Summary
Calling
send_stdin/sendStdinon the handle returned bypty.create()/pty.connect()raised "Sending stdin is not supported for this command handle". A PTY has no stdin; input goes to the terminal. So instead of wiring up stdin, this PR adds a dedicatedsend_input/sendInputto the handle for PTYs, across the JS and Python (sync + async) SDKs:handle.sendInput()/handle.send_input(), available only on PTY handles. Callingsend_stdin/sendStdinon a PTY handle now raises an error that points tosend_input(). Callingsend_inputon a regular command handle points tosend_stdin().sandbox.pty.send_input()is added (matching the JSsandbox.pty.sendInput()).sandbox.pty.send_stdin()is kept as a deprecated alias.sandbox.pty.sendInput()stays the canonical method (no rename).str, encoded as UTF-8.Usage
Tests
commandHandle.test.ts, Pythontest_command_handle.py) cover input routing on PTY handles and the error messages that point to the right method.send_input/sendInput, with handle-level andstr-input cases, plus a Python test for the deprecatedpty.send_stdinalias.🤖 Generated with Claude Code