Versions in this module Expand all Collapse all v1 v1.0.2 Oct 28, 2026 v1.0.1 Oct 27, 2026 Changes in this version + const CookiePrefix + const DefaultFetchPerMinute + const ManifestFile + const WasmFile + var ErrCommunityScripts = errors.New("site.scripts cannot be granted to a community package") + var ErrFetchBlocked = safefetch.ErrBlocked + var ErrKVQuota = errors.New("plugin kv quota exceeded") + var ErrNotRequested = errors.New("permission not requested by the plugin") + var ErrPluginNotFound = errors.New("plugin not found") + var ErrRoleUnavailable = errors.New("plugin database role unavailable") + var ErrSQLBlocked = errors.New("sql blocked") + var ErrUnknownPermission = errors.New("unknown permission") + func AgentFirstCrawlObserver(e *hooks.Engine) func(agents.FirstCrawl) + func AgentHitObserver(e *hooks.Engine) func([]agents.Hit) + func BeforeSave(engine *hooks.Engine) entity.BeforeSaveFunc + func BindHostHooks(e *hooks.Engine) + func CompileSchema(schema []byte) (*jsonschema.Schema, error) + func DecodeArgs(raw json.RawMessage) ([]any, error) + func ExtSources(h *hooks.Engine) render.ExtSourceFunc + func HeadFilter(h *hooks.Engine) render.HeadFilter + func HostFunctionsFor(perms []sdk.Permission) []string + func MaskWriteOnly(schema []byte, v json.RawMessage) json.RawMessage + func MergeDefaults(schema []byte, stored json.RawMessage) json.RawMessage + func PluginCookieName(plugin, name string) string + func PreserveWriteOnly(schema []byte, old, in json.RawMessage) json.RawMessage + func SDKRefusal(m sdk.Manifest) error + func SchemaName(plugin string) string + func WriteOnlySet(schema []byte, stored json.RawMessage) map[string]bool + type API struct + func NewAPI(svc Services, grants Grants, manifest func(string) (sdk.Manifest, bool), ...) *API + func (a *API) Call(ctx context.Context, plugin string, in []byte) []byte + type Assets struct + Migrations []Migration + Partials map[string]string + Sections map[string]string + func AssetsFromFS(root fs.FS) (Assets, error) + type Caller func(ctx context.Context, plugin, export string, in []byte) ([]byte, error) + type Config struct + Grants Grants + Scheduler Scheduler + Services Services + type EntityPaths interface + BaseURL func(ctx context.Context) string + Path func(ctx context.Context, ent *entity.Entity) string + Resolve func(ctx context.Context, path string) (*entity.Entity, error) + type EntitySink struct + func NewEntitySink(engine *hooks.Engine, log *slog.Logger) *EntitySink + func (s *EntitySink) Emit(ctx context.Context, ev entity.Event) + func (s *EntitySink) EntityPublished(ctx context.Context, id uuid.UUID, schemaSlug, slug, name string, version int) + func (s *EntitySink) SetLocaleLookup(f func(context.Context, uuid.UUID) string) + type FetchRequest struct + Body string + BodyB64 string + Headers map[string]string + Method string + TimeoutMS int + URL string + type FetchResponse struct + Body string + BodyB64 string + Headers map[string]string + Status int + Truncated bool + type Fetcher struct + func NewFetcher() *Fetcher + func NewFetcherForTests() *Fetcher + func (f *Fetcher) Do(ctx context.Context, plugin string, allowed []string, req FetchRequest) (*FetchResponse, error) + type FieldError struct + Message string + Path string + func Validate(sch *jsonschema.Schema, v json.RawMessage) []FieldError + type GrantStore struct + func NewGrantStore(pool *pgxpool.Pool) *GrantStore + func (g *GrantStore) Granted(plugin string) []sdk.Permission + func (g *GrantStore) Has(plugin string, perm sdk.Permission) bool + func (g *GrantStore) Load(ctx context.Context) error + func (g *GrantStore) Set(ctx context.Context, plugin string, perms []sdk.Permission) error + type Grants interface + Granted func(plugin string) []sdk.Permission + Has func(plugin string, perm sdk.Permission) bool + Set func(ctx context.Context, plugin string, perms []sdk.Permission) error + type Lookup func(ctx context.Context, host string) ([]netip.Addr, error) + type Mailer interface + IsConfigured func() bool + Send func(ctx context.Context, to []string, subject, htmlBody, textBody string) error + type Migration struct + Name string + Stmts []string + Version int64 + func ReadMigrations(fsys fs.FS, dir string) ([]Migration, error) + type PageFilter struct + func NewPageFilter(engine *hooks.Engine) *PageFilter + func (p *PageFilter) Active() bool + func (p *PageFilter) Apply(ctx context.Context, in sdk.PageContext) sdk.PageContext + type PluginDB struct + AllowPublicObjects bool + func NewPluginDB(pool *pgxpool.Pool, log *slog.Logger) *PluginDB + func (d *PluginDB) Close() + func (d *PluginDB) Drop(ctx context.Context, plugin string) error + func (d *PluginDB) Exec(ctx context.Context, plugin, sql string, args ...any) (int64, error) + func (d *PluginDB) KVDelete(ctx context.Context, plugin, key string) error + func (d *PluginDB) KVGet(ctx context.Context, plugin, key string) (json.RawMessage, bool, error) + func (d *PluginDB) KVList(ctx context.Context, plugin, prefix string, limit int) ([]string, error) + func (d *PluginDB) KVSet(ctx context.Context, plugin, key string, value json.RawMessage, ...) error + func (d *PluginDB) Migrate(ctx context.Context, plugin string, migs []Migration) (int, error) + func (d *PluginDB) Provision(ctx context.Context, plugin string) error + func (d *PluginDB) PublicObjects(ctx context.Context) ([]string, error) + func (d *PluginDB) Query(ctx context.Context, plugin, sql string, args ...any) (*QueryResult, error) + func (d *PluginDB) Reprovision(ctx context.Context, plugin string) error + func (d *PluginDB) RoleError(plugin string) error + func (d *PluginDB) WarnPublicObjects(ctx context.Context) []string + type QueryResult struct + Columns []string + Rows [][]any + Truncated bool + type RouteRegistry struct + func NewRouteRegistry(call Caller, public bool, log *slog.Logger) *RouteRegistry + func (g *RouteRegistry) Plugins() []string + func (g *RouteRegistry) Serve(w http.ResponseWriter, r *http.Request, plugin, rest string, ...) + func (g *RouteRegistry) Set(plugin string, routes []sdk.Route) + type Runtime struct + func NewRuntime(log *slog.Logger, engine *hooks.Engine, cacheDir string) (*Runtime, error) + func (r *Runtime) AdminRoutes() *RouteRegistry + func (r *Runtime) CallHost(ctx context.Context, plugin string, req sdk.CallRequest) []byte + func (r *Runtime) Close(ctx context.Context) + func (r *Runtime) Configure(c Config) + func (r *Runtime) ExtSourceList() []builder.ExtSource + func (r *Runtime) Grant(ctx context.Context, name string, perms []sdk.Permission) (Status, error) + func (r *Runtime) Grants() Grants + func (r *Runtime) Host() *wasmhost.Host + func (r *Runtime) Load(ctx context.Context, m sdk.Manifest, wasm []byte) Status + func (r *Runtime) LoadDir(ctx context.Context, dir string) []Status + func (r *Runtime) LoadWith(ctx context.Context, m sdk.Manifest, wasm []byte, assets Assets) Status + func (r *Runtime) PublicRoutes() *RouteRegistry + func (r *Runtime) ScriptsDropped(plugin string) bool + func (r *Runtime) SetGrantPolicy(f func(plugin string, perms []sdk.Permission) error) + func (r *Runtime) SetScriptsDeny(f func(plugin string) bool) + func (r *Runtime) Statuses() []Status + func (r *Runtime) Unload(ctx context.Context, name string) + type Scheduler interface + Schedule func(id string, every time.Duration, fn func(context.Context) error) error + Unschedule func(prefix string) + type Services struct + DB *PluginDB + Entities *entity.Service + FetchPerMinute int + Fetcher *Fetcher + Forms *form.Service + Mail Mailer + Media *media.Service + Menus *menu.Service + Paths EntityPaths + Redirects *redirect.Service + Settings *SettingsStore + Terms *taxonomy.Service + type SettingsStore struct + func NewSettingsStore(pool *pgxpool.Pool) *SettingsStore + func (s *SettingsStore) Get(ctx context.Context, plugin string) (json.RawMessage, error) + func (s *SettingsStore) Put(ctx context.Context, plugin string, v json.RawMessage) error + type Status struct + DataError string + Error string + Hooks []string + Loaded bool + Manifest sdk.Manifest + Name string + func ListDir(dir string) ([]Status, error)