Written so the module system has something that proves itself rather than a claim about what it supports, and guarded by a test in the catalogue's own suite so it cannot quietly stop exercising things. Nine of the host's eleven resource kinds, all three artifact kinds including the one that compiles, all three ways a module's code can run, and all four things that code can be: tools, an event consumer, a provisioner, and processes. Two absences that are findings rather than gaps. `action` is refused to modules outright — the link may not carry a command to run (ADR 0005), so a module that needs something done ships a program that reconciles, which is what a run-once process is. `service` puts an EXISTING unit into a state and installs none, which is right for software shipping its own; code the mesh built has no unit until the mesh writes one, and that is a process. And it no longer picks its own port. ADR 0038 says a module cannot know what else is on the machine it was assigned to, and names exactly the trap this fell into: the number written three times — listens, serves, a container's ports — agreeing only because one person wrote all three, with nothing checking. So it says what it needs and the mesh assigns the number. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
26 lines
854 B
TypeScript
26 lines
854 B
TypeScript
// showcase's tools — its operator-facing surface, served over the broker.
|
|
//
|
|
// Two of them, because one tool proves a tool can exist and two prove a module can have a surface.
|
|
import { tool } from "@novox/mesh-sdk/tools";
|
|
|
|
tool({
|
|
name: "showcase_greet",
|
|
description: "Greet somebody, and say which machine did it.",
|
|
input: { type: "object", properties: { who: { type: "string" } } },
|
|
async run({ who }: { who?: string }) {
|
|
return { greeting: `hello ${who ?? "world"}`, from: process.env.MESH_NODE ?? "somewhere" };
|
|
},
|
|
});
|
|
|
|
tool({
|
|
name: "showcase_state",
|
|
description: "What this module was configured with, so a test can read it back.",
|
|
input: { type: "object", properties: {} },
|
|
async run() {
|
|
return {
|
|
greeting: process.env.SHOWCASE_GREETING ?? "",
|
|
database: process.env.SHOWCASE_DATABASE ?? "",
|
|
};
|
|
},
|
|
});
|