Feature 57 (config and provisioning): modules declare config and provisions, their files rendered from templates; synced with main (issues of feature 57, 874)

This commit is contained in:
2026-10-16 07:37:43 +00:00
parent 1a2c917abf
commit 9652b2d5ce
771 changed files with 52063 additions and 1774 deletions
+27 -4
View File
@@ -4,6 +4,27 @@
import { registerModuleTools, type ToolDefinition } from "@novox/mesh-sdk/tools";
import { MailuClient } from "../client.js";
import { dockerExec, mailFlows, DEFERRED_BOUND_SECONDS, PUBLIC_NAME, SPREAD_DOMAINS } from "../health.js";
/**
* Whether mail flows (novox/hq ADR 0240, issue 690): the tool the node-engine asks as the smtp container's
* check. It needs no admin API, only the postfix container, so it is served even when the API is not
* configured — a check that vanished with the API would say unhealthy for the wrong reason.
*/
export function getHealthTool(env: NodeJS.ProcessEnv): ToolDefinition {
const container = env.MESH_MAILU_SMTP_CONTAINER || "mailu-smtp";
return {
name: "mailu_health",
description:
`Whether mail flows through mailu, asked inside ${container}: postfix runs; no recipient has waited ` +
`deferred longer than ${DEFERRED_BOUND_SECONDS / 60} minutes on a name-service failure here, and overdue ` +
`deferred mail does not reach ${SPREAD_DOMAINS} or more domains (one or two far domains are said, not ` +
`unhealthy); and ${PUBLIC_NAME} resolves through the resolver postfix uses. Says counts, domains, the ` +
"oldest message's age and its reason (novox/hq ADR 0240, issue 690).",
input: {},
run: async () => mailFlows(dockerExec(), container),
};
}
export function getMailuTools(mailu: MailuClient): ToolDefinition[] {
return [
@@ -143,12 +164,14 @@ export function getMailuTools(mailu: MailuClient): ToolDefinition[] {
];
}
// The tools exist only when the admin API is configured; without it, mailu contributes none rather
// than failing the whole runtime.
// The admin tools exist only when the admin API is configured; without it, mailu contributes only its
// health tool rather than failing the whole runtime.
registerModuleTools("mailu", (env) => {
let tools: ToolDefinition[] = [];
try {
return getMailuTools(MailuClient.fromEnv(env));
tools = getMailuTools(MailuClient.fromEnv(env));
} catch {
return [];
tools = [];
}
return [...tools, getHealthTool(env)];
});