// Package golem is the golem15.golem plugin: the shared AI layer of // SummerCMS applications. It ports the WinterCMS Golem15.Golem plugin's AI // service (provider adapters for the Anthropic Messages API and the // OpenAI-compatible chat completions API, prompts, image generation, file // uploads, streaming), its AI model settings with their admin screen and // its SSRF guard. package golem import ( "embed" "io/fs" "git.golem15.com/golem15/sm-golem-plugin/console" "git.golem15.com/golem15/sm-golem-plugin/models" "git.golem15.com/golem15/sm-golem-plugin/updates" "git.golem15.com/golem15/summercms/modules/backpack" "git.golem15.com/golem15/summercms/modules/bonfire" "git.golem15.com/golem15/summercms/modules/pact" "git.golem15.com/golem15/summercms/modules/party" "github.com/go-gormigrate/gormigrate/v2" ) var ( _ party.Plugin = (*Plugin)(nil) _ pact.HasConfig = (*Plugin)(nil) _ pact.HasLang = (*Plugin)(nil) _ pact.HasMigrations = (*Plugin)(nil) _ pact.HasModels = (*Plugin)(nil) _ pact.HasCommands = (*Plugin)(nil) ) //go:embed config var configFS embed.FS //go:embed lang var langFS embed.FS // Plugin is the golem15.golem plugin. type Plugin struct { app *backpack.App } // ID is the plugin ID, also its config and lang namespace. func (p *Plugin) ID() string { return "golem15.golem" } // Requires is empty: the plugin depends on no other plugin. func (p *Plugin) Requires() []string { return nil } // Register keeps the application. func (p *Plugin) Register(app *backpack.App) error { p.app = app return nil } // Boot keeps the application. func (p *Plugin) Boot(app *backpack.App) error { p.app = app return nil } // ConfigFS ships config/config.yaml, merged under golem15.golem.*. func (p *Plugin) ConfigFS() fs.FS { return configFS } // LangFS ships the golem15.golem lang namespace. func (p *Plugin) LangFS() fs.FS { return langFS } // Migrations creates golem15_golem_models. func (p *Plugin) Migrations() []*gormigrate.Migration { return updates.All() } // Models is AiModel. func (p *Plugin) Models() []any { return models.All() } // Commands is golem:import-settings. func (p *Plugin) Commands() []bonfire.Command { return []bonfire.Command{console.ImportSettings(p.app)} } func init() { party.Register(&Plugin{}) }