Help us shape the future of Go! Take the 2026 Go Developer Survey

host

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package host implements orb's original out-of-process JavaScript extension host protocol and lifecycle manager. It has no mirrored upstream package.

Index

Constants

View Source
const (
	ProtocolName    = "orb-extension-host"
	ProtocolVersion = 1
	MaxFrameSize    = 4 << 20
)

Variables

View Source
var (
	ErrNotRunning = errors.New("extension host is not running")
	ErrRestarting = errors.New("extension host is restarting")
)
View Source
var (
	ErrFrameTooLarge   = errors.New("extension host: frame exceeds 4 MiB")
	ErrIncompleteFrame = errors.New("extension host: unterminated JSONL frame")
)

Functions

func Discover

func Discover(options DiscoveryOptions) []string

Discover returns extension entry points in upstream load order with the first spelling of an absolute path winning deduplication.

Types

type AgentInfo

type AgentInfo struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	CWD      string `json:"cwd"`
	AgentDir string `json:"agentDir"`
}

type DiscoveryOptions

type DiscoveryOptions struct {
	CWD                         string
	AgentDir                    string
	ProjectTrusted              bool
	NoDiscovery                 bool
	ConfiguredPaths             []string
	ProjectConfiguredPaths      []string
	ResolvedPackagePaths        []string
	ProjectResolvedPackagePaths []string
	ExplicitPaths               []string
}

DiscoveryOptions contains local paths after settings and package resolution. Package resolution remains the caller's responsibility.

type LoadError

type LoadError struct {
	Path  string `json:"path"`
	Error string `json:"error"`
}

type LoadResult

type LoadResult struct {
	Paths       []string
	Errors      []LoadError
	Diagnostics []extensions.Diagnostic
	Runtime     *Runtime
}

type Manager

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

func NewManager

func NewManager(options Options) *Manager

func (*Manager) Close

func (manager *Manager) Close() error

func (*Manager) RegisterInto

func (manager *Manager) RegisterInto(ctx context.Context, registry *extensions.Registry, paths []string) LoadResult

func (*Manager) Reload

func (manager *Manager) Reload(ctx context.Context) error

func (*Manager) RestartCount

func (manager *Manager) RestartCount() int64

func (*Manager) Runtime

func (manager *Manager) Runtime() *Runtime

type Options

type Options struct {
	AgentDir string
	CWD      string
	// ProjectTrusted gates the project-scoped npm root the SDK is resolved from,
	// exactly as DiscoveryOptions.ProjectTrusted gates project extensions.
	ProjectTrusted bool
	Version        string
	// SDKVersion pins the @earendil-works/pi-coding-agent auto-provisioned into
	// the user npm root when a loose extension imports the SDK and no copy
	// resolves. Empty disables provisioning.
	SDKVersion      string
	Runtime         *Runtime
	OrbExecutable   string
	RequestTimeout  time.Duration
	ShutdownTimeout time.Duration
	MaxRestarts     int
	BackoffBase     time.Duration
	BackoffMax      time.Duration
	Stderr          io.Writer
	OnDiagnostic    func(extensions.Diagnostic)
}

type ProviderInvokeError

type ProviderInvokeError struct {
	ExtensionID string
	ProviderID  string
	Method      string
	CanRetry    bool
	Cause       error
}

ProviderInvokeError distinguishes extension failures from transport failures. A retryable error means the process generation disappeared or was replaced; callers may retry against the next generation without rebuilding the registry.

func (*ProviderInvokeError) Error

func (err *ProviderInvokeError) Error() string

func (*ProviderInvokeError) Retryable

func (err *ProviderInvokeError) Retryable() bool

func (*ProviderInvokeError) Unwrap

func (err *ProviderInvokeError) Unwrap() error

type Runtime

type Runtime struct {
	Name    string
	Version string
	Path    string
	Args    []string
}

func DiscoverRuntime

func DiscoverRuntime(ctx context.Context) (Runtime, error)

type RuntimeUnavailableError

type RuntimeUnavailableError struct {
	NodeVersion string
}

func (*RuntimeUnavailableError) Diagnostic

func (err *RuntimeUnavailableError) Diagnostic() extensions.Diagnostic

func (*RuntimeUnavailableError) Error

type UIDialogCancellationError

type UIDialogCancellationError struct {
	Reason UIDialogCancellationReason
}

func (*UIDialogCancellationError) Error

func (err *UIDialogCancellationError) Error() string

type UIDialogCancellationReason

type UIDialogCancellationReason string
const UIDialogCancellationHostRestarted UIDialogCancellationReason = "host_restarted"

Jump to

Keyboard shortcuts

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