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
29 lines (28 loc) • 1.39 kB
JavaScript
// 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 { isRecord } from "../../core/common.js";
/**
* Read a journaled runner back. A current runner is kept as stored. An earlier
* release's `llm`, `agent` and `sdk` runners are not read: they fall through to
* the last case and the plan that holds one cannot be decoded, so its run starts
* afresh.
*/
export function decodeFrozenRunnerSpec(value) {
if (!isRecord(value))
throw new TypeError("a frozen runner must be an object");
switch (value.kind) {
case "connection":
if (typeof value.name !== "string" || typeof value.endpoint !== "string" || typeof value.model !== "string") {
throw new TypeError("a frozen connection runner must carry name, endpoint and model");
}
return value;
case "harness":
if (typeof value.name !== "string" || typeof value.platform !== "string" || typeof value.bin !== "string") {
throw new TypeError("a frozen harness runner must carry name, platform and bin");
}
return { args: [], ...value };
default:
throw new TypeError("a frozen runner's kind must be connection or harness");
}
}