Runtime Adapters and In-Runtime Extensions
Runtime-specific execution for Hermes, Hermes proxy, Codex, OpenRouter, Pi, oh-my-pi, Claude Code, Command Code, ACP and experimental Anthropic with their capability manifests, plus in-runtime extensions: Tool Guard hooks for Claude Code, Command Code and OMP, and optional Honcho memory.
Depends on: Runtime Execution and Supervision (88), Artifact Schemas (66), Mission Lifecycle and Artifact Store (38), Verification, Review and Promotion (3)
Used by: CLI Entry, Build and Project Tooling (13), Mission Lifecycle and Artifact Store (10), Mission Control TUI (8), Runtime Execution and Supervision (5), Observability, Accounting and Reporting (4), Verification, Review and Promotion (3), Run Control and Team Coordination (3)
(Numbers are distinct file-to-file dependencies.)
| File | Summary | Key symbols |
|---|---|---|
src/adapters/_artifact-context.ts |
Shared mission-artifact context for runtime adapters: resolves the per-run .harness/missions/<id>/runs/<run-id>/ paths with symlink and path-escape guards and provides the write helpers every adapter uses to persist prompts, sessions and events. |
getMissionArtifactContext, assertWritableArtifact, assertPathInsideMissionDir, writeArtifactFile, persistPromptAndSession, appendMissionEvent |
src/adapters/acp.ts |
Agent-Client Protocol runtime adapter: a JSON-RPC 2.0 stdio client that launches any ACP-compliant agent server, answers its filesystem/permission requests, applies an environment policy, and runs a mission end-to-end into UH run artifacts. | AcpClient, waitForExit, terminateProcessTree, extractAcpAgentText, mapAcpUsage, applyAcpEnvPolicy, resolveAcpLaunchCommand, mcpServersForSessionNew, … |
src/adapters/anthropic.ts |
Experimental native Anthropic runtime adapter that plans and sends Messages API requests with the ANTHROPIC_API_KEY from the environment, checks connectivity, parses text and usage, and persists runtime sessions and results. | anthropicRuntimeChecker, loadAdapterConfig, planAnthropicRun, defaultAnthropicRunner, extractErrorEnvelope, extractMessageText, parseAnthropicResponse, defaultDiffCollector, … |
src/adapters/capabilities/acp.ts |
Static capability manifest for the ACP adapter: shell and filesystem tools, no sandbox, standard cost class, with cancellation and runtime-config overrides supported. | |
src/adapters/capabilities/anthropic.ts |
Static capability manifest for the native Anthropic adapter: network-only Messages API client with a 200k context window, remote-only sandbox and pay-per-token cost class. | |
src/adapters/capabilities/claude-code.ts |
Static capability manifest for the Claude Code CLI adapter, declaring its tool surface, sandbox mode and cost class for routing decisions. | |
src/adapters/capabilities/codex.ts |
Static capability manifest for the Codex adapter: codex exec in a git-worktree sandbox with workspace-write isolation. | |
src/adapters/capabilities/command-code.ts |
Static capability manifest for the Command Code adapter, describing its tools, sandbox and cost class for the capability registry. | |
src/adapters/capabilities/hermes-proxy-probe.ts |
Forward-looking live capability probe for hermes-proxy that fetches <endpoint>/capabilities, validates it with a partial Zod schema, and merges it over the static manifest, falling back to the static manifest on any failure. |
mergeProbedCapabilities, probeHermesProxyCapabilities |
src/adapters/capabilities/hermes-proxy.ts |
Static capability manifest for the hermes-proxy adapter (OpenAI-compatible subscription routing over HTTP). | |
src/adapters/capabilities/hermes.ts |
Static capability manifest for the reference Hermes adapter, declaring its tools, sandbox and cost class. | |
src/adapters/capabilities/index.ts |
Barrel and registry for adapter capability manifests: maps every team adapter id to its static manifest and exposes lookup, id listing and schema-validated manifest parsing. | getCapabilities, listAdapterIds, parseCapabilitiesManifest |
src/adapters/capabilities/oh-my-pi.ts |
Static capability manifest for the oh-my-pi adapter, declaring its tools, sandbox and cost class. | |
src/adapters/capabilities/openrouter.ts |
Static capability manifest for the OpenRouter adapter (OpenAI-compatible pay-per-token HTTP client). | |
src/adapters/capabilities/pi.ts |
Static capability manifest for the pi adapter, declaring its tools, sandbox and cost class. | |
src/adapters/claude-code.ts |
Claude Code CLI runtime adapter that plans a guarded print-mode stream-json run (native write rules derived from the tool-guard policy), launches it under runtime supervision and recovery, and parses results and usage into UH artifacts. | parseClaudeCodeResult, streamedClaudeUsage, orchestratorWriteRules, claudeSettings, planClaudeCodeRun, dryRunClaudeCode, runClaudeCode |
src/adapters/codex.ts |
Codex CLI runtime adapter with a strict runtime-config schema, CLI check, planner, streaming runner, JSONL event parsing, quota-error detection and session collection that maps exit codes and final result blocks to runtime-result status; optionally integrates Honcho memory. | loadAdapterConfig, runCodexCliCheck, getCodexRuntimeConfig, checkCodex, dryRunCodex, planCodexRun, defaultCodexRunner, defaultDiffCollector, … |
src/adapters/command-code.ts |
Command Code (cmd) runtime adapter: probes the CLI version, plans guarded runs with prompt on stdin, and executes supervised attempts with recovery, settlement and runtime result persistence. | buildCommandCodeProbeArgs, parseCommandCodeVersion, checkCommandCode, planCommandCodeRun, dryRunCommandCode, runCommandCode |
src/adapters/hermes-proxy.ts |
hermes-proxy runtime adapter: an OpenAI-compatible HTTP/SSE client to a local hermes proxy, with config schema, health check, planning, streaming parse and session collection. |
hermesProxyRuntimeChecker, loadAdapterConfig, planHermesProxyRun, defaultHermesProxyRunner, handleSseFrame, extractErrorEnvelope, extractMessageContent, parseHermesProxyStream, … |
src/adapters/hermes.ts |
Hermes Agent CLI runtime adapter: version gating, run planning with dispatch context and Honcho memory, subprocess execution and parsing of the final block into a runtime session. | loadAdapterConfig, parseHermesVersion, meetsMinimumHermesVersion, runHermesCliCheck, checkHermes, dryRunHermes, planHermesRun, defaultHermesRunner, … |
src/adapters/oh-my-pi.ts |
oh-my-pi (omp) runtime adapter, the default executor: plans guarded runs with recovery and snapshots, streams live output, detects quota errors, and collects sessions with route verification. | loadAdapterConfig, runOhMyPiCliCheck, getOhMyPiRuntimeConfig, checkOhMyPi, dryRunOhMyPi, planOhMyPiRun, ohMyPiRuntimeOverlay, defaultDiffCollector, … |
src/adapters/openrouter.ts |
OpenRouter runtime adapter: an OpenAI-compatible pay-per-token HTTP/SSE client reading OPENROUTER_API_KEY from the environment, with check, plan, run and session collection. | openRouterRuntimeChecker, loadAdapterConfig, planOpenRouterRun, defaultOpenRouterRunner, handleSseFrame, extractErrorEnvelope, extractMessageContent, parseOpenRouterStream, … |
src/adapters/pi.ts |
pi CLI runtime adapter: plans runs with dispatch context and Honcho memory, executes the pi subprocess, parses its output and detects quota errors. | loadAdapterConfig, runPiCliCheck, getPiRuntimeConfig, checkPi, dryRunPi, planPiRun, defaultPiRunner, defaultDiffCollector, … |
src/extensions/honcho-memory/client.ts |
Honcho memory client bootstrap: structural SDK types, a lazily imported SDK factory and cached, de-duplicated handle creation for the active session. | HonchoConfigError, defaultHonchoClientFactory, getCachedHandles, clearHandles, bootstrapHonchoHandles |
src/extensions/honcho-memory/config.ts |
Resolves Honcho memory extension config from HONCHO_* env vars and ~/.honcho/config.json (hosts.uh with hosts.pi fallback), including session strategy and limits. | normalizePositiveInteger, readConfigFile, normalizeSessionStrategy, getSessionStrategyLabel, getHonchoConfigPath, resolveHonchoMemoryConfig |
src/extensions/honcho-memory/git.ts |
Tiny helper running short-lived git commands with a 3s timeout for Honcho session-key derivation, returning null on failure. | execGit |
src/extensions/honcho-memory/index.ts |
Public surface of the Honcho persistent-memory extension: resolves and caches config, lazily creates client handles, injects a cached memory block into mission prompts, records mission exchanges, and offers search/remember helpers; a no-op when disabled. | getOrLoadConfig, resetHonchoExtensionForTests, setHonchoClientFactory, ensureHandles, enrichMissionPrompt, loadHonchoMemoryBlock, recordMissionExchange, honchoSearch, … |
src/extensions/honcho-memory/memory.ts |
In-process Honcho memory cache and sequenced save queue: builds the [Persistent memory] block from profile and project summaries, refreshes it once per session, and serializes exchange/memory saves through a single promise chain. |
normalizeMemoryText, buildCachedMemoryParts, buildCombinedMemoryBlock, getCachedMemoryBlock, clearCachedMemory, __setCachedMemoryForTests, refreshMemoryCache, flushPendingHonchoSaves, … |
src/extensions/honcho-memory/session-key.ts |
Derives a stable Honcho session key from the working directory using repo, git-branch or directory strategies, normalizing git remote URLs and hashing unsanitized values to avoid key collisions. | normalizeGitUrl, tryGitRemote, tryGitBranch, deriveRepoScopedKey, deriveHonchoSessionKey |
src/extensions/tool-guard/claude-code-hook.ts |
Claude Code PreToolUse hook entry point that reads one JSON tool request from stdin, runs the shared guard core, and emits a deny decision on stdout, failing closed on any error. | readRequest, main |
src/extensions/tool-guard/cmdc-hook.ts |
Command Code PreToolUse hook entry point wrapping the shared guard core; it also opts into the read-window rule that denies whole-file reads of large files, and fails closed on errors. | main |
src/extensions/tool-guard/core.ts |
Single fail-closed tool-guard core shared by every runtime wrapper: loads the policy, classifies and decides each tool call, applies the optional read-window rule, and appends every verdict to a JSONL audit log. | toolGuardFailClosedReason, readWindowReason, readWindowVerdict, decide, appendVerdict, runToolGuard |
src/extensions/tool-guard/omp.ts |
oh-my-pi extension that hooks the tool_call event, routes it through the shared guard core with the runtime’s toolCallId, and blocks denied calls, denying on any error. |