nornir-saga — live UI-movement viewer + replay (FEATURE REQUEST, 2026-07-08)
Status: REQUESTED by Rickard — to be implemented by another agent. This file is a durable spec so that agent (and the plan) has the intent. NOT yet built. Njord is off-limits to the current fleet — this module lives in nornir and only observes/replays a saga-enabled Njord; do not modify Njord to add this.
What Rickard asked for (verbatim intent)
"I want a nornir-saga UI module to view live UI movements from a saga-enabled
njord… and later replay the UI movements so it actually moves on the web pages."
The feature, unpacked
A new nornir module/crate — nornir-saga — with two modes over the same recorded "saga" of UI interaction events:
-
LIVE view. A saga-enabled Njord emits a stream of UI-movement events (pointer moves/clicks, focus changes, navigation, scroll, field edits, route transitions — the user's actual motion through the web UI).
nornir-sagasubscribes to that live stream and renders the movements live (a viewer that shows, in real time, what the UI is doing / where the user/agent is moving). -
REPLAY. Persist the saga, then replay the recorded UI movements so the web page actually moves — i.e. deterministically drive the real web UI to reproduce the captured motion (cursor travels, clicks fire, pages navigate), not just a passive timeline. Think "robot replay" of a recorded session that re-animates the live DOM/pages.
Design notes / open questions for the implementing agent
- Event model / transport: define the saga UI-event schema (a serde model, the nornir way — model-is-the-contract). How does Njord emit it (the "saga-enabled" half is a Njord change Rickard will coordinate separately — NOT ours)? nornir-saga consumes it (live socket/SSE + a persisted event log; reuse the warehouse or an event stream if it fits).
- Live viewer: likely an egui/robotui or a web (axum+SSE) frontend — mirror the knut-pipelines viewer pattern (one model, CLI/GUI/web frontends over a
Sink). - Replay driver: to make the web page actually move, the replay must drive a real browser/DOM (a WebDriver/CDP-style or in-page injected driver that dispatches the recorded pointer/click/nav events against the live pages). Deterministic, time-scaled, seekable.
- Reuse: the nornir robot/robotui harness already drives egui headless + asserts
state_json; the saga replay is the "drive real UI from a recorded script" generalization of that idea onto the web target.
ELM? — YES, and it's the key to clean capture + replay (Rickard asked)
-
Viewer + replay-control UI = ELM. Build them with the constellation's
facett-coreElm(Model/Msg/update/view) so they're consistent and robot-testable viastate_json(matches the ELM×robot doctrine everything was just swept onto). -
The deeper reason ELM matters: if Njord's web UI is Elm-architected, then the saga IS the ordered
Msgstream (± Model/state_jsonsnapshots). All three modes fall out of that:- READ — nornir-saga consumes Njord's saga as a
Msg+ state log. - LIVE — fold the
Msgstream into a viewer Model, render the motion live. - REPLAY (page actually moves) — re-dispatch the recorded
Msgs through the Elmupdate/view. Deterministic, seekable, time-scalable — you're replaying the exact events the UI originally reacted to.
- READ — nornir-saga consumes Njord's saga as a
-
Two replay targets to move the real webpage: (a) feed the
Msgs back into a live Elm Njord web instance (cleanest — needs Njord's Elm runtime to expose a replay/Msg-injection hook); (b) synthesize real pointer/DOM events (WebDriver/CDP) ifMsginjection isn't available. -
This is the web-target generalization of the existing nornir robot/robotui harness (which already drives egui headless from a recorded script + asserts
state_json).
Njord-side coordination (NOT ours — for the agent who extends Njord)
Njord already has a saga feature branch, but it "doesn't know about this feature yet" (Rickard) — its saga almost certainly captures a state/business saga, not UI movements. To feed nornir-saga, Njord's saga must ALSO log the Elm Msg stream (pointer / click / nav / focus / scroll Msgs) and allow re-injection on replay. Do not touch Njord until Rickard says so — this is a coordination note for whoever extends the Njord saga branch.
Boundaries
- Build the viewer + replay in nornir (
nornir-saga), on the shared ELM/Msgcontract. The saga-enabled Njord emitter side is Rickard's separate ask to another agent — do not touch Njord until he says so.