G A-17 (corrected): mesh-sdk names no seat; WriterConfig.Asked and the TypeScript writer's asked are the subject of findings-asked, given from the seat's generated contract

views.FindingsAskedSubject, views.FindingsAskedEvent and FINDINGS_ASKED_EVENT are gone; the stdio writer subscribes the seat event
the given subject names.

Builds: design 47 G A-17, A-13, §461
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 21:58:38 +01:00
parent 948cc1b34e
commit 24f876a348
7 changed files with 59 additions and 37 deletions
+5 -5
View File
@@ -3,13 +3,11 @@
// working on their wire form, with no layout of a finding of its own (design 47 G A-3, §640). It keeps an observer's findings in its own state
// `findings` and says them as events (§383, §384). It names the four events itself (design 47 G A-13, A-17): it says
// `finding-written`, `finding-cleared` and `findings-stated` by their names, which the runtime publishes on the subject the
// module's membership names for each, and hears `findings-asked` as the seat mesh-conditions' event; a module passes none.
// module's membership names for each; the event `findings-asked` is the seat's and is given as `asked` (A-17: mesh-sdk names no seat).
// Its acts, `write`, `clear` and a statement, run one at a time in the order they are asked, on one chain of promises.
import type { State } from "../state/index.js";
/** The event `findings-asked` is always the seat mesh-conditions' (design 47 G A-17), named with that seat. */
export const FINDINGS_ASKED_EVENT = "mesh-conditions.findings-asked";
/** The events the writer says, by their names (design 47 G §383, A-13). */
export const FINDING_WRITTEN_EVENT = "finding-written";
export const FINDING_CLEARED_EVENT = "finding-cleared";
@@ -94,6 +92,8 @@ export interface WriterOptions<F extends FindingFields, C extends object, S exte
module: string;
/** The observer's own state `findings`. */
state: State<F>;
/** The event the writer hears `findings-asked` as: the seat's, which the module fills from the seat's generated contract (design 47 G A-17). */
asked: string;
/** The finding kinds this writer owns (design 47 G §580): a write or clear of another kind is refused, naming it, and a statement carries them as `kinds` and deletes only keys of them. None: every kind. The views reader's kinds are always its own besides. */
kinds?: string[];
/** The findings the observer observes now and its pending keys. It is called inside the writer's one chain: it must not call `write` or `clear`. */
@@ -174,7 +174,7 @@ export class Writer<F extends FindingFields, C extends object, S extends object,
try {
await this.listen();
} catch (e) {
this.log(`error: the finding writer could not make its consumer of ${FINDINGS_ASKED_EVENT} again: ${e}`);
this.log(`error: the finding writer could not make its consumer of ${this.o.asked} again: ${e}`);
}
this.request("");
}
@@ -188,7 +188,7 @@ export class Writer<F extends FindingFields, C extends object, S extends object,
}
private async listen(): Promise<void> {
const stop = await this.o.listen(FINDINGS_ASKED_EVENT, (body) => this.heard(body));
const stop = await this.o.listen(this.o.asked, (body) => this.heard(body));
this.stop?.();
this.stop = stop;
}