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
43 lines (42 loc) • 2.17 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 { caps } from "../shared.js";
import { BaseHarness } from "../types.js";
import { codexBuilder } from "./agent-builder.js";
import { codexResultExtractor } from "./result-extractor.js";
import { CodexProvider } from "./session-log.js";
export { codexBuilder, codexResumeArgs, writeCodexOutputSchemaFile } from "./agent-builder.js";
export { codexResultExtractor } from "./result-extractor.js";
export { CodexProvider } from "./session-log.js";
/**
* OpenAI Codex CLI.
*
* Canonical id is `'codex'`; no alias or distinct runtime identity.
*/
export class CodexHarness extends BaseHarness {
id = "codex";
displayName = "OpenAI Codex CLI";
// No `setupDetectionDir`: `~/.codex` holds credentials and session rollouts,
// not assets, so `akm setup` must not offer it as a stash source.
agentBuilder = codexBuilder;
resultExtractor = codexResultExtractor;
// ── Workflow-engine descriptor (plan §"Capability matrix", P2) ────────────
// No flag-shaped resume: codex resume is the `exec resume <id>` SUBCOMMAND
// chain (see `codexResumeArgs` in ./agent-builder.ts).
// Presence flag: CODEX_SANDBOX is stamped only on processes codex itself
// spawns inside its sandbox, so it genuinely means "running under codex" —
// but its VALUE (e.g. "seatbelt") is a sandbox mode, not a session id, so it
// is registered as `presenceEnv` (harness inference only), never
// `identityEnv` (whose values persist as agent_session_id). CODEX_HOME (the
// matrix's other candidate) is deliberately NOT registered anywhere: it is a
// user config-dir var commonly exported in shell profiles, so it would stamp
// identity onto manual runs (see `AkmHarness.presenceEnv`).
presenceEnv = ["CODEX_SANDBOX"];
sessionLogProvider = () => new CodexProvider();
capabilities = caps({
sessionLogs: true,
agentDispatch: true,
detection: true,
});
}