UNPKG

akm-cli

Version:

akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cur

58 lines (57 loc) • 2.63 kB
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. /** * `egress-endpoints` advisory for `akm health` (meta-review 08, surfaces 3/9): * the remote-destination list, for eyeball diff. A pure projection over the * effective config (no process.env reads); silent when nothing remote is * configured, matching the `binary-config-skew` advisory's pattern. */ import { redactCredentialPatterns } from "../../core/redaction.js"; import { formatRegistryUrl } from "../../core/registry-url.js"; /** * `egress-endpoints` (08 surfaces 3/9): the full list of remote destinations * akm can talk to under the effective config — registries, remote sources, * LLM endpoints, embedding endpoint — as one pass-status informational entry * for eyeball diff against expectations. Silent only when nothing remote is * configured at all. */ export function collectEgressAdvisory(config) { if (!config) return undefined; const endpoints = []; for (const reg of config.registries ?? []) { if (reg.enabled === false || !reg.url) continue; endpoints.push(`registry ${reg.name ?? "(unnamed)"}: ${formatRegistryUrl(reg.url)}`); } for (const [key, bundle] of Object.entries(config.bundles ?? {})) { if (!bundle) continue; const url = bundle.git ?? bundle.website?.url; if (!url) continue; endpoints.push(`source ${key} (${bundle.git ? "git" : "website"}): ${url}`); } for (const [name, connection] of Object.entries(config.connections ?? {})) { if (!connection?.endpoint) continue; endpoints.push(`connection ${name}: ${connection.endpoint}`); } if (config.embedding?.endpoint) endpoints.push(`embedding: ${config.embedding.endpoint}`); if (endpoints.length === 0) return undefined; // A configured URL can carry a credential (`?token=…`, `user:pass@`); the list is for eyeballing destinations, so // print the host and path and never the secret. const safe = endpoints.map(redactCredentialPatterns); return { name: "egress-endpoints", kind: "deterministic", status: "pass", confidence: "high", message: `${endpoints.length} remote endpoint(s) in the effective config (registries/sources/LLM/embedding) — ` + "the evidence lists them (`--detail normal`); review it for unexpected destinations.", evidence: { endpoints: safe }, }; }