feat: skeleton for in browser swactor engine #35

Merged
zacheryasc merged 6 commits from in-browser into master 2026-02-13 13:27:35 +00:00
Owner

Skeleton up for a web browser swactor engine that is capable of connecting with a cluster.

Skeleton up for a web browser swactor engine that is capable of connecting with a cluster.
zacheryasc added 5 commits 2026-02-13 13:25:30 +00:00
Research phase for browser-native swactor runtime:
- constraints.md: wasm-threads (SharedArrayBuffer), Rust-only actors,
  COOP/COEP required, no new modules in src/
- research_synthesis.md: P0-P4 priority ranking, platform dependency
  analysis, ecosystem comparison (Lunatic, wasmCloud, Actix)
- 6 feature-stage docs: platform abstraction → single-worker →
  multi-worker parallelism → feature parity → transport → DX
- Key decision: SharedArrayBuffer + wasm-threads over postMessage
  isolation (swactor's shared-memory architecture demands it)

Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
Core swactor now compiles for wasm32-unknown-unknown:
- Added `wasm` feature flag (bundles no_random + web-time)
- Platform-aware Instant: web_time::Instant on wasm, std::time on native
- cfg-gated Runtime::run() and RuntimeHandle (thread::spawn unavailable
  on wasm32 — browser crate provides Web Worker-based alternative)
- Validated: crossbeam-queue, atomics, Mutex, RwLock, thread parking all
  work on wasm32 with atomics target feature
- Updated crates/wasm/ to use new `wasm` feature

Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
Evolved crates/wasm/ from hardcoded PoC to a generic browser runtime:
- WasmRuntime: wraps Runtime, provides tick/send/stop/stats/inbox creation
- WasmAddr: opaque actor address handle for JS (replaces fragile indices)
- WasmInboxU32, WasmInboxBytes: typed inboxes for receiving actor results
- Free-standing spawn_counter/spawn_relay demonstrate the actor pattern
- 10 Node.js tests pass (accumulator, relay, multi-counter, stop, bytes)

Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
Enable naming, groups, watching, and stats in the browser runtime.
Fix core watching gap: StopSignal deaths now trigger WatchRegistry
notifications. Add register_name to RuntimeNaming trait. Cfg-gate
getrandom in router.rs for wasm builds. 30 Node.js tests pass.

Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
zacheryasc added 1 commit 2026-02-13 13:27:12 +00:00
zacheryasc merged commit b4312676a6 into master 2026-02-13 13:27:35 +00:00
zacheryasc deleted branch in-browser 2026-02-13 13:27:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: zacheryasc/swactor#35
No description provided.