Versions in this module Expand all Collapse all v0 v0.9.0 Aug 6, 2026 Changes in this version + const HealthPingFunc + var DefaultResourcePolicy = pkgplugin.DefaultResourcePolicy + var PluginCallerKey = pluginCallerKeyType + var PluginLanguageKey = pluginLangKeyType + func RegisterPluginJobs(mgr *Manager, sched PlatformScheduler) int + func SetGlobalManager(m *Manager) + func SetTemplateOverrides(registry *TemplateOverrideRegistry) + func SetTemplatePluginManager(mgr *Manager) + type CascadeSpec = pkgplugin.CascadeSpec + type CustomFieldFilter = pkgplugin.CustomFieldFilter + type CustomFieldSpec = pkgplugin.CustomFieldSpec + type DefaultHostAPI struct + func NewDefaultHostAPI() *DefaultHostAPI + func (h *DefaultHostAPI) CacheDelete(ctx context.Context, key string) error + func (h *DefaultHostAPI) CacheGet(ctx context.Context, key string) ([]byte, bool, error) + func (h *DefaultHostAPI) CacheSet(ctx context.Context, key string, value []byte, ttlSeconds int) error + func (h *DefaultHostAPI) CallPlugin(ctx context.Context, pluginName, fn string, args json.RawMessage) (json.RawMessage, error) + func (h *DefaultHostAPI) ConfigGet(ctx context.Context, key string) (string, error) + func (h *DefaultHostAPI) CustomFieldsGet(ctx context.Context, entityType string, objectID int64, fields []string) (map[string]any, error) + func (h *DefaultHostAPI) CustomFieldsQuery(ctx context.Context, entityType string, filters []CustomFieldFilter) ([]int64, error) + func (h *DefaultHostAPI) CustomFieldsSet(ctx context.Context, entityType string, objectID int64, values map[string]any) error + func (h *DefaultHostAPI) DBExec(ctx context.Context, query string, args ...any) (int64, error) + func (h *DefaultHostAPI) DBQuery(ctx context.Context, query string, args ...any) ([]map[string]any, error) + func (h *DefaultHostAPI) DeleteFile(ctx context.Context, key string) error + func (h *DefaultHostAPI) EntityHardDelete(ctx context.Context, entityType string, entityID int64, reason string) error + func (h *DefaultHostAPI) EntityRestore(ctx context.Context, entityType string, entityID int64) error + func (h *DefaultHostAPI) EntitySoftDelete(ctx context.Context, entityType string, entityID int64, reason string) error + func (h *DefaultHostAPI) GetFile(ctx context.Context, key string) ([]byte, map[string]string, error) + func (h *DefaultHostAPI) HTTPRequest(ctx context.Context, method, url string, headers map[string]string, ...) (int, []byte, error) + func (h *DefaultHostAPI) ListFiles(ctx context.Context, prefix string) ([]FileInfo, error) + func (h *DefaultHostAPI) Log(ctx context.Context, level, message string, fields map[string]any) + func (h *DefaultHostAPI) OrgID(ctx context.Context) int64 + func (h *DefaultHostAPI) PublishEvent(ctx context.Context, channel string, eventType string, data string) error + func (h *DefaultHostAPI) RecycleBinList(ctx context.Context, entityType string) (json.RawMessage, error) + func (h *DefaultHostAPI) SecureConfigGet(ctx context.Context, key string) (string, error) + func (h *DefaultHostAPI) SecureConfigSet(ctx context.Context, key string, value string) error + func (h *DefaultHostAPI) SendEmail(ctx context.Context, to, subject, body string, html bool) error + func (h *DefaultHostAPI) StoreFile(ctx context.Context, key string, data []byte, metadata map[string]string) error + func (h *DefaultHostAPI) Translate(ctx context.Context, key string, args ...any) string + func (m *DefaultHostAPI) GenerateThumbnail(_ context.Context, _ []byte, _ string, _, _ int) ([]byte, string, error) + type ErrorCodeSpec = pkgplugin.ErrorCodeSpec + type FileInfo = pkgplugin.FileInfo + type FileStorageBackend interface + Delete func(path string) error + Get func(path string) ([]byte, map[string]string, error) + List func(prefix string) ([]pkgplugin.FileInfo, error) + Store func(path string, data []byte, metadata map[string]string) error + Usage func(prefix string) (int64, error) + type GKRegistration = pkgplugin.GKRegistration + type HostAPI = pkgplugin.HostAPI + type I18nSpec = pkgplugin.I18nSpec + type JobSpec = pkgplugin.JobSpec + type LazyLoader interface + Discovered func() []string + EnsureLoaded func(ctx context.Context, name string) error + Forget func(name string) + type LogBuffer struct + func GetLogBuffer() *LogBuffer + func NewLogBuffer(maxSize int) *LogBuffer + func (b *LogBuffer) Add(entry LogEntry) + func (b *LogBuffer) Clear() + func (b *LogBuffer) Count() int + func (b *LogBuffer) GetAll() []LogEntry + func (b *LogBuffer) GetByLevel(minLevel string) []LogEntry + func (b *LogBuffer) GetByPlugin(pluginName string) []LogEntry + func (b *LogBuffer) GetRecent(n int) []LogEntry + func (b *LogBuffer) Log(plugin, level, message string, fields map[string]any) + type LogEntry struct + Fields map[string]any + Level string + Message string + Plugin string + Timestamp time.Time + type MCPToolSpec = pkgplugin.MCPToolSpec + type Manager struct + OnPluginLoaded func() + func NewManager(host HostAPI) *Manager + func (m *Manager) AllHealthStatuses() map[string]PluginHealth + func (m *Manager) AllPluginStats() []StatsSnapshot + func (m *Manager) AllPolicies() map[string]ResourcePolicy + func (m *Manager) AllWidgets(location string) []PluginWidget + func (m *Manager) Call(ctx context.Context, pluginName, fn string, args []byte) ([]byte, error) + func (m *Manager) CallFrom(ctx context.Context, callerPlugin, targetPlugin, fn string, args []byte) ([]byte, error) + func (m *Manager) Disable(name string) error + func (m *Manager) Discovered() []string + func (m *Manager) Enable(name string) error + func (m *Manager) Forget(name string) + func (m *Manager) Get(name string) (Plugin, bool) + func (m *Manager) GetPolicy(name string) (ResourcePolicy, bool) + func (m *Manager) HealthStatus(name string) (PluginHealth, bool) + func (m *Manager) HiddenMenuItems() []string + func (m *Manager) Host() HostAPI + func (m *Manager) InstalledPluginNames() []string + func (m *Manager) IsEnabled(name string) bool + func (m *Manager) Jobs() []PluginJob + func (m *Manager) LandingPage() string + func (m *Manager) LandingPageFor(name string) string + func (m *Manager) List() []GKRegistration + func (m *Manager) MenuItems(location string) []PluginMenuItem + func (m *Manager) PluginStats(name string) (StatsSnapshot, bool) + func (m *Manager) PolicyFor(name string) *ResourcePolicy + func (m *Manager) Register(ctx context.Context, p Plugin) error + func (m *Manager) ReplacePlugin(ctx context.Context, oldName string, newPlugin Plugin) error + func (m *Manager) ResetCrashLoop(name string) bool + func (m *Manager) Routes() []PluginRoute + func (m *Manager) Scheduler() PlatformScheduler + func (m *Manager) SetLazyLoader(loader LazyLoader) + func (m *Manager) SetPolicy(name string, policy ResourcePolicy) + func (m *Manager) SetRestarter(r Restarter) + func (m *Manager) SetScheduler(sched PlatformScheduler) + func (m *Manager) ShutdownAll(ctx context.Context) error + func (m *Manager) SkipsOrgInjection(name string) bool + func (m *Manager) StartHealthChecker(interval, probeTimeout time.Duration) func() + func (m *Manager) Unload(name string) + func (m *Manager) Unregister(ctx context.Context, name string) error + func (m *Manager) Widgets(location string) []PluginWidget + type MenuItemSpec = pkgplugin.MenuItemSpec + type Permission = pkgplugin.Permission + type PlatformScheduledJob struct + Handler string + Name string + Schedule string + Slug string + TimeoutSeconds int + type PlatformScheduler interface + AddJob func(job *PlatformScheduledJob) error + RegisterHandler func(name string, ...) + type Plugin = pkgplugin.Plugin + type PluginCaller struct + Ctx context.Context + Manager *Manager + PluginName string + func (pc *PluginCaller) Call(fn string, args ...interface{}) interface{} + func (pc *PluginCaller) Translate(key string, args ...interface{}) string + func (pc *PluginCaller) Widget(widgetID string) string + type PluginDisabledError struct + CallerPlugin string + PluginName string + func (e *PluginDisabledError) Error() string + type PluginHealth struct + ConsecutiveFailures int + CrashLoopAbandoned bool + Healthy bool + LastCheck time.Time + LastError string + LastRestartAt time.Time + LastSuccess time.Time + NextRestartAt time.Time + Payload json.RawMessage + RestartAttempts int + type PluginJob struct + PluginName string + type PluginMenuItem struct + PluginName string + type PluginNotFoundError struct + CallerPlugin string + Function string + PluginName string + func (e *PluginNotFoundError) Error() string + type PluginRoute struct + PluginName string + RouteSpec RouteSpec + type PluginStats struct + CacheOps atomic.Int64 + Calls atomic.Int64 + DBExecs atomic.Int64 + DBQueries atomic.Int64 + Errors atomic.Int64 + HTTPRequests atomic.Int64 + LastCallAt atomic.Int64 + func (s *PluginStats) Snapshot(name string) StatsSnapshot + type PluginWidget struct + PluginName string + type ProdHostAPI struct + PluginManager *Manager + SSEBroker *SSEBroker + func NewProdHostAPI(opts ...ProdHostAPIOption) *ProdHostAPI + func (h *ProdHostAPI) CacheDelete(ctx context.Context, key string) error + func (h *ProdHostAPI) CacheGet(ctx context.Context, key string) ([]byte, bool, error) + func (h *ProdHostAPI) CacheSet(ctx context.Context, key string, value []byte, ttlSeconds int) error + func (h *ProdHostAPI) CallPlugin(ctx context.Context, pluginName, fn string, args json.RawMessage) (json.RawMessage, error) + func (h *ProdHostAPI) ConfigGet(ctx context.Context, key string) (string, error) + func (h *ProdHostAPI) CustomFieldsGet(ctx context.Context, entityType string, objectID int64, fields []string) (map[string]any, error) + func (h *ProdHostAPI) CustomFieldsQuery(ctx context.Context, entityType string, filters []CustomFieldFilter) ([]int64, error) + func (h *ProdHostAPI) CustomFieldsSet(ctx context.Context, entityType string, objectID int64, values map[string]any) error + func (h *ProdHostAPI) DBExec(ctx context.Context, query string, args ...any) (int64, error) + func (h *ProdHostAPI) DBQuery(ctx context.Context, query string, args ...any) ([]map[string]any, error) + func (h *ProdHostAPI) DeleteFile(ctx context.Context, key string) error + func (h *ProdHostAPI) EntityHardDelete(ctx context.Context, entityType string, entityID int64, reason string) error + func (h *ProdHostAPI) EntityRestore(ctx context.Context, entityType string, entityID int64) error + func (h *ProdHostAPI) EntitySoftDelete(ctx context.Context, entityType string, entityID int64, reason string) error + func (h *ProdHostAPI) GenerateThumbnail(ctx context.Context, data []byte, contentType string, maxWidth, maxHeight int) ([]byte, string, error) + func (h *ProdHostAPI) GetFile(ctx context.Context, key string) ([]byte, map[string]string, error) + func (h *ProdHostAPI) HTTPRequest(ctx context.Context, method, url string, headers map[string]string, ...) (int, []byte, error) + func (h *ProdHostAPI) ListFiles(ctx context.Context, prefix string) ([]pkgplugin.FileInfo, error) + func (h *ProdHostAPI) Log(ctx context.Context, level, message string, fields map[string]any) + func (h *ProdHostAPI) OrgID(ctx context.Context) int64 + func (h *ProdHostAPI) PublishEvent(ctx context.Context, channel string, eventType string, data string) error + func (h *ProdHostAPI) RecycleBinList(ctx context.Context, entityType string) (json.RawMessage, error) + func (h *ProdHostAPI) SecureConfigGet(ctx context.Context, key string) (string, error) + func (h *ProdHostAPI) SecureConfigSet(ctx context.Context, key string, value string) error + func (h *ProdHostAPI) SendEmail(ctx context.Context, to, subject, body string, html bool) error + func (h *ProdHostAPI) StoreFile(ctx context.Context, key string, data []byte, metadata map[string]string) error + func (h *ProdHostAPI) Translate(ctx context.Context, key string, args ...any) string + type ProdHostAPIOption func(*ProdHostAPI) + func WithCache(c *cache.RedisCache) ProdHostAPIOption + func WithDB(name string, db *sql.DB) ProdHostAPIOption + func WithDefaultDB(name string) ProdHostAPIOption + func WithLogger(logger *slog.Logger) ProdHostAPIOption + func WithPluginManager(mgr *Manager) ProdHostAPIOption + func WithThumbnailService(ts ThumbnailGenerator) ProdHostAPIOption + type ResourcePolicy = pkgplugin.ResourcePolicy + type ResourceRequest = pkgplugin.ResourceRequest + type Restarter interface + Reload func(ctx context.Context, name string) error + type RouteSpec = pkgplugin.RouteSpec + type SSEBroker struct + func NewSSEBroker() *SSEBroker + func (b *SSEBroker) ClientCount() int + func (b *SSEBroker) Publish(event SSEEvent) + func (b *SSEBroker) ServeChannel(w http.ResponseWriter, r *http.Request, pluginName, channel string) + func (b *SSEBroker) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (b *SSEBroker) Subscribe(plugin, channel string) chan SSEEvent + func (b *SSEBroker) Unsubscribe(ch chan SSEEvent) + type SSEEvent struct + Channel string + Data string + Plugin string + Type string + type SandboxedHostAPI struct + func NewSandboxedHostAPI(inner HostAPI, pluginName string, policy ResourcePolicy) *SandboxedHostAPI + func (s *SandboxedHostAPI) CacheDelete(ctx context.Context, key string) error + func (s *SandboxedHostAPI) CacheGet(ctx context.Context, key string) ([]byte, bool, error) + func (s *SandboxedHostAPI) CacheSet(ctx context.Context, key string, value []byte, ttlSeconds int) error + func (s *SandboxedHostAPI) CallPlugin(ctx context.Context, pluginName, fn string, args json.RawMessage) (json.RawMessage, error) + func (s *SandboxedHostAPI) ConfigGet(ctx context.Context, key string) (string, error) + func (s *SandboxedHostAPI) CustomFieldsGet(ctx context.Context, entityType string, objectID int64, fields []string) (map[string]any, error) + func (s *SandboxedHostAPI) CustomFieldsQuery(ctx context.Context, entityType string, filters []CustomFieldFilter) ([]int64, error) + func (s *SandboxedHostAPI) CustomFieldsSet(ctx context.Context, entityType string, objectID int64, values map[string]any) error + func (s *SandboxedHostAPI) DBExec(ctx context.Context, query string, args ...any) (int64, error) + func (s *SandboxedHostAPI) DBQuery(ctx context.Context, query string, args ...any) ([]map[string]any, error) + func (s *SandboxedHostAPI) DeleteFile(ctx context.Context, key string) error + func (s *SandboxedHostAPI) EntityHardDelete(ctx context.Context, entityType string, entityID int64, reason string) error + func (s *SandboxedHostAPI) EntityRestore(ctx context.Context, entityType string, entityID int64) error + func (s *SandboxedHostAPI) EntitySoftDelete(ctx context.Context, entityType string, entityID int64, reason string) error + func (s *SandboxedHostAPI) GenerateThumbnail(ctx context.Context, data []byte, contentType string, maxWidth, maxHeight int) ([]byte, string, error) + func (s *SandboxedHostAPI) GetFile(ctx context.Context, key string) ([]byte, map[string]string, error) + func (s *SandboxedHostAPI) HTTPRequest(ctx context.Context, method, url string, headers map[string]string, ...) (int, []byte, error) + func (s *SandboxedHostAPI) ListFiles(ctx context.Context, prefix string) ([]FileInfo, error) + func (s *SandboxedHostAPI) Log(ctx context.Context, level, message string, fields map[string]any) + func (s *SandboxedHostAPI) OrgID(ctx context.Context) int64 + func (s *SandboxedHostAPI) PublishEvent(ctx context.Context, channel string, eventType string, data string) error + func (s *SandboxedHostAPI) RecycleBinList(ctx context.Context, entityType string) (json.RawMessage, error) + func (s *SandboxedHostAPI) SecureConfigGet(ctx context.Context, key string) (string, error) + func (s *SandboxedHostAPI) SecureConfigSet(ctx context.Context, key string, value string) error + func (s *SandboxedHostAPI) SendEmail(ctx context.Context, to, subject, body string, html bool) error + func (s *SandboxedHostAPI) Stats() StatsSnapshot + func (s *SandboxedHostAPI) StoreFile(ctx context.Context, key string, data []byte, metadata map[string]string) error + func (s *SandboxedHostAPI) Translate(ctx context.Context, key string, args ...any) string + func (s *SandboxedHostAPI) UpdatePolicy(policy ResourcePolicy) + type StatsSnapshot struct + CacheOps int64 + Calls int64 + DBExecs int64 + DBQueries int64 + Errors int64 + HTTPRequests int64 + LastCallAt int64 + PluginName string + type TemplateOverride struct + Handler string + PluginName string + TemplateName string + type TemplateOverrideRegistry struct + func GetTemplateOverrides() *TemplateOverrideRegistry + func NewTemplateOverrideRegistry(mgr *Manager) *TemplateOverrideRegistry + func (r *TemplateOverrideRegistry) GetOverride(templateName string) *TemplateOverride + func (r *TemplateOverrideRegistry) HasOverride(templateName string) bool + func (r *TemplateOverrideRegistry) List() map[string]*TemplateOverride + func (r *TemplateOverrideRegistry) Register(pluginName string, templates []TemplateSpec) + func (r *TemplateOverrideRegistry) RenderOverride(ctx context.Context, templateName string, data map[string]any) (string, bool) + func (r *TemplateOverrideRegistry) Unregister(pluginName string) + type TemplateSpec = pkgplugin.TemplateSpec + type ThumbnailGenerator interface + GenerateThumbnail func(data []byte, contentType string, maxWidth, maxHeight int) ([]byte, string, error) + func NewThumbnailGenerator(...) ThumbnailGenerator + type ThumbnailServiceAdapter struct + func (a *ThumbnailServiceAdapter) GenerateThumbnail(data []byte, contentType string, maxWidth, maxHeight int) ([]byte, string, error) + type UIAuthSpec = pkgplugin.UIAuthSpec + type UIBrandingSpec = pkgplugin.UIBrandingSpec + type UINavItem = pkgplugin.UINavItem + type UINavSpec = pkgplugin.UINavSpec + type UIPWASpec = pkgplugin.UIPWASpec + type UIRouteSpec = pkgplugin.UIRouteSpec + type UISpec = pkgplugin.UISpec + type WidgetSpec = pkgplugin.WidgetSpec