Documentation
¶
Index ¶
- Constants
- func Copy(srcFile, dstFile string) error
- func CopyDir(dst, src string) error
- func CopyDirectory(scrDir, dest string) error
- func CopySymLink(source, dest string) error
- func CreateIfNotExists(dir string, perm os.FileMode) error
- func Exists(filePath string) bool
- func FindGoBinary() (string, error)
- func FindNodeBinary() (string, error)
- func FindPnpmBinary() (string, error)
- func HydrateBuildOpts(opts *types.BuildOpts) error
- func PrepareCommandWithBinaries(command string, args []string, binaries ...string) (*exec.Cmd, error)
- func ValidateForPhase(phase lifecycle.PluginPhase, meta config.PluginMeta, location string) error
- type CrashRecoveryState
- type DeprecatedProtocolPayload
- type DevServerChecker
- type HealthChecker
- type LoadPluginOptions
- type Manager
- type PIDTracker
- type PluginBuilder
- type PluginErrorPayload
- type PluginRefAdapter
- type PluginReloaderAdapter
- type ReconcileResult
- type Reconciler
- type ServiceWrapper
- func (s *ServiceWrapper) GetPlugin(id string) (sdktypes.PluginInfo, error)
- func (s *ServiceWrapper) GetPluginDownloadStats(pluginID string) (*registry.DownloadStats, error)
- func (s *ServiceWrapper) GetPluginMeta(id string) (config.PluginMeta, error)
- func (s *ServiceWrapper) GetPluginReadme(pluginID string) (string, error)
- func (s *ServiceWrapper) GetPluginReleaseHistory(pluginID string) ([]registry.VersionInfo, error)
- func (s *ServiceWrapper) GetPluginReviews(pluginID string, page int) ([]registry.Review, error)
- func (s *ServiceWrapper) GetPluginVersions(pluginID string) ([]registry.VersionInfo, error)
- func (s *ServiceWrapper) InstallDevPluginFromPath(path string) (sdktypes.PluginInfo, error)
- func (s *ServiceWrapper) InstallFromPathPrompt() (*config.PluginMeta, error)
- func (s *ServiceWrapper) InstallInDevMode() (*config.PluginMeta, error)
- func (s *ServiceWrapper) InstallPluginFromPath(path string) (*config.PluginMeta, error)
- func (s *ServiceWrapper) InstallPluginVersion(pluginID, version string) (*config.PluginMeta, error)
- func (s *ServiceWrapper) ListAvailablePlugins() ([]registry.AvailablePlugin, error)
- func (s *ServiceWrapper) ListPluginMetas() []config.PluginMeta
- func (s *ServiceWrapper) ListPlugins() []sdktypes.PluginInfo
- func (s *ServiceWrapper) LoadPlugin(id string, opts *LoadPluginOptions) (sdktypes.PluginInfo, error)
- func (s *ServiceWrapper) ReloadPlugin(id string) (sdktypes.PluginInfo, error)
- func (s *ServiceWrapper) RetryFailedPlugin(id string) (sdktypes.PluginInfo, error)
- func (s *ServiceWrapper) SearchPlugins(query, category, sort string) ([]registry.AvailablePlugin, error)
- func (s *ServiceWrapper) UninstallPlugin(id string) (sdktypes.PluginInfo, error)
- func (s *ServiceWrapper) UnlinkDevPlugin(id string) (sdktypes.PluginInfo, error)
- type StateChangePayload
- type StateWriteErrorPayload
- type TelemetryEnvConfig
- type UpdateErrorPayload
- type UpdatePayload
Constants ¶
const ( // Lifecycle state changes. EventStateChange = "plugin/state_change" // Install flow. EventInstallStarted = "plugin/install_started" EventInstallFinished = "plugin/install_finished" EventInstallError = "plugin/install_error" // Dev install flow. EventDevInstallStart = "plugin/dev_install_start" EventDevInstallError = "plugin/dev_install_error" EventDevInstallComplete = "plugin/dev_install_complete" // Plugin reload. EventReloadStart = "plugin/dev_reload_start" EventReloadError = "plugin/dev_reload_error" EventReloadComplete = "plugin/dev_reload_complete" // Update. EventUpdateStarted = "plugin/update_started" EventUpdateError = "plugin/update_error" EventUpdateComplete = "plugin/update_complete" // Initialization. EventInitComplete = "plugin/init_complete" // Durable installed-inventory changes. EventInventoryChanged = "plugin/inventory_changed" // Crash recovery. EventCrash = "plugin/crash" EventCrashRecoveryFailed = "plugin/crash_recovery_failed" EventRecovered = "plugin/recovered" // State persistence. EventStateWriteError = "plugin/state_write_error" // Protocol version. EventDeprecatedProtocol = "plugin/deprecated_protocol" // Process logging. EventProcessLog = "plugin/process/log" )
Plugin event constants.
const (
MaxPluginSize = 1024 * 1024 * 1024 // 1GB
)
Variables ¶
This section is empty.
Functions ¶
func CopyDirectory ¶
func CopySymLink ¶
func FindGoBinary ¶
FindGoBinary looks for the Go binary in a number of well-known paths in case it's not available in the PATH.
func FindNodeBinary ¶
FindNodeBinary tries to locate the Node.js binary across common install paths.
func FindPnpmBinary ¶
FindPnpmBinary looks for the Pnpm binary in a number of well-known paths in case it's not available in the PATH.
func HydrateBuildOpts ¶
HydrateBuildOpts adds the additional build options if they are not specified.
func PrepareCommandWithBinaries ¶
func PrepareCommandWithBinaries( command string, args []string, binaries ...string, ) (*exec.Cmd, error)
PrepareCommandWithBinaries returns an exec.Cmd with extended PATH to include the directories of provided binary paths.
func ValidateForPhase ¶ added in v0.1.4
func ValidateForPhase(phase lifecycle.PluginPhase, meta config.PluginMeta, location string) error
ValidateForPhase checks that a plugin meets the requirements for the given phase.
Types ¶
type CrashRecoveryState ¶ added in v0.1.4
CrashRecoveryState tracks exponential backoff for a single plugin.
type DeprecatedProtocolPayload ¶ added in v0.2.0
type DeprecatedProtocolPayload struct {
PluginID string `json:"pluginID"`
Version int `json:"version"`
CurrentVersion int `json:"currentVersion"`
}
DeprecatedProtocolPayload is sent with EventDeprecatedProtocol.
type DevServerChecker ¶
DevServerChecker allows the plugin manager to check if a plugin is managed by the dev server system.
type HealthChecker ¶ added in v0.1.4
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker periodically checks the health of running plugins and triggers crash recovery when issues are detected.
func NewHealthChecker ¶ added in v0.1.4
func NewHealthChecker(logger logging.Logger, pm *pluginManager) *HealthChecker
NewHealthChecker creates a new HealthChecker.
func (*HealthChecker) CancelRecovery ¶ added in v0.1.4
func (hc *HealthChecker) CancelRecovery(pluginID string)
CancelRecovery cancels any in-progress crash recovery goroutine for the given plugin. This should be called when a plugin is uninstalled to prevent recovery loops.
func (*HealthChecker) HandleCrashWithBackoff ¶ added in v0.1.4
func (hc *HealthChecker) HandleCrashWithBackoff(pluginID string)
HandleCrashWithBackoff handles a plugin crash with exponential backoff. Uses an iterative loop instead of recursion to avoid stack growth.
func (*HealthChecker) IsInCrashCycle ¶ added in v0.2.0
func (hc *HealthChecker) IsInCrashCycle(pluginID string) bool
IsInCrashCycle returns true if the plugin has already crashed at least once within the current budget window. Used by HandlePluginCrash to suppress repeated "plugin/crash" notifications during crash-recover-crash loops.
func (*HealthChecker) ResetBudget ¶ added in v0.4.0
func (hc *HealthChecker) ResetBudget(pluginID string)
ResetBudget clears the crash budget and recovery state for a plugin. This should be called when the user manually triggers a reload so that the plugin gets fresh retry attempts instead of being immediately rejected by an exhausted budget from a prior crash cycle.
func (*HealthChecker) Start ¶ added in v0.1.4
func (hc *HealthChecker) Start(ctx context.Context)
Start begins the periodic health check loop.
type LoadPluginOptions ¶
type LoadPluginOptions struct {
DevMode bool
DevModePath string
ExistingState *plugintypes.PluginStateRecord
// contains filtered or unexported fields
}
LoadPluginOptions configures how a plugin is loaded.
type Manager ¶
type Manager interface {
Initialize(ctx context.Context) error
Run(ctx context.Context)
Shutdown()
InstallInDevMode() (*config.PluginMeta, error)
InstallDevPluginFromPath(path string) (sdktypes.PluginInfo, error)
UnlinkDevPlugin(id string) (sdktypes.PluginInfo, error)
InstallFromPathPrompt() (*config.PluginMeta, error)
InstallPluginFromPath(path string) (*config.PluginMeta, error)
InstallPluginVersion(pluginID string, version string) (*config.PluginMeta, error)
LoadPlugin(id string, opts *LoadPluginOptions) (sdktypes.PluginInfo, error)
ReloadPlugin(id string) (sdktypes.PluginInfo, error)
UnloadPlugin(id string) error
StopDevPlugin(id string) error
ReloadManagedPlugin(ctx context.Context, id, source, generation string) error
RetryFailedPlugin(id string) (sdktypes.PluginInfo, error)
UninstallPlugin(id string) (sdktypes.PluginInfo, error)
GetPlugin(id string) (sdktypes.PluginInfo, error)
ListPlugins() []sdktypes.PluginInfo
GetPluginMeta(id string) (config.PluginMeta, error)
ListPluginMetas() []config.PluginMeta
ListAvailablePlugins() ([]registry.AvailablePlugin, error)
SearchPlugins(query, category, sort string) ([]registry.AvailablePlugin, error)
GetPluginReadme(pluginID string) (string, error)
GetPluginVersions(pluginID string) ([]registry.VersionInfo, error)
GetPluginReviews(pluginID string, page int) ([]registry.Review, error)
GetPluginDownloadStats(pluginID string) (*registry.DownloadStats, error)
GetPluginReleaseHistory(pluginID string) ([]registry.VersionInfo, error)
HandlePluginCrash(pluginID string)
SetDevServerChecker(checker DevServerChecker)
SetDevServerManager(mgr *devserver.DevServerManager)
SetPluginLogManager(mgr *pluginlog.Manager)
}
Manager manages the lifecycle and registration of plugins.
func NewManager ¶
func NewManager( logger logging.Logger, stateRoot *appstate.ScopedRoot, pluginsRoot *appstate.ScopedRoot, resourceController resource.Controller, settingsController settings.Controller, execController pluginexec.Controller, networkerController networker.Controller, logsController pluginlogs.Controller, metricController pluginmetric.Controller, toolsController tools.Controller, managers map[string]plugintypes.PluginManager, settingsProvider pkgsettings.Provider, registryClient *registry.Client, telemetryConfigFn func() TelemetryEnvConfig, ) Manager
NewManager returns a new plugin manager.
type PIDTracker ¶ added in v0.4.0
type PIDTracker struct {
// contains filtered or unexported fields
}
PIDTracker persists kernel process identity plus supervisor provenance. Numeric legacy PIDs are retained as rejected recovery evidence, never kill authority. Live children remain owned by go-plugin Client.Kill, including on Darwin.
func NewPIDTracker ¶ added in v0.4.0
func NewPIDTracker(root *appstate.ScopedRoot) *PIDTracker
func (*PIDTracker) CheckAvailable ¶ added in v0.5.0
func (t *PIDTracker) CheckAvailable(id, workspaceID string) error
CheckAvailable runs before exec: unresolved recovery evidence must block a second backend, not merely reject recording it after its startup side effects.
func (*PIDTracker) CleanupStale ¶ added in v0.4.0
func (t *PIDTracker) CleanupStale(logger logging.Logger)
func (*PIDTracker) RecordOwned ¶ added in v0.5.0
func (t *PIDTracker) RecordOwned(id string, pid int, owner devsession.ProcessOwner) error
func (*PIDTracker) Remove ¶ added in v0.4.0
func (t *PIDTracker) Remove(id string)
func (*PIDTracker) Save ¶ added in v0.4.0
func (t *PIDTracker) Save() error
type PluginBuilder ¶
type PluginBuilder struct{}
type PluginErrorPayload ¶ added in v0.4.1
type PluginErrorPayload struct {
PluginID string `json:"pluginID"`
Error string `json:"error,omitempty"`
}
PluginErrorPayload is sent with EventCrash, EventCrashRecoveryFailed and EventRecovered (which leaves Error empty).
type PluginRefAdapter ¶ added in v0.4.0
type PluginRefAdapter struct{ Mgr Manager }
PluginRefAdapter adapts plugin.Manager to devserver.PluginRef.
func (*PluginRefAdapter) GetDevPluginInfo ¶ added in v0.4.0
func (a *PluginRefAdapter) GetDevPluginInfo(pluginID string) (bool, string, error)
type PluginReloaderAdapter ¶ added in v0.4.0
type PluginReloaderAdapter struct{ Mgr Manager }
PluginReloaderAdapter adapts plugin.Manager to devserver.PluginReloader.
func (*PluginReloaderAdapter) ReloadManagedPlugin ¶ added in v0.5.0
func (a *PluginReloaderAdapter) ReloadManagedPlugin(ctx context.Context, id, source, generation string) error
func (*PluginReloaderAdapter) ReloadPlugin ¶ added in v0.4.0
func (a *PluginReloaderAdapter) ReloadPlugin(id string) error
func (*PluginReloaderAdapter) StopDevPlugin ¶ added in v0.5.0
func (a *PluginReloaderAdapter) StopDevPlugin(id string) error
type ReconcileResult ¶ added in v0.1.4
type ReconcileResult struct {
Records map[string]*plugintypes.PluginRecord
// Orphans are directories found on disk but not in persisted state.
Orphans []string
// Ghosts are entries in persisted state but not on disk.
Ghosts []string
}
ReconcileResult contains the reconciled plugin state.
type Reconciler ¶ added in v0.1.4
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler audits the filesystem against persisted state and produces a consistent set of plugin records for the manager.
func NewReconciler ¶ added in v0.1.4
func NewReconciler(logger logging.Logger) *Reconciler
NewReconciler creates a new Reconciler.
func (*Reconciler) Reconcile ¶ added in v0.1.4
func (r *Reconciler) Reconcile( ctx context.Context, pluginDir string, persistedStates []plugintypes.PluginStateRecord, ) (*ReconcileResult, error)
Reconcile compares the filesystem with persisted state and produces a consistent set of plugin records.
func (*Reconciler) ReconcileFromFilesystem ¶ added in v0.1.4
func (r *Reconciler) ReconcileFromFilesystem( ctx context.Context, pluginDir string, ) (*ReconcileResult, error)
ReconcileFromFilesystem rebuilds state entirely from the filesystem. Used when the state file is corrupt or missing.
type ServiceWrapper ¶ added in v0.4.0
type ServiceWrapper struct {
Mgr Manager
}
ServiceWrapper exposes only the frontend-safe methods of plugin.Manager. Internal methods (SetDevServerChecker, SetPluginLogManager, HandlePluginCrash, Initialize, Run, Shutdown) are excluded to avoid binding warnings from interface/function-type parameters.
func (*ServiceWrapper) GetPlugin ¶ added in v0.4.0
func (s *ServiceWrapper) GetPlugin(id string) (sdktypes.PluginInfo, error)
func (*ServiceWrapper) GetPluginDownloadStats ¶ added in v0.4.0
func (s *ServiceWrapper) GetPluginDownloadStats(pluginID string) (*registry.DownloadStats, error)
func (*ServiceWrapper) GetPluginMeta ¶ added in v0.4.0
func (s *ServiceWrapper) GetPluginMeta(id string) (config.PluginMeta, error)
func (*ServiceWrapper) GetPluginReadme ¶ added in v0.4.0
func (s *ServiceWrapper) GetPluginReadme(pluginID string) (string, error)
func (*ServiceWrapper) GetPluginReleaseHistory ¶ added in v0.4.0
func (s *ServiceWrapper) GetPluginReleaseHistory(pluginID string) ([]registry.VersionInfo, error)
func (*ServiceWrapper) GetPluginReviews ¶ added in v0.4.0
func (*ServiceWrapper) GetPluginVersions ¶ added in v0.4.0
func (s *ServiceWrapper) GetPluginVersions(pluginID string) ([]registry.VersionInfo, error)
func (*ServiceWrapper) InstallDevPluginFromPath ¶ added in v0.5.0
func (s *ServiceWrapper) InstallDevPluginFromPath(path string) (sdktypes.PluginInfo, error)
func (*ServiceWrapper) InstallFromPathPrompt ¶ added in v0.4.0
func (s *ServiceWrapper) InstallFromPathPrompt() (*config.PluginMeta, error)
func (*ServiceWrapper) InstallInDevMode ¶ added in v0.4.0
func (s *ServiceWrapper) InstallInDevMode() (*config.PluginMeta, error)
func (*ServiceWrapper) InstallPluginFromPath ¶ added in v0.4.0
func (s *ServiceWrapper) InstallPluginFromPath(path string) (*config.PluginMeta, error)
func (*ServiceWrapper) InstallPluginVersion ¶ added in v0.4.0
func (s *ServiceWrapper) InstallPluginVersion(pluginID, version string) (*config.PluginMeta, error)
func (*ServiceWrapper) ListAvailablePlugins ¶ added in v0.4.0
func (s *ServiceWrapper) ListAvailablePlugins() ([]registry.AvailablePlugin, error)
func (*ServiceWrapper) ListPluginMetas ¶ added in v0.4.0
func (s *ServiceWrapper) ListPluginMetas() []config.PluginMeta
func (*ServiceWrapper) ListPlugins ¶ added in v0.4.0
func (s *ServiceWrapper) ListPlugins() []sdktypes.PluginInfo
func (*ServiceWrapper) LoadPlugin ¶ added in v0.4.0
func (s *ServiceWrapper) LoadPlugin(id string, opts *LoadPluginOptions) (sdktypes.PluginInfo, error)
func (*ServiceWrapper) ReloadPlugin ¶ added in v0.4.0
func (s *ServiceWrapper) ReloadPlugin(id string) (sdktypes.PluginInfo, error)
func (*ServiceWrapper) RetryFailedPlugin ¶ added in v0.4.0
func (s *ServiceWrapper) RetryFailedPlugin(id string) (sdktypes.PluginInfo, error)
func (*ServiceWrapper) SearchPlugins ¶ added in v0.4.0
func (s *ServiceWrapper) SearchPlugins(query, category, sort string) ([]registry.AvailablePlugin, error)
func (*ServiceWrapper) UninstallPlugin ¶ added in v0.4.0
func (s *ServiceWrapper) UninstallPlugin(id string) (sdktypes.PluginInfo, error)
func (*ServiceWrapper) UnlinkDevPlugin ¶ added in v0.5.0
func (s *ServiceWrapper) UnlinkDevPlugin(id string) (sdktypes.PluginInfo, error)
type StateChangePayload ¶ added in v0.1.4
type StateChangePayload struct {
PluginID string `json:"pluginID"`
From lifecycle.PluginPhase `json:"from"`
To lifecycle.PluginPhase `json:"to"`
Reason string `json:"reason"`
Timestamp time.Time `json:"timestamp"`
}
StateChangePayload is sent with EventStateChange.
type StateWriteErrorPayload ¶ added in v0.4.1
type StateWriteErrorPayload struct {
PluginID string `json:"pluginID"`
Detail string `json:"detail"`
}
StateWriteErrorPayload is sent with EventStateWriteError.
type TelemetryEnvConfig ¶ added in v0.3.0
type TelemetryEnvConfig struct {
Enabled bool
OTLPEndpoint string
Profiling bool
PyroscopeEndpoint string
}
TelemetryEnvConfig holds the subset of telemetry configuration injected into plugin processes. Auth credentials are NOT included — they are managed host-side only.
type UpdateErrorPayload ¶ added in v0.4.0
UpdateErrorPayload is sent with EventUpdateError.
type UpdatePayload ¶ added in v0.4.0
UpdatePayload is sent with EventUpdateStarted and EventUpdateComplete.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pluginlog manages per-plugin log capture with file persistence, in-memory ring buffering, and callback-based real-time streaming.
|
Package pluginlog manages per-plugin log capture with file persistence, in-memory ring buffering, and callback-based real-time streaming. |