Module state is hq ADR 0202: 0201 landed first for a provider's derivations

This commit is contained in:
jochen
2026-10-04 03:44:56 +02:00
parent 0677cebb9b
commit d937c7bc2f
8 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ function startSession(): Session {
});
const ask = (method: string, params: unknown): Promise<unknown> => askAs(`bundle-${nextOut++}`, method, params);
// The module's state (ADR 0201): each watch's changes arrive as `mesh/state` requests naming the
// The module's state (ADR 0202): each watch's changes arrive as `mesh/state` requests naming the
// watch by the id it was asked with, so its handler is registered under that id before it is asked
// — the current values arrive before the watch itself is answered.
const watches = new Map<string, (change: StateChange<unknown>) => Promise<void>>();
@@ -176,7 +176,7 @@ function startSession(): Session {
return;
}
case "mesh/state": {
// One change to a state this bundle watches (ADR 0201), answered once its handler has taken
// One change to a state this bundle watches (ADR 0202), answered once its handler has taken
// it. The runtime delivers a watch's changes one at a time, in order.
const p = request.params as { watch?: string; change?: StateChange<unknown> } | undefined;
const deliver = p?.watch !== undefined ? watches.get(String(p.watch)) : undefined;