feat(rust): chat titles, BetterChat group styles, the voice and popups (phase 17)

PLAN.md §33, D134-D143. Protocol 12.

- Chat titles (D135-D137): per-server rules (stat, top N, text, colour)
  that rank the current wipe, and a mode (first | all | up to N). Worked
  out once in model/titles and read three ways: pushed whole to the game by
  a new titleSync loop (on change, restart or wipe), and on every
  leaderboard row as `titles`. Admin: PUT /servers/:id/titles.
- Group styles (D138, D139): a site group may carry all twelve BetterChat
  fields (rust_perm_group_chat). They ride perm.sync with `expect` from the
  pushed ledger, which gains a value column; a field changed in game is a
  `chat-field` drift row with the game's value, adopted into the style or
  put back. A withdrawn style is one `chat-group` retirement, never for
  `default`, cleared from the ledger only once BetterChat removed it.
- The voice (D140): one fleet setting naming a styled group; news and
  rust.announce chat lines carry its format and the plugin says them with
  no sender. Admin: GET/PUT /voice.
- Popups (D141, D142): rust.announce gains `delivery` (still version 1,
  from rust.options.delivery); each server gains news_delivery beside the
  news switch; `popup-unavailable` is not retried.
- GET /servers/:id/integrations reads, live, which optional mods a server
  has loaded. README lists BetterChat and PopupNotifications as optional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-09-25 17:48:22 -05:00
parent fb5a581a94
commit 1b70cef5be
43 changed files with 3371 additions and 72 deletions

View File

@@ -67,7 +67,9 @@ const TIMEOUT_MS = 12000
* `/tally/close`, `/kits` and `/chat`, and a `credits` field on the permission
* sync (PLAN.md §29); **11** adds the map — `/map`, `/map/chunk`,
* `/map/render` and `/map/live`, its picture and what moves on it (PLAN.md
* §30). The bump lands here in the same change as the emitters,
* §30); **12** adds `/titles`, the chat titles BetterChat shows, and gives a
* permission sync a group's BetterChat style and a chat line a delivery and a
* voice (PLAN.md §33). The bump lands here in the same change as the emitters,
* because the sidecar refuses a client declaring a different version with a
* `409`: a module left on 2 would stop being able to read the server board it
* has been reading all along. A constant that lags the deployment is not a safe
@@ -77,7 +79,7 @@ const TIMEOUT_MS = 12000
* deployment into a `409` naming both numbers instead of a parse failure three
* layers further in.
*/
const PROTOCOL_VERSION = 11
const PROTOCOL_VERSION = 12
/** What a caller gets back. Shaped once so every call site reads the same. */
function reply(ok, status, data = null) {
@@ -388,6 +390,12 @@ const kits = (server) => request(server, '/kits')
*/
const chat = (server, body) => request(server, '/chat', { method: 'POST', body })
/**
* Replace the chat titles a server's plugin holds (protocol 12). Whole, so a
* retry is harmless; `titles.ok` says whether BetterChat is there to show them.
*/
const titles = (server, body) => request(server, '/titles', { method: 'POST', body })
/**
* What one server's map is and where its picture comes from (protocol 11,
* stage one): `mapKey`, `source` (`companion`, `rendered` or `none`), the
@@ -449,6 +457,7 @@ module.exports = {
tallyClose,
kits,
chat,
titles,
mapInfo,
mapChunk,
mapRender,