Data contracts
Data contracts are the shapes a plugin promises to the kernel: what configuration it accepts, what each property looks like, what its operations take and return, and how it writes data. This page covers the schemas you declare in the manifest and the change sets your scripts return.
Configuration schema
Section titled “Configuration schema”configSchema is strict top-level AppSchema data.
| Supported | Not supported |
|---|---|
string, number, integer, boolean and enum fields |
Nested values, arrays and dates |
| Labels, hints, descriptions and secrets | Translation |
| Defaults and ordinary validation | Normalization and schema rules |
- Compiler-derived script keys and import-source configuration requirements must name declared fields.
- Script configuration access is derived from
getPluginConfigcalls, not authored as a separate list. See Configuration access. - A stored configuration may be at most 64 KiB; larger saves and restores are rejected.
- Configuration is never copied into automation input or history.
Environment variables
Section titled “Environment variables”System configuration keys are read from environment variables named
RYOT_PLUGIN__<PUBLISHER>__<NAME>__<CONFIG_KEY>. Each segment is uppercased, camelCase boundaries
become _, and any other non-alphanumeric run (such as -) becomes _. Two keys that normalize to
the same variable are rejected.
| Package ID | Config key | Variable |
|---|---|---|
ryot/media |
anilistClientId |
RYOT_PLUGIN__RYOT__MEDIA__ANILIST_CLIENT_ID |
Private configuration never reads environment variables.
User settings
Section titled “User settings”System and private plugins may declare userSettingsSchema: non-secret per-user preferences that
the kernel renders under Settings → Plugin preferences.
| Supported | Not supported |
|---|---|
| Primitive fields, primitive arrays and static enum choices | Secrets, uploads, OAuth connections, objects and dynamic choices |
AppSchema labels, descriptions, ordering, defaults, validation and rules |
- The schema must validate an empty record after applying defaults, so initial preferences and reset are always valid.
- Defaults apply to absent keys, not explicit nulls. A field with a default and
validation.requiredaccepts an empty record after defaults while rejecting null choices. - Values belong to the exact user’s installation, separate from
configSchema, and are included in account backups. Reset removes stored choices. - Schema evolution is additive; incompatible changes are rejected. Property labels and descriptions are display text and may change freely.
Reading settings
Section titled “Reading settings”- User-scoped backend scripts declare
getUserSettingsand callhost.getUserSettings()to read their own plugin’s current settings with defaults applied. Decode the JSON record with plugin-owned Effect schemas. - Retained execution reads use the pinned manifest schema; durable activity replay retains the recorded read.
- System execution without a user cannot read user settings.
getUserPreferencesexposes the kernel-owneddisableIntegrations. Interface locale, entity content language and week start remain kernel preferences.- Client code reads the same resolved settings with the client SDK’s
usePluginUserSettings(pluginId).
Writing settings
Section titled “Writing settings”An operation changes the execution user’s settings for its own plugin by returning a settings patch
in its change set.
- The kernel selects the installation from the executing plugin and user, never from the patch.
- Each top-level key replaces the stored value.
- Keys must exist in the pinned manifest schema, and the merged document must validate against the active schema and stay within 64 KiB.
- Integration, import and bootstrap executions cannot write settings.
Property schemas
Section titled “Property schemas”Every manifest property schema labels fields and static choices with catalogMessage(...) from
shared/messages.generated.ts. This covers configuration, user settings, entity, event,
relationship and signal properties, projections, import inputs, integration settings, search options
and page settings. Sandbox manifests write the literal { key }.
| Field | Audience |
|---|---|
label |
People, in forms |
hint |
People: user-facing help, rendered by forms |
description |
English documentation for models and developers; never shown in forms |
- A choice of countries or other regions is
{ value: "DE", kind: "region" }with an ISO 3166-1 alpha-2 or UN M49 code and no label. Forms name it in the viewer’s locale and list region choices, sorted by that name, after the other choices. - Kernel building blocks such as
imagesFieldorreviewPropertyFieldsbring their own kernel messages. ryot plugin buildand installation reject keys missing from the source catalog, and kernel messages that name no English kernel key or whose parameters do not match its arguments.- Numeric
normalize.round.scalein manifest property schemas other thanconfigSchemaapplies half-up rounding before validation.
RyotQL parameter labels
Section titled “RyotQL parameter labels”Every document a plugin authors, whether declared in queries, a saved view’s dataSources, or a
recipe its backend or client runs inline, is a PluginRyotQLDocument.
- Parameter and static choice labels are
catalogMessage(...)keys, or kernel messages from kernel recipe building blocks such asreportingParameterFields. Choice labels are optional and usually omitted. ryot plugin buildand installation check the labels of declared documents, and stored definitions carry them stamped with the plugin’s namespace.- Inline documents are stamped where they enter the kernel: by the sandbox host with the run’s plugin, and by the kernel client bridge with the requesting document’s plugin.
- Shared recipe factories that accept parameter schemas constrain them with
AuthoredAppSchema(from@ryot-app/plugin-kit/schemaor@ryot-app/plugin-client-sdk/ryotql). - Tests that bind or execute a plugin document directly stamp it first with
stampRyotQLDocument.
Entity schema contracts
Section titled “Entity schema contracts”| Field | Contract |
|---|---|
mergeIdentityProperties |
Unique top-level entity properties whose persisted JSON values must match before user state can merge. Omission means no property-based merge restriction. |
occursAtProperties |
Top-level string or datetime properties, in order, used as the entity’s date (see below) |
editor |
Opts the schema into the kernel entity editor (see below) |
refreshIntervalDays |
Provider refresh interval; see Population levels |
browse |
Filters and sorts; see Browse fields |
fold |
Derived values; see Folds |
Entity dates
Section titled “Entity dates”On every write the kernel stores the first occursAtProperties entry holding a valid timestamp as
the indexed occursAt column of the entity table, or null when none does.
- A query whose root filters
occursAton both sides starts from that date range, so use the column instead of casting the property for date windows. - A revision can add, change or remove the declaration, and existing rows are recomputed when it activates.
Entity editor
Section titled “Entity editor”editor: { relationships } opts an entity schema into the kernel entity editor. Users can then
create and edit their own entities of that schema, together with the listed relationships, through
EntityEditorScreen and the kernel editor save. No plugin operation is involved.
- Each entry is
{ slug, direction }, wheredirectionisoutgoing,incomingorparent. - Each slug must be unique and name a relationship schema declared in the same manifest that is
anchored on this entity schema: its source for
outgoing, its target forincomingandparent. - Omission means the schema has no editor.
- Adding, changing or removing an editor is an allowed evolution.
Crons target one script or workflow script by scriptSlug and use either { cron } or
{ tier: "infrequent" } as their schedule.
- They run with system subject through durable execution.
- Dispatch is skipped when
scheduler.disableDispatchersis enabled. - The kernel does not commit changes a cron script returns, so a cron that writes targets a workflow, whose steps and activities commit theirs.
Operations
Section titled “Operations”Operations map a public slug and user or integration auth to an operation-kind script.
| Field | Required | Meaning |
|---|---|---|
slug |
Yes | Public operation slug |
auth |
Yes | user or integration |
scriptSlug |
Yes | An operation-kind script |
title |
Yes | A short imperative phrase, such as “Log entry”, that Ryo shows when a person approves the operation |
description |
Yes | Behavior, including writes, deletes, conflicts and per-item misses |
input |
Yes | JSON Schema document |
output |
Yes | JSON Schema document |
hints |
Yes | { readOnly, destructive, idempotent } |
demoAccess |
user auth only |
allowed or protected |
entitlement |
No | Entitlement required to invoke it |
import { operationJsonSchema } from "@ryot-app/plugin-kit/operations";
operations: [ { auth: "user", demoAccess: "protected", title: "Delete exercise note", slug: exerciseNoteOperationSlugs.delete, scriptSlug: "operation.exercise-note-delete", output: operationJsonSchema(ExerciseNoteOutput), input: operationJsonSchema(ExerciseNoteDeleteInput), hints: { readOnly: false, destructive: true, idempotent: false }, description: "Permanently delete an existing private exercise note and return the deleted count.", },],Input and output schemas
Section titled “Input and output schemas”Generate each document with operationJsonSchema(sharedEffectSchema) from
@ryot-app/plugin-kit/operations, importing the same shared schemas that the script uses.
- The helper rejects opaque declarations and non-JSON types, retains referenced definitions, and describes the encoded wire values as draft 2020-12 JSON Schema.
- The sandbox decodes every definition’s input through its JSON codec, so the wire values the schema
describes, such as
nullfor an optional key, decode as they do for any JSON caller. - It publishes representable structural constraints. Custom business checks such as timestamp ordering remain authoritative runtime Effect validation. Passing the published schema does not guarantee that the script decoder or business validation will accept the input.
readOnlydescribes actual effects, independently ofdemoAccess.- Read-only operations must be non-destructive and idempotent.
- A writing operation may also be idempotent, including a destructive write whose repetition has no additional effect.
- Descriptions should explain writes, deletes, conflicts and per-item misses so people and tool clients can choose operations safely.
Results and errors
Section titled “Results and errors”An operation’s run returns { output, changes? }. output is what the caller receives and what
the declared output schema describes. changes is a change set the kernel commits
after the run ends; every operation returns its writes this way. The kernel commits them atomically,
runs event policies over them, and answers { result, committed }, where committed carries the root
entity ID and each written event ID by item identity.
| Outcome | HTTP status |
|---|---|
reject(message) from @ryot-app/plugin-backend-sdk/operation |
422, with the message |
| A policy rejection of the changes | 422 |
| A stale baseline | 409 changes-conflict |
| Any other invalid or unauthorized change set | 502 |
- Refuse a request that cannot succeed as submitted with
reject(message); outputs are success-only. - An operation that finds its baseline gone while reading fails with
StaleBaselineError({ conflict }), which reaches the caller the same way as a stale baseline.
On the client, client.operations.invoke resolves the output, and
client.operations.invokeCommitted resolves { output, committed } (CommittedChanges). Both fail a
stale baseline with ChangesConflict (isChangesConflict), carrying the commit’s conflict code, and
a refusal with OperationRejected (isOperationRejected).
Change sets
Section titled “Change sets”Scripts never write directly. They return a change set that the kernel commits atomically after the
run. @ryot-app/plugin-backend-sdk/core exports the ChangeSet type, CHANGE_SET_LIMITS and the
item types, plus these helpers:
| Group | Helpers |
|---|---|
| References | rootEntity, existingEntity(id), upsertedGlobalEntity(entitySchemaSlug, externalId) |
| Baselines | entityUpdateTarget(entity), expectedEventFields(event, editable?), expectedRelationshipProperties(properties, checked) |
| Builders | createEventChange, updateEventChange, deleteEventChange |
Every part names the writing plugin’s own schemas by slug, each declared by its revision.
| Part | Writes | Writer |
|---|---|---|
entity |
A root user entity create, or an update with its expected name, properties and updatedAt |
User executions |
entities.deletes |
User entities, cascading their events | User executions |
entities.clears |
An entity’s user data: its events and relationships | User executions |
entities.merges |
One entity’s user data into another of the same plugin schema | User executions |
entities.ensures |
One user entity per schema, created only when absent | The plugin’s user bootstrap script |
relationships |
upserts (merge or replace properties, optionally expected) and deletes between root or existing entities |
User executions and user automation runs |
events |
One changes list of create, update and delete items, with expected session events and baselines |
User executions and user automation runs |
settings |
A patch of the plugin’s settings for the execution user | User executions, except integrations, imports and bootstraps |
signals |
Signal emissions with a discriminator and optional subject entity | Automation runs; system ones need a system plugin automation |
notifications |
Messages from the plugin catalog for the run’s account | User automation runs |
globalEntities |
Provider-owned global entities by external ID | System executions of a system plugin’s provider |
globalRelationships |
Groups with a self selector (one entity schema’s self relationships) or anchored one; existing or upserted endpoints |
System executions of a system plugin |
folds |
Requests to fold entities again with no change, for the execution user (user) or every user who folded them (all-users) |
User executions; all-users from a system execution needs a system plugin |
- A
{ kind: "root" }reference requiresentity. - User entities never carry provenance, global scope, ownership or
populatedAt. - Relationship upserts must choose
mergeorreplace; membership upserts usemergeto preserve annotations. - Global writes run no policies.
- Notifications are queued for delivery after the commit.
- A part the writer may not write fails the whole change set.
See Script writes for how the kernel commits them.
Signal notifications
Section titled “Signal notifications”A signal notification automation passes notifySignals(signals) from
@ryot-app/plugin-backend-sdk/automation as the run of defineAutomation. Each signal schema slug
names a properties schema and a notify formatter; the formatted message is returned as a
change-set notification, and undecodable properties fail with SignalNotificationError.
export default defineAutomation({ manifest, run: notifySignals({ "reminder.due": { properties: Schema.Struct({ message: Schema.String }), notify: ({ message }) => catalogMessage("notification.reminder-due", { message }), }, }),});Review content
Section titled “Review content”@ryot-app/plugin-kit/schema exposes shared review helpers:
| Export | Purpose |
|---|---|
ReviewContent |
Review content fields for operation inputs |
ReviewRating |
The rating field on its own |
requireReviewContent |
The shared content check |
reviewProperties |
Maps review input to stored properties |
reviewPropertiesPatch |
Builds a properties patch from review input |
reviewPropertyKeys |
The review property keys |
reviewRatingField |
The rating property field |
reviewPropertyFields |
The review property fields, with their own kernel messages |
- Compose operation inputs from the content fields and apply the shared content check, or reuse
ReviewRatingwith a plugin-owned text rule. - The mapper omits absent text and rating, and stores the spoiler flag only with text and only when the input carries one.
- The patch sets those properties and removes every other review key.
- Ratings are stored 0–100 whatever scale the user enters them in.
- Manifest fields accept plugin-owned descriptive copy.
- Plugins keep target admission, lifecycle hooks and operation execution.