package plugin // PluginBridge allows plugins to share services with each other. // Plugins register named services during startup; other plugins look them up at runtime. type PluginBridge interface { RegisterService(pluginName, serviceName string, service any) GetService(pluginName, serviceName string) any } // GetServiceAs retrieves a typed service from the bridge. func GetServiceAs[T any](bridge PluginBridge, pluginName, serviceName string) (T, bool) { var zero T if bridge == nil { return zero, false } svc := bridge.GetService(pluginName, serviceName) if svc == nil { return zero, false } typed, ok := svc.(T) return typed, ok }