cursorEnvelope
A cursor-envelope response for observable list routes (the wire protocol's live-polling shape): {"cursor":..,"status":..,("items":[..],)?(,"state":..)?}.
The status is derived by checking clientCursor — the cursor the client echoed back, typically request.queryParam("cursor") — against currentSequence, the server's current change sequence: absent, undecodable, or foreign cursor → reset; equal → unchanged (items omitted); anything else → delta. For reset and delta, appendItems writes the comma-separated JSON array elements (the enclosing "items":[...] is emitted by this factory); per the envelope contract the items always carry the full authoritative list. A non-null state must be a valid JSON value and is appended verbatim as the envelope's state member.
Advance the sequence whenever the list changes, and only then: every advance re-sends the whole list to every poller. Observable state that isn't part of the list belongs in state, which is sent with every response, unchanged ones included.
epoch identifies the store that counts currentSequence; a cursor issued under any other epoch is foreign. That keeps a restarted store from answering unchanged to a client still holding a cursor from before the restart once its new sequence catches up. The default is picked once per process, which covers app restarts. A store that can be recreated within a process should pick its own when it's created, for example with Random.nextLong().
This factory implements snapshot-list semantics only. For a route with append-stream semantics (e.g. a log tail, where a poll returns only the entries after the cursor), use streamEnvelope.