Files
Void-Homelab/lib/ai/agent/tools/blue/infra_audit.js
root b0b23ba05d feat(infra): commit live infra-audit/cluster work to reconcile git with prod
This work (network_hosts inventory + infra_audit MCP tool, /api/cluster +
Sacred Valley cluster card, topbar cluster-health pill + SW self-heal) was
built in an earlier session and DEPLOYED to CT 311 as alpha.24–26, but was
never committed to git — prod was running code absent from the repo. Commits
it as-is (already prod-validated) so git matches the live state, and restores
its alpha.24/25/26 CHANGELOG entries. Files are disjoint from the fold-in
work; both now ship together under alpha.27.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 15:20:38 +10:00

18 lines
1.1 KiB
JavaScript

// Little Blue's infra sanity check. Runs in the MCP child (no infra creds) — it
// calls the main server's read-only /api/infra/audit, which probes wiki-referenced
// endpoints + registered service URLs and reports anything unreachable (e.g. a
// doc/registry pointing at a stale IP) plus inventory hosts missing a MAC.
function api(env = process.env) { return { base: env.VOID_API_URL, token: env.VOID_AGENT_TOKEN }; }
export const infraAuditTool = {
name: 'infra_audit',
description: 'Run a homelab sanity check: probe every IP:port the wiki references and every monitored service, and report unreachable endpoints (stale/incorrect IPs or ports) plus inventory hosts missing a MAC. Read-only — use to verify the docs/registry match reality.',
input_schema: { type: 'object', properties: {} },
async handler(_args, _ctx, { fetchImpl = fetch } = {}) {
const { base, token } = api();
const res = await fetchImpl(`${base}/api/infra/audit`, { headers: { Authorization: `Bearer ${token}` } });
if (!res.ok) return { error: `infra_audit ${res.status}` };
return res.json();
}
};