Repository navigation
Adopt the glaze native transport on macOS; dual-transport bridge - #1
Merged
Merged
Conversation
run-app now starts with #:transport 'native on macOS (HACKDIGEST_TRANSPORT overrides; other platforms keep the HTTP adapter until their native runs are verified end to end). The page loads from glaze:// and every call rides the GLZ1 message handler — no TCP port, no token, no loopback API. bridge.ts speaks both transports behind the same interface: - apiPost/hasBackend detect window.__glz1 and route through GLZ1 invoke; without it the old relative-fetch path runs unchanged (vite dev, plain-browser). - streamChat/streamLines keep the backend's line protocol (first line OK or ERR <status> <message>, then raw text / ndjson lines) on both transports — the native channel delivers the handler's bytes verbatim as chunk frames, so one parser serves both. Parser errors cannot throw out of onDelta (the native bootstrap swallows callback exceptions), so LineStreamParser records them and the caller raises after settle. - AbortSignal cancels through glaze.invokeStream's signal support, which rejects immediately and closes the stream server side via the cancel op. Also verified on the machine: the app opens from glaze://, loads real data through the native channel, and survives the React startup burst of invokes with a clean log. Tests: 12 new bridge cases cover both transports — invoke value/error pass-through, per-chunk onDelta, ERR-line handling, ndjson lines split across chunks, and the missing-status-line error.
The native adoption needs GLZ1 streaming, and the typed-descriptor re-exports landed on glaze main after v0.14.0. Revert to a version pin once glaze#63 merges and releases.
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.
What
run-appstarts with#:transport 'nativeon macOS (HACKDIGEST_TRANSPORToverrides; other platforms keep the HTTP adapter until verified). The page loads fromglaze://, every call rides the GLZ1 message handler — no TCP port, no token. Depends on glaze#63 (GLZ1 streaming + FFI-stack discipline) landing first.Bridge
bridge.tskeeps one interface over both transports:apiPost/hasBackenddetectwindow.__glz1and route through GLZ1 invoke; without it, the relative-fetch path runs unchanged (vite dev, plain-browser, HTTP adapter).streamChat/streamLineskeep the backend's wire protocol (first lineOK/ERR <status> <message>, then raw text / ndjson lines) on both transports — the native channel delivers the handler's bytes verbatim as chunk frames, so one parser serves both. Parser errors cannot throw out ofonDelta(the native bootstrap swallows callback exceptions by design), soLineStreamParserrecords them and the caller raises after the stream settles.invokeStream's signal support (immediate reject + server-side cancel op closing the stream pipe).Verified on the machine
The app opens from
glaze://, renders the full UI with real data through the native channel, and survives the React startup burst of invokes with a clean log (this exact burst found two glaze bugs — see glaze#63).Tests
12 new bridge cases over both transports: invoke value/error pass-through, per-chunk
onDelta, ERR-line handling, ndjson lines split across fetch chunks, missing-status-line error. 26 in the suite, plustsc --noEmitandvite buildclean.