Module-level _serverStarted / ruleRegistry / onClientAuthenticatedCallbacks
reset on hot-reload (new VM context). After hot-reload the second runtime
attempt would hit EADDRINUSE (silently swallowed) while __yonexusServer
was overwritten to point at a transport that never started, making every
sendRule() return false.
- Replace let _serverStarted with _G["_yonexusServerStarted"]
- Store ruleRegistry and onClientAuthenticatedCallbacks under globalThis
keys, initialising only when absent
- Store transport under _G["_yonexusServerTransport"]; sendRule closure
reads it from globalThis instead of a module-local capture
- Re-write __yonexusServer every register() call (updated closures),
but skip runtime.start() when the globalThis flag is already set
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add ruleRegistry and onClientAuthenticated options to YonexusServerRuntime
- Dispatch rewritten rule messages (rule::sender::content) to rule registry
- Guard onClientAuthenticated behind promoteToAuthenticated return value
- Fix transport message handler: use tempConn directly when ws is in temp state,
preventing stale _connections entry from causing promoteToAuthenticated to fail
- Close competing temp connections with same identifier on promotion
- Expose __yonexusServer on globalThis for cross-plugin communication
- Remove auto-failure on admin notification miss; pairing stays pending
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>