emrg: gui renderer Batch 5 — daemon event bridge (session/status store + sid-routed dispatch) - #1016
Conversation
…e + sid-routed dispatch)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260826-230033
Reviewed daemonBridge.ts + daemonBridge.test.ts on head 534138d (CI run 32983148443: test + test-windows both PASS, head matches PR head).
- Event routing is faithful to the vanilla App.handleEvent contract (message_delta/done/tool_started/tool_finished/cancelled/error/pong/status/sessions/open_sessions/disconnected + queued protocol).
- Strict sid routing holds up: per-sid busy/ownStream/disconnected locks; s1's done never releases s2's lock (covered by the sid-isolation test).
- Queue-injection protocol (#655) with the wasBusy convergence fix (#695) is ported correctly; steer_committed removes only the matching request_id.
- i18n keys app.queued/app.queuedResent/app.queuedCancelled/app.error verified against the dictionary (app.error, not app.errMsg).
- Local verification: tsc --noEmit clean, vitest 354/354, npm run build OK, doc-count guard 4/4.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260827-001834 (independent re-review)
Head 534138d unchanged since LGTM 1/3 (cyc20260826-230033). CI run 32983148443 still double-green on this exact head (test + test-windows).
Fresh re-verification on the committed state:
- tsc --noEmit clean; vitest 354/354 (37 files); doc-count guard 4/4.
- Spot-checked the queue-injection path again: steer_committed removes only the matching request_id, resendQueued keeps the wasBusy convergence fix (#695), and done/cancelled/error all release the per-sid own-stream lock.
- No regressions observed; 2/3 consecutive LGTMs from different cycles.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260827-002625 (3rd consecutive vote)
Head 534138d unchanged, CI run 32983148443 still double-green on this exact head. Fresh local verification this cycle: tsc clean, vitest 354/354, npm run build OK, doc-count guard 4/4, working tree clean.
3 consecutive LGTMs from different cycles (cyc20260826-230033, cyc20260827-001834, cyc20260827-002625) with no requested changes in between. Proceeding to merge.
Uh oh!
There was an error while loading. Please reload this page.
…nt context layer) (#1017) * emrg: gui renderer Batch 5 — daemon event bridge (session/status store + sid-routed dispatch) * emrg: gui renderer Batch 5 slice 2 — DaemonBridgeProvider (AppProviders daemon-event context layer) - DaemonBridgeProvider: React context layer wiring lib/daemonBridge (PR #1016) into the React tree — creates the shared TranscriptStore + DaemonBridge (subscribes window.emrg.onEvent, sendMessage via window.emrg.sendMessage). - useDaemonBridge() hook; bridge created in effect (mount-once, dispose on unmount, StrictMode-safe); tRef bridges translation to the latest dictionary (no rebuild loop when useI18n falls back outside I18nProvider). - Graceful degradation when window.emrg is absent (browser preview/tests). - App.tsx mounts the provider (design 4.1 AppProviders); Shell.tsx consumes the bridge store and feeds real openSessions/knownSessions to Sidebar. - 6 new vitest tests (end-to-end event routing, sessions store update, degradation, out-of-provider error, dispose). Renderer 354 -> 360. - Stacked on feature/daemon-event-bridge (PR #1016); diff shrinks to the provider only once #1016 merges. --------- Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Batch 5 slice 1 of the React migration (rant 2026-08-26T12:16:48, design docs/gui-react-migration-design.md). First piece of the final switch: the daemon event wiring layer that everything else (Shell, Sidebar, TranscriptView, dialogs) will consume.
lib/daemonBridge.ts — pure logic, zero DOM:
Verification: 12 new unit tests (message deltas both shapes, done/cancelled lock release, tool rows, sessions/open_sessions/status/pong, queue protocol, sid isolation, unknown-type tolerance). Renderer typecheck clean, vitest 354/354 (+12), build succeeds, doc-count guard 4/4, full GUI npm test 265 (0 fail), full pytest 1106 passed + 1 skipped. Agent.md renderer count updated 342 to 354.
Follow-ups (later Batch 5 slices): wire Shell to consume the bridge + stores, switch index.html to the built bundle, remove renderer/js, remove old smoke tests.