// kometa's tools — its own code (novox/hq ADR 0039), importing kometa's client. Kometa runs on a // schedule and has no API, so the tools read what it leaves behind. Two tools, the example to // extend: what it ran with, and how its last runs went. import { registerModuleTools, type ToolDefinition } from "@novox/mesh-sdk/tools"; import { KometaClient } from "../client.js"; export function getKometaTools(kometa: KometaClient): ToolDefinition[] { return [ { name: "kometa_status", description: "Kometa's last runs: the newest logs it wrote and their last lines.", input: { runs: { type: "number", description: "how many runs, newest first (default 3)" }, tail: { type: "number", description: "lines per run (default 20)" }, }, run: async (args) => { const runs = kometa.runs(args.runs ? Number(args.runs) : 3, args.tail ? Number(args.tail) : 20); return { count: runs.length, runs }; }, }, { name: "kometa_config", description: "The config.yml kometa runs with, credentials redacted.", input: {}, run: async () => ({ config: kometa.config() }), }, ]; } // Only exposed when the config dir is there; otherwise kometa contributes no tools rather than // failing the whole runtime. registerModuleTools("kometa", (env) => { try { return getKometaTools(KometaClient.fromEnv(env)); } catch { return []; } });