Documentation
¶
Index ¶
- Constants
- type Agent
- func (*Agent) Capabilities() toolv1.AgentCapabilities
- func (agent *Agent) Configure(ctx context.Context, request toolv1.ConfigureRequest) error
- func (agent *Agent) Export(ctx context.Context, request toolv1.ExportRequest) (toolv1.ExportResult, error)
- func (agent *Agent) Prepare(ctx context.Context, request toolv1.FileSystemRequest) error
- func (agent *Agent) ResolveSettings(run *agentrunv1.AgentRun) (toolv1.Settings, error)
- func (*Agent) Type() console.AgentRuntimeType
- type ConfigTemplateInput
- type Provider
- type Transport
Constants ¶
const ConfigFileName = "opencode.json"
ConfigFileName is the native OpenCode configuration filename.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶ added in v0.6.65
type Agent struct {
// contains filtered or unexported fields
}
Agent owns OpenCode's shared preparation and lifecycle entrypoints. Runtime settings, native configuration, and ACP environment details live in their responsibility-specific files.
func NewAgent ¶ added in v0.6.65
NewAgent creates an OpenCode Agent for one agent run. Credentials in the run configuration are used only while writing provider configuration; resolved settings never contain credentials.
func (*Agent) Capabilities ¶ added in v0.6.65
func (*Agent) Capabilities() toolv1.AgentCapabilities
Capabilities advertises the modes supported by OpenCode's configured agents.
func (*Agent) Configure ¶ added in v0.6.65
Configure writes the native OpenCode provider configuration. Shared prompt and skill files are prepared by Prepare, while ConsoleToken is used only for this configuration pass when the Plural proxy is selected.
func (*Agent) Export ¶ added in v0.6.65
func (agent *Agent) Export(ctx context.Context, request toolv1.ExportRequest) (toolv1.ExportResult, error)
Export writes the native OpenCode session export into OutputDir and returns that directory as the source for the shared artifact builder.
func (*Agent) Prepare ¶ added in v0.6.65
Prepare writes the OpenCode system prompt and run skills for a phase.
func (*Agent) ResolveSettings ¶ added in v0.6.65
ResolveSettings resolves provider/model defaults without copying credentials into the provider-neutral runtime settings.
func (*Agent) Type ¶ added in v0.6.65
func (*Agent) Type() console.AgentRuntimeType
Type identifies the Console runtime implemented by Agent.
type ConfigTemplateInput ¶
type ConfigTemplateInput struct {
ConsoleURL string
ConsoleToken string
AgentRunID string
// ReadOnlyDirectories are external directories OpenCode may inspect but
// must never edit, such as repository prebake roots.
ReadOnlyDirectories []string
// Provider is the AI provider to use.
Provider Provider
// OpenAICompatible selects the OpenAI-compatible chat completions SDK (npm @ai-sdk/openai-compatible).
OpenAICompatible bool
// Endpoint is an optional override for the provider baseURL (for example a custom OpenAI-compatible URL).
// When empty, baseURL is omitted so OpenCode uses the models.dev default for the provider.
Endpoint string
// Model is the AI model to use.
Model string
// Token is the API token for the AI provider.
Token string
// Mode is the agent run mode.
Mode console.AgentRunMode
// DindEnabled is true when the agent run pod has Docker-in-Docker available.
DindEnabled bool
// StreamingProxy routes plural provider requests through the in-pod mcpserver proxy.
StreamingProxy bool
// StreamingProxyBaseURL is the OpenAI-compatible base URL for the in-pod streaming proxy.
StreamingProxyBaseURL string
}
type Provider ¶
type Provider string
Provider is an OpenCode provider id (https://models.dev).
const ( // ProviderPlural routes requests through the Console AI proxy (/ext/ai/v1). ProviderPlural Provider = "plural" ProviderOpenAI Provider = "openai" // Common models.dev provider ids for direct (non-proxy) usage. ProviderAnthropic Provider = "anthropic" ProviderAmazonBedrock Provider = "amazon-bedrock" ProviderGoogleVertex Provider = "google-vertex" ProviderOllama Provider = "ollama" ProviderAzure Provider = "azure" ProviderXAI Provider = "xai" // ProviderBedrock and ProviderVertex are legacy aliases accepted by the // Console provider contract in addition to the canonical models.dev IDs. ProviderBedrock Provider = "bedrock" ProviderVertex Provider = "vertex" // ProviderOpenAICompatible is the fixed provider key for custom OpenAI-compatible endpoints. ProviderOpenAICompatible Provider = "openai-compatible" )
type Transport ¶ added in v0.6.65
type Transport struct {
// contains filtered or unexported fields
}
Transport invokes OpenCode through its ACP interface. It owns process launch, while ACP session projection and protocol handling stay with the runtime configuration and provider-neutral engine.
func NewTransport ¶ added in v0.6.65
NewTransport creates the OpenCode ACP transport for an Agent.
func (*Transport) Capabilities ¶ added in v0.6.65
func (transport *Transport) Capabilities() toolv1.TransportCapabilities
Capabilities reports the ACP features implemented by OpenCode.
func (*Transport) Kind ¶ added in v0.6.65
func (*Transport) Kind() toolv1.TransportKind
Kind identifies this as an Agent Client Protocol transport.