Skip to content

feat(sandbox): support streaming stdin in runFS#363

Open
snowyu wants to merge 3 commits into
taybenlor:mainfrom
snowyu:feat/stream-stdin
Open

feat(sandbox): support streaming stdin in runFS#363
snowyu wants to merge 3 commits into
taybenlor:mainfrom
snowyu:feat/stream-stdin

Conversation

@snowyu

@snowyu snowyu commented Feb 7, 2026

Copy link
Copy Markdown

This PR adds support for streaming stdin (AsyncIterable, ReadableStream, and factory functions) to runFS and runCode.

Key improvements:

  • Unified stdin handling logic
  • Timeout and error propagation for streams
  • UTF-8 safe chunking to prevent corruption at boundaries
  • Backpressure support via SharedArrayBuffer synchronization
  • Comprehensive tests for edge cases and stress scenarios

Closes #362

- Extend runFS to accept AsyncIterable, ReadableStream, or factory functions for stdin.
- Implement UTF-8 safe chunking logic to prevent character corruption when splitting large inputs across buffer boundaries.
- Refactor runFS to utilize WASIWorkerHost directly for asynchronous stdin streaming.
- Add comprehensive unit tests covering various streaming scenarios, large payloads, and multi-byte UTF-8 character safety.
…te a new `langs` directory inside the existing one.
…nd backpressure support

- Unify stdin handling logic for both string and stream inputs in runFS.
- Add timeout support and error propagation for streaming stdin.
- Improve WASIWorkerHost with isRunning state to prevent hangs during worker termination.
- Implement UTF-8 safe chunking and filter empty chunks to prevent premature EOF.
- Add comprehensive stress tests for backpressure and factory functions.
- Update README with streaming stdin documentation and examples.
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.

Support streaming stdin for runFS / runCode (AsyncIterable / ReadableStream / Node Readable)

1 participant