runtime: portable device runtime for Axis Browser Direct#30
Merged
Conversation
…age backends, browser router Extract everything a browser needs to run ForgeFX in-page (Axis Browser Direct) while keeping the Fastify HTTP API byte-compatible: - drivers/registryCore.ts: DeviceRegistry + createRegistry(deps) with all Node transport behavior injected via RegistryDeps; drivers/registry.ts stays the singleton wiring with the real serial/MIDI/connection deps - runtime/storeBackend.ts + fsStoreBackend.ts + memStoreBackend.ts: store.ts becomes backend-agnostic policy (createStore(backend, codec)); fs backend is byte-identical to the classic ~/.axis layout - runtime/folderAdapter.ts + fsFolderAdapter.ts + localFolder.ts + localService.ts: local storage folder logic over an async adapter with relative-path traversal guards; localStore.ts is thin Fastify glue - runtime/handlers.ts + services.ts: app.ts handler bodies shared between Fastify routes and the runtime router - runtime/cloud.ts: Cloud parameterized as createCloud(cfg, store); cloud.ts keeps the env-bound singleton behavior - runtime/router.ts + index.ts: dependency-injected (method, path, body) dispatcher covering the full Axis endpoint inventory, events via subscribe() instead of SSE; exported as forgefx-server/runtime - test/api/router.test.ts: 54 app↔router parity twins over one fake-FM3 registry; scripts/check-browser-safe.ts (esbuild platform:browser) chained into npm test
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.
Extract everything a browser needs to run ForgeFX in-page (Axis Browser Direct) while keeping the Fastify HTTP API byte-compatible:
drivers/registryCore.tsholdsDeviceRegistry+createRegistry(deps)with all Node transport behavior injected (RegistryDeps);drivers/registry.tsstays the singleton wiring over the real serial/MIDI/connection modulesstore.tsbecomes backend-agnostic policy (createStore(backend, codec)); the fs backend is byte-identical to the classic~/.axislayout; in-memory backend for tests/browser mirrorsFolderAdapterwith relative-path traversal guards;localStore.tsis thin Fastify glueruntime/router.ts: dependency-injected(method, path, body)dispatcher covering the full Axis endpoint inventory; events viasubscribe()instead of SSE; shared handler bodies (runtime/handlers.ts) keep both surfaces identicalcreateCloud(cfg, store)(supabase-js is isomorphic); env-bound server singleton unchangedforgefx-server/runtimesubpath export;scripts/check-browser-safe.ts(esbuildplatform:'browser') chained intonpm testtest/api/router.test.ts: 54 app↔router twins over one fake-FM3 registry (byte-parity on bodies, incl. version.syxand/local/*over a temp root)All 9 suites green; server 0.5.0-beta. Requires forgefx-midi ≥ 0.2.0 (merged: sKuhLight/forgefx-midi#1).
Known intentional divergence:
POST /remote/enableanswers 503 in the router — a browser tab is never the Realtime relay host.