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
34 lines (33 loc) • 1.23 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/.
/** Models reaching a harness have already crossed the single model-map boundary. */
export function resolveDispatchModel(request, _profile, _platform) {
return request.model;
}
/**
* The model an engine's own `args` select, as `--model X` or `--model=X` (the
* last one wins), for a builder that writes its own argv in place of those args.
*/
export function modelFromArgs(args) {
let model;
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === "--model")
model = args[index + 1];
else if (arg?.startsWith("--model="))
model = arg.slice("--model=".length);
}
return model;
}
/**
* Normalize a toolPolicy value to a comma-separated string suitable for a
* CLI flag. Structured policy objects are JSON-serialized.
*/
export function normalizeTools(tools) {
if (typeof tools === "string")
return tools;
if (Array.isArray(tools))
return tools.join(",");
return JSON.stringify(tools);
}