Documentation
¶
Overview ¶
Package opencode drives the opencode CLI as a subprocess and parses its JSON-lines output into a plain text reply, session ID, and token usage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoginReport ¶
func CheckLogin ¶
func CheckLogin(command string, timeout time.Duration) (LoginReport, error)
type Runner ¶
type Runner struct {
shared.RunnerBase
DefaultModel string
DefaultVariant string
}
Runner executes the opencode CLI for a single request.
func (Runner) Run ¶
Run is a convenience wrapper that runs without thread resumption or progress callbacks. It uses the runner's DefaultModel and DefaultVariant when set.
func (Runner) RunWithThreadAndProgress ¶
func (r Runner) RunWithThreadAndProgress( ctx context.Context, threadID string, userText string, model string, variant string, env map[string]string, onProgress func(step string), onRawEvent func(kind, line, detail string), ) (string, string, int64, int64, int64, error)
RunWithThreadAndProgress runs the opencode CLI and returns the final reply, next session ID, and token usage.
- threadID: resume an existing session when non-empty.
- userText: the fully assembled prompt.
- model: the provider/model string (e.g. "deepseek/deepseek-v4-pro").
- variant: the model variant (e.g. "max", "high", "minimal").
- env: merged over the process environment.
- onProgress: called with each text event as an independent agent message; may be nil.
- onRawEvent: optional callback for raw stdout events (kind, line, detail); nil disables raw event delivery.
Click to show internal directories.
Click to hide internal directories.