Documentation
¶
Overview ¶
Package harness builds the launch configuration for each agent harness (DBX-46, DBX-57): the ACP command, environment pointing model traffic at the console AI proxy with a placeholder key (or at the owner's plan), CA trust, home instruction files and the per-harness model boot flags used when an adapter has no ACP model control. Models are set over ACP; config files only get the defaults and model lists harnesses can't take any other way (Claude's availableModels, Codex's provider, catalog and default model).
Index ¶
- Constants
- Variables
- func AgentName(t devboxv1.AgentType) string
- func Binary(t devboxv1.AgentType) string
- func EnvValue(env []string, k string) (string, bool)
- func ModelIDs(t devboxv1.AgentType, model string) []string
- func ParseAgent(s string) (devboxv1.AgentType, bool)
- func ProxyModel(t devboxv1.AgentType, model string) string
- type Command
- type Config
- func (c *Config) AdapterVersion(t devboxv1.AgentType) string
- func (c *Config) CodexAuthDir() string
- func (c *Config) CodexHome() string
- func (c *Config) Headless(t devboxv1.AgentType, prompt, lastMessage string) (path string, args, env []string, err error)
- func (c *Config) InstructionLinks() map[string]string
- func (c *Config) LinkInstructions() error
- func (c *Config) PiSubagentDir() string
- func (c *Config) Present(t devboxv1.AgentType) (string, bool)
- func (c *Config) Spec(launch *devboxv1.AgentLaunch, endpoints *devboxv1.HarnessEndpoints, ...) (*Spec, error)
- type ImageAgent
- type ImageInfo
- type OpenCodeServer
- type Spec
Constants ¶
const ClaudeOAuthPlaceholder = "sk-ant-oat01-plural-devbox-placeholder"
ClaudeOAuthPlaceholder has the real `sk-ant-oat01-` prefix, so Claude Code accepts it; egress swaps in the owner's token for api.anthropic.com (section 4.11).
const PlaceholderKey = "plural-devbox-placeholder"
PlaceholderKey is the API key harnesses send; atenet-egress replaces the auth header with the instance's AI proxy token, so the real token never enters the sandbox.
Variables ¶
var AllAgents = []devboxv1.AgentType{ devboxv1.AgentType_AGENT_TYPE_CLAUDE, devboxv1.AgentType_AGENT_TYPE_CODEX, devboxv1.AgentType_AGENT_TYPE_OPENCODE, devboxv1.AgentType_AGENT_TYPE_GEMINI, devboxv1.AgentType_AGENT_TYPE_PI, }
AllAgents lists the supported harnesses.
Functions ¶
func ModelIDs ¶
ModelIDs are the IDs an agent's picker may list a console model under, most specific first: the ID itself, a bare model under the agent's proxy provider, the `plural/` provider OpenCode and Pi register the proxy models under, and Gemini CLI's bare names.
func ParseAgent ¶
ParseAgent parses an agent name ("claude", "AGENT_TYPE_CLAUDE").
Types ¶
type Config ¶
type Config struct {
Home string
// StateDir is ~/.plural; daemon-managed harness config lives under StateDir/harness.
StateDir string
Image *ImageInfo
// AgentAuthDir is the tmpfs for subscription credentials (/run/plural/agent-auth).
AgentAuthDir string
// BaseEnv returns the environment every child process gets (CA trust, identity, PATH, ...).
BaseEnv func() []string
// Overrides replace the ACP command per agent.
Overrides map[devboxv1.AgentType]Command
// CodexBundledModels returns Codex's bundled model catalog; it defaults to `codex debug models --bundled`.
CodexBundledModels func() ([]byte, error)
// PiSubagentExtension overrides where pi's subagent extension is (PiSubagentDir).
PiSubagentExtension string
}
Config is the harness configuration shared by every agent.
func (*Config) AdapterVersion ¶
AdapterVersion is the pinned adapter version from image.json, if known.
func (*Config) CodexAuthDir ¶
CodexAuthDir is the tmpfs CODEX_HOME holding auth.json for subscription billing.
func (*Config) CodexHome ¶
CodexHome is where Codex keeps its state (sessions, config) on the workspace volume.
func (*Config) Headless ¶
func (c *Config) Headless(t devboxv1.AgentType, prompt, lastMessage string) (path string, args, env []string, err error)
Headless is the command line for a one-off, non-interactive prompt to a subscription agent's CLI, run with the credentials its ACP process gets. The CLI may read the working directory but not change it. lastMessage is a file Codex writes its final answer to; Claude prints a JSON result instead.
func (*Config) InstructionLinks ¶
InstructionLinks are each harness's global instruction file, symlinked to ~/AGENTS.md so the devbox conventions apply whatever the session's cwd.
func (*Config) LinkInstructions ¶
LinkInstructions creates the global instruction symlinks that don't exist yet.
func (*Config) PiSubagentDir ¶
PiSubagentDir is the image's copy of pi's subagent extension, under the global node_modules.
func (*Config) Spec ¶
func (c *Config) Spec(launch *devboxv1.AgentLaunch, endpoints *devboxv1.HarnessEndpoints, bootModel string) (*Spec, error)
Spec builds the launch spec for one agent connection.
type ImageAgent ¶
type ImageAgent struct {
Command string `json:"command"`
Version string `json:"version"`
ACP struct {
Command string `json:"command"`
Args []string `json:"args"`
Version string `json:"version"`
} `json:"acp"`
}
ImageAgent is one agent entry in /etc/devbox/image.json, written by the devbox image build (DBX-49).
type ImageInfo ¶
type ImageInfo struct {
Contract string `json:"contract"`
Flavor string `json:"flavor"`
DaemonVersion string `json:"daemonVersion"`
PlaywrightMCP string `json:"playwrightMcp"`
Agents map[string]ImageAgent `json:"agents"`
}
ImageInfo is /etc/devbox/image.json.
func LoadImageInfo ¶
LoadImageInfo reads the image description. A missing file yields built-in defaults.
type OpenCodeServer ¶
OpenCodeServer is where `opencode acp` serves OpenCode's own API, and its basic-auth credentials.
type Spec ¶
type Spec struct {
Agent devboxv1.AgentType
Path string
Args []string
Env []string
Dir string
Lineage acp.LineageExtractor
// RequestV2 asks for protocol version 2 at initialize (acpV2 flag and adapter support).
RequestV2 bool
// NativeSubagents advertises the subagents client capability at initialize.
NativeSubagents bool
// TranscriptTool is a tool whose output streams its subagents' transcripts (acp.TranscriptTool).
TranscriptTool string
// BootModel is the model passed through flags/env, for adapters without ACP model control.
BootModel string
Billing devboxv1.BillingMode
// AuthMethodID, when set, is sent with `authenticate` after initialize.
AuthMethodID string
// OpenCodeServer is the HTTP server `opencode acp` runs its sessions on, whose event stream names the child
// sessions of `task` subagents.
OpenCodeServer *OpenCodeServer
}
Spec is everything needed to start one agent's ACP process.