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

24 lines (23 loc) • 991 B
// 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/. import { canonicalJson } from "../ir/plan-hash.js"; /** * Merge safe lowerer diagnostics in first-seen order. * * Notices are live execution metadata only: this helper is deliberately used * by executor/report/output paths, never by result/evidence journal writers. * Canonical JSON includes `details`, so two genuinely different structured * diagnostics are not collapsed merely because their headline fields match. */ export function mergeLoweringNotices(...groups) { const merged = new Map(); for (const group of groups) { for (const notice of group ?? []) { const key = canonicalJson(notice); if (!merged.has(key)) merged.set(key, notice); } } return merged.size > 0 ? [...merged.values()] : undefined; }