Plugin Lifecycle Advanced
Plugin Lifecycle Advanced protocol schemas
Advanced Plugin Lifecycle Protocol
Defines advanced lifecycle management capabilities including:
-
Hot reload and live updates
-
Graceful degradation and fallback mechanisms
-
Health monitoring and auto-recovery
-
State preservation during updates
This protocol extends the basic plugin lifecycle with enterprise-grade
features for production environments.
Source: packages/spec/src/kernel/plugin-lifecycle-advanced.zod.ts
TypeScript Usage
import { AdvancedPluginLifecycleConfig, DistributedStateConfig, GracefulDegradation, HotReloadConfig, PluginHealthCheck, PluginHealthReport, PluginHealthStatus, PluginStateSnapshot, PluginUpdateStrategy } from '@objectstack/spec/kernel';
import type { AdvancedPluginLifecycleConfig, DistributedStateConfig, GracefulDegradation, HotReloadConfig, PluginHealthCheck, PluginHealthReport, PluginHealthStatus, PluginStateSnapshot, PluginUpdateStrategy } from '@objectstack/spec/kernel';
// Validate data
const result = AdvancedPluginLifecycleConfig.parse(data);AdvancedPluginLifecycleConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| health | Object | optional | |
| hotReload | Object | optional | |
| degradation | Object | optional | |
| updates | Object | optional | |
| resources | Object | optional | |
| observability | Object | optional |
DistributedStateConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| provider | Enum<'redis' | 'etcd' | 'custom'> | ✅ | Distributed state backend provider |
| endpoints | string[] | optional | Backend connection endpoints |
| keyPrefix | string | optional | Prefix for all keys (e.g., "plugin:my-plugin:") |
| ttl | integer | optional | State expiration time in seconds |
| auth | Object | optional | |
| replication | Object | optional | |
| customConfig | Record<string, any> | optional | Provider-specific configuration |
GracefulDegradation
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | |
| fallbackMode | Enum<'minimal' | 'cached' | 'readonly' | 'offline' | 'disabled'> | ✅ | |
| criticalDependencies | string[] | optional | Plugin IDs that are required for operation |
| optionalDependencies | string[] | optional | Plugin IDs that are nice to have but not required |
| degradedFeatures | Object[] | optional | |
| autoRecovery | Object | optional |
HotReloadConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | |
| watchPatterns | string[] | optional | Glob patterns to watch for changes |
| debounceDelay | integer | ✅ | Wait time after change detection before reload |
| preserveState | boolean | ✅ | Keep plugin state across reloads |
| stateStrategy | Enum<'memory' | 'disk' | 'distributed' | 'none'> | ✅ | How to preserve state during reload |
| distributedConfig | Object | optional | Configuration for distributed state management |
| shutdownTimeout | integer | ✅ | Maximum time to wait for graceful shutdown |
| beforeReload | string[] | optional | Hook names to call before reload |
| afterReload | string[] | optional | Hook names to call after reload |
PluginHealthCheck
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| interval | integer | ✅ | How often to perform health checks (default: 30s) |
| timeout | integer | ✅ | Maximum time to wait for health check response |
| failureThreshold | integer | ✅ | Consecutive failures needed to mark unhealthy |
| successThreshold | integer | ✅ | Consecutive successes needed to mark healthy |
| checkMethod | string | optional | Method name to call for health check |
| autoRestart | boolean | ✅ | Automatically restart plugin on health check failure |
| maxRestartAttempts | integer | ✅ | Maximum restart attempts before giving up |
| restartBackoff | Enum<'fixed' | 'linear' | 'exponential'> | ✅ | Backoff strategy for restart delays |
PluginHealthReport
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| status | Enum<'healthy' | 'degraded' | 'unhealthy' | 'failed' | 'recovering' | 'unknown'> | ✅ | Current health status of the plugin |
| timestamp | string | ✅ | |
| message | string | optional | |
| metrics | Object | optional | |
| checks | Object[] | optional | |
| dependencies | Object[] | optional |
PluginHealthStatus
Current health status of the plugin
Allowed Values
healthydegradedunhealthyfailedrecoveringunknown
PluginStateSnapshot
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| pluginId | string | ✅ | |
| version | string | ✅ | |
| timestamp | string | ✅ | |
| state | Record<string, any> | ✅ | |
| metadata | Object | optional |
PluginUpdateStrategy
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| mode | Enum<'manual' | 'automatic' | 'scheduled' | 'rolling'> | ✅ | |
| autoUpdateConstraints | Object | optional | |
| schedule | Object | optional | |
| rollback | Object | optional | |
| validation | Object | optional |