Files
mesh-sdk/test/fixtures/stdio-emits.mjs
T
jochen fdd5c58a87 A launched tool emits through its runtime, and calls run beside the stdio loop (hq ADR 0193)
A launched bundle holds no bus connection. The stdio loop binds a broker whose publish asks the
runtime (mesh/publish) and resolves when the runtime has published; asking, answering and
subscribing are refused by name. Tool calls run beside the loop, so a tool awaiting the runtime's
answer to its emit does not deadlock the line that carries it. 0.1.5.
2026-10-03 21:12:14 +02:00

9 lines
508 B
JavaScript

// A launched bundle whose tool emits (novox/hq ADR 0193): the emit travels to the runtime over stdio.
import { registerModuleTools } from "../../dist/tools/index.js";
import { emit } from "../../dist/events/index.js";
import { serveRegisteredOverStdio } from "../../dist/stdio/index.js";
registerModuleTools("chime", () => [
{ name: "ring", description: "rings and says so", input: {}, run: async () => { await emit("rang", { times: 1 }); return { rang: true }; } },
]);
await serveRegisteredOverStdio();