Files
mesh-sdk/test/fixtures/stdio-keeps.mjs
T
jschoubben 57d2f31f05 Let a module's code announce the states it keeps, in Go and TypeScript (issue 1790, S10, ADR 0495 §2 §5)
process.Conn.Keeps, stdio.Keeps and the TypeScript keeps publish the announcement on
the module's own subject; afterwards a state the code did not announce is refused at
the call, so announcement and code cannot drift. The package goes to 0.1.15 for keeps.
2026-10-22 17:42:24 +02:00

12 lines
670 B
JavaScript

// A launched bundle that says what it keeps (novox/hq ADR 0495 clause 2; issue 1790): it announces its states as it is
// imported, and a state of its own it did not announce is refused at the call.
import { keeps, state } from "../../dist/state/index.js";
import { registerModuleTools } from "../../dist/tools/index.js";
import { serveRegisteredOverStdio } from "../../dist/stdio/index.js";
await keeps([{ name: "servers", readable: true }, { name: "own" }]);
registerModuleTools("keeper", () => [
{ name: "unannounced", description: "reads a state it did not announce", input: {}, run: async () => state("drafts").get("k") },
]);
await serveRegisteredOverStdio();