The contract half of the engagement system: a module (and core) can DECLARE an
event with a payload contract and fire it. Nothing delivers yet — `emit`
validates, logs and stops, and Phase 4 replaces that log line with the engine.
`api.registerEventTriggers` and `api.registerAudiences` ride the existing
stage()/apply() validate-then-commit discipline, so a registrant that throws
halfway leaves nothing behind. `ctx.events.emit` is fire-and-forget and binds
the owner from the calling module — a module fires its own triggers and no one
else's. `ctx.inbox.push` is present and throws until Phase 7, the shape 1.6.0
settled on for a member that arrives a phase late.
MODULE_API_VERSION 1.7.0 on both halves. Additions only; module-uo's
`coreApi: "^1.3.0"` still resolves.
Three design decisions, approved by the org lead before any code:
ONE NAMESPACE for trigger ids and notification-stream ids (ENGAGEMENT.md §7.2,
against the recommendation in the text). A trigger is a payload contract
attached to an id that may also carry a subscription toggle, so an id has
exactly one owner across both facets, checked in both directions. Core's five
trigger ids ARE its five stream ids, so the same-owner upgrade case is
exercised on every boot rather than only by a module. It keeps
notification_channel_prefs single-keyed in Phase 3, where two namespaces would
have forced a `kind` discriminator into its primary key.
Two knock-on effects appeared only once it was implemented. The id grammar had
to be RELAXED to admit `_` inside a segment — §4.3's own worked example is
`uo.house.idoc_warning`, and two grammars over one namespace would mean an id
legal as a trigger and illegal as the stream it is the same event as. And the
seven grandfathered `uo.*` ids had to share their legacy allowlist with
triggers, because under one namespace `idoc.warning` is a single id. The push
catalog is untouched either way: allStreams() still serves the stream facet
only, so the shipped Android client sees exactly what it saw before.
THE CEILING LATTICE (G24), which the plan named everywhere and defined nowhere.
It is containment, not size: everyone ⊃ authenticated ⊃ {subscribers, members,
staff, owner}, with the four leaves mutually incomparable. The flat total order
the plan's wording invites would let a `staff`-ceilinged trigger be given an
`owner` audience — a rule that mails cheat detection to the player it detected.
Fewer people is not less exposure. Two incomparable ceilings have no meet at
all, so a composition is refused rather than guessed; union-widens is the
intuitive implementation and it is the wrong one.
`kind: 'event' | 'scheduled'` is declarable now and no evaluator exists (§7.1
Q6). Registration accepts `scheduled` and emit refuses to fire one, so `kind`
means something from the moment it can be written rather than from the moment
it is honoured.
Also: `GET /admin/engagement/{triggers,audiences}`, served from the registries
rather than a table so an uninstalled module simply stops appearing;
`npm run engagement:manifest` plus its CI `--check`, the twin of the route
manifest, because renaming a variable breaks stored templates silently, at send
time, in mail someone already received.
Co-Authored-By: Claude <noreply@anthropic.com>
212 lines
6.5 KiB
JSON
212 lines
6.5 KiB
JSON
{
|
|
"_comment": "Generated event-trigger inventory - the authoritative freeze of CORE's engagement contract (docs/website/ENGAGEMENT.md 4.3). Regenerate with `npm run engagement:manifest` in website/server. A renamed variable, a changed type or a widened ceiling breaks stored templates and rules, so the diff here is the review signal. A module ships its own copy in its bundle; this file never contains one.",
|
|
"moduleApiVersion": "1.7.0",
|
|
"triggers": [
|
|
{
|
|
"id": "news.post",
|
|
"owner": "core",
|
|
"label": "News post published",
|
|
"description": "A news / Five-on-Friday / newsletter post was published.",
|
|
"kind": "event",
|
|
"subjectKey": null,
|
|
"audience": "subscribers",
|
|
"ceiling": "authenticated",
|
|
"version": 1,
|
|
"variables": [
|
|
{
|
|
"name": "title",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Five on Friday — the Yew invasion",
|
|
"description": "The post title."
|
|
},
|
|
{
|
|
"name": "excerpt",
|
|
"type": "string",
|
|
"required": false,
|
|
"example": "Four new champion spawns, and the fate of the Yew moongate…",
|
|
"description": "A plain-text summary, already stripped of markup."
|
|
},
|
|
{
|
|
"name": "category",
|
|
"type": "string",
|
|
"required": false,
|
|
"example": "Five on Friday",
|
|
"description": "The post category, when it has one."
|
|
},
|
|
{
|
|
"name": "postUrl",
|
|
"type": "url",
|
|
"required": true,
|
|
"example": "/news/five-on-friday-yew-invasion",
|
|
"description": "Site-relative path to the post."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "team.announcement",
|
|
"owner": "core",
|
|
"label": "Team — announcement",
|
|
"description": "A leader posted an announcement in a Team.",
|
|
"kind": "event",
|
|
"subjectKey": "teamName",
|
|
"audience": "members",
|
|
"ceiling": "members",
|
|
"version": 1,
|
|
"variables": [
|
|
{
|
|
"name": "teamName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "The Silver Anvil",
|
|
"description": "The Team the event is about. Also the cooldown subject."
|
|
},
|
|
{
|
|
"name": "authorName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Marisol",
|
|
"description": "Display name of the leader who posted."
|
|
},
|
|
{
|
|
"name": "title",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Siege practice moved to Sunday",
|
|
"description": "The announcement title."
|
|
},
|
|
{
|
|
"name": "excerpt",
|
|
"type": "string",
|
|
"required": false,
|
|
"example": "We are moving practice to Sunday 8pm…",
|
|
"description": "Plain-text excerpt of the announcement body."
|
|
},
|
|
{
|
|
"name": "postUrl",
|
|
"type": "url",
|
|
"required": false,
|
|
"example": "/guilds/the-silver-anvil/forum/419",
|
|
"description": "Site-relative path to the announcement."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "team.forum.post",
|
|
"owner": "core",
|
|
"label": "Team — new forum post",
|
|
"description": "A new thread or reply in a Team forum.",
|
|
"kind": "event",
|
|
"subjectKey": "teamName",
|
|
"audience": "members",
|
|
"ceiling": "members",
|
|
"version": 1,
|
|
"variables": [
|
|
{
|
|
"name": "teamName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "The Silver Anvil",
|
|
"description": "The Team the event is about. Also the cooldown subject."
|
|
},
|
|
{
|
|
"name": "authorName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Darrow",
|
|
"description": "Display name of the poster."
|
|
},
|
|
{
|
|
"name": "threadTitle",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Tuesday champ rotation",
|
|
"description": "Title of the thread the post belongs to."
|
|
},
|
|
{
|
|
"name": "excerpt",
|
|
"type": "string",
|
|
"required": false,
|
|
"example": "Moving the Tuesday run an hour later…",
|
|
"description": "Plain-text excerpt of the post body, already stripped of markup."
|
|
},
|
|
{
|
|
"name": "postUrl",
|
|
"type": "url",
|
|
"required": false,
|
|
"example": "/guilds/the-silver-anvil/forum/412",
|
|
"description": "Site-relative path to the post."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "team.leadership.changed",
|
|
"owner": "core",
|
|
"label": "Team — leadership change",
|
|
"description": "Leadership changed in a Team.",
|
|
"kind": "event",
|
|
"subjectKey": "teamName",
|
|
"audience": "members",
|
|
"ceiling": "members",
|
|
"version": 1,
|
|
"variables": [
|
|
{
|
|
"name": "teamName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "The Silver Anvil",
|
|
"description": "The Team the event is about. Also the cooldown subject."
|
|
},
|
|
{
|
|
"name": "leaderName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Marisol",
|
|
"description": "Display name of the new leader."
|
|
},
|
|
{
|
|
"name": "teamUrl",
|
|
"type": "url",
|
|
"required": false,
|
|
"example": "/guilds/the-silver-anvil",
|
|
"description": "Site-relative path to the Team page."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "team.member.joined",
|
|
"owner": "core",
|
|
"label": "Team — new member",
|
|
"description": "Someone joined a Team.",
|
|
"kind": "event",
|
|
"subjectKey": "teamName",
|
|
"audience": "members",
|
|
"ceiling": "members",
|
|
"version": 1,
|
|
"variables": [
|
|
{
|
|
"name": "teamName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "The Silver Anvil",
|
|
"description": "The Team the event is about. Also the cooldown subject."
|
|
},
|
|
{
|
|
"name": "memberName",
|
|
"type": "string",
|
|
"required": true,
|
|
"example": "Darrow",
|
|
"description": "Display name of the member who joined."
|
|
},
|
|
{
|
|
"name": "teamUrl",
|
|
"type": "url",
|
|
"required": false,
|
|
"example": "/guilds/the-silver-anvil",
|
|
"description": "Site-relative path to the Team page. Absent when no module supplies a pageUrlTemplate."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|