Documentation
¶
Index ¶
- func ValidateReadiness(cfg config.OpenCodeConfig) error
- type ConnectMCPRequest
- type CreateSessionRequest
- type CreateSessionResponse
- type Harness
- func (h *Harness) Capabilities() adapter.HarnessCapabilities
- func (h *Harness) Name() string
- func (h *Harness) RunAction(ctx context.Context, req adapter.HarnessActionRequest) (adapter.HarnessActionResult, error)
- func (h *Harness) StartSession(ctx context.Context, opts adapter.SessionOpts) (_ adapter.AgentSession, err error)
- func (h *Harness) SupportsCompact() bool
- type MessageEvent
- type Part
- type QuestionEntry
- type QuestionEvent
- type QuestionListResponse
- type QuestionReplyRequest
- type SendMessageRequest
- type SessionEvent
- type SummarizeRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateReadiness ¶
func ValidateReadiness(cfg config.OpenCodeConfig) error
ValidateReadiness checks that the opencode binary is available on PATH.
Types ¶
type ConnectMCPRequest ¶
type ConnectMCPRequest struct {
Transport string `json:"transport"`
Command string `json:"command,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"name"`
}
ConnectMCPRequest is the body for POST /mcp.
type CreateSessionRequest ¶
type CreateSessionRequest struct {
// Agent type: "build" (default) or "plan".
Agent string `json:"agent,omitempty"`
Model string `json:"model,omitempty"`
}
CreateSessionRequest is the body for POST /session.
type CreateSessionResponse ¶
type CreateSessionResponse struct {
ID string `json:"id"`
}
CreateSessionResponse is the response from POST /session.
type Harness ¶
type Harness struct {
// contains filtered or unexported fields
}
Harness implements adapter.AgentHarness and adapter.HarnessActionRunner for the OpenCode HTTP server (opencode serve).
func NewHarness ¶
func NewHarness(cfg config.OpenCodeConfig, workspaceRoot string) *Harness
NewHarness creates a new OpenCode harness.
func (*Harness) Capabilities ¶
func (h *Harness) Capabilities() adapter.HarnessCapabilities
Capabilities returns the harness capabilities.
func (*Harness) RunAction ¶
func (h *Harness) RunAction(ctx context.Context, req adapter.HarnessActionRequest) (adapter.HarnessActionResult, error)
RunAction executes harness control-plane actions.
func (*Harness) StartSession ¶
func (h *Harness) StartSession(ctx context.Context, opts adapter.SessionOpts) (_ adapter.AgentSession, err error)
StartSession creates a new agent session by launching the opencode serve child process and connecting via HTTP/SSE.
func (*Harness) SupportsCompact ¶
SupportsCompact reports that OpenCode supports native compaction.
type MessageEvent ¶
MessageEvent represents the message payload in a message.updated event.
type Part ¶
type Part struct {
Type string `json:"type"`
State string `json:"state,omitempty"`
Text string `json:"text,omitempty"`
// Tool fields (present when Type is "tool-use").
ToolUseID string `json:"toolUseID,omitempty"`
ToolName string `json:"toolName,omitempty"`
ToolInput json.RawMessage `json:"input,omitempty"`
// Tool result fields (present when Type is "tool-result").
ToolResultID string `json:"toolResultID,omitempty"`
ToolResultErr string `json:"error,omitempty"`
ToolOutput string `json:"output,omitempty"`
}
Part represents a single part within a message event.
type QuestionEntry ¶
type QuestionEntry struct {
RequestID string `json:"requestID,omitempty"`
Question string `json:"question,omitempty"`
}
QuestionEntry represents a single pending question.
type QuestionEvent ¶
type QuestionEvent struct {
RequestID string `json:"requestID,omitempty"`
Question string `json:"question,omitempty"`
}
QuestionEvent represents the question payload in question.asked events.
type QuestionListResponse ¶
type QuestionListResponse struct {
Questions []QuestionEntry `json:"questions,omitempty"`
}
QuestionListResponse is the response from GET /session/:id/todo (questions).
type QuestionReplyRequest ¶
type QuestionReplyRequest struct {
Content string `json:"content"`
}
QuestionReplyRequest is the body for POST /question/:requestID/reply.
type SendMessageRequest ¶
type SendMessageRequest struct {
Content string `json:"content"`
Variant string `json:"variant,omitempty"`
}
SendMessageRequest is the body for POST /session/:id/message.
type SessionEvent ¶
type SessionEvent struct {
// Type is the event discriminator, e.g. "session.created", "message.updated".
Type string `json:"type"`
// SessionID is present on session-level events.
SessionID string `json:"sessionID,omitempty"`
// Message is present on message-level events.
Message *MessageEvent `json:"message,omitempty"`
// Error message (present on session.error).
Error string `json:"error,omitempty"`
// Question fields (present on question.asked, question.replied).
Question *QuestionEvent `json:"question,omitempty"`
}
SessionEvent represents a typed event from the OpenCode SSE stream. The SSE data payload is JSON-encoded; this struct captures the common fields across all event types.
type SummarizeRequest ¶
type SummarizeRequest struct{}
SummarizeRequest is the body for POST /session/:id/summarize.