S3 ask-once-ts: the TypeScript stdio asks once; the kind stopping goes
Builds: design 47 H2 H-A-570 (2) (3) (4)
This commit is contained in:
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// A launched bundle whose one tool asks a seat's verb through the runtime, and says how the ask ended: its answer, or the
|
||||
// words of its fault (design 47 H2 H-A-570 (2), (4)).
|
||||
import { broker } from "../../dist/messaging/index.js";
|
||||
import { registerModuleTools } from "../../dist/tools/index.js";
|
||||
import { serveRegisteredOverStdio } from "../../dist/stdio/index.js";
|
||||
|
||||
registerModuleTools("builder", () => [
|
||||
{ name: "publish", description: "asks the registry", input: {}, run: async () => {
|
||||
try {
|
||||
return { answer: await broker().request("seat:go-package-registry.publish", {}) };
|
||||
} catch (err) {
|
||||
return { words: err.message };
|
||||
}
|
||||
} },
|
||||
]);
|
||||
await serveRegisteredOverStdio();
|
||||
Vendored
-24
@@ -1,24 +0,0 @@
|
||||
// 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();
|
||||
Reference in New Issue
Block a user