15 Commits

Author SHA1 Message Date
4adb187331 fix: migrate startup guard and shared state to globalThis
Module-level _clientStarted / ruleRegistry / onAuthenticatedCallbacks
reset on hot-reload (new VM context), causing a second runtime to start
and the exposed __yonexusClient API to point at orphaned objects.

- Replace let _clientStarted with _G["_yonexusClientStarted"]
- Store ruleRegistry and onAuthenticatedCallbacks under globalThis keys,
  initialising only when absent (survives hot-reload)
- Store runtime under _G["_yonexusClientRuntime"]; sendRule / submitPairingCode
  closures read it from globalThis instead of capturing a module-local ref
- Re-write __yonexusClient every register() call so closures stay current,
  but skip runtime.start() when the globalThis flag is already set

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 20:41:27 +01:00
8824e768fb feat: wire rule registry and authenticated callback into client runtime
- Add ruleRegistry and onAuthenticated options to YonexusClientRuntime
- Dispatch non-builtin messages to rule registry
- Fire onAuthenticated callback on auth_success
- Reload persisted state on reconnect so externally-written secrets are picked up
- Re-send hello on auth_failed("not_paired") when client has a valid secret
- Always enter waiting_pair_confirm after pair_request regardless of notification status
- Expose __yonexusClient on globalThis for cross-plugin communication
- Wire onStateChange in transport creation (previously missing, prevented connection)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 20:14:57 +01:00
nav
57b53fc122 Fix strict TypeScript checks for client 2026-04-09 04:38:03 +00:00
nav
ddeed9a7b7 Harden client reconnect and protocol guards 2026-04-08 23:03:54 +00:00
nav
07c2438fb8 feat: add client rule registry 2026-04-08 22:39:49 +00:00
nav
58818e11d1 Implement heartbeat send and re-pair trust reset 2026-04-08 22:35:02 +00:00
nav
5ca6ec0952 feat: add client auth request flow 2026-04-08 22:04:44 +00:00
nav
cec59784de feat: handle client pairing messages 2026-04-08 21:38:43 +00:00
nav
fc226b1f18 feat(client): add keypair generation 2026-04-08 21:34:38 +00:00
nav
fb39a17dbb Add client runtime and hello handshake 2026-04-08 21:13:16 +00:00
nav
bc3e931979 Add client WebSocket transport 2026-04-08 21:05:12 +00:00
nav
2148027a41 feat(client): add local trust material state store 2026-04-08 20:33:25 +00:00
nav
1d751b7c55 feat: add client config validation 2026-04-08 20:03:28 +00:00
nav
c2bdb2efb6 feat: scaffold yonexus client plugin 2026-04-08 19:33:32 +00:00
nav
5234358cac create initial project skeleton 2026-04-01 18:11:04 +00:00