Files
mesh-sdk/test/fixtures/stdio-stopping.mjs
T
jschoubben 07bfc71c33 stdio (TypeScript): the ask's bound is the setting ask-bound; the pause has a seam (H-A-549)
Review round 1: the bound of asking again while the tool runner is stopping is the
setting ask-bound (default 60 s), and the pause and the clock are askPacing, which
the test replaces as the Go test does pause and askNow, so nothing sleeps. Rows
added: past the bound the fault is the caller's, a bare timeout stays a failure.

Builds: design 47 H2 H-A-542, H-A-544, H-A-549
2026-11-23 12:05:15 +01:00

25 lines
1.0 KiB
JavaScript

// A launched bundle whose one tool asks a seat's verb through the runtime, and says how the ask ended: its answer, or
// whether its fault was the typed fault stopping, and the pauses between its asks (design 47 H2 H-A-542, H-A-544,
// H-A-549). Its pause moves a clock instead of sleeping.
import { broker } from "../../dist/messaging/index.js";
import { registerModuleTools } from "../../dist/tools/index.js";
import { serveRegisteredOverStdio, isStopping, askPacing } from "../../dist/stdio/index.js";
let clock = 0;
let paused = [];
askPacing.now = () => clock;
askPacing.pause = async (ms) => { paused.push(ms); clock += ms; };
registerModuleTools("builder", () => [
{ name: "publish", description: "asks the registry", input: {}, run: async () => {
clock = 0;
paused = [];
try {
return { answer: await broker().request("seat:go-package-registry.publish", {}), paused };
} catch (err) {
return { stopping: isStopping(err), words: err.message, paused };
}
} },
]);
await serveRegisteredOverStdio();