// A launched bundle whose module code runs long (novox/hq ADR 0198): it subscribes as it is imported, // before it says what it serves — exactly as a handler module's index does — and one tool asks the bus. import { on } from "../../dist/events/index.js"; import { broker } from "../../dist/messaging/index.js"; import { registerModuleTools } from "../../dist/tools/index.js"; import { serveRegisteredOverStdio } from "../../dist/stdio/index.js"; await on("alpha.happened", async (e) => { process.stderr.write(`handled ${e.type} ${JSON.stringify(e.body)}\n`); if (e.body && e.body.fail) throw new Error("not this one"); }); registerModuleTools("watcher", () => [ { name: "relay", description: "asks beta", input: {}, run: async () => broker().request("beta.one", { x: 1 }) }, ]); await serveRegisteredOverStdio();