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

31 lines (30 loc) • 1.5 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/. /** * Materialize a unit's frozen environment at dispatch. Env-file values are the * one deliberately live input to a frozen plan: freeze records each env ref; * the values (and the secrets and paths their `${ref}` tokens name) are read * here, per dispatch, through `resolveEnvBinding` — the same machinery `akm env * run` uses — and nothing is returned until every read has succeeded. */ import { resolveEnvBinding } from "../../commands/env/env-binding.js"; export function materializeFrozenWorkflowEnvironment(descriptors) { const values = {}; const sensitive = new Set(); for (const descriptor of descriptors) { if (descriptor.kind === "literal") { values[descriptor.name] = descriptor.value; continue; } // `pass_env` names are recorded in the plan and select nothing: the exec child inherits // akm's environment (exec-unit.ts), so they are neither read nor marked sensitive here. if (descriptor.kind === "pass-through") continue; const binding = resolveEnvBinding(descriptor.ref); Object.assign(values, binding.values); for (const secret of binding.secretValues) sensitive.add(secret); } return { values, sensitiveValues: [...sensitive] }; }