Documentation
¶
Overview ¶
Package host implements pigo's original out-of-process JavaScript extension host protocol and lifecycle manager. It has no mirrored upstream package.
Index ¶
Constants ¶
View Source
const ( ProtocolName = "pigo-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") )
View Source
var ErrUIDialogHostRestarted = &UIDialogCancellationError{Reason: UIDialogCancellationHostRestarted}
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 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 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 (*Manager) RegisterInto ¶
func (manager *Manager) RegisterInto(ctx context.Context, registry *extensions.Registry, paths []string) LoadResult
func (*Manager) RestartCount ¶
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
PigoExecutable 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 RuntimeUnavailableError ¶
type RuntimeUnavailableError struct {
}
func (*RuntimeUnavailableError) Diagnostic ¶
func (err *RuntimeUnavailableError) Diagnostic() extensions.Diagnostic
func (*RuntimeUnavailableError) Error ¶
func (*RuntimeUnavailableError) Error() string
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"
Click to show internal directories.
Click to hide internal directories.