Documentation
¶
Overview ¶
Package harness defines the adapter contract every AI coding CLI implements. An adapter turns a resolved policy.Profile into the files that CLI reads as admin-enforced configuration, per OS.
Index ¶
Constants ¶
const ( InstallerNPM = "npm" // npm package tarball (Meta.NPMPackage) InstallerClaudeNative = "claude-native" // Anthropic's signed native-binary manifest )
Installer kinds for Meta.Installer.
Variables ¶
This section is empty.
Functions ¶
func Matrix ¶
func Matrix() map[string][]Capability
Matrix returns the capability set of every registered adapter, keyed by adapter name. Adapters register from init(), so callers must import internal/harness/all (or the adapters they need) first.
Types ¶
type Adapter ¶
type Adapter interface {
Name() string
Capabilities() []Capability
// Render returns the admin-enforced files for the profile. Unsupported
// profile fields must be reported as warnings, never silently dropped.
Render(p *policy.Profile, c Context) (files []File, warnings []string, err error)
// InstallCommand returns the shell command that installs exactly version on os.
InstallCommand(version string, os OS) string
}
Adapter renders one harness.
type Capability ¶
type Capability string
Capability is something an adapter can enforce centrally.
const ( CapVersionPin Capability = "version-pin" // CLI refuses to run outside the pinned version CapModelLock Capability = "model-lock" // restrict selectable models CapMCPAllowlist Capability = "mcp-allowlist" // restrict MCP servers CapHooksLock Capability = "hooks-lock" // only managed hooks run CapPermissions Capability = "permissions" // tool allow/deny rules CapGateway Capability = "gateway" // route traffic through a custom base URL CapTelemetry Capability = "telemetry" // OTEL export CapInstructions Capability = "instructions" // managed org-wide memory file CapHeaders Capability = "headers" // custom request headers (ring stamping) CapExtensions Capability = "extensions" // plugin marketplaces, plugins, skills, subagents (each adapter covers a subset; the rest warns) )
type Context ¶
type Context struct {
Gateway *policy.Gateway
Ring string
Release string // release digest or version label, stamped into headers/telemetry
OS OS
// Experiment/Variant are set when rendering a client-axis variant release;
// adapters stamp them into telemetry resource attributes (halo.experiment,
// halo.variant) so CLI metrics are attributed to the variant. Never sent as
// request headers: the gateway assigns and stamps x-halo-* itself.
Experiment string
Variant string
}
Context carries everything an adapter needs beyond the profile.
type Describer ¶
type Describer interface {
Meta() Meta
}
Describer is implemented by adapters that publish Meta.
type Meta ¶
type Meta struct {
Binary string // executable name, probed with `--version`
Installer string // InstallerNPM | InstallerClaudeNative | "" (no verified installer)
NPMPackage string // npm package name when Installer is InstallerNPM
UAPrefixes []string // lower-case User-Agent prefixes the CLI sends (none = never seen at the gateway)
// ManagedDirs are the admin config directories (per OS) the adapter's
// rendered files live under; halod refuses to write anywhere else.
ManagedDirs map[OS][]string
// ManagedFiles are single-file path.Match patterns outside ManagedDirs.
ManagedFiles map[OS][]string
}
Meta is optional per-adapter metadata that install and traffic code derive their harness lists from, so adding an adapter needs no edits elsewhere.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package all registers every built-in harness adapter via blank imports.
|
Package all registers every built-in harness adapter via blank imports. |
|
Package claudecode renders Claude Code's managed settings.
|
Package claudecode renders Claude Code's managed settings. |
|
Package codex renders OpenAI Codex CLI admin configuration.
|
Package codex renders OpenAI Codex CLI admin configuration. |
|
Package copilot renders GitHub Copilot CLI file-based enterprise managed settings (managed-settings.json).
|
Package copilot renders GitHub Copilot CLI file-based enterprise managed settings (managed-settings.json). |
|
Package cursor renders Cursor CLI (cursor-agent) enterprise hooks: the system-wide hooks.json is the one root-owned, admin-controlled file the CLI reads.
|
Package cursor renders Cursor CLI (cursor-agent) enterprise hooks: the system-wide hooks.json is the one root-owned, admin-controlled file the CLI reads. |
|
Package gemini renders Gemini CLI system settings.
|
Package gemini renders Gemini CLI system settings. |
|
Package hutil holds helpers shared by harness adapters.
|
Package hutil holds helpers shared by harness adapters. |
|
hutiltest
Package hutiltest provides a shared rich fixture and golden-file helper for adapter tests.
|
Package hutiltest provides a shared rich fixture and golden-file helper for adapter tests. |
|
Package opencode renders OpenCode (sst/opencode, npm "opencode-ai") managed configuration: an opencode.json in the system managed-config directory, which OpenCode loads at the highest precedence.
|
Package opencode renders OpenCode (sst/opencode, npm "opencode-ai") managed configuration: an opencode.json in the system managed-config directory, which OpenCode loads at the highest precedence. |