Documentation
¶
Index ¶
- Constants
- func New(config v1.Config) v1.Tool
- type ConfigTemplateInput
- type Event
- type EventListResponse
- type Model
- type Opencode
- func (in *Opencode) AnalysisFollowUpRun(ctx context.Context, followUpPrompt string) error
- func (in *Opencode) BabysitRun(ctx context.Context, bCtx *v1.BabysitContext) bool
- func (in *Opencode) Configure(consoleURL, consoleToken string) error
- func (in *Opencode) ConfigureBabysitRun() error
- func (in *Opencode) OnMessage(f func(message *console.AgentMessageAttributes))
- func (in *Opencode) Run(ctx context.Context, options ...exec.Option)
- type Provider
- type StreamError
- type StreamErrorData
- type StreamPart
- type StreamPartType
- type StreamTokens
- type StreamToolState
- type StreamToolStatus
Constants ¶
View Source
const (
ConfigFileName = "opencode.json"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigTemplateInput ¶
type ConfigTemplateInput struct {
ConsoleURL string
ConsoleToken string
AgentRunID string
// Provider is the AI provider to use.
Provider Provider
// OpenAICompatible is true when using a custom OpenAI-compatible provider block (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
}
type Event ¶
type Event struct {
ID string
Message *console.AgentMessageAttributes
Done bool
// contains filtered or unexported fields
}
func (*Event) FromEventResponse ¶
func (in *Event) FromEventResponse(e EventListResponse)
type EventListResponse ¶
type EventListResponse struct {
Timestamp int64 `json:"timestamp"`
SessionID string `json:"sessionID"`
Part *StreamPart `json:"part,omitempty"`
Error *StreamError `json:"error,omitempty"`
}
type Opencode ¶
type Opencode struct {
toolv1.DefaultTool
// contains filtered or unexported fields
}
Opencode implements toolv1.Tool interface.
func (*Opencode) AnalysisFollowUpRun ¶ added in v0.6.40
AnalysisFollowUpRun re-runs OpenCode with followUpPrompt. Errors are returned to the caller and must not be sent on ErrorChan.
func (*Opencode) BabysitRun ¶
func (*Opencode) ConfigureBabysitRun ¶
func (*Opencode) OnMessage ¶
func (in *Opencode) OnMessage(f func(message *console.AgentMessageAttributes))
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" ProviderGoogle Provider = "google" // ProviderOpenAICompatible is the fixed provider key for custom OpenAI-compatible endpoints. ProviderOpenAICompatible Provider = "openai-compatible" )
func EnsureProvider ¶
EnsureProvider selects the OpenCode provider block written to opencode.json. defaultProvider must be a models.dev provider slug (for example openai, anthropic, amazon-bedrock). When aiProxy is enabled, the harness always uses ProviderPlural (Console /ext/ai/v1); spec.config.opencode.provider is ignored in that mode.
type StreamError ¶
type StreamError struct {
Name string `json:"name"`
Data *StreamErrorData `json:"data,omitempty"`
}
type StreamErrorData ¶
type StreamErrorData struct {
Message string `json:"message"`
}
type StreamPart ¶
type StreamPart struct {
ID string `json:"id"`
SessionID string `json:"sessionID"`
MessageID string `json:"messageID"`
CallID string `json:"callID,omitempty"`
Type StreamPartType `json:"type"`
Text string `json:"text,omitempty"`
Tool string `json:"tool,omitempty"`
Cost float64 `json:"cost,omitempty"`
Tokens *StreamTokens `json:"tokens,omitempty"`
State *StreamToolState `json:"state,omitempty"`
}
type StreamPartType ¶
type StreamPartType string
const ( StreamPartTypeText StreamPartType = "text" StreamPartTypeTool StreamPartType = "tool" StreamPartTypeStepStart StreamPartType = "step-start" StreamPartTypeStepFinish StreamPartType = "step-finish" )
type StreamTokens ¶
type StreamToolState ¶
type StreamToolState struct {
Status StreamToolStatus `json:"status"`
Input json.RawMessage `json:"input,omitempty"`
Output string `json:"output,omitempty"`
}
type StreamToolStatus ¶
type StreamToolStatus string
const ( StreamToolStatusRunning StreamToolStatus = "running" StreamToolStatusCompleted StreamToolStatus = "completed" StreamToolStatusPending StreamToolStatus = "pending" StreamToolStatusError StreamToolStatus = "error" )
Click to show internal directories.
Click to hide internal directories.