Add CultMesh peer snapshot document handles

This commit is contained in:
Meta Vens 2026-06-27 15:56:45 +01:00
commit 1753dfbb92
4 changed files with 284 additions and 0 deletions

View file

@ -330,6 +330,13 @@ unsubscribe();
const pilots = station.collection(playerShipDocument);
const currentPilots = await pilots.latest();
const stopRoster = pilots.watchChanges(change => refreshRoster(change));
const remoteHealth = CultMesh.documentFromPeerSnapshot(
() => daemonPeer,
"gamecult.aetheria.daemon_health.v1",
"daemon:aetheria.health.v1",
);
const health = await remoteHealth.latest();
```
Projected, remote, shared-memory, IPC, WASM, and local-cache documents all use
@ -458,6 +465,15 @@ helpers parse endpoint contact hints and choose authorized peers;
`GameCult.Networking` still owns the RUDP packet codec, session state, resend,
fragmentation, and channel semantics.
TypeScript runtimes can also wrap a CultNet peer snapshot as a normal document
handle with `CultMesh.documentFromPeerSnapshot(...)`. The caller supplies the
peer or peer factory, schema id, and record key; CultMesh sends the snapshot
request, waits for the matching response, decodes the raw MessagePack document,
and returns the same `latest()`/`watch()` document surface used by local cache
and single-file documents. Exact schema ids are preferred, but record-key
publications remain readable when two runtimes alias the same logical document
through different schema names.
### Shard Authority
Each shard has one primary writer for now. Non-primary writes are rejected or