Documentation
¶
Index ¶
Constants ¶
const OpenCodeModelDiscoveryFreshnessWindow = 24 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func DefaultOpenCodeModelDiscovery ¶
func DefaultOpenCodeModelDiscovery() harnesses.ModelDiscoverySnapshot
Types ¶
type OpenCodeModelCost ¶
type OpenCodeModelCost struct {
InputUSDPerMTok float64 `json:"input_usd_per_mtok"`
OutputUSDPerMTok float64 `json:"output_usd_per_mtok"`
CacheReadUSDPerMTok float64 `json:"cache_read_usd_per_mtok"`
CacheWriteUSDPerMTok float64 `json:"cache_write_usd_per_mtok"`
}
OpenCodeModelCost captures the per-million-token prices printed by `opencode models --verbose`.
type OpenCodeModelEvidence ¶
type OpenCodeModelEvidence struct {
Model string `json:"model"`
ProviderID string `json:"provider_id,omitempty"`
ModelID string `json:"model_id,omitempty"`
Status string `json:"status,omitempty"`
Cost *OpenCodeModelCost `json:"cost,omitempty"`
ContextLimit int `json:"context_limit,omitempty"`
OutputLimit int `json:"output_limit,omitempty"`
Reasoning bool `json:"reasoning"`
ToolCall bool `json:"tool_call"`
Attachment bool `json:"attachment"`
Variants []string `json:"variants,omitempty"`
}
OpenCodeModelEvidence captures the stable model metadata exposed by `opencode models --verbose`. It intentionally does not include account or quota state because the current opencode CLI does not expose those as structured data.
func ParseOpenCodeVerboseModelEvidence ¶
func ParseOpenCodeVerboseModelEvidence(text string) ([]OpenCodeModelEvidence, error)
type Runner ¶
type Runner struct {
// Binary is the absolute path to the opencode executable. When empty the
// runner resolves "opencode" via PATH at Execute time.
Binary string
// BaseArgs is prepended to the per-request argument list.
// opencode default: ["run", "--format", "json"]
BaseArgs []string
// PromptMode controls how the prompt is delivered:
// "arg" (default) — prompt is appended as the final positional argument
// "stdin" — prompt is piped on stdin
PromptMode string
// EventBuffer overrides the per-Execute channel buffer size.
EventBuffer int
}
Runner is the subprocess-backed opencode harness. It launches opencode in run --format json mode, parses the JSON output into harness Events, and emits a final Event when the subprocess exits.
opencode run auto-approves all tool permissions; no extra flags are needed for any permission level.
func (*Runner) Execute ¶
func (r *Runner) Execute(ctx context.Context, req harnesses.ExecuteRequest) (<-chan harnesses.Event, error)
Execute runs one resolved request through the opencode CLI and emits JSON-derived events on the returned channel.
func (*Runner) HealthCheck ¶
HealthCheck verifies the opencode binary is present.
func (*Runner) Info ¶
func (r *Runner) Info() harnesses.HarnessInfo
Info returns identity + capability metadata for this harness.