opencodehost

package
v2.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DAGUsesManaged

func DAGUsesManaged(dag *ir.DAG) bool

DAGUsesManaged reports whether a DAG has a host-compatible managed OpenCode step.

func DeleteSession

func DeleteSession(ctx context.Context, hostConfig Config, directory, sessionID string) error

DeleteSession removes a host-owned OpenCode session after its DAG run is removed.

func SessionAvailable

func SessionAvailable(ctx context.Context, hostConfig Config, directory, sessionID string) (bool, error)

SessionAvailable reports whether a managed session exists in directory.

func UnavailableEnv

func UnavailableEnv(err error) []string

UnavailableEnv returns a private transport error for a required managed step.

func WithHost

func WithHost(ctx context.Context, host *Host) context.Context

WithHost makes a managed OpenCode host available to runtime executors.

Types

type Config

type Config struct {
	URL        string
	Username   string
	Password   string
	InstanceID string
	Version    string
}

Config contains the private loopback connection used by managed harness steps.

func ConfigFromContext

func ConfigFromContext(ctx context.Context) (Config, bool, error)

ConfigFromContext resolves a host-owned or process-injected connection.

func (Config) Env

func (c Config) Env() []string

Env returns the private transport entries needed by a child Dagu process.

type Host

type Host struct {
	// contains filtered or unexported fields
}

Host lazily owns one OpenCode server process.

func New

func New(parent context.Context, settings config.OpenCodeConfig) *Host

New creates an idle host whose lifecycle ends with parent.

func (*Host) Close

func (h *Host) Close(ctx context.Context) error

Close stops the managed server.

func (*Host) Ensure

func (h *Host) Ensure() (Config, error)

Ensure returns a healthy managed server, starting it when necessary.

type ModeResult

type ModeResult struct {
	Managed  bool
	Required bool
	Reason   string
}

ModeResult describes how an OpenCode harness config should run.

func Mode

func Mode(values map[string]any) (ModeResult, error)

Mode reports whether an OpenCode harness config can use the managed service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL