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.
9 lines
508 B
JavaScript
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();
|