Add HTTY transport support and refactor environment layer#5
Merged
Conversation
f643323 to
c3b14d7
Compare
- Add `Async::HTTY` transport support: when `ENV["HTTY"] == "1"`, the
server runs over a terminal side-channel instead of a TCP socket.
- Refactor environment modules into focused layers:
- `Lively::Environment::Middleware` — shared application/asset stack
- `Lively::Environment::HTTP` — Falcon TCP transport + Middleware
- `Lively::Environment::HTTY` — HTTY transport + Middleware
- `Lively::Environment::Application` — multiplexes via `make_service`,
using the new `Async::Service::Generic#make_service` hook (requires
async-service ~> 0.23)
- Force `Async::Container::Threaded` in `bin/lively` — no forking needed
for a single-user dev tool.
- Fix `Live.js` WebSocket URL construction to handle `htty:` scheme,
mapping it to `ws:` alongside the existing `http:` → `ws:` mapping.
- Fix `Lively::Assets` missing `require "uri"` (was implicit via Falcon).
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
c3b14d7 to
3320777
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Async::HTTYtransport support — whenENV["HTTY"] == "1",bin/livelyserves over a terminal side-channel (stdin/stdout) instead of a TCP socket, enabling tools like htty.dev to host Lively apps in the terminal.Middleware,HTTP,HTTY,Application) and uses the newmake_servicehook fromasync-service ~> 0.23to multiplex transports via explicit, overridable evaluator keys rather thanModule#includedhooks.Async::Container::Threadedinbin/lively— no process forking needed for a single-user dev tool.Live.jsWebSocket URL scheme handling to supporthtty:→ws:alongside the existinghttp:→ws:mapping.Lively::Assetsmissingrequire "uri"(was previously implicit via Falcon).Test plan
HTTY=1 lively examples/hello-world/application.rb— verify app serves over HTTYlively examples/hello-world/application.rb— verify normal Falcon path still worksdef htty = falseforces HTTP even withHTTY=1setMade with Cursor