ObjectStackObjectStack

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 { AdvancedPluginLifecycleConfigSchema, DistributedStateConfigSchema, GracefulDegradationSchema, HotReloadConfigSchema, PluginHealthCheckSchema, PluginHealthReportSchema, PluginHealthStatusSchema, PluginStateSnapshotSchema, PluginUpdateStrategySchema } from '@objectstack/spec/kernel';
import type { AdvancedPluginLifecycleConfig, DistributedStateConfig, GracefulDegradation, HotReloadConfig, PluginHealthCheck, PluginHealthReport, PluginHealthStatus, PluginStateSnapshot, PluginUpdateStrategy } from '@objectstack/spec/kernel';

// Validate data
const result = AdvancedPluginLifecycleConfigSchema.parse(data);

AdvancedPluginLifecycleConfig

Properties

PropertyTypeRequiredDescription
health{ interval: integer; timeout: integer; failureThreshold: integer; successThreshold: integer; … }optional
hotReload{ enabled: boolean; watchPatterns?: string[]; debounceDelay: integer; preserveState: boolean; … }optional
degradation{ enabled: boolean; fallbackMode: Enum<'minimal' | 'cached' | 'readonly' | 'offline' | 'disabled'>; criticalDependencies?: string[]; optionalDependencies?: string[]; … }optional
updates{ mode: Enum<'manual' | 'automatic' | 'scheduled' | 'rolling'>; autoUpdateConstraints?: object; schedule?: object; rollback?: object; … }optional
resources{ maxMemory?: integer; maxCpu?: number; maxConnections?: integer; timeout?: integer }optional
observability{ enableMetrics: boolean; enableTracing: boolean; enableProfiling: boolean; metricsInterval: integer }optional

DistributedStateConfig

Properties

PropertyTypeRequiredDescription
providerEnum<'redis' | 'etcd' | 'custom'>Distributed state backend provider
endpointsstring[]optionalBackend connection endpoints
keyPrefixstringoptionalPrefix for all keys (e.g., "plugin:my-plugin:")
ttlintegeroptionalState expiration time in seconds
auth{ username?: string; password?: string; token?: string; certificate?: string }optional
replication{ enabled: boolean; minReplicas: integer }optional
customConfigRecord<string, any>optionalProvider-specific configuration

GracefulDegradation

Properties

PropertyTypeRequiredDescription
enabledboolean
fallbackModeEnum<'minimal' | 'cached' | 'readonly' | 'offline' | 'disabled'>
criticalDependenciesstring[]optionalPlugin IDs that are required for operation
optionalDependenciesstring[]optionalPlugin IDs that are nice to have but not required
degradedFeatures{ feature: string; enabled: boolean; reason?: string }[]optional
autoRecovery{ enabled: boolean; retryInterval: integer; maxAttempts: integer }optional

HotReloadConfig

Properties

PropertyTypeRequiredDescription
enabledboolean
watchPatternsstring[]optionalGlob patterns to watch for changes
debounceDelayintegerWait time after change detection before reload
preserveStatebooleanKeep plugin state across reloads
stateStrategyEnum<'memory' | 'disk' | 'distributed' | 'none'>How to preserve state during reload
distributedConfig{ provider: Enum<'redis' | 'etcd' | 'custom'>; endpoints?: string[]; keyPrefix?: string; ttl?: integer; … }optionalConfiguration for distributed state management
shutdownTimeoutintegerMaximum time to wait for graceful shutdown
beforeReloadstring[]optionalHook names to call before reload
afterReloadstring[]optionalHook names to call after reload

PluginHealthCheck

Properties

PropertyTypeRequiredDescription
intervalintegerHow often to perform health checks (default: 30s)
timeoutintegerMaximum time to wait for health check response
failureThresholdintegerConsecutive failures needed to mark unhealthy
successThresholdintegerConsecutive successes needed to mark healthy
checkMethodstringoptionalMethod name to call for health check
autoRestartbooleanAutomatically restart plugin on health check failure
maxRestartAttemptsintegerMaximum restart attempts before giving up
restartBackoffEnum<'fixed' | 'linear' | 'exponential'>Backoff strategy for restart delays

PluginHealthReport

Properties

PropertyTypeRequiredDescription
statusEnum<'healthy' | 'degraded' | 'unhealthy' | 'failed' | 'recovering' | 'unknown'>Current health status of the plugin
timestampstring
messagestringoptional
metrics{ uptime?: number; memoryUsage?: number; cpuUsage?: number; activeConnections?: number; … }optional
checks{ name: string; status: Enum<'passed' | 'failed' | 'warning'>; message?: string; data?: Record<string, any> }[]optional
dependencies{ pluginId: string; status: Enum<'healthy' | 'degraded' | 'unhealthy' | 'failed' | 'recovering' | 'unknown'>; message?: string }[]optional

PluginHealthStatus

Current health status of the plugin

Allowed Values

  • healthy
  • degraded
  • unhealthy
  • failed
  • recovering
  • unknown

PluginStateSnapshot

Properties

PropertyTypeRequiredDescription
pluginIdstring
versionstring
timestampstring
stateRecord<string, any>
metadata{ checksum?: string; compressed: boolean; encryption?: string }optional

PluginUpdateStrategy

Properties

PropertyTypeRequiredDescription
modeEnum<'manual' | 'automatic' | 'scheduled' | 'rolling'>
autoUpdateConstraints{ major: boolean; minor: boolean; patch: boolean }optional
schedule{ cron?: string; timezone: string; maintenanceWindow: integer }optional
rollback{ enabled: boolean; automatic: boolean; keepVersions: integer; timeout: integer }optional
validation{ checkCompatibility: boolean; runTests: boolean; testSuite?: string }optional

On this page